| [ Index ] |
PHP Cross Reference of E107 v0.7.22 code documentation |
[Summary view] [Print] [Text view]
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: /cvs_backup/e107_0.7/userposts.php,v $ 14 | $Revision: 11346 $ 15 | $Date: 2010-02-17 13:56:14 -0500 (Wed, 17 Feb 2010) $ 16 | $Author: secretr $ 17 +----------------------------------------------------------------------------+ 18 */ 19 require_once ("class2.php"); 20 require_once(e_HANDLER."comment_class.php"); 21 $cobj = new comment; 22 require_once(HEADERF); 23 24 25 $_POST['f_query'] = trim($_POST['f_query']); 26 27 $action = 'exit'; 28 if (e_QUERY) 29 { 30 $tmp = explode(".", e_QUERY); 31 $from = intval($tmp[0]); // Always defined 32 $action = varset($tmp[1],'exit'); 33 if (!isset($tmp[2])) $action = 'exit'; 34 $id = intval(varset($tmp[2],0)); 35 if ($id <= 0) $action = 'exit'; 36 if (($id != USERID) && !check_class(varset($pref['memberlist_access'], 253))) $action = 'exit'; 37 unset($tmp); 38 } 39 40 41 if ($action == 'exit') 42 { 43 header("location:".e_BASE."index.php"); 44 exit; 45 } 46 47 if(!defined("BULLET")) 48 { 49 define("BULLET", "bullet2.gif"); 50 } 51 52 if ($action == "comments") 53 { 54 if(is_numeric($id)) 55 { 56 $sql->db_Select("user", "user_name", "user_id=".$id); 57 $row = $sql->db_Fetch(); 58 $user_name = $row['user_name']; 59 $user_id = $id.".".$user_name.""; 60 } 61 else 62 { 63 $user_name = UP_LAN_16.$id; 64 } 65 66 if (!$USERPOSTS_COMMENTS_TABLE) 67 { 68 if (file_exists(THEME."userposts_template.php")) 69 { 70 require_once(THEME."userposts_template.php"); 71 } 72 else 73 { 74 require_once(e_BASE.$THEMES_DIRECTORY."templates/userposts_template.php"); 75 } 76 } 77 78 79 $sql2 = new db; 80 if(is_numeric($id)) 81 { 82 $ccaption = UP_LAN_1.$user_name; 83 $sql->db_Select("user", "user_comments", "user_id=".$id); 84 list($user_comments) = $sql->db_Fetch(); 85 $ctotal = $user_comments; 86 // $data = $cobj->getCommentData($amount='10', $from, "comment_author = '".$user_id."'"); 87 $data = $cobj->getCommentData($amount='10', $from, "SUBSTRING_INDEX(comment_author,'.',1) = '".$id."'"); 88 } 89 else 90 { 91 require_once(e_HANDLER."encrypt_handler.php"); 92 $dip = decode_ip($id); 93 $ccaption = UP_LAN_1.$dip; 94 $data = $cobj->getCommentData($amount='10', $from, "comment_ip = '".$id."'"); 95 } 96 97 if(empty($data) || !is_array($data)){ 98 $ctext = "<span class='mediumtext'>".UP_LAN_7."</span>"; 99 } 100 101 global $row; 102 foreach($data as $row){ 103 $userposts_comments_table_string .= parse_userposts_comments_table($row); 104 } 105 106 // $userposts_comments_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE_START); 107 $userposts_comments_table_start = $tp->simpleParse($USERPOSTS_COMMENTS_TABLE_START); 108 109 // $userposts_comments_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE_END); 110 $userposts_comments_table_end = $tp->simpleParse($USERPOSTS_COMMENTS_TABLE_END); 111 112 $ctext .= $userposts_comments_table_start."".$userposts_comments_table_string."".$userposts_comments_table_end; 113 114 $ns->tablerender($ccaption, $ctext); 115 116 $parms = $ctotal.",10,".$from.",".e_SELF."?[FROM].comments.".$id; 117 $USERPOSTS_NEXTPREV = $tp->parseTemplate("{NEXTPREV={$parms}}"); 118 // echo preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_NP_TABLE); 119 echo $tp->simpleParse($USERPOSTS_NP_TABLE); 120 } 121 122 123 124 if ($action == "forums" || isset($_POST['fsearch'])) 125 { 126 127 if(is_numeric($id)) 128 { 129 $user_id = intval($id); 130 $sql->db_Select("user", "user_name", "user_id=".$id); 131 $row = $sql->db_Fetch(); 132 $fcaption = UP_LAN_0." ".$row['user_name']; 133 } 134 else 135 { 136 $user_name = 0; 137 } 138 139 if (!$USERPOSTS_FORUM_TABLE) 140 { 141 if (file_exists(THEME."userposts_template.php")) 142 { 143 require_once(THEME."userposts_template.php"); 144 } 145 else 146 { 147 require_once(e_BASE.$THEMES_DIRECTORY."templates/userposts_template.php"); 148 } 149 } 150 151 $s_info = ""; 152 if (isset($_POST['f_query']) && $_POST['f_query'] != "") 153 { 154 $f_query = $tp -> toDB($_POST['f_query']); 155 $s_info = "AND (ft.thread_name REGEXP('".$f_query."') OR ft.thread_thread REGEXP('".$f_query."'))"; 156 $fcaption = UP_LAN_12." ".$row['user_name']; 157 } 158 $qry = " 159 SELECT ft.*, f.* FROM #forum_t AS ft 160 LEFT JOIN #forum AS f ON ft.thread_forum_id = f.forum_id 161 LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id 162 WHERE SUBSTRING_INDEX(ft.thread_user,'.',1) = {$user_id} 163 AND f.forum_class IN (".USERCLASS_LIST.") 164 AND fp.forum_class IN (".USERCLASS_LIST.") 165 {$s_info} 166 ORDER BY ft.thread_datestamp DESC LIMIT {$from}, 10 167 "; 168 169 $total_qry = " 170 SELECT COUNT(*) AS count FROM #forum_t AS ft 171 LEFT JOIN #forum AS f ON ft.thread_forum_id = f.forum_id 172 LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id 173 WHERE SUBSTRING_INDEX(ft.thread_user,'.',1) = {$user_id} 174 AND f.forum_class IN (".USERCLASS_LIST.") 175 AND fp.forum_class IN (".USERCLASS_LIST.") 176 {$s_info} 177 "; 178 179 $ftotal = 0; 180 if($sql->db_Select_gen($total_qry)) 181 { 182 $row = $sql->db_Fetch(); 183 $ftotal = $row['count']; 184 } 185 186 if (!$sql->db_Select_gen($qry)) 187 { 188 $ftext .= "<span class='mediumtext'>".UP_LAN_8."</span>"; 189 } 190 else 191 { 192 if (!is_object($gen)) 193 { 194 $gen = new convert; 195 } 196 $render = $sql -> db_getList(); 197 foreach ($render as $row) 198 { 199 $userposts_forum_table_string .= parse_userposts_forum_table($row); 200 } 201 // $userposts_forum_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_FORUM_TABLE_START); 202 $userposts_forum_table_start = $tp->simpleParse($USERPOSTS_FORUM_TABLE_START); 203 $USERPOSTS_FORUM_SEARCH = "<input class='tbox' type='text' name='f_query' size='20' value='' maxlength='50' /> <input class='button' type='submit' name='fsearch' value='".UP_LAN_12."' />"; 204 // $userposts_forum_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_FORUM_TABLE_END); 205 $userposts_forum_table_end = $tp->simpleParse($USERPOSTS_FORUM_TABLE_END); 206 $ftext .= $userposts_forum_table_start."".$userposts_forum_table_string."".$userposts_forum_table_end; 207 } 208 $ns->tablerender($fcaption, $ftext); 209 210 $parms = $ftotal.",10,".$from.",".e_SELF."?[FROM].forums.".$id; 211 $USERPOSTS_NEXTPREV = $tp->parseTemplate("{NEXTPREV={$parms}}"); 212 // echo preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_NP_TABLE); 213 echo $tp->simpleParse($USERPOSTS_NP_TABLE); 214 } 215 216 require_once(FOOTERF); 217 218 219 220 221 function parse_userposts_comments_table($row) 222 { 223 global $USERPOSTS_COMMENTS_TABLE, $pref, $gen, $tp, $menu_pref, $id, $sql2, $comment_files; 224 225 $gen = new convert; 226 $datestamp = $gen->convert_date($row['comment_datestamp'], "short"); 227 $bullet = ''; 228 if(defined('BULLET')) 229 { 230 $bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />'; 231 } 232 elseif(file_exists(THEME.'images/bullet2.gif')) 233 { 234 $bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />'; 235 } 236 $tVars['USERPOSTS_COMMENTS_ICON'] = $bullet; 237 $tVars['USERPOSTS_COMMENTS_DATESTAMP'] = UP_LAN_11." ".$datestamp; 238 $tVars['USERPOSTS_COMMENTS_HEADING'] = $row['comment_title']; 239 $tVars['USERPOSTS_COMMENTS_COMMENT'] = $row['comment_comment']; 240 $tVars['USERPOSTS_COMMENTS_HREF_PRE'] = "<a href='".$row['comment_url']."'>"; 241 $tVars['USERPOSTS_COMMENTS_TYPE'] = $row['comment_type']; 242 243 // return(preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE)); 244 return($tp->simpleParse($USERPOSTS_COMMENTS_TABLE, $tVars)); 245 } 246 247 248 function parse_userposts_forum_table($row) 249 { 250 global $USERPOSTS_FORUM_TABLE, $gen, $tp, $id; 251 extract($row); 252 253 $gen = new convert; 254 $sql2 = new db; 255 256 $poster = substr($thread_user, (strpos($thread_user, ".")+1)); 257 $datestamp = $gen->convert_date($thread_datestamp, "short"); 258 $tVars['DATESTAMP'] = $datestamp; 259 260 if ($thread_parent) 261 { 262 if ($cachevar[$thread_parent]) 263 { 264 $thread_name = $cachevar[$thread_parent]; 265 } 266 else 267 { 268 $sql2->db_Select("forum_t", "thread_name", "thread_id = ".intval($thread_parent)); 269 list($thread_name) = $sql2->db_Fetch(); 270 $cachevar[$thread_parent] = $thread_name; 271 } 272 $tVars['USERPOSTS_FORUM_TOPIC_PRE'] = UP_LAN_15.": "; 273 } 274 else 275 { 276 $tVars['USERPOSTS_FORUM_TOPIC_PRE'] = UP_LAN_2.": "; 277 } 278 279 $tmp = $thread_id; 280 $thread_thread = $tp->toHTML($thread_thread, TRUE, "USER_BODY", $id); 281 282 $tVars['USERPOSTS_FORUM_ICON'] = "<img src='".e_PLUGIN."forum/images/".IMODE."/new_small.png' alt='' />"; 283 $tVars['USERPOSTS_FORUM_TOPIC_HREF_PRE'] = "<a href='".e_PLUGIN."forum/forum_viewtopic.php?".$tmp.".post'>"; 284 $tVars['USERPOSTS_FORUM_TOPIC'] = $thread_name; 285 $tVars['USERPOSTS_FORUM_NAME_HREF_PRE'] = "<a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>"; 286 $tVars['USERPOSTS_FORUM_NAME'] = $forum_name; 287 $tVars['USERPOSTS_FORUM_THREAD'] = $thread_thread; 288 $tVars['USERPOSTS_FORUM_DATESTAMP'] = UP_LAN_11." ".$datestamp; 289 290 // return(preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_FORUM_TABLE)); 291 return($tp->simpleParse($USERPOSTS_FORUM_TABLE, $tVars)); 292 } 293 294 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Tue Aug 3 00:19:13 2010 |