"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/handler/page/moderate.php" between
wacko.6.1.16.zip and wacko.6.1.17.zip

About: WackoWiki is a multilingual Wiki-engine that supports WYTIWYG-editing, page rights (ACLs), design themes (skins), file upload, email notification and much more.

moderate.php  (wacko.6.1.16):moderate.php  (wacko.6.1.17)
skipping to change at line 86 skipping to change at line 86
$page = $this->load_page($new_tag); $page = $this->load_page($new_tag);
$this->current_context++; $this->current_context++;
$this->context[$this->current_context] = $new_tag; $this->context[$this->current_context] = $new_tag;
$this->update_link_table($page['page_id'], $page['body_r']); $this->update_link_table($page['page_id'], $page['body_r']);
$this->current_context--; $this->current_context--;
// update title in meta and body if needed // update title in meta and body if needed
if ($title != '') if ($title != '')
{ {
// resave modified page // resave modified page
$this->save_page($new_tag, $page['body'], $title, '', '', '', '', '', '', true, false); $this->save_page($new_tag, $page['body'], $title, '', null, null, null, null, '', true, false);
} }
// restore forum context // restore forum context
$this->forum = $forum_context; $this->forum = $forum_context;
return true; return true;
}; };
$moderate_merge_topics = function($base, $topics, $move_topics = true) use ($mod erate_delete_page) $moderate_merge_topics = function($base, $topics, $move_topics = true) use ($mod erate_delete_page)
{ {
skipping to change at line 138 skipping to change at line 138
{ {
if ($row['Name'] == $this->prefix . 'page ') if ($row['Name'] == $this->prefix . 'page ')
{ {
$num = (int) $row['Auto_increment ']; $num = (int) $row['Auto_increment '];
} }
} }
// resave topic body as comment // resave topic body as comment
$page = $this->load_page($topic); $page = $this->load_page($topic);
$this->save_page('Comment' . $num, $page['body'], $page['title'], '', '', '', $base_id, '', '', true); $this->save_page('Comment' . $num, $page['body'], $page['title'], '', null, null, $base_id, null, '', true);
// restore creation date // restore creation date
$this->db->sql_query( $this->db->sql_query(
"UPDATE " . $this->prefix . "page SET " . "UPDATE " . $this->prefix . "page SET " .
"modified = " . $th is->db->q($page['modified']) . ", " . "modified = " . $th is->db->q($page['modified']) . ", " .
"created = " . $th is->db->q($page['created']) . ", " . "created = " . $th is->db->q($page['created']) . ", " .
"commented = " . $th is->db->q($page['commented']) . ", " . "commented = " . $th is->db->q($page['commented']) . ", " .
"owner_id = " . (in t) $page['owner_id'] . ", " . "owner_id = " . (in t) $page['owner_id'] . ", " .
"user_id = " . (in t) $page['user_id'] . ", " . "user_id = " . (in t) $page['user_id'] . ", " .
"ip = " . $this->db->q($page['ip']) . " " . "ip = " . $this->db->q($page['ip']) . " " .
skipping to change at line 226 skipping to change at line 226
// temporary unset page context // temporary unset page context
$old_page = $this->page; $old_page = $this->page;
unset($this->page); unset($this->page);
// TODO: build title // TODO: build title
$title = $page['title']; $title = $page['title'];
// TODO: pass user, else save_page might fail due missing write privilege // TODO: pass user, else save_page might fail due missing write privilege
// resave modified body // resave modified body
$this->save_page($new_tag, $page['body'], $title, '', '', '', 0, '', '', true); $this->save_page($new_tag, $page['body'], $title, '', null, null, 0, null , '', true);
// set page context back // set page context back
$this->page = $old_page; $this->page = $old_page;
$new_page_id = $this->get_page_id($new_tag); $new_page_id = $this->get_page_id($new_tag);
// bug-resistent check: has page been really resaved? // bug-resistent check: has page been really resaved?
if (!$new_page_id) if (!$new_page_id)
{ {
$this->forum = $forum_context; $this->forum = $forum_context;
skipping to change at line 337 skipping to change at line 337
if ($this->db->forum_cluster if ($this->db->forum_cluster
&& mb_substr($this->tag, 0, mb_strlen($this->db->forum_cluster)) == $this->db->forum_cluster) && mb_substr($this->tag, 0, mb_strlen($this->db->forum_cluster)) == $this->db->forum_cluster)
{ {
$forum_cluster = true; $forum_cluster = true;
} }
else else
{ {
$forum_cluster = false; $forum_cluster = false;
} }
// simple and rude input sanitization
foreach ($_POST as $key => $val)
{
$_POST[$key] = Ut::html($val);
}
// IDs PROCESSING (COMMON PROCEDURES) // IDs PROCESSING (COMMON PROCEDURES)
$set = []; $set = [];
// pass previously selected items // pass previously selected items
if (isset($_REQUEST['ids'])) if (isset($_REQUEST['ids']))
{ {
$ids = explode('-', $_REQUEST['ids']); $ids = explode('-', $_REQUEST['ids']);
foreach ($ids as $id) foreach ($ids as $id)
{ {
if (!in_array($id, $set) && !empty($id)) if (!in_array($id, $set) && !empty($id))
{ {
$set[] = (int) $id; $set[] = (int) $id;
} }
} }
unset($ids, $id); unset($ids, $id);
} }
// keep currently selected list items // keep currently selected list items
foreach ($_POST as $val => $key) foreach ($_POST['id'] as $key => $val)
{ {
if ($key == 'id' && !in_array($val, $set) && !empty($val)) if (!in_array($val, $set) && !empty($val))
{ {
$set[] = (int) $val; $set[] = (int) $val;
} }
} }
unset($key, $val); unset($key, $val);
// save page ids for later operations (correct if needed) // save page ids for later operations (correct if needed)
if (isset($_POST['set'])) if (isset($_POST['set']))
{ {
$set = []; $set = [];
foreach ($_POST as $val => $key) foreach ($_POST['id'] as $key => $val)
{ {
if ($key == 'id' && !empty($val)) if (!empty($val))
{ {
$set[] = (int) $val; $set[] = (int) $val;
} }
} }
unset($key, $val); unset($key, $val);
} }
// reset page ids // reset page ids
else if (isset($_POST['reset'])) else if (isset($_POST['reset']))
{ {
skipping to change at line 403 skipping to change at line 397
// check moderator read access on passed ids // check moderator read access on passed ids
foreach ($set as $n => $page_id) foreach ($set as $n => $page_id)
{ {
if ($this->has_access('read', $page_id) !== true) if ($this->has_access('read', $page_id) !== true)
{ {
unset($set[$n]); unset($set[$n]);
} }
} }
reset($set);
unset($n, $page_id); unset($n, $page_id);
////// BEGIN SUBFORUM MODERATION ////// ////// BEGIN SUBFORUM MODERATION //////
if ($this->forum !== true && $forum_cluster) if ($this->forum !== true && $forum_cluster)
{ {
$tpl->enter('subforum_'); $tpl->enter('subforum_');
// number of topics to display // number of topics to display
$limit = 40; $limit = 40;
skipping to change at line 425 skipping to change at line 418
// delete selected topic(s) // delete selected topic(s)
if (isset($_POST['delete']) && $set) if (isset($_POST['delete']) && $set)
{ {
$accept_action = 'delete'; $accept_action = 'delete';
// actually remove topics // actually remove topics
if (isset($_POST['accept'])) if (isset($_POST['accept']))
{ {
foreach ($set as $page_id) foreach ($set as $page_id)
{ {
$page = $this->load_page('', $page_id, '' , LOAD_NOCACHE, LOAD_META); $page = $this->load_page('', $page_id, nu ll, LOAD_NOCACHE, LOAD_META);
$moderate_delete_page($page['tag']); $moderate_delete_page($page['tag']);
$this->log(1, Ut::perc_replace($this->_t( 'LogRemovedPage', SYSTEM_LANG), $page['tag'], $page['user_id'])); $this->log(1, Ut::perc_replace($this->_t( 'LogRemovedPage', SYSTEM_LANG), $page['tag'], $page['user_id']));
} }
unset($accept_action); unset($accept_action);
$write_comment_feed(); $write_comment_feed();
$set = []; $set = [];
$this->set_message($this->_t('ModerateTopicsDelet ed'), 'success'); $this->set_message($this->_t('ModerateTopicsDelet ed'), 'success');
skipping to change at line 564 skipping to change at line 557
$set = []; $set = [];
$this->set_message($this->_t('ModerateTopicsMerge d'), 'success'); $this->set_message($this->_t('ModerateTopicsMerge d'), 'success');
$this->http->redirect($this->href('moderate')); $this->http->redirect($this->href('moderate'));
} }
} }
// lock topics // lock topics
else if (isset($_POST['lock']) && $set) else if (isset($_POST['lock']) && $set)
{ {
foreach ($set as $page_id) foreach ($set as $page_id)
{ {
$page = $this->load_page('', $page_id, '', LOAD_N OCACHE, LOAD_META); $page = $this->load_page('', $page_id, null, LOAD _NOCACHE, LOAD_META);
$this->log(2, Ut::perc_replace($this->_t('LogTopi cLocked', SYSTEM_LANG), $page['tag'] . ' ' . $page['title'])); $this->log(2, Ut::perc_replace($this->_t('LogTopi cLocked', SYSTEM_LANG), $page['tag'] . ' ' . $page['title']));
// DON'T USE BLANK PRIVILEGE LIST!!! Only "negati ve all" - '!*' // DON'T USE BLANK PRIVILEGE LIST!!! Only "negati ve all" - '!*'
$this->save_acl($page_id, 'comment', '!*'); $this->save_acl($page_id, 'comment', '!*');
} }
// purge SQL queries cache // purge SQL queries cache
$this->db->invalidate_sql_cache(); $this->db->invalidate_sql_cache();
$set = []; $set = [];
$this->set_message($this->_t('ModerateTopicsBlocked'), 's uccess'); $this->set_message($this->_t('ModerateTopicsBlocked'), 's uccess');
$this->http->redirect($this->href('moderate')); $this->http->redirect($this->href('moderate'));
} }
// unlock topics // unlock topics
else if (isset($_POST['unlock']) && $set) else if (isset($_POST['unlock']) && $set)
{ {
foreach ($set as $page_id) foreach ($set as $page_id)
{ {
$page = $this->load_page('', $page_id, '', LOAD_N OCACHE, LOAD_META); $page = $this->load_page('', $page_id, null, LOAD _NOCACHE, LOAD_META);
$this->log(2, Ut::perc_replace($this->_t('LogTopi cUnlocked', SYSTEM_LANG), $page['tag'] . ' ' . $page['title'])); $this->log(2, Ut::perc_replace($this->_t('LogTopi cUnlocked', SYSTEM_LANG), $page['tag'] . ' ' . $page['title']));
$this->save_acl($page_id, 'comment', $this->db->d efault_comment_acl); $this->save_acl($page_id, 'comment', $this->db->d efault_comment_acl);
} }
// purge SQL queries cache // purge SQL queries cache
$this->db->invalidate_sql_cache(); $this->db->invalidate_sql_cache();
$set = []; $set = [];
$this->set_message($this->_t('ModerateTopicsUnlocked'), ' success'); $this->set_message($this->_t('ModerateTopicsUnlocked'), ' success');
$this->http->redirect($this->href('moderate')); $this->http->redirect($this->href('moderate'));
skipping to change at line 742 skipping to change at line 735
$tpl->hids = implode('-', $set); $tpl->hids = implode('-', $set);
$tpl->p = (int) ($_GET['p'] ?? ''); $tpl->p = (int) ($_GET['p'] ?? '');
$tpl->set_ids = implode(', ', $set); $tpl->set_ids = implode(', ', $set);
// print moderation controls... // print moderation controls...
$tpl->enter('n_'); $tpl->enter('n_');
// ...and topics list itself // ...and topics list itself
foreach ($topics as $topic) foreach ($topics as $n => $topic)
{ {
if ($this->has_access('read', $topic['page_id'])) if ($this->has_access('read', $topic['page_id']))
{ {
$tpl->n = $n;
$tpl->pageid = $topic['page_id']; $tpl->pageid = $topic['page_id'];
$tpl->created = $topic['created']; $tpl->created = $topic['created'];
$tpl->comments = $topic['comments']; $tpl->comments = $topic['comments'];
$tpl->user = $this->user_link($topic ['owner_name'], true, false); $tpl->user = $this->user_link($topic ['owner_name'], true, false);
$tpl->ip = $this->is_admin() ? $to pic['ip'] : ''; $tpl->ip = $this->is_admin() ? $to pic['ip'] : '';
if ($this->has_access('comment', $topic['page_id' ], $this->db->default_comment_acl) === false) if ($this->has_access('comment', $topic['page_id' ], $this->db->default_comment_acl) === false)
{ {
$tpl->locked = true; $tpl->locked = true;
} }
skipping to change at line 944 skipping to change at line 938
{ {
if (!array_filter($set)) if (!array_filter($set))
{ {
$error = $this->_t('ModerateNoItemChosen' ); $error = $this->_t('ModerateNoItemChosen' );
} }
if (!$error) if (!$error)
{ {
foreach ($set as $page_id) foreach ($set as $page_id)
{ {
$page = $this->load_page('', $pag e_id, '', LOAD_NOCACHE, LOAD_META); $page = $this->load_page('', $pag e_id, null, LOAD_NOCACHE, LOAD_META);
$moderate_delete_page($page['tag' ]); $moderate_delete_page($page['tag' ]);
$this->log(1, Ut::perc_replace($t his->_t('LogRemovedComment', SYSTEM_LANG), $this->log(1, Ut::perc_replace($t his->_t('LogRemovedComment', SYSTEM_LANG),
$this->get_page_t ag($page['comment_on_id']) . ' ' . $this->get_page_title('', $page['comment_on_i d']), $this->get_page_t ag($page['comment_on_id']) . ' ' . $this->get_page_title('', $page['comment_on_i d']),
$page['user_name' ], $page['user_name' ],
$this->sql_time_f ormatted($page['created']))); $this->sql_time_f ormatted($page['created'])));
} }
// recount comments for current topic // recount comments for current topic
$this->db->sql_query( $this->db->sql_query(
"UPDATE " . $prefix . "page SET " . "UPDATE " . $prefix . "page SET " .
skipping to change at line 1304 skipping to change at line 1298
if ($comments) if ($comments)
{ {
$tpl->enter('comments_'); $tpl->enter('comments_');
$tpl->set_ids = implode(', ', $set); $tpl->set_ids = implode(', ', $set);
$tpl->enter('n_'); $tpl->enter('n_');
// ...and comments list // ...and comments list
foreach ($comments as $comment) foreach ($comments as $n => $comment)
{ {
$desc = $this->format($comment['body'], 'cleanwac ko'); $desc = $this->format($comment['body'], 'cleanwac ko');
$desc = (mb_strlen($desc) > 300 ? mb_substr($desc , 0, 300) . '[...]' : $desc); $desc = (mb_strlen($desc) > 300 ? mb_substr($desc , 0, 300) . '[...]' : $desc);
$desc = Ut::html($desc); $desc = Ut::html($desc);
$tpl->n = $n;
$tpl->comment = $comment; $tpl->comment = $comment;
$tpl->desc = $desc; $tpl->desc = $desc;
$tpl->ip = $this->is_admin() ? $co mment['ip'] : ''; $tpl->ip = $this->is_admin() ? $co mment['ip'] : '';
$tpl->clink = $this->compose_link_to_ page($comment['tag'], '', $comment['title']); $tpl->clink = $this->compose_link_to_ page($comment['tag'], '', $comment['title']);
$tpl->ulink = $this->user_link($comme nt['owner_name'], true, false); $tpl->ulink = $this->user_link($comme nt['owner_name'], true, false);
$tpl->set = in_array($comment['page _id'], $set); $tpl->set = in_array($comment['page _id'], $set);
} }
$tpl->leave(); // n_ $tpl->leave(); // n_
$tpl->leave(); // comments_ $tpl->leave(); // comments_
 End of changes. 17 change blocks. 
20 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)