本文整理汇总了PHP中ConfigManager类的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager类的具体用法?PHP ConfigManager怎么用?PHP ConfigManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: connetti_query
function connetti_query($query)
{
global $Host, $User, $Password, $Database, $link;
$ConfigManager = new ConfigManager();
$Host = $ConfigManager->getHost();
$User = $ConfigManager->getUser();
$Database = $ConfigManager->getDatabase();
$Password = $ConfigManager->getPassword();
// Connessione al database
if (!($link = mysql_connect($Host, $User, $Password))) {
die("Errore nella connessione al database! -> " . mysql_error());
}
// Apertura del database
if (!mysql_select_db($Database, $link)) {
die("Errore nell'apertura del database mba!" . mysql_error());
}
// Esucuzione della query
if (!($result = mysql_query($query, $link))) {
print "Errore nell'esecuzione della query! <br />";
die(mysql_error());
}
//chiusura del collegamento al database
mysql_close($link);
//restituzione all'ambiente chiamante del risultato della query
return $result;
}
开发者ID:sergiobelli,项目名称:geso,代码行数:26,代码来源:dblib.php
示例2: elenco
function elenco($idOperatore)
{
$ConfigManager = new ConfigManager();
$dbhost = $ConfigManager->getHost();
$dbuser = $ConfigManager->getUser();
$dbname = $ConfigManager->getDatabase();
$dbpass = $ConfigManager->getPassword();
$conn = null;
try {
$conn = new PDO("mysql:host={$dbhost};dbname={$dbname}", $dbuser, $dbpass);
$cmd = "\r\n\t\t\t\tselect \r\n\t\t\t\t\trusc_conferimenti.id as id_conferimento,\r\n\t\t\t\t\trusc_tipologia.descrizione as descrizione_conferimento, \r\n\t\t\t\t\trusc_conferimenti.data as data_conferimento,\r\n\t\t\t\t\trusc_operatori.descrizione as descrizione_operatore\r\n\t\t\t\tfrom \r\n\t\t\t\t\trusc_conferimenti, \r\n\t\t\t\t\trusc_tipologia,\r\n\t\t\t\t\trusc_operatori\r\n\t\t\t\twhere \r\n\t\t\t\t\trusc_conferimenti.tipologia = rusc_tipologia.id\r\n\t\t\t\t\tand rusc_conferimenti.operatore = rusc_operatori.id\r\n\t\t\t\t\tand rusc_operatori.id = " . $idOperatore;
$result = $conn->prepare($cmd);
$result->execute();
$return_arr = array();
$row_array = array();
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$row_array['idConferimento'] = utf8_encode($row['id_conferimento']);
$row_array['descrizioneConferimento'] = utf8_encode($row['descrizione_conferimento']);
$row_array['dataConferimento'] = utf8_encode($row['data_conferimento']);
$row_array['descrizioneOperatore'] = utf8_encode($row['descrizione_operatore']);
array_push($return_arr, $row_array);
}
$conn = NULL;
return json_encode($return_arr);
} catch (PDOException $e) {
echo $e->getMessage();
}
}
开发者ID:sergiobelli,项目名称:rusc,代码行数:28,代码来源:ConferimentiController.php
示例3: elenco
function elenco()
{
$ConfigManager = new ConfigManager();
$dbhost = $ConfigManager->getHost();
$dbuser = $ConfigManager->getUser();
$dbname = $ConfigManager->getDatabase();
$dbpass = $ConfigManager->getPassword();
$conn = null;
try {
$conn = new PDO("mysql:host={$dbhost};dbname={$dbname}", $dbuser, $dbpass);
$cmd = "\r\n\t\t\t\tselect \r\n\t\t\t\t\trusc_tipologia.id as id_tipologia,\r\n\t\t\t\t\trusc_tipologia.codice as codice_tipologia,\r\n\t\t\t\t\trusc_tipologia.descrizione as descrizione_tipologia \r\n\t\t\t\tfrom \r\n\t\t\t\t\trusc_tipologia\r\n\t\t\t\torder by rusc_tipologia.codice";
$result = $conn->prepare($cmd);
$result->execute();
$return_arr = array();
$row_array = array();
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$row_array['idTipologia'] = utf8_encode($row['id_tipologia']);
$row_array['codiceTipologia'] = utf8_encode($row['codice_tipologia']);
$row_array['descrizioneTipologia'] = utf8_encode($row['descrizione_tipologia']);
array_push($return_arr, $row_array);
}
$conn = NULL;
return json_encode($return_arr);
} catch (PDOException $e) {
echo $e->getMessage();
}
}
开发者ID:sergiobelli,项目名称:rusc,代码行数:27,代码来源:TipologieController.php
示例4: login
function login($username, $password)
{
$ConfigManager = new ConfigManager();
$dbhost = $ConfigManager->getHost();
$dbuser = $ConfigManager->getUser();
$dbname = $ConfigManager->getDatabase();
$dbpass = $ConfigManager->getPassword();
$conn = null;
try {
$conn = new PDO("mysql:host={$dbhost};dbname={$dbname}", $dbuser, $dbpass);
$cmd = "\n\t\t\t\tSELECT \t\n\t\t\t\t\tid as id_operatore,\n\t\t\t\t\tusername as username_operatore,\n\t\t\t\t\tpassword as password_operatore,\n\t\t\t\t\tdescrizione as descrizione_operatore\n\t\t\t\tFROM \trusc_operatori \n\t\t\t\tWHERE \tusername = :username\n\t\t\t\t\t\tAND password = :password";
$result = $conn->prepare($cmd);
$result->bindValue(":username", $username);
$result->bindValue(":password", $password);
$result->execute();
$return_arr = array();
$row_array = array();
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$row_array['idOperatore'] = utf8_encode($row['id_operatore']);
$row_array['usernameOperatore'] = utf8_encode($row['username_operatore']);
$row_array['descrizioneOperatore'] = utf8_encode($row['descrizione_operatore']);
array_push($return_arr, $row_array);
}
$conn = NULL;
return json_encode($return_arr);
} catch (PDOException $e) {
return json_encode($e->getMessage());
}
}
开发者ID:sergiobelli,项目名称:rusc,代码行数:29,代码来源:LoginController.php
示例5: __construct
public function __construct()
{
$ConfigManager = new ConfigManager();
$this->Host = $ConfigManager->getHost();
$this->User = $ConfigManager->getUser();
$this->Database = $ConfigManager->getDatabase();
$this->Password = $ConfigManager->getPassword();
}
开发者ID:sergiobelli,项目名称:geso,代码行数:8,代码来源:funzioni_mysql.php
示例6: testPrefixIfNeeded
public function testPrefixIfNeeded()
{
$dm = new Downloader();
$cm1 = new ConfigManager(array("ZipBackupFolder" => "bla"), $this->dm);
$cm1->prefixIfNeeded("foo");
$this->assertEquals($cm1->config["ZipBackupFolder"], "foo/bla");
$cm2 = new ConfigManager(array("ZipBackupFolder" => "/bla"), $this->dm);
$cm2->prefixIfNeeded("foo");
$this->assertEquals($cm2->config["ZipBackupFolder"], "/bla");
}
开发者ID:shadiakiki1986,项目名称:fatca-ides-php,代码行数:10,代码来源:ConfigManagerTest.php
示例7: setup
function setup($dbHost, $dbUsername, $dbPassword, $dbName, $controlThreads, $controlInterval)
{
if ($dbHost == "" || $dbUsername == "" || $dbPassword == "" || $dbName == "") {
throw new Exception("La configuration de Base de données est incomplète");
}
/*if ($controlThreads == "" || $controlInterval == "" || !is_numeric($controlThreads) || !is_numeric($controlInterval))
throw new Exception("La configuration de Contrôle est incomplète");*/
if ($controlThreads == "" || !is_numeric($controlThreads)) {
throw new Exception("Le champ Threads de contrôle est vide");
}
if ($controlInterval == "" || !is_numeric($controlInterval)) {
throw new Exception("Le champ Intervalle de contrôle est vide");
}
$cm = new ConfigManager(ADMIN_CONFIG_PATH);
$cm->loadINIFile();
$cm->setConfig('database', 'db_host', $dbHost);
$cm->setConfig('database', 'db_auth_username', $dbUsername);
$cm->setConfig('database', 'db_auth_password', $dbPassword);
$cm->setConfig('database', 'db_auth_dbname', $dbName);
$cm->setConfig('control', 'ac_control_threads', $controlThreads);
$cm->setConfig('control', 'ac_control_frequency', $controlInterval);
$cm->saveINIFile();
$_SESSION["message"] = array("type" => "success", "title" => "Configuration terminée", "descr" => "La configuration a été modifiée avec succès.");
header('Location: ' . '/monitoring/?v=admin&tab=config');
exir(0);
}
开发者ID:yashodhank,项目名称:Monitoring,代码行数:26,代码来源:admin.php
示例8: login
function login($username, $password)
{
$ConfigManager = new ConfigManager();
$elementNamespace = $ConfigManager->getGecredNamespace();
$gecredUrl = $elementNamespace . '.php?wsdl';
$client = new nusoap_client($gecredUrl, true);
// false: no WSDL
// Call the SOAP method
$result = $client->call('login', array('username' => $username, 'password' => $password));
return $result;
}
开发者ID:sergiobelli,项目名称:rusc,代码行数:11,代码来源:server.php
示例9: loadYubikeyUserAuthorization
protected function loadYubikeyUserAuthorization()
{
$usersConfig = ConfigManager::getConfig("Users", "Users");
$resultingConfig = ConfigManager::mergeConfigs($usersConfig->AuxConfig, $this->config->AuxConfig);
$yubikeyUserAuthorization = new YubikeyUserAuthorization(Reg::get($usersConfig->Objects->UserManagement), $resultingConfig);
$this->register($yubikeyUserAuthorization);
}
开发者ID:alexamiryan,项目名称:stingle,代码行数:7,代码来源:LoaderYubikey.class.php
示例10: uninstall
public function uninstall()
{
$this->drop_tables();
ConfigManager::delete('web', 'config');
CacheManager::invalidate('module', 'web');
WebService::get_keywords_manager()->delete_module_relations();
}
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:7,代码来源:WebSetup.class.php
示例11: initDBConfig
/**
* Get configs from DB and merge them with global config
*
* @param int $cacheMinutes
*/
public static function initDBConfig($cacheMinutes = null)
{
$sql = MySqlDbManager::getQueryObject();
$sql->exec("SELECT * FROM `" . Tbl::get("TBL_CONFIGS") . "`", $cacheMinutes);
$dbConfig = static::parseDBRowsToConfig($sql->fetchRecords());
ConfigManager::setGlobalConfig(ConfigManager::mergeConfigs($dbConfig, ConfigManager::getGlobalConfig()));
}
开发者ID:alexamiryan,项目名称:stingle,代码行数:12,代码来源:ConfigDBManager.class.php
示例12: instance
/**
* Gets the singleton instance of the ConfigManager.
*/
public static function instance() {
if(is_null(self::$INSTANCE)) {
self::$INSTANCE = new ConfigManager();
}
return self::$INSTANCE;
}
开发者ID:Rastrian,项目名称:Osimo-Forum-System-v2,代码行数:10,代码来源:config.manager.php
示例13: decrypt
public static function decrypt($string, $key = null, $salt = null, $iv = null)
{
$config = ConfigManager::getConfig('Crypto', 'AES256')->AuxConfig;
if ($key === null) {
$key = $config->key;
}
if ($salt === null) {
$salt = $config->salt;
}
if ($iv === null) {
$iv = $config->iv;
}
$td = mcrypt_module_open('rijndael-128', '', MCRYPT_MODE_CBC, '');
$ks = mcrypt_enc_get_key_size($td);
$bs = mcrypt_enc_get_block_size($td);
$iv = substr(hash("sha256", $iv), 0, $bs);
// Create key
$key = Crypto::pbkdf2("sha512", $key, $salt, $config->pbkdfRounds, $ks);
// Initialize encryption module for decryption
mcrypt_generic_init($td, $key, $iv);
$decryptedString = "";
// Decrypt encrypted string
try {
if (ctype_xdigit($string)) {
$decryptedString = trim(mdecrypt_generic($td, pack("H*", $string)));
}
} catch (ErrorException $e) {
}
// Terminate decryption handle and close module
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
// Show string
return $decryptedString;
}
开发者ID:Welvin,项目名称:stingle,代码行数:34,代码来源:AES256.class.php
示例14: loadrewriteAliasURL
protected function loadrewriteAliasURL()
{
$rewriteURLconfig = $this->packageManager->getPluginConfig("RewriteURL", "RewriteURL")->AuxConfig;
$hostConfig = ConfigManager::getConfig("Host", "Host");
$this->rewriteAliasURL = new RewriteAliasURL($rewriteURLconfig, $this->aliasMap->getAliasMap(Reg::get($hostConfig->Objects->Host)));
$this->register($this->rewriteAliasURL);
}
开发者ID:Welvin,项目名称:stingle,代码行数:7,代码来源:LoaderRewriteAliasURL.class.php
示例15: init
public static function init()
{
if (!self::$initialized) {
Profiler::StartTimer("DNSResolver::Init()", 3);
$cfg = ConfigManager::singleton();
if (isset($cfg->servers["dnsresolver"]["ttl"])) {
self::$ttl = $cfg->servers["dnsresolver"]["ttl"];
}
if (isset($cfg->servers["dnsresolver"]["cache"])) {
self::$cache = $cfg->servers["dnsresolver"]["cache"];
}
// parse /etc/resolv.conf to get domain/search suffixes
if (file_exists("/etc/resolv.conf")) {
$resolv = file("/etc/resolv.conf");
for ($i = 0; $i < count($resolv); $i++) {
if (preg_match("/^\\s*(.*?)\\s+(.*)\\s*\$/", $resolv[$i], $m)) {
switch ($m[1]) {
case 'domain':
self::$domain = $m[2];
array_unshift(self::$search, self::$domain);
break;
case 'search':
self::$search[] = $m[2];
break;
}
}
}
self::$search[] = "";
}
self::$initialized = true;
Profiler::StopTimer("DNSResolver::Init()");
}
}
开发者ID:jbaicoianu,项目名称:elation,代码行数:33,代码来源:dnsresolver_class.php
示例16: doLogin
/**
* Does login operation
* @param string $username
* @param string $password
* @param bool $writeCookie
* @param bool $isPasswordEncrypted
*
* @throws RuntimeException (Codes: 1 - Incorrect login/password combination, 2 - Account is disabled)
*/
public function doLogin($username, $password, $writeCookie = false, $isPasswordEncrypted = false)
{
if ($this->um->checkCredentials($username, $password, $isPasswordEncrypted)) {
$this->usr = $this->um->getObjectByLogin($username);
$this->authorize($this->usr);
$this->saveUserId($this->usr->getId());
if ($writeCookie) {
$secs = getdate();
$exp_time = $secs[0] + 60 * 60 * 24 * $this->config->rememberDaysCount;
$cookie_value = $this->usr->getId() . ":" . hash('sha256', $username . ":" . md5($password));
setcookie($this->config->loginCookieName, $cookie_value, $exp_time, '/');
}
if (Reg::get('packageMgr')->isPluginLoaded("Security", "RequestLimiter") and $this->config->bruteForceProtectionEnabled) {
$this->query->exec("DELETE FROM `" . Tbl::get('TBL_SECURITY_INVALID_LOGINS_LOG') . "` WHERE `ip`='" . $_SERVER['REMOTE_ADDR'] . "'");
}
} else {
if (Reg::get('packageMgr')->isPluginLoaded("Security", "RequestLimiter") and $this->config->bruteForceProtectionEnabled) {
$this->query->exec("SELECT `count` \n\t\t\t\t\t\t\t\t\t\t\tFROM `" . Tbl::get('TBL_SECURITY_INVALID_LOGINS_LOG') . "` \n\t\t\t\t\t\t\t\t\t\t\tWHERE `ip`='" . $_SERVER['REMOTE_ADDR'] . "'");
$failedAuthCount = $this->query->fetchField('count');
$newFailedAuthCount = $failedAuthCount + 1;
if ($newFailedAuthCount >= $this->config->failedAuthLimit) {
Reg::get(ConfigManager::getConfig("Security", "RequestLimiter")->Objects->RequestLimiter)->blockIP();
$this->query->exec("DELETE FROM `" . Tbl::get('TBL_SECURITY_INVALID_LOGINS_LOG') . "` WHERE `ip`='" . $_SERVER['REMOTE_ADDR'] . "'");
throw new RequestLimiterTooManyAuthTriesException("Too many unsucessful authorization tries.");
}
$this->query->exec("INSERT INTO `" . Tbl::get('TBL_SECURITY_INVALID_LOGINS_LOG') . "` (`ip`) \n\t\t\t\t\t\t\t\t\t\tVALUES ('" . $_SERVER['REMOTE_ADDR'] . "')\n\t\t\t\t\t\t\t\t\t\tON DUPLICATE KEY UPDATE `count` = `count` + 1");
}
throw new RuntimeException("Incorrect login/password combination", static::EXCEPTION_INCORRECT_LOGIN_PASSWORD);
}
}
开发者ID:alexamiryan,项目名称:stingle,代码行数:39,代码来源:UserAuthorization.class.php
示例17: isAuthorized
function isAuthorized()
{
if (Reg::isRegistered(ConfigManager::getConfig("Users", "Users")->ObjectsIgnored->User)) {
return true;
}
return false;
}
开发者ID:Welvin,项目名称:stingle,代码行数:7,代码来源:helpers.inc.php
示例18: getInstance
/**
* @return ConfigManager instance
*/
public static function getInstance()
{
if (is_null(self::$_instance)) {
self::$_instance = new ConfigManager();
}
return self::$_instance;
}
开发者ID:Davidiborra,项目名称:WP-Splash-Image,代码行数:10,代码来源:ConfigManager.class.php
示例19: initialize
protected function initialize()
{
$this->config = ConfigManager::bind();
// setting limit time
set_time_limit($this->config['webbot']['time_limit']);
$this->container = new Pimple();
// initializing persistence
$config = $this->config;
if ($config['general']['persistence']['use_database']) {
if (!isset($config['general']['persistence']['connections'])) {
throw new ConfigurationAccessException(101);
}
if (!is_array($config['general']['persistence']['connections']) || count($config['general']['persistence']['connections']) < 1) {
throw new ConfigurationAccessException(102);
}
$connections = $config['general']['persistence']['connections'];
// initializing ActiveRecord
ActiveRecord\Config::initialize(function ($cfg) use($connections, $config) {
$cfg->set_model_directory($config->getBaseDir() . '/' . $config['general']['persistence']['models_dir']);
$cfg->set_connections($connections);
// assigning as default conection the first one
$default_con_index = array_shift(array_keys($connections));
$cfg->set_default_connection($default_con_index);
});
}
$this->loadStartups();
}
开发者ID:nebtrx,项目名称:stratos,代码行数:27,代码来源:Context.class.php
示例20: loadGeoIPGps
protected function loadGeoIPGps()
{
$geoIPConfig = ConfigManager::getConfig("GeoIP", "GeoIP");
$gpsConfig = ConfigManager::getConfig("Gps", "Gps");
$geoIpGps = new GeoIPGps(Reg::get($geoIPConfig->Objects->GeoIP), Reg::get($gpsConfig->Objects->Gps));
$this->register($geoIpGps);
}
开发者ID:alexamiryan,项目名称:stingle,代码行数:7,代码来源:LoaderGeoIPGps.class.php
注:本文中的ConfigManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论