Пример #1
0
 /**
  * @covers Config::write
  * @todo   Implement testWrite().
  */
 public function testWrite()
 {
     $config = array('app_key' => 'appkeyvalue', 'user_key' => 'userkeyvalue');
     $this->object->setConfig($config);
     echo getcwd();
     $this->object->setFileName('data/testOutputFile.ini');
     $this->object->write();
     $this->assertEquals($config, $this->object->read());
     unlink($this->object->getFileName());
 }
Пример #2
0
    protected function getContent()
    {
        // Inicializa assistente de formulário
        $form = new Form("myDetail");
        $dataArr['ajax'] = ["type" => Config::read('form.hidden'), "data" => (object) ["value" => true]];
        $dataArr['name'] = ["type" => Config::read('form.input'), "data" => (object) ["text" => Text::read('form.name'), "length" => 50]];
        $dataArr['surname'] = ["type" => Config::read('form.input'), "data" => (object) ["text" => Text::read('form.surname'), "length" => 50]];
        $dataArr['sex'] = ["type" => Config::read('form.radio'), "data" => (object) ["text" => Text::read('form.sex'), "value" => [(object) ["id" => 1, "text" => Text::read('form.man')], (object) ["id" => 2, "text" => Text::read('form.woman')]], "checked" => 1]];
        $dataArr['email'] = ["type" => Config::read('form.input'), "data" => (object) ["text" => Text::read('form.email'), "length" => 50]];
        $dataArr['password'] = ["type" => Config::read('form.password'), "data" => (object) ["text" => Text::read('form.password'), "length" => 20]];
        $dataArr['news'] = ["type" => Config::read('form.checkbox'), "data" => (object) ["text" => Text::read('form.newsletter'), "checked" => true]];
        $dataArr['btnSave'] = ["type" => Config::read('form.submit'), "data" => (object) ["text" => Text::read('form.save'), "class" => "success btn-lg"]];
        $accountForm = $form->createForm($dataArr);
        unset($dataArr);
        ob_start();
        ?>
          <div class="container">
            <div class="row cadastro">
              <div class="col-md-4 col-md-offset-4">
                <?php 
        echo $accountForm;
        ?>
              </div>
            </div>
          </div>
		<?php 
        return ob_get_clean();
    }
Пример #3
0
 /**
  * Create a new template object
  * @return object
  */
 public static function create()
 {
     // Try/catch statement
     try {
         // Required Smarty libraries
         require_once dirname(__DIR__) . '/smarty/libs/Smarty.class.php';
         // Optional - load custom security features
         //require_once(__DIR__.'/smartysecuritycustom.inc.php');
         // Smarty v3.1 or newer
         $smarty = new Smarty();
         $smarty->setTemplateDir(Config::read('smarty|templateDirectory'));
         $smarty->setCompileDir(Config::read('smarty|compileDirectory'));
         $smarty->setCacheDir(Config::read('smarty|cacheDirectory'));
         // Optional - override configs
         //$smarty->setConfigDir(Config::read('smarty|configDirectory'));
         // Optional - override plugins
         //$smarty->setPluginsDir(Config::read('smarty|pluginsDirectory'));
         $smarty->setCacheLifetime(Config::read('smarty|cacheLifetime'));
         // Disable caching
         $smarty->force_compile = true;
         $smarty->compile_check = true;
         $smarty->setCaching(Smarty::CACHING_OFF);
         // Optional - enable security restrictions
         //$smarty->enableSecurity('SmartySecurityCustom');
         // Return Smarty object
         return $smarty;
     } catch (Exception $e) {
         Log::error("Error while loading template engine");
         // Exception error
         return false;
     }
 }
Пример #4
0
 /**
  * Find cafés nearby
  *
  * @param array $get The original $_GET array
  * @return array
  * @throws \Exception
  * @author Jesper Skytte Hansen <*****@*****.**>
  */
 public static function find($get)
 {
     if (!isset($get['lat']) || !isset($get['lng'])) {
         return self::format('', 'MissingParams');
     }
     // Convert to floats
     $lat = floatval($get['lat']);
     $lng = floatval($get['lng']);
     // Set query parameters
     $query = array('location' => $lat . ',' . $lng, 'language' => 'da', 'rankby' => 'distance', 'sensor' => 'true', 'types' => 'cafe', 'key' => Config::read('Keys.GoogleApi'));
     // Create call url
     $url = 'https://maps.googleapis.com/maps/api/place/search/json?' . http_build_query($query);
     $url = str_replace('%2C', ',', $url);
     // Send request to google
     $d = self::curl($url);
     // Json decode string
     $d = json_decode($d, true);
     switch ($d['status']) {
         case 'OK':
             return self::format(array('latitude' => $lat, 'longitude' => $lng, 'results' => $d['results']));
             break;
         case 'ZERO_RESULTS':
             return self::format(array('latitude' => $lat, 'longitude' => $lng, 'results' => []));
             break;
     }
     return self::format('', 'UnknownApiResponse');
 }
Пример #5
0
 /**
  * Método que se utiliza para leer un .ini
  * @param type $file Nombre del archivo (sin el .ini);
  * @param type $source 
  */
 public static function read($file, $source = '', $force = FALSE)
 {
     $tmp = $file;
     $file = Config::read($file, $force);
     foreach ($file as $seccion => $filas) {
         foreach ($filas as $variable => $valor) {
             if ($valor == '1') {
                 $file[$seccion][$variable] = 'On';
             } else {
                 if (empty($valor)) {
                     $file[$seccion][$variable] = $tmp == 'databases' ? NULL : 'Off';
                 }
             }
         }
     }
     if ($source) {
         if (is_array($source)) {
             $key = @array_shift(array_keys($source));
             $var = $source[$key];
             return isset($file[$key][$var]) ? $file[$key][$var] : NULL;
         } else {
             return isset($file[$source]) ? $file[$source] : NULL;
         }
     }
     return $file;
 }
Пример #6
0
 public function __construct($params = "")
 {
     /**
      * Carrega os routes do sistema
      */
     $this->routes = Config::read("routes");
     //pr( $this->routes );
     /**
      * URL
      *
      * Verifica URL e decifra que controller
      * e action deve ser aberto.
      */
     $this->translateUrl();
     /**
      * AJUSTA CONEXÃO SE EXISTIR
      */
     $this->conn = empty($params["conn"]) ? NULL : $params["conn"];
     /**
      * Verifica tabelas
      */
     if ($this->conn) {
         $this->checkTables(array('conn' => $this->conn));
     }
 }
Пример #7
0
 public function selectForDetail($id)
 {
     $this->mapping->fields['id'] = 'productID';
     $this->mapping->fields['name'] = 'productName';
     $this->mapping->fields['text'] = 'productDescription';
     $this->mapping->fields['price'] = 'REPLACE( CAST( TRUNCATE(productPrice,2)    AS CHAR), ".", "," )';
     $this->mapping->fields['discount'] = 'REPLACE( CAST( TRUNCATE(productDiscount,2) AS CHAR), ".", "," )';
     $this->mapping->fields['status'] = 'productStatus';
     $this->mapping->fields['album'] = 'albumID';
     $this->mapping->fields['type'] = '(SELECT typeTitle' . ' FROM products_types AS textTable' . ' WHERE textTable.typeID = ' . $this->mapping->table . '.typeID)';
     $this->mapping->fields['subtype'] = '(SELECT typeTitle' . ' FROM products_types AS textTable' . ' WHERE textTable.typeID = ' . $this->mapping->table . '.subTypeID)';
     $this->mapping->fields['brand'] = '(SELECT brandTitle' . ' FROM products_brands AS textTable' . ' WHERE textTable.brandID = ' . $this->mapping->table . '.brandID)';
     $this->mapping->fields['account'] = 'accountID';
     $this->mapping->fields['accName'] = '(SELECT accountFirstName' . ' FROM accounts AS textTable' . ' WHERE textTable.accountID = ' . $this->mapping->table . '.accountID)';
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'productID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $id;
     $data = $this->detail($id);
     if ($data) {
         // Recupera fotos a partir do album
         if ($this->photoModel) {
             $data->photos = $this->photoModel->selectAlbum($data->album);
         }
         // Converte o código do status para texto
         $data->statusText = Text::read('product.status')[array_search($data->status, Config::read('product.status'))];
     } else {
         //exit($this->getMessage());
     }
     return $data;
 }
Пример #8
0
 protected function getContent()
 {
     // Inicializa assistente de formul‡rio
     $form = new Form("myDetail");
     $dataArr['ajax'] = ["type" => Config::read('form.hidden'), "data" => (object) ["value" => true]];
     $dataArr['name'] = ["type" => Config::read('form.input'), "data" => (object) ["text" => Text::read('form.name'), "length" => 100]];
     $dataArr['email'] = ["type" => Config::read('form.input'), "data" => (object) ["text" => Text::read('form.email'), "length" => 50]];
     $dataArr['message'] = ["type" => Config::read('form.textarea'), "data" => (object) ["text" => Text::read('form.message')]];
     $dataArr['btnSend'] = ["type" => Config::read('form.submit'), "data" => (object) ["text" => Text::read('form.send'), "class" => "success btn-lg"]];
     $messageForm = $form->createForm($dataArr);
     unset($dataArr);
     ob_start();
     ?>
         <div class="container">
             <div class="row cadastro">
                 <div class="col-md-4 col-md-offset-4">
                     <?php 
     echo $messageForm;
     ?>
                 </div>
             </div>
         </div>
     <?php 
     return ob_get_clean();
 }
Пример #9
0
 /**
  * Create a new template object
  * @return object
  */
 public static function create()
 {
     // Try/catch statement
     try {
         // Smarty installation
         $configDir = Config::read('smarty');
         // Required Smarty libraries
         require_once $configDir . '/libs/Smarty.class.php';
         // Smarty v3.1 or newer
         $smarty = new Smarty();
         $smarty->setTemplateDir(Config::read('pwd') . '/templates/' . Config::read('template'));
         $smarty->setCompileDir($configDir . '/templates_c');
         $smarty->setCacheDir($configDir . '/cache');
         // Disable caching
         $smarty->force_compile = true;
         $smarty->compile_check = true;
         $smarty->setCaching(Smarty::CACHING_OFF);
         // Return Smarty object
         return $smarty;
     } catch (Exception $e) {
         Log::error("Error while loading template engine");
         // Exception error
         return false;
     }
 }
Пример #10
0
 public function runApp()
 {
     $run_info = URLParser\URLParser::getPeices();
     # Include it and call it, really basic
     include APP_PATH . DS . 'controllers' . DS . $run_info['controller'] . '_controller.php';
     $controller_name = ucwords($run_info['controller']) . 'Controller';
     $this->controller = new $controller_name();
     # Load up the database includes if there is one specified
     if (Config::read('DATABASE_CONNECTOR') !== '') {
         include LITEFRAME_PATH . DS . 'lib' . DS . 'php-activerecord' . DS . 'ActiveRecord.php';
         $connections = Config::read('DATABASE_CONNECTIONS');
         $default_connection = Config::read('DATABASE_CONNECTOR');
         $model_path = APP_PATH . DS . 'models';
         # must issue a "use" statement in your closure if passing variables
         \ActiveRecord\Config::initialize(function ($cfg) use($connections, $default_connection, $model_path) {
             $cfg->set_model_directory($model_path);
             $cfg->set_connections($connections);
             # default connection is now production
             $cfg->set_default_connection($default_connection);
         });
     }
     call_user_func_array(array($this->controller, 'init'), array());
     ob_start();
     call_user_func_array(array($this->controller, $run_info['function']), $run_info['args']);
     $content_for_layout = ob_get_clean();
     ob_end_clean();
     $title_for_layout = $this->controller->title;
     # Finally output with a global layout
     if ($this->controller->layout !== '') {
         include APP_PATH . DS . 'layouts' . DS . $this->controller->layout . '.tpl';
     } else {
         include LITEFRAME_PATH . DS . 'layouts' . DS . 'default.tpl';
     }
 }
Пример #11
0
/**
 * Generador de Reportes
 *
 * @category Kumbia
 * @package Report
 * @copyright Copyright (c) 2005-2007 Andres Felipe Gutierrez (andresfelipe at vagoogle.net)
 * @license http://www.kumbia.org/license.txt GNU/GPL
 *
 */
function htm($result, $sumArray, $title, $weighArray, $headerArray)
{
    $config = Config::read('config');
    $active_app = Router::get_application();
    $file = md5(uniqid());
    $content = "\n<html>\n <head>\n   <title>REPORTE DE " . strtoupper($title) . "</title>\n </head>\n <body bgcolor='white'>\n <div style='font-size:20px;font-family:Verdana;color:#000000'>" . strtoupper($config->{$active_app}->name) . "</div>\n\n <div style='font-size:18px;font-family:Verdana;color:#000000'>REPORTE DE " . strtoupper($title) . "</div>\n\n <div style='font-size:18px;font-family:Verdana;color:#000000'>" . date("Y-m-d") . "</div>\n\n <br/>\n <table cellspacing='0' border=1 style='border:1px solid #969696'>\n ";
    $content .= "<tr bgcolor='#F2F2F2'>\n";
    for ($i = 0; $i <= count($headerArray) - 1; $i++) {
        $content .= "<th style='font-family:Verdana;font-size:12px'>" . $headerArray[$i] . "</th>\n";
    }
    $content .= "</tr>\n";
    $l = 5;
    foreach ($result as $row) {
        $content .= "<tr bgcolor='white'>\n";
        for ($i = 0; $i <= count($row) - 1; $i++) {
            if (is_numeric($row[$i])) {
                $content .= "<td style='font-family:Verdana;font-size:12px' align='center'>{$row[$i]}</td>";
            } else {
                $content .= "<td style='font-family:Verdana;font-size:12px'>{$row[$i]}&nbsp;</td>";
            }
        }
        $content .= "</tr>\n";
        $l++;
    }
    file_put_contents("public/temp/{$file}.html", $content);
    if (isset($raw_output)) {
        print "<script type='text/javascript'> window.open('" . KUMBIA_PATH . "temp/" . $file . ".html', null);  </script>";
    } else {
        Generator::forms_print("<script type='text/javascript'> window.open('" . KUMBIA_PATH . "temp/" . $file . ".html', null);  </script>");
    }
}
Пример #12
0
 /**
  * @param string|null $version
  */
 public function setPHP($version = null)
 {
     $phpVersions = $this->config->read('php_commands');
     if (is_array($phpVersions) && in_array($version, array_keys($phpVersions))) {
         $this->php = $phpVersions[$version];
     }
 }
Пример #13
0
function site_include($Filename)
{
    if (Config::read('site.includenone')) {
    } else {
        include $Filename;
    }
}
Пример #14
0
    protected function getContent()
    {
        ob_start();
        ?>
			<div class="jumbotron text-center">
			  <h1>
				<span class="glyphicon glyphicon-time"></span>
				<?php 
        echo Text::read('message.login.session.inactive');
        ?>
			  </h1>
			  <h2>
				<a class="btn btn-lg btn-info" href="<?php 
        echo Config::read('page.url.login');
        ?>
">
				  <span class="glyphicon glyphicon-home"></span>&nbsp;
				  <?php 
        echo Text::read('message.login.session.return');
        ?>
				</a>
			  </h2>
			</div>
		<?php 
        return ob_get_clean();
    }
Пример #15
0
 private function __construct()
 {
     $this->dbType = Config::read('db.type');
     switch ($this->dbType) {
         case 'mysql':
             $dsn = "mysql:host=" . Config::read('db.host') . ";port=" . Config::read('db.port') . ";dbname=" . Config::read('db.basename');
             $username = Config::read('db.user');
             $password = Config::read('db.password');
             $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES " . Config::read('db.charset'));
             break;
         case 'sqlite':
             $dsn = "sqlite:" . Config::read('db.basename');
             $options = array(PDO::ATTR_PERSISTENT => true);
             break;
         case 'sqlite2':
             $dsn = "sqlite2:" . Config::read('db.basename');
             $options = array(PDO::ATTR_PERSISTENT => true);
             break;
         case 'pgsql':
             $dsn = "pgsql:host=" . Config::read('db.host') . ";port=" . Config::read('db.port') . ";dbname=" . Config::read('db.basename') . ";user="******";password=" . Config::read('db.password');
             break;
     }
     try {
         if ($this->dbType == 'pgsql') {
             $this->dbh = new PDO($dsn);
         } elseif ($this->dbType == 'sqlite') {
             $this->dbh = new PDO($dsn, NULL, NULL, $options);
         } elseif ($this->dbType == 'mysql') {
             $this->dbh = new PDO($dsn, $username, $password, $options);
         }
     } catch (PDOException $e) {
         print 'Error!: ' . $e->getMessage() . '<br/>';
         die;
     }
 }
Пример #16
0
 /**
  * Load data
  */
 public function load($path = NULL)
 {
     $path or $path = $this->getPath();
     if ($data = Config::read($path)) {
         $this->import($data);
     }
 }
Пример #17
0
Файл: db.php Проект: Jamp/sgas
 /**
  * Realiza una conexión directa al motor de base de datos
  * usando el driver de Kumbia
  *
  * @param string $database base de datos a donde conectar
  * @return DbBase
  */
 private static function connect($database)
 {
     $databases = Config::read('databases');
     $config = $databases[$database];
     // carga los valores por defecto para la conexión, si no existen
     $default = array('port' => 0, 'dsn' => NULL, 'dbname' => NULL, 'host' => 'localhost', 'username' => NULL, 'password' => NULL);
     $config = $config + $default;
     $path = __DIR__;
     //Si usa PDO
     if (isset($config['pdo'])) {
         $dbclass = "DbPdo{$config['type']}";
         $db_file = "{$path}/adapters/pdo/{$config['type']}.php";
     } else {
         if ($config['type'] == 'mysql') {
             $config['type'] = 'mysqli';
         }
         $dbclass = "Db{$config['type']}";
         $db_file = "{$path}/adapters/{$config['type']}.php";
     }
     //Carga la clase adaptadora necesaria
     if (!(include_once $db_file)) {
         throw new KumbiaException("No existe la clase {$dbclass}, necesaria para iniciar el adaptador");
     }
     return new $dbclass($config);
 }
Пример #18
0
 protected function getContent()
 {
     // Prepara formulário de pesquisa
     $dataArr['ajax'] = ["type" => Config::read('form.hidden'), "data" => (object) ["value" => true]];
     $dataArr['page'] = ["type" => Config::read('form.hidden'), "data" => (object) ["value" => 1]];
     $dataArr['name'] = ["type" => Config::read('form.input'), "data" => (object) ["text" => Text::read('form.product')]];
     $dataArr['btnSearch'] = ["type" => Config::read('form.submit'), "data" => (object) ["text" => Text::read('form.search'), "class" => "primary", "icon" => "glyphicon-search"]];
     $form = new Form("mySearch");
     $form->setHorizontal();
     $searchForm = $form->createForm($dataArr);
     ob_start();
     ?>
         <div class="container">
           <div class="row">
             <a id="toogleFilter" class="pull-right" data-toggle="collapse" data-target="#collapseFilter" href="#">
                 <span class="text">Exibir Filtros </span><span class="glyphicon glyphicon-menu-down"></span>
             </a>
             <div id="collapseFilter" class="panel-body panel-collapse collapse">
                 <?php 
     echo $searchForm;
     ?>
             </div>
           </div>
         </div>
     
         <div id="resultPanel" class="panel-body table-responsive">
             <?php 
     echo $this->result;
     ?>
         </div>
     <?php 
     return ob_get_clean();
 }
Пример #19
0
function print_head()
{
    ?>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="/favicon.ico">
    <title><?php 
    echo Config::read('site.title');
    ?>
</title>
    <link href="/css/bootstrap.min.css" rel="stylesheet">
<!--
    <link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.6/cosmo/bootstrap.min.css" rel="stylesheet">
-->
    <link href="/css/navbar-static-top.css" rel="stylesheet">
    <link href="/css/sticky-footer.css" rel="stylesheet">
    <link href="/css/framy.css" rel="stylesheet">
    <link href="/css/icons.css" rel="stylesheet">
    <link rel="stylesheet" href="/opt/bootstrap-select/bootstrap-select.min.css">    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
<?php 
}
Пример #20
0
 /**
  * Read from cache
  * 
  * @param string $name
  * @param boolean $force
  * @return mixed|NULL
  */
 public function read($name, $force = FALSE)
 {
     if (!$force && $this->enabled === FALSE) {
         return NULL;
     }
     $name = $this->prepareKey($name);
     $path = $this->options->path . DS . $name;
     if (file_exists($path)) {
         $data = Config::read($path, Config::AS_ARRAY);
         if ($force) {
             return $data['value'];
         } elseif ($data['ttl'] && time() > $data['ttl']) {
             return NULL;
         } elseif (isset($data['tags']) && is_array($data['tags'])) {
             foreach ($data['tags'] as $tag) {
                 if (!$this->read('tags/' . $tag)) {
                     return NULL;
                 }
             }
         } else {
             return $data['value'];
         }
     }
     return NULL;
 }
Пример #21
0
 private function __construct()
 {
     // building data source name from config
     $dsn = 'mysql:charset=utf8;host=' . Config::read('db.host') . ';dbname=' . Config::read('db.basename') . ';port=' . Config::read('db.port') . ';connect_timeout=15';
     $user = Config::read('db.user');
     $password = Config::read('db.password');
     $this->dbh = new PDO($dsn, $user, $password);
 }
Пример #22
0
 public function __construct()
 {
     $this->Session = Session::getInstance();
     $this->Rules = Rules::getInstance();
     $this->Cache = CacheFactory::factory();
     $this->tables = Config::read('modules.Session.User.Auth.tables');
     $this->auths = array();
 }
Пример #23
0
 public function getTextContent($key)
 {
     $this->getConfig();
     $questions = Config::read('secure.captcha_text_questions');
     $qkey = array_rand($questions);
     $text = $questions[$qkey];
     $_SESSION[$key] = $qkey;
     return $text;
 }
 public static function getServerMessage()
 {
     if (!Config::read('allow_server_notifications')) {
         return '';
     }
     $context = stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 2)));
     $message = @file_get_contents(self::$apiUrl . 'cdn/message.php?v=' . FPS_VERSION, null, $context);
     return !empty($message) ? json_decode($message, true) : array();
 }
Пример #25
0
 /**
  * Export configuration (php.ini)
  * @param DatabaseSqlite3 &$db Database object
  * @return boolean
  */
 public function exportConfiguration(&$db)
 {
     Log::debug('Export configuration: php');
     // Smarty template
     $smarty = TemplateFactory::create();
     if ($smarty === false) {
         return false;
     }
     // Try to detect the timezone of the server
     $timezone = '';
     $timedatectl = array();
     exec('/usr/bin/timedatectl', $timedatectl);
     foreach ($timedatectl as $t) {
         // Look for time zone string
         if (strpos($t, 'Time zone') !== false) {
             $rc = preg_match('/Time zone: (.*) \\(/U', $t, $matches);
             if ($rc === 1 && isset($matches[1])) {
                 // Match found, store and break from loop
                 $timezone = trim($matches[1]);
                 break;
             }
         }
     }
     // Assign variables
     $smarty->assignByRef('TIMEZONE', $timezone);
     // Load custom changes from template
     $params = explode("\n", $smarty->fetch('php.tpl'));
     // Load the php.ini file into memory
     $ini = file_get_contents(Config::read('php|iniFile'));
     if ($ini === false) {
         Log::error('Error while loading file: ' . Config::read('php|iniFile'));
         return false;
     }
     // Loop each parameter
     foreach ($params as $p) {
         // Trim input
         $p = trim($p);
         // Skip empty and/or invalid lines
         if ($p == '' || strpos($p, '=') === false) {
             continue;
         }
         $p = explode('=', $p);
         $rc = $this->_setIniParameter($ini, $p[0], $p[1]);
         if ($rc === false) {
             return false;
         }
     }
     // Save the modified php.ini
     Log::debug('Writing to file: ' . Config::read('php|iniFile'));
     $rc = file_put_contents(Config::read('php|iniFile'), $ini, LOCK_EX);
     if ($rc === false) {
         Log::error('Error while writing to file: ' . Config::read('php|iniFile'));
         return false;
     }
     return true;
 }
Пример #26
0
 /**
  * Método contructor
  */
 public function __construct()
 {
     //Reviso la configuración actual
     $config = Config::read('config');
     $this->_database = $config['application']['database'];
     //Conecto a la bd
     $this->_connect();
     //Cargo las tablas
     $this->_loadTables();
 }
Пример #27
0
 private function __construct()
 {
     // building data source name from config
     $dsn = Config::read('db.prefix') . ':host=' . Config::read('db.host') . ';dbname=' . Config::read('db.basename') . ';port=' . Config::read('db.port') . ';connect_timeout=15';
     // getting DB user from config
     $user = Config::read('db.user');
     // getting DB password from config
     $password = Config::read('db.password');
     $this->dbh = new PDO($dsn, $user, $password);
 }
Пример #28
0
function error_page($message)
{
    begin_mini_page();
    echo "<h1>" . Config::read('site.title') . "</h1>";
    echo "<h2>Error</h2>";
    echo "<div class=\"alert alert-danger\">";
    echo $message;
    echo "</div>";
    end_mini_page();
}
function weblog_get_options($conf_name, $options)
{
    //コンフィグの読み込み
    $config = new Config("plugin/weblog/{$conf_name}");
    if ($config->read()) {
        foreach ($config->get('Config') as $conf_item) {
            $options[$conf_item[0]] = $conf_item[1];
        }
    }
    return $options;
}
Пример #30
0
function showErrorMessage($message = '', $error = '', $redirect = false, $queryString = '')
{
    if ($redirect === true) {
        header('Refresh: ' . Config::read('redirect_delay') . '; url=http://' . $_SERVER['SERVER_NAME'] . get_url($queryString));
    }
    $Register = Register::getInstance();
    $View = $Register['Viewer'];
    $data['info_message'] = $message;
    $data['error_message'] = Config::read('debug_mode') ? $error : null;
    $html = $View->view('infomessagegrand.html', array('data' => $data));
    echo $html;
}