本文整理汇总了PHP中Environment::get_env方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::get_env方法的具体用法?PHP Environment::get_env怎么用?PHP Environment::get_env使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::get_env方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($filename = null, $template_vars = null)
{
$this->env = Environment::get_env();
$this->template_vars = $template_vars;
if ($filename) {
$this->contents = $this->read_template_file($filename);
}
}
示例2: getGeoTools
public static function getGeoTools()
{
$env = Environment::get_env();
if ($env->CONFIG['DISABLE_REMOTE']) {
return new MockGeoTools();
}
return new GeoTools();
}
示例3: are_credentials_correct
public function are_credentials_correct($credentials)
{
$env = Environment::get_env();
$encryption_key = $env->CONFIG['DB_ENCRYPTION_KEY'];
$sql = "SELECT AES_DECRYPT(password, '{$encryption_key}') AS password FROM t_users WHERE username = '{$credentials->username}';";
$result = $this->mysqli->query($sql);
$row = $result->fetch_object();
return $row->password == $credentials->password;
}
示例4: __construct
public function __construct()
{
$this->env = Environment::get_env();
$this->mysqli = $this->get_mysqli_connection();
$this->mysqli->set_charset('utf8');
if ($this->env->CONFIG['DB_CREATE']) {
$this->_create_db();
}
$this->_manage_upgrades();
}
示例5: addJsFile
public function addJsFile($filename, $external = false)
{
$jsFile = new \stdClass();
$jsFile->fileName = $filename;
if (strpos($filename, 'http') === 0 || strpos($filename, '//') === 0) {
$external = true;
}
$jsFile->external = $external;
$env = \Environment::get_env();
if ($env->CONFIG['DISABLE_REMOTE'] && $external) {
return false;
}
$this->jsFiles[] = $jsFile;
}
示例6: start
public static function start()
{
global $winvnc, $policy;
self::generate_password();
$env = Environment::get_env();
$vnc = $winvnc;
$vnc .= 'Password=' . $env['encrypted_password'] . ' ';
$vnc .= 'PortNumber=' . $env['vnc_port'] . ' ';
$vnc .= 'SecurityTypes=VncAuth ';
$vnc .= 'QueryConnect=false';
$pol = $policy;
$pol .= $env['policy_port'] . ' ' . $env['policy_host'];
Process::start('winvnc4', $vnc);
Process::start('php', $pol);
}
示例7: json_encode
Environment::set_env(array("installed" => false, "vnc_port" => 5900, "policy_host" => $_GET['policy_host'], "policy_port" => 1234, "password" => "", "success" => false, "vnc_port_open" => false, "policy_port_open" => false, "encrypted_password" => ""));
$env = Environment::get_env();
$l->log('Attempting to start the service in the following environment: ' . json_encode($env));
Service::start();
$trys = 0;
$success = false;
$vnc_running = false;
$policy_running = false;
while (!$success && $trys < 20) {
if (!$vnc_running) {
$vnc_running = !port_open($env['vnc_port']);
}
if (!$policy_running) {
$policy_running = !port_open($env['policy_port'], $env['policy_host']);
}
if ($vnc_running && $policy_running) {
$success = true;
}
$trys++;
usleep(500000);
}
$env = Environment::get_env();
if ($success) {
$l->log('Service started successfully');
Environment::update_env(array('success' => true));
} else {
$l->log('Service did not start');
Environment::update_env(array('success' => false));
}
print json_encode(Environment::get_env());
示例8: default_env
public static function default_env($env)
{
Environment::set_env(array_merge($env, Environment::get_env()));
}
示例9: Logger
<?php
require_once '../lib/logger.class.php';
$l = new Logger();
function port_open($port, $host = '127.0.0.1')
{
$conn = @fsockopen($host, $port, $errno, $errstr, 0.2);
if ($conn) {
fclose($conn);
return false;
}
return true;
}
require '../lib/environment.class.php';
header("Content-type: text/plain");
Environment::default_env(array('installed' => false, 'vnc_port' => 5900, 'policy_host' => '127.0.0.1', 'policy_port' => 1234, 'password' => 'password', 'success' => false));
$env = Environment::get_env();
Environment::update_env(array('vnc_port_open' => port_open($env['vnc_port']), 'policy_port_open' => port_open($env['policy_port'], $env['policy_host'])));
$env = Environment::get_env();
print json_encode($env);
$l->log('Returned the following environment: ' . json_encode($env));
示例10:
<?php
require_once 'lib/service.class.php';
require_once 'lib/environment.class.php';
Environment::set_env(Environment::get_env());
Environment::update_env(array('password' => '123', 'test' => 'testing'));
//Service::stop();
//Service::start();
示例11: locate_file
public static function locate_file($file_name)
{
$env = Environment::get_env();
$localPath = $env->CONFIG['LOCAL_PATH'] . $file_name;
$centralPath = $env->CONFIG['CENTRAL_PATH'] . $file_name;
if (file_exists($localPath)) {
return $localPath;
} elseif (file_exists($centralPath)) {
return $centralPath;
}
return false;
}