[ Index ]

PHP Cross Reference of e107 v1


title

Body

[close]

/ -> online.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     Copyright (C) 2001-2002 Steve Dunstan (jalist@e107.org)
   7  |     Copyright (C) 2008-2010 e107 Inc (e107.org)
   8  |
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/online.php $
  14  |     $Revision: 11678 $
  15  |     $Id: online.php 11678 2010-08-22 00:43:45Z e107coders $
  16  |     $Author: e107coders $
  17  +----------------------------------------------------------------------------+
  18  */
  19  require_once ("class2.php");
  20  require_once(HEADERF);
  21  
  22  global $listuserson;
  23  
  24  foreach($listuserson as $uinfo => $pinfo) {
  25      $class_check = TRUE;
  26      list($oid, $oname) = explode(".", $uinfo, 2);
  27      $sql2 = new db;
  28      $sql2->db_Select("user", "user_id", "user_admin > 0 ");
  29      $row_2 = $sql2->db_Fetch();
  30      $online_location = $pinfo;
  31      $online_location_page = substr(strrchr($online_location, "/"), 1);
  32      if (!strstr($online_location, "forum_") || !strstr($online_location, "content.php") || !strstr($online_location, "comment.php")) {
  33          $online_location_page = str_replace(".php", "", substr(strrchr($online_location, "/"), 1));
  34      }
  35      if ($online_location_page == "log" || $online_location_page == "error") {
  36          $online_location = "news.php";
  37          $online_location_page = NEWS;
  38      }
  39      if ($online_location_page == "request") {
  40          $online_location = "download.php";
  41      }
  42      if ($online_location_page == "article") {
  43          $online_location_page = ARTICLEPAGE;
  44      }
  45      if ($online_location_page == "chat") {
  46          $online_location_page = CHAT;
  47      }
  48      //if($online_location_page == "comment"){$online_location_page = COMMENT;}
  49      if ($online_location_page == "content") {
  50          $online_location_page = CONTENT;
  51      }
  52      if ($online_location_page == "download") {
  53          $online_location_page = DOWNLOAD;
  54      }
  55      if ($online_location_page == "email") {
  56          $online_location_page = EMAIL;
  57      }
  58      if ($online_location_page == "forum") {
  59          $online_location_page = FORUM;
  60      }
  61      if ($online_location_page == "links") {
  62          $online_location_page = LINKS;
  63      }
  64      if ($online_location_page == "news") {
  65          $online_location_page = NEWS;
  66      }
  67      if ($online_location_page == "oldpolls") {
  68          $online_location_page = OLDPOLLS;
  69      }
  70      if ($online_location_page == "print") {
  71          $online_location_page = PRINTPAGE;
  72      }
  73      if ($online_location_page == "login") {
  74          $online_location_page = LOGIN;
  75      }
  76      if ($online_location_page == "search") {
  77          $online_location_page = SEARCH;
  78      }
  79      if ($online_location_page == "stats") {
  80          $online_location_page = STATS;
  81      }
  82      if ($online_location_page == "submitnews") {
  83          $online_location_page = SUBMITNEWS;
  84      }
  85      if ($online_location_page == "upload") {
  86          $online_location_page = UPLOAD;
  87      }
  88      if ($online_location_page == "user") {
  89          $online_location_page = USERPAGE;
  90      }
  91      if ($online_location_page == "usersettings") {
  92          $online_location_page = USERSETTINGS;
  93      }
  94      if ($online_location_page == "new") {
  95          $online_location_page = LISTNEW;
  96      }
  97      if ($online_location_page == "online") {
  98          $online_location_page = ONLINE;
  99      }
 100      if ($online_location_page == "userposts") {
 101          $online_location_page = USERPOSTS;
 102      }
 103      if ($online_location_page == "subcontent") {
 104          $online_location_page = SUBCONTENT;
 105      }
 106      if ($online_location_page == "top") {
 107          $online_location_page = TOP;
 108      }
 109      //commonly used plugin pages
 110      if ($online_location_page == "bugtracker") {
 111          $online_location_page = BUGTRACKER;
 112      }
 113      if ($online_location_page == "event") {
 114          $online_location_page = EVENT;
 115      }
 116      if ($online_location_page == "calendar") {
 117          $online_location_page = CALENDAR;
 118      }
 119      if ($online_location_page == "faq") {
 120          $online_location_page = FAQ;
 121      }
 122      if ($online_location_page == "pm") {
 123          $online_location_page = PM;
 124      }
 125      if ($online_location_page == "survey") {
 126          $online_location_page = SURVEY;
 127      }
 128      if (strstr($online_location, "content.php")) {
 129          $tmp = explode(".", substr(strrchr($online_location, "php."), 2));
 130          if ($tmp[0] == "article") {
 131              $sql->db_Select("content", "content_heading, content_class", "content_id='".intval($tmp[1])."'");
 132              list($content['content_heading'], $content['content_class']) = $sql->db_Fetch();
 133              $online_location_page = ARTICLE.": ".$content['content_heading'];
 134              $online_location = str_replace("php.", "php?", $online_location);
 135              if (!check_class($content['content_class'])) {
 136                  $class_check = FALSE;
 137                  $online_location_page = ARTICLE.": \"".CLASSRESTRICTED."\"";
 138              }
 139          } elseif($tmp[0] == "review") {
 140              $sql->db_Select("content", "content_heading, content_class", "content_id='".intval($tmp[1])."'");
 141              list($content['content_heading'], $content['content_class']) = $sql->db_Fetch();
 142              $online_location_page = REVIEW.": ".$content['content_heading'];
 143              $online_location = str_replace("php.", "php?", $online_location);
 144              if (!check_class($content['content_class'])) {
 145                  $class_check = FALSE;
 146                  $online_location_page = REVIEW.": \"".CLASSRESTRICTED."\"";
 147              }
 148          } elseif($tmp[0] == "content") {
 149              $sql->db_Select("content", "content_heading, content_class", "content_id='".intval($tmp[1])."'");
 150              list($content['content_heading'], $content['content_class']) = $sql->db_Fetch();
 151              $online_location_page = CONTENT.": ".$content['content_heading'];
 152              $online_location = str_replace("php.", "php?", $online_location);
 153              if (!check_class($content['content_class'])) {
 154                  $class_check = FALSE;
 155                  $online_location_page = CONTENT.": \"".CLASSRESTRICTED."\"";
 156              }
 157          }
 158      }
 159      if (strstr($online_location, "comment.php")) {
 160          $tmp = explode(".php.", $online_location);
 161          $tmp = explode(".", $tmp[1]);
 162          if ($tmp[1] == "news") {
 163              $id = ($tmp[0] == "reply" ? $tmp[3] : $tmp[2]);
 164              $sql->db_Select("news", "news_title, news_class", "news_id=".intval($id));
 165              list($news['news_title'], $news['news_class']) = $sql->db_Fetch();
 166              $online_location_page = ($tmp[0] == "reply" ? COMMENT.": ".ONLINE_EL12." > ".$news['news_title'] : COMMENT.": ".$news['news_title']);
 167              $online_location = "comment.php?comment.news.$id";
 168              if (!check_class($news['news_class'])) {
 169                  $class_check = FALSE;
 170                  $online_location_page = COMMENT.": \"".CLASSRESTRICTED."\"";
 171              }
 172          } elseif($tmp[1] == "poll") {
 173              $id = ($tmp[0] == "reply" ? $tmp[3] : $tmp[2]);
 174              $sql->db_Select("poll", "poll_title", "poll_id=".intval($id));
 175              list($poll['poll_title']) = $sql->db_Fetch();
 176              $online_location_page = POLLCOMMENT.": ".$poll['poll_title'];
 177              $online_location = "comment.php?comment.poll.$id";
 178          } else {
 179              $online_location_page = COMMENT;
 180              $class_check = FALSE;
 181          }
 182      }
 183      if (isset($pref['plug_installed']['forum']) && strstr($online_location, "forum"))
 184      {
 185          $tmp = explode(".", substr(strrchr($online_location, "php."), 2));
 186          if (strstr($online_location, "_viewtopic")) {
 187              if ($tmp[2]) {
 188                  $pref['forum_postspage'] = ($pref['forum_postspage'] ? $pref['forum_postspage'] : 10);
 189                  $t_page = $tmp[2]/$pref['forum_postspage'] +1;
 190              } else {
 191                  $t_page = 1;
 192              }
 193              $qry = "
 194              SELECT t.thread_name, f.forum_name, f.forum_class from #forum_t AS t
 195              LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
 196              WHERE t.thread_id = ".intval($tmp[0])
 197              ;
 198              $sql->db_Select_gen($qry);
 199              $forum = $sql->db_Fetch();
 200              $online_location_page = ONLINE_EL13." .:. ".$forum['forum_name']."->".ONLINE_EL14." .:. ".$forum['thread_name']."->".ONLINE_EL15.": ".$t_page;
 201              $online_location = str_replace("php.", "php?", $online_location);
 202              if (!check_class($forum['forum_class'])) {
 203                  $class_check = FALSE;
 204                  $online_location_page = ONLINE_EL13.": \"".CLASSRESTRICTED."\"";
 205              }
 206          } elseif(strstr($online_location, "_viewforum")) {
 207              $sql->db_Select("forum", "forum_name, forum_class", "forum_id=".intval($tmp[0]));
 208              list($forum['forum_name'], $forum['forum_class']) = $sql->db_Fetch();
 209              $online_location_page = ONLINE_EL13." .:. ".$forum['forum_name'];
 210              $online_location = str_replace("php.", "php?", $online_location);
 211              if (!check_class($forum['forum_class'])) {
 212                  $class_check = FALSE;
 213                  $online_location_page = ONLINE_EL13.": \"".CLASSRESTRICTED."\"";
 214              }
 215          } elseif(strstr($online_location, "_post")) {
 216              $sql->db_Select("forum_t", "thread_name, thread_forum_id", "thread_forum_id=".intval($tmp[0])." AND thread_parent=0");
 217              list($forum_t['thread_name'], $forum_t['thread_forum_id']) = $sql->db_Fetch();
 218              $sql->db_Select("forum", "forum_name", "forum_id=".$forum_t['thread_forum_id']);
 219              list($forum['forum_name']) = $sql->db_Fetch();
 220              $online_location_page = ONLINE_EL12.": ".ONLINE_EL13." .:. ".$forum['forum_name']."->".ONLINE_EL14." .:. ".$forum_t['thread_name'];
 221              $online_location = e_PLUGIN."forum/forum_viewtopic.php?$tmp[0].$tmp[1]";
 222          }
 223      }
 224      if (strstr($online_location, "admin")) 
 225      {
 226          $class_check = FALSE;
 227          $online_location_page = ADMINAREA;
 228      }
 229  
 230      $ONLINE_TABLE_ICON = (varsettrue($pref['plug_installed']['pm']) && $oid != USERID ? $tp->parseTemplate("{SENDPM={$oid}}", 'sendpm.sc') : "<img src='".e_PLUGIN."online_extended_menu/images/user.png' alt='' style='vertical-align:middle' />");
 231       
 232      $ONLINE_TABLE_USERNAME = "<a href='".e_BASE."user.php?id.{$oid}'>{$oname}</a>";
 233      $ONLINE_TABLE_LOCATION = ($class_check ? "<a href='{$online_location}'>{$online_location_page}</a>" : $online_location_page);
 234       
 235      if (!$ONLINE_TABLE) 
 236      {
 237          if (file_exists(THEME."online_template.php")) 
 238          {
 239              require_once(THEME."online_template.php");
 240          } 
 241          else 
 242          {
 243              require_once(e_BASE.$THEMES_DIRECTORY."templates/online_template.php");
 244          }
 245      }
 246      $textstring .= preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE);
 247  }
 248      
 249  $ONLINE_TABLE_MEMBERS_ONLINE = ONLINE_EL1.GUESTS_ONLINE;
 250  $ONLINE_TABLE_GUESTS_ONLINE = ONLINE_EL2.MEMBERS_ONLINE;
 251  // The check for (count($menu_pref) > 3) is to try and prevent DB updates if the host does something nasty to earlier queries - can end up with $menu_pref empty
 252  if (((MEMBERS_ONLINE + GUESTS_ONLINE) > ($menu_pref['most_members_online'] + $menu_pref['most_guests_online'])) && (count($menu_pref) > 3))
 253  {
 254      global $sysprefs;
 255      $menu_pref['most_members_online'] = MEMBERS_ONLINE;
 256      $menu_pref['most_guests_online'] = GUESTS_ONLINE;
 257      $menu_pref['most_online_datestamp'] = time();
 258      $sysprefs->setArray('menu_pref');
 259  }
 260      
 261  if (!isset($gen) || !is_object($gen)) 
 262  {
 263      $gen = new convert;
 264  }
 265      
 266  $datestamp = $gen->convert_date($menu_pref['most_online_datestamp'], "short");
 267      
 268  $ONLINE_TABLE_MOST_EVER_ONLINE = ONLINE_EL8.($menu_pref['most_members_online'] + $menu_pref['most_guests_online']);
 269  $ONLINE_TABLE_MOST_MEMBERS_ONLINE = ONLINE_EL2.$menu_pref['most_members_online'];
 270  $ONLINE_TABLE_MOST_GUESTS_ONLINE  = ONLINE_EL1.$menu_pref['most_guests_online'];
 271  $ONLINE_TABLE_DATESTAMP = $datestamp;
 272      
 273  $total_members = $sql->db_Count("user","(*)","where user_ban = 0");
 274      
 275  if ($total_members > 1)
 276  {
 277      $newest_member = $sql->db_Select("user", "user_id, user_name", "user_ban=0 ORDER BY user_join DESC LIMIT 0,1");
 278      $row = $sql->db_Fetch();
 279       
 280      $ONLINE_TABLE_MEMBERS_TOTAL = "<br />".ONLINE_EL5.": ".$total_members;
 281      $ONLINE_TABLE_MEMBERS_NEWEST = "<br />".ONLINE_EL6.": ".(USER ? "<a href='".e_BASE."user.php?id.".$row['user_id']."'>".$row['user_name']."</a>" : $row['user_name']);
 282  }
 283      
 284  $textstart = preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE_START);
 285  $textend = preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE_END);
 286  $text = $textstart.$textstring.$textend;
 287      
 288  $ns->tablerender(ONLINE_EL4, $text);
 289      
 290  require_once(FOOTERF);


Generated: Mon Mar 12 16:28:38 2012 Cross Reference PHPXref