本文整理汇总了PHP中loadConfig函数的典型用法代码示例。如果您正苦于以下问题:PHP loadConfig函数的具体用法?PHP loadConfig怎么用?PHP loadConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loadConfig函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->db = loadModel('session_model');
$this->lifetime = loadConfig('config', 'session_ttl');
session_set_save_handler(array(&$this, 'open'), array(&$this, 'close'), array(&$this, 'read'), array(&$this, 'write'), array(&$this, 'destroy'), array(&$this, 'gc'));
session_start();
}
示例2: __construct
public function __construct()
{
$this->db_config = loadConfig('dbconfig');
$this->db_setting = 'default';
$this->table_name = 'session';
parent::__construct();
}
示例3: prepare_items
function prepare_items()
{
$iterator = new DirectoryIterator($this->skinsDir);
$skins = array();
foreach ($iterator as $item) {
if (!$item->isDot() and $item->isDir()) {
$skin = $item->getBasename();
$neon = $item->getPathname() . "/{$skin}.neon";
if (file_exists($neon)) {
$config = loadConfig($neon);
$skins[$skin]['name'] = $config['name'];
$skins[$skin]['url'] = "{$this->skinsUrl}/{$skin}";
$skins[$skin]['author'] = $config['author'];
$skins[$skin]['desc'] = $config['desc'];
$skins[$skin]['theme'] = isset($config['theme']) ? $config['theme'] : '';
if (file_exists("{$this->skinsDir}/{$skin}/{$skin}-screenshot.png")) {
$skins[$skin]['screenshot'] = "{$this->skinsUrl}/{$skin}/{$skin}-screenshot.png";
} else {
$skins[$skin]['screenshot'] = '';
}
}
}
}
uksort($skins, "strnatcasecmp");
$per_page = 15;
$page = $this->get_pagenum();
$start = ($page - 1) * $per_page;
$this->items = array_slice($skins, $start, $per_page);
$this->set_pagination_args(array('total_items' => count($skins), 'per_page' => $per_page));
}
示例4: __construct
/**
* @desc constructor for mysql class
* @param string $sEnvType
*/
private function __construct($sEnvType = 'release')
{
if ($sEnvType == 'test') {
$this->_dbconfig = loadConfig('DBTest');
} elseif ($sEnvType == 'release') {
$this->_dbconfig = loadConfig('DB');
} else {
if (isTestEnv()) {
$this->_dbconfig = loadConfig('DBTest');
} else {
$this->_dbconfig = loadConfig('DB');
}
}
$sHost = $this->_dbconfig['host'];
$sPort = $this->_dbconfig['port'];
$sUser = $this->_dbconfig['user'];
$sPassword = $this->_dbconfig['password'];
$this->_link = mysql_connect("{$sHost}:{$sPort}", $sUser, $sPassword);
if (!$this->_link) {
recordSysLog('Unable to connect to Mysql');
}
$sDatabase = $this->_dbconfig['database'];
$this->setDatabase($sDatabase);
$sCharset = $this->_dbconfig['charset'];
$this->setCharset($sCharset);
}
示例5: createSitemap
function createSitemap($type, $showMessage = 1)
{
$sitemapConfig = loadConfig('sitemap');
$articleCount = $sitemapConfig['articleCount'] ? $sitemapConfig['articleCount'] : 500;
$ucarCount = $sitemapConfig['ucarCount'] ? $sitemapConfig['ucarCount'] : 500;
$datas = array();
switch ($type) {
default:
case 'news':
$article_db = bpBase::loadModel('article_model');
$articles = $article_db->select(array('ex' => 0), 'link,time,title,keywords', '0,' . $articleCount, 'time DESC');
if ($articles) {
foreach ($articles as $a) {
if (!strExists($a['link'], 'http://')) {
$a['link'] = MAIN_URL_ROOT . $a['link'];
}
if ($a['keywords'] == ',') {
$a['keywords'] = '';
}
array_push($datas, array('url' => $a['link'], 'time' => $a['time'], 'keywords' => $a['keywords']));
}
}
break;
}
$this->_createSitemap($type, $datas, $showMessage);
}
示例6: config
function config(string $key, $default = null)
{
static $config;
if (!$config) {
$config = loadConfig();
}
return $config[$key] ?? $default;
}
示例7: __construct
function __construct()
{
$this->watermarkConfig = loadConfig('watermark');
$this->watermarkConfig['leftTopWaterMarkText'] = $this->watermarkConfig['leftTopWaterMarkText'] ? $this->watermarkConfig['leftTopWaterMarkText'] : $this->watermarkConfig['waterMarkText'];
$this->watermarkConfig['leftDistance'] = isset($this->watermarkConfig['leftDistance']) ? intval($this->watermarkConfig['leftDistance']) : 9;
$this->watermarkConfig['topDistance'] = isset($this->watermarkConfig['topDistance']) ? intval($this->watermarkConfig['topDistance']) : 16;
$this->watermarkConfig['rightDistance'] = isset($this->watermarkConfig['rightDistance']) ? intval($this->watermarkConfig['rightDistance']) : 5;
$this->watermarkConfig['bottomDistance'] = isset($this->watermarkConfig['bottomDistance']) ? intval($this->watermarkConfig['bottomDistance']) : 10;
}
示例8: dbInit
protected function dbInit()
{
$config = loadConfig('confDb', 'config');
$this->_dbname = $config['dbname'];
$this->_host = $config['host'];
$this->_user = $config['user'];
$this->_password = $config['password'];
$dsn = 'mysql:dbname=' . $this->_dbname . ';host=' . $this->_host . '';
$this->db = new Database($dsn, $this->_user, $this->_password);
}
示例9: __construct
public function __construct()
{
parent::__construct();
/***********uid*******************/
$uid = isset($_GET['uid']) && intval($_GET['uid']) > 0 ? intval($_GET['uid']) : 0;
//设置uid为request的数值
$uid = $uid > 0 ? $uid : $this->uid;
$this->assign('uid', $uid);
if (!$uid) {
header('Location:/');
exit;
}
$thisUser = $this->user;
$this->assign('user', $thisUser);
/**********************************************************/
if ($this->uid == $uid) {
$sub = '我';
$my = 1;
} else {
$sub = '他(她)';
$my = 0;
}
$this->uid = $uid;
$this->assign('sub', $sub);
$this->assign('my', $my);
/*********************判断是不是各种经销商***************************/
$storeUserIndependent = 0;
//经销商用户是否单独建表存储
if (intval(loadConfig('store', 'storeUserIndependent'))) {
$storeUserIndependent = 1;
//经销商用户是否单独建表存储
}
if ($uid == $this->uid) {
$this->assign('canManage', 1);
}
if ($uid == $this->uid && !$storeUserIndependent) {
$store_db = bpBase::loadModel('store_model');
$is4sStore = 0;
if ($store_db->select(array('storetype' => 1, 'uid' => $this->uid))) {
$is4sStore = 1;
}
$this->assign('is4sStore', $is4sStore);
//carRental
$isRentalStore = 0;
if ($store_db->select(array('storetype' => 3, 'uid' => $this->uid))) {
$isRentalStore = 1;
}
$this->assign('isRentalStore', $isRentalStore);
//ucar
$ucar_store_db = bpBase::loadModel('usedcar_store_model');
$thisUcarStore = $ucar_store_db->select(array('uid' => $this->uid));
$this->assign('isUcarStore', $thisUcarStore ? 1 : 0);
}
}
示例10: init
public function init()
{
// Initialize logger and translate actions
$this->_logger = Zend_Registry::get("logger");
$this->_translate = Zend_Registry::get("translate");
// set the redirector to ignore the baseurl for redirections
$this->_helper->redirector->setPrependBase(false);
$this->_eventdispatcher = initializeSFEventDispatcher();
// load the application configuration
loadConfig();
$this->view->referer = $this->getRequest()->getHeader('referer');
$this->view->viewurl = $_SERVER['REQUEST_URI'];
// debugMessage($this->view->viewurl);
// debugMessage($this->getRequest());
$isvalid = false;
$host = giveHost($this->view->serverUrl());
// debugMessage($host);
$this->view->domain = str_replace('http://', '', strtolower($host));
$subdomain = getSubdomain($this->view->serverUrl());
$this->view->subdomain = strtolower($subdomain);
if ($subdomain == "www") {
$this->_helper->redirector->gotoUrl('http://' . $host);
exit;
}
// debugMessage('subdomain '.$subdomain);
if (!isEmptyString($subdomain) && strtolower($host) == "hrmagic.ug") {
$session = SessionWrapper::getInstance();
$session->setVar('companyid', '');
$company = new Company();
if ($company->isRenderable($subdomain)) {
$isvalid = true;
// debugMessage('valid');
} else {
// debugMessage('invalid');
}
if ($isvalid) {
// if valid subdomain, set id to session
$companyid = $company->findByUsername($subdomain);
$session->setVar('cid', $companyid);
} else {
// subdomain not found. redirect to 404 page.
$domain = str_replace($subdomain . '.', '', $this->view->serverUrl());
// debugMessage('d is '.$domain);
$this->_helper->redirector->gotoUrl(stripUrl($domain) . '/index/error');
}
}
$url = array('http://www.domain.com', 'http://domain.com', 'https://domain.com', 'www.domain.com', 'domain.com', 'www.domain.com/some/path', 'http://sub.domain.com/domain.com', 'http://sub-domain.domain.net/domain.net', 'sub-domain.third-Level_DomaIN.domain.uk.co/domain.net');
/* foreach ($url as $u) {
debugMessage(getSubdomain($u));
} */
// exit();
# set default timezone based on company in session
# date_default_timezone_set(getTimeZine());
}
示例11: verifyUserPass
function verifyUserPass($username, $password, $redirect)
{
$config = getConfig();
if (checkUsername($username, $config->username) && checkPassword($password, $config->password)) {
if (loadConfig($config)) {
$_SESSION["loggedIn"] = true;
}
header("Location: " . $redirect);
} else {
return false;
}
}
示例12: getInstance
public static function getInstance($config = '')
{
if (!isset(self::$_instance)) {
self::$_instance = new self();
}
if ($config == '') {
$config = loadConfig('dbconfig');
}
if ($config != '' && $config != self::$_instance->_config) {
self::$_instance->_config = array_merge($config, self::$_instance->_config);
}
return self::$_instance;
}
示例13: _errorLog
function _errorLog($errno, $errstr, $errfile, $errline)
{
if ($errno == 8) {
return '';
}
$errfile = str_replace(ROOT_PATH, '', $errfile);
if (loadConfig('config', 'errorlog')) {
error_log('<?php exit;?>' . date('Y-m-d H:i:s', SYS_TIME) . ' | ' . $errno . ' | ' . str_pad($errstr, 30) . ' | ' . $errfile . ' | ' . $errline . "\r\n", 3, CACHE_PATH . 'errorlog.php');
} else {
$str = '<div style="border:1px solid #ccc;color:#666">errorno:' . $errno . ',str:' . $errstr . ',file:<span style="color:#f00">' . $errfile . '</span>,line:' . $errline . '</div>';
echo $str;
}
}
示例14: main
function main()
{
$pp = new Prefork(array('max_workers' => 5, 'trap_signals' => array(SIGHUP => SIGTERM, SIGTERM => SIGTERM)));
while ($pp->signalReceived() !== SIGTERM) {
loadConfig();
if ($pp->start()) {
continue;
}
workChildren();
$pp->finish();
}
$pp->waitAllChildren();
}
示例15: __construct
public function __construct()
{
if (!get_magic_quotes_gpc()) {
$_GET = new_addslashes($_GET);
$_POST = new_addslashes($_POST);
$_REQUEST = new_addslashes($_REQUEST);
$_COOKIE = new_addslashes($_COOKIE);
}
$this->route = loadConfig('route', 'default');
if (isset($_GET['page'])) {
$_GET['page'] = max(intval($_GET['page']), 1);
$_GET['page'] = min($_GET['page'], 1000000);
}
}