aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Choom 2023-01-26 01:48:46 -0300
committerLibravatar Choom 2023-01-26 01:54:30 -0300
commit198becec5eb7c6e7827700afb4cc9b6cb1c1b2a8 (patch)
tree9da42f4862cde372002b9fc3512062f30cfaa8c2
parente396b01348126c1b8d5c3a93cb90bc309046f8e7 (diff)
downloadweabot-198becec5eb7c6e7827700afb4cc9b6cb1c1b2a8.tar.gz
weabot-198becec5eb7c6e7827700afb4cc9b6cb1c1b2a8.tar.xz
weabot-198becec5eb7c6e7827700afb4cc9b6cb1c1b2a8.zip
Agregando lockboard a boards
-rw-r--r--cgi/manage.py120
-rw-r--r--cgi/templates/manage/boardoptions.html16
-rw-r--r--cgi/templates/manage/lockboard.html20
-rw-r--r--cgi/templates/manage/menu.html95
-rw-r--r--cgi/templates/manage/recent_images.html30
5 files changed, 138 insertions, 143 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"]
diff --git a/cgi/templates/manage/boardoptions.html b/cgi/templates/manage/boardoptions.html
index 4e33e5b..7e57320 100644
--- a/cgi/templates/manage/boardoptions.html
+++ b/cgi/templates/manage/boardoptions.html
@@ -5,9 +5,19 @@
<div class="replymode">Opciones de Board</div>
<?py if mode == 0: ?>
<table class="managertable">
- <tr><th colspan="2">Sección</th><th>Accion</th></tr>
+ <tr>
+ <th colspan="2">Sección</th>
+ <th>Acciones</th>
+ </tr>
<?py for board in boards: ?>
- <tr><td>/#{board['dir']}/</td><td>#{board['name']}</td><td>[<a href="#{cgi_url}manage/board/#{board['dir']}">Configurar</a>]</td></tr>
+ <tr>
+ <td>/#{board['dir']}/</td>
+ <td>#{board['name']}</td>
+ <td style="white-space:nowrap">
+ [<a href="#{cgi_url}manage/board/#{board['dir']}">Configurar</a>]
+ [<a href="#{cgi_url}manage/boardlock/#{board['dir']}">#{'Abrir' if board['locked'] else 'Cerrar'}</a>]
+ </td>
+ </tr>
<?py #endfor ?>
</table>
<?py elif mode == 1: ?>
@@ -192,4 +202,4 @@
<?py #endif ?>
</center>
<hr />
-<?py include('templates/base_bottom.html') ?> \ No newline at end of file
+<?py include('templates/base_bottom.html') ?>
diff --git a/cgi/templates/manage/lockboard.html b/cgi/templates/manage/lockboard.html
deleted file mode 100644
index 49559f6..0000000
--- a/cgi/templates/manage/lockboard.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<?py include('templates/base_top.html') ?>
-<?py include('templates/manage/menu.html') ?>
-<center>
-<div class="replymode">Cerrar o abrir board</div>
-<table class="managertable">
- <tr>
- <th colspan="2">Sección</th>
- <th>Acción</th>
- </tr>
- <?py for board in boards: ?>
- <tr>
- <td>#{board['dir']}</td>
- <td>#{board['name']}</td>
- <td style="text-align:center;">[<a href="#{cgi_url}manage/boardlock/#{board['dir']}">#{'Abrir' if board['locked'] else 'Cerrar'}</a>]</td>
- </tr>
- <?py #endfor ?>
-</table>
-</center>
-<hr />
-<?py include('templates/base_bottom.html') ?>
diff --git a/cgi/templates/manage/menu.html b/cgi/templates/manage/menu.html
index e0d28fa..000ec2f 100644
--- a/cgi/templates/manage/menu.html
+++ b/cgi/templates/manage/menu.html
@@ -2,28 +2,75 @@
<script type="text/javascript" src="/static/js/manage.js"></script>
<input type="hidden" name="board" value="" />
<?py if int(rights) < 4: ?>
-<div id="adminmenu">¡Bienvenido, <b><acronym title="Cuenta creada el #{added}">#{username}</acronym></b>! ¡Eres
-<?py if rights == '0': ?><b>Accionista</b>
-<?py elif rights == '1': ?><b>Accionista</b>
-<?py elif rights == '2': ?><span class="developer">Developer</span>
-<?py elif rights == '3': ?><span class="moderator">Moderador</span>
-<?py #endif ?> de #{site_title}!<br />
-<center>
-<table class="reply">
-<tr><td>Principal:</td>
-<td>- <a href="#{cgi_url}manage">Inicio</a> - <a href="#{cgi_url}manage/changepassword">Cambiar contrase&ntilde;a</a> - <a href="#{cgi_url}manage/newschannel">News Channel</a> - <a href="//webmail.bienvenidoainternet.org">Correo</a> - <a href="#{cgi_url}manage/logout">Cerrar sesi&oacute;n</a> -</td></tr>
-<tr><td>Posts:</td>
-<td>- <a href="#{cgi_url}manage/mod">Modbrowse</a> - <a href="#{cgi_url}manage/ipshow">Ver por IP</a> - <a href="#{cgi_url}manage/recyclebin">Papelera de reciclaje</a> - <a href="#{cgi_url}manage/recent_images">Im&aacute;genes recientes</a> - <a href="#{cgi_url}manage/recent">Posts recientes</a> -</td></tr>
-<tr><td>Moderaci&oacute;n:</td>
-<td>- <a href="#{cgi_url}manage/reports">Denuncias</a> - <a href="#{cgi_url}manage/ipdelete">Eliminar por IP</a> - <a href="#{cgi_url}manage/bans">Lista de bans</a> - <a href="#{cgi_url}manage/move">Mover hilo</a> - <a href="#{cgi_url}manage/filters">Filtros</a> - <a href="#{cgi_url}manage/quotes">Frases</a> -</td></tr>
-<?py if int(rights) < 3: ?>
-<tr><td>Administraci&oacute;n:</td>
-<td>- <a href="#{cgi_url}manage/rebuild">Reconstruir</a> - <a href="#{cgi_url}manage/news?type=1">Noticias</a> - <a href="#{cgi_url}manage/news?type=2">Twitter</a> - <a href="#{cgi_url}manage/board">Opciones de board</a> - <a href="#{cgi_url}manage/addboard">Agregar board</a> - <a href="#{cgi_url}manage/lockboard">Cerrar board</a> -</td></tr>
-<?py if int(rights) in [0,2]: ?>
-<tr><td>Staff:</td>
-<td>- <a href="#{cgi_url}manage/staff">Miembros</a> - <a href="#{cgi_url}manage/logs">Registro de acciones</a> -</td></tr>
-<?py #endif ?>
-<?py #endif ?>
-</table></center></div>
+<div id="adminmenu">
+ ¡Bienvenido, <b><acronym title="Cuenta creada el #{added}">#{username}</acronym></b>! ¡Eres
+ <?py if rights == '0': ?><b>Accionista</b>
+ <?py elif rights == '1': ?><b>Accionista</b>
+ <?py elif rights == '2': ?><span class="developer">Developer</span>
+ <?py elif rights == '3': ?><span class="moderator">Moderador</span>
+ <?py #endif ?> de #{site_title}!<br />
+ <center>
+ <table class="reply">
+ <tr>
+ <td>Principal:</td>
+ <td>
+ - <a href="#{cgi_url}manage">Inicio</a>
+ - <a href="#{cgi_url}manage/changepassword">Cambiar contrase&ntilde;a</a>
+ - <a href="#{cgi_url}manage/newschannel">News Channel</a>
+ - <a href="//webmail.bienvenidoainternet.org">Correo</a>
+ - <a href="#{cgi_url}manage/logout">Cerrar sesi&oacute;n</a>
+ -
+ </td>
+ </tr>
+ <tr>
+ <td>Posts:</td>
+ <td>
+ - <a href="#{cgi_url}manage/mod">Modbrowse</a>
+ - <a href="#{cgi_url}manage/ipshow">Ver por IP</a>
+ - <a href="#{cgi_url}manage/recyclebin">Papelera</a>
+ - <a href="#{cgi_url}manage/basural">Basural</a>
+ - <a href="#{cgi_url}manage/recent_images">Im&aacute;genes</a>
+ - <a href="#{cgi_url}manage/recent">Posts recientes</a>
+ -
+ </td>
+ </tr>
+ <tr>
+ <td>Moderaci&oacute;n:</td>
+ <td>
+ - <a href="#{cgi_url}manage/reports">Denuncias</a>
+ - <a href="#{cgi_url}manage/ipdelete">Eliminar por IP</a>
+ - <a href="#{cgi_url}manage/bans">Lista de bans</a>
+ - <a href="#{cgi_url}manage/move">Mover hilo</a>
+ - <a href="#{cgi_url}manage/filters">Filtros</a>
+ - <a href="#{cgi_url}manage/quotes">Frases</a>
+ -
+ </td>
+ </tr>
+ <?py if int(rights) < 3: ?>
+ <tr>
+ <td>Administraci&oacute;n:</td>
+ <td>
+ - <a href="#{cgi_url}manage/rebuild">Reconstruir</a>
+ - <a href="#{cgi_url}manage/news?type=1">Noticias</a>
+ - <a href="#{cgi_url}manage/news?type=2">Twitter</a>
+ - <a href="#{cgi_url}manage/board">Opciones de board</a>
+ - <a href="#{cgi_url}manage/addboard">Agregar board</a>
+ -
+ </td>
+ </tr>
+ <?py if int(rights) in [0,2]: ?>
+ <tr>
+ <td>Staff:</td>
+ <td>
+ - <a href="#{cgi_url}manage/staff">Miembros</a>
+ - <a href="#{cgi_url}manage/logs">Registro de acciones</a>
+ -
+ </td>
+ </tr>
+ <?py #endif ?>
+ <?py #endif ?>
+ </table>
+ </center>
+</div>
<hr />
-<?py #endif ?> \ No newline at end of file
+<?py #endif ?>
diff --git a/cgi/templates/manage/recent_images.html b/cgi/templates/manage/recent_images.html
index 39f919c..1071eeb 100644
--- a/cgi/templates/manage/recent_images.html
+++ b/cgi/templates/manage/recent_images.html
@@ -1,24 +1,32 @@
<?py include('templates/base_top.html') ?>
<?py include('templates/manage/menu.html') ?>
-<style>.imgs{font-size:0;}.imgs img{vertical-align:top;margin:2px;height:150px;width:auto;}</style>
+<style>
+ .imgs {font-size:0;}
+ .imgs img {vertical-align:top;margin:2px;height:150px;width:auto;}
+</style>
<center>
<div class="replymode">Imágenes recientes</div>
<form action="#{cgi_url}manage/recent_images" name="recent_images" method="post">
<table>
- <tr><td class="postblock">Número a mostrar</td><td><input type="text" name="images" size="4" /></td></tr>
- <tr><td colspan="2"><input type="submit" style="width:100%;" value="Enviar" /></td></tr>
+ <tr>
+ <td class="postblock">Número a mostrar</td>
+ <td><input type="text" name="images" size="4" /></td>
+ </tr>
+ <tr>
+ <td colspan="2"><input type="submit" style="width:100%;" value="Enviar" /></td>
+ </tr>
</table>
</form>
<hr />
<div class="imgs">
-<?py for post in posts: ?>
- <?py if post['parentid'] != '0': ?>
- <a href="/#{post['dir']}/res/#{post['parentid']}.html##{post['id']}"><img src="#{boards_url}#{post['dir']}/thumb/#{post['thumb']}" /></a>
- <?py else: ?>
- <a href="/#{post['dir']}/res/#{post['id']}.html##{post['id']}"><img src="#{boards_url}#{post['dir']}/thumb/#{post['thumb']}" /></a>
- <?py #endif ?>
-<?py #endfor ?>
+ <?py for post in posts: ?>
+ <?py if post['parentid'] != '0': ?>
+ <a href="/#{post['dir']}/res/#{post['parentid']}.html##{post['id']}"><img src="#{boards_url}#{post['dir']}/thumb/#{post['thumb']}" /></a>
+ <?py else: ?>
+ <a href="/#{post['dir']}/res/#{post['id']}.html##{post['id']}"><img src="#{boards_url}#{post['dir']}/thumb/#{post['thumb']}" /></a>
+ <?py #endif ?>
+ <?py #endfor ?>
</div>
</center>
<hr />
-<?py include('templates/base_bottom.html') ?> \ No newline at end of file
+<?py include('templates/base_bottom.html') ?>