<commit_before><?php

// $Header: /cvsroot/tikiwiki/tiki/tiki-rename_page.php,v 1.19 2007-03-06 19:29:51 sylvieg Exp $

// Copyright (c) 2002-2007, <NAME>, <NAME>, <NAME>, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.

// Initialization
$section = 'wiki page';
require_once ('tiki-setup.php');

include_once ('lib/wiki/wikilib.php');

if ($feature_wiki != 'y') {
	$smarty->assign('msg', tra("This feature is disabled").": feature_wiki");

	$smarty->display("error.tpl");
	die;
}

// Get the page from the request var or default it to HomePage
if (!isset($_REQUEST["page"])) {
	$smarty->assign('msg', tra("No page indicated"));

	$smarty->display("error.tpl");
	die;
} else {
	$page = $_REQUEST["page"];

	$smarty->assign_by_ref('page', $_REQUEST["page"]);
}

include_once ("tiki-pagesetup.php");

// Now check permissions to rename this page
$info=null;
if ($tiki_p_rename == 'y') {
	if ($tiki_p_admin_wiki != 'y' && $feature_wiki_usrlock == 'y') {
		$info = $tikilib->get_page_info($page);
		$allowed = ($wikilib->is_editable($page, $user, $info))? 'y': 'n';
	} else {
		$allowed = 'y';
	}
} else {
	$allowed = 'n';
}
if ($allowed == 'n') {
	$smarty->assign('msg', tra("Permission denied you cannot rename this page"));

	$smarty->display("error.tpl");
	die;
}

// If the page doesn't exist then display an error
if (!$tikilib->page_exists($page,true)) { // true: casesensitive check here
	$smarty->assign('msg', tra("Page cannot be found"));

	$smarty->display("error.tpl");
	die;
}

if (isset($_REQUEST["rename"])) {
	check_ticket('rename-page');
	// If the new pagename does match userpage prefix then display an error
	$newName = $_REQUEST['newpage'];
	if (stristr($newName, $feature_wiki_userpage_prefix) == $newName) {//stripos is only php5
		$smarty->assign('msg', tra("Cannot rename page because the new name begins with reserved prefix").' ('.$feature_wiki_userpage_prefix.').');

		$smarty->display("error.tpl");
		die;
	}
	if (!$wikilib->wiki_rename_page($page, $newName)) {
		$smarty->assign('msg', tra("Cannot rename page maybe new page already exists"));

		$smarty->display("error.tpl");
		die;
	}

	header ('location: tiki-index.php?page='.urlencode($newName));
}

ask_ticket('rename-page');

include_once ('tiki-section_options.php');

// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');

$smarty->assign('mid', 'tiki-rename_page.tpl');
$smarty->display("tiki.tpl");

?>
<commit_msg>Instant-Auto-Merge from BRANCH-1-9 to HEAD<commit_after><?php

// $Header: /cvsroot/tikiwiki/tiki/tiki-rename_page.php,v 1.20 2007-06-30 00:52:05 sylvieg Exp $

// Copyright (c) 2002-2007, <NAME>, <NAME>, <NAME>, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.

// Initialization
$section = 'wiki page';
require_once ('tiki-setup.php');

include_once ('lib/wiki/wikilib.php');

if ($feature_wiki != 'y') {
	$smarty->assign('msg', tra("This feature is disabled").": feature_wiki");

	$smarty->display("error.tpl");
	die;
}

// Get the page from the request var or default it to HomePage
if (!isset($_REQUEST["page"])) {
	$smarty->assign('msg', tra("No page indicated"));

	$smarty->display("error.tpl");
	die;
} else {
	$page = $_REQUEST["page"];

	$smarty->assign_by_ref('page', $_REQUEST["page"]);
}

include_once ("tiki-pagesetup.php");

// Now check permissions to rename this page
$info=null;
if ($tiki_p_rename == 'y') {
	if ($tiki_p_admin_wiki != 'y' && $feature_wiki_usrlock == 'y') {
		$info = $tikilib->get_page_info($page);
		$allowed = ($wikilib->is_editable($page, $user, $info))? 'y': 'n';
	} else {
		$allowed = 'y';
	}
} else {
	$allowed = 'n';
}
if ($allowed == 'n') {
	$smarty->assign('msg', tra("Permission denied you cannot rename this page"));

	$smarty->display("error.tpl");
	die;
}

// If the page doesn't exist then display an error
if (!$tikilib->page_exists($page,true)) { // true: casesensitive check here
	$smarty->assign('msg', tra("Page cannot be found"));

	$smarty->display("error.tpl");
	die;
}

if (isset($_REQUEST["rename"])) {
	check_ticket('rename-page');
	// If the new pagename does match userpage prefix then display an error
	$newName = $_REQUEST['newpage'];
	if (stristr($newName, $feature_wiki_userpage_prefix) == $newName) {//stripos is only php5
		$smarty->assign('msg', tra("Cannot rename page because the new name begins with reserved prefix").' ('.$feature_wiki_userpage_prefix.').');

		$smarty->display("error.tpl");
		die;
	}
	if (!$wikilib->wiki_rename_page($page, $newName)) {
		$smarty->assign('msg', tra("Cannot rename page maybe new page already exists"));

		$smarty->display("error.tpl");
		die;
	}

	header ('location: tiki-index.php?page='.urlencode($newName));
}

ask_ticket('rename-page');

include_once ('tiki-section_options.php');

// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');

$smarty->assign('mid', 'tiki-rename_page.tpl');
$smarty->display("tiki.tpl");

?>

{'fraction_non_alphanumeric': 0.1936231884057971, 'fraction_numerical': 0.010434782608695653, 'mean_word_length': 4.956271576524741, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2318122', 'n_tokens_mistral': 1897, 'n_tokens_neox': 1837, 'n_words': 454}