}\r
\r
/* default installed plugins and skins */\r
-$aConfPlugsToInstall = array('NP_SecurityEnforcer', 'NP_SkinFiles');\r
+$aConfPlugsToInstall = array('NP_SecurityEnforcer', 'NP_SkinFiles', 'NP_Medium');\r
$aConfSkinsToImport = array('atom', 'rss2.0', 'rsd', 'default', 'admin/default', 'admin/bookmarklet');\r
\r
// Check if some important files\r
}\r
\r
// include translation file\r
-if ( array_key_exists('locale', $_POST) ) $param->set_locale();\r
-i18n::set_current_locale($param->locale);\r
-$translation_file = './locales/' . i18n::get_current_locale() . '.' . i18n::get_current_charset() . '.php';\r
-if ( !file_exists($translation_file) )\r
-{\r
- $translation_file = './locales/en_Latn_US.UTF-8.php';\r
-}\r
-include($translation_file);\r
+$param->set_locale();\r
\r
do_action();\r
\r
switch ( $param->state )\r
{\r
case 'locale':\r
- $param->set_locale();\r
$param->set_state('mysql');\r
$isPostback = false;\r
break;\r
<h1><img src="./styles/nucleus_rogo.png" alt="NucleusCMS" /></h1>\r
<ul>\r
<?php\r
+ echo '<li>';\r
+ $label = '_LOCALE_' . strtoupper($param->locale);\r
+ if ( !defined($label) )\r
+ {\r
+ echo $param->locale;\r
+ }\r
+ else\r
+ {\r
+ echo constant($label);\r
+ }\r
+ echo "</li>\n";\r
+ \r
if ( in_array($param->state, array('mysql', 'weblog', 'install')) )\r
{\r
- echo '<li>', _STEP1, '</li><li';\r
+ echo '<li> > ' . _STEP1, '</li><li';\r
if ( $param->state == 'mysql' )\r
{\r
echo ' class="gry"';\r
}\r
echo '> > ', _STEP3, "</li>\n";\r
}\r
+ \r
if ( in_array($param->state, array('mysql', 'weblog', 'detail')) )\r
{\r
echo '<li class="rightbox">';\r
*/\r
function show_select_locale_form()\r
{\r
- // get locale list\r
- $localelist = i18n::get_available_locale_list();\r
- $locales = array();\r
- foreach ( $localelist as $locale ) {\r
- $checkfile = './locales/' . $locale . '.' . i18n::get_current_charset() . '.php';\r
- $locales[] = array( $locale, (!file_exists($checkfile) ? '* ' : '') . $locale );\r
- }\r
+ global $param;\r
+ \r
?>\r
<div id="container">\r
<p style="font-size:152%;font-weight:bold;">\r
- Select your locale:\r
+ <?php echo _LOCALE_HEADER; ?>\r
</p>\r
<form method="post" action="./index.php">\r
\r
<div class="prt">\r
<select name="locale">\r
<?php\r
- // Get the browser language that can be displayed\r
- // TODO: default locale select simple implementation\r
- $languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);\r
- $language = (is_array($languages) && count($languages) > 0) ? preg_replace('#^([\w]+).*$#', '$1', $languages[0]) : '';\r
-\r
+ $locales = i18n::get_available_locale_list();\r
foreach ( $locales as $locale )\r
{\r
- echo "<option value=\"$locale[0]\"";\r
- if ( i18n::strpos($locale[0], $language) === 0 )\r
+ if ( $param->locale != $locale )\r
+ {\r
+ echo "<option value=\"{$locale}\">";\r
+ }\r
+ else\r
{\r
- echo ' selected';\r
+ echo "<option value=\"{$locale}\" selected=\"selected\">";\r
}\r
- echo ">$locale[1]</option>\n";\r
+ \r
+ $checkfile = "./locales/{$locale}." . i18n::get_current_charset() . '.php';\r
+ if ( !file_exists($checkfile) )\r
+ {\r
+ echo '* ';\r
+ }\r
+ \r
+ $label = '_LOCALE_' . strtoupper($locale);\r
+ if ( !defined($label) )\r
+ {\r
+ echo $locale;\r
+ }\r
+ else\r
+ {\r
+ echo constant($label);\r
+ }\r
+ echo "</option>\n";\r
}\r
?>\r
</select>\r
- <p>Nucleus is installed in the selected locale, the locale of the Asterisk prefixed will be displayed in English because there is no translation of the installer file.</p>\r
- <p>We will wait for the translator by volunteers!</p>\r
- </p>\r
+ <p><?php echo _LOCALE_DESC1; ?></p>\r
+ <p><?php echo _LOCALE_DESC2; ?></p>\r
+ <p><?php echo _LOCALE_NEED_HELP;?></p>\r
<p class="sbt">\r
<button type="submit" name="action" value="locale" class="sbt_arw">START</button>\r
</p>\r
if ( DB::execute($query) === FALSE )\r
{\r
$errinfo = DB::getError();\r
- $errors[] = _INST_ERROR4 . ' (<small>' . $newpost . '</small>): ' . $errinfo[2];\r
+ $errors[] = _INST_ERROR4 . ' (<small>' . $query . '</small>): ' . $errinfo[2];\r
}\r
\r
/* push configurations */\r
'../index.php',\r
'../action.php',\r
'../nucleus/index.php',\r
- '../nucleus/media.php',\r
'../nucleus/libs/ACTION.php',\r
'../nucleus/libs/ACTIONLOG.php',\r
'../nucleus/libs/ACTIONS.php',\r
'../nucleus/libs/COMMENT.php',\r
'../nucleus/libs/COMMENTACTIONS.php',\r
'../nucleus/libs/COMMENTS.php',\r
- '../nucleus/libs/ENCAPSULATE.php',\r
'../nucleus/libs/ENTITY.php',\r
'../nucleus/libs/globalfunctions.php',\r
'../nucleus/libs/i18n.php',\r
// set default values\r
$this->state = 'locale';\r
$this->install_mode = 'simple';\r
- $this->locale = 'en_Latn_US';\r
+ $this->locale = '';\r
$this->mysql_host = @ini_get('mysql.default_host');\r
$this->blog_name = 'My Nucleus CMS';\r
$this->blog_shortname = 'mynucleuscms';\r
public function set_locale()\r
{\r
$this->read_parameter(array('locale'));\r
-\r
- if ( !in_array($this->locale, i18n::get_available_locale_list()) )\r
+ \r
+ if ( !$this->locale )\r
+ {\r
+ /**\r
+ * default locale select simple implementation\r
+ * \r
+ * NOTE:\r
+ * RFC2616: Hypertext Transfer Protocol -- HTTP/1.1\r
+ * http://www.ietf.org/rfc/rfc2616.txt\r
+ * \r
+ * 14.4 Accept-Language\r
+ * \r
+ * The Accept-Language request-header field is similar to Accept, but\r
+ * restricts the set of natural languages that are preferred as a\r
+ * response to the request. Language tags are defined in section 3.10.\r
+ * \r
+ * Accept-Language = "Accept-Language" ":"\r
+ * 1#( language-range [ ";" "q" "=" qvalue ] )\r
+ * language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )\r
+ * \r
+ * Each language-range MAY be given an associated quality value which\r
+ * represents an estimate of the user's preference for the languages\r
+ * specified by that range. The quality value defaults to "q=1". For\r
+ * example,\r
+ * \r
+ * Accept-Language: da, en-gb;q=0.8, en;q=0.7\r
+ * \r
+ * would mean: "I prefer Danish, but will accept British English and\r
+ * other types of English." A language-range matches a language-tag if\r
+ * it exactly equals the tag, or if it exactly equals a prefix of the\r
+ * tag such that the first tag character following the prefix is "-".\r
+ * The special range "*", if present in the Accept-Language field,\r
+ * matches every tag not matched by any other range present in the\r
+ * Accept-Language field.\r
+ * \r
+ * TODO: this is appropriate implement or not\r
+ */\r
+ $languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);\r
+ \r
+ /* retrieve language token of language tag from first token */\r
+ $language = '';\r
+ if ( is_array($languages) && count($languages) > 0 )\r
+ {\r
+ $language = preg_replace('#^([\w]+).*$#', '$1', $languages[0]);\r
+ }\r
+ \r
+ $locales = i18n::get_available_locale_list();\r
+ foreach ( $locales as $locale )\r
+ {\r
+ if ( i18n::strpos($locale, $language) === 0 )\r
+ {\r
+ $this->locale = $locale;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ \r
+ /* include installer translation messages */\r
+ $translation_file = "./locales/{$this->locale}." . i18n::get_current_charset() . '.php';\r
+ if ( !file_exists($translation_file) )\r
{\r
- $this->locale = 'en_Latn_US';\r
+ $translation_file = './locales/en_Latn_US.UTF-8.php';\r
}\r
+ include($translation_file);\r
+ \r
+ /* include global translation messages */\r
+ $translation_file = "../nucleus/locales/{$this->locale}." . i18n::get_current_charset() . '.php';\r
+ if ( !file_exists($translation_file) )\r
+ {\r
+ $translation_file = './locales/en_Latn_US.UTF-8.php';\r
+ }\r
+ include($translation_file);\r
+ \r
+ i18n::set_current_locale($this->locale);\r
+ \r
+ return;\r
}\r
\r
public function check_mysql_parameters()\r