Example #1
0
 /**
  * Constructor. Sets up the tag list.
  *
  * @param	bool		Whether to append customer user tags to the tag list
  */
 public function __construct($appendCustomTags = true, $appendSessionHashToImage = false)
 {
     if (!self::$initialized) {
         $response = vB_Api::instanceInternal('bbcode')->initInfo();
         self::$defaultTags = $response['defaultTags'];
         self::$customTags = $response['customTags'];
         self::$defaultOptions = $response['defaultOptions'];
         self::$smilies = $response['smilies'];
         self::$censorship = $response['censorship'];
         self::$sessionUrl = $response['sessionUrl'];
         self::$blankAsciiStrip = $response['blankAsciiStrip'];
         self::$wordWrap = $response['wordWrap'];
         self::$bbUrl = $response['bbUrl'];
         self::$viewAttachedImages = $response['viewAttachedImages'];
         self::$urlNoFollow = $response['urlNoFollow'];
         self::$urlNoFollowWhiteList = $response['urlNoFollowWhiteList'];
         self::$vBHttpHost = $response['vBHttpHost'];
         self::$useFileAvatar = $response['useFileAvatar'];
         self::$sigpicUrl = $response['sigpicUrl'];
         $options = vB::getDatastore()->getValue('options');
         self::$baseurl = preg_replace("#/?core/?\$#", '', $options['bburl']);
         self::$baseurl_core = $options['bburl'];
         self::$frontendurl = $options['frontendurl'];
         self::$initialized = true;
     }
     $this->tag_list = self::$defaultTags;
     if ($appendCustomTags) {
         $this->tag_list = vB_Array::arrayReplaceRecursive($this->tag_list, self::$customTags);
     }
     if (!empty($appendSessionHashToImage)) {
         $session = vB::getCurrentSession();
         if (!empty($session)) {
             $sessionHash = $session->get('dbsessionhash');
             if (!empty($sessionHash)) {
                 // This is going to be part of a URL
                 $this->sessionSuffix = '&s=' . urlencode($sessionHash);
             }
         }
     }
     // Legacy Hook 'bbcode_create' Removed //
 }
Example #2
0
 /**
  * Fetches database/system configuration
  * Code extracted from vB_Registry::fetch_config (class_core)
  */
 private static function fetch_config()
 {
     // Set the default values here.
     $default['Cache']['class'] = vB_Cache::getDefaults();
     // parse the config file
     if (file_exists(CWD . '/' . self::$config_file)) {
         include CWD . '/' . self::$config_file;
     } else {
         if (defined('STDIN')) {
             exit(5);
         }
         die('<br /><br /><strong>Configuration</strong>: includes/config.php does not exist. For a new install click <a href="core/install/makeconfig.php">here</a>');
     }
     // TODO: this should be handled with an exception, the backend shouldn't produce output
     if (empty($config)) {
         // config.php exists, but does not define $config
         if (defined('STDIN')) {
             exit(5);
         }
         die('<br /><br /><strong>Configuration</strong>: includes/config.php exists, but is not in the 3.6+ format. Please convert your config file via the new config.php.new.');
     }
     self::$config = vB_Array::arrayReplaceRecursive($default, $config);
     // if a configuration exists for this exact HTTP host, use it
     if (isset($_SERVER['HTTP_HOST']) and isset(self::$config["{$_SERVER['HTTP_HOST']}"])) {
         self::$config['MasterServer'] = self::$config["{$_SERVER['HTTP_HOST']}"];
     }
     // define table and cookie prefix constants
     define('TABLE_PREFIX', trim(isset(self::$config['Database']['tableprefix']) ? self::$config['Database']['tableprefix'] : ''));
     define('COOKIE_PREFIX', empty(self::$config['Misc']['cookieprefix']) ? 'bb' : self::$config['Misc']['cookieprefix']);
     // Set debug mode, always default this to false unless it is explicitly set to true (see VBV-2948).
     self::$config['Misc']['debug'] = (isset(self::$config['Misc']['debug']) and self::$config['Misc']['debug'] === true) ? true : false;
     // This will not exist if a pre vB5 config file is still in use. @TODO, change the default when everything can cope with a blank setting.
     if (!isset(self::$config['SpecialUsers']['superadmins'])) {
         self::$config['SpecialUsers']['superadmins'] = '1';
         // Not ideal, but some areas (and the upgrader) choke on a blank setting atm.
     }
 }