当前位置: 首页>>代码示例>>PHP>>正文


PHP vB::getConfig方法代码示例

本文整理汇总了PHP中vB::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP vB::getConfig方法的具体用法?PHP vB::getConfig怎么用?PHP vB::getConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vB的用法示例。


在下文中一共展示了vB::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __call

 public function __call($method, $arguments)
 {
     try {
         $logger = vB::getLogger('api.' . $this->controller . '.' . $method);
         //check so that we don't var_export large variables when we don't have to
         if ($logger->isInfoEnabled()) {
             if (!($ip = vB::getRequest()->getAltIp())) {
                 $ip = vB::getRequest()->getIpAddress();
             }
             $message = str_repeat('=', 80) . "\ncalled {$method} on {$this->controller} from ip {$ip} \n\$arguments = " . var_export($arguments, true) . "\n" . str_repeat('=', 80) . "\n";
             $logger->info($message);
             $logger->info("time: " . microtime(true));
         }
         if ($logger->isTraceEnabled()) {
             $message = str_repeat('=', 80) . "\n " . $this->getTrace() . str_repeat('=', 80) . "\n";
             $logger->trace($message);
         }
         $c = $this->api;
         // This is a hack to prevent method parameter reference error. See VBV-5546
         $hackedarguments = array();
         foreach ($arguments as $k => &$arg) {
             $hackedarguments[$k] =& $arg;
         }
         $return = call_user_func_array(array(&$c, $method), $hackedarguments);
         //check so that we don't var_export large variables when we don't have to
         if ($logger->isDebugEnabled()) {
             $message = str_repeat('=', 80) . "\ncalled {$method} on {$this->controller}\n\$return = " . var_export($return, true) . "\n" . str_repeat('=', 80) . "\n";
             $logger->debug($message);
         }
         return $return;
     } catch (vB_Exception_Api $e) {
         $errors = $e->get_errors();
         $config = vB::getConfig();
         if (!empty($config['Misc']['debug'])) {
             $trace = '## ' . $e->getFile() . '(' . $e->getLine() . ") Exception Thrown \n" . $e->getTraceAsString();
             $errors[] = array("exception_trace", $trace);
         }
         return array('errors' => $errors);
     } catch (vB_Exception_Database $e) {
         $config = vB::getConfig();
         if (!empty($config['Misc']['debug']) or vB::getUserContext()->hasAdminPermission('cancontrolpanel')) {
             $errors = array('Error ' . $e->getMessage());
             $trace = '## ' . $e->getFile() . '(' . $e->getLine() . ") Exception Thrown \n" . $e->getTraceAsString();
             $errors[] = array("exception_trace", $trace);
             return array('errors' => $errors);
         } else {
             // This text is purposely hard-coded since we don't have
             // access to the database to get a phrase
             return array('errors' => array(array('There has been a database error, and the current page cannot be displayed. Site staff have been notified.')));
         }
     } catch (Exception $e) {
         $errors = array(array('unexpected_error', $e->getMessage()));
         $config = vB::getConfig();
         if (!empty($config['Misc']['debug'])) {
             $trace = '## ' . $e->getFile() . '(' . $e->getLine() . ") Exception Thrown \n" . $e->getTraceAsString();
             $errors[] = array("exception_trace", $trace);
         }
         return array('errors' => $errors);
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:60,代码来源:logwrapper.php

示例2: __construct

 public function __construct(&$config, &$db_assertor)
 {
     parent::__construct($config, $db_assertor);
     if (defined('SKIP_DEFAULTDATASTORE')) {
         $this->cacheableitems = array('options', 'bitfields');
     }
     //this define is only used in this file so move it here.
     $vb5_config =& vB::getConfig();
     if (!empty($vb5_config['Misc']['datastorepath'])) {
         $this->datastoreLocation = $vb5_config['Misc']['datastorepath'];
         return;
     }
     //It's cool if the user can set this in fileSystem cache and let this pick it up.
     if (!empty($vb5_config['Cache']['fileCachePath']) and file_exists($vb5_config['Cache']['fileCachePath']) and is_dir($vb5_config['Cache']['fileCachePath'])) {
         $path = $vb5_config['Cache']['fileCachePath'] . '/datastore';
         if (!file_exists($path)) {
             mkdir($path);
             file_put_contents($path . '/index.html', '');
         }
         if (is_dir($path)) {
             if (!file_exists($path . '/datastore_cache.php') and file_exists(DIR . '/includes/datastore/datastore_cache.php')) {
                 copy(DIR . '/includes/datastore/datastore_cache.php', $path . '/datastore_cache.php');
             }
             if (!file_exists($path . 'datastore_cache.php')) {
                 $this->datastoreLocation = $path;
             }
             return;
         }
     }
     $this->datastoreLocation = DIR . '/includes/datastore';
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:31,代码来源:filecache.php

示例3: createSession

 public function createSession($userid = 1)
 {
     //$this->session = vB_Session_Web::getSession(1);
     $this->session = new vB_Session_Cli(vB::getDbAssertor(), vB::getDatastore(), vB::getConfig(), $userid);
     vB::setCurrentSession($this->session);
     $this->timeNow = time();
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:7,代码来源:test.php

示例4: createSessionNew

 /**
  *	Create a session for this page load
  *
  *	Should only be called from the Request code.
  *	Will use a reexisting session that matches the session hash
  *
  *	@param string $sessionhash -- the token given to the client for session handling.  If the client has this token they
  *		can use the session.
  *	@param array $restoreSessionInfo -- Information to handle "remember me" logic.
  *		* remembermetoken -- Token value for "remember me".  Stored in the "password" cookie for legacy reasons.  There are
  *			so special values to indicate that we should reauthentic via a method other than the internal vB remember me
  *			system.
  *		* userid -- user we are remembering
  *		* fbsr_{appid} (optional) -- Only valid if facebook is enabled, and only used if "remembermetoken" is "facebook".
  */
 public static function createSessionNew($sessionhash, $restoreSessionInfo = array())
 {
     $assertor = vB::getDbAssertor();
     $datastore = vB::getDatastore();
     $config = vB::getConfig();
     //this looks weird but its valid.  Will create the an instance of whatever session class this was called
     //on.  So vB_Session_Web::createSessionNew() will do the expected thing.
     $session = new vB_Session_WebApi($assertor, $datastore, $config, $sessionhash, $restoreSessionInfo);
     return $session;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:25,代码来源:webapi.php

示例5: createSession

 public static function createSession($vbApiParamsToVerify, $vBApiRequests)
 {
     self::$vBApiParamsToVerify = $vbApiParamsToVerify;
     self::$vBApiRequests = $vBApiRequests;
     $assertor = vB::getDbAssertor();
     $datastore = vB::getDatastore();
     $config = vB::getConfig();
     $session = new vB_Session_Api($assertor, $datastore, $config, '', $vbApiParamsToVerify, $vBApiRequests);
     return $session;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:10,代码来源:api.php

示例6: getSession

 public static function getSession($userId, $sessionHash = '', &$dBAssertor = null, &$datastore = null, &$config = null)
 {
     $dBAssertor = $dBAssertor ? $dBAssertor : vB::getDbAssertor();
     $datastore = $datastore ? $datastore : vB::getDatastore();
     $config = $config ? $config : vB::getConfig();
     $restoreSessionInfo = array('userid' => $userId);
     $session = new vB_Session_Web($dBAssertor, $datastore, $config, $sessionHash, $restoreSessionInfo);
     $session->set('userid', $userId);
     $session->fetch_userinfo();
     return $session;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:11,代码来源:web.php

示例7: __construct

 /**
  * Constructor protected to enforce singleton use.
  * @see instance()
  */
 protected function __construct($cachetype)
 {
     parent::__construct($cachetype);
     //get the APC prefix.
     $config = vB::getConfig();
     if (empty($config['Cache']['apcprefix'])) {
         $this->prefix = $config['Database']['tableprefix'];
     } else {
         $this->prefix = $config['Cache']['apcprefix'];
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:15,代码来源:apc.php

示例8: __construct

 /** Standard vB exception constructor for database exceptions.
  *
  *	@param	string	text message
  * 	@param	mixed	array of data- intended for debug mode
  * 	@code	mixed	normally an error flog.  If passed FALSE we won't send an email.
  */
 public function __construct($message = "", $data = array(), $code = 0)
 {
     $this->sql = $message;
     $this->data = $data;
     $message = $this->createMessage();
     $config = vB::getConfig();
     parent::__construct($message, $code);
     if (!empty($config['Database']['technicalemail']) and $code !== FALSE) {
         // This text is purposely hard-coded since we don't have
         // access to the database to get a phrase
         vB_Mail::vbmail($config['Database']['technicalemail'], 'Database Error', $message, true, $config['Database']['technicalemail'], '', '', true);
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:19,代码来源:database.php

示例9: __construct

 /**
  * Constructor public to allow for separate automated unit testing. Actual code should use
  * vB_Cache::instance();
  * @see vB_Cache::instance()
  */
 public function __construct($cachetype)
 {
     parent::__construct($cachetype);
     $this->requestStart = vB::getRequest()->getTimeNow();
     $config = vB::getConfig();
     $this->cachetype = $cachetype;
     if (!isset($config['Cache']['fileCachePath'])) {
         throw new vB_Exception_Cache('need_filecache_location');
     }
     $this->cacheLocation = $config['Cache']['fileCachePath'];
     if (!is_dir($this->cacheLocation) or !is_writable($this->cacheLocation)) {
         throw new vB_Exception_Cache('invalid_filecache_location- ' . $this->cacheLocation);
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:19,代码来源:filesystem.php

示例10: instance

 public static function instance()
 {
     if (!isset(self::$instance)) {
         if (class_exists('Memcached', FALSE)) {
             $class = 'vB_Memcached';
         } else {
             if (class_exists('Memcache', FALSE)) {
                 $class = __CLASS__;
             } else {
                 throw new Exception('Memcached is not installed');
             }
         }
         self::$instance = new $class();
         self::$instance->config = vB::getConfig();
     }
     return self::$instance;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:17,代码来源:memcache.php

示例11: __construct

 /**
  * Constructor protected to enforce singleton use.
  * @see instance()
  */
 protected function __construct($cachetype)
 {
     parent::__construct($cachetype);
     $this->memcached = vB_Memcache::instance();
     $check = $this->memcached->connect();
     if ($check === 3) {
         trigger_error('Unable to connect to memcache server', E_USER_ERROR);
     }
     $this->expiration = 48 * 60 * 60;
     // two days
     $this->timeNow = vB::getRequest()->getTimeNow();
     //get the memcache prefix.
     $config = vB::getConfig();
     if (empty($config['Cache']['memcacheprefix'])) {
         $this->prefix = $config['Database']['tableprefix'];
     } else {
         $this->prefix = $config['Cache']['memcacheprefix'];
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:23,代码来源:memcached.php

示例12: __call

 public function __call($method, $arguments)
 {
     try {
         // check if API method is enabled
         // @TODO this is a temp fix, fix as part of VBV-10619
         // performing checkApiState for those being called through callNamed is definitive
         // Also Skip state check for the 'getRoute' and 'checkBeforeView' api calls, because
         // this state check uses the route info from getRoute and calls checkBeforeView  to
         // determine state. See VBV-11808 and the vB5_ApplicationAbstract::checkState calls
         // in vB5_Frontend_Routing::setRoutes.
         if (!in_array($method, array('callNamed', 'getRoute', 'checkBeforeView'))) {
             if (!$this->api->checkApiState($method)) {
                 return false;
             }
         }
         $result = null;
         $type = $this->validateCall($this->api, $method, $arguments);
         if ($type) {
             if (is_callable(array($this->api, $method))) {
                 $call = call_user_func_array(array(&$this->api, $method), $arguments);
                 if ($call !== null) {
                     $result = $call;
                 }
             }
         }
         if ($elist = vB_Api_Extensions::getExtensions($this->controller)) {
             foreach ($elist as $class) {
                 if (is_callable(array($class, $method))) {
                     $args = $arguments;
                     array_unshift($args, $result);
                     $call = call_user_func_array(array($class, $method), $args);
                     if ($call !== null) {
                         $result = $call;
                     }
                 }
             }
         }
         return $result;
     } catch (vB_Exception_Api $e) {
         $errors = $e->get_errors();
         $config = vB::getConfig();
         if (!empty($config['Misc']['debug'])) {
             $trace = '## ' . $e->getFile() . '(' . $e->getLine() . ") Exception Thrown \n" . $e->getTraceAsString();
             $errors[] = array("exception_trace", $trace);
         }
         return array('errors' => $errors);
     } catch (vB_Exception_Database $e) {
         $config = vB::getConfig();
         if (!empty($config['Misc']['debug']) or vB::getUserContext()->hasAdminPermission('cancontrolpanel')) {
             $errors = array('Error ' . $e->getMessage());
             $trace = '## ' . $e->getFile() . '(' . $e->getLine() . ") Exception Thrown \n" . $e->getTraceAsString();
             $errors[] = array("exception_trace", $trace);
             return array('errors' => $errors);
         } else {
             // This text is purposely hard-coded since we don't have
             // access to the database to get a phrase
             return array('errors' => array(array('There has been a database error, and the current page cannot be displayed. Site staff have been notified.')));
         }
     } catch (Exception $e) {
         $errors = array(array('unexpected_error', $e->getMessage()));
         $config = vB::getConfig();
         if (!empty($config['Misc']['debug'])) {
             $trace = '## ' . $e->getFile() . '(' . $e->getLine() . ") Exception Thrown \n" . $e->getTraceAsString();
             $errors[] = array("exception_trace", $trace);
         }
         return array('errors' => $errors);
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:68,代码来源:wrapper.php

示例13: process_keywords_filters

 /**
  * Process the filters for the query string
  *
  * @param vB_Legacy_Current_User $user user requesting the search
  * @param vB_Search_Criteria $criteria search criteria to process
  */
 protected function process_keywords_filters(vB_Search_Criteria &$criteria)
 {
     $keywords = $criteria->get_keywords();
     // nothing to process
     if (empty($keywords)) {
         return;
     }
     $words = array();
     // get the map table names for the keywords. these tables will be joined into the search query
     $has_or_joiner = false;
     foreach ($keywords as $word_details) {
         $suffix = vBDBSearch_Core::get_table_name($word_details['word']);
         //$words[$suffix][$clean_word] = array('wordid'=>false,'joiner'=>$word['joiner']);
         $words[$word_details['word']] = array('suffix' => $suffix, 'word' => $word_details['word'], 'joiner' => $word_details['joiner']);
         if ($word_details['joiner'] == "OR") {
             $has_or_joiner = true;
         }
     }
     // nothing to process
     if (empty($words)) {
         return;
     }
     $set = $this->db->query_read_slave($query = "\n\t\t\t\t\tSELECT *\n\t\t\t\t\tFROM " . TABLE_PREFIX . "words as words\n\t\t\t\t\tWHERE " . self::make_equals_filter('words', 'word', array_keys($words)));
     $config = vB::getConfig();
     if (!empty($config['Misc']['debug_sql']) or self::DEBUG) {
         echo "{$query};\n";
     }
     $wordids = array();
     while ($word_details = $this->db->fetch_array($set)) {
         $wordids[$word_details['word']] = $word_details['wordid'];
     }
     $this->db->free_result($set);
     $word_details = array();
     foreach ($words as $word => $details) {
         // if the word was not found
         if (!isset($wordids[$word])) {
             // and it's not with a NOT or OR operator
             if (!$has_or_joiner and $details['joiner'] != 'NOT') {
                 // this word is not indexed so there is nothing to return
                 $this->where[] = "0 /** word is not indexed **/";
                 $this->sort = array('node.created' => 'ASC');
                 return;
             }
             // still need to add this word to the mix (either as a NOT operator or maybe as an OR). we use the word itself as a key to make it unique
             $key = $word;
             $details['wordid'] = 0;
         } else {
             $key = $details['wordid'] = $wordids[$word];
         }
         $word_details[$key] = $details;
     }
     unset($wordids);
     unset($words);
     if (count($word_details) == 1) {
         $this->process_one_word_rank(array_pop($word_details), $criteria->is_title_only());
     } elseif ($has_or_joiner or isset($this->sort['rank'])) {
         $this->process_existing_words_or($word_details, $criteria->is_title_only());
     } else {
         $this->process_existing_words_and($word_details, $criteria->is_title_only());
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:67,代码来源:querydefs.php

示例14: addThemeData

 /**
  * Adds theme data (GUID, icon, preview image) to a style if in debug mode. (used by update & insert)
  *
  * @param	string	$guid Theme GUID
  * @param	binary	$icon Theme icon
  * @param	boolean	$iconRemove Whether to remove the current icon (if there is one, and we're not uploading a new one)
  * @param	binary	$previewImage Theme preview image
  * @param	boolean	$previewImageRemove Whether to remove the current preview image (if there is one, and we're not uploading a new one)
  */
 protected function addThemeData($dostyleid, $guid, $icon, $iconRemove, $previewImage, $previewImageRemove)
 {
     $config = vB::getConfig();
     if (empty($config['Misc']['debug'])) {
         // only modify theme information in debug mode.
         return;
     }
     $style = $this->library->fetchStyleByID($dostyleid);
     $themeImporter = new vB_Xml_Import_Theme();
     $updateValues = array();
     // ----- GUID -----
     if (!empty($guid)) {
         $updateValues['guid'] = $guid;
     } else {
         $updateValues['guid'] = vB_dB_Query::VALUE_ISNULL;
     }
     // ----- Icon -----
     if (!empty($icon)) {
         // upload it & get a filedataid
         $filedataid = $themeImporter->uploadThemeImageData($icon);
         if ($filedataid > 0 and $filedataid != $style['filedataid']) {
             $updateValues['filedataid'] = $filedataid;
         }
     }
     if ($style['filedataid'] > 0 and ($iconRemove or !empty($updateValues['filedataid']))) {
         // remove previous icon (if there was one and they checked 'remove' or if there was one and we just uploaded a new one)
         vB::getDbAssertor()->assertQuery('decrementFiledataRefcount', array('filedataid' => $style['filedataid']));
         // set icon to blank if we don't have a new one
         if (empty($updateValues['filedataid'])) {
             $updateValues['filedataid'] = 0;
         }
     }
     // ----- Preview Image -----
     if (!empty($previewImage)) {
         // upload it & get a previewfiledataid
         $previewfiledataid = $themeImporter->uploadThemeImageData($previewImage);
         if ($previewfiledataid > 0 and $previewfiledataid != $style['previewfiledataid']) {
             $updateValues['previewfiledataid'] = $previewfiledataid;
         }
     }
     if ($style['previewfiledataid'] > 0 and ($previewImageRemove or !empty($updateValues['previewfiledataid']))) {
         // remove previous preview image (if there was one and they checked 'remove' or if there was one and we just uploaded a new one)
         vB::getDbAssertor()->assertQuery('decrementFiledataRefcount', array('filedataid' => $style['previewfiledataid']));
         // set preview image to blank if we don't have a new one
         if (empty($updateValues['previewfiledataid'])) {
             $updateValues['previewfiledataid'] = 0;
         }
     }
     // save
     if (!empty($updateValues)) {
         vB::getDbAssertor()->update('style', $updateValues, array('styleid' => $dostyleid));
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:62,代码来源:style.php

示例15: array

global $phrasegroups, $specialtemplates, $vbphrase, $vbulletin;
$phrasegroups = array('cron', 'logging');
$specialtemplates = array();
// ########################## REQUIRE BACK-END ############################
require_once dirname(__FILE__) . '/global.php';
// ######################## CHECK ADMIN PERMISSIONS #######################
if (is_demo_mode() or !can_administer('canadmincron')) {
    print_cp_no_permission();
}
// ############################# LOG ACTION ###############################
$vbulletin->input->clean_array_gpc('r', array('cronid' => vB_Cleaner::TYPE_INT));
log_admin_action(iif($vbulletin->GPC['cronid'] != 0, 'cron id = ' . $vbulletin->GPC['cronid']));
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
$vb5_config =& vB::getConfig();
print_cp_header($vbphrase['scheduled_task_manager_gcron']);
if (empty($_REQUEST['do'])) {
    $_REQUEST['do'] = 'modify';
}
// ############## quick enabled/disabled status ################
if ($_POST['do'] == 'updateenabled') {
    $vbulletin->input->clean_gpc('p', 'enabled', vB_Cleaner::TYPE_ARRAY_BOOL);
    $updates = array();
    //$crons_result = $vbulletin->db->query_read("SELECT varname, active FROM " . TABLE_PREFIX . "cron");
    $crons_result = vB::getDbAssertor()->assertQuery('cron');
    foreach ($crons_result as $cron) {
        $old = $cron['active'] ? 1 : 0;
        $new = $vbulletin->GPC['enabled']["{$cron['varname']}"] ? 1 : 0;
        if ($old != $new) {
            $updates["{$cron['varname']}"] = $new;
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:31,代码来源:cronadmin.php


注:本文中的vB::getConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。