function admin_plugin_comments_run(&$loq) { // Again, the plugin API needs work. $commentAmount = 50; if (isset($_POST['commentsQuantity'])) { if ($_POST['commentsQuantity'] == 'ALL') { $commentAmount = 'ALL'; } else { $commentAmount = intval($_POST['commentsQuantity']); } } $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']) ? strtolower($_POST['commentdo']) : ''; if ($commentdo == '') { $commentdo = isset($_GET['commentdo']) ? strtolower($_GET['commentdo']) : ''; } switch ($commentdo) { case "delete": // delete comments if (is_array($_POST['commentid'])) { foreach ($_POST['commentid'] as $key => $val) { deleteComment($loq, $val, $_POST['postid'][$val]); } } break; case "edit": $commentid = intval($_GET['editComment']); $postid = intval($_GET['postid']); editComment($loq, $commentid, $postid); break; case "editsave": saveEdit($loq); break; case "approve": if (is_array($_POST['commentid'])) { foreach ($_POST['commentid'] as $key => $val) { $loq->_adb->Execute("UPDATE " . T_COMMENTS . " SET onhold='0' WHERE commentid='" . intval($val) . "'"); } } break; case "filter": default: // show form break; } retrieveComments($loq, $commentAmount, $articles); populateSelectList($loq); }
/** * 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); }
} } $sec->setModified(time()); if (!$sec->save()) { redirectMsg('edits.php', _AS_AH_DBERROR . '<br />' . $sec->errors(), 1); die; } $edit->delete(); redirectMsg('edits.php', _AS_AH_DBOK, 0); } $action = rmc_server_var($_REQUEST, 'action', ''); switch ($action) { case 'review': reviewEdit(); break; case 'approve': approveEdits(); break; case 'edit': showFormEdits(); break; case 'save': saveEdit(); break; case 'delete': deleteEdits(); break; default: showEdits(); break; }