Esempio n. 1
0
 static function instance()
 {
     if (!cfg::$instance) {
         cfg::$instance = new cfg();
     }
     return cfg::$instance;
 }
Esempio n. 2
0
 public static function init()
 {
     /*
      * Zuordnung der Prozessart
      * -> Unterscheidung zwischen CLI-
      * und Browser-Aufruf
      */
     self::$proc = "browser";
     if (defined('STDIN')) {
         self::$proc = "cli";
     }
     self::$config_file = ROOT_DIR . "etc/config.php";
     if (!file_exists(self::$config_file)) {
         throw new Exception("Konfigurations-Datei " . self::$config_file . " nicht gefunden!");
     } else {
         require_once self::$config_file;
     }
     /*
      * Zuordnung der Konfigurations-Werte
      */
     self::$debug = $debug;
     self::$debug_file = $debug_file;
     self::$web_root = $web_root;
     self::$db_host = $db_host;
     self::$db_name = $db_name;
     self::$db_user = $db_user;
     self::$db_pass = $db_pass;
     debug::init();
     // debug::add_info("(" . __FILE__ . ")<b>" . __CLASS__ . "</b>::" . __FUNCTION__ . "(): Konfigurations-Datei eingelesen.");
 }
Esempio n. 3
0
 public function __construct()
 {
     try {
         $this->db = new PDO('mysql:dbname=' . cfg::cdb('database') . ';host=' . cfg::cdb('hostname'), cfg::cdb('username'), cfg::cdb('password'));
     } catch (PDOException $e) {
         throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
     }
     $this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name');
 }
Esempio n. 4
0
 public function __construct()
 {
     try {
         $this->db = new PDO('mysql:dbname=' . cfg::cdb('database') . ';host=' . cfg::cdb('hostname'), cfg::cdb('username'), cfg::cdb('password'));
     } catch (PDOException $e) {
         throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
     }
     $this->fetch = $this->db->prepare('SELECT modified, content FROM output_cache WHERE id = :id');
     $this->fetchTimestamp = $this->db->prepare('SELECT modified FROM output_cache WHERE id = :id');
     $this->save = $this->db->prepare('REPLACE INTO output_cache (id, name, cache_id, compile_id, content)
         VALUES  (:id, :name, :cache_id, :compile_id, :content)');
 }
/*
**************************
*/
require_once PHPOS_DIR . 'controllers/databaseController.php';
require_once PHPOS_DIR . 'classes/class.users.php';
require_once PHPOS_DIR . 'classes/class.phpos_config.php';
$config = new phpos_config();
$config->set_id_user();
require_once PHPOS_DIR . 'classes/class.helpers.php';
require_once PHPOS_DIR . 'classes/class.phpos_logs.php';
$phpos_log = new phpos_logs();
/*
**************************
*/
define("PHPOS_SYSTEM_LANG", cfg::get('lang'));
define("PHPOS_USER_LANG", cfg::uget('lang'));
require_once PHPOS_DIR . 'classes/class.languages.php';
require_once PHPOS_DIR . 'controllers/languageController.php';
require_once PHPOS_DIR . 'common/functions.php';
require_once PHPOS_DIR . 'classes/class.api_wintask.php';
require_once PHPOS_DIR . 'classes/class.api_processes.php';
require_once PHPOS_DIR . 'controllers/helpersController.php';
define('THEME_DIR', PHPOS_WEBROOT_DIR . '_phpos/themes/' . globalconfig('theme') . '/');
define('THEME_URL', PHPOS_WEBROOT_URL . '_phpos/themes/' . globalconfig('theme') . '/');
if ($_SESSION['DEBUG']) {
    //define("PHPOS_IN_DEBUG", true);
}
/*
**************************
*/
require_once PHPOS_DIR . 'classes/class.phpos_debugger.php';
Esempio n. 6
0
<?php

require_once "designer/php/configuration.php";
// cfg VERSION UPDATEN
$cfg = new cfg();
$cfg->setCurrentApplication("Test");
?>
<!DOCTYPE html>
<html>
    <head>
        <title>jsCow - Javascript Component Framework</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        
        <link type="text/css" rel="stylesheet" href="gen/production/css/theme-min.css" />
        
		<script type="text/javascript" src="node_modules/jquery/dist/jquery.min.js"></script>
        <script type="text/javascript" src="gen/production/jscow/jscow.min.js"></script>
        <?php 
foreach ($cfg->getComponentList() as $file) {
    echo '<script type="text/javascript" src="' . $cfg->getOnlinePath($file["path"] . $file["name"]) . '"></script>';
}
echo '<script type="text/javascript" src="apps/' . $cfg->getCurrentApplication() . '.js"></script>';
?>

    </head>
<body>
    
</body>
</html>
Esempio n. 7
0
define('APP_DIR', ROOT_DIR . "application" . DIRECTORY_SEPARATOR);
define('DATA_DIR', ROOT_DIR . "application" . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR);
define('VIEW_DIR', APP_DIR . "view" . DIRECTORY_SEPARATOR);
define('LIB_DIR', ROOT_DIR . "lib" . DIRECTORY_SEPARATOR);
define('TMPL_DIR', ROOT_DIR . "template" . DIRECTORY_SEPARATOR);
define('VAR_DIR', ROOT_DIR . "var" . DIRECTORY_SEPARATOR);
define('INC_DIR', ROOT_DIR . "inc" . DIRECTORY_SEPARATOR);
/**
 * setzen der benötigten Include-Verzeichnisse
 * für den Autoloader
 */
set_include_path(get_include_path() . PATH_SEPARATOR . APP_DIR . PATH_SEPARATOR . LIB_DIR . PATH_SEPARATOR . DATA_DIR . PATH_SEPARATOR . VIEW_DIR . PATH_SEPARATOR . TMPL_DIR . PATH_SEPARATOR . VAR_DIR . PATH_SEPARATOR . INC_DIR . PATH_SEPARATOR);
/*
 * Stelle Konfigurations-Variablen bereit
 */
cfg::init();
/*
 * extract $_POST, $_GET and $_SERVER['REQUEST_URI']
 */
$request = array_merge($_GET, $_POST, array("json" => json_decode(file_get_contents('php://input'))));
$request['uri'] = null;
if (isset($_SERVER['REQUEST_URI']) && strlen($_SERVER['REQUEST_URI']) > 0) {
    /*
     * prüfe auf web_root
     */
    if (cfg::$web_root != "/" && substr($_SERVER['REQUEST_URI'], 0, +strlen(cfg::$web_root)) === cfg::$web_root) {
        $_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], strlen(cfg::$web_root) - 1);
    }
    /*
     * prüfe auf "?"-GET Variablen:
     */
Esempio n. 8
0
function winConfig($helper_name, $helper_params = null)
{
    // Get globals
    $app_name = glb::get('app_name');
    $app_action = glb::get('app_action');
    $app_param = glb::get('app_param');
    $win_obj = glb::get('apiWindow');
    switch ($helper_name) {
        // ----------
        case 'use_params':
            // If GET parameters, then parse them and apply to window object
            if (!empty($_GET['app_params'])) {
                $win_obj->setAppParams($_GET['app_params']);
                glb::set('apiWIndow', $win_obj);
            }
            // If empty params (file included by ajax, from parent main window?)
            if (!$helper_params && !is_array(glb::get('app_param'))) {
                $app_param = $win_obj->getParam('app_params');
            }
            // Parse APP params
            foreach ($app_param as $key => $value) {
                $param_name = $key;
                $param_value = $value;
                // If object have param data in window object
                if ($win_obj->appParam($param_name)) {
                    $app_param[$param_name] = $win_obj->appParam($param_name);
                } else {
                    $win_obj->set_appParam($param_name, $param_value);
                }
            }
            glb::set('app_param', $app_param);
            // Apply parameters to global
            $win_obj->updateWindow();
            glb::set('apiWindow', $win_obj);
            break;
            // ----------
        // ----------
        case 'use_menu':
            // Default menu file = action, e.g. "indexMenu.php" (in main app folder)
            $menu_file = $app_action;
            // Override menu file if specified in array
            if (is_array($params)) {
                $menu_file = $params[$app_action];
            }
            // If menu exists, load it
            if (file_exists(PHPOS_APPS_DIR . $app_name . '/' . $menu_file . 'Menu.php')) {
                include PHPOS_APPS_DIR . $app_name . '/' . $menu_file . 'Menu.php';
                glb::set('app_menu', $app_menu);
                // Apply loaded menu to global
            }
            break;
            // ----------
        // ----------
        case 'use_toolbar':
            // Default toolbar file = action, e.g. "indexToolbar.php" (in main app folder)
            $toolbar_file = $app_action;
            // Override menu file if specified in array
            if (is_array($params)) {
                $toolbar_file = $params[$app_action];
            }
            // If menu exists, load it
            if (file_exists(PHPOS_APPS_DIR . $app_name . '/' . $toolbar_file . 'Toolbar.php')) {
                include PHPOS_APPS_DIR . $app_name . '/' . $toolbar_file . 'Toolbar.php';
                glb::set('app_toolbar', $app_toolbar);
                // Apply loaded menu to global
            }
            break;
            // ----------
        // ----------
        case 'use_action':
            // Override actual action
            break;
            // ----------
        // ----------
        case 'langs':
            // Load app langs config to global app_langs
            if (is_array($helper_params)) {
                $win_obj->appParam('_config_langs', $helper_params);
                glb::set('apiWindow', $win_obj);
                glb::set('app_langs', $helper_params);
            }
            break;
            // ----------
        // ----------
        case 'use_lang':
            // if param = choosen lang
            if (!empty($helper_params)) {
                $lang = $helper_params;
            } else {
                // if empty, get info from window
                $obj_lang = $win_obj->appParam('_config_lang');
                if (!empty($obj_lang)) {
                    $lang = $obj_lang;
                } else {
                    // set from global OS config
                    $lang = cfg::get('lang');
                }
            }
            // Set app lang
            glb::set("app_lang", $lang);
            // Get app available langs
            $app_langs = glb::get('app_langs');
            // If empty langs try load info from window params
            if (!is_array($app_langs)) {
                $app_langs = $win_obj->appParam('_config_langs');
            }
            // Get global lang file
            $txt = glb::get('txt');
            // Set app lang file to load
            $lang_file = $app_langs[$lang];
            // Load lang file
            if (file_exists(PHPOS_APPS_DIR . $app_name . '/lang/' . $lang_file . 'Lang.php')) {
                include PHPOS_APPS_DIR . $app_name . '/lang/' . $lang_file . 'Lang.php';
                $win_obj->appParam('_config_lang', $lang);
                $win_obj->updateWindow();
                glb::set('apiWindow', $win_obj);
                glb::set('txt', $txt);
                // add app lang to global lang
            }
            break;
    }
}
Esempio n. 9
0
if (class_exists('cfg')) {
    // scans the entire config directory (/config/..)
    // iterates through all the folders in the config directory
    foreach (cfg::scanDirectory() as $config_file) {
        // looks for the route config - special config parsing
        switch ($config_file) {
            case 'errors.ini':
                $errors = cfg::registerErrorsConfig();
                break;
            case 'routes.ini':
                $routes = cfg::registerRoutesConfig();
                break;
            default:
                // normal config parsing (not a routes config)
                cfg::registerConfig($config_file);
        }
    }
    if (defined('BASE_DIRECTORY')) {
        define('HOST_PATH', $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
        // remove the base directory path and removing any / characters from left or right of the path
        $parameters = explode('/', trim(str_replace(strtolower(BASE_DIRECTORY), '', HOST_PATH), '/'));
        // registering the users request parameters (url path)
        $path = trim(str_replace(strtolower(BASE_DIRECTORY) . '/', '', HOST_PATH));
        #var_dump(HOST_PATH);
        #var_dump($_SERVER['REQUEST_URI']);
        //var_dump(BASE_DIRECTORY); // $_SERVER['REQUEST_URI']
        //var_dump($_SERVER); // $_SERVER['REQUEST_URI']
        //var_dump($path); // $_SERVER['REQUEST_URI']
        //var_dump(ltrim($path, $_SERVER['HTTP_HOST'].'/'));
        #var_dump($routes);
Esempio n. 10
0
File: cfg.php Progetto: rhertzog/lcs
/**
 * la fonction appelee par le core, une simple "factory" de la classe cfg
 *
 * @param mixed $class # inutilisé
 */
function exec_cfg_dist($class = null)
{
	include_spip('inc/filtres');
	include_spip('inc/cfg');
	$config = new cfg(
		($nom = sinon(_request('cfg'), '')),
		($cfg_id = sinon(_request('cfg_id'),''))
		);
	
	// traitements du formulaire poste
	// seulement s'il provient d'un formulaire CFG
	// et non d'un formulaire CVT dans un fond CFG
	if (_request('arg'))
		$config->traiter();
	
	//
	// affichages
	//
	include_spip("inc/presentation");

	if (!$config->autoriser()) {
		echo $config->acces_refuse();
		exit;
	}

	pipeline('exec_init',array('args'=>array('exec'=>'cfg'),'data'=>''));

	$commencer_page = charger_fonction('commencer_page', 'inc');
	echo $commencer_page($config->get_boite(), 'cfg', $config->get_nom());
	echo "<br /><br /><br />\n";

	echo gros_titre(sinon($config->get_titre(), _T('cfg:configuration_modules')), '', false);	
	echo $config->barre_onglets();
	
	// colonne gauche
	echo debut_gauche('', true);

	// si un formulaire cfg est demande
	if ($s = $config->descriptif()) echo debut_boite_info(true) . $s . fin_boite_info(true);
	
	// affiche éventuellement une colonne supplémentaire à gauche
	if ($s = $config->gauche()) echo debut_boite_info(true) . $s . fin_boite_info(true);
	
	echo pipeline('affiche_gauche',array('args'=>array('exec'=>'cfg'),'data'=>''));
	echo creer_colonne_droite('', true);
	echo pipeline('affiche_droite',array('args'=>array('exec'=>'cfg'),'data'=>''));
		
	// affichage des messages envoyes par cfg
	if ($s = $config->messages()) echo debut_boite_info(true) . $s . fin_boite_info(true);

	// affichage des liens
	if ($s = $config->liens()) echo debut_boite_info(true) . $s . fin_boite_info(true);
	if ($s = $config->liens_multi()) echo debut_boite_info(true) . $s . fin_boite_info(true);
	
	echo debut_droite("", true);
	
	// centre de la page	
	if ($config->get_presentation() == 'auto') {
		echo debut_cadre_trait_couleur('', true, '', $config->get_boite());
		echo $config->formulaire();
		echo fin_cadre_trait_couleur(true);
	} else {
		echo $config->formulaire();
	}

	// pied
	echo fin_gauche() . fin_page();
}
Esempio n. 11
0
File: cfg.php Progetto: rhertzog/lcs
/**
 * retourne un tableau contenant une liste de fonds cfg et leurs parametres
 * d'onglet (oui/non/titre_parent), plus quelques autres parametres (url, titre, icone),
 * pour un repertoire donne (sinon tout le path)
 * 
 * @param string $dir
 * @return string
 */
function lister_onglets_cfg($dir='', $script='cfg'){
	$onglets = array();
	
	// scruter les onglets affichables
	if ($l = liste_cfg($dir)) {
		foreach($l as $fonds => $cfg) {

			if (!isset($onglets[$fonds])) 
				$onglets[$fonds] = array();
			$args = array();
			$args['afficher'] = false;
			
			// On va chercher la config cible
			// et on regarde ses donnees pour faire l'onglet
			// seulement si l'onglet doit etre affiche
			include_spip('inc/cfg');
			$tmp = new cfg($fonds);

			if ($tmp->autoriser()){
				$args['onglet'] = $tmp->form->param['onglet'];
				$args['url'] = generer_url_ecrire($script, 'cfg='.$fonds);
				// titre
				if (!$args['titre'] = $tmp->form->param['titre'])
					$args['titre'] = $fonds;
				// icone	
				$path = dirname(dirname($cfg));	
				$args['icone'] = '';
				if ($tmp->form->param['icone'])
					$args['icone'] = $path.'/'.$tmp->form->param['icone'];
				else if (file_exists($path.'/plugin.xml'))
					$args['icone'] = 'plugin-24.gif';
				else
					$args['icone'] = _DIR_PLUGIN_CFG.'cfg-doc-22.png';	
				
				// l'afficher ?
				if ($tmp->form->param['onglet'] == 'oui')
					$args['afficher'] = true;
			}
			
			$onglets[$fonds] = array_merge($args, $onglets[$fonds]); // conserver les donnees deja presentes ('enfant_actif')
		}
	}
	return $onglets;	
}
Esempio n. 12
0
 /**
  * set_template()
  *
  * Legt das Template anhand der Subdomain fest
  * @XXX: falls keine valide Subdomain vorhanden, wird der Parameter 'template'
  * abgeprüft und verwendet
  */
 private static function set_template()
 {
     if (!array_key_exists('template', $_SESSION)) {
         $invalid_subdomains = array("www", "vcvps2142");
         cfg::$template = "default";
         $num_match = preg_match($pattern = "/^([^\\.]+)\\.([^\\.]+)\\.([^\\.]+)\$/", $subject = $_SERVER['SERVER_NAME'], $match);
         if ($num_match == 1 && !in_array($match[1], $invalid_subdomains) && is_dir(TMPL_DIR . $match[1])) {
             cfg::$template = $match[1];
         }
         $_SESSION['template'] = cfg::$template;
     }
     if (array_key_exists("template", $_REQUEST) && is_dir(TMPL_DIR . $_REQUEST['template'])) {
         cfg::$template = $_REQUEST['template'];
         $_SESSION['template'] = cfg::$template;
     }
     cfg::$template = $_SESSION['template'];
 }