mirror of
https://github.com/e107inc/e107.git
synced 2025-07-24 00:12:24 +02:00
Finalise locations of language files, option to disable auto-load of English files on non-English sites if required files not found
This commit is contained in:
79
class2.php
79
class2.php
@@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/class2.php,v $
|
||||
| $Revision: 1.84 $
|
||||
| $Date: 2008-12-04 21:05:05 $
|
||||
| $Author: mcfly_e107 $
|
||||
| $Revision: 1.85 $
|
||||
| $Date: 2008-12-07 21:41:03 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
//
|
||||
@@ -1708,20 +1708,93 @@ function e107_require($fname)
|
||||
|
||||
function include_lan($path, $force = false)
|
||||
{
|
||||
global $pref;
|
||||
if (!is_readable($path))
|
||||
{
|
||||
if (varsettrue($pref['noLanguageSubs']) || (e_LANGUAGE == 'English'))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
$path = str_replace(e_LANGUAGE, 'English', $path);
|
||||
}
|
||||
$ret = ($force) ? include($path) : include_once($path);
|
||||
return (isset($ret)) ? $ret : "";
|
||||
}
|
||||
|
||||
/*
|
||||
withdrawn - use loadLanFiles($path, 'admin') instead
|
||||
// Searches a defined set of paths and file names to load language files used for admin (including install etc)
|
||||
function include_lan_admin($path)
|
||||
{
|
||||
include_lan($path.'languages/'.e_LANGUAGE.'/lan_config.php');
|
||||
include_lan($path.'languages/admin/'.e_LANGUAGE.'.php');
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Routine looks in standard paths for language files associated with a plugin or theme - primarily for core routines, which won't know
|
||||
// for sure where the author has put them.
|
||||
// $unitName is the name (directory path) of the plugin or theme
|
||||
// $type determines what is to be loaded:
|
||||
// 'runtime' - the standard runtime language file for a plugin
|
||||
// 'admin' - the standard admin language file for a plugin
|
||||
// 'theme' - the standard language file for a plugin (these are usually pretty small, so one is enough)
|
||||
// Otherwise, $type is treated as part of a filename within the plugin's language directory, prefixed with the current language
|
||||
// Returns FALSE on failure (not found).
|
||||
// Returns the include_once error return if there is one
|
||||
// Otherwise returns an empty string.
|
||||
|
||||
// Note - if the code knows precisely where the language file is located, use include_lan()
|
||||
|
||||
// $pref['noLanguageSubs'] can be set TRUE to prevent searching for the English files if the files for the current site language don't exist.
|
||||
|
||||
function loadLanFiles($unitName, $type='runtime')
|
||||
{
|
||||
global $pref;
|
||||
switch ($type)
|
||||
{
|
||||
case 'runtime' :
|
||||
$searchPath[1] = e_PLUGIN.$unitName.'/languages/'.e_LANGUAGE.'_'.$unitName.'.php';
|
||||
$searchPath[2] = e_PLUGIN.$unitName.'/languages/'.e_LANGUAGE.'/'.$unitName.'.php';
|
||||
break;
|
||||
case 'admin' :
|
||||
$searchPath[1] = e_PLUGIN.$unitName.'/languages/'.e_LANGUAGE.'_admin_'.$unitName.'.php';
|
||||
$searchPath[2] = e_PLUGIN.$unitName.'/languages/'.e_LANGUAGE.'/'.'admin_'.$unitName.'.php';
|
||||
break;
|
||||
case 'theme' :
|
||||
$searchPath[1] = e_THEME.$unitName.'/languages/'.e_LANGUAGE.'_'.$unitName.'.php';
|
||||
$searchPath[2] = e_THEME.$unitName.'/languages/'.e_LANGUAGE.'/'.$unitName.'.php';
|
||||
break;
|
||||
default :
|
||||
$searchPath[1] = e_PLUGIN.$unitName.'/languages/'.e_LANGUAGE.'_'.$type.'.php';
|
||||
$searchPath[2] = e_PLUGIN.$unitName.'/languages/'.e_LANGUAGE.'/'.$type.'.php';
|
||||
}
|
||||
foreach ($searchPath as $s) // Look for files in current language first - should usually be found
|
||||
{
|
||||
if (is_readable($s))
|
||||
{
|
||||
$ret = include_once($s);
|
||||
return (isset($ret)) ? $ret : "";
|
||||
}
|
||||
}
|
||||
if (varsettrue($pref['noLanguageSubs']) || (e_LANGUAGE == 'English'))
|
||||
{
|
||||
return FALSE; // No point looking for the English files twice
|
||||
}
|
||||
|
||||
foreach ($searchPath as $s) // Now look for the English files
|
||||
{
|
||||
$s = str_replace(e_LANGUAGE, 'English', $s);
|
||||
if (is_readable($s))
|
||||
{
|
||||
$ret = include_once($s);
|
||||
return (isset($ret)) ? $ret : "";
|
||||
}
|
||||
}
|
||||
return FALSE; // Nothing found
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!function_exists('print_a'))
|
||||
{
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/admin.php,v $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2008-12-04 20:17:49 $
|
||||
| $Revision: 1.6 $
|
||||
| $Date: 2008-12-07 21:41:04 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -302,7 +302,7 @@ function getPluginLinks($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb')
|
||||
}
|
||||
else
|
||||
{
|
||||
include_lan_admin($plugin_path);
|
||||
loadLanFiles($plugin_path, 'admin');
|
||||
$eplug_name = $tp->toHTML($readFile['@attributes']['name'],FALSE,"defs, emotes_off");
|
||||
$eplug_conffile = $readFile['administration']['configFile'];
|
||||
$eplug_icon_small = $plugin_path.'/'.$readFile['administration']['iconSmall'];
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/language.php,v $
|
||||
| $Revision: 1.10 $
|
||||
| $Date: 2008-12-06 15:48:16 $
|
||||
| $Revision: 1.11 $
|
||||
| $Date: 2008-12-07 21:41:04 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -54,7 +54,8 @@ if (isset($_POST['submit_prefs']) && isset($_POST['mainsitelanguage']))
|
||||
$temp['multilanguage'] = $_POST['multilanguage'];
|
||||
$temp['multilanguage_subdomain'] = $_POST['multilanguage_subdomain'];
|
||||
$temp['sitelanguage'] = $_POST['mainsitelanguage'];
|
||||
|
||||
$temp['noLanguageSubs'] = $_POST['noLanguageSubs'];
|
||||
|
||||
if ($admin_log->logArrayDiffs($temp, $pref, 'LANG_01'))
|
||||
{
|
||||
save_prefs(); // Only save if changes
|
||||
@@ -179,9 +180,11 @@ if ($_POST['edit_existing'])
|
||||
<div style='text-align:center'>
|
||||
<table class='fborder' style='".ADMIN_WIDTH."'>\n";
|
||||
|
||||
foreach ($tabs as $table_name) {
|
||||
foreach ($tabs as $table_name)
|
||||
{
|
||||
$installed = strtolower($_POST['lang_choices'])."_".$table_name;
|
||||
if (stristr($_POST['lang_choices'], $installed) === FALSE) {
|
||||
if (stristr($_POST['lang_choices'], $installed) === FALSE)
|
||||
{
|
||||
$text .= "<tr>
|
||||
<td style='width:30%' class='forumheader3'>".ucfirst(str_replace("_", " ", $table_name))."</td>\n
|
||||
<td style='width:70%' class='forumheader3'>\n";
|
||||
@@ -228,7 +231,8 @@ if ($_POST['edit_existing'])
|
||||
require_once(e_ADMIN."footer.php");
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
function multilang_prefs() {
|
||||
function multilang_prefs()
|
||||
{
|
||||
global $ns, $pref,$lanlist;
|
||||
|
||||
$text = "<div style='text-align:center'>
|
||||
@@ -245,7 +249,8 @@ function multilang_prefs() {
|
||||
$text .= "
|
||||
<select name='mainsitelanguage' class='tbox'>\n";
|
||||
$sellan = preg_replace("/lan_*.php/i", "", $pref['sitelanguage']);
|
||||
foreach($lanlist as $lan){
|
||||
foreach($lanlist as $lan)
|
||||
{
|
||||
$sel = ($lan == $sellan) ? "selected='selected'" : "";
|
||||
$text .= "<option value='{$lan}' {$sel}>".$lan."</option>\n";
|
||||
}
|
||||
@@ -259,7 +264,17 @@ function multilang_prefs() {
|
||||
<td style='width:80%' class='forumheader3'>".LANG_LAN_12.": </td>
|
||||
<td style='width:20%;text-align:center' class='forumheader3'>";
|
||||
$checked = ($pref['multilanguage'] == 1) ? "checked='checked'" : "";
|
||||
$text .= "<input type='checkbox' name='multilanguage' value='1' $checked />
|
||||
$text .= "<input type='checkbox' name='multilanguage' value='1' {$checked} />
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
|
||||
$text .= "
|
||||
<tr>
|
||||
<td style='width:80%' class='forumheader3'>".LANG_LAN_26.": <br /><span class='smalltext'>".LANG_LAN_27."</span></td>
|
||||
<td style='width:20%;text-align:center' class='forumheader3'>";
|
||||
$checked = ($pref['noLanguageSubs'] == 1) ? "checked='checked'" : "";
|
||||
$text .= "<input type='checkbox' name='noLanguageSubs' value='1' {$checked} />
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_files/def_e107_prefs.php,v $
|
||||
| $Revision: 1.18 $
|
||||
| $Date: 2008-12-07 13:08:41 $
|
||||
| $Revision: 1.19 $
|
||||
| $Date: 2008-12-07 21:41:04 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -164,6 +164,7 @@ City, State, Country
|
||||
'ban_retrigger' => '0',
|
||||
|
||||
'multilanguage' => '0',
|
||||
'noLanguageSubs' => '0',
|
||||
|
||||
'user_tracking' => 'cookie',
|
||||
'cookie_name' => 'e107cookie',
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* e107 website system (c) 2001-2008 Steve Dunstan (e107.org)
|
||||
* $Id: admin_alt_nav.sc,v 1.5 2008-12-05 19:56:45 e107steved Exp $
|
||||
* $Id: admin_alt_nav.sc,v 1.6 2008-12-07 21:41:04 e107steved Exp $
|
||||
*/
|
||||
|
||||
if (ADMIN)
|
||||
@@ -81,6 +81,7 @@ if (ADMIN)
|
||||
if($plug->parse_plugin($_path))
|
||||
{
|
||||
$plug_vars = $plug->plug_vars;
|
||||
loadLanFiles($row['plugin_path'], 'admin');
|
||||
if($plug_vars['administration']['configFile'])
|
||||
{
|
||||
$plug_vars['@attributes']['name'] = $tp->toHTML($plug_vars['@attributes']['name'], FALSE, "defs");
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* e107 website system (c) 2001-2008 Steve Dunstan (e107.org)
|
||||
* $Id: admin_nav.sc,v 1.4 2008-12-04 20:17:54 e107steved Exp $
|
||||
* $Id: admin_nav.sc,v 1.5 2008-12-07 21:41:04 e107steved Exp $
|
||||
*/
|
||||
if (ADMIN)
|
||||
{
|
||||
@@ -49,7 +49,7 @@ if (ADMIN)
|
||||
if (is_readable(e_PLUGIN.$plugin_path."/plugin.xml"))
|
||||
{
|
||||
$readFile = $xml->loadXMLfile(e_PLUGIN.$plugin_path.'/plugin.xml', true, true);
|
||||
include_lan_admin(e_PLUGIN.$plugin_path.'/');
|
||||
loadLanFiles($plugin_path, 'admin');
|
||||
$eplug_caption = $tp->toHTML($readFile['@attributes']['name'],FALSE,"defs, emotes_off");
|
||||
$eplug_conffile = $readFile['administration']['configFile'];
|
||||
}
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
|
||||
| $Revision: 1.54 $
|
||||
| $Date: 2008-12-05 19:56:51 $
|
||||
| $Revision: 1.55 $
|
||||
| $Date: 2008-12-07 21:41:04 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -1542,7 +1542,7 @@ class e107plugin
|
||||
function parse_plugin_xml($path)
|
||||
{
|
||||
global $tp;
|
||||
include_lan_admin($path); // Look for LAN files on default paths
|
||||
loadLanFiles($path, 'admin'); // Look for LAN files on default paths
|
||||
require_once(e_HANDLER.'xml_class.php');
|
||||
$xml = new xmlClass;
|
||||
$this->plug_vars = $xml->loadXMLfile($path.'plugin.xml', true, true);
|
||||
|
@@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/theme_handler.php,v $
|
||||
| $Revision: 1.13 $
|
||||
| $Date: 2008-12-03 18:09:00 $
|
||||
| $Author: mcfly_e107 $
|
||||
| $Revision: 1.14 $
|
||||
| $Date: 2008-12-07 21:41:04 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@@ -572,7 +572,7 @@ class themeHandler{
|
||||
function parse_theme_xml($path)
|
||||
{
|
||||
global $tp;
|
||||
// include_lan_admin($path); // Look for LAN files on default paths
|
||||
// loadLanFiles($path, 'admin'); // Look for LAN files on default paths
|
||||
require_once(e_HANDLER.'xml_class.php');
|
||||
$xml = new xmlClass;
|
||||
$vars = $xml->loadXMLfile(e_THEME.$path.'/theme.xml', true, true);
|
||||
|
@@ -4,9 +4,9 @@
|
||||
| e107 website system - Language File.
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_language.php,v $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2007-09-20 21:45:33 $
|
||||
| $Author: e107coders $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2008-12-07 21:41:04 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@@ -36,6 +36,8 @@ define("LANG_LAN_22", "Language Pack created successfully.");
|
||||
define("LANG_LAN_23", "Create Language-Pack (zip)");
|
||||
define("LANG_LAN_24", "Generate");
|
||||
define("LANG_LAN_25", "Language-Pack Creation Status");
|
||||
define('LANG_LAN_26', 'Load language files only for current language');
|
||||
define('LANG_LAN_27', 'If checked, and a required language can\'t be found, there will be an error');
|
||||
|
||||
|
||||
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/admin_config.php,v $
|
||||
| $Revision: 1.10 $
|
||||
| $Date: 2008-11-20 21:43:57 $
|
||||
| $Revision: 1.11 $
|
||||
| $Date: 2008-12-07 21:41:04 $
|
||||
| $Author: e107steved $
|
||||
|
|
||||
+----------------------------------------------------------------------------+
|
||||
@@ -28,7 +28,7 @@ if (!getperms("P"))
|
||||
}
|
||||
|
||||
|
||||
include_lan_admin(e_PLUGIN.'calendar_menu/');
|
||||
include_lan(e_PLUGIN.'calendar_menu/languages/'.e_LANGUAGE.'_admin_calendar_menu.php');
|
||||
|
||||
|
||||
$message = "";
|
||||
|
@@ -10,9 +10,9 @@
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/languages/admin/English.php,v $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2008-08-12 19:59:59 $
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/languages/English_admin_calendar_menu.php,v $
|
||||
| $Revision: 1.1 $
|
||||
| $Date: 2008-12-07 21:41:04 $
|
||||
| $Author: e107steved $
|
||||
|
|
||||
+----------------------------------------------------------------------------+
|
@@ -11,17 +11,16 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/admin_config.php,v $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2008-08-13 20:47:09 $
|
||||
| $Revision: 1.6 $
|
||||
| $Date: 2008-12-07 21:41:04 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
|
||||
To do:
|
||||
1. Admin log for changes
|
||||
*/
|
||||
|
||||
|
||||
require_once("../../class2.php");
|
||||
if (!plugInstalled('log')) header("Location: ".e_BASE."index.php");
|
||||
if (!getperms("P"))
|
||||
{
|
||||
header("location:../../index.php");
|
||||
@@ -31,9 +30,9 @@ if (!getperms("P"))
|
||||
require_once(e_ADMIN."auth.php");
|
||||
require_once(e_HANDLER."userclass_class.php");
|
||||
|
||||
define("LOGPATH", e_PLUGIN."log/");
|
||||
define('LOGPATH', e_PLUGIN.'log/');
|
||||
|
||||
include_lan(LOGPATH."languages/admin/".e_LANGUAGE.".php");
|
||||
include_lan(LOGPATH.'languages/'.e_LANGUAGE.'_admin_log.php');
|
||||
|
||||
if (e_QUERY)
|
||||
{
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/e_help.php,v $
|
||||
| $Revision: 1.1 $
|
||||
| $Date: 2008-01-06 10:18:34 $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2008-12-07 21:41:04 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -20,7 +20,7 @@
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
define("LOGPATH", e_PLUGIN."log/");
|
||||
include_lan(LOGPATH."languages/admin/".e_LANGUAGE."_log_help.php");
|
||||
include_lan(LOGPATH."languages/".e_LANGUAGE."_log_help.php");
|
||||
|
||||
if (e_QUERY) list($action,$junk) = explode('.',e_QUERY); else $action = 'list';
|
||||
|
||||
|
@@ -10,9 +10,9 @@
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/languages/admin/English.php,v $
|
||||
| $Revision: 1.6 $
|
||||
| $Date: 2008-08-13 20:47:10 $
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/languages/English_admin_log.php,v $
|
||||
| $Revision: 1.1 $
|
||||
| $Date: 2008-12-07 21:41:04 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
@@ -10,9 +10,9 @@
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/languages/admin/English_log_help.php,v $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2008-02-16 14:57:37 $
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/languages/English_log_help.php,v $
|
||||
| $Revision: 1.1 $
|
||||
| $Date: 2008-12-07 21:41:04 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
Reference in New Issue
Block a user