Example #1
0
 /**
  * @param string $filename
  * @throws AException
  */
 public function __construct($filename)
 {
     if (is_dir($filename)) {
         $filename .= (substr($filename, -1) != '/' ? '/' : '') . 'error.txt';
     }
     $this->filename = $filename;
     if (!is_writable(pathinfo($filename, PATHINFO_DIRNAME))) {
         // if it happens see errors in httpd error log!
         throw new AException(AC_ERR_LOAD, 'Error: Log directory ' . DIR_LOGS . ' is non-writable. Please change permissions.');
     }
     //check is log-file writable
     //1.create file if it not exists
     $handle = @fopen($filename, 'a+');
     @fclose($handle);
     //2. then change mode to 777
     if (is_file($filename) && decoct(fileperms($filename) & 0777) != 777) {
         chmod($filename, 0777);
         //3.if log-file non-writable create new one
         if (!is_writable($filename)) {
             $this->filename = DIR_LOGS . 'error_0.txt';
             $handle = @fopen($this->filename, 'a+');
             @fclose($handle);
         }
     }
     if (class_exists('Registry')) {
         // for disabling via settings
         $registry = Registry::getInstance();
         if (is_object($registry->get('config'))) {
             $this->mode = $registry->get('config')->get('config_error_log') ? true : false;
         }
     }
 }
Example #2
0
File: insert.php Project: AidaDC/to
 function __construct($params)
 {
     parent::__construct($params);
     $this->conf = Registry::getInstance();
     $this->model = new minsert();
     $this->view = new vinsert();
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('showUserdata');
     // Variablen der Template-Dateien Werte zuordnen.
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     // Suche nach Benutzernamen starten.
     if ($request->issetParameter('userSearch')) {
         if ($request->issetParameter('namefilter') and $request->issetParameter('namefilter') != '') {
             $sessionRegistry->set('activeNamefilter', $request->getParameter('namefilter'));
         } else {
             $sessionRegistry->set('activeNamefilter', '*');
         }
         $sessionRegistry->set('activeGroup', $request->getParameter('groupSelect'));
     }
     if ($sessionRegistry->get('activeGroup') != null) {
         $view->assign('namefilter', $sessionRegistry->get('activeNamefilter'));
         $view->assign('groupSelect', $sessionRegistry->get('activeGroup'));
         $view->assign('results', $registry->get('ldapAccess')->search($sessionRegistry->get('activeNamefilter'), $sessionRegistry->get('activeGroup')));
     }
     if ($request->issetParameter('userSelect')) {
         $view->assign('userSelect', $request->getParameter('userSelect'));
         $view->assign('userdata', $registry->get('ldapAccess')->getUserInformation($request->getParameter('userSelect')));
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
 /**
  * @param string $session_name
  */
 public function init($session_name)
 {
     $path = dirname($_SERVER['PHP_SELF']);
     session_set_cookie_params(0, $path, null, defined('HTTPS') && HTTPS, true);
     session_name($session_name);
     // for shared ssl domain set session id of non-secure domain
     $registry = Registry::getInstance();
     if ($registry->get('config')) {
         if ($registry->get('config')->get('config_shared_session') && isset($_GET['session_id'])) {
             header('P3P: CP="CAO COR CURa ADMa DEVa OUR IND ONL COM DEM PRE"');
             session_id($_GET['session_id']);
             setcookie($session_name, $_GET['session_id'], 0, $path, null, defined('HTTPS') && HTTPS, true);
         }
     }
     if (isset($_GET[EMBED_TOKEN_NAME]) && !isset($_COOKIE[$session_name])) {
         session_id($_GET[EMBED_TOKEN_NAME]);
         setcookie($session_name, $_GET[EMBED_TOKEN_NAME], 0, $path, null, defined('HTTPS') && HTTPS);
         $session_mode = 'embed_token';
     } else {
         $session_mode = '';
     }
     session_start();
     /*
     NOTE: You can enable this section if you need extra security to prevent session attacks. 
     We recomed to use of SSL on all admin pages and customer related storefront pages.
     if(!$this->_prevent_hijacking()){
     	$this->clear();
     	session_name($this->ses_name);
     	session_start();
     }
     */
     $_SESSION['session_mode'] = $session_mode;
 }
Example #5
0
/**
 * called for caught exceptions
 * @param  AException $e
 * @return null
 */
function ac_exception_handler($e)
{
    //fix for default PHP handler call in third party PHP libraries
    if (!method_exists($e, 'logError')) {
        $e = new AException($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
    }
    if (class_exists('Registry')) {
        $registry = Registry::getInstance();
        $config = $registry->get('config');
        if (!$config || !$config->has('config_error_log') && !$config->has('config_error_display')) {
            $e->logError();
            $e->displayError();
        } else {
            if ($config->has('config_error_log') && $config->get('config_error_log')) {
                $e->logError();
            }
            if ($config->has('config_error_display') && $config->get('config_error_display')) {
                $e->displayError();
            }
        }
        return null;
    }
    $e->logError();
    $e->displayError();
}
Example #6
0
	 * @var	Registry 
	 */
    protected $_registry;
    /**
	 * Cria uma variável para a view. Não pode ser sobrescrito
	 * @param	string	$var		nome da variável
	 * @param	mixed	$value		valor da variável
	 * @return	void
 public static function recoveryDate(\DateTime $data)
 {
     print_r($data);
     die;
     $data->format("d/m/Y H:s:i");
     Registry::getInstance()->set('data_hoje', $data);
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('changeSchool');
     // Template-Variablen Werte zuweisen.
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('districtList', $registry->get('ldapAccess')->getDistricts());
     if ($request->issetParameter('districtSelect')) {
         $view->assign('districtSelect', $request->getParameter('districtSelect'));
     }
     // Benutzeraktion: Kreis gewählt.
     if ($request->issetParameter('changeDistrict')) {
         $view->assign('schoolList', $registry->get('ldapAccess')->getSchools($request->getParameter('districtSelect')));
     }
     // Benutzeraktion: Schule gewechselt.
     if ($request->issetParameter('changeSchool')) {
         $sessionRegistry->set('school', 'ou=' . $request->getParameter('schoolSelect'));
         $sessionRegistry->set('district', 'ou=' . $request->getParameter('districtSelect'));
         $view->assign('schoolList', $registry->get('ldapAccess')->getSchools($request->getParameter('districtSelect')));
         $view->assign('schoolSelect', str_replace('ou=', '', $sessionRegistry->get('school')));
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
Example #9
0
 function __construct()
 {
     ob_start();
     $conf = Registry::getInstance();
     // access to app_data that configures html-view
     $this->view_data = (array) $conf->app;
 }
Example #10
0
 function save()
 {
     foreach (array_keys(Registry::getInstance()->get('locales')) as $locale) {
         $data[$locale] = ['html' => $this->get('html', $locale)];
     }
     parent::saveData($this->parentId, self::TABLE, $data);
 }
 public function execute(Request $request, Response $response)
 {
     $view = new TemplateView('createDistrict');
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     // Benutzeraktion: neuen Kreis anlegen.
     if ($request->issetParameter('create')) {
         // Eingabedaten auf Korrektheit prüfen
         $datacorrectness = true;
         if (!$request->issetParameter('districtName') or $request->getParameter('districtName') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Bitte geben Sie einen Namen für den Kreis an!');
         }
         if ($datacorrectness) {
             $status = $registry->get('ldapAccess')->createDistrict($request->getParameter('districtName'));
             if ($status != false) {
                 $view->assign('status', 'ok');
                 $view->assign('statusMsg', 'Der Kreis wurde korrekt angelegt!');
             } else {
                 $view->assign('status', 'warning');
                 $view->assign('statusMsg', 'Es ist ein Fehler aufgetreten!');
             }
         }
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
Example #12
0
 /**
  * @param string $filename
  * @throws AException
  */
 public function __construct($filename)
 {
     if (is_dir($filename)) {
         $filename .= (substr($filename, -1) != '/' ? '/' : '') . 'error.txt';
     }
     $this->filename = $filename;
     if (!is_writable(pathinfo($filename, PATHINFO_DIRNAME))) {
         // if it happens see errors in httpd error log!
         throw new AException(AC_ERR_LOAD, 'Error: Log directory ' . DIR_LOGS . ' is non-writable. Please change permissions.');
     }
     //1.create file if it not exists
     if (!file_exists($this->filename)) {
         $handle = @fopen($this->filename, 'a+');
         @fclose($handle);
     } else {
         if (!is_writable($this->filename)) {
             //create second log file if original is not writable
             $this->filename = DIR_LOGS . 'error_0.txt';
             $handle = @fopen($this->filename, 'a+');
             @fclose($handle);
         }
     }
     if (class_exists('Registry')) {
         // for disabling via settings
         $registry = Registry::getInstance();
         if (is_object($registry->get('config'))) {
             $this->mode = $registry->get('config')->get('config_error_log') ? true : false;
         }
     }
 }
Example #13
0
 function __construct($contents)
 {
     $this->reg = Registry::getInstance();
     //access to app_data
     $array_app = (array) $this->reg->app_data;
     Template::load($contents, $array_app);
 }
 /**
  * Get the config static object
  *
  * @return self
  */
 public static function getInstance($basePath = null)
 {
     if (!isset(self::$_Registry)) {
         self::$_Registry = parent::getInstance($basePath);
     }
     return self::$_Registry;
 }
Example #15
0
function buildStoreFrontMenuTree($menu_array, $level = 0)
{
    $menu_array = (array) $menu_array;
    if (!$menu_array) {
        return '';
    }
    $result = '';
    //for submenus build new UL node
    if ($level > 0) {
        $result .= "<ul class='sub_menu dropdown-menu'>\r\n";
    }
    $registry = Registry::getInstance();
    $logged = $registry->get('customer')->isLogged();
    $ar = new AResource('image');
    foreach ($menu_array as $item) {
        if ($logged && $item['id'] == 'login' || !$logged && $item['id'] == 'logout') {
            continue;
        }
        //build appropriate menu id and classes for css controll
        $id = empty($item['id']) ? '' : ' data-id="menu_' . $item['id'] . '" ';
        // li ID
        if ($level != 0) {
            if (empty($item['children'])) {
                $class = $item['icon'] ? ' class="top nobackground"' : ' class="sub menu_' . $item['id'] . '" ';
            } else {
                $class = $item['icon'] ? ' class="parent nobackground" ' : ' class="parent menu_' . $item['id'] . '" ';
            }
        } else {
            $class = $item['icon'] ? ' class="top nobackground"' : ' class="top menu_' . $item['id'] . '" ';
        }
        $href = empty($item['href']) ? '' : ' href="' . $item['href'] . '" ';
        //construct HTML
        $current = '';
        if ($item['current']) {
            $current = 'current';
        }
        $result .= '<li ' . $id . ' class="dropdown ' . $current . '">';
        $result .= '<a ' . $class . $href . '>';
        //check icon rl type html, image or none.
        $rl_id = $item['icon_rl_id'];
        if ($rl_id) {
            $resource = $ar->getResource($rl_id);
            if ($resource['resource_path'] && is_file(DIR_RESOURCE . 'image/' . $resource['resource_path'])) {
                $result .= '<img class="menu_image" src="' . HTTPS_DIR_RESOURCE . 'image/' . $resource['resource_path'] . '" alt="" />';
            } elseif ($resource['resource_code']) {
                $result .= $resource['resource_code'];
            }
        }
        $result .= '<span class="menu_text">' . $item['text'] . '</span></a>';
        //if children build inner clild tree
        if (!empty($item['children'])) {
            $result .= "\r\n" . buildStoreFrontMenuTree($item['children'], $level + 1);
        }
        $result .= "</li>\r\n";
    }
    if ($level > 0) {
        $result .= "</ul>\r\n";
    }
    return $result;
}
 public function __construct($custom_block_id)
 {
     $this->registry = Registry::getInstance();
     $this->custom_block_id = (int) $custom_block_id;
     // datasources hardcode
     $this->data_sources = array('catalog_product_getPopularProducts' => array('text' => 'text_products_popular', 'rl_object_name' => 'products', 'data_type' => 'product_id', 'storefront_model' => 'catalog/product', 'storefront_method' => 'getPopularProducts', 'storefront_view_path' => 'product/product'), 'catalog_product_getSpecialProducts' => array('text' => 'text_products_special', 'rl_object_name' => 'products', 'data_type' => 'product_id', 'storefront_model' => 'catalog/product', 'storefront_method' => 'getProductSpecials', 'storefront_view_path' => 'product/product'), 'catalog_category_getcategories' => array('text' => 'text_categories', 'rl_object_name' => 'categories', 'data_type' => 'category_id', 'storefront_model' => 'catalog/category', 'storefront_method' => 'getCategories', 'storefront_view_path' => 'product/category'), 'catalog_category_getmanufacturers' => array('text' => 'text_manufacturers', 'rl_object_name' => 'manufacturers', 'data_type' => 'manufacturer_id', 'storefront_model' => 'catalog/manufacturer', 'storefront_method' => 'getManufacturers', 'storefront_view_path' => 'product/manufacturer'), 'catalog_product_getfeatured' => array('text' => 'text_featured', 'rl_object_name' => 'products', 'data_type' => 'product_id', 'storefront_model' => 'catalog/product', 'storefront_method' => 'getFeaturedProducts', 'storefront_view_path' => 'product/product'), 'catalog_product_getlatest' => array('text' => 'text_latest', 'rl_object_name' => 'products', 'data_type' => 'product_id', 'storefront_model' => 'catalog/product', 'storefront_method' => 'getLatestProducts', 'storefront_view_path' => 'product/product'), 'catalog_product_getbestsellers' => array('text' => 'text_bestsellers', 'rl_object_name' => 'products', 'data_type' => 'product_id', 'storefront_model' => 'catalog/product', 'storefront_method' => 'getBestsellerProducts', 'storefront_view_path' => 'product/product'), 'media' => array('text' => 'text_media'), 'custom_products' => array('model' => 'catalog/product', 'total_method' => 'getTotalProducts', 'method' => 'getProducts', 'language' => 'catalog/product', 'data_type' => 'product_id', 'view_path' => 'catalog/product/update', 'rl_object_name' => 'products', 'text' => 'text_custom_products', 'storefront_model' => 'catalog/product', 'storefront_method' => 'getProduct', 'storefront_view_path' => 'product/product', 'items_list_url' => 'product/product/related'), 'custom_categories' => array('model' => 'catalog/category', 'total_method' => 'getTotalCategories', 'method' => 'getCategoriesData', 'language' => 'catalog/category', 'data_type' => 'category_id', 'view_path' => 'catalog/category/update', 'rl_object_name' => 'categories', 'text' => 'text_custom_categories', 'storefront_model' => 'catalog/category', 'storefront_method' => 'getCategory', 'storefront_view_path' => 'product/category', 'items_list_url' => 'product/product/product_categories'), 'custom_manufacturers' => array('model' => 'catalog/manufacturer', 'total_method' => 'getTotalManufacturers', 'method' => 'getManufacturers', 'language' => 'catalog/manufacturer', 'data_type' => 'manufacturer_id', 'view_path' => 'catalog/category/update', 'rl_object_name' => 'manufacturers', 'text' => 'text_custom_manufacturers', 'storefront_model' => 'catalog/manufacturer', 'storefront_method' => 'getManufacturer', 'storefront_view_path' => 'product/manufacturer', 'items_list_url' => 'catalog/manufacturer_listing/getManufacturers'));
 }
Example #17
0
 function __construct()
 {
     parent::__construct($this->params);
     $this->conf = Registry::getInstance();
     $this->model = new mModificarc();
     $this->view = new vModificarc();
 }
Example #18
0
 public function error($msg, $fatal = TRUE)
 {
     $config = Registry::getInstance();
     if ($config->error_log) {
         $fp = fopen($config->error_log, 'a');
         fwrite($fp, date('r') . ' : ' . $msg . "\n");
         fclose($fp);
     }
     if ($config->show_errors) {
         if ($fatal) {
             echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
             echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">';
             echo '<body><p>Fatal Framework Error: ' . $msg . '</p></body></html>';
             die;
         } else {
             echo '<p>Framework Error: ' . $msg . '</p>';
         }
     } else {
         if (!empty($config->error_page)) {
             include $config->error_page;
         }
         if ($fatal) {
             die;
         }
     }
 }
Example #19
0
 function __construct($params = null)
 {
     parent::__construct($params);
     $this->conf = Registry::getInstance();
     $this->model = new mUser();
     $this->view = new vUser();
 }
 public function execute(Request $request, Response $response)
 {
     $view = new TemplateView('lookUp');
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     // Benutzeraktion:
     if ($request->issetParameter('lookUp')) {
         $groupname = $request->getParameter('directSelect');
         $groupDN = $registry->get('ldapAccess')->getGroupDN_2($groupname);
         $user = $sessionRegistry->get('uid');
         $userPW = $sessionRegistry->get('userPW');
         // sTeam
         $steamConnector = new steam_connector('localhost', 1900, 'root', 'h6518_W#');
         if (!$steamConnector->get_login_status()) {
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Verbindung zum sTeam-Server konnte nicht erstellt werden!');
         } else {
             $ldapModule = $steamConnector->get_server_module('persistence:ldap');
             $steam_groupname = $steamConnector->predefined_command($ldapModule, 'dn_to_group_name', $groupDN, 0);
             $steamGroup = steam_factory::get_group($steamConnector, $steam_groupname, 0);
             $steamGroup->get_members(0);
             // Rückmeldung
             $view->assign('status', 'ok');
             $view->assign('statusMsg', 'LookUp wurde durchgef&uuml;hrt!');
         }
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
Example #21
0
 public function __construct($name)
 {
     /**
      * @var Registry
      */
     $this->registry = Registry::getInstance();
     //Add [date] snapshot to the name and validate if archive is already used.
     //Return error if archive can not be created
     $name = !$name ? 'backup_' . time() : $name;
     $this->backup_name = $name;
     //Create a tmp directory with backup name in admin/system/backup/ (add config constant DIR_BACKUP with path in init.php)
     //Create subdirectory /files and  /data
     $this->backup_dir = DIR_BACKUP . $this->backup_name . '/';
     if (!is_dir($this->backup_dir)) {
         $result = mkdir($this->backup_dir, 0777, true);
         if (!$result) {
             $this->error = "Error: Can't create directory " . $this->backup_dir . " during backup.";
             $this->log->write($this->error);
             $this->message->saveError('Backup Error', $this->error);
             $this->backup_dir = $this->backup_name = null;
         }
         chmod($this->backup_dir, 0777);
     }
     if (!is_dir($this->backup_dir . 'files')) {
         mkdir($this->backup_dir . 'files');
         chmod($this->backup_dir . 'files', 0777);
     }
     if (!is_dir($this->backup_dir . 'data')) {
         mkdir($this->backup_dir . 'data');
         chmod($this->backup_dir . 'data', 0777);
     }
 }
Example #22
0
 function __construct()
 {
     parent::__construct($this->params);
     $this->conf = Registry::getInstance();
     $this->model = new mEliminar();
     $this->view = new vEliminar();
 }
Example #23
0
		public static function StartApp()
		{
			ob_start('ob_gzhandler');
			session_start();
			
			// Defines
			define('BASEURL', substr((empty($_SERVER['HTTPS']) ? 'http://' : 'https://' ) . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'],0,-10));
			define('BASEPATH', substr($_SERVER['SCRIPT_FILENAME'],0,-10));
			
			// Helper Boot Loader
			require(BASEPATH.'/core/bootloader.php');
			
			// Initialize Helpers
			BootLoader::loadHelpers();
			Registry::getInstance();
			
			// Handle Errors
			Registry::setDebugMode(true);
			set_error_handler('Template::handleError');
			set_exception_handler('Template::handleException');
	
			// Initialize Database
			Model::$db = DBO::getInstance('sqlite:example.sqldb');
			
			// Init Autoloads
			spl_autoload_register('Autoload::controllers');
			spl_autoload_register('Autoload::models');
			
			// Determine Controllers and Methods
			Routes::getRoute();
			
			// Run Application
			Routes::run();
		}
Example #24
0
 function __construct()
 {
     parent::__construct($this->params);
     $this->conf = Registry::getInstance();
     $this->model = new mandroid();
     $this->view = new vandroid();
 }
Example #25
0
 public function __construct($form_name = '')
 {
     if (!IS_ADMIN) {
         // forbid for non admin calls
         throw new AException(AC_ERR_LOAD, 'Error: permission denied to change forms');
     }
     $this->registry = Registry::getInstance();
     //check if form with same name exists
     $sql = "SELECT form_id FROM " . DB_PREFIX . "forms WHERE form_name='" . $this->db->escape($form_name) . "'";
     $result = $this->db->query($sql);
     $this->form_id = (int) $result->row['form_id'];
     if ($this->form_id) {
         // field groups of form
         $sql = "SELECT group_id FROM " . DB_PREFIX . "form_groups WHERE form_id='" . $this->form_id . "'";
         $result = $this->db->query($sql);
         if ($result->num_rows) {
             $this->form_field_groups[] = (int) $result->row['group_id'];
         }
         // fields of form
         $sql = "SELECT field_id FROM " . DB_PREFIX . "fields WHERE form_id='" . $this->form_id . "'";
         $result = $this->db->query($sql);
         if ($result->num_rows) {
             $this->form_fields[] = (int) $result->row['field_id'];
         }
     }
 }
Example #26
0
 /**
  *
  */
 public function __construct()
 {
     $this->registry = Registry::getInstance();
     $this->db = $this->registry->get('db');
     $this->html = $this->registry->get('html');
     $this->session = $this->registry->get('session');
 }
 public function __construct()
 {
     $this->registry = Registry::getInstance();
     $this->db = $this->registry->get('db');
     $this->dataset = new ADataset('menu', 'storefront');
     $this->dataset_decription = new ADataset('menu', 'storefront_description');
     $this->_buildMenu();
 }
 public function __construct()
 {
     if (!IS_ADMIN) {
         // forbid for non admin calls
         throw new AException(AC_ERR_LOAD, 'Error: permission denied to change resources');
     }
     $this->registry = Registry::getInstance();
 }
Example #29
0
 public function init()
 {
     define('CLASS_DIR', 'core/');
     set_include_path(get_include_path() . PATH_SEPARATOR . CLASS_DIR);
     spl_autoload_extensions('.class.php');
     spl_autoload_register();
     $this->registry = Registry::getInstance();
 }
 /**
  * @return	array
  * @see		Products::getProducts()
  */
 public function getProducts()
 {
     $pdo = Registry::getInstance()->get('pdo');
     $stm = $pdo->prepare('SELECT * FROM `Product` AS `p` ORDER BY `p`.`productName`;');
     $stm->setFetchMode(PDO::FETCH_CLASS, 'Product');
     $stm->execute();
     return $stm->fetchAll();
 }