예제 #1
0
 public function __construct()
 {
     $expired = time() - Lib::GetSetting('sess.gc_maxlifetime');
     $users = DBA::Open()->Query("SELECT * FROM " . USERS . " WHERE birthday != 0");
     $this->count = $users->NumRows();
     $this->users = $users->GetIterator();
     $this->i = 1;
 }
예제 #2
0
 public function Current()
 {
     $temp = $this->users->Current();
     // todo format datre
     $temp['created'] = date("d-m-y", $temp['created']);
     if ($temp['seen'] >= time() - Lib::GetSetting('sess.gc_maxlifetime')) {
         $temp['online_status'] = $this->lang['L_ONLINE'];
     } else {
         $temp['online_status'] = $this->lang['L_OFFLINE'];
     }
     $temp['avatar'] = $temp['avatar'] != '' && $temp['avatar'] != 0 ? '<img src="Uploads/Avatars/' . $temp['id'] . '.gif" border="0" alt="" />' : NULL;
     return $temp;
 }
예제 #3
0
 public function Execute(Template $template, Session $session, $request)
 {
     $forum = new Forum();
     //foreach(DBA::Open()->Query("SELECT * FROM ". SESSIONS) as $s) { print_r($s); }
     //$rows = $forum->getForums((@$session['user']['perms'] & ADMIN));
     /* Set the templates */
     $template->content = array('file' => 'forums.html');
     if ($template['WOLenable'] == 1) {
         $template->users_online = array('file' => 'online_users.html');
     }
     if ($template['showbirthdays'] == 1) {
         $template->todays_bdays = array('file' => 'birthdays.html');
     }
     $suspend = $session['user']['perms'] & ADMIN ? 1 : 0;
     /* Set the forums and categoris */
     $template->categories = new ForumList(FALSE, $suspend);
     /* Set the title of the page */
     $template['title'] = $template['L_HOME'];
     $expired = time() - Lib::GetSetting('sess.gc_maxlifetime');
     /* Display message for unlogged users */
     if ($session['user'] instanceof Guest) {
         $template['welcome_title'] = sprintf($template['L_WELCOMETITLE'], $template['forum_description']);
         // you can use forum_name here instead
         $template['welcome_msg'] = $template['L_WELCOMEMESSAGE'];
     } else {
         $template->welcome_msg = array('hide' => TRUE);
     }
     /* Set the online users list */
     if ($template['displayloggedin'] == 1) {
         $template->online_users = new Online_Users();
     }
     if ($template['showbirthdays'] == 1) {
         $template->birthdays = new Birthdays();
     }
     //DBA::Open()->Execute("delete from k4_pmsgs");
     //echo DBA::Open()->GetValue("select count(*) from k4_pmsgs");
     //print_r(DBA::Open()->GetRow("SELECT * FROM ". FORUMS ." WHERE row_left = 1"));
     //foreach(DBA::Open()->Query("SELECT * FROM ". POSTS ." WHERE row_left < 0 OR row_right < 0") as $t) { print_r($t); }
     $stats = DBA::Open()->GetRow("SELECT (SELECT COUNT(*) FROM " . USERS . " WHERE invisible = 0) AS num_members, (SELECT COUNT(s.uid) FROM " . USERS . " u, " . SESSIONS . " s WHERE u.invisible = 1 AND u.id = s.uid) AS num_invisible, (SELECT MAX(id) FROM " . USERS . ") AS newest_uid, (SELECT name FROM " . USERS . " ORDER BY created DESC LIMIT 1) AS newest_user, (SELECT COUNT(*) FROM " . USERS . " WHERE seen >= {$expired}) AS num_online, (SELECT COUNT(*) FROM " . POSTS . ") AS num_articles, (SELECT COUNT(*) FROM " . SESSIONS . ") AS num_total FROM " . USERS);
     /* Set the board statistics */
     $template['newest_member'] = sprintf($template['L_NEWESTMEMBER'], $stats['newest_uid'], $stats['newest_user']);
     $template['total_posts'] = sprintf($template['L_TOTALPOSTS'], $stats['num_articles']);
     $template['total_users'] = sprintf($template['L_TOTALUSERS'], $stats['num_members']);
     $guests = $stats['num_total'] - $stats['num_online'] < 0 ? 0 : $stats['num_total'] - $stats['num_online'];
     $guests = $template['WOLguests'] == 1 ? $guests : '--';
     $template['online_stats'] = sprintf($template['L_ONLINEUSERSTATS'], $stats['num_total'], $stats['num_online'], $guests, $stats['num_invisible']);
     /* Set the number of queries */
     $template['num_queries'] = $session->dba->num_queries;
     return TRUE;
 }
예제 #4
0
 public function Execute(Template $template, Session $session, $request)
 {
     // view a member's profile
     if (isset($request['id'])) {
         $id = intval($request['id']);
         /* Chck if we're trying to look at the gues user */
         if ($id == 0) {
             return new Error($template['L_USERDOESNTEXIST'], $template);
         }
         /* Get our user from the db */
         $user = DBA::Open()->GetRow("SELECT * FROM " . USERS . " WHERE id = {$id}");
         /* If our user has admin perms, use a different tamplate */
         if ($session['user']['perms'] & ADMIN) {
             $template->content = array('file' => 'admin/member.html');
         } else {
             $template->content = array('file' => 'member.html');
         }
         /* set the user info template variables */
         $template['id'] = $user['id'];
         $template['name'] = $user['name'];
         $template['email'] = $user['email'];
         $template['posts'] = $user['posts'];
         $template['created'] = relative_time($user['created']);
         $template['rank'] = $user['rank'];
         if ($template['displayemails'] == 1) {
             $template->email_link = array('hide' => TRUE);
         } else {
             if ($template['displayemails'] == 0) {
                 $template->email_address = array('hide' => TRUE);
             }
         }
         /* Set the last seen time */
         $user['seen'] = $user['seen'] == 0 ? time() : $user['seen'];
         $user['last_seen'] = $user['last_seen'] == 0 ? time() : $user['last_seen'];
         $template['seen'] = $user['seen'] >= time() - Lib::GetSetting('sess.gc_maxlifetime') ? relative_time($user['seen']) : relative_time($user['last_seen']);
         /* Set the user's online status field on the template */
         if ($user['seen'] >= time() - Lib::GetSetting('sess.gc_maxlifetime')) {
             $template['online_status'] = $template['L_ONLINE'];
         } else {
             $template['online_status'] = $template['L_OFFLINE'];
         }
     }
     /* Set the number of queries */
     $template['num_queries'] = $session->dba->num_queries;
     return TRUE;
 }
예제 #5
0
 public function Current()
 {
     $row = $this->post_info->Current();
     $this->count++;
     $row['count'] = $this->count;
     $row['created'] = relative_time($row['created']);
     if ($row['poster_id'] != 0) {
         $user = $this->dba->GetRow("SELECT * FROM " . USERS . " WHERE id = " . $row['poster_id']);
         if ($user['seen'] >= time() - Lib::GetSetting('sess.gc_maxlifetime')) {
             $row['online_status'] = $this->lang['L_ONLINE'];
         } else {
             $row['online_status'] = $this->lang['L_OFFLINE'];
         }
         $row['user_num_posts'] = $user['posts'];
         $row['user_rank'] = $user['rank'] != '' ? $user['rank'] : '--';
         $row['avatar'] = $user['avatar'] != '' && $user['avatar'] != 0 ? '<img src="Uploads/Avatars/' . $user['id'] . '.gif" border="0" alt="" />' : ' ';
         $row['signature'] = $user['signature'] != '' && !is_null($user['signature']) && $row['allow_sigs'] == 1 ? '<br /><br />' . stripslashes($user['signature']) : ' ';
     } else {
         $row['poster_name'] = $this->lang['L_ADMINISTRATOR'];
         $row['online_status'] = '--';
         $row['user_num_posts'] = '--';
         $row['user_rank'] = '--';
     }
     $row['name'] = stripslashes($row['name']);
     $row['name'] = $row['member_has_read'] == 0 ? '<span class="text-decoration:italic;">' . $row['name'] . '</span>' : $row['name'];
     $row['display'] = $this->pm['num_children'] == $this->count - 1 || $row['member_has_read'] == 0 ? 'block' : 'none';
     $bbcode = new BBParser(stripslashes($row['body_text']), TRUE);
     //$row['quoted_text']			= str_replace("\r\n", '\n', addslashes($bbcode->Revert($row['body_text'])));
     $row['body_text'] = $bbcode->QuickExecute();
     return $row;
 }
예제 #6
0
 public function __construct()
 {
     $expired = time() - Lib::GetSetting('sess.gc_maxlifetime');
     $this->users = DBA::Open()->Query("SELECT * FROM " . USERS . " WHERE seen >= {$expired} AND invisible = 0")->GetIterator();
 }
 public function Current()
 {
     $row = $this->post_info->Current();
     $this->count++;
     $row['count'] = $this->count;
     $row['created'] = relative_time($row['created']);
     if ($row['poster_id'] != 0) {
         $user = $this->dba->GetRow("SELECT * FROM " . USERS . " WHERE id = " . $row['poster_id']);
         if ($user['seen'] >= time() - Lib::GetSetting('sess.gc_maxlifetime')) {
             $row['online_status'] = $this->lang['L_ONLINE'];
         } else {
             $row['online_status'] = $this->lang['L_OFFLINE'];
         }
         $row['user_num_posts'] = $user['posts'];
         $row['user_rank'] = $user['rank'] != '' ? $user['rank'] : '--';
         $row['avatar'] = $user['avatar'] != '' && $user['avatar'] != 0 && $row['allow_avatars'] == 1 ? '<img src="Uploads/Avatars/' . $user['id'] . '.gif" border="0" alt="" />' : ' ';
         $row['signature'] = $user['signature'] != '' && !is_null($user['signature']) && $row['allow_sigs'] == 1 ? '<br /><br />' . stripslashes($user['signature']) : ' ';
         /* Set the user ranks */
         $row['user_ranks'] = '';
         foreach ($this->dba->Query("SELECT * FROM " . RANKS . " WHERE group_id = (SELECT group_id FROM " . USER_IN_GROUP . " WHERE id = " . $user['id'] . ")") as $rank) {
             $row['user_ranks'] .= $rank['rank'] . ' <br />';
         }
         foreach ($this->dba->Query("SELECT * FROM " . RANKS . " WHERE user_id = " . $user['id']) as $rank) {
             $row['user_ranks'] .= $rank['rank'] . ' <br />';
         }
         if ($this->session['user']['perms'] & ADMIN) {
             $row['delete'] = '<a href="admin.php?act=delete_single&amp;type=1&amp;id=' . $row['id'] . '"><img src="Images/' . $this->settings['imageset'] . '/Buttons/delete.gif" alt="" border="0" /></a>';
         }
     } else {
         $row['online_status'] = '--';
         $row['user_num_posts'] = '--';
         $row['user_rank'] = '--';
         $row['user_ranks'] = '';
     }
     $row['name'] = stripslashes($row['name']);
     $bbcode = new BBParser(stripslashes($row['body_text']), TRUE);
     $row['body_text'] = $bbcode->QuickExecute();
     $row['edited'] = intval($row['edited']) != 0 ? '<br /><br /><span class="smalltext"><em>' . $this->lang['L_EDITEDON'] . '&nbsp;' . date("F j, Y, g:i a", $row['edited']) . '</em></span>' : ' ';
     return $row;
 }