diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-05-17 14:48:39 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-05-17 14:48:39 +0000 |
commit | b621f70cd14a4a912837021604e723cefac406b7 (patch) | |
tree | ff9ba32a10ce34179d10dabef9e980f538757e19 | |
parent | dcf65b486eeae372b5604a84bfbbfbabc7a22a8e (diff) | |
download | forums-b621f70cd14a4a912837021604e723cefac406b7.tar forums-b621f70cd14a4a912837021604e723cefac406b7.tar.gz forums-b621f70cd14a4a912837021604e723cefac406b7.tar.bz2 forums-b621f70cd14a4a912837021604e723cefac406b7.tar.xz forums-b621f70cd14a4a912837021604e723cefac406b7.zip |
Removed separate header/footers and moved into each pages body
git-svn-id: file:///svn/phpbb/trunk@311 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/includes/page_header.php | 175 | ||||
-rw-r--r-- | phpBB/includes/page_tail.php | 23 | ||||
-rw-r--r-- | phpBB/index.php | 22 | ||||
-rw-r--r-- | phpBB/posting.php | 46 | ||||
-rw-r--r-- | phpBB/profile.php | 988 | ||||
-rw-r--r-- | phpBB/templates/Default/index_body.tpl | 30 | ||||
-rw-r--r-- | phpBB/templates/Default/login_body.tpl | 12 | ||||
-rw-r--r-- | phpBB/templates/Default/posting_body.tpl | 15 | ||||
-rw-r--r-- | phpBB/templates/Default/viewforum_body.tpl | 74 | ||||
-rw-r--r-- | phpBB/templates/Default/viewonline_body.tpl | 37 | ||||
-rw-r--r-- | phpBB/templates/Default/viewtopic_body.tpl | 76 | ||||
-rw-r--r-- | phpBB/viewforum.php | 24 | ||||
-rw-r--r-- | phpBB/viewonline.php | 27 | ||||
-rw-r--r-- | phpBB/viewtopic.php | 108 |
14 files changed, 953 insertions, 704 deletions
diff --git a/phpBB/includes/page_header.php b/phpBB/includes/page_header.php index eddde9fe5f..ced6480b90 100644 --- a/phpBB/includes/page_header.php +++ b/phpBB/includes/page_header.php @@ -107,10 +107,20 @@ $l_g_user_s = ($guests_online == 1) ? $l_user : $l_users; $l_is_are = ($logged_online == 1) ? $l_is : $l_are; $userlist = ($logged_online > 0) ? "$l_Registered $l_r_user_s: " . $userlist : "$l_Registered $l_r_user_s: $l_None"; +// +// The following assigns all _common_ +// variables that may be used at any point +// in a template. Note that all URL's should +// be wrapped in append_sid, as should all +// S_x_ACTIONS for forms. +// $template->assign_vars(array( "SITENAME" => $board_config['sitename'], - "PHPEX" => $phpEx, - "PHPSELF" => $PHP_SELF, + "PAGE_TITLE" => $page_title, + "LOGIN_STATUS" => $logged_in_status, + "META_INFO" => $meta_tags, + "TOTAL_USERS_ONLINE" => "$l_There $l_is_are $logged_online $l_Registered $l_r_user_s $l_and $guests_online $l_guest $l_g_user_s $l_online", + "LOGGED_IN_USER_LIST" => $userlist, "L_USERNAME" => $l_username, "L_PASSWORD" => $l_password, @@ -143,12 +153,10 @@ $template->assign_vars(array( "L_NEWPOSTS" => $l_newposts, "L_POSTED" => $l_posted, "L_JOINED" => $l_joined, - "L_AUTO_LOGIN" => $l_autologin, "L_AUTHOR" => $l_author, "L_MESSAGE" => $l_message, "L_BY" => $l_by, - "L_LOGIN_LOGOUT" => $l_login_logout, "U_INDEX" => append_sid("index.".$phpEx), @@ -195,165 +203,8 @@ $template->assign_vars(array( "T_IMG1" => $theme['img1'], "T_IMG2" => $theme['img2'], "T_IMG3" => $theme['img3'], - "T_IMG4" => $theme['img4'], - - "PAGE_TITLE" => $page_title, - "LOGIN_STATUS" => $logged_in_status, - "META_INFO" => $meta_tags, - - "TOTAL_USERS_ONLINE" => "$l_There $l_is_are $logged_online $l_Registered $l_r_user_s $l_and $guests_online $l_guest $l_g_user_s $l_online", - "LOGGED_IN_USER_LIST" => $userlist - )); + "T_IMG4" => $theme['img4'])); $template->pparse("overall_header"); -// -// Do a switch on page type, this way we only load -// the templates that we need at the time -// -switch($pagetype) -{ - - case 'index': - $template->set_filenames(array( - "header" => "index_header.tpl", - "body" => "index_body.tpl", - "footer" => "index_footer.tpl") - ); - $template->assign_vars(array( - "TOTAL_POSTS" => $total_posts, - "TOTAL_USERS" => $total_users, - "NEWEST_USER" => $newest_user, - "NEWEST_UID" => $newest_uid, - "USERS_BROWSING" => $users_browsing, - - "U_NEWEST_USER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=$newest_uid")) - ); - - $template->pparse("header"); - break; - - case 'viewforum': - $template->set_filenames(array( - "header" => "viewforum_header.tpl", - "body" => "viewforum_body.tpl", - "jumpbox" => "jumpbox.tpl", - "footer" => "viewforum_footer.tpl") - ); - $jumpbox = make_jumpbox(); - $template->assign_vars(array( - "JUMPBOX_LIST" => $jumpbox, - "SELECT_NAME" => POST_FORUM_URL) - ); - $template->assign_var_from_handle("JUMPBOX", "jumpbox"); - $template->assign_vars(array( - "FORUM_ID" => $forum_id, - "FORUM_NAME" => $forum_name, - "MODERATORS" => $forum_moderators, - "USERS_BROWSING" => $users_browsing) - ); - $template->pparse("header"); - break; - - case 'viewtopic': - $template->set_filenames(array( - "header" => "viewtopic_header.tpl", - "body" => "viewtopic_body.tpl", - "jumpbox" => "jumpbox.tpl", - "footer" => "viewtopic_footer.tpl") - ); - $jumpbox = make_jumpbox(); - $template->assign_vars(array( - "JUMPBOX_LIST" => $jumpbox, - "SELECT_NAME" => POST_FORUM_URL) - ); - $template->assign_var_from_handle("JUMPBOX", "jumpbox"); - $template->assign_vars(array( - "FORUM_ID" => $forum_id, - "FORUM_NAME" => $forum_name, - "TOPIC_ID" => $topic_id, - "TOPIC_TITLE" => $topic_title, - "POST_FORUM_URL" => POST_FORUM_URL, - "USERS_BROWSING" => $users_browsing) - ); - $template->pparse("header"); - break; - - case 'viewonline': - $template->set_filenames(array( - "header" => "viewonline_header.tpl", - "body" => "viewonline_body.tpl", - "jumpbox" => "jumpbox.tpl", - "footer" => "viewonline_footer.tpl") - ); - $jumpbox = make_jumpbox(); - $template->assign_vars(array( - "JUMPBOX_LIST" => $jumpbox, - "SELECT_NAME" => POST_FORUM_URL) - ); - $template->assign_var_from_handle("JUMPBOX", "jumpbox"); - $template->assign_vars(array( - "TOTAL_POSTS" => $total_posts, - "TOTAL_USERS" => $total_users, - "POST_USER_URL" => POST_USERS_URL, - "NEWEST_USER" => $newest_user, - "NEWEST_UID" => $newest_uid, - - "U_NEWEST_USER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=$newest_uid")) - ); - $template->pparse("header"); - break; - - case 'newtopic': - $template->set_filenames(array( - "header" => "newtopic_header.tpl", - "jumpbox" => "jumpbox.tpl", - "body" => "posting_body.tpl") - ); - $jumpbox = make_jumpbox(); - $template->assign_vars(array( - "JUMPBOX_LIST" => $jumpbox, - "SELECT_NAME" => POST_FORUM_URL) - ); - $template->assign_var_from_handle("JUMPBOX", "jumpbox"); - $template->assign_vars(array( - "L_POSTNEWIN" => $l_postnewin, - "FORUM_ID" => $forum_id, - "FORUM_NAME" => $forum_name, - - "U_VIEW_FORUM" => append_sid("viewforum.$phpEx?".POST_FORUM_URL."=$forum_id")) - ); - $template->pparse("header"); - break; - - case 'register': - if(!isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed'])) - { - $coppa = (!isset($HTTP_POST_VARS['coppa'])) ? FALSE : TRUE; - - $template->set_filenames(array( - "body" => "agreement.tpl") - ); - $template->assign_vars(array( - "COPPA" => $coppa, - - "U_AGREE_OVER13" => append_sid("profile.$phpEx?mode=register&agreed=true"), - "U_AGREE_UNDER13" => append_sid("profile.$phpEx?mode=register&agreed=true&coppa=true")) - ); - } - else - { - $template->set_filenames(array( - "body" => "profile_add_body.tpl") - ); - } - break; - - case 'profile': - $template->set_filenames(array( - "body" => "profile_view_body.tpl") - ); - break; -} - ?>
\ No newline at end of file diff --git a/phpBB/includes/page_tail.php b/phpBB/includes/page_tail.php index addc956d69..e45ca5ad7d 100644 --- a/phpBB/includes/page_tail.php +++ b/phpBB/includes/page_tail.php @@ -23,29 +23,6 @@ ***************************************************************************/ // -// Load/parse the footer template we need based on pagetype. -// -switch($pagetype) -{ - case 'index': - $template->pparse("footer"); - break; - - case 'viewforum': - $template->pparse("footer"); - break; - - case 'viewtopic': - $template->pparse("footer"); - break; - - case 'viewonline': - $template->pparse("footer"); - break; - -} - -// // Show the overall footer. // if($userdata['session_logged_in']) diff --git a/phpBB/index.php b/phpBB/index.php index e508a42ac7..27108595b1 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -48,8 +48,28 @@ if(empty($viewcat)) $viewcat = -1; } +// +// Output page header and +// open the index body template +// include('includes/page_header.'.$phpEx); +$template->set_filenames(array( + "body" => "index_body.tpl")); + +$template->assign_vars(array( + "TOTAL_POSTS" => $total_posts, + "TOTAL_USERS" => $total_users, + "NEWEST_USER" => $newest_user, + "NEWEST_UID" => $newest_uid, + "USERS_BROWSING" => $users_browsing, + + "U_NEWEST_USER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=$newest_uid")) +); + +// +// Start main +// $sql = "SELECT c.cat_id, c.cat_title, c.cat_order FROM ".CATEGORIES_TABLE." c, ".FORUMS_TABLE." f WHERE f.cat_id = c.cat_id @@ -107,7 +127,7 @@ if($total_categories) default: // This works on: MySQL, MSSQL and ODBC (Access) $limit_forums = ($viewcat != -1) ? "WHERE f.cat_id = $viewcat " : ""; - echo $sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time + $sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time FROM (( ".FORUMS_TABLE." f LEFT JOIN ".POSTS_TABLE." p ON f.forum_last_post_id = p.post_id ) LEFT JOIN ".TOPICS_TABLE." t ON p.post_id = t.topic_last_post_id ) diff --git a/phpBB/posting.php b/phpBB/posting.php index 29832ee665..d64bfbc830 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -25,6 +25,18 @@ include('extension.inc'); include('common.'.$phpEx); // +// Obtain which forum id is required +// +if(!isset($HTTP_GET_VARS['forum']) && !isset($HTTP_POST_VARS['forum'])) // For backward compatibility +{ + $forum_id = ($HTTP_GET_VARS[POST_FORUM_URL]) ? $HTTP_GET_VARS[POST_FORUM_URL] : $HTTP_POST_VARS[POST_FORUM_URL]; +} +else +{ + $forum_id = ($HTTP_GET_VARS['forum']) ? $HTTP_GET_VARS['forum'] : $HTTP_POST_VARS['forum']; +} + +// // Start session management // $userdata = session_pagestart($user_ip, PAGE_POSTING, $session_length); @@ -33,6 +45,11 @@ init_userprefs($userdata); // End session management // +// +// Nothing in this file is set, lots of things +// will change to meet coding standards and new +// posting code ... +// if($submit && !$preview) { @@ -65,14 +82,14 @@ else $page_title = " $l_postnew"; $sql = "SELECT forum_name, forum_access FROM ".FORUMS_TABLE." - WHERE forum_id = '$forum_id'"; + WHERE forum_id = $forum_id"; if(!$result = $db->sql_query($sql)) { error_die(SQL_QUERY, "Could not obtain forum/forum access information.", __LINE__, __FILE__); } - $forum_info = $db->sql_fetchrowset($result); - $forum_name = stripslashes($forum_info[0]["forum_name"]); - $forum_access = $forum_info[0]["forum_access"]; + $forum_info = $db->sql_fetchrow($result); + $forum_name = stripslashes($forum_info['forum_name']); + $forum_access = $forum_info['forum_access']; if($forum_access == ANONALLOWED) { @@ -88,7 +105,26 @@ else } include('includes/page_header.'.$phpEx); - if($user_logged_in) + + $template->set_filenames(array( + "body" => "posting_body.tpl", + "jumpbox" => "jumpbox.tpl") + ); + $jumpbox = make_jumpbox(); + $template->assign_vars(array( + "JUMPBOX_LIST" => $jumpbox, + "SELECT_NAME" => POST_FORUM_URL) + ); + $template->assign_var_from_handle("JUMPBOX", "jumpbox"); + $template->assign_vars(array( + "L_POSTNEWIN" => $l_postnewin, + "FORUM_ID" => $forum_id, + "FORUM_NAME" => $forum_name, + + "U_VIEW_FORUM" => append_sid("viewforum.$phpEx?".POST_FORUM_URL."=$forum_id")) + ); + + if($userdata['session_logged_in']) { $username_input = $userdata["username"]; $password_input = ""; diff --git a/phpBB/profile.php b/phpBB/profile.php index 57cdb309d4..599aeaff8a 100644 --- a/phpBB/profile.php +++ b/phpBB/profile.php @@ -194,507 +194,272 @@ function tz_select($default) // -// -// Begin page proper -// -switch($mode) +if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) { - case 'viewprofile': - $pagetype = "profile"; - $page_title = "$l_profile"; - include('includes/page_header.'.$phpEx); - - if(!$HTTP_GET_VARS[POST_USERS_URL]) - { - if(DEBUG) - { - error_die(GENERAL_ERROR, "You must supply the user ID number of the user you want to view", __LINE__, __FILE__); - } - else - { - error_die(GENERAL_ERROR, $l_nouserid); - } - } - $profiledata = get_userdata_from_id($HTTP_GET_VARS[POST_USERS_URL]); - - // - // Calculate the number of days this user has been a member ($memberdays) - // Then calculate their posts per day - // - $regdate = $profiledata['user_regdate']; - - $memberdays = (time() - $regdate) / (24*60*60); - $posts_per_day = sprintf("%.2f", $profiledata['user_posts'] / $memberdays); - - // Get the users percentage of total posts - if($profiledata['user_posts'] != 0) - { - $total_posts = get_db_stat("postcount"); - $percentage = sprintf("%.2f", ($profiledata['user_posts'] / $total_posts) * 100); - } - else - { - $percentage = 0; - } - - if($profiledata['user_viewemail']) - { - // Replace the @ with 'at'. Some anti-spam mesures. - $email_addy = str_replace("@", " at ", $profiledata['user_email']); - $email = "<a href=\"mailto:$email_addy\">$email_addy</a>"; - } - else - { - $email = $l_hidden; - } - $template->assign_vars(array( - "L_VIEWING_PROFILE" => $l_viewing_profile, - "USERNAME" => stripslashes($profiledata['username']), - "L_USERNAME" => $l_username, - "L_VIEW_USERS_POSTS" => $l_view_users_posts, - "L_JOINED" => $l_joined, - "JOINED" => create_date($board_config['default_dateformat'], $profiledata['user_regdate'], $board_config['default_timezone']), - "POSTS_PER_DAY" => $posts_per_day, - "L_PER_DAY" => $l_per_day, - "POSTS" => $profiledata['user_posts'], - "PERCENTAGE" => $percentage . "%", - "L_OF_TOTAL" => $l_of_total, - "L_EMAIL_ADDRESS" => $l_emailaddress, - "EMAIL" => $email, - "L_ICQ_NUMBER" => $l_icq_number, - "ICQ" => $profiledata['user_icq'], - "L_AIM" => $l_aim, - "AIM" => $profiledata['user_aim'], - "L_MESSENGER" => $l_messenger, - "MSN" => $profiledata['user_msnm'], - "L_YAHOO" => $l_yahoo, - "YIM" => $profiledata['user_yim'], - "L_WEBSITE" => $l_website, - "WEBSITE" => "<a href=\"".$profiledata['user_website']."\" target=\"_blank\">".$profiledata['user_website']."</a>", - "L_LOCATION" => $l_from, - "LOCATION" => stripslashes($profiledata['user_from']), - "L_OCCUPATION" => $l_occupation, - "OCCUPATION" => stripslashes($profiledata['user_occ']), - "L_INTERESTS" => $l_interests, - "INTERESTS" => stripslashes($profiledata['user_interests']), - - "S_PROFILE_ACTION" => append_sid("profile.$phpEx")) - ); - - $template->pparse("body"); - include('includes/page_tail.'.$phpEx); - break; - - case 'editprofile': - - if(!$userdata['session_logged_in']) - { - header(append_sid("Location: login.$phpEx?forward_page=$PHP_SELF&mode=editprofile")); - } - $pagetype = "register"; - $page_title = "$l_register"; - include('includes/page_header.'.$phpEx); - - if(isset($HTTP_POST_VARS['submit'])) - { - $user_id = $HTTP_POST_VARS['user_id']; - $username = (!empty($HTTP_POST_VARS['username'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['username']))) : ""; - $email = (!empty($HTTP_POST_VARS['email'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['email']))) : ""; - $password = (!empty($HTTP_POST_VARS['password'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['password']))) : ""; - $password_confirm = (!empty($HTTP_POST_VARS['password_confirm'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['password_confirm']))) : ""; - - $icq = (!empty($HTTP_POST_VARS['icq'])) ? trim(strip_tags($HTTP_POST_VARS['icq'])) : ""; - $aim = (!empty($HTTP_POST_VARS['aim'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['aim']))) : ""; - $msn = (!empty($HTTP_POST_VARS['msn'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['msn']))) : ""; - $yim = (!empty($HTTP_POST_VARS['yim'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['yim']))) : ""; - - $website = (!empty($HTTP_POST_VARS['website'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['website']))) : ""; - $location = (!empty($HTTP_POST_VARS['location'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['location']))) : ""; - $occupation = (!empty($HTTP_POST_VARS['occupation'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['occupation']))) : ""; - $interests = (!empty($HTTP_POST_VARS['interests'])) ? trim(addslashes($HTTP_POST_VARS['interests'])) : ""; - $signature = (!empty($HTTP_POST_VARS['signature'])) ? trim(addslashes(str_replace("\n", "<br />", $HTTP_POST_VARS['signature']))) : ""; - - $viewemail = $HTTP_POST_VARS['viewemail']; - $attachsig = $HTTP_POST_VARS['attachsig']; - $allowhtml = $HTTP_POST_VARS['allowhtml']; - $allowbbcode = $HTTP_POST_VARS['allowbbcode']; - $allowsmilies = $HTTP_POST_VARS['allowsmilies']; - - $user_theme = ($HTTP_POST_VARS['theme']) ? $HTTP_POST_VARS['theme'] : $board_config['default_theme']; - $user_lang = ($HTTP_POST_VARS['language']) ? $HTTP_POST_VARS['language'] : $board_config['default_lang']; - $user_timezone = (isset($HTTP_POST_VARS['timezone'])) ? $HTTP_POST_VARS['timezone'] : $board_config['default_timezone']; - $user_template = ($HTTP_POST_VARS['template']) ? $HTTP_POST_VARS['template'] : $board_config['default_template']; - $user_dateformat = ($HTTP_POST_VARS['dateformat']) ? trim($HTTP_POST_VARS['dateformat']) : $board_config['default_dateformat']; - - $error = FALSE; - - $passwd_sql = ""; - if(!empty($password) && !empty($password_confirm)) + $mode = ($HTTP_GET_VARS['mode']) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode']; + // + // Begin page proper + // + switch($mode) + { + case 'viewprofile': + $pagetype = "profile"; + $page_title = "$l_profile"; + + // + // Output page header and + // profile_view template + // + include('includes/page_header.'.$phpEx); + + $template->set_filenames(array( + "body" => "profile_view_body.tpl") + ); + // + // End header + // + + if(!$HTTP_GET_VARS[POST_USERS_URL]) { - // The user wants to change their password, isn't that cute.. - if($password != $password_confirm) + if(DEBUG) { - $error = TRUE; - $error_msg = $l_mismatch . "<br />" . $l_tryagain; + error_die(GENERAL_ERROR, "You must supply the user ID number of the user you want to view", __LINE__, __FILE__); } else { - $password = md5($password); - $passwd_sql = ", user_password = '$password'"; + error_die(GENERAL_ERROR, $l_nouserid); } } - else if($password && !$password_confirm) + $profiledata = get_userdata_from_id($HTTP_GET_VARS[POST_USERS_URL]); + + // + // Calculate the number of days this user has been a member ($memberdays) + // Then calculate their posts per day + // + $regdate = $profiledata['user_regdate']; + + $memberdays = (time() - $regdate) / (24*60*60); + $posts_per_day = sprintf("%.2f", $profiledata['user_posts'] / $memberdays); + + // Get the users percentage of total posts + if($profiledata['user_posts'] != 0) { - $error = TRUE; - $error_msg = $l_mismatch . "<br />" . $l_tryagain; + $total_posts = get_db_stat("postcount"); + $percentage = sprintf("%.2f", ($profiledata['user_posts'] / $total_posts) * 100); } - - if($board_config['allow_namechange']) + else { - if(!validate_username($username)) - { - $error = TRUE; - if(isset($error_msg)) - { - $error_msg .= "<br />"; - } - $error_msg .= $l_invalidname; - } + $percentage = 0; } - if(!$error) + + if($profiledata['user_viewemail']) { - - $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 - WHERE user_id = $user_id"; - - if($result = $db->sql_query($sql)) - { - $msg = $l_infoupdated; - $template->set_filenames(array( - "reg_header" => "error_body.tpl" - )); - $template->assign_vars(array( - "ERROR_MESSAGE" => $msg - )); - $template->pparse("reg_header"); - - include('includes/page_tail.'.$phpEx); - } + // Replace the @ with 'at'. Some anti-spam mesures. + $email_addy = str_replace("@", " at ", $profiledata['user_email']); + $email = "<a href=\"mailto:$email_addy\">$email_addy</a>"; } else { - $template->set_filenames(array( - "reg_header" => "error_body.tpl" - )); - $template->assign_vars(array( - "ERROR_MESSAGE" => $error_msg - )); - $template->pparse("reg_header"); + $email = $l_hidden; } - } - else - { - $user_id = $userdata['user_id']; - $username = $userdata['username']; - $email = $userdata['user_email']; - $password = ""; - $password_confirm = ""; - - $icq = $userdata['user_icq']; - $aim = $userdata['user_aim']; - $msn = $userdata['user_msnm']; - $yim = $userdata['user_yim']; - - $website = $userdata['user_website']; - $location = $userdata['user_from']; - $occupation = $userdata['user_occ']; - $interests = $userdata['user_interests']; - $signature = str_replace("<br />", "\n", $userdata['user_sig']); - - $viewemail = $userdata['user_viewemail']; - $attachsig = $userdata['user_attachsig']; - $allowhtml = $userdata['user_html']; - $allowbbcode = $userdata['user_bbcode']; - $allowsmilies = $userdata['user_desmile']; - - $user_theme = $userdata['user_theme']; - $user_lang = $userdata['user_lang']; - $user_timezone = $userdata['user_timezone']; - $user_template = $userdata['user_template']; - $user_dateformat = $userdata['user_dateformat']; - } - - $template->set_filenames(array( - "body" => "profile_add_body.tpl")); - $template->assign_vars(array( - "COPPA" => 0, - "MODE" => $mode, - "USER_ID" => $userdata['user_id'], - "USERNAME" => $username, - "EMAIL" => $email, - "YIM" => $yim, - "ICQ" => $icq, - "MSN" => $msn, - "AIM" => $aim, - "OCCUPATION" => $occupation, - "INTERESTS" => $interests, - "LOCATION" => $location, - "WEBSITE" => $website, - "SIGNATURE" => $signature, - "VIEW_EMAIL_YES" => ($viewemail) ? "CHECKED" : "", - "VIEW_EMAIL_NO" => (!$viewemail) ? "CHECKED" : "", - "ALWAYS_ADD_SIGNATURE_YES" => ($attachsig) ? "CHECKED" : "", - "ALWAYS_ADD_SIGNATURE_NO" => (!$attachsig) ? "CHECKED" : "", - "ALWAYS_ALLOW_BBCODE_YES" => ($allowbbcode) ? "CHECKED" : "", - "ALWAYS_ALLOW_BBCODE_NO" => (!$allowbbcode) ? "CHECKED" : "", - "ALWAYS_ALLOW_HTML_YES" => ($allowhtml) ? "CHECKED" : "", - "ALWAYS_ALLOW_HTML_NO" => (!$allowhtml) ? "CHECKED" : "", - "ALWAYS_ALLOW_SMILIES_YES" => ($allowsmilies) ? "CHECKED" : "", - "ALWAYS_ALLOW_SMILIES_NO" => (!$allowsmilies) ? "CHECKED" : "", - "LANGUAGE_SELECT" => language_select($user_lang), - "THEME_SELECT" => theme_select($user_theme), - "TIMEZONE_SELECT" => tz_select($user_timezone), - "DATE_FORMAT" => $user_dateformat, - "TEMPLATE_SELECT" => template_select($user_template), - - "L_PASSWORD_IF_CHANGED" => $l_password_if_changed, - "L_PASSWORD_CONFIRM_IF_CHANGED" => $l_password_confirm_if_changed, - "L_SUBMIT" => $l_submit, - "L_ICQ_NUMBER" => $l_icq_number, - "L_MESSENGER" => $l_messenger, - "L_YAHOO" => $l_yahoo, - "L_WEBSITE" => $l_website, - "L_AIM" => $l_aim, - "L_LOCATION" => $l_from, - "L_OCCUPATION" => $l_occupation, - "L_BOARD_LANGUAGE" => $l_boardlang, - "L_BOARD_THEME" => $l_boardtheme, - "L_BOARD_TEMPLATE" => $l_boardtemplate, - "L_TIMEZONE" => $l_timezone, - "L_DATE_FORMAT" => $l_date_format, - "L_DATE_FORMAT_EXPLANATION" => $l_date_format_explanation, - "L_YES" => $l_yes, - "L_NO" => $l_no, - "L_INTERESTS" => $l_interests, - "L_USER_UNIQUE" => $l_useruniq, - "L_ALWAYS_ALLOW_SMILIES" => $l_alwayssmile, - "L_ALWAYS_ALLOW_BBCODE" => $l_alwaysbbcode, - "L_ALWAYS_ALLOW_HTML" => $l_alwayshtml, - "L_ALWAYS_ADD_SIGNATURE" => $l_alwayssig, - "L_SIGNATURE" => $l_signature, - "L_SIGNATURE_EXPLAIN" => $l_sigexplain, - "L_PREFERENCES" => $l_preferences, - "L_PUBLIC_VIEW_EMAIL" => $l_publicmail, - "L_ITEMS_REQUIRED" => $l_itemsreq, - "L_REGISTRATION_INFO" => $l_reginfo, - "L_PROFILE_INFO" => $l_profile_info, - "L_PROFILE_INFO_NOTICE" => $l_profile_info_notice, - "L_CONFIRM" => $l_confirm, - "L_EMAIL_ADDRESS" => $l_emailaddress, + $template->assign_vars(array( + "L_VIEWING_PROFILE" => $l_viewing_profile, + "USERNAME" => stripslashes($profiledata['username']), + "L_USERNAME" => $l_username, + "L_VIEW_USERS_POSTS" => $l_view_users_posts, + "L_JOINED" => $l_joined, + "JOINED" => create_date($board_config['default_dateformat'], $profiledata['user_regdate'], $board_config['default_timezone']), + "POSTS_PER_DAY" => $posts_per_day, + "L_PER_DAY" => $l_per_day, + "POSTS" => $profiledata['user_posts'], + "PERCENTAGE" => $percentage . "%", + "L_OF_TOTAL" => $l_of_total, + "L_EMAIL_ADDRESS" => $l_emailaddress, + "EMAIL" => $email, + "L_ICQ_NUMBER" => $l_icq_number, + "ICQ" => $profiledata['user_icq'], + "L_AIM" => $l_aim, + "AIM" => $profiledata['user_aim'], + "L_MESSENGER" => $l_messenger, + "MSN" => $profiledata['user_msnm'], + "L_YAHOO" => $l_yahoo, + "YIM" => $profiledata['user_yim'], + "L_WEBSITE" => $l_website, + "WEBSITE" => "<a href=\"".$profiledata['user_website']."\" target=\"_blank\">".$profiledata['user_website']."</a>", + "L_LOCATION" => $l_from, + "LOCATION" => stripslashes($profiledata['user_from']), + "L_OCCUPATION" => $l_occupation, + "OCCUPATION" => stripslashes($profiledata['user_occ']), + "L_INTERESTS" => $l_interests, + "INTERESTS" => stripslashes($profiledata['user_interests']), - "S_PROFILE_ACTION" => append_sid("profile.$phpEx")) - ); - - $template->pparse("body"); - include('includes/page_tail.'.$phpEx); - - break; + "S_PROFILE_ACTION" => append_sid("profile.$phpEx")) + ); - case 'register': - - $username = (!empty($HTTP_POST_VARS['username'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['username']))) : ""; - $email = (!empty($HTTP_POST_VARS['email'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['email']))) : ""; - $password = (!empty($HTTP_POST_VARS['password'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['password']))) : ""; - $password_confirm = (!empty($HTTP_POST_VARS['password_confirm'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['password_confirm']))) : ""; - - $icq = (!empty($HTTP_POST_VARS['icq'])) ? trim(strip_tags($HTTP_POST_VARS['icq'])) : ""; - $aim = (!empty($HTTP_POST_VARS['aim'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['aim']))) : ""; - $msn = (!empty($HTTP_POST_VARS['msn'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['msn']))) : ""; - $yim = (!empty($HTTP_POST_VARS['yim'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['yim']))) : ""; - - $website = (!empty($HTTP_POST_VARS['website'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['website']))) : ""; - $location = (!empty($HTTP_POST_VARS['location'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['location']))) : ""; - $occupation = (!empty($HTTP_POST_VARS['occupation'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['occupation']))) : ""; - $interests = (!empty($HTTP_POST_VARS['interests'])) ? trim(addslashes($HTTP_POST_VARS['interests'])) : ""; - $signature = (!empty($HTTP_POST_VARS['signature'])) ? trim(addslashes($HTTP_POST_VARS['signature'])) : ""; - - $viewemail = $HTTP_POST_VARS['viewemail']; - $attachsig = $HTTP_POST_VARS['attachsig']; - $allowhtml = $HTTP_POST_VARS['allowhtml']; - $allowbbcode = $HTTP_POST_VARS['allowbbcode']; - $allowsmilies = $HTTP_POST_VARS['allowsmilies']; - - $user_theme = ($HTTP_POST_VARS['theme']) ? $HTTP_POST_VARS['theme'] : $board_config['default_theme']; - $user_lang = ($HTTP_POST_VARS['language']) ? $HTTP_POST_VARS['language'] : $board_config['default_lang']; - $user_timezone = str_replace("+", "", (isset($HTTP_POST_VARS['timezone'])) ? $HTTP_POST_VARS['timezone'] : $board_config['default_timezone']); - $user_template = ($HTTP_POST_VARS['template']) ? $HTTP_POST_VARS['template'] : $board_config['default_template']; - $user_dateformat = ($HTTP_POST_VARS['dateformat']) ? trim($HTTP_POST_VARS['dateformat']) : $board_config['default_dateformat']; - - if(!$HTTP_POST_VARS['coppa'] && !$HTTP_GET_VARS['coppa']) - { - $coppa = 0; - } - else - { - $coppa = 1; - } - - list($hr, $min, $sec, $mon, $day, $year) = explode(",", gmdate("H,i,s,m,d,Y", time())); - $regdate = gmmktime($hr, $min, $sec, $mon, $day, $year); + $template->pparse("body"); + include('includes/page_tail.'.$phpEx); + break; - $pagetype = "register"; - $page_title = "$l_register"; - include('includes/page_header.'.$phpEx); + case 'editprofile': + if(!$userdata['session_logged_in']) + { + header(append_sid("Location: login.$phpEx?forward_page=$PHP_SELF&mode=editprofile")); + } + $pagetype = "register"; + $page_title = "$l_register"; + + // + // Output page header and + // profile_add template + // + include('includes/page_header.'.$phpEx); + // + // End header + // - if(!isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed'])) - { - $template->pparse("body"); - include('includes/page_tail.'.$phpEx); - } - else - { if(isset($HTTP_POST_VARS['submit'])) { + $user_id = $HTTP_POST_VARS['user_id']; + $username = (!empty($HTTP_POST_VARS['username'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['username']))) : ""; + $email = (!empty($HTTP_POST_VARS['email'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['email']))) : ""; + $password = (!empty($HTTP_POST_VARS['password'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['password']))) : ""; + $password_confirm = (!empty($HTTP_POST_VARS['password_confirm'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['password_confirm']))) : ""; + + $icq = (!empty($HTTP_POST_VARS['icq'])) ? trim(strip_tags($HTTP_POST_VARS['icq'])) : ""; + $aim = (!empty($HTTP_POST_VARS['aim'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['aim']))) : ""; + $msn = (!empty($HTTP_POST_VARS['msn'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['msn']))) : ""; + $yim = (!empty($HTTP_POST_VARS['yim'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['yim']))) : ""; + + $website = (!empty($HTTP_POST_VARS['website'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['website']))) : ""; + $location = (!empty($HTTP_POST_VARS['location'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['location']))) : ""; + $occupation = (!empty($HTTP_POST_VARS['occupation'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['occupation']))) : ""; + $interests = (!empty($HTTP_POST_VARS['interests'])) ? trim(addslashes($HTTP_POST_VARS['interests'])) : ""; + $signature = (!empty($HTTP_POST_VARS['signature'])) ? trim(addslashes(str_replace("\n", "<br />", $HTTP_POST_VARS['signature']))) : ""; + + $viewemail = $HTTP_POST_VARS['viewemail']; + $attachsig = $HTTP_POST_VARS['attachsig']; + $allowhtml = $HTTP_POST_VARS['allowhtml']; + $allowbbcode = $HTTP_POST_VARS['allowbbcode']; + $allowsmilies = $HTTP_POST_VARS['allowsmilies']; + + $user_theme = ($HTTP_POST_VARS['theme']) ? $HTTP_POST_VARS['theme'] : $board_config['default_theme']; + $user_lang = ($HTTP_POST_VARS['language']) ? $HTTP_POST_VARS['language'] : $board_config['default_lang']; + $user_timezone = (isset($HTTP_POST_VARS['timezone'])) ? $HTTP_POST_VARS['timezone'] : $board_config['default_timezone']; + $user_template = ($HTTP_POST_VARS['template']) ? $HTTP_POST_VARS['template'] : $board_config['default_template']; + $user_dateformat = ($HTTP_POST_VARS['dateformat']) ? trim($HTTP_POST_VARS['dateformat']) : $board_config['default_dateformat']; + $error = FALSE; - if(empty($username) || empty($password) || empty($password_confirm) || empty($email)) - { - $error = TRUE; - $error_msg = $l_notfilledin; - } - if(isset($username) && (!validate_username($username))) + + $passwd_sql = ""; + if(!empty($password) && !empty($password_confirm)) { - $error = TRUE; - if(isset($error_msg)) + // The user wants to change their password, isn't that cute.. + if($password != $password_confirm) { - $error_msg .= "<br />"; + $error = TRUE; + $error_msg = $l_mismatch . "<br />" . $l_tryagain; } - $error_msg .= $l_invalidname; - } - if($password != $password_confirm) - { - $error = TRUE; - if(isset($error_msg)) + else { - $error_msg .= "<br />"; + $password = md5($password); + $passwd_sql = ", user_password = '$password'"; } - $error_msg .= $l_mismatch; - } - } - - if(isset($HTTP_POST_VARS['submit']) && !$error) - { - // - // The AUTO_INCREMENT field in MySQL v3.23 doesn't work - // correctly when there is a row with -1 in that field - // so we have to explicitly get the next user ID. - // - $sql = "SELECT max(user_id) AS total - FROM ".USERS_TABLE; - if($result = $db->sql_query($sql)) - { - $user_id_row = $db->sql_fetchrow($result); - $new_user_id = $user_id_row['total'] + 1; - unset($result); - unset($user_id_row); - } - else - { - error_die(SQL_QUERY, "Couldn't obtained next user_id information.", __LINE__, __FILE__); - } - - $md_pass = md5($password); - $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) - 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, "; - if($require_activation || $coppa == 1) - { - $act_key = generate_activation_key(); - $sql .= "0, '$act_key')"; } - else + else if($password && !$password_confirm) { - $sql .= "1, '')"; + $error = TRUE; + $error_msg = $l_mismatch . "<br />" . $l_tryagain; } - - if($result = $db->sql_query($sql)) + + if($board_config['allow_namechange']) { - if($require_activation) + if(!validate_username($username)) { - $msg = $l_accountinactive; - $email_msg = $l_welcomeemailactivate; - } - else if($coppa) - { - $msg = $l_coppa; - $email_msg = $l_welcomecoppa; - } - else - { - $msg = $l_acountadded; - $email_msg = $l_welcomemail; + $error = TRUE; + if(isset($error_msg)) + { + $error_msg .= "<br />"; + } + $error_msg .= $l_invalidname; } + } + if(!$error) + { + + $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 + WHERE user_id = $user_id"; + + if($result = $db->sql_query($sql)) + { + $msg = $l_infoupdated; + $template->set_filenames(array( + "reg_header" => "error_body.tpl" + )); + $template->assign_vars(array( + "ERROR_MESSAGE" => $msg + )); + $template->pparse("reg_header"); - if(!$coppa) - { - $email_msg .= "\r\n" . $board_config['board_email']; - mail($email, $l_welcomesubj, $email_msg, "From: ".$board_config['board_email_from']."\r\n"); + include('includes/page_tail.'.$phpEx); } - + } + else + { $template->set_filenames(array( "reg_header" => "error_body.tpl" )); $template->assign_vars(array( - "ERROR_MESSAGE" => $msg + "ERROR_MESSAGE" => $error_msg )); $template->pparse("reg_header"); - - include('includes/page_tail.'.$phpEx); } - else - { - $error = TRUE; - $err = $db->sql_error(); - $error_msg = "Query Error: ".$err["message"]; - if(DEBUG) - { - $error_msg .= "<br>Query: $sql"; - } - } - } - - if($error) - { - $template->set_filenames(array( - "reg_header" => "error_body.tpl" - )); - $template->assign_vars(array( - "ERROR_MESSAGE" => $error_msg - )); - $template->pparse("reg_header"); - } - if(!isset($coppa)) - { - $coppa = FALSE; - } - - if(!isset($user_template)) + else { - $selected_template = $board_config['default_template']; + $user_id = $userdata['user_id']; + $username = $userdata['username']; + $email = $userdata['user_email']; + $password = ""; + $password_confirm = ""; + + $icq = $userdata['user_icq']; + $aim = $userdata['user_aim']; + $msn = $userdata['user_msnm']; + $yim = $userdata['user_yim']; + + $website = $userdata['user_website']; + $location = $userdata['user_from']; + $occupation = $userdata['user_occ']; + $interests = $userdata['user_interests']; + $signature = str_replace("<br />", "\n", $userdata['user_sig']); + + $viewemail = $userdata['user_viewemail']; + $attachsig = $userdata['user_attachsig']; + $allowhtml = $userdata['user_html']; + $allowbbcode = $userdata['user_bbcode']; + $allowsmilies = $userdata['user_desmile']; + + $user_theme = $userdata['user_theme']; + $user_lang = $userdata['user_lang']; + $user_timezone = $userdata['user_timezone']; + $user_template = $userdata['user_template']; + $user_dateformat = $userdata['user_dateformat']; } + $template->set_filenames(array( + "body" => "profile_add_body.tpl")); $template->assign_vars(array( + "COPPA" => 0, "MODE" => $mode, + "USER_ID" => $userdata['user_id'], "USERNAME" => $username, "EMAIL" => $email, "YIM" => $yim, "ICQ" => $icq, "MSN" => $msn, "AIM" => $aim, - "COPPA" => $coppa, "OCCUPATION" => $occupation, "INTERESTS" => $interests, "LOCATION" => $location, @@ -716,6 +481,8 @@ switch($mode) "DATE_FORMAT" => $user_dateformat, "TEMPLATE_SELECT" => template_select($user_template), + "L_PASSWORD_IF_CHANGED" => $l_password_if_changed, + "L_PASSWORD_CONFIRM_IF_CHANGED" => $l_password_confirm_if_changed, "L_SUBMIT" => $l_submit, "L_ICQ_NUMBER" => $l_icq_number, "L_MESSENGER" => $l_messenger, @@ -748,47 +515,328 @@ switch($mode) "L_PROFILE_INFO_NOTICE" => $l_profile_info_notice, "L_CONFIRM" => $l_confirm, "L_EMAIL_ADDRESS" => $l_emailaddress, - - "S_PROFILE_ACTION" => append_sid("profile.$phpEx")) - ); + "S_PROFILE_ACTION" => append_sid("profile.$phpEx")) + ); + $template->pparse("body"); include('includes/page_tail.'.$phpEx); - } - break; - case 'activate': + break; - $sql = "SELECT user_id - FROM ".USERS_TABLE." - WHERE user_actkey = '$act_key'"; - if($result = $db->sql_query($sql)) - { - if($num = $db->sql_numrows($result)) + case 'register': + + $username = (!empty($HTTP_POST_VARS['username'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['username']))) : ""; + $email = (!empty($HTTP_POST_VARS['email'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['email']))) : ""; + $password = (!empty($HTTP_POST_VARS['password'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['password']))) : ""; + $password_confirm = (!empty($HTTP_POST_VARS['password_confirm'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['password_confirm']))) : ""; + + $icq = (!empty($HTTP_POST_VARS['icq'])) ? trim(strip_tags($HTTP_POST_VARS['icq'])) : ""; + $aim = (!empty($HTTP_POST_VARS['aim'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['aim']))) : ""; + $msn = (!empty($HTTP_POST_VARS['msn'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['msn']))) : ""; + $yim = (!empty($HTTP_POST_VARS['yim'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['yim']))) : ""; + + $website = (!empty($HTTP_POST_VARS['website'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['website']))) : ""; + $location = (!empty($HTTP_POST_VARS['location'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['location']))) : ""; + $occupation = (!empty($HTTP_POST_VARS['occupation'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['occupation']))) : ""; + $interests = (!empty($HTTP_POST_VARS['interests'])) ? trim(addslashes($HTTP_POST_VARS['interests'])) : ""; + $signature = (!empty($HTTP_POST_VARS['signature'])) ? trim(addslashes($HTTP_POST_VARS['signature'])) : ""; + + $viewemail = $HTTP_POST_VARS['viewemail']; + $attachsig = $HTTP_POST_VARS['attachsig']; + $allowhtml = $HTTP_POST_VARS['allowhtml']; + $allowbbcode = $HTTP_POST_VARS['allowbbcode']; + $allowsmilies = $HTTP_POST_VARS['allowsmilies']; + + $user_theme = ($HTTP_POST_VARS['theme']) ? $HTTP_POST_VARS['theme'] : $board_config['default_theme']; + $user_lang = ($HTTP_POST_VARS['language']) ? $HTTP_POST_VARS['language'] : $board_config['default_lang']; + $user_timezone = str_replace("+", "", (isset($HTTP_POST_VARS['timezone'])) ? $HTTP_POST_VARS['timezone'] : $board_config['default_timezone']); + $user_template = ($HTTP_POST_VARS['template']) ? $HTTP_POST_VARS['template'] : $board_config['default_template']; + $user_dateformat = ($HTTP_POST_VARS['dateformat']) ? trim($HTTP_POST_VARS['dateformat']) : $board_config['default_dateformat']; + + if(!$HTTP_POST_VARS['coppa'] && !$HTTP_GET_VARS['coppa']) + { + $coppa = 0; + } + else + { + $coppa = 1; + } + + list($hr, $min, $sec, $mon, $day, $year) = explode(",", gmdate("H,i,s,m,d,Y", time())); + $regdate = gmmktime($hr, $min, $sec, $mon, $day, $year); + + $pagetype = "register"; + $page_title = "$l_register"; + include('includes/page_header.'.$phpEx); + + if(!isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed'])) { - $rowset = $db->sql_fetchrowset($result); - $sql_update = "UPDATE ".USERS_TABLE." - SET user_active = 1, user_actkey = '' - WHERE user_id = ".$rowset[0]['user_id']; - if($result = $db->sql_query($sql_update)) + // + // Load agreement template + // since user has not yet + // agreed to registration + // conditions/coppa + // + $template->set_filenames(array( + "body" => "agreement.tpl") + ); + $template->assign_vars(array( + "COPPA" => $coppa, + + "U_AGREE_OVER13" => append_sid("profile.$phpEx?mode=register&agreed=true"), + "U_AGREE_UNDER13" => append_sid("profile.$phpEx?mode=register&agreed=true&coppa=true")) + ); + $template->pparse("body"); + + include('includes/page_tail.'.$phpEx); + } + else + { + if(isset($HTTP_POST_VARS['submit'])) + { + $error = FALSE; + if(empty($username) || empty($password) || empty($password_confirm) || empty($email)) + { + $error = TRUE; + $error_msg = $l_notfilledin; + } + if(isset($username) && (!validate_username($username))) + { + $error = TRUE; + if(isset($error_msg)) + { + $error_msg .= "<br />"; + } + $error_msg .= $l_invalidname; + } + if($password != $password_confirm) + { + $error = TRUE; + if(isset($error_msg)) + { + $error_msg .= "<br />"; + } + $error_msg .= $l_mismatch; + } + } + + if(isset($HTTP_POST_VARS['submit']) && !$error) + { + // + // The AUTO_INCREMENT field in MySQL v3.23 doesn't work + // correctly when there is a row with -1 in that field + // so we have to explicitly get the next user ID. + // + $sql = "SELECT max(user_id) AS total + FROM ".USERS_TABLE; + if($result = $db->sql_query($sql)) + { + $user_id_row = $db->sql_fetchrow($result); + $new_user_id = $user_id_row['total'] + 1; + unset($result); + unset($user_id_row); + } + else + { + error_die(SQL_QUERY, "Couldn't obtained next user_id information.", __LINE__, __FILE__); + } + + $md_pass = md5($password); + $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) + 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, "; + if($require_activation || $coppa == 1) + { + $act_key = generate_activation_key(); + $sql .= "0, '$act_key')"; + } + else + { + $sql .= "1, '')"; + } + + if($result = $db->sql_query($sql)) + { + if($require_activation) + { + $msg = $l_accountinactive; + $email_msg = $l_welcomeemailactivate; + } + else if($coppa) + { + $msg = $l_coppa; + $email_msg = $l_welcomecoppa; + } + else + { + $msg = $l_acountadded; + $email_msg = $l_welcomemail; + } + + if(!$coppa) + { + $email_msg .= "\r\n" . $board_config['board_email']; + mail($email, $l_welcomesubj, $email_msg, "From: ".$board_config['board_email_from']."\r\n"); + } + + $template->set_filenames(array( + "reg_header" => "error_body.tpl" + )); + $template->assign_vars(array( + "ERROR_MESSAGE" => $msg + )); + $template->pparse("reg_header"); + + include('includes/page_tail.'.$phpEx); + } + else + { + $error = TRUE; + $err = $db->sql_error(); + $error_msg = "Query Error: ".$err["message"]; + if(DEBUG) + { + $error_msg .= "<br>Query: $sql"; + } + } + } + + if($error) + { + $template->set_filenames(array( + "reg_header" => "error_body.tpl" + )); + $template->assign_vars(array( + "ERROR_MESSAGE" => $error_msg + )); + $template->pparse("reg_header"); + } + if(!isset($coppa)) + { + $coppa = FALSE; + } + + if(!isset($user_template)) + { + $selected_template = $board_config['default_template']; + } + + // + // Load profile_add template + // to allow user to insert + // new user reg details + // + $template->set_filenames(array( + "body" => "profile_add_body.tpl") + ); + + $template->assign_vars(array( + "MODE" => $mode, + "USERNAME" => $username, + "EMAIL" => $email, + "YIM" => $yim, + "ICQ" => $icq, + "MSN" => $msn, + "AIM" => $aim, + "COPPA" => $coppa, + "OCCUPATION" => $occupation, + "INTERESTS" => $interests, + "LOCATION" => $location, + "WEBSITE" => $website, + "SIGNATURE" => $signature, + "VIEW_EMAIL_YES" => ($viewemail) ? "CHECKED" : "", + "VIEW_EMAIL_NO" => (!$viewemail) ? "CHECKED" : "", + "ALWAYS_ADD_SIGNATURE_YES" => ($attachsig) ? "CHECKED" : "", + "ALWAYS_ADD_SIGNATURE_NO" => (!$attachsig) ? "CHECKED" : "", + "ALWAYS_ALLOW_BBCODE_YES" => ($allowbbcode) ? "CHECKED" : "", + "ALWAYS_ALLOW_BBCODE_NO" => (!$allowbbcode) ? "CHECKED" : "", + "ALWAYS_ALLOW_HTML_YES" => ($allowhtml) ? "CHECKED" : "", + "ALWAYS_ALLOW_HTML_NO" => (!$allowhtml) ? "CHECKED" : "", + "ALWAYS_ALLOW_SMILIES_YES" => ($allowsmilies) ? "CHECKED" : "", + "ALWAYS_ALLOW_SMILIES_NO" => (!$allowsmilies) ? "CHECKED" : "", + "LANGUAGE_SELECT" => language_select($user_lang), + "THEME_SELECT" => theme_select($user_theme), + "TIMEZONE_SELECT" => tz_select($user_timezone), + "DATE_FORMAT" => $user_dateformat, + "TEMPLATE_SELECT" => template_select($user_template), + + "L_SUBMIT" => $l_submit, + "L_ICQ_NUMBER" => $l_icq_number, + "L_MESSENGER" => $l_messenger, + "L_YAHOO" => $l_yahoo, + "L_WEBSITE" => $l_website, + "L_AIM" => $l_aim, + "L_LOCATION" => $l_from, + "L_OCCUPATION" => $l_occupation, + "L_BOARD_LANGUAGE" => $l_boardlang, + "L_BOARD_THEME" => $l_boardtheme, + "L_BOARD_TEMPLATE" => $l_boardtemplate, + "L_TIMEZONE" => $l_timezone, + "L_DATE_FORMAT" => $l_date_format, + "L_DATE_FORMAT_EXPLANATION" => $l_date_format_explanation, + "L_YES" => $l_yes, + "L_NO" => $l_no, + "L_INTERESTS" => $l_interests, + "L_USER_UNIQUE" => $l_useruniq, + "L_ALWAYS_ALLOW_SMILIES" => $l_alwayssmile, + "L_ALWAYS_ALLOW_BBCODE" => $l_alwaysbbcode, + "L_ALWAYS_ALLOW_HTML" => $l_alwayshtml, + "L_ALWAYS_ADD_SIGNATURE" => $l_alwayssig, + "L_SIGNATURE" => $l_signature, + "L_SIGNATURE_EXPLAIN" => $l_sigexplain, + "L_PREFERENCES" => $l_preferences, + "L_PUBLIC_VIEW_EMAIL" => $l_publicmail, + "L_ITEMS_REQUIRED" => $l_itemsreq, + "L_REGISTRATION_INFO" => $l_reginfo, + "L_PROFILE_INFO" => $l_profile_info, + "L_PROFILE_INFO_NOTICE" => $l_profile_info_notice, + "L_CONFIRM" => $l_confirm, + "L_EMAIL_ADDRESS" => $l_emailaddress, + + "S_PROFILE_ACTION" => append_sid("profile.$phpEx")) + ); + + $template->pparse("body"); + include('includes/page_tail.'.$phpEx); + } + break; + + case 'activate': + + $sql = "SELECT user_id + FROM ".USERS_TABLE." + WHERE user_actkey = '$act_key'"; + if($result = $db->sql_query($sql)) + { + if($num = $db->sql_numrows($result)) { - error_die(GENERAL_ERROR, $l_nowactive); + $rowset = $db->sql_fetchrowset($result); + $sql_update = "UPDATE ".USERS_TABLE." + SET user_active = 1, user_actkey = '' + WHERE user_id = ".$rowset[0]['user_id']; + if($result = $db->sql_query($sql_update)) + { + error_die(GENERAL_ERROR, $l_nowactive); + } + else + { + error_die(SQL_QUERY); + } } else { - error_die(SQL_QUERY); + error_die(GENERAL_ERROR, $l_wrongactiv); } } else { - error_die(GENERAL_ERROR, $l_wrongactiv); + error_die(SQL_QUERY); } - } - else - { - error_die(SQL_QUERY); - } - break; + break; + } + } ?>
\ No newline at end of file diff --git a/phpBB/templates/Default/index_body.tpl b/phpBB/templates/Default/index_body.tpl index 3d363bc65f..0a6fc9cda6 100644 --- a/phpBB/templates/Default/index_body.tpl +++ b/phpBB/templates/Default/index_body.tpl @@ -1,4 +1,23 @@ <tr> +<td> + <table border="0" align="right" width="30%" bgcolor="#000000" cellpadding="0" cellspacing="1"> + <tr> + <td> + <table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1"> + <tr> + <td align="right" style="{font-size: 8pt;}">{L_POSTEDTOTAL} -<b>{TOTAL_POSTS}</b>- {L_MESSAGES}.<br> + {L_WEHAVE} <b>{TOTAL_USERS}</b> {L_REGUSERS}.<br> + {L_NEWESTUSER} <b><a href="{U_NEWEST_USER_PROFILE}">{NEWEST_USER}</a></b><br> + {L_ARECURRENTLY} <a href="{U_VIEWONLINE}"><b>{USERS_BROWSING}</b> {L_BROWSING}</a> {L_THEFORUMS}<br> + </td> + </tr> + </table> + </td> + </tr> + </table> + </td> +</tr> +<tr> <td bgcolor="#000000" align="center"><table width="100%" cellpadding="0" cellspacing="1" border="0"> <tr> <td><table width="100%" cellpadding="3" cellspacing="1" border="0"> @@ -31,4 +50,15 @@ </table></td> </tr> </table></td> +</tr> +<tr> + <td align="center"><table border="0" width="100%" cellpadding="0" cellspacing="1"> + <tr> + <td style="{font-size: 8pt;}"><img src="images/folder.gif"> = {L_NEWPOSTS}</td> + <td style="{font-size: 8pt;}" align="right" valign="top"><b>{S_TIMEZONE}</b></td> + </tr> + <tr> + <td style="{font-size: 8pt;}"><img src="images/red_folder.gif"> = {L_NONEWPOSTS}</td> + </tr> + </table></td> </tr>
\ No newline at end of file diff --git a/phpBB/templates/Default/login_body.tpl b/phpBB/templates/Default/login_body.tpl index 0aad58a463..8f4b4f51a2 100644 --- a/phpBB/templates/Default/login_body.tpl +++ b/phpBB/templates/Default/login_body.tpl @@ -1,4 +1,11 @@ <tr> + <td><div align="center"><table width="60%" cellspacing="0" cellpadding="4" border="0"> + <tr> + <td align="left" style="{font-size: 8pt; height: 55px;}" nowrap><a href="{U_INDEX}">{SITENAME} {L_INDEX}</a></font></td> + </tr> + </table></div></td> +</tr> +<tr> <td><br clear="all" /><br /> <table border="0" align="center" width="60%" bgcolor="#000000" cellpadding="0" cellspacing="1"> @@ -33,4 +40,9 @@ </table></td> </td> +</tr> +<tr> + <td><div align="center"><table align="center" border="0" width="60%"> + <td style="{font-size: 8pt;}" align="right" valign="top"><b>{S_TIMEZONE}</b></td> + </table></div></td> </tr>
\ No newline at end of file diff --git a/phpBB/templates/Default/posting_body.tpl b/phpBB/templates/Default/posting_body.tpl index c49b6292c3..9256a4841c 100644 --- a/phpBB/templates/Default/posting_body.tpl +++ b/phpBB/templates/Default/posting_body.tpl @@ -1,4 +1,19 @@ <tr> + <td> + <table border="0" align="right" width="20%" bgcolor="#000000" cellpadding="0" cellspacing="1"> + <tr> + <td> + <table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1"> + <tr> + <td align="center" style="{font-size: 8pt;}">{L_POSTNEWIN}<br><a href="{U_VIEW_FORUM}">{FORUM_NAME}</a></td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr> <td><form action="{S_POST_ACTION}" method="post"> <table border="0" align="center" width="100%" bgcolor="#000000" cellpadding="0" cellspacing="1"> <tr> diff --git a/phpBB/templates/Default/viewforum_body.tpl b/phpBB/templates/Default/viewforum_body.tpl index 5be8f6f258..75a9e829cc 100644 --- a/phpBB/templates/Default/viewforum_body.tpl +++ b/phpBB/templates/Default/viewforum_body.tpl @@ -1,4 +1,44 @@ <tr> + <td> + <table border="0" width="100%" cellpadding="0" cellspacing="0"> + <tr> + <td> + <table border="0" align="left" width="20%" bgcolor="#000000" cellpadding="0" cellspacing="1"> + <tr> + <td> + <table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1"> + <tr> + <td align="left" style="{font-size: 8pt; height: 55px;}" nowrap> + <div style="{font-size: 10pt; font-weight: bold}">{FORUM_NAME}</div> + Moderated by - {MODERATORS}<br> + <a href="{U_INDEX}">{SITENAME} - Forum Index</a> >> {FORUM_NAME} + </td> + </tr> + </table> + </td> + </tr> + </table> + <table border="0" align="right" width="20%" bgcolor="#000000" cellpadding="0" cellspacing="1"> + <tr> + <td> + <table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1"> + <tr> + <td align="right" style="{font-size: 8pt;}"> + <a href="{U_POST_NEW_TOPIC}"> + <img src="images/newpost.jpg" height="50" width="250" alt="Post New Topic" border="0"> + </a> + </td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr> <td> <table border="0" align="center" width="100%" bgcolor="#000000" cellpadding="0" cellspacing="1"> <tr> @@ -41,3 +81,37 @@ </tr> </table></td> </tr> +<tr> + <td> + <table border="0" width="100%" align="center" cellpadding="0" cellspacing="0"> + <tr> + <td> + <table border="0" align="left" width="20%" bgcolor="#000000" cellpadding="0" cellspacing="1"> + <tr> + <td> + <table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1"> + <tr> + <td align="left" style="{font-size: 8pt;}"><a href="{U_POST_NEW_TOPIC}"><img src="images/newpost.jpg" height="50" width="250" alt="Post New Topic" border="0"></a></td> + </tr> + </table> + </td> + </tr> + </table> + + <table border="0" align="right" width="20%" bgcolor="#000000" cellpadding="0" cellspacing="1"> + <tr> + <td> + <table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1"> + <tr> + <td align="right" style="{font-size: 8pt; height: 55px;}">{JUMPBOX}</td> + </tr> + </table> + </td> + </tr> + </table> + + </td> + </tr> + </table> + </td> +</tr>
\ No newline at end of file diff --git a/phpBB/templates/Default/viewonline_body.tpl b/phpBB/templates/Default/viewonline_body.tpl index c9e2ca6f9f..5c93812dd3 100644 --- a/phpBB/templates/Default/viewonline_body.tpl +++ b/phpBB/templates/Default/viewonline_body.tpl @@ -1,4 +1,15 @@ <tr> + <td><table border="0" align="right" width="30%" bgcolor="#000000" cellpadding="0" cellspacing="1"> + <tr> + <td><table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1"> + <tr> + <td align="right" style="{font-size: 8pt;}">{L_POSTEDTOTAL} -<b>{TOTAL_POSTS}</b>- {L_MESSAGES}.<br> {L_WEHAVE} <b>{TOTAL_USERS}</b> {L_REGUSERS}.<br>{L_NEWESTUSER} <b><a href="{U_NEWEST_USER_PROFILE}">{NEWEST_USER}</a></b></td> + </tr> + </table></td> + </tr> + </table></td> +</tr> +<tr> <td><table border="0" align="center" width="100%" bgcolor="#000000" cellpadding="0" cellspacing="1"> <tr> <td><table border="0" width="100%" cellpadding="3" cellspacing="1"> @@ -6,18 +17,34 @@ <td colspan="4" align="center"><b>There are {ACTIVE_USERS} logged in users and {GUEST_USERS} guest users browsing this board.</b><br />This data is based on users active over the past five minutes.</td> </tr> <tr class="catheader"> - <td width="35%" align="center"> {L_USERNAME} </td> - <td width="25%" align="center"> {L_LAST_UPDATE} </td> + <td width="30%" align="center"> {L_USERNAME} </td> + <td width="30%" align="center"> {L_LASTUPDATE} </td> <td width="40%" align="center"> {L_LOCATION} </td> </tr> <!-- BEGIN userrow --> <tr bgcolor="{userrow.ROW_COLOR}" class="tablebody"> - <td width="35%"> <a href="{userrow.U_USER_PROFILE}">{userrow.USERNAME}</a> </td> - <td width="25%" align="center"> {userrow.LASTUPDATE} </td> - <td width="40%"> <a href="{userrow.U_FORUM_LOCATION}"> {userrow.LOCATION}</a> </td> + <td width="30%"> {userrow.USERNAME} </td> + <td width="30%" align="center"> {userrow.LASTUPDATE} </td> + <td width="40%"><a href="{userguestrow.LOCATION_URL}"> {userrow.LOCATION} </a></td> </tr> <!-- END userrow --> </table></td> </tr> </table></td> +</tr> +<tr> + <td align="center"><table border="0" width="100%" cellpadding="0" cellspacing="1"> + <tr> + <td style="{font-size: 8pt;}" align="left" valign="top"><b>{S_TIMEZONE}</b></td> + <td style="{font-size: 8pt;}" align="right" ><table cellpadding="0" cellspacing="1" border="0" bgcolor="#000000"> + <tr> + <td bgcolor="#CCCCCC"><table width="100%" cellpadding="1" cellspacing="1" border="0"> + <tr> + <td style="{font-size:8pt; height:55px;}" align="right">{JUMPBOX}</td> + </tr> + </table></td> + </tr> + </table></td> + </tr> + </table></td> </tr>
\ No newline at end of file diff --git a/phpBB/templates/Default/viewtopic_body.tpl b/phpBB/templates/Default/viewtopic_body.tpl index 0eeb777095..ffa5326054 100644 --- a/phpBB/templates/Default/viewtopic_body.tpl +++ b/phpBB/templates/Default/viewtopic_body.tpl @@ -1,4 +1,40 @@ <tr> + <td> + <table border="0" width="100%" cellpadding="0" cellspacing="0"> + <tr> + <td> + <table border="0" align="left" width="20%" bgcolor="#000000" cellpadding="0" cellspacing="1"> + <tr> + <td> + <table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1"> + <tr> + <td align="left" valign="bottom" style="{font-size: 8pt; height: 55px;}" nowrap> + <a href="{U_INDEX}">{SITENAME} - Forum Index</a> >> <a href="{U_VIEW_FORUM}">{FORUM_NAME}</a> >> {TOPIC_TITLE} + </td> + </tr> + </table> + </td> + </tr> + </table> + <table border="0" align="right" width="20%" bgcolor="#000000" cellpadding="0" cellspacing="1"> + <tr> + <td> + <table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1"> + <tr> + <td align="right" style="{font-size: 8pt;}"> + <a href="{U_POST_NEW_TOPIC}"><img src="images/newpost.jpg" height="50" width="125" alt="Post New Topic" border="0"></a> <a href="{U_POST_REPLY_TOPIC}"><img src="images/reply.jpg" height="50" width="125" alt="Reply to this topic" border="0"></a> + </td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr> <td> <table border="0" align="center" width="100%" bgcolor="#000000" cellpadding="0" cellspacing="1"> <tr> @@ -68,3 +104,43 @@ </tr> </table></td> </tr> +<tr> + <td> + <table border="0" width="100%" align="center" cellpadding="0" cellspacing="0"> + <tr> + <td> + <table border="0" align="left" width="20%" bgcolor="#000000" cellpadding="0" cellspacing="1"> + <tr> + <td> + <table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1"> + <tr> + <td align="left" style="{font-size: 8pt;}"> + <a href="{U_POST_NEW_TOPIC}"> + <img src="images/newpost.jpg" height="50" width="125" alt="Post New Topic" border="0"></a> + <a href="{U_POST_REPLY_TOPIC}"> + <img src="images/reply.jpg" height="50" width="125" alt="Reply to this topic" border="0"> + </a> + </td> + </tr> + </table> + </td> + </tr> + </table> + + <table border="0" align="right" width="20%" bgcolor="#000000" cellpadding="0" cellspacing="1"> + <tr> + <td> + <table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1"> + <tr> + <td align="right" style="{font-size: 8pt; height: 55px;}">{JUMPBOX}</td> + </tr> + </table> + </td> + </tr> + </table> + + </td> + </tr> + </table> + </td> +</tr>
\ No newline at end of file diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index aae3bcf64b..2e68fc30ff 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -191,10 +191,31 @@ $template->assign_vars(array( "S_POST_DAYS_ACTION" => append_sid("viewforum.$phpEx?".POST_FORUM_URL."=".$forum_id."&start=$start"))); // -// Dump out the page header +// Dump out the page header and +// load viewforum template // include('includes/page_header.'.$phpEx); +$template->set_filenames(array( + "body" => "viewforum_body.tpl", + "jumpbox" => "jumpbox.tpl") +); +$jumpbox = make_jumpbox(); +$template->assign_vars(array( + "JUMPBOX_LIST" => $jumpbox, + "SELECT_NAME" => POST_FORUM_URL) +); +$template->assign_var_from_handle("JUMPBOX", "jumpbox"); +$template->assign_vars(array( + "FORUM_ID" => $forum_id, + "FORUM_NAME" => $forum_name, + "MODERATORS" => $forum_moderators, + "USERS_BROWSING" => $users_browsing) +); +// +// End header +// + // // Okay, lets dump out the page ... // @@ -270,6 +291,7 @@ if($total_topics) $template->assign_vars(array( "PAGINATION" => generate_pagination("viewforum.$phpEx?".POST_FORUM_URL."=$forum_id", $topics_count, $board_config['topics_per_page'], $start)) ); + $template->pparse("body"); } else diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index 1ecd1cfeb2..7b89476aa4 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -42,8 +42,35 @@ $newest_userdata = get_db_stat('newestuser'); $newest_user = $newest_userdata["username"]; $newest_uid = $newest_userdata["user_id"]; +// +// Output page header and load +// viewonline template +// include('includes/page_header.'.$phpEx); +$template->set_filenames(array( + "body" => "viewonline_body.tpl", + "jumpbox" => "jumpbox.tpl") +); +$jumpbox = make_jumpbox(); +$template->assign_vars(array( + "JUMPBOX_LIST" => $jumpbox, + "SELECT_NAME" => POST_FORUM_URL) +); +$template->assign_var_from_handle("JUMPBOX", "jumpbox"); +$template->assign_vars(array( + "TOTAL_POSTS" => $total_posts, + "TOTAL_USERS" => $total_users, + "POST_USER_URL" => POST_USERS_URL, + "NEWEST_USER" => $newest_user, + "NEWEST_UID" => $newest_uid, + + "U_NEWEST_USER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=$newest_uid")) +); +// +// End header +// + $sql = "SELECT u.username, u.user_id, s.session_page, s.session_logged_in, s.session_time FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s WHERE u.user_id = s.session_user_id diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index d28e9b5e0b..12cac73143 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -27,6 +27,8 @@ include('includes/bbcode.'.$phpEx); $page_title = "View Topic - $topic_title"; $pagetype = "viewtopic"; +$is_moderator = 0; + if(!isset($HTTP_GET_VARS['topic'])) // For backward compatibility { $topic_id = $HTTP_GET_VARS[POST_TOPIC_URL]; @@ -36,8 +38,6 @@ else $topic_id = $HTTP_GET_VARS['topic']; } -$is_moderator = 0; - if(!isset($topic_id)) { error_die(GENERAL_ERROR, "You have reached this page in error, please go back and try again"); @@ -57,34 +57,29 @@ if(isset($HTTP_GET_VARS['view'])) $operator = "<"; } - switch($dbms) + switch(SQL_LAYER) { - case 'oracle': - case 'mssql': - case 'odbc': - case 'postgres': - $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, - 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 - WHERE t.topic_id in - (select min(topic_id) from ".TOPICS_TABLE." WHERE topic_time ".$operator." (select topic_time as t_time from ".TOPICS_TABLE." where topic_id = $topic_id)) - AND f.forum_id = t.forum_id - AND fm.forum_id = t.forum_id - AND u.user_id = fm.user_id"; - break; - default: - // And now the stupid MySQL case...I wish they would get around to implementing subselectes... - $sub_query = "SELECT topic_time FROM ".TOPICS_TABLE." WHERE topic_id = $topic_id"; + case 'mysql': + // + // Now the stupid MySQL case...I wish they would get around + // to implementing subselectes... + // + $sub_query = "SELECT topic_time + FROM ".TOPICS_TABLE." + WHERE topic_id = $topic_id"; if($sub_result = $db->sql_query($sub_query)) { - $resultset = $db->sql_fetchrowset($sub_result); - $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, + $result = $db->sql_fetchrow($sub_result); + echo $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, 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 - WHERE t.topic_time ".$operator." ".$resultset[0]['topic_time']." - AND f.forum_id = t.forum_id - AND fm.forum_id = t.forum_id - AND u.user_id = fm.user_id"; + FROM ".TOPICS_TABLE." t, ".TOPICS_TABLE." t2, ".FORUMS_TABLE." f, ".FORUM_MODS_TABLE." fm, ".USERS_TABLE." u + WHERE t.topic_time ".$operator." ".$result['topic_time']." + AND t2.topic_id = $topic_id + AND t.forum_id = t2.forum_id + AND f.forum_id = t.forum_id + AND fm.forum_id = t.forum_id + AND u.user_id = fm.user_id + ORDER BY t.topic_time DESC"; $db->sql_freeresult($sub_result); } else @@ -99,7 +94,22 @@ if(isset($HTTP_GET_VARS['view'])) error_die(SQL_QUERY, "Couldn't obtain topic information.", __LINE__, __FILE__); } } - break; + break; + + default: + // + // The default query handles all the other supported + // DB's; PostgreSQL, MSSQL, ODBC and of course Oracle + // + echo $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, + 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 + WHERE t.topic_id in + (select min(topic_id) from ".TOPICS_TABLE." WHERE topic_time ".$operator." (select topic_time as t_time from ".TOPICS_TABLE." where topic_id = $topic_id)) + AND f.forum_id = t.forum_id + AND fm.forum_id = t.forum_id + AND u.user_id = fm.user_id"; + break; } } // @@ -107,13 +117,15 @@ if(isset($HTTP_GET_VARS['view'])) // else { - $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, - 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 - WHERE t.topic_id = $topic_id - AND f.forum_id = t.forum_id + + $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, + 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 + WHERE t.topic_id = $topic_id + AND f.forum_id = t.forum_id AND fm.forum_id = t.forum_id AND u.user_id = fm.user_id"; + } if(!$result = $db->sql_query($sql)) @@ -204,6 +216,33 @@ $postrow = $db->sql_fetchrowset($result); $ranksrow = $db->sql_fetchrowset($ranksresult); // +// Dump out the page header +// +include('includes/page_header.'.$phpEx); + +$template->set_filenames(array( + "body" => "viewtopic_body.tpl", + "jumpbox" => "jumpbox.tpl") +); +$jumpbox = make_jumpbox(); +$template->assign_vars(array( + "JUMPBOX_LIST" => $jumpbox, + "SELECT_NAME" => POST_FORUM_URL) +); +$template->assign_var_from_handle("JUMPBOX", "jumpbox"); +$template->assign_vars(array( + "FORUM_ID" => $forum_id, + "FORUM_NAME" => $forum_name, + "TOPIC_ID" => $topic_id, + "TOPIC_TITLE" => $topic_title, + "POST_FORUM_URL" => POST_FORUM_URL, + "USERS_BROWSING" => $users_browsing) +); +// +// End header +// + +// // Post, reply and other URL generation for // templating vars // @@ -220,11 +259,6 @@ $template->assign_vars(array( "U_POST_REPLY_TOPIC" => $reply_topic_url)); // -// Dump out the page header -// -include('includes/page_header.'.$phpEx); - -// // Okay, let's do the loop, yeah come on baby let's do the loop // and it goes like this ... // |