[ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 /* 3 + ----------------------------------------------------------------------------+ 4 | e107 website system 5 | 6 | ©Steve Dunstan 2001-2002 7 | http://e107.org 8 | jalist@e107.org 9 | 10 | Released under the terms and conditions of the 11 | GNU General Public License (http://gnu.org). 12 | 13 | $Source: /cvsroot/e107/e107_0.7/online.php,v $ 14 | $Revision: 1.14 $ 15 | $Date: 2006/10/20 20:57:15 $ 16 | $Author: mrpete $ 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 (strstr($online_location, "forum")) { 184 $tmp = explode(".", substr(strrchr($online_location, "php."), 2)); 185 if (strstr($online_location, "_viewtopic")) { 186 if ($tmp[2]) { 187 $pref['forum_postspage'] = ($pref['forum_postspage'] ? $pref['forum_postspage'] : 10); 188 $t_page = $tmp[2]/$pref['forum_postspage'] +1; 189 } else { 190 $t_page = 1; 191 } 192 $qry = " 193 SELECT t.thread_name, f.forum_name, f.forum_class from #forum_t AS t 194 LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id 195 WHERE t.thread_id = '".intval($tmp[0])."' 196 "; 197 $sql->db_Select_gen($qry); 198 $forum = $sql->db_Fetch(); 199 $online_location_page = ONLINE_EL13." .:. ".$forum['forum_name']."->".ONLINE_EL14." .:. ".$forum['thread_name']."->".ONLINE_EL15.": ".$t_page; 200 $online_location = str_replace("php.", "php?", $online_location); 201 if (!check_class($forum['forum_class'])) { 202 $class_check = FALSE; 203 $online_location_page = ONLINE_EL13.": \"".CLASSRESTRICTED."\""; 204 } 205 } elseif(strstr($online_location, "_viewforum")) { 206 $sql->db_Select("forum", "forum_name, forum_class", "forum_id='".intval($tmp[0])."' "); 207 list($forum['forum_name'], $forum['forum_class']) = $sql->db_Fetch(); 208 $online_location_page = ONLINE_EL13." .:. ".$forum['forum_name']; 209 $online_location = str_replace("php.", "php?", $online_location); 210 if (!check_class($forum['forum_class'])) { 211 $class_check = FALSE; 212 $online_location_page = ONLINE_EL13.": \"".CLASSRESTRICTED."\""; 213 } 214 } elseif(strstr($online_location, "_post")) { 215 $sql->db_Select("forum_t", "thread_name, thread_forum_id", "thread_forum_id='".intval($tmp[0])."' AND thread_parent='0'"); 216 list($forum_t['thread_name'], $forum_t['thread_forum_id']) = $sql->db_Fetch(); 217 $sql->db_Select("forum", "forum_name", "forum_id='".$forum_t['thread_forum_id']."'"); 218 list($forum['forum_name']) = $sql->db_Fetch(); 219 $online_location_page = ONLINE_EL12.": ".ONLINE_EL13." .:. ".$forum['forum_name']."->".ONLINE_EL14." .:. ".$forum_t['thread_name']; 220 $online_location = e_PLUGIN."forum/forum_viewtopic.php?$tmp[0].$tmp[1]"; 221 } 222 } 223 if (strstr($online_location, "admin")) { 224 $class_check = FALSE; 225 $online_location_page = ADMINAREA; 226 } 227 $pm_installed = ($pref['pm_title'] ? TRUE : FALSE); 228 $ONLINE_TABLE_ICON = ($pm_installed && $oid != USERID ? $tp->parseTemplate("{pm_menu.sendpm={$oid}}") : "<img src='".e_PLUGIN."online_extended_menu/images/user.png' alt='' style='vertical-align:middle' />"); 229 230 $ONLINE_TABLE_USERNAME = "<a href='".e_BASE."user.php?id.$oid'>$oname</a>"; 231 $ONLINE_TABLE_LOCATION = ($class_check ? "<a href='$online_location'>$online_location_page</a>" : $online_location_page); 232 233 if (!$ONLINE_TABLE) { 234 if (file_exists(THEME."online_template.php")) { 235 require_once(THEME."online_template.php"); 236 } else { 237 require_once(e_BASE.$THEMES_DIRECTORY."templates/online_template.php"); 238 } 239 } 240 $textstring .= preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE); 241 } 242 243 $ONLINE_TABLE_MEMBERS_ONLINE = ONLINE_EL1.GUESTS_ONLINE; 244 $ONLINE_TABLE_GUESTS_ONLINE = ONLINE_EL2.MEMBERS_ONLINE; 245 if ((MEMBERS_ONLINE + GUESTS_ONLINE) > ($menu_pref['most_members_online'] + $menu_pref['most_guests_online'])) { 246 global $sysprefs; 247 $menu_pref['most_members_online'] = MEMBERS_ONLINE; 248 $menu_pref['most_guests_online'] = GUESTS_ONLINE; 249 $menu_pref['most_online_datestamp'] = time(); 250 $sysprefs->setArray('menu_pref'); 251 } 252 253 if (!isset($gen) || !is_object($gen)) { 254 $gen = new convert; 255 } 256 257 $datestamp = $gen->convert_date($menu_pref['most_online_datestamp'], "short"); 258 259 $ONLINE_TABLE_MOST_EVER_ONLINE = ONLINE_EL8.($menu_pref['most_members_online'] + $menu_pref['most_guests_online']); 260 $ONLINE_TABLE_MOST_MEMBERS_ONLINE = strtolower(ONLINE_EL2).$menu_pref['most_members_online']; 261 $ONLINE_TABLE_MOST_GUESTS_ONLINE = strtolower(ONLINE_EL1).$menu_pref['most_guests_online']; 262 $ONLINE_TABLE_DATESTAMP = $datestamp; 263 264 $total_members = $sql->db_Count("user"); 265 266 if ($total_members > 1) { 267 $newest_member = $sql->db_Select("user", "user_id, user_name", "user_ban='0' ORDER BY user_join DESC LIMIT 0,1"); 268 $row = $sql->db_Fetch(); 269 extract($row); 270 271 $ONLINE_TABLE_MEMBERS_TOTAL = "<br />".ONLINE_EL5.": ".$total_members; 272 $ONLINE_TABLE_MEMBERS_NEWEST = "<br />".ONLINE_EL6.": ".(USER ? "<a href='".e_BASE."user.php?id.".$user_id."'>".$user_name."</a>" : $user_name); 273 } 274 275 $textstart = preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE_START); 276 $textend = preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE_END); 277 $text = $textstart.$textstring.$textend; 278 279 $ns->tablerender(ONLINE_EL4, $text); 280 281 require_once(FOOTERF); 282 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |