예제 #1
0
if ($options['parent'] != $old_parent) {
    $order->clean($old_parent);
}
// additional settings
$template_variant = $val->sanitizePost('template_variant', NULL, true);
if ($template_variant) {
    CAT_Helper_Page::updatePageSettings($page_id, array('template_variant' => $template_variant));
}
//=====================
// ! Move (rename) page
//=====================
if ($options['link'] !== $old_link) {
    // if a directory exists, rename it; if this fails, we need to recover
    // the changes!
    if (is_dir(CAT_PATH . PAGES_DIRECTORY . $old_link)) {
        if (!CAT_Helper_Directory::moveDirectory(CAT_PATH . PAGES_DIRECTORY . $old_link, CAT_PATH . PAGES_DIRECTORY . $options['link'], true)) {
            CAT_Helper_Page::updatePage($page_id, $page);
            $ajax = array('message' => 'Unable to move the directory', 'success' => false);
            print json_encode($ajax);
            exit;
        }
    }
    // delete old file
    $old_filename = CAT_Helper_Directory::sanitizePath(CAT_PATH . PAGES_DIRECTORY . $old_link . PAGE_EXTENSION);
    if (file_exists($old_filename)) {
        unlink($old_filename);
    }
    // create new access file
    $result = CAT_Helper_Page::createAccessFile($options['link'], $page_id, $options['level']);
    // Update child pages
    $old_link_len = strlen($old_link);