function __construct()
 {
     // handle timezone needed since php 5.3
     if (function_exists('ini_get')) {
         if (ini_get('date.timezone') === '') {
             date_default_timezone_set('Europe/Berlin');
         }
     }
     $this->rootdir = $_SERVER["DOCUMENT_ROOT"] . '/openqrm/base';
     $this->tpldir = $this->rootdir . '/tpl';
     require_once $this->rootdir . '/class/file.handler.class.php';
     $file = new file_handler();
     require_once $this->rootdir . '/class/htmlobjects/htmlobject.class.php';
     require_once $this->rootdir . '/class/openqrm.htmlobjects.class.php';
     $html = new openqrm_htmlobject();
     // if openQRM is unconfigured, set openqrm empty
     if ($file->exists($this->rootdir . '/unconfigured')) {
         $this->openqrm = '';
         $this->webdir = $this->rootdir;
         $this->baseurl = $html->thisurl;
     } else {
         require_once $this->rootdir . '/class/user.class.php';
         $user = new user($_SERVER['PHP_AUTH_USER']);
         $user->set_user();
         require_once $this->rootdir . '/class/openqrm.class.php';
         $this->openqrm = new openqrm($file, $user, $html->response());
         $this->webdir = $this->openqrm->get('webdir');
         $this->baseurl = $this->openqrm->get('baseurl');
     }
     // only translate if openqrm is not empty (configure mode)
     if ($this->openqrm !== '') {
         $html->lang = $user->translate($html->lang, $this->rootdir . "/lang", 'htmlobjects.ini');
         $file->lang = $user->translate($file->lang, $this->rootdir . "/lang", 'file.handler.ini');
         $this->lang = $user->translate($this->lang, $this->rootdir . "/lang", 'openqrm.controller.ini');
     }
     require_once $this->rootdir . '/include/requestfilter.inc.php';
     $request = $html->request();
     $request->filter = $requestfilter;
     $this->response = $html->response();
     $this->request = $this->response->html->request();
     $this->file = $file;
 }
 function __construct()
 {
     // handle timezone needed since php 5.3
     if (function_exists('ini_get')) {
         if (ini_get('date.timezone') === '') {
             date_default_timezone_set('Europe/Berlin');
         }
     }
     $this->rootdir = $_SERVER["DOCUMENT_ROOT"] . '/openqrm/base';
     $this->portaldir = $_SERVER["DOCUMENT_ROOT"] . '/cloud-portal';
     $this->tpldir = $this->portaldir . '/user/tpl/';
     $this->langdir = $this->portaldir . '/user/lang/';
     require_once $this->rootdir . '/class/file.handler.class.php';
     require_once $this->rootdir . '/class/htmlobjects/htmlobject.class.php';
     require_once $this->rootdir . '/class/openqrm.htmlobjects.class.php';
     $html = new openqrm_htmlobject();
     $file = new file_handler();
     $this->response = $html->response();
     // handle user
     $user = '';
     if (isset($_SERVER['PHP_AUTH_USER'])) {
         require_once $this->rootdir . '/plugins/cloud/class/clouduser.class.php';
         $user = new clouduser($_SERVER['PHP_AUTH_USER']);
         $user->get_instance_by_name($_SERVER['PHP_AUTH_USER']);
         // handle user lang
         $lang = $this->response->html->request()->get('langselect');
         if ($lang !== '') {
             $user->update($user->id, array('cu_lang' => $lang));
             $user->get_instance_by_name($_SERVER['PHP_AUTH_USER']);
         }
     }
     // if openQRM is unconfigured, set openqrm empty
     if ($file->exists($this->rootdir . '/unconfigured')) {
         $this->openqrm = '';
         $this->webdir = $html->thisdir;
         $this->baseurl = $html->thisurl;
     } else {
         require_once $this->rootdir . '/class/openqrm.class.php';
         $this->openqrm = new openqrm($file, $user, $html->response());
         $this->webdir = $this->openqrm->get('webdir');
         $this->baseurl = $this->openqrm->get('baseurl');
     }
     // translate
     if ($user !== '') {
         $lang = $user->lang;
     } else {
         $lang = $this->response->html->request()->get('langselect');
     }
     $html->lang = $this->__translate($lang, $html->lang, $this->langdir, 'htmlobjects.ini');
     $file->lang = $this->__translate($lang, $file->lang, $this->langdir, 'file.handler.ini');
     require_once $this->rootdir . '/include/requestfilter.inc.php';
     $request = $html->request();
     $request->filter = $requestfilter;
     $this->file = $file;
     $this->baseurl = '/cloud-portal/';
     // templating default or custom
     $tpl = $this->portaldir . "/user/tpl/index.default.tpl.php";
     if ($this->file->exists($this->portaldir . "/user/tpl/index.tpl.php")) {
         $tpl = $this->portaldir . "/user/tpl/index.tpl.php";
     }
     $this->tpl = $tpl;
 }