From 0e9f0ac4ecc636336603cc6932ce21a550c7087e Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sun, 20 Oct 2002 19:19:07 +0000 Subject: [PATCH] Mostly changes to turn userdata into user->data, lang into user->lang + bitstring 2nd format + inheritance for permission admin and various other updates/fixes/changes ... note that user->lang & user->theme isn't final git-svn-id: file:///svn/phpbb/trunk@2958 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/admin/admin_ban.php | 21 +- phpBB/admin/admin_board.php | 188 ++++---- phpBB/admin/admin_database.php | 62 +-- phpBB/admin/admin_disallow.php | 26 +- phpBB/admin/admin_email.php | 20 +- phpBB/admin/admin_forums.php | 128 +++--- phpBB/admin/admin_groups.php | 72 +-- phpBB/admin/admin_permissions.php | 238 ++++++---- phpBB/admin/admin_prune.php | 40 +- phpBB/admin/admin_prune_users.php | 42 +- phpBB/admin/admin_ranks.php | 58 +-- phpBB/admin/admin_search.php | 22 +- phpBB/admin/admin_smilies.php | 108 ++--- phpBB/admin/admin_styles.php | 117 ++--- phpBB/admin/admin_users.php | 192 ++++---- phpBB/admin/admin_viewlogs.php | 34 +- phpBB/admin/admin_words.php | 42 +- phpBB/admin/index.php | 102 ++--- phpBB/admin/pagestart.php | 34 +- phpBB/common.php | 61 +-- phpBB/config.php | 15 + phpBB/db/mysql.php | 14 +- phpBB/develop/revar_lang_files.php | 4 +- phpBB/faq.php | 6 +- phpBB/groupcp.php | 106 ++--- phpBB/includes/auth/auth_apache.php | 4 +- phpBB/includes/auth/auth_db.php | 4 +- phpBB/includes/auth/auth_ldap.php | 8 +- phpBB/includes/forums_display.php | 43 +- phpBB/includes/functions.php | 207 +++------ phpBB/includes/functions_admin.php | 154 +++---- phpBB/includes/page_header.php | 211 +++++---- phpBB/includes/page_tail.php | 12 +- phpBB/includes/session.php | 428 ++++++++++++------ phpBB/includes/usercp_viewprofile.php | 88 ++-- phpBB/index.php | 72 +-- phpBB/install/schemas/mysql_schema.sql | 5 +- phpBB/language/en/lang_admin.php | 25 +- phpBB/language/en/lang_main.php | 3 +- phpBB/login.php | 14 +- phpBB/memberlist.php | 136 +++--- phpBB/modcp.php | 10 +- phpBB/posting.php | 264 +++++------ phpBB/privmsg.php | 10 +- phpBB/profile.php | 22 +- phpBB/search.php | 213 +++++---- .../subSilver/search_results_posts.html | 4 +- phpBB/templates/subSilver/viewforum_body.html | 18 +- phpBB/templates/subSilver/viewtopic_body.html | 28 +- phpBB/viewforum.php | 276 +++++------ phpBB/viewonline.php | 80 ++-- phpBB/viewtopic.php | 182 ++++---- 52 files changed, 2146 insertions(+), 2127 deletions(-) diff --git a/phpBB/admin/admin_ban.php b/phpBB/admin/admin_ban.php index b03880c1ce..40232d7098 100644 --- a/phpBB/admin/admin_ban.php +++ b/phpBB/admin/admin_ban.php @@ -528,8 +528,27 @@ switch ( $mode ) + :
- + + + + diff --git a/phpBB/admin/admin_board.php b/phpBB/admin/admin_board.php index c326b41323..6f26eb934b 100644 --- a/phpBB/admin/admin_board.php +++ b/phpBB/admin/admin_board.php @@ -46,7 +46,7 @@ require('pagestart.' . $phpEx); // Are we authed? if ( !$auth->acl_get('a_general') ) { - message_die(MESSAGE, $lang['No_admin']); + message_die(MESSAGE, $user->lang['No_admin']); } // Get mod @@ -84,7 +84,7 @@ while ( $row = $db->sql_fetchrow($result) ) if ( isset($_POST['submit']) ) { add_admin_log('log_' . $mode . '_config'); - message_die(MESSAGE, $lang['Config_updated']); + message_die(MESSAGE, $user->lang['Config_updated']); } // @@ -120,17 +120,17 @@ switch ( $mode ) return; } -page_header($lang[$l_title]); +page_header($user->lang[$l_title]); ?> -

+

lang[$l_title]; ?>

-

+

lang[$l_title . '_explain']; ?>

" method="post"> - + - + - + - + - - + + - - + + - - + + - - + + - + - + - + - + - + - - + + - + - + - + - - - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - + - + - + - - + + - - + + - - + + - - + + - + - + - - + + - + - + - + - + - - - + - + - + - + - - + + - - + + - + - + - - + + - + - + - + - + - + - + - - + + - + - + - + - - + + - + - + - + - +
lang[$l_title]; ?>
: lang['Cookie_domain']; ?>:
: lang['Cookie_name']; ?>:
: lang['Cookie_path']; ?>:
:
/>    />lang['Cookie_secure']; ?>:
lang['Cookie_secure_explain']; ?>
/>lang['Disabled']; ?>    />lang['Enabled']; ?>
: />    /> lang['Allow_local']; ?>: /> lang['Yes']; ?>   /> lang['No']; ?>
:
/>    /> lang['Allow_remote']; ?>:
lang['Allow_remote_explain']; ?>
/> lang['Yes']; ?>   /> lang['No']; ?>
: />    /> lang['Allow_upload']; ?>: /> lang['Yes']; ?>   /> lang['No']; ?>
:
lang['Max_filesize']; ?>:
lang['Max_filesize_explain']; ?>
Bytes
:
lang['Max_avatar_size']; ?>:
lang['Max_avatar_size_explain']; ?>
x
:
lang['Avatar_storage_path']; ?>:
lang['Avatar_storage_path_explain']; ?>
:
lang['Avatar_gallery_path']; ?>:
lang['Avatar_gallery_path_explain']; ?>
lang['Default_style']; ?>
:
/>    /> lang['Override_style']; ?>:
lang['Override_style_explain']; ?>
/> lang['Yes']; ?>   /> lang['No']; ?>
: lang['Default_language']; ?>:
:
lang['Date_format']; ?>:
lang['Date_format_explain']; ?>
: lang['System_timezone']; ?>:

: +
lang['Char_limit']; ?>:
lang['Char_limit_explain']; ?>
:
+
lang['Smilies_limit']; ?>:
lang['Smilies_limit_explain']; ?>
: />    /> lang['Allow_topic_notify']; ?>: /> lang['Yes']; ?>   /> lang['No']; ?>
: />    /> lang['Allow_forum_notify']; ?>: /> lang['Yes']; ?>   /> lang['No']; ?>
: />    /> lang['Allow_name_change']; ?>: /> lang['Yes']; ?>   /> lang['No']; ?>
: />    /> lang['Allow_HTML']; ?>: /> lang['Yes']; ?>   /> lang['No']; ?>
:
lang['Allowed_tags']; ?>:
lang['Allowed_tags_explain']; ?>
: />    /> lang['Allow_BBCode']; ?>: /> lang['Yes']; ?>   /> lang['No']; ?>
: />    /> lang['Allow_smilies']; ?>: /> lang['Yes']; ?>   /> lang['No']; ?>
: />    /> lang['Allow_sig']; ?>: /> lang['Yes']; ?>   /> lang['No']; ?>
:
lang['Max_sig_length']; ?>:
lang['Max_sig_length_explain']; ?>
: lang['Site_name']; ?>:
: lang['Site_desc']; ?>:
:
/>    />
lang['Board_disable']; ?>:
lang['Board_disable_explain']; ?>
/> lang['Yes']; ?>   /> lang['No']; ?>
: />    /> lang['Enable_prune']; ?>: /> lang['Yes']; ?>   /> lang['No']; ?>
:
/>    />    />    />lang['Acct_activation']; ?>:
lang['Acct_activation_explain']; ?>
/>lang['Acc_None']; ?>    />lang['Acc_User']; ?>    />lang['Acc_Admin']; ?>    />lang['Acc_Disable']; ?>
:
/>    /> lang['Enable_COPPA']; ?>:
lang['Enable_COPPA_explain']; ?>
/> lang['Yes']; ?>   /> lang['No']; ?>
: lang['COPPA_fax']; ?>:
:
lang['COPPA_mail']; ?>:
lang['COPPA_mail_explain']; ?>
: />    />lang['Private_Messaging']; ?>: />lang['Enabled']; ?>    />lang['Disabled']; ?>
:
lang['Boxes_max']; ?>:
lang['Boxes_max_explain']; ?>
:
lang['Boxes_limit']; ?>:
lang['Boxes_limit_explain']; ?>
:
lang['Flood_Interval']; ?>:
lang['Flood_Interval_explain']; ?>
:
lang['Search_Interval']; ?>:
lang['Search_Interval_explain']; ?>
:
+
lang['Min_search_chars']; ?>:
lang['Min_search_chars_explain']; ?>
:
+
lang['Max_search_chars']; ?>:
lang['Max_search_chars_explain']; ?>
: lang['Topics_per_page']; ?>:
: lang['Posts_per_page']; ?>:
: lang['Hot_threshold']; ?>:
: lang['Max_poll_options']; ?>:
:
/>    /> lang['Enable_email']; ?>:
lang['Enable_email_explain']; ?>
/> lang['Enabled']; ?>   /> lang['Disabled']; ?>
:
/>    /> lang['Board_email_form']; ?>:
lang['Board_email_form_explain']; ?>
/> lang['Enabled']; ?>   /> lang['Disabled']; ?>
: lang['Admin_email']; ?>:
:
lang['Email_sig']; ?>:
lang['Email_sig_explain']; ?>
:
/>    /> lang['Use_SMTP']; ?>:
lang['Use_SMTP_explain']; ?>
/> lang['Yes']; ?>   /> lang['No']; ?>
: lang['SMTP_server']; ?>:
:
lang['SMTP_username']; ?>:
lang['SMTP_username_explain']; ?>
:
lang['SMTP_password']; ?>:
lang['SMTP_password_explain']; ?>
:
lang['Server_name']; ?>:
lang['Server_name_explain']; ?>
:
lang['Server_port']; ?>:
lang['Server_port_explain']; ?>
:
lang['Script_path']; ?>:
lang['Script_path_explain']; ?>
:
/>    />    />    />   lang['IP_valid']; ?>:
lang['IP_valid_explain']; ?>
/> lang['All']; ?>   /> lang['Class_C']; ?>   /> lang['Class_B']; ?>   /> lang['None']; ?>  
:
lang['Limit_load']; ?>:
lang['Limit_load_explain']; ?>
: lang['Session_length']; ?>:
:
lang['Limit_sessions']; ?>:
lang['Limit_sessions_explain']; ?>
: />    /> lang['Enable_gzip']; ?>: /> lang['Yes']; ?>   /> lang['No']; ?>
:
lang['Smilies_path']; ?>:
lang['Smilies_path_explain']; ?>
:
lang['Icons_path']; ?>:
lang['Icons_path_explain']; ?>
:lang['Auth_method']; ?>:
    
diff --git a/phpBB/admin/admin_database.php b/phpBB/admin/admin_database.php index 41c7962062..162a7ae653 100644 --- a/phpBB/admin/admin_database.php +++ b/phpBB/admin/admin_database.php @@ -52,7 +52,7 @@ include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); // if ( !$auth->acl_get('a_general') ) { - message_die(MESSAGE, $lang['No_admin']); + message_die(MESSAGE, $user->lang['No_admin']); } // @@ -85,7 +85,7 @@ switch( $mode ) break; } - message_die(MESSAGE, $lang['Backups_not_supported']); + message_die(MESSAGE, $user->lang['Backups_not_supported']); break; } @@ -97,32 +97,32 @@ switch( $mode ) if ( !isset($_POST['backupstart']) && !isset($_GET['backupstart']) ) { - page_header($lang['DB_Backup']); + page_header($user->lang['DB_Backup']); ?> -

+

lang['DB_Backup']; ?>

-

+

lang['Backup_explain']; ?>

"> - + - - + + - - + + - + - + - - + - +
lang['Backup_options']; ?>
:       lang['Backup_type']; ?>: lang['Full_backup']; ?>   lang['Structure_only']; ?>   lang['Data_only']; ?>
:
   lang['Include_search_index']; ?>:
lang['Include_search_index_explain']; ?>
lang['No']; ?>   lang['Yes']; ?>
:
lang['Additional_tables']; ?>:
lang['Additional_tables_explain']; ?>
:
lang['Store_local']; ?>:
lang['Store_local_explain']; ?>
: lang['Compress_file']; ?>: lang['None']; ?>
@@ -170,10 +170,10 @@ switch( $mode ) { $meta = ""; - $message = ( empty($store_path) ) ? $lang['Backup_download'] : $lang['Backup_writing']; + $message = ( empty($store_path) ) ? $user->lang['Backup_download'] : $user->lang['Backup_writing']; - page_header($lang['DB_Backup'], $meta); - page_message($lang['DB_Backup'], $message); + page_header($user->lang['DB_Backup'], $meta); + page_message($user->lang['DB_Backup'], $message); page_footer(); } @@ -301,7 +301,7 @@ switch( $mode ) fclose($fp); unset($contents); - message_die(MESSAGE, $lang['Backup_success']); + message_die(MESSAGE, $user->lang['Backup_success']); } exit; @@ -328,19 +328,19 @@ switch( $mode ) if ( $file_tmpname == '' || $filename == '' || !file_exists($file_tmpname) ) { - message_die(MESSAGE, $lang['Restore_Error_no_file']); + message_die(MESSAGE, $user->lang['Restore_Error_no_file']); } $ext = substr($filename, strrpos($filename, '.') + 1); if ( !preg_match('/^(sql|gz|bz2)$/', $ext) ) { - message_die(MESSAGE, $lang['Restore_Error_filename']); + message_die(MESSAGE, $user->lang['Restore_Error_filename']); } if ( ( !extension_loaded('zlib') && $ext == 'gz' ) || ( !extension_loaded('zip') && $ext == 'zip' ) || ( $ext == 'bz2' && !extension_loaded('bz2') ) ) { - message_die(MESSAGE, $lang['Compress_unsupported']); + message_die(MESSAGE, $user->lang['Compress_unsupported']); } $sql_query = ''; @@ -383,27 +383,27 @@ switch( $mode ) add_admin_log('log_db_restore'); - message_die(MESSAGE, $lang['Restore_success']); + message_die(MESSAGE, $user->lang['Restore_success']); } // // Restore page // - page_header($lang['DB_Restore']); + page_header($user->lang['DB_Restore']); ?> -

+

lang['DB_Restore']; ?>

-

+

lang['Restore_explain']; ?>

"> - + - - + - +
lang['Select_file']; ?>
:
lang['Upload_file']; ?>:
lang['Supported_extensions']; $types = ': sql'; if ( extension_loaded('zlib') ) @@ -421,11 +421,11 @@ switch( $mode )
:
lang['Local_backup_file']; ?>:
lang['Local_backup_file_explain']; ?>
diff --git a/phpBB/admin/admin_disallow.php b/phpBB/admin/admin_disallow.php index dba6f28455..4bd6a88170 100644 --- a/phpBB/admin/admin_disallow.php +++ b/phpBB/admin/admin_disallow.php @@ -59,7 +59,7 @@ if( isset($_POST['add_name']) ) if ( !validate_username($disallowed_user) ) { - $message = $lang['Disallowed_already']; + $message = $user->lang['Disallowed_already']; } else { @@ -67,10 +67,10 @@ if( isset($_POST['add_name']) ) VALUES('" . str_replace("\'", "''", $disallowed_user) . "')"; $result = $db->sql_query( $sql ); - $message = $lang['Disallow_successful']; + $message = $user->lang['Disallow_successful']; } - $message .= '

' . sprintf($lang['Click_return_disallowadmin'], '', '') . '

' . sprintf($lang['Click_return_admin_index'], '', ''); + $message .= '

' . sprintf($user->lang['Click_return_disallowadmin'], '', '') . '

' . sprintf($user->lang['Click_return_admin_index'], '', ''); add_admin_log('log_disallow_add', str_replace('%', '*', $disallowed_user)); @@ -84,7 +84,7 @@ else if( isset($_POST['delete_name']) ) WHERE disallow_id = $disallowed_id"; $db->sql_query($sql); - $message .= $lang['Disallowed_deleted'] . '

' . sprintf($lang['Click_return_disallowadmin'], '', '') . '

' . sprintf($lang['Click_return_admin_index'], '', ''); + $message .= $user->lang['Disallowed_deleted'] . '

' . sprintf($user->lang['Click_return_disallowadmin'], '', '') . '

' . sprintf($user->lang['Click_return_admin_index'], '', ''); add_admin_log('log_disallow_delete'); @@ -112,28 +112,28 @@ if ( $row = $db->sql_fetchrow($result) ) // // Output page // -page_header($lang['Users']); +page_header($user->lang['Users']); ?> -

+

lang['Disallow_control']; ?>

-

+

lang['Disallow_explain']; ?>

"> - + - - + + - + - - + +
lang['Add_disallow_title']; ?>

 lang['Username']; ?>
lang['Add_disallow_explain']; ?>
 
lang['Delete_disallow_title']; ?>

 lang['Username']; ?>
lang['Delete_disallow_explain']; ?>
 lang['No_disallowed']; } ?>
diff --git a/phpBB/admin/admin_email.php b/phpBB/admin/admin_email.php index 775e013ae0..e8790017c5 100644 --- a/phpBB/admin/admin_email.php +++ b/phpBB/admin/admin_email.php @@ -132,7 +132,7 @@ if ( isset($_POST['submit']) ) $emailer->send(); $emailer->reset(); - message_die(MESSAGE, $lang['Email_sent']); + message_die(MESSAGE, $user->lang['Email_sent']); } } @@ -144,7 +144,7 @@ $sql = "SELECT group_id, group_name FROM ".GROUPS_TABLE; $result = $db->sql_query($sql); -$select_list = ''; if ( $row = $db->sql_fetchrow($result) ) { do @@ -155,32 +155,32 @@ if ( $row = $db->sql_fetchrow($result) ) } $select_list .= ''; -page_header($lang['Mass_Email']); +page_header($user->lang['Mass_Email']); ?> -

+

lang['Mass_Email']; ?>

-

+

lang['Mass_email_explain']; ?>

"> - + - + - + - - +
lang['Compose']; ?>
lang['Recipients']; ?>
lang['Subject']; ?>
+ lang['Message']; ?>
diff --git a/phpBB/admin/admin_forums.php b/phpBB/admin/admin_forums.php index 956bc010b6..915a63a56f 100644 --- a/phpBB/admin/admin_forums.php +++ b/phpBB/admin/admin_forums.php @@ -45,7 +45,7 @@ include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); // if (!$auth->acl_get('a_forum')) { - message_die(MESSAGE, $lang['No_admin']); + message_die(MESSAGE, $user->lang['No_admin']); } // @@ -202,7 +202,7 @@ switch ($mode) VALUES ($forum_id, '$forum_name', '$forum_desc', $parent_id, $left_id, $right_id, $forum_status, $forum_style, $post_count_inc, $prune_enable, $prune_days, $prune_freq)"; $db->sql_query($sql); - $message = $lang['Forums_updated'] . "

" . sprintf($lang['Click_return_forumadmin'], '', '') . '

' . sprintf($lang['Click_return_admin_index'], '', ''); + $message = $user->lang['Forums_updated'] . "

" . sprintf($user->lang['Click_return_forumadmin'], '', '') . '

' . sprintf($user->lang['Click_return_admin_index'], '', ''); message_die(MESSAGE, $message); break; @@ -252,7 +252,7 @@ switch ($mode) $db->sql_query_array('UPDATE ' . FORUMS_TABLE . " SET WHERE forum_id = $forum_id", $sql); - $message = $lang['Forums_updated'] . "

" . sprintf($lang['Click_return_forumadmin'], '', '') . '

' . sprintf($lang['Click_return_admin_index'], '', ''); + $message = $user->lang['Forums_updated'] . "

" . sprintf($user->lang['Click_return_forumadmin'], '', '') . '

' . sprintf($user->lang['Click_return_admin_index'], '', ''); message_die(MESSAGE, $message); break; @@ -280,7 +280,7 @@ switch ($mode) { if (empty($_POST['posts_to_id'])) { - $message = $lang['No_destination_forum'] . '

' . sprintf($lang['Click_return_forumadmin'], '', ''); + $message = $user->lang['No_destination_forum'] . '

' . sprintf($user->lang['Click_return_forumadmin'], '', ''); message_die(ERROR, $message); } @@ -305,7 +305,7 @@ switch ($mode) { if (empty($_POST['subforums_to_id'])) { - $message = $lang['No_destination_forum'] . '

' . sprintf($lang['Click_return_forumadmin'], '', ''); + $message = $user->lang['No_destination_forum'] . '

' . sprintf($user->lang['Click_return_forumadmin'], '', ''); message_die(ERROR, $message); } @@ -340,7 +340,7 @@ switch ($mode) $db->sql_query($sql); $return_id = (!empty($_POST['subforums_to_id'])) ? $_POST['subforums_to_id'] : $parent_id; - $message = $lang['Forum_deleted'] . '

' . sprintf($lang['Click_return_forumadmin'], '', ''); + $message = $user->lang['Forum_deleted'] . '

' . sprintf($user->lang['Click_return_forumadmin'], '', ''); message_die(MESSAGE, $message); break; @@ -371,9 +371,9 @@ switch ($mode) $parents_list = make_forums_list('all', $parent_id, $subforums_id); - $l_title = ($forum_status != ITEM_CATEGORY) ? $lang['Edit_forum'] : $lang['Edit_category']; + $l_title = ($forum_status != ITEM_CATEGORY) ? $user->lang['Edit_forum'] : $user->lang['Edit_category']; $newmode = 'modify'; - $buttonvalue = $lang['Update']; + $buttonvalue = $user->lang['Update']; $prune_enabled = ($prune_enable) ? 'checked="checked" ' : ''; if ($forum_status != ITEM_CATEGORY) @@ -390,9 +390,9 @@ switch ($mode) } $parents_list = make_forums_list('all', $parent_id); - $l_title = $lang['Create_forum']; + $l_title = $user->lang['Create_forum']; $newmode = 'create'; - $buttonvalue = $lang['Create_forum']; + $buttonvalue = $user->lang['Create_forum']; $forum_desc = ''; $forum_style = ''; @@ -414,27 +414,27 @@ switch ($mode) $forum_checked = ($forum_status != ITEM_CATEGORY) ? 'checked="checked" ' : ''; $category_checked = ($forum_status == ITEM_CATEGORY) ? 'checked="checked" ' : ''; - $statuslist = '\n"; - $statuslist .= '\n"; + $statuslist = '\n"; + $statuslist .= '\n"; page_header($l_title); ?>

-

+

lang['Forum_edit_delete_explain'] ?>

" method="post"> - + - + - + - - + + - + - - + + - + - + - + - - + - + @@ -542,7 +542,7 @@ switch ($mode) break; case 'delete': - page_header($lang['Forum_delete']); + page_header($user->lang['Forum_delete']); extract(get_forum_info($_GET['f'])); $subforums_id = array(); @@ -556,17 +556,17 @@ switch ($mode) $move_posts_list = make_forums_list('forums', $parent_id, $subforums_id); ?> -

+

lang['Forum_delete'] ?>

-

+

lang['Forum_delete_explain'] ?>

lang['General_settings'] ?>
lang['Forum_name'] : $user->lang['Category_name'] ?>
lang['Forum_desc'] ?>
/>   />lang['Forum_type'] ?>/>lang['Forum'] ?>   />lang['Category'] ?>
lang['Parent'] ?>
lang['Style'] ?>
lang['Forum_settings'] ?>
lang['Forum_status'] ?>
lang['Options'] ?> - /> + />lang['Disable_post_count'] ?> 0) { @@ -488,7 +488,7 @@ switch ($mode) { ?>
- /> + />lang['Display_on_index'] ?>

-      
-       +
lang['Forum_type'] ?>lang['Set_as_category'] ?>
+      lang['Delete_all_posts'] ?>
+      lang['Move_posts_to'] ?>
lang['Forum_pruning'] ?> - + - - + + - - + +
lang['Enabled'] ?> />
  lang['prune_days'] ?>  lang['Days'] ?>
  lang['prune_freq'] ?>  lang['Days'] ?>
- + - + - - + + - + - - + + - + - +
lang['Forum_delete'] ?>
lang['Category_name'] : $user->lang['Forum_name'] ?>
lang['Action'] ?> lang['Delete_all_posts'] ?>
lang['Move_posts_to'] ?>
lang['Action'] ?> lang['Delete_subforums'] ?>
lang['Move_subforums_to'] ?>
@@ -615,7 +615,7 @@ if (empty($show_index)) page_footer(); } -page_header($lang['Manage']); +page_header($user->lang['Manage']); $parent_id = (!empty($_GET['parent_id'])) ? $_GET['parent_id'] : 0; @@ -648,7 +648,7 @@ else
"> - + sql_fetchrow($result)) ?> - - - + + + @@ -732,17 +732,17 @@ while ($row = $db->sql_fetchrow($result)) - - - - + + + + - + sql_fetchrow($result)) - - - - + + + + sql_fetchrow($result)) ?> - +
lang['Forum_admin'] ?>
lang['Edit'] ?>lang['Delete'] ?>lang['Move_up'] ?> lang['Move_down'] ?>  
>

lang['Edit'] ?>lang['Delete'] ?>lang['Move_up'] ?>
lang['Move_down'] ?>
lang['Resync'] : ' ' ?>
>

lang['Edit'] ?>lang['Delete'] ?>lang['Move_up'] ?>
lang['Move_down'] ?>
lang['Resync'] ?>
diff --git a/phpBB/admin/admin_groups.php b/phpBB/admin/admin_groups.php index 048673d344..893672498b 100644 --- a/phpBB/admin/admin_groups.php +++ b/phpBB/admin/admin_groups.php @@ -47,7 +47,7 @@ require('pagestart.' . $phpEx); // if ( !$auth->acl_get('a_group') ) { - message_die(MESSAGE, $lang['No_admin']); + message_die(MESSAGE, $user->lang['No_admin']); } if( isset($_POST[POST_GROUPS_URL]) || isset($_GET[POST_GROUPS_URL]) ) @@ -96,7 +96,7 @@ if( isset($_POST['edit']) || isset($_POST['new']) ) if( !$db->sql_numrows($result) ) { - message_die(GENERAL_MESSAGE, $lang['Group_not_exist']); + message_die(GENERAL_MESSAGE, $user->lang['Group_not_exist']); } $group_info = $db->sql_fetchrow($result); @@ -151,23 +151,23 @@ if( isset($_POST['edit']) || isset($_POST['new']) ) "GROUP_DESCRIPTION" => $group_info['group_description'], "GROUP_MODERATOR" => $group_moderator, - "L_GROUP_TITLE" => $lang['Group_administration'], - "L_GROUP_EDIT_DELETE" => ( isset($_POST['new']) ) ? $lang['New_group'] : $lang['Edit_group'], - "L_GROUP_NAME" => $lang['group_name'], - "L_GROUP_DESCRIPTION" => $lang['group_description'], - "L_GROUP_MODERATOR" => $lang['group_moderator'], - "L_FIND_USERNAME" => $lang['Find_username'], - "L_GROUP_STATUS" => $lang['group_status'], - "L_GROUP_OPEN" => $lang['group_open'], - "L_GROUP_CLOSED" => $lang['group_closed'], - "L_GROUP_HIDDEN" => $lang['group_hidden'], - "L_GROUP_DELETE" => $lang['group_delete'], - "L_GROUP_DELETE_CHECK" => $lang['group_delete_check'], - "L_SUBMIT" => $lang['Submit'], - "L_RESET" => $lang['Reset'], - "L_DELETE_MODERATOR" => $lang['delete_group_moderator'], - "L_DELETE_MODERATOR_EXPLAIN" => $lang['delete_moderator_explain'], - "L_YES" => $lang['Yes'], + "L_GROUP_TITLE" => $user->lang['Group_administration'], + "L_GROUP_EDIT_DELETE" => ( isset($_POST['new']) ) ? $user->lang['New_group'] : $user->lang['Edit_group'], + "L_GROUP_NAME" => $user->lang['group_name'], + "L_GROUP_DESCRIPTION" => $user->lang['group_description'], + "L_GROUP_MODERATOR" => $user->lang['group_moderator'], + "L_FIND_USERNAME" => $user->lang['Find_username'], + "L_GROUP_STATUS" => $user->lang['group_status'], + "L_GROUP_OPEN" => $user->lang['group_open'], + "L_GROUP_CLOSED" => $user->lang['group_closed'], + "L_GROUP_HIDDEN" => $user->lang['group_hidden'], + "L_GROUP_DELETE" => $user->lang['group_delete'], + "L_GROUP_DELETE_CHECK" => $user->lang['group_delete_check'], + "L_SUBMIT" => $user->lang['Submit'], + "L_RESET" => $user->lang['Reset'], + "L_DELETE_MODERATOR" => $user->lang['delete_group_moderator'], + "L_DELETE_MODERATOR_EXPLAIN" => $user->lang['delete_moderator_explain'], + "L_YES" => $user->lang['Yes'], "U_SEARCH_USER" => append_sid("../search.$phpEx?mode=searchuser"), @@ -212,7 +212,7 @@ else if( isset($_POST['group_update']) ) message_die(GENERAL_ERROR, "Couldn't update auth_access", "", __LINE__, __FILE__, $sql); } - $message = $lang['Deleted_group'] . "

" . sprintf($lang['Click_return_groupsadmin'], "", "") . "

" . sprintf($lang['Click_return_admin_index'], "", "");; + $message = $user->lang['Deleted_group'] . "

" . sprintf($user->lang['Click_return_groupsadmin'], "", "") . "

" . sprintf($user->lang['Click_return_admin_index'], "", "");; message_die(GENERAL_MESSAGE, $message); } @@ -226,11 +226,11 @@ else if( isset($_POST['group_update']) ) if( $group_name == "" ) { - message_die(GENERAL_MESSAGE, $lang['No_group_name']); + message_die(GENERAL_MESSAGE, $user->lang['No_group_name']); } else if( $group_moderator == "" ) { - message_die(GENERAL_MESSAGE, $lang['No_group_moderator']); + message_die(GENERAL_MESSAGE, $user->lang['No_group_moderator']); } $this_userdata = get_userdata($group_moderator); @@ -238,7 +238,7 @@ else if( isset($_POST['group_update']) ) if( !$group_moderator ) { - message_die(GENERAL_MESSAGE, $lang['No_group_moderator']); + message_die(GENERAL_MESSAGE, $user->lang['No_group_moderator']); } if( $mode == "editgroup" ) @@ -253,7 +253,7 @@ else if( isset($_POST['group_update']) ) } if( !$db->sql_numrows($result) ) { - message_die(GENERAL_MESSAGE, $lang['Group_not_exist']); + message_die(GENERAL_MESSAGE, $user->lang['Group_not_exist']); } $group_info = $db->sql_fetchrow($result); @@ -284,7 +284,7 @@ else if( isset($_POST['group_update']) ) message_die(GENERAL_ERROR, "Couldn't update group", "", __LINE__, __FILE__, $sql); } - $message = $lang['Updated_group'] . "

" . sprintf($lang['Click_return_groupsadmin'], "", "") . "

" . sprintf($lang['Click_return_admin_index'], "", "");; + $message = $user->lang['Updated_group'] . "

" . sprintf($user->lang['Click_return_groupsadmin'], "", "") . "

" . sprintf($user->lang['Click_return_admin_index'], "", "");; message_die(GENERAL_MESSAGE, $message); } @@ -314,29 +314,29 @@ else if( isset($_POST['group_update']) ) message_die(GENERAL_ERROR, "Couldn't insert new user-group info", "", __LINE__, __FILE__, $sql); } - $message = $lang['Added_new_group'] . "

" . sprintf($lang['Click_return_groupsadmin'], "", "") . "

" . sprintf($lang['Click_return_admin_index'], "", "");; + $message = $user->lang['Added_new_group'] . "

" . sprintf($user->lang['Click_return_groupsadmin'], "", "") . "

" . sprintf($user->lang['Click_return_admin_index'], "", "");; message_die(GENERAL_MESSAGE, $message); } else { - message_die(GENERAL_MESSAGE, $lang['Group_mode_not_selected']); + message_die(GENERAL_MESSAGE, $user->lang['Group_mode_not_selected']); } } } -page_header($lang['Manage']); +page_header($user->lang['Manage']); ?> -

+

lang['Manage']; ?>

-

+

lang['Group_manage_explain']; ?>

"> - + lang[$group_ary['group_name']]) ) ? $user->lang[$group_ary['group_name']] : $group_ary['group_name']; ?> - - + + - - + + acl_get('a_auth') ) { - message_die(MESSAGE, $lang['No_admin']); + message_die(MESSAGE, $user->lang['No_admin']); } // Define some vars @@ -71,77 +70,55 @@ else $mode = ''; } -// // Start program proper -// switch ( $mode ) { case 'forums': - $l_title = $lang['Permissions']; - $l_title_explain = $lang['Permissions_explain']; + $l_title = $user->lang['Permissions']; + $l_title_explain = $user->lang['Permissions_explain']; $l_can = '_can'; break; case 'moderators': - $l_title = $lang['Moderators']; - $l_title_explain = $lang['Moderators_explain']; + $l_title = $user->lang['Moderators']; + $l_title_explain = $user->lang['Moderators_explain']; $l_can = '_can'; break; case 'supermoderators': - $l_title = $lang['Super_Moderators']; - $l_title_explain = $lang['Super_Moderators_explain']; + $l_title = $user->lang['Super_Moderators']; + $l_title_explain = $user->lang['Super_Moderators_explain']; $l_can = '_can'; break; case 'administrators': - $l_title = $lang['Administrators']; - $l_title_explain = $lang['Administrators_explain']; + $l_title = $user->lang['Administrators']; + $l_title_explain = $user->lang['Administrators_explain']; $l_can = '_can_admin'; break; } -// -// Brief explanation of how things work when updating ... -// -// Granting someone any admin permissions grants them permissions -// to all other options, e.g. Moderator and Forums across the board. -// This is done via the acl class -// +// Call update or delete, both can take multiple user/group +// ids. Additionally inheritance is handled (by the auth API) if ( isset($_POST['update']) ) { $auth_admin = new auth_admin(); - switch ( $_POST['type'] ) + // Admin wants subforums to inherit permissions ... so handle this + if ( !empty($_POST['inherit']) ) { - case 'user': - $set = 'acl_set_user'; - break; - - case 'group': - $set = 'acl_set_group'; - break; + array_push($_POST['inherit'], $forum_id); + $forum_id = $_POST['inherit']; } foreach ( $_POST['entries'] as $id ) { - $auth_admin->$set($forum_id, $id, $_POST['option']); + $auth_admin->acl_set($_POST['type'], $forum_id, $id, $_POST['option']); } - message_die(MESSAGE, 'Permissions updated successfully'); + trigger_error('Permissions updated successfully'); } else if ( isset($_POST['delete']) ) { $auth_admin = new auth_admin(); - switch ( $_POST['type'] ) - { - case 'user': - $set = 'acl_delete_user'; - break; - - case 'group': - $set = 'acl_delete_group'; - break; - } - $option_ids = false; if ( !empty($_POST['option']) ) { @@ -164,23 +141,21 @@ else if ( isset($_POST['delete']) ) foreach ( $_POST['entries'] as $id ) { - $auth_admin->$set($forum_id, $id, $option_ids); + $auth_admin->acl_delete($_POST['type'], $forum_id, $id, $option_ids); } - message_die(MESSAGE, 'Permissions updated successfully'); + trigger_error('Permissions updated successfully'); } -// // Get required information, either all forums if // no id was specified or just the requsted if it // was -// if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators' ) { - // +// // Clear some vars, grab some info if relevant ... - // $s_hidden_fields = ''; + if ( !empty($forum_id) ) { $sql = "SELECT forum_name @@ -194,17 +169,13 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators $l_title .= ' : ' . $forum_info['forum_name'] . ''; } - // // Generate header - // page_header($l_title); ?>

-

- sql_fetchrow($result) ) { - $group_list .= ''; + $group_list .= ''; } $db->sql_freeresult($result); @@ -247,10 +218,12 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators ?> +

+
lang['Manage']; ?>
        
- - + + @@ -275,13 +248,13 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators ?> - + - +

lang['Users']; ?>

lang['Groups']; ?>

lang['Manage_users']; ?>
   
@@ -300,19 +273,19 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators $groups = ''; while ( $row = $db->sql_fetchrow($result) ) { - $groups .= ''; + $groups .= ''; } $db->sql_freeresult($result); ?> - + lang['Manage_groups']; ?> -   +   @@ -321,25 +294,25 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators
"> - + - +
lang['Add_users']; ?>
    &mode=searchuser&form=2&field=entries', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=650');return false;" />     &mode=searchuser&form=2&field=entries', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=650');return false;" />
"> - + - +
lang['Add_groups']; ?>
   
@@ -403,7 +376,7 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators $auth = array(); while ( $row = $db->sql_fetchrow($result) ) { - $ug_test = ( !empty($lang[$row['name']]) ) ? $lang[$row['name']] : $row['name']; + $ug_test = ( !empty($user->lang[$row['name']]) ) ? $user->lang[$row['name']] : $row['name']; $ug .= ( !strstr($ug, $ug_test) ) ? $ug_test . "\n" : ''; $ug_test = ''; @@ -415,17 +388,80 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators ?> -

+ + +

lang['ACL_explain']; ?>

+ +
"> - - - - - + + + +
          Quick settings:
+ + + + + lang['acl_' . $auth_options[$i]['auth_value']]) ) ? $user->lang['acl_' . $auth_options[$i]['auth_value']] : ucfirst(preg_replace('#.*?_#', '', $auth_options[$i]['auth_value'])); - $permit_type = ( $auth[$auth_options[$i]['auth_value']] == ACL_PERMIT ) ? ' checked="checked"' : ''; $allow_type = ( $auth[$auth_options[$i]['auth_value']] == ACL_ALLOW ) ? ' checked="checked"' : ''; $deny_type = ( $auth[$auth_options[$i]['auth_value']] == ACL_DENY ) ? ' checked="checked"' : ''; - $prevent_type = ( $auth[$auth_options[$i]['auth_value']] == ACL_PREVENT ) ? ' checked="checked"' : ''; + $inherit_type = ( $auth[$auth_options[$i]['auth_value']] == ACL_INHERIT ) ? ' checked="checked"' : ''; ?> - - + - + - + + + + + + + +
 lang['Option']; ?>  lang['Allow']; ?>  lang['Deny']; ?>  lang['Inherit']; ?> 
/> /> /> /> />
lang['Inheritance']; ?>
+ + + + + + + + + + + +
lang['Inheritance_explain']; ?>
lang['Mark_all']; ?> :: lang['Unmark_all']; ?>
  
@@ -484,10 +558,10 @@ else
"> - + - +
lang['Select_a_Forum']; ?>
        
diff --git a/phpBB/admin/admin_prune.php b/phpBB/admin/admin_prune.php index 0281f1a398..fadcf1e0a5 100644 --- a/phpBB/admin/admin_prune.php +++ b/phpBB/admin/admin_prune.php @@ -44,7 +44,7 @@ require($phpbb_root_path . 'includes/functions_admin.'.$phpEx); // Do we have forum admin permissions? if ( !$auth->acl_get('a_forum') ) { - message_die(MESSAGE, $lang['No_admin']); + message_die(MESSAGE, $user->lang['No_admin']); } // @@ -107,11 +107,11 @@ if ( isset($_POST['doprune']) ) } $template->assign_vars(array( - 'L_FORUM_PRUNE' => $lang['Forum_Prune'], - 'L_FORUM' => $lang['Forum'], - 'L_TOPICS_PRUNED' => $lang['Topics_pruned'], - 'L_POSTS_PRUNED' => $lang['Posts_pruned'], - 'L_PRUNE_RESULT' => $lang['Prune_success']) + 'L_FORUM_PRUNE' => $user->lang['Forum_Prune'], + 'L_FORUM' => $user->lang['Forum'], + 'L_TOPICS_PRUNED' => $user->lang['Topics_pruned'], + 'L_POSTS_PRUNED' => $user->lang['Posts_pruned'], + 'L_PRUNE_RESULT' => $user->lang['Prune_success']) ); add_admin_log('log_prune', $log_data); @@ -119,7 +119,7 @@ if ( isset($_POST['doprune']) ) } else { - page_header($lang['Prune']); + page_header($user->lang['Prune']); // // If they haven't selected a forum for pruning yet then @@ -130,7 +130,7 @@ else // // Output a selection table if no forum id has been specified. // - $select_list = ''; + $select_list = ''; $right = 0; $subforum = ''; @@ -153,16 +153,16 @@ else ?> -

+

lang['Prune']; ?>

-

+

lang['Forum_Prune_explain']; ?>

"> - + - +
lang['Select_a_Forum']; ?>
        
@@ -171,30 +171,30 @@ else } else { - $forum_name = ( $forum_id == -1 ) ? $lang['All_Forums'] : $forum_rows[0]['forum_name']; + $forum_name = ( $forum_id == -1 ) ? $user->lang['All_Forums'] : $forum_rows[0]['forum_name']; - $prune_data = $lang['Prune_topics_not_posted'] . " "; - $prune_data .= ' ' . $lang['Days']; + $prune_data = $user->lang['Prune_topics_not_posted'] . " "; + $prune_data .= ' ' . $user->lang['Days']; $s_hidden_fields = ''; ?> -

+

lang['Prune']; ?>

-

+

lang['Forum_Prune_explain']; ?>

-

+

lang['Forum'] . ': ' . $forum_name; ?>

"> - + - +
lang['Forum_Prune']; ?>
diff --git a/phpBB/admin/admin_prune_users.php b/phpBB/admin/admin_prune_users.php index 2dfdedfdfe..7bd0e59160 100644 --- a/phpBB/admin/admin_prune_users.php +++ b/phpBB/admin/admin_prune_users.php @@ -69,7 +69,7 @@ if ( isset($_POST['prune']) ) { $values = array('prune', 'deactivate', 'delete', 'users', 'username', 'email', 'joined_select', 'active_select', 'count_select', 'joined', 'active', 'count', 'deleteposts'); - $l_message = '
' . $lang['Confirm_prune_users'] . '

  '; + $l_message = '' . $user->lang['Confirm_prune_users'] . '

  '; foreach ( $values as $field ) { @@ -78,17 +78,17 @@ if ( isset($_POST['prune']) ) $l_message .= '
'; - page_header($lang['Prune_users']); + page_header($user->lang['Prune_users']); ?> -

+

lang['Prune_users']; ?>

-

+

lang['Prune_users_explain']; ?>

lang['Confirm'], $l_message, false); page_footer(); } @@ -194,14 +194,14 @@ if ( isset($_POST['prune']) ) unset($usernames); } - message_die(MESSAGE, $lang['Success_user_prune']); + message_die(MESSAGE, $user->lang['Success_user_prune']); } } // // // -$find_count = array('lt' => $lang['Less_than'], 'eq' => $lang['Equal_to'], 'gt' => $lang['More_than']); +$find_count = array('lt' => $user->lang['Less_than'], 'eq' => $user->lang['Equal_to'], 'gt' => $user->lang['More_than']); $s_find_count = ''; foreach ( $find_count as $key => $value ) { @@ -209,7 +209,7 @@ foreach ( $find_count as $key => $value ) $s_find_count .= ''; } -$find_time = array('lt' => $lang['Before'], 'gt' => $lang['After']); +$find_time = array('lt' => $user->lang['Before'], 'gt' => $user->lang['After']); $s_find_join_time = ''; foreach ( $find_time as $key => $value ) { @@ -224,48 +224,48 @@ foreach ( $find_time as $key => $value ) // // // -page_header($lang['Prune_users']); +page_header($user->lang['Prune_users']); ?> -

+

lang['Prune_users']; ?>

-

+

lang['Prune_users_explain']; ?>

"> - + - + - + - + - + - + - + - - + + - +
lang['Prune_users']; ?>
: lang['Username']; ?>:
: lang['Email']; ?>:
:
lang['Joined']; ?>:
lang['Joined_explain']; ?>
:
lang['Last_active']; ?>:
lang['Last_active_explain']; ?>
: lang['Posts']; ?>:
:
lang['Prune_users']; ?>:
lang['Select_users_explain']; ?>
:
   lang['Delete_user_posts']; ?>:
lang['Delete_user_posts_explain']; ?>
lang['Yes']; ?>    lang['No']; ?>
    ', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=650');return false;" />    ', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=650');return false;" />
diff --git a/phpBB/admin/admin_ranks.php b/phpBB/admin/admin_ranks.php index eadce13d11..ff3424f9f2 100644 --- a/phpBB/admin/admin_ranks.php +++ b/phpBB/admin/admin_ranks.php @@ -92,7 +92,7 @@ if ( $mode != '' ) { if ( empty($rank_id) ) { - message_die(MESSAGE, $lang['Must_select_rank']); + message_die(MESSAGE, $user->lang['Must_select_rank']); } $sql = "SELECT * FROM " . RANKS_TABLE . " @@ -108,36 +108,36 @@ if ( $mode != '' ) $rank_info['rank_special'] = 0; } - page_header($lang['Ranks']); + page_header($user->lang['Ranks']); ?> -

+

lang['Ranks']; ?>

-

+

lang['Ranks_explain']; ?>

"> - + - + - - + + - + - + - +
lang['Ranks']; ?>
: lang['Rank_title']; ?>:
: />    /> lang['Rank_special']; ?>: />lang['Yes']; ?>    /> lang['No']; ?>
: lang['Rank_minimum']; ?>:
:
lang['Rank_image']; ?>:
lang['Rank_image_explain']; ?>

' : ''; ?>
    
@@ -160,7 +160,7 @@ if ( $mode != '' ) if ( $rank_title == '' ) { - message_die(MESSAGE, $lang['Must_select_rank']); + message_die(MESSAGE, $user->lang['Must_select_rank']); } if ( $special_rank == 1 ) @@ -185,19 +185,19 @@ if ( $mode != '' ) SET rank_title = '" . str_replace("\'", "''", $rank_title) . "', rank_special = $special_rank, rank_min = $min_posts, rank_image = '" . str_replace("\'", "''", $rank_image) . "' WHERE rank_id = $rank_id"; - $message = $lang['Rank_updated']; + $message = $user->lang['Rank_updated']; } else { $sql = "INSERT INTO " . RANKS_TABLE . " (rank_title, rank_special, rank_min, rank_image) VALUES ('" . str_replace("\'", "''", $rank_title) . "', $special_rank, $min_posts, '" . str_replace("\'", "''", $rank_image) . "')"; - $message = $lang['Rank_added']; + $message = $user->lang['Rank_added']; } $db->sql_query($sql); - $message .= '

' . sprintf($lang['Click_return_rankadmin'], '', '') . '

' . sprintf($lang['Click_return_admin_index'], '', ''); + $message .= '

' . sprintf($user->lang['Click_return_rankadmin'], '', '') . '

' . sprintf($user->lang['Click_return_admin_index'], '', ''); message_die(MESSAGE, $message); @@ -228,33 +228,33 @@ if ( $mode != '' ) WHERE user_rank = $rank_id"; $db->sql_query($sql); - $message = $lang['Rank_removed'] . '

' . sprintf($lang['Click_return_rankadmin'], '', '') . '

' . sprintf($lang['Click_return_admin_index'], '', ''); + $message = $user->lang['Rank_removed'] . '

' . sprintf($user->lang['Click_return_rankadmin'], '', '') . '

' . sprintf($user->lang['Click_return_admin_index'], '', ''); message_die(MESSAGE, $message); } else { - message_die(MESSAGE, $lang['Must_select_rank']); + message_die(MESSAGE, $user->lang['Must_select_rank']); } } } -page_header($lang['Ranks']); +page_header($user->lang['Ranks']); ?> -

+

lang['Ranks']; ?>

-

+

lang['Ranks_explain']; ?>

"> - - - - - + + + + + sql_fetchrow($result) ) - - - + + + sql_fetchrow($result) ) ?> - +
lang['Rank_title']; ?>lang['Rank_minimum']; ?>lang['Rank_special']; ?>lang['Edit']; ?>lang['Delete']; ?>
">">lang['Yes'] : $user->lang['No']; ?>">lang['Edit']; ?>">lang['Delete']; ?>
diff --git a/phpBB/admin/admin_search.php b/phpBB/admin/admin_search.php index 452f36a053..5fdc2b8a5e 100644 --- a/phpBB/admin/admin_search.php +++ b/phpBB/admin/admin_search.php @@ -46,7 +46,7 @@ include($phpbb_root_path . 'includes/functions_posting.'.$phpEx); // if ( !$auth->acl_get('a_general') ) { - message_die(MESSAGE, $lang['No_admin']); + message_die(MESSAGE, $user->lang['No_admin']); } // @@ -295,13 +295,13 @@ if ( isset($_POST['start']) || isset($_GET['batchstart']) ) WHERE config_name = 'board_disable'"; $db->sql_query($sql); - page_header($lang['Search_indexing']); + page_header($user->lang['Search_indexing']); ?> -

+

lang['Search_indexing']; ?>

-

+

lang['Search_indexing_complete']; ?>

sql_query($sql); - page_header($lang['Search_indexing']); + page_header($user->lang['Search_indexing']); ?> -

+

lang['Search_indexing']; ?>

-

+

lang['Search_indexing_cancel']; ?>

lang['Search_indexing']); ?> -

+

lang['Search_indexing']; ?>

-

+

lang['Search_indexing_explain']; ?>

"> - +
          
diff --git a/phpBB/admin/admin_smilies.php b/phpBB/admin/admin_smilies.php index aacbb5dbcc..09f0f3fdde 100644 --- a/phpBB/admin/admin_smilies.php +++ b/phpBB/admin/admin_smilies.php @@ -45,7 +45,7 @@ require('pagestart.' . $phpEx); // if (!$auth->acl_get('a_general')) { - message_die(MESSAGE, $lang['No_admin']); + message_die(MESSAGE, $user->lang['No_admin']); } // @@ -173,13 +173,13 @@ if (isset($_POST['import_pak'])) } } - message_die(MESSAGE, $lang['Smilies_import_success']); + message_die(MESSAGE, $user->lang['Smilies_import_success']); } else { if (!count($smilies_paks)) { - $smilies_paks_select = $lang['No_smilies_pak']; + $smilies_paks_select = $user->lang['No_smilies_pak']; } else { @@ -192,33 +192,33 @@ if (isset($_POST['import_pak'])) $smilies_paks_select .= ''; } - page_header($lang['Import_smilies']); + page_header($user->lang['Import_smilies']); ?> -

+

lang['Import_smilies'] ?>

-

+

lang['Import_smilies_explain'] ?>

- + - + - + -
lang['Smilies_import'] ?>
lang['Select_package'] ?>
lang['Delete_existing_smilies'] ?>

+
lang['Smilies_conflicts'] ?>
-    
-    
+   lang['Replace_existing_smilies'] ?> 
+   lang['Keep_existing_smilies'] ?> 
- +
', '')); + page_header($user->lang['Export_smilies']); + message_die(MESSAGE, sprintf($user->lang['Export_smilies_explain'], '', '')); } elseif (isset($_POST['add'])) { @@ -265,9 +265,9 @@ elseif (isset($_POST['add'])) $filename_list .= ''; } - page_header($lang['Add_smile']); + page_header($user->lang['Add_smile']); ?> -

+

lang['Add_smile'] ?>

-

+

lang['Welcome_phpBB']; ?>

-

+

lang['Admin_intro']; ?>

-

+

lang['Forum_stats']; ?>

- - - - + + + + - + - + - + - + - + - + - + - + - + - - + +
lang['Statistic']; ?>lang['Value']; ?>lang['Statistic']; ?>lang['Value']; ?>
:lang['Number_posts']; ?>: :lang['Posts_per_day']; ?>:
:lang['Number_topics']; ?>: :lang['Topics_per_day']; ?>:
:lang['Number_users']; ?>: :lang['Users_per_day']; ?>:
:lang['Board_started']; ?>: :lang['Avatar_dir_size']; ?>:
:lang['Database_size']; ?>: :lang['Gzip_compression']; ?>:lang['ON'] : $user->lang['OFF']; ?>
-

+

lang['Admin_log']; ?>

-

+

lang['Admin_log_index_explain']; ?>

- - - - + + + +
lang['Username']; ?>lang['IP']; ?>lang['Time']; ?>lang['Action']; ?>
-

+

lang['Inactive_users']; ?>

-

+

lang['Inactive_users_explain']; ?>

"> - - - + + + - + - +
lang['Username']; ?>lang['Joined']; ?>lang['Mark']; ?>
lang['No_inactive_users']; ?>
:: lang['Mark_all']; ?> :: lang['Unmark_all']; ?>
@@ -481,12 +475,12 @@ else // header("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - header("Content-type: text/html; charset=" . $lang['ENCODING']); + header("Content-type: text/html; charset=" . $user->lang['ENCODING']); ?> -<?php echo $lang['Admin_title']; ?> +<?php echo $user->lang['Admin_title']; ?> @@ -499,7 +493,7 @@ else <body bgcolor="white" text="#000000"> - <p><?php echo $lang['No_frames']; ?></p> + <p><?php echo $user->lang['No_frames']; ?></p> </body> diff --git a/phpBB/admin/pagestart.php b/phpBB/admin/pagestart.php index b640029279..f08aaff80a 100644 --- a/phpBB/admin/pagestart.php +++ b/phpBB/admin/pagestart.php @@ -27,24 +27,20 @@ if ( !defined('IN_PHPBB') ) define('IN_ADMIN', true); include($phpbb_root_path . 'common.'.$phpEx); -// // Start session management -// -$userdata = $session->start($update); -$auth->acl($userdata, false, 'a_'); -$user = new user($userdata); -// +$user->start($update); +$user->setup(); +$auth->acl($user->data); // End session management -// // // If session_ids do not match, rewrite the URL correctly then redirect the user // -if ($_REQUEST['sid'] != $userdata['session_id']) +if ($_REQUEST['sid'] != $user->data['session_id']) { $url = preg_replace('/sid=([^&]*)(&?)/i', '', $_SERVER['REQUEST_URI']); $url = preg_replace('/\?$/', '', $url); - $url .= ((strpos($url, '?')) ? '&' : '?') . 'sid=' . $userdata['session_id']; + $url .= ((strpos($url, '?')) ? '&' : '?') . 'sid=' . $user->data['session_id']; redirect($url); } @@ -52,7 +48,7 @@ if ($_REQUEST['sid'] != $userdata['session_id']) // Functions function page_header($sub_title, $meta = '', $table_html = true) { - global $board_config, $db, $lang, $phpEx; + global $board_config, $db, $user, $phpEx; define('HEADER_INC', true); @@ -65,13 +61,13 @@ function page_header($sub_title, $meta = '', $table_html = true) } } - header("Content-type: text/html; charset=" . $lang['ENCODING']); + header("Content-type: text/html; charset=" . $user->lang['ENCODING']); ?> - + sql_close(); @@ -146,7 +142,7 @@ function page_footer($copyright_html = true) function page_message($title, $message, $show_header = false) { - global $phpEx, $SID, $lang; + global $phpEx, $SID, $user; if ( $show_header ) { @@ -156,7 +152,7 @@ function page_message($title, $message, $show_header = false) - +
phpBB Logo      lang['Admin_title']; ?>      
@@ -185,7 +181,7 @@ function page_message($title, $message, $show_header = false) function add_admin_log() { - global $db, $userdata, $user_ip; + global $db, $user; $arguments = func_get_args(); @@ -193,7 +189,7 @@ function add_admin_log() $data = ( !sizeof($arguments) ) ? '' : addslashes(serialize($arguments)); $sql = "INSERT INTO " . LOG_ADMIN_TABLE . " (user_id, log_ip, log_time, log_operation, log_data) - VALUES (" . $userdata['user_id'] . ", '$user_ip', " . time() . ", '$action', '$data')"; + VALUES (" . $user->data['user_id'] . ", '$user->ip', " . time() . ", '$action', '$data')"; $db->sql_query($sql); return; @@ -201,7 +197,7 @@ function add_admin_log() function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC') { - global $db, $lang, $phpEx, $SID; + global $db, $user, $phpEx, $SID; $table_sql = ( $mode == 'admin' ) ? LOG_ADMIN_TABLE : LOG_MOD_TABLE; $forum_sql = ( $mode == 'mod' && $forum_id ) ? "AND l.forum_id = $forum_id" : ''; @@ -227,7 +223,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id $log[$i]['ip'] = $row['log_ip']; $log[$i]['time'] = $row['log_time']; - $log[$i]['action'] = ( !empty($lang[$row['log_operation']]) ) ? $lang[$row['log_operation']] : ucfirst(str_replace('_', ' ', $row['log_operation'])); + $log[$i]['action'] = ( !empty($user->lang[$row['log_operation']]) ) ? $user->lang[$row['log_operation']] : ucfirst(str_replace('_', ' ', $row['log_operation'])); if ( !empty($row['log_data']) ) { diff --git a/phpBB/common.php b/phpBB/common.php index fe1ff62a12..2e527dcb87 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -28,6 +28,14 @@ error_reporting(E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitia //error_reporting(E_ALL); set_magic_quotes_runtime(0); +// If magic quotes is off, addslashes +if ( !get_magic_quotes_gpc() ) +{ + $_GET = slash_input_data($_GET); + $_POST = slash_input_data($_POST); + $_COOKIE = slash_input_data($_COOKIE); +} + require($phpbb_root_path . 'config.'.$phpEx); if ( !defined('PHPBB_INSTALLED') ) @@ -36,12 +44,17 @@ if ( !defined('PHPBB_INSTALLED') ) exit; } -//set_error_handler('message'); +// Set PHP error handler to ours +set_error_handler('msg_handler'); // Define some constants/variables -define('ANONYMOUS', 0); +$board_config = array(); +$theme = array(); +$lang = array(); // User related +define('ANONYMOUS', 0); + define('USER_ACTIVATION_NONE', 0); define('USER_ACTIVATION_SELF', 1); define('USER_ACTIVATION_ADMIN', 2); @@ -53,10 +66,9 @@ define('USER_AVATAR_REMOTE', 2); define('USER_AVATAR_GALLERY', 3); // ACL -define('ACL_PREVENT', 1); -define('ACL_DENY', 2); -define('ACL_ALLOW', 4); -define('ACL_PERMIT', 8); +define('ACL_DENY', 0); +define('ACL_ALLOW', 1); +define('ACL_INHERIT', 2); // Group settings define('GROUP_OPEN', 0); @@ -123,51 +135,20 @@ define('VOTE_DESC_TABLE', $table_prefix.'vote_desc'); define('VOTE_RESULTS_TABLE', $table_prefix.'vote_results'); define('VOTE_USERS_TABLE', $table_prefix.'vote_voters'); -// If magic quotes is off, addslashes -if ( !get_magic_quotes_gpc() ) -{ - $HTTP_GET_VARS = slash_input_data($HTTP_GET_VARS); - $HTTP_POST_VARS = slash_input_data($HTTP_POST_VARS); - $HTTP_COOKIE_VARS = slash_input_data($HTTP_COOKIE_VARS); -} - -$board_config = array(); -$userdata = array(); -$theme = array(); -$images = array(); -$lang = array(); - // Include files require($phpbb_root_path . 'includes/template.'.$phpEx); require($phpbb_root_path . 'includes/session.'.$phpEx); require($phpbb_root_path . 'includes/functions.'.$phpEx); require($phpbb_root_path . 'db/' . $dbms . '.'.$phpEx); +require($phpbb_root_path . 'config_cache.'.$phpEx); // Instantiate some basic classes -$session = new session(); +$user = new user(); $auth = new auth(); $template = new Template(); $db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false); -// Obtain users IP -if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) || !empty($_ENV['HTTP_X_FORWARDED_FOR'])) -{ - $user_ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ? $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR ); - $x_ip = ( !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_ENV['HTTP_X_FORWARDED_FOR']; - - if ( preg_match('/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $x_ip, $ip_list) ) - { - $private_ip = array('/^0\./', '/^127\.0\.0\.1/', '/^192\.168\..*/', '/^172\.16\..*/', '/^10\..*/', '/^224\..*/', '/^240\..*/'); - $user_ip = preg_replace($private_ip, $client_ip, $ip_list[1]); - } -} -else -{ - $user_ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ? $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR ); -} - -// Setup forum wide options, if this fails we output a CRITICAL_ERROR since -// basic forum information is not available +// Obtain boardwide default config $sql = "SELECT * FROM " . CONFIG_TABLE; $result = $db->sql_query($sql, false); diff --git a/phpBB/config.php b/phpBB/config.php index e69de29bb2..e443e887ae 100644 --- a/phpBB/config.php +++ b/phpBB/config.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/phpBB/db/mysql.php b/phpBB/db/mysql.php index d2f7dc70ea..22c544054e 100644 --- a/phpBB/db/mysql.php +++ b/phpBB/db/mysql.php @@ -44,7 +44,7 @@ class sql_db $this->persistency = $persistency; $this->user = $sqluser; $this->password = $sqlpassword; - $this->server = $sqlserver . ( ( $port ) ? ':' . $port : '' ); + $this->server = $sqlserver . ( ( $port ) ? ':' . $port : '' ); $this->dbname = $database; $this->db_connect_id = ( $this->persistency ) ? @mysql_pconnect($this->server, $this->user, $this->password) : @mysql_connect($this->server, $this->user, $this->password); @@ -117,7 +117,7 @@ class sql_db // // Base query method // - function sql_query($query = '', $transaction = false) + function sql_query($query = '') { if ($query != '') { @@ -181,10 +181,10 @@ class sql_db return false; } - return ( $this->query_result) ? $this->query_result : ( ( $transaction == END_TRANSACTION ) ? true : false ); + return ( $this->query_result) ? $this->query_result : fals; } - function sql_query_limit($query = '', $total, $offset = 0, $transaction = false) + function sql_query_limit($query = '', $total, $offset = 0) { if ( $query != '' ) { @@ -205,7 +205,7 @@ class sql_db } // Idea for this from Ikonboard - function sql_query_array($query = '', $assoc_ary = false, $transaction = false) + function sql_query_array($query = '', $assoc_ary = false) { if (!is_array($assoc_ary)) { @@ -392,8 +392,8 @@ class sql_db $this_page = ( !empty($_SERVER['PHP_SELF']) ) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; $this_page .= '&' . ( ( !empty($_SERVER['QUERY_STRING']) ) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING'] ); - $message = 'SQL ERROR [ ' . SQL_LAYER . ' ]

' . @mysql_error() . '

PAGE

' . $this_page . ( ( $sql != '' ) ? '

SQL

' . $sql : '' ) . '
'; - message_die(ERROR, $message); + $message = 'SQL ERROR [ ' . SQL_LAYER . ' ]

' . @mysql_error() . '

CALLING PAGE

' . $this_page . ( ( $sql != '' ) ? '

SQL

' . $sql : '' ) . '
'; + trigger_error($message, E_USER_ERROR); } $result['message'] = @mysql_error(); diff --git a/phpBB/develop/revar_lang_files.php b/phpBB/develop/revar_lang_files.php index b5fbc5631b..628b8b5c58 100644 --- a/phpBB/develop/revar_lang_files.php +++ b/phpBB/develop/revar_lang_files.php @@ -27,7 +27,7 @@ // Remove or comment the next line (die(".... ) to enable this script. // Do NOT FORGET to either remove this script or disable it after you have used it. // -die("Please read the first lines of this script for instructions on how to enable it"); +//die("Please read the first lines of this script for instructions on how to enable it"); $vars = array('lang_main' => 'lang', 'lang_admin' => 'lang', 'lang_faq' => 'faq', 'lang_bbcode' => 'faq'); @@ -36,7 +36,7 @@ $dir = opendir($dirname); while ( $file = readdir($dir) ) { - if ( ereg("^lang_", $file) && !is_file($dirname . "/" . $file) && !is_link($dirname . "/" . $file) ) + if ( $file != 'CVS' && !is_file($dirname . "/" . $file) && !is_link($dirname . "/" . $file) ) { foreach($vars as $lang_file => $lang_var) { diff --git a/phpBB/faq.php b/phpBB/faq.php index 180c0902f5..5c8a649a7f 100644 --- a/phpBB/faq.php +++ b/phpBB/faq.php @@ -25,9 +25,9 @@ include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); // Start session management -$userdata = $session->start(); -$auth->acl($userdata); -$user = new user($userdata); +$user->start(); +$user->setup(); +$auth->acl($user->data); // End session management // Load the appropriate faq file diff --git a/phpBB/groupcp.php b/phpBB/groupcp.php index 38c0193c66..a7d6f03646 100644 --- a/phpBB/groupcp.php +++ b/phpBB/groupcp.php @@ -111,8 +111,9 @@ function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$ // // Start session management // -$userdata = $session->start(); -$auth->acl($userdata); +$user->start(); +$user->setup(); +$auth->acl($user->data); // // End session management // @@ -125,40 +126,39 @@ $server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config $server_url = $server_protocol . $server_name . $server_port . $script_name; -if ( isset($HTTP_GET_VARS[POST_GROUPS_URL]) || isset($HTTP_POST_VARS[POST_GROUPS_URL]) ) +if ( isset($_GET[POST_GROUPS_URL]) || isset($_POST[POST_GROUPS_URL]) ) { - $group_id = ( isset($HTTP_GET_VARS[POST_GROUPS_URL]) ) ? intval($HTTP_GET_VARS[POST_GROUPS_URL]) : intval($HTTP_POST_VARS[POST_GROUPS_URL]); + $group_id = ( isset($_GET[POST_GROUPS_URL]) ) ? intval($_GET[POST_GROUPS_URL]) : intval($_POST[POST_GROUPS_URL]); } else { $group_id = ''; } -if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) ) +if ( isset($_POST['mode']) || isset($_GET['mode']) ) { - $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; + $mode = ( isset($_POST['mode']) ) ? $_POST['mode'] : $_GET['mode']; } else { $mode = ''; } -$confirm = ( isset($HTTP_POST_VARS['confirm']) ) ? TRUE : 0; -$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : 0; +$confirm = ( isset($_POST['confirm']) ) ? TRUE : 0; +$cancel = ( isset($_POST['cancel']) ) ? TRUE : 0; -$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0; +$start = ( isset($_GET['start']) ) ? intval($_GET['start']) : 0; // // Default var values // -$header_location = ( @preg_match('/Microsoft|WebSTAR/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: '; $is_moderator = FALSE; -if ( isset($HTTP_POST_VARS['groupstatus']) && $group_id ) +if ( isset($_POST['groupstatus']) && $group_id ) { - if ( !$userdata['session_logged_in'] ) + if ( !$user->data['session_logged_in'] ) { - header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); + redirect("login.$phpEx$SIDredirect=groupcp.$phpEx&g=$group_id"); } $sql = "SELECT group_moderator @@ -171,7 +171,7 @@ if ( isset($HTTP_POST_VARS['groupstatus']) && $group_id ) $row = $db->sql_fetchrow($result); - if ( $row['group_moderator'] != $userdata['user_id'] && $userdata['user_level'] != ADMIN ) + if ( $row['group_moderator'] != $user->data['user_id'] && $user->data['user_level'] != ADMIN ) { $template->assign_vars(array( 'META' => '') @@ -183,7 +183,7 @@ if ( isset($HTTP_POST_VARS['groupstatus']) && $group_id ) } $sql = "UPDATE " . GROUPS_TABLE . " - SET group_type = " . intval($HTTP_POST_VARS['group_type']) . " + SET group_type = " . intval($_POST['group_type']) . " WHERE group_id = $group_id"; if ( !($result = $db->sql_query($sql)) ) { @@ -199,15 +199,15 @@ if ( isset($HTTP_POST_VARS['groupstatus']) && $group_id ) message_die(MESSAGE, $message); } -else if ( isset($HTTP_POST_VARS['joingroup']) && $group_id ) +else if ( isset($_POST['joingroup']) && $group_id ) { // // First, joining a group // If the user isn't logged in redirect them to login // - if ( !$userdata['session_logged_in'] ) + if ( !$user->data['session_logged_in'] ) { - header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); + redirect("login.$phpEx$SID&redirect=groupcp.$phpEx&g=$group_id"); } $sql = "SELECT ug.user_id, g.group_type @@ -226,7 +226,7 @@ else if ( isset($HTTP_POST_VARS['joingroup']) && $group_id ) { do { - if ( $userdata['user_id'] == $row['user_id'] ) + if ( $user->data['user_id'] == $row['user_id'] ) { $template->assign_vars(array( 'META' => '') @@ -255,7 +255,7 @@ else if ( isset($HTTP_POST_VARS['joingroup']) && $group_id ) } $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) - VALUES ($group_id, " . $userdata['user_id'] . ", 1)"; + VALUES ($group_id, " . $user->data['user_id'] . ", 1)"; if ( !($result = $db->sql_query($sql)) ) { message_die(ERROR, "Error inserting user group subscription", "", __LINE__, __FILE__, $sql); @@ -300,7 +300,7 @@ else if ( isset($HTTP_POST_VARS['joingroup']) && $group_id ) message_die(MESSAGE, $message); } -else if ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending']) && $group_id ) +else if ( isset($_POST['unsub']) || isset($_POST['unsubpending']) && $group_id ) { // // Second, unsubscribing from a group @@ -308,28 +308,28 @@ else if ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending // if ( $cancel ) { - header($header_location . append_sid("groupcp.$phpEx", true)); + redirect("groupcp.$phpEx$SID"); } - elseif ( !$userdata['session_logged_in'] ) + elseif ( !$user->data['session_logged_in'] ) { - header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); + redirect("login.$phpEx$SID&redirect=groupcp.$phpEx&g=$group_id"); } if ( $confirm ) { $sql = "DELETE FROM " . USER_GROUP_TABLE . " - WHERE user_id = " . $userdata['user_id'] . " + WHERE user_id = " . $user->data['user_id'] . " AND group_id = $group_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(ERROR, 'Could not delete group memebership data', '', __LINE__, __FILE__, $sql); } - if ( $userdata['user_level'] != ADMIN && $userdata['user_level'] == MOD ) + if ( $user->data['user_level'] != ADMIN && $user->data['user_level'] == MOD ) { $sql = "SELECT COUNT(auth_mod) AS is_auth_mod FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug - WHERE ug.user_id = " . $userdata['user_id'] . " + WHERE ug.user_id = " . $user->data['user_id'] . " AND aa.group_id = ug.group_id AND aa.auth_mod = 1"; if ( !($result = $db->sql_query($sql)) ) @@ -341,7 +341,7 @@ else if ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending { $sql = "UPDATE " . USERS_TABLE . " SET user_level = " . USER . " - WHERE user_id = " . $userdata['user_id']; + WHERE user_id = " . $user->data['user_id']; if ( !($result = $db->sql_query($sql)) ) { message_die(ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql); @@ -359,7 +359,7 @@ else if ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending } else { - $unsub_msg = ( isset($HTTP_POST_VARS['unsub']) ) ? $lang['Confirm_unsub'] : $lang['Confirm_unsub_pending']; + $unsub_msg = ( isset($_POST['unsub']) ) ? $lang['Confirm_unsub'] : $lang['Confirm_unsub_pending']; $s_hidden_fields = ''; @@ -391,11 +391,11 @@ else if ( $group_id ) // Did the group moderator get here through an email? // If so, check to see if they are logged in. // - if ( isset($HTTP_GET_VARS['validate']) ) + if ( isset($_GET['validate']) ) { - if ( !$userdata['session_logged_in'] ) + if ( !$user->data['user_id'] ) { - header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); + redirect("login.$phpEx$SID&redirect=groupcp.$phpEx&g=$group_id"); } } @@ -444,7 +444,7 @@ else if ( $group_id ) { $group_moderator = $group_info['group_moderator']; - if ( $group_moderator == $userdata['user_id'] || $userdata['user_level'] == ADMIN ) + if ( $group_moderator == $user->data['user_id'] || $user->data['user_level'] == ADMIN ) { $is_moderator = TRUE; } @@ -452,11 +452,11 @@ else if ( $group_id ) // // Handle Additions, removals, approvals and denials // - if ( !empty($HTTP_POST_VARS['add']) || !empty($HTTP_POST_VARS['remove']) || isset($HTTP_POST_VARS['approve']) || isset($HTTP_POST_VARS['deny']) ) + if ( !empty($_POST['add']) || !empty($_POST['remove']) || isset($_POST['approve']) || isset($_POST['deny']) ) { - if ( !$userdata['session_logged_in'] ) + if ( !$user->data['session_logged_in'] ) { - header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); + redirect("login.$phpEx$SIDredirect=groupcp.$phpEx&g=$group_id"); } if ( !$is_moderator ) @@ -470,9 +470,9 @@ else if ( $group_id ) message_die(MESSAGE, $message); } - if ( isset($HTTP_POST_VARS['add']) ) + if ( isset($_POST['add']) ) { - $username = ( isset($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : ""; + $username = ( isset($_POST['username']) ) ? $_POST['username'] : ""; $sql = "SELECT user_id, user_email, user_lang, user_level FROM " . USERS_TABLE . " @@ -583,10 +583,10 @@ else if ( $group_id ) } else { - if ( ( ( isset($HTTP_POST_VARS['approve']) || isset($HTTP_POST_VARS['deny']) ) && isset($HTTP_POST_VARS['pending_members']) ) || ( isset($HTTP_POST_VARS['remove']) && isset($HTTP_POST_VARS['members']) ) ) + if ( ( ( isset($_POST['approve']) || isset($_POST['deny']) ) && isset($_POST['pending_members']) ) || ( isset($_POST['remove']) && isset($_POST['members']) ) ) { - $members = ( isset($HTTP_POST_VARS['approve']) || isset($HTTP_POST_VARS['deny']) ) ? $HTTP_POST_VARS['pending_members'] : $HTTP_POST_VARS['members']; + $members = ( isset($_POST['approve']) || isset($_POST['deny']) ) ? $_POST['pending_members'] : $_POST['members']; $sql_in = ''; for($i = 0; $i < count($members); $i++) @@ -594,7 +594,7 @@ else if ( $group_id ) $sql_in .= ( ( $sql_in != '' ) ? ', ' : '' ) . $members[$i]; } - if ( isset($HTTP_POST_VARS['approve']) ) + if ( isset($_POST['approve']) ) { if ( $group_info['auth_mod'] ) { @@ -616,7 +616,7 @@ else if ( $group_id ) FROM ". USERS_TABLE . " WHERE user_id IN ($sql_in)"; } - else if ( isset($HTTP_POST_VARS['deny']) || isset($HTTP_POST_VARS['remove']) ) + else if ( isset($_POST['deny']) || isset($_POST['remove']) ) { if ( $group_info['auth_mod'] ) { @@ -678,7 +678,7 @@ else if ( $group_id ) // // Email users when they are approved // - if ( isset($HTTP_POST_VARS['approve']) ) + if ( isset($_POST['approve']) ) { if ( !($result = $db->sql_query($sql_select)) ) { @@ -711,7 +711,7 @@ else if ( $group_id ) $email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\nBcc: " . $email_addresses . "\r\n"; $emailer->use_template('group_approved'); - $emailer->email_address($userdata['user_email']); + $emailer->email_address($user->data['user_email']); $emailer->set_subject();//$lang['Group_approved'] $emailer->extra_headers($email_headers); @@ -807,7 +807,7 @@ else if ( $group_id ) { for($i = 0; $i < $members_count; $i++) { - if ( $group_members[$i]['user_id'] == $userdata['user_id'] && $userdata['session_logged_in'] ) + if ( $group_members[$i]['user_id'] == $user->data['user_id'] && $user->data['session_logged_in'] ) { $is_group_member = TRUE; } @@ -819,19 +819,19 @@ else if ( $group_id ) { for($i = 0; $i < $modgroup_pending_count; $i++) { - if ( $modgroup_pending_list[$i]['user_id'] == $userdata['user_id'] && $userdata['session_logged_in'] ) + if ( $modgroup_pending_list[$i]['user_id'] == $user->data['user_id'] && $user->data['session_logged_in'] ) { $is_group_pending_member = TRUE; } } } - if ( $userdata['user_level'] == ADMIN ) + if ( $user->data['user_level'] == ADMIN ) { $is_moderator = TRUE; } - if ( $userdata['user_id'] == $group_info['group_moderator'] ) + if ( $user->data['user_id'] == $group_info['group_moderator'] ) { $is_moderator = TRUE; @@ -847,7 +847,7 @@ else if ( $group_id ) $s_hidden_fields = ''; } - else if ( $userdata['user_id'] == ANONYMOUS ) + else if ( $user->data['user_id'] == ANONYMOUS ) { $group_details = $lang['Login_to_join']; $s_hidden_fields = ''; @@ -1143,11 +1143,11 @@ else // Select all group that the user is a member of or where the user has // a pending membership. // - if ( $userdata['session_logged_in'] ) + if ( $user->data['session_logged_in'] ) { $sql = "SELECT g.group_id, g.group_name, g.group_type, ug.user_pending FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug - WHERE ug.user_id = " . $userdata['user_id'] . " + WHERE ug.user_id = " . $user->data['user_id'] . " AND ug.group_id = g.group_id AND g.group_single_user <> " . TRUE . " ORDER BY g.group_name, ug.user_id"; @@ -1198,7 +1198,7 @@ else $s_group_list_opt = ''; while( $row = $db->sql_fetchrow($result) ) { - if ( $row['group_type'] != GROUP_HIDDEN || $userdata['user_level'] == ADMIN ) + if ( $row['group_type'] != GROUP_HIDDEN || $user->data['user_level'] == ADMIN ) { $s_group_list_opt .=''; } @@ -1237,7 +1237,7 @@ else $template->assign_block_vars('switch_groups_remaining', array() ); } - $s_hidden_fields = ''; + $s_hidden_fields = ''; $template->assign_vars(array( 'L_GROUP_MEMBERSHIP_DETAILS' => $lang['Group_member_details'], diff --git a/phpBB/includes/auth/auth_apache.php b/phpBB/includes/auth/auth_apache.php index 4226c4ca53..88d5be4f4f 100644 --- a/phpBB/includes/auth/auth_apache.php +++ b/phpBB/includes/auth/auth_apache.php @@ -2,7 +2,7 @@ // // Authentication plug-ins is largely down to -// Sergey Kanareykin, our thanks to him. +// Sergey Kanareykin, our thanks to him. // function login_apache(&$username, &$password) { @@ -13,7 +13,7 @@ function login_apache(&$username, &$password) if ( $php_auth_user && $php_auth_pw ) { - $sql = "SELECT user_id, username, user_password, user_email, user_active + $sql = "SELECT user_id, username, user_password, user_email, user_active FROM " . USERS_TABLE . " WHERE username = '" . str_replace("\'", "''", $username) . "'"; $result = $db->sql_query($sql); diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php index 0c9d0adf3e..6fad9eb986 100644 --- a/phpBB/includes/auth/auth_db.php +++ b/phpBB/includes/auth/auth_db.php @@ -2,13 +2,13 @@ // // Authentication plug-ins is largely down to -// Sergey Kanareykin, our thanks to him. +// Sergey Kanareykin, our thanks to him. // function login_db(&$username, &$password) { global $db, $board_config; - $sql = "SELECT user_id, username, user_password, user_email, user_active + $sql = "SELECT user_id, username, user_password, user_email, user_active FROM " . USERS_TABLE . " WHERE username = '" . str_replace("\'", "''", $username) . "'"; $result = $db->sql_query($sql); diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php index d715dc837e..79af7a23e6 100644 --- a/phpBB/includes/auth/auth_ldap.php +++ b/phpBB/includes/auth/auth_ldap.php @@ -47,19 +47,19 @@ function login_ldap(&$username, &$password) // function admin_ldap(&$new) { - global $lang; + global $user; ?> - :
+ lang['LDAP_server']; ?>:
lang['LDAP_server_explain']; ?> - :
+ lang['LDAP_dn']; ?>:
lang['LDAP_dn_explain']; ?> - :
+ lang['LDAP_uid']; ?>:
lang['LDAP_uid_explain']; ?> $userdata['user_lastvisit']) + if ($user->data['user_id'] && $forum_last_post_time > $user->data['user_lastvisit']) { $unread_topics = true; - if (isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'])) - { - if ($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $forum_last_post_time) - { - $unread_topics = false; - } - } - - if (isset($mark_topics[$forum_id]) || isset($mark_forums[$forum_id])) - { - if ($mark_forums[$forum_id] > $userdata['user_lastvisit'] || !max($mark_topics[$forum_id])) - { - $unread_topics = false; - } - } } - $folder_image = ($unread_topics) ? $theme['forum_new'] : $theme['forum']; - $folder_alt = ($unread_topics) ? $lang['New_posts'] : $lang['No_new_posts']; + $folder_image = ($unread_topics) ? 'forum_new' : 'forum'; + $folder_alt = ($unread_topics) ? 'New_posts' : 'No_new_posts'; } if ($forum_last_post_id) { - $last_post = create_date($board_config['default_dateformat'], $forum_last_post_time, $board_config['board_timezone']) . '
'; + $last_post = $user->format_date($forum_last_post_time) . '
'; - $last_post .= ($forum_last_poster_id == ANONYMOUS) ? (($forum_last_poster_name != '') ? $forum_last_poster_name . ' ' : $lang['Guest'] . ' ') : '' . $username . ' '; + $last_post .= ($forum_last_poster_id == ANONYMOUS) ? (($forum_last_poster_name != '') ? $forum_last_poster_name . ' ' : $user->lang['Guest'] . ' ') : '' . $username . ' '; - $last_post .= '' . create_img($theme['goto_post_latest'], $lang['View_latest_post']) . ''; + $last_post .= '' . $user->img('goto_post_latest', 'View_latest_post') . ''; } else { - $last_post = $lang['No_Posts']; + $last_post = $user->lang['No_Posts']; } if (!empty($forum_moderators[$forum_id])) { - $l_moderator = (count($forum_moderators[$forum_id]) == 1) ? $lang['Moderator'] . ': ' : $lang['Moderators'] . ': ' ; + $l_moderator = (count($forum_moderators[$forum_id]) == 1) ? $user->lang['Moderator'] . ': ' : $user->lang['Moderators'] . ': ' ; $moderators_list = implode(', ', $forum_moderators[$forum_id]); } else @@ -127,7 +112,7 @@ foreach ($forum_rows as $row) } $subforums_list = implode(', ', $links); - $l_subforums = (count($subforums[$forum_id]) == 1) ? $lang['Subforum'] . ': ' : $lang['Subforums'] . ': '; + $l_subforums = (count($subforums[$forum_id]) == 1) ? $user->lang['Subforum'] . ': ' : $user->lang['Subforums'] . ': '; } else { @@ -157,7 +142,7 @@ foreach ($forum_rows as $row) $template->assign_block_vars('forumrow', array( $forum_type_switch => TRUE, - 'FORUM_FOLDER_IMG' => create_img($folder_image, $folder_alt), + 'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt), 'FORUM_NAME' => $forum_name, 'FORUM_DESC' => $forum_desc, diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 07002056ed..06e901842d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -103,14 +103,16 @@ function get_forum_branch($forum_id, $type='all', $order='descending', $include_ default: $condition = 'f2.left_id BETWEEN f1.left_id AND f1.right_id OR f1.left_id BETWEEN f2.left_id AND f2.right_id'; } - $sql = 'SELECT f2.* - FROM ' . FORUMS_TABLE . ' f1 - LEFT JOIN ' . FORUMS_TABLE . " f2 ON $condition - WHERE f1.forum_id = $forum_id - ORDER BY f2.left_id " . (($order == 'descending') ? 'ASC' : 'DESC'); $rows = array(); + + $sql = 'SELECT f2.* + FROM ( ' . FORUMS_TABLE . ' f1 + LEFT JOIN ' . FORUMS_TABLE . " f2 ON $condition ) + WHERE f1.forum_id = $forum_id + ORDER BY f2.left_id " . ( ($order == 'descending') ? 'ASC' : 'DESC' ); $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { if (!$include_forum && $row['forum_id'] == $forum_id) @@ -122,10 +124,8 @@ function get_forum_branch($forum_id, $type='all', $order='descending', $include_ return $rows; } -// // Obtain list of moderators of each forum // First users, then groups ... broken into two queries -// function get_moderators(&$forum_moderators, $forum_id = false) { global $SID, $db, $phpEx; @@ -166,17 +166,17 @@ function get_moderators(&$forum_moderators, $forum_id = false) // function get_forum_rules($mode, &$rules, &$forum_id) { - global $SID, $auth, $lang, $phpEx; + global $SID, $auth, $user, $phpEx; - $rules .= ( ( $auth->acl_get('f_post', $forum_id) ) ? $lang['Rules_post_can'] : $lang['Rules_post_cannot'] ) . '
'; - $rules .= ( ( $auth->acl_get('f_reply', $forum_id) ) ? $lang['Rules_reply_can'] : $lang['Rules_reply_cannot'] ) . '
'; - $rules .= ( ( $auth->acl_get('f_edit', $forum_id) ) ? $lang['Rules_edit_can'] : $lang['Rules_edit_cannot'] ) . '
'; - $rules .= ( ( $auth->acl_get('f_delete', $forum_id) || $auth->acl_get('m_delete', $forum_id) ) ? $lang['Rules_delete_can'] : $lang['Rules_delete_cannot'] ) . '
'; - $rules .= ( ( $auth->acl_get('f_attach', $forum_id) ) ? $lang['Rules_attach_can'] : $lang['Rules_attach_cannot'] ) . '
'; + $rules .= ( ( $auth->acl_get('f_post', $forum_id) ) ? $user->lang['Rules_post_can'] : $user->lang['Rules_post_cannot'] ) . '
'; + $rules .= ( ( $auth->acl_get('f_reply', $forum_id) ) ? $user->lang['Rules_reply_can'] : $user->lang['Rules_reply_cannot'] ) . '
'; + $rules .= ( ( $auth->acl_get('f_edit', $forum_id) ) ? $user->lang['Rules_edit_can'] : $user->lang['Rules_edit_cannot'] ) . '
'; + $rules .= ( ( $auth->acl_get('f_delete', $forum_id) || $auth->acl_get('m_delete', $forum_id) ) ? $user->lang['Rules_delete_can'] : $user->lang['Rules_delete_cannot'] ) . '
'; + $rules .= ( ( $auth->acl_get('f_attach', $forum_id) ) ? $user->lang['Rules_attach_can'] : $user->lang['Rules_attach_cannot'] ) . '
'; if ( $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id) ) { - $rules .= sprintf($lang['Rules_moderate'], '', ''); + $rules .= sprintf($user->lang['Rules_moderate'], '', ''); } return; @@ -184,9 +184,9 @@ function get_forum_rules($mode, &$rules, &$forum_id) function make_jumpbox($action, $forum_id = false) { - global $auth, $template, $lang, $db, $nav_links, $phpEx; + global $auth, $template, $user, $db, $nav_links, $phpEx; - $boxstring = ''; $sql = 'SELECT forum_id, forum_name, forum_status, left_id, right_id FROM ' . FORUMS_TABLE . ' @@ -249,9 +249,7 @@ function make_jumpbox($action, $forum_id = false) $holding = ''; } - // // TODO: do not add empty categories to nav links - // $nav_links['chapter forum'][$row['forum_id']] = array ( 'url' => ($row['forum_status'] == ITEM_CATEGORY) ? "index.$phpEx$SIDc=" : "viewforum.$phpEx$SID&f=" . $row['forum_id'], 'title' => $row['forum_name'] @@ -263,13 +261,13 @@ function make_jumpbox($action, $forum_id = false) if (!$right) { - $boxstring .= ''; + $boxstring .= ''; } $boxstring .= ''; $template->assign_vars(array( - 'L_GO' => $lang['Go'], - 'L_JUMP_TO' => $lang['Jump_to'], + 'L_GO' => $user->lang['Go'], + 'L_JUMP_TO' => $user->lang['Jump_to'], 'S_JUMPBOX_SELECT' => $boxstring, 'S_JUMPBOX_ACTION' => $action) @@ -278,16 +276,14 @@ function make_jumpbox($action, $forum_id = false) return; } -// // Pick a language, any language ... -// function language_select($default, $select_name = "language", $dirname="language") { global $phpEx; $dir = opendir($dirname); - $lang = array(); + $user = array(); while ( $file = readdir($dir) ) { if ( preg_match('#^lang_#', $file) && !is_file($dirname . '/' . $file) && !is_link($dirname . '/' . $file) ) @@ -295,30 +291,28 @@ function language_select($default, $select_name = "language", $dirname="language $filename = trim(str_replace('lang_', '', $file)); $displayname = preg_replace('/^(.*?)_(.*)$/', '\\1 [ \\2 ]', $filename); $displayname = preg_replace('/\[(.*?)_(.*)\]/', '[ \\1 - \\2 ]', $displayname); - $lang[$displayname] = $filename; + $user->lang[$displayname] = $filename; } } closedir($dir); - @asort($lang); - @reset($lang); + @asort($user); + @reset($user); - $lang_select = ''; + foreach ( $user as $displayname => $filename ) { $selected = ( strtolower($default) == strtolower($filename) ) ? ' selected="selected"' : ''; - $lang_select .= ''; + $user_select .= ''; } - $lang_select .= ''; + $user_select .= ''; - return $lang_select; + return $user_select; } -// // Pick a template/theme combo, -// -function style_select($default_style, $select_name = "style", $dirname = "templates") +function style_select($default_style, $select_name = 'style', $dirname = 'templates') { global $db; @@ -339,15 +333,13 @@ function style_select($default_style, $select_name = "style", $dirname = "templa return $style_select; } -// // Pick a timezone -// function tz_select($default, $select_name = 'timezone') { - global $sys_timezone, $lang; + global $sys_timezone, $user; $tz_select = ''; @@ -83,7 +83,7 @@ for($i = 0; $i < count($mode_types_text); $i++) $select_sort_mode .= ''; $select_sort_order = ''; if ( $mode != 'topten' || $board_config['topics_per_page'] < 10 ) @@ -102,22 +102,22 @@ else // $template->assign_vars(array( 'PAGINATION' => $pagination, - 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_members / $board_config['topics_per_page'] )), + 'PAGE_NUMBER' => sprintf($user->lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_members / $board_config['topics_per_page'] )), - 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'], - 'L_EMAIL' => $lang['Email'], - 'L_WEBSITE' => $lang['Website'], - 'L_FROM' => $lang['Location'], - 'L_ORDER' => $lang['Order'], - 'L_SORT' => $lang['Sort'], - 'L_SUBMIT' => $lang['Sort'], - 'L_AIM' => $lang['AIM'], - 'L_YIM' => $lang['YIM'], - 'L_MSNM' => $lang['MSNM'], - 'L_ICQ' => $lang['ICQ'], - 'L_JOINED' => $lang['Joined'], - 'L_POSTS' => $lang['Posts'], - 'L_GOTO_PAGE' => $lang['Goto_page'], + 'L_SELECT_SORT_METHOD' => $user->lang['Select_sort_method'], + 'L_EMAIL' => $user->lang['Email'], + 'L_WEBSITE' => $user->lang['Website'], + 'L_FROM' => $user->lang['Location'], + 'L_ORDER' => $user->lang['Order'], + 'L_SORT' => $user->lang['Sort'], + 'L_SUBMIT' => $user->lang['Sort'], + 'L_AIM' => $user->lang['AIM'], + 'L_YIM' => $user->lang['YIM'], + 'L_MSNM' => $user->lang['MSNM'], + 'L_ICQ' => $user->lang['ICQ'], + 'L_JOINED' => $user->lang['Joined'], + 'L_POSTS' => $user->lang['Posts'], + 'L_GOTO_PAGE' => $user->lang['Goto_page'], 'S_MODE_SELECT' => $select_sort_mode, 'S_ORDER_SELECT' => $select_sort_order, @@ -176,7 +176,7 @@ if ( $row = $db->sql_fetchrow($result) ) $user_id = $row['user_id']; $from = ( !empty($row['user_from']) ) ? $row['user_from'] : ' '; - $joined = $user->format_date($row['user_regdate'], $lang['DATE_FORMAT']); + $joined = $user->format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); $posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0; $poster_avatar = ''; @@ -200,8 +200,8 @@ if ( $row = $db->sql_fetchrow($result) ) { $email_uri = ( $board_config['board_email_form'] ) ? "profile.$phpEx$SID&mode=email&u=" . $user_id : 'mailto:' . $row['user_email']; - $email_img = '' . create_img($theme['icon_email'], $lang['Send_email']) . ''; - $email = '' . $lang['Send_email'] . ''; + $email_img = '' . $user->img('icon_email', $user->lang['Send_email']) . ''; + $email = '' . $user->lang['Send_email'] . ''; } else { @@ -210,21 +210,21 @@ if ( $row = $db->sql_fetchrow($result) ) } $temp_url = "profile.$phpEx$SID&mode=viewprofile&u=$user_id"; - $profile_img = '' . create_img($theme['icon_profile'], $lang['Read_profile']) . ''; - $profile = '' . $lang['Read_profile'] . ''; + $profile_img = '' . $user->img('icon_profile', $user->lang['Read_profile']) . ''; + $profile = '' . $user->lang['Read_profile'] . ''; $temp_url = "privmsg.$phpEx$SID&mode=post&u=$user_id"; - $pm_img = '' . create_img($theme['icon_pm'], $lang['Send_private_message']) . ''; - $pm = '' . $lang['Send_private_message'] . ''; + $pm_img = '' . $user->img('icon_pm', $user->lang['Send_private_message']) . ''; + $pm = '' . $user->lang['Send_private_message'] . ''; - $www_img = ( $row['user_website'] ) ? '' . create_img($theme['icon_www'], $lang['Visit_website']) . '' : ''; - $www = ( $row['user_website'] ) ? '' . $lang['Visit_website'] . '' : ''; + $www_img = ( $row['user_website'] ) ? '' . $user->img('icon_www', $user->lang['Visit_website']) . '' : ''; + $www = ( $row['user_website'] ) ? '' . $user->lang['Visit_website'] . '' : ''; if ( !empty($row['user_icq']) ) { $icq_status_img = ''; - $icq_img = '' . create_img($theme['icon_icq'], $lang['ICQ']) . ''; - $icq = '' . $lang['ICQ'] . ''; + $icq_img = '' . $user->img('icon_icq', $user->lang['ICQ']) . ''; + $icq = '' . $user->lang['ICQ'] . ''; } else { @@ -233,19 +233,19 @@ if ( $row = $db->sql_fetchrow($result) ) $icq = ''; } - $aim_img = ( $row['user_aim'] ) ? '' . create_img($theme['icon_aim'], $lang['AIM']) . '' : ''; - $aim = ( $row['user_aim'] ) ? '' . $lang['AIM'] . '' : ''; + $aim_img = ( $row['user_aim'] ) ? '' . $user->img('icon_aim', $user->lang['AIM']) . '' : ''; + $aim = ( $row['user_aim'] ) ? '' . $user->lang['AIM'] . '' : ''; $temp_url = "profile.$phpEx$SID&mode=viewprofile&u=$user_id"; - $msn_img = ( $row['user_msnm'] ) ? '' . create_img($theme['icon_msnm'], $lang['MSNM']) . '' : ''; - $msn = ( $row['user_msnm'] ) ? '' . $lang['MSNM'] . '' : ''; + $msn_img = ( $row['user_msnm'] ) ? '' . $user->img('icon_msnm', $user->lang['MSNM']) . '' : ''; + $msn = ( $row['user_msnm'] ) ? '' . $user->lang['MSNM'] . '' : ''; - $yim_img = ( $row['user_yim'] ) ? '' . create_img($theme['icon_yim'], $lang['YIM']) . '' : ''; - $yim = ( $row['user_yim'] ) ? '' . $lang['YIM'] . '' : ''; + $yim_img = ( $row['user_yim'] ) ? '' . $user->img('icon_yim', $user->lang['YIM']) . '' : ''; + $yim = ( $row['user_yim'] ) ? '' . $user->lang['YIM'] . '' : ''; $temp_url = "search.$phpEx$SID&search_author=" . urlencode($username) . "&showresults=posts"; - $search_img = '' . create_img($theme['icon_search'], $lang['Search_user_posts']) . ''; - $search = '' . $lang['Search_user_posts'] . ''; + $search_img = '' . $user->img('icon_search', $user->lang['Search_user_posts']) . ''; + $search = '' . $user->lang['Search_user_posts'] . ''; $template->assign_block_vars('memberrow', array( 'ROW_NUMBER' => $i + ( $start + 1 ), @@ -284,7 +284,7 @@ if ( $row = $db->sql_fetchrow($result) ) while ( $row = $db->sql_fetchrow($result) ); } -$page_title = $lang['Memberlist']; +$page_title = $user->lang['Memberlist']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( @@ -325,7 +325,7 @@ function username_search() // // // - $sort_by_types_text = array($lang['Sort_Username'], $lang['Sort_Email'], $lang['Sort_Post_count'], $lang['Sort_Joined'], $lang['Sort_Last_active']); + $sort_by_types_text = array($user->lang['Sort_Username'], $user->lang['Sort_Email'], $user->lang['Sort_Post_count'], $user->lang['Sort_Joined'], $user->lang['Sort_Last_active']); $s_sort_by = ''; for($i = 0; $i < count($sort_by_types_text); $i++) { @@ -333,7 +333,7 @@ function username_search() $s_sort_by .= ''; } - $sort_order_text = array('a' => $lang['Ascending'], 'd' => $lang['Descending']); + $sort_order_text = array('a' => $user->lang['Ascending'], 'd' => $user->lang['Descending']); $s_sort_order = ''; foreach ( $sort_order_text as $key => $value ) { @@ -341,7 +341,7 @@ function username_search() $s_sort_order .= ''; } - $find_count = array('lt' => $lang['Less_than'], 'eq' => $lang['Equal_to'], 'gt' => $lang['More_than']); + $find_count = array('lt' => $user->lang['Less_than'], 'eq' => $user->lang['Equal_to'], 'gt' => $user->lang['More_than']); $s_find_count = ''; foreach ( $find_count as $key => $value ) { @@ -349,7 +349,7 @@ function username_search() $s_find_count .= ''; } - $find_time = array('lt' => $lang['Before'], 'gt' => $lang['After']); + $find_time = array('lt' => $user->lang['Before'], 'gt' => $user->lang['After']); $s_find_join_time = ''; foreach ( $find_time as $key => $value ) { @@ -395,7 +395,7 @@ function username_search() // // // - $page_title = $lang['Search']; + $page_title = $user->lang['Search']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( @@ -414,26 +414,26 @@ function username_search() 'COUNT' => $count, 'PAGINATION' => $pagination, - 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_users / $board_config['topics_per_page'] )), + 'PAGE_NUMBER' => sprintf($user->lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_users / $board_config['topics_per_page'] )), - 'L_SEARCH_USERNAME' => $lang['Find_username'], - 'L_SEARCH_EXPLAIN' => $lang['Find_username_explain'], - 'L_RESET' => $lang['Reset'], - 'L_EMAIL' => $lang['Email'], - 'L_ICQ_NUMBER' => $lang['ICQ'], - 'L_MESSENGER' => $lang['MSNM'], - 'L_YAHOO' => $lang['YIM'], - 'L_AIM' => $lang['AIM'], - 'L_JOINED' => $lang['Joined'], - 'L_ACTIVE' => $lang['Last_active'], - 'L_POSTS' => $lang['Posts'], - 'L_SORT_BY' => $lang['Sort_by'], - 'L_SORT_ASCENDING' => $lang['Sort_Ascending'], - 'L_SORT_DESCENDING' => $lang['Sort_Descending'], - 'L_SELECT_MARKED' => $lang['Select_marked'], - 'L_MARK' => $lang['Mark'], - 'L_MARK_ALL' => $lang['Mark_all'], - 'L_UNMARK_ALL' => $lang['Unmark_all'], + 'L_SEARCH_USERNAME' => $user->lang['Find_username'], + 'L_SEARCH_EXPLAIN' => $user->lang['Find_username_explain'], + 'L_RESET' => $user->lang['Reset'], + 'L_EMAIL' => $user->lang['Email'], + 'L_ICQ_NUMBER' => $user->lang['ICQ'], + 'L_MESSENGER' => $user->lang['MSNM'], + 'L_YAHOO' => $user->lang['YIM'], + 'L_AIM' => $user->lang['AIM'], + 'L_JOINED' => $user->lang['Joined'], + 'L_ACTIVE' => $user->lang['Last_active'], + 'L_POSTS' => $user->lang['Posts'], + 'L_SORT_BY' => $user->lang['Sort_by'], + 'L_SORT_ASCENDING' => $user->lang['Sort_Ascending'], + 'L_SORT_DESCENDING' => $user->lang['Sort_Descending'], + 'L_SELECT_MARKED' => $user->lang['Select_marked'], + 'L_MARK' => $user->lang['Mark'], + 'L_MARK_ALL' => $user->lang['Mark_all'], + 'L_UNMARK_ALL' => $user->lang['Unmark_all'], 'S_FORM_NAME' => $form, 'S_FIELD_NAME' => $field, @@ -462,13 +462,13 @@ function username_search() $username = $row['username']; $user_id = $row['user_id']; - $joined = $user->format_date($row['user_regdate'], $lang['DATE_FORMAT']); + $joined = $user->format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); $posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0; - $active = ( !$row['user_lastvisit'] ) ? $lang['Never'] : $user->format_date($row['user_lastvisit'], $lang['DATE_FORMAT']); + $active = ( !$row['user_lastvisit'] ) ? $user->lang['Never'] : $user->format_date($row['user_lastvisit'], $user->lang['DATE_FORMAT']); $temp_url = "profile.$phpEx$SID&mode=viewprofile&u=$user_id"; - $profile_img = '' . create_img($theme['icon_profile'], $lang['Read_profile']) . ''; - $profile = '' . $lang['Read_profile'] . ''; + $profile_img = '' . $user->img('icon_profile', $user->lang['Read_profile']) . ''; + $profile = '' . $user->lang['Read_profile'] . ''; $template->assign_block_vars('memberrow', array( 'ROW_NUMBER' => $i + ( $start + 1 ), diff --git a/phpBB/modcp.php b/phpBB/modcp.php index 1ace157609..ac6fe1b2d1 100644 --- a/phpBB/modcp.php +++ b/phpBB/modcp.php @@ -76,15 +76,13 @@ if ( isset($_POST['cancel']) ) $redirect = "index.$phpEx$SID"; } - $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: '; - header($header_location . $redirect); - exit; + redirect($redirect); } // Start session management -$userdata = $session->start(); -$auth->acl($userdata, $forum_id); -$user = new user($userdata); +$user->start(); +$user->setup(); +$auth->acl($user->data); // End session management diff --git a/phpBB/posting.php b/phpBB/posting.php index 9989d57cb9..49de69d185 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -24,49 +24,34 @@ $phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'includes/functions_posting.'.$phpEx); -include($phpbb_root_path . 'includes/bbcode.'.$phpEx); +// Grab all data extract($_GET); extract($_POST); -// Check and impose var types? -$vars = array( - 'intval' => array( - 'forum_id' => 'f', - 'post_id' => 'p', - 'topic_id' => 't', - ) +// Some vars need their names changing and type imposing +$int_vars = array( + 'f' => 'forum_id', + 'p' => 'post_id', + 't' => 'topic_id', ); -foreach ( $vars as $vartype => $varcheck) +foreach ( $int_vars as $in_var => $out_var) { - foreach ( $varcheck as $varname => $varparse ) - { - $$varname = ( isset($_POST[$varparse]) ) ? $vartype($_POST[$varparse]) : ( ( isset($_GET[$varparse]) ) ? $vartype($_GET[$varparse]) : false ); - } + $$out_var = ( isset($$in_var) ) ? intval($$in_var) : false; } -$refresh = $preview || $poll_add || $poll_edit || $poll_delete; - -// ------------------------------------------------ -// NOTE --> No data validation at present! <-- NOTE -// ------------------------------------------------ - // Start session management -$userdata = $session->start(); -$auth->acl($userdata, $f, array('f_post', 'f_edit', 'f_delete', 'f_attach', 'f_poll', 'f_img', 'f_flash', 'f_bbcode', 'f_html', 'f_smilies', 'f_vote', 'f_sticky', 'f_announce')); -$user = new user($userdata); +$user->start(); +$user->setup(); +$auth->acl($user->data); // End session management - -// Was cancel pressed? If so then redirect to the appropriate -// page, no point in continuing with any further checks +// Was cancel pressed? If so then redirect to the appropriate page if ( !empty($cancel) ) { - $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: '; $redirect = ( $p ) ? "viewtopic.$phpEx$SID&p=$p#$p" : ( ( $t ) ? "viewtopic.$phpEx$SID&t=$t" : ( ( $f ) ? "viewforum.$phpEx$SID&f=$f" : "index.$phpEx$SID" ) ); - header($header_location . $redirect); - exit; + redirect($redirect); } @@ -81,12 +66,12 @@ if ( !empty($cancel) ) switch ( $mode ) { case 'topicreview': - require($phpbb_root_path . 'includes/topic_review.'.$phpEx); - topic_review($t, false); +// require($phpbb_root_path . 'includes/topic_review.'.$phpEx); +// topic_review($t, false); break; case 'smilies': - generate_smilies('window', PAGE_POSTING); + generate_smilies('window'); break; } @@ -104,7 +89,7 @@ if ( !$board_config['allow_html'] ) } else { - $html_on = ( $post || $refresh ) ? ( ( !empty($disable_html) ) ? 0 : TRUE ) : ( ( !$userdata['user_id'] ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] ); + $html_on = ( $post || $refresh ) ? ( ( !empty($disable_html) ) ? 0 : TRUE ) : ( ( !$user->data['user_id'] ) ? $board_config['allow_html'] : $user->data['user_allowhtml'] ); } if ( !$board_config['allow_bbcode'] ) @@ -113,7 +98,7 @@ if ( !$board_config['allow_bbcode'] ) } else { - $bbcode_on = ( $post || $refresh ) ? ( ( !empty($disable_bbcode) ) ? 0 : TRUE ) : ( ( !$userdata['user_id'] ) ? $board_config['allow_bbcode'] : $userdata['user_allowbbcode'] ); + $bbcode_on = ( $post || $refresh ) ? ( ( !empty($disable_bbcode) ) ? 0 : TRUE ) : ( ( !$user->data['user_id'] ) ? $board_config['allow_bbcode'] : $user->data['user_allowbbcode'] ); } $magic_urls_on = ( $post || $refresh ) ? ( ( !empty($disable_magic_url) ) ? 0 : TRUE ) : TRUE; @@ -124,10 +109,10 @@ if ( !$board_config['allow_smilies'] ) } else { - $smilies_on = ( $post || $refresh ) ? ( ( !empty($disable_smilies) ) ? 0 : TRUE ) : ( ( !$userdata['user_id'] ) ? $board_config['allow_smilies'] : $userdata['user_allowsmile'] ); + $smilies_on = ( $post || $refresh ) ? ( ( !empty($disable_smilies) ) ? 0 : TRUE ) : ( ( !$user->data['user_id'] ) ? $board_config['allow_smilies'] : $user->data['user_allowsmile'] ); } -$attach_sig = ( $post || $refresh ) ? ( ( !empty($attach_sig) ) ? TRUE : 0 ) : ( ( !$userdata['user_id'] ) ? 0 : $userdata['user_attachsig'] ); +$attach_sig = ( $post || $refresh ) ? ( ( !empty($attach_sig) ) ? TRUE : 0 ) : ( ( !$user->data['user_id'] ) ? 0 : $user->data['user_attachsig'] ); @@ -139,24 +124,24 @@ switch ( $mode ) case 'newtopic': if ( empty($f) ) { - message_die(MESSAGE, $lang['Forum_not_exist']); + trigger($user->lang['Forum_not_exist']); } $sql = "SELECT * FROM " . FORUMS_TABLE . " - WHERE forum_id = $f"; + WHERE forum_id = $forum_id"; break; case 'reply': case 'vote': if ( empty( $t) ) { - message_die(MESSAGE, $lang['No_topic_id']); + trigger($user->lang['No_topic_id']); } $sql = "SELECT f.*, t.* FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t - WHERE t.topic_id = $t + WHERE t.topic_id = $topic_id AND f.forum_id = t.forum_id"; break; @@ -166,7 +151,7 @@ switch ( $mode ) case 'poll_delete': if ( empty($p) ) { - message_die(MESSAGE, $lang['No_post_id']); + trigger($user->lang['No_post_id']); } $select_sql = ( !$submit ) ? ', t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig' : ', pt.post_subject, pt.post_text'; @@ -182,20 +167,18 @@ switch ( $mode ) break; default: - message_die(MESSAGE, $lang['No_valid_mode']); + message_die(MESSAGE, $user->lang['No_valid_mode']); } -if ( $result = $db->sql_query($sql) ) -{ - $post_info = $db->sql_fetchrow($result); +$result = $db->sql_query($sql); +if ( $post_info = $db->sql_fetchrow($result) ) +{ $forum_id = $post_info['forum_id']; $forum_name = $post_info['forum_name']; $topic_title = $post_info['topic_title']; $topic_id = $post_info['topic_id']; - - } @@ -234,7 +217,8 @@ if ( isset($post) ) print_r($message); echo "


\n\n"; - $result = $search->add($p, $message, $post_subject, $post_info['post_text'], $post_info['post_subject']); + // Fulltext parser +// $result = $search->add($p, $message, $post_subject, $post_info['post_text'], $post_info['post_subject']); } exit; @@ -251,16 +235,14 @@ $message = $post_info['post_text']; // Remove encoded bbcode, urls, etc. $match = array( '#(.*?)#s', - '#(.*?)#s', - '#\[b:([0-9a-z]+)\](.*?)\[/b:\1\]#s', - '#.*?#', - '#.*?#', + '#(.*?)#s', + '#.*?#', + '#.*?#', ); $replace = array( '[b]\1[/b]', '[u]\1[/u]', - '[b]\2[/b]', '\1', '\1', ); @@ -282,19 +264,19 @@ if ( $post || $refresh ) } else { - if ( $mode != 'newtopic' && $userdata['user_id'] ) + if ( $mode != 'newtopic' && $user->data['user_id'] ) { $sql = "SELECT topic_id FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = $topic_id - AND user_id = " . $userdata['user_id']; + AND user_id = " . $user->data['user_id']; $result = $db->sql_query($sql); - $notify_user = ( $db->sql_fetchrow($result) ) ? TRUE : $userdata['user_notify']; + $notify_user = ( $db->sql_fetchrow($result) ) ? TRUE : $user->data['user_notify']; } else { - $notify_user = ( $user_id['user_id'] ) ? $userdata['user_notify'] : 0; + $notify_user = ( $user_id['user_id'] ) ? $user->data['user_notify'] : 0; } } @@ -335,7 +317,7 @@ if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) { $topic_type_toggle .= ' checked="checked"'; } - $topic_type_toggle .= ' /> ' . $lang['Post_Sticky'] . '  '; + $topic_type_toggle .= ' /> ' . $user->lang['Post_Sticky'] . '  '; } if ( $auth->acl_get('f_announce', $forum_id) ) @@ -345,21 +327,21 @@ if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) { $topic_type_toggle .= ' checked="checked"'; } - $topic_type_toggle .= ' /> ' . $lang['Post_Announcement'] . '  '; + $topic_type_toggle .= ' /> ' . $user->lang['Post_Announcement'] . '  '; } if ( $topic_type_toggle != '' ) { - $topic_type_toggle = $lang['Post_topic_as'] . ': ' . $lang['Post_Normal'] . '  ' . $topic_type_toggle; + $topic_type_toggle = $user->lang['Post_topic_as'] . ': ' . $user->lang['Post_Normal'] . '  ' . $topic_type_toggle; } } // HTML, BBCode, Smilies, Images and Flash status -$html_status = ( $board_config['allow_html'] && $auth->acl_get('f_html', $f) ) ? true : false; -$bbcode_status = ( $board_config['allow_bbcode'] && $auth->acl_get('f_bbcode', $f) ) ? true : false; -$smilies_status = ( $board_config['allow_smilies'] && $auth->acl_get('f_smilies', $f) ) ? true : false; -$img_status = ( $board_config['allow_img'] && $auth->acl_get('f_img', $f) ) ? true : false; -$flash_status = ( $board_config['allow_flash'] && $auth->acl_get('f_flash', $f) ) ? true : false; +$html_status = ( $board_config['allow_html'] && $auth->acl_get('f_html', $forum_id) ) ? true : false; +$bbcode_status = ( $board_config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id) ) ? true : false; +$smilies_status = ( $board_config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id) ) ? true : false; +$img_status = ( $board_config['allow_img'] && $auth->acl_get('f_img', $forum_id) ) ? true : false; +$flash_status = ( $board_config['allow_flash'] && $auth->acl_get('f_flash', $forum_id) ) ? true : false; // Page title/hidden fields $s_hidden_fields = ''; @@ -367,18 +349,18 @@ $s_hidden_fields = ''; switch( $mode ) { case 'newtopic': - $page_title = $lang['Post_a_new_topic']; - $s_hidden_fields .= ''; + $page_title = $user->lang['Post_a_new_topic']; + $s_hidden_fields .= ''; break; case 'reply': - $page_title = $lang['Post_a_reply']; - $s_hidden_fields .= ''; + $page_title = $user->lang['Post_a_reply']; + $s_hidden_fields .= ''; break; case 'editpost': - $page_title = $lang['Edit_Post']; - $s_hidden_fields .= ''; + $page_title = $user->lang['Edit_Post']; + $s_hidden_fields .= ''; break; } @@ -389,55 +371,55 @@ $template->assign_vars(array( 'USERNAME' => $username, 'SUBJECT' => $subject, 'MESSAGE' => $message, - 'HTML_STATUS' => ( $html_status ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'], - 'BBCODE_STATUS' => ( $bbcode_status ) ? sprintf($lang['BBCode_is_ON'], '', '') : sprintf($lang['BBCode_is_OFF'], '', ''), - 'SMILIES_STATUS' => ( $smilies_status ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF'], - 'IMG_STATUS' => ( $img_status ) ? $lang['Images_are_ON'] : $lang['Images_are_OFF'], - 'FLASH_STATUS' => ( $flash_status ) ? $lang['Flash_is_ON'] : $lang['Flash_is_OFF'], + 'HTML_STATUS' => ( $html_status ) ? $user->lang['HTML_is_ON'] : $user->lang['HTML_is_OFF'], + 'BBCODE_STATUS' => ( $bbcode_status ) ? sprintf($user->lang['BBCode_is_ON'], '', '') : sprintf($user->lang['BBCode_is_OFF'], '', ''), + 'SMILIES_STATUS' => ( $smilies_status ) ? $user->lang['Smilies_are_ON'] : $user->lang['Smilies_are_OFF'], + 'IMG_STATUS' => ( $img_status ) ? $user->lang['Images_are_ON'] : $user->lang['Images_are_OFF'], + 'FLASH_STATUS' => ( $flash_status ) ? $user->lang['Flash_is_ON'] : $user->lang['Flash_is_OFF'], 'L_POST_A' => $page_title, - 'L_POST_SUBJECT' => $lang['Post_subject'], - 'L_VIEW_MODERATORS' => $lang['View_moderators'], - 'L_TOPIC_ICON' => $lang['Topic_icon'], - 'L_SUBJECT' => $lang['Subject'], - 'L_MESSAGE_BODY' => $lang['Message_body'], - 'L_OPTIONS' => $lang['Options'], - 'L_PREVIEW' => $lang['Preview'], - 'L_SPELLCHECK' => $lang['Spellcheck'], - 'L_SUBMIT' => $lang['Submit'], - 'L_SAVE' => $lang['Save'], - 'L_CANCEL' => $lang['Cancel'], - 'L_CONFIRM_DELETE' => $lang['Confirm_delete'], - 'L_DISABLE_HTML' => $lang['Disable_HTML_post'], - 'L_DISABLE_BBCODE' => $lang['Disable_BBCode_post'], - 'L_DISABLE_SMILIES' => $lang['Disable_Smilies_post'], - 'L_DISABLE_MAGIC_URL' => $lang['Disable_magic_url'], - 'L_ATTACH_SIGNATURE' => $lang['Attach_signature'], - 'L_NOTIFY_ON_REPLY' => $lang['Notify'], - 'L_DELETE_POST' => $lang['Delete_post'], - 'L_NONE' => $lang['None'], - 'L_EMPTY_MESSAGE' => $lang['Empty_message'], - 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'], - 'L_STYLES_TIP' => $lang['Styles_tip'], - 'L_BBCODE_B_HELP' => $lang['bbcode_b_help'], - 'L_BBCODE_I_HELP' => $lang['bbcode_i_help'], - 'L_BBCODE_U_HELP' => $lang['bbcode_u_help'], - 'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'], - 'L_BBCODE_C_HELP' => $lang['bbcode_c_help'], - 'L_BBCODE_L_HELP' => $lang['bbcode_l_help'], - 'L_BBCODE_O_HELP' => $lang['bbcode_o_help'], - 'L_BBCODE_P_HELP' => $lang['bbcode_p_help'], - 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'], - 'L_BBCODE_A_HELP' => $lang['bbcode_a_help'], - 'L_BBCODE_S_HELP' => $lang['bbcode_s_help'], - 'L_BBCODE_F_HELP' => $lang['bbcode_f_help'], - 'L_FONT_COLOR' => $lang['Font_color'], - 'L_FONT_SIZE' => $lang['Font_size'], - 'L_FONT_TINY' => $lang['font_tiny'], - 'L_FONT_SMALL' => $lang['font_small'], - 'L_FONT_NORMAL' => $lang['font_normal'], - 'L_FONT_LARGE' => $lang['font_large'], - 'L_FONT_HUGE' => $lang['font_huge'], + 'L_POST_SUBJECT' => $user->lang['Post_subject'], + 'L_VIEW_MODERATORS' => $user->lang['View_moderators'], + 'L_TOPIC_ICON' => $user->lang['Topic_icon'], + 'L_SUBJECT' => $user->lang['Subject'], + 'L_MESSAGE_BODY' => $user->lang['Message_body'], + 'L_OPTIONS' => $user->lang['Options'], + 'L_PREVIEW' => $user->lang['Preview'], + 'L_SPELLCHECK' => $user->lang['Spellcheck'], + 'L_SUBMIT' => $user->lang['Submit'], + 'L_SAVE' => $user->lang['Save'], + 'L_CANCEL' => $user->lang['Cancel'], + 'L_CONFIRM_DELETE' => $user->lang['Confirm_delete'], + 'L_DISABLE_HTML' => $user->lang['Disable_HTML_post'], + 'L_DISABLE_BBCODE' => $user->lang['Disable_BBCode_post'], + 'L_DISABLE_SMILIES' => $user->lang['Disable_Smilies_post'], + 'L_DISABLE_MAGIC_URL' => $user->lang['Disable_magic_url'], + 'L_ATTACH_SIGNATURE' => $user->lang['Attach_signature'], + 'L_NOTIFY_ON_REPLY' => $user->lang['Notify'], + 'L_DELETE_POST' => $user->lang['Delete_post'], + 'L_NONE' => $user->lang['None'], + 'L_EMPTY_MESSAGE' => $user->lang['Empty_message'], + 'L_BBCODE_CLOSE_TAGS' => $user->lang['Close_Tags'], + 'L_STYLES_TIP' => $user->lang['Styles_tip'], + 'L_BBCODE_B_HELP' => $user->lang['bbcode_b_help'], + 'L_BBCODE_I_HELP' => $user->lang['bbcode_i_help'], + 'L_BBCODE_U_HELP' => $user->lang['bbcode_u_help'], + 'L_BBCODE_Q_HELP' => $user->lang['bbcode_q_help'], + 'L_BBCODE_C_HELP' => $user->lang['bbcode_c_help'], + 'L_BBCODE_L_HELP' => $user->lang['bbcode_l_help'], + 'L_BBCODE_O_HELP' => $user->lang['bbcode_o_help'], + 'L_BBCODE_P_HELP' => $user->lang['bbcode_p_help'], + 'L_BBCODE_W_HELP' => $user->lang['bbcode_w_help'], + 'L_BBCODE_A_HELP' => $user->lang['bbcode_a_help'], + 'L_BBCODE_S_HELP' => $user->lang['bbcode_s_help'], + 'L_BBCODE_F_HELP' => $user->lang['bbcode_f_help'], + 'L_FONT_COLOR' => $user->lang['Font_color'], + 'L_FONT_SIZE' => $user->lang['Font_size'], + 'L_FONT_TINY' => $user->lang['font_tiny'], + 'L_FONT_SMALL' => $user->lang['font_small'], + 'L_FONT_NORMAL' => $user->lang['font_normal'], + 'L_FONT_LARGE' => $user->lang['font_large'], + 'L_FONT_HUGE' => $user->lang['font_huge'], 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=$forum_id", 'U_VIEWTOPIC' => ( $mode != 'newtopic' ) ? "viewtopic.$phpEx$SID&t=$topic_id" : '', @@ -451,15 +433,15 @@ $template->assign_vars(array( 'S_MAGIC_URL_CHECKED' => ( !$magic_urls_on ) ? 'checked="checked"' : '', 'S_SIGNATURE_CHECKED' => ( $attach_sig ) ? 'checked="checked"' : '', 'S_NOTIFY_CHECKED' => ( $notify_user ) ? 'checked="checked"' : '', - 'S_DISPLAY_USERNAME' => ( !$userdata['user_id'] || ( $mode == 'editpost' && $post_info['post_username'] ) ) ? true : false, + 'S_DISPLAY_USERNAME' => ( !$user->data['user_id'] || ( $mode == 'editpost' && $post_info['post_username'] ) ) ? true : false, - 'S_SAVE_ALLOWED' => ( $auth->acl_get('f_save', $f) ) ? true : false, + 'S_SAVE_ALLOWED' => ( $auth->acl_get('f_save', $forum_id) ) ? true : false, 'S_HTML_ALLOWED' => $html_status, 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_SMILIES_ALLOWED' => $smilies_status, - 'S_SIG_ALLOWED' => ( $auth->acl_get('f_sigs', $f) ) ? true : false, - 'S_NOTIFY_ALLOWED' => ( $userdata['user_id'] ) ? true : false, - 'S_DELETE_ALLOWED' => ( $mode == 'editpost' && ( ( $auth->acl_get('f_delete', $f) && $post_data['last_post'] && ( !$post_data['has_poll'] || $post_data['edit_poll'] ) ) || $auth->acl_is_mod($f) ) ) ? true : false, + 'S_SIG_ALLOWED' => ( $auth->acl_get('f_sigs', $forum_id) ) ? true : false, + 'S_NOTIFY_ALLOWED' => ( $user->data['user_id'] ) ? true : false, + 'S_DELETE_ALLOWED' => ( $mode == 'editpost' && ( ( $auth->acl_get('f_delete', $forum_id) && $post_data['last_post'] && ( !$post_data['has_poll'] || $post_data['edit_poll'] ) ) || $auth->acl_get('m_', $forum_id) ) ) ? true : false, 'S_TYPE_TOGGLE' => $topic_type_toggle, 'S_TOPIC_ID' => $t, @@ -467,26 +449,24 @@ $template->assign_vars(array( 'S_HIDDEN_FIELDS' => $s_hidden_fields) ); -// // Poll entry -// -if ( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) ) && $auth->acl_get('f_poll', $f) ) +if ( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) ) && $auth->acl_get('f_poll', $forum_id) ) { $template->assign_vars(array( 'S_SHOW_POLL_BOX' => true, 'S_POLL_DELETE' => ( $mode == 'editpost' && $post_data['edit_poll'] ) ? true : false, - 'L_ADD_A_POLL' => $lang['Add_poll'], - 'L_ADD_POLL_EXPLAIN' => $lang['Add_poll_explain'], - 'L_POLL_QUESTION' => $lang['Poll_question'], - 'L_POLL_OPTION' => $lang['Poll_option'], - 'L_ADD_OPTION' => $lang['Add_option'], - 'L_UPDATE_OPTION' => $lang['Update'], - 'L_DELETE_OPTION' => $lang['Delete'], - 'L_POLL_LENGTH' => $lang['Poll_for'], - 'L_DAYS' => $lang['Days'], - 'L_POLL_LENGTH_EXPLAIN' => $lang['Poll_for_explain'], - 'L_POLL_DELETE' => $lang['Delete_poll'], + 'L_ADD_A_POLL' => $user->lang['Add_poll'], + 'L_ADD_POLL_EXPLAIN' => $user->lang['Add_poll_explain'], + 'L_POLL_QUESTION' => $user->lang['Poll_question'], + 'L_POLL_OPTION' => $user->lang['Poll_option'], + 'L_ADD_OPTION' => $user->lang['Add_option'], + 'L_UPDATE_OPTION' => $user->lang['Update'], + 'L_DELETE_OPTION' => $user->lang['Delete'], + 'L_POLL_LENGTH' => $user->lang['Poll_for'], + 'L_DAYS' => $user->lang['Days'], + 'L_POLL_LENGTH_EXPLAIN' => $user->lang['Poll_for_explain'], + 'L_POLL_DELETE' => $user->lang['Delete_poll'], 'POLL_TITLE' => $poll_title, 'POLL_LENGTH' => $poll_length) @@ -506,16 +486,16 @@ if ( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] } // Attachment entry -if ( $auth->acl_get('f_attach', $f) ) +if ( $auth->acl_get('f_attach', $forum_id) ) { $template->assign_vars(array( 'S_SHOW_ATTACH_BOX' => true, - 'L_ADD_ATTACHMENT' => $lang['Add_attach'], - 'L_ADD_ATTACHMENT_EXPLAIN' => $lang['Add_attach_explain'], + 'L_ADD_ATTACHMENT' => $user->lang['Add_attach'], + 'L_ADD_ATTACHMENT_EXPLAIN' => $user->lang['Add_attach_explain'], - 'L_ADD_FILE' => $lang['Add_file'], - 'L_FILE_NAME' => $lang['Filename'], - 'L_FILE_COMMENT' => $lang['File_comment'],) + 'L_ADD_FILE' => $user->lang['Add_file'], + 'L_FILE_NAME' => $user->lang['Filename'], + 'L_FILE_COMMENT' => $user->lang['File_comment'],) ); } diff --git a/phpBB/privmsg.php b/phpBB/privmsg.php index f28ec3095f..2992b1f0ef 100644 --- a/phpBB/privmsg.php +++ b/phpBB/privmsg.php @@ -73,15 +73,13 @@ else // if ( $cancel ) { - $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: '; - header($header_location . "privmsg.$phpEx$SIDfolder=$folder"); - exit; + redirect("privmsg.$phpEx$SIDfolder=$folder"); } // Start session management -$userdata = $session->start(); -$auth->acl($userdata); -$user = new user($userdata); +$user->start(); +$user->setup(); +$auth->acl($user->data); // End session management // diff --git a/phpBB/profile.php b/phpBB/profile.php index 6c195ad358..5443c5121d 100644 --- a/phpBB/profile.php +++ b/phpBB/profile.php @@ -26,9 +26,9 @@ include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); // Start session management -$userdata = $session->start(); -$auth->acl($userdata); -$user = new user($userdata); +$user->start(); +$user->setup(); +$auth->acl($user->data); // End session management // Set default email variables @@ -76,17 +76,13 @@ if ( isset($_GET['mode']) || isset($_POST['mode']) ) } else if ( $mode == 'editprofile' || $mode == 'register' ) { - if ( !$userdata['user_id'] && $mode == 'editprofile' ) + if ( !$user->data['user_id'] && $mode == 'editprofile' ) { - $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; - header($header_location . "login.$phpEx$SID&redirect=profile.$phpEx&mode=editprofile"); - exit; + redirect("login.$phpEx$SID&redirect=profile.$phpEx&mode=editprofile"); } - else if ( $userdata['user_id'] && $mode == 'register' ) + else if ( $user->data['user_id'] && $mode == 'register' ) { - $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; - header($header_location . "index.$phpEx$SID"); - exit; + redirect("index.$phpEx$SID"); } include($phpbb_root_path . 'includes/usercp_register.'.$phpEx); @@ -110,9 +106,7 @@ if ( isset($_GET['mode']) || isset($_POST['mode']) ) } else { - $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; - header($header_location . "index.$phpEx$SID"); - exit; + redirect("index.$phpEx$SID"); } ?> \ No newline at end of file diff --git a/phpBB/search.php b/phpBB/search.php index 4c8dd0bc06..0b0176c79c 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -27,9 +27,9 @@ include($phpbb_root_path . 'includes/bbcode.'.$phpEx); include($phpbb_root_path . 'includes/functions_posting.'.$phpEx); // Start session management -$userdata = $session->start(); -$auth->acl($userdata); -$user = new user($userdata); +$user->start(); +$user->setup(); +$auth->acl($user->data); // End session management // Define initial vars @@ -109,7 +109,7 @@ else $start = ( isset($_GET['start']) ) ? intval($_GET['start']) : 0; -$sort_by_types = array($lang['Sort_Time'], $lang['Sort_Post_Subject'], $lang['Sort_Topic_Title'], $lang['Sort_Author'], $lang['Sort_Forum']); +$sort_by_types = array($user->lang['Sort_Time'], $user->lang['Sort_Post_Subject'], $user->lang['Sort_Topic_Title'], $user->lang['Sort_Author'], $user->lang['Sort_Forum']); // // Begin core code @@ -127,11 +127,11 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) { if ( $search_id == 'newposts' ) { - if ( $userdata['user_id'] ) + if ( $user->data['user_id'] ) { $sql = "SELECT post_id FROM " . POSTS_TABLE . " - WHERE post_time >= " . $userdata['session_last_visit']; + WHERE post_time >= " . $user->data['session_last_visit']; } else { @@ -145,11 +145,11 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) } else if ( $search_id == 'egosearch' ) { - if ( $userdata['session_logged_in'] ) + if ( $user->data['session_logged_in'] ) { $sql = "SELECT post_id FROM " . POSTS_TABLE . " - WHERE poster_id = " . $userdata['user_id'];; + WHERE poster_id = " . $user->data['user_id'];; } else { @@ -181,7 +181,7 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) } else { - message_die(MESSAGE, $lang['No_search_match']); + message_die(MESSAGE, $user->lang['No_search_match']); } $sql = "SELECT post_id @@ -319,7 +319,7 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) { if ( !$auth->acl_get($search_forum, 'forum', 'read') ) { - message_die(MESSAGE, $lang['No_searchable_forums']); + message_die(MESSAGE, $user->lang['No_searchable_forums']); } // $auth_sql = "f.forum_id = $search_forum"; @@ -494,7 +494,7 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) } else { - message_die(MESSAGE, $lang['No_search_match']); + message_die(MESSAGE, $user->lang['No_search_match']); } // @@ -546,11 +546,11 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) $sql = "UPDATE " . SEARCH_TABLE . " SET search_id = $search_id, search_array = '$result_array' - WHERE session_id = '" . $userdata['session_id'] . "'"; + WHERE session_id = '" . $user->data['session_id'] . "'"; if ( !($result = $db->sql_query($sql)) || !$db->sql_affectedrows() ) { $sql = "INSERT INTO " . SEARCH_TABLE . " (search_id, session_id, search_array) - VALUES($search_id, '" . $userdata['session_id'] . "', '" . str_replace("\'", "''", $result_array) . "')"; + VALUES($search_id, '" . $user->data['session_id'] . "', '" . str_replace("\'", "''", $result_array) . "')"; if ( !($result = $db->sql_query($sql)) ) { message_die(ERROR, 'Could not insert search results', '', __LINE__, __FILE__, $sql); @@ -564,7 +564,7 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) $sql = "SELECT search_array FROM " . SEARCH_TABLE . " WHERE search_id = $search_id - AND session_id = '". $userdata['session_id'] . "'"; + AND session_id = '". $user->data['session_id'] . "'"; if ( !($result = $db->sql_query($sql)) ) { message_die(ERROR, 'Could not obtain search results', '', __LINE__, __FILE__, $sql); @@ -655,11 +655,11 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) // Output header // - $l_search_matches = ( $total_match_count == 1 ) ? sprintf($lang['Found_search_match'], $total_match_count) : sprintf($lang['Found_search_matches'], $total_match_count); + $l_search_matches = ( $total_match_count == 1 ) ? sprintf($user->lang['Found_search_match'], $total_match_count) : sprintf($user->lang['Found_search_matches'], $total_match_count); $template->assign_vars(array( 'L_SEARCH_MATCHES' => $l_search_matches, - 'L_TOPIC' => $lang['Topic']) + 'L_TOPIC' => $user->lang['Topic']) ); $highlight_active = ''; @@ -688,8 +688,8 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) $highlight_active = urlencode(trim($highlight_active)); - $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array(); - $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array(); + $tracking_topics = ( isset($_COOKIE[$board_config['cookie_name'] . '_t']) ) ? unserialize($_COOKIE[$board_config['cookie_name'] . '_t']) : array(); + $tracking_forums = ( isset($_COOKIE[$board_config['cookie_name'] . '_f']) ) ? unserialize($_COOKIE[$board_config['cookie_name'] . '_f']) : array(); for($i = 0; $i < count($searchset); $i++) { @@ -697,7 +697,7 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) $topic_url = "viewtopic.$phpEx$SID&t=" . $searchset[$i]['topic_id'] . "&highlight=$highlight_active"; $post_url = "viewtopic.$phpEx$SID&p=" . $searchset[$i]['post_id'] . "&highlight=$highlight_active" . '#' . $searchset[$i]['post_id']; - $post_date = create_date($board_config['default_dateformat'], $searchset[$i]['post_time'], $board_config['board_timezone']); + $post_date = $user->format_date($searchset[$i]['post_time']); $message = $searchset[$i]['post_text']; $topic_title = $searchset[$i]['topic_title']; @@ -842,10 +842,10 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) } $poster = ( !$searchset[$i]['user_id'] ) ? '' : ''; - $poster .= ( $searchset[$i]['user_id'] ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != "" ) ? $searchset[$i]['post_username'] : $lang['Guest'] ); + $poster .= ( $searchset[$i]['user_id'] ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != "" ) ? $searchset[$i]['post_username'] : $user->lang['Guest'] ); $poster .= ( $searchset[$i]['user_id'] ) ? '' : ''; - if ( $userdata['session_logged_in'] && $searchset[$i]['post_time'] > $userdata['session_last_visit'] ) + if ( $user->data['session_logged_in'] && $searchset[$i]['post_time'] > $user->data['session_last_visit'] ) { if ( !empty($tracking_topics[$topic_id]) && !empty($tracking_forums[$forum_id]) ) { @@ -858,19 +858,19 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) if ( $searchset[$i]['post_time'] > $topic_last_read ) { - $mini_post_img = $images['icon_minipost_new']; - $mini_post_alt = $lang['New_post']; + $mini_post_img = 'goto_post_newest'; + $mini_post_alt = $user->lang['New_post']; } else { - $mini_post_img = $images['icon_minipost']; - $mini_post_alt = $lang['Post']; + $mini_post_img = 'goto_post'; + $mini_post_alt = $user->lang['Post']; } } else { - $mini_post_img = $images['icon_minipost']; - $mini_post_alt = $lang['Post']; + $mini_post_img = 'goto_post'; + $mini_post_alt = $user->lang['Post']; } $template->assign_block_vars("searchresults", array( @@ -882,9 +882,7 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) 'TOPIC_REPLIES' => $searchset[$i]['topic_replies'], 'TOPIC_VIEWS' => $searchset[$i]['topic_views'], 'MESSAGE' => $message, - 'MINI_POST_IMG' => $mini_post_img, - - 'L_MINI_POST_ALT' => $mini_post_alt, + 'MINI_POST_IMG' => $user->img($mini_post_img, $mini_post_alt), 'U_POST' => $post_url, 'U_TOPIC' => $topic_url, @@ -904,11 +902,11 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) if ($topic_type == POST_ANNOUNCE) { - $topic_type = $lang['Topic_Announcement'] . ' '; + $topic_type = $user->lang['Topic_Announcement'] . ' '; } else if ($topic_type == POST_STICKY) { - $topic_type = $lang['Topic_Sticky'] . ' '; + $topic_type = $user->lang['Topic_Sticky'] . ' '; } else { @@ -917,7 +915,7 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) if ( $searchset[$i]['topic_vote'] ) { - $topic_type .= $lang['Topic_Poll'] . ' '; + $topic_type .= $user->lang['Topic_Poll'] . ' '; } $views = $searchset[$i]['topic_views']; @@ -926,7 +924,7 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) if ( ( $replies + 1 ) > $board_config['posts_per_page'] ) { $total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] ); - $goto_page = ' [ ' . $lang['Goto_page'] . '' . $lang['Goto_page'] . ': '; + $goto_page = ' [ ' . $user->img('icon_gotopost', $user->lang['Goto_page']) . $user->lang['Goto_page'] . ': '; $times = 1; for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page']) @@ -953,48 +951,49 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) if ( $searchset[$i]['topic_status'] == TOPIC_MOVED ) { - $topic_type = $lang['Topic_Moved'] . ' '; + $topic_type = $user->lang['Topic_Moved'] . ' '; $topic_id = $searchset[$i]['topic_moved_id']; - $folder_image = '' . $lang['No_new_posts'] . ''; + $folder_image = 'folder'; + $folder_alt = $user->lang['No_new_posts']; $newest_post_img = ''; } else { if ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) { - $folder = $images['folder_locked']; - $folder_new = $images['folder_locked_new']; + $folder = 'folder_locked'; + $folder_new = 'folder_locked_new'; } else if ( $searchset[$i]['topic_type'] == POST_ANNOUNCE ) { - $folder = $images['folder_announce']; - $folder_new = $images['folder_announce_new']; + $folder = 'folder_announce'; + $folder_new = 'folder_announce_new'; } else if ( $searchset[$i]['topic_type'] == POST_STICKY ) { - $folder = $images['folder_sticky']; - $folder_new = $images['folder_sticky_new']; + $folder = 'folder_sticky'; + $folder_new = 'folder_sticky_new'; } else { if ( $replies >= $board_config['hot_threshold'] ) { - $folder = $images['folder_hot']; - $folder_new = $images['folder_hot_new']; + $folder = 'folder_hot'; + $folder_new ='folder_hot_new'; } else { - $folder = $images['folder']; - $folder_new = $images['folder_new']; + $folder = 'folder'; + $folder_new = 'folder_new'; } } - if ( $userdata['session_logged_in'] ) + if ( $user->data['session_logged_in'] ) { - if ( $searchset[$i]['post_time'] > $userdata['session_last_visit'] ) + if ( $searchset[$i]['post_time'] > $user->data['session_last_visit'] ) { - if ( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) + if ( !empty($tracking_topics) || !empty($tracking_forums) || isset($_COOKIE[$board_config['cookie_name'] . '_f_all']) ) { $unread_topics = true; @@ -1015,9 +1014,9 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) } } - if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) + if ( isset($_COOKIE[$board_config['cookie_name'] . '_f_all']) ) { - if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $searchset[$i]['post_time'] ) + if ( $_COOKIE[$board_config['cookie_name'] . '_f_all'] > $searchset[$i]['post_time'] ) { $unread_topics = false; } @@ -1026,13 +1025,13 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) if ( $unread_topics ) { $folder_image = $folder_new; - $folder_alt = $lang['New_posts']; + $folder_alt = $user->lang['New_posts']; - $newest_post_img = '' . $lang['View_newest_post'] . ' '; + $newest_post_img = '' . $user->img('icon_newest_reply', $user->lang['View_newest_post']) . ' '; } else { - $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; + $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $user->lang['Topic_locked'] : $user->lang['No_new_posts']; $folder_image = $folder; $folder_alt = $folder_alt; @@ -1040,54 +1039,54 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) } } - else if ( $searchset[$i]['post_time'] > $userdata['session_last_visit'] ) + else if ( $searchset[$i]['post_time'] > $user->data['session_last_visit'] ) { $folder_image = $folder_new; - $folder_alt = $lang['New_posts']; + $folder_alt = $user->lang['New_posts']; - $newest_post_img = '' . $lang['View_newest_post'] . ' '; + $newest_post_img = '' . $user->img('icon_newest_reply', $user->lang['View_newest_post']) . ' '; } else { $folder_image = $folder; - $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; + $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $user->lang['Topic_locked'] : $user->lang['No_new_posts']; $newest_post_img = ''; } } else { $folder_image = $folder; - $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; + $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $user->lang['Topic_locked'] : $user->lang['No_new_posts']; $newest_post_img = ''; } } else { $folder_image = $folder; - $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; + $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $user->lang['Topic_locked'] : $user->lang['No_new_posts']; $newest_post_img = ''; } } $topic_author = ( $searchset[$i]['user_id'] ) ? '' : ''; - $topic_author .= ( $searchset[$i]['user_id'] ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != '' ) ? $searchset[$i]['post_username'] : $lang['Guest'] ); + $topic_author .= ( $searchset[$i]['user_id'] ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != '' ) ? $searchset[$i]['post_username'] : $user->lang['Guest'] ); $topic_author .= ( $searchset[$i]['user_id'] ) ? '' : ''; - $first_post_time = create_date($board_config['default_dateformat'], $searchset[$i]['topic_time'], $board_config['board_timezone']); + $first_post_time = $user->format_date($searchset[$i]['topic_time']); - $last_post_time = create_date($board_config['default_dateformat'], $searchset[$i]['post_time'], $board_config['board_timezone']); + $last_post_time = $user->format_date($searchset[$i]['post_time']); - $last_post_author = ( $searchset[$i]['id2'] ) ? ( ($searchset[$i]['post_username2'] != '' ) ? $searchset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '' . $searchset[$i]['user2'] . ''; + $last_post_author = ( $searchset[$i]['id2'] ) ? ( ($searchset[$i]['post_username2'] != '' ) ? $searchset[$i]['post_username2'] . ' ' : $user->lang['Guest'] . ' ' ) : '' . $searchset[$i]['user2'] . ''; - $last_post_url = '' . $lang['View_latest_post'] . ''; + $last_post_url = '' . $user->img('icon_latest_reply', $user->lang['View_latest_post']) . ''; $template->assign_block_vars('searchresults', array( 'FORUM_NAME' => $searchset[$i]['forum_name'], 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, - 'FOLDER' => $folder_image, + 'FOLDER' => $user->img($folder_image, $folder_alt), 'NEWEST_POST_IMG' => $newest_post_img, 'TOPIC_FOLDER_IMG' => $folder_image, 'GOTO_PAGE' => $goto_page, @@ -1113,23 +1112,23 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) $template->assign_vars(array( 'PAGINATION' => generate_pagination($base_url, $total_match_count, $per_page, $start), - 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $per_page ) + 1 ), ceil( $total_match_count / $per_page )), + 'PAGE_NUMBER' => sprintf($user->lang['Page_of'], ( floor( $start / $per_page ) + 1 ), ceil( $total_match_count / $per_page )), - 'L_AUTHOR' => $lang['Author'], - 'L_MESSAGE' => $lang['Message'], - 'L_FORUM' => $lang['Forum'], - 'L_TOPICS' => $lang['Topics'], - 'L_REPLIES' => $lang['Replies'], - 'L_VIEWS' => $lang['Views'], - 'L_POSTS' => $lang['Posts'], - 'L_LASTPOST' => $lang['Last_Post'], - 'L_POSTED' => $lang['Posted'], - 'L_SUBJECT' => $lang['Subject'], + 'L_AUTHOR' => $user->lang['Author'], + 'L_MESSAGE' => $user->lang['Message'], + 'L_FORUM' => $user->lang['Forum'], + 'L_TOPICS' => $user->lang['Topics'], + 'L_REPLIES' => $user->lang['Replies'], + 'L_VIEWS' => $user->lang['Views'], + 'L_POSTS' => $user->lang['Posts'], + 'L_LASTPOST' => $user->lang['Last_Post'], + 'L_POSTED' => $user->lang['Posted'], + 'L_SUBJECT' => $user->lang['Subject'], - 'L_GOTO_PAGE' => $lang['Goto_page']) + 'L_GOTO_PAGE' => $user->lang['Goto_page']) ); - $page_title = $lang['Search']; + $page_title = $user->lang['Search']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( @@ -1141,7 +1140,7 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) } else { - message_die(MESSAGE, $lang['No_search_match']); + message_die(MESSAGE, $user->lang['No_search_match']); } } @@ -1169,12 +1168,12 @@ while( $row = $db->sql_fetchrow($result) ) if ( $s_forums != '' ) { - $s_forums = '' . $s_forums; + $s_forums = '' . $s_forums; // // Category to search // - $s_categories = ''; + $s_categories = ''; while( list($cat_id, $cat_title) = @each($list_cat)) { $s_categories .= ''; @@ -1182,13 +1181,13 @@ if ( $s_forums != '' ) } else { - message_die(MESSAGE, $lang['No_searchable_forums']); + message_die(MESSAGE, $user->lang['No_searchable_forums']); } // // Number of chars returned // -$s_characters = ''; +$s_characters = ''; $s_characters .= ''; $s_characters .= ''; $s_characters .= ''; @@ -1212,7 +1211,7 @@ for($i = 0; $i < count($sort_by_types); $i++) // Search time // $previous_days = array(0, 1, 7, 14, 30, 90, 180, 364); -$previous_days_text = array($lang['All_Posts'], $lang['1_Day'], $lang['7_Days'], $lang['2_Weeks'], $lang['1_Month'], $lang['3_Months'], $lang['6_Months'], $lang['1_Year']); +$previous_days_text = array($user->lang['All_Posts'], $user->lang['1_Day'], $user->lang['7_Days'], $user->lang['2_Weeks'], $user->lang['1_Month'], $user->lang['3_Months'], $user->lang['6_Months'], $user->lang['1_Year']); $s_time = ''; for($i = 0; $i < count($previous_days); $i++) @@ -1222,27 +1221,27 @@ for($i = 0; $i < count($previous_days); $i++) } $template->assign_vars(array( - 'L_SEARCH_QUERY' => $lang['Search_query'], - 'L_SEARCH_OPTIONS' => $lang['Search_options'], - 'L_SEARCH_KEYWORDS' => $lang['Search_keywords'], - 'L_SEARCH_KEYWORDS_EXPLAIN' => $lang['Search_keywords_explain'], - 'L_SEARCH_AUTHOR' => $lang['Search_author'], - 'L_SEARCH_AUTHOR_EXPLAIN' => $lang['Search_author_explain'], - 'L_SEARCH_ANY_TERMS' => $lang['Search_for_any'], - 'L_SEARCH_ALL_TERMS' => $lang['Search_for_all'], - 'L_SEARCH_MESSAGE_ONLY' => $lang['Search_msg_only'], - 'L_SEARCH_MESSAGE_TITLE' => $lang['Search_title_msg'], - 'L_CATEGORY' => $lang['Category'], - 'L_RETURN_FIRST' => $lang['Return_first'], - 'L_CHARACTERS' => $lang['characters_posts'], - 'L_SORT_BY' => $lang['Sort_by'], - 'L_SORT_ASCENDING' => $lang['Sort_Ascending'], - 'L_SORT_DESCENDING' => $lang['Sort_Descending'], - 'L_SEARCH_PREVIOUS' => $lang['Search_previous'], - 'L_DISPLAY_RESULTS' => $lang['Display_results'], - 'L_FORUM' => $lang['Forum'], - 'L_TOPICS' => $lang['Topics'], - 'L_POSTS' => $lang['Posts'], + 'L_SEARCH_QUERY' => $user->lang['Search_query'], + 'L_SEARCH_OPTIONS' => $user->lang['Search_options'], + 'L_SEARCH_KEYWORDS' => $user->lang['Search_keywords'], + 'L_SEARCH_KEYWORDS_EXPLAIN' => $user->lang['Search_keywords_explain'], + 'L_SEARCH_AUTHOR' => $user->lang['Search_author'], + 'L_SEARCH_AUTHOR_EXPLAIN' => $user->lang['Search_author_explain'], + 'L_SEARCH_ANY_TERMS' => $user->lang['Search_for_any'], + 'L_SEARCH_ALL_TERMS' => $user->lang['Search_for_all'], + 'L_SEARCH_MESSAGE_ONLY' => $user->lang['Search_msg_only'], + 'L_SEARCH_MESSAGE_TITLE' => $user->lang['Search_title_msg'], + 'L_CATEGORY' => $user->lang['Category'], + 'L_RETURN_FIRST' => $user->lang['Return_first'], + 'L_CHARACTERS' => $user->lang['characters_posts'], + 'L_SORT_BY' => $user->lang['Sort_by'], + 'L_SORT_ASCENDING' => $user->lang['Sort_Ascending'], + 'L_SORT_DESCENDING' => $user->lang['Sort_Descending'], + 'L_SEARCH_PREVIOUS' => $user->lang['Search_previous'], + 'L_DISPLAY_RESULTS' => $user->lang['Display_results'], + 'L_FORUM' => $user->lang['Forum'], + 'L_TOPICS' => $user->lang['Topics'], + 'L_POSTS' => $user->lang['Posts'], 'S_SEARCH_ACTION' => "search.$phpEx$SID&mode=results", 'S_CHARACTER_OPTIONS' => $s_characters, @@ -1256,7 +1255,7 @@ $template->assign_vars(array( // // Output the basic page // -$page_title = $lang['Search']; +$page_title = $user->lang['Search']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( diff --git a/phpBB/templates/subSilver/search_results_posts.html b/phpBB/templates/subSilver/search_results_posts.html index 61174b4c2d..dade2f2d56 100644 --- a/phpBB/templates/subSilver/search_results_posts.html +++ b/phpBB/templates/subSilver/search_results_posts.html @@ -19,7 +19,7 @@ -   {L_TOPIC}: {searchresults.TOPIC_TITLE} + {L_TOPIC}: {searchresults.TOPIC_TITLE} {searchresults.POSTER_NAME}
@@ -27,7 +27,7 @@ {L_REPLIES}: {searchresults.TOPIC_REPLIES}
{L_VIEWS}: {searchresults.TOPIC_VIEWS}

- {searchresults.L_MINI_POST_ALT}{L_FORUM}: {searchresults.FORUM_NAME}   {L_POSTED}: {searchresults.POST_DATE}   {L_SUBJECT}: {searchresults.POST_SUBJECT} + {searchresults.MINI_POST_IMG}{L_FORUM}: {searchresults.FORUM_NAME}   {L_POSTED}: {searchresults.POST_DATE}   {L_SUBJECT}: {searchresults.POST_SUBJECT} {searchresults.MESSAGE} diff --git a/phpBB/templates/subSilver/viewforum_body.html b/phpBB/templates/subSilver/viewforum_body.html index 616f7b993e..37c6034546 100644 --- a/phpBB/templates/subSilver/viewforum_body.html +++ b/phpBB/templates/subSilver/viewforum_body.html @@ -5,11 +5,11 @@ - + - +
{FORUM_NAME}
[ {L_VIEW_MODERATORS} ]

{LOGGED_IN_USER_LIST}
{PAGINATION}
{POST_IMG}
- + @@ -30,7 +30,7 @@ - + @@ -41,17 +41,17 @@ - + - +
 {L_TOPICS}   {L_AUTHOR}   {L_REPLIES}  {L_RATING} 
{topicrow.TOPIC_FOLDER_IMG} {topicrow.TOPIC_ICON} {topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}{topicrow.TOPIC_TITLE}
{topicrow.GOTO_PAGE}
{topicrow.TOPIC_RATING}
{L_NO_TOPICS}
{L_DISPLAY_TOPICS}: {S_SELECT_SORT_DAYS} {L_SORT_BY} {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} 
- +
{POST_IMG}
- +
@@ -87,7 +87,7 @@ {FOLDER_ANNOUNCE_IMG} {L_ANNOUNCEMENT} - + {FOLDER_HOT_NEW_IMG} {L_NEW_POSTS_HOT}    diff --git a/phpBB/templates/subSilver/viewtopic_body.html b/phpBB/templates/subSilver/viewtopic_body.html index f38bfec55f..d225542d51 100644 --- a/phpBB/templates/subSilver/viewtopic_body.html +++ b/phpBB/templates/subSilver/viewtopic_body.html @@ -42,18 +42,18 @@ {S_HIDDEN_FIELDS} - +
- + - + @@ -87,7 +87,7 @@ - + @@ -102,23 +102,23 @@ - + - +
{POLL_QUESTION}
- + - +
{poll_option.POLL_OPTION_CAPTION} - + @@ -65,7 +65,7 @@
{poll_option.POLL_OPTION_PERCENT}
{L_TOTAL_VOTES} : {TOTAL_VOTES}

{postrow.MINI_POST_IMG}{L_POSTED}: {postrow.POST_DATE}    {L_POST_SUBJECT}: {postrow.POST_SUBJECT} {postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}

{L_BACK_TO_TOP} - -
{postrow.PROFILE_IMG} {postrow.PM_IMG} {postrow.EMAIL_IMG} {postrow.WWW_IMG} {postrow.AIM_IMG} {postrow.YIM_IMG} {postrow.MSN_IMG}
@@ -128,7 +128,7 @@
{L_DISPLAY_POSTS}: {S_SELECT_SORT_DAYS} {L_SORT_BY} {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} 
- + @@ -139,7 +139,7 @@
{POST_IMG}   {REPLY_IMG}    {L_INDEX} -> {FORUM_NAME} {S_TIMEZONE}
{PAGINATION}
- + diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index e20168e731..1fa339659a 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -32,9 +32,7 @@ if (preg_match('/^c([0-9]+)$/', $_POST['f'], $m)) include($phpbb_root_path . 'common.'.$phpEx); -// // Start initial var setup -// if ( isset($_GET['f']) || isset($_POST['f']) ) { $forum_id = ( isset($_GET['f']) ) ? intval($_GET['f']) : intval($_POST['f']); @@ -54,13 +52,10 @@ else } $start = ( isset($_GET['start']) ) ? intval($_GET['start']) : 0; -// // End initial var setup -// -// Start session management -$userdata = $session->start(); -// End session management +// Start session +$user->start(); // Check if the user has actually sent a forum ID with his/her request // If not give them a nice error page. @@ -75,20 +70,18 @@ if (!$forum_branch = get_forum_branch($forum_id)) } // Configure style, language, etc. -$user = new user($userdata, false, $forum_branch['forum_style']); -$auth->acl($userdata, $forum_id, array('m_', 'f_read', 'f_post', 'f_attach', 'f_reply', 'f_edit', 'f_delete')); -// +$user->setup(false, $forum_branch['forum_style']); +$auth->acl($user->data, $forum_id); // Auth check if (!$auth->acl_get('f_read', $forum_id)) { - if ( !$userdata['user_id'] ) + if ( !$user->data['user_id'] ) { redirect("login.$phpEx$SID&redirect=viewforum.$phpEx&f=$forum_id" . ((isset($start)) ? "&start=$start" : '')); } - // The user is not authed to read this forum ... - message_die(MESSAGE, $lang['Sorry_auth_read']); + trigger_error( $user->lang['Sorry_auth_read']); } // End of auth check @@ -161,18 +154,14 @@ foreach ($forum_branch as $row) } } -// // Topic read tracking cookie info -// $mark_topics = ( isset($_COOKIE[$board_config['cookie_name'] . '_t']) ) ? unserialize(stripslashes($_COOKIE[$board_config['cookie_name'] . '_t'])) : array(); $mark_forums = ( isset($_COOKIE[$board_config['cookie_name'] . '_f']) ) ? unserialize(stripslashes($_COOKIE[$board_config['cookie_name'] . '_f'])) : array(); -// // Handle marking posts -// if ( $mark_read == 'topics' ) { - if ( $userdata['user_id'] ) + if ( $user->data['user_id'] ) { $mark_forums[$forum_id] = time(); @@ -183,16 +172,12 @@ if ( $mark_read == 'topics' ) ); } - $message = $lang['Topics_marked_read'] . '

' . sprintf($lang['Click_return_forum'], '', ' '); - message_die(MESSAGE, $message); + $message = $user->lang['Topics_marked_read'] . '

' . sprintf($user->lang['Click_return_forum'], '', ' '); + trigger_error($message); } -// // End handle marking posts -// -// // Do the forum Prune -// if ( $auth->acl_get('m_prune', $forum_id) && $board_config['prune_enable'] ) { if ( $forum_data['prune_next'] < time() && $forum_data['prune_enable'] ) @@ -201,16 +186,12 @@ if ( $auth->acl_get('m_prune', $forum_id) && $board_config['prune_enable'] ) auto_prune($forum_id); } } -// // End of forum prune -// -// // Forum rules, subscription info and word censors -// $s_watching_forum = ''; $s_watching_forum_img = ''; -watch_topic_forum('forum', $s_watching_forum, $s_watching_forum_img, $userdata['user_id'], $forum_id); +watch_topic_forum('forum', $s_watching_forum, $s_watching_forum_img, $user->data['user_id'], $forum_id); $s_forum_rules = ''; get_forum_rules('forum', $s_forum_rules, $forum_id); @@ -219,14 +200,9 @@ $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); - - - -// // Topic ordering options -// -$previous_days = array(0 => $lang['All_Topics'], 1 => $lang['1_Day'], 7 => $lang['7_Days'], 14 => $lang['2_Weeks'], 30 => $lang['1_Month'], 90 => $lang['3_Months'], 180 => $lang['6_Months'], 364 => $lang['1_Year']); -$sort_by_text = array('a' => $lang['Author'], 't' => $lang['Post_time'], 'r' => $lang['Replies'], 's' => $lang['Subject'], 'v' => $lang['Views']); +$previous_days = array(0 => $user->lang['All_Topics'], 1 => $user->lang['1_Day'], 7 => $user->lang['7_Days'], 14 => $user->lang['2_Weeks'], 30 => $user->lang['1_Month'], 90 => $user->lang['3_Months'], 180 => $user->lang['6_Months'], 364 => $user->lang['1_Year']); +$sort_by_text = array('a' => $user->lang['Author'], 't' => $user->lang['Post_time'], 'r' => $user->lang['Replies'], 's' => $user->lang['Subject'], 'v' => $user->lang['Views']); $sort_by = array('a' => 'u.username', 't' => 't.topic_last_post_id', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views'); if ( isset($_POST['sort']) ) @@ -286,82 +262,80 @@ foreach ( $sort_by_text as $key => $text ) $select_sort .= ''; $select_sort_dir = ''; -$post_alt = ( $forum_data['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic']; +$post_alt = ( $forum_data['forum_status'] == FORUM_LOCKED ) ? 'Forum_locked' : 'Post_new_topic'; +// Basic pagewide vars $template->assign_vars(array( - 'FORUM_ID' => $forum_id, - 'POST_IMG' => '' . $post_alt . '', - 'PAGINATION' => generate_pagination("viewforum.$phpEx$SID&f=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start), - 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $board_config['topics_per_page'] )), + 'FORUM_ID' => $forum_id, + 'FORUM_NAME' => $forum_data['forum_name'], + 'POST_IMG' => ( $forum_data['forum_status'] == FORUM_LOCKED ) ? $user->img('post_locked', $post_alt) : $user->img('post_new', $post_alt), + 'PAGINATION' => generate_pagination("viewforum.$phpEx$SID&f=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start), + 'PAGE_NUMBER' => sprintf($user->lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $board_config['topics_per_page'] )), - 'FOLDER_IMG' => create_img($theme['folder'], $lang['No_new_posts']), - 'FOLDER_NEW_IMG' => create_img($theme['folder_new'], $lang['New_posts']), - 'FOLDER_HOT_IMG' => create_img($theme['folder_hot'], $lang['No_new_posts_hot']), - 'FOLDER_HOT_NEW_IMG' => create_img($theme['folder_hot_new'], $lang['New_posts_hot']), - 'FOLDER_LOCKED_IMG' => create_img($theme['folder_locked'], $lang['No_new_posts_locked']), - 'FOLDER_LOCKED_NEW_IMG' => create_img($theme['folder_locked_new'], $lang['New_posts_locked']), - 'FOLDER_STICKY_IMG' => create_img($theme['folder_sticky'], $lang['Post_Sticky']), - 'FOLDER_STICKY_NEW_IMG' => create_img($theme['folder_sticky_new'], $lang['Post_Sticky']), - 'FOLDER_ANNOUNCE_IMG' => create_img($theme['folder_announce'], $lang['Post_Announcement']), - 'FOLDER_ANNOUNCE_NEW_IMG' => create_img($theme['folder_announce_new'], $lang['Post_Announcement']), + 'FOLDER_IMG' => $user->img('folder', 'No_new_posts'), + 'FOLDER_NEW_IMG' => $user->img('folder_new', 'New_posts'), + 'FOLDER_HOT_IMG' => $user->img('folder_hot', 'No_new_posts_hot'), + 'FOLDER_HOT_NEW_IMG' => $user->img('folder_hot_new', 'New_posts_hot'), + 'FOLDER_LOCKED_IMG' => $user->img('folder_locked', 'No_new_posts_locked'), + 'FOLDER_LOCKED_NEW_IMG' => $user->img('folder_locked_new', 'New_posts_locked'), + 'FOLDER_STICKY_IMG' => $user->img('folder_sticky', 'Post_Sticky'), + 'FOLDER_STICKY_NEW_IMG' => $user->img('folder_sticky_new', 'Post_Sticky'), + 'FOLDER_ANNOUNCE_IMG' => $user->img('folder_announce', 'Post_Announcement'), + 'FOLDER_ANNOUNCE_NEW_IMG' => $user->img('folder_announce_new', 'Post_Announcement'), - 'L_TOPICS' => $lang['Topics'], - 'L_REPLIES' => $lang['Replies'], - 'L_VIEWS' => $lang['Views'], - 'L_POSTS' => $lang['Posts'], - 'L_LASTPOST' => $lang['Last_Post'], - 'L_RATING' => $lang['Rating'], - 'L_VIEW_MODERATORS' => $lang['View_moderators'], - 'L_DISPLAY_TOPICS' => $lang['Display_topics'], - 'L_SORT_BY' => $lang['Sort_by'], - 'L_MARK_TOPICS_READ' => $lang['Mark_all_topics'], - 'L_NO_NEW_POSTS' => $lang['No_new_posts'], - 'L_NEW_POSTS' => $lang['New_posts'], - 'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'], - 'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'], - 'L_NO_NEW_POSTS_HOT' => $lang['No_new_posts_hot'], - 'L_NEW_POSTS_HOT' => $lang['New_posts_hot'], - 'L_ANNOUNCEMENT' => $lang['Post_Announcement'], - 'L_STICKY' => $lang['Post_Sticky'], - 'L_POSTED' => $lang['Posted'], - 'L_JOINED' => $lang['Joined'], - 'L_AUTHOR' => $lang['Author'], - 'L_NO_TOPICS' => ( $forum_data['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['No_topics_post_one'], - 'L_GOTO_PAGE' => $lang['Goto_page'], + 'L_TOPICS' => $user->lang['Topics'], + 'L_REPLIES' => $user->lang['Replies'], + 'L_VIEWS' => $user->lang['Views'], + 'L_POSTS' => $user->lang['Posts'], + 'L_LASTPOST' => $user->lang['Last_Post'], + 'L_RATING' => $user->lang['Rating'], + 'L_VIEW_MODERATORS' => $user->lang['View_moderators'], + 'L_DISPLAY_TOPICS' => $user->lang['Display_topics'], + 'L_SORT_BY' => $user->lang['Sort_by'], + 'L_MARK_TOPICS_READ' => $user->lang['Mark_all_topics'], + 'L_NO_NEW_POSTS' => $user->lang['No_new_posts'], + 'L_NEW_POSTS' => $user->lang['New_posts'], + 'L_NO_NEW_POSTS_LOCKED' => $user->lang['No_new_posts_locked'], + 'L_NEW_POSTS_LOCKED' => $user->lang['New_posts_locked'], + 'L_NO_NEW_POSTS_HOT' => $user->lang['No_new_posts_hot'], + 'L_NEW_POSTS_HOT' => $user->lang['New_posts_hot'], + 'L_ANNOUNCEMENT' => $user->lang['Post_Announcement'], + 'L_STICKY' => $user->lang['Post_Sticky'], + 'L_POSTED' => $user->lang['Posted'], + 'L_JOINED' => $user->lang['Joined'], + 'L_AUTHOR' => $user->lang['Author'], + 'L_NO_TOPICS' => ( $forum_data['forum_status'] == FORUM_LOCKED ) ? $user->lang['Forum_locked'] : $user->lang['No_topics_post_one'], + 'L_GOTO_PAGE' => $user->lang['Goto_page'], 'S_SELECT_SORT_DIR' => $select_sort_dir, 'S_SELECT_SORT_KEY' => $select_sort, - 'S_SELECT_SORT_DAYS' => $select_sort_days, - 'S_AUTH_LIST' => $s_forum_rules, - 'S_WATCH_FORUM' => $s_watching_forum, - 'S_FORUM_ACTION' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id . "&start=$start", + 'S_SELECT_SORT_DAYS'=> $select_sort_days, + 'S_AUTH_LIST' => $s_forum_rules, + 'S_WATCH_FORUM' => $s_watching_forum, + 'S_FORUM_ACTION' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id . "&start=$start", - 'U_POST_NEW_TOPIC' => 'posting.' . $phpEx . $SID . '&mode=newtopic&f=' . $forum_id, - 'U_VIEW_MODERATORS' => 'memberslist.' . $phpEx . $SID . '&mode=moderators&f=' . $forum_id, - 'U_MARK_READ' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id . '&mark=topics') + 'U_POST_NEW_TOPIC' => 'posting.' . $phpEx . $SID . '&mode=newtopic&f=' . $forum_id, + 'U_VIEW_MODERATORS' => 'memberslist.' . $phpEx . $SID . '&mode=moderators&f=' . $forum_id, + 'U_MARK_READ' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id . '&mark=topics') ); -// // Do we have subforums? if so, let's include this harmless file -// if ($s_has_subforums) { $template->assign_vars(array( 'S_HAS_SUBFORUM' => TRUE, - 'L_SUBFORUM' => (count($forum_rows) == 1) ? $lang['Subforum'] : $lang['Subforums'] + 'L_SUBFORUM' => (count($forum_rows) == 1) ? $user->lang['Subforum'] : $user->lang['Subforums'] )); $root_id = $forum_id; include($phpbb_root_path . 'includes/forums_display.' . $phpEx); } -// // Grab all the basic data. If we're not on page 1 we also grab any // announcements that may exist. -// $total_topics = 0; $topic_rowset = array(); @@ -387,7 +361,7 @@ if ( $start ) } // topic icon join requires full table scan ... not good ... order by is a killer too -$sql = "SELECT t.*, i.icons_url, i.icons_width, i.icons_height, u.username, u.user_id, u2.username as user2, u2.user_id as id2 +/*$sql = "SELECT t.*, i.icons_url, i.icons_width, i.icons_height, u.username, u.user_id, u2.username as user2, u2.user_id as id2 FROM " . TOPICS_TABLE . " t, " . ICONS_TABLE . " i, " . USERS_TABLE . " u, " . USERS_TABLE . " u2 WHERE t.forum_id = $forum_id AND i.icons_id = t.topic_icon @@ -395,6 +369,14 @@ $sql = "SELECT t.*, i.icons_url, i.icons_width, i.icons_height, u.username, u.us AND u2.user_id = t.topic_last_poster_id $limit_topics_time ORDER BY t.topic_type DESC, $sort_order + LIMIT $start, " . $board_config['topics_per_page'];*/ +$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2 + FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . USERS_TABLE . " u2 + WHERE t.forum_id = $forum_id + AND u.user_id = t.topic_poster + AND u2.user_id = t.topic_last_poster_id + $limit_topics_time + ORDER BY t.topic_type DESC, $sort_order LIMIT $start, " . $board_config['topics_per_page']; $result = $db->sql_query($sql); @@ -405,26 +387,22 @@ while( $row = $db->sql_fetchrow($result) ) } $db->sql_freeresult($result); -// // Okay, lets dump out the page ... -// if ( $total_topics ) { for($i = 0; $i < $total_topics; $i++) { $topic_id = $topic_rowset[$i]['topic_id']; - // // Type and folder - // $topic_type = ''; if ( $topic_rowset[$i]['topic_status'] == TOPIC_MOVED ) { - $topic_type = $lang['Topic_Moved'] . ' '; + $topic_type = $user->lang['Topic_Moved'] . ' '; $topic_id = $topic_rowset[$i]['topic_moved_id']; - $folder_image = $theme['folder']; - $folder_alt = $lang['Topic_Moved']; + $folder_image = 'folder'; + $folder_alt = 'Topic_Moved'; $newest_post_img = ''; } else @@ -432,77 +410,55 @@ if ( $total_topics ) switch ( $topic_rowset[$i]['topic_type'] ) { case POST_ANNOUNCE: - $topic_type = $lang['Topic_Announcement'] . ' '; - $folder = $theme['folder_announce']; - $folder_new = $theme['folder_announce_new']; + $topic_type = $user->lang['Topic_Announcement'] . ' '; + $folder = 'folder_announce'; + $folder_new = 'folder_announce_new'; break; case POST_STICKY: - $topic_type = $lang['Topic_Sticky'] . ' '; - $folder = $theme['folder_sticky']; - $folder_new = $theme['folder_sticky_new']; + $topic_type = $user->lang['Topic_Sticky'] . ' '; + $folder = 'folder_sticky'; + $folder_new = 'folder_sticky_new'; break; case TOPIC_LOCKED: - $folder = $theme['folder_locked']; - $folder_new = $theme['folder_locked_new']; + $folder = 'folder_locked'; + $folder_new = 'folder_locked_new'; break; default: if ( $replies >= $board_config['hot_threshold'] ) { - $folder = $theme['folder_hot']; - $folder_new = $theme['folder_hot_new']; + $folder = 'folder_hot'; + $folder_new = 'folder_hot_new'; } else { - $folder = $theme['folder']; - $folder_new = $theme['folder_new']; + $folder = 'folder'; + $folder_new = 'folder_new'; } break; } $unread_topic = false; - if ( $userdata['user_id'] && $topic_rowset[$i]['topic_last_post_time'] > $userdata['user_lastvisit'] ) + if ( $user->data['user_id'] && $topic_rowset[$i]['topic_last_post_time'] > $user->data['user_lastvisit'] ) { $unread_topic = true; - if ( isset($_COOKIE[$board_config['cookie_name'] . '_f_all']) ) - { - if ( $_COOKIE[$board_config['cookie_name'] . '_f_all'] > $topic_rowset[$i]['topic_last_post_time'] ) - { - $unread_topic = false; - } - } - - if ( isset($mark_topics[$forum_id]) || isset($mark_forums[$forum_id][$topic_id]) ) - { - if ( $mark_forums[$forum_id] > $topic_rowset[$i]['topic_last_post_time'] || !$mark_topics[$forum_id][$topic_id] ) - { - $unread_topic = false; - } - } - - if ( !isset($mark_topics[$forum_id][$topic_id]) ) - { - $mark_topics[$forum_id][$topic_id] = $topic_rowset[$i]['topic_last_post_time']; - } } - $newest_post_img = ( $unread_topic ) ? '' . create_img($theme['goto_post_newest'], $lang['View_newest_post']) . ' ' : ''; + $newest_post_img = ( $unread_topic ) ? '' . $user->img('goto_post_newest', 'View_newest_post') . ' ' : ''; $folder_img = ( $unread_topic ) ? $folder_new : $folder; - $folder_alt = ( $unread_topic ) ? $lang['New_posts'] : ( ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'] ); + $folder_alt = ( $unread_topic ) ? 'New_posts' : ( ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? 'Topic_locked' : 'No_new_posts' ); } if ( $topic_rowset[$i]['topic_vote'] ) { - $topic_type .= $lang['Topic_Poll'] . ' '; + $topic_type .= $user->lang['Topic_Poll'] . ' '; } - // // Goto message - // if ( ( $replies + 1 ) > $board_config['posts_per_page'] ) { $total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] ); - $goto_page = ' [ ' . $lang['Goto_page'] . '' . $lang['Goto_page'] . ': '; + $goto_page = ' [ ' . $user->lang['Goto_page'] . '' . $user->lang['Goto_page'] . ': '; $times = 1; for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page']) @@ -527,13 +483,11 @@ if ( $total_topics ) $goto_page = ''; } - // // Generate all the URIs ... - // $view_topic_url = 'viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&t=' . $topic_id; $topic_author = ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '' : ''; - $topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? $topic_rowset[$i]['username'] : ( ( $topic_rowset[$i]['topic_first_poster_name'] != '' ) ? $topic_rowset[$i]['topic_first_poster_name'] : $lang['Guest'] ); + $topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? $topic_rowset[$i]['username'] : ( ( $topic_rowset[$i]['topic_first_poster_name'] != '' ) ? $topic_rowset[$i]['topic_first_poster_name'] : $user->lang['Guest'] ); $topic_author .= ( $topic_rowset[$i]['user_id'] ) ? '' : ''; @@ -541,51 +495,49 @@ if ( $total_topics ) $last_post_time = $user->format_date($topic_rowset[$i]['topic_last_post_time']); - $last_post_author = ( !$topic_rowset[$i]['id2'] ) ? ( ( $topic_rowset[$i]['topic_last_poster_name'] != '' ) ? $topic_rowset[$i]['topic_last_poster_name'] . ' ' : $lang['Guest'] . ' ' ) : '' . $topic_rowset[$i]['user2'] . ''; + $last_post_author = ( !$topic_rowset[$i]['id2'] ) ? ( ( $topic_rowset[$i]['topic_last_poster_name'] != '' ) ? $topic_rowset[$i]['topic_last_poster_name'] . ' ' : $user->lang['Guest'] . ' ' ) : '' . $topic_rowset[$i]['user2'] . ''; - $last_post_url = '' . create_img($theme['goto_post_latest'], $lang['View_latest_post']) . ''; + $last_post_url = '' . $user->img('goto_post_latest', 'View_latest_post') . ''; // // Send vars to template // $template->assign_block_vars('topicrow', array( - 'FORUM_ID' => $forum_id, - 'TOPIC_ID' => $topic_id, - 'TOPIC_FOLDER_IMG' => create_img($folder_img, $folder_alt), - 'TOPIC_AUTHOR' => $topic_author, - 'NEWEST_POST_IMG' => $newest_post_img, - 'FIRST_POST_TIME' => $first_post_time, - 'LAST_POST_TIME' => $last_post_time, - 'LAST_POST_AUTHOR' => $last_post_author, - 'LAST_POST_IMG' => $last_post_url, - 'GOTO_PAGE' => $goto_page, - 'REPLIES' => $topic_rowset[$i]['topic_replies'], - 'VIEWS' => $topic_rowset[$i]['topic_views'], - 'TOPIC_TITLE' => ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'], - 'TOPIC_TYPE' => $topic_type, - 'TOPIC_ICON' => ( !empty($topic_rowset[$i]['icons_url']) ) ? '' : '', - 'TOPIC_RATING' => ( !empty($topic_rowset[$i]['topic_rating']) ) ? '' . $topic_rowset[$i]['topic_rating'] . '' : '', + 'FORUM_ID' => $forum_id, + 'TOPIC_ID' => $topic_id, + 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), + 'TOPIC_AUTHOR' => $topic_author, + 'NEWEST_POST_IMG' => $newest_post_img, + 'FIRST_POST_TIME' => $first_post_time, + 'LAST_POST_TIME' => $last_post_time, + 'LAST_POST_AUTHOR' => $last_post_author, + 'LAST_POST_IMG' => $last_post_url, + 'GOTO_PAGE' => $goto_page, + 'REPLIES' => $topic_rowset[$i]['topic_replies'], + 'VIEWS' => $topic_rowset[$i]['topic_views'], + 'TOPIC_TITLE' => ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'], + 'TOPIC_TYPE' => $topic_type, + 'TOPIC_ICON' => ( !empty($topic_rowset[$i]['icons_url']) ) ? '' : '', + 'TOPIC_RATING' => ( !empty($topic_rowset[$i]['topic_rating']) ) ? '' . $topic_rowset[$i]['topic_rating'] . '' : '', - 'S_ROW_COUNT' => $i, + 'S_ROW_COUNT' => $i, - 'U_VIEW_TOPIC' => $view_topic_url) + 'U_VIEW_TOPIC' => $view_topic_url) ); } } -if ( $userdata['user_id'] ) +if ($user->data['user_id'] != ANONYMOUS) { setcookie($board_config['cookie_name'] . '_t', serialize($mark_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); } -// // Dump out the page header and load viewforum template -// -$page_title = $lang['View_forum'] . ' - ' . $forum_data['forum_name']; +$page_title = $user->lang['View_forum'] . ' - ' . $forum_data['forum_name']; $nav_links['up'] = array( 'url' => 'index.' . $phpEx . $SID, - 'title' => sprintf($lang['Forum_Index'], $board_config['sitename']) + 'title' => sprintf($user->lang['Forum_Index'], $board_config['sitename']) ); include($phpbb_root_path . 'includes/page_header.'.$phpEx); diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index b3952d7d88..41eee0cb0d 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -25,9 +25,9 @@ include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); // Start session management -$userdata = $session->start(); -$auth->acl($userdata); -$user = new user($userdata); +$user->start(); +$user->setup(); +$auth->acl($user->data); // End session management // @@ -100,7 +100,7 @@ while ( $row = $db->sql_fetchrow($result) ) { if ( $row['session_ip'] != $prev_ip ) { - $username = $lang['Guest']; + $username = $user->lang['Guest']; $view_online = true; $guest_users++; @@ -118,7 +118,7 @@ while ( $row = $db->sql_fetchrow($result) ) switch ( $on_page[1] ) { case 'index': - $location = $lang['Forum_index']; + $location = $user->lang['Forum_index']; $location_url = "index.$phpEx$SID"; break; @@ -134,10 +134,10 @@ while ( $row = $db->sql_fetchrow($result) ) switch ( $on_page[1] ) { case 'posting': - $location = sprintf($lang['Posting_message'], $forum_data[$forum_id]); + $location = sprintf($user->lang['Posting_message'], $forum_data[$forum_id]); break; case 'viewtopic': - $location = sprintf($lang['Reading_topic'], $forum_data[$forum_id]); + $location = sprintf($user->lang['Reading_topic'], $forum_data[$forum_id]); break; case 'viewforum': $location .= $forum_data[$forum_id]; @@ -147,51 +147,51 @@ while ( $row = $db->sql_fetchrow($result) ) } else { - $location = $lang['Forum_index']; + $location = $user->lang['Forum_index']; $location_url = "index.$phpEx$SID"; } break; case 'search': - $location = $lang['Searching_forums']; + $location = $user->lang['Searching_forums']; $location_url = "search.$phpEx$SID"; break; case 'profile': - $location = $lang['Viewing_profile']; + $location = $user->lang['Viewing_profile']; $location_url = "index.$phpEx$SID"; break; case 'faq': - $location = $lang['Viewing_FAQ']; + $location = $user->lang['Viewing_FAQ']; $location_url = "faq.$phpEx$SID"; break; case 'viewonline': - $location = $lang['Viewing_online']; + $location = $user->lang['Viewing_online']; $location_url = "viewonline.$phpEx$SID"; break; case 'memberslist': - $location = $lang['Viewing_member_list']; + $location = $user->lang['Viewing_member_list']; $location_url = "memberlist.$phpEx$SID"; break; default: - $location = $lang['Forum_index']; + $location = $user->lang['Forum_index']; $location_url = "index.$phpEx$SID"; break; } $template->assign_block_vars($which_row, array( - 'USERNAME' => $username, - 'LASTUPDATE' => $user->format_date($row['session_time']), - 'FORUM_LOCATION' => $location, + 'USERNAME' => $username, + 'LASTUPDATE' => $user->format_date($row['session_time']), + 'FORUM_LOCATION'=> $location, - 'S_ROW_COUNT' => $$which_counter, + 'S_ROW_COUNT' => $$which_counter, - 'U_USER_PROFILE' => "profile.$phpEx$SID&mode=viewprofile&u=" . $user_id, - 'U_FORUM_LOCATION' => $location_url) + 'U_USER_PROFILE' => "profile.$phpEx$SID&mode=viewprofile&u=" . $user_id, + 'U_FORUM_LOCATION' => $location_url) ); $$which_counter++; @@ -200,57 +200,59 @@ while ( $row = $db->sql_fetchrow($result) ) if( $registered_users == 0 ) { - $l_r_user_s = $lang['Reg_users_zero_online']; + $l_r_user_s = $user->lang['Reg_users_zero_online']; } else if( $registered_users == 1 ) { - $l_r_user_s = $lang['Reg_user_online']; + $l_r_user_s = $user->lang['Reg_user_online']; } else { - $l_r_user_s = $lang['Reg_users_online']; + $l_r_user_s = $user->lang['Reg_users_online']; } if( $hidden_users == 0 ) { - $l_h_user_s = $lang['Hidden_users_zero_online']; + $l_h_user_s = $user->lang['Hidden_users_zero_online']; } else if( $hidden_users == 1 ) { - $l_h_user_s = $lang['Hidden_user_online']; + $l_h_user_s = $user->lang['Hidden_user_online']; } else { - $l_h_user_s = $lang['Hidden_users_online']; + $l_h_user_s = $user->lang['Hidden_users_online']; } if( $guest_users == 0 ) { - $l_g_user_s = $lang['Guest_users_zero_online']; + $l_g_user_s = $user->lang['Guest_users_zero_online']; } else if( $guest_users == 1 ) { - $l_g_user_s = $lang['Guest_user_online']; + $l_g_user_s = $user->lang['Guest_user_online']; } else { - $l_g_user_s = $lang['Guest_users_online']; + $l_g_user_s = $user->lang['Guest_users_online']; } $template->assign_vars(array( - 'TOTAL_REGISTERED_USERS_ONLINE' => sprintf($l_r_user_s, $registered_users) . sprintf($l_h_user_s, $hidden_users), - 'TOTAL_GUEST_USERS_ONLINE' => sprintf($l_g_user_s, $guest_users), + 'TOTAL_REGISTERED_USERS_ONLINE' => sprintf($l_r_user_s, $registered_users) . sprintf($l_h_user_s, $hidden_users), + 'TOTAL_GUEST_USERS_ONLINE' => sprintf($l_g_user_s, $guest_users), - 'L_WHOSONLINE' => $lang['Who_is_online'], - 'L_ONLINE_EXPLAIN' => $lang['Online_explain'], - 'L_USERNAME' => $lang['Username'], - 'L_FORUM_LOCATION' => $lang['Forum_Location'], - 'L_LAST_UPDATE' => $lang['Last_updated'], - 'L_NO_GUESTS_BROWSING' => $lang['No_users_browsing'], - 'L_NO_REGISTERED_USERS_BROWSING' => $lang['No_users_browsing']) + 'META' => '', + + 'L_WHOSONLINE' => $user->lang['Who_is_online'], + 'L_ONLINE_EXPLAIN' => $user->lang['Online_explain'], + 'L_USERNAME' => $user->lang['Username'], + 'L_FORUM_LOCATION' => $user->lang['Forum_Location'], + 'L_LAST_UPDATE' => $user->lang['Last_updated'], + 'L_NO_GUESTS_BROWSING' => $user->lang['No_users_browsing'], + 'L_NO_REGISTERED_USERS_BROWSING' => $user->lang['No_users_browsing']) ); -$page_title = $lang['Who_is_online']; +$page_title = $user->lang['Who_is_online']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index b74ebe7b85..467af5a736 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -100,20 +100,16 @@ if (isset($_GET['view']) && empty($post_id)) } } -// // Start session management -// -$userdata = $session->start(); -// +$user->start(); // End session management -// -if ( $userdata['user_id'] && isset($_POST['rating']) ) +if ( $user->data['user_id'] && isset($_POST['rating']) ) { $sql = "SELECT rating FROM " . TOPICS_RATINGS_TABLE . " WHERE topic_id = $topic_id - AND user_id = " . $userdata['user_id']; + AND user_id = " . $user->data['user_id']; $result = $db->sql_query($sql); $rating = ( $row = $db->sql_fetchrow($result) ) ? $row['rating'] : ''; @@ -125,7 +121,7 @@ if ( $userdata['user_id'] && isset($_POST['rating']) ) { $new_rating = intval($_POST['rating']); - $sql = ( $rating != '' ) ? "UPDATE " . TOPICS_RATING_TABLE . " SET rating = $new_rating WHERE user_id = " . $userdata['user_id'] . " AND topic_id = $topic_id" : "INSERT INTO " . TOPICS_RATING_TABLE . " (topic_id, user_id, rating) VALUES ($topic_id, " . $userdata['user_id'] . ", $new_rating)"; + $sql = ( $rating != '' ) ? "UPDATE " . TOPICS_RATING_TABLE . " SET rating = $new_rating WHERE user_id = " . $user->data['user_id'] . " AND topic_id = $topic_id" : "INSERT INTO " . TOPICS_RATING_TABLE . " (topic_id, user_id, rating) VALUES ($topic_id, " . $user->data['user_id'] . ", $new_rating)"; } } @@ -152,8 +148,8 @@ if ( !(extract($db->sql_fetchrow($result))) ) } // Configure style, language, etc. -$user = new user($userdata, false, $forum_style); -$auth->acl($userdata, $forum_id, array('f_read', 'f_post', 'f_reply', 'f_attach')); +$user->setup(false, $forum_style); +$auth->acl($user->data, $forum_id); // End configure // @@ -161,14 +157,14 @@ $auth->acl($userdata, $forum_id, array('f_read', 'f_post', 'f_reply', 'f_attach' // if ( !$auth->acl_get('f_read', $forum_id) ) { - if ( $userdata['user_id'] ) + if ( $user->data['user_id'] ) { $redirect = ( isset($post_id) ) ? "p=$post_id" : "t=$topic_id"; $redirect .= ( isset($start) ) ? "&start=$start" : ''; redirect('login.' . $phpEx . $SID . '&redirect=viewtopic.' . $phpEx . '&' . $redirect); } - message_die(MESSAGE, $lang['Sorry_auth_read']); + message_die(MESSAGE, $user->lang['Sorry_auth_read']); } // // End auth check @@ -181,13 +177,13 @@ if ( !empty($post_id) ) $s_watching_topic = ''; $s_watching_topic_img = ''; -watch_topic_forum('topic', $s_watching_topic, $s_watching_topic_img, $userdata['user_id'], $topic_id); +watch_topic_forum('topic', $s_watching_topic, $s_watching_topic_img, $user->data['user_id'], $topic_id); // // Post ordering options // -$previous_days = array(0 => $lang['All_Posts'], 1 => $lang['1_Day'], 7 => $lang['7_Days'], 14 => $lang['2_Weeks'], 30 => $lang['1_Month'], 90 => $lang['3_Months'], 180 => $lang['6_Months'], 364 => $lang['1_Year']); -$sort_by_text = array('a' => $lang['Author'], 't' => $lang['Post_time'], 's' => $lang['Subject']); +$previous_days = array(0 => $user->lang['All_Posts'], 1 => $user->lang['1_Day'], 7 => $user->lang['7_Days'], 14 => $user->lang['2_Weeks'], 30 => $user->lang['1_Month'], 90 => $user->lang['3_Months'], 180 => $user->lang['6_Months'], 364 => $user->lang['1_Year']); +$sort_by_text = array('a' => $user->lang['Author'], 't' => $user->lang['Post_time'], 's' => $user->lang['Subject']); $sort_by = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'pt.post_subject'); if ( isset($_POST['sort']) ) @@ -245,7 +241,7 @@ foreach ( $sort_by_text as $key => $text ) $select_sort .= ''; $select_sort_dir = ''; $select_post_days = '
{S_WATCH_TOPIC}
{L_RATE_TOPIC}: {S_SELECT_RATING} 
{S_AUTH_LIST}
{L_QUICK_MOD}: {S_TOPIC_MOD}