diff options
Diffstat (limited to 'cgi')
-rw-r--r-- | cgi/templates/manage/reports.html | 81 | ||||
-rwxr-xr-x | cgi/weabot.py | 19 |
2 files changed, 56 insertions, 44 deletions
diff --git a/cgi/templates/manage/reports.html b/cgi/templates/manage/reports.html index 6095d50..f3ea5c5 100644 --- a/cgi/templates/manage/reports.html +++ b/cgi/templates/manage/reports.html @@ -2,23 +2,27 @@ <?py include('templates/manage/menu.html') ?> <?py from tenjin.helpers.html import * ?> <center> -<div class="replymode">Reportes</div> +<div class="replymode">Denuncias</div> <?py if message: ?> +<hr /> ${message} +<hr /> <?py #endif ?> + <form name="boardForm" method="get" action="#{cgi_url}manage/reports/0"> <table> - <tr> - <td class="postblock">Board</td> - <td> - <select name="board"> - <option value="all">Todos los boards</option> -<?py for board in boards: ?> - <option value="#{board['dir']}"#{selected(board['checked'])}>#{board['dir']} - #{board['name']}</option> -<?py #endfor ?> - </select> - <td><input type="submit" value="Mostrar" /></td> - </td></tr> + <tr> + <td class="postblock">Board</td> + <td> + <select name="board"> + <option value="all">Todos los boards</option> + <?py for board in boards: ?> + <option value="#{board['dir']}"#{selected(board['checked'])}>#{board['dir']} - #{board['name']}</option> + <?py #endfor ?> + </select> + </td> + <td><input type="submit" value="Mostrar" /></td> + </tr> </table> </form> @@ -28,31 +32,38 @@ ${message} <?py #endif ?> <hr /> <table class="managertable"> -<tr> - <th></th> - <th></th> - <th>Fecha</th> - <th>Post</th> - <th>IP Post</th> - <th>Razón</th> - <th>IP Denuncia</th> -</tr> -<?py for report in reports: ?> -<tr> - <td> <a href="#{cgi_url}manage/reports/#{currentpage}/ignore/#{report['id']}">X</a> </td> - <td><input type="checkbox" name="i#{report['id']}" id="i#{report['id']}" value="1" /><label for="i#{report['id']}"></label></td> - <td class="date" data-unix="${report['timestamp']}">${report['timestamp_formatted']}</td> - <td><a href="#{report['link']}">${report['link']}</a></td> - <td><a href="#{cgi_url}manage/ipshow?ip=${report['ip']}">${report['ip']}</a></td> - <td>${report['reason']}</td> - <td><a href="#{cgi_url}manage/ipshow?ip=${report['repip']}">${report['repip']}</a></td> -</tr> -<?py #endfor ?> -<tr> - <td colspan="8" style="text-align:center;"><input name="ignore" type="submit" value="Ignorar seleccionados" /></td> -</tr> +<?py if reports: ?> + <tr> + <th></th> + <th></th> + <th>Fecha</th> + <th>Post</th> + <th>IP Post</th> + <th>Razón</th> + <th>IP Denuncia</th> + </tr> + <?py for report in reports: ?> + <tr> + <td><a href="#{cgi_url}manage/reports/#{currentpage}/ignore/#{report['id']}">X</a></td> + <td><input type="checkbox" name="i#{report['id']}" id="i#{report['id']}" value="1" /><label for="i#{report['id']}"></label></td> + <td class="date" data-unix="${report['timestamp']}">${report['timestamp_formatted']}</td> + <td><a href="#{report['link']}">${report['link']}</a></td> + <td><a href="#{cgi_url}manage/ipshow?ip=${report['ip']}">${report['ip']}</a></td> + <td>${report['reason']}</td> + <td><a href="#{cgi_url}manage/ipshow?ip=${report['repip']}">${report['repip']}</a></td> + </tr> + <?py #endfor ?> + <tr> + <td colspan="8" style="text-align:center;"><input name="ignore" type="submit" value="Ignorar seleccionados" /></td> + </tr> +<?py else: ?> + <tr> + <td style='font-size:larger;font-style:italic;'>No hay denuncias.</td> + </tr> +<?py #endif ?> </table> </form> + </center> <hr /> <?py include('templates/base_bottom.html') ?> diff --git a/cgi/weabot.py b/cgi/weabot.py index ff6debc..f032e20 100755 --- a/cgi/weabot.py +++ b/cgi/weabot.py @@ -931,7 +931,7 @@ class weabot(object): # if there's not a reason, show the report page if reason is None: self.output += renderTemplate("report.html", - {'finished': False, 'postshow': postshow, 'txt': txt}) + {'finished': False, 'postshow': postshow, 'txt': txt}) return # check reason @@ -951,19 +951,20 @@ class weabot(object): raise UserError(_("You're banned.")) # check if post exists - post = FetchOne("SELECT `id`, `parentid`, `ip` FROM `posts` WHERE `id` = %s AND `boardid` = %s", - (postid, board['id'])) + post = FetchOne("SELECT `id`, `parentid`, `ip`, `timestamp` FROM `posts` WHERE `id` = %s AND `boardid` = %s LIMIT 1", (postid, board['id']) ) if not post: - raise UserError(_("Post doesn't exist.")) + raise UserError(_("Post doesn't exist.")) # generate link if board["board_type"] == 1: - parent_post = get_parent_post(post["parentid"], board["id"]) - link = "/%s/read/%s/%s" % (board["dir"], - parent_post["timestamp"], postshow) + if post['parentid']: + parent_post = FetchOne("SELECT id, timestamp FROM posts WHERE id = %s AND boardid = %s LIMIT 1", (post["parentid"], board["id"]) ) + else: + parent_post = post + + link = "/%s/read/%s/%s" % (board["dir"], parent_post["timestamp"], postshow) else: - link = "/%s/res/%d.html#%d" % (board["dir"], int( - post["parentid"]) or int(post["id"]), int(post["id"])) + link = "/%s/res/%s.html#%s" % (board["dir"], post["parentid"] or post["id"], post["id"]) # insert report t = time.time() |