| | |
| | | |
| | | //* Start the session |
| | | if($this->_conf['start_session'] == true) { |
| | | |
| | | $this->uses('session'); |
| | | session_set_save_handler( array($this->session, 'open'), |
| | | array($this->session, 'close'), |
| | | array($this->session, 'read'), |
| | | array($this->session, 'write'), |
| | | array($this->session, 'destroy'), |
| | | array($this->session, 'gc')); |
| | | |
| | | session_start(); |
| | | |
| | | //* Initialize session variables |
| | |
| | | if(empty($_SESSION['s']['language'])) $_SESSION['s']['language'] = $conf['language']; |
| | | } |
| | | |
| | | $this->uses('auth,plugin'); |
| | | $this->uses('auth,plugin,functions'); |
| | | } |
| | | |
| | | public function __destruct() { |
| | | session_write_close(); |
| | | if(isset($this->db)) $this->db->closeConn(); |
| | | } |
| | | |
| | | public function uses($classes) { |
| | |
| | | |
| | | /** Translates strings in current language */ |
| | | public function lng($text) { |
| | | global $conf; |
| | | if($this->_language_inc != 1) { |
| | | $language = (isset($_SESSION['s']['language']))?$_SESSION['s']['language']:$conf['language']; |
| | | //* loading global Wordbook |
| | | $this->load_language_file('/lib/lang/'.$_SESSION['s']['language'].'.lng'); |
| | | $this->load_language_file('lib/lang/'.$language.'.lng'); |
| | | //* Load module wordbook, if it exists |
| | | if(isset($_SESSION['s']['module']['name']) && isset($_SESSION['s']['language'])) { |
| | | $lng_file = '/web/'.$_SESSION['s']['module']['name'].'/lib/lang/'.$_SESSION['s']['language'].'.lng'; |
| | | if(!file_exists(ISPC_ROOT_PATH.$lng_file)) $lng_file = '/web/'.$_SESSION['s']['module']['name'].'/lib/lang/en.lng'; |
| | | if(isset($_SESSION['s']['module']['name'])) { |
| | | $lng_file = 'web/'.$_SESSION['s']['module']['name'].'/lib/lang/'.$language.'.lng'; |
| | | if(!file_exists(ISPC_ROOT_PATH.'/'.$lng_file)) $lng_file = '/web/'.$_SESSION['s']['module']['name'].'/lib/lang/en.lng'; |
| | | $this->load_language_file($lng_file); |
| | | } |
| | | $this->_language_inc = 1; |
| | |
| | | $filename = ISPC_ROOT_PATH.'/'.$filename; |
| | | if(substr($filename,-4) != '.lng') $this->error('Language file has wrong extension.'); |
| | | if(file_exists($filename)) { |
| | | @include_once($filename); |
| | | @include($filename); |
| | | if(is_array($wb)) { |
| | | if(is_array($this->_wb)) { |
| | | $this->_wb = array_merge($this->_wb,$wb); |