/** * Recount category * @return null */ public function category_recount($param) { //$array = array(); //for($i = 0; $i <= 9999; $i++) { // $array[] = $id + $i; //} $array = array(); $param = json_decode($param); $id = $param[0]; $perRequestBuildArticle = $param[1]; for ($i = $id; $i < $id + $perRequestBuildArticle; $i++) { array_push($array, $i); } CountPostArray($array); $this->output('success', '文章' . '(ID = ' . $id . ')重建成功'); }
function CheckComment() { global $zbp; $id = (int) GetVars('id', 'GET'); $ischecking = (bool) GetVars('ischecking', 'GET'); $cmt = $zbp->GetCommentByID($id); $cmt->IsChecking = $ischecking; $cmt->Save(); CountPostArray(array($cmt->LogID)); $zbp->AddBuildModule('comments'); }
/** * 评论批量处理(删除、通过审核、加入审核) */ function BatchComment() { global $zbp; if (isset($_POST['all_del'])) { $type = 'all_del'; } if (isset($_POST['all_pass'])) { $type = 'all_pass'; } if (isset($_POST['all_audit'])) { $type = 'all_audit'; } $array = array(); $array = $_POST['id']; $array = array_unique($array); if ($type == 'all_del') { $arrdel = array(); foreach ($array as $i => $id) { $cmt = $zbp->GetCommentByID($id); if ($cmt->ID == 0) { continue; } $arrdel[] = $cmt->ID; DelComment_Children_NoDel($cmt->ID, $arrdel); } foreach ($arrdel as $i => $id) { $cmt = $zbp->GetCommentByID($id); if ($cmt->ID == 0) { continue; } $cmt->Del(); if ($cmt->IsChecking == false) { CountPostArray(array($cmt->LogID), -1); } if ($cmt->IsChecking == false) { CountCommentNums(-1, 0); } else { CountCommentNums(-1, -1); } } } if ($type == 'all_pass') { foreach ($array as $i => $id) { $cmt = $zbp->GetCommentByID($id); if ($cmt->ID == 0) { continue; } $cmt->IsChecking = false; $cmt->Save(); CountPostArray(array($cmt->LogID), +1); CountCommentNums(0, -1); } } if ($type == 'all_audit') { foreach ($array as $i => $id) { $cmt = $zbp->GetCommentByID($id); if ($cmt->ID == 0) { continue; } $cmt->IsChecking = true; $cmt->Save(); CountPostArray(array($cmt->LogID), -1); CountCommentNums(0, +1); } } $zbp->AddBuildModule('comments'); }
function kill_ip($ip, $kill) { global $zbp; $logid = array(); $cmtid = array(); $sql = $zbp->db->sql->Select('%pre%comment', array('comm_ID', 'comm_logID'), array(array('=', 'comm_IP', $ip), array('=', 'comm_IsChecking', 0), array('>', 'comm_PostTime', time() - 24 * 60 * 60)), null, null, null); $result = $zbp->db->Query($sql); if (count($result) > 0) { for ($i = 0; $i < count($result); $i++) { $cmtid[] = $result[$i]['comm_ID']; $logid[] = $result[$i]['comm_logID']; } } CountPostArray($logid); $zbp->AddBuildModule('comments'); $sql = $zbp->db->sql->Update('%pre%comment', array('comm_IsChecking' => 1), array(array('=', 'comm_IP', $ip), array('=', 'comm_IsChecking', 0), array('>', 'comm_PostTime', time() - 24 * 60 * 60))); $zbp->db->Update($sql); }
/** * 评论批量处理(删除、通过审核、加入审核) */ function BatchComment() { global $zbp; if (isset($_POST['all_del'])) { $type = 'all_del'; } if (isset($_POST['all_pass'])) { $type = 'all_pass'; } if (isset($_POST['all_audit'])) { $type = 'all_audit'; } $array = $_POST['id']; if (is_array($array)) { $array = array_unique($array); } else { $array = array($array); } // Search Child Comments $childArray = array(); foreach ($array as $i => $id) { $cmt = $zbp->GetCommentByID($id); if ($cmt->ID == 0) { continue; } $childArray[] = $cmt; GetSubComments($cmt->ID, $childArray); } // Unique child array $childArray = array_unique($childArray); if ($type == 'all_del') { foreach ($childArray as $i => $cmt) { $cmt->Del(); if (!$cmt->IsChecking) { CountPostArray(array($cmt->LogID), -1); CountCommentNums(-1, 0); } else { CountCommentNums(-1, -1); } } } elseif ($type == 'all_pass') { foreach ($childArray as $i => $cmt) { if (!$cmt->IsChecking) { continue; } $cmt->IsChecking = false; $cmt->Save(); CountPostArray(array($cmt->LogID), +1); CountCommentNums(0, -1); } } elseif ($type == 'all_audit') { foreach ($childArray as $i => $cmt) { if ($cmt->IsChecking) { continue; } $cmt->IsChecking = true; $cmt->Save(); CountPostArray(array($cmt->LogID), -1); CountCommentNums(0, +1); } } $zbp->AddBuildModule('comments'); }
public function kill_ip($ip) { global $zbp; $logid = array(); $cmtid = array(); $sql = $zbp->db->sql->Select('%pre%comment', array('comm_ID', 'comm_logID'), array(array('=', 'comm_IP', $ip), array('=', 'comm_IsChecking', 0), array('>', 'comm_PostTime', time() - 24 * 60 * 60)), null, null, null); $result = $zbp->db->Query($sql); $foundComment = count($result); if ($foundComment > 0) { for ($i = 0; $i < count($result); $i++) { $cmtid[] = $result[$i]['comm_ID']; $logid[] = $result[$i]['comm_logID']; } } $zbp->Config('Totoro')->CHECK_INT = (int) $zbp->Config('Totoro')->CHECK_INT + $foundComment; $zbp->SaveConfig('Totoro'); if (function_exists('CountCommentNums')) { CountCommentNums(0, +$foundComment); } CountPostArray($logid); $zbp->AddBuildModule('comments'); $sql = $zbp->db->sql->Update('%pre%comment', array('comm_IsChecking' => 1), array(array('=', 'comm_IP', $ip), array('=', 'comm_IsChecking', 0), array('>', 'comm_PostTime', time() - 24 * 60 * 60))); $zbp->db->Update($sql); }