# import cgitb cgitb.enable() import monobook2 content = """\ <h1>Bots running here</h1> <ul> <li><a href="http://en.wikipedia.org/wiki/User:Legobot">Legobot</a></li> <li><a href="http://en.wikipedia.org/wiki/User:Legobot II">Legobot II</a></li> <li><a href="http://en.wikipedia.org/wiki/User:Legobot III">Legobot III</a></li> <li><i><a href="http://en.wikipedia.org/wiki/User:ArticleAlertbot">ArticleAlertbot</a> -- <i>Inactive</i></li> </ul> <h1>Tools</h1> <ul> <li><a href="http://toolserver.org/~legoktm/cgi-bin/count.py">Raw edit counter</a></li> <li><a href="http://toolserver.org/~legoktm/alertbot.html">Alertbot status</a></li> <li><a href="http://toolserver.org/~legoktm/cgi-bin/reflinks.py">Template filler</a></li> </ul> <!--<h2>Beta Tools</h2> <ul> </ul>--> """ page = monobook2.Page('~legoktm', '/~legoktm/cgi-bin/index.py') print page.top() print page.body(content) print page.footer() #print monobook.header('~legoktm') #print monobook.body(content) #print monobook.navbar() #print monobook.footer()
#!/usr/bin/python # # (C) Legoktm 2008-2011, MIT License # import cgitb; cgitb.enable() import cgi import MySQLdb import monobook2 print "Content-Type: text/html\n" def getdb(): db = MySQLdb.connect(db='toolserver', host="sql", read_default_file="/home/legoktm/.my.cnf") cur = db.cursor() cur.execute("SELECT domain, dbname, server FROM `wiki`") res = cur.fetchall() text = '' for i in res: text += res[0] + ' (' + res[1] + ') on sql-s' + str(res[2]) +'\n' return text page = monobook2.Page('Server List','/~legoktm/cgi-bin/servers.py') text = getdb() print text
#!/usr/bin/python # # (C) Legoktm 2008-2011, MIT License # import cgitb cgitb.enable() import cgi, sys, urllib2, re, time import monobook2, BeautifulSoup print "Content-Type: text/html\n" page = monobook2.Page('Template filler', '/~legoktm/cgi-bin/reflinks.py') months = { '1': '01', '2': '02', '3': '03', '4': '04', '5': '05', '6': '06', '7': '07', '8': '08', '9': '09', '10': '10', '11': '11', '12': '12', } subpagelink = '<div id="contentSub"><span class="subpages">< <a href="http://toolserver.org/~legoktm/cgi-bin/reflinks.py" title="reflinks.py">Template filler</a></span></div>' def gettitle(url, errorrep=False): try:
cur.close() return res def getdb(wiki): db = MySQLdb.connect(db='toolserver', host="sql", read_default_file="/home/legoktm/.my.cnf") cur = db.cursor() cur.execute( "SELECT dbname, server FROM `wiki` WHERE domain = '%s' LIMIT 1" % wiki) res = cur.fetchall()[0] return [res[0], 's' + str(res[1])] page = monobook2.Page('Raw edit counter', '/~legoktm/cgi-bin/count.py') username = page.getValue('username') if username: wiki = page.getValue('wiki') dbset = getdb(wiki) editcount = count(username, dbset[0], dbset[1]) print editcount else: content = """\ <form name="input" action="/~legoktm/cgi-bin/count.py" method="get"> Username: <input type="text" name="username"> <br />
#!/usr/bin/python # # (C) Legoktm 2008-2011, MIT License # import cgitb cgitb.enable() import cgi, sys, urllib2, re, time import monobook2, BeautifulSoup import pywikibot print "Content-Type: text/html\n" page = monobook2.Page('Watchlist Filter-er', '/~legoktm/cgi-bin/watchlist.py') input_content = """\ <form name="input" action="/~legoktm/cgi-bin/watchlist.py" method="POST"> Wiki: <input type="text" name="wiki"> (Example: en.wikipedia.org) <textarea name="watchlist">Copy/paste your entire raw-watchlist here. Delete these two lines first.</textarea> <br /><br /> <input type="submit" value="Filter Watchlist"> </form> """ def parse_site(url): if url == 'commons.wikimedia.org': return pywikibot.Site('commons', 'commons') split = url.split('.') if len(split) != 3: return pywikibot.Site() try:
def fullcontent(content): page = monobook2.Page('SVN Updater', '/~legoktm/cgi-bin/svnup.py') print page.top() print page.body(content) print page.footer()