本文整理汇总了PHP中Config::get_config方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::get_config方法的具体用法?PHP Config::get_config怎么用?PHP Config::get_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::get_config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($person)
{
parent::__construct($person);
$this->attributes = array();
$this->idp = "";
$personIndex = 0;
try {
$personIndex = (int) Config::get_config('bypass_id');
} catch (KeyNotFoundException $knfe) {
Logger::log_event(LOG_NOTICE, __FILE__ . ":" . __LINE__ . " bypass_id not set in config. Using default ID.");
}
switch ($personIndex) {
case 0:
$this->attributes = array('cn2' => array('John Doe'), 'eduPersonPrincipalName' => array('jdoe@example.org'), 'mail2' => array('john.doe@example.org'), 'country' => array('NN'), 'organization' => array('o=Hogwarts, dc=hsww, dc=wiz'), 'nren' => array('testnren'), 'eduPersonEntitlement2' => array('urn:mace:feide.no:sigma.uninett.no:confusa'));
$this->idp = "idp.example.org";
break;
case 1:
$this->attributes = array('cn2' => array('Jane Doe'), 'eduPersonPrincipalName' => array('janedoe@example.org'), 'mail2' => array('jane.doe@example.org', 'jane@example.org', 'janed@example.org'), 'country' => array('NN'), 'organization' => array('o=Barad, dc=Dur'), 'nren' => array('testnren'), 'eduPersonEntitlement2' => array('urn:mace:feide.no:sigma.uninett.no:confusaAdmin', 'urn:mace:feide.no:sigma.uninett.no:confusa'));
$this->idp = "idp.example.org";
break;
case 2:
default:
$this->attributes = array('cn2' => array('Ola Nordmann'), 'eduPersonPrincipalName' => array('onordmann@example.org', 'olamann@example.org', 'ola@example.org'), 'mail2' => array('ola.nordmann@example.org'), 'country' => array('NO'), 'organization' => array('o=Hogwarts, dc=hsww, dc=wiz'), 'nren' => array('testnren'), 'eduPersonEntitlement2' => array('urn:mace:feide.no:sigma.uninett.no:confusa'));
$this->idp = "idp.example.org";
break;
}
}
示例2: getConfusaVersion
/**
* Get the version of the currently running Confusa instance.
*
* @return Version in the format major.minor.extra
* @throws ConfusaGenException if the version of Confusa can not be determined
*/
public static function getConfusaVersion()
{
$version_file = file_get_contents(Config::get_config('install_path') . '/VERSION');
$major_v_line_start = strpos($version_file, "MAJOR_VERSION=");
$major_v_line_end = strpos($version_file, "\n", $major_v_line_start);
if ($major_v_line_start === false || $major_v_line_end === false) {
throw new ConfusaGenException("Could not determine the major version of Confusa!" . " Please contact an administrator about that!");
}
$major_v_line_start += 14;
$major_version = substr($version_file, $major_v_line_start, $major_v_line_end - $major_v_line_start);
$minor_v_line_start = strpos($version_file, "MINOR_VERSION=");
$minor_v_line_end = strpos($version_file, "\n", $minor_v_line_start);
if ($minor_v_line_start === false || $minor_v_line_end === false) {
throw new ConfusaGenException("Could not determine the minor version of Confusa!" . " Please contact an administrator about that!");
}
$minor_v_line_start += 14;
$minor_version = substr($version_file, $minor_v_line_start, $minor_v_line_end - $minor_v_line_start);
$extra_v_line_start = strpos($version_file, "EXTRA_VERSION=");
$extra_v_line_end = strpos($version_file, "\n", $extra_v_line_start);
if ($extra_v_line_start === false || $extra_v_line_end === false) {
throw new ConfusaGenException("Could not determine the extra version of Confusa!" . " Please contact an administrator about that!");
}
$extra_v_line_start += 14;
$extra_version = substr($version_file, $extra_v_line_start, $extra_v_line_end - $extra_v_line_start);
$confusaVersion = $major_version . "." . $minor_version . "." . $extra_version;
return $confusaVersion;
}
示例3: sanitizeOrgName
/**
* sanitize a subscriber org-name (the /O= name in the subject DN).
* This function does not perform any validation whatsoever, it just removes
* characters that are not meant to be in subject-DN org-name.
*
* Update: it was discovered that the CA backend did not eat ',' in the
* orgname too well and needs to be stripped out.
*
* @param $input string an input which is supposed to be a subscriber
* org-name
* @return string the sanitized input string
*/
static function sanitizeOrgName($input)
{
$output = preg_replace('/[^a-z0-9@_\\-\\.\\s]/i', '', $input);
if (Config::get_config('cert_product') == PRD_ESCIENCE) {
/* cannot use ',' and length > 64 */
return substr($output, 0, 64);
}
return $output;
}
示例4: __construct
public function __construct()
{
$this->tpl = new Smarty();
$this->tpl->template_dir = Config::get_config('install_path') . 'templates';
$this->tpl->compile_dir = ConfusaConstants::$SMARTY_TEMPLATES_C;
$this->tpl->config_dir = Config::get_config('install_path') . 'lib/smarty/configs';
$this->tpl->cache_dir = ConfusaConstants::$SMARTY_CACHE;
$this->logErrors = array();
}
示例5: dumpSession
/**
* dumpSession() dump the content of the session to stdout.
*
* This is only available when debug is enabled.
*/
public static function dumpSession()
{
if (Config::get_config('debug')) {
self::testSession();
echo "<pre>\n";
echo "Session name. " . session_name() . "\n";
print_r($_SESSION);
echo "</pre>\n";
}
}
示例6: test_content
/**
* test_content - test a CSR for deficiencies
*
* This function is to be used when testing uploaded CSRs for flaws and errors.
* It will test for:
* - common text-patterns
* - that the key meets the required key-length
* - that it is a normal CSR (previous point will fail if it is a 'bogus' CSR
* - that the auth_url is derived from the supplied CSR
*/
function test_content($content, $auth_url)
{
$testres = true;
/* check for start */
$start = substr($content, 0, strlen("-----BEGIN CERTIFICATE REQUEST-----"));
$end = substr($content, -(strlen("-----END CERTIFICATE REQUEST-----") + 1), -1);
/* test start and ending of certificate */
if (strcmp("-----BEGIN CERTIFICATE REQUEST-----", $start) !== 0 && strcmp("-----END CERTIFICATE REQUEST-----", $end) !== 0) {
Framework::error_output("malformed CSR. Please upload a proper CSR to the system.");
return false;
}
/* test type. IGTF will soon change the charter to *not* issue DSA
* certificates */
if (get_algorithm($content) !== "rsa") {
Framework::error_output("Will only accept RSA keys!");
return false;
}
/*
* test length of pubkey
*/
$length = Config::get_config('min_key_length');
if (csr_pubkey_length($content) < $length) {
Framework::error_output("Uploaded key is not long enough. Please download a proper keyscript and try again.");
return false;
}
/*
* test CSR to blacklist. It is safe to call exec as we have tested the
* content of the CSR.
*/
$cmd = "echo \"{$content}\" | openssl-vulnkey -";
exec($cmd, $output, $return_val);
switch ($return_val) {
case 0:
/* key is not blacklisted */
break;
case 1:
Framework::error_output("Uploaded CSR is blacklisted!");
return false;
case 127:
Logger::log_event(LOG_ERR, __FILE__ . ":" . __LINE__ . " openssl-vulnkey not installed");
break;
default:
Logger::log_event(LOG_DEBUG, __FILE__ . ":" . __LINE__ . " Unknown return ({$return_val}) value from shell");
break;
}
/*
* test authenticity of auth_url
*/
$hash = pubkey_hash($content, true);
if (substr($hash, 0, ConfusaConstants::$AUTH_KEY_LENGTH) != $auth_url) {
Framework::error_output("Uploaded key ({$hash}) and auth_url ({$auth_url}) does not match");
return false;
}
return true;
}
示例7: process
function process()
{
if (CS::getSessionKey('hasAcceptedAUP') !== true) {
Framework::error_output($this->translateTag("l10n_err_aupagreement", "processcsr"));
return;
}
$user_cert_enabled = $this->person->testEntitlementAttribute(Config::get_config('entitlement_user'));
$this->tpl->assign('email_status', $this->person->getNREN()->getEnableEmail());
$this->tpl->assign('user_cert_enabled', $user_cert_enabled);
$this->tpl->assign('content', $this->tpl->fetch('select_email.tpl'));
}
示例8: process
public function process()
{
if (Config::get_config('cert_product') == PRD_PERSONAL) {
$this->tpl->assign('cps', ConfusaConstants::$LINK_PERSONAL_CPS);
} else {
$this->tpl->assign('cps', ConfusaConstants::$LINK_ESCIENCE_CPS);
}
Logger::log_event(LOG_INFO, "User acknowledged session: " . CS::getSessionKey('hasAcceptedAUP'));
$this->tpl->assign('aup_session_state', CS::getSessionKey('hasAcceptedAUP'));
$this->tpl->assign('privacy_notice_text', $this->person->getNREN()->getPrivacyNotice($this->person));
$this->tpl->assign('content', $this->tpl->fetch('confirm_aup.tpl'));
}
示例9: show_headers
function show_headers()
{
global $title;
global $extra_header;
echo "<HTML>\n";
echo "<HEAD>\n";
echo "{$extra_header}\n";
echo "<TITLE>" . Config::get_config('system_name') . "{$title}</TITLE>\n";
echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"confusa.css\">\n";
echo "<LINK REL=\"shortcut icon\" HREF=\"graphics/icon.gif\" TYPE=\"image/gif\"/>\n";
echo "</HEAD>\n";
}
示例10: pre_process
public function pre_process($person)
{
parent::pre_process($person);
$authvar = "";
$csr = null;
if (isset($_POST['signCSR'])) {
$this->signCSR(Input::sanitizeCertKey($_POST['signCSR']));
return;
}
/* Testing for uploaded files */
if (isset($_FILES['user_csr']['name'])) {
try {
$csr = CSRUpload::receiveUploadedCSR('user_csr', true);
} catch (FileException $fileEx) {
$msg = $this->translateTag('l10n_err_csrproc', 'processcsr');
Framework::error_output($msg . $fileEx->getMessage());
$this->csr = null;
return;
}
} else {
if (isset($_POST['user_csr'])) {
try {
$csr = CSRUPload::receivePastedCSR('user_csr');
} catch (ConfusaGenException $cge) {
$msg = $this->translateTag('l10n_err_no_csr', 'processcsr');
Framework::error_output($msg . $cg - e > getMessage());
$this->csr = null;
return;
}
} else {
/* No CSR present, neither paste nor file, kindly bump user */
Framework::error_output($this->translateTag('l10n_err_no_csr', 'processcsr'));
return;
}
}
if (!$csr->isValid()) {
$msg = $this->translateTag('l10n_err_csrinvalid1', 'processcsr');
$msg .= Config::get_config('min_key_length');
$msg .= $this->translateTag('l10n_err_csrinvalid2', 'processcsr');
Framework::error_output($msg);
$this->csr = null;
return;
}
if (Config::get_config('ca_mode') == CA_COMODO || match_dn($csr->getSubject(), $this->ca->getFullDN())) {
$csr->setUploadedDate(date("Y-m-d H:i:s"));
$csr->setUploadedFromIP($_SERVER['REMOTE_ADDR']);
$csr->storeDB($this->person);
$this->csr = $csr;
}
}
示例11: getAuthManager
/**
* Get the auth manager based on the request
*
* @param $person The person for which the auth_manager should be created
* @return an instance of Confusa_Auth
*/
public static function getAuthManager($person)
{
if (!isset(AuthHandler::$auth)) {
if (Config::get_config('auth_bypass') === TRUE) {
require_once 'Confusa_Auth_Bypass.php';
AuthHandler::$auth = new Confusa_Auth_Bypass($person);
} else {
/* Start the IdP and create the handler */
require_once 'Confusa_Auth_IdP.php';
AuthHandler::$auth = new Confusa_Auth_IdP($person);
}
}
return AuthHandler::$auth;
}
示例12: assignVersionVariables
/**
* Decorate the about::confusa template with the information from the
* VERSION file
*/
private function assignVersionVariables()
{
try {
$confusaVersion = MetaInfo::getConfusaVersion();
} catch (ConfusaGenException $cge) {
Framework::error_output("Could not determine the version of Confusa! " . "Please contact an administrator about that!");
}
$version_path = Config::get_config('install_path') . "VERSION";
$version_file = file_get_contents($version_path);
$this->tpl->assign('cVersion', $confusaVersion);
$cdn_line_start = strpos($version_file, "NAME=");
$cdn_line_end = strpos($version_file, "\n", $cdn_line_start);
if ($cdn_line_start === false || $cdn_line_end === false) {
Framework::error_output("Could not determine the version codename of " . "Confusa! Please contact an administrator about " . "that!");
}
$cdn_line_start += 5;
$versionCodename = substr($version_file, $cdn_line_start, $cdn_line_end - $cdn_line_start);
$this->tpl->assign('cCodename', $versionCodename);
}
示例13: process
public function process()
{
$nren = $this->person->getNREN();
if (isset($nren) && $this->person->isAuth()) {
$helpText = $nren->getHelpText($this->person);
if (isset($helpText)) {
$this->tpl->assign('nren_help_text', $helpText);
} else {
$this->tpl->assign('nren_contact_email', $nren->getContactEmail(true));
}
if (Config::get_config('cert_product') == PRD_ESCIENCE) {
$this->tpl->assign('portal_escience', true);
}
$this->tpl->assign('nren', $nren->getName());
$this->tpl->assign('content', $this->tpl->fetch('help.tpl'));
} else {
$this->tpl->assign('content', $this->tpl->fetch('help.tpl'));
return;
}
}
示例14: __construct
/**
* Constructor
*
* Note that the person is tied to a OAuth datastore here
*/
function __construct($person = NULL)
{
parent::__construct($person);
/* Find the path to simpelsamlphp and run the autoloader */
try {
$sspdir = Config::get_config('simplesaml_path');
} catch (KeyNotFoundException $knfe) {
echo "Cannot find path to simplesaml. This install is not valid. Aborting.<br />\n";
Logger::log_event(LOG_ALERT, "Trying to instantiate simpleSAMLphp without a configured path.");
exit(0);
}
require_once $sspdir . '/lib/_autoload.php';
SimpleSAML_Configuration::setConfigDir($sspdir . '/config');
$this->oauthStore = new OAuthDataStore_Confusa();
$this->oauthServer = new sspmod_oauth_OAuthServer($this->oauthStore);
$hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
$this->oauthServer->add_signature_method($hmac_method);
$req = OAuthRequest::from_request();
list($consumer, $this->accessToken) = $this->oauthServer->verify_request($req);
$this->isAuthenticated = isset($this->accessToken);
}
示例15: __construct
public function __construct($name)
{
$oConfig = Config::get_config('DB');
$aDatabases = $oConfig->get('databases');
if (!$aDatabases[$name]) {
throw new Exception('Invalid Database');
}
$aParams = $aDatabases[$name];
$sHost = $aParams[0];
if ($aParams[1]) {
$sHost .= ':' . $aParams[1];
}
$this->db = mysql_pconnect($sHost, $aParams[2], $aParams[3]);
$retry = 0;
while (!$this->db && ++$retry < 3) {
_WARN('Could not connect to DB, attempt ' . $retry);
$this->db = mysql_pconnect($sHost, $aParams[2], $aParams[3]);
usleep(500);
}
if (!$this->db) {
throw new Exception('Database connection failed');
}
mysql_select_db($aParams[4]);
}