public function page($arg) { $page = new Page($arg[0]); $page_args['title'] = "<title>" . $page->getTitle() . "</title>"; $page_args['header'] = $page->getHeader(); $page_args['style'] = "<style>" . $page->getStyle() . "</style>"; $page_args['content'] = $page->getContent(); if (empty($page_args['content'])) { Location::To(URL . 'error'); } $this->render('page', array('categories' => $this->categories, 'd_product' => $this->d_product, 'page' => $page_args)); }
public function delete($f3) { header('Cache-Control: no-cache, must-revalidate'); header('Content-type: application/json'); $id = $f3->get('PARAMS.id'); echo json_encode(\Models\Page::instance()->delete($id)); }
function __construct() { $visitor = new Visitor(); $visitor->add(Helper::getIP(), Helper::getBrowser()); $page = new Page(); if (isset($_GET['adress']) && !isset($_POST)) { $page->register($_GET['adress']); Route::get($_GET['adress']); } else { if (isset($_GET['adress']) && isset($_POST)) { $page->register($_GET['adress']); Route::get($_GET['adress'], $_POST); } else { $page->register('/'); Route::get('/'); } } }
private function updatePagePosition($page, $position, $parent = null) { \Models\Page::instance()->setPosition($page->id, $parent, $position); if ($page->children) { foreach ($page->children as $index => $child) { $this->updatePagePosition($child, $index, $page->id); } } }
function stats() { if (Session::isSession('user')) { $getstat = new Visitor(); $daily = $getstat->getDaily(); $bpercent = $getstat->getBrowser(); $getstat2 = new Page(); $pages = $getstat2->getDaily(); $this->view->addIp($_SERVER['REMOTE_ADDR']); $this->view->addBrowser(Helper::getBrowser()); $this->view->addDaily($daily); $this->view->addPages($pages); $this->view->addBrowserpercent($bpercent); $this->view->forAjax('stats'); } else { Error::authFail(); } }
public function __construct() { $this->pageContentModel = \Models\PageContent::instance(); $this->contentListModel = \Models\ContentListElement::instance(); $this->contentListEltModel = \Models\ContentListElement::instance(); $this->contentGroupEltModel = \Models\ContentGroupElement::instance(); $this->imageModel = \Models\Image::instance(); $this->textModel = \Models\Texte::instance(); $this->f3 = \Base::instance(); $this->contentGroupModel = \Models\ContentGroup::instance(); $this->pageModel = $pageModel = \Models\Page::instance(); }
public function actionIndex() { $page = isset($_GET['page']) ? $_GET['page'] : 1; $category = isset($_GET['cat']) ? sprintf('%s', $_GET['cat']) : null; $model = \models\Page::getInstance(); $name = Auth::getUser(); $greet = $name ? 'Welcome, ' . $name . '!' : null; if ($category) { $images = $model->getAllImagesInCategory($category, $page); } else { $images = $model->getAllImagesOnPage($page); } $this->title = "Gallery"; $this->content = $this->generateTemplate('index', ['images' => $images, 'categories' => $model->getAllCategories(), 'currentCategory' => $category, 'pagesAmount' => $model->amountOfPages($category), 'auth' => Auth::isAuthorized(), 'greet' => $greet]); $this->render(); }
/** * {@inheritDoc} */ public function getPath2() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getPath2', array()); return parent::getPath2(); }
/** * autoDispatch by Volter9 * Ability to call controllers in their controller/model/param way */ public static function autoDispatch() { $uri = parse_url($_SERVER['QUERY_STRING'], PHP_URL_PATH); $uri = trim($uri, ' /'); $uri = ($amp = strpos($uri, '&')) !== false ? substr($uri, 0, $amp) : $uri; $parts = explode('/', $uri); $controller = array_shift($parts); $controller = $controller ? $controller : DEFAULT_CONTROLLER; $method = array_shift($parts); $method = $method ? $method : DEFAULT_METHOD; $args = !empty($parts) ? $parts : array(); // Check for file if (!file_exists("app/Controllers/" . ucfirst($controller) . ".php")) { $myroute = Page::cmsRoute(); $customRoute = $parts[0]; if ($myroute > 0) { self::get($customRoute, '\\Controllers\\Page@index'); self::get($customRoute . '/(:any)', '\\Controllers\\Page@index'); self::get($customRoute . '/(:any)/(:any)', '\\Controllers\\Page@index'); self::dispatch(); } else { return false; } return true; } $controller = ucwords($controller); $controller = "\\Controllers\\{$controller}"; $c = new $controller(); if (method_exists($c, $method)) { $c->{$method}($args); //found method so stop return true; } return false; }
public function deletePage() { $http = new Http(); $id = $http->post('id'); $page = new Page($id); $cat = new CategoryPage(); $page->delete(); $cat->excludePage($id); }
private function loadTree($lang, $showHidden = false) { $pageModel = \Models\Page::instance(); $allPages = $pageModel->getAll($lang); if ($allPages === FALSE) { die($pageModel->getSqlLog()); } $this->tree = array(); if (is_array($allPages)) { $mappedPages = array(); foreach ($allPages as $page) { if (!$page['hidden'] || $showHidden) { $mappedPages[$page['id']] = $page; } } foreach ($mappedPages as $id => $page) { $pid = $page['parent_id']; unset($mappedPages[$id]['parent_id']); $mappedPages[$id]['children'] = array(); if ($pid > 0) { $mappedPages[$pid]['children'][] =& $mappedPages[$id]; } else { $this->tree[] =& $mappedPages[$id]; } } } }
/** * Prepare the content for the 'last edited' message, e.g. 'Last edited on 30 August * 2013, at 23:31'. This message is different for the main page since main page * content is typically transcuded rather than edited directly. * @param Title $title The Title object of the page being viewed * @return array */ protected function getHistoryLink(Title $title) { $user = $this->getUser(); $isMainPage = $title->isMainPage(); $mp = new Page($this->getTitle(), false); $timestamp = $mp->getLatestTimestamp(); // Main pages tend to include transclusions (see bug 51924) if ($isMainPage) { $lastModified = $this->msg('mobile-frontend-history')->plain(); } else { $lastModified = $this->msg('mobile-frontend-last-modified-date', $this->getLanguage()->userDate($timestamp, $user), $this->getLanguage()->userTime($timestamp, $user))->parse(); } $historyUrl = $title->getFullURL('action=history'); if ($this->mobileContext) { $historyUrl = $this->mobileContext->getMobileUrl($historyUrl); } $edit = $mp->getLatestEdit(); $link = array('data-timestamp' => $isMainPage ? '' : $edit['timestamp'], 'href' => $historyUrl, 'text' => $lastModified, 'data-user-name' => $edit['name'], 'data-user-gender' => $edit['gender']); $link['href'] = SpecialPage::getTitleFor('History', $title)->getLocalURL(); return $link; }
public static function header($topmenu) { // var_dump($topmenu); foreach ($topmenu as $link) { $topmenu2 = Page::otherMenu($link->page_id); if (count($topmenu2) > 0) { $header .= '<li class="' . Assets::activeClass($link->page_alias, 'active') . ' page_item dropdown">'; $header .= '<a href="' . DIR . $link->page_alias . '" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" >'; } else { $header .= '<li class="' . Assets::activeClass($link->page_alias, 'active') . ' page_item">'; $header .= "<a href='" . DIR . $link->page_alias . "' >"; } $header .= $link->page_name; $header .= "</a>"; $topmenu2 = Page::otherMenu($link->page_id); if (count($topmenu2) > 0) { $header .= '<ul class="dropdown-menu">'; foreach ($topmenu2 as $link2) { $header .= '<li>'; $header .= '<a href="' . DIR . $link->page_alias . '/' . $link2->page_alias . '" >'; $header .= $link2->page_name; $header .= '</a>'; //check for third level menu $topmenu3 = Page::otherMenu($link2->page_id); if (count($topmenu3) > 0) { $header .= '<ul id="nav_menu_3">'; foreach ($topmenu3 as $link3) { $header .= '<li>'; $header .= '<a href="' . DIR . $link->page_alias . '/' . $link2->page_alias . '/' . $link3->page_alias . '; >'; $header .= $link3->page_name; $header .= '</a>'; $header .= '</li>'; } $header .= '</ul>'; } $header .= '</li>'; } $header .= '</ul>'; } $header .= '</li>'; } return $header; }