public static function getSetting($strName, $strNode = "/config") { if (Page::isPage($strNode)) { $objConfig = new Page($strNode); return $objConfig->getField($strName)->getValue(); } return ""; }
public function Page($path) { if (!Page::isPage($path)) { throw new Exception("Page does not exist: {$path} (" . getPath($path) . ")"); } $this->path = $path; $this->xml = XmlHelper::getXML(getXMLPath($path)); }
public static function GetRecentlyModified($root, $path = "") { $aryDirs = FileSystemHelper::GetAllDirectories($root, $path); $aryPages = array(); foreach ($aryDirs as $d) { if (Page::isPage($d)) { $aryPages[$d] = filemtime(getXMLPath($d)); } } arSort($aryPages, SORT_NUMERIC); return $aryPages; }
public static function getCurrentPage($defaultPage = "/home") { $strPage = $defaultPage; if (array_key_exists("path", $_GET)) { $strPage = $_GET["path"]; /*} elseif ( array_key_exists("PATH_INFO", $_SERVER) ) { $strPage = $_SERVER["PATH_INFO"];*/ } elseif (strstr($_SERVER["SCRIPT_FILENAME"], getPath(""))) { $strPage = "/" . str_replace(getPath(""), "", dirname($_SERVER["SCRIPT_FILENAME"])); } // strip out paths $strPage = preg_replace("/\\/index\\.php\$/", "", $strPage); $strPage = preg_replace("/^\\/content/", "", $strPage); // if page exists, return it, otherwise return default page if (Page::isPage($strPage)) { return $strPage; } return $defaultPage; }
<?php include_once getRootPath() . "/classes/core/Page.php"; include_once getRootPath() . "/classes/core/ContentType.php"; if (array_key_exists("node", $_REQUEST)) { $strNode = stripslashes($_REQUEST["node"]); } else { $strNode = "/home"; } if ($strNode == "") { $strName = "[root]"; } else { $strName = $strNode; } if (Page::isPage($strNode)) { $objPage = new Page($strNode); $objType = $objPage->getContentTypeObject(); $strType = $objType->name; } else { $strType = "content"; } $aryTypes = ContentType::getContentTypes();
$footer = Page::create("/rss", "content"); $footer->setField("Title", "RSS"); $footer->setField("Description", "RSS feeds root page"); $footer->setField("Keywords", "StructureCMS Content Management System"); $footer->save(); } if (!Page::isPage("/rss/latest")) { $latest = Page::create("/rss/latest", "rss"); $latest->setField("Title", "Latest Items"); $latest->setField("Description", "An RSS Feed containing latest items."); $latest->setField("Keywords", "StructureCMS Content Management System"); $latest->setField("Description", "Latest items created or modified on the site"); $latest->save(); } // create settings if (!Page::isPage("/config")) { $settings = Page::create("/config", "settings"); $settings->setField("Site Name", $_POST["sitename"]); $settings->setField("Description", "Default installation of StructureCMS"); $settings->setField("Keywords", "StructureCMS Content Management System"); $settings->setField("Theme", "classic"); $settings->save(); } } else { $strSiteName = array_key_exists("sitename", $_POST) ? $_POST["sitename"] : "StructureCMS"; $strUserName = array_key_exists("username", $_POST) ? $_POST["username"] : "******"; $strPassword1 = array_key_exists("password", $_POST) ? $_POST["password"] : ""; $strPassword2 = array_key_exists("password2", $_POST) ? $_POST["password2"] : ""; $aryHighlightFields = array(); ?> <html>
<?php // CHECK PHP VERSION if (phpversion() < "5.0") { die("This project is only supported in PHP 5 and above."); } require_once "classes/includes/paths.php"; require_once "classes/core/Page.php"; require_once "classes/helpers/UrlHelper.php"; if (!Page::isPage("/home")) { include "installer.php"; } global $PAGE; global $PAGE_HANDLE; $PAGE_HANDLE = UrlHelper::getCurrentPage("/home"); $PAGE = new Page($PAGE_HANDLE); $PAGE->render(); /* ******* LICENSE ******* * * Copyright 2009 Joel Cass * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and
private function reset() { $aryDirectory = scandir(getPath($this->path)); $this->xml = XmlHelper::fromString("<order><pages/></order>"); foreach ($aryDirectory as $strEntry) { if ($strEntry != "." && $strEntry != ".." && Page::isPage($this->path . "/" . $strEntry)) { $this->add($strEntry); } } }