示例#1
0
 protected function _set($users, $time = null)
 {
     if ($time == NULL) {
         $time = XenForo_Application::$time;
     }
     XenForo_Application::setSimpleCacheData(self::CACHE_KEY, array($time, $users));
 }
 public static function verifyOption(array &$values, XenForo_DataWriter $dw, $fieldName)
 {
     if (!$values) {
         XenForo_Application::setSimpleCacheData('xengalleryStatisticsCache', false);
     }
     return true;
 }
示例#3
0
文件: Cache.php 项目: Sywooch/forums
 public static function runCron()
 {
     $Model = XenForo_Model::create('Turki_Adv_Model_View');
     $Advs = $Model->getAllAdvHooks();
     $adv_xenforo = array("AdvsHook" => $Advs);
     XenForo_Application::setSimpleCacheData('adv_xenforo', $adv_xenforo);
 }
示例#4
0
 public static function verifyOption(&$value, XenForo_DataWriter $dw, $fieldName)
 {
     XenForo_Application::setSimpleCacheData('taigachat_lastUpdate', XenForo_Application::$time);
     /** @var Dark_TaigaChat_Model_TaigaChat */
     $taigaModel = XenForo_Model::create("Dark_TaigaChat_Model_TaigaChat");
     $taigaModel->regeneratePublicHtml($value);
     return true;
 }
 /**
  *
  * @param array $matches
  * @return string
  */
 public static function removeCopyrightNotice(array $matches)
 {
     $copyrightModification = XenForo_Application::getSimpleCacheData(parent::COPYRIGHT_MODIFICATION_SIMPLE_CACHE_KEY);
     if ($copyrightModification < XenForo_Application::$time) {
         XenForo_Application::setSimpleCacheData(parent::COPYRIGHT_MODIFICATION_SIMPLE_CACHE_KEY, XenForo_Application::$time);
     }
     return $matches[0];
 }
示例#6
0
 public function getAllCachedCollections()
 {
     $collections = XenForo_Application::getSimpleCacheData(self::$allCacheKey);
     if (!$collections) {
         $collections = $this->getCollections();
         XenForo_Application::setSimpleCacheData(self::$allCacheKey, $collections);
     }
     return $collections;
 }
示例#7
0
文件: Field.php 项目: Sywooch/forums
 public function getAllCachedFields()
 {
     $fields = XenForo_Application::getSimpleCacheData(self::$allCacheKey);
     if (!$fields) {
         $fields = $this->getFields();
         XenForo_Application::setSimpleCacheData(self::$allCacheKey, $fields);
     }
     return $fields;
 }
 public function rebuildUserBannerGroupCache()
 {
     $userBannerGroups = $this->getUserBannerGroups();
     if ($userBannerGroups) {
         XenForo_Application::setSimpleCacheData('th_userBannerGroups', $userBannerGroups);
     } elseif (XenForo_Application::getSimpleCacheData('th_userBannerGroups')) {
         XenForo_Application::setSimpleCacheData('th_userBannerGroups', false);
     }
     return $userBannerGroups;
 }
示例#9
0
 public static function uninstall()
 {
     $db = XenForo_Application::get('db');
     $db->query("DROP TABLE IF EXISTS bbm");
     $db->query("DROP TABLE IF EXISTS bbm_buttons");
     if ($db->fetchRow('SHOW COLUMNS FROM xf_forum WHERE Field = ?', 'bbm_bm_editor')) {
         $db->query("ALTER TABLE xf_forum DROP bbm_bm_editor");
     }
     XenForo_Model::create('XenForo_Model_DataRegistry')->delete('bbm_buttons');
     XenForo_Application::setSimpleCacheData('bbm_active', false);
 }
示例#10
0
 public function getAllNodes()
 {
     if ($this->_nodes === null) {
         $nodes = XenForo_Application::getSimpleCacheData(self::$nodesCacheKey);
         if ($nodes === false) {
             $nodes = $this->_getNodeModel()->getAllNodes();
             XenForo_Application::setSimpleCacheData(self::$nodesCacheKey, $nodes);
         }
         $this->_nodes = $nodes;
     }
     return $this->_nodes;
 }
示例#11
0
 public function saveGroupPermDataCache()
 {
     $groups = $this->getGroups();
     foreach ($groups as &$group) {
         if (!is_array($group['permissions'])) {
             $group['permissions'] = @unserialize($group['permissions']);
         }
     }
     if (!defined('TEAM_DATAREGISTRY_KEY')) {
         define('TEAM_DATAREGISTRY_KEY', 'Teams_group_perms');
     }
     XenForo_Application::setSimpleCacheData(TEAM_DATAREGISTRY_KEY, $groups);
     return $groups;
 }
示例#12
0
 /**
  * Updates statistics for XenForo Media Gallery.
  */
 public static function runStatisticsUpdate()
 {
     /** @var  $categoryModel XenGallery_Model_Category */
     $categoryModel = XenForo_Model::create('XenGallery_Model_Category');
     /** @var  $albumModel XenGallery_Model_Album */
     $albumModel = XenForo_Model::create('XenGallery_Model_Album');
     /** @var  $mediaModel XenGallery_Model_Media */
     $mediaModel = XenForo_Model::create('XenGallery_Model_Media');
     /** @var  $commentModel XenGallery_Model_Comment */
     $commentModel = XenForo_Model::create('XenGallery_Model_Comment');
     $statisticsCache = array('category_count' => $categoryModel->getCategoryCount(), 'album_count' => $albumModel->countAlbums(), 'upload_count' => $mediaModel->countMedia(array('media_type' => array('image_upload', 'video_upload')), array('join' => XenGallery_Model_Media::FETCH_ALBUM)), 'embed_count' => $mediaModel->countMedia(array('media_type' => 'video_embed'), array('join' => XenGallery_Model_Media::FETCH_ALBUM)), 'comment_count' => $commentModel->countComments(), 'disk_usage' => $mediaModel->calculateMediaDiskUsage());
     XenForo_Application::setSimpleCacheData('xengalleryStatisticsCache', $statisticsCache);
     return true;
 }
示例#13
0
文件: Index.php 项目: Sywooch/forums
 public static function rebuildChildNodesCache()
 {
     $nodeModel = XenForo_Model::create('XenForo_Model_Node');
     $nodeId = WidgetFramework_Option::get('indexNodeId');
     $childNodes = array();
     if ($nodeId > 0) {
         $widgetPage = $nodeModel->getNodeById($nodeId);
         if (!empty($widgetPage)) {
             $childNodes = $nodeModel->getChildNodes($widgetPage, true);
             XenForo_Application::setSimpleCacheData(self::SIMPLE_CACHE_CHILD_NODES, $childNodes);
         }
     }
     return $childNodes;
 }
示例#14
0
 public function getShortUrlLengthHttps($token)
 {
     $data = XenForo_Application::getSimpleCacheData(self::SIMPLE_CACHE_DATA_KEY_SHORT_URL_LENGTH_HTTPS);
     if (empty($data) or XenForo_Application::$time - $data['timestamp'] > 86400) {
         $response = bdSocialShare_Helper_Twitter::helpConfiguration($token['oauth_token'], $token['oauth_token_secret']);
         if (!empty($response['short_url_length_https'])) {
             $data = array('value' => $response['short_url_length_https'], 'timestamp' => time());
             XenForo_Application::setSimpleCacheData(self::SIMPLE_CACHE_DATA_KEY_SHORT_URL_LENGTH_HTTPS, $data);
         } else {
             // for some reason we cannot get configuration from Twitter,
             // return our best guess then: as of September 13, 2014 it is 23
             return 30;
         }
     }
     return $data['value'];
 }
示例#15
0
 public static function getInstances()
 {
     if (!self::$_instance) {
         /* @var $self sonnbUpThread_Model_Up*/
         $self = self::create('sonnbUpThread_Model_Up');
         if (!$self->_nodes) {
             $nodes = XenForo_Application::getSimpleCacheData($self->_nodesCacheKey);
             if ($nodes === false) {
                 $nodes = $self->_getNodeModel()->getAllNodes();
                 XenForo_Application::setSimpleCacheData($self->_nodesCacheKey, $nodes);
             }
             $self->_nodes = $nodes;
         }
         self::$_instance = $self;
     }
     return self::$_instance;
 }
示例#16
0
 public function getBypass($params)
 {
     $visitor = XenForo_Visitor::getInstance();
     $sessionModel = $this->getModelFromCache('XenForo_Model_Session');
     $onlineUsers = $sessionModel->getSessionActivityQuickList($visitor->toArray(), array('cutOff' => array('>', $sessionModel->getOnlineStatusTimeout())), $visitor['user_id'] ? $visitor->toArray() : null);
     $onlineUsers['most_users'] = XenForo_Application::getSimpleCacheData('EWRporta_MostUsers');
     if (empty($onlineUsers['most_users']) || $onlineUsers['total'] > $onlineUsers['most_users']['total']) {
         $onlineUsers['most_users'] = array('total' => $onlineUsers['total'], 'time' => XenForo_Application::$time);
         XenForo_Application::setSimpleCacheData('EWRporta_MostUsers', $onlineUsers['most_users']);
     }
     if (!$params['option']['staff']) {
         foreach ($onlineUsers['records'] as &$user) {
             $user['is_staff'] = false;
         }
     }
     return $onlineUsers;
 }
示例#17
0
 public static function uninstall()
 {
     $db = XenForo_Application::get('db');
     $uninstall = self::DataUninstall();
     foreach (self::getTables() as $tableName => $tableSql) {
         try {
             $db->query("DROP TABLE IF EXISTS `{$tableName}`");
         } catch (Zend_Db_Exception $e) {
         }
     }
     foreach ($uninstall as $dataSql) {
         try {
             $db->query($dataSql);
         } catch (Zend_Db_Exception $e) {
         }
     }
     XenForo_Application::setSimpleCacheData('adv_xenforo', FALSE);
 }
示例#18
0
 public function getModule()
 {
     if (!($addon = $this->getModelFromCache('XenForo_Model_AddOn')->getAddOnById('EWRhabla')) || empty($addon['active'])) {
         return "killModule";
     }
     $options = XenForo_Application::get('options');
     $server = $options->EWRhabla_server;
     $channel = $options->EWRhabla_channel;
     $chatUsers = array('total' => 0);
     if (!($chatUsers['rooms'] = $this->getModelFromCache('EWRhabla_Model_Chat')->fetchUsers($server, $channel))) {
         return array('rooms' => array());
     }
     foreach ($chatUsers['rooms'] as $room) {
         $chatUsers['total'] += $room['count'];
     }
     $chatUsers['most_users'] = XenForo_Application::getSimpleCacheData('EWRporta_ChatUsers');
     if (empty($chatUsers['most_users']) || $chatUsers['total'] > $chatUsers['most_users']['total']) {
         $chatUsers['most_users'] = array('total' => $chatUsers['total'], 'time' => XenForo_Application::$time);
         XenForo_Application::setSimpleCacheData('EWRporta_ChatUsers', $chatUsers['most_users']);
     }
     return $chatUsers;
 }
示例#19
0
 protected function _preInstall()
 {
     $addOn = $this->getModelFromCache('XenForo_Model_AddOn')->getAddOnById('ThemeHouse_Warnings');
     if ($addOn && $addOn['version_id'] <= '1378250672') {
         throw new XenForo_Exception('Unable to upgrade from this version. Upgrade to 1.0.3 first.');
     }
     if (XenForo_Application::$versionId >= 1030000) {
         $this->_db->query('
             UPDATE xf_warning_action
 			SET action = \'groups\'
 			WHERE action = \'groups_length\'
         ');
         if ($this->_isTableExists('xf_warning_user_group')) {
             $this->_db->query('
                     INSERT INTO xf_user_change_temp
                     (user_id, action_type, action_modifier, new_value, old_value, create_date, expiry_date)
                     SELECT user_id, \'groups\', CONCAT(\'warning_action_\', warning_action_id),
                     extra_user_group_ids, \'N;\', warning_action_date, end_date
                     FROM xf_warning_user_group
                 ');
             $this->_db->query('
                     DELETE FROM xf_user_group_change
                     WHERE change_key IN (
                         SELECT CONCAT(\'warningUserGroup\', warning_user_group_id)
                         FROM xf_warning_user_group
                     )
                 ');
             $this->_db->query('
                     DROP TABLE xf_warning_user_group
                 ');
         }
     }
     if (XenForo_Application::$versionId != XenForo_Application::getSimpleCacheData('th_warnings_xfVersionId')) {
         XenForo_Application::setSimpleCacheData('th_warnings_xfVersionId', XenForo_Application::$versionId);
     }
 }
示例#20
0
 protected function _updateJustUninstalled()
 {
     if (isset($this->_data['addon_id'])) {
         if (XenForo_Application::$versionId < 1020000 && defined('Waindigo_Listener_InitDependencies::JUST_UNINSTALLED_SIMPLE_CACHE_KEY')) {
             $justUninstalled = XenForo_Application::getSimpleCacheData(Waindigo_Listener_InitDependencies::JUST_UNINSTALLED_SIMPLE_CACHE_KEY);
             if (!$justUninstalled) {
                 $justUninstalled = array();
             }
             if (!in_array($this->_data['addon_id'], $justUninstalled)) {
                 $justUninstalled[] = $this->_data['addon_id'];
             }
             XenForo_Application::setSimpleCacheData(Waindigo_Listener_InitDependencies::JUST_UNINSTALLED_SIMPLE_CACHE_KEY, $justUninstalled);
         } elseif (XenForo_Application::$versionId >= 1020000) {
             XenForo_Application::defer('Waindigo_Deferred', array_merge($this->_data, array('uninstall' => true)));
         }
     }
 }
示例#21
0
文件: Prefix.php 项目: Sywooch/forums
 /**
  * Rebuilds the 'resourcePrefixes' cache
  *
  * @return array
  */
 public function rebuildPrefixCache()
 {
     $prefixes = $this->getPrefixCache();
     $this->_getDataRegistryModel()->set('resourcePrefixes', $prefixes);
     XenForo_Application::setSimpleCacheData('resourcePrefixes', $prefixes);
     return $prefixes;
 }
示例#22
0
 public static function clear() {
     XenForo_Application::setSimpleCacheData("RCBDRecentStatus_status_array",null);
     XenForo_Application::setSimpleCacheData("RCBDRecentStatus_comments_array",null);
     return true;
 }
示例#23
0
 /**
  *
  * @param integer $lastXmlUploadDate
  */
 protected function _setLastXmlUploadDate($lastXmlUploadDate)
 {
     $oldLastXmlUploadDate = $this->_getLastXmlUploadDate();
     if ($lastXmlUploadDate > $oldLastXmlUploadDate) {
         XenForo_Application::setSimpleCacheData(self::LAST_XML_UPLOAD_DATE_SIMPLE_CACHE_KEY, $lastXmlUploadDate);
     }
 }
示例#24
0
 public function pruneShoutbox()
 {
     Dark_TaigaChat_CronEntry_CleanUp::runDailyCleanUp();
     $this->_getDb()->query("\n\t\t\tdelete from dark_taigachat\t\n\t\t");
     $visitor = XenForo_Visitor::getInstance();
     $dw = XenForo_DataWriter::create('Dark_TaigaChat_DataWriter_Message');
     $dw->setOption(Dark_TaigaChat_DataWriter_Message::OPTION_IS_AUTOMATED, true);
     $dw->set('user_id', $visitor['user_id']);
     $dw->set('username', $visitor['user_id'] > 0 ? $visitor['username'] : new XenForo_Phrase('guest'));
     $dw->set('message', new XenForo_Phrase('dark_taigachat_pruned'));
     $dw->save();
     XenForo_Application::setSimpleCacheData('taigachat_lastUpdate', XenForo_Application::$time);
 }
示例#25
0
 protected function _postDelete()
 {
     $this->_getCollectionModel()->deleteCollection($this->get('collection_id'));
     XenForo_Application::setSimpleCacheData(sonnb_XenGallery_Model_Collection::$allCacheKey, false);
 }
示例#26
0
 /**
  * Updates the count of purchasable user upgrades.
  *
  * @return integer
  */
 public function updateUserUpgradeCount()
 {
     $upgrades = $this->getAllUserUpgrades();
     foreach ($upgrades as $upgradeId => $upgrade) {
         if (!$upgrade['can_purchase']) {
             unset($upgrades[$upgradeId]);
         }
     }
     $upgradeCount = count($upgrades);
     XenForo_Application::setSimpleCacheData('userUpgradeCount', $upgradeCount);
     return $upgradeCount;
 }
示例#27
0
文件: ipb.php 项目: Sywooch/forums
    public function stepCategories($start, array $options)
    {
        $options = array_merge(array('limit' => 50, 'processed' => 0, 'max' => false), $options);
        $sDb = $this->_sourceDb;
        $prefix = $this->_prefix;
        $model = $this->_importModel;
        if ($options['max'] === false) {
            $data = $sDb->fetchRow('
                SELECT MAX(category_id) AS max, COUNT(category_id) AS rows
                FROM ' . $prefix . 'gallery_categories
			');
            $options = array_merge($options, $data);
            return array(0, $options, "Processing Categories ...");
        }
        $categories = $sDb->fetchAll($sDb->limit('
                SELECT *
                FROM ' . $prefix . 'gallery_categories
                WHERE category_id > ' . $sDb->quote($start) . '
                ORDER BY category_id ASC
            ', $options['limit']));
        if (!$categories) {
            return true;
        }
        $next = 0;
        $last = 0;
        $total = 0;
        foreach ($categories as $category) {
            $next = $category['category_id'];
            if ($last != $next) {
                $last = $next;
                $categoryIdMap = $model->getCategoryIdsMapFromArray($categories, 'category_id');
                $import = array('parent_category_id' => $this->_mapLookUp($categoryIdMap, $category['category_parent_id'], 0), 'title' => $this->_convertToUtf8($category['category_name'], true), 'description' => $this->_convertToUtf8($category['category_description'], true), 'display_order' => $category['category_position'], 'album_count' => 0, 'category_breadcrumb' => 'a:0:{}', 'lft' => 0, 'rgt' => 0, 'depth' => 0, 'category_privacy' => serialize(array('post' => array(-1), 'view' => array(-1))));
                if ($this->_config['retainKeys']) {
                    $import['category_id'] = $category['category_id'];
                }
                $categoryId = $model->importXenGalleryCategory($category['category_id'], $import);
                $model->logImportData('sonnb_xengallery_category', $category['category_id'], $categoryId);
            }
            $total++;
        }
        $options['processed'] += $total;
        $this->_session->incrementStepImportTotal($total);
        XenForo_Application::setSimpleCacheData(sonnb_XenGallery_Model_Category::$allCacheKey, false);
        return array($next, $options, $this->_getProgressOutput($options['processed'], $options['rows']));
    }
示例#28
0
 public function stepFields($start, array $options)
 {
     $options = array_merge(array('limit' => 50, 'processed' => 0, 'max' => false), $options);
     $db = $this->_db;
     $model = $this->_importModel;
     if ($options['max'] === false) {
         $data = $db->fetchRow("\n    \t\t\t\tSELECT MAX(field_id) AS max, COUNT(field_id) AS rows\n    \t\t\t\tFROM xengallery_field\n\t\t\t");
         $options = array_merge($options, $data);
         return array(0, $options, "Processing Fields ...");
     }
     //TODO: check duplicate field_id in XenGallery
     $fields = $db->fetchAll($db->limit("\n    \t\t\t\tSELECT field.*, GROUP_CONCAT(field_cat.category_id SEPARATOR ',') as category\n    \t\t\t\tFROM xengallery_field AS field\n    \t\t\t\t    LEFT JOIN xengallery_field_category AS field_cat\n    \t\t\t\t        ON (field.field_id = field_cat.field_id)\n    \t\t\t\tGROUP BY field.field_id\n    \t\t\t\tORDER BY field.field_id ASC\n    \t\t\t", $options['limit'], $start));
     if (!$fields) {
         return true;
     }
     $next = 0;
     $last = 0;
     $total = 0;
     //TODO: get category map
     foreach ($fields as $field) {
         $next++;
         if ($last != $next) {
             $last = $next;
             $import = array('field_id' => $field['field_id'], 'title' => new XenForo_Phrase($this->_getXMGFieldModel()->getGalleryFieldTitlePhraseName($field['field_id'])), 'description' => new XenForo_Phrase($this->_getXMGFieldModel()->getGalleryFieldDescriptionPhraseName($field['field_id'])), 'category' => empty($field['category']) ? array() : explode(',', $field['category']), 'content' => array(sonnb_XenGallery_Model_Photo::$contentType, sonnb_XenGallery_Model_Video::$contentType), 'field_type' => $field['field_type'] === 'bbcode' ? 'textarea' : $field['field_type'], 'field_choices' => $field['field_choices'], 'required' => 0, 'match_type' => $field['match_type'], 'match_regex' => $field['match_regex'], 'max_length' => $field['max_length'], 'active' => 1, 'display_order' => $field['display_order']);
             $fieldId = $model->importXenGalleryField($field['field_id'], $import);
             $model->logImportData('sonnb_xengallery_field', $field['field_id'], $fieldId);
         }
         $total++;
     }
     $options['processed'] += $total;
     $this->_session->incrementStepImportTotal($total);
     XenForo_Application::setSimpleCacheData(sonnb_XenGallery_Model_Field::$allCacheKey, false);
     return array($next, $options, $this->_getProgressOutput($options['processed'], $options['rows']));
 }
示例#29
0
 public function save() {
     $response = parent::save();
     XenForo_Application::setSimpleCacheData("RCBDRecentStatus_status_array",null);
     XenForo_Application::setSimpleCacheData("RCBDRecentStatus_comments_array",null);
     return $response;
 }
示例#30
0
 public static function uninstall()
 {
     XenForo_Application::setSimpleCacheData(Ragtek_MOU_Model_OnlineUsers::CACHE_KEY, false);
 }