"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/handler/page/rename.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.

rename.php  (wacko.6.1.16):rename.php  (wacko.6.1.17)
skipping to change at line 124 skipping to change at line 124
{ {
if ($this->db->multilanguage) if ($this->db->multilanguage)
{ {
$languages = $this->_t('Lang uageArray'); $languages = $this->_t('Lang uageArray');
$tpl->l_language = $languages[$this->page_ lang]; $tpl->l_language = $languages[$this->page_ lang];
$tpl->l_lang = $this->page_lang; $tpl->l_lang = $this->page_lang;
$tpl->l_charset = $this->get_charset(); $tpl->l_charset = $this->get_charset();
} }
$user_lang = $user['user_lang'] ?: $
this->db->language;
$tpl->enter('f_'); $tpl->enter('f_');
// show rename form // show rename form
$tpl->tag = $this->tag; $tpl->tag = $this->tag;
if ($this->db->default_rename_redirect == 1) if ($this->db->default_rename_redirect == 1)
{ {
$tpl->checked = ' checked'; $tpl->checked = ' checked';
} }
skipping to change at line 148 skipping to change at line 146
$tpl->global = true; $tpl->global = true;
} }
// show backlinks // show backlinks
$tpl->backlinks = $this->action('backlinks', ['nomark' => 0]); $tpl->backlinks = $this->action('backlinks', ['nomark' => 0]);
// show sub-pages // show sub-pages
$tpl->tree = $this->action('tree', ['depth' => 3]); $tpl->tree = $this->action('tree', ['depth' => 3]);
$tpl->leave(); // f_ $tpl->leave(); // f_
} }
} }
} }
else else
{ {
$tpl->denied = true; $tpl->denied = true;
} }
function recursive_move(&$engine, $root, $new_root, $log) function recursive_move(&$engine, $root, $new_root, $log): void
{ {
$new_root = utf8_trim($new_root, '/'); $new_root = utf8_trim($new_root, '/');
$user = $engine->get_user();
$user_lang = $user['user_lang'] ?: $engine->db->language;
if ($root == '/') if ($root == '/')
{ {
exit; // who and where did intend to move root??? exit; // who and where did intend to move root???
} }
// FIXME: missing $owner_id -> rename_global_acl || owner // FIXME: missing $owner_id -> rename_global_acl || owner
$owner_id = ''; $owner_id = '';
$_root = $root; $_root = $root;
$pages = $engine->db->load_all( $pages = $engine->db->load_all(
skipping to change at line 185 skipping to change at line 180
" OR tag = " . $engine->db->q($_r oot) . ") " . " OR tag = " . $engine->db->q($_r oot) . ") " .
($owner_id ($owner_id
? "AND owner_id = " . (int) $owne r_id . " " ? "AND owner_id = " . (int) $owne r_id . " "
: "") . : "") .
"AND comment_on_id = 0"); "AND comment_on_id = 0");
foreach ($pages as $page) foreach ($pages as $page)
{ {
$log->log_n_h = $page['tag']; $log->log_n_h = $page['tag'];
// avoid charset conflict
if ($engine->get_charset($page['page_lang']) != $engine->get_char
set($user_lang))
{
$log->log_n_l_message = Ut::perc_replace($engine->_t('Sk
ipCharsetConflict'), $engine->link('/' . $page['tag']), '<code>' . $page['page_l
ang'] . ' (' . $engine->get_charset($page['page_lang']) . ')</code>');
continue;
}
// $new_tag = str_replace( $root, $new_root, $page['tag'] ); // $new_tag = str_replace( $root, $new_root, $page['tag'] );
$new_tag = preg_replace('/' . preg_quote($root, '/') . '/', preg_ quote($new_root), $page['tag'], 1); $new_tag = preg_replace('/' . preg_quote($root, '/') . '/', preg_ quote($new_root), $page['tag'], 1);
// FIXME: preg_quote is not universally suitable for escaping the replacement string. A single . will become \. and the preg_replace call will no t undo the escaping. // FIXME: preg_quote is not universally suitable for escaping the replacement string. A single . will become \. and the preg_replace call will no t undo the escaping.
$new_tag = stripslashes($new_tag); $new_tag = stripslashes($new_tag);
move($engine, $page, $new_tag, $log); move($engine, $page, $new_tag, $log);
} }
} }
function move(&$engine, $old_page, $new_tag, $log) function move(&$engine, $old_page, $new_tag, $log): void
{ {
$user = $engine->get_user(); $user = $engine->get_user();
$user_id = $engine->get_user_id(); $user_id = $engine->get_user_id();
if ($engine->check_acl($user['user_name'], $engine->db->rename_global_acl ) if ($engine->check_acl($user['user_name'], $engine->db->rename_global_acl )
|| $engine->get_page_owner_id($old_page['page_id']) == $user_id) || $engine->get_page_owner_id($old_page['page_id']) == $user_id)
{ {
if (!preg_match('/^([' . $engine->lang['TAG_P'] . ']+)$/u', $new_ tag)) if (!preg_match('/^([' . $engine->lang['TAG_P'] . ']+)$/u', $new_ tag))
{ {
$log->log_n_l_message = $engine->_t('InvalidWikiName'); $log->log_n_l_message = $engine->_t('InvalidWikiName');
} }
else if ($old_page['tag'] == $new_tag) else if ($old_page['tag'] == $new_tag)
{ {
$log->log_n_l_message = Ut::perc_replace($engine->_t('Alr eadyNamed'), '<strong>' . $engine->link($new_tag) . '</strong>'); $log->log_n_l_message = Ut::perc_replace($engine->_t('Alr eadyNamed'), '<strong>' . $engine->link($new_tag) . '</strong>');
} }
else else
{ {
if ($old_page['tag'] != $new_tag && $engine->load_page($n ew_tag, 0, '', LOAD_CACHE, LOAD_META)) if ($old_page['tag'] != $new_tag && $engine->load_page($n ew_tag, 0, null, LOAD_CACHE, LOAD_META))
{ {
$log->log_n_l_message = Ut::perc_replace($engine- >_t('AlreadyExists'), '<strong>' . $engine->link($new_tag) . '</strong>'); $log->log_n_l_message = Ut::perc_replace($engine- >_t('AlreadyExists'), '<strong>' . $engine->link($new_tag) . '</strong>');
} }
else else
{ {
// Rename page // Rename page
$need_redirect = @$_POST['redirect'] == 'on'; $need_redirect = @$_POST['redirect'] == 'on';
if (!$need_redirect) if (!$need_redirect)
{ {
 End of changes. 7 change blocks. 
20 lines changed or deleted 3 lines changed or added

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