/**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.template.canDeleteTemplate');
     if (!count($this->templateID)) {
         throw new IllegalLinkException();
     }
     // delete templates (files)
     $templateIDs = '';
     require_once WCF_DIR . 'lib/data/template/TemplateEditor.class.php';
     $sql = "SELECT\t\ttemplate.*, pack.templatePackFolderName, package.packageDir\n\t\t\tFROM\t\twcf" . WCF_N . "_template template\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_template_pack pack\n\t\t\tON\t\t(pack.templatePackID = template.templatePackID)\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_package package\n\t\t\tON\t\t(package.packageID = template.packageID)\n\t\t\tWHERE\t\ttemplate.templateID IN (" . implode(',', $this->templateID) . ")\n\t\t\t\t\tAND template.templatePackID > 0";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         if (!empty($templateIDs)) {
             $templateIDs .= ',';
         }
         $templateIDs .= $row['templateID'];
         $template = new TemplateEditor(null, $row);
         if ($template->templateID) {
             $template->deleteFile();
         }
     }
     // delete database entries
     if (!empty($templateIDs)) {
         TemplateEditor::deleteAll($templateIDs);
     }
     // reset cache
     WCF::getCache()->clear(WCF_DIR . 'cache', 'cache.templates-*.php');
     $this->executed();
     // forward to list page
     HeaderUtil::redirect('index.php?page=TemplateList&deletedTemplates=' . count($this->templateID) . '&templatePackID=' . $this->templatePackID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * Loads the search type objects.
  */
 public static function loadSearchTypeObjects()
 {
     if (self::$searchTypeObjects !== null) {
         return;
     }
     // get cache
     WCF::getCache()->addResource('searchableMessageTypes-' . PACKAGE_ID, WCF_DIR . 'cache/cache.searchableMessageTypes-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderSearchableMessageType.class.php');
     self::$searchTypeData = WCF::getCache()->get('searchableMessageTypes-' . PACKAGE_ID);
     // get objects
     self::$searchTypeObjects = array();
     foreach (self::$searchTypeData as $type) {
         // calculate class path
         $path = '';
         if (empty($type['packageDir'])) {
             $path = WCF_DIR;
         } else {
             $path = FileUtil::getRealPath(WCF_DIR . $type['packageDir']);
         }
         // include class file
         if (!file_exists($path . $type['classPath'])) {
             throw new SystemException("unable to find class file '" . $path . $type['classPath'] . "'", 11000);
         }
         require_once $path . $type['classPath'];
         // create instance
         $className = StringUtil::getClassName($type['classPath']);
         if (!class_exists($className)) {
             throw new SystemException("unable to find class '" . $className . "'", 11001);
         }
         self::$searchTypeObjects[$type['typeName']] = new $className();
     }
 }
 /**
  * @see TreeMenu::loadCache()
  */
 protected function loadCache()
 {
     parent::loadCache();
     WCF::getCache()->addResource('userProfileMenu-' . PACKAGE_ID, WCF_DIR . 'cache/cache.userProfileMenu-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderUserProfileMenu.class.php');
     $this->menuItems = WCF::getCache()->get('userProfileMenu-' . PACKAGE_ID);
     EventHandler::fireAction($this, 'loadedCache');
 }
 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (MODULE_TEAM_LIST) {
         if ($eventName == 'readFormParameters') {
             if (isset($_POST['showOnTeamPage'])) {
                 $this->showOnTeamPage = intval($_POST['showOnTeamPage']);
             }
             if (isset($_POST['teamPagePosition'])) {
                 $this->teamPagePosition = intval($_POST['teamPagePosition']);
             }
         } else {
             if ($eventName == 'save') {
                 $eventObj->additionalFields['showOnTeamPage'] = $this->showOnTeamPage;
                 $eventObj->additionalFields['teamPagePosition'] = $this->teamPagePosition;
                 if (!$eventObj instanceof GroupEditForm) {
                     $this->showOnTeamPage = $this->teamPagePosition = 0;
                 }
                 // clear cache
                 WCF::getCache()->clear(WCF_DIR . 'cache', 'cache.teamCount.php');
             } else {
                 if ($eventName == 'assignVariables') {
                     if (!count($_POST) && $eventObj instanceof GroupEditForm) {
                         $this->showOnTeamPage = $eventObj->group->showOnTeamPage;
                         $this->teamPagePosition = $eventObj->group->teamPagePosition;
                     }
                     WCF::getTPL()->assign(array('showOnTeamPage' => $this->showOnTeamPage, 'teamPagePosition' => $this->teamPagePosition));
                     WCF::getTPL()->append('additionalFields', WCF::getTPL()->fetch('groupAddShowOnTeamPage'));
                 }
             }
         }
     }
 }
 /**
  * hide promotion for active user
  */
 protected static function getPromotions()
 {
     $languageID = WCF::getLanguage()->getLanguageID();
     $cacheName = 'contest.promotion-' . PACKAGE_ID . '-' . $languageID;
     WCF::getCache()->addResource($cacheName, WCF_DIR . 'cache/' . $cacheName . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderContestPromotion.class.php', 0, 3600);
     return (array) WCF::getCache()->get($cacheName);
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     //save activation token into database
     $token = StringUtil::getRandomID();
     $sql = 'INSERT INTO wcf' . WCF_N . '_' . $this->subscriberTable . "\n        \t\t(email)\n        \t\t\tVALUES\n        \t\t('" . escapeString($this->email) . "')";
     WCF::getDB()->sendQuery($sql);
     $subscriberID = WCF::getDB()->getInsertID();
     //clears cache
     WCF::getCache()->clear(WCF_DIR . 'cache/', 'cache.newsletter-subscriber-' . PACKAGE_ID . '.php', true);
     $sql = 'INSERT INTO wcf' . WCF_N . '_' . $this->activationTable . '
     		(subscriberID, token)
     			VALUES
     		(' . intval($subscriberID) . ", '" . escapeString($token) . "')";
     WCF::getDB()->sendQuery($sql);
     $url = PAGE_URL . '/index.php?action=NewsletterGuestActivate&id=' . $subscriberID . '&t=' . $token;
     $subject = WCF::getLanguage()->get('wcf.acp.newsletter.optin.subject');
     $content = WCF::getLanguage()->getDynamicVariable('wcf.acp.newsletter.optin.text', array('username' => WCF::getLanguage()->get('wcf.acp.newsletter.optin.hello'), 'url' => $url));
     WCF::getTPL()->assign(array('subject' => $subject, 'content' => $content));
     $output = WCF::getTPL()->fetch('validationEmail');
     $mail = new Mail($this->email, $subject, $output, MESSAGE_NEWSLETTERSYSTEM_GENERAL_FROM);
     $mail->setContentType('text/html');
     $mail->send();
     $this->saved();
     WCF::getTPL()->assign(array('message' => WCF::getLanguage()->get('wcf.acp.newsletter.optin.activationPending'), 'url' => PAGE_URL . '/index.php?page=Index' . SID_ARG_2ND));
     WCF::getTPL()->display('redirect');
     exit;
 }
 /**
  * Renders the list of boards.
  */
 public function renderBoards()
 {
     // get unread threads
     $this->readUnreadThreads();
     // get boards
     $this->readBoards();
     // assign data
     WCF::getTPL()->assign('boards', $this->boards);
     WCF::getTPL()->assign('unreadThreadsCount', $this->unreadThreadsCount);
     // show newest posts
     if (BOARD_LIST_ENABLE_LAST_POST) {
         $lastPosts = WCF::getCache()->get('boardData', 'lastPosts');
         if (is_array($lastPosts)) {
             $visibleLanguages = false;
             if (count(WCF::getSession()->getVisibleLanguageIDArray())) {
                 $visibleLanguages = WCF::getSession()->getVisibleLanguageIDArray();
             }
             foreach ($lastPosts as $boardID => $languages) {
                 foreach ($languages as $languageID => $row) {
                     if (!$languageID || !$visibleLanguages || in_array($languageID, $visibleLanguages)) {
                         $this->lastPosts[$row['boardID']] = new DatabaseObject($row);
                         continue 2;
                     }
                 }
             }
         }
         WCF::getTPL()->assign('lastPosts', $this->lastPosts);
     }
     // stats
     if (BOARD_LIST_ENABLE_STATS) {
         WCF::getTPL()->assign('boardStats', WCF::getCache()->get('boardData', 'counts'));
     }
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // save
     $updateOptionValueUpdate = '';
     foreach ($this->activeOptions as $option) {
         if ($option['defaultValue'] != $option['optionValue']) {
             $sql = "UPDATE\twcf" . WCF_N . "_user_option\n\t\t\t\t\tSET\tdefaultValue = '" . escapeString($option['optionValue']) . "'\n\t\t\t\t\tWHERE\toptionID = " . $option['optionID'];
             WCF::getDB()->sendQuery($sql);
             if (!empty($updateOptionValueUpdate)) {
                 $updateOptionValueUpdate .= ',';
             }
             $updateOptionValueUpdate .= 'userOption' . $option['optionID'] . "='" . escapeString($option['optionValue']) . "'";
         }
     }
     // apply to existing users
     if ($this->applyChangesToExistingUsers == 1 && !empty($updateOptionValueUpdate)) {
         $sql = "UPDATE\twcf" . WCF_N . "_user_option_value\n\t\t\t\tSET\t" . $updateOptionValueUpdate;
         WCF::getDB()->sendQuery($sql);
         // reset sessions
         Session::resetSessions();
     }
     // reset cache
     WCF::getCache()->clearResource($this->cacheName . PACKAGE_ID);
     // show success message
     WCF::getTPL()->assign('success', true);
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // count board
     $sql = "SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twbb" . WBB_N . "_board";
     $row = WCF::getDB()->getFirstRow($sql);
     $count = $row['count'];
     // get board ids
     $boardIDs = '';
     $sql = "SELECT\t\tboardID\n\t\t\tFROM\t\twbb" . WBB_N . "_board\n\t\t\tORDER BY\tboardID";
     $result = WCF::getDB()->sendQuery($sql, $this->limit, $this->limit * $this->loop);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $boardIDs .= ',' . $row['boardID'];
         // update last post
         $board = new BoardEditor($row['boardID']);
         $board->setLastPosts();
     }
     if (empty($boardIDs)) {
         // clear board cache
         WCF::getCache()->clear(WBB_DIR . 'cache', 'cache.boardData.php');
         $this->calcProgress();
         $this->finish();
     }
     // update boards
     $sql = "UPDATE\twbb" . WBB_N . "_board board\n\t\t\tSET\tthreads = (\n\t\t\t\t\tSELECT\tCOUNT(*)\n\t\t\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\t\t\tWHERE\tboardID = board.boardID\n\t\t\t\t\t\tAND isDeleted = 0\n\t\t\t\t\t\tAND isDisabled = 0\n\t\t\t\t),\n\t\t\t\tposts = (\n\t\t\t\t\tSELECT\tIFNULL(SUM(replies), 0) + COUNT(*)\n\t\t\t\t\tFROM\twbb" . WBB_N . "_thread thread\n\t\t\t\t\tWHERE\tboardID = board.boardID\n\t\t\t\t\t\tAND isDeleted = 0\n\t\t\t\t\t\tAND isDisabled = 0\n\t\t\t\t)\n\t\t\tWHERE\tboard.boardID IN (0" . $boardIDs . ")";
     WCF::getDB()->sendQuery($sql);
     $this->executed();
     $this->calcProgress($this->limit * $this->loop, $count);
     $this->nextLoop();
 }
 /**
  * Loads cached menu items.
  */
 protected function loadCache()
 {
     // call loadCache event
     EventHandler::fireAction($this, 'loadCache');
     WCF::getCache()->addResource('pageMenu-' . PACKAGE_ID, WCF_DIR . 'cache/cache.pageMenu-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderPageMenu.class.php');
     $this->menuItems = WCF::getCache()->get('pageMenu-' . PACKAGE_ID);
 }
 /**
  * @see AbstractAction::execute()
  */
 public function execute()
 {
     parent::execute();
     $subscriber = new NewsletterSubscriber($this->subscriberID);
     //deletes user subscribers
     $sql = 'DELETE FROM wcf' . WCF_N . '_' . $this->activationTable . '
     		WHERE userID = ' . intval($subscriber->userID);
     WCF::getDB()->sendQuery($sql);
     //resets user setting
     $user = new UserEditor($subscriber->userID);
     $options = array('acceptNewsletter' => 0);
     $user->updateOptions($options);
     //deletes guest subscribers
     $sql = 'DELETE FROM wcf' . WCF_N . '_' . $this->guestActivationTable . '
     		WHERE subscriberID = ' . $this->subscriberID;
     WCF::getDB()->sendQuery($sql);
     //deletes unsubscribe tokens
     $sql = 'DELETE FROM wcf' . WCF_N . '_' . $this->unsubscriptionTable . '
             WHERE subscriberID = ' . $this->subscriberID;
     WCF::getDB()->sendQuery($sql);
     $sql = 'DELETE FROM wcf' . WCF_N . '_' . $this->subscriberTable . '
     		WHERE subscriberID = ' . $this->subscriberID;
     WCF::getDB()->sendQuery($sql);
     $this->executed();
     //clear cache
     $cacheName = 'newsletter-subscriber-' . PACKAGE_ID;
     WCF::getCache()->clear(WCF_DIR . 'cache/', 'cache.' . $cacheName . '.php');
     HeaderUtil::redirect('index.php?page=NewsletterSubscriberList&result=success&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
示例#12
0
 /**
  * Reads the missions cache.
  */
 public static function readCache()
 {
     if (!count(self::$cache)) {
         WCF::getCache()->addResource('eventTypes-' . PACKAGE_ID, WCF_DIR . 'cache/cache.eventTypes-' . PACKAGE_ID . '.php', LW_DIR . 'lib/system/cache/CacheBuilderEventTypes.class.php');
         self::$cache = WCF::getCache()->get('eventTypes-' . PACKAGE_ID);
     }
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // add cache resources
     WCF::getCache()->addResource('bbcodes', WCF_DIR . 'cache/cache.bbcodes.php', WCF_DIR . 'lib/system/cache/CacheBuilderBBCodes.class.php');
     WCF::getCache()->addResource('smileys', WCF_DIR . 'cache/cache.smileys.php', WCF_DIR . 'lib/system/cache/CacheBuilderSmileys.class.php');
     // count threads
     $sql = "SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twbb" . WBB_N . "_thread";
     $row = WCF::getDB()->getFirstRow($sql);
     $count = $row['count'];
     // get thread ids
     $threadIDs = '';
     $sql = "SELECT\t\tthreadID\n\t\t\tFROM\t\twbb" . WBB_N . "_thread\n\t\t\tORDER BY\tthreadID";
     $result = WCF::getDB()->sendQuery($sql, $this->limit, $this->limit * $this->loop);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $threadIDs .= ',' . $row['threadID'];
     }
     if (empty($threadIDs)) {
         $this->calcProgress();
         $this->finish();
     }
     // get data
     $sql = "SELECT\t\tthread.threadID,\n\t\t\t\t\tpost.postID, post.message, post.enableSmilies, post.enableHtml, post.enableBBCodes\n\t\t\tFROM\t\twbb" . WBB_N . "_thread thread\n\t\t\tLEFT JOIN\twbb" . WBB_N . "_post post\n\t\t\tON\t\t(post.postID = thread.firstPostID)\n\t\t\tWHERE\t\tthread.threadID IN (0" . $threadIDs . ")";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         if ($row['postID']) {
             PostEditor::updateFirstPostPreview($row['threadID'], $row['postID'], $row['message'], $row);
         }
     }
     $this->executed();
     $this->calcProgress($this->limit * $this->loop, $count);
     $this->nextLoop();
 }
 /**
  * @see AdminToolsFunction::execute($data)
  */
 public function execute($data)
 {
     parent::execute($data);
     $parameters = $data['parameters']['cache.clearCache'];
     if ($parameters['clearWCFCache']) {
         WCF::getCache()->clear(WCF_DIR . 'cache', '*.php', true);
     }
     if ($parameters['clearStandaloneCache']) {
         $sql = "SELECT packageDir FROM wcf" . WCF_N . "_package WHERE packageID = " . PACKAGE_ID;
         $row = WCF::getDB()->getFirstRow($sql);
         WCF::getCache()->clear($row['packageDir'] . 'cache', '*.php', true);
     }
     if ($parameters['clearTemplateCache']) {
         require_once WCF_DIR . 'lib/system/template/ACPTemplate.class.php';
         ACPTemplate::deleteCompiledACPTemplates();
         Template::deleteCompiledTemplates();
     }
     if ($parameters['clearLanguageCache']) {
         LanguageEditor::deleteLanguageFiles('*', '*', '*');
     }
     if ($parameters['clearStandaloneOptions']) {
         Options::resetCache();
         Options::resetFile();
     }
     $this->executed();
 }
 /**
  * Loads the taggable objects.
  */
 protected function loadTaggables()
 {
     if ($this->taggables !== null) {
         return;
     }
     // get cache
     WCF::getCache()->addResource('taggables-' . PACKAGE_ID, WCF_DIR . 'cache/cache.taggables-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderTaggable.class.php');
     $this->taggablesData = WCF::getCache()->get('taggables-' . PACKAGE_ID);
     // get objects
     $this->taggables = array();
     foreach ($this->taggablesData as $type) {
         // calculate class path
         $path = '';
         if (empty($type['packageDir'])) {
             $path = WCF_DIR;
         } else {
             $path = FileUtil::getRealPath(WCF_DIR . $type['packageDir']);
         }
         // include class file
         if (!file_exists($path . $type['classPath'])) {
             throw new SystemException("unable to find class file '" . $path . $type['classPath'] . "'", 11000);
         }
         require_once $path . $type['classPath'];
         // create instance
         $className = StringUtil::getClassName($type['classPath']);
         if (!class_exists($className)) {
             throw new SystemException("unable to find class '" . $className . "'", 11001);
         }
         $this->taggables[$type['taggableID']] = new $className($type['taggableID'], $type['name']);
     }
 }
 /**
  * Returns a list of available suspension types.
  * 
  * @return	array<SuspensionType>
  */
 public static function getAvailableSuspensionTypes()
 {
     if (self::$availableSuspensionTypes === null) {
         WCF::getCache()->addResource('suspensionTypes-' . PACKAGE_ID, WCF_DIR . 'cache/cache.suspensionTypes-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderSuspensionTypes.class.php');
         $types = WCF::getCache()->get('suspensionTypes-' . PACKAGE_ID);
         foreach ($types as $type) {
             // get path to class file
             if (empty($type['packageDir'])) {
                 $path = WCF_DIR;
             } else {
                 $path = FileUtil::getRealPath(WCF_DIR . $type['packageDir']);
             }
             $path .= $type['classFile'];
             // include class file
             if (!class_exists($type['className'])) {
                 if (!file_exists($path)) {
                     throw new SystemException("Unable to find class file '" . $path . "'", 11000);
                 }
                 require_once $path;
             }
             // instance object
             if (!class_exists($type['className'])) {
                 throw new SystemException("Unable to find class '" . $type['className'] . "'", 11001);
             }
             self::$availableSuspensionTypes[$type['suspensionType']] = new $type['className']();
         }
     }
     return self::$availableSuspensionTypes;
 }
 /**
  * Loads default cache resources of auction system.
  * Can be called statically from other applications or plugins.
  */
 public static function loadDefaultBASHCacheResources()
 {
     WCF::getCache()->addResource('pageLocations-' . PACKAGE_ID, WCF_DIR . 'cache/cache.pageLocations-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderPageLocations.class.php');
     WCF::getCache()->addResource('bbcodes', WCF_DIR . 'cache/cache.bbcodes.php', WCF_DIR . 'lib/system/cache/CacheBuilderBBCodes.class.php');
     WCF::getCache()->addResource('smileys', WCF_DIR . 'cache/cache.smileys.php', WCF_DIR . 'lib/system/cache/CacheBuilderSmileys.class.php');
     WCF::getCache()->addResource('cronjobs-' . PACKAGE_ID, WCF_DIR . 'cache/cache.cronjobs-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderCronjobs.class.php');
     WCF::getCache()->addResource('help-' . PACKAGE_ID, WCF_DIR . 'cache/cache.help-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderHelp.class.php');
 }
 /**
  * Deletes cache
  */
 public static function clearCache()
 {
     if (empty(self::$data)) {
         self::registerCache();
     }
     WCF::getCache()->clearResource('scm');
     WCF::getCache()->clear(WCF_DIR . 'cache/', 'cache.scm.php');
     self::$data = array();
 }
示例#19
0
 /**
  * Gets a list of simple statistics.
  */
 protected function readStat()
 {
     WCF::getCache()->addResource('acpstat', CONTEST_DIR . 'cache/cache.acpstat.php', CONTEST_DIR . 'lib/system/cache/CacheBuilderACPStat.class.php', 0, 3600 * 12);
     $this->stat = WCF::getCache()->get('acpstat');
     // users online
     $sql = "SELECT\tCOUNT(*) AS usersOnline\n\t\t\tFROM\twcf" . WCF_N . "_session\n\t\t\tWHERE\tpackageID = " . PACKAGE_ID . "\n\t\t\t\tAND lastActivityTime > " . (TIME_NOW - USER_ONLINE_TIMEOUT);
     $row = WCF::getDB()->getFirstRow($sql);
     $this->stat['usersOnline'] = $row['usersOnline'];
 }
 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (MODULE_TEAM_LIST) {
         WCF::getCache()->addResource('teamCount', WCF_DIR . 'cache/cache.teamCount.php', WCF_DIR . 'lib/system/cache/CacheBuilderTeamCount.class.php', 0, 1800);
         if (WCF::getCache()->get('teamCount') > 0) {
             WCF::getTPL()->append('additionalTabs', '<li><a href="index.php?page=Team' . SID_ARG_2ND . '"><img src="' . StyleManager::getStyle()->getIconPath('teamM.png') . '" alt="" /> <span>' . WCF::getLanguage()->get('wcf.user.team.title') . '</span></a></li>');
         }
     }
 }
 /**
  * Loads the tag cloud cache.
  */
 public function loadCache()
 {
     if ($this->tags !== null) {
         return;
     }
     // get cache
     WCF::getCache()->addResource($this->cacheName, WBB_DIR . 'cache/cache.tagCloud-' . $this->boardID . '-' . StringUtil::getHash(implode(',', $this->languageIDArray)) . '.php', WBB_DIR . 'lib/system/cache/CacheBuilderBoardTagCloud.class.php', 0, 86400);
     $this->tags = WCF::getCache()->get($this->cacheName);
 }
示例#22
0
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     $this->ovents = Ovent::getByConditions(array('userID' => WCF::getUser()->userID, 'checked' => 0));
     $this->hovents = Ovent::getByConditions(array('userID' => WCF::getUser()->userID, 'checked' => 1));
     // news
     WCF::getCache()->addResource('news-' . PACKAGE_ID, WCF_DIR . 'cache/cache.news-' . PACKAGE_ID . '.php', LW_DIR . 'lib/system/cache/CacheBuilderNews.class.php');
     $this->news = WCF::getCache()->get('news-' . PACKAGE_ID);
 }
示例#23
0
 /**
  * @see TreeMenu::loadCache()
  */
 protected function loadCache()
 {
     parent::loadCache();
     if (PACKAGE_ID == 0) {
         return;
     }
     WCF::getCache()->addResource('menu-' . PACKAGE_ID, WCF_DIR . 'cache/cache.menu-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderACPMenu.class.php');
     $this->menuItems = WCF::getCache()->get('menu-' . PACKAGE_ID);
 }
示例#24
0
 /**
  *
  */
 protected function createGroup($groupOptions = array())
 {
     require_once WCF_DIR . 'lib/util/StringUtil.class.php';
     require_once WCF_DIR . 'lib/data/user/group/GroupEditor.class.php';
     $group = GroupEditor::create($groupName = StringUtil::getRandomID(), $groupOptions);
     // WCF does not clear instance caches... so rebuild
     $classFile = WCF_DIR . 'lib/system/cache/CacheBuilderGroups.class.php';
     WCF::getCache()->rebuild(array('cache' => 'groups', 'file' => WCF_DIR . 'cache/cache.groups.php', 'className' => StringUtil::getClassName($classFile), 'classFile' => $classFile));
     return $group;
 }
 /**
  * counts number of entries in first level
  * @see DatabaseObjectList::countObjects()
  */
 protected function fromCache($method)
 {
     $key = 'DatabaseObjectListCached.' . $this->getHash($method);
     $cacheResource = array('file' => WCF_DIR . 'cache/cache.' . $key . '.php', 'cache' => $key, 'minLifetime' => $this->minLifetime, 'maxLifetime' => $this->maxLifetime);
     if (($val = WCF::getCache()->getCacheSource()->get($cacheResource)) === null) {
         $val = $this->{'_' . $method}();
         WCF::getCache()->getCacheSource()->set($cacheResource, $val);
     }
     return $val;
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // save
     LanguageEditor::enableMultilingualism($this->enable == 1 ? $this->languageIDs : array());
     // clear cache
     WCF::getCache()->clearResource('languages');
     $this->saved();
     // show success message
     WCF::getTPL()->assign('success', true);
 }
 /**
  * @see Form::validate()
  */
 public function save()
 {
     AbstractForm::save();
     // update
     $this->bbcode->update($this->bbcodeTag, $this->htmlOpen, $this->htmlClose, $this->textOpen, $this->textClose, $this->allowedChildren, $this->className, $this->sourceCode, $this->attributes, $this->wysiwyg, $this->wysiwygIcon);
     // show success message
     WCF::getTPL()->assign('success', true);
     // delete cache
     WCF::getCache()->clear(WCF_DIR . 'cache', 'cache.bbcodes.php');
     $this->saved();
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     WCF::getCache()->addResource('admin_tools_functions-' . PACKAGE_ID, WCF_DIR . 'cache/cache.admin_tools_functions-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderAdminToolsFunction.class.php');
     $this->functions = WCF::getCache()->get('admin_tools_functions-' . PACKAGE_ID);
     foreach ($this->functions as $key => $function) {
         if (!$function['executeAsCronjob']) {
             unset($this->functions[$key]);
         }
     }
 }
示例#29
0
 /**
  * Creates a new StatRefresher object.
  */
 public function __construct()
 {
     StatGeneratorFactory::init();
     $cache = WCF::getCache()->get('statTypes-' . PACKAGE_ID, 'byStatTypeID');
     foreach ($cache as $statTypeID => $row) {
         $statGenerator = StatGeneratorFactory::getByStatTypeID($statTypeID);
         $statGenerator->generate();
     }
     $sql = "TRUNCATE wcf" . WCF_N . "_session";
     WCF::getDB()->sendQuery($sql);
 }
 /**
  * @see DatabaseObject::handleData()
  */
 protected function handleData($data)
 {
     parent::handleData($data);
     // calculate page logo path
     if (!empty($this->data['variables']['page.logo.image']) && !FileUtil::isURL($this->data['variables']['page.logo.image']) && StringUtil::substring($this->data['variables']['page.logo.image'], 0, 1) !== '/') {
         $this->data['variables']['page.logo.image'] = RELATIVE_WCF_DIR . $this->data['variables']['page.logo.image'];
     }
     // load icon cache
     WCF::getCache()->addResource('icon-' . PACKAGE_ID . '-' . $this->styleID, WCF_DIR . 'cache/cache.icon-' . PACKAGE_ID . '-' . $this->styleID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderIcon.class.php');
     $this->iconCache = WCF::getCache()->get('icon-' . PACKAGE_ID . '-' . $this->styleID);
 }