echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"center\">", form_submit("approve", gettext("Approve")), " ", form_submit("delete", gettext("Delete")), " ", form_submit("cancel", gettext("Cancel")), "</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo "</form>\n"; echo "</div>\n"; html_draw_bottom(); } else { html_draw_error(gettext("That post does not exist in this thread!"), 'admin_post_approve.php', 'post', array('cancel' => gettext("Cancel")), array('ret' => $ret), '_self', 'center'); } } else { html_draw_top(sprintf('title=%s', gettext("Admin - Post Approval Queue")), 'class=window_title'); $post_approval_array = admin_get_post_approval_queue($page); echo "<h1>", gettext("Admin"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("Post Approval Queue"), "</h1>\n"; if (sizeof($post_approval_array['post_array']) < 1) { html_display_warning_msg(gettext("No posts are awaiting approval"), '86%', 'center'); } echo "<br />\n"; echo "<div align=\"center\">\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"86%\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n"; echo " <table class=\"posthead\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td class=\"subhead\" align=\"left\" width=\"20\"> </td>\n";
function admin_get_post_approval_queue($page = 1) { if (!($db = db::get())) { return false; } if (!is_numeric($page) || $page < 1) { $page = 1; } $offset = calculate_page_offset($page, 10); if (!($table_prefix = get_table_prefix())) { return false; } if ($folder_list = session::get_folders_by_perm(USER_PERM_FOLDER_MODERATE)) { $fidlist = implode(',', $folder_list); } $post_approval_array = array(); $sql = "SELECT SQL_CALC_FOUND_ROWS FOLDER.TITLE AS FOLDER_TITLE, "; $sql .= "TRIM(CONCAT_WS(' ', COALESCE(FOLDER.PREFIX, ''), THREAD.TITLE)) AS TITLE, "; $sql .= "USER.UID, USER.LOGON, USER.NICKNAME, UNIX_TIMESTAMP(POST.CREATED) AS CREATED, "; $sql .= "CONCAT(POST.TID, '.', POST.PID) AS MSG FROM `{$table_prefix}POST` POST "; $sql .= "LEFT JOIN USER USER ON (USER.UID = POST.FROM_UID) "; $sql .= "LEFT JOIN `{$table_prefix}THREAD` THREAD ON (THREAD.TID = POST.TID) "; $sql .= "LEFT JOIN `{$table_prefix}FOLDER` FOLDER ON (FOLDER.FID = THREAD.FID) "; $sql .= "WHERE POST.APPROVED IS NULL AND THREAD.FID IN ({$fidlist}) "; $sql .= "LIMIT {$offset}, 10"; if (!($result = $db->query($sql))) { return false; } // Fetch the number of total results $sql = "SELECT FOUND_ROWS() AS ROW_COUNT"; if (!($result_count = $db->query($sql))) { return false; } list($post_count) = $result_count->fetch_row(); if ($result->num_rows == 0 && $post_count > 0 && $page > 1) { return admin_get_post_approval_queue($page - 1); } while ($post_array = $result->fetch_assoc()) { $post_approval_array[] = $post_array; } return array('post_count' => $post_count, 'post_array' => $post_approval_array); }