Esempio n. 1
0
 public function __construct()
 {
     require_once __DIR__ . "/../../../clavis.php";
     require_once __DIR__ . "/../../autogen/appEnv.php";
     $this->values = [];
     $this->values = array_merge($this->values, getAppEnv());
     $this->values = array_merge($this->values, getAppKeys());
 }
Esempio n. 2
0
 /**
  *
  */
 public function __construct()
 {
     $this->values = [];
     $this->values = array_merge($this->values, getAppEnv());
     if (function_exists('getAppKeys')) {
         $this->values = array_merge($this->values, getAppKeys());
     }
 }
Esempio n. 3
0
 public function __construct($key, $serialize = true, $ttl = false, $gzip = false)
 {
     $this->client = new Client();
     $this->baseKey = substr(md5(getAppEnv()->getEnv() . $key), 0, 10);
     $this->serialize = $serialize;
     $this->ttl = $ttl;
     $this->gzip = $gzip;
 }
/**
 * @return \Igorw\Silex\Config
 */
function getAppConfig($key = null)
{
    static $cnf = null;
    if (is_null($cnf)) {
        $cnf = new Igorw\Silex\Config(getAppEnv());
    }
    if (!is_null($key)) {
        return $cnf->getConfig($key);
    }
    return $cnf;
}
Esempio n. 5
0
<?php

define("__APP__", __DIR__ . '/../app');
define("__CONFIG__", __DIR__ . '/../config');
require __APP__ . '/bootstrap/autoload.php';
if (!is_file(__CONFIG__ . '/env.php')) {
    echo "Please set the config/env.php file. You can use the config/env.default as a example.";
    die;
}
$env = (require_once __CONFIG__ . '/env.php');
$app = new \Slim\Slim(getConfigApp($env));
$app->setName(getAppEnv('app_name', 'app', $env));
$app->env = $env;
AppSession::setAppSession($app);
require __APP__ . '/bootstrap/singleton.php';
$app->view->parserOptions = ['charset' => 'utf-8', 'cache' => realpath(__APP__ . '/templates/cache'), 'auto_reload' => true, 'strict_variables' => false, 'autoescape' => true];
$app->view->parserExtensions = [new \Slim\Views\TwigExtension()];
$app->em = (require __CONFIG__ . '/../config/doctrine.php');
require_once __APP__ . "/routes.php";
$app->run();
Esempio n. 6
0
 function getConfigApp($env)
 {
     return ['mode' => getAppEnv('mode', 'production', $env), 'log.enabled' => getAppEnv('log', true, $env), 'templates.path' => __APP__ . '/templates', 'view' => new \Slim\Views\Twig(), 'cookies.encrypt' => getAppEnv('cookies_encrypt', true, $env), 'cookies.path' => getAppEnv('cookies_path', '/', $env), 'cookies.domain' => getAppEnv('cookies_domain', 'localhost', $env), 'cookies.secure' => getAppEnv('cookies_secure', false, $env), 'cookies.httponly' => getAppEnv('cookies_httponly', false, $env), 'cookies.secret_key' => getAppEnv('cookies_secret_key', 'secret_key', $env), 'cookies.cipher' => getAppEnv('cookies_cipher', MCRYPT_RIJNDAEL_256, $env), 'cookies.cipher_mode' => getAppEnv('cookies_cipher_mode', MCRYPT_MODE_CBC, $env)];
 }
Esempio n. 7
0
 public static function setAppSession($app)
 {
     $app->add(new \Slim\Middleware\SessionCookie(['expires' => getAppEnv('cookies_expires', '20 minutes'), 'name' => getAppEnv('cookies_name', 'slim_session')]));
 }
Esempio n. 8
0
<?php

use GW2Spidy\Util\CLIColors;
use GW2Spidy\Util\Functions;
use Igorw\Silex\Config;
require dirname(__FILE__) . '/../autoload.php';
$name = isset($argv[1]) ? $argv[1] : null;
$check = isset($argv[2]) ? $argv[2] : null;
$env = isset($argv[3]) ? $argv[3] : null;
// '-' is null too ;) just so you can skip the arg if you want
$check = $check == '-' ? null : $check;
// grab default env
$env = $env ?: getAppEnv()->getEnv();
// generate md5
$md5 = md5($name);
// cnf file based on env
$cnffile = __DIR__ . "/../config/cnf/{$env}.json";
echo CLIColors::getColoredString("adding md5 [[ {$md5} ]] for [[ {$name} ]] to [[ {$env} ]] ... \n", "light_blue");
if (in_array($env, array('dev', 'prod', 'default'))) {
    die(CLIColors::getColoredString("Can't add API keys to [[ {$env} ]] cnf file, protected.\n", "red"));
}
if (!file_exists($cnffile)) {
    die(CLIColors::getColoredString("Config file [[ {$cnffile} ]] doesn't exist.\n", "red"));
}
$cnf = Config::readConfig($cnffile);
if (!$cnf) {
    die(CLIColors::getColoredString("Parsing cnf failed.\n", "red"));
}
if (!isset($cnf['gw2spidy']['api_secrets'])) {
    die(CLIColors::getColoredString("Please create the initial 'api_secrets' entry yourself.\n", "red"));
}
Esempio n. 9
0
 public function __construct($key)
 {
     $this->baseKey = substr(md5(getAppEnv()->getEnv() . $key), 0, 10);
 }