| 1 | <?php |
|---|
| 2 | require_once(WCF_DIR.'lib/page/AbstractPage.class.php'); |
|---|
| 3 | require_once(WCF_DIR.'lib/page/util/menu/UserProfileMenu.class.php'); |
|---|
| 4 | |
|---|
| 5 | /** |
|---|
| 6 | * Shows more Visitors on extra Side. |
|---|
| 7 | * |
|---|
| 8 | * @package de.mdman.profile.lastvisitors |
|---|
| 9 | * @author MDMAN |
|---|
| 10 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> |
|---|
| 11 | */ |
|---|
| 12 | class MoreVisitorsTabPage extends AbstractPage { |
|---|
| 13 | public $profileID = 0; |
|---|
| 14 | public $templateName = 'moreVisitorsTab'; |
|---|
| 15 | public $visitors = array(); |
|---|
| 16 | public $user = array(); |
|---|
| 17 | public $visitorCount = 0; |
|---|
| 18 | public $userID = 0; |
|---|
| 19 | |
|---|
| 20 | /** |
|---|
| 21 | * @see Page::readParameters() |
|---|
| 22 | */ |
|---|
| 23 | public function readParameters() { |
|---|
| 24 | parent::readParameters(); |
|---|
| 25 | |
|---|
| 26 | if (isset($_REQUEST['userID'])) $this->profileID = intval($_REQUEST['userID']); |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | /** |
|---|
| 30 | * @see Page::validate() |
|---|
| 31 | */ |
|---|
| 32 | public function validate() { |
|---|
| 33 | parent::validate(); |
|---|
| 34 | |
|---|
| 35 | if ($this->profileID == 0) { |
|---|
| 36 | require_once(WCF_DIR.'lib/system/exception/IllegalLinkException.class.php'); |
|---|
| 37 | throw new IllegalLinkException(); |
|---|
| 38 | } |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | /** |
|---|
| 42 | * @see Page::readData() |
|---|
| 43 | */ |
|---|
| 44 | public function readData() { |
|---|
| 45 | parent::readData(); |
|---|
| 46 | |
|---|
| 47 | if ($this->profileID > 0 && SHOW_LASTVISITOR_MOREVISITORS_ONTAB == 1 && SHOW_LASTVISITOR == 1 && SHOW_LASTVISITOR_ALLUSERS == 1 || $this->profileID > 0 && SHOW_LASTVISITOR_MOREVISITORS_ONTAB == 1 && SHOW_LASTVISITOR == 1 && SHOW_LASTVISITOR_ALLUSERS != 1 && WCF::getUser()->userID == $this->profileID || $this->profileID > 0 && SHOW_LASTVISITOR_MOREVISITORS_ONTAB == 1 && WCF::getUser()->getPermission('admin.profile.lastvisitor.canseeboxes')){ |
|---|
| 48 | |
|---|
| 49 | // hier werde die Daten von den Besuchern des Profils geladen |
|---|
| 50 | $sql = "SELECT profile.userID, profile.username, profile.time, user.lastActivityTime |
|---|
| 51 | FROM wcf".WCF_N."_profile_lastvisitors profile |
|---|
| 52 | LEFT OUTER JOIN wcf".WCF_N."_user user |
|---|
| 53 | ON (user.userID = profile.userID) |
|---|
| 54 | WHERE profileID = ".$this->profileID." |
|---|
| 55 | ORDER BY time DESC |
|---|
| 56 | LIMIT 0 , ".SHOW_LASTVISITOR_MOREVISITORS_AMOUNT; |
|---|
| 57 | $result = WCF::getDB()->sendQuery($sql); |
|---|
| 58 | while ($row = WCF::getDB()->fetchArray($result)) { |
|---|
| 59 | $this->visitors[] = $row; |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | // hier wird der Username des Profilinhabers geladen. |
|---|
| 63 | $sql = "SELECT username |
|---|
| 64 | FROM wcf".WCF_N."_user |
|---|
| 65 | WHERE userID = ".$this->profileID; |
|---|
| 66 | $this->user = WCF::getDB()->getFirstRow($sql); |
|---|
| 67 | } |
|---|
| 68 | |
|---|
| 69 | else { |
|---|
| 70 | require_once(WCF_DIR.'lib/system/exception/PermissionDeniedException.class.php'); |
|---|
| 71 | throw new PermissionDeniedException(); |
|---|
| 72 | } |
|---|
| 73 | } |
|---|
| 74 | |
|---|
| 75 | /** |
|---|
| 76 | * @see Page::assignVariables() |
|---|
| 77 | */ |
|---|
| 78 | public function assignVariables() { |
|---|
| 79 | parent::assignVariables(); |
|---|
| 80 | |
|---|
| 81 | WCF::getTPL()->assign(array( |
|---|
| 82 | 'visitors' => $this->visitors, |
|---|
| 83 | 'visitorCount' => count($this->visitors), |
|---|
| 84 | 'profileID' => $this->profileID, |
|---|
| 85 | 'user' => $this->user, |
|---|
| 86 | )); |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | /** |
|---|
| 90 | * @see Page::show() |
|---|
| 91 | */ |
|---|
| 92 | public function show() { |
|---|
| 93 | require_once(WCF_DIR.'lib/page/util/menu/UserProfileMenu.class.php'); |
|---|
| 94 | UserProfileMenu::getInstance()->userID = $this->profileID; |
|---|
| 95 | UserProfileMenu::getInstance()->setActiveMenuItem('wcf.user.profile.menu.link.profile.lastvisitor'); |
|---|
| 96 | |
|---|
| 97 | // set active header menu item |
|---|
| 98 | require_once(WCF_DIR.'lib/page/util/menu/HeaderMenu.class.php'); |
|---|
| 99 | HeaderMenu::setActiveMenuItem('wcf.header.menu.memberslist'); |
|---|
| 100 | |
|---|
| 101 | parent::show(); |
|---|
| 102 | } |
|---|
| 103 | } |
|---|
| 104 | ?> |
|---|