Пример #1
0
<?php

$login_required = FALSE;
$use_theme = 'Beta';
//TODO : Remove this when new UI is completely implemented.
include "includes/page.php";
require_once "{$path_prefix}/ext/StaticPage/StaticPage.php";
$msg = array();
$page = !empty($_GET['caption']) ? $_GET['caption'] : NULL;
$static_page = StaticPage::get(array('url' => $page));
if (empty($static_page)) {
    $msg[] = MessagesHandler::get_message(12009);
}
function setup_module($column, $module, $obj)
{
    global $static_page;
    switch ($module) {
        case 'StaticPageDisplayModule':
            if (!empty($msg)) {
                return 'skip';
            }
            $obj->text = $static_page[0]->page_text;
            break;
    }
}
$page = new PageRenderer("setup_module", PAGE_STATIC_PAGE_DISPLAY, "Static Pages", "container_two_column.tpl", "header_user.tpl", NULL, PRI, $network_info);
if (!empty($msg)) {
    for ($counter = 0; $counter < count($msg); $counter++) {
        $message .= $msg[$counter] . "<br>";
    }
}
    $static_page->page_text = $form_data['page_text'] = $_POST['page_text'];
    $static_page->url = $form_data['preferred_caption'] = $_POST['preferred_caption'];
    if (!$error) {
        try {
            $url = $static_page->save();
            $form_data = array();
            header("location: cncontent_static_pages.php?msg_id={$msg_id}");
            exit;
        } catch (CNException $e) {
            $msg[] = $e->message;
        }
    }
} else {
    if (!empty($_GET['do']) && $_GET['do'] == 'edit' && !empty($_GET['id'])) {
        $edit = TRUE;
        $res = StaticPage::get(array('id' => (int) $_GET['id']));
        if (!empty($res)) {
            $form_data['id'] = $res[0]->id;
            $form_data['caption'] = $res[0]->caption;
            $form_data['url'] = $res[0]->url;
            $form_data['page_text'] = $res[0]->page_text;
        }
    } else {
        if (!empty($_GET['action']) && $_GET['action'] == 'delete' && !empty($_GET['id'])) {
            if (!empty($_GET['id'])) {
                try {
                    StaticPage::delete((int) $_GET['id']);
                    header("location: cncontent_static_pages.php?msg_id=12013");
                    exit;
                } catch (CNException $e) {
                    $msg[] = $e->message;
 function get_links()
 {
     $this->Paging["count"] = StaticPage::get(NULL, true);
     $footer_links = StaticPage::get(NULL, false, $this->Paging['page'], $this->Paging['show']);
     return $footer_links;
 }