function clone_subs($pagetoclone, $parent, $copy_title, $visibility)
{
    global $admin, $database;
    // Get page list from database
    $query = "SELECT * FROM `" . TABLE_PREFIX . "pages` WHERE `parent` = " . $pagetoclone . " AND `page_id` <> " . $parent;
    $get_subpages = $database->query($query);
    if ($get_subpages and $get_subpages->numRows() > 0) {
        while (false != ($page = $get_subpages->fetchRow(MYSQL_ASSOC))) {
            #echo 'clonepage('.$page['page_title'].','.$parent.','.$page['page_id'].')<br>';
            $newnew_page = clone_page($page['menu_title'], $parent, $page['page_id'], $copy_title, $visibility);
            #echo 'clonesubs('.$page['page_id'].','.$newnew_page.','.$copy_title.','.$visibility.')<hr />';
            clone_subs($page['page_id'], $newnew_page, $copy_title, $visibility);
        }
    }
}
예제 #2
0
$load['plugin'] = true;
// Include common.php
include 'inc/common.php';
login_cookie_check();
exec_action('load-pages');
// Variable settings
// inputs for error_checking
$id = isset($_GET['id']) ? var_in($_GET['id']) : null;
$ptype = isset($_GET['type']) ? var_in($_GET['type']) : null;
$path = GSDATAPAGESPATH;
$counter = '0';
$table = '';
// cloning a page
if (isset($_GET['action']) && isset($_GET['id']) && $_GET['action'] == 'clone') {
    check_for_csrf("clone", "pages.php");
    $status = clone_page($_GET['id']);
    if ($status !== false) {
        exec_action('page-clone');
        // @hook page-clone page was cloned
        redirect('pages.php?upd=clone-success&id=' . $status);
    } else {
        $error = sprintf(i18n_r('CLONE_ERROR'), var_out($_GET['id']));
        redirect('pages.php?error=' . $error);
    }
}
init_pageCache(true);
getPagesXmlValues(true);
/**
 * sorting prepare function tests
 * @todo
 */
예제 #3
0
function handle_page_removal()
{
    if (isset($_GET['id'])) {
        $id = $_GET['id'];
        $dbh = get_database_handler();
        try {
            $dbh->beginTransaction();
            $params = clone_page($dbh, $id);
            update_page_info($dbh, $params);
            $dbh->commit();
        } catch (PDOException $e) {
            echo '<p>ERROR: {' . $e->getMessage() . '}</p>';
        }
        $dbh = null;
    } else {
    }
    redirect_with_message(get_prev_url(), SUCCESS_MSG, REDIRECT_DELTA);
}