');
chmod(PL_PAGE_DATA_FILE, 0666);
fclose($fh);
} else {
e('cntwriteto', 'file', PL_PAGE_DATA_FILE);
}
}
/**
* Create an instance of PL_Page_Data_Router
*/
$pd_router = new PL_Page_Data_Router(PL_PAGE_DATA_FILE, $h);
if ($adm) {
/**
* Check for any changes to handle
* First: check for changes from texteditor
*/
if ($function == 'save') {
/**
* Collect the headings and pass them over to the router
*/
/* do not activate without backup ;-)
if($cf['use']['h1only_pagesplitting'] == 'true')
{
$text = preg_replace("/
( | |\xC2\xA0| )?<\/h1>/isu", "", stsl($text));
}
else
{
$text = preg_replace("/]*>( | |\xC2\xA0| )?<\/h[1-" . $cf['menu']['levels'] . "]>/isu", "", stsl($text));
}
*/
if($cf['use']['h1only_pagesplitting'] == 'true')
{
preg_match_all('/(.+)<\/h1>/isU', $text, $matches);
}
else
{
preg_match_all('/(.+)<\/h[1-' . $cf['menu']['levels'] . ']>/isU', $text, $matches);
}
$pd_router->refresh_from_texteditor($matches[1], $s);
}
/**
* Second: check for hanges from MenuManager
*/
if (isset($menumanager) && $menumanager && $action == 'saverearranged' && (isset($text) ? strlen($text) : 0 ) > 0) {
$pd_router->refresh_from_menu_manager($text);
}
/**
* Finally check for some changed page infos
*/
if ($s > -1 && isset($_POST['save_page_data'])) {
if(!isset($_SESSION)){session_start();}
csrfProtection();
$params = $_POST;
unset($params['save_page_data']);
$pd_router->update($s, $params);
}
}
/**
* Now we are up to date
* If no page has been selected yet, we
* are on the start page: Get its index
*/
if ($s == -1 && !$f && $o == '' && $su == '') {
$pd_s = 0;
} else {
$pd_s = $s;
}
/**
* Get the infos about the current page
*/
$pd_current = $pd_router->find_page($pd_s);
?>