/** * Gets, and creates if neccessary, a store object */ private function _getStore() { if ($this->_store === null) { $this->_store = forward_static_call(array($this->_conf->getKey('class', 'model'), 'getInstance'), $this->_conf->getSection('model_options')); } return $this->_store; }
public function __construct() { parent::__construct(); $this->plugin->call('codice_init'); $config = new configuration(); $blogConfig = $config->getBlogConfiguration(); $this->conf = $blogConfig; $this->themes->conf = $blogConfig; }
/** * set configuration options of the traffic limiter * * @access public * @static * @param configuration $conf * @return void */ public static function setConfiguration(configuration $conf) { self::setLimit($conf->getKey('limit', 'traffic')); self::setPath($conf->getKey('dir', 'traffic')); if (($option = $conf->getKey('header', 'traffic')) !== null) { $httpHeader = 'HTTP_' . $option; if (array_key_exists($httpHeader, $_SERVER) && !empty($_SERVER[$httpHeader])) { self::$_ipKey = $httpHeader; } } }
public function __construct() { parent::__construct(); if ($this->session->check("logged") == false) { $this->redirect("admin/login/nosession/"); } $config = new configuration(); $blogConfig = $config->getBlogConfiguration(); $userConfig = $config->getUserConfiguration(1); $this->conf = $blogConfig; $this->userConf = $userConfig; }
function test_readconfig() { $confmgr = new configuration($this->meta); $conf = $confmgr->_read_config($this->config); //print_r($conf); $this->assertEquals('42', $conf['int1']); $this->assertEquals('6*7', $conf['int2']); $this->assertEquals('Hello World', $conf['str1']); $this->assertEquals('G\'day World', $conf['str2']); $this->assertEquals('Hello World', $conf['str3']); $this->assertEquals("Hello 'World'", $conf['str4']); $this->assertEquals('Hello "World"', $conf['str5']); $this->assertEquals(array('foo', 'bar', 'baz'), $conf['arr1']); }
function test_readconfig() { $this->markTestSkipped('The test config.php and metadata.php files are missing'); $confmgr = new configuration($this->meta); $conf = $confmgr->_read_config($this->config); //print_r($conf); $this->assertEquals('42', $conf['int1']); $this->assertEquals('6*7', $conf['int2']); $this->assertEquals('Hello World', $conf['str1']); $this->assertEquals('G\'day World', $conf['str2']); $this->assertEquals('Hello World', $conf['str3']); $this->assertEquals("Hello 'World'", $conf['str4']); $this->assertEquals('Hello "World"', $conf['str5']); $this->assertEquals(array('foo', 'bar', 'baz'), $conf['arr1']); }
/** * Regarde si un objet connexion a déjà été instancier, * si c'est le cas alors il retourne l'objet déjà existant * sinon il en créer un autre. * @return $instance */ public static function getInstance() { if (!self::$instance instanceof self) { self::$instance = new self(); } return self::$instance; }
/** * * Return Config instance or create intitial instance * * @access public * * @return object * */ public static function getInstance() { if (is_null(self::$instance)) { self::$instance = new configuration(); } return self::$instance; }
public function __construct(projectsModel $model) { parent::__construct(); $this->model = $model; //$this->todolist = new todolist(new todolistModel()); // On initialize la todolist pour le projet $this->viewHelper->setGlobalAssign(array("token" => $this->controllerHelper->_setToken("token"), "configuration" => configuration::getInstance()->getConfiguration(), "javascript" => array("wysihtml5-0.3.0.min", "bootstrap3-wysihtml5", "plugins/tree/jstree.min", "plugins/dropzone/dropzone", "global", "project", "filesmanager"), "css" => array("bootstrap-wysihtml5", "bootstrap3-wysiwyg5-color", "plugins/tree/themes/default/style.min"))); }
public function displayList() { global $cookie, $currentIndex; $warnings = array(); if (!file_exists(_PS_ROOT_DIR_ . '/.htaccess')) { $warnings[] = $this->l('In order to enable the PrestaShop Webservice, please generate the .htaccess file via the "Generators" tab (in the "Tools" tab).'); } if (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === false) { $warnings[] = $this->l('To avoid operating problems, please use an Apache server.'); } if (function_exists('apache_get_modules')) { $apache_modules = apache_get_modules(); if (!in_array('mod_auth_basic', $apache_modules)) { $warnings[] = $this->l('Please activate the Apache module \'mod_auth_basic\' to allow authentication of PrestaShop webservice.'); } if (!in_array('mod_rewrite', $apache_modules)) { $warnings[] = $this->l('Please activate the Apache module \'mod_rewrite\' to allow using the PrestaShop webservice.'); } } else { $warnings[] = $this->l('We could not check if basic authentication and rewrite extensions are activated. Please manually check if they are activated in order to use the PrestaShop webservice.'); } if (!extension_loaded('SimpleXML')) { $warnings[] = $this->l('Please activate the PHP extension \'SimpleXML\' to allow testing of PrestaShop webservice.'); } if (!configuration::get('PS_SSL_ENABLED')) { $warnings[] = $this->l('If possible, it is preferable to use SSL (https) for webservice calls, as it avoids the security issues of type "man in the middle".'); } $this->displayWarning($warnings); foreach ($this->_list as $k => $item) { if ($item['is_module'] && $item['class_name'] && $item['module_name'] && ($instance = Module::getInstanceByName($item['module_name'])) && !$instance->useNormalPermissionBehaviour()) { unset($this->_list[$k]); } } parent::displayList(); }
public function hookLeftColumn($params) { if (Module::isInstalled('smartblog') != 1) { $this->smarty->assign(array('smartmodname' => $this->name)); return $this->display(__FILE__, 'views/templates/front/install_required.tpl'); } else { if (!$this->isCached('smartblogtag.tpl', $this->getCacheId())) { $view_data = array(); $id_lang = $this->context->language->id; if (Configuration::get('smartshowposttag') != '' && Configuration::get('smartshowposttag') != null) { $limit = Configuration::get('smartshowposttag'); } else { $limit = 10; } $id_lang_default = configuration::get('PS_LANG_DEFAULT'); $sqllangdefault = 'SELECT * FROM ' . _DB_PREFIX_ . 'smart_blog_post_tag p INNER JOIN ' . _DB_PREFIX_ . 'smart_blog_post_shop s ON p.id_post=s.id_smart_blog_post AND s.id_shop = ' . (int) Context::getContext()->shop->id . ' INNER JOIN ' . _DB_PREFIX_ . 'smart_blog_tag t ON p.id_tag= t.id_tag where t.id_lang = ' . (int) $id_lang_default . ' LIMIT ' . $limit; $sql = 'SELECT * FROM ' . _DB_PREFIX_ . 'smart_blog_post_tag p INNER JOIN ' . _DB_PREFIX_ . 'smart_blog_post_shop s ON p.id_post=s.id_smart_blog_post AND s.id_shop = ' . (int) Context::getContext()->shop->id . ' INNER JOIN ' . _DB_PREFIX_ . 'smart_blog_tag t ON p.id_tag= t.id_tag where t.id_lang = ' . (int) $id_lang . ' LIMIT ' . $limit; $tags = Db::getInstance()->ExecuteS($sql); if (empty($tags)) { $tags = Db::getInstance()->ExecuteS($sqllangdefault); } $this->smarty->assign(array('tags' => $tags)); } return $this->display(__FILE__, 'views/templates/front/smartblogtag.tpl', $this->getCacheId()); } }
function checkConfig() { $this->cookie = cookie::getInstance(); if (!$this->cookie->check("logged")) { return; } $conf = new configuration(); $row = $conf->findBy('name', 'blog_feedburner_rssLink'); $setupMsg = "<p style=\"border:1px solid #f00;background-color:#ff0;padding:10px;font-size:15px;\">Please <a href=\"{$this->registry->path}admin/config#blog_feedburner_rssLink\">setup</a> the feedburner plugin.</p>"; if (!$row) { echo $setupMsg; } else { if (!preg_match(VALID_URL, $row['value'])) { echo $setupMsg; } } }
/** * Display ZeroBin frontend. * * @access private * @return void */ private function _view() { // set headers to disable caching $time = gmdate('D, d M Y H:i:s \\G\\M\\T'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Pragma: no-cache'); header('Expires: ' . $time); header('Last-Modified: ' . $time); header('Vary: Accept'); // label all the expiration options $expire = array(); foreach ($this->_conf->getSection('expire_options') as $time => $seconds) { $expire[$time] = $seconds == 0 ? i18n::_(ucfirst($time)) : filter::time_humanreadable($time); } // translate all the formatter options $formatters = array_map(array('i18n', 'translate'), $this->_conf->getSection('formatter_options')); // set language cookie if that functionality was enabled $languageselection = ''; if ($this->_conf->getKey('languageselection')) { $languageselection = i18n::getLanguage(); setcookie('lang', $languageselection); } $page = new RainTPL(); $page::$path_replace = false; // we escape it here because ENT_NOQUOTES can't be used in RainTPL templates $page->assign('CIPHERDATA', htmlspecialchars($this->_data, ENT_NOQUOTES)); $page->assign('ERROR', i18n::_($this->_error)); $page->assign('STATUS', i18n::_($this->_status)); $page->assign('VERSION', self::VERSION); $page->assign('DISCUSSION', $this->_conf->getKey('discussion')); $page->assign('OPENDISCUSSION', $this->_conf->getKey('opendiscussion')); $page->assign('MARKDOWN', array_key_exists('markdown', $formatters)); $page->assign('SYNTAXHIGHLIGHTING', array_key_exists('syntaxhighlighting', $formatters)); $page->assign('SYNTAXHIGHLIGHTINGTHEME', $this->_conf->getKey('syntaxhighlightingtheme')); $page->assign('FORMATTER', $formatters); $page->assign('FORMATTERDEFAULT', $this->_conf->getKey('defaultformatter')); $page->assign('NOTICE', i18n::_($this->_conf->getKey('notice'))); $page->assign('BURNAFTERREADINGSELECTED', $this->_conf->getKey('burnafterreadingselected')); $page->assign('PASSWORD', $this->_conf->getKey('password')); $page->assign('FILEUPLOAD', $this->_conf->getKey('fileupload')); $page->assign('BASE64JSVERSION', $this->_conf->getKey('base64version')); $page->assign('LANGUAGESELECTION', $languageselection); $page->assign('LANGUAGES', i18n::getLanguageLabels(i18n::getAvailableLanguages())); $page->assign('EXPIRE', $expire); $page->assign('EXPIREDEFAULT', $this->_conf->getKey('default', 'expire')); $page->assign('EXPIRECLONE', !$this->_doesExpire || $this->_doesExpire && $this->_conf->getKey('clone', 'expire')); $page->assign('URLSHORTENER', $this->_conf->getKey('urlshortener')); $page->draw($this->_conf->getKey('template')); }
public static function initTimer($wsGetArray, $wsPostArray, $cachetimeLbl, $lastrequestLbl) { self::$timeOnInit = time(); self::$wsGetList = $wsGetArray; self::$wsPostList = $wsPostArray; self::$cachetimeLbl = $cachetimeLbl; self::$lastrequestLbl = $lastrequestLbl; $completeWslist = array_merge(self::$wsGetList, self::$wsPostList); foreach ($completeWslist as $ws) { // ex 'OSI_CACHETIME_WSO-G002' $WSOInfosList[] = self::$cachetimeLbl . $ws; // ex 'OSI_LASTREQUEST_WSO-G002' $WSOInfosList[] = self::$lastrequestLbl . $ws; } self::$wsInfosList = configuration::getMultiple($WSOInfosList); }
public function actionIndex() { $this->htmlOption = array('class' => 'icon-head head-products', 'header' => "货运设置", 'button' => array(array('class' => 'scalable save', 'id' => 'form-save', 'header' => '保存'))); $carrier = $this->loadModel(); if ($_POST['SHIPPING']) { configuration::updateItems($_POST['SHIPPING']); } if ($_POST['feeAdd']) { foreach ($_POST['feeAdd'] as $key => $row) { if ($row != 0) { $arr = explode('-', $key); $delivery = new delivery(); $delivery->carrier_ID = $_POST['carrier_ID']; $delivery->zone_ID = $arr[0]; $delivery->weight_range_ID = $arr[1]; $delivery->price = $row; $delivery->save(); } } } if ($_POST['feeUpdate']) { foreach ($_POST['feeUpdate'] as $key => $row) { $delivery = delivery::model()->findByPk($key); if ($row != 0 && $row != $delivery->price) { $delivery->price = $row; $delivery->save(); } else { if ($row == 0) { $delivery->delete(); } } } } $config = configuration::item('SHIPPING', 'SHIPPING_FREE_PRICE'); $this->constructScript('index'); $this->render('index', array('config' => $config, 'carrier' => $carrier)); }
/** * Sets Vivvo registered modules. * * @return void */ function set_modules() { $this->_modules = $this->_configuration->get_configuration_property_list('modules'); }
public function config($id = null) { if ($this->data) { $C = new configuration(); foreach ($this->data as $name => $value) { if ($C->findBy("name", $name)) { //updating $C['value'] = trim($value); $C->save(); } else { //adding new record. $C = new configuration(); $new_value = array(); $new_value['name'] = $name; $new_value['value'] = $value; $new_value['id_user'] = 1; $C->prepareFromArray($new_value); $C->save(); } } $this->redirect("admin/config"); } $this->registry->conf = $this->conf; $this->registry->userConf = $this->userConf; $this->plugin->call('admin_init_config'); $this->view->conf = $this->registry->conf; $this->view->userConf = $this->registry->userConf; $this->view->setLayout("admin"); $this->render(); }
/** * Runs a DB query and returns a result based on arguments which specify what to look for * * @param string $query The query to run * @param boolean $checkResult Whether to check that a result was found (not needed for update/delete, only select): This result may be empty * @param boolean $resultCheck Whether to check for returned results from the query * @return unknown */ function runDBQuery($query, $checkResult = false, $resultCheck = false) { if (!isset($this->iniUtilities) || !is_object($this->iniUtilities)) { $this->dbUtilities = new dbUtilities(); $this->iniUtilities = new iniUtilities(); } $wizConfigHandler = new configuration(); $configPath = $wizConfigHandler->readConfigPathIni(); $this->iniUtilities->load($configPath); $dconf = $this->iniUtilities->getSection('db'); $this->dbUtilities->load($dconf['dbHost'], '', $dconf['dbAdminUser'], $dconf['dbAdminPass'], $dconf['dbName']); $result = $this->dbUtilities->query($query); if ($checkResult) { $assArr = $this->dbUtilities->fetchAssoc($result); if ($resultCheck) { return !is_null($assArr); } else { return is_null($assArr); } } return !is_null($result); }
function delete_many($arg_arr_ids) { if (is_array($arg_arr_ids)) { while (list(, $id) = each($arg_arr_ids)) { $obj = new configuration($id); $obj->delete(); } } }
public function addComment($urlfriendly = null) { $C = new configuration(); $codice = $C->getBlogConfiguration(); if ($this->data) { if (is_null($urlfriendly) === true) { $this->redirect($codice['blog_siteurl'], true); } $P = new post(); $post = $P->findBy('urlfriendly', $urlfriendly); if ($P->isNew() === true) { $this->redirect($codice['blog_siteurl'], true); } if (isset($this->data["resultado"]) === true) { $captcha = $this->data['resultado']; if ($captcha != '5') { $this->session->flash('Tu comentario no puede ser agregado. Necesitas contestar la pregunta correctamente.'); $this->redirect("{$post['urlfriendly']}#comments"); } unset($this->data['resultado']); } else { $this->session->flash('Tu comentario no puede ser agregado. Necesitas contestar la pregunta.'); $this->redirect("{$post['urlfriendly']}#comments"); } if ($this->cookie->check('id_user')) { $this->data['user_id'] = $this->cookie->id_user; $this->data['status'] = 'publish'; } else { $this->data['user_id'] = 0; $this->data['status'] = 'waiting'; } $this->data['type'] = ''; //'pingback', 'trackback', '' $this->data['IP'] = utils::getIP(); $this->data['ID_post'] = $post["ID"]; $this->cookie->author = $this->data['author']; $this->cookie->email = $this->data['email']; $this->cookie->url = $this->data['url']; $C = new comment(); $C->prepareFromArray($this->data); $valid = $C->save(); if ($valid) { $this->registry->lastCommentID = $valid; $this->registry->postID = $post["ID"]; $this->plugin->call("index_comment_added"); } if ($valid and $this->isAjax()) { echo $valid; } else { if ($valid) { $this->redirect("{$post['urlfriendly']}#comment-{$valid}"); } else { $this->redirect("{$post['urlfriendly']}"); } } } }
function getall() { global $__in, $__out; $configuration = new configuration(); $__out['arr_configurations'] = $configuration->getall(); return true; }
ob_start('ob_gzhandler'); } else { ob_start(); } if (version_compare(phpversion(), '5.1.0', '<') == true) { die("PHP5 = false : PHP5 required"); } //////////////////////////////////// // Define root directory //////////////////////////////////// define('__SITE_PATH', realpath(dirname(__FILE__))); //////////////////////////////////// // Get Configuration Object //////////////////////////////////// include __SITE_PATH . "/core/library/config.class.php"; $configuration = configuration::getInstance(); //////////////////////////////////// // Set system time //////////////////////////////////// $date_time = date($configuration->config_values['application']['date_format']); //////////////////////////////////// // Set Time Zone //////////////////////////////////// date_default_timezone_set($configuration->config_values['application']['timezone']); //////////////////////////////////// // Load Classes - Core //////////////////////////////////// include __SITE_PATH . "/core/library/error.class.php"; include __SITE_PATH . "/core/library/template.class.php"; include __SITE_PATH . "/core/database/db.class.php"; ////////////////////////////////////
public function __construct() { $this->conexion = parent::conectar(); return $this->conexion; }
<?php define("USERS_URL", LIVE_URL . "/modules/users/"); define("USERS_VIEWS", BASE_URL . "/modules/users/views/"); $config["users"] = array("icon" => "fa fa-users", "menu" => array("Utilisateurs" => USERS_URL . "index.php?page=getSidebar")); configuration::getInstance()->setConfiguration("menus", array("name" => "users", "icon" => "fa fa-users", "menu" => array("Utilisateurs" => USERS_URL . "/index.php?page=getSidebar")));
/** * Prepare the configuration data for the moodle form. * * @return object */ public function prepare_data_for_form() { $data = $this->to_record(); foreach (configuration::get_defaultable_keys() as $key) { $data->{$key} = $this->get_config($key, configuration::get_default_value($key)); } return $data; }
<?php include "header.php"; require_once "../common/class/configuration.class.php"; $configuration = new configuration(); ?> <script> function validno(no) { return(/^[0-9]+$/.test(no.toString())); } function validemailid(email) { //return(/^([\w\.]+)\@([\w]+)\.([\w\.]+)$/.test(email.toString())); return(/^[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9\.-]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/.test(email.toString())); } function checkconfiguration() { switch(document.getElementById('formtype').value) { case "number": if(!validno(document.getElementById('configvaluenumber').value)) { alert("Invalid Number.."); document.getElementById('configvaluenumber').focus(); document.getElementById('configvaluenumber').select(); return false; } else
public function isFreeshipping() { $freeshippingPrice = configuration::item('SHIPPING', 'SHIPPING_FREE_PRICE'); if ($this->getOrderTotal(4) >= $freeshippingPrice) { return TRUE; } $req = Yii::app()->db->createCommand('SELECT m2.discount_ID FROM {{cart_discount}} as m1 ' . ' LEFT JOIN {{discount_entity}} as m2 ON m1.discount_ID=m2.discount_ID' . " WHERE m2.discount_type=3 AND m1.cart_ID={$this->cart_ID}"); if ($req->queryScalar()) { return TRUE; } return FALSE; }
public function testHandleMissingSubKeys() { $options = $this->_options; unset($options['expire_options']['1week']); unset($options['expire_options']['1year']); unset($options['expire_options']['never']); helper::createIniFile(CONF, $options); $conf = new configuration(); $options['expire']['default'] = '5min'; $this->assertEquals($options, $conf->get(), 'not overriding "missing" subkeys'); }
public function checkForWarning() { if (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === false) { $this->warnings[] = $this->l('To avoid operating problems, please use an Apache server.'); if (function_exists('apache_get_modules')) { $apache_modules = apache_get_modules(); if (!in_array('mod_auth_basic', $apache_modules)) { $this->warnings[] = $this->l('Please activate the \'mod_auth_basic\' Apache module to allow authentication of PrestaShop\'s webservice.'); } if (!in_array('mod_rewrite', $apache_modules)) { $this->warnings[] = $this->l('Please activate the \'mod_rewrite\' Apache module to allow the PrestaShop webservice.'); } } else { $this->warnings[] = $this->l('We could not check to see if basic authentication and rewrite extensions have been activated. Please manually check if they\'ve been activated in order to use the PrestaShop webservice.'); } } if (!extension_loaded('SimpleXML')) { $this->warnings[] = $this->l('Please activate the \'SimpleXML\' PHP extension to allow testing of PrestaShop\'s webservice.'); } if (!configuration::get('PS_SSL_ENABLED')) { $this->warnings[] = $this->l('It is preferable to use SSL (https:) for webservice calls, as it avoids the "man in the middle" type security issues.'); } foreach ($this->_list as $k => $item) { if ($item['is_module'] && $item['class_name'] && $item['module_name'] && ($instance = Module::getInstanceByName($item['module_name'])) && !$instance->useNormalPermissionBehaviour()) { unset($this->_list[$k]); } } $this->renderList(); }
<?php include "header.php"; require_once "../common/class/configuration.class.php"; $configuration = new configuration(); if ($_GET['wtdo'] == 'add_variable' && $_POST != "") { $configuration->add_variable($_POST); } if ($_GET['wtdo'] == 'edit_variable' && $_POST != "") { $add = $configuration->edit_configuration($_POST, $_GET['cid']); } $config = $configuration->getall_values(); ?> <table align="center" > <tr> <td><img src="images/configuration.png" /></td> <td style="color:#003399; font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:18px;" align="center" valign="middle"> List of Configuration Values</td> </tr> </table> <br /> <a href='add_variable.php'>ADD VARIABLE</a> <table width="100%" cellspacing="3" cellpadding="3" style="font-family:Arial, Helvetica, sans-serif; font-size:13px;" align="center"> <tr bgcolor="#3262bd" align="left" > <th style="font-weight:bold; font-size:13px;color:#ffffff;" width="300">Configuration Name</th> <th style="font-weight:bold; font-size:13px;color:#ffffff;" width="300">Value</th> <th style="font-weight:bold; font-size:13px;color:#ffffff;" width="30">Type</th> <th style="font-weight:bold; font-size:13px;color:#ffffff;" width="30" >Edit</th> </tr>