/**
  * Enables this option.
  * 
  * @param 	boolean		$enable
  */
 public function enable($enable = true)
 {
     $value = intval(!$enable);
     $sql = "UPDATE\twcf" . WCF_N . "_user_option\n\t\t\tSET\tdisabled = ?\n\t\t\tWHERE\toptionID = ?";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array($value, $this->optionID));
 }
 /**
  * @see	\wcf\system\option\IOptionType::getData()
  */
 public function getData(Option $option, $newValue)
 {
     $number = str_replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $newValue);
     $number = str_replace(WCF::getLanguage()->get('wcf.global.decimalPoint'), '.', $number);
     if (!preg_match('~^(?:\\d*)\\.?\\d+~', $number, $matches)) {
         return 0;
     }
     $number = $matches[0];
     if (preg_match('/[kmgt]i?b$/i', $newValue, $multiplier)) {
         switch (mb_strtolower($multiplier[0])) {
             case 'tb':
                 $number *= 1000;
             case 'gb':
                 $number *= 1000;
             case 'mb':
                 $number *= 1000;
             case 'kb':
                 $number *= 1000;
                 break;
             case 'tib':
                 $number *= 1024;
             case 'gib':
                 $number *= 1024;
             case 'mib':
                 $number *= 1024;
             case 'kib':
                 $number *= 1024;
                 break;
         }
     }
     return $number;
 }
Exemple #3
0
 /**
  * calculate the final config of $this->cfg through $this->cfg default value and MbqMain::$customConfig and MbqMain::$oMbqAppEnv and the plugin support degree
  */
 public function calCfg()
 {
     $url = WCF::getPath();
     MbqMain::$oMbqAppEnv->siteRootUrl = substr($url, 0, strlen($url) - 4);
     //init user
     $oUser = DefaultUserAuthentication::getInstance()->loginAutomatically(true);
     if ($oUser && $oUser->userID) {
         MbqMain::$oMbqAppEnv->oCurrentUser = $oUser;
         $oMbqRdEtUser = MbqMain::$oClk->newObj('MbqRdEtUser');
         $oMbqRdEtUser->initOCurMbqEtUser();
     }
     if (MbqMain::hasLogin()) {
         //!!!
         header('Mobiquo_is_login: true');
     } else {
         header('Mobiquo_is_login: false');
     }
     $oMbqRdEtForum = MbqMain::$oClk->newObj('MbqRdEtForum');
     MbqMain::$oMbqAppEnv->exttForumTree = $oMbqRdEtForum->getForumTree();
     //!!!
     parent::calCfg();
     /* calculate the final config */
     $this->cfg['base']['sys_version']->setOriValue(PACKAGE_VERSION);
     if (OFFLINE) {
         $this->cfg['base']['is_open']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.base.is_open.range.no'));
     } else {
         $this->cfg['base']['is_open']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.base.is_open.range.yes'));
     }
     if (!MODULE_CONVERSATION || !WCF::getSession()->getPermission('user.conversation.canUseConversation')) {
         $this->cfg['pc']['module_enable']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.pc.module_enable.range.disable'));
         $this->cfg['pc']['conversation']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.pc.conversation.range.notSupport'));
     }
 }
 /**
  * @see	\wcf\system\option\IOptionType::getData()
  */
 public function getData(Option $option, $newValue)
 {
     $newValue = str_replace(' ', '', $newValue);
     $newValue = str_replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $newValue);
     $newValue = str_replace(WCF::getLanguage()->get('wcf.global.decimalPoint'), '.', $newValue);
     return floatval($newValue);
 }
 /**
  * @see	\wcf\system\user\activity\event\IUserActivityEvent::prepare()
  */
 public function prepare(array $events)
 {
     $newsIDs = array();
     foreach ($events as $event) {
         $newsIDs[] = $event->objectID;
     }
     $newsList = new ViewableNewsList();
     $newsList->getConditionBuilder()->add("news.newsID IN (?)", array($newsIDs));
     $newsList->readObjects();
     $newsEntries = $newsList->getObjects();
     foreach ($events as $event) {
         if (isset($newsEntries[$event->objectID])) {
             $news = $newsEntries[$event->objectID];
             if (!$news->canRead()) {
                 continue;
             }
             $event->setIsAccessible();
             $text = WCF::getLanguage()->getDynamicVariable('news.recentActivity.likedNews', array('news' => $news));
             $event->setTitle($text);
             $event->setDescription($news->getExcerpt());
         } else {
             $event->setIsOrphaned();
         }
     }
 }
 /**
  * @see	\wcf\system\bbcode\IBBCode::getParsedTag()
  */
 public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser)
 {
     if ($parser->getOutputType() == 'text/html') {
         $quoteLink = !empty($openingTag['attributes'][1]) ? $openingTag['attributes'][1] : '';
         $externalQuoteLink = !empty($openingTag['attributes'][1]) ? !ApplicationHandler::getInstance()->isInternalURL($openingTag['attributes'][1]) : false;
         if (!$externalQuoteLink) {
             $quoteLink = preg_replace('~^https?://~', RouteHandler::getProtocol(), $quoteLink);
         }
         $quoteAuthor = !empty($openingTag['attributes'][0]) ? $openingTag['attributes'][0] : '';
         $quoteAuthorObject = null;
         if ($quoteAuthor && !$externalQuoteLink) {
             $quoteAuthorLC = mb_strtolower(StringUtil::decodeHTML($quoteAuthor));
             foreach (MessageEmbeddedObjectManager::getInstance()->getObjects('com.woltlab.wcf.quote') as $user) {
                 if (mb_strtolower($user->username) == $quoteAuthorLC) {
                     $quoteAuthorObject = $user;
                     break;
                 }
             }
         }
         WCF::getTPL()->assign(array('content' => $content, 'quoteLink' => $quoteLink, 'quoteAuthor' => $quoteAuthor, 'quoteAuthorObject' => $quoteAuthorObject, 'isExternalQuoteLink' => $externalQuoteLink));
         return WCF::getTPL()->fetch('quoteBBCodeTag');
     } else {
         if ($parser->getOutputType() == 'text/simplified-html') {
             return WCF::getLanguage()->getDynamicVariable('wcf.bbcode.quote.text', array('content' => $content, 'cite' => !empty($openingTag['attributes'][0]) ? $openingTag['attributes'][0] : '')) . "\n";
         }
     }
 }
 /**
  * @see	\wcf\system\event\IEventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     // 		try {
     // 			$request = new HTTPRequest(self::FEED_URL);
     // 			$request->execute();
     // 			$feedData = $request->getReply();
     // 			$feedData = $feedData['body'];
     // 		}
     // 		catch (SystemException $e) {
     // 			// log error
     // 			$e->getExceptionID();
     // 			return;
     // 		}
     // 		if (!$xml = simplexml_load_string($feedData)) {
     // 			return;
     // 		}
     $feed = array();
     // 		$i = 10;
     // 		foreach ($xml->channel[0]->item as $item) {
     // 			if ($i -- == 0) {
     // 				break;
     // 			}
     // 			$feed[] = array(
     // 				'title' => (string) $item->title,
     // 				'description' => (string) $item->description,
     // 				'link' => (string) $item->guid,
     // 				'time' => strtotime((string) $item->pubDate)
     // 			);
     // 		}
     WCF::getTPL()->assign(array('codequakeNewsFeed' => $feed));
 }
 /**
  * Returns the number of authentication failures for given user account.
  * 
  * @param	integer		$userID
  * @return	boolean
  */
 public static function countUserFailures($userID)
 {
     $sql = "SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twcf" . WCF_N . "_user_authentication_failure\n\t\t\tWHERE\tuserID = ?\n\t\t\t\tAND time > ?";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array($userID, TIME_NOW - USER_AUTHENTICATION_FAILURE_TIMEOUT));
     return $statement->fetchColumn();
 }
 /**
  * @see	\wcf\system\importer\IImporter::import()
  */
 public function import($oldID, array $data, array $additionalData = array())
 {
     $data['packageID'] = 1;
     // set temporary option name
     $data['optionName'] = StringUtil::getRandomID();
     if ($data['optionType'] == 'boolean' || $data['optionType'] == 'integer') {
         if (isset($data['defaultValue'])) {
             $data['defaultValue'] = intval($data['defaultValue']);
         }
     }
     // create category
     $this->createCategory($data['categoryName']);
     // save option
     $action = new UserOptionAction(array(), 'create', array('data' => $data));
     $returnValues = $action->executeAction();
     $userOption = $returnValues['returnValues'];
     // update generic option name
     $editor = new UserOptionEditor($userOption);
     $editor->update(array('optionName' => 'option' . $userOption->optionID));
     // save name
     $sql = "INSERT IGNORE INTO\twcf" . WCF_N . "_language_item\n\t\t\t\t\t\t(languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)\n\t\t\tVALUES\t\t\t(?, ?, ?, ?, ?, ?)";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array(LanguageFactory::getInstance()->getDefaultLanguageID(), 'wcf.user.option.option' . $userOption->optionID, $additionalData['name'], 0, $this->languageCategoryID, 1));
     ImportHandler::getInstance()->saveNewID('com.woltlab.wcf.user.option', $oldID, $userOption->optionID);
     return $userOption->optionID;
 }
 /**
  * Returns the label of the input element.
  * 
  * @param	string		$identifier
  * @return	string
  */
 protected function getLabel($identifier)
 {
     if (isset($this->labels[$identifier])) {
         return '<label for="' . $identifier . '">' . WCF::getLanguage()->get($this->labels[$identifier]) . '</label>';
     }
     return '';
 }
 /**
  * Validates object options and permissions.
  * 
  * @param	\wcf\data\DatabaseObject		$object
  * @param	string				$optionsColumnName
  * @param	string				$permissionsColumnName
  * @return	boolean
  */
 protected function validate(DatabaseObject $object, $optionsColumnName = 'options', $permissionsColumnName = 'permissions')
 {
     // check the options of this item
     $hasEnabledOption = true;
     if ($object->{$optionsColumnName}) {
         $hasEnabledOption = false;
         $options = explode(',', strtoupper($object->{$optionsColumnName}));
         foreach ($options as $option) {
             if (defined($option) && constant($option)) {
                 $hasEnabledOption = true;
                 break;
             }
         }
     }
     if (!$hasEnabledOption) {
         return false;
     }
     // check the permission of this item for the active user
     $hasPermission = true;
     if ($object->{$permissionsColumnName}) {
         $hasPermission = false;
         $permissions = explode(',', $object->{$permissionsColumnName});
         foreach ($permissions as $permission) {
             if (WCF::getSession()->getPermission($permission)) {
                 $hasPermission = true;
                 break;
             }
         }
     }
     if (!$hasPermission) {
         return false;
     }
     return true;
 }
 /**
  * Creates the AccessibleNewsList object.
  */
 public function __construct()
 {
     parent::__construct();
     // accessible news categories
     $accessibleCategoryIDs = NewsCategory::getAccessibleCategoryIDs();
     if (!empty($accessibleCategoryIDs)) {
         $this->getConditionBuilder()->add('news.newsID IN (SELECT newsID FROM news' . WCF_N . '_news_to_category WHERE categoryID IN (?))', array($accessibleCategoryIDs));
     } else {
         $this->getConditionBuilder()->add('1=0');
     }
     // default conditions
     if (!WCF::getSession()->getPermission('mod.news.canReadDeactivatedNews')) {
         $this->getConditionBuilder()->add('news.isActive = 1');
     }
     if (!WCF::getSession()->getPermission('mod.news.canReadDeletedNews')) {
         $this->getConditionBuilder()->add('news.isDeleted = 0');
     }
     if (!WCF::getSession()->getPermission('mod.news.canReadFutureNews')) {
         if (WCF::getUser()->userID) {
             $this->getConditionBuilder()->add('(news.isPublished = 1 OR news.userID = ?)', array(WCF::getUser()->userID));
         } else {
             $this->getConditionBuilder()->add('news.isPublished = 1');
         }
     }
     // apply language filter
     if (LanguageFactory::getInstance()->multilingualismEnabled() && count(WCF::getUser()->getLanguageIDs())) {
         $this->getConditionBuilder()->add('(news.languageID IN (?) OR news.languageID IS NULL)', array(WCF::getUser()->getLanguageIDs()));
     }
 }
 /**
  * @see	\wcf\system\like\IViewableLikeProvider::prepare()
  */
 public function prepare(array $likes)
 {
     $responseIDs = array();
     foreach ($likes as $like) {
         $responseIDs[] = $like->objectID;
     }
     // get objects type ids
     $responses = array();
     $conditionBuilder = new PreparedStatementConditionBuilder();
     $conditionBuilder->add('comment_response.responseID IN (?)', array($responseIDs));
     $sql = "SELECT\t\tcomment.objectTypeID, comment_response.responseID\n\t\t\tFROM\t\twcf" . WCF_N . "_comment_response comment_response\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_comment comment\n\t\t\tON\t\t(comment.commentID = comment_response.commentID)\n\t\t\t" . $conditionBuilder;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute($conditionBuilder->getParameters());
     while ($row = $statement->fetchArray()) {
         $responses[$row['responseID']] = $row['objectTypeID'];
     }
     // group likes by object type id
     $likeData = array();
     foreach ($likes as $like) {
         if (isset($responses[$like->objectID])) {
             if (!isset($likeData[$responses[$like->objectID]])) {
                 $likeData[$responses[$like->objectID]] = array();
             }
             $likeData[$responses[$like->objectID]][] = $like;
         }
     }
     foreach ($likeData as $objectTypeID => $likes) {
         $objectType = CommentHandler::getInstance()->getObjectType($objectTypeID);
         if (CommentHandler::getInstance()->getCommentManager($objectType->objectType) instanceof IViewableLikeProvider) {
             CommentHandler::getInstance()->getCommentManager($objectType->objectType)->prepare($likes);
         }
     }
 }
 /**
  * @see	\wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
  */
 protected function rebuild(array $parameters)
 {
     $data = array();
     // number of entry
     $sql = "SELECT\tCOUNT(*) AS count,\n\t\t\t\tSUM(downloads) AS downloads\n\t\t\tFROM\tfilebase" . WCF_N . "_entry";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute();
     $row = $statement->fetchArray();
     $data['entries'] = $row['count'];
     $data['downloads'] = $row['downloads'];
     // number of comments
     $sql = "SELECT\tSUM(comments) AS count\n\t\t\tFROM\tfilebase" . WCF_N . "_entry\n\t\t\tWHERE\tcomments > 0";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute();
     $data['comments'] = $statement->fetchColumn();
     // number of authors
     $sql = "SELECT\tCOUNT(DISTINCT userID) AS count\n\t\t\tFROM\tfilebase" . WCF_N . "_entry";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute();
     $data['authors'] = $statement->fetchColumn();
     // files + total size
     $sql = "SELECT\tCOUNT(*) AS files,\n\t\t\t\tSUM(filesize) AS size\n\t\t\tFROM\tfilebase" . WCF_N . "_file";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute();
     $row = $statement->fetchArray();
     $data['files'] = $row['files'];
     $data['size'] = $row['size'];
     // downloads per day
     $days = ceil((TIME_NOW - FILEBASE_INSTALL_DATE) / 86400);
     if ($days <= 0) {
         $days = 1;
     }
     $data['downloadsPerDay'] = $data['downloads'] / $days;
     return $data;
 }
	/**
	 * Returns the acl options for the given category and for the given user.
	 * If no user is given, the active user is used.
	 * 
	 * @param	wcf\data\category\Category	$category
	 * @param	wcf\data\user\User		$user
	 */
	public function getPermissions(Category $category, User $user = null) {
		if ($user === null) {
			$user = WCF::getUser();
		}
		
		$permissions = array();
		if (isset($this->categoryPermissions[$category->categoryID])) {
			if (isset($this->categoryPermissions[$category->categoryID]['group'])) {
				foreach ($user->getGroupIDs() as $groupID) {
					if (isset($this->categoryPermissions[$category->categoryID]['group'][$groupID])) {
						foreach ($this->categoryPermissions[$category->categoryID]['group'][$groupID] as $optionName => $optionValue) {
							if (isset($permissions[$optionName])) {
								$permissions[$optionName] = $permissions[$optionName] || $optionValue;
							}
							else {
								$permissions[$optionName] = $optionValue;
							}
						}
					}
				}
			}
			
			if (isset($this->categoryPermissions[$category->categoryID]['user']) && isset($this->categoryPermissions[$category->categoryID]['user'][$user->userID])) {
				foreach ($this->categoryPermissions[$category->categoryID]['user'][$user->userID] as $optionName => $optionValue) {
					$permissions[$optionName] = $optionValue;
				}
			}
		}
		
		return $permissions;
	}
 /**
  * @see	\wcf\system\user\activity\event\IUserActivityEvent::prepare()
  */
 public function prepare(array $events)
 {
     $objectIDs = array();
     foreach ($events as $event) {
         $objectIDs[] = $event->objectID;
     }
     // fetch entrys
     $entryList = new EntryList();
     $entryList->setObjectIDs($objectIDs);
     $entryList->readObjects();
     $entries = $entryList->getObjects();
     // set message
     foreach ($events as $event) {
         if (isset($entries[$event->objectID])) {
             if (!$entries[$event->objectID]->canRead()) {
                 continue;
             }
             $event->setIsAccessible();
             // title
             $text = WCF::getLanguage()->getDynamicVariable('filebase.recentActivity.entry', array('entry' => $entries[$event->objectID]));
             $event->setTitle($text);
             // description
             $event->setDescription($entries[$event->objectID]->getExcerpt());
         } else {
             $event->setIsOrphaned();
         }
     }
 }
 /**
  * @see	\wcf\system\SingletonFactory::init()
  */
 protected function init()
 {
     // set default tags
     $this->addTag('description', 'description', WCF::getLanguage()->get(META_DESCRIPTION));
     $this->addTag('keywords', 'keywords', WCF::getLanguage()->get(META_KEYWORDS));
     $this->addTag('og:site_name', 'og:site_name', WCF::getLanguage()->get(PAGE_TITLE), true);
 }
 /**
  * Creates a new UnreadNewsList object.
  */
 public function __construct()
 {
     parent::__construct();
     $this->getConditionBuilder()->add("news.time > ?", array(VisitTracker::getInstance()->getVisitTime('de.voolia.news.entry')));
     $this->getConditionBuilder()->add("tracked_visit.visitTime IS NULL");
     $this->sqlConditionJoins = "LEFT JOIN wcf" . WCF_N . "_tracked_visit tracked_visit ON (tracked_visit.objectTypeID = " . VisitTracker::getInstance()->getObjectTypeID('de.voolia.news.entry') . " AND tracked_visit.objectID = news.newsID AND tracked_visit.userID = " . WCF::getUser()->userID . ")";
 }
 /**
  * @see \wcf\system\event\listener\IParameterizedEventListener::execute()
  */
 public function execute($eventObj, $className, $eventName, array &$parameters)
 {
     if (!MODULE_JCOINS || !WCF::getSession()->getPermission('user.jcoins.canSee')) {
         return;
     }
     $eventObj->validSortFields[] = 'jCoinsBalance';
 }
 /**
  * Returns true if this session is the active user session.
  * 
  * @return	boolean
  */
 public function isActiveUserSession()
 {
     if ($this->isActive() && $this->sessionID == WCF::getSession()->sessionID) {
         return 1;
     }
     return 0;
 }
 /**
  * @see	\wcf\system\comment\manager\ICommentManager::getTitle()
  */
 public function getTitle($objectTypeID, $objectID, $isResponse = false)
 {
     if ($isResponse) {
         return WCF::getLanguage()->get('filebase.commentResponse');
     }
     return WCF::getLanguage()->getDynamicVariable('filebase.comment');
 }
 /**
  * @see wcf\system\option\IOptionType::getFormElement()
  */
 public function getFormElement(Option $option, $value)
 {
     // get options
     $options = $this->parseEnableOptions($option);
     WCF::getTPL()->assign(array('disableOptions' => $options['disableOptions'], 'enableOptions' => $options['enableOptions'], 'option' => $option, 'selectOptions' => $option->parseSelectOptions(), 'value' => $value));
     return WCF::getTPL()->fetch('selectOptionType');
 }
 /**
  * Fetches a user from the database.
  */
 protected function getObject()
 {
     $sql = "SELECT\t\tuserID, registrationDate\n\t\t\tFROM\t\twcf" . WCF_N . "_user\n\t\t\tORDER BY\tuserID ASC";
     $statement = \wcf\system\WCF::getDB()->prepareStatement($sql, 1, $this->generator->numberBetween(0, $this->userCount - 1));
     $statement->execute();
     $this->receiver = $statement->fetchObject('\\wcf\\data\\user\\User');
 }
 /**
  * Deletes the cronjob log.
  */
 public static function clearLogs($packageID = PACKAGE_ID)
 {
     // delete logs
     $sql = "DELETE FROM\twcf" . WCF_N . "_cronjob_log\n\t\t\tWHERE\t\tcronjobID IN (\n\t\t\t\t\t\tSELECT\tcronjobID\n\t\t\t\t\t\tFROM\twcf" . WCF_N . "_cronjob cronjob,\n\t\t\t\t\t\t\twcf" . WCF_N . "_package_dependency package_dependency\n\t\t\t\t\t\tWHERE \tcronjob.packageID = package_dependency.dependency\n\t\t\t\t\t\t\tAND package_dependency.packageID = ?\n\t\t\t\t\t)";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute($packageID);
 }
 /**
  * @see    \wcf\data\like\object\ILikeObject::sendNotification()
  */
 public function sendNotification(Like $like)
 {
     if ($this->object->userID != WCF::getUser()->userID) {
         $notificationObject = new LikeUserNotificationObject($like);
         UserNotificationHandler::getInstance()->fireEvent('like', 'de.incendium.cms.like.likeableNews.notification', $notificationObject, array($this->object->userID), array('objectID' => $this->object->entryID));
     }
 }
 /**
  * @see	\wcf\system\event\listener\IParameterizedEventListener::execute()
  */
 public function execute($eventObj, $className, $eventName, array &$parameters)
 {
     if (WCF::getUser()->userID && WCF::getSession()->getPermission('admin.general.canUseAcp') && !defined(get_class($eventObj) . '::DO_NOT_LOG')) {
         // try to find existing session log
         $sql = "SELECT\tsessionLogID\n\t\t\t\tFROM\twcf" . WCF_N . "_acp_session_log\n\t\t\t\tWHERE\tsessionID = ?\n\t\t\t\t\tAND lastActivityTime >= ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array(WCF::getSession()->sessionID, TIME_NOW - SESSION_TIMEOUT));
         $row = $statement->fetchArray();
         if (!empty($row['sessionLogID'])) {
             $sessionLogID = $row['sessionLogID'];
             $sessionLogEditor = new ACPSessionLogEditor(new ACPSessionLog(null, array('sessionLogID' => $sessionLogID)));
             $sessionLogEditor->update(array('lastActivityTime' => TIME_NOW));
         } else {
             // create new session log
             $sessionLog = ACPSessionLogEditor::create(array('sessionID' => WCF::getSession()->sessionID, 'userID' => WCF::getUser()->userID, 'ipAddress' => UserUtil::getIpAddress(), 'hostname' => @gethostbyaddr(WCF::getSession()->ipAddress), 'userAgent' => WCF::getSession()->userAgent, 'time' => TIME_NOW, 'lastActivityTime' => TIME_NOW));
             $sessionLogID = $sessionLog->sessionLogID;
         }
         // format request uri
         $requestURI = WCF::getSession()->requestURI;
         // remove directories
         $URIComponents = explode('/', $requestURI);
         $requestURI = array_pop($URIComponents);
         // remove session url
         $requestURI = preg_replace('/(?:\\?|&)s=[a-f0-9]{40}/', '', $requestURI);
         // save access
         ACPSessionAccessLogEditor::create(array('sessionLogID' => $sessionLogID, 'ipAddress' => UserUtil::getIpAddress(), 'time' => TIME_NOW, 'requestURI' => $requestURI, 'requestMethod' => WCF::getSession()->requestMethod, 'className' => get_class($eventObj)));
     }
 }
 /**
  * @see	\wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
  */
 protected function rebuild(array $parameters)
 {
     $data = array('boxes' => array(), 'pages' => array());
     // load boxes
     $boxList = new DashboardBoxList();
     $boxList->readObjects();
     foreach ($boxList as $box) {
         $data['boxes'][$box->boxID] = $box;
     }
     // load settings
     $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.user.dashboardContainer');
     $objectTypeIDs = array();
     foreach ($objectTypes as $objectType) {
         $objectTypeIDs[] = $objectType->objectTypeID;
     }
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("objectTypeID IN (?)", array($objectTypeIDs));
     $sql = "SELECT\t\t*\n\t\t\tFROM\t\twcf" . WCF_N . "_dashboard_option\n\t\t\t" . $conditions . "\n\t\t\tORDER BY\tshowOrder ASC";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute($conditions->getParameters());
     while ($row = $statement->fetchArray()) {
         if (!isset($data['pages'][$row['objectTypeID']])) {
             $data['pages'][$row['objectTypeID']] = array();
         }
         $data['pages'][$row['objectTypeID']][] = $row['boxID'];
     }
     return $data;
 }
 /**
  * Creates a Member
  *
  * A Single Wow Member
  *
  * @param array $data
  *
  * @link http://dev.battle.net
  */
 function __construct(array $data)
 {
     $this->baseUrl = WCF::getPath('cms');
     $this->data = $data;
     $inflector = new Inflector();
     $this->inflector = $inflector;
 }
	/**
	 * @see	wcf\system\package\plugin\IPackageInstallationPlugin::uninstall()
	 */
	public function uninstall() {
		// create ACP-templates list
		$templates = array();
		
		// get ACP-templates from log
		$sql = "SELECT	*
			FROM	wcf".WCF_N."_acp_template
			WHERE	packageID = ?";
		$statement = WCF::getDB()->prepareStatement($sql);
		$statement->execute(array($this->installation->getPackageID()));
		while ($row = $statement->fetchArray()) {
			// store acp template with suffix (_$packageID)
			$templates[] = 'acp/templates/'.$row['templateName'].'.tpl';
		}
		
		if (!empty($templates)) {
			// delete template files
			$packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$this->installation->getPackage()->packageDir));
			$deleteEmptyDirectories = $this->installation->getPackage()->isApplication;
			$this->installation->deleteFiles($packageDir, $templates, false, $deleteEmptyDirectories);
			
			// delete log entries
			parent::uninstall();
		}
	}
	/**
	 * @see	wcf\system\package\plugin\IPackageInstallationPlugin::install()
	 */
	public function install() {
		parent::install();
		
		// get installation path of package
		$sql = "SELECT	packageDir
			FROM	wcf".WCF_N."_package
			WHERE	packageID = ?";
		$statement = WCF::getDB()->prepareStatement($sql);
		$statement->execute(array($this->installation->getPackageID()));
		$packageDir = $statement->fetchArray();
		$packageDir = $packageDir['packageDir'];
		
		// get relative path of script
		$path = FileUtil::getRealPath(WCF_DIR.$packageDir);
		
		// reset WCF cache
		CacheHandler::getInstance()->flushAll();
		
		// run script
		$this->run($path.$this->instruction['value']);
		
		// delete script
		if (@unlink($path.$this->instruction['value'])) {
			// delete file log entry
			$sql = "DELETE FROM	wcf".WCF_N."_package_installation_file_log
				WHERE		packageID = ?
						AND filename = ?";
			$statement = WCF::getDB()->prepareStatement($sql);
			$statement->execute(array(
				$this->installation->getPackageID(),
				$this->instruction['value']
			));
		}
	}