public function display() { $host = Settings::getInstance()->get("host"); echo "<div style=\"width:300px;margin-right:10px;float:left;\"><h2>" . Language::DirectTranslateHtml("DATATYPES") . "</h2>"; $list = new LinkList(); $url = UrlRewriting::GetUrlByAlias("admin/data", "show="); $list->fillSelect = "SELECT displayName as text, CONCAT('" . $url . "',id) as href FROM {'dbprefix'}datatypes ORDER BY displayName"; $list->display(); echo "</div>"; if (is_numeric($_GET['show'])) { $id = DataBase::Current()->EscapeString($_GET['show']); $datatype = DataBase::Current()->ReadRow("SELECT * FROM {'dbprefix'}datatypes WHERE id = '" . $id . "' ORDER BY displayName"); echo "<div><h2>" . htmlentities($datatype->displayName) . "</h2><p>" . htmlentities($datatype->description) . "</p><h2>" . Language::DirectTranslateHtml("PROPERTIES") . "</h2>"; $table = new Table(); $displayName = new TableColumn("displayName", "Name"); $dataName = new TableColumn("dataName", "Datenname"); $validator = new TableColumn("validator_name", "Inhalt", "IFNULL((SELECT name FROM {'dbprefix'}data_validator WHERE id = {'dbprefix'}datafields.validator),'')"); $table->columns->add($displayName); $table->columns->add($dataName); $table->columns->add($validator); $displayName->autoWidth = true; $validator->autoWidth = true; $table->condition = "dataType = '" . DataBase::Current()->EscapeString($_GET['show']) . "'"; $table->name = "{'dbprefix'}datafields"; $table->orderBy = "displayName"; $table->display(); echo "</div>"; $this->displayEvents(); $this->displaySharing(); } }
/** * Exception, if access is denied * @param string $message message for the user * @param int $code errorcode for automatic handling */ public function __construct($message, $code = 0) { parent::__construct($message, $code); $page = new Page(); $page->loadPropertiesById(Settings::getInstance()->get("accessdenied")); parent::setErrorPage($page); }
/** * * @param Page $page * @param string $separator * @param string $class * @param string $idpraefix */ public static function display(Page $page, $separator, $class, $idpraefix) { $host = Settings::getInstance()->get("host"); $i = 1; $breadcrumb = $page->getBreadcrumb(); $j = 0; foreach ($breadcrumb as $item) { $breadcrumb[$j][0] = UrlRewriting::GetShortUrlByAlias($breadcrumb[$j][0]); $j++; } $currentItem = array_pop($breadcrumb); $fulldir = ""; foreach (explode("/", $_SESSION['dir']) as $dir) { if ($dir != "") { $url = UrlRewriting::GetShortUrlByAlias("admin/home", "dir=" . $fulldir . "/" . $dir); $breadcrumb[] = array($url, $dir); $fulldir .= "/" . $dir; } } $breadcrumb[] = $currentItem; while ($i <= count($breadcrumb)) { echo "<a style='display:inline' href=\"" . $host . $breadcrumb[$i - 1][0] . "\" class=\"" . $class . "\" \n id=\"" . $idpraefix . $i . "\">" . $breadcrumb[$i - 1][1] . "</a>"; if ($i < count($breadcrumb)) { echo $separator; } $i++; } }
protected function upload() { $template = new Template(); $template->load("upload"); $template->assign_var("REFERRER", $_POST['referrer']); $template->show_if("SHOW_MEDIALIBARY", false); if (!file_exists(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'])) { mkdir(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir']); } if (FileServer::upload(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'], $_FILES['file'])) { $name = $_FILES['file']['name']; $template->assign_var("MESSAGE", str_replace("{FILENAME}", $name, Language::DirectTranslate("FILE_UPLOADED"))); $path_info = pathinfo(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'] . "/" . $name); if (strtolower($path_info['extension'] == 'jpg') or strtolower($path_info['extension'] == 'jpeg') or strtolower($path_info['extension'] == 'gif') or strtolower($path_info['extension'] == 'png') or strtolower($path_info['extension'] == 'bmp')) { $template->show_if("SHOW_MEDIALIBARY", true); $template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/media/addimage")); $template->assign_var("FILE_PATH", Settings::getInstance()->get("host") . "content/uploads" . $_SESSION['dir'] . "/" . $name); } } else { if (FileServer::$uploadFailure != "") { $template->assign_var("MESSAGE", FileServer::$uploadFailure); } else { $template->assign_var("MESSAGE", Language::DirectTranslate("FILE_NOT_UPLOADED")); } } $template->output(); }
public function UpdateCurrs() { $setting = Settings::getInstance(); $systemcurr = $setting->Get('system.currency'); $systemcurrrate = NULL; $provider = $setting->Get('system.currency.autoupdate') . 'curprovider'; $ecb = $provider::getInstance(); $provinfo = $ecb->Info(); $currs = $ecb->GetButch(); //find system curr exchange rate for ($i = 0; $i < count($currs); $i++) { if (array_key_exists($systemcurr, $currs[$i])) { $systemcurrrate = $currs[$i][$systemcurr]; } } if ($systemcurr == $provinfo['default']) { $systemcurrrate = 1; } elseif ($systemcurrrate == NULL) { throw new Exception("system default currency doesnt exists in provided data"); } for ($i = 0; $i < count($currs); $i++) { $tempkey = array_keys($currs[$i]); $id = $this->GetID($tempkey[0], 'name'); $rate = $currs[$i][$tempkey[0]] / $systemcurrrate; if (!$id) { $this->Create(array('name' => $tempkey[0], 'rate' => $rate)); } else { $this->Update('rate', $rate, $id); } } return true; }
public function runUpdate() { $path = Settings::getInstance()->get('root') . "/" . $this->path; if (!file_exists($path)) { mkdir($path); } }
public static function getInstance() { if (self::$_instance === null) { $settings = Settings::getInstance(); self::$_instance = new self($settings->db_host(), $settings->db_name(), $settings->db_user(), $settings->db_pass()); } return self::$_instance; }
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)); }
public function Send($users, $data = false, $templatetype = false, $subject = false, $message = false) { $nt = NotifyTemplate::getInstance(); //$ntdata = $nt->FetchData($templateid); $us = UserSettings::getInstance(); $setting = Settings::getInstance(); $nm = NotificationModule::getInstance(); $user = User::getInstance(); $lang = Lang::getInstance(); for ($i = 0; $i < count($users); $i++) { $usersettings = $us->Get($users[$i]['id']); if (@$usersettings[$templatetype] != "0") { if (is_numeric($usersettings['language'])) { $langdata = $lang->FetchData($usersettings['language']); $langcode = $langdata['code']; } else { $langcode = $setting->Get('system.lang.default'); } if (strlen($langcode) != 2) { throw new Exception("Lang code not found or in wrong format"); } if (is_array($data) && $templatetype != '' && $templatetype != false) { if (!is_numeric($templateid = $nt->GetID($templatetype, 'type', "`langcode` = '" . $langcode . "'")) && !is_numeric($templateid = $nt->GetID($templatetype, 'type', "`langcode` = 'en'"))) { throw new Exception("Notify Template not found with type " . $templatetype . " and language " . $langcode); } $ntdata = $nt->FetchData($templateid); if (!is_array($ntdata)) { continue; } $message = $this->prepare_template($ntdata['text'], $data); } elseif (is_string($subject) && is_string($message)) { $ntdata['subject'] = $subject; } else { throw new Exception("Wrong parameters specified"); } if (is_numeric($usersettings['notifymodule']) && is_string($usersettings['notifyaddress'])) { $moduleid = $usersettings['notifymodule']; $address = $usersettings['notifyaddress']; } else { $userdata = $user->FetchData($users[$i]['id']); $moduleid = $setting->Get('system.notifymodule.default'); $address = $userdata['email']; } if (strlen($address) < 2 || !is_numeric($moduleid)) { continue; } if ($nm->Send($moduleid, $address, $ntdata['subject'], $message)) { $status = 'Done'; } else { $status = 'Fail'; } $this->Create(array('userid' => $users[$i]['id'], 'moduleid' => $moduleid, 'subject' => $ntdata['subject'], 'text' => $message, 'address' => $address, 'status' => $status)); } else { return true; } } return true; }
private function AddInfo($plugin_name) { $pluginpath = Settings::getInstance()->get("root") . "system/plugins"; if (is_dir($pluginpath . "/" . $plugin_name)) { if (file_exists($pluginpath . "/" . $plugin_name . "/info.php")) { include $pluginpath . "/" . $plugin_name . "/info.php"; } } }
public function runUpdate() { $destination = fopen(Settings::getInstance()->get("root") . $this->toPath, "w"); $source = fopen($this->fromPath, "r"); while ($a = fread($source, 1024)) { fwrite($destination, $a); } fclose($source); fclose($destination); }
function G_requestUrl() { $reqUri = $_SERVER["REQUEST_URI"]; $base = Settings::getInstance()->getPar('baseUrl'); if (str_starts_with($reqUri, $base)) { $reqUri = substr($reqUri, strlen($base)); } $reqUri = '/' . url_trimAndClean($reqUri); return $reqUri; }
/** * * @param array $params * @return string */ public function getDestination($params) { $res = $this->destination; foreach ($params as $key => $value) { $res = str_replace("{VAR:" . strtoupper($key) . "}", $value, $res); } $res = str_replace("{VAR:ROOT}", Settings::getInstance()->get("root"), $res); $res = str_replace("{VAR:HOST}", Settings::getInstance()->get("host"), $res); return $res; }
/** * * @param string $name * @return string */ public static function getIcon($name) { $res = Settings::getInstance()->get("host"); if (file_exists("../system/skins/" . SkinController::getCurrentSkinName() . "/icons/" . strtolower($name) . ".png")) { $res .= "system/skins/" . SkinController::getCurrentSkinName() . "/icons/" . strtolower($name) . ".png"; } else { $res .= "system/images/icons/" . Settings::getInstance()->get("iconset") . "/" . strtolower($name) . ".png"; } return $res; }
function __construct() { /* * Object of Settings class * * @var Settings * */ $settings = Settings::getInstance(); $this->db = DataBase::getInstance(); $this->db_config = $settings->getDBConfig(); }
/** * * @param string $area * @return string */ public static function getCacheDir($area) { $dir = Settings::getInstance()->get("root") . "/content/cache/" . $area . "/"; if (!file_exists(Settings::getInstance()->get("root") . "/content/cache/")) { mkdir(Settings::getInstance()->get("root") . "/content/cache/"); } if (!file_exists($dir)) { mkdir($dir); } return $dir; }
public function display() { $plugins = new PluginList(); $plugins->loadAll(); foreach ($plugins->plugins as $plugin) { if ($plugin->path == $_GET['plugin']) { echo "<h2>" . $plugin->name . "</h2>"; include Settings::getInstance()->get("root") . "system/plugins/" . $plugin->path . "/" . $plugin->configurationFile; } } }
/** * * @param mixed $data * @return WidgetBase */ public static function getWidget($data) { if (file_exists(Settings::getInstance()->get("root") . 'system/plugins/' . $data->path)) { include_once Settings::getInstance()->get("root") . 'system/plugins/' . $data->path; $res = new $data->class(); $res->path = $data->path; return $res; } else { return null; } }
/** * * @param string $token */ public function __construct($token = null) { if ($token == null) { $token = Settings::getInstance()->get("language"); } $this->language = $token; $alias = Page::Current()->alias; if (Cache::Contains("language", $token . "/" . $alias)) { $this->cache = Cache::getData("language", $token . "/" . $alias); } }
public function getEditableCode() { Cache::clear(); $change = htmlentities(Language::GetGlobal()->getString("CHANGE")); $plugin_contactform_res = "<h3>" . Language::DirectTranslate("plugin_contactform_pagetypetitle") . "</h3>"; $settings = Settings::getRootInstance()->specify("plugin", "contactform"); if ($settings->get("contactform_mail") == "") { $plugin_contactform_res .= "<p><a href=\"" . Settings::getInstance()->get("host") . "admin/pluginsettings.html?plugin=contactform\">" . Language::DirectTranslate("plugin_contactform_nomailfound") . "</a></p>"; } $plugin_contactform_res .= "<input name=\"save\" type=\"submit\" value=\"" . $change . "\" onclick=\"form.action='" . UrlRewriting::GetUrlByAlias("admin/pageedit", "site=" . $this->page->alias) . "' ; target='_self' ; return true\" />"; return $plugin_contactform_res; }
/** * * @return string */ public function getEditableCode() { $template = new Template(); $template->load("control_wysiwyg"); $template->assign_var("CONTENT", $this->page->getEditorContent($this)); $template->assign_var("HOST", Settings::getInstance()->get("host")); $template->assign_var("ALIAS", $this->page->alias); $template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/pageedit", "site=" . $this->page->alias)); $template->assign_var("LANG", strtolower(Settings::getInstance()->get("language"))); $template->assign_var("PREVIEWURL", $this->page->GetUrl()); return $template->getCode(); }
function assignCommons() { global $params; ##prod info $this->assign('ProductTitle', PRODUCT_NAME); ##skin dir $this->assign('skin', '/' . $this->location . '/views/'); $this->assign('bento', '/bento/'); ##global url http/https if (empty($_SERVER["HTTPS"])) { $this->assign('httpUrl', 'http://' . URL . '/'); } else { $this->assign('httpUrl', 'https://' . URL . '/'); } ##site settings $objSettings = Settings::getInstance(); $settings = $objSettings->getEntrys(); $this->assign('Settings', $settings); $metaTitle = $settings['meta']['default-meta-title']; $metaDescription = $settings['meta']['default-meta-description']; $metaKeywords = $settings['meta']['default-meta-keywords']; if (!empty($params['_urlrequest'])) { $objUrls = new FriendlyurlModel(); $objUrls->parseRequest($params['_urlrequest']); $urlMeta = $objUrls->getMetaData($objUrls->url_id); if (!empty($urlMeta['title'])) { $metaTitle = $urlMeta['title']; } if (!empty($urlMeta['description'])) { $metaDescription = $urlMeta['description']; } if (!empty($urlMeta['keywords'])) { $metaKeywords = $urlMeta['keywords']; } $this->assign('urlrequest', $params['_urlrequest']); } ##meta deta $this->assign('metaTitle', $metaTitle); $this->assign('metaDescription', $metaDescription); $this->assign('metaKeywords', $metaKeywords); ##global filesystem path $this->assign('fsPath', DIR); ##user vars $objAuthentication = Authentication::getInstance(); if ($objAuthentication->loggedIn()) { $objUser = new UserModel($objAuthentication->user_id); $this->assign('loggedIn', true); $this->assign('UserInfo', $objUser->getInfo()); } else { $this->assign('loggedIn', false); } }
public static function removeFromCacheByPattern($pattern) { $settings = Settings::getInstance(); $cache_dir = $settings->cache_dir; chdir($cache_dir); if ($pattern != '*') { $pattern = sprintf("*%s*", $pattern); } $res = glob($pattern); foreach ($res as $file) { unlink($cache_dir . "/" . $file); } }
public function getCode() { $res = "<select name=\"" . $this->name . "\" style=\"" . $this->style . "\">"; foreach (FileServer::getFolders(Settings::getInstance()->get("root") . "system/images/icons") as $iconset) { if ($this->value == $iconset) { $res .= "<option value=\"" . htmlentities($iconset) . "\" selected=\"1\">" . htmlentities($iconset) . "</option>"; } else { $res .= "<option value=\"" . htmlentities($iconset) . "\">" . htmlentities($iconset) . "</option>"; } } $res .= "</select>"; return $res; }
function displayBreadcrumb($separator, $class, $idpraefix) { $i = 1; $breadcrumb = $this->page->getBreadcrumb(); $host = Settings::getInstance()->get("host"); while ($i <= count($breadcrumb)) { $url = UrlRewriting::GetUrlByAlias($breadcrumb[$i - 1][0]); echo "<a href=\"" . $url . "\" class=\"" . $class . "\" \n id=\"" . $idpraefix . $i . "\">" . htmlentities($breadcrumb[$i - 1][1]) . "</a>"; if ($i < count($breadcrumb)) { echo $separator; } $i++; } }
public static function setUp() { if (!Log::$configured) { self::$logDir = absolute_from_script(Settings::getInstance()->getPar('logsDir')); self::$debugMode = Settings::getInstance()->getPar('debug') === true; if (self::$debugMode && file_exists(Log::$logDir)) { rrmdir(Log::$logDir); } if (!file_exists(Log::$logDir)) { mkdir(Log::$logDir); } Log::$configured = true; } }
public function GetLang4User($userid) { if (!is_numeric($userid)) { throw new Exception("User ID is not numeric"); } $usersettings = UserSettings::getInstance(); $userlang = $usersettings->Get($userid, 'language'); $userlang = $userlang['language']; if (!preg_match('/[a-z]{2}/i', $userlang)) { $settings = Settings::getInstance(); $userlang = $settings->Get('system.lang.default'); } return $userlang; }
public function __construct($min = -1, $max = -1) { // get the settings class $settings = Settings::getInstance(); // Text labels (note these are also the submit values $this->labels = unserialize($settings->getSetting('buttons_navigation_labels')); $this->enabled = unserialize($settings->getSetting('buttons_navigation_enabled')); $this->show_answer_button = "false"; if ($settings->getSetting('buttons_show_answer_button') == "true") { $this->show_answer_button = "true"; } $this->min = $min; $this->max = $max; }
public function load() { $dir = ''; if (isset($_GET['dir']) && substr($_GET['dir'], 0, 1) != '.') { $dir = $_GET['dir']; } $this->headline = Language::DirectTranslate("plugin_pagelistwidget_pages"); if (Cache::contains("page", "widget_" . $dir)) { $this->content = Cache::getData("page", "widget_" . $dir); } else { $template = new Template(); $template->load("plugin_pagelistwidget_pagelist"); $pages = Page::getPagesByDir($dir); if (substr($dir, 0, 1) == "/") { $shortdir = substr($dir, 1); } else { $shortdir = $dir; } if ($pages) { foreach ($pages as $page) { $shortalias = substr($page->alias, strlen($shortdir)); if (substr($shortalias, 0, 1) == "/") { $shortalias = substr($shortalias, 1); } else { $shortalias = $shortalias; } if (!strpos($shortalias, "/")) { $host = Settings::getInstance()->get("host"); $index = $template->add_loop_item("PAGES"); $template->assign_loop_var("PAGES", $index, "TITLE", $page->title); $template->assign_loop_var("PAGES", $index, "ALIAS", $shortalias); $editurl = UrlRewriting::GetUrlByAlias("admin/pageedit", "site=" . $page->alias); $template->assign_loop_var("PAGES", $index, "EDITURL", $editurl); $deleteurl = UrlRewriting::GetUrlByAlias("admin/pagedelete", "site=" . $page->alias); $template->assign_loop_var("PAGES", $index, "DELETEURL", $deleteurl); $showurl = UrlRewriting::GetUrlByAlias($page->alias); $template->assign_loop_var("PAGES", $index, "SHOWURL", $showurl); } } $template->assign_var("NOPAGES", ""); } else { $template->assign_var("NOPAGES", Language::DirectTranslate("plugin_pagelistwidget_no_pages")); } $this->content = $template->getCode(); if (isset($_GET['dir'])) { Cache::setData("page", "widget_" . $_GET['dir'], $this->content); } } }
private function __construct() { /* * Object of Settings class * * @var Settings * */ $settings = Settings::getInstance(); $this->db_config = $settings->getDBConfig(); $this->connection = new \mysqli($this->db_config['db_host'], $this->db_config['db_user'], $this->db_config['db_password'], $this->db_config['db_name']); if ($this->connection->connect_error) { die($this->connection->connect_error); } $this->connection->set_charset('utf8'); }