public function __construct($data, $boxname = "") { $this->TopData['templatename'] = "topthanksgivinguser"; $this->getBoxStatus($data); $this->TopData['boxID'] = $data['boxID']; if (!defined('TOPTHANKSGIVINGUSER_COUNT_ACP')) { define('TOPTHANKSGIVINGUSER_COUNT_ACP', 10); } if (!defined('TOPTHANKSGIVINGUSER_TITLELENGTH_ACP')) { define('TOPTHANKSGIVINGUSER_TITLELENGTH_ACP', 28); } if (!defined('TOPTHANKSGIVINGUSER_SBCOLOR_ACP')) { define('TOPTHANKSGIVINGUSER_SBCOLOR_ACP', 2); } if (!defined('TOPTHANKSGIVINGUSER_HITS_ACP')) { define('TOPTHANKSGIVINGUSER_HITS_ACP', true); } $sql = "SELECT wcf.userID, wcf.username, wbb.thanks_got" . "\n FROM wcf" . WCF_N . "_user wcf" . "\n LEFT JOIN wbb" . WBB_N . "_user wbb ON (wbb.userid = wcf.userid)" . "\n WHERE wbb.thanks_got > 0" . "\n ORDER BY wbb.thanks_got DESC, wcf.username" . "\n LIMIT 0, " . TOPTHANKSGIVINGUSER_COUNT_ACP; $result = WBBCore::getDB()->sendQuery($sql); while ($row = WBBCore::getDB()->fetchArray($result)) { $plainUser = $row['username']; $row['thanks_got'] = StringUtil::formatInteger($row['thanks_got']); if (TOPTHANKSGIVINGUSER_TITLELENGTH_ACP != 0 && strlen($plainUser) > TOPTHANKSGIVINGUSER_TITLELENGTH_ACP) { $row['username'] = StringUtil::substring($plainUser, 0, TOPTHANKSGIVINGUSER_TITLELENGTH_ACP - 3) . '...'; } $row['username'] = StringUtil::encodeHTML($row['username']); $this->TopData['thanksgivinguser'][] = $row; } WCF::getTPL()->assign('TOPTHANKSGIVINGUSER_SBCOLOR_ACP', intval(TOPTHANKSGIVINGUSER_SBCOLOR_ACP)); WCF::getTPL()->assign('TOPTHANKSGIVINGUSER_HITS_ACP', TOPTHANKSGIVINGUSER_HITS_ACP); }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if (MODULE_USERS_ONLINE == 1) { if ($eventObj->activeCategory == 'profile') { if ($eventName == 'validate') { if (WCF::getUser()->getPermission('user.profile.rank.canSelectOnlineMarking')) { if (isset($_POST['userOnlineGroupID'])) { $this->userOnlineGroupID = intval($_POST['userOnlineGroupID']); } // validate user online group id if ($this->userOnlineGroupID) { try { $sql = "SELECT\t\tgroupID\n\t\t\t\t\t\t\t\t\tFROM\t\twcf" . WCF_N . "_group\n\t\t\t\t\t\t\t\t\tWHERE\t\tgroupID = " . $this->userOnlineGroupID . "\n\t\t\t\t\t\t\t\t\t\t\tAND groupID IN (" . implode(',', WCF::getUser()->getGroupIDs()) . ")"; $row = WCF::getDB()->getFirstRow($sql); if (!isset($row['groupID'])) { throw new UserInputException('userOnlineGroupID'); } // save rankid $eventObj->additionalFields['userOnlineGroupID'] = $this->userOnlineGroupID; } catch (UserInputException $e) { $eventObj->errorType[$e->getField()] = $e->getType(); } } } } else { if ($eventName == 'assignVariables') { if (!count($_POST)) { // get current values $this->userOnlineGroupID = WCF::getUser()->userOnlineGroupID; } $fields = array(); // get user online markings if (WCF::getUser()->getPermission('user.profile.rank.canSelectOnlineMarking')) { $markings = array(); $sql = "SELECT\t\tgroupID, groupName, userOnlineMarking\n\t\t\t\t\t\t\tFROM\t\twcf" . WCF_N . "_group\n\t\t\t\t\t\t\tWHERE\t\tgroupID IN (" . implode(',', WCF::getUser()->getGroupIDs()) . ")\n\t\t\t\t\t\t\tORDER BY\tgroupID ASC"; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { $row['userOnlineMarking'] = sprintf($row['userOnlineMarking'], StringUtil::encodeHTML(WCF::getUser()->username)); $markings[] = $row; } if (count($markings) > 1) { WCF::getTPL()->assign(array('markings' => $markings, 'userOnlineGroupID' => $this->userOnlineGroupID)); $fields[] = array('optionName' => 'userOnlineGroupID', 'divClass' => 'formRadio', 'beforeLabel' => false, 'isOptionGroup' => true, 'html' => WCF::getTPL()->fetch('userProfileEditOnlineMarkingSelect')); } } // add fields if (count($fields) > 0) { foreach ($eventObj->options as $key => $category) { if ($category['categoryName'] == 'profile.rank') { $eventObj->options[$key]['options'] = array_merge($category['options'], $fields); return; } } $eventObj->options[] = array('categoryName' => 'profile.rank', 'categoryIconM' => '', 'options' => $fields); } } } } } }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if ($eventName == 'assignVariables') { WCF::getTPL()->assign(array('user' => $eventObj->user, 'url' => $eventObj->url)); WCF::getTPL()->append('additionalUserOptions', WCF::getTPL()->fetch('userEditAdvancedUserOptions')); } }
public function __construct($data, $boxname = "") { $this->BoardlistData['templatename'] = "listboards"; $this->getBoxStatus($data); $this->BoardlistData['boxID'] = $data['boxID']; // DEFAULTS $lbLength = 24; $lbLevelCut = 3; $lbMaxHeight = 0; $lbSBColor = 2; $lbFontsize = '1.2em'; $lbSpacer = 5; $lbIndent = ' » '; $lbIndentNewPosts = '<span style="font-weight:bold; color:Red;"> » </span>'; $lbShowNewPosts = true; // ACP Konstanten... if (!defined('LISTBOARDS_LENGTH_ACP')) { define('LISTBOARDS_LENGTH_ACP', $lbLength); } if (!defined('LISTBOARDS_LEVELCUT_ACP')) { define('LISTBOARDS_LEVELCUT_ACP', $lbLevelCut); } if (!defined('LISTBOARDS_MAXHEIGHT_ACP')) { define('LISTBOARDS_MAXHEIGHT_ACP', $lbMaxHeight); } if (!defined('LISTBOARDSBOX_SBCOLOR_ACP')) { define('LISTBOARDSBOX_SBCOLOR_ACP', $lbSBColor); } if (!defined('LISTBOARDS_MAINBOARD_FONTSIZE_ACP')) { define('LISTBOARDS_MAINBOARD_FONTSIZE_ACP', $lbFontsize); } if (!defined('LISTBOARDS_MAINBOARD_SPACER_ACP')) { define('LISTBOARDS_MAINBOARD_SPACER_ACP', $lbSpacer); } if (!defined('LISTBOARDS_SUBBOARD_INDENT_ACP')) { define('LISTBOARDS_SUBBOARD_INDENT_ACP', $lbIndent); } if (!defined('LISTBOARDS_NEWPOST_INDENT_ACP')) { define('LISTBOARDS_NEWPOST_INDENT_ACP', $lbIndentNewPosts); } if (!defined('LISTBOARDS_SHOW_NEWPOSTS_ACP')) { define('LISTBOARDS_SHOW_NEWPOSTS_ACP', $lbShowNewPosts); } // Boxen Hoehe if (WCF::getUser()->userID) { if (WCF::getUser()->listboards_maxheight >= 100) { $lbMaxHeight = intval(WCF::getUser()->listboards_maxheight); } else { if (WCF::getUser()->listboards_maxheight == 0 && LISTBOARDS_MAXHEIGHT_ACP >= 100) { $lbMaxHeight = LISTBOARDS_MAXHEIGHT_ACP; } } } // Template Variablen zuordnen... WCF::getTPL()->assign(array('lbFontsize' => LISTBOARDS_MAINBOARD_FONTSIZE_ACP == '' ? $lbFontsize : LISTBOARDS_MAINBOARD_FONTSIZE_ACP, 'lbSpacer' => intval(LISTBOARDS_MAINBOARD_SPACER_ACP), 'lbIndent' => LISTBOARDS_SUBBOARD_INDENT_ACP, 'lbIndentNewPosts' => LISTBOARDS_NEWPOST_INDENT_ACP, 'lbSBColor' => intval(LISTBOARDSBOX_SBCOLOR_ACP), 'lbLength' => intval(LISTBOARDS_LENGTH_ACP), 'lbLevelCut' => intval(LISTBOARDS_LEVELCUT_ACP), 'lbShowNewPosts' => LISTBOARDS_SHOW_NEWPOSTS_ACP, 'lbMaxHeight' => $lbMaxHeight)); // Forenliste require_once WBB_DIR . 'lib/data/board/BoardList.class.php'; $boardList = new BoardList(); $boardList->renderBoards(); }
/** * @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&types[]=post&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')); } } } } } }
/** * Installs the templates of this package. */ public function install() { parent::install(); // extract files.tar to temp folder $tag = $this->installation->getXMLTag('templates'); $sourceFile = $this->installation->getArchive()->extractTar($tag['cdata'], 'templates_'); // create file handler $fileHandler = new TemplatesFileHandler($this->installation); // extract content of files.tar $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $this->installation->getPackage()->getDir())); try { $fileInstaller = $this->installation->extractFiles($packageDir . 'templates/', $sourceFile, $fileHandler); } catch (SystemException $e) { if (!@file_exists(WCF_DIR . 'acp/templates/packageInstallationFileInstallationFailed.tpl')) { // workaround for wcf 1.0 to 1.1 update throw $e; } else { WCF::getTPL()->assign(array('exception' => $e)); WCF::getTPL()->display('packageInstallationFileInstallationFailed'); exit; } } // look if tpl files are to be overwritten by this update, // and if so, check if these files have been patched before ... require_once WCF_DIR . 'lib/acp/package/plugin/TemplatePatchPackageInstallationPlugin.class.php'; $tar = new Tar($sourceFile); $files = $tar->getContentList(); $templatePatch = new TemplatePatchPackageInstallationPlugin($this->installation); $templatePatch->repatch($files); // delete temporary sourceArchive @unlink($sourceFile); }
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) { if ($eventName == 'readData') { if ($eventObj->action == 'notActivated') { if (!empty($eventObj->sqlConditions)) { $this->sqlConditions .= ' AND '; } $eventObj->sqlConditions .= "user_table.activationCode <> 0"; } else { if ($eventObj->action == 'new') { if (!empty($eventObj->sqlConditions)) { $this->sqlConditions .= ' AND '; } $eventObj->sqlConditions .= "user_table.registrationDate > " . (TIME_NOW - 3600 * 24); } else { if ($eventObj->action == 'banned') { if (!empty($eventObj->sqlConditions)) { $this->sqlConditions .= ' AND '; } $eventObj->sqlConditions .= "user_table.banned = 1"; } } } } if ($eventName == 'assignVariables') { WCF::getTPL()->assign('action', $eventObj->action); WCF::getTPL()->append('additionalUserListOptions', WCF::getTPL()->fetch('userSearchUserListOptions')); } }
/** * @see Page::assignVariables() */ public function assignVariables() { parent::assignVariables(); // get phpinfo() output ob_start(); phpinfo(); $info = ob_get_contents(); ob_end_clean(); // parse output $info = preg_replace('%^.*<body>(.*)</body>.*$%s', '$1', $info); // style fixes // remove first table $info = preg_replace('%<table.*?</table><br />%s', '', $info, 1); // fix tables $info = preg_replace('%<h2>(.*?)</h2>\\s*<table border="0" cellpadding="3" width="600">%', '<div class="border titleBarPanel"><div class="containerHead"><h3>\\1</h3></div></div><div class="border borderMarginRemove"><table class="tableList">', $info); $info = preg_replace('%<table border="0" cellpadding="3" width="600">%', '<div class="border titleBarPanel"><table class="tableList">', $info); $info = str_replace('</table>', '</table></div>', $info); $info = str_replace('<tr class="h">', '<thead><tr class="tableHead">', $info); $info = str_replace('</th></tr>', '</th></tr></thead>', $info); $info = preg_replace('%</td></tr>%', '</th></tr></thead>', $info, 1); $info = str_replace('<tr class="tableHead"><td>', '<tr class="tableHead"><th>', $info); $info = preg_replace('%<th(\\s+.*?)?>%', '<th\\1><div><span class="emptyHead">', $info); $info = str_replace('</th>', '</span></div></th>', $info); // fix row colors $info = preg_replace_callback('%<tr>%', array($this, 'insertRowColorsCallback'), $info); // h1, h2 fixes $info = str_replace('</h2>', '</h3>', $info); $info = str_replace('<h2>', '<h3>', $info); $info = str_replace('</h1>', '</h2>', $info); $info = str_replace('<h1', '<h2', $info); WCF::getTPL()->assign(array('phpInfo' => $info)); }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if ($eventObj->poll->messageType == 'post') { // check permissions require_once WBB_DIR . 'lib/data/post/Post.class.php'; $post = new Post($eventObj->poll->messageID); if (!$post->postID) { throw new IllegalLinkException(); } require_once WBB_DIR . 'lib/data/thread/Thread.class.php'; $thread = new Thread($post->threadID); $thread->enter(); require_once WBB_DIR . 'lib/data/board/Board.class.php'; $board = new Board($thread->boardID); $eventObj->canVotePoll = $board->getPermission('canVotePoll'); // plug in breadcrumbs WCF::getTPL()->assign(array('board' => $board, 'thread' => $thread, 'showThread' => true)); WCF::getTPL()->append('specialBreadCrumbs', WCF::getTPL()->fetch('navigation')); // get other polls from this thread if ($thread->polls > 1) { require_once WCF_DIR . 'lib/data/message/poll/Poll.class.php'; $polls = array(); $sql = "SELECT \t\tpoll_vote.pollID AS voted,\n\t\t\t\t\t\t\tpoll_vote.isChangeable,\n\t\t\t\t\t\t\tpoll.*\n\t\t\t\t\tFROM \t\twcf" . WCF_N . "_poll poll\n\t\t\t\t\tLEFT JOIN \twcf" . WCF_N . "_poll_vote poll_vote\n\t\t\t\t\tON \t\t(poll_vote.pollID = poll.pollID\n\t\t\t\t\t\t\t" . (!WCF::getUser()->userID ? "AND poll_vote.ipAddress = '" . escapeString(WCF::getSession()->ipAddress) . "'" : '') . "\n\t\t\t\t\t\t\tAND poll_vote.userID = " . WCF::getUser()->userID . ")\n\t\t\t\t\tWHERE \t\tpoll.pollID IN (\n\t\t\t\t\t\t\t\tSELECT\tpollID\n\t\t\t\t\t\t\t\tFROM\twbb" . WBB_N . "_post\n\t\t\t\t\t\t\t\tWHERE\tthreadID = " . $thread->threadID . "\n\t\t\t\t\t\t\t\t\tAND isDeleted = 0\n\t\t\t\t\t\t\t\t\tAND isDisabled = 0\n\t\t\t\t\t\t\t\t\tAND pollID <> 0\n\t\t\t\t\t\t\t)\n\t\t\t\t\tORDER BY\tpoll.question"; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { $polls[] = new Poll(null, $row, $eventObj->canVotePoll); } if (count($polls) > 1) { WCF::getTPL()->assign(array('polls' => $polls, 'pollID' => $eventObj->pollID)); WCF::getTPL()->append('additionalSidebarContent', WCF::getTPL()->fetch('pollOverviewSidebar')); } } } }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if ($eventName == 'readParameters') { // read parameters if (isset($_REQUEST['boardID'])) { $this->boardID = intval($_REQUEST['boardID']); } if (isset($_REQUEST['threadID'])) { $this->threadID = intval($_REQUEST['threadID']); } // append sql condition if ($this->threadID) { $eventObj->usersOnlineSortedList->sqlConditions .= " AND session.threadID = " . $this->threadID . " "; } else { if ($this->boardID) { $eventObj->usersOnlineSortedList->sqlConditions .= " AND session.boardID = " . $this->boardID . " "; } } } else { if ($eventName == 'assignVariables') { if ($this->threadID) { WCF::getTPL()->append('additionalParameters', '&threadID=' . $this->threadID); } else { if ($this->boardID) { WCF::getTPL()->append('additionalParameters', '&boardID=' . $this->boardID); } } } } }
/** * @see Action::execute() */ public function execute() { AbstractAction::execute(); // check permission WCF::getUser()->checkPermission('admin.user.canBanUser'); if (count($this->userIDs) > 0) { // check permission $sql = "SELECT\tDISTINCT groupID\n\t\t\t\tFROM\twcf" . WCF_N . "_user_to_groups\n\t\t\t\tWHERE\tuserID IN (" . implode(',', $this->userIDs) . ")"; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { if (!Group::isAccessibleGroup($row['groupID'])) { throw new PermissionDeniedException(); } } // update user $sql = "UPDATE\twcf" . WCF_N . "_user\n\t\t\t\tSET\tbanned = 0\n\t\t\t\tWHERE\tuserID IN (" . implode(',', $this->userIDs) . ")"; WCF::getDB()->sendQuery($sql); // unmark users UserEditor::unmarkAll(); // reset sessions Session::resetSessions($this->userIDs); } $this->executed(); if (!empty($this->url)) { HeaderUtil::redirect($this->url); } else { // set active menu item WCFACP::getMenu()->setActiveMenuItem('wcf.acp.menu.link.user.management'); // show succes message WCF::getTPL()->assign('message', 'wcf.acp.user.unban.success'); WCF::getTPL()->display('success'); } exit; }
/** * @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'))); } } } }
/** * @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')); } } } } }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { WCF::getTPL()->append('additionalCSS', ' <link rel="stylesheet" type="text/css" href="' . RELATIVE_WCF_DIR . 'style/containers.css" /> <link rel="stylesheet" type="text/css" href="' . RELATIVE_WCF_DIR . 'style/forms.css" /> '); }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if (MODULE_USERS_ONLINE == 1) { if ($eventName == 'readFormParameters') { if (isset($_POST['userOnlineMarking'])) { $this->userOnlineMarking = $_POST['userOnlineMarking']; } } else { if ($eventName == 'validate') { try { if (strpos($this->userOnlineMarking, '%s') === false || substr_count($this->userOnlineMarking, '%s') > 1) { throw new UserInputException('userOnlineMarking'); } } catch (UserInputException $e) { $eventObj->errorType[$e->getField()] = $e->getType(); } } else { if ($eventName == 'save') { $eventObj->additionalFields['userOnlineMarking'] = $this->userOnlineMarking; if (!$eventObj instanceof GroupEditForm) { $this->userOnlineMarking = '%s'; } } else { if ($eventName == 'assignVariables') { if (!count($_POST) && $eventObj instanceof GroupEditForm) { $this->userOnlineMarking = $eventObj->group->userOnlineMarking; } WCF::getTPL()->assign('userOnlineMarking', $this->userOnlineMarking); WCF::getTPL()->append('additionalFields', WCF::getTPL()->fetch('groupAddUserOnlineMarking')); } } } } } }
public function __construct($data, $boxname = "") { $this->BoxData['templatename'] = "wbb3addonsBox01"; $this->getBoxStatus($data); $this->BoxData['boxID'] = $data['boxID']; if (!defined('WBB3ADDONSBOX01_TITLE')) { define('WBB3ADDONSBOX01_TITLE', ''); } if (!defined('WBB3ADDONSBOX01_BOXOPENED')) { define('WBB3ADDONSBOX01_BOXOPENED', false); } if (!defined('WBB3ADDONSBOX01_VALUE')) { define('WBB3ADDONSBOX01_VALUE', ''); } if (!defined('WBB3ADDONSBOX01_PHP')) { define('WBB3ADDONSBOX01_PHP', false); } if (WBB3ADDONSBOX01_BOXOPENED == true) { $this->BoxData['Status'] = 1; } // php?! ******************************************* if (WBB3ADDONSBOX01_PHP) { ob_start(); eval(WBB3ADDONSBOX01_VALUE); $val = ob_get_clean(); } else { $val = WBB3ADDONSBOX01_VALUE; } WCF::getTPL()->assign(array('wbb3addonsBox01Title' => WBB3ADDONSBOX01_TITLE, 'wbb3addonsBox01Value' => $val, 'wbb3addonsBox01Opened' => WBB3ADDONSBOX01_BOXOPENED)); }
/** * @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&userID=' . $eventObj->userID . SID_ARG_2ND . '">' . WCF::getLanguage()->get('wcf.user.infraction.button.warn') . '</a></li>'); } } } } }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if (!WCF::getUser()->getPermission('user.ucstomUserPages.canViewPages')) return; switch ($className) { case 'UserProfileMenu': $items = UserCustomPage::getMenuItemsByUserID($eventObj->userID); foreach ($items as $name => $menuItem) { UserProfileMenu::getInstance()->menuItems[''][] = array( 'menuItem' => $menuItem, 'parentMenuItem' => '', 'menuItemLink' => 'index.php?page=UserCustomPage&userID='.$eventObj->userID.'&pageName='.$name.SID_ARG_2ND_NOT_ENCODED, 'menuItemIcon' => 'messageM.png', 'permissions' => 'user.customUserPages.canViewPages' ); } break; case 'UserProfileFrame': if (WCF::getUser()->userID == $eventObj->userID && $eventObj->getUser()->getPermission('user.customUserPages.canUse')) WCF::getTPL()->append('additionalUserCardOptions', WCF::getTPL()->display('customUserPagesUserCardOption') ); break; } }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if ($eventName == 'readFormParameters') { if (isset($_POST['showOnTeamOnlineBox'])) { $this->showOnTeamOnlineBox = intval($_POST['showOnTeamOnlineBox']); } if (isset($_POST['teamOnlineMarking'])) { $this->teamOnlineMarking = $_POST['teamOnlineMarking']; } } else { if ($eventName == 'save') { $eventObj->additionalFields['showOnTeamOnlineBox'] = $this->showOnTeamOnlineBox; $eventObj->additionalFields['teamOnlineMarking'] = $this->teamOnlineMarking; if (!$eventObj instanceof GroupEditForm) { $this->showOnTeamOnlineBox = 0; $this->teamOnlineMarking = '%s'; } } else { if ($eventName == 'assignVariables') { if (!count($_POST) && $eventObj instanceof GroupEditForm) { $this->showOnTeamOnlineBox = $eventObj->group->showOnTeamOnlineBox; $this->teamOnlineMarking = $eventObj->group->teamOnlineMarking; } WCF::getTPL()->assign(array('showOnTeamOnlineBox' => $this->showOnTeamOnlineBox, 'teamOnlineMarking' => $this->teamOnlineMarking)); WCF::getTPL()->append('additionalFields', WCF::getTPL()->fetch('groupTeamOnlineBox')); } } } }
/** * Changes the active style. * * @param integer $styleID */ public static final function changeStyle($styleID, $ignorePermissions = false) { // load cache self::getCache(); // check permission if (!$ignorePermissions) { if (isset(self::$cache['styles'][$styleID])) { if ((self::$cache['styles'][$styleID]->disabled || !empty(self::$cache['packages'][PACKAGE_ID]['disabled'][$styleID])) && !WCF::getUser()->getPermission('admin.style.canUseDisabledStyle')) { $styleID = 0; } } } // fallback to default style if (!isset(self::$cache['styles'][$styleID])) { // get package default style if (!empty(self::$cache['packages'][PACKAGE_ID]['default'])) { $styleID = self::$cache['packages'][PACKAGE_ID]['default']; } else { $styleID = self::$cache['default']; } if (!isset(self::$cache['styles'][$styleID])) { throw new SystemException('no default style defined', 100000); } } // init style self::$style = self::$cache['styles'][$styleID]->getActiveStyle(); // set template pack id if (WCF::getTPL()) { WCF::getTPL()->setTemplatePackID(self::$style->templatePackID); } }
/** * @see OptionType::getFormElement() */ public function getFormElement(&$optionData) { if (!isset($optionData['optionValue'])) { if (isset($optionData['defaultValue'])) { $optionData['optionValue'] = $optionData['defaultValue']; } else { $optionData['optionValue'] = false; } } $optionData['beforeLabel'] = true; $optionData['divClass'] = 'formCheckBox'; if (!empty($optionData['enableOptions'])) { $options = explode(',', $optionData['enableOptions']); $enableOptions = $disableOptions = ''; foreach ($options as $option) { if ($option[0] == '!') { if (!empty($disableOptions)) { $disableOptions .= ','; } $disableOptions .= "'" . substr($option, 1) . "'"; } else { if (!empty($enableOptions)) { $enableOptions .= ','; } $enableOptions .= "'" . $option . "'"; } } $optionData['enableOptionsJS'] = 'enableOptions(' . $enableOptions . ') + disableOptions(' . $disableOptions . '); else enableOptions(' . $disableOptions . ') + disableOptions(' . $enableOptions . ');'; $optionData['enableOptions'] = 'if (this.checked) ' . $optionData['enableOptionsJS']; $optionData['enableOptionsJS'] = 'if (' . ($optionData['optionValue'] ? 'true' : 'false') . ') ' . $optionData['enableOptionsJS']; } WCF::getTPL()->assign('optionData', $optionData); return WCF::getTPL()->fetch('optionTypeBoolean'); }
/** * 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')); } }
public function testContestPage() { $user = $this->user; $contest = $this->contest; // save two jurytalk entries require_once WCF_DIR . 'lib/data/contest/jurytalk/ContestJurytalkEditor.class.php'; $this->deleteArray[] = $jurytalk = ContestJurytalkEditor::create($contestID = $contest->contestID, $jurytalk = __METHOD__ . ' jurytalk #1', $userID = $user->userID, $username = $user->username); $this->deleteArray[] = $jurytalk = ContestJurytalkEditor::create($contestID = $contest->contestID, $jurytalk = __METHOD__ . ' jurytalk #2', $userID = $user->userID, $username = $user->username); $raised = false; try { $this->runHTTP('page=ContestJurytalk&contestID=' . $contest->contestID); } catch (Exception $e) { $raised = true; } $this->assertTrue($raised, "user should not be allowed to access a private contest"); // now try with owner $this->setCurrentUser($user); $this->runHTTP('page=ContestJurytalk&contestID=' . $contest->contestID); $this->assertEquals(count(WCF::getTPL()->get('jurytalks')), 2); // now try with jury member who was invited $this->deleteArray[] = $juryuser = $this->createUser(); require_once WCF_DIR . 'lib/data/contest/jury/ContestJuryEditor.class.php'; $this->deleteArray[] = $jury = ContestJuryEditor::create($contestID = $contest->contestID, $userID = $juryuser->userID, $groupID = 0, $state = 'invited'); $this->setCurrentUser($juryuser); $this->runHTTP('page=ContestJurytalk&contestID=' . $contest->contestID); // invited members should only see first entry $this->assertEquals(count(WCF::getTPL()->get('jurytalks')), 1); // accepted members should have 2 entries $jury->update($contestID, $userID, $groupID, 'accepted'); $this->runHTTP('page=ContestJurytalk&contestID=' . $contest->contestID); $this->assertEquals(count(WCF::getTPL()->get('jurytalks')), 2); }
/** * @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&userID=' . $user->userID . '&url=' . $url . '&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&userID=' . $user->userID . '&url=' . $url . '&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&userID=' . $user->userID . '&url=' . $url . '&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&userID=' . $user->userID . '&url=' . $url . '&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 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; } } } } } } } }
/** * @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 Page::assignVariables() */ public function assignVariables() { global $game_config; parent::assignVariables(); WCF::getTPL()->assign(array('maxSpeed' => $this->fleetQueue->getSpeed(), 'capacity' => $this->fleetQueue->getCapacity(), 'speedFactor' => $game_config['fleet_speed'] / 2500, 'fleetQueue' => $this->fleetQueue, 'specs' => $this->specs)); //TODO: integrate this in wcf eventlistener assignVariables@FleetStartCoordinatesForm WCF::getTPL()->assign('navalFormations', NavalFormation::getByUserID(WCF::getUser()->userID)); }
/** * @see Page::assignVariables() */ public function assignVariables() { parent::assignVariables(); if ($this->target == '_iframe') { $this->iFrame = AdminTools::getIframeSettings(); } WCF::getTPL()->assign(array('wbbExists' => AdminTools::wbbExists(), 'url' => $this->url, 'target' => $this->target, 'iFrame' => $this->iFrame)); }
/** * @see Page::assignVariables() */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array( 'action' => 'edit', 'pageID' => $this->pageID )); }