aboutsummaryrefslogtreecommitdiff
path: root/cgi/manage.py
diff options
context:
space:
mode:
Diffstat (limited to 'cgi/manage.py')
-rw-r--r--cgi/manage.py120
1 files changed, 35 insertions, 85 deletions
diff --git a/cgi/manage.py b/cgi/manage.py
index 5634a49..d1de264 100644
--- a/cgi/manage.py
+++ b/cgi/manage.py
@@ -850,6 +850,7 @@ def manage(self, path_split):
else:
template_filename = "changepassword.html"
template_values = {}
+
elif path_split[2] == 'board':
if not administrator:
return
@@ -1102,6 +1103,22 @@ def manage(self, path_split):
# List all boards
template_filename = "boardoptions.html"
template_values = {'mode': 0, 'boards': boardlist()}
+
+ elif path_split[2] == 'boardlock':
+ board = setBoard(path_split[3])
+ if int(board['locked']):
+ # Si esta cerrado... abrir
+ board['locked'] = 0
+ updateBoardSettings()
+ message = _('Board opened successfully.')
+ template_filename = "message.html"
+ else:
+ # Si esta abierta, cerrar
+ board['locked'] = 1
+ updateBoardSettings()
+ message = _('Board closed successfully.')
+ template_filename = "message.html"
+
elif path_split[2] == 'recyclebin':
if not administrator:
return
@@ -1259,32 +1276,7 @@ def manage(self, path_split):
'posts': posts,
'navigator': navigator})
# End recyclebin
- elif path_split[2] == 'lockboard':
- if not administrator:
- return
- try:
- board_dir = path_split[3]
- except:
- board_dir = ''
-
- if board_dir == '':
- template_filename = "lockboard.html"
- template_values = {'boards': boardlist()}
- elif path_split[2] == 'boardlock':
- board = setBoard(path_split[3])
- if int(board['locked']):
- # Si esta cerrado... abrir
- board['locked'] = 0
- updateBoardSettings()
- message = _('Board opened successfully.')
- template_filename = "message.html"
- else:
- # Si esta abierta, cerrar
- board['locked'] = 1
- updateBoardSettings()
- message = _('Board closed successfully.')
- template_filename = "message.html"
elif path_split[2] == 'addboard':
if not administrator:
return
@@ -1365,18 +1357,7 @@ def manage(self, path_split):
self.output = "done " + sql
return
- elif path_split[2] == 'fixflood':
- if not administrator:
- return
-
- board = setBoard('zonavip')
- threads = FetchAll(
- "SELECT * FROM posts WHERE boardid = %s AND parentid = 0 AND subject LIKE 'querido mod%%'" % board['id'])
-
- for thread in threads:
- self.output += "%s<br>" % thread['id']
- #deletePost(thread['id'], None)
- return
+
elif path_split[2] == 'fixico':
if not administrator:
return
@@ -1494,39 +1475,6 @@ def manage(self, path_split):
self.output = "done"
return
- elif path_split[2] == 'sepid':
- if not administrator:
- return
-
- #sql = 'update posts set posterid = \'\''
- #UpdateDb(sql)
-
- board = setBoard(path_split[3])
- #posts = FetchAll('SELECT * FROM `posts` WHERE `boardid` = %s LIMIT 5' % board['id'])
- #for post in posts:
- # self.output += str(post)
-
- #return
-
- posts = FetchAll('SELECT * FROM `posts` WHERE `boardid` = %s' % board['id'])
-
- for post in posts:
- if not post['posterid']:
- splitted = post['timestamp_formatted'].split(' ID:')
-
- self.output += splitted[0] + '<br>'
-
- idhash = ''
- if len(splitted) > 1:
- self.output += splitted[1]
- idhash = splitted[1]
-
- self.output += '<hr>'
-
- sql = "update posts set timestamp_formatted = '%s', posterid = '%s' where boardid = '%s' and id = '%s'" % (splitted[0], idhash, board['id'], post['id'])
- UpdateDb(sql)
-
- return
elif path_split[2] == 'fixid':
if not administrator:
@@ -1544,6 +1492,7 @@ def manage(self, path_split):
self.output = "total: %d<br />" % len(posts)
return
+
elif path_split[2] == 'fixname':
return
board = setBoard(path_split[3])
@@ -1558,19 +1507,7 @@ def manage(self, path_split):
new_name, board['id'], post['id'])
UpdateDb(query)
return
- elif path_split[2] == 'setsub':
- if not administrator:
- return
-
- board = setBoard(path_split[3])
- thread = FetchOne(
- 'SELECT * FROM `posts` WHERE `parentid` = 0 AND `boardid` = %s' % board['id'])
- subject = str(path_split[4])
- self.output = subject + "->" + thread['id'] + "<br />"
- query = "UPDATE `posts` SET `subject` = '%s' WHERE boardid = '%s' AND id = '%s'" % (
- subject, board['id'], thread['id'])
- UpdateDb(query)
- return
+
elif path_split[2] == 'fixlength':
if not administrator:
return
@@ -1585,6 +1522,7 @@ def manage(self, path_split):
self.output = 'done'
return
+
elif path_split[2] == 'archive':
if not administrator:
return
@@ -1594,6 +1532,7 @@ def manage(self, path_split):
postid = int(path_split[4])
archiveThread(postid)
self.output = "todo ok %s" % str(time.time() - t)
+
elif path_split[2] == 'filters':
action_taken = False
if len(path_split) > 3 and path_split[3] == 'add':
@@ -1813,6 +1752,7 @@ def manage(self, path_split):
template_filename = "filters.html"
template_values = {'mode': 0, 'filters': filters}
+
elif path_split[2] == 'logs':
if staff_account['rights'] not in [0, 2]:
return
@@ -1824,12 +1764,14 @@ def manage(self, path_split):
log['timestamp'])
template_filename = "logs.html"
template_values = {'logs': logs}
+
elif path_split[2] == 'logout':
message = _('Logging out...') + '<meta http-equiv="refresh" content="0;url=' + \
Settings.CGI_URL + 'manage" />'
deleteCookie(self, 'weabot_manage')
deleteSession(staff_account['session_id'])
template_filename = "message.html"
+
elif path_split[2] == 'quotes':
# Quotes for the post screen
if "save" in self.formdata:
@@ -1851,6 +1793,7 @@ def manage(self, path_split):
except:
message = 'Error al leer datos.'
template_filename = 'message.html'
+
elif path_split[2] == 'recent_images':
try:
if int(self.formdata['images']) > 256:
@@ -1859,9 +1802,10 @@ def manage(self, path_split):
images = self.formdata['images']
posts = FetchAll('SELECT * FROM `posts` INNER JOIN `boards` ON boardid = boards.id WHERE CHAR_LENGTH(`thumb`) > 0 ORDER BY `timestamp` DESC LIMIT %s' % (images) )
except:
- posts = FetchAll('SELECT * FROM `posts` INNER JOIN `boards` ON boardid = boards.id WHERE CHAR_LENGTH(`thumb`) > 0 ORDER BY `timestamp` DESC LIMIT 32')
+ posts = FetchAll('SELECT * FROM `posts` INNER JOIN `boards` ON boardid = boards.id WHERE CHAR_LENGTH(`thumb`) > 0 ORDER BY `timestamp` DESC LIMIT 64')
template_filename = "recent_images.html"
template_values = {'posts': posts}
+
elif path_split[2] == 'news':
if not administrator:
return
@@ -1978,6 +1922,7 @@ def manage(self, path_split):
template_filename = "news.html"
template_values = {'action': 'newschannel', 'posts': posts}
+
elif path_split[2] == 'reports':
if not moderator:
return
@@ -2073,7 +2018,7 @@ def manage(self, path_split):
'currentpage': currentpage,
'curboard': curboard,
'navigator': navigator}
- # Show by IP
+
elif path_split[2] == 'ipshow':
if not moderator:
return
@@ -2092,6 +2037,7 @@ def manage(self, path_split):
# Generate form
template_filename = "ipshow.html"
template_values = {"mode": 0}
+
elif path_split[2] == 'ipdelete':
if not moderator:
return
@@ -2173,6 +2119,7 @@ def manage(self, path_split):
# Show form
template_filename = "ipdelete.html"
template_values = {'boards': boardlist()}
+
elif path_split[2] == 'goto':
board = setBoard(path_split[3])
@@ -2188,6 +2135,7 @@ def manage(self, path_split):
url = "/%s/res/%s.html" % (board['dir'], pid)
self.output = '<meta http-equiv="refresh" content="0;url=%s" />' % url
+
elif path_split[2] == 'fixquote':
# when a mod deletes a post permanently messing with quote numbers
if not administrator:
@@ -2224,6 +2172,7 @@ def manage(self, path_split):
# reflect changes
threadUpdated(parent)
+
elif path_split[2] == 'search':
if not administrator:
return
@@ -2239,6 +2188,7 @@ def manage(self, path_split):
log['archive'] = False
template_filename = "search.html"
template_values = {'search': search_logs}
+
else:
# Main page.
reports = FetchOne("SELECT COUNT(1) AS 'count' FROM `reports`")["count"]