Example #1
0
 /**
  * Loads a page object into the current view, if the page exists. Otherwise 404 error is returned.
  *
  * Route: page/:slug
  *
  * @param string $slug The slug of the page to get.
  */
 public static function view($slug)
 {
     $page = Page::page()->find($slug);
     if ($page) {
         View::setTitle($page->title);
         View::data('page', $page);
         return;
     }
     return ERROR_404;
 }
Example #2
0
 public static function getInstance()
 {
     if (self::$page == NULL) {
         self::$page = new self();
     }
     return self::$page;
 }
Example #3
0
 /**
  * Set up paging
  *
  * @access public
  * @static	
  * @param array $segments
  */
 public static function setUp(&$segments = array())
 {
     $count = count($segments);
     self::$end = self::$offset;
     if (isset($segments[$count - 2]) && isset($segments[$count - 1])) {
         if ($segments[$count - 2] == 'page' && is_numeric($segments[$count - 1])) {
             if ($segments[$count - 1] > 1) {
                 self::$page = $segments[$count - 1];
                 self::$start = (self::$page - 1) * self::$offset;
                 self::$end = self::$offset * self::$page;
             }
             unset($segments[$count - 2]);
             unset($segments[$count - 1]);
         }
     }
     self::$next = '/' . implode('/', $segments) . '/page/';
     self::$next .= self::$page + 1;
     if (self::$page > 1) {
         self::$previous = '/' . implode('/', $segments) . '/page/';
         self::$previous .= self::$page - 1;
     }
 }
Example #4
0
<?php

return array('permissions' => array('page.admin' => 'Administer pages', 'page.manage' => 'Manage all pages', 'page.manage_mine' => 'Manage my pages', 'page.create' => 'Create pages', 'page.edit' => 'Edit all pages', 'page.edit_mine' => 'Edit my pages', 'page.delete' => 'Delete all pages', 'page.delete_mine' => 'Delete my pages'), 'routes' => array('page/:slug' => array('callback' => array('page', 'view')), 'admin/page' => array('title' => 'Pages', 'redirect' => 'admin/page/manage', 'permissions' => array('page.admin')), 'admin/page/manage' => array('title' => 'Manage', 'callback' => array('admin_page', 'manage'), 'permissions' => array('page.manage', 'page.manage_mine')), 'admin/page/create' => array('title' => 'Create', 'callback' => array('admin_page', 'create'), 'permissions' => array('page.create')), 'admin/page/edit/%d' => array('callback' => array('admin_page', 'edit'), 'permissions' => array('page.edit', 'page.edit_mine')), 'admin/page/delete/%d' => array('callback' => array('admin_page', 'delete'), 'permissions' => array('page.delete', 'page.delete_mine'))), 'events' => array('multilanguage.modules' => function () {
    return 'page';
}, 'multilanguage.content[page]' => function () {
    $content = array('page' => array());
    $pages = Page::page()->all();
    if ($pages) {
        foreach ($pages as $page) {
            $content['page'][$page->id] = $page->title;
        }
    }
    return $content;
}, 'multilanguage.content_type[page][page]' => function () {
    return array('title' => 'text', 'body' => 'textarea');
}));
Example #5
0
 /**
  * 设置页数信息
  * @return boolean
  */
 public static function setPage()
 {
     if (empty($_REQUEST[self::$pageVar])) {
         self::$page = 1;
     } else {
         self::$page = (int) $_REQUEST[self::$pageVar];
     }
     if (self::$page < 1) {
         self::$page = 1;
     } elseif (!empty(self::$total) && self::$page > self::$total) {
         $qs = sprintf(self::$qsTpl, self::$total);
         $last = $_SERVER['PHP_SELF'] . '?' . $qs;
         self::$page = self::$total;
     } else {
         //当前页数即请求的页数
     }
     return true;
 }
Example #6
0
$ordertype = "";
$callid = false;
$callpage = "start";
$lang = "de";
$skin = "default";
$scroll = 0;
$history = "";
// get http parameters
$httpParam = new Config();
$httpParam->set($_GET);
$httpParam->set($_POST);
$page = $httpParam->page();
// =====================================
// load page configuration
$page_obj = new Page($httpParam->get(), "start");
$page = $page_obj->page();
// debug($page_obj);
if (file_exists("page/config.php")) {
    include_once "page/config.php";
    if (file_exists("page/" . $page . "/config.php")) {
        include_once "page/" . $page . "/config.php";
    } else {
        die("Seite nicht gefunden");
    }
} else {
    die("Fehlende Seitenkonfiguration");
}
//==========================
// look for database definition
if ($_config->database()) {
    // open object database
Example #7
0
        //показать авторизацию и сообщение об ошибке
    } else {
        //выставить кукисы
        //
        //exit;
        setcookie('loginusername', $auth->username);
        setcookie('loginpassword', $auth->password);
    }
    $userinstance->username = trim(@$_REQUEST['username']);
}
$auth = new Auth(trim($_REQUEST['loginusername']), trim($_REQUEST['loginpassword']));
//var_dump($userinstance->GetID('username',$auth->username));
Page::$userid = $userinstance->GetID($auth->username, 'username');
Page::$query_string = $_SERVER["QUERY_STRING"];
Page::$request_uri = $_SERVER["REQUEST_URI"];
Page::$page = @$_GET['page'];
//Block 2: Dashboard
if ($action == '' && $object == '' && $auth->check_auth() && $auth->get_rights() == 'Admin') {
    Page::init('admin');
    Page::setup(Lang::$langarray['dashboard'], Lang::$langarray['pleasedtomeetyou']);
    Page::Dashboard();
    exit;
} elseif ($action == '' && $object == '' && $auth->check_auth() && $auth->get_rights() == 'Active') {
    //show user's dashboard
    Page::init('user');
    if (is_numeric(@$_COOKIE['temporderid'])) {
        //creating new order from temprary one
        $temporder = TempOrder::getInstance();
        $temporderarray = $temporder->FetchData($_COOKIE['temporderid']);
        if (count($temporderarray) > 1) {
            setcookie('temporderid', '');
Example #8
0
 public static function getByParentId($parentId)
 {
     return Page::page()->where('page_id', '=', $parentId)->orderBy('title')->all();
 }
Example #9
0
 /**
  * Deletes any pages related to (are children of) the given page $id.
  *
  * @param int $id The id of the page to delete any child pages for.
  */
 private static function _deleteRelated($id)
 {
     $relatedPages = Page::page()->where('page_id', '=', $id)->all();
     if ($relatedPages) {
         foreach ($relatedPages as $p) {
             self::_deleteRelated($p->id);
         }
     }
     Page::page()->delete($id);
 }