Exemple #1
0
/**
 * Loads a INI file according the Language
 *
 * @version 1
 * @author Rick de Man <*****@*****.**>
 *        
 * @param string $File
 *        	location of the INI file
 * @param string $Lang
 *        	Requested Language
 * @param string $DefaultLang
 *        	Default Language
 *        	
 * @return array | false Array when found, false when failed
 */
function getxmlarray($File, $Lang = "", $DefaultLang = "")
{
    $INI = str_replace('%1', $Lang, $File);
    if (file_exists($INI)) {
        // Load XML
        $XML = simplexml_load_file($INI);
        // XML to Array
        $XML = xml2array($XML);
        // Return XML array
        return $XML;
    } else {
        if ($DefaultLang !== "") {
            // Using Default Language
            return GetXmlArray(str_replace('%1', $DefaultLang, $File));
        }
    }
    return false;
}
Exemple #2
0
 /**
  * Start Loading The WMS - System is Setup
  *
  * @version 1
  * @author Rick de Man <*****@*****.**>
  *        
  */
 protected function WMS_Load()
 {
     // Allow Real Debugging
     $this->Debug = in_array($_SERVER['REMOTE_ADDR'], $this->WMS['Developers']) ? True : False;
     $_SESSION['WMS-Debug'] = $this->Debug;
     // Generate Debug List */
     if ($this->Debug === True && strtolower($_SERVER['QUERY_STRING']) == strtolower('Debug')) {
         Debug_All($this);
     }
     // Generate Debug List
     if ($this->Debug === True && strtolower($_SERVER['QUERY_STRING']) == strtolower('Mkdir')) {
         Debug_Mkdir($this->Root . 'lib');
     }
     $this->HTML_ConstructGet();
     // SQL Connection
     $this->SQL = new MySQL();
     var_dump($this->SQL->IsConnected());
     die;
     if (!$this->SQL->IsConnected()) {
         if (file_exists(WMS_ROOT . 'installation')) {
             header('Location: ' . $this->HTML_Root . 'installation');
             exit;
         }
         die('PHP PDO  is unable to open the connection.');
     }
     // Driver selection
     // TODO: do in the mysql class
     /*
     if( in_array(strtolower($this->_SQL['type']),PDO::getAvailableDrivers()) ){
     }else{
     	// Driver is not enabled / does not exists
     	die('PHP PDO  "'.$this->_SQL['type'].'" is not (yet) enabled or does not exist.');
     }
     */
     if ($this->WMS_Mode != 'AJAX') {
         // SQL Connection Module
         $this->Query_Clear_Locked();
     }
     // Get User Info
     $this->User__Construct();
     // Ajax Determines WMS Mode
     if ($this->WMS_Mode == 'AJAX') {
         $Mode_tmp = $this->WMS_Mode;
         $this->WMS_Mode = $this->WMS_Mode_Ini;
     }
     // Load 'Language' & 'Error' INI Files
     $this->Lang = GetXmlArray(WMS_LIB . 'lang/%1/' . $this->WMS_Mode . '.xml', $this->User['lang'], $this->WMS['LangDefault']);
     $this->Error = GetXmlArray(WMS_LIB . 'lang/%1/' . $this->WMS_Mode . '_error.xml', $this->User['lang'], $this->WMS['LangDefault']);
     // Check for errors
     if ($this->Lang === false) {
         die('Missing language file: ' . $this->WMS_Mode . ':' . $this->User['lang'] . '/' . $this->WMS['LangDefault']);
     }
     if ($this->Error === false) {
         die('Missing Error language file: ' . $this->WMS_Mode . ':' . $this->User['lang'] . '/' . $this->WMS['LangDefault']);
     }
     $_SESSION['Language'] = $this->Lang;
     $_SESSION['WMS-MinifyHtml'] = $this->WMS['MinifyHtml'] !== false;
     // LowerCase
     $this->Lang = ArrayChangeKey($this->Lang);
     $this->Error = ArrayChangeKey($this->Error);
     // Resore WMS mode
     if (isset($Mode_tmp)) {
         $this->WMS_Mode = $Mode_tmp;
     }
 }