Esempio n. 1
0
 function test_get_layouts()
 {
     $layouts = admin_get_layouts();
     $this->assertTrue(is_array($layouts));
     $this->assertTrue(in_array('admin', $layouts));
     $this->assertTrue(in_array('default', $layouts));
 }
Esempio n. 2
0
$f->verify_csrf = false;
if ($f->submit()) {
    $wp->id = $_POST['id'];
    $wp->title = $_POST['title'];
    $wp->menu_title = $_POST['menu_title'];
    $wp->window_title = $_POST['window_title'];
    $wp->access = $_POST['access'];
    $wp->layout = $_POST['layout'];
    $wp->description = $_POST['description'];
    $wp->keywords = $_POST['keywords'];
    $wp->body = $_POST['body'];
    $wp->put();
    if (!$wp->error) {
        Versions::add($wp);
        $memcache->delete('_admin_page_' . $_GET['page']);
        $this->add_notification(i18n_get('Page saved.'));
        $_POST['page'] = $_GET['page'];
        $lock->remove();
        $this->hook('admin/edit', $_POST);
        $this->redirect('/' . $_POST['id']);
    }
    $page->title = i18n_get('An Error Occurred');
    echo i18n_get('Error Message') . ': ' . $wp->error;
} else {
    $wp->layouts = admin_get_layouts();
    $wp->failed = $f->failed;
    $wp = $f->merge_values($wp);
    $page->title = i18n_get('Edit Page') . ': ' . $wp->title;
    $page->head = $tpl->render('admin/edit/head', $wp) . $tpl->render('admin/wysiwyg');
    echo $tpl->render('admin/edit', $wp);
}
Esempio n. 3
0
 */
$page->layout = 'admin';
if (!User::require_admin()) {
    $this->redirect('/admin');
}
require_once 'apps/admin/lib/Functions.php';
$f = new Form('post', 'admin/add');
$f->verify_csrf = false;
if ($f->submit()) {
    $wp = new Webpage($_POST);
    $wp->put();
    Versions::add($wp);
    if (!$wp->error) {
        $this->add_notification(i18n_get('Page created.'));
        $_POST['page'] = $_POST['id'];
        $this->hook('admin/add', $_POST);
        $this->redirect('/' . $_POST['id']);
    }
    $page->title = i18n_get('An Error Occurred');
    echo i18n_get('Error Message') . ': ' . $wp->error;
} else {
    $pg = new Page();
    $pg->layout = 'default';
    $pg->weight = '0';
    $pg->layouts = admin_get_layouts();
    $pg->failed = $f->failed;
    $pg = $f->merge_values($pg);
    $page->title = i18n_get('Add Page');
    $page->head = $tpl->render('admin/add/head', $pg) . $tpl->render('admin/wysiwyg');
    echo $tpl->render('admin/add', $pg);
}