21 die(
'Restricted access');
24 include_once
$GLOBALS[
'xoops']->path(
'include/comment_constants.php');
33 $com_mode = isset(
$_GET[
'com_mode']) ? htmlspecialchars(trim(
$_GET[
'com_mode']), ENT_QUOTES) :
'flat';
46 $redirect_page = XOOPS_URL .
'/modules/system/admin.php?fct=comments&com_modid=' .
$com_modid .
'&com_itemid';
59 if (isset(${$extra_param})) {
64 } elseif (isset(
$_GET[$extra_param])) {
81 include_once
$GLOBALS[
'xoops']->path(
'modules/system/constants.php');
105 include_once
$GLOBALS[
'xoops']->path(
'header.php');
107 include_once
$GLOBALS[
'xoops']->path(
'footer');
118 if ($callbackfile !=
'' && file_exists(
$file =
$GLOBALS[
'xoops']->path(
'modules/' .
$moddir .
'/' . $callbackfile))) {
138 if (
$comment->getVar(
'com_uid') != 0) {
141 if (is_object($com_poster)) {
142 $member_handler->updateUserByField($com_poster,
'posts', $com_poster->getVar(
'posts') - 1);
148 include_once
$GLOBALS[
'xoops']->path(
'class/tree.php');
149 $xot =
new XoopsObjectTree($thread_comments,
'com_id',
'com_pid',
'com_rootid');
150 $child_comments =& $xot->getFirstChild(
$com_id);
152 $new_pid =
$comment->getVar(
'com_pid');
154 foreach (array_keys($child_comments) as
$i) {
155 $child_comments[
$i]->setVar(
'com_pid', $new_pid);
158 $new_rootid = $child_comments[
$i]->getVar(
'com_id');
159 $child_comments[
$i]->setVar(
'com_rootid', $child_comments[$i]->getVar(
'com_id'));
161 $errs[] =
'Could not change comment parent ID from <strong>' .
$com_id .
'</strong> to <strong>' . $new_pid .
'</strong>. (ID: ' . $new_rootid .
')';
164 $c_child_comments = & $xot->getAllChild($new_rootid);
165 $cc_count = count($c_child_comments);
166 foreach(array_keys($c_child_comments) as
$j) {
167 $c_child_comments[
$j]->setVar(
'com_rootid', $new_rootid);
169 $errs[] =
'Could not change comment root ID from <strong>' .
$com_id .
'</strong> to <strong>' . $new_rootid .
'</strong>.';
175 $errs[] =
'Could not change comment parent ID from <strong>' .
$com_id .
'</strong> to <strong>' . $new_pid .
'</strong>.';
179 if (count($errs) > 0) {
180 include_once
$GLOBALS[
'xoops']->path(
'header.php');
182 include_once
$GLOBALS[
'xoops']->path(
'footer.php');
197 include_once
$GLOBALS[
'xoops']->path(
'class/tree.php');
198 $xot =
new XoopsObjectTree($thread_comments,
'com_id',
'com_pid',
'com_rootid');
199 $child_comments =& $xot->getAllChild(
$com_id);
203 $deleted_num = array();
205 foreach(array_keys($child_comments) as $i) {
207 $msgs[] =
_CM_COMDELETENG .
' (ID: ' . $child_comments[
$i]->getVar(
'com_id') .
')';
209 $msgs[] =
_CM_COMDELETED .
' (ID: ' . $child_comments[
$i]->getVar(
'com_id') .
')';
211 $poster_id = $child_comments[
$i]->getVar(
'com_uid');
212 if ($poster_id > 0) {
213 $deleted_num[$poster_id] = ! isset($deleted_num[$poster_id]) ? 1 : ($deleted_num[$poster_id] + 1);
217 foreach ($deleted_num as
$user_id => $post_num) {
220 if (is_object($com_poster)) {
221 $member_handler->updateUserByField($com_poster,
'posts', $com_poster->getVar(
'posts') - $post_num);
232 if ($callbackfile !=
'' && file_exists(
$file =
$GLOBALS[
'xoops']->path(
'modules/' .
$moddir .
'/' . $callbackfile))) {
250 include_once
$GLOBALS[
'xoops']->path(
'header.php');
253 include_once
$GLOBALS[
'xoops']->path(
'footer.php');
258 include_once
$GLOBALS[
'xoops']->path(
'header.php');
259 $comment_confirm = array(
270 include_once
$GLOBALS[
'xoops']->path(
'footer.php');