Esempio n. 1
0
 /**
  * @brief Constructor
  */
 function __construct()
 {
     includeeasyhelper('logger');
     includeeasyhelper('showerror');
     includeeasylibrary('easyinireaderwriter');
     log_message(LOGGER_DEBUG, 'called function: ' . $this->getlibraryname() . '.' . __FUNCTION__ . ' begin');
     //log_message ( LOGGER_SYSTEM, $this->getlibraryname () . ' library is inited. version:' . $this->getversion () );
     adddependency($this->getlibraryname(), $this->getversion(), COMPONENT_LIBRARY, 'logger', '1.0.0.2', COMPONENT_HELPER);
     adddependency($this->getlibraryname(), $this->getversion(), COMPONENT_LIBRARY, 'easyinireaderwriter', '1.0.0.5', COMPONENT_LIBRARY);
     $this->acturl = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $this->segments = array();
     $this->controller = '';
     $this->functionname = '';
     $tacturl = $this->acturl;
     $tbaseurl = substr(geteasy()->getbaseurl(), strpos(geteasy()->getbaseurl(), '://') + 3);
     if (substr($tacturl, 0, strlen($tbaseurl)) == $tbaseurl) {
         $tacturl = substr($tacturl, strlen($tbaseurl));
         // Find parameters
         $poz = strpos($tacturl, '?');
         if ($poz !== FALSE) {
             $arr = explode('&', substr($tacturl, $poz + 1));
             foreach ($arr as $item) {
                 $par = explode('=', $item);
                 $this->parameters[] = array('name' => isset($par[0]) ? urldecode($par[0]) : '', 'value' => isset($par[1]) ? urldecode($par[1]) : '');
             }
             log_message(LOGGER_INFO, 'found parameters=' . print_r($this->parameters, true));
             $tacturl = substr($tacturl, 0, strpos($tacturl, '?'));
         } else {
             $this->parameters = array();
         }
         if (!$tacturl || strtoupper($tacturl) == 'INDEX.PHP') {
             // Not found method
             getinivalue('config', 'config.ini', 'routes', 'default', 'default/index');
             // Create if not exists
             $tacturl = 'default';
         } else {
             // remove index.php
             $tacturl = str_replace('index.php/', '', $tacturl);
             $tacturl = str_replace('index.php', '', $tacturl);
         }
         if (!$this->parsemethod($tacturl)) {
             /*Show error*/
             $arr = explode('/', $tacturl);
             log_message(LOGGER_SYSTEM, print_r($arr[0], true) . ' method not found!');
             showerror('Hiba', 'A ' . $arr[0] . ' metódus nem található', '');
             exit;
         }
     } else {
         /*Show error*/
         log_message(LOGGER_SYSTEM, print_r($tbaseurl, true) . ' is not set in config file\'s baseurl entry!');
         showerror('Hiba', 'A megadott URL nem felel meg a config fájlban beállított baseurl értékének.', '');
         exit;
     }
     log_message(LOGGER_DEBUG, 'called function: ' . $this->getlibraryname() . '.' . __FUNCTION__ . ' end');
 }
Esempio n. 2
0
 function __construct()
 {
     includeeasylibrary('easyinireaderwriter');
     includeeasyhelper('showerror');
     includeeasyhelper('utils');
     adddependency($this->getlibraryname(), $this->getversion(), COMPONENT_LIBRARY, 'easyinireaderwriter', '1.0.0.5', COMPONENT_LIBRARY);
     adddependency($this->getlibraryname(), $this->getversion(), COMPONENT_LIBRARY, 'showerror', '1.0.0.0', COMPONENT_HELPER);
     adddependency($this->getlibraryname(), $this->getversion(), COMPONENT_LIBRARY, 'utils', '1.0.0.2', COMPONENT_HELPER);
     $this->mode = getinivalue('config', 'config.ini', 'system', 'session_mode', 'generic');
     switch (strtoupper($this->mode)) {
         case 'GENERIC':
             $this->handler = geteasyhandler('easygenericsession');
             break;
         case 'FILE':
             showerror($caption = 'Information', $errormessage = 'File based session handler is not implemented!', '', 'defaulterror', 'info');
             break;
         case 'DATABASE':
             showerror($caption = 'Information', $errormessage = 'Database based session handler is not implemented!', '', 'defaulterror', 'info');
             break;
     }
     $this->handleerror($this->create());
 }
Esempio n. 3
0
 /**
  * @brief get base url
  */
 function getbaseurl()
 {
     if (easy::$instance->baseurl == '') {
         easy::$instance->baseurl = getinivalue('config', 'config.ini', 'system', 'baseurl', 'http://localhost/');
     }
     return easy::$instance->baseurl;
 }