Exemple #1
0
 public function execute()
 {
     EventManager::RaiseEvent("before_executing_task", array("task" => $this));
     $script = DataBase::Current()->EscapeString($this->script);
     DataBase::Current()->Execute("UPDATE {'dbprefix'}tasks SET lastExecution = NOW() WHERE script = '" . $script . "'");
     include Settings::getInstance()->get("root") . $this->script;
     EventManager::RaiseEvent("after_executing_task", array("task" => $this));
 }
Exemple #2
0
 /**
  *
  * @param string $base
  * @param string $name
  * @return mixed 
  */
 public static function createFolder($base, $name)
 {
     $res = false;
     if (!file_exists($base . "/" . $name)) {
         $res = mkdir($base . "/" . $name, 0777);
     }
     $args['name'] = $base . "/" . $name;
     if (isset($res) && $res) {
         EventManager::RaiseEvent("folder_created", $args);
     }
     return $res;
 }
Exemple #3
0
 /**
  *
  * @return boolean
  */
 public function deactivate()
 {
     $res = false;
     if ($this->isActivated()) {
         $path = DataBase::Current()->EscapeString($this->path);
         @(include Settings::getValue("root") . "system/plugins/" . $path . "/deactivate.php");
         foreach ($this->supportedLanguages as $language) {
             Language::DropLanguagePack("plugin_" . $path, $language);
         }
         $res = DataBase::Current()->Execute("DELETE FROM {'dbprefix'}activated_plugins WHERE path = '" . $path . "'");
         EventManager::RaiseEvent("deactivated_plugin", array("plugininfo", $this));
     }
     return $res;
 }
Exemple #4
0
 /**
  *
  * @param string $path
  * @param string $name
  * @param string $description
  * @return mixed 
  */
 public static function insert($path, $name, $description)
 {
     $path = DataBase::Current()->EscapeString($path);
     $name = DataBase::Current()->EscapeString($name);
     $description = DataBase::Current()->EscapeString($description);
     $res = DataBase::Current()->Execute("INSERT INTO {'dbprefix'}images (path,name,description) \n                                              VALUES ('" . $path . "','" . $name . "','" . $description . "')");
     if ($res) {
         $args['path'] = $path;
         $args['name'] = $name;
         $args['description'] = $description;
         EventManager::RaiseEvent("image_registered", $args);
     }
     return $res;
 }
Exemple #5
0
 static function includeHeader()
 {
     echo "<title>" . htmlentities(Page::Current()->title) . Settings::getValue("title_extention") . "</title>";
     if (Cache::contains("htmlmeta", Page::Current()->id)) {
         echo Cache::getData("htmlmeta", Page::Current()->id);
     } else {
         $cache = "";
         $rows = DataBase::Current()->ReadRows("SELECT name, content\n                            FROM {'dbprefix'}meta_global\n                            UNION SELECT name, content\n                            FROM {'dbprefix'}meta_local\n                            WHERE page = '" . Page::Current()->id . "'");
         if ($rows) {
             foreach ($rows as $row) {
                 echo "<meta name=\"" . htmlentities($row->name) . "\" content=\"" . htmlentities($row->content) . "\" />";
                 $cache .= "<meta name=\"" . htmlentities($row->name) . "\" content=\"" . htmlentities($row->content) . "\" />";
             }
         }
         Cache::setData("htmlmeta", Page::Current()->id, $cache);
     }
     echo Page::Current()->getHeader();
     EventManager::RaiseEvent("header_included", null);
 }
Exemple #6
0
 /**
  *
  * @return boolean
  */
 function delete()
 {
     $res = DataBase::Current()->Execute("DELETE FROM {'dbprefix'}pages WHERE alias = '" . $this->alias . "'");
     if ($res) {
         MenuEntry::DeleteByPage($this);
         $args['alias'] = $this->alias;
         EventManager::RaiseEvent("page_deleted", $args);
     }
     Cache::clear("breadcrumb");
     Cache::clear("page");
     return $res;
 }
Exemple #7
0
 /**
  *
  * @return boolean
  */
 private function update()
 {
     $id = DataBase::Current()->EscapeString($this->id);
     $menu = DataBase::Current()->EscapeString($this->menu);
     $title = DataBase::Current()->EscapeString($this->title);
     $href = DataBase::Current()->EscapeString($this->href);
     $type = DataBase::Current()->EscapeString($this->type);
     $res = DataBase::Current()->Execute("UPDATE {'dbprefix'}menu SET \n                                       href = '" . $href . "', \n                                         title = '" . $title . "', \n                                         type = '" . $type . "' \n                                       WHERE id = '" . $id . "' \n                                       AND menuID = '" . $menu . "'");
     if ($res) {
         $args['menu'] = $menu;
         $args['title'] = $title;
         $args['href'] = $href;
         $args['id'] = $id;
         EventManager::RaiseEvent("menu_entry_edit", $args);
     }
     Cache::clear("menu");
     return $res;
 }
Exemple #8
0
 /**
  *
  * @param int $id
  * @return string 
  */
 static function delete($id)
 {
     $id = DataBase::Current()->EscapeString($id);
     $res = DataBase::Current()->Execute("DELETE FROM {'dbprefix'}menu_names WHERE id = '" . $id . "'");
     if ($res) {
         $res = DataBase::Current()->Execute("DELETE FROM {'dbprefix'}menu WHERE menuID = '" . $id . "'");
         if ($res) {
             $args['id'] = $id;
             EventManager::RaiseEvent("menu_deleted", $args);
         }
     }
     Cache::clear();
     SessionCache::clear();
     return $res;
 }
Exemple #9
0
 public static function displayCurrent()
 {
     EventManager::RaiseEvent("BEFORE_DISPLAYSKIN", array());
     $skin = self::getCurrentSkinName();
     if (file_exists(Settings::getInstance()->get("root") . "/system/skins/" . $skin . "/index.php")) {
         include Settings::getInstance()->get("root") . "/system/skins/" . $skin . "/index.php";
         EventManager::RaiseEvent("AFTER_DISPLAYSKIN", array());
     } else {
         if (file_exists(Settings::getInstance()->get("root") . "/system/skins/default/index.php")) {
             if (DEVELOPMENT) {
                 die("Skin " . $skin . " cannot be found!");
             }
             include Settings::getInstance()->get("root") . "/system/skins/" . $skin . "/index.php";
         } else {
             die("Skin " . $skin . " cannot be found!");
         }
     }
 }
Exemple #10
0
 /**
  *
  * @return boolean
  */
 public function delete()
 {
     $res = false;
     if (!$this->equals(User::Current())) {
         $id = DataBase::Current()->EscapeString(strtolower(trim($this->id)));
         $res = DataBase::Current()->Execute("DELETE FROM {'dbprefix'}user WHERE id = '" . $id . "'");
         Cache::clear("tables", "userlist");
         $args = array();
         $args["user"] = $this;
         EventManager::RaiseEvent("user_deleted", $args);
     }
     return $res;
 }
Exemple #11
0
 /**
  *
  * @param boolean $escape
  * @return string
  */
 public function getCode($escape = false)
 {
     $this->replaceGetParams();
     EventManager::RaiseEvent("PARSE_CONTENT", array("template" => $this));
     $this->template = $this->removeHiddenIfBlocks($this->template);
     foreach ($this->loops as $key => $array) {
         $loop_template = implode("\n", $array);
         $this->template = str_ireplace('<!--LOOP(' . strtoupper($key) . ')-->', $loop_template, $this->template);
     }
     $this->replaceLanguageTokens();
     $this->replaceIcons();
     $this->replaceForms();
     if (!$escape) {
         $this->unescape();
     }
     return $this->template;
 }
Exemple #12
0
 /**
  * Deletes the form.
  */
 public function Delete()
 {
     $id = DataBase::Current()->EscapeString($this->id);
     DataBase::Current()->Execute("DELETE FROM {'dbprefix'}forms WHERE id = '" . $id . "'");
     DataBase::Current()->Execute("DELETE FROM {'dbprefix'}form_fields WHERE id = '" . $id . "'");
     #
     $args = array();
     $args['form'] = $this;
     EventManager::RaiseEvent("FORM_DELETED", $args);
 }
Exemple #13
0
<?php

include 'const.php';
include 'autoload.php';
if (!DEVELOPMENT) {
    error_reporting(0);
    ini_set('display_errors', 0);
} else {
    error_reporting(-1);
    ini_set('display_errors', 1);
}
session_start();
sys::parseGetParams();
//Unescape backslashes in $_POST
array_walk_recursive($_POST, create_function('&$val', '$val = stripslashes($val);'));
if (!isset($_GET['include'])) {
    $_GET['include'] = '';
}
Page::Current()->ExecuteHttpHeader();
EventManager::RaiseEvent("pre_page_load", null);
if (file_exists(Settings::getInstance()->get("root") . $_GET['include'] . ".htm")) {
    include Settings::getInstance()->get("root") . $_GET['include'] . ".htm";
} else {
    SkinController::displayCurrent();
}
Scheduler::runTasks();
Exemple #14
0
 /**
  *
  * @return boolean
  */
 public function delete()
 {
     $res = false;
     if ($this->ID > 3) {
         $id = DataBase::Current()->EscapeString($this->ID);
         $res = DataBase::Current()->Execute("DELETE FROM {'dbprefix'}roles WHERE id = '" . $id . "'");
         if ($res) {
             $res = DataBase::Current()->Execute("DELETE FROM {'dbprefix'}role_rights WHERE role = '" . $id . "'");
         }
         if ($res) {
             $res = DataBase::Current()->Execute("UPDATE {'dbprefix'}user SET role = '1' WHERE role = '" . $id . "'");
         }
         Cache::clear("roles");
         Cache::clear("tables", "rolelist");
         EventManager::RaiseEvent("role_deleted", array("name" => $this->name, "obj" => $this));
     }
     return $res;
 }