本文整理汇总了PHP中ConfigManager类的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager类的具体用法?PHP ConfigManager怎么用?PHP ConfigManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
}
示例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();
}
}
示例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());
}
}
示例5: __construct
public function __construct()
{
$ConfigManager = new ConfigManager();
$this->Host = $ConfigManager->getHost();
$this->User = $ConfigManager->getUser();
$this->Database = $ConfigManager->getDatabase();
$this->Password = $ConfigManager->getPassword();
}
示例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");
}
示例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);
}
示例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;
}
示例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);
}
示例10: uninstall
public function uninstall()
{
$this->drop_tables();
ConfigManager::delete('web', 'config');
CacheManager::invalidate('module', 'web');
WebService::get_keywords_manager()->delete_module_relations();
}
示例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()));
}
示例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;
}
示例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;
}
示例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);
}
示例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()");
}
}