/**
     * @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>';
                            }
                        }
                    }
                }
            }
        }
    }
示例#2
0
 public function __construct($data, $boxname = "")
 {
     $this->TopData['templatename'] = "topthreads";
     $this->getBoxStatus($data);
     $this->TopData['boxID'] = $data['boxID'];
     if (!defined('TOPTHREADS_COUNT')) {
         define('TOPTHREADS_COUNT', 10);
     }
     if (!defined('TOPTHREADS_TITLELENGTH')) {
         define('TOPTHREADS_TITLELENGTH', 25);
     }
     if (!defined('TOPTHREADS_SBCOLOR_ACP')) {
         define('TOPTHREADS_SBCOLOR_ACP', 2);
     }
     require_once WBB_DIR . 'lib/data/board/Board.class.php';
     $boardIDs = Board::getAccessibleBoards();
     if (!empty($boardIDs)) {
         $sql = "SELECT thread.*" . "\n  FROM wbb" . WBB_N . "_thread thread" . "\n WHERE thread.boardID IN (0" . $boardIDs . ")" . "\n ORDER BY thread.replies DESC" . "\n LIMIT 0, " . TOPTHREADS_COUNT;
         $result = WBBCore::getDB()->sendQuery($sql);
         while ($row = WBBCore::getDB()->fetchArray($result)) {
             $row['replies'] = StringUtil::formatInteger($row['replies']);
             $row['title'] = StringUtil::encodeHTML($row['topic']) . ' - ' . $row['replies'];
             if (TOPTHREADS_TITLELENGTH != 0 && strlen($row['topic']) > TOPTHREADS_TITLELENGTH) {
                 $row['topic'] = StringUtil::substring($row['topic'], 0, TOPTHREADS_TITLELENGTH - 3) . '...';
             }
             $row['topic'] = StringUtil::encodeHTML($row['topic']);
             $this->TopData['threads'][] = $row;
         }
     }
 }
    /**
     * @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'));
                        }
                    }
                }
            }
        }
    }
 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)
 {
     // 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);
             }
         }
     }
 }
 public function readEntries($sortField = 'updateDate', $sortOrder = 'DESC', $pageNo = 1, $itemsPerPage = 20)
 {
     $ret = array();
     $i = 0;
     if (preg_match('/(userID|avatarID)/', $sortField)) {
         $sortField = 'u.' . $sortField;
     }
     require_once WCF_DIR . 'lib/data/user/UserProfile.class.php';
     require_once WCF_DIR . 'lib/data/user/avatar/Avatar.class.php';
     $sql = "SELECT uwp.*, IFNULL(SUM(attachmentSize),0) + LENGTH(uwp.text) AS size, COUNT(attachmentID) AS aCnt, u.*, a.*, rank.*, uo.*" . "\n  FROM wcf" . WCF_N . "_user_wanted_poster uwp" . "\n  JOIN wcf" . WCF_N . "_user u ON u.userID = uwp.userID" . "\n  LEFT JOIN wcf" . WCF_N . "_attachment wat ON (wat.userID = uwp.userID AND wat.messageType = 'wantedPoster')" . "\n  LEFT JOIN wcf" . WCF_N . "_avatar a ON (a.avatarID = u.avatarID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user_rank rank ON (rank.rankID = u.rankID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user_option_value uo ON (uo.userID = u.userID)";
     if (!WCF::getUser()->getPermission('mod.wantedPoster.canLockEntries')) {
         $sql .= "\n WHERE uwp.locked != 1";
     }
     $sql .= "\n GROUP BY uwp.userID, uwp.insertDate, uwp.updateDate, uwp.text, uwp.views, uwp.enableSmilies, uwp.enableHtml, uwp.enableBBCodes, uwp.locked, uwp.lockDate, uwp.lockUser" . "\n ORDER BY " . $sortField . " " . $sortOrder . "\n LIMIT " . $itemsPerPage . "\nOFFSET " . ($pageNo - 1) * $itemsPerPage;
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $ret[$i]['userID'] = $row['userID'];
         $ret[$i]['insertDate'] = $row['insertDate'];
         $ret[$i]['updateDate'] = $row['updateDate'];
         $ret[$i]['views'] = $row['views'];
         $ret[$i]['locked'] = $row['locked'];
         $ret[$i]['size'] = StringUtil::formatInteger($row['size']);
         $ret[$i]['aCnt'] = StringUtil::formatInteger($row['aCnt']);
         // username
         $user = new UserProfile(null, $row);
         $username = StringUtil::encodeHTML($row['username']);
         $protectedProfile = $user->protectedProfile && WCF::getUser()->userID != $user->userID;
         $userData = array('user' => $user, 'encodedUsername' => $username, 'protectedProfile' => $protectedProfile);
         $userData['username'] = '******';
         if ($user->isOnline()) {
             $title = WCF::getLanguage()->get('wcf.user.online', array('$username' => $username));
             $userData['username'] .= '<img src="' . RELATIVE_WCF_DIR . 'icon/onlineS.png" alt="' . $title . '" title="' . $title . '" />';
         } else {
             $title = WCF::getLanguage()->get('wcf.user.offline', array('$username' => $username));
             $userData['username'] .= '<img src="' . RELATIVE_WCF_DIR . 'icon/offlineS.png" alt="' . $title . '" title="' . $title . '" />';
         }
         $userData['username'] .= '</div><div class="containerContentSmall">';
         $title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $username));
         $userData['username'] .= '<p><a href="index.php?page=User&amp;userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $username . '</a></p>';
         if ($user->getUserTitle()) {
             $userData['username'] .= '<p class="smallFont">' . $user->getUserTitle() . ' ' . ($user->getRank() ? $user->getRank()->getImage() : '') . '</p>';
         }
         $userData['username'] .= '</div>';
         $ret[$i]['username'] = $userData['username'];
         // avatar
         if (empty($row['disableAvatar']) && !empty($row['avatarID']) && !empty($row['avatarExtension'])) {
             $avatar = new Avatar(null, $row);
             $avatar->setMaxHeight(50);
             $title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $row['username']));
             $ret[$i]['avatar'] = '<a href="index.php?page=User&amp;userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $avatar->__toString() . '</a>';
         } else {
             $ret[$i]['avatar'] = '&nbsp;';
         }
         $i++;
     }
     return $ret;
 }
 /**
  * Generates html code of a link.
  * 
  * @param 	string		$link
  * @param 	integer		$pageNo
  * @param 	integer		$activePage
  * @paraM	boolean		$break
  * @return	string
  */
 protected function makeLink($link, $pageNo, $activePage, $break = false)
 {
     // first page
     if ($activePage != $pageNo) {
         return '<li' . ($break ? ' class="break"' : '') . '><a href="' . $this->insertPageNumber($link, $pageNo) . '">' . StringUtil::formatInteger($pageNo) . '</a></li>' . "\n";
     } else {
         return '<li class="' . ($break ? 'break ' : '') . 'active"><span>' . StringUtil::formatInteger($pageNo) . '</span></li>' . "\n";
     }
 }
 public function __construct($data, $boxname = "")
 {
     $this->TopPosterData['templatename'] = "topposter";
     $this->getBoxStatus($data);
     $this->TopPosterData['boxID'] = $data['boxID'];
     if (!defined('TOPPOSTER_COUNT')) {
         define('TOPPOSTER_COUNT', 10);
     }
     if (!defined('TOPPOSTER_SBCOLOR_ACP')) {
         define('TOPPOSTER_SBCOLOR_ACP', 2);
     }
     WCF::getTPL()->assign('TOPPOSTER_SBCOLOR_ACP', intval(TOPPOSTER_SBCOLOR_ACP));
     $sql = "SELECT wcu.userid, wcu.username, wbu.posts" . "\n  FROM wcf" . WCF_N . "_user wcu" . "\n  LEFT JOIN wbb" . WBB_N . "_user wbu ON (wbu.userid = wcu.userid)" . "\n  ORDER BY wbu.posts DESC, wcu.username" . "\n  LIMIT 0, " . TOPPOSTER_COUNT;
     $result = WBBCore::getDB()->sendQuery($sql);
     while ($row = WBBCore::getDB()->fetchArray($result)) {
         $row['username'] = StringUtil::encodeHTML($row['username']);
         $row['posts'] = StringUtil::formatInteger($row['posts']);
         $this->TopPosterData['users'][] = $row;
     }
 }
 public function __construct($data, $boxname = "")
 {
     $this->TopData['templatename'] = "topthanksgivingposts";
     $this->getBoxStatus($data);
     $this->TopData['boxID'] = $data['boxID'];
     if (!defined('TOPTHANKSGIVING_COUNT_ACP')) {
         define('TOPTHANKSGIVING_COUNT_ACP', 10);
     }
     if (!defined('TOPTHANKSGIVING_TITLELENGTH_ACP')) {
         define('TOPTHANKSGIVING_TITLELENGTH_ACP', 28);
     }
     if (!defined('TOPTHANKSGIVING_SBCOLOR_ACP')) {
         define('TOPTHANKSGIVING_SBCOLOR_ACP', 2);
     }
     if (!defined('TOPTHANKSGIVING_HITS_ACP')) {
         define('TOPTHANKSGIVING_HITS_ACP', true);
     }
     require_once WBB_DIR . 'lib/data/board/Board.class.php';
     $boardIDs = Board::getAccessibleBoards();
     if (!empty($boardIDs)) {
         $sql = "SELECT thread.topic AS subject, MIN(post.postID) AS postID, COUNT(*) AS cnt" . "\n  FROM wbb" . WBB_N . "_thread thread" . "\n  LEFT JOIN (wbb" . WBB_N . "_post post, wbb" . WBB_N . "_thank_guests tg, wbb" . WBB_N . "_thank_user tu)" . "\n  ON (post.threadID = thread.threadID AND (post.postID = tu.postID OR post.postID = tg.postID))" . "\n  WHERE thread.isDisabled = 0" . "\n  AND thread.isDeleted = 0" . "\n  AND thread.boardID IN (" . $boardIDs . ")" . "\n  AND post.isDeleted = 0" . "\n  AND post.isDisabled = 0" . "\n  GROUP BY thread.threadID" . "\n  ORDER BY cnt DESC" . "\n  LIMIT 0, " . TOPTHANKSGIVING_COUNT_ACP;
         $result = WBBCore::getDB()->sendQuery($sql);
         while ($row = WBBCore::getDB()->fetchArray($result)) {
             $plainSubject = $row['subject'];
             $row['thanks'] = StringUtil::formatInteger($row['cnt']);
             $row['title'] = StringUtil::encodeHTML($plainSubject) . ' - ' . $row['thanks'];
             if (TOPTHANKSGIVING_TITLELENGTH_ACP != 0 && strlen($plainSubject) > TOPTHANKSGIVING_TITLELENGTH_ACP) {
                 $row['subject'] = StringUtil::substring($plainSubject, 0, TOPTHANKSGIVING_TITLELENGTH_ACP - 3) . '...';
             }
             $row['subject'] = StringUtil::encodeHTML($row['subject']);
             $this->TopData['thanksgiving'][] = $row;
         }
     }
     WCF::getTPL()->assign('TOPTHANKSGIVING_SBCOLOR_ACP', intval(TOPTHANKSGIVING_SBCOLOR_ACP));
     WCF::getTPL()->assign('TOPTHANKSGIVING_HITS_ACP', TOPTHANKSGIVING_HITS_ACP);
 }
示例#10
0
 public function __construct($data, $boxname = "")
 {
     $this->BoxData['templatename'] = "personalbox";
     $this->getBoxStatus($data);
     $this->BoxData['boxID'] = $data['boxID'];
     // Instant Messenger by Tatzelwurm
     if (!defined('INSTANTMESSENGER_AKTIV')) {
         define('INSTANTMESSENGER_AKTIV', false);
     }
     $imcount = 0;
     $pbShowIM = false;
     if (!empty($_REQUEST['page'])) {
         $boxCurPage = $_REQUEST['page'];
     } else {
         $boxCurPage = 'Portal';
     }
     // DEFAULTS
     $pbCatVertOffset = 4;
     $pbLargeRankImages = false;
     $pbRepeatRankImage = true;
     $pbRankImage = '<img src="' . RELATIVE_WCF_DIR . 'icon/userRank1S.png" alt="" title="' . WCF::getLanguage()->get('wcf.user.rank') . '" />';
     $pbLineFeedRank = false;
     $pbFBColor = 1;
     $pbSBColor = 2;
     $pbShowUserMarking = true;
     $pbStyleWidth = 140;
     $pbShowProfileLink = false;
     $pbShowDisplayLink = false;
     $pbFirstColWidth = 20;
     $pbTableWidth = '99%';
     $pbCellPadding = 0;
     $pbWeatherZipCode = '60329';
     $pbWeatherComZipCode = 'DEPLZ,60329';
     $pbWeatherStyle = 1;
     $pbWeatherComStyle = 4;
     $pbWeatherWidth = 140;
     $pbWeatherComDay = 'C';
     $pbMaxHeight = 0;
     $pbShowAvatar = true;
     $pbAvatarMaxWidth = 150;
     $pbAvatarMaxHeight = 150;
     $pbShowPersonal = false;
     $pbShowSearch = true;
     $pbSearchDays = 0;
     $pbShowPM = true;
     $pbShowUserCP = true;
     $pbShowStyles = false;
     $pbShowMisc = false;
     $pbShowWeather = false;
     $pbShowWeatherCom = false;
     $pbShowProfileHits = false;
     // ACP Konstanten...
     if (!defined('PERSONALBOX_CATSPACER_ACP')) {
         define('PERSONALBOX_CATSPACER_ACP', $pbCatVertOffset);
     }
     if (!defined('PERSONALBOX_LARGERANKIMAGES_ACP')) {
         define('PERSONALBOX_LARGERANKIMAGES_ACP', $pbLargeRankImages);
     }
     if (!defined('PERSONALBOX_REPEATRANKIMAGE_ACP')) {
         define('PERSONALBOX_REPEATRANKIMAGE_ACP', $pbRepeatRankImage);
     }
     if (!defined('PERSONALBOX_STYLEBOXWIDTH_ACP')) {
         define('PERSONALBOX_STYLEBOXWIDTH_ACP', $pbStyleWidth);
     }
     if (!defined('PERSONALBOX_WEATHER_ZIPCODE_ACP')) {
         define('PERSONALBOX_WEATHER_ZIPCODE_ACP', $pbWeatherZipCode);
     }
     if (!defined('PERSONALBOX_WEATHERCOM_ZIPCODE_ACP')) {
         define('PERSONALBOX_WEATHERCOM_ZIPCODE_ACP', $pbWeatherComZipCode);
     }
     if (!defined('PERSONALBOX_WEATHER_STYLE_ACP')) {
         define('PERSONALBOX_WEATHER_STYLE_ACP', $pbWeatherStyle);
     }
     if (!defined('PERSONALBOX_WEATHERCOM_STYLE_ACP')) {
         define('PERSONALBOX_WEATHERCOM_STYLE_ACP', $pbWeatherComStyle);
     }
     if (!defined('PERSONALBOX_WEATHERCOM_DAY_ACP')) {
         define('PERSONALBOX_WEATHERCOM_DAY_ACP', $pbWeatherComDay);
     }
     if (!defined('PERSONALBOX_WEATHER_WIDTH_ACP')) {
         define('PERSONALBOX_WEATHER_WIDTH_ACP', $pbWeatherWidth);
     }
     if (!defined('PERSONALBOX_LINEFEEDRANK_ACP')) {
         define('PERSONALBOX_LINEFEEDRANK_ACP', $pbLineFeedRank);
     }
     if (!defined('PERSONALBOX_FBCOLOR_ACP')) {
         define('PERSONALBOX_FBCOLOR_ACP', $pbFBColor);
     }
     if (!defined('PERSONALBOX_SBCOLOR_ACP')) {
         define('PERSONALBOX_SBCOLOR_ACP', $pbSBColor);
     }
     if (!defined('PERSONALBOX_SHOWUSERMARKING_ACP')) {
         define('PERSONALBOX_SHOWUSERMARKING_ACP', $pbShowUserMarking);
     }
     if (!defined('PERSONALBOX_SHOWPROFILELINK_ACP')) {
         define('PERSONALBOX_SHOWPROFILELINK_ACP', $pbShowProfileLink);
     }
     if (!defined('PERSONALBOX_SHOWDISPLAYLINK_ACP')) {
         define('PERSONALBOX_SHOWDISPLAYLINK_ACP', $pbShowDisplayLink);
     }
     if (!defined('PERSONALBOX_FIRSTCOLWIDTH_ACP')) {
         define('PERSONALBOX_FIRSTCOLWIDTH_ACP', $pbFirstColWidth);
     }
     if (!defined('PERSONALBOX_TABLEWIDTH_ACP')) {
         define('PERSONALBOX_TABLEWIDTH_ACP', $pbTableWidth);
     }
     if (!defined('PERSONALBOX_CELLPADDING_ACP')) {
         define('PERSONALBOX_CELLPADDING_ACP', $pbCellPadding);
     }
     if (!defined('PERSONALBOX_MAXHEIGHT_ACP')) {
         define('PERSONALBOX_MAXHEIGHT_ACP', $pbMaxHeight);
     }
     if (!defined('PERSONALBOX_SHOW_AVATAR_ACP')) {
         define('PERSONALBOX_SHOW_AVATAR_ACP', $pbShowAvatar);
     }
     if (!defined('PERSONALBOX_AVATARMAXWIDTH_ACP')) {
         define('PERSONALBOX_AVATARMAXWIDTH_ACP', $pbAvatarMaxWidth);
     }
     if (!defined('PERSONALBOX_AVATARMAXHEIGHT_ACP')) {
         define('PERSONALBOX_AVATARMAXHEIGHT_ACP', $pbAvatarMaxHeight);
     }
     if (!defined('PERSONALBOX_SHOW_PERSONAL_ACP')) {
         define('PERSONALBOX_SHOW_PERSONAL_ACP', $pbShowPersonal);
     }
     if (!defined('PERSONALBOX_SHOW_SEARCH_ACP')) {
         define('PERSONALBOX_SHOW_SEARCH_ACP', $pbShowSearch);
     }
     if (!defined('PERSONALBOX_SEARCH_DAYS_ACP')) {
         define('PERSONALBOX_SEARCH_DAYS_ACP', $pbSearchDays);
     }
     if (!defined('PERSONALBOX_SHOW_PM_ACP')) {
         define('PERSONALBOX_SHOW_PM_ACP', $pbShowPM);
     }
     if (!defined('PERSONALBOX_SHOW_USERCP_ACP')) {
         define('PERSONALBOX_SHOW_USERCP_ACP', $pbShowUserCP);
     }
     if (!defined('PERSONALBOX_SHOW_STYLES_ACP')) {
         define('PERSONALBOX_SHOW_STYLES_ACP', $pbShowStyles);
     }
     if (!defined('PERSONALBOX_SHOW_MISC_ACP')) {
         define('PERSONALBOX_SHOW_MISC_ACP', $pbShowMisc);
     }
     if (!defined('PERSONALBOX_WEATHER_SHOW_ACP')) {
         define('PERSONALBOX_WEATHER_SHOW_ACP', $pbShowWeather);
     }
     if (!defined('PERSONALBOX_WEATHERCOM_SHOW_ACP')) {
         define('PERSONALBOX_WEATHERCOM_SHOW_ACP', $pbShowWeatherCom);
     }
     if (!defined('PERSONALBOX_SHOW_IM_ACP')) {
         define('PERSONALBOX_SHOW_IM_ACP', false);
     }
     if (!defined('PERSONALBOX_SHOW_PROFILEHITS_ACP')) {
         define('PERSONALBOX_SHOW_PROFILEHITS_ACP', $pbShowProfileHits);
     }
     if (WCF::getUser()->userID != 0) {
         // Include libraries...
         require_once WBB_DIR . 'lib/data/board/Board.class.php';
         require_once WCF_DIR . 'lib/data/user/UserProfile.class.php';
         // Boxen Hoehe
         if (WCF::getUser()->getPermission('user.profile.personalbox.canSetMaxheight') && (WCF::getUser()->personalbox_maxheight >= 100 || WCF::getUser()->personalbox_maxheight == 0 || WCF::getUser()->personalbox_maxheight == 1)) {
             $pbMaxHeight = intval(WCF::getUser()->personalbox_maxheight);
         } else {
             if (PERSONALBOX_MAXHEIGHT_ACP >= 100) {
                 $pbMaxHeight = PERSONALBOX_MAXHEIGHT_ACP;
             }
         }
         // Avatar
         if (WCF::getUser()->getPermission('user.profile.personalbox.canSetAvatar') && WCF::getUser()->personalbox_show_avatar == 'enabled') {
             $pbShowAvatar = true;
         } else {
             if (WCF::getUser()->getPermission('user.profile.personalbox.canSetAvatar') && WCF::getUser()->personalbox_show_avatar == 'disabled') {
                 $pbShowAvatar = false;
             } else {
                 $pbShowAvatar = PERSONALBOX_SHOW_AVATAR_ACP;
             }
         }
         // Persoenliches
         if (WCF::getUser()->getPermission('user.profile.personalbox.canSetPersonal') && WCF::getUser()->personalbox_show_personal == 'enabled') {
             $pbShowPersonal = true;
         } else {
             if (WCF::getUser()->getPermission('user.profile.personalbox.canSetPersonal') && WCF::getUser()->personalbox_show_personal == 'disabled') {
                 $pbShowPersonal = false;
             } else {
                 $pbShowPersonal = PERSONALBOX_SHOW_PERSONAL_ACP;
             }
         }
         // Beitraege
         if (WCF::getUser()->getPermission('user.profile.personalbox.canSetCurPosts') && WCF::getUser()->personalbox_show_search == 'enabled') {
             $pbShowSearch = true;
         } else {
             if (WCF::getUser()->getPermission('user.profile.personalbox.canSetCurPosts') && WCF::getUser()->personalbox_show_search == 'disabled') {
                 $pbShowSearch = false;
             } else {
                 $pbShowSearch = PERSONALBOX_SHOW_SEARCH_ACP;
             }
         }
         // Private Nachrichten
         if (WCF::getUser()->getPermission('user.profile.personalbox.canSetPM') && WCF::getUser()->personalbox_show_pm == 'enabled') {
             $pbShowPM = true;
         } else {
             if (WCF::getUser()->getPermission('user.profile.personalbox.canSetPM') && WCF::getUser()->personalbox_show_pm == 'disabled') {
                 $pbShowPM = false;
             } else {
                 $pbShowPM = PERSONALBOX_SHOW_PM_ACP;
             }
         }
         // Verwaltung
         if (WCF::getUser()->getPermission('user.profile.personalbox.canSetUserCP') && WCF::getUser()->personalbox_show_usercp == 'enabled') {
             $pbShowUserCP = true;
         } else {
             if (WCF::getUser()->getPermission('user.profile.personalbox.canSetUserCP') && WCF::getUser()->personalbox_show_usercp == 'disabled') {
                 $pbShowUserCP = false;
             } else {
                 $pbShowUserCP = PERSONALBOX_SHOW_USERCP_ACP;
             }
         }
         // Style
         if (WCF::getUser()->getPermission('user.profile.personalbox.canSetStyle') && WCF::getUser()->personalbox_show_styles == 'enabled') {
             $pbShowStyles = true;
         } else {
             if (WCF::getUser()->getPermission('user.profile.personalbox.canSetStyle') && WCF::getUser()->personalbox_show_styles == 'disabled') {
                 $pbShowStyles = false;
             } else {
                 $pbShowStyles = PERSONALBOX_SHOW_STYLES_ACP;
             }
         }
         $pbStyles = array();
         if ($pbShowStyles && defined('PERSONALBOX_CNTSTYLES_ACP') && PERSONALBOX_CNTSTYLES_ACP == true) {
             $i = $isDefaultIdx = $cntDisabled = 0;
             $sql = "SELECT s.styleID, s.styleName, s.isDefault, s.disabled, COUNT(u.userID) AS CNT" . "\n  FROM wcf" . WCF_N . "_style s" . "\n  LEFT JOIN wcf" . WCF_N . "_user u ON (u.styleID = s.styleID OR (u.styleID = 0 AND isDefault = 1))" . "\n GROUP BY styleID, styleName, isDefault, disabled" . "\n ORDER BY styleName";
             $result = WBBCore::getDB()->sendQuery($sql);
             while ($row = WBBCore::getDB()->fetchArray($result)) {
                 $pbStyles[$i]['ID'] = $row['styleID'];
                 $pbStyles[$i]['NAME'] = $row['styleName'];
                 $pbStyles[$i]['DEFAULT'] = $row['isDefault'];
                 $pbStyles[$i]['DISABLED'] = $row['disabled'];
                 $pbStyles[$i]['CNT'] = $row['CNT'];
                 if (!empty($row['isDefault'])) {
                     $isDefaultIdx = $i;
                 }
                 if (!empty($row['disabled'])) {
                     $cntDisabled += $row['CNT'];
                 }
                 $i++;
             }
             if ($cntDisabled > 0 && isset($pbStyles[$isDefaultIdx])) {
                 $pbStyles[$isDefaultIdx]['CNT'] += $cntDisabled;
             }
         }
         // Sonstiges
         if (WCF::getUser()->getPermission('user.profile.personalbox.canSetMisc') && WCF::getUser()->personalbox_show_misc == 'enabled') {
             $pbShowMisc = true;
         } else {
             if (WCF::getUser()->getPermission('user.profile.personalbox.canSetMisc') && WCF::getUser()->personalbox_show_misc == 'disabled') {
                 $pbShowMisc = false;
             } else {
                 $pbShowMisc = PERSONALBOX_SHOW_MISC_ACP;
             }
         }
         $pbLinks = array();
         if ($pbShowMisc && defined('PERSONALBOX_LINKLIST_ACP') && PERSONALBOX_LINKLIST_ACP != '' && preg_match('/\\|/', PERSONALBOX_LINKLIST_ACP)) {
             $linkList = preg_split("/\r?\n/", PERSONALBOX_LINKLIST_ACP);
             $i = 0;
             foreach ($linkList as $line) {
                 $line = trim($line);
                 if (preg_match("/\\{SPACER\\}/", $line)) {
                     $pbLinks[$i]['TYPE'] = 'SPACER';
                     $pbLinks[$i]['SPACER'] = preg_replace("/\\{SPACER\\}(.*)\\{\\/SPACER\\}/i", "\$1", $line);
                     $i++;
                 } else {
                     if (preg_match("/\\|/", $line)) {
                         list($img, $url, $title, $target, $perm) = preg_split("/\\|/", $line, 5);
                         $img = trim($img);
                         $url = trim($url);
                         $title = trim($title);
                         $target = trim($target);
                         $perm = trim($perm);
                         if (!empty($url) && !empty($title)) {
                             if (preg_match("/\\{\\@?RELATIVE_WBB_DIR\\}/", $img) && defined('RELATIVE_WBB_DIR')) {
                                 $img = preg_replace("/{\\@?RELATIVE_WBB_DIR\\}/", RELATIVE_WBB_DIR, $img);
                             }
                             if (preg_match("/\\{\\@?RELATIVE_WCF_DIR\\}/", $img) && defined('RELATIVE_WCF_DIR')) {
                                 $img = preg_replace("/{\\@?RELATIVE_WCF_DIR\\}/", RELATIVE_WCF_DIR, $img);
                             }
                             if (preg_match("/\\{\\@?RELATIVE_WBB_DIR\\}/", $url) && defined('RELATIVE_WBB_DIR')) {
                                 $url = preg_replace("/{\\@?RELATIVE_WBB_DIR\\}/", RELATIVE_WBB_DIR, $url);
                             }
                             if (preg_match("/\\{\\@?RELATIVE_WCF_DIR\\}/", $url) && defined('RELATIVE_WCF_DIR')) {
                                 $url = preg_replace("/{\\@?RELATIVE_WCF_DIR\\}/", RELATIVE_WCF_DIR, $url);
                             }
                             if (preg_match("/\\{\\@?SECURITY_TOKEN\\}/", $url) && defined('SECURITY_TOKEN')) {
                                 $url = preg_replace("/{\\@?SECURITY_TOKEN\\}/", SECURITY_TOKEN, $url);
                             }
                             if (preg_match("/\\{\\@?PACKAGE_ID\\}/", $url) && defined('PACKAGE_ID')) {
                                 $url = preg_replace("/{\\@?PACKAGE_ID\\}/", PACKAGE_ID, $url);
                             }
                             if (preg_match("/\\{\\@?SID_ARG_2ND\\}/", $url) && defined('SID_ARG_2ND')) {
                                 $url = preg_replace("/{\\@?SID_ARG_2ND\\}/", SID_ARG_2ND, $url);
                             }
                             if (preg_match("/\\{\\@?USER_ID\\}/", $url)) {
                                 $url = preg_replace("/{\\@?USER_ID\\}/", WCF::getUser()->userID, $url);
                             }
                             $pbLinks[$i]['TYPE'] = 'LINK';
                             $pbLinks[$i]['IMG'] = $img;
                             $pbLinks[$i]['URL'] = $url;
                             $pbLinks[$i]['TITLE'] = $title;
                             $pbLinks[$i]['TARGET'] = $target;
                             $pbLinks[$i]['PERM'] = $perm;
                             $i++;
                         }
                     }
                 }
             }
         }
         // Wetter
         if (WCF::getUser()->getPermission('user.profile.personalbox.enableWeather')) {
             // Donnerwetter
             if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeather') && WCF::getUser()->personalbox_weather_enabled == 'enabled') {
                 $pbShowWeather = true;
             } else {
                 if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeather') && WCF::getUser()->personalbox_weather_enabled == 'disabled') {
                     $pbShowWeather = false;
                 } else {
                     $pbShowWeather = PERSONALBOX_WEATHER_SHOW_ACP;
                 }
             }
             // PLZ fuer Donnerwetter
             if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeatherZip') && preg_match("/^[0-9]{4,5}\$/", WCF::getUser()->personalbox_weather_zipcode)) {
                 $pbWeatherZipCode = WCF::getUser()->personalbox_weather_zipcode;
             } else {
                 if (preg_match("/^[0-9]{4,5}\$/", PERSONALBOX_WEATHER_ZIPCODE_ACP)) {
                     $pbWeatherZipCode = PERSONALBOX_WEATHER_ZIPCODE_ACP;
                 }
             }
             // Style fuer Donnerwetter...
             if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeatherStyle') && preg_match("/^1|2\$/", WCF::getUser()->personalbox_weather_style)) {
                 $pbWeatherStyle = WCF::getUser()->personalbox_weather_style;
             } else {
                 if (preg_match("/^1|2\$/", PERSONALBOX_WEATHER_STYLE_ACP)) {
                     $pbWeatherStyle = PERSONALBOX_WEATHER_STYLE_ACP;
                 }
             }
             // wetter.com
             if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeather') && WCF::getUser()->personalbox_weathercom_enabled == 'enabled') {
                 $pbShowWeatherCom = true;
             } else {
                 if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeather') && WCF::getUser()->personalbox_weathercom_enabled == 'disabled') {
                     $pbShowWeatherCom = false;
                 } else {
                     $pbShowWeatherCom = PERSONALBOX_WEATHERCOM_SHOW_ACP;
                 }
             }
             if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeatherZip') && preg_match("/^.*\\,.*\$/", WCF::getUser()->personalbox_weathercom_zipcode)) {
                 $pbWeatherComZipCode = WCF::getUser()->personalbox_weathercom_zipcode;
             } else {
                 if (preg_match("/^.*\\,.*\$/", PERSONALBOX_WEATHERCOM_ZIPCODE_ACP)) {
                     $pbWeatherComZipCode = PERSONALBOX_WEATHERCOM_ZIPCODE_ACP;
                 }
             }
             if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeatherStyle') && preg_match("/^[1-5]\$/", WCF::getUser()->personalbox_weathercom_style)) {
                 $pbWeatherComStyle = WCF::getUser()->personalbox_weathercom_style;
             } else {
                 if (preg_match("/^[1-5]\$/", PERSONALBOX_WEATHERCOM_STYLE_ACP)) {
                     $pbWeatherComStyle = PERSONALBOX_WEATHERCOM_STYLE_ACP;
                 }
             }
             if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeatherStyle') && preg_match("/^Z|C|F\$/", WCF::getUser()->personalbox_weathercom_day)) {
                 $pbWeatherComDay = WCF::getUser()->personalbox_weathercom_day;
             } else {
                 if (preg_match("/^Z|C|F\$/", PERSONALBOX_WEATHERCOM_DAY_ACP)) {
                     $pbWeatherComDay = PERSONALBOX_WEATHERCOM_DAY_ACP;
                 }
             }
         }
         // setze Timestamp genau auf 0.00 Uhr...
         if (WCF::getUser()->getPermission('user.profile.personalbox.canSetCurPosts') && WCF::getUser()->personalbox_search_days != 'default') {
             $pbSearchDays = intval(WCF::getUser()->personalbox_search_days);
         } else {
             $pbSearchDays = PERSONALBOX_SEARCH_DAYS_ACP;
         }
         if ($pbSearchDays == 0) {
             $itstamp = time();
         } else {
             $itstamp = time() - $pbSearchDays * 86400;
         }
         $searchTime = mktime(0, 0, 0, (int) date("m", $itstamp), (int) date("d", $itstamp), (int) date("Y", $itstamp));
         // Hintergrundfarbe fuer Donnerwetter...
         if (preg_match("/^[a-f0-9]{6}\$/i", PERSONALBOX_WEATHER_BGCOLOR_ACP)) {
             $bgColor = strtoupper(PERSONALBOX_WEATHER_BGCOLOR_ACP);
         } else {
             $bgColor = strtoupper(WBBCore::getStyle()->getVariable('container1.background.color'));
             $bgColor = preg_replace("/\\#/", "", $bgColor);
             if (strlen($bgColor) < 6 && strlen($bgColor) > 0) {
                 $bgColor = str_pad($bgColor, 6, substr($bgColor, -1, 1));
             }
         }
         // Rahmenfarbe fuer Donnerwetter...
         if (preg_match("/^[a-f0-9]{6}\$/i", PERSONALBOX_WEATHER_BOCOLOR_ACP)) {
             $boColor = strtoupper(PERSONALBOX_WEATHER_BOCOLOR_ACP);
         } else {
             $boColor = $bgColor;
         }
         // Textfarbe fuer Donnerwetter...
         if (preg_match("/^[a-f0-9]{6}\$/i", PERSONALBOX_WEATHER_TEXTCOLOR_ACP)) {
             $textColor = strtoupper(PERSONALBOX_WEATHER_TEXTCOLOR_ACP);
         } else {
             $textColor = strtoupper(WBBCore::getStyle()->getVariable('container1.font.color'));
             $textColor = preg_replace("/\\#/", "", $textColor);
             if (strlen($textColor) < 6 && strlen($textColor) > 0) {
                 $textColor = str_pad($textColor, 6, substr($textColor, -1, 1));
             }
         }
         // Standardfarben, falls bis hierhin keine zugeordnet...
         if (empty($bgColor)) {
             $bgColor = 'FFFFFF';
         }
         if (empty($boColor)) {
             $boColor = 'FFFFFF';
         }
         if (empty($textColor)) {
             $textColor = '000000';
         }
         $boardIDs = Board::getAccessibleBoards();
         $user = new UserProfile(WCF::getUser()->userID);
         // RANK
         if ($user->rankImage) {
             if (PERSONALBOX_REPEATRANKIMAGE_ACP && $user->repeatImage) {
                 $pbRankImage = '';
                 for ($i = 0; $i < $user->repeatImage; $i++) {
                     $pbRankImage .= '<img src="' . RELATIVE_WCF_DIR . $user->rankImage . '" alt="" title="' . WCF::getLanguage()->get($user->rankTitle) . '" />';
                 }
             } else {
                 $pbRankImage = '<img src="' . RELATIVE_WCF_DIR . $user->rankImage . '" alt="" title="' . WCF::getLanguage()->get($user->rankTitle) . '" />';
             }
         }
         $user->username = StringUtil::encodeHTML(WCF::getUser()->username);
         $user->searchTime = $searchTime;
         $user->bgColor = $bgColor;
         $user->boColor = $boColor;
         $user->textColor = $textColor;
         $user->posts = 0;
         $user->cntNewPosts = 0;
         $user->cntLastPosts = 0;
         $user->cntReported = 0;
         $user->cntSub = 0;
         if (WCF::getUser()->getPermission('user.profile.personalbox.cntOwnPosts')) {
             // Anzahl Postings...
             $sql = "SELECT wbu.posts" . "\n  FROM wbb" . WBB_N . "_user wbu" . "\n WHERE wbu.userid = " . WCF::getUser()->userID;
             $result = WBBCore::getDB()->getFirstRow($sql);
             $user->posts = StringUtil::formatInteger($result['posts']);
         }
         // Instant Messenger by Tatzelwurm
         if (INSTANTMESSENGER_AKTIV && (WCF::getUser()->getPermission('user.board.instantmessenger.canUseInstantMessenger') || WCF::getUser()->getPermission('user.instantmessenger.canUseInstantMessenger'))) {
             if (@(require_once WCF_DIR . 'lib/data/InstantMessage/IM.class.php')) {
                 if (WCF::getUser()->getPermission('user.profile.personalbox.canSetIM') && WCF::getUser()->personalbox_show_im == 'enabled') {
                     $pbShowIM = true;
                 } else {
                     if (WCF::getUser()->getPermission('user.profile.personalbox.canSetIM') && WCF::getUser()->personalbox_show_im == 'disabled') {
                         $pbShowIM = false;
                     } else {
                         $pbShowIM = PERSONALBOX_SHOW_IM_ACP;
                     }
                 }
                 $imcount = IM::countNewIM();
             }
         }
         // userOnlineMarking...
         if (PERSONALBOX_SHOWUSERMARKING_ACP) {
             $sql = "SELECT wcg.userOnlineMarking" . "\n  FROM wcf" . WCF_N . "_group wcg" . "\n  JOIN wcf" . WCF_N . "_user wcu ON (wcu.userOnlineGroupID = wcg.groupID)" . "\n WHERE wcu.userID = " . WCF::getUser()->userID;
             $result = WBBCore::getDB()->getFirstRow($sql);
             $userOnlineMarking = $result['userOnlineMarking'];
             if ($userOnlineMarking && $userOnlineMarking != '%s') {
                 $user->username = sprintf($userOnlineMarking, StringUtil::encodeHTML(WCF::getUser()->username));
             }
         }
         // neue Beitraege seit letztem Besuch und n Tagen, Abonnements...
         if ($pbShowSearch) {
             if (WCF::getUser()->getPermission('user.profile.personalbox.cntCurPosts')) {
                 $sql = "SELECT COUNT(*) cntNewPosts" . "\n  FROM wbb" . WBB_N . "_thread wbt" . "\n WHERE wbt.boardID IN (0" . $boardIDs . ")" . "\n   AND wbt.lastPostTime >= " . WCF::getUser()->boardLastActivityTime;
                 $result = WBBCore::getDB()->getFirstRow($sql);
                 $user->cntNewPosts = $result['cntNewPosts'];
             }
             if (WCF::getUser()->getPermission('user.profile.personalbox.cntLastPosts')) {
                 $sql = "SELECT COUNT(*) cntLastPosts" . "\n  FROM wbb" . WBB_N . "_thread wbt" . "\n WHERE wbt.boardID IN (0" . $boardIDs . ")" . "\n   AND wbt.lastPostTime >= " . $searchTime;
                 $result = WBBCore::getDB()->getFirstRow($sql);
                 $user->cntLastPosts = $result['cntLastPosts'];
             }
             if (WCF::getUser()->getPermission('user.profile.personalbox.cntSubscriptions')) {
                 $sql = "SELECT COUNT(*) AS newSubscriptions" . "\n  FROM wbb" . WBB_N . "_thread_subscription subscription" . "\n  JOIN wbb" . WBB_N . "_thread thread ON (thread.threadID = subscription.threadID)" . "\n  JOIN\twbb" . WBB_N . "_thread_visit thread_visit ON (thread_visit.threadID = subscription.threadID AND subscription.userID = thread_visit.userID)" . "\n  JOIN\twbb" . WBB_N . "_board_visit board_visit ON (board_visit.boardID = thread.boardID AND subscription.userID = board_visit.userID)" . "\n WHERE subscription.userID = " . WCF::getUser()->userID . "\n   AND thread_visit.lastVisitTime < thread.lastPostTime" . "\n   AND (thread_visit.lastVisitTime > board_visit.lastVisitTime" . "\n    OR board_visit.lastVisitTime < thread.lastPostTime" . "\n    OR board_visit.lastVisitTime IS NULL)" . "\n GROUP BY subscription.userID";
                 $result = WBBCore::getDB()->getFirstRow($sql);
                 $user->cntSub = intval($result['newSubscriptions']);
             }
         }
         // Moderation...
         if ($pbShowUserCP && (WCF::getUser()->getPermission('admin.general.canUseAcp') || WCF::getUser()->getPermission('mod.board.canDeleteThreadCompletely') || WCF::getUser()->getPermission('mod.board.canDeletePostCompletely') || WCF::getUser()->getPermission('mod.board.canEnablePost') || WCF::getUser()->getPermission('mod.board.canEnableThread'))) {
             if (WCF::getUser()->getPermission('admin.general.canUseAcp') || WCF::getUser()->getPermission('mod.board.canEnablePost') || WCF::getUser()->getPermission('mod.board.canEnableThread')) {
                 $sql = "SELECT COUNT(*) cntReported" . "\n  FROM wbb" . WBB_N . "_post_report wbr";
                 $result = WBBCore::getDB()->getFirstRow($sql);
                 $user->cntReported = $result['cntReported'];
             }
             if (WCF::getUser()->getPermission('admin.general.canUseAcp') || WCF::getUser()->getPermission('mod.board.canDeleteThreadCompletely') || WCF::getUser()->getPermission('mod.board.canDeletePostCompletely')) {
                 $sql = "SELECT COUNT(*) cntTrash" . "\n  FROM wbb" . WBB_N . "_post wbp" . "\n  JOIN wbb" . WBB_N . "_thread wbt ON (wbt.threadID = wbp.threadID)" . "\n WHERE wbt.boardID IN (0" . $boardIDs . ")" . "\n   AND (wbp.isDeleted > 0 OR wbt.isDeleted > 0)";
                 $result = WBBCore::getDB()->getFirstRow($sql);
                 $user->cntTrash = $result['cntTrash'];
             }
         }
         // Guestbook
         $user->cntGB = 0;
         if (WCF::getUser()->getPermission('user.guestbook.canUseOwn')) {
             $sql = "SELECT entries, userLastVisit, lastEntry" . "\n  FROM wcf" . WCF_N . "_user_guestbook_header" . "\n WHERE userID = " . WCF::getUser()->userID;
             $result = WBBCore::getDB()->getFirstRow($sql);
             $user->cntGB = empty($result['entries']) ? 0 : $result['entries'];
             if (!empty($result['lastEntry']) && $result['lastEntry'] > $result['userLastVisit']) {
                 $user->newGB = true;
             } else {
                 $user->newGB = false;
             }
         }
         $this->BoxData['user'] = $user;
     }
     // Template Variablen zuordnen...
     WCF::getTPL()->assign(array('pbCatVertOffset' => intval(PERSONALBOX_CATSPACER_ACP), 'pbFirstBoxColor' => intval(PERSONALBOX_FBCOLOR_ACP), 'pbSecondBoxColor' => intval(PERSONALBOX_SBCOLOR_ACP), 'pbFirstColWidth' => intval(PERSONALBOX_FIRSTCOLWIDTH_ACP), 'pbTableWidth' => PERSONALBOX_TABLEWIDTH_ACP, 'pbCellPadding' => intval(PERSONALBOX_CELLPADDING_ACP), 'pbLargeImages' => PERSONALBOX_LARGERANKIMAGES_ACP, 'pbShowIP' => WCF::getUser()->getPermission('user.profile.personalbox.showIP') && WBBCore::getSession()->ipAddress ? WBBCore::getSession()->ipAddress : 0, 'pbStyleWidth' => PERSONALBOX_STYLEBOXWIDTH_ACP, 'pbLineFeedRank' => PERSONALBOX_LINEFEEDRANK_ACP, 'pbShowProfileLink' => PERSONALBOX_SHOWPROFILELINK_ACP, 'pbShowDisplayLink' => PERSONALBOX_SHOWDISPLAYLINK_ACP, 'pbRankImage' => $pbRankImage, 'pbMaxHeight' => $pbMaxHeight, 'pbShowAvatar' => $pbShowAvatar, 'pbAvatarMaxWidth' => PERSONALBOX_AVATARMAXWIDTH_ACP, 'pbAvatarMaxHeight' => PERSONALBOX_AVATARMAXHEIGHT_ACP, 'pbShowPersonal' => $pbShowPersonal, 'pbShowSearch' => $pbShowSearch, 'pbShowPM' => $pbShowPM, 'pbShowUserCP' => $pbShowUserCP, 'pbShowStyles' => $pbShowStyles, 'pbShowMisc' => $pbShowMisc, 'pbShowWeather' => $pbShowWeather, 'pbWeatherZipCode' => $pbWeatherZipCode, 'pbWeatherComZipCode' => $pbWeatherComZipCode, 'pbWeatherStyle' => $pbWeatherStyle, 'pbWeatherComStyle' => $pbWeatherComStyle, 'pbWeatherWidth' => $pbWeatherWidth, 'pbShowWeatherCom' => $pbShowWeatherCom, 'pbWeatherComDay' => $pbWeatherComDay, 'pbLinks' => isset($pbLinks) ? $pbLinks : array(), 'pbStyles' => isset($pbStyles) ? $pbStyles : array(), 'imcount' => $imcount, 'pbShowIM' => $pbShowIM, 'pbShowProfileHits' => PERSONALBOX_SHOW_PROFILEHITS_ACP, 'boxCurPage' => $boxCurPage));
 }
 /**
  * Creates a valid block for the report.
  * 
  * @param	array	data
  * @return	string
  */
 protected function createBlock($data)
 {
     $block = '';
     $dataSets = array();
     foreach ($data as $date) {
         $dataSets[] = '<td>' . $date['name'] . '</td><td id="' . $date['id'] . '">' . StringUtil::formatInteger($date['count']) . '</td>';
     }
     $rows = array_chunk($dataSets, $this->colCount);
     foreach ($rows as $row) {
         $block .= '<tr>';
         foreach ($row as $dataSet) {
             $block .= $dataSet;
         }
         $block .= '</tr>';
     }
     return $block;
 }
示例#12
0
        }
        $parse['FLOTA_TEST'] = $user['authlevel'] == 1 || $user['authlevel'] == 3 ? '<tr><td><div align="center"><font color="#FFFFFF"><a href="buildings.php?mode=fleet" accesskey="u" target="{mf}">KLIKNIJ TUTAJ NA TEST FLOTY</a></font></div></td></tr>
' : '';
        $parse = $lang;
        $parse['moon_img'] = "";
        $parse['moon'] = "";
        //}
        $moon = WCF::getDB()->getFirstRow("SELECT * FROM ugml" . LW_N . "_planets WHERE galaxy = '" . $planetrow['galaxy'] . "' AND system = '" . $planetrow['system'] . "' AND planet = '" . $planetrow['planet'] . "' AND planet_type = '3'");
        if (intval($moon['galaxy']) && WCF::getUser()->planetClassName == 'UserPlanet') {
            $parse['moon'] = $moon['name'] . '<br /><a href="overview.php?cp=' . $moon['id'] . '&re=0"><img src="' . $dpath . 'planeten/small/s_' . $moon['image'] . '.jpg" height="50" width="50" /></a>';
        }
        $parse['planet_name'] = $planetrow['name'];
        $parse['planet_diameter'] = $planetrow['diameter'];
        $parse['planet_field_current'] = LWCore::getPlanet()->getUsedFields();
        $parse['planet_field_max'] = LWCore::getPlanet()->getMaxFields();
        //$parse['planet_field_max'] = 10;
        $parse['planet_temp_min'] = $planetrow['temp_min'];
        $parse['planet_temp_max'] = $planetrow['temp_max'];
        $parse['galaxy_galaxy'] = $planetrow['galaxy'];
        $parse['galaxy_planet'] = $planetrow['planet'];
        $parse['galaxy_system'] = $planetrow['system'];
        $parse['user_points'] = StringUtil::formatInteger(intval(WCF::getUser()->wotPoints));
        //$parse['user_fleet'] = pretty_number($user['points_fleet_old']/1000); + pretty_number($user['points_builds2']/1000);
        //$parse['user_buili'] = pretty_number($user['points_builds']/1000);
        //$parse['player_points_tech'] = pretty_number($user['points_tech_old']/1000);
        $parse['user_rank'] = intval(WCF::getUser()->wotRank);
        $ile = $user['rank_old'] - $user['rank'];
        if ($ile >= 1) {
            $parse['ile'] = "<font color=lime>+" . $ile . "</font>";
        }
        if ($ile < 0) {
 /**
  * Generates html code of a link.
  * 
  * @param 	string		$link
  * @param 	integer		$pageNo
  * @return	string
  */
 protected function makeLink($link, $pageNo)
 {
     return '<li><a href="' . $this->insertPageNumber($link, $pageNo) . '" title="' . WCF::getLanguage()->getDynamicVariable('wcf.page.pageNo', array('pageNo' => $pageNo)) . '">' . StringUtil::formatInteger($pageNo) . '</a></li>' . "\n";
 }
 public function getGuestbookList($sortField = 'lastEntry', $sortOrder = 'DESC', $pageNo = 1, $itemsPerPage = 20)
 {
     $ret = array();
     $i = 0;
     $optID = self::getOptionID('userGuestbook_enable');
     if (preg_match('/(userID|avatarID)/', $sortField)) {
         $sortField = 'u.' . $sortField;
     }
     require_once WCF_DIR . 'lib/data/user/avatar/Avatar.class.php';
     $gbUserIDs = 0;
     $sql = "SELECT ugb.*, u.*, rank.*, a.*, uo.*, leu.username AS lastEntryUser, lv.username AS lastVisitor" . "\n  FROM wcf" . WCF_N . "_user_guestbook_header ugb" . "\n  JOIN wcf" . WCF_N . "_user u ON (u.userID = ugb.userID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user leu ON (leu.userID = ugb.lastEntryUserID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user lv ON (lv.userID = ugb.visitorID)" . "\n  LEFT JOIN wcf" . WCF_N . "_avatar a ON (a.avatarID = u.avatarID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user_rank rank ON (rank.rankID = u.rankID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user_option_value uo ON (uo.userID = u.userID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user_option_value ov ON (ov.userID = ugb.userID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user_to_groups ug ON (ug.userID = ugb.userID)" . "\n  LEFT JOIN wcf" . WCF_N . "_group_option_value gv ON (gv.groupID = ug.groupID)" . "\n  LEFT JOIN wcf" . WCF_N . "_group_option go ON (go.optionID = gv.optionID)" . "\n WHERE ov.userOption" . $optID . " = '1'" . "\n   AND gv.optionValue = '1'" . "\n   AND go.optionName = 'user.guestbook.canUseOwn'";
     if (!WCF::getUser()->getPermission('mod.guestbook.canLock')) {
         $sql .= "\n   AND ugb.locked != 1";
         $sql .= "\n   AND ugb.entries > 0";
     } else {
         $sql .= "\n   AND (ugb.locked = 1 OR ugb.entries > 0)";
     }
     $sql .= "\n GROUP BY ugb.userID, ugb.userLastVisit, ugb.lastEntryUserID, ugb.lastEntry, ugb.entries, ugb.newEntries, ugb.views, ugb.visitorID, ugb.visitorLastVisit, ugb.locked, ugb.lockTime, ugb.lockUserID" . "\n ORDER BY " . $sortField . " " . $sortOrder . "\n LIMIT " . $itemsPerPage . "\nOFFSET " . ($pageNo - 1) * $itemsPerPage;
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $user = new UserProfile(null, $row);
         if (!$user->userGuestbook_enable) {
             continue;
         }
         $gbUserIDs .= ',' . $row['userID'];
         $ret[$i]['curUserEntry'] = false;
         $ret[$i]['userID'] = $row['userID'];
         $ret[$i]['userLastVisit'] = $row['userLastVisit'];
         $ret[$i]['userLastCommentTime'] = $row['userLastCommentTime'];
         $ret[$i]['lastEntry'] = $row['lastEntry'];
         $ret[$i]['visitorLastVisit'] = $row['visitorLastVisit'];
         $ret[$i]['entries'] = StringUtil::formatInteger($row['entries']);
         $ret[$i]['newEntries'] = StringUtil::formatInteger($row['newEntries']);
         $ret[$i]['views'] = StringUtil::formatInteger($row['views']);
         $ret[$i]['locked'] = $row['locked'];
         if (empty($row['lastEntryUser'])) {
             $ret[$i]['lastEntryUser'] = StringUtil::encodeHTML($row['lastEntryUsername']);
             $ret[$i]['lastEntryUserID'] = 0;
         } else {
             $ret[$i]['lastEntryUser'] = StringUtil::encodeHTML($row['lastEntryUser']);
             $ret[$i]['lastEntryUserID'] = $row['lastEntryUserID'];
         }
         $ret[$i]['lastVisitor'] = StringUtil::encodeHTML($row['lastVisitor']);
         $ret[$i]['lastVisitorID'] = $row['visitorID'];
         // username
         $username = StringUtil::encodeHTML($row['username']);
         $protectedProfile = $user->protectedProfile && WCF::getUser()->userID != $user->userID;
         $userData = array('user' => $user, 'encodedUsername' => $username, 'protectedProfile' => $protectedProfile);
         $userData['username'] = '******';
         if ($user->isOnline()) {
             $title = WCF::getLanguage()->get('wcf.user.online', array('$username' => $username));
             $userData['username'] .= '<img src="' . RELATIVE_WCF_DIR . 'icon/onlineS.png" alt="' . $title . '" title="' . $title . '" />';
         } else {
             $title = WCF::getLanguage()->get('wcf.user.offline', array('$username' => $username));
             $userData['username'] .= '<img src="' . RELATIVE_WCF_DIR . 'icon/offlineS.png" alt="' . $title . '" title="' . $title . '" />';
         }
         $userData['username'] .= '</div><div class="containerContentSmall">';
         $title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $username));
         $userData['username'] .= '<p><a href="index.php?page=User&amp;userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $username . '</a></p>';
         if ($user->getUserTitle()) {
             $userData['username'] .= '<p class="smallFont">' . $user->getUserTitle() . ' ' . ($user->getRank() ? $user->getRank()->getImage() : '') . '</p>';
         }
         $userData['username'] .= '</div>';
         $ret[$i]['username'] = $userData['username'];
         // avatar
         if (empty($row['disableAvatar']) && !empty($row['avatarID']) && !empty($row['avatarExtension'])) {
             $avatar = new Avatar(null, $row);
             $avatar->setMaxHeight(50);
             $title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $row['username']));
             $ret[$i]['avatar'] = '<a href="index.php?page=User&amp;userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $avatar->__toString() . '</a>';
         } else {
             $ret[$i]['avatar'] = '&nbsp;';
         }
         $i++;
     }
     if (!empty($gbUserIDs) && WCF::getUser()->userID) {
         $sql = "SELECT DISTINCT userID" . "\n  FROM wcf" . WCF_N . "_user_guestbook" . "\n WHERE userID IN (" . $gbUserIDs . ")" . "\n   AND fromUserID = " . WCF::getUser()->userID;
         $result = WCF::getDB()->sendQuery($sql);
         while ($row = WCF::getDB()->fetchArray($result)) {
             foreach ($ret as $k => $v) {
                 if ($ret[$k]['userID'] == $row['userID']) {
                     $ret[$k]['curUserEntry'] = true;
                 }
             }
         }
     }
     return $ret;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.user.canPMToUserGroups');
     $sql = "SELECT COUNT(DISTINCT u.userID) AS cnt" . "\n  FROM wcf" . WCF_N . "_user u" . "\n  LEFT JOIN wcf" . WCF_N . "_user_to_groups g ON (g.userID = u.userID)" . "\n  LEFT JOIN wcf" . WCF_N . "_group_option_value v ON (v.groupID = g.groupID)" . "\n  LEFT JOIN wcf" . WCF_N . "_group_option o ON (o.optionID = v.optionID)" . "\n WHERE o.optionName = 'user.pm.canUsePm'" . "\n   AND v.optionValue = '1'" . "\n   AND u.userID != " . $this->userID . "\n   AND g.groupID IN (" . $this->pmData['groupIDs'] . ")";
     $row = WCF::getDB()->getFirstRow($sql);
     $count = $row['cnt'];
     if (!$count > 0) {
         // clear session
         if (isset($this->pmData)) {
             $pmData = WCF::getSession()->getVar('pmData');
             unset($pmData[$this->pmSessionID]);
             WCF::getSession()->register('pmData', $pmData);
         }
         $this->finish('wcf.pmToUgrps.error.noRecipients', 'index.php?form=PMToUserGroups&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     }
     if ($count <= $this->limit * $this->loop) {
         $endTime = TIME_NOW;
         $lf = "\n";
         // remove from outbox
         $sql = "UPDATE wcf" . WCF_N . "_pm" . "\n   SET saveInOutbox = 0" . "\n WHERE pmID = " . $this->pmID;
         WCF::getDB()->sendQuery($sql);
         // groups...
         $groups = '';
         $sql = "SELECT groupName" . "\n  FROM wcf" . WCF_N . "_group" . "\n WHERE groupID IN (" . $this->pmData['groupIDs'] . ")" . "\n ORDER BY groupName";
         $result = WCF::getDB()->sendQuery($sql);
         while ($row = WCF::getDB()->fetchArray($result)) {
             if (!empty($groups)) {
                 $groups .= ', ';
             }
             $groups .= StringUtil::decodeHTML($row['groupName']);
         }
         // log...
         $log = '';
         $subject = WCF::getLanguage()->get('wcf.pmToUgrps.log.subject', array('$pmID' => $this->pmID)) . ' ' . $this->pmData['subject'];
         if ($this->pmData['enableHtml']) {
             $log .= '<pre>';
         }
         $log .= WCF::getLanguage()->get('wcf.pmToUgrps.log.started', array('$startTime' => DateUtil::formatDate('%d.%m.%Y %H:%M:%S', $this->pmData['startTime']))) . $lf;
         $log .= WCF::getLanguage()->get('wcf.pmToUgrps.log.finished', array('$endTime' => DateUtil::formatDate('%d.%m.%Y %H:%M:%S', $endTime))) . $lf;
         $log .= WCF::getLanguage()->get('wcf.pmToUgrps.log.recipients', array('$groups' => $groups, '$count' => StringUtil::decodeHTML(StringUtil::formatInteger($count)))) . $lf;
         $log .= str_repeat('-', 60) . $lf;
         if ($this->pmData['enableHtml']) {
             $log .= '</pre>' . $lf;
         }
         $log .= $this->pmData['text'];
         $this->recipientArray = $this->blindCopyArray = array();
         $this->recipientArray[0]['userID'] = $this->userID;
         $this->recipientArray[0]['username'] = $this->username;
         PMEditor::create($this->draft, $this->recipientArray, $this->blindCopyArray, $subject, $log, $this->userID, $this->username, array('enableSmilies' => $this->pmData['enableSmilies'], 'enableHtml' => $this->pmData['enableHtml'], 'enableBBCodes' => $this->pmData['enableBBCodes'], 'showSignature' => false));
         // clear session
         $pmData = WCF::getSession()->getVar('pmData');
         unset($pmData[$this->pmSessionID]);
         WCF::getSession()->register('pmData', $pmData);
         $this->calcProgress();
         $msg = WCF::getLanguage()->get('wcf.pmToUgrps.finish', array('$count' => StringUtil::decodeHTML(StringUtil::formatInteger($count)), '$startTime' => DateUtil::formatShortTime('%H:%M:%S', $this->pmData['startTime']), '$endTime' => DateUtil::formatShortTime('%H:%M:%S', $endTime)));
         $this->finish($msg, 'index.php?form=PMToUserGroups&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     }
     // get users
     $sql = "SELECT DISTINCT u.userID, u.username" . "\n  FROM wcf" . WCF_N . "_user u" . "\n  LEFT JOIN wcf" . WCF_N . "_user_to_groups g ON (g.userID = u.userID)" . "\n  LEFT JOIN wcf" . WCF_N . "_group_option_value v ON (v.groupID = g.groupID)" . "\n  LEFT JOIN wcf" . WCF_N . "_group_option o ON (o.optionID = v.optionID)" . "\n WHERE o.optionName = 'user.pm.canUsePm'" . "\n   AND v.optionValue = '1'" . "\n   AND u.userID != " . $this->userID . "\n   AND g.groupID IN (" . $this->pmData['groupIDs'] . ")" . "\n ORDER BY u.userID";
     $this->blindCopyArray = array();
     $i = 0;
     $result = WCF::getDB()->sendQuery($sql, $this->limit, $this->limit * $this->loop);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $this->blindCopyArray[$i]['userID'] = $row['userID'];
         $this->blindCopyArray[$i]['username'] = $row['username'];
         $i++;
     }
     if (count($this->blindCopyArray)) {
         if (empty($this->pmID)) {
             $tmp = PMEditor::create($this->draft, $this->recipientArray, $this->blindCopyArray, $this->pmData['subject'], $this->pmData['text'], $this->userID, $this->username, array('enableSmilies' => $this->pmData['enableSmilies'], 'enableHtml' => $this->pmData['enableHtml'], 'enableBBCodes' => $this->pmData['enableBBCodes'], 'showSignature' => $this->pmData['showSignature']));
             if ($tmp->pmID) {
                 $this->pmID = intval($tmp->pmID);
                 $pmData = WCF::getSession()->getVar('pmData');
                 $pmData[$this->pmSessionID]['pmID'] = $this->pmID;
                 WCF::getSession()->register('pmData', $pmData);
                 $mlt = intval($this->pmData['maxLifeTime']);
                 if ($mlt > 0) {
                     $mlt = $this->pmData['startTime'] + 86400 * $mlt;
                 } else {
                     $mlt = 0;
                 }
                 $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_pm_bulk_mailing" . "\n       (pmID, elapsedTime, time, userID)" . "\nVALUES (" . $this->pmID . ", " . $mlt . ", " . $this->pmData['startTime'] . ", " . $this->userID . ")";
                 WCF::getDB()->sendQuery($sql);
             }
         } else {
             $recipientIDs = $inserts = '';
             foreach ($this->blindCopyArray as $k => $v) {
                 $username = WCF::getDB()->escapeString($this->blindCopyArray[$k]['username']);
                 if (!empty($recipientIDs)) {
                     $recipientIDs .= ',';
                 }
                 $recipientIDs .= $this->blindCopyArray[$k]['userID'];
                 if (!empty($inserts)) {
                     $inserts .= ',';
                 }
                 $inserts .= "\n       (" . $this->pmID . ", " . intval($this->blindCopyArray[$k]['userID']) . ", '" . $username . "', 1)";
             }
             if (!empty($recipientIDs) && !empty($inserts)) {
                 $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_pm_to_user" . "\n       (pmID, recipientID, recipient, isBlindCopy)" . "\nVALUES " . $inserts;
                 WCF::getDB()->sendQuery($sql);
                 PMEditor::updateUnreadMessageCount($recipientIDs);
                 PMEditor::updateTotalMessageCount($recipientIDs);
                 Session::resetSessions($recipientIDs, true, false);
             }
         }
     }
     $this->executed();
     $this->calcProgress($this->limit * $this->loop, $count);
     $msg = WCF::getLanguage()->get('wcf.pmToUgrps.progress', array('$loop' => StringUtil::decodeHTML(StringUtil::formatInteger($this->limit * $this->loop)), '$count' => StringUtil::decodeHTML(StringUtil::formatInteger($count))));
     $this->nextLoop($msg, 'index.php?action=' . $this->action . '&pmSessionID=' . $this->pmSessionID . '&limit=' . $this->limit . '&loop=' . ($this->loop + 1) . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
 }
示例#16
0
 public function cronRunJournal($pmDelCnt = 0, $cLog = 0, $cStat = 0, $cAdminMail = 0)
 {
     if (!empty($cLog) || !empty($cStat)) {
         require_once WCF_DIR . 'lib/data/mail/Mail.class.php';
         require_once WCF_DIR . 'lib/data/user/User.class.php';
         require_once WCF_DIR . 'lib/system/language/Language.class.php';
         $pR = 45;
         $pL = 35;
         // get default language
         $sql = "SELECT languageID" . "\n  FROM wcf" . WCF_N . "_language" . "\n WHERE isDefault = 1";
         $tmp = WCF::getDB()->getFirstRow($sql);
         $lang = $tmp['languageID'] == WCF::getLanguage()->getLanguageID() ? WCF::getLanguage() : new Language($tmp['languageID']);
         $useStrftime = DateUtil::$useStrftime;
         DateUtil::$useStrftime = $lang->get('wcf.global.dateMethod') == 'strftime';
         $currentDate = DateUtil::formatDate($lang->get('wcf.global.dateFormat'), TIME_NOW);
         $previousDayStart = mktime(0, 0, 0, (int) date("m", TIME_NOW), (int) date("d", TIME_NOW) - 1, (int) date("Y", TIME_NOW));
         $previousDayEnd = mktime(0, 0, -1, (int) date("m", TIME_NOW), (int) date("d", TIME_NOW), (int) date("Y", TIME_NOW));
         $logDate = DateUtil::formatDate($lang->get('wcf.global.dateFormat'), $previousDayStart);
         $spacer = str_repeat('-', 80);
         $mailUserHeader = "\n" . self::str_pad("USER", 26, " ") . self::str_pad("USERID", 12, " ", STR_PAD_LEFT) . "    " . self::str_pad("REG-DATE", 20, " ") . "LAST-ACTIVE" . "\n" . $spacer;
         $subject = $lang->get('wcf.acp.adminTools.cron.mail.subject', array('PAGE_TITLE' => PAGE_TITLE, '$currentDate' => $currentDate));
         $message = $lang->get('wcf.acp.adminTools.cron.mail.header', array('PAGE_TITLE' => PAGE_TITLE));
         // log -----------------------------------------
         if (!empty($cLog)) {
             $message .= "\n\n" . $spacer;
             $message .= "\n" . $lang->get('wcf.acp.adminTools.cron.mail.logHeader', array('$logDate' => $logDate));
             $message .= "\n" . $spacer;
             // deleted PMs -----------------------------
             if (!empty($pmDelCnt)) {
                 $message .= "\n\n" . $lang->get('wcf.acp.adminTools.cron.mail.statsCntDeletedPMs') . ' ' . StringUtil::decodeHTML(StringUtil::formatInteger($pmDelCnt));
             }
             // registrations ---------------------------
             $mailMsg = '';
             $cnt = 0;
             $sql = "SELECT userID" . "\n  FROM wcf" . WCF_N . "_user" . "\n WHERE registrationDate >= " . $previousDayStart . "\n   AND registrationDate <= " . $previousDayEnd . "\n ORDER BY LOWER(username)";
             $result = WCF::getDB()->sendQuery($sql);
             while ($row = WCF::getDB()->fetchArray($result)) {
                 $user = new User($row['userID']);
                 $cnt++;
                 $mailMsg .= "\n" . self::str_pad(StringUtil::encodeHTML($user->username), 26, " ") . self::str_pad($user->userID, 12, " ", STR_PAD_LEFT) . "    " . self::str_pad(DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->registrationDate), 20, " ") . DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->lastActivityTime);
             }
             $message .= "\n\n";
             $message .= $lang->get('wcf.acp.adminTools.cron.mail.registrations') . ' ' . $cnt . $mailUserHeader;
             if (!empty($cnt)) {
                 $message .= $mailMsg;
             } else {
                 $message .= "\n-";
             }
             // user quits ------------------------------
             $mailMsg = '';
             $cnt = 0;
             $sql = "SELECT userID" . "\n  FROM wcf" . WCF_N . "_user" . "\n WHERE quitStarted > 0" . "\n ORDER BY LOWER(username)";
             $result = WCF::getDB()->sendQuery($sql);
             while ($row = WCF::getDB()->fetchArray($result)) {
                 $user = new User($row['userID']);
                 $cnt++;
                 $mailMsg .= "\n" . self::str_pad(StringUtil::encodeHTML($user->username), 26, " ") . self::str_pad($user->userID, 12, " ", STR_PAD_LEFT) . "    " . self::str_pad(DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->registrationDate), 20, " ") . DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->lastActivityTime);
                 $quitStarted = DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->quitStarted);
                 $quitExec = DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->quitStarted + 7 * 86400);
                 $mailMsg .= "\n" . self::str_pad(StringUtil::encodeHTML($lang->get('wcf.acp.adminTools.cron.mail.quitInfo', array('$quitStarted' => $quitStarted, '$quitExec' => $quitExec))), $pL + $pR, " ", STR_PAD_LEFT);
             }
             $message .= "\n\n";
             $message .= $lang->get('wcf.acp.adminTools.cron.mail.quit') . ' ' . $cnt . $mailUserHeader;
             if (!empty($cnt)) {
                 $message .= $mailMsg;
             } else {
                 $message .= "\n-";
             }
             // inactive ------------------------------------
             $mailMsg = '';
             $cnt = 0;
             $sql = "SELECT userID" . "\n  FROM wcf" . WCF_N . "_user" . "\n WHERE activationCode > 0" . "\n ORDER BY LOWER(username)";
             $result = WCF::getDB()->sendQuery($sql);
             while ($row = WCF::getDB()->fetchArray($result)) {
                 $user = new User($row['userID']);
                 $cnt++;
                 $mailMsg .= "\n" . self::str_pad(StringUtil::encodeHTML($user->username), 26, " ") . self::str_pad($user->userID, 12, " ", STR_PAD_LEFT) . "    " . self::str_pad(DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->registrationDate), 20, " ") . DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->lastActivityTime);
             }
             $message .= "\n\n";
             $message .= $lang->get('wcf.acp.adminTools.cron.mail.inactives') . ' ' . $cnt . $mailUserHeader;
             if (!empty($cnt)) {
                 $message .= $mailMsg;
             } else {
                 $message .= "\n-";
             }
             // banned --------------------------------------
             $mailMsg = '';
             $cnt = 0;
             $sql = "SELECT userID" . "\n  FROM wcf" . WCF_N . "_user" . "\n WHERE banned > 0" . "\n ORDER BY LOWER(username)";
             $result = WCF::getDB()->sendQuery($sql);
             while ($row = WCF::getDB()->fetchArray($result)) {
                 $user = new User($row['userID']);
                 $cnt++;
                 $mailMsg .= "\n" . self::str_pad(StringUtil::encodeHTML($user->username), 26, " ") . self::str_pad($user->userID, 12, " ", STR_PAD_LEFT) . "    " . self::str_pad(DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->registrationDate), 20, " ") . DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->lastActivityTime);
             }
             $message .= "\n\n";
             $message .= $lang->get('wcf.acp.adminTools.cron.mail.banned') . ' ' . $cnt . $mailUserHeader;
             if (!empty($cnt)) {
                 $message .= $mailMsg;
             } else {
                 $message .= "\n-";
             }
         }
         if (!empty($cStat)) {
             // stats -----------------------------------
             $nStats = array();
             // user
             $sql = "SELECT COUNT(userID) AS user, MAX(userID) AS userMax FROM wcf" . WCF_N . "_user";
             $tmp = WCF::getDB()->getFirstRow($sql);
             foreach ($tmp as $k => $v) {
                 $nStats[$k] = $v;
             }
             $sql = "SELECT SUM(banned) AS userLocked, SUM(disableSignature) AS signLocked FROM wcf" . WCF_N . "_user";
             $tmp = WCF::getDB()->getFirstRow($sql);
             foreach ($tmp as $k => $v) {
                 $nStats[$k] = $v;
             }
             // threads
             if (self::wbbExists()) {
                 $sql = "SELECT COUNT(threadID) AS threads, MAX(threadID) AS threadsMax, SUM(views) AS threadViews FROM wbb" . WBB_N . "_thread";
                 $tmp = WCF::getDB()->getFirstRow($sql);
                 foreach ($tmp as $k => $v) {
                     $nStats[$k] = $v;
                 }
                 $sql = "SELECT COUNT(threadID) AS threadClosed FROM wbb" . WBB_N . "_thread WHERE isClosed = 1";
                 $tmp = WCF::getDB()->getFirstRow($sql);
                 foreach ($tmp as $k => $v) {
                     $nStats[$k] = $v;
                 }
                 // posts
                 $sql = "SELECT COUNT(postID) AS posts, MAX(postID) AS postsMax FROM wbb" . WBB_N . "_post";
                 $tmp = WCF::getDB()->getFirstRow($sql);
                 foreach ($tmp as $k => $v) {
                     $nStats[$k] = $v;
                 }
                 // pm
             }
             $sql = "SELECT COUNT(pmID) AS pms, MAX(pmID) AS pmsMax FROM wcf" . WCF_N . "_pm";
             $tmp = WCF::getDB()->getFirstRow($sql);
             foreach ($tmp as $k => $v) {
                 $nStats[$k] = $v;
             }
             // polls
             $sql = "SELECT COUNT(pollID) AS polls FROM wcf" . WCF_N . "_poll";
             $tmp = WCF::getDB()->getFirstRow($sql);
             foreach ($tmp as $k => $v) {
                 $nStats[$k] = $v;
             }
             // attachments *****************************
             // get decimal point
             $dp = StringUtil::decodeHTML($lang->get('wcf.global.decimalPoint'));
             if (!preg_match('/^[\\,\\.]{1}$/', $dp)) {
                 $dp = ',';
             }
             // get thousands separator
             $tp = StringUtil::decodeHTML($lang->get('wcf.global.thousandsSeparator'));
             if (!preg_match('/^[\\,\\.\\s]{1}$/', $tp)) {
                 $tp = ' ';
             }
             $sql = "SELECT COUNT(attachmentID) AS atCnt, SUM(attachmentSize) AS atSize FROM wcf" . WCF_N . "_attachment WHERE messageID != 0";
             $tmp = WCF::getDB()->getFirstRow($sql);
             foreach ($tmp as $k => $v) {
                 $nStats[$k] = $v;
             }
             if (!empty($nStats['atSize'])) {
                 $atSize = number_format($nStats['atSize'] / pow(1024, 2), 2, $dp, $tp);
             } else {
                 $atSize = 0;
             }
             // avatars
             $sql = "SELECT COUNT(avatarID) AS avatars FROM wcf" . WCF_N . "_avatar WHERE userID > 0";
             $tmp = WCF::getDB()->getFirstRow($sql);
             foreach ($tmp as $k => $v) {
                 $nStats[$k] = $v;
             }
             // record
             $nStats['record'] = USERS_ONLINE_RECORD;
             $nStats['recordTime'] = USERS_ONLINE_RECORD_TIME;
             // mail message
             $message .= "\n\n" . $spacer;
             $message .= "\n" . $lang->get('wcf.acp.adminTools.cron.mail.statsHeader');
             $message .= "\n" . $spacer;
             $di = self::getDiskInfo();
             if (is_array($di) && count($di)) {
                 $totalSpace = StringUtil::decodeHTML(StringUtil::formatNumeric($di['TOTAL_SPACE'])) . ' GB';
                 $freeSpace = StringUtil::decodeHTML(StringUtil::formatNumeric($di['FREE_SPACE'])) . ' GB (' . StringUtil::decodeHTML(StringUtil::formatNumeric($di['FREE_QUOTA'])) . '%)';
                 $usedSpace = StringUtil::decodeHTML(StringUtil::formatNumeric($di['USED_SPACE'])) . ' GB (' . StringUtil::decodeHTML(StringUtil::formatNumeric($di['USED_QUOTA'])) . '%)';
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.diskTotalSpace'), $pR, " ") . self::str_pad($totalSpace, $pL, " ", STR_PAD_LEFT);
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.diskFreeSpace'), $pR, " ") . self::str_pad($freeSpace, $pL, " ", STR_PAD_LEFT);
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.diskUsedSpace'), $pR, " ") . self::str_pad($usedSpace, $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['user'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntMembers'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['user'])), $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['userMax'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntMembersMax'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['userMax'])), $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['userLocked'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntMembersLocked'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['userLocked'])), $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['signLocked'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntSignLocked'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['signLocked'])), $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['threads'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntThreads'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['threads'])), $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['threadsMax'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntThreadsMax'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['threadsMax'])), $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['threadClosed'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntThreadsLocked'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['threadClosed'])), $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['threadViews'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntThreadsView'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['threadViews'])), $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['posts'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntPosts'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['posts'])), $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['postsMax'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntPostsMax'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['postsMax'])), $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['pms'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntPMs'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['pms'])), $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['pmsMax'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntPMsMax'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['pmsMax'])), $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['polls'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntPolls'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['polls'])), $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['atCnt'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntAttachments'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['atCnt'])) . ' (' . $atSize . ' MB)', $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['avatars'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntAvatars'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['avatars'])), $pL, " ", STR_PAD_LEFT);
             }
             if (isset($nStats['record'])) {
                 $message .= "\n" . self::str_pad($lang->get('wcf.acp.adminTools.cron.mail.statsCntRecord'), $pR, " ") . self::str_pad(StringUtil::decodeHTML(StringUtil::formatInteger($nStats['record'])) . ' (' . DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $nStats['recordTime']) . ')', $pL, " ", STR_PAD_LEFT);
             }
         }
         // sendmail ------------------------------------
         if (empty($cAdminMail)) {
             $sendTo = array(MAIL_FROM_NAME => MAIL_FROM_ADDRESS);
         } else {
             $sendTo = MAIL_ADMIN_ADDRESS;
         }
         $mail = new Mail($sendTo, $subject, $message);
         $mail->send();
         // reset datetime
         DateUtil::$useStrftime = $useStrftime;
     }
 }