/** * Gets the posts for the feed. */ protected function readPosts() { // accessible boards $accessibleBoardIDArray = Board::getAccessibleBoardIDArray(array('canViewBoard', 'canEnterBoard', 'canReadThread')); if (!count($accessibleBoardIDArray)) { throw new PermissionDeniedException(); } // get posts $attachmentPostIDArray = array(); $sql = "SELECT\t\tpost.*\n\t\t\tFROM\t\twbb" . WBB_N . "_post post\n\t\t\tWHERE\t\tpost.threadID IN (" . implode(',', $this->threadIDArray) . ")\n\t\t\t\t\tAND post.threadID IN (SELECT threadID FROM wbb" . WBB_N . "_thread WHERE boardID IN (" . implode(',', $accessibleBoardIDArray) . "))\n\t\t\t\t\tAND post.isDeleted = 0\n\t\t\t\t\tAND post.isDisabled = 0\n\t\t\t\t\t" . ($this->hours ? "AND post.time > " . (TIME_NOW - $this->hours * 3600) : '') . "\n\t\t\tORDER BY\tpost.time DESC"; $result = WCF::getDB()->sendQuery($sql, $this->limit); while ($row = WCF::getDB()->fetchArray($result)) { $this->posts[] = new FeedPost(null, $row); // attachments if ($row['attachments'] != 0) { $attachmentPostIDArray[] = $row['postID']; } } // read attachments if (MODULE_ATTACHMENT == 1 && count($attachmentPostIDArray) > 0 && (WCF::getUser()->getPermission('user.board.canViewAttachmentPreview') || WCF::getUser()->getPermission('user.board.canDownloadAttachment'))) { require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php'; $attachmentList = new MessageAttachmentList($attachmentPostIDArray, 'post'); $attachmentList->readObjects(); $attachments = $attachmentList->getSortedAttachments(); // set embedded attachments require_once WCF_DIR . 'lib/data/message/bbcode/AttachmentBBCode.class.php'; AttachmentBBCode::setAttachments($attachments); } }
/** * @see Action::execute() */ public function execute() { parent::execute(); WCF::getUser()->checkPermission('admin.user.canDeleteUser'); require_once WCF_DIR . 'lib/data/user/UserEditor.class.php'; require_once WCF_DIR . 'lib/data/user/group/Group.class.php'; if ($this->userID !== 0) { $this->userIDs[] = $this->userID; } // active user can't delete himself $activeUserID = WCF::getSession()->getUser()->userID; $this->userIDs = array_diff($this->userIDs, array($activeUserID)); // check permission if (count($this->userIDs) > 0) { $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(); } } } $deletedUsers = UserEditor::deleteUsers($this->userIDs); $this->executed(); if (!empty($this->url) && (strpos($this->url, 'searchID=0') !== false || strpos($this->url, 'searchID=') === false)) { HeaderUtil::redirect($this->url); } else { HeaderUtil::redirect('index.php?form=UserSearch&deletedUsers=' . $deletedUsers . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED); } exit; }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); // default settings $this->closeThread = $this->thread->isClosed; $this->subscription = $this->thread->subscribed; if (WCF::getUser()->userID) { // options $this->parseURL = WCF::getUser()->{$this->permissionType . 'ParseURL'}; $this->enableSmilies = WCF::getUser()->{$this->permissionType . 'EnableSmilies'}; $this->enableHtml = WCF::getUser()->{$this->permissionType . 'EnableHtml'}; $this->enableBBCodes = WCF::getUser()->{$this->permissionType . 'EnableBBCodes'}; if ($this->showSignatureSetting) { $this->showSignature = WCF::getUser()->{$this->permissionType . 'ShowSignature'}; } if (!$this->subscription && WCF::getUser()->enableSubscription) { $this->subscription = 1; } } else { // options $this->parseURL = MESSAGE_FORM_DEFAULT_PARSE_URL; $this->enableSmilies = MESSAGE_FORM_DEFAULT_ENABLE_SMILIES; $this->enableHtml = MESSAGE_FORM_DEFAULT_ENABLE_HTML; $this->enableBBCodes = MESSAGE_FORM_DEFAULT_ENABLE_BBCODES; } $this->enableSmilies = intval($this->enableSmilies && WCF::getUser()->getPermission('user.' . $this->permissionType . '.canUseSmilies')); $this->enableHtml = intval($this->enableHtml && WCF::getUser()->getPermission('user.' . $this->permissionType . '.canUseHtml')); $this->enableBBCodes = intval($this->enableBBCodes && WCF::getUser()->getPermission('user.' . $this->permissionType . '.canUseBBCodes')); }
/** * @see Page::show() */ public function show() { // check permission WCF::getUser()->checkPermission('user.guestbook.canViewList'); HeaderMenu::setActiveMenuItem('wcf.header.menu.userGuestbook'); parent::show(); }
public function readData() { parent::readData(); $this->entry = new ViewableBashEntry($this->entryID); // check for the entry if (!$this->entry->entryID) { throw new IllegalLinkException(); } // check for permissions $throwPermissionDeniedException = false; if ($this->entry->isDisabled) { // guest if (!WCF::getUser()->userID) { $throwPermissionDeniedException = true; } // check for author (the author of the entry can see this entry) if (!$throwPermissionDeniedException and WCF::getUser()->userID != $this->entry->authorID) { $throwPermissionDeniedException = true; } // check for a moderator (a moderator can see this entry) if (!$throwPermissionDeniedException and WCF::getUser()->userID != $this->entry->authorID and !WCF::getUser()->getPermission('mod.bash.moderatorPermissions')) { $throwPermissionDeniedException = true; } } // throw a permission denied exception if ($throwPermissionDeniedException) { throw new PermissionDeniedException(); } // init sidebars $this->sidebarFactory = new MessageSidebarFactory($this); $this->sidebarFactory->create($this->entry); $this->sidebarFactory->init(); }
/** * @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 Action::readParameters() */ public function readParameters() { parent::readParameters(); if (!WCF::getUser()->userID) { throw new IllegalLinkException(); } }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if (!MODULE_USER_NOTIFICATION) { return; } try { $notificationObject = $this->getNotificationObject($eventObj->eventName, $eventObj->placeholders + array('contestID' => $eventObj->contestID)); } catch (Exception $e) { // just fun, errors don't need to be handled return; } switch ($eventName) { case 'create': foreach ($notificationObject->getRecipients() as $recipientUserID) { // remove current user from recipient list if ($recipientUserID == WCF::getUser()->userID) { continue; } NotificationHandler::fireEvent($eventObj->eventName, self::OBJECT_TYPE, $notificationObject, $recipientUserID); } break; case 'delete': NotificationHandler::revokeEvent(array($eventObj->eventName), self::OBJECT_TYPE, array($notificationObject)); break; case 'confirm': // anybody affected by current confirmation? $objectIDScope = array(); foreach ($notificationObject->getObjects() as $objectID) { $objectIDScope[] = $objectID; } $recipientUserID = WCF::getUser()->userID; NotificationEditor::markConfirmedByObjectVisit($recipientUserID, array($eventObj->eventName), self::OBJECT_TYPE, $objectIDScope); break; } }
/** * @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); } } } } } }
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>'); } } } } } } }
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) { // 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&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&types[]=post&userID=' . $sidebar->getUser()->userID . SID_ARG_2ND)), $sidebar->userCredits); } } } }
/** * @see Page::readParameters() */ public function readParameters() { parent::readParameters(); if (!empty($_POST['action']) && $_POST['action'] == 'compare') { if (!empty($_POST['version1']) && !empty($_POST['version2'])) { require_once WCF_DIR . 'lib/acp/package/Package.class.php'; $this->verResult = Package::compareVersion($_POST['version1'], $_POST['version2']); // $this->verResult = version_compare($_POST['version1'], $_POST['version2']); $this->verFirst = $_POST['version1']; $this->verSecond = $_POST['version2']; if ($this->logFile) { $entries = array(); $u = WCF::getUser()->username ? WCF::getUser()->username : '******'; $t = TIME_NOW; if (is_file(WBB_DIR . '/' . $this->logFile)) { $entries = file(WBB_DIR . '/' . $this->logFile); } array_push($entries, $t . '||' . date('d.m.Y H:i:s', $t) . '||' . $u . '||' . $this->verFirst . '||' . $this->verSecond); rsort($entries); if (!empty($this->logMaxEntries) && $this->logMaxEntries > 0) { $output = array_slice($entries, 0, $this->logMaxEntries); } else { $output = $entries; } if (count($output) && ($fh = @fopen(WBB_DIR . '/' . $this->logFile, 'w'))) { foreach ($output as $k => $line) { fwrite($fh, trim($line) . "\n"); } fclose($fh); } } } } }
/** * @see Action::execute() */ public function execute() { parent::execute(); // check permission if (!WCF::getUser()->userID) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } $this->fleet = Fleet::getInstance($this->fleetID); if ($this->fleet->ownerID != WCF::getUser()->userID) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } if (!$this->fleet->getCancelDuration()) { require_once WCF_DIR . 'lib/system/exception/IllegalLinkException.class.php'; throw new IllegalLinkException(); } if ($this->fleet->missionID == 11) { $formation = $this->fleet->getNavalFormation(); } $this->fleet->getEditor()->cancel(); if ($this->fleet->missionID == 11) { FleetOvent::update($formation->getLeaderFleet()); } $this->executed(); header('Location: index.php?page=FleetStartShips'); exit; }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if (WCF::getUser()->userID && WCF::getUser()->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 = '" . WCF::getSession()->sessionID . "'\n\t\t\t\t\tAND lastActivityTime >= " . (TIME_NOW - SESSION_TIMEOUT); $row = WCF::getDB()->getFirstRow($sql); if (!empty($row['sessionLogID'])) { $sessionLogID = $row['sessionLogID']; // update session log $sql = "UPDATE\twcf" . WCF_N . "_acp_session_log\n\t\t\t\t\tSET\tlastActivityTime = " . TIME_NOW . "\n\t\t\t\t\tWHERE\tsessionLogID = " . $sessionLogID; WCF::getDB()->registerShutdownUpdate($sql); } else { // create new session log $sql = "INSERT INTO\twcf" . WCF_N . "_acp_session_log\n\t\t\t\t\t\t\t(sessionID, userID, ipAddress, hostname, userAgent, time, lastActivityTime)\n\t\t\t\t\tVALUES\t\t('" . WCF::getSession()->sessionID . "', " . WCF::getUser()->userID . ", '" . escapeString(WCF::getSession()->ipAddress) . "', '" . escapeString(@gethostbyaddr(WCF::getSession()->ipAddress)) . "', '" . escapeString(WCF::getSession()->userAgent) . "', " . TIME_NOW . ", " . TIME_NOW . ")"; WCF::getDB()->sendQuery($sql); $sessionLogID = WCF::getDB()->getInsertID("wcf" . WCF_N . "_acp_session_log", '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 $sql = "INSERT INTO\twcf" . WCF_N . "_acp_session_access_log\n\t\t\t\t\t\t(sessionLogID, packageID, ipAddress, time, requestURI, requestMethod, className)\n\t\t\t\tVALUES\t\t(" . $sessionLogID . ", " . PACKAGE_ID . ", '" . escapeString(WCF::getSession()->ipAddress) . "', " . TIME_NOW . ", '" . escapeString($requestURI) . "', '" . escapeString(WCF::getSession()->requestMethod) . "', '" . escapeString(get_class($eventObj)) . "')"; WCF::getDB()->registerShutdownUpdate($sql); } }
/** * @see Page::readParameters() */ public function readParameters() { parent::readParameters(); if (WCF::getUser()->userID) { $this->username = WCF::getUser()->username; } }
/** * @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::readParameters() */ public function readParameters() { parent::readParameters(); if (WCF::getUser()->userID || WCF::getSession()->getVar('captchaDone')) { $this->useCaptcha = false; } }
/** * @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 Page::readParameters */ public function readParameters() { // if there is no user logged in try to get valid logindata if (!WCF::getUser()->userID && function_exists('getallheaders')) { if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['PHP_AUTH_PW'])) { $this->authenticate(); } else { $this->user = new UserSession(null, null, $_SERVER['PHP_AUTH_USER']); if (!$this->user->checkPassword($_SERVER['PHP_AUTH_PW'])) { $this->authenticate(); } } } else { $this->user = WCF::getUser(); } $sourceID = 0; if (isset($_REQUEST['sourceID'])) { $sourceID = $_REQUEST['sourceID']; } if (isset($_REQUEST['type'])) { $this->type = StringUtil::trim($_REQUEST['type']); } if (!in_array($this->type, $this->validTypes)) { throw new IllegalLinkException(); } $this->source = new Source($sourceID); if (!$this->source->sourceID) { throw new IllegalLinkException(); } if (!$this->source->hasAccess($this->user)) { throw new PermissionDeniedException(); } }
/** * Gets a list of available updates. */ protected function readUpdates() { if (WCF::getUser()->getPermission('admin.system.package.canUpdatePackage')) { require_once WCF_DIR . 'lib/acp/package/update/PackageUpdate.class.php'; $this->updates = PackageUpdate::getAvailableUpdates(); // kick wbb 3.0 updates if (CMS_DISABLE_WBB_UPDATES) { foreach ($this->updates as $packageID => $package) { if ($package['package'] == 'com.woltlab.wbb') { foreach ($package['versions'] as $version => $packageVersion) { if (Package::compareVersion($version, '3.0.0 Beta 1', '>=')) { unset($this->updates[$packageID]['versions'][$version]); } } if (!count($this->updates[$packageID]['versions'])) { $this->updates = PackageUpdate::getAvailableUpdates(false); unset($this->updates[$packageID]); } else { $this->updates[$packageID]['version'] = end($this->updates[$packageID]['versions']); } } } } } }
/** * @see Page::readParameters() */ public function readParameters() { parent::readParameters(); if (!WCF::getUser()->getPermission('user.source.profiles.canManageProfiles')) { throw new PermissionDeniedException(); } if (isset($_POST['packages'])) { $packages = JSON::decode($_POST['packages']); if (!is_array($packages)) { $this->sendResponse('pb.build.profile.error.packages.empty', true); } $this->packages = $packages; } if (isset($_POST['packageHash'])) { $this->packageHash = StringUtil::trim($_POST['packageHash']); } if (isset($_POST['packageName'])) { $this->packageName = StringUtil::trim($_POST['packageName']); } if (isset($_POST['profileName'])) { $this->profileName = StringUtil::trim($_POST['profileName']); if (empty($this->profileName)) { $this->sendResponse('wcf.global.error.empty', true); } } if (isset($_POST['resource'])) { $this->resource = StringUtil::trim($_POST['resource']); } }
/** * Gets a list of available updates. */ protected function readUpdates() { if (WCF::getUser()->getPermission('admin.system.package.canUpdatePackage')) { require_once WCF_DIR . 'lib/acp/package/update/PackageUpdate.class.php'; $this->updates = PackageUpdate::getAvailableUpdates(); } }
/** * @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 (!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 Action::execute() */ public function execute() { parent::execute(); // check permission if (!WCF::getUser()->userID) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } $this->alliance = Alliance::getByUserID($this->userID, true); $this->user = new LWUser($this->userID); if ($this->userID == WCF::getUser()->userID) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } if ($this->user->ally_id != $this->allianceID) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } if (!$this->alliance->getRank(true, 6)) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } $this->alliance->deleteUser($this->userID); $this->executed(); header('Location: index.php?page=AllianceMembersList'); exit; }
/** * @see Taggable::getObjectsByTagID() */ public function getObjectsByTagID($tagID, $limit = 0, $offset = 0) { $accessibleBoardIDArray = Board::getAccessibleBoardIDArray(); if (count($accessibleBoardIDArray) == 0) { return array(); } $sqlThreadVisitSelect = $sqlThreadVisitJoin = $sqlSubscriptionSelect = $sqlSubscriptionJoin = $sqlOwnPostsSelect = $sqlOwnPostsJoin = ''; if (WCF::getUser()->userID != 0) { $sqlThreadVisitSelect = ', thread_visit.lastVisitTime'; $sqlThreadVisitJoin = " LEFT JOIN \twbb" . WBB_N . "_thread_visit thread_visit \n\t\t\t\t\t\tON \t\t(thread_visit.threadID = thread.threadID\n\t\t\t\t\t\t\t\tAND thread_visit.userID = " . WCF::getUser()->userID . ")"; $sqlSubscriptionSelect = ', IF(thread_subscription.userID IS NOT NULL, 1, 0) AS subscribed'; $sqlSubscriptionJoin = " LEFT JOIN \twbb" . WBB_N . "_thread_subscription thread_subscription \n\t\t\t\t\t\tON \t\t(thread_subscription.userID = " . WCF::getUser()->userID . "\n\t\t\t\t\t\t\t\tAND thread_subscription.threadID = thread.threadID)"; if (BOARD_THREADS_ENABLE_OWN_POSTS) { $sqlOwnPostsSelect = "DISTINCT post.userID AS ownPosts,"; $sqlOwnPostsJoin = "\tLEFT JOIN\twbb" . WBB_N . "_post post\n\t\t\t\t\t\t\tON \t\t(post.threadID = thread.threadID\n\t\t\t\t\t\t\t\t\tAND post.userID = " . WCF::getUser()->userID . ")"; } } $threads = array(); $sql = "SELECT\t\t" . $sqlOwnPostsSelect . "\n\t\t\t\t\tthread.*,\n\t\t\t\t\tboard.boardID, board.title\n\t\t\t\t\t" . $sqlThreadVisitSelect . "\n\t\t\t\t\t" . $sqlSubscriptionSelect . "\n\t\t\tFROM\t\twcf" . WCF_N . "_tag_to_object tag_to_object\n\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\tON\t\t(thread.threadID = tag_to_object.objectID)\n\t\t\tLEFT JOIN \twbb" . WBB_N . "_board board\n\t\t\tON \t\t(board.boardID = thread.boardID)\n\t\t\t" . $sqlOwnPostsJoin . "\n\t\t\t" . $sqlThreadVisitJoin . "\n\t\t\t" . $sqlSubscriptionJoin . "\n\t\t\tWHERE\t\ttag_to_object.tagID = " . $tagID . "\n\t\t\t\t\tAND tag_to_object.taggableID = " . $this->getTaggableID() . "\n\t\t\t\t\tAND thread.boardID IN (" . implode(',', $accessibleBoardIDArray) . ")\n\t\t\t\t\tAND thread.isDeleted = 0\n\t\t\t\t\tAND thread.isDisabled = 0\n\t\t\tORDER BY\tthread.lastPostTime DESC"; $result = WCF::getDB()->sendQuery($sql, $limit, $offset); while ($row = WCF::getDB()->fetchArray($result)) { $row['taggable'] = $this; $threads[] = new TaggedThread(null, $row); } return $threads; }
/** * @see Page::readData() */ public function readData() { parent::readData(); $this->os = PHP_OS; if (isset($_SERVER['SERVER_SOFTWARE'])) { $this->webserver = $_SERVER['SERVER_SOFTWARE']; } $this->sqlVersion = WCF::getDB()->getVersion(); $this->sqlType = WCF::getDB()->getDBType(); $this->readLoad(); $this->readStat(); // updates if (WCF::getUser()->getPermission('admin.system.package.canUpdatePackage')) { require_once WCF_DIR . 'lib/acp/package/update/PackageUpdate.class.php'; $this->updates = PackageUpdate::getAvailableUpdates(); } // news if (false) { $this->news = FeedReaderSource::getEntries(5); foreach ($this->news as $key => $news) { $this->news[$key]['description'] = preg_replace('/href="(.*?)"/e', '\'href="' . RELATIVE_WCF_DIR . 'acp/dereferrer.php?url=\'.rawurlencode(\'$1\').\'" class="externalURL"\'', $news['description']); } } else { $this->news = array(); } }
/** * @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 Action::execute() */ public function execute() { parent::execute(); // check permission if (!WCF::getUser()->userID) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } $this->navalFormation = new NavalFormation($this->navalFormationID); // check fleet if ($this->navalFormation->getLeaderFleet()->ownerID != WCF::getUser()->userID) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } if ($this->navalFormation->usersLimitReached()) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } $user = new LWUser(null, null, $this->username); if (!$user->userID) { require_once WCF_DIR . 'lib/system/exception/IllegalLinkException.class.php'; throw new IllegalLinkException(); } $this->userID = $user->userID; $this->navalFormation->getEditor()->addUser($this->userID); $this->executed(); header('Location: index.php?page=FleetStartShips'); exit; }