Changeset 1509 in ExiteCMS for branches/PLi-Fusion/forum/viewthread.php
- Timestamp:
- 07/02/08 18:27:06 (4 years ago)
- File:
-
- 1 edited
-
branches/PLi-Fusion/forum/viewthread.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/PLi-Fusion/forum/viewthread.php
r1408 r1509 86 86 "SELECT f.*, f2.forum_name AS forum_cat_name 87 87 FROM ".$db_prefix."forums f 88 LEFTJOIN ".$db_prefix."forums f2 ON f.forum_cat=f2.forum_id88 INNER JOIN ".$db_prefix."forums f2 ON f.forum_cat=f2.forum_id 89 89 WHERE f.forum_id='".$forum_id."'" 90 90 ); … … 158 158 } 159 159 // check if this isn't a reload, back-post, or double submit 160 if (isset($_ COOKIE['post_'.$random_id])) {160 if (isset($_SESSION['posts'][$random_id])) { 161 161 redirect("post.php?action=quickreply&forum_id=$forum_id&thread_id=$thread_id&post_id=0&errorcode=3"); 162 162 } else { 163 163 if (!$flood) { 164 setcookie("post_".$random_id, "posted", time() + 60*60, "/", "", "0"); 164 if (!isset($_SESSION['posts']) || !is_array($_SESSION['posts'])) $_SESSION['posts'] = array(); 165 $_SESSION['posts'][$random_id] = time()+60*60*12; 165 166 $sig = ($userdata['user_sig'] ? '1' :'0'); 166 167 $smileys = isset($_POST['disable_smileys']) ? "0" : "1"; … … 199 200 SELECT count(*) as unread, tr.thread_first_read, tr.thread_last_read 200 201 FROM ".$db_prefix."posts p 201 LEFTJOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id202 INNER JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 202 203 WHERE tr.user_id = '".$userdata['user_id']."' 203 204 AND tr.thread_id = '".$thread_id."' … … 212 213 SELECT count(*) as unread, tr.thread_first_read, tr.thread_last_read 213 214 FROM ".$db_prefix."posts p 214 LEFTJOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id215 INNER JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 215 216 WHERE tr.user_id = '".$userdata['user_id']."' 216 217 AND p.post_author != '".$userdata['user_id']."' … … 261 262 $result = dbquery( 262 263 "SELECT p.*, u.*, u2.user_name AS edit_name, u2.user_status AS edit_status FROM ".$db_prefix."posts p 263 LEFTJOIN ".$db_prefix."users u ON p.post_author = u.user_id264 INNER JOIN ".$db_prefix."users u ON p.post_author = u.user_id 264 265 LEFT JOIN ".$db_prefix."users u2 ON p.post_edituser = u2.user_id AND post_edituser > '0' 265 266 WHERE p.thread_id='$thread_id' ORDER BY post_sticky DESC, post_datestamp ASC LIMIT $rowstart,".$settings['numofthreads'] … … 267 268 $variables['posts'] = array(); 268 269 while ($data = dbarray($result)) { 270 271 // default, show no ranking information 272 $data['show_ranking'] = false; 269 273 270 274 // check for a system-post (author = 0 ), use some of the webmasters details for this … … 278 282 $data['user_sig'] = ""; 279 283 $data['user_status'] = "0"; 284 } else { 285 // check if a ranking is defined for this poster 286 $result2 = dbquery("SELECT * FROM ".$db_prefix."forum_ranking WHERE rank_posts_from <= '".$data['user_posts']."' AND rank_posts_to >= '".$data['user_posts']."' ORDER BY rank_order"); 287 while ($data2 = dbarray($result2)) { 288 // get the grouplist for this ranking 289 if (strpos($data2['rank_groups'], ",")) { 290 $groups = explode(",", $data2['rank_groups']); 291 } else { 292 if (empty($data2['rank_groups'])) { 293 $groups = ""; 294 } else { 295 $groups = array($data2['rank_groups']); 296 } 297 } 298 if (is_array($groups)) { 299 // check for group matching as well, assume a match will be found 300 $ranking_match = true; 301 foreach($groups as $group) { 302 if ($data2['rank_groups_and']) { 303 // all should match 304 if (!checkusergroup($data['post_author'], $group)) { 305 // bail out if a non-match has been found 306 $ranking_match = false; 307 break; 308 } 309 } else { 310 // one match is sufficient 311 if (checkusergroup($data['post_author'], $group)) { 312 $ranking_match = true; 313 break; 314 } 315 } 316 } 317 } else { 318 // no groups to test, must be a match on posts range 319 $ranking_match = true; 320 } 321 // if we had a match, add the ranking information to the post data 322 if ($ranking_match) { 323 $data['ranking'] = $data2; 324 $data['show_ranking'] = true; 325 break; 326 } 327 } 280 328 } 281 329 … … 301 349 $last_post_datestamp = max($data['post_datestamp'], $data['post_edittime'], $last_post_datestamp); 302 350 303 // check what options to show for this post 304 $data['user_can_edit'] = iMEMBER && $data['post_author'] != 0 && (iMOD || iSUPERADMIN || (!$tdata['thread_locked'] && $userdata['user_id'] == $data['post_author'])); 351 // check if the user can edit this post. Assume the user can't 352 $data['user_can_edit'] = false; 353 if (iMEMBER) { 354 // webmasters and forum moderators may always edit 355 if (iSUPERADMIN || iMOD) { 356 $data['user_can_edit'] = true; 357 } else { 358 // check if this is not a system post 359 if ($data['post_author'] != 0) { 360 // check if the thread is not locked 361 if (!$tdata['thread_locked']) { 362 // check if this is the users own post 363 if ($userdata['user_id'] == $data['post_author']) { 364 // check if the edit time is not expired 365 if ($settings['forum_edit_timeout'] == 0 || ($data['post_datestamp'] + $settings['forum_edit_timeout'] * 3600) > time()) { 366 $data['user_can_edit'] = true; 367 } 368 } 369 } 370 } 371 } 372 } 373 374 // check if we can show the poster's IP address 305 375 $data['show_ip'] = (iMOD || iSUPERADMIN && ($data['post_ip'] != "0.0.0.0" && file_exists(PATH_THEME."images/ip.gif"))); 306 376 … … 311 381 $data['cc_flag'] = GeoIP_Code2Flag($settings['country']); 312 382 } else { 313 $data['cc_flag'] = GeoIP_IP2Flag($data['post_ip']);383 $data['cc_flag'] = !empty($data['post_cc']) ? GeoIP_Code2Flag($data['post_cc']) : GeoIP_IP2Flag($data['post_ip']); 314 384 } 315 385 } else { … … 324 394 // user & group memberships 325 395 $data['group_names'] = array(); 396 // if a ranking is present, and a rank title is defined, display that first 397 if (isset($data['ranking']) && !empty($data['ranking']['rank_title']) && !$data['ranking']['rank_tooltip']) { 398 $data['group_names'][] = array('type' => 'R', 'color' => $data['ranking']['rank_color'], 'name' => $data['ranking']['rank_title']); 399 } 400 // display the standard user level next 326 401 $data['group_names'][] = array('type' => 'U', 'level' => $data['user_level'], 'name' => getuserlevel($data['user_level'])); 327 402
Note: See TracChangeset
for help on using the changeset viewer.
