default language and session language
This commit is contained in:
parent
4a52eea793
commit
5e1f40ee3c
4 changed files with 11 additions and 9 deletions
|
@ -10,7 +10,7 @@
|
|||
*
|
||||
* @package NOCC
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License
|
||||
* @version SVN: $Id: nocc_contacts.php 2629 2014-11-19 15:23:53Z oheil $
|
||||
* @version SVN: $Id: nocc_contacts.php 3062 2023-03-06 11:07:35Z oheil $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -230,7 +230,7 @@ class NOCC_Contacts {
|
|||
* @todo Rewrite!
|
||||
*/
|
||||
public static function saveList($path, $contacts, $conf, &$ev) {
|
||||
include 'lang/' . $_SESSION['nocc_lang'] . '.php';
|
||||
global $html_err_file_contacts;
|
||||
if (file_exists($path) && !is_writable($path)) {
|
||||
$ev = new NoccException($html_err_file_contacts);
|
||||
return false;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*
|
||||
* @package NOCC
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License
|
||||
* @version SVN: $Id: nocc_languages.php 3060 2023-03-05 19:06:00Z oheil $
|
||||
* @version SVN: $Id: nocc_languages.php 3062 2023-03-06 11:07:35Z oheil $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -55,8 +55,7 @@ class NOCC_Languages {
|
|||
if (substr($path, -1) != '/') { //if NOT ends with '/'...
|
||||
$path .= '/';
|
||||
}
|
||||
|
||||
$this->_languages["default"]='';
|
||||
|
||||
//TODO: Move some code to a NOCC_Directory class?
|
||||
if ($handle = opendir($path)) { //if can open the directory...
|
||||
while (false !== ($name = readdir($handle))) { //for each item...
|
||||
|
@ -81,10 +80,12 @@ class NOCC_Languages {
|
|||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
|
||||
if ($this->exists($defaultLangId)) { //if the language exists...
|
||||
$this->_defaultLangId = strtolower($defaultLangId);
|
||||
}
|
||||
|
||||
$this->_languages["default"]=$this->_languages[$this->_defaultLangId];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,6 +168,7 @@ class NOCC_Languages {
|
|||
* @return bool Successful?
|
||||
*/
|
||||
public function setSelectedLangId($langId) {
|
||||
error_log("setSelectedLangId: ".$langId);
|
||||
if ($this->exists($langId)) { //if the language exists...
|
||||
$this->_selectedLangId = strtolower($langId);
|
||||
return true;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
* @package NOCC
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License
|
||||
* @version SVN: $Id: common.php 3060 2023-03-05 19:06:00Z oheil $
|
||||
* @version SVN: $Id: common.php 3062 2023-03-06 11:07:35Z oheil $
|
||||
*/
|
||||
|
||||
define('NOCC_DEBUG_LEVEL', 0);
|
||||
|
@ -140,7 +140,6 @@ if (isset($_REQUEST['lang'])) { //if a language is requested...
|
|||
$_SESSION['nocc_lang'] = $languages->getSelectedLangId();
|
||||
}
|
||||
}
|
||||
|
||||
if( isset($_SESSION['nocc_lang']) && $_SESSION['nocc_lang'] != "default" ) { //if session language already set...
|
||||
$languages->setSelectedLangId($_SESSION['nocc_lang']);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
*
|
||||
* @package NOCC
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License
|
||||
* @version SVN: $Id: send.php 2967 2021-12-10 14:24:34Z oheil $
|
||||
* @version SVN: $Id: send.php 3062 2023-03-06 11:07:35Z oheil $
|
||||
*/
|
||||
|
||||
require_once './common.php';
|
||||
|
@ -266,6 +266,7 @@ switch ($_REQUEST['sendaction']) {
|
|||
} else {
|
||||
$ev = new NoccException(i18n_message($lang_err_send_delay, $conf->send_delay));
|
||||
}
|
||||
|
||||
header("Content-type: text/html; Charset=UTF-8");
|
||||
if (NoccException::isException($ev)) {
|
||||
// Error while sending the message, display an error message
|
||||
|
|
Loading…
Reference in a new issue