diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-10-25 23:21:12 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-10-25 23:21:12 +0000 |
commit | c976663e966fbd6ed4b6a960aa0718e2c96843ce (patch) | |
tree | 2ef5e6fb92090a0b8813ada9971ea8705462b456 /phpBB/includes | |
parent | cc9373fe66f93503b7dab9ccbb64cdc7f7301d8d (diff) | |
download | forums-c976663e966fbd6ed4b6a960aa0718e2c96843ce.tar forums-c976663e966fbd6ed4b6a960aa0718e2c96843ce.tar.gz forums-c976663e966fbd6ed4b6a960aa0718e2c96843ce.tar.bz2 forums-c976663e966fbd6ed4b6a960aa0718e2c96843ce.tar.xz forums-c976663e966fbd6ed4b6a960aa0718e2c96843ce.zip |
Altered various language constructs + new quote changes for PM + altered pagination
git-svn-id: file:///svn/phpbb/trunk@1247 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions.php | 167 | ||||
-rw-r--r-- | phpBB/includes/page_header.php | 36 |
2 files changed, 102 insertions, 101 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 66b72a986b..237bd48982 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -29,18 +29,18 @@ function get_db_stat($mode) { case 'postcount': $sql = "SELECT COUNT(post_id) AS total - FROM ".POSTS_TABLE; + FROM " . POSTS_TABLE; break; case 'usercount': $sql = "SELECT COUNT(user_id) AS total - FROM ". USERS_TABLE ." + FROM " . USERS_TABLE . " WHERE user_id <> " . ANONYMOUS; break; case 'newestuser': $sql = "SELECT user_id, username - FROM ".USERS_TABLE." + FROM " . USERS_TABLE . " WHERE user_id <> " . ANONYMOUS . " ORDER BY user_id DESC LIMIT 1"; @@ -48,7 +48,7 @@ function get_db_stat($mode) case 'topiccount': $sql = "SELECT SUM(forum_topics) AS total - FROM ".FORUMS_TABLE; + FROM " . FORUMS_TABLE; break; } @@ -82,15 +82,15 @@ function get_userdata_from_id($userid) message_die(GENERAL_ERROR, "Couldn't obtain userdata for id", "", __LINE__, __FILE__, $sql); } - if($db->sql_numrows($result)) - { - $myrow = $db->sql_fetchrowset($result); - return($myrow[0]); - } - else + if( !$db->sql_numrows($result) ) { message_die(GENERAL_ERROR, "No userdata for this user_id", "", __LINE__, __FILE__, $sql); } + + $row = $db->sql_fetchrow($result); + + return($row); + } function get_userdata($username) { @@ -106,15 +106,14 @@ function get_userdata($username) { message_die(GENERAL_ERROR, "Tried obtaining data for a non-existent user", "", __LINE__, __FILE__, $sql); } - if($db->sql_numrows($result)) - { - $myrow = $db->sql_fetchrowset($result); - return($myrow[0]); - } - else + if( !$db->sql_numrows($result) ) { message_die(GENERAL_ERROR, "Tried obtaining data for a non-existent user", "", __LINE__, __FILE__, $sql); } + + $row = $db->sql_fetchrow($result); + + return($row); } function make_jumpbox($match_forum_id = 0) @@ -226,21 +225,15 @@ function make_forum_select($box_name) // Initialise user settings on page load function init_userprefs($userdata) { - global $board_config, $theme, $images, $template, $lang, $phpEx, $phpbb_root_path; + global $board_config, $theme, $images; + global $template, $lang, $phpEx, $phpbb_root_path; -// if( !defined("IN_ADMIN") ) -// { - if( !$board_config['override_user_style'] ) + if( !$board_config['override_user_style'] ) + { + if( $userdata['user_id'] != ANONYMOUS && isset($userdata['user_style']) ) { - if( $userdata['user_id'] != ANONYMOUS && isset($userdata['user_style']) ) - { - $theme = setup_style($userdata['user_style']); - if( !$theme ) - { - $theme = setup_style($board_config['default_style']); - } - } - else + $theme = setup_style($userdata['user_style']); + if( !$theme ) { $theme = setup_style($board_config['default_style']); } @@ -249,11 +242,11 @@ function init_userprefs($userdata) { $theme = setup_style($board_config['default_style']); } -// } -// else -// { -// $theme = setup_style($board_config['default_admin_style']); -// } + } + else + { + $theme = setup_style($board_config['default_style']); + } if( $userdata['user_id'] != ANONYMOUS ) { @@ -262,24 +255,24 @@ function init_userprefs($userdata) $board_config['default_lang'] = $userdata['user_lang']; } - if(!empty($userdata['user_dateformat'])) + if( !empty($userdata['user_dateformat']) ) { $board_config['default_dateformat'] = $userdata['user_dateformat']; } - if(isset($userdata['user_timezone'])) + if( isset($userdata['user_timezone']) ) { $board_config['board_timezone'] = $userdata['user_timezone']; } } - if(file_exists("language/lang_".$board_config['default_lang']."/lang_main.".$phpEx) ) + if( file_exists($phpbb_root_path . "language/lang_" . $board_config['default_lang'] . "/lang_main.".$phpEx) ) { - include($phpbb_root_path . 'language/lang_'.$board_config['default_lang'].'/lang_main.'.$phpEx); + include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx); } else { - include($phpbb_root_path . 'language/lang_english/lang_main.'.$phpEx); + include($phpbb_root_path . 'language/lang_english/lang_main.' . $phpEx); } return; @@ -302,8 +295,6 @@ function setup_style($style) message_die(CRITICAL_ERROR, "Couldn't get theme data for themes_id=$style."); } -// $template_path = ( defined('IN_ADMIN') ) ? 'admin/templates/' : 'templates/' ; -// $template_name = ( defined('IN_ADMIN') ) ? $board_config['board_admin_template'] : $myrow['template_name'] ; $template_path = 'templates/' ; $template_name = $row['template_name'] ; @@ -349,16 +340,12 @@ function encode_ip($dotquad_ip) { $ip_sep = explode(".", $dotquad_ip); return (sprintf("%02x%02x%02x%02x", $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3])); - -// return (( $ip_sep[0] * 0xFFFFFF + $ip_sep[0] ) + ( $ip_sep[1] * 0xFFFF + $ip_sep[1] ) + ( $ip_sep[2] * 0xFF + $ip_sep[2] ) + ( $ip_sep[3] ) ); } function decode_ip($int_ip) { $hexipbang = explode(".",chunk_split($int_ip, 2, ".")); return hexdec($hexipbang[0]).".".hexdec($hexipbang[1]).".".hexdec($hexipbang[2]).".".hexdec($hexipbang[3]); - -// return sprintf( "%d.%d.%d.%d", ( ( $int_ip >> 24 ) & 0xFF ), ( ( $int_ip >> 16 ) & 0xFF ), ( ( $int_ip >> 8 ) & 0xFF ), ( ( $int_ip ) & 0xFF ) ); } // @@ -387,81 +374,93 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add global $lang; $total_pages = ceil($num_items/$per_page); - if($total_pages == 1) + + if( $total_pages == 1 ) { return ""; } - $on_page = floor($start_item/$per_page) + 1; + $on_page = floor($start_item / $per_page) + 1; $page_string = ""; - $this_block_start = ($on_page < 10) ? 1 : floor($on_page/10) * 10; - $this_block_end = ($on_page < 10) ? 9 : $this_block_start + 9; - if($this_block_end > $total_pages) + if( $total_pages > 8 ) { - $this_block_end = $total_pages; - } - for($i = $this_block_start; $i <= $this_block_end; $i++) - { - $page_string .= ($i == $on_page) ? "<b>$i</b>" : "<a href=\"".append_sid($base_url . "&start=" . (($i - 1) * $per_page)) . "\">$i</a>"; - if($i < $this_block_end) + $init_page_max = ( $total_pages > 2 ) ? 2 : $total_pages; + + for($i = 1; $i < $init_page_max + 1; $i++) { - $page_string .= ", "; + $page_string .= ($i == $on_page) ? "<b>$i</b>" : "<a href=\"" . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page )) . "\">$i</a>"; + if( $i < $init_page_max ) + { + $page_string .= ", "; + } } - } - if($this_block_start > 1) - { - $page_string_prepend = ""; - for($i = 0; $i < $this_block_start; $i += 10) + if( $total_pages > 2 ) { - $page_string_prepend .= "<a href=\"" . append_sid($base_url . "&start=" . ($i * $per_page)) . "\">" . ( ($i == 0) ? ($i + 1) : $i) . " - " . ($i + 9) . "</a>, "; - } + if( $on_page > 1 && $on_page < $total_pages ) + { + $page_string .= ( $on_page > 4 ) ? " ... " : ", "; - $page_string = $page_string_prepend . $page_string; - } + $init_page_min = ( $on_page > 3 ) ? $on_page : 4; + $init_page_max = ( $on_page < $total_pages - 3 ) ? $on_page : $total_pages - 3; - if($this_block_end < $total_pages) - { - $page_string_append = ", "; + for($i = $init_page_min - 1; $i < $init_page_max + 2; $i++) + { + $page_string .= ($i == $on_page) ? "<b>$i</b>" : "<a href=\"" . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page )) . "\">$i</a>"; + if( $i < $init_page_max + 1 ) + { + $page_string .= ", "; + } + } - if(!($total_pages%10)) - { - $page_url = append_sid($base_url."&start=".( ( ($this_block_end + 1) * $per_page ) - $per_page ) ); - $page_string_append .= "<a href=\"$page_url\">$total_pages</a>"; - } - else - { + $page_string .= ( $on_page < $total_pages - 3 ) ? " ... " : ", "; + } + else + { + $page_string .= " ... "; + } - for($i = $this_block_end + 1; $i < $total_pages; $i += 10) + for($i = $total_pages - 1; $i < $total_pages + 1; $i++) { - $page_string_append .= "<a href=\"" . append_sid($base_url . "&start=" . (($i * $per_page) - $per_page)) . "\">" . ( ($i == 0) ? ($i + 1) : $i) . " - " . ((($i + 9) < $total_pages) ? ($i + 9) : $total_pages) . "</a>"; - if($i < $total_pages - 10) + $page_string .= ($i == $on_page) ? "<b>$i</b>" : "<a href=\"" . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page )) . "\">$i</a>"; + if( $i < $total_pages ) { - $page_string_append .= ", "; + $page_string .= ", "; } } } - $page_string .= $page_string_append; + } + else + { + for($i = 1; $i < $total_pages + 1; $i++) + { + $page_string .= ($i == $on_page) ? "<b>$i</b>" : "<a href=\"" . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page )) . "\">$i</a>"; + if( $i < $total_pages ) + { + $page_string .= ", "; + } + } } - if($add_prevnext_text) + if( $add_prevnext_text ) { if($on_page > 1) { $page_string = " <a href=\"" . append_sid($base_url . "&start=" . (($on_page - 2) * $per_page)) . "\">" . $lang['Previous'] . "</a> " . $page_string; } + if($on_page < $total_pages) { $page_string .= " <a href=\"" . append_sid($base_url . "&start=" . ($on_page * $per_page)) . "\">" . $lang['Next'] . "</a>"; } - $page_string = $lang['Goto_page'] . ": " . $page_string; - } + $page_string = $lang['Goto_page'] . " " . $page_string; + return $page_string; } diff --git a/phpBB/includes/page_header.php b/phpBB/includes/page_header.php index 578639bee1..0876397e25 100644 --- a/phpBB/includes/page_header.php +++ b/phpBB/includes/page_header.php @@ -142,12 +142,11 @@ for($i = 0; $i < count($userlist_ary); $i++) } } } +$online_userlist = $lang['Registered_users'] . " " . $online_userlist; -$l_g_user_s = ($guests_online == 1) ? $lang['User'] : $lang['Users']; -$l_h_user_s = ($logged_hidden_online == 1) ? $lang['User'] : $lang['Users']; -$l_r_user_s = ($logged_visible_online == 1) ? $lang['User'] : $lang['Users']; -$l_is_are = ($logged_visible_online == 1) ? $lang['is'] : $lang['are']; -$online_userlist = ($logged_visible_online > 0) ? $lang['Registered'] . " $l_r_user_s: " . $online_userlist : $lang['Registered'] . " $l_r_user_s: " . $lang['None']; +$total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online; + +$l_online_users = ( $total_online_users == 1 ) ? sprintf($lang['Online_user'], $total_online_users, $logged_visible_online, $logged_hidden_online, $guests_online) : sprintf($lang['Online_users'], $total_online_users, $logged_visible_online, $logged_hidden_online, $guests_online); // // Obtain number of new private messages @@ -168,8 +167,8 @@ if( $userdata['session_logged_in'] ) { $new_pm_messages = $pm_result['new_messages']; - $l_message_new = ( $new_pm_messages == 1 ) ? $lang['message'] : $lang['messages']; - $l_privmsgs_text = $lang['You_have'] . " $new_pm_messages " . $lang['new'] . " $l_message_new"; + $l_message_new = ( $new_pm_messages == 1 ) ? $lang['New_pm'] : $lang['New_pms']; + $l_privmsgs_text = sprintf($l_message_new, $new_pm_messages); } else { @@ -189,17 +188,16 @@ else $template->assign_vars(array( "SITENAME" => $board_config['sitename'], "PAGE_TITLE" => $page_title, - "TOTAL_USERS_ONLINE" => $lang['There'] . " $l_is_are $logged_visible_online " . $lang['Registered'] . " $l_r_user_s, $logged_hidden_online " . $lang['Hidden'] . " $l_h_user_s ". $lang['and'] . " $guests_online " . $lang['Guest'] . " $l_g_user_s " . $lang['online'], + "TOTAL_USERS_ONLINE" => $l_online_users, "LOGGED_IN_USER_LIST" => $online_userlist, "PRIVATE_MESSAGE_INFO" => $l_privmsgs_text, "PRIVATE_MESSAGE_COUNT" => $new_pm_messages_session, - "LAST_VISIT_DATE" => $s_last_visit, + "LAST_VISIT_DATE" => $s_last_visit, "L_USERNAME" => $lang['Username'], "L_PASSWORD" => $lang['Password'], "L_LOGIN" => $lang['Login'], "L_LOG_ME_IN" => $lang['Log_me_in'], - "L_WELCOMETO" => $lang['Welcome_to'], "L_INDEX" => $lang['Forum_Index'], "L_REGISTER" => $lang['Register'], "L_PROFILE" => $lang['Profile'], @@ -216,11 +214,13 @@ $template->assign_vars(array( "L_POSTS" => $lang['Posts'], "L_LASTPOST" => $lang['Last_Post'], "L_MODERATOR" => $lang['Moderator'], - "L_NONEWPOSTS" => $lang['No_new_posts'], - "L_NEWPOSTS" => $lang['New_posts'], - "L_NONEWPOSTS_HOT" => $lang['No_new_posts_hot'], - "L_NEWPOSTS_HOT" => $lang['New_posts_hot'], - "L_TOPIC_IS_LOCKED" => $lang['Topic_is_locked'], + "L_NO_NEW_POSTS" => $lang['No_new_posts'], + "L_NEW_POSTS" => $lang['New_posts'], + "L_NO_NEW_POSTS_HOT" => $lang['No_new_posts_hot'], + "L_NEW_POSTS_HOT" => $lang['New_posts_hot'], + "L_TOPIC_IS_LOCKED" => $lang['Topic_is_locked'], + "L_ANNOUNCEMENT" => $lang['Post_Announcement'], + "L_STICKY" => $lang['Post_Sticky'], "L_POSTED" => $lang['Posted'], "L_JOINED" => $lang['Joined'], "L_AUTO_LOGIN" => $lang['Log_me_in'], @@ -242,6 +242,8 @@ $template->assign_vars(array( "U_MEMBERSLIST" => append_sid("memberlist.".$phpEx), "U_GROUP_CP" => append_sid("groupcp.".$phpEx), + "S_CONTENT_DIRECTION" => $lang['DIRECTION'], + "S_CONTENT_ENCODING" => $lang['ENCODING'], "S_TIMEZONE" => $lang['All_times'] . " " . $lang[$board_config['board_timezone']], "S_LOGIN_ACTION" => append_sid("login.$phpEx"), "S_CURRENT_TIME" => create_date($board_config['default_dateformat'], time(), $board_config['board_timezone']), @@ -291,11 +293,11 @@ $template->assign_vars(array( // if( !$userdata['session_logged_in'] ) { - $template->assign_block_vars("user_logged_out", array()); + $template->assign_block_vars("switch_user_logged_out", array()); } else { - $template->assign_block_vars("user_logged_in", array()); + $template->assign_block_vars("switch_user_logged_in", array()); } header ("Cache-Control: no-store, no-cache, must-revalidate"); |