public function main($args) { if ($args['articles'] != null && !is_array($args['articles'])) { $msgbox = new MessageBox("Can't render archive frontend: wrong argument 'articles'!"); die($msgbox->getImports() . $msgbox->toHTML()); } if ($args['articles'] != null) { $this->articles =& $args['articles']; } $this->articleHTML = ""; $this->generateArticleHTML(); }
public function main($args) { if (!isset($args['page'])) { $msgbox = new MessageBox("Can't render page frontend: missing argument 'page'!"); die($msgbox->getImports() . $msgbox->toHTML()); } if ($args['page'] instanceof Page == false) { $msgbox = new MessageBox("Can't render page frontend: wrong argument 'page'!"); die($msgbox->getImports() . $msgbox->toHTML()); } $this->page = $args['page']; }
public function main($args) { if (!isset($args['error_code'])) { $msgbox = new MessageBox("Can't render error frontend: missing argument 'error_code'!"); die($msgbox->getImports() . $msgbox->toHTML()); } if (!is_numeric($args['error_code'])) { $msgbox = new MessageBox("Can't render article frontend: wrong argument 'error_code'!"); die($msgbox->getImports() . $msgbox->toHTML()); } $this->errorCode = $args['error_code']; }
public function main($args) { if (!isset($args['article'])) { $msgbox = new MessageBox("Can't render article frontend: missing argument 'article'!"); die($msgbox->getImports() . $msgbox->toHTML()); } if ($args['article'] instanceof Article == false) { $msgbox = new MessageBox("Can't render article frontend: wrong argument 'article'!"); die($msgbox->getImports() . $msgbox->toHTML()); } $this->article =& $args['article']; $this->commentsHTML = ""; $this->generateCommentsHTML(); }
public function main($args) { getDisplay()->setTemplateDir(ROOT . "/orongo-admin/theme/"); if (!isset($args['page_title'])) { $msgbox = new MessageBox("Can't render admin frontend: missing argument 'page_title'!"); die($msgbox->getImports() . $msgbox->toHTML()); } if (!isset($args['page_template'])) { $msgbox = new MessageBox("Can't render admin frontend: missing argument 'page_template!"); die($msgbox->getImports() . $msgbox->toHTML()); } if (!is_string($args['page_template'])) { $msgbox = new MessageBox("Can't render admin frontend: wrong argument 'page_template'!"); die($msgbox->getImports() . $msgbox->toHTML()); } if (!is_string($args['page_title'])) { $msgbox = new MessageBox("Can't render admin frontend: wrong argument 'page_title'!"); die($msgbox->getImports() . $msgbox->toHTML()); } $this->pageTemplate = $args['page_template']; $this->objects = array(); $this->pageTitle = l($args['page_title']); }
if (getUser()->getRank() != RANK_ADMIN) { header("Location: " . orongoURL("orongo-admin/index.php?msg=0")); exit; } if (!isset($_POST['website_url']) || !isset($_POST['website_style']) || !isset($_POST['website_name']) || !isset($_POST['website_lang']) || !isset($_POST['show_archive'])) { header("Location: " . orongoURL("orongo-admin/orongo-settings.php")); exit; } if (Settings::getWebsiteURL() != $_POST['website_url'] && !empty($_POST['website_url'])) { Settings::setWebsiteURL($_POST['website_url']); } if (Settings::getWebsiteName() != $_POST['website_name'] && !empty($_POST['website_name'])) { Settings::setWebsiteName($_POST['website_name']); } if (Settings::getLanguageName() != $_POST['website_lang'] && !empty($_POST['website_lang'])) { Settings::setLanguageName($_POST['website_lang']); } if (strval(Settings::showArchive()) != $_POST['show_archive'] && !empty($_POST['show_archive'])) { Settings::setShowArchive($_POST['show_archive']); } if (getStyle()->getStyleFolder() != $_POST['website_style'] && file_exists(ROOT . "/themes/" . $_POST['website_style']) . "/info.xml") { try { Settings::setStyle($_POST['website_style']); } catch (Exception $e) { $msgbox = new MessageBox("Can't install style: " . $_POST['website_style']); $msgbox->bindException($e); die($msgbox->getImports() . $msgbox->toHTML()); } } header("Location: " . orongoURL("orongo-admin/orongo-settings.php?msg=0")); exit;
/** * Renders the Display */ public function render() { if ($this->rendered) { return; } $this->setTemplateVariable("website_name", Settings::getWebsiteName()); $this->setTemplateVariable("website_url", Settings::getWebsiteURL()); $this->setTemplateVariable("version", "r" . REVISION); $this->setTemplateVariable("menu", getMenu()->toHTML()); if (getUser() != null) { $this->setTemplateVariable("user", getUser()); $on = new OrongoNotifier(); $on->start(); } if (!$this->isImported(orongoURL('orongo-admin/theme/smoothness/jquery-ui-1.8.16.custom.css'))) { $this->import(orongoURL('orongo-admin/theme/smoothness/jquery-ui-1.8.16.custom.css')); } if (!$this->isImported('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js')) { $this->import('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'); } foreach ($this->objects as $object) { if ($object == null) { continue; } if ($object instanceof OrongoDisplayableObject == false) { continue; } $this->addToTemplateVariable("body", $object->toHTML()); } foreach ($this->imports as $import) { $type = strrev($import); $type = explode(".", $type); $type = strrev($type[0]); if (stristr($type, "?")) { $type = explode("?", $type); $type = $type[0]; } switch ($type) { case "css": $this->addHTML('<link rel="stylesheet" href="' . $import . '" type="text/css" media="screen" />', "head"); break; case "js": $this->addHTML('<script type="text/javascript" src="' . $import . '"></script>', "head"); break; default: break; } } $this->addToTemplateVariable("head", $this->head); $this->addToTemplateVariable("body", $this->generalhtml); foreach ($this->pluginhtml as $field => $html) { $this->setTemplateVariable($field, $html); } $this->addToTemplateVariable("body", '<script type="text/javascript">' . $this->js . '</script>'); foreach ($this->tpls as $tpl) { if (empty($tpl)) { continue; } if (function_exists("getCurrentPage") && !stristr(getCurrentPage(), "admin") && !file_exists(raintpl::$tpl_dir . $tpl . ".html")) { $msgbox = new MessageBox("Style was missing a file: " . $tpl . ".html"); die($msgbox->getImports() . $msgbox->toHTML()); } $this->raintpl->draw($tpl); } $this->rendered = true; }
/** * Database Class * * @author Jaco Ruit */ function dbErrorHandler($args) { $msgb = new MessageBox("SQL Error - " . $args['error'] . " <br/><br /><strong>Query</strong><br />" . $args['query']); die($msgb->getImports() . $msgb->toHTML()); }
/** *Starts Orongo! :) * @param String $paramCurrentPage the current page */ function startOrongo($paramCurrentPage = 'anonymous') { session_start(); define("ROOT", dirname(__FILE__)); define("LIB", ROOT . "/lib"); define("ADMIN", ROOT . "/orongo-admin"); define("CONFIG", ROOT . "/config.php"); define('RANK_ADMIN', 3); define('RANK_WRITER', 2); define('RANK_USER', 1); define('ARTICLE_NOT_EXIST', 2100); define('PAGE_NOT_EXIST', 3100); define('USER_NOT_EXIST', 4100); define('COMMENT_NOT_EXIST', 5100); error_reporting(E_ALL); if (file_exists("orongo-install.php")) { die("If you didn't install OrongoCMS yet, proceed to the <a href='orongo-install.php'>installer</a><br/>If you installed it, please delete orongo-install.php"); } if (!file_exists(CONFIG)) { die("config.php (" . CONFIG . ") was missing!"); } require_once CONFIG; require LIB . '/function_load.php'; try { load(LIB); } catch (Exception $e) { die($e->getMessage()); } setDatabase(new Database(CONFIG)); try { setLanguage(new Language(ADMIN . '/lang/' . Settings::getLanguageName())); } catch (Exception $e) { $msgbox = new MessageBox(); $msgbox->bindException($e); die($msgbox->getImports() . $msgbox->toHTML()); } setCurrentPage($paramCurrentPage); $style = null; try { $style = Settings::getStyle(); } catch (Exception $e) { $msgbox = new MessageBox(); $msgbox->bindException($e); die($msgbox->getImports() . $msgbox->toHTML()); } setMenu(new Menu()); setStyle($style); setDisplay(new Display($style->getStylePath())); setUser(handleSessions()); if (defined('HACK_PLUGINS') && HACK_PLUGINS == true) { Plugin::hackKeys(); } try { setPlugins(Plugin::getActivatedPlugins('orongo-admin/')); } catch (Exception $e) { $msgbox = new MessageBox(); $msgbox->bindException($e); getDisplay()->addObject($msgbox); } //getLanguage()->setTempLanguage(ADMIN . '/lang/en_US'); OrongoDefaultEventHandlers::init(); }
/** * Returns activated plugins * @return array containing plugins */ public static function getActivatedPlugins() { $loadedPluginNames = array(); if (self::$requiresDone) { throw new Exception(); } self::$requiresDone = true; self::$authKeys = array(); $rows = getDatabase()->query("SELECT `plugin_xml_path` FROM `activated_plugins`"); $plugins = array(); $count = 0; foreach ($rows as $row) { $infoXML = $row['plugin_xml_path']; if (!file_exists($infoXML)) { if (!file_exists('../' . $infoXML)) { continue; } $infoXML = '../' . $infoXML; } $xml = @simplexml_load_file($infoXML); $json = @json_encode($xml); $info = @json_decode($json, true); if (in_array($info['plugin']['name'], $loadedPluginNames)) { throw new ClassLoadException("There is already a plugin loaded with this name: " . $info['plugin']['name']); } switch (trim(strtoupper($info['plugin']['language']))) { case "PHP": try { $phpFile = self::getPHPFile($infoXML); } catch (Exception $e) { $msgbox = new MessageBox(); $msgbox->bindException($e); die($msgbox->getImports() . $msgbox->toHTML()); } require_once $phpFile; try { $className = $info['plugin']['main_class']; $accessKey = $info['plugin']['access_key']; $authKey = md5(rand() . microtime() . rand()); self::$authKeys[$authKey] = $accessKey; $plugin = new $className(array("time" => time(), "auth_key" => $authKey)); if ($plugin instanceof OrongoPluggableObject == false) { throw new ClassLoadException("Invalid plugin object!"); } $plugin->setXMLFile($infoXML); $plugins[$count] = $plugin; $count++; } catch (IllegalMemoryAccessException $ie) { throw new ClassLoadException("Plugin tried to access illegal memory. Unable to load plugin (php): <br /> " . $phpFile); continue; } catch (Exception $e) { throw new ClassLoadException("Unable to load plugin (php): <br /> " . $phpFile . "<br/><br /><strong>Exception</strong><br />" . $e->getMessage()); continue; } break; case "OSC": try { $oscFile = self::getOSCFile($infoXML); } catch (Exception $e) { $msgbox = new MessageBox(); $msgbox->bindException($e); die($msgbox->getImports() . $msgbox->toHTML()); } try { $accessKey = $info['plugin']['access_key']; $authKey = md5(rand() . microtime() . rand()); self::$authKeys[$authKey] = $accessKey; $pluginBridge = new OrongoScriptPluginBridge(array("osc_file" => $oscFile, "time" => time(), "auth_key" => $authKey)); $pluginBridge->setXMLFile($infoXML); $plugins[$count] = $plugin; $count++; } catch (OrongoScriptParseException $pe) { throw new ClassLoadException("Unable to load plugin (osc): <br /> " . $oscFile . "<br/><br/><strong>OrongoScriptParseException</strong><br />" . $pe->getMessage()); } catch (Exception $e) { throw new ClassLoadException("Unable to load plugin (osc): <br /> " . $oscFile . "<br/><br /><strong>Exception</strong><br />" . $e->getMessage()); continue; } break; default: throw new ClassLoadException("Invalid plugin language: " . $info['plugin']['language'] . "!"); break; } } return $plugins; }