mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-06 15:45:34 +02:00
- Uploading changed language files in the language ACP panel :-)
git-svn-id: file:///svn/phpbb/trunk@5562 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
26a6d215d0
commit
ef8b25cb13
@ -116,7 +116,7 @@
|
||||
<select name="language_file">{S_LANG_OPTIONS}</select> <input type="submit" class="button2" name="change" value="{L_SELECT}" />
|
||||
</fieldset>
|
||||
|
||||
<br /><br />
|
||||
<br /><br /><br />
|
||||
|
||||
<table cellspacing="1">
|
||||
<thead>
|
||||
@ -132,7 +132,7 @@
|
||||
<!-- ENDIF -->
|
||||
<tr>
|
||||
<td class="row3"><b>{PRINT_MESSAGE}<!-- IF S_FROM_STORE --><br /><span style="color: red;">{L_FILE_FROM_STORAGE}</span><!-- ENDIF --></b></td>
|
||||
<td class="row3" style="text-align: right;"><input type="submit" name="download_file" class="button2" value="{L_SUBMIT_AND_DOWNLOAD}" /> <input type="submit" name="submit_file" class="button2" value="{L_SUBMIT}" /></td>
|
||||
<td class="row3" style="text-align: right;"><input type="submit" name="download_file" class="button2" value="{L_SUBMIT_AND_DOWNLOAD}" /> <input type="submit" name="submit_file" class="button2" value="{L_SUBMIT}" /><!-- IF ALLOW_UPLOAD --> {L_UPLOAD_METHOD}: <!-- BEGIN buttons--><input type="radio"<!-- IF buttons.S_FIRST_ROW --> id="method" checked="checked"<!-- ENDIF --> value="{buttons.VALUE}" name="method"> {buttons.VALUE} <!-- END buttons --><input type="submit" name="upload_file" class="button2" value="{L_SUBMIT_AND_UPLOAD}" /><!-- ENDIF --></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -144,13 +144,50 @@
|
||||
{TPL}
|
||||
<!-- ENDIF -->
|
||||
<tr>
|
||||
<td class="row3" colspan="3" style="text-align: right;"><input type="submit" name="download_file" class="button2" value="{L_SUBMIT_AND_DOWNLOAD}" /> <input type="submit" name="submit_file" class="button2" value="{L_SUBMIT}" /></td>
|
||||
<td class="row3" colspan="3" style="text-align: right;"><input type="submit" name="download_file" class="button2" value="{L_SUBMIT_AND_DOWNLOAD}" /> <input type="submit" name="submit_file" class="button2" value="{L_SUBMIT}" /><!-- IF ALLOW_UPLOAD --> {L_UPLOAD_METHOD}: <!-- BEGIN buttons--><input type="radio" value="{buttons.VALUE}" name="method"> {buttons.VALUE} <!-- END buttons --><input type="submit" name="upload_file" class="button2" value="{L_SUBMIT_AND_UPLOAD}" /><!-- ENDIF --></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
<!-- ELSEIF S_UPLOAD -->
|
||||
<a href="{U_BACK}" style="float: right">« {L_BACK}</a>
|
||||
|
||||
<h1>{L_UPLOAD_SETTINGS}</h1>
|
||||
|
||||
<form id="upload" method="post" action="{U_ACTION}">
|
||||
|
||||
<!-- IF S_CONNECTION_SUCCESS -->
|
||||
<div class="successbox">
|
||||
<p>{L_CONNECTION_SUCCESS}</p>
|
||||
</div>
|
||||
<!-- ELSEIF S_CONNECTION_FAILED -->
|
||||
<div class="errorbox">
|
||||
<p>{L_CONNECTION_FAILED}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_UPLOAD_SETTINGS}</legend>
|
||||
<dl>
|
||||
<dt><label>{L_UPLOAD_METHOD}:</label></dt>
|
||||
<dd><b>{NAME}</b></dd>
|
||||
</dl>
|
||||
<!-- BEGIN data -->
|
||||
<dl>
|
||||
<dt><label for="store">{data.NAME}:</label><br /><span>{data.EXPLAIN}</span></dt>
|
||||
<dd><input type="text" id="{data.DATA}" name="{data.DATA}" value="{data.DEFAULT}" checked="checked" /></dd>
|
||||
</dl>
|
||||
<!-- END data -->
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="quick">
|
||||
{HIDDEN}
|
||||
<input class="button1" type="submit" name="update" value="{L_SUBMIT}" />
|
||||
<input class="button1" type="submit" name="test_connection" value="{L_TEST_CONNECTION}" />
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
<!-- ELSE -->
|
||||
|
||||
<h1>{L_ACP_LANGUAGE_PACKS}</h1>
|
||||
|
@ -36,6 +36,8 @@ class acp_language
|
||||
|
||||
$action = (isset($_POST['update_details'])) ? 'update_details' : $action;
|
||||
$action = (isset($_POST['download_file'])) ? 'download_file' : $action;
|
||||
$action = (isset($_POST['upload_file'])) ? 'upload_file' : $action;
|
||||
$action = (isset($_POST['upload_data'])) ? 'upload_data' : $action;
|
||||
$action = (isset($_POST['submit_file'])) ? 'submit_file' : $action;
|
||||
$action = (isset($_POST['remove_store'])) ? 'details' : $action;
|
||||
|
||||
@ -55,8 +57,106 @@ class acp_language
|
||||
$this->tpl_name = 'acp_language';
|
||||
$this->page_title = 'ACP_LANGUAGE_PACKS';
|
||||
|
||||
$u_action = "{$phpbb_admin_path}index.$phpEx$SID&i=$id&mode=$mode";
|
||||
|
||||
if ($action == 'upload_data' && request_var('test_connection', ''))
|
||||
{
|
||||
$test_connection = false;
|
||||
|
||||
$action = 'upload_file';
|
||||
|
||||
$method = request_var('method', '');
|
||||
|
||||
include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx);
|
||||
|
||||
switch ($method)
|
||||
{
|
||||
case 'ftp':
|
||||
$transfer = new ftp(request_var('host', ''), request_var('username', ''), request_var('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', ''));
|
||||
break;
|
||||
default:
|
||||
trigger_error($user->lang['INVALID_UPLOAD_METHOD']);
|
||||
}
|
||||
|
||||
$test_connection = $transfer->open_session();
|
||||
$transfer->close_session();
|
||||
}
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
case 'upload_data':
|
||||
if (!$lang_id)
|
||||
{
|
||||
trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($u_action));
|
||||
}
|
||||
|
||||
$sql = 'SELECT lang_iso FROM ' . LANG_TABLE . "
|
||||
WHERE lang_id = $lang_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$file = request_var('file', '');
|
||||
$dir = request_var('dir', '');
|
||||
|
||||
$old_file = '/' . $this->get_filename($row['lang_iso'], $dir, $file, false, true);
|
||||
$lang_path = 'language/' . $row['lang_iso'] . '/' . (($dir) ? $dir . '/' : '');
|
||||
|
||||
include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx);
|
||||
$method = request_var('method', '');
|
||||
|
||||
switch ($method)
|
||||
{
|
||||
case 'ftp':
|
||||
$transfer = new ftp(request_var('host', ''), request_var('username', ''), request_var('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', ''));
|
||||
break;
|
||||
default:
|
||||
trigger_error($user->lang['INVALID_UPLOAD_METHOD']);
|
||||
}
|
||||
|
||||
if (!$transfer->open_session())
|
||||
{
|
||||
trigger_error($user->lang['ERR_CONNECTING_SERVER'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
$transfer->rename($lang_path . $file, $lang_path . $file . '.bak');
|
||||
$transfer->copy_file('store/' . $lang_path . $file, $lang_path . $file);
|
||||
$transfer->close_session();
|
||||
|
||||
add_log('admin', 'LOG_LANGUAGE_FILE_REPLACED', $file);
|
||||
|
||||
trigger_error($user->lang['UPLOAD_COMPLETED']);
|
||||
break;
|
||||
|
||||
case 'upload_file':
|
||||
include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx);
|
||||
|
||||
$method = request_var('method', '');
|
||||
|
||||
$requested_data = call_user_func(array($method, 'data'));
|
||||
foreach ($requested_data as $data => $default)
|
||||
{
|
||||
$template->assign_block_vars('data', array(
|
||||
'DATA' => $data,
|
||||
'NAME' => $user->lang[strtoupper($method . '_' . $data)],
|
||||
'EXPLAIN' => $user->lang[strtoupper($method . '_' . $data) . '_EXPLAIN'],
|
||||
'DEFAULT' => $_REQUEST[$data] ? request_var($data, '') : $default
|
||||
));
|
||||
}
|
||||
|
||||
$hidden_data = build_hidden_fields(array('file' => $this->language_file, 'dir' => $this->language_directory, 'method' => $method));
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_UPLOAD' => true,
|
||||
'NAME' => $method,
|
||||
'U_ACTION' => $this->u_action . "&id=$lang_id&action=upload_data",
|
||||
'HIDDEN' => $hidden_data,
|
||||
|
||||
'S_CONNECTION_SUCCESS' => (request_var('test_connection', '') && $test_connection === true) ? true : false,
|
||||
'S_CONNECTION_FAILED' => (request_var('test_connection', '') && $test_connection === false) ? true : false
|
||||
));
|
||||
break;
|
||||
|
||||
case 'update_details':
|
||||
|
||||
if (!$lang_id)
|
||||
@ -297,6 +397,17 @@ class acp_language
|
||||
@unlink($phpbb_root_path . $store_filename);
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx);
|
||||
|
||||
$methods = transfer::methods();
|
||||
|
||||
foreach ($methods as $method)
|
||||
{
|
||||
$template->assign_block_vars('buttons', array(
|
||||
'VALUE' => $method
|
||||
));
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DETAILS' => true,
|
||||
'U_ACTION' => $this->u_action . "&action=details&id=$lang_id",
|
||||
@ -305,6 +416,7 @@ class acp_language
|
||||
'LANG_ENGLISH_NAME' => $lang_entries['lang_english_name'],
|
||||
'LANG_ISO' => $lang_entries['lang_iso'],
|
||||
'LANG_AUTHOR' => $lang_entries['lang_author'],
|
||||
'ALLOW_UPLOAD' => sizeof($methods)
|
||||
)
|
||||
);
|
||||
|
||||
@ -824,6 +936,14 @@ class acp_language
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* DO NOT CHANGE
|
||||
*/
|
||||
if (empty($lang) || !is_array($lang))
|
||||
{
|
||||
$lang = array();
|
||||
}
|
||||
|
||||
// DEVELOPERS PLEASE NOTE
|
||||
//
|
||||
// Placeholders can now contain order information, e.g. instead of
|
||||
@ -836,16 +956,7 @@ class acp_language
|
||||
';
|
||||
|
||||
$this->lang_header = '
|
||||
|
||||
/**
|
||||
* DO NOT CHANGE
|
||||
*/
|
||||
if (empty($lang) || !is_array($lang))
|
||||
{
|
||||
$lang = array();
|
||||
}
|
||||
|
||||
$lang += array(
|
||||
$lang = array_merge($lang, array(
|
||||
';
|
||||
|
||||
// Language files in language root directory
|
||||
|
@ -178,6 +178,18 @@ class transfer
|
||||
return $this->_rmdir($dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename a file or folder
|
||||
*/
|
||||
function rename($old_handle, $new_handle)
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
|
||||
$old_handle = $this->root_path . '/' . str_replace($phpbb_root_path, '', $old_handle);
|
||||
|
||||
return $this->_rename($old_handle, $new_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open session
|
||||
*/
|
||||
@ -228,9 +240,21 @@ class ftp extends transfer
|
||||
$this->timeout = $timeout;
|
||||
$this->root_path = (($root_path{0} != '/' ) ? '/' : '') . ((substr($root_path, -1, 1) == '/') ? substr($root_path, 0, -1) : $root_path);
|
||||
|
||||
// Init some needed values
|
||||
transfer::transfer();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests data
|
||||
*/
|
||||
function data()
|
||||
{
|
||||
global $config;
|
||||
return array('host' => 'localhost' , 'username' => 'anonymous', 'password' => '', 'root_path' => $config['script_path'], 'port' => 21, 'timeout' => 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Init FTP Session
|
||||
*/
|
||||
@ -278,6 +302,14 @@ class ftp extends transfer
|
||||
return @ftp_rmdir($this->connection, $dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove directory (RMDIR)
|
||||
*/
|
||||
function _rename($old_handle, $new_handle)
|
||||
{
|
||||
return @ftp_rename($this->connection, $old_handle, $new_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change current working directory (CHDIR)
|
||||
*/
|
||||
@ -295,10 +327,16 @@ class ftp extends transfer
|
||||
* change file permissions (CHMOD)
|
||||
*/
|
||||
function _chmod($file, $perms)
|
||||
{
|
||||
if (function_exists('ftp_chmod'))
|
||||
{
|
||||
$err = @ftp_chmod($this->connection, $perms, $file);
|
||||
}
|
||||
else
|
||||
{
|
||||
$chmod_cmd = 'CHMOD 0' . $perms . ' ' . $file;
|
||||
$err = $this->_site($chmod_cmd);
|
||||
|
||||
}
|
||||
return $err;
|
||||
}
|
||||
|
||||
|
@ -415,6 +415,7 @@ $lang = array_merge($lang, array(
|
||||
'LOG_LANGUAGE_PACK_DELETED' => '<b>Deleted language pack</b><br />» %s',
|
||||
'LOG_LANGUAGE_PACK_INSTALLED' => '<b>Installed language pack</b><br />» %s',
|
||||
'LOG_LANGUAGE_PACK_UPDATED' => '<b>Updated language pack details</b><br />» %s',
|
||||
'LOG_LANGUAGE_FILE_REPLACED' => '<b>Replaced language file</b><br />» %s',
|
||||
|
||||
'LOG_MASS_EMAIL' => '<b>Sent mass email</b><br />» %s',
|
||||
|
||||
|
@ -37,10 +37,13 @@ $lang = array_merge($lang, array(
|
||||
'FILE_CONTENTS' => 'File Contents',
|
||||
'FILE_FROM_STORAGE' => 'File from storage folder',
|
||||
|
||||
'TEST_CONNECTION' => 'Test Connection',
|
||||
|
||||
'HELP_FILES' => 'Help Files',
|
||||
|
||||
'INSTALLED_LANGUAGE_PACKS' => 'Installed language packs',
|
||||
'INVALID_LANGUAGE_PACK' => 'The selected language pack seems to be not valid. Please verify the language pack and upload it again if necessary.',
|
||||
'INVALID_UPLOAD_METHOD' => 'The selected upload method is not valid, please choose a different method.',
|
||||
|
||||
'LANGUAGE_DETAILS_UPDATED' => 'Language details successfully updated',
|
||||
'LANGUAGE_ENTRIES' => 'Language Entries',
|
||||
@ -74,12 +77,17 @@ $lang = array_merge($lang, array(
|
||||
|
||||
'SELECT_DOWNLOAD_FORMAT' => 'Select download format',
|
||||
'SUBMIT_AND_DOWNLOAD' => 'Submit and Download File',
|
||||
'SUBMIT_AND_UPLOAD' => 'Submit and Upload File',
|
||||
|
||||
'THOSE_MISSING_LANG_FILES' => 'The following language files are missing from the %s language folder',
|
||||
'THOSE_MISSING_LANG_VARIABLES' => 'The following language variables are missing from the <b>%s</b> language pack',
|
||||
|
||||
'UNINSTALLED_LANGUAGE_PACKS' => 'Uninstalled language packs',
|
||||
|
||||
'UPLOAD_COMPLETED' => 'The upload has completed',
|
||||
'UPLOAD_METHOD' => 'Upload method',
|
||||
'UPLOAD_SETTINGS' => 'Upload settings',
|
||||
|
||||
'WRONG_LANGUAGE_FILE' => 'Selected language file is invalid',
|
||||
));
|
||||
|
||||
|
@ -92,6 +92,8 @@ $lang = array_merge($lang, array(
|
||||
'CLICK_VIEW_PRIVMSG' => 'Click %sHere%s to visit your Inbox',
|
||||
'CONFIRM' => 'Confirm',
|
||||
'CONGRATULATIONS' => 'Congratulations to',
|
||||
'CONNECTION_FAILED' => 'Connection failed',
|
||||
'CONNECTION_SUCCESS' => 'Connection was successful!',
|
||||
'COOKIES_DELETED' => 'All Board Cookies successfully deleted.',
|
||||
'CURRENT_TIME' => 'The time is %s',
|
||||
|
||||
@ -119,6 +121,7 @@ $lang = array_merge($lang, array(
|
||||
'EMAIL_ADDRESS' => 'Email address',
|
||||
'EMPTY_SUBJECT' => 'You must specify a subject when posting a new topic.',
|
||||
'ENABLED' => 'Enabled',
|
||||
'ERR_CONNECTING_SERVER' => 'Error connecting to the server',
|
||||
'EXTENSION' => 'Extension',
|
||||
'EXTENSION_DISABLED_AFTER_POSTING' => 'The extension <b>%s</b> has been deactivated and can no longer be displayed',
|
||||
|
||||
@ -141,6 +144,19 @@ $lang = array_merge($lang, array(
|
||||
'FORUM_RULES_LINK' => 'Please click to view the forum rules',
|
||||
'FROM' => 'from',
|
||||
|
||||
'FTP_HOST' => 'FTP Host',
|
||||
'FTP_HOST_EXPLAIN' => 'FTP Server used to connect your site',
|
||||
'FTP_PASSWORD' => 'FTP Password',
|
||||
'FTP_PASSWORD_EXPLAIN' => 'Password for your FTP Username',
|
||||
'FTP_PORT' => 'FTP Port',
|
||||
'FTP_PORT_EXPLAIN' => 'Port used to connect to your server',
|
||||
'FTP_ROOT_PATH' => 'Path to phpBB',
|
||||
'FTP_ROOT_PATH_EXPLAIN' => 'Path from the root to your phpBB board',
|
||||
'FTP_TIMEOUT' => 'FTP Timeout',
|
||||
'FTP_TIMEOUT_EXPLAIN' => 'The amount of time, in seconds, that the system will wait for a reply from your server',
|
||||
'FTP_USERNAME' => 'FTP Username',
|
||||
'FTP_USERNAME_EXPLAIN' => 'Username used to connect to your server',
|
||||
|
||||
'GO' => 'Go',
|
||||
'GOTO_PAGE' => 'Goto page',
|
||||
'GROUP' => 'Group',
|
||||
|
Loading…
x
Reference in New Issue
Block a user