/** * Main constructor. * * @param string $moduleName */ function __construct($moduleName = '') { // Инициализация конфига Config::init($moduleName); // БД $this->db = DbClass::init(['host' => DBHOST, 'user' => DBUSER, 'pass' => DBPASS, 'db' => DBNAME, 'charset' => COLLATE]); }
/** * @param String $config_file */ public function __construct($config = array()) { // make sure global statics are set up Config::init($config); Template::init(); $this->ingester = new Ingester(); }
public function init() { parent::init(); $currency = new \Zend_Form_Element_Hidden('currency', array('decorators' => array('ViewHelper'), 'required' => true, 'value' => 'USD')); $amount = new \Tillikum_Form_Element_Number('amount', array('attribs' => array('min' => '-9999.99', 'max' => '9999.99', 'step' => '0.01', 'title' => 'Value must be precise to no more than 2' . ' decimal places'), 'label' => 'Amount', 'required' => true, 'validators' => array('Float', new \Zend_Validate_Between(-9999.99, 9999.99)))); $this->addElements(array($currency, $amount)); }
public static function router() { // System Classes Config::init(); Autoloder::load(); Request::setRequest(); // Router Data Config::$controller = Request::$request['post']['controller']; Config::$action = Request::$request['post']['action']; Config::$route = self::$controller . '/' . self::$action; Config::$session = []; Config::$is_ajax = false; if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') { Config::$is_ajax = true; } // Current User Session Config::locateUserSession(); // API Mode if (!Request::$request['post']) { //Default API Mode Config::$mobile_mode = 'default'; } else { Config::$mobile_mode = Request::$request['post']['mobile']; } return true; }
function plugin(&$url_parts) { $CFG = Config::init(); if (isset($url_parts[0]) && isset($url_parts[1])) { $file_path = $url_parts[0] . DS . $url_parts[1] . '.php'; if (is_file($file = TPL_PATH . 'application/controllers' . DS . $file_path)) { $url_parts = array_slice($url_parts, 2); return $file; } if (is_file($file = APPPATH . 'controllers/' . $file_path)) { $url_parts = array_slice($url_parts, 2); return $file; } } if (isset($url_parts[0])) { $file_path = $url_parts[0] . '.php'; if (is_file($file = TPL_PATH . 'application/controllers' . DS . $file_path)) { $url_parts = array_slice($url_parts, 1); return $file; } if (is_file($file = APPPATH . 'controllers/' . $file_path)) { $url_parts = array_slice($url_parts, 1); return $file; } } $file_path = ($CFG->get('default_controller') == '' ? '' : $CFG->get('default_controller') . DS) . $CFG->get('default_action') . '.php'; if (is_file($file = TPL_PATH . 'application/controllers' . DS . $file_path)) { return $file; } return APPPATH . 'controllers/' . $file_path; }
/** * Constructor. * * @access protected */ protected function __construct() { // Init Config Config::init(); // Turn on output buffering ob_start(); // Display Errors Config::get('system.errors.display') and error_reporting(-1); // Set internal encoding function_exists('mb_language') and mb_language('uni'); function_exists('mb_regex_encoding') and mb_regex_encoding(Config::get('system.charset')); function_exists('mb_internal_encoding') and mb_internal_encoding(Config::get('system.charset')); // Set default timezone date_default_timezone_set(Config::get('system.timezone')); // Start the session Session::start(); // Init Cache Cache::init(); // Init Plugins Plugins::init(); // Init Blocks Blocks::init(); // Init Pages Pages::init(); // Flush (send) the output buffer and turn off output buffering ob_end_flush(); }
/** * @throws Exception * @return void */ public function testInvalidXml() { $this->setExpectedException('Migration\\Exception', 'XML file is invalid'); $validationState = $this->getMockBuilder('Magento\\Framework\\App\\Arguments\\ValidationState')->disableOriginalConstructor()->setMethods(['isValidationRequired'])->getMock(); $validationState->expects($this->any())->method('isValidationRequired')->willReturn(true); $config = new Config($validationState); $config->init(__DIR__ . '/_files/invalid-config.xml'); }
private static function init() { if (self::$init == true) { return; } $string = file_get_contents(self::$config_path); self::$properties = json_decode($string, TRUE); self::$init = true; }
private function __construct() { Config::init(); $this->include_library(); $this->db = $this->init_db(); $this->session = $this->init_session(); $this->flash = $this->init_flash(); $this->log = $this->init_log(); $this->init_cache(); }
private static function init() { global $db; $res = $db->query("SELECT * FROM " . TABLE_CONFIG . ""); while ($row = $db->fetchObject($res)) { self::$values[$row->key] = $row->value; } ksort(self::$values); self::$init = true; }
public function __construct($formatclass, $opts, $extra = array()) { foreach ($opts as $k => $v) { $method = "set_{$k}"; Config::$method($v); } if (count($extra) != 0) { Config::init($extra); } $classname = __NAMESPACE__ . "\\" . $formatclass; $this->format = new $classname(); }
public function __construct($apikey = null, $api_secret = null) { $this->yunpian_config = Config::init(); if ($api_secret == null) { $this->api_secret = $this->yunpian_config['API_SECRET']; } else { $this->api_secret = $apikey; } if ($apikey == null) { $this->apikey = $this->yunpian_config['APIKEY']; } else { $this->apikey = $api_secret; } }
/** * 初始化配置 */ protected static function init() { Config::init(BASE_PATH); Config::loadConfig(CONFIG_PATH . 'global.php'); Config::loadConfig(CONFIG_PATH . Config::get('ENV') . '.php'); date_default_timezone_set(Config::get('TIMEZONE')); //error display if (Config::get('DEBUG')) { ini_set("display_errors", 1); error_reporting(E_ALL ^ E_NOTICE); } else { ini_set("display_errors", 0); error_reporting(0); } }
public static function load() { // app is available static::available(); // load the app configs Config::init(); // initializing encryption Encryption::init(); // initializing the request infos Request::init(); // initializing sessions Session::init(); Session::start(); // handling the routes and response echo Route::response(); }
public function __construct() { if (isset($_REQUEST['reportID'])) { $this->report = new Report($_REQUEST['reportID']); } else { $this->report = new Report(header('Location: index.php')); } if (isset($_REQUEST['outputType'])) { $this->outputType = $_REQUEST['outputType']; } else { $this->outputType = 'web'; } if ($this->outputType != 'web') { $this->startPage = 1; } else { if (isset($_REQUEST['startPage'])) { $this->startPage = $_REQUEST['startPage']; } else { $this->startPage = 1; } } if (isset($_REQUEST['sortColumn'])) { $this->sortColumn = $_REQUEST['sortColumn']; } if (isset($_REQUEST['sortOrder'])) { $this->sortOrder = $_REQUEST['sortOrder']; } if (isset($_REQUEST['titleID'])) { $this->titleID = $_REQUEST['titleID']; } $this->hidden_inputs = new HiddenInputs(); $this->loopThroughParams(); $this->sumColsArray = $this->report->getReportSums(); $this->groupColsArray = $this->report->getGroupingColumns(); if (count($this->groupColsArray) > 0) { $this->perform_subtotal_flag = true; } else { $this->perform_subtotal_flag = false; } $this->outlier = $this->report->getOutliers(); Config::init(); if (Config::$settings->baseURL) { $hasQ = strpos(Config::$settings->baseURL, '?') > 0; $this->baseURL = Config::$settings->baseURL . ($hasQ ? '&' : '?'); } }
public static function boot() { Config::init(); require_once SYS . 'model/database/connector.php'; require_once COMPONENTS . 'database/nitrogen/nitrogen.php'; require_once COMPONENTS . 'database/nitrogen/builder.php'; require_once SYS . 'model/model.php'; Autoload::load(); Request::init(); Response::init(); Url::init(); Log::init(); $boot = new Bootstrap(Config::$path); $boot->getPage(); $boot->getContent(); if (Config::$profiler === true) { echo Log::render(); } }
public static function getByTimeZone($skinsDirPath) { $byTimeZone = []; $d = dir($skinsDirPath); while (false !== ($skinDirName = $d->read())) { if ($skinDirName == '.' || $skinDirName == '..') { continue; } $currentSkinPath = $skinsDirPath . DIRECTORY_SEPARATOR . $skinDirName; Config::init($currentSkinPath); $config = Config::getInstance(); $timezone = $config->timezone; if (!isset($byTimeZone[$timezone])) { $byTimeZone[$timezone] = []; } $byTimeZone[$timezone][] = $currentSkinPath; } $d->close(); return $byTimeZone; }
public function __construct($dbname = null) { Config::init(); if (!self::$db && !(self::$db = new mysqli(Config::$database->host, Config::$database->username, Config::$database->password))) { throw new RuntimeException("There was a problem with the database: " . self::$db->error); } else { if ($dbname) { if (!self::$db->select_db($dbname)) { throw new RuntimeException("There was a problem with the database: " . self::$db->error); } } else { if (!self::$db->select_db(Config::$database->name)) { throw new RuntimeException("There was a problem with the database: " . self::$db->error); } } } if ($dbname) { $this->selectDB($dbname); } }
/** * Sets the test up by loading the DI container and other stuff * * @author Nikos Dimopoulos <*****@*****.**> * @since 2012-09-30 * * @return \Phalcon\DI */ protected function setUp() { $this->checkExtension('phalcon'); // Set the config up $this->config = Config::init(); // Reset the DI container \Phalcon\DI::reset(); // Instantiate a new DI container $di = new \Phalcon\DI(); // Set the URL $di->set('url', function () { $url = new \Phalcon\Mvc\Url(); $url->setBaseUri('/'); return $url; }); $di->set('escaper', function () { return new \Phalcon\Escaper(); }); $this->di = $di; }
public static function init() { if (self::$initialized) { return true; } if (!self::$browser) { self::$browser = new Browser(); } if (!file_exists(INCLUDE_PATH . 'Entete.php')) { self::jump_install(); } else { require_once INCLUDE_PATH . 'Entete.php'; } if (!class_exists('Config')) { self::ErrorAndDie('Invalid file "entete.php" (see entete.dist.php)...', false); } Config::init(); Config::DB_Connect(); DataEngine::conf_cache('wormhole_cleaning'); define('LNG_PATH', TEMPLATE_PATH . 'lng' . DIRECTORY_SEPARATOR . LNG_CODE . DIRECTORY_SEPARATOR); return self::minimalinit(); }
public function __construct($path = null) { $this->config =& Config::init()->load('email'); $this->templatePath = $path; $this->initMailer(); }
<?php /* This class holds configuration values that are constant. Namely the database credentials. */ class Config { public static $DB_NAME; public static $DB_USER; public static $DB_PASS; public static $DB_HOST; public static $NET_LOGIN_BANNER; public static $NET_LOGIN_URL; public static $LOG_TO_FILE; public static $ALLOWED_TYPES; static function init() { self::$DB_NAME = "LECTURE"; self::$DB_USER = "******"; self::$DB_PASS = ""; self::$DB_HOST = "localhost"; self::$NET_LOGIN_BANNER = "UA Lecture Notes"; self::$NET_LOGIN_URL = "http://localhost/UA-Lecture-Notes/login.php"; self::$LOG_TO_FILE = TRUE; self::$ALLOWED_TYPES = array("application/pdf" => "pdf"); } } Config::init();
public function __construct() { Config::init(); }
<?php require_once 'HookService.php'; require_once 'Config.php'; require_once '../config.php'; if (!isset($_POST["fn"])) { return false; } else { if (!in_array($_POST["fn"], HookService::$allowFuntcion)) { return false; } Config::init($CONFIG); $request = $_POST; } call_user_func("HookService::callHook", $request["fn"], $request["params"]);
public function setUp() { Config::init('test'); $this->app = App::getInstance(); }
<?php $dev_mode = true; $project_name = 'diary'; ini_set('display_errors', $dev_mode ? 1 : 0); error_reporting(E_ALL); if (file_exists('localconfig.php')) { require_once 'localconfig.php'; } else { $local_config = array(); } // инклудим require_once 'config.php'; // переписываем конфиг Config::init($local_config); require_once 'include.php'; //jQuery запросы if (isset($_POST['jquery'])) { if (is_string($_POST['jquery'])) { $jModuleName = 'J' . $_POST['jquery']; $jModule = new $jModuleName(); echo $jModule->getJson(); } exit; } Log::timing('total'); try { ob_start(); // разбираем запрос $pageName = Request::initialize(); // авторизуем пользователя
<?php require_once '../components/Config.php'; if (Config::$sCurrentEnvironment == Config::ENVIRONMENT_PRODUCTION) { $aConfig = (require_once '../config/production/config.php'); } else { $aConfig = (require_once '../config/local/config.php'); } Config::init()->setCurrentConfig($aConfig); $sIpspJavaScript = (require_once 'ipspjs.js.template.php'); $sIpspJavaScript = str_replace('%IPSPJS_HOST_NAME%', Config::init()->get('bridge_url'), $sIpspJavaScript); file_put_contents('ipspjs.js', $sIpspJavaScript); function getIpspjsPublicKey($sKeyId) { $sTimestamp = time(); $sToken = md5(date('Y-m-d H:i:s', $sTimestamp . mt_rand(0, 10000))); $sData = str_pad($sKeyId, 6, '0', STR_PAD_LEFT) . $sToken . $sTimestamp; $sPrivateKey = file_get_contents('private.pem'); $rPrivateKey = openssl_pkey_get_private($sPrivateKey); openssl_sign($sData, $sSign, $rPrivateKey, OPENSSL_ALGO_SHA1); // дополнить токен идентификатором ключа расшифровки return $sData . bin2hex($sSign); } $aCardData = ['exp_month' => '01', 'exp_year' => '2017', 'cardholder' => 'TEST CARDHOLDER', 'amount' => sprintf('%s.%s', mt_rand(1, 100), mt_rand(1, 99)), 'currency' => 'RUB']; // mastercard $aCardData['number'] = '5417150396276825'; $aCardData['cvv'] = '789'; // visa (3ds) $aCardData3Ds['number'] = '4652060573334999'; $aCardData3Ds['cvv'] = '067'; // ID ключа для расшифровки
/** * Логгирование * * @param string $sMessage * @param mixed $mData * @param int $iLogLevel */ private function log($sMessage, $mData, $iLogLevel) { if (Config::init()->get('logger_off') || $iLogLevel < Config::init()->get('log_level')) { return; } // трассировка позволяет не передавать множество лишних аргументов при логгировании $aBacktrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); $sClass = isset($aBacktrace[2]['class']) ? $aBacktrace[2]['class'] : 'undefined'; $sFunction = isset($aBacktrace[2]['function']) ? $aBacktrace[2]['function'] : 'undefined'; $sLine = isset($aBacktrace[1]['line']) ? $aBacktrace[1]['line'] : 0; $sFile = str_replace($this->sDeletedPath, '', $aBacktrace[1]['file']); $oStatement = $this->oDb->prepare('INSERT INTO `logs` (`level`, `class`, `function`, `file`, `line`, `message`, `data`, `microtime`, `dt_create`) VALUES (:level, :class, :function, :file, :line, :message, :data, :microtime, :dt_create)'); $data = $this->transformData($mData); $mctime = microtime(true); $dt = date('Y-m-d H:i:s', time()); $oStatement->bindParam(':level', $iLogLevel, PDO::PARAM_INT); $oStatement->bindParam(':class', $sClass, PDO::PARAM_STR); $oStatement->bindParam(':function', $sFunction, PDO::PARAM_STR); $oStatement->bindParam(':file', $sFile, PDO::PARAM_STR); $oStatement->bindParam(':line', $sLine, PDO::PARAM_INT); $oStatement->bindParam(':message', $sMessage, PDO::PARAM_STR); $oStatement->bindParam(':data', $data, PDO::PARAM_STR); $oStatement->bindParam(':microtime', $mctime, PDO::PARAM_STR); $oStatement->bindParam(':dt_create', $dt, PDO::PARAM_STR); $oStatement->execute(); }
/** * Initialize ChainRecord Library method. */ public static function init($path) { Config::init($path); }
Options_Parser::getopt(); /* If no docbook file was passed, die */ if (!is_dir(Config::xml_root()) || !is_file(Config::xml_file())) { trigger_error("No Docbook file given. Specify it on the command line with --docbook.", E_USER_ERROR); } if (!file_exists(Config::output_dir())) { v("Creating output directory..", VERBOSE_MESSAGES); if (!mkdir(Config::output_dir(), 0777, True)) { v("Can't create output directory : %s", Config::output_dir(), E_USER_ERROR); } } elseif (!is_dir(Config::output_dir())) { v("Output directory is not a file?", E_USER_ERROR); } // This needs to be moved. Preferably into the PHP package. if (!$conf) { Config::init(array("lang_dir" => __INSTALLDIR__ . DIRECTORY_SEPARATOR . "phpdotnet" . DIRECTORY_SEPARATOR . "phd" . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR . "langs" . DIRECTORY_SEPARATOR, "phpweb_version_filename" => Config::xml_root() . DIRECTORY_SEPARATOR . 'version.xml', "phpweb_acronym_filename" => Config::xml_root() . DIRECTORY_SEPARATOR . 'entities' . DIRECTORY_SEPARATOR . 'acronyms.xml')); } if (Config::saveconfig()) { v("Writing the config file", VERBOSE_MESSAGES); file_put_contents("phd.config.php", "<?php\nreturn " . var_export(Config::getAllFiltered(), 1) . ";"); } if (Config::quit()) { exit(0); } function make_reader() { //Partial Rendering $idlist = Config::render_ids() + Config::skip_ids(); if (!empty($idlist)) { v("Running partial build", VERBOSE_RENDER_STYLE); $reader = new Reader_Partial();