/** * Main function of plugin * * @param object $bBlog Instance of bBlog object * @return void * */ function admin_plugin_comments_run(&$bBlog) { // Again, the plugin API needs work. $commentAmount = 50; if (isset($_GET['commentdo'])) { $commentdo = $_GET['commentdo']; } elseif (isset($_POST['commentdo'])) { $commentdo = $_POST['commentdo']; } else { $commentdo = ""; } switch ($commentdo) { case "Delete": // delete comments if (is_array($_POST['commentid'])) { foreach ($_POST['commentid'] as $key => $val) { deleteComment(&$bBlog, $val); } } break; case "Edit": $commentid = intval($_GET['editComment']); $postid = intval($_GET['postid']); editComment(&$bBlog, $commentid, $postid); break; case "editsave": saveEdit(&$bBlog); break; case "Approve": if (is_array($_POST['commentid'])) { foreach ($_POST['commentid'] as $key => $val) { $bBlog->query("UPDATE " . T_COMMENTS . " SET onhold='0' WHERE commentid='" . intval($val) . "'"); } } break; case "25": case "50": case "100": case "150": case "200": $commentAmount = intval($commentdo); break; default: // show form break; } retrieveComments(&$bBlog, $commentAmount); populateSelectList(&$bBlog); }
function admin_plugin_comments_run(&$bBlog) { // Again, the plugin API needs work. $commentAmount = isset($_POST['commentsQuantity']) ? intval($_POST['commentsQuantity']) : 50; $articles = null; if (isset($_POST['commentsPosts'])) { $articles = $_POST['commentsPosts'] === 'All' ? null : intval($_POST['commentsPosts']); } $commentdo = isset($_POST['commentdo']) ? $_POST['commentdo'] : ''; switch ($commentdo) { case "Delete": // delete comments if (is_array($_POST['commentid'])) { foreach ($_POST['commentid'] as $key => $val) { deleteComment(&$bBlog, $val); } } break; case "Edit": $commentid = intval($_GET['editComment']); $postid = intval($_GET['postid']); editComment(&$bBlog, $commentid, $postid); break; case "editsave": saveEdit(&$bBlog); break; case "Approve": if (is_array($_POST['commentid'])) { foreach ($_POST['commentid'] as $key => $val) { $bBlog->_adb->Execute("UPDATE " . T_COMMENTS . " SET onhold='0' WHERE commentid='" . intval($val) . "'"); } } break; case "filter": default: // show form break; } retrieveComments(&$bBlog, $commentAmount, $articles); populateSelectList(&$bBlog); }