diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index 9993b4bb5e..5c55fda67c 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -14,7 +14,7 @@ class compress { var $fp = 0; - + function add_file($src, $src_rm_prefix = '', $src_add_prefix = '', $skip_files = '') { global $phpbb_root_path; @@ -63,7 +63,7 @@ class compress $path = (substr($path, 0, 1) == '/') ? substr($path, 1) : $path; $path = ($path && substr($path, -1) != '/') ? $path . '/' : $path; - $this->data("$src_path$path", '', filemtime("$phpbb_root_path$path"), true); + $this->data("$src_path$path", '', filemtime("$phpbb_root_path$src_path$path"), true); } foreach ($file_ary as $file) @@ -73,7 +73,7 @@ class compress continue; } - $this->data("$src_path$path$file", implode('', file("$phpbb_root_path$src$path$file")), filemtime("$phpbb_root_path$src$path$file"), false); + $this->data("$src_path$path$file", implode('', file("$phpbb_root_path$src_path$path$file")), filemtime("$phpbb_root_path$src_path$path$file"), false); } } @@ -374,6 +374,24 @@ class compress_zip extends compress pack('V', $this->datasec_len) . // offset to start of central dir "\x00\x00"; // .zip file comment length } + + function download($filename) + { + global $phpbb_root_path; + + $mimetype = 'application/zip'; + + header('Pragma: no-cache'); + header("Content-Type: $mimetype; name=\"$filename.zip\""); + header("Content-disposition: attachment; filename=$filename.zip"); + + $fp = fopen("{$phpbb_root_path}store/$filename.zip", 'rb'); + while ($buffer = fread($fp, 1024)) + { + echo $buffer; + } + fclose($fp); + } } // Tar/tar.gz compression routine @@ -384,6 +402,7 @@ class compress_tar extends compress var $isbz = false; var $filename = ''; var $mode = ''; + var $type = ''; function compress_tar($mode, $file, $type = '') { @@ -393,6 +412,7 @@ class compress_tar extends compress $this->mode = &$mode; $this->file = &$file; + $this->type = &$type; $this->open(); } @@ -529,6 +549,7 @@ class compress_tar extends compress $header .= pack("x247"); // Checksum + $checksum = 0; for ($i = 0; $i < 512; $i++) { $b = unpack("c1char", substr($header, $i, 1)); @@ -548,11 +569,46 @@ class compress_tar extends compress unset($data); } - function open($mode, $file) + function open() { $fzopen = ($this->isbz && function_exists('bzopen')) ? 'bzopen' : (($this->isgz && extension_loaded('zlib')) ? 'gzopen' : 'fopen'); return $this->fp = @$fzopen($this->file, $this->mode . 'b'); } + + function download($filename) + { + global $phpbb_root_path; + + switch ($this->type) + { + case 'tar': + $mimetype = 'application/x-tar'; + break; + + case 'tar.gz': + $mimetype = 'application/x-gzip'; + break; + + case 'tar.bz2': + $mimetype = 'application/x-bzip2'; + break; + + default: + $mimetype = 'application/octet-stream'; + break; + } + + header('Pragma: no-cache'); + header("Content-Type: $mimetype; name=\"$filename.$this->type\""); + header("Content-disposition: attachment; filename=$filename.$this->type"); + + $fp = fopen("{$phpbb_root_path}store/$filename.$this->type", 'rb'); + while ($buffer = fread($fp, 1024)) + { + echo $buffer; + } + fclose($fp); + } } ?> \ No newline at end of file diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index f71d133378..1d0dd56337 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -523,7 +523,7 @@ class user extends session $accept_lang = substr($accept_lang, 0, 2) . '_' . strtoupper(substr($accept_lang, 3, 2)); if (file_exists($phpbb_root_path . 'language/' . $accept_lang . "/common.$phpEx")) { - $this->lang_name = $accept_lang; + $this->lang_name = $config['default_lang'] = $accept_lang; $this->lang_path = $phpbb_root_path . 'language/' . $accept_lang . '/'; break; } @@ -533,7 +533,7 @@ class user extends session $accept_lang = substr($accept_lang, 0, 2); if (file_exists($phpbb_root_path . 'language/' . $accept_lang . "/common.$phpEx")) { - $this->lang_name = $accept_lang; + $this->lang_name = $config['default_lang'] = $accept_lang; $this->lang_path = $phpbb_root_path . 'language/' . $accept_lang . '/'; break; } diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index be29709ca7..91f0722317 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -30,6 +30,17 @@ class ucp_register extends module $coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false; $agreed = (!empty($_POST['agreed'])) ? 1 : 0; $submit = (isset($_POST['submit'])) ? true : false; + $change_lang = request_var('change_lang', ''); + + if ($change_lang) + { + $submit = false; + $lang = $change_lang; + $user->lang_name = $lang = $change_lang; + $user->lang_path = $phpbb_root_path . 'language/' . $lang . '/'; + $user->lang = array(); + $user->add_lang(array('common', 'ucp')); + } $cp = new custom_profile(); @@ -68,6 +79,27 @@ class ucp_register extends module $this->display($user->lang['REGISTER'], 'ucp_agreement.html'); } + // If we change the language inline, we do not want to display errors, but pre-fill already filled out values + if ($change_lang) + { + $var_ary = array( + 'username' => (string) '', + 'password_confirm' => (string) '', + 'new_password' => (string) '', + 'cur_password' => (string) '', + 'email' => (string) '', + 'email_confirm' => (string) '', + 'confirm_code' => (string) '', + 'lang' => (string) $config['default_lang'], + 'tz' => (float) $config['board_timezone'], + ); + + foreach ($var_ary as $var => $default) + { + $$var = request_var($var, $default); + } + } + // Check and initialize some variables if needed if ($submit) { @@ -272,7 +304,7 @@ class ucp_register extends module { include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx); - $messenger = new messenger(); + $messenger = new messenger(false); $messenger->template($email_template, $lang); @@ -335,8 +367,6 @@ class ucp_register extends module } $db->sql_freeresult($result); } - - $messenger->queue->save(); } if ($config['require_activation'] == USER_ACTIVATION_NONE || !$config['email_enable']) @@ -353,53 +383,57 @@ class ucp_register extends module } $s_hidden_fields = ''; + $s_hidden_fields .= ''; $confirm_image = ''; // Visual Confirmation - Show images if ($config['enable_confirm']) { - $sql = 'SELECT session_id - FROM ' . SESSIONS_TABLE; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) + if (!$change_lang) { - $sql_in = array(); - do - { - $sql_in[] = "'" . $db->sql_escape($row['session_id']) . "'"; - } - while ($row = $db->sql_fetchrow($result)); + $sql = 'SELECT session_id + FROM ' . SESSIONS_TABLE; + $result = $db->sql_query($sql); - $sql = 'DELETE FROM ' . CONFIRM_TABLE . ' - WHERE session_id NOT IN (' . implode(', ', $sql_in) . ')'; + if ($row = $db->sql_fetchrow($result)) + { + $sql_in = array(); + do + { + $sql_in[] = "'" . $db->sql_escape($row['session_id']) . "'"; + } + while ($row = $db->sql_fetchrow($result)); + + $sql = 'DELETE FROM ' . CONFIRM_TABLE . ' + WHERE session_id NOT IN (' . implode(', ', $sql_in) . ')'; + $db->sql_query($sql); + } + $db->sql_freeresult($result); + + $sql = 'SELECT COUNT(session_id) AS attempts + FROM ' . CONFIRM_TABLE . " + WHERE session_id = '" . $db->sql_escape($user->session_id) . "'"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + if ($config['max_reg_attempts'] && $row['attempts'] >= $config['max_reg_attempts']) + { + trigger_error($user->lang['TOO_MANY_REGISTERS']); + } + } + $db->sql_freeresult($result); + + $code = gen_rand_string(6); + $confirm_id = md5(uniqid($user_ip)); + + $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'confirm_id' => (string) $confirm_id, + 'session_id' => (string) $user->session_id, + 'code' => (string) $code) + ); $db->sql_query($sql); } - $db->sql_freeresult($result); - - $sql = 'SELECT COUNT(session_id) AS attempts - FROM ' . CONFIRM_TABLE . " - WHERE session_id = '" . $db->sql_escape($user->session_id) . "'"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - if ($config['max_reg_attempts'] && $row['attempts'] >= $config['max_reg_attempts']) - { - trigger_error($user->lang['TOO_MANY_REGISTERS']); - } - } - $db->sql_freeresult($result); - - $code = gen_rand_string(6); - $confirm_id = md5(uniqid($user_ip)); - - $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'confirm_id' => (string) $confirm_id, - 'session_id' => (string) $user->session_id, - 'code' => (string) $code) - ); - $db->sql_query($sql); $confirm_image = (@extension_loaded('zlib')) ? "\"\"" : "\"\"\"\"\"\"\"\"\"\"\"\""; $s_hidden_fields .= ''; @@ -443,7 +477,7 @@ class ucp_register extends module 'S_CONFIRM_CODE' => ($config['enable_confirm']) ? true : false, 'S_COPPA' => $coppa, 'S_HIDDEN_FIELDS' => $s_hidden_fields, - 'S_UCP_ACTION' => "ucp.$phpEx$SID&mode=register") + 'S_UCP_ACTION' => "{$phpbb_root_path}ucp.$phpEx$SID&mode=register") ); // diff --git a/phpBB/language/en/admin.php b/phpBB/language/en/admin.php index cb16911993..a39b92fd67 100644 --- a/phpBB/language/en/admin.php +++ b/phpBB/language/en/admin.php @@ -52,8 +52,7 @@ $lang += array( 'ACP_CAT_USERGROUP' => 'Users & Groups', 'ACP_USERS_MANAGE' => 'Edit user data', - - + 'DB_CAT' => 'Database', @@ -114,6 +113,10 @@ $lang += array( 'GROUP_MANAGE' => 'Manage groups', 'CUSTOM_PROFILE_FIELDS' => 'Profile fields', + 'LANGUAGE_CAT' => 'Language', + 'LANGUAGE_PACKS' => 'Language Packs', + + 'ADMINISTRATORS' => 'Administrators', 'USERNAMES_EXPLAIN' => 'Place each username on a seperate line', 'LOOK_UP_FORUM' => 'Select a Forum', @@ -280,6 +283,10 @@ $lang += array( 'LOG_BOT_ADDED' => 'New bot added
» %s', 'LOG_BOT_UPDATED' => 'Existing bot updated
» %s', 'LOG_BOT_DELETE' => 'Deleted bot
» %s', + + 'LOG_DELETE_LANGUAGE_PACK' => 'Deleted language pack
» %s', + 'LOG_LANGUAGE_PACK_INSTALLED' => 'Installed language pack
» %s', + 'LOG_UPDATE_LANG_DETAILS' => 'Updated language pack details
» %s', ); // Index page diff --git a/phpBB/language/en/iso.txt b/phpBB/language/en/iso.txt index 043ea105ed..c2a03d9516 100644 --- a/phpBB/language/en/iso.txt +++ b/phpBB/language/en/iso.txt @@ -1 +1,3 @@ -English [UK] \ No newline at end of file +English [UK] +English [UK] +phpBB Group \ No newline at end of file diff --git a/phpBB/posting.php b/phpBB/posting.php index e8f43b6c81..aab0d3da78 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1537,11 +1537,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($post_mode == 'post') { $sql_data[TOPICS_TABLE]['sql'] = array( - 'topic_first_post_id' => $data['post_id'], - 'topic_last_post_id' => $data['post_id'], - 'topic_last_post_time' => $current_time, - 'topic_last_poster_id' => (int) $user->data['user_id'], - 'topic_last_poster_name' => ($user->data['user_id'] == ANONYMOUS && $username) ? stripslashes($username) : $user->data['username'] + 'topic_first_post_id' => $data['post_id'], + 'topic_last_post_id' => $data['post_id'], + 'topic_last_post_time' => $current_time, + 'topic_last_poster_id' => (int) $user->data['user_id'], + 'topic_last_poster_name'=> ($user->data['user_id'] == ANONYMOUS && $username) ? stripslashes($username) : $user->data['username'] ); } @@ -1557,11 +1557,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u FROM ' . TOPICS_TABLE . ' WHERE topic_id = ' . $data['topic_id']; $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); // globalise - if ((int)$row['topic_type'] != POST_GLOBAL && $topic_type == POST_GLOBAL) + if ($row['topic_type'] != POST_GLOBAL && $topic_type == POST_GLOBAL) { // Decrement topic/post count $make_global = true; @@ -1577,7 +1577,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $db->sql_query($sql); } // unglobalise - else if ((int)$row['topic_type'] == POST_GLOBAL && $topic_type != POST_GLOBAL) + else if ($row['topic_type'] == POST_GLOBAL && $topic_type != POST_GLOBAL) { // Increment topic/post count $make_global = true; diff --git a/phpBB/styles/subSilver/template/ucp_register.html b/phpBB/styles/subSilver/template/ucp_register.html index 4023b81220..6f52f1bdc2 100644 --- a/phpBB/styles/subSilver/template/ucp_register.html +++ b/phpBB/styles/subSilver/template/ucp_register.html @@ -2,7 +2,17 @@ -
+ + +
@@ -47,7 +57,7 @@ - +
{L_LANGUAGE}:
{L_TIMEZONE}: