/**
  * @see AdminToolsFunction::execute($data)
  */
 public function execute($data)
 {
     parent::execute($data);
     $parameters = $data['parameters']['database.optimize'];
     $tables = WCF::getDB()->getTableNames();
     $message = WCF::getLanguage()->get('wcf.acp.admintools.function.success', array('$functionName' => WCF::getLanguage()->get('wcf.acp.admintools.function.' . $data['functionName']))) . '<ul>';
     if ($parameters['analyze']) {
         foreach ($tables as $table) {
             WCF::getDB()->sendQuery('ANALYZE TABLE ' . $table);
         }
         $message .= WCF::getLanguage()->get('wcf.acp.admintools.function.database.optimize.analyze.success', array('$tableCount' => count($tables)));
     }
     if ($parameters['optimize']) {
         foreach ($tables as $table) {
             WCF::getDB()->sendQuery('OPTIMIZE TABLE ' . $table);
         }
         $message .= WCF::getLanguage()->get('wcf.acp.admintools.function.database.optimize.optimize.success', array('$tableCount' => count($tables)));
     }
     if (!count($tables) || !$parameters['analyze'] && !$parameters['optimize']) {
         $this->setReturnMessage('error', WCF::getLanguage()->get('wcf.acp.admintools.function.database.optimize.analyze.error'));
     } else {
         $this->setReturnMessage('success', $message . '</ul>');
     }
     $this->executed();
 }
 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if ($eventName == 'readFormParameters') {
         if (isset($_POST['usedQuotes']) && is_array($_POST['usedQuotes'])) {
             $this->usedQuotes = $_POST['usedQuotes'];
         }
     } else {
         if ($eventName == 'saved') {
             if (count($this->usedQuotes) > 0) {
                 require_once WCF_DIR . 'lib/data/message/multiQuote/MultiQuoteManager.class.php';
                 foreach ($this->usedQuotes as $quoteID) {
                     MultiQuoteManager::removeQuote($quoteID);
                 }
                 MultiQuoteManager::saveStorage();
             }
         } else {
             if ($eventName == 'assignVariables') {
                 require_once WCF_DIR . 'lib/data/message/multiQuote/MultiQuoteManager.class.php';
                 $quotes = MultiQuoteManager::getStorage();
                 $usedQuotes = array_flip($this->usedQuotes);
                 foreach ($quotes as $quoteID => $quote) {
                     $quote['used'] = isset($usedQuotes[$quoteID]) ? 1 : 0;
                     $quotes[$quoteID] = $quote;
                 }
                 WCF::getTPL()->assign('quotes', $quotes);
                 WCF::getTPL()->append(array('additionalTabs' => '<li id="multiQuoteTab"><a onclick="tabbedPane.openTab(\'multiQuote\');"><span>' . WCF::getLanguage()->get('wcf.multiQuote.title') . '</span></a></li>', 'additionalSubTabs' => WCF::getTPL()->fetch('messageFormMultiQuote')));
             }
         }
     }
 }
 public function execute($eventObj, $className, $eventName)
 {
     if (!defined('THREAD_SHOW_CLOSED_MESSAGE_ALL')) {
         define('THREAD_SHOW_CLOSED_MESSAGE_ALL', false);
     }
     if (isset($eventObj->thread) && $eventObj->thread->isDeleted == 1) {
         WCF::getTPL()->append('userMessages', '<p class="error">' . WCF::getLanguage()->get('wbb.thread.inactiveTopic.deleted') . '</p>');
     } else {
         if (isset($eventObj->thread) && $eventObj->thread->isDisabled == 1) {
             WCF::getTPL()->append('userMessages', '<p class="warning">' . WCF::getLanguage()->get('wbb.thread.inactiveTopic.disabled') . '</p>');
         } else {
             if (isset($eventObj->thread) && $eventObj->thread->isClosed == 1 && (WCF::getUser()->getPermission('mod.board.canReplyClosedThread') || THREAD_SHOW_CLOSED_MESSAGE_ALL)) {
                 WCF::getTPL()->append('userMessages', '<p class="warning">' . WCF::getLanguage()->get('wbb.thread.inactiveTopic.closed') . '</p>');
             } else {
                 if (isset($eventObj->post) && $eventObj->post->isDeleted == 1) {
                     WCF::getTPL()->append('userMessages', '<p class="error">' . WCF::getLanguage()->get('wbb.thread.inactiveTopic.deleted') . '</p>');
                 } else {
                     if (isset($eventObj->post) && $eventObj->post->isDisabled == 1) {
                         WCF::getTPL()->append('userMessages', '<p class="warning">' . WCF::getLanguage()->get('wbb.thread.inactiveTopic.disabled') . '</p>');
                     } else {
                         if (isset($eventObj->post) && $eventObj->post->isClosed == 1 && (WCF::getUser()->getPermission('mod.board.canReplyClosedThread') || THREAD_SHOW_CLOSED_MESSAGE_ALL)) {
                             WCF::getTPL()->append('userMessages', '<p class="warning">' . WCF::getLanguage()->get('wbb.thread.inactiveTopic.closed') . '</p>');
                         }
                     }
                 }
             }
         }
     }
 }
 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     // ip address
     if (WCF::getUser()->getPermission('admin.general.canViewIpAddress') && $eventObj->container instanceof ThreadPage) {
         foreach ($eventObj->messageSidebars as $id => $sidebar) {
             if ($sidebar->getSidebarObject()->ipAddress) {
                 $title = WCF::getLanguage()->getDynamicVariable('wbb.thread.ipAddress', array('username' => $sidebar->getUser()->username, 'ipAddress' => $sidebar->getSidebarObject()->ipAddress));
                 $sidebar->addUserContact('<a href="index.php?page=IpAddress&amp;postID=' . $sidebar->getSidebarObject()->postID . SID_ARG_2ND . '"><img src="' . StyleManager::getStyle()->getIconPath('ipAddressS.png') . '" alt="' . $title . '" title="' . $title . '" /></a>');
             }
         }
     }
     // thread starter icon
     if (MESSAGE_SIDEBAR_ENABLE_THREAD_STARTER_ICON == 1 && $eventObj->container instanceof ThreadPage && $eventObj->container->thread->userID != 0) {
         foreach ($eventObj->messageSidebars as $id => $sidebar) {
             if ($eventObj->container->thread->userID == $sidebar->getUser()->userID) {
                 $title = WCF::getLanguage()->getDynamicVariable('wbb.thread.starter', array('username' => $sidebar->getUser()->username));
                 $sidebar->addUserSymbol('<img src="' . StyleManager::getStyle()->getIconPath('threadStarterS.png') . '" alt="' . $title . '" title="' . $title . '" />');
             }
         }
     }
     // post count
     if (MESSAGE_SIDEBAR_ENABLE_USER_POSTS == 1) {
         foreach ($eventObj->messageSidebars as $id => $sidebar) {
             if ($sidebar->getUser()->userID != 0 && $sidebar->getSidebarObject()->posts !== null) {
                 $sidebar->userCredits = array_merge(array(array('name' => WCF::getLanguage()->get('wcf.user.posts'), 'value' => StringUtil::formatInteger($sidebar->getSidebarObject()->posts), 'url' => 'index.php?form=Search&amp;types[]=post&amp;userID=' . $sidebar->getUser()->userID . SID_ARG_2ND)), $sidebar->userCredits);
             }
         }
     }
 }
 /**
  * @see Page::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     // permission
     WCF::getUser()->checkPermission('admin.system.adminTools.canView');
     $this->atSettings = AdminTools::getSettings();
     foreach ($this->atSettings as $k => $val) {
         if (isset($this->{$k})) {
             $this->{$k} = $val;
         }
     }
     // execute cron job
     if (!empty($_REQUEST['cRun'])) {
         if ($_REQUEST['cRun'] == 'journal' && (isset($_REQUEST['log']) || isset($_REQUEST['stat']))) {
             AdminTools::cronRunJournal(0, isset($_REQUEST['log']) ? $_REQUEST['log'] : 0, isset($_REQUEST['stat']) ? $_REQUEST['stat'] : 0, isset($_REQUEST['adminMail']) ? $_REQUEST['adminMail'] : 0);
         } else {
             if ($_REQUEST['cRun'] == 'db' && (isset($_REQUEST['analyze']) || isset($_REQUEST['optimize']) || isset($_REQUEST['backup']))) {
                 AdminTools::cronRunDB(isset($_REQUEST['analyze']) ? $_REQUEST['analyze'] : 0, isset($_REQUEST['optimize']) ? $_REQUEST['optimize'] : 0, isset($_REQUEST['backup']) ? $_REQUEST['backup'] : 0);
             } else {
                 if ($_REQUEST['cRun'] == 'subscriptions') {
                     $cnt = AdminTools::cronCleanUpSubscriptions(false);
                     $this->subscriptionsMsg = WCF::getLanguage()->get('wcf.acp.adminTools.cron.cronCleanUpSubscriptions.cleaned', array('$cnt' => $cnt));
                 }
             }
         }
     }
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     // get all available languages
     $this->languages = WCF::getLanguage()->getLanguageCodes();
     // rekursion fail
     if ($this->parentItem == $this->helpItem->helpItem) {
         $this->parentItem = $this->helpItem->parentHelpItem;
     }
     // default values
     if (!count($_POST)) {
         $this->refererPattern = $this->helpItem->refererPattern;
         $this->showOrder = $this->helpItem->showOrder;
         $this->isDisabled = $this->helpItem->isDisabled;
         $this->parentItem = $this->helpItem->parentHelpItem;
         if (WCF::getLanguage()->getLanguageID() != $this->languageID) {
             $language = new Language($this->languageID);
         } else {
             $language = WCF::getLanguage();
         }
         $this->topic = $language->get('wcf.help.item.' . $this->helpItem->helpItem);
         if ($this->topic == 'wcf.help.item.' . $this->helpItem->helpItem) {
             $this->topic = "";
         }
         $this->text = $language->get('wcf.help.item.' . $this->helpItem->helpItem . '.description');
         if ($this->text == 'wcf.help.item.' . $this->helpItem->helpItem . '.description') {
             $this->text = "";
         }
     }
 }
    /**
     * @see EventListener::execute()
     */
    public function execute($eventObj, $className, $eventName)
    {
        if ($eventName == 'init') {
            $eventObj->sqlSelects .= 'wbb_user.posts,';
            $eventObj->sqlJoins .= ' LEFT JOIN wbb' . WBB_N . '_user wbb_user
						ON (wbb_user.userID = user.userID) ';
        } else {
            if ($eventName == 'assignVariables') {
                $user = $eventObj->frame->getUser();
                $eventObj->generalInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('postM.png'), 'title' => WCF::getLanguage()->get('wcf.user.posts'), 'value' => '<a href="index.php?form=Search&amp;types[]=post&amp;userID=' . $user->userID . SID_ARG_2ND . '" title="' . WCF::getLanguage()->get('wcf.user.profile.search', array('$username' => StringUtil::encodeHTML($user->username))) . '">' . StringUtil::formatInteger(intval($user->posts)) . ($user->getProfileAge() > 1 ? ' ' . WCF::getLanguage()->get('wcf.user.postsPerDay', array('$posts' => StringUtil::formatDouble($user->posts / $user->getProfileAge()))) : '') . '</a>');
                // show last 5 posts
                if (PROFILE_SHOW_LAST_POSTS) {
                    require_once WBB_DIR . 'lib/data/post/ViewablePost.class.php';
                    require_once WBB_DIR . 'lib/data/board/Board.class.php';
                    $boardIDArray = Board::getAccessibleBoardIDArray(array('canViewBoard', 'canEnterBoard', 'canReadThread'));
                    if (count($boardIDArray)) {
                        $posts = array();
                        $sql = "SELECT\t\tpost.postID, post.time,\n\t\t\t\t\t\t\t\tCASE WHEN post.subject <> '' THEN post.subject ELSE thread.topic END AS subject\n\t\t\t\t\t\tFROM\t\twbb" . WBB_N . "_user_last_post user_last_post\n\t\t\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_post post\n\t\t\t\t\t\tON\t\t(post.postID = user_last_post.postID)\n\t\t\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\t\t\t\tON\t\t(thread.threadID = post.threadID)\n\t\t\t\t\t\tWHERE\t\tuser_last_post.userID = " . $user->userID . "\n\t\t\t\t\t\t\t\tAND post.isDeleted = 0\n\t\t\t\t\t\t\t\tAND post.isDisabled = 0\n\t\t\t\t\t\t\t\tAND thread.boardID IN (" . implode(',', $boardIDArray) . ")\n\t\t\t\t\t\t\t\t" . (count(WCF::getSession()->getVisibleLanguageIDArray()) ? "AND thread.languageID IN (" . implode(',', WCF::getSession()->getVisibleLanguageIDArray()) . ")" : "") . "\n\t\t\t\t\t\tORDER BY\tuser_last_post.time DESC";
                        $result = WCF::getDB()->sendQuery($sql, 5);
                        while ($row = WCF::getDB()->fetchArray($result)) {
                            $posts[] = new ViewablePost(null, $row);
                        }
                        if (count($posts)) {
                            WCF::getTPL()->assign(array('posts' => $posts, 'user' => $user));
                            WCF::getTPL()->append('additionalContent2', WCF::getTPL()->fetch('userProfileLastPosts'));
                        }
                    }
                }
            }
        }
    }
 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     $um = WCF::getTPL()->get('userMessages');
     if ($um && preg_match('/page=UserGuestbook/', $um)) {
         return;
     }
     if (WCF::getUser()->userID) {
         $userID = WCF::getUser()->userID;
     }
     if (!empty($userID)) {
         $ret = WCF::getTPL()->get('userMessages');
         require_once WCF_DIR . 'lib/data/user/UserProfile.class.php';
         $user = new UserProfile($userID, null, null, null);
         if ($user->userGuestbook_sendInfo) {
             $sql = "SELECT gbh.userLastVisit, gbh.newEntries, gbh.lastEntryUserID, gbh.lastEntry, u.username" . "\n  FROM wcf" . WCF_N . "_user_guestbook_header gbh" . "\n  LEFT JOIN wcf" . WCF_N . "_user u ON (u.userID = gbh.lastEntryUserID)" . "\n WHERE gbh.userID = " . $userID . "\n   AND gbh.userID != gbh.lastEntryUserID";
             $row = WCF::getDB()->getFirstRow($sql);
             if (!empty($row['newEntries']) && !empty($row['lastEntry']) && $row['lastEntry'] > $row['userLastVisit']) {
                 if ($row['newEntries'] != 1) {
                     $msg = WCF::getLanguage()->get('wcf.user.guestbook.infoMessages', array('$newEntries' => $row['newEntries']));
                 } else {
                     $msg = WCF::getLanguage()->get('wcf.user.guestbook.infoMessage', array('$username' => $row['username']));
                 }
                 WCF::getTPL()->append('userMessages', '<p class="info"><a href="index.php?page=UserGuestbook&userID=' . $userID . SID_ARG_2ND . '">' . $msg . '</a></p>');
             }
         }
     }
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     WCF::getTPL()->assign(array('pageTitle' => WCF::getLanguage()->get('wbb.acp.updateCounters.counter.' . $this->counter), 'url' => 'index.php?action=Update' . ucfirst($this->counter) . '&limit=' . $this->limit . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED));
     WCF::getTPL()->display('worker');
     exit;
 }
 /**
  * @see	Page::readData()
  */
 public function readData()
 {
     parent::readData();
     // create chart object
     $this->data = new OpenFlashChart(WCF::getLanguage()->get('cms.acp.statistics.chart.page.title'));
     // create element
     $element = new OpenFlashChartElement($this->type);
     // set special options
     $element->tip = WCF::getLanguage()->get('cms.acp.statistics.chart.page.tip');
     // read data from db
     $sql = "SELECT\n\t\t\t\t\tstats.requestCount AS requestCount,\n\t\t\t\t\tpage.title AS title\n\t\t\t\tFROM\n\t\t\t\t\tcms" . CMS_N . "_statistic_page stats\n\t\t\t\tLEFT JOIN\n\t\t\t\t\twcf" . WCF_N . "_page page\n\t\t\t\tON\n\t\t\t\t\tstats.pageID = page.pageID";
     $result = WCF::getDB()->sendQuery($sql);
     $items = array();
     // get available colours
     $colours = array();
     while ($row = WCF::getDB()->fetchArray($result)) {
         $colours[] = "#" . substr(sha1($row['title']), 0, 6);
         $items[] = $row;
     }
     // add colours to element
     $element->colours = $colours;
     // load data
     foreach ($items as $row) {
         switch ($this->type) {
             case 'pie':
                 $element->addValue(intval($row['requestCount']), $row['title']);
                 break;
         }
     }
     // add element to chart
     $this->data->addElement($element);
 }
Beispiel #11
0
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     if (!empty($this->allianceID)) {
         $this->alliance = new Alliance($this->allianceID);
     } else {
         $this->alliance = Alliance::getByUserID(WCF::getUser()->userID);
     }
     // no such alliance
     if ($this->alliance === null || $this->alliance->id <= 0) {
         require_once WCF_DIR . 'lib/system/exception/NamedUserException.class.php';
         //$_SERVER['HTTP_ACCEPT'] = str_replace('platzhalter', 'application/xhtml+xml', $_SERVER['HTTP_ACCEPT']);
         // user has no alliance
         if (empty($this->allianceID)) {
             // waiting for a answer to the application
             if (WCF::getUser()->ally_request) {
                 $alliance = new Alliance(WCF::getUser()->ally_request);
                 throw new NamedUserException(WCF::getLanguage()->get('wot.alliance.waitingForApplicationAnswer', array('allianceID' => $alliance->allianceID, 'allianceTag' => $alliance->ally_tag, 'userID' => WCF::getUser()->userID)));
             }
             throw new NamedUserException(WCF::getLanguage()->get('wot.alliance.notMember'));
         }
         // requested alliance does not exist
         throw new NamedUserException(WCF::getLanguage()->get('wot.alliance.notExisting'));
     }
     // applications
     if ($this->alliance->getRank(true, 3)) {
         $sql = "SELECT COUNT(*) AS count\n\t\t\t\t\tFROM ugml_users\n\t\t\t\t\tWHERE ally_request = " . $this->alliance->allianceID;
         $result = WCF::getDB()->getFirstRow($sql);
         $this->applicationsCount = $result['count'];
     }
 }
 /**
  * @see OptionType::getData()
  */
 public function getData($optionData, $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::initTPL()
  */
 protected function initTPL()
 {
     // init style to get template pack id
     $this->initStyle();
     global $packageDirs;
     require_once WCF_DIR . 'lib/system/template/StructuredTemplate.class.php';
     self::$tplObj = new StructuredTemplate(self::getStyle()->templatePackID, self::getLanguage()->getLanguageID(), ArrayUtil::appendSuffix($packageDirs, 'templates/'));
     $this->assignDefaultTemplateVariables();
     // init cronjobs
     $this->initCronjobs();
     // check offline mode
     if (OFFLINE && !self::getUser()->getPermission('user.board.canViewBoardOffline')) {
         $showOfflineError = true;
         foreach (self::$availablePagesDuringOfflineMode as $type => $names) {
             if (isset($_REQUEST[$type])) {
                 foreach ($names as $name) {
                     if ($_REQUEST[$type] == $name) {
                         $showOfflineError = false;
                         break 2;
                     }
                 }
                 break;
             }
         }
         if ($showOfflineError) {
             self::getTPL()->display('offline');
             exit;
         }
     }
     // user ban
     if (self::getUser()->banned && (!isset($_REQUEST['page']) || $_REQUEST['page'] != 'LegalNotice')) {
         throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.user.banned'));
     }
 }
 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if ($eventObj->board->getPermission('canPostAnonymously')) {
         if ($eventName === 'readFormParameters') {
             if (isset($_POST['postAnonymously'])) {
                 self::$postAnonymously = intval($_POST['postAnonymously']);
             }
         } else {
             if ($eventName === 'assignVariables') {
                 WCF::getTPL()->assign('postAnonymously', self::$postAnonymously);
             } else {
                 if ($eventName === 'show') {
                     WCF::getTPL()->append('additionalSettings', WCF::getTPL()->fetch('messageFormSettingsPostAnonymously'));
                 } else {
                     if ($eventName === 'save') {
                         if (self::$postAnonymously) {
                             self::$userID = WCF::getUser()->userID;
                             self::$ipAddress = WCF::getSession()->ipAddress;
                             $eventObj->username = WCF::getLanguage()->get('wbb.threadAdd.anonymousUsername');
                             WCF::getUser()->userID = 0;
                             WCF::getSession()->ipAddress = '';
                         }
                     } else {
                         if ($eventName === 'saved') {
                             if (self::$postAnonymously) {
                                 WCF::getUser()->userID = self::$userID;
                                 WCF::getSession()->ipAddress = self::$ipAddress;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 /**
  * 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 EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (MODULE_USER_INFRACTION == 1) {
         if ($eventName == 'init') {
             if (WCF::getUser()->getPermission('admin.user.infraction.canWarnUser') || USER_CAN_SEE_HIS_WARNINGS && WCF::getUser()->userID == $eventObj->userID) {
                 $eventObj->sqlSelects .= "(SELECT COUNT(*) FROM wcf" . WCF_N . "_user_infraction_warning_to_user WHERE userID = " . $eventObj->userID . ") AS warnings,";
             }
         } else {
             if ($eventName == 'assignVariables') {
                 if (!$eventObj->getUser()->warnings) {
                     // remove warning overview tab
                     foreach (UserProfileMenu::getInstance()->menuItems as $parentMenuItem => $items) {
                         foreach ($items as $key => $item) {
                             if ($item['menuItem'] == 'wcf.user.profile.menu.link.infraction') {
                                 unset(UserProfileMenu::getInstance()->menuItems[$parentMenuItem][$key]);
                             }
                         }
                     }
                 }
                 // add warn button
                 if (WCF::getUser()->getPermission('admin.user.infraction.canWarnUser')) {
                     WCF::getTPL()->append('additionalAdminOptions', '<li><a href="index.php?form=UserWarn&amp;userID=' . $eventObj->userID . SID_ARG_2ND . '">' . WCF::getLanguage()->get('wcf.user.infraction.button.warn') . '</a></li>');
                 }
             }
         }
     }
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     if (!count($_POST)) {
         // default value
         $this->optionName = WCF::getLanguage()->get('wcf.user.option.' . $this->userOption->optionName);
         $this->optionDescription = WCF::getLanguage()->get('wcf.user.option.' . $this->userOption->optionName . '.description');
         $this->categoryName = $this->userOption->categoryName;
         $this->optionType = $this->userOption->optionType;
         $this->defaultValue = $this->userOption->defaultValue;
         $this->validationPattern = $this->userOption->validationPattern;
         $this->selectOptions = $this->userOption->selectOptions;
         $this->required = $this->userOption->required;
         $this->askDuringRegistration = $this->userOption->askDuringRegistration;
         $this->editable = $this->userOption->editable;
         $this->visible = $this->userOption->visible;
         $this->searchable = $this->userOption->searchable;
         $this->showOrder = $this->userOption->showOrder;
         if ($this->userOption->outputClass == 'UserOptionOutputNewlineToBreak') {
             $this->showLineBreaks = 1;
         }
         if ($this->userOption->outputClass == 'UserOptionOutputURL') {
             $this->textFormat = 'link';
         }
         if ($this->userOption->outputClass == 'UserOptionOutputImage') {
             $this->textFormat = 'image';
         }
     }
 }
    /**
     * @see EventListener::execute()
     */
    public function execute($eventObj, $className, $eventName)
    {
        /* OptionTypeMemberslistcolumns */
        if ($eventName == 'construct') {
            $eventObj->staticColumns['posts'] = 'wcf.user.posts';
        } else {
            if ($eventName == 'readParameters') {
                $eventObj->specialSortFields[] = 'posts';
            } else {
                if ($eventName == 'readData') {
                    if ($eventObj->sortField == 'posts') {
                        $eventObj->userTable = 'wbb' . WBB_N . '_user';
                    } else {
                        $eventObj->sqlSelects .= 'wbb_user.posts,';
                        $eventObj->sqlJoins .= ' LEFT JOIN wbb' . WBB_N . '_user wbb_user
							ON (wbb_user.userID = user.userID) ';
                    }
                } else {
                    if ($eventName == 'assignVariables') {
                        if (in_array('posts', $eventObj->activeFields)) {
                            foreach ($eventObj->members as $key => $memberData) {
                                $user = $memberData['user'];
                                $username = $memberData['encodedUsername'];
                                $eventObj->members[$key]['posts'] = '<a href="index.php?form=Search&amp;types[]=post&amp;userID=' . $user->userID . SID_ARG_2ND . '" title="' . WCF::getLanguage()->get('wcf.user.profile.search', array('$username' => $username)) . '">' . StringUtil::formatInteger(intval($user->posts)) . '</a>';
                            }
                        }
                    }
                }
            }
        }
    }
 protected function icsHolidayExporter($location)
 {
     $ret = '';
     $page = 'IcsHolidayExporter';
     $ret = '<a href="index.php?form=' . $page . '">' . WCF::getLanguage()->get($location['locationName']) . '</a>';
     return $ret;
 }
 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     $canBanUser = WCF::getUser()->getPermission('admin.user.canBanUser');
     $canEnableUser = WCF::getUser()->getPermission('admin.user.canEnableUser');
     $url = rawurlencode($eventObj->url);
     $additionalButtons = array();
     foreach ($eventObj->users as $key => $user) {
         $additionalButtons[$user->userID] = '';
         if ($canEnableUser && $user->accessible && $user->userID != WCF::getUser()->userID) {
             if ($user->activationCode == 0) {
                 $additionalButtons[$user->userID] .= ' <a href="index.php?action=UserDisable&amp;userID=' . $user->userID . '&amp;url=' . $url . '&amp;packageID=' . PACKAGE_ID . SID_ARG_2ND . '"><img src="' . RELATIVE_WCF_DIR . 'icon/enabledS.png" alt="" title="' . WCF::getLanguage()->get('wcf.acp.user.button.disable') . '" /></a>';
             } else {
                 $additionalButtons[$user->userID] .= ' <a href="index.php?action=UserEnable&amp;userID=' . $user->userID . '&amp;url=' . $url . '&amp;packageID=' . PACKAGE_ID . SID_ARG_2ND . '"><img src="' . RELATIVE_WCF_DIR . 'icon/disabledS.png" alt="" title="' . WCF::getLanguage()->get('wcf.acp.user.button.enable') . '" /></a>';
             }
         } else {
             if ($user->activationCode == 0) {
                 $additionalButtons[$user->userID] .= ' <img src="' . RELATIVE_WCF_DIR . 'icon/enabledDisabledS.png" alt="" title="' . WCF::getLanguage()->get('wcf.acp.user.button.disable') . '" />';
             } else {
                 $additionalButtons[$user->userID] .= ' <img src="' . RELATIVE_WCF_DIR . 'icon/disabledDisabledS.png" alt="" title="' . WCF::getLanguage()->get('wcf.acp.user.button.enable') . '" />';
             }
         }
         if ($canBanUser && $user->accessible && $user->userID != WCF::getUser()->userID) {
             if ($user->banned == 0) {
                 $additionalButtons[$user->userID] .= ' <a href="index.php?form=UserBan&amp;userID=' . $user->userID . '&amp;url=' . $url . '&amp;packageID=' . PACKAGE_ID . SID_ARG_2ND . '"><img src="' . RELATIVE_WCF_DIR . 'icon/userBanS.png" alt="" title="' . WCF::getLanguage()->get('wcf.acp.user.button.ban') . '" /></a>';
             } else {
                 $additionalButtons[$user->userID] .= ' <a href="index.php?action=UserUnban&amp;userID=' . $user->userID . '&amp;url=' . $url . '&amp;packageID=' . PACKAGE_ID . SID_ARG_2ND . '"><img src="' . RELATIVE_WCF_DIR . 'icon/userUnbanS.png" alt="" title="' . WCF::getLanguage()->get('wcf.acp.user.button.unban') . '" /></a>';
             }
         } else {
             $additionalButtons[$user->userID] .= ' <img src="' . RELATIVE_WCF_DIR . 'icon/userBanDisabledS.png" alt="" title="' . WCF::getLanguage()->get('wcf.acp.user.button.ban') . '" />';
         }
     }
     WCF::getTPL()->append('additionalButtons', $additionalButtons);
 }
 /**
  * @see	Page::readData()
  */
 public function readData()
 {
     // read variables
     $this->availableLanguages = WCF::getLanguage()->getAvailableLanguageCodes();
     $this->languageID = WCF::getLanguage()->getLanguageID();
     // call parent
     parent::readData();
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     if (!count($_POST)) {
         $this->categoryName = WCF::getLanguage()->get('wcf.user.option.category.' . $this->category->categoryName);
         $this->showOrder = $this->category->showOrder;
     }
 }
 /**
  * Returns the icon html code.
  * 
  * @return	string 
  */
 protected function getImage(User $user, $imageSize = 'M')
 {
     $title = WCF::getLanguage()->get('wcf.user.profile.' . $this->type . '.title', array('$username' => StringUtil::encodeHTML($user->username)));
     if (class_exists('StyleManager')) {
         return '<img src="' . StyleManager::getStyle()->getIconPath($this->type . $imageSize . '.png') . '" alt="" title="' . $title . '" />';
     }
     return '<img src="' . RELATIVE_WCF_DIR . 'icon/' . $this->type . $imageSize . '.png' . '" alt="" title="' . $title . '" />';
 }
 /**
  * @see PM::handleData()
  */
 protected function handleData($data)
 {
     if (!$data['username']) {
         $data['username'] = WCF::getLanguage()->get('wcf.pm.author.system');
     }
     parent::handleData($data);
     $this->user = new UserProfile(null, $data);
 }
 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (!USERGUESTBOOK_SHOWINSIDEBAR) {
         return;
     }
     if (!WCF::getUser()->getPermission('user.guestbook.canRead')) {
         return;
     }
     if (empty($eventObj->postList->posts)) {
         return;
     }
     $seen = $ret = array();
     $ret = WCF::getTPL()->get('additionalSidebarUserContacts');
     $link = '<a href="index.php?page=UserGuestbook&amp;userID=%1$d' . SID_ARG_2ND . '"><img src="' . RELATIVE_WCF_DIR . 'icon/guestbookS.png" alt="" title="%2$s" /></a>';
     $curUserID = WCF::getUser()->userID;
     $curUserCanUse = WCF::getUser()->getPermission('user.guestbook.canUseOwn');
     $gbEnableOption = 'userOption' . User::getUserOptionID('userGuestbook_enable');
     require_once WCF_DIR . 'lib/data/user/UserProfile.class.php';
     foreach ($eventObj->postList->posts as $post) {
         if ($post->userID) {
             if ($curUserID == $post->userID && !$curUserCanUse) {
                 continue;
             } else {
                 if (!$post->{$gbEnableOption}) {
                     continue;
                 } else {
                     if (array_key_exists($post->userID, $seen)) {
                         if (!empty($seen[$post->userID])) {
                             if (isset($ret[$post->postID])) {
                                 $ret[$post->postID] .= ' ' . $seen[$post->userID];
                             } else {
                                 $ret[$post->postID] = $seen[$post->userID];
                             }
                         }
                     } else {
                         $add = '';
                         $user = new UserProfile($post->userID, null, null, null);
                         if ($user->getPermission('user.guestbook.canUseOwn')) {
                             $username = StringUtil::encodeHTML($user->username);
                             $title = WCF::getLanguage()->get('wcf.user.guestbook.title', array('$user->username' => $username));
                             $add = sprintf($link, $post->userID, $title);
                             if (isset($ret[$post->postID])) {
                                 $ret[$post->postID] .= ' ' . $add;
                             } else {
                                 $ret[$post->postID] = $add;
                             }
                         }
                         $seen[$post->userID] = $add;
                     }
                 }
             }
         }
     }
     if (count($ret)) {
         WCF::getTPL()->assign('additionalSidebarUserContacts', $ret);
     }
 }
 public function __construct($data, $boxname = "")
 {
     if (!defined('BUDDIESBOX_SBCOLOR_ACP')) {
         define('BUDDIESBOX_SBCOLOR_ACP', 2);
     }
     if (!defined('BUDDIESBOX_SHOWDEL_ACP')) {
         define('BUDDIESBOX_SHOWDEL_ACP', false);
     }
     if (!defined('BUDDIESBOX_SHOWUSERMARKING_ACP')) {
         define('BUDDIESBOX_SHOWUSERMARKING_ACP', false);
     }
     if (!defined('BUDDIESBOX_SHOWONLYONLINE_ACP')) {
         define('BUDDIESBOX_SHOWONLYONLINE_ACP', true);
     }
     if (!defined('BUDDIESBOX_HIDEIFEMPTY_ACP')) {
         define('BUDDIESBOX_HIDEIFEMPTY_ACP', true);
     }
     $this->BuddiesData['templatename'] = "buddiesbox";
     $this->getBoxStatus($data);
     $this->BuddiesData['boxID'] = $data['boxID'];
     $this->BuddiesData['showBuddiesBox'] = false;
     //        $buddies = WCF::getUser()->buddies;
     if (WCF::getUser()->userID != 0) {
         require_once WCF_DIR . 'lib/data/user/UserProfile.class.php';
         $cnt = 0;
         $sql = "SELECT u.*, uo.*, wcg.*" . "\n  FROM wcf" . WCF_N . "_user_whitelist wcu" . "\n  JOIN wcf" . WCF_N . "_user u ON (u.userID = wcu.whiteUserID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user_option_value uo ON (uo.userID = u.userID)" . "\n  LEFT JOIN wcf" . WCF_N . "_group wcg ON (wcg.groupID = u.userOnlineGroupID)" . "\n WHERE wcu.userID = " . WCF::getUser()->userID . "\n ORDER BY u.username";
         $result = WBBCore::getDB()->sendQuery($sql);
         while ($row = WBBCore::getDB()->fetchArray($result)) {
             $user = new UserProfile(null, $row);
             if (BUDDIESBOX_SHOWONLYONLINE_ACP && !$user->isOnline()) {
                 continue;
             }
             if ($user->isOnline()) {
                 $this->BuddiesData['buddies'][$cnt]['imgTitle'] = StringUtil::decodeHTML(WCF::getLanguage()->get('wcf.user.online', array('$username' => $row['username'])));
                 $this->BuddiesData['buddies'][$cnt]['img'] = 'onlineS.png';
             } else {
                 $this->BuddiesData['buddies'][$cnt]['imgTitle'] = StringUtil::decodeHTML(WCF::getLanguage()->get('wcf.user.offline', array('$username' => $row['username'])));
                 $this->BuddiesData['buddies'][$cnt]['img'] = 'offlineS.png';
             }
             if ($user->acceptPm) {
                 $this->BuddiesData['buddies'][$cnt]['pm'] = '1';
             } else {
                 $this->BuddiesData['buddies'][$cnt]['pm'] = '';
             }
             $this->BuddiesData['buddies'][$cnt]['userID'] = $row['userID'];
             $this->BuddiesData['buddies'][$cnt]['username'] = StringUtil::encodeHTML($row['username']);
             // userOnlineMarking...
             if (BUDDIESBOX_SHOWUSERMARKING_ACP && !empty($row['userOnlineMarking']) && $row['userOnlineMarking'] != '%s') {
                 $this->BuddiesData['buddies'][$cnt]['username'] = sprintf($row['userOnlineMarking'], StringUtil::encodeHTML($row['username']));
             }
             $cnt++;
         }
         if ($cnt > 0 || !BUDDIESBOX_HIDEIFEMPTY_ACP) {
             $this->BuddiesData['showBuddiesBox'] = true;
         }
     }
 }
 /**
  * @see DatabaseObject::handleData()
  */
 protected function handleData($data)
 {
     parent::handleData($data);
     if ($this->isViewable() == false) {
         $this->message = WCF::getLanguage()->get('wcf.contest.solution.message.hidden');
         $this->attachments = 0;
     }
     $this->subject = WCF::getLanguage()->get('wcf.contest.solution.number', array('$solutionID' => $this->solutionID, '$time' => $this->time));
 }
 /**
  * Generates an image button.
  * 
  * @see UserOptionOutput::getShortOutput()
  */
 protected function getImage(User $user, $value, $imageSize = 'M')
 {
     if (empty($value) || $value == 'http://') {
         return '';
     }
     $value = self::getURL($value);
     $title = WCF::getLanguage()->get('wcf.user.profile.homepage.title', array('$username' => StringUtil::encodeHTML($user->username)));
     return '<a href="' . StringUtil::encodeHTML($value) . '"><img src="' . StyleManager::getStyle()->getIconPath('website' . $imageSize . '.png') . '" alt="" title="' . $title . '" /></a>';
 }
 /**
  * Creates a new FTPUninstaller object.
  * 
  * @param	string		$targetDir		directory from the deleting files
  * @param	array		$files			delete files
  * @param	FTP		$ftp			active ftp connection
  * @param	boolean		$deleteEmptyTargetDir	delete target dir if empty
  * @param	boolean		$deleteEmptyDirectories	delete sub-directories if empty
  */
 public function __construct($targetDir, $files, FTP $ftp, $deleteEmptyTargetDir, $deleteEmptyDirectories)
 {
     $this->ftp = $ftp;
     $this->ftpPath = FTPUtil::getRelativeFtpPath($this->ftp, $targetDir);
     if (!$this->ftpPath) {
         throw new SystemException(WCF::getLanguage()->get('warnings.couldNotFindFTPPath', array('{$dir}' => $targetDir)));
     }
     parent::__construct($this->ftpPath, $files, $deleteEmptyTargetDir, $deleteEmptyDirectories);
 }
 /**
  * @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>');
         }
     }
 }