- some code refactoring before upgrade to utf (only cosmetic at this point...)
git-svn-id: http://piwigo.org/svn/trunk@2126 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
5132cc1f87
commit
98b07a4a7f
15 changed files with 291 additions and 263 deletions
|
|
@ -57,7 +57,6 @@ include(PHPWG_ROOT_PATH.'include/page_header.php');
|
|||
$template->set_filenames(
|
||||
array(
|
||||
'about'=>'about.tpl',
|
||||
'about_content' => get_language_filepath('about.html')
|
||||
)
|
||||
);
|
||||
if ( isset($lang['Theme: '.$user['theme']]) )
|
||||
|
|
@ -75,7 +74,7 @@ $template->assign_vars(
|
|||
)
|
||||
);
|
||||
|
||||
$template->assign_var_from_handle('ABOUT_MESSAGE', 'about_content');
|
||||
$template->assign_var('ABOUT_MESSAGE', load_language('about.html','','',true) );
|
||||
|
||||
$template->parse('about');
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
|
|
|
|||
|
|
@ -32,11 +32,5 @@ include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
|||
// +-----------------------------------------------------------------------+
|
||||
check_status(ACCESS_ADMINISTRATOR);
|
||||
|
||||
$template->set_filenames(
|
||||
array(
|
||||
'help_content' => get_language_filepath('help.html')
|
||||
)
|
||||
);
|
||||
|
||||
$template->assign_var_from_handle('ADMIN_CONTENT', 'help_content');
|
||||
$template->assign_var('ADMIN_CONTENT', load_language('help.html','','',true) );
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -155,13 +155,13 @@ include(PHPWG_ROOT_PATH.'include/user.inc.php');
|
|||
|
||||
|
||||
// language files
|
||||
include_once(get_language_filepath('common.lang.php'));
|
||||
load_language('common.lang');
|
||||
if (defined('IN_ADMIN') and IN_ADMIN)
|
||||
{
|
||||
include_once(get_language_filepath('admin.lang.php'));
|
||||
load_language('admin.lang');
|
||||
}
|
||||
trigger_action('loading_lang');
|
||||
@include_once(get_language_filepath('local.lang.php'));
|
||||
load_language('local.lang');
|
||||
|
||||
// only now we can set the localized username of the guest user (and not in
|
||||
// include/user.inc.php)
|
||||
|
|
|
|||
|
|
@ -729,9 +729,9 @@ function redirect_html( $url , $msg = '', $refresh_time = 0)
|
|||
if (!isset($lang_info))
|
||||
{
|
||||
$user = build_user( $conf['guest_id'], true);
|
||||
include_once(get_language_filepath('common.lang.php'));
|
||||
load_language('common.lang');
|
||||
trigger_action('loading_lang');
|
||||
@include_once(get_language_filepath('local.lang.php'));
|
||||
load_language('local.lang');
|
||||
list($tmpl, $thm) = explode('/', get_default_template());
|
||||
$template = new Template(PHPWG_ROOT_PATH.'template/'.$tmpl, $thm);
|
||||
}
|
||||
|
|
@ -1424,4 +1424,43 @@ function get_filter_page_value($value_name)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the character set of data sent to browsers / received from forms
|
||||
*/
|
||||
function get_pwg_charset()
|
||||
{
|
||||
//TEMP CODE
|
||||
global $lang_info;return $lang_info['charset'];
|
||||
}
|
||||
|
||||
/**
|
||||
* includes a language file or returns the content of a language file
|
||||
* availability of the file
|
||||
*
|
||||
* in descending order of preference:
|
||||
* param language, user language, default language
|
||||
* PhpWebGallery default language.
|
||||
*
|
||||
* @param string filename
|
||||
* @param string dirname
|
||||
* @param string language
|
||||
* @param bool return_content - if true the file content is returned otherwise
|
||||
* the file is evaluated as php
|
||||
* @return boolean success status or a string if return_content is true
|
||||
*/
|
||||
function load_language($filename, $dirname = '', $language = '',
|
||||
$return_content=false)
|
||||
{
|
||||
//TEMP CODE
|
||||
if (!$return_content) $filename.='.php';
|
||||
$f = get_language_filepath($filename, $dirname, $language);
|
||||
if ($f === false)
|
||||
return false;
|
||||
if ($return_content)
|
||||
return @file_get_contents($f);
|
||||
global $lang, $lang_info;
|
||||
@include($f);
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -48,7 +48,7 @@ function encode_mime_header($str)
|
|||
$str = str_replace(" ", "_", $str);
|
||||
|
||||
global $lang_info;
|
||||
return '=?'.$lang_info['charset'].'?Q?'.$str.'?=';
|
||||
return '=?'.get_pwg_charset().'?Q?'.$str.'?=';
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -226,12 +226,12 @@ function switch_lang_to($language)
|
|||
$lang = array();
|
||||
|
||||
// language files
|
||||
include(get_language_filepath('common.lang.php', '', $language));
|
||||
load_language('common.lang', '', $language);
|
||||
// No test admin because script is checked admin (user selected no)
|
||||
// Translations are in admin file too
|
||||
include(get_language_filepath('admin.lang.php', '', $language));
|
||||
load_language('admin.lang', '', $language);
|
||||
trigger_action('loading_lang');
|
||||
@include(get_language_filepath('local.lang.php', '', $language));
|
||||
load_language('local.lang', '', $language);
|
||||
|
||||
$switch_lang[$language]['lang_info'] = $lang_info;
|
||||
$switch_lang[$language]['lang'] = $lang;
|
||||
|
|
@ -588,7 +588,7 @@ function pwg_mail($to, $args = array())
|
|||
|
||||
$content = '';
|
||||
|
||||
if (!isset($conf_mail[$args['email_format']][$lang_info['charset']][$args['template']][$args['theme']]))
|
||||
if (!isset($conf_mail[$args['email_format']][get_pwg_charset()][$args['template']][$args['theme']]))
|
||||
{
|
||||
if (!isset($mail_template))
|
||||
{
|
||||
|
|
@ -603,7 +603,7 @@ function pwg_mail($to, $args = array())
|
|||
//Header
|
||||
'BOUNDARY_KEY' => $conf_mail['boundary_key'],
|
||||
'CONTENT_TYPE' => $args['email_format'],
|
||||
'CONTENT_ENCODING' => $lang_info['charset'],
|
||||
'CONTENT_ENCODING' => get_pwg_charset(),
|
||||
'LANG' => $lang_info['code'],
|
||||
'DIR' => $lang_info['direction'],
|
||||
|
||||
|
|
@ -650,20 +650,20 @@ function pwg_mail($to, $args = array())
|
|||
|
||||
// what are displayed on the header of each mail ?
|
||||
$conf_mail[$args['email_format']]
|
||||
[$lang_info['charset']]
|
||||
[get_pwg_charset()]
|
||||
[$args['template']][$args['theme']]['header'] =
|
||||
$mail_template->parse('mail_header', true);
|
||||
|
||||
// what are displayed on the footer of each mail ?
|
||||
$conf_mail[$args['email_format']]
|
||||
[$lang_info['charset']]
|
||||
[get_pwg_charset()]
|
||||
[$args['template']][$args['theme']]['footer'] =
|
||||
$mail_template->parse('mail_footer', true);
|
||||
}
|
||||
|
||||
// Header
|
||||
$content.= $conf_mail[$args['email_format']]
|
||||
[$lang_info['charset']]
|
||||
[get_pwg_charset()]
|
||||
[$args['template']][$args['theme']]['header'];
|
||||
|
||||
// Content
|
||||
|
|
@ -683,7 +683,7 @@ function pwg_mail($to, $args = array())
|
|||
|
||||
// Footer
|
||||
$content.= $conf_mail[$args['email_format']]
|
||||
[$lang_info['charset']]
|
||||
[get_pwg_charset()]
|
||||
[$args['template']][$args['theme']]['footer'];
|
||||
|
||||
// Close boundary
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ $template->assign_vars(
|
|||
isset($page['body_id']) ?
|
||||
$page['body_id'] : '',
|
||||
|
||||
'CONTENT_ENCODING' => $lang_info['charset'],
|
||||
'CONTENT_ENCODING' => get_pwg_charset(),
|
||||
'PAGE_TITLE' => strip_tags($title),
|
||||
'LANG'=>$lang_info['code'],
|
||||
'DIR'=>$lang_info['direction'],
|
||||
|
|
@ -99,7 +99,7 @@ if ( isset( $refresh ) and intval($refresh) >= 0
|
|||
|
||||
trigger_action('loc_end_page_header');
|
||||
|
||||
header('Content-Type: text/html; charset='.$lang_info['charset']);
|
||||
header('Content-Type: text/html; charset='.get_pwg_charset());
|
||||
$template->parse('header');
|
||||
|
||||
trigger_action('loc_after_page_header');
|
||||
|
|
|
|||
|
|
@ -910,10 +910,7 @@ function ws_session_getStatus($params, &$service)
|
|||
{
|
||||
$res[$k] = $user[$k];
|
||||
}
|
||||
foreach ( array('charset') as $k )
|
||||
{
|
||||
$res[$k] = $lang_info[$k];
|
||||
}
|
||||
$res['charset'] = get_pwg_charset();
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ class PwgRestEncoder extends PwgResponseEncoder
|
|||
$this->_writer = new PwgXmlWriter();
|
||||
$this->encode($response);
|
||||
$ret = $this->_writer->getOutput();
|
||||
$ret = '<?xml version="1.0" encoding="'.$lang_info['charset'].'" ?>
|
||||
$ret = '<?xml version="1.0" encoding="'.get_pwg_charset().'" ?>
|
||||
<rsp stat="ok">
|
||||
'.$ret.'
|
||||
</rsp>';
|
||||
|
|
|
|||
5
nbm.php
5
nbm.php
|
|
@ -34,10 +34,11 @@ include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
|
|||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions_notification_by_mail.inc.php');
|
||||
// Translations are in admin file too
|
||||
include(get_language_filepath('admin.lang.php'));
|
||||
load_language('admin.lang');
|
||||
// Need to update a second time
|
||||
trigger_action('loading_lang');
|
||||
@include(get_language_filepath('local.lang.php'));
|
||||
load_language('local.lang');
|
||||
|
||||
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
|
|
|||
|
|
@ -50,9 +50,7 @@ class AdminAddIndex extends AddIndex
|
|||
|
||||
function loading_lang()
|
||||
{
|
||||
global $lang;
|
||||
|
||||
include(get_language_filepath('plugin.lang.php', $this->path));
|
||||
load_language('plugin.lang', $this->path);
|
||||
}
|
||||
|
||||
function get_admin_advanced_features_links($advanced_features)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class NormalAddIndex extends AddIndex
|
|||
if (in_array($page, array('advanced_feature', 'site_manager')))
|
||||
{
|
||||
$help_content =
|
||||
@file_get_contents(get_language_filepath('help/'.$page.'.html', $this->path));
|
||||
load_language('help/'.$page.'.html', $this->path, '', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ add_event_handler('get_check_integrity', 'c13y_upgrade');
|
|||
|
||||
function c13y_upgrade($c13y_array)
|
||||
{
|
||||
global $lang, $conf;
|
||||
global $conf;
|
||||
|
||||
include(get_language_filepath('plugin.lang.php', dirname(__FILE__).'/'));
|
||||
load_language('plugin.lang', dirname(__FILE__).'/');
|
||||
|
||||
$result = array();
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ if
|
|||
)
|
||||
{
|
||||
$help_content =
|
||||
@file_get_contents(get_language_filepath('help/'.$_GET['page'].'.html'));
|
||||
load_language('help/'.$_GET['page'].'.html', '', '', true);
|
||||
|
||||
if ($help_content == false)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue