root/profile.lastvisitors/files/lib/page/MoreVisitorsPage.class.php @ 677

Revision 677, 2.9 kB (checked in by MDMAN, 5 years ago)

new version of profile.lastvisitors added

RevLine 
[283]1<?php
2require_once(WCF_DIR.'lib/page/AbstractPage.class.php');
[358]3require_once(WCF_DIR.'lib/page/util/menu/HeaderMenu.class.php');
[283]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 */
12class MoreVisitorsPage extends AbstractPage {
13        public $profileID = 0;
[358]14        public $templateName = 'moreVisitors';
15        public $visitors = array();
16        public $user = array();
17        public $visitorCount = 0;
18                       
[658]19        /**
20         * @see Page::readParameters()
21         */
[358]22        public function readParameters() {
23                parent::readParameters();
[360]24               
[411]25                if (isset($_GET['userID'])) $this->profileID = intval($_GET['userID']);
[658]26        }
[283]27       
[658]28        /**
29         * @see Page::validate()
30         */
31        public function validate() {
32                parent::validate();
33
34                if ($this->profileID == 0) {
35                        require_once(WCF_DIR.'lib/system/exception/IllegalLinkException.class.php');
36                        throw new IllegalLinkException();
37                }
38        }
39       
40        /**
41         * @see Page::readData()
42         */
43        public function readData() {
44                parent::readData();
45       
[370]46                if ($this->profileID > 0 && SHOW_LASTVISITOR_MOREVISITORS == 1 && SHOW_LASTVISITOR == 1 && SHOW_LASTVISITOR_ALLUSERS == 1 || $this->profileID > 0 && SHOW_LASTVISITOR_MOREVISITORS == 1 && SHOW_LASTVISITOR == 1 && SHOW_LASTVISITOR_ALLUSERS != 1 && WCF::getUser()->userID == $this->profileID || $this->profileID > 0 && SHOW_LASTVISITOR_MOREVISITORS == 1 && WCF::getUser()->getPermission('admin.profile.lastvisitor.canseeboxes')){
[360]47
48                        // hier werde die Daten von den Besuchern des Profils geladen
[513]49                        $sql = "SELECT  profile.userID, profile.username, profile.time, user.lastActivityTime
50                                        FROM                    wcf".WCF_N."_profile_lastvisitors profile
51                                        LEFT OUTER JOIN wcf".WCF_N."_user user
52                                        ON                              (user.userID = profile.userID)
53                                        WHERE   profileID = ".$this->profileID."       
54                                        ORDER BY        time DESC
55                                        LIMIT 0 , ".SHOW_LASTVISITOR_MOREVISITORS_AMOUNT;
[360]56                        $result = WCF::getDB()->sendQuery($sql);
57                        while ($row = WCF::getDB()->fetchArray($result)) {
[677]58                                $this->visitors[] = new DatabaseObject($row);
[360]59                        }
60               
61                        // hier wird der Username des Profilinhabers geladen.
62                        $sql = "SELECT username
63                                FROM    wcf".WCF_N."_user
64                                WHERE   userID = ".$this->profileID;
65                        $this->user = WCF::getDB()->getFirstRow($sql);
[358]66                }
[360]67                else {
68                        require_once(WCF_DIR.'lib/system/exception/PermissionDeniedException.class.php');
69                        throw new PermissionDeniedException();
70                }               
[358]71        }
72       
[658]73        /**
74         * @see Page::assignVariables()
75         */
[358]76        public function assignVariables() {
77                parent::assignVariables();
[283]78
[358]79                WCF::getTPL()->assign(array(
80                        'visitors' => $this->visitors,
81                        'visitorCount' => count($this->visitors),
82                        'profileID' => $this->profileID,
83                        'user' => $this->user,
84                ));
85        }
86       
87        /**
88         * @see Page::show()
89         */
90        public function show() {
91                // set active header menu item
92                HeaderMenu::setActiveMenuItem('wcf.header.menu.memberslist');
93               
94                parent::show();
95        }
[283]96}
97?>
Note: See TracBrowser for help on using the browser.