Initial SQL updates complete

git-svn-id: file:///svn/phpbb/trunk@281 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-05-13 16:02:30 +00:00
parent bdaedc9afc
commit e3bd966042
13 changed files with 192 additions and 171 deletions

View file

@ -68,7 +68,7 @@ include('includes/db.'.$phpEx);
// //
$sql = "SELECT * $sql = "SELECT *
FROM ".CONFIG_TABLE." FROM ".CONFIG_TABLE."
WHERE selected = '1'"; WHERE selected = 1";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
// //

View file

@ -114,7 +114,7 @@ class sql_db
if(eregi("LIMIT", $query)) if(eregi("LIMIT", $query))
{ {
preg_match("/^(.*)LIMIT ([0-9]+)[, ]*([0-9]+)*$/", $query, $limits); preg_match("/^(.*)LIMIT ([0-9]+)[, ]*([0-9]+)*/s", $query, $limits);
$query = $limits[1]; $query = $limits[1];
if($limits[3]) if($limits[3])

View file

@ -130,9 +130,9 @@ class sql_db
{ {
if(!eregi("^INSERT ",$query)) if(!eregi("^INSERT ",$query))
{ {
if(eregi(" LIMIT ", $query)) if(eregi("LIMIT", $query))
{ {
preg_match("/^(.*)LIMIT ([0-9]+)[, ]*([0-9]+)*", $query, $limits); preg_match("/^(.*)LIMIT ([0-9]+)[, ]*([0-9]+)*/s", $query, $limits);
$query = $limits[1]; $query = $limits[1];
if($limits[3]) if($limits[3])
@ -158,29 +158,29 @@ class sql_db
} }
else else
{ {
$this->query_result = @odbc_exec($this->db_connect_id, $query); $this->query_result = odbc_exec($this->db_connect_id, $query);
$row_offset = 0; $row_offset = 0;
$this->result_numrows[$this->query_result] = 5E6; $this->result_numrows[$this->query_result] = 5E6;
} }
if($this->query_result) $result_id = $this->query_result;
if($this->query_result && eregi("^SELECT", $query))
{ {
$result_id = $this->query_result;
for($i = 1; $i < @odbc_num_fields($result_id)+1; $i++) for($i = 1; $i < odbc_num_fields($result_id)+1; $i++)
{ {
$this->result_field_names[$result_id][] = @odbc_field_name($result_id, $i); $this->result_field_names[$result_id][] = odbc_field_name($result_id, $i);
} }
$i = $row_offset + 1; $i = $row_offset + 1;
$k = 0; $k = 0;
while(@odbc_fetch_row($result_id, $i) && $k < $this->result_numrows[$result_id]) while(odbc_fetch_row($result_id, $i) && $k < $this->result_numrows[$result_id])
{ {
for($j = 1; $j < count($this->result_field_names[$result_id])+1; $j++) for($j = 1; $j < count($this->result_field_names[$result_id])+1; $j++)
{ {
$this->result_rowset[$result_id][$k][$this->result_field_names[$result_id][$j-1]] = @odbc_result($result_id, $j); $this->result_rowset[$result_id][$k][$this->result_field_names[$result_id][$j-1]] = odbc_result($result_id, $j);
} }
$i++; $i++;
$k++; $k++;
@ -189,10 +189,15 @@ class sql_db
$this->result_numrows[$result_id] = $k; $this->result_numrows[$result_id] = $k;
$this->row_index[$result_id] = 0; $this->row_index[$result_id] = 0;
} }
else
{
$this->result_numrows[$result_id] = @odbc_num_rows($result_id);
$this->row_index[$result_id] = 0;
}
} }
else else
{ {
$this->query_result = @odbc_exec($this->db_connect_id, $query); $this->query_result = odbc_exec($this->db_connect_id, $query);
if($this->query_result) if($this->query_result)
{ {
@ -210,10 +215,10 @@ class sql_db
default: default:
$sql_id = ""; $sql_id = "";
} }
$id_result = @odbc_exec($this->db_connect_id, $sql_id); $id_result = odbc_exec($this->db_connect_id, $sql_id);
if($id_result) if($id_result)
{ {
$row_result = @odbc_fetch_row($id_result); $row_result = odbc_fetch_row($id_result);
if($row_result) if($row_result)
{ {
$this->next_id[$this->query_result] = odbc_result($id_result, 1); $this->next_id[$this->query_result] = odbc_result($id_result, 1);
@ -261,14 +266,14 @@ class sql_db
{ {
$query_id = $this->query_result; $query_id = $this->query_result;
} }
/* if($query_id) if($query_id)
{ {
return $this->@odbc_num_rows[$query_id]; return $this->result_numrows[$query_id];
} }
else else
{ {
return false; return false;
}*/ }
} }
function sql_numfields($query_id = 0) function sql_numfields($query_id = 0)
{ {

View file

@ -24,9 +24,7 @@
function error_die($error_code, $error_msg = "", $line = "", $file = "") function error_die($error_code, $error_msg = "", $line = "", $file = "")
{ {
global $db, $template, $phpEx, $default_lang; global $db, $template, $phpEx, $default_lang, $theme;
global $table_bgcolor, $color1;
global $starttime, $phpbbversion;
if(!defined("HEADER_INC")) if(!defined("HEADER_INC"))
{ {
@ -42,6 +40,10 @@ function error_die($error_code, $error_msg = "", $line = "", $file = "")
{ {
$template = new Template("templates/Default"); $template = new Template("templates/Default");
} }
if(!$theme)
{
$theme = setuptheme(1);
}
include('includes/page_header.'.$phpEx); include('includes/page_header.'.$phpEx);
} }
if(!$error_msg) if(!$error_msg)
@ -56,8 +58,7 @@ function error_die($error_code, $error_msg = "", $line = "", $file = "")
break; break;
case SQL_CONNECT: case SQL_CONNECT:
$db_error = $db->sql_error(); $error_msg = "Couldn't connect to database!";
$error_msg .= "<br />SQL connect error - " . $db_error["message"];
break; break;
case BANNED: case BANNED:
@ -65,8 +66,6 @@ function error_die($error_code, $error_msg = "", $line = "", $file = "")
break; break;
case SQL_QUERY: case SQL_QUERY:
$db_error = $db->sql_error();
$error_msg .= "<br />SQL query error - ".$db_error["message"];
break; break;
case SESSION_CREATE: case SESSION_CREATE:
@ -88,8 +87,10 @@ function error_die($error_code, $error_msg = "", $line = "", $file = "")
$error_msg .= "<br /><br /><u>DEBUG INFO</u></br /><br>Line: ".$line."<br />File: ".$file; $error_msg .= "<br /><br /><u>DEBUG INFO</u></br /><br>Line: ".$line."<br />File: ".$file;
} }
$template->set_filenames(array("error_body" => "error_body.tpl")); $template->set_filenames(array(
$template->assign_vars(array("ERROR_MESSAGE" => $error_msg)); "error_body" => "error_body.tpl"));
$template->assign_vars(array(
"ERROR_MESSAGE" => $error_msg));
$template->pparse("error_body"); $template->pparse("error_body");
include('includes/page_tail.'.$phpEx); include('includes/page_tail.'.$phpEx);
@ -97,4 +98,4 @@ function error_die($error_code, $error_msg = "", $line = "", $file = "")
exit(); exit();
} }
?> ?>

View file

@ -73,7 +73,7 @@ else
$sql = "SELECT u.username, u.user_id, s.session_logged_in $sql = "SELECT u.username, u.user_id, s.session_logged_in
FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
WHERE u.user_id = s.session_user_id WHERE u.user_id = s.session_user_id
AND s.session_time >= '".(time() - 300)."'"; AND s.session_time >= ".(time() - 300);
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if(!$result) if(!$result)
{ {

View file

@ -27,7 +27,7 @@
// Adds/updates a new session to the database for the given userid. // Adds/updates a new session to the database for the given userid.
// Returns the new session ID on success. // Returns the new session ID on success.
// //
function session_begin($user_id, $user_ip, $page_id, $session_length, $login = FALSE, $autologin = FALSE) function session_begin($user_id, $user_ip, $page_id, $session_length, $login = 0, $autologin = 0)
{ {
global $db; global $db;
@ -53,7 +53,7 @@ function session_begin($user_id, $user_ip, $page_id, $session_length, $login = F
// //
$sql = "SELECT ban_ip, ban_userid $sql = "SELECT ban_ip, ban_userid
FROM ".BANLIST_TABLE." FROM ".BANLIST_TABLE."
WHERE (ban_ip = '$int_ip' OR ban_userid = '$user_id') WHERE (ban_ip = '$int_ip' OR ban_userid = $user_id)
AND (ban_start < $current_time AND ban_end > $current_time )"; AND (ban_start < $current_time AND ban_end > $current_time )";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if (!$result) if (!$result)
@ -73,8 +73,8 @@ function session_begin($user_id, $user_ip, $page_id, $session_length, $login = F
{ {
if($user_id == ANONYMOUS) if($user_id == ANONYMOUS)
{ {
$login = FALSE; $login = 0;
$autologin = FALSE; $autologin = 0;
} }
// //
// Remove duplicate user_id from session table // Remove duplicate user_id from session table
@ -85,18 +85,20 @@ function session_begin($user_id, $user_ip, $page_id, $session_length, $login = F
if( ( $login || $autologin ) && $user_id != ANONYMOUS && $user_id != DELETED ) if( ( $login || $autologin ) && $user_id != ANONYMOUS && $user_id != DELETED )
{ {
$sql_delete_same_user = "DELETE FROM ".SESSIONS_TABLE." $sql_delete_same_user = "DELETE FROM ".SESSIONS_TABLE."
WHERE session_user_id = '$user_id' WHERE session_user_id = $user_id
AND session_ip != '$int_ip' AND session_ip <> '$int_ip'
AND session_logged_in = '1'"; AND session_logged_in = 1";
$result = $db->sql_query($sql_delete_same_user); $result = $db->sql_query($sql_delete_same_user);
} }
$sql_update = "UPDATE ".SESSIONS_TABLE." $sql_update = "UPDATE ".SESSIONS_TABLE."
SET session_user_id = '$user_id', session_start = '$current_time', session_time = '$current_time', session_page = '$page_id', session_logged_in = '$login' SET session_user_id = $user_id, session_start = $current_time, session_time = $current_time, session_page = $page_id, session_logged_in = $login
WHERE (session_id = '".$sessiondata['sessionid']."') WHERE (session_id = '".$sessiondata['sessionid']."')
AND (session_ip = '$int_ip')"; AND (session_ip = '$int_ip')";
$result = $db->sql_query($sql_update); $result = $db->sql_query($sql_update);
// $affected = $db->sql_affectedrows();
if(!$result || !$db->sql_affectedrows()) if(!$result || !$db->sql_affectedrows())
{ {
mt_srand( (double) microtime() * 1000000); mt_srand( (double) microtime() * 1000000);
@ -106,7 +108,7 @@ function session_begin($user_id, $user_ip, $page_id, $session_length, $login = F
$sql_insert = "INSERT INTO ".SESSIONS_TABLE." $sql_insert = "INSERT INTO ".SESSIONS_TABLE."
(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in) (session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in)
VALUES VALUES
('$session_id', '$user_id', '$current_time', '$current_time', '$int_ip', '$page_id', '$login')"; ('$session_id', $user_id, $current_time, $current_time, '$int_ip', $page_id, $login)";
$result = $db->sql_query($sql_insert); $result = $db->sql_query($sql_insert);
if(!$result) if(!$result)
{ {
@ -133,7 +135,7 @@ function session_begin($user_id, $user_ip, $page_id, $session_length, $login = F
$sql_update = "UPDATE ".USERS_TABLE." $sql_update = "UPDATE ".USERS_TABLE."
SET user_autologin_key = '$autologin_key' SET user_autologin_key = '$autologin_key'
WHERE user_id = '$user_id'"; WHERE user_id = $user_id";
$result = $db->sql_query($sql_update); $result = $db->sql_query($sql_update);
if(!$result) if(!$result)
{ {
@ -156,6 +158,9 @@ function session_begin($user_id, $user_ip, $page_id, $session_length, $login = F
setcookie($cookiename, $serialised_cookiedata, $session_length, $cookiepath, $cookiedomain, $cookiesecure); setcookie($cookiename, $serialised_cookiedata, $session_length, $cookiepath, $cookiedomain, $cookiesecure);
$SID = ($sessionmethod == SESSION_METHOD_GET) ? "sid=".$sessiondata['sessionid'] : ""; $SID = ($sessionmethod == SESSION_METHOD_GET) ? "sid=".$sessiondata['sessionid'] : "";
// echo $sql_update."<br>".$affected."<br>".$sql_insert."<br>";
} }
return $session_id; return $session_id;
@ -279,8 +284,8 @@ function session_pagestart($user_ip, $thispage_id, $session_length)
if($current_time - $userdata['session_time'] > 60) if($current_time - $userdata['session_time'] > 60)
{ {
$sql = "UPDATE ".SESSIONS_TABLE." $sql = "UPDATE ".SESSIONS_TABLE."
SET session_time = '$current_time', session_page = '$thispage_id' SET session_time = $current_time, session_page = $thispage_id
WHERE (session_id = ".$userdata['session_id'].") WHERE (session_id = '".$userdata['session_id']."')
AND (session_ip = '$int_ip') AND (session_ip = '$int_ip')
AND (session_user_id = ".$userdata['user_id'].")"; AND (session_user_id = ".$userdata['user_id'].")";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -323,15 +328,15 @@ function session_pagestart($user_ip, $thispage_id, $session_length)
// pull basic user prefs. // pull basic user prefs.
// //
$login = FALSE; $login = 0;
$autologin = FALSE; $autologin = 0;
$userdata['session_logged_in'] = 0; $userdata['session_logged_in'] = 0;
if(isset($sessiondata['userid']) && isset($sessiondata['autologinid'])) if(isset($sessiondata['userid']) && isset($sessiondata['autologinid']))
{ {
$sql = "SELECT u.* $sql = "SELECT u.*
FROM ".USERS_TABLE." u FROM ".USERS_TABLE." u
WHERE u.user_id = '".$sessiondata['userid']."'"; WHERE u.user_id = ".$sessiondata['userid'];
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if (!$result) if (!$result)
{ {
@ -354,8 +359,8 @@ function session_pagestart($user_ip, $thispage_id, $session_length)
// We have a match, and not the kind you light ... // We have a match, and not the kind you light ...
// //
$userdata['session_logged_in'] = 1; $userdata['session_logged_in'] = 1;
$login = TRUE; $login = 1;
$autologin = TRUE; $autologin = 1;
} }
$userdata['user_id'] = $sessiondata['userid']; $userdata['user_id'] = $sessiondata['userid'];
} }
@ -371,7 +376,6 @@ function session_pagestart($user_ip, $thispage_id, $session_length)
$userdata['user_id'] = ANONYMOUS; $userdata['user_id'] = ANONYMOUS;
} }
$result = session_begin($userdata['user_id'], $user_ip, $thispage_id, $session_length, $login, $autologin); $result = session_begin($userdata['user_id'], $user_ip, $thispage_id, $session_length, $login, $autologin);
if(!$result) if(!$result)
{ {
@ -416,9 +420,9 @@ function session_end($session_id, $user_id)
$current_time = time(); $current_time = time();
$sql = "UPDATE ".SESSIONS_TABLE." $sql = "UPDATE ".SESSIONS_TABLE."
SET session_logged_in = '0', session_user_id = '-1' SET session_logged_in = 0, session_user_id = -1, session_time = $current_time
WHERE (session_user_id = $user_id) WHERE (session_user_id = $user_id)
AND (session_id = $session_id)"; AND (session_id = '$session_id')";
$result = $db->sql_query($sql, $db); $result = $db->sql_query($sql, $db);
if (!$result) if (!$result)
{ {
@ -436,7 +440,7 @@ function session_end($session_id, $user_id)
{ {
$sql = "UPDATE ".USERS_TABLE." $sql = "UPDATE ".USERS_TABLE."
SET user_autologin_key = '' SET user_autologin_key = ''
WHERE user_id = '$user_id'"; WHERE user_id = $user_id";
$result = $db->sql_query($sql, $db); $result = $db->sql_query($sql, $db);
if (!$result) if (!$result)
{ {
@ -459,8 +463,8 @@ function session_end($session_id, $user_id)
$SID = ($sessionmethod == SESSION_METHOD_GET) ? "sid=".$sessiondata['sessionid'] : ""; $SID = ($sessionmethod == SESSION_METHOD_GET) ? "sid=".$sessiondata['sessionid'] : "";
return true; return 1;
} // session_end() } // session_end()
?> ?>

View file

@ -35,7 +35,6 @@ init_userprefs($userdata);
// //
// End session management // End session management
// //
//nl2br(var_dump($userdata));
$total_posts = get_db_stat('postcount'); $total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount'); $total_users = get_db_stat('usercount');
@ -51,7 +50,7 @@ if(empty($viewcat))
include('includes/page_header.'.$phpEx); include('includes/page_header.'.$phpEx);
$sql = "SELECT c.* $sql = "SELECT c.cat_id, c.cat_title, c.cat_order
FROM ".CATEGORIES_TABLE." c, ".FORUMS_TABLE." f FROM ".CATEGORIES_TABLE." c, ".FORUMS_TABLE." f
WHERE f.cat_id=c.cat_id WHERE f.cat_id=c.cat_id
GROUP BY c.cat_id, c.cat_title, c.cat_order GROUP BY c.cat_id, c.cat_title, c.cat_order
@ -70,14 +69,14 @@ if($total_categories)
$limit_forums = ""; $limit_forums = "";
if($viewcat != -1) if($viewcat != -1)
{ {
$limit_forums = " WHERE f.cat_id = $viewcat "; $limit_forums = "AND f.cat_id = $viewcat ";
} }
$sql = "SELECT f.*, t.topic_id, u.username, u.user_id, p.post_time $sql = "SELECT f.*, t.topic_id, u.username, u.user_id, p.post_time
FROM ".FORUMS_TABLE." f FROM ".FORUMS_TABLE." f, ".POSTS_TABLE." p, ".USERS_TABLE." u, ".TOPICS_TABLE." t
LEFT JOIN ".POSTS_TABLE." p ON p.post_id = f.forum_last_post_id WHERE p.post_id = f.forum_last_post_id
LEFT JOIN ".USERS_TABLE." u ON u.user_id = p.poster_id AND u.user_id = p.poster_id
LEFT JOIN ".TOPICS_TABLE." t ON t.topic_last_post_id = p.post_id AND t.topic_last_post_id = p.post_id
$limit_forums $limit_forums
ORDER BY f.cat_id, f.forum_order"; ORDER BY f.cat_id, f.forum_order";
if(!$q_forums = $db->sql_query($sql)) if(!$q_forums = $db->sql_query($sql))
{ {

View file

@ -38,9 +38,9 @@ if(isset($HTTP_POST_VARS['submit']) || isset($HTTP_GET_VARS['submit']))
if($HTTP_POST_VARS['submit'] == "Login" && !$userdata['session_logged_in']) if($HTTP_POST_VARS['submit'] == "Login" && !$userdata['session_logged_in'])
{ {
$username = $HTTP_POST_VARS["username"]; $username = $HTTP_POST_VARS['username'];
$password = $HTTP_POST_VARS["password"]; $password = $HTTP_POST_VARS['password'];
$sql = "SELECT * $sql = "SELECT user_id, username, user_password, user_active
FROM ".USERS_TABLE." FROM ".USERS_TABLE."
WHERE username = '$username'"; WHERE username = '$username'";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -52,11 +52,11 @@ if(isset($HTTP_POST_VARS['submit']) || isset($HTTP_GET_VARS['submit']))
$rowresult = $db->sql_fetchrow($result); $rowresult = $db->sql_fetchrow($result);
if(count($rowresult)) if(count($rowresult))
{ {
if((md5($password) == $rowresult["user_password"]) && $rowresult['user_active'] != 0) if((md5($password) == $rowresult['user_password']) && $rowresult['user_active'] != 0)
{ {
$autologin = (isset($HTTP_POST_VARS['autologin'])) ? TRUE : FALSE; $autologin = (isset($HTTP_POST_VARS['autologin'])) ? TRUE : FALSE;
$session_id = session_begin($rowresult["user_id"], $user_ip, PAGE_INDEX, $session_length, TRUE, $autologin); $session_id = session_begin($rowresult['user_id'], $user_ip, PAGE_INDEX, $session_length, TRUE, $autologin);
if($session_id) if($session_id)
{ {
if(!empty($HTTP_POST_VARS['forward_page'])) if(!empty($HTTP_POST_VARS['forward_page']))
@ -87,7 +87,7 @@ if(isset($HTTP_POST_VARS['submit']) || isset($HTTP_GET_VARS['submit']))
{ {
if($userdata['session_logged_in']) if($userdata['session_logged_in'])
{ {
session_end($userdata["session_id"], $userdata["user_id"]); session_end($userdata['session_id'], $userdata['user_id']);
} }
if(!empty($HTTP_POST_VARS['forward_page'])) if(!empty($HTTP_POST_VARS['forward_page']))
{ {

View file

@ -46,24 +46,24 @@ if(isset($HTTP_GET_VARS['mode']))
case 'topten': case 'topten':
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email
FROM ".USERS_TABLE." FROM ".USERS_TABLE."
WHERE user_id != ".ANONYMOUS." WHERE user_id <> ".ANONYMOUS."
AND user_level != ".DELETED." AND user_level <> ".DELETED."
ORDER BY user_posts DESC ORDER BY user_posts DESC
LIMIT 10"; LIMIT 10";
break; break;
case 'alpha': case 'alpha':
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email
FROM ".USERS_TABLE." FROM ".USERS_TABLE."
WHERE user_id != ".ANONYMOUS." WHERE user_id <> ".ANONYMOUS."
AND user_level != ".DELETED." AND user_level <> ".DELETED."
ORDER BY username ASC ORDER BY username ASC
LIMIT $start, ".$board_config['topics_per_page']; LIMIT $start, ".$board_config['topics_per_page'];
break; break;
default: default:
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email
FROM ".USERS_TABLE." FROM ".USERS_TABLE."
WHERE user_id != ".ANONYMOUS." WHERE user_id <> ".ANONYMOUS."
AND user_level != ".DELETED." AND user_level <> ".DELETED."
ORDER BY user_id ASC ORDER BY user_id ASC
LIMIT $start, ".$board_config['topics_per_page']; LIMIT $start, ".$board_config['topics_per_page'];
break; break;
@ -73,8 +73,8 @@ else
{ {
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email
FROM ".USERS_TABLE." FROM ".USERS_TABLE."
WHERE user_id != ".ANONYMOUS." WHERE user_id <> ".ANONYMOUS."
AND user_level != ".DELETED." AND user_level <> ".DELETED."
ORDER BY user_id ASC ORDER BY user_id ASC
LIMIT $start, ".$board_config['topics_per_page']; LIMIT $start, ".$board_config['topics_per_page'];
} }
@ -115,7 +115,7 @@ if(($selected_members = $db->sql_numrows($result)) > 0)
$from = stripslashes($members[$x]['user_from']); $from = stripslashes($members[$x]['user_from']);
$joined = create_date($board_config['default_dateformat'], $members[$x]['user_regdate'], $board_config['default_timezone']); $joined = create_date($board_config['default_dateformat'], $members[$x]['user_regdate'], $board_config['default_timezone']);
if($members[$x]['user_viewemail'] != 0) if($members[$x]['user_viewemail'] <> 0)
{ {
$email = str_replace("@", " at ", $members[$x]['user_email']); $email = str_replace("@", " at ", $members[$x]['user_email']);
$email = "<a href=\"mailto:$email\">$email</a>"; $email = "<a href=\"mailto:$email\">$email</a>";
@ -125,7 +125,7 @@ if(($selected_members = $db->sql_numrows($result)) > 0)
$email = "&nbsp;"; $email = "&nbsp;";
} }
if($members[$x]['user_website'] != '') if($members[$x]['user_website'] <> '')
{ {
$url_img = $images['www']; $url_img = $images['www'];
$url = "<a href=\"".stripslashes($members[$x]['user_website'])."\"><img src=\"".$url_img."\" border=\"0\"/></a>"; $url = "<a href=\"".stripslashes($members[$x]['user_website'])."\"><img src=\"".$url_img."\" border=\"0\"/></a>";
@ -154,12 +154,12 @@ if(($selected_members = $db->sql_numrows($result)) > 0)
"WEBSITE" => $url)); "WEBSITE" => $url));
} }
if($mode != "topten") if($mode <> "topten")
{ {
$sql = "SELECT count(*) AS total $sql = "SELECT count(*) AS total
FROM ".USERS_TABLE." FROM ".USERS_TABLE."
WHERE user_id != ".ANONYMOUS." WHERE user_id <> ".ANONYMOUS."
AND user_level != ".DELETED; AND user_level <> ".DELETED;
if(!$count_result = $db->sql_query($sql)) if(!$count_result = $db->sql_query($sql))
{ {
if(DEBUG) if(DEBUG)

View file

@ -365,8 +365,8 @@ switch($mode)
{ {
$sql = "UPDATE ".USERS_TABLE." $sql = "UPDATE ".USERS_TABLE."
SET username = '$username'".$passwd_sql.", user_email = '$email', user_icq = '$icq', user_website = '$website', user_occ = '$occ', user_from = '$location', user_interests = '$interests', user_sig = '$signature', user_viewemail = '$viewemail', user_aim = '$aim', user_yim = '$yim', user_msnm = '$msn', user_attachsig = '$attachsig', user_desmile = '$allowsmilies', user_html = '$allowhtml', user_bbcode = '$allowbbcode', user_timezone = '$user_timezone', user_dateformat = '$user_dateformat', user_lang = '$user_lang', user_template = '$user_template', user_theme = '$user_theme' SET username = '$username'".$passwd_sql.", user_email = '$email', user_icq = '$icq', user_website = '$website', user_occ = '$occ', user_from = '$location', user_interests = '$interests', user_sig = '$signature', user_viewemail = $viewemail, user_aim = '$aim', user_yim = '$yim', user_msnm = '$msn', user_attachsig = $attachsig, user_desmile = $allowsmilies, user_html = $allowhtml, user_bbcode = $allowbbcode, user_timezone = $user_timezone, user_dateformat = '$user_dateformat', user_lang = '$user_lang', user_template = '$user_template', user_theme = $user_theme
WHERE user_id = '$user_id'"; WHERE user_id = $user_id";
if($result = $db->sql_query($sql)) if($result = $db->sql_query($sql))
{ {
@ -608,7 +608,7 @@ switch($mode)
$sql = "INSERT INTO ".USERS_TABLE." $sql = "INSERT INTO ".USERS_TABLE."
(user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_desmile, user_html, user_bbcode, user_timezone, user_dateformat, user_lang, user_template, user_theme, user_active, user_actkey) (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_desmile, user_html, user_bbcode, user_timezone, user_dateformat, user_lang, user_template, user_theme, user_active, user_actkey)
VALUES VALUES
('$new_user_id', '$username', '$regdate', '$md_pass', '$email', '$icq', '$website', '$occupation', '$location', '$interests', '$signature', '$viewemail', '$aim', '$yim', '$msn', '$attachsig', '$allowsmilies', '$allowhtml', '$allowbbcode', '$user_timezone', '$user_dateformat', '$user_lang', '$user_template', '$user_theme', "; ($new_user_id, '$username', '$regdate', '$md_pass', '$email', '$icq', '$website', '$occupation', '$location', '$interests', '$signature', '$viewemail', '$aim', '$yim', '$msn', $attachsig, $allowsmilies, '$allowhtml', $allowbbcode, $user_timezone, '$user_dateformat', '$user_lang', '$user_template', $user_theme, ";
if($require_activation || $coppa == 1) if($require_activation || $coppa == 1)
{ {
$act_key = generate_activation_key(); $act_key = generate_activation_key();

View file

@ -47,8 +47,8 @@ if(isset($forum_id))
{ {
$sql = "SELECT f.forum_type, f.forum_name, f.forum_topics, u.username, u.user_id $sql = "SELECT f.forum_type, f.forum_name, f.forum_topics, u.username, u.user_id
FROM ".FORUMS_TABLE." f, ".FORUM_MODS_TABLE." fm, ".USERS_TABLE." u FROM ".FORUMS_TABLE." f, ".FORUM_MODS_TABLE." fm, ".USERS_TABLE." u
WHERE f.forum_id = '$forum_id' WHERE f.forum_id = $forum_id
AND fm.forum_id = '$forum_id' AND fm.forum_id = $forum_id
AND u.user_id = fm.user_id"; AND u.user_id = fm.user_id";
} }
else else
@ -56,15 +56,6 @@ else
error_die(GENERAL_ERROR, "You have reached this page in error, please go back and try again"); error_die(GENERAL_ERROR, "You have reached this page in error, please go back and try again");
} }
//
// Start session management
//
$userdata = session_pagestart($user_ip, $forum_id, $session_length);
init_userprefs($userdata);
//
// End session management
//
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
error_die(SQL_QUERY, "Couldn't obtain forums information.", __LINE__, __FILE__); error_die(SQL_QUERY, "Couldn't obtain forums information.", __LINE__, __FILE__);
@ -76,6 +67,18 @@ if(!$total_rows = $db->sql_numrows($result))
error_die(GENERAL_ERROR, "The forum you selected does not exist. Please go back and try again."); error_die(GENERAL_ERROR, "The forum you selected does not exist. Please go back and try again.");
} }
//
// Start session management
//
$userdata = session_pagestart($user_ip, $forum_id, $session_length);
init_userprefs($userdata);
//
// End session management
//
// //
// Add checking for private forums here!! // Add checking for private forums here!!
// //
@ -88,15 +91,15 @@ if(!$forum_row)
error_die(SQL_QUERY, "Couldn't obtain rowset.", __LINE__, __FILE__); error_die(SQL_QUERY, "Couldn't obtain rowset.", __LINE__, __FILE__);
} }
$forum_name = stripslashes($forum_row[0]["forum_name"]); $forum_name = stripslashes($forum_row[0]['forum_name']);
$topics_count = $forum_row[0]["forum_topics"]; $topics_count = $forum_row[0]['forum_topics'];
for($x = 0; $x < $db->sql_numrows($result); $x++) for($x = 0; $x < $db->sql_numrows($result); $x++)
{ {
if($x > 0) if($x > 0)
$forum_moderators .= ", "; $forum_moderators .= ", ";
$forum_moderators .= "<a href=\"".append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$forum_row[$x]["user_id"])."\">".$forum_row[$x]["username"]."</a>"; $forum_moderators .= "<a href=\"".append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$forum_row[$x]['user_id'])."\">".$forum_row[$x]['username']."</a>";
} }
if(!isset($start)) if(!isset($start))
@ -104,12 +107,16 @@ if(!isset($start))
$start = 0; $start = 0;
} }
//
// Grab all the basic data for
// this forum
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time
FROM " . TOPICS_TABLE ." t FROM ".TOPICS_TABLE." t, ".USERS_TABLE." u, ".POSTS_TABLE." p, ".USERS_TABLE." u2
LEFT JOIN ". USERS_TABLE. " u ON t.topic_poster = u.user_id WHERE t.forum_id = $forum_id
LEFT JOIN ".POSTS_TABLE." p ON p.post_id = t.topic_last_post_id AND t.topic_poster = u.user_id
LEFT JOIN " . USERS_TABLE . " u2 ON p.poster_id = u2.user_id AND p.post_id = t.topic_last_post_id
WHERE t.forum_id = '$forum_id' AND p.poster_id = u2.user_id
ORDER BY topic_time DESC ORDER BY topic_time DESC
LIMIT $start, ".$board_config['topics_per_page']; LIMIT $start, ".$board_config['topics_per_page'];
if(!$t_result = $db->sql_query($sql)) if(!$t_result = $db->sql_query($sql))
@ -118,6 +125,7 @@ if(!$t_result = $db->sql_query($sql))
} }
$total_topics = $db->sql_numrows($t_result); $total_topics = $db->sql_numrows($t_result);
// //
// Post URL generation for // Post URL generation for
// templating vars // templating vars
@ -139,9 +147,9 @@ if($total_topics)
$topic_rowset = $db->sql_fetchrowset($t_result); $topic_rowset = $db->sql_fetchrowset($t_result);
for($x = 0; $x < $total_topics; $x++) for($x = 0; $x < $total_topics; $x++)
{ {
$topic_title = stripslashes($topic_rowset[$x]["topic_title"]); $topic_title = stripslashes($topic_rowset[$x]['topic_title']);
$topic_id = $topic_rowset[$x]["topic_id"]; $topic_id = $topic_rowset[$x]['topic_id'];
$replies = $topic_rowset[$x]["topic_replies"]; $replies = $topic_rowset[$x]['topic_replies'];
if($replies > $board_config['posts_per_page']) if($replies > $board_config['posts_per_page'])
{ {
$goto_page = "&nbsp;&nbsp;&nbsp;(<img src=\"".$images['posticon']."\">$l_gotopage: "; $goto_page = "&nbsp;&nbsp;&nbsp;(<img src=\"".$images['posticon']."\">$l_gotopage: ";
@ -176,14 +184,14 @@ if($total_topics)
$view_topic_url = append_sid("viewtopic.".$phpEx."?".POST_TOPIC_URL."=".$topic_id."&".$replies); $view_topic_url = append_sid("viewtopic.".$phpEx."?".POST_TOPIC_URL."=".$topic_id."&".$replies);
$topic_poster = stripslashes($topic_rowset[$x]["username"]); $topic_poster = stripslashes($topic_rowset[$x]['username']);
$topic_poster_profile_url = append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$topic_rowset[$x]["user_id"]); $topic_poster_profile_url = append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$topic_rowset[$x]['user_id']);
$last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$x]["post_time"], $board_config['default_timezone']); $last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$x]['post_time'], $board_config['default_timezone']);
$last_post_user = $topic_rowset[$x]["user2"]; $last_post_user = $topic_rowset[$x]['user2'];
$last_post_profile_url = append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$topic_rowset[$x]["id2"]); $last_post_profile_url = append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$topic_rowset[$x]['id2']);
$views = $topic_rowset[$x]["topic_views"]; $views = $topic_rowset[$x]['topic_views'];
$template->assign_block_vars("topicrow", array( $template->assign_block_vars("topicrow", array(
"FORUM_ID" => $forum_id, "FORUM_ID" => $forum_id,

View file

@ -44,9 +44,8 @@ $newest_uid = $newest_userdata["user_id"];
include('includes/page_header.'.$phpEx); include('includes/page_header.'.$phpEx);
$sql = "SELECT u.username, u.user_id, f.forum_name, f.forum_id, s.session_page, s.session_logged_in, s.session_time $sql = "SELECT u.username, u.user_id, s.session_page, s.session_logged_in, s.session_time
FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
LEFT JOIN ".FORUMS_TABLE." f ON f.forum_id = s.session_page
WHERE u.user_id = s.session_user_id WHERE u.user_id = s.session_user_id
AND s.session_time >= ".(time()-300)." AND s.session_time >= ".(time()-300)."
ORDER BY s.session_time DESC"; ORDER BY s.session_time DESC";
@ -56,7 +55,16 @@ if(!$result)
error_die(SQL_QUERY, "Couldn't obtain user/online information.", __LINE__, __FILE__); error_die(SQL_QUERY, "Couldn't obtain user/online information.", __LINE__, __FILE__);
} }
$onlinerow = $db->sql_fetchrowset($result); $onlinerow = $db->sql_fetchrowset($result);
if(!$onlinerow) $sql = "SELECT forum_name, forum_id
FROM ".FORUMS_TABLE;
$forums_result = $db->sql_query($sql);
if(!$forums_result)
{
error_die(SQL_QUERY, "Couldn't obtain user/online forums information.", __LINE__, __FILE__);
}
$forumsrow = $db->sql_fetchrowset($forums_result);
if(!$onlinerow || !$forumsrow)
{ {
error_die(SQL_QUERY, "Couldn't fetchrow", __LINE__, __FILE__); error_die(SQL_QUERY, "Couldn't fetchrow", __LINE__, __FILE__);
} }
@ -69,7 +77,6 @@ $template->assign_vars(array(
) )
); );
$active_users = 0; $active_users = 0;
$guest_users = 0; $guest_users = 0;
@ -124,7 +131,7 @@ if($online_count)
$guest_users++; $guest_users++;
} }
if($onlinerow[$i]['forum_name'] == "") if($onlinerow[$i]['session_page'] < 0)
{ {
switch($onlinerow[$i]['session_page']) switch($onlinerow[$i]['session_page'])
{ {
@ -171,8 +178,15 @@ if($online_count)
} }
else else
{ {
$location_url = append_sid("viewforum.".$phpEx."?".POST_FORUM_URL."=".$onlinerow[$i]['forum_id']); for($j = 0; $j < count($forumrow); $j++)
$location = $onlinerow[$i]['forum_name']; {
if($onlinerow[$i]['session_page'] == $forumrow[$j]['forum_id'])
{
$location_url = append_sid("viewforum.".$phpEx."?".POST_FORUM_URL."=".$forumrow[$j]['forum_id']);
$location = $forumrow[$j]['forum_name'];
break;
}
}
} }
// //

View file

@ -46,7 +46,7 @@ if(!isset($topic_id))
$sql = "SELECT t.topic_title, t.topic_status, t.topic_replies, $sql = "SELECT t.topic_title, t.topic_status, t.topic_replies,
f.forum_type, f.forum_name, f.forum_id, u.username, u.user_id f.forum_type, f.forum_name, f.forum_id, u.username, u.user_id
FROM ".TOPICS_TABLE." t, ".FORUMS_TABLE." f, ".FORUM_MODS_TABLE." fm, ".USERS_TABLE." u FROM ".TOPICS_TABLE." t, ".FORUMS_TABLE." f, ".FORUM_MODS_TABLE." fm, ".USERS_TABLE." u
WHERE t.topic_id = '$topic_id' WHERE t.topic_id = $topic_id
AND f.forum_id = t.forum_id AND f.forum_id = t.forum_id
AND fm.forum_id = t.forum_id AND fm.forum_id = t.forum_id
AND u.user_id = fm.user_id"; AND u.user_id = fm.user_id";
@ -60,9 +60,9 @@ if(!$total_rows = $db->sql_numrows($result))
error_die(GENERAL_ERROR, "The forum you selected does not exist. Please go back and try again."); error_die(GENERAL_ERROR, "The forum you selected does not exist. Please go back and try again.");
} }
$forum_row = $db->sql_fetchrowset($result); $forum_row = $db->sql_fetchrowset($result);
$topic_title = $forum_row[0]["topic_title"]; $topic_title = $forum_row[0]['topic_title'];
$forum_id = $forum_row[0]["forum_id"]; $forum_id = $forum_row[0]['forum_id'];
$forum_name = stripslashes($forum_row[0]["forum_name"]); $forum_name = stripslashes($forum_row[0]['forum_name']);
// //
// Start session management // Start session management
@ -75,9 +75,9 @@ init_userprefs($userdata);
for($x = 0; $x < $total_rows; $x++) for($x = 0; $x < $total_rows; $x++)
{ {
$moderators[] = array("user_id" => $forum_row[$x]["user_id"], $moderators[] = array("user_id" => $forum_row[$x]['user_id'],
"username" => $forum_row[$x]["username"]); "username" => $forum_row[$x]['username']);
if($userdata["user_id"] == $forum_row[$x]["user_id"]) if($userdata['user_id'] == $forum_row[$x]['user_id'])
{ {
$is_moderator = 1; $is_moderator = 1;
} }
@ -89,20 +89,18 @@ for($x = 0; $x < $total_rows; $x++)
$total_replies = $forum_row[0]["topic_replies"] + 1; $total_replies = $forum_row[0]['topic_replies'] + 1;
if(!isset($start)) if(!isset($start))
{ {
$start = 0; $start = 0;
} }
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, r.rank_title, r.rank_image, p.post_time, p.post_id, p.bbcode_uid, pt.post_text $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, p.post_time, p.post_id, p.bbcode_uid, pt.post_text
FROM ".POSTS_TABLE." p FROM ".POSTS_TABLE." p, ".USERS_TABLE." u, ".POSTS_TEXT_TABLE." pt
LEFT JOIN ".USERS_TABLE." u ON p.poster_id = u.user_id WHERE p.topic_id = $topic_id
LEFT JOIN ".POSTS_TEXT_TABLE." pt ON p.post_id = pt.post_id AND p.poster_id = u.user_id
LEFT JOIN ".RANKS_TABLE." r ON ( u.user_rank = r.rank_id ) AND p.post_id = pt.post_id
AND (r.rank_special = 1)
WHERE p.topic_id = '$topic_id'
ORDER BY p.post_time ASC ORDER BY p.post_time ASC
LIMIT $start, ".$board_config['posts_per_page']; LIMIT $start, ".$board_config['posts_per_page'];
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
@ -150,29 +148,35 @@ include('includes/page_header.'.$phpEx);
// //
for($x = 0; $x < $total_posts; $x++) for($x = 0; $x < $total_posts; $x++)
{ {
$poster = stripslashes($postrow[$x]["username"]); $poster = stripslashes($postrow[$x]['username']);
$poster_id = $postrow[$x]["user_id"]; $poster_id = $postrow[$x]['user_id'];
$post_date = create_date($board_config['default_dateformat'], $postrow[$x]["post_time"], $board_config['default_timezone']); $post_date = create_date($board_config['default_dateformat'], $postrow[$x]['post_time'], $board_config['default_timezone']);
$poster_posts = $postrow[$x]["user_posts"]; $poster_posts = $postrow[$x]['user_posts'];
$poster_from = ($postrow[$x]["user_from"]) ? "$l_from: ".$postrow[$x]["user_from"] : ""; $poster_from = ($postrow[$x]['user_from']) ? "$l_from: ".$postrow[$x]['user_from'] : "";
$poster_joined = create_date($board_config['default_dateformat'], $postrow[$x]["user_regdate"], $board_config['default_timezone']); $poster_joined = create_date($board_config['default_dateformat'], $postrow[$x]['user_regdate'], $board_config['default_timezone']);
if($poster_id != ANONYMOUS && $poster_id != DELETED) if($poster_id != ANONYMOUS && $poster_id != DELETED)
{ {
if(!$postrow[$x]["rank_title"]) if(!$postrow[$x]['user_rank'])
{ {
for($i = 0; $i < count($ranksrow); $i++) for($i = 0; $i < count($ranksrow); $i++)
{ {
if($poster_posts > $ranksrow[$i]['rank_min'] && $poster_posts < $ranksrow[$i]['rank_max']) if($poster_posts > $ranksrow[$i]['rank_min'] && $poster_posts < $ranksrow[$i]['rank_max'])
{ {
$poster_rank = $ranksrow[$i]['rank_title']; $poster_rank = $ranksrow[$i]['rank_title'];
$rank_image = ($ranksrow[$x]["rank_image"]) ? "<img src=\"".$ranksrow[$x]["rank_image"]."\">" : ""; $rank_image = ($ranksrow[$x]['rank_image']) ? "<img src=\"".$ranksrow[$x]['rank_image']."\">" : "";
} }
} }
} }
else else
{ {
$poster_rank = stripslashes($postrow[$x]["rank_title"]); for($i = 0; $i < count($ranksrow); $i++)
$rank_image = ($postrow[$x]["rank_image"]) ? "<img src=\"".$postrow[$x]["rank_image"]."\">" : ""; {
if($postrow[$x]['user_rank'] == $ranksrow[$i]['rank_special'])
{
$poster_rank = $ranksrow[$i]['rank_title'];
$rank_image = ($ranksrow[$x]['rank_image']) ? "<img src=\"".$ranksrow[$x]['rank_image']."\">" : "";
}
}
} }
} }
else else
@ -181,13 +185,13 @@ for($x = 0; $x < $total_posts; $x++)
} }
$profile_img = "<a href=\"".append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=$poster_id")."\"><img src=\"".$images['profile']."\" alt=\"$l_profileof $poster\" border=\"0\"></a>"; $profile_img = "<a href=\"".append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=$poster_id")."\"><img src=\"".$images['profile']."\" alt=\"$l_profileof $poster\" border=\"0\"></a>";
$email_img = ($postrow[$x]["user_viewemail"] == 1) ? "<a href=\"mailto:".$postrow[$x]["user_email"]."\"><img src=\"".$images['email']."\" alt=\"$l_email $poster\" border=\"0\"></a>" : ""; $email_img = ($postrow[$x]['user_viewemail'] == 1) ? "<a href=\"mailto:".$postrow[$x]['user_email']."\"><img src=\"".$images['email']."\" alt=\"$l_email $poster\" border=\"0\"></a>" : "";
$www_img = ($postrow[$x]["user_website"]) ? "<a href=\"".$postrow[$x]["user_website"]."\"><img src=\"".$images['www']."\" alt=\"$l_viewsite\" border=\"0\"></a>" : ""; $www_img = ($postrow[$x]['user_website']) ? "<a href=\"".$postrow[$x]['user_website']."\"><img src=\"".$images['www']."\" alt=\"$l_viewsite\" border=\"0\"></a>" : "";
if($postrow[$x]["user_icq"]) if($postrow[$x]['user_icq'])
{ {
$icq_status_img = "<a href=\"http://wwp.icq.com/".$postrow[$x]["user_icq"]."#pager\"><img src=\"http://online.mirabilis.com/scripts/online.dll?icq=".$postrow[$x]["user_icq"]."&img=5\" alt=\"$l_icqstatus\" border=\"0\"></a>"; $icq_status_img = "<a href=\"http://wwp.icq.com/".$postrow[$x]['user_icq']."#pager\"><img src=\"http://online.mirabilis.com/scripts/online.dll?icq=".$postrow[$x]['user_icq']."&img=5\" alt=\"$l_icqstatus\" border=\"0\"></a>";
$icq_add_img = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=".$postrow[$x]["user_icq"]."\"><img src=\"".$images['icq']."\" alt=\"$l_icq\" border=\"0\"></a>"; $icq_add_img = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=".$postrow[$x]['user_icq']."\"><img src=\"".$images['icq']."\" alt=\"$l_icq\" border=\"0\"></a>";
} }
else else
{ {
@ -195,21 +199,21 @@ for($x = 0; $x < $total_posts; $x++)
$icq_add_img = ""; $icq_add_img = "";
} }
$aim_img = ($postrow[$x]["user_aim"]) ? "<a href=\"aim:goim?screenname=".$postrow[$x]["user_aim"]."&message=Hello+Are+you+there?\"><img src=\"".$images['aim']."\" border=\"0\"></a>" : ""; $aim_img = ($postrow[$x]['user_aim']) ? "<a href=\"aim:goim?screenname=".$postrow[$x]['user_aim']."&message=Hello+Are+you+there?\"><img src=\"".$images['aim']."\" border=\"0\"></a>" : "";
$msn_img = ($postrow[$x]["user_msnm"]) ? "<a href=\"profile.$phpEx?mode=viewprofile&user_id=$poster_id\"><img src=\"".$images['msn']."\" border=\"0\"></a>" : ""; $msn_img = ($postrow[$x]['user_msnm']) ? "<a href=\"profile.$phpEx?mode=viewprofile&user_id=$poster_id\"><img src=\"".$images['msn']."\" border=\"0\"></a>" : "";
$yim_img = ($postrow[$x]["user_yim"]) ? "<a href=\"http://edit.yahoo.com/config/send_webmesg?.target=".$postrow[$x]["user_yim"]."&.src=pg\"><img src=\"".$images['yim']."\" border=\"0\"></a>" : ""; $yim_img = ($postrow[$x]['user_yim']) ? "<a href=\"http://edit.yahoo.com/config/send_webmesg?.target=".$postrow[$x]['user_yim']."&.src=pg\"><img src=\"".$images['yim']."\" border=\"0\"></a>" : "";
$edit_img = "<a href=\"".append_sid("posting.$phpEx?mode=editpost&post_id=".$postrow[$x]["post_id"]."&topic_id=$topic_id&forum_id=$forum_id")."\"><img src=\"".$images['edit']."\" alt=\"$l_editdelete\" border=\"0\"></a>"; $edit_img = "<a href=\"".append_sid("posting.$phpEx?mode=editpost&post_id=".$postrow[$x]['post_id']."&topic_id=$topic_id&forum_id=$forum_id")."\"><img src=\"".$images['edit']."\" alt=\"$l_editdelete\" border=\"0\"></a>";
$quote_img = "<a href=\"".append_sid("posting.$phpEx?mode=reply&quote=true&post_id=".$postrow[$x]["post_id"]."&topic_id=$topic_id&forum_id=$forum_id")."\"><img src=\"".$images['quote']."\" alt=\"$l_replyquote\" border=\"0\"></a>"; $quote_img = "<a href=\"".append_sid("posting.$phpEx?mode=reply&quote=true&post_id=".$postrow[$x]['post_id']."&topic_id=$topic_id&forum_id=$forum_id")."\"><img src=\"".$images['quote']."\" alt=\"$l_replyquote\" border=\"0\"></a>";
$pmsg_img = "<a href=\"".append_sid("priv_msgs.$phpEx?mode=send")."\"><img src=\"".$images['pmsg']."\" alt=\"$l_sendpmsg\" border=\"0\"></a>"; $pmsg_img = "<a href=\"".append_sid("priv_msgs.$phpEx?mode=send")."\"><img src=\"".$images['pmsg']."\" alt=\"$l_sendpmsg\" border=\"0\"></a>";
if($is_moderator) if($is_moderator)
{ {
$ip_img = "<a href=\"".append_sid("topicadmin.$phpEx?mode=viewip&user_id=".$poster_id)."\"><img src=\"".$images['ip']."\" alt=\"$l_viewip\" border=\"0\"></a>"; $ip_img = "<a href=\"".append_sid("topicadmin.$phpEx?mode=viewip&user_id=".$poster_id)."\"><img src=\"".$images['ip']."\" alt=\"$l_viewip\" border=\"0\"></a>";
$delpost_img = "<a href=\"".append_sid("topicadmin.$phpEx?mode=delpost$post_id=".$postrow[$x]["post_id"])."\"><img src=\"".$images['delpost']."\" alt=\"$l_delete\" border=\"0\"></a>"; $delpost_img = "<a href=\"".append_sid("topicadmin.$phpEx?mode=delpost$post_id=".$postrow[$x]['post_id'])."\"><img src=\"".$images['delpost']."\" alt=\"$l_delete\" border=\"0\"></a>";
} }
$message = stripslashes($postrow[$x]["post_text"]); $message = stripslashes($postrow[$x]['post_text']);
$bbcode_uid = $postrow[$x]['bbcode_uid']; $bbcode_uid = $postrow[$x]['bbcode_uid'];
$user_sig = stripslashes($postrow[$x]['user_sig']); $user_sig = stripslashes($postrow[$x]['user_sig']);
@ -234,25 +238,11 @@ for($x = 0; $x < $total_posts; $x++)
if(!($x % 2)) if(!($x % 2))
{ {
if(isset($theme['td_color1'])) $color = "#".$theme['td_color1'];
{
$color = "#".$theme['td_color1'];
}
else
{
$color = "#DDDDDD";
}
} }
else else
{ {
if(isset($theme['td_color2'])) $color = "#".$theme['td_color2'];
{
$color = "#".$theme['td_color2'];
}
else
{
$color = "#CCCCCC";
}
} }
$message = eregi_replace("\[addsig]$", "<br />_________________<br />" . nl2br($user_sig), $message); $message = eregi_replace("\[addsig]$", "<br />_________________<br />" . nl2br($user_sig), $message);
@ -282,7 +272,7 @@ for($x = 0; $x < $total_posts; $x++)
"IP_IMG" => $ip_img, "IP_IMG" => $ip_img,
"DELPOST_IMG" => $delpost_img, "DELPOST_IMG" => $delpost_img,
"U_POST_ID" => "#".$postrow[$x]["post_id"])); "U_POST_ID" => "#".$postrow[$x]['post_id']));
} }
if($total_replies > $board_config['posts_per_page']) if($total_replies > $board_config['posts_per_page'])
@ -307,4 +297,4 @@ $template->pparse("body");
include('includes/page_tail.'.$phpEx); include('includes/page_tail.'.$phpEx);
?> ?>