Example #1
0
File: DB.php Project: kijtra/db
 /**
  * Config getter
  *
  * @param string  $key  Config array key
  * @return mixed  If pass $key return one, else all config data
  */
 public function getConfig($key = null)
 {
     if (isset($key)) {
         if ($this->config->offsetExists($key)) {
             return $this->config->offsetGet($key);
         }
     } else {
         return $this->config->all();
     }
 }
Example #2
0
 /**
  * Выполняет обработку запроса
  *
  * @param WS_Environment $env
  *
  * @return mixed
  */
 public function run(WS_Environment $env)
 {
     $config = Config::all();
     $env->assign_if(array('config' => $config));
     Events::call('ws.config', $config);
     return $this->application->run($env);
 }
Example #3
0
 public function settings()
 {
     if (isset($_POST['letsgo'])) {
         foreach ($_POST as $name => $value) {
             $config = Config::find_by_name($name);
             if ($config) {
                 $config->value = $value;
                 $config->save();
             }
         }
         //SUCCESSS REPORTER
         echo '<div class="row">
                 <div class="col-lg-9 col-lg-offset-2">
                     <br />
                     <div class="alert alert-success">
                         Die Einstellungen wurden erfolgreich gespeichert.
                     </div>
                 </div>
              </div>';
     }
     $data = array();
     $configs = Config::all();
     foreach ($configs as $config) {
         $data[$config->name] = $config;
     }
     return $data;
 }
Example #4
0
/**
 * 操作配置项
 *
 * @param string $name [description]
 * @param string $value [description]
 */
function C($name = '', $value = '')
{
    if ($name === '') {
        return Config::all();
    }
    if ($value === '') {
        return Config::get($name);
    }
    return Config::set($name, $value);
}
Example #5
0
 protected function auth()
 {
     $enable = Core::if_null(Config::all()->apache_auth->enable, false);
     $enable_admin = Core::if_null(Config::all()->apache_auth->enable_admin, false);
     if (!$enable) {
         return true;
     }
     if (!empty(WS::env()->auth->user)) {
         return true;
     }
     $user = null;
     $login = $this->request->server('PHP_AUTH_USER');
     if (!$login) {
         $login = $this->request->server('REMOTE_USER');
     }
     if ($login) {
         $user = $this->auth_module->authenticate($login, null);
         if (!$user->isactive) {
             return false;
         }
     }
     if (!$user && !Core::is_cli()) {
         return false;
     } else {
         Events::call('ws.auth.apache.user', $user);
         WS::env()->auth->user = $user;
         WS::env()->auth->module = $this->auth_module;
         if ($enable_admin) {
             $admin_user = clone $user;
             $admin_user->password = $this->request->server('PHP_AUTH_PW');
             WS::env()->admin_auth->user = $admin_user;
         }
         $this->reset_default_auth();
         return true;
     }
 }
Example #6
0
Config::handle($argv);
if (Config::get('help')) {
    Help();
    exit;
}
if (Config::get('version')) {
    check_version();
    exit;
}
if (Config::get('upgrade')) {
    download();
    exit;
}
// credit syahiran
$ok = false;
$keys = array_keys(Config::all());
foreach ($keys as $key) {
    switch ($key) {
        case 'default':
        case 'basic':
        case 'et':
        case 'ep':
        case 'dt':
        case 'dp':
        case 'bf':
        case 'eu':
            $ok = true;
            break;
    }
}
if (empty($argv) or !$ok or !Config::get('url')) {
Example #7
0
 public static function buildPlatformAccess($identifier)
 {
     return ['api' => static::getExposedApi(), 'config' => \Config::all(), 'session' => Session::all(), 'store' => new ScriptSession(\Config::get("script.{$identifier}.store"), app('cache'))];
 }
Example #8
0
/*Datenbankeinstellungen*/
define('DATABASE_HOST', '127.0.0.1');
define('DATABASE_USER', 'root');
define('DATABASE_PASS', '');
define('DATABASE_NAME', 'addl');
/*####################################################################
#####################-DONT CHANGE ANYTHING BELOW-#####################
####################################################################*/
try {
    require_once APP_ROOT . '/libs/Mite/Mite.php';
    require_once APP_ROOT . '/libs/activeRecord/ActiveRecord.php';
    $connections = array('development' => 'mysql://' . DATABASE_USER . '@' . DATABASE_HOST . '/' . DATABASE_NAME . '?charset=utf8', 'production' => 'mysql://' . DATABASE_USER . '@' . DATABASE_HOST . '/' . DATABASE_NAME . '?charset=utf8');
    // initialize ActiveRecord
    ActiveRecord\Config::initialize(function ($cfg) use($connections) {
        $cfg->set_model_directory(APP_ROOT . '/models');
        $cfg->set_connections($connections);
    });
    try {
        $configs = Config::all();
        foreach ($configs as $config) {
            if ($config->value == 'false') {
                $config->value = false;
            } elseif ($config->value == 'true') {
                $config->value = true;
            }
            define($config->name, $config->value);
        }
    } catch (Exception $e) {
    }
} catch (Exception $e) {
}
Example #9
0
 public function testAllReturnsAll()
 {
     $this->assertEquals($this->testData, $this->config->all());
 }
Example #10
0
File: CMS.php Project: techart/tao
 public static function build_apache_auth_module()
 {
     $config = Config::all()->apache_auth;
     $module = Core::if_not($config->module, 'WS.Auth.Apache.RemoteAuthModule');
     $args = Core::if_not($config->module_args, array());
     $instance = Core::amake($module, $args);
     return $instance;
 }
Example #11
0
 public static function value($data, $property)
 {
     $value = array();
     $config = Config::all();
     $name = self::$config;
     $to_merge = array();
     if (isset($config->{$name}) && isset($config->{$name}->{$property})) {
         $to_merge[] = $config->{$name}->{$property};
     }
     if (isset($data[$property])) {
         $to_merge[] = $data[$property];
     }
     foreach ($to_merge as $tmp) {
         if (is_array($tmp)) {
             $value = array_merge($value, $tmp);
         } else {
             $value = $tmp;
         }
     }
     return $value;
 }
Example #12
0
File: FS.php Project: techart/tao
 /**
  * Инициализация
  *
  * @param array $options
  */
 public static function initialize(array $options = array())
 {
     $opts = isset(Config::all()->iofs) ? (array) Config::all()->iofs : array();
     self::options($opts);
     self::options($options);
 }
Example #13
0
File: HTML.php Project: techart/tao
 protected function configure_layoute()
 {
     $this->use_attrs('js', array('type' => 'lib'))->use_attrs('css', array('type' => 'lib'));
     $env = Config::all()->environment;
     if ($env == 'prod' && !Core_Strings::contains($this->name, 'admin')) {
         $this->use_onpage_to_file('js')->use_onpage_to_file('css')->no_duplicates_in('js')->join_styles()->minify_styles()->join_scripts()->minify_scripts();
     }
     return $this;
 }