当前位置: 首页>>代码示例>>PHP>>正文


PHP Logger::log_event方法代码示例

本文整理汇总了PHP中Logger::log_event方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::log_event方法的具体用法?PHP Logger::log_event怎么用?PHP Logger::log_event使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Logger的用法示例。


在下文中一共展示了Logger::log_event方法的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;
     }
 }
开发者ID:henrikau,项目名称:confusa,代码行数:27,代码来源:Confusa_Auth_Bypass.php

示例2: process

 public function process()
 {
     if (!$this->person->isNRENAdmin() && !$this->person->isSubscriberAdmin()) {
         Logger::log_event(LOG_NOTICE, "User " . stripslashes($this->person->getX509ValidCN()) . " tried to access the NREN-area");
         $this->tpl->assign('reason', 'You are not an NREN or subscriber-admin');
         $this->tpl->assign('content', $this->tpl->fetch('restricted_access.tpl'));
         return;
     }
     if (isset($_GET['attr_value'])) {
         /* no need for sanitization, only used in array lookup & does not go
          * into the DB
          */
         $this->handleAttrValueAJAX($_GET['attr_value']);
         return;
     }
     $this->tpl->assign('handle_map', true);
     if ($this->person->isNRENAdmin()) {
         $map = $this->person->getNREN()->getMap();
     } else {
         if ($this->person->isSubscriberAdmin()) {
             /* This will get the Subscriber-map if available,
              * otherwise it will return the NREN-map. */
             $map = $this->person->getMap();
         }
     }
     $auth = AuthHandler::getAuthManager($this->person);
     if (isset($map['epodn'])) {
         $epodn = implode(', ', $auth->getAttributeValue($map['epodn']));
         $this->tpl->assign('epodn', $epodn);
     } else {
         $this->tpl->assign('epodn', '');
     }
     if (isset($map['cn'])) {
         $cn = implode(', ', $auth->getAttributeValue($map['cn']));
         $this->tpl->assign('cn', $cn);
     } else {
         $this->tpl->assign('cn', '');
     }
     if (isset($map['mail'])) {
         $mail = implode(', ', $auth->getAttributeValue($map['mail']));
         $this->tpl->assign('mail', $mail);
     } else {
         $this->tpl->assign('mail', '');
     }
     if (isset($map['entitlement'])) {
         $entitlement = implode(', ', $auth->getAttributeValue($map['entitlement']));
         $this->tpl->assign('entitlement', $entitlement);
     } else {
         $this->tpl->assign('entitlement', '');
     }
     $this->tpl->assign('map', $map);
     $this->tpl->assign('keys', AuthHandler::getAuthManager($this->person)->getAttributeKeys($this->person->isNRENAdmin()));
     $this->tpl->assign('content', $this->tpl->fetch('attributes.tpl'));
 }
开发者ID:henrikau,项目名称:confusa,代码行数:54,代码来源:attributes.php

示例3: 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'));
 }
开发者ID:henrikau,项目名称:confusa,代码行数:12,代码来源:confirm_aup.php

示例4: __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);
 }
开发者ID:henrikau,项目名称:confusa,代码行数:26,代码来源:Confusa_Auth_OAuth.php

示例5: process

 public function process()
 {
     if (!$this->person->isNRENAdmin()) {
         Logger::log_event(LOG_NOTICE, "User " . stripslashes($this->person->getX509ValidCN()) . " tried to access the NREN-area");
         $this->tpl->assign('reason', 'You are not an NREN-admin');
         $this->tpl->assign('content', $this->tpl->fetch('restricted_access.tpl'));
         return;
     }
     $this->tpl->assign('nren_maint_msg', $this->person->getNREN()->getMaintMsg());
     /* set maint-mode msg */
     if ($this->person->getNREN()->getMaintMode() === "y") {
         $this->tpl->assign('maint_mode_msg', $this->translateTag('l10n_nren_maint_mode_enabled', 'portal_config'));
     } else {
         $this->tpl->assign('maint_mode_msg', $this->translateTag('l10n_nren_maint_mode_disabled', 'portal_config'));
     }
     /* set the radio-buttons */
     $this->tpl->assign('maint_mode_v', array('y', 'n'));
     $this->tpl->assign('maint_mode_t', array(' enabled', ' disabled'));
     $this->tpl->assign('maint_mode_selected', $this->person->getNREN()->getMaintMode());
     $this->tpl->assign('maint_mode', $this->person->getNREN()->getMaintMode() === 'y');
     $this->tpl->assign('content', $this->tpl->fetch('portal_config.tpl'));
 }
开发者ID:henrikau,项目名称:confusa,代码行数:22,代码来源:portal_config.php

示例6: curlContactCert

 public static function curlContactCert($url, $key, $cert, $keypw = false, $postData = null)
 {
     if (is_null($key) || is_null($cert) || $key === "" || $cert === "") {
         throw new ConfusaGenException("Empty key or certificate received " . "when using curlContactCert(). " . "Aborting curl-transfer to url: {$url}");
     }
     if (is_null($postData) || !is_array($postData) || count($postData) == 0) {
         return false;
     }
     /* Do basic URL filtering */
     $curlurl = Input::sanitizeURL($url);
     if (is_null($curlurl) || $curlurl === "" || filter_var($curlurl, FILTER_VALIDATE_URL) === false) {
         Logger::log_event(LOG_NOTICE, "invalid URL (" . $curlurl . "), aborting curl-fetch.");
         return false;
     }
     Logger::log_event(LOG_DEBUG, "Contacting {$curlurl} using cert AuthN");
     /* key should be encrypted, if not, do not use it (not safe!) */
     $start = "-----BEGIN ENCRYPTED PRIVATE KEY-----";
     if (substr($key, 0, strlen($start)) !== $start) {
         Logger::log_event(LOG_NOTICE, "Trying to use curlContactCert with unecrypted private key, aborting.");
         return false;
     }
     $rkey = openssl_pkey_get_private($key, $keypw);
     if ($rkey === false) {
         Logger::log_event(LOG_NOTICE, "Could not parse private key for CurlContactCert, aborting");
         return false;
     }
     if (!openssl_x509_check_private_key($cert, $rkey)) {
         Logger::log_event(LOG_NOTICE, "Provided key and certificate is not a pair, cannot continue.");
         /* throw exception? */
         return false;
     }
     $rcert = new Certificate($cert);
     if (!$rcert->isValid()) {
         $logline = "Certificate (" . $rcert->getHash() . ") has expired, cannot use this. Aborting curl.";
         Logger::log_event(LOG_NOTICE, $logline);
         return false;
     }
     if (!file_exists("/tmp/" . $rcert->getHash() . ".key") || !file_exists("/tmp/" . $rcert->getHash() . ".crt")) {
         if (file_put_contents("/tmp/" . $rcert->getHash() . ".key", $key) === false) {
             Logger::log_event(LOG_NOTICE, "Could not write key to file");
         }
         if (file_put_contents("/tmp/" . $rcert->getHash() . ".crt", $cert) === false) {
             Logger::log_event(LOG_NOTICE, "Could not write cert to file");
         }
     }
     $options = array(CURLOPT_URL => $curlurl, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_SSLKEY => "/tmp/" . $rcert->getHash() . ".key", CURLOPT_SSLCERT => "/tmp/" . $rcert->getHash() . ".crt", CURLOPT_SSLKEYPASSWD => $keypw, CURLOPT_HEADER => false, CURLOPT_FOLLOWLOCATION => true, CURLOPT_RETURNTRANSFER => 1, CURLOPT_CONNECTTIMEOUT => 15);
     $channel = curl_init();
     curl_setopt_array($channel, $options);
     $data = curl_exec($channel);
     $status = curl_errno($channel);
     curl_close($channel);
     if ($status !== 0) {
         throw new ConfusaGenException("Could not connect properly to remote " . "endpoint {$curlurl} using cert-based authN! " . "Maybe the Confusa instance is misconfigured? " . "Please contact an administrator!");
     }
     return $data;
 }
开发者ID:henrikau,项目名称:confusa,代码行数:56,代码来源:CurlWrapper.php

示例7: getCountriesIdP

 /** getCountriesIdP() return all countries and IdP present in the database
  *
  * @params void
  * @return array list of available countries with corresponding IdP(s)
  * @access private
  */
 private function getCountriesIdP()
 {
     if (isset($this->cidp)) {
         return $this->cidp;
     }
     try {
         $res = MDB2Wrapper::execute("SELECT idp_url, country, name FROM nrens n " . "LEFT JOIN idp_map im ON n.nren_id = im.nren_id", NULL, NULL);
     } catch (ConfusaGenException $cge) {
         Logger::log_event(LOG_WARNING, "Could not get IdP-URLs from the database, " . "make sure DB-connection is properly configured\n");
         Framework::error_output($this->translateTag('l10n_err_db_select', 'disco'));
         return array();
     }
     $this->cidp = array();
     foreach ($res as $key => $value) {
         if (!isset($this->cidp[$value['country']])) {
             $this->cidp[$value['country']] = array();
         }
         $this->cidp[$value['country']][] = $value['idp_url'];
     }
     return $res;
 }
开发者ID:henrikau,项目名称:confusa,代码行数:27,代码来源:idp_select.php

示例8: updateSubscriberContact

 /**
  * Update the contact information for a subscriber to a new value
  *
  * @param $contact_email string A general subscriber-mail address
  * @param $contact_phone string The (main) phone number of the subscriber
  * @param $resp_name string The name of a responsible person at the subscr.
  * @param $resp_email string e-mail address of a responsible person
  * @param $help_url string URL of the subscriber's helpdesk
  * @param $help_email string e-mail address of the subscriber's helpdesk
  * @param $language string the language code for the subscriber's preferred
  *                         language
  */
 private function updateSubscriberContact($language)
 {
     $subscriber = $this->person->getSubscriber();
     $subscriber->setEmail($contact_email);
     $subscriber->setPhone($contact_phone);
     $subscriber->setRespName($resp_name);
     $subscriber->setRespEmail($resp_email);
     $subscriber->setHelpURL($help_url);
     $subscriber->setHelpEmail($help_email);
     $subscriber->setLanguage($language);
     try {
         $subscriber->save();
     } catch (ConfusaGenException $cge) {
         Framework::error_output($this->translateTag('l10n_err_updatesubscr', 'contactinfo') . " " . htmlentities($cge->getMessage()));
         Logger::log_event(LOG_INFO, "[sadm] Could not update " . "contact of subscriber {$subscriber}: " . $cge->getMessage());
     }
     Framework::success_output($this->translateTag('l10n_suc_updatesubscr', 'contactinfo') . " " . htmlentities($subscriber->getIdPName()) . ".");
     Logger::log_event(LOG_DEBUG, "[sadm] Updated contact for subscriber {$subscriber}.");
 }
开发者ID:henrikau,项目名称:confusa,代码行数:31,代码来源:nren_subs_settings.php

示例9: save

 /**
  * Synchronize the changes in the subscriber object to the database or
  * freshly store the subscriber in the DB
  *
  * @param $forcedSynch boolean if true, UPDATE the db even if no the object
  *                             is not explicitly marked as having changed
  * @throws ConfusaGenException INSERT/UPDATE of the subscriber failed for
  *                             some reason
  * @access	public
  */
 public function save($forcedSynch = false)
 {
     if (!$this->isValid()) {
         return false;
     }
     if ($this->pendingChanges || $forcedSynch) {
         $query = "UPDATE subscribers SET ";
         if (!is_null($this->getEmail())) {
             $query .= " subscr_email=:subscr_email, ";
             $data['subscr_email'] = $this->getEmail();
         }
         if (!is_null($this->getPhone())) {
             $query .= " subscr_phone=:subscr_phone, ";
             $data['subscr_phone'] = $this->getPhone();
         }
         if (!is_null($this->getRespName())) {
             $query .= "subscr_resp_name=:subscr_resp_name, ";
             $data['subscr_resp_name'] = $this->getRespName();
         }
         if (!is_null($this->getRespEmail())) {
             $query .= "subscr_resp_email=:subscr_resp_email, ";
             $data['subscr_resp_email'] = $this->getRespEmail();
         }
         if (!is_null($this->getState())) {
             $query .= "org_state=:org_state, ";
             $data['org_state'] = $this->getState();
         }
         if (!is_null($this->getComment())) {
             $query .= "subscr_comment=:subscr_comment, ";
             $data['subscr_comment'] = $this->getComment();
         }
         if (!is_null($this->getLanguage())) {
             $query .= "lang=:lang, ";
             $data['lang'] = $this->getLanguage();
         }
         if (!is_null($this->getHelpURL())) {
             $query .= "subscr_help_url=:subscr_help_url, ";
             $data['subscr_help_url'] = $this->getHelpURL();
         }
         if (!is_null($this->getHelpEmail())) {
             $query .= "subscr_help_email=:subscr_help_email, ";
             $data['subscr_help_email'] = $this->getHelpEmail();
         }
         $query = substr($query, 0, -2) . " WHERE subscriber_id=:subscriber_id";
         $data['subscriber_id'] = $this->getDBID();
         try {
             MDB2Wrapper::update($query, null, $data);
             Logger::log_event(LOG_NOTICE, "Updated data for subscriber (" . $this->getDBID() . ") " . $this->getOrgName());
         } catch (DBStatementException $dbse) {
             $msg = __CLASS__ . "::" . __FUNCTION__ . "(" . __LINE__ . ") ";
             $msg .= "Cannot connect properly to database, some internal error. ";
             $msg .= "Make sure the DB is configured correctly." . $dbse->getMessage();
             throw new ConfusaGenException($msg);
         } catch (DBQueryException $dbqe) {
             $msg = __CLASS__ . "::" . __FUNCTION__ . "(" . __LINE__ . ") ";
             $msg .= "Cannot connect properly to database, ";
             $msg .= "errors with supplied data.";
             throw new ConfusaGenException($msg);
         }
         $this->pendingChanges = false;
         return true;
     }
     return false;
 }
开发者ID:henrikau,项目名称:confusa,代码行数:74,代码来源:Subscriber.php

示例10: downloadArchive

 /**
  * downloadArchive() pack the RI-library in a zip-file and present it as
  * a file to download.
  *
  * @param  : void
  * @return : Boolean True if no errors were encountered.
  */
 private function downloadArchive()
 {
     require_once 'file_download.php';
     $confusa_client = file_get_contents(Config::get_config('install_path') . "/extlibs/XML_Client/Confusa_Client.py");
     $parser = file_get_contents(Config::get_config('install_path') . "/extlibs/XML_Client/Parser.py");
     $https_client = file_get_contents(Config::get_config('install_path') . "/extlibs/XML_Client/HTTPSClient.py");
     $timeout = file_get_contents(Config::get_config('install_path') . "/extlibs/XML_Client/Timeout.py");
     $readme = file_get_contents(Config::get_config('install_path') . "/extlibs/XML_Client/README");
     $license = file_get_contents(Config::get_config('install_path') . "/extlibs/XML_Client/LICENSE");
     $gplv3 = file_get_contents(Config::get_config('install_path') . "/COPYING");
     $init = file_get_contents(Config::get_config('install_path') . "/extlibs/XML_Client/__init__.py");
     $zip = new ZipArchive();
     $name = tempnam($ZIP_CACHE, "XML_Cli_");
     $zip->open($name, ZipArchive::OVERWRITE);
     $zip->addFromString("XML_Client/Confusa_Client.py", $confusa_client);
     $zip->addFromString("XML_Client/Parser.py", $parser);
     $zip->addFromString("XML_Client/HTTPSClient.py", $https_client);
     $zip->addFromString("XML_Client/Timeout.py", $timeout);
     $zip->addFromString("XML_Client/README", $readme);
     $zip->addFromString("XML_Client/LICENSE", $license);
     $zip->addFromString("XML_Client/COPYING", $gplv3);
     $zip->addFromString("XML_Client/__init__.py", $init);
     if ($zip->numFiles != 8) {
         Logger::log_event(LOG_NOTICE, " Could not add all RI-library files to ZIP-archive.");
         Framework::error_output("Error creating archive. Cannot send");
         return False;
     }
     if ($zip->close()) {
         $contents = file_get_contents($name);
         download_zip($contents, "XML_Client.zip");
     }
     unlink($name);
     Logger::log_event(LOG_NOTICE, "Sending XML_Client.zip to " . $this->person->getEPPN());
     return True;
 }
开发者ID:henrikau,项目名称:confusa,代码行数:42,代码来源:robot.php

示例11: guessBestLanguage

 /**
  * Guess the "best" language for a user. This should be called whenever a
  * decorated person object is availabe.
  * The "best" language is determined by the following order of steps:
  *
  * 1.) If there is already a language set (this->language) take that one.
  *     Thus the language settings can be functionaly overriden, e.g. in
  *     the framework.
  * 2.) The language stored in the cookie of the user dominates over everything else
  *     Thus, manually changing the language only means setting a cookie.
  * 3.) Try to take the language set by the subscriber, if the user is logged in
  * 4.) If the subscriber-language is NULL, take the language set by the NREN,
  *     if the user is logged in
  * 5.) If the user is not logged in and no session variable is set, take the
  *     first available language from the user's language accept-headers
  * 6.) If none of the languages in the user's accept header is available,
  *     take the default language of the Confusa instance (usually but not necessarily English)
  *
  * @param $person Person-oject (Decorated) Person, from the subscriber or
  *                             NREN of which translator can deduce the
  *                             best language
  * @return void
  */
 public function guessBestLanguage($person)
 {
     if ($this->languageOverridden) {
         return;
     }
     if (isset($_COOKIE['language'])) {
         $cookielang = Input::sanitizeLangCode($_COOKIE['language']);
         $this->language = $cookielang;
         return;
     }
     if ($person->isAuth()) {
         if (!is_null($person->getSubscriber())) {
             try {
                 $query = "SELECT lang FROM subscribers WHERE name=?";
                 $res = MDB2Wrapper::execute($query, array('text'), array($person->getSubscriber()->getIdPName()));
                 if (isset($res[0]['lang'])) {
                     setCookie('language', $res[0]['lang']);
                     $this->language = $res[0]['lang'];
                     return;
                 }
                 $query = "SELECT lang FROM nrens WHERE name=?";
                 $res = MDB2Wrapper::execute($query, array('text'), array($person->getNREN()));
                 if (isset($res[0]['lang'])) {
                     setCookie('language', $res[0]['lang']);
                     $this->language = $res[0]['lang'];
                     return;
                 }
             } catch (DBQueryException $dbqe) {
                 Logger::log_event(LOG_WARNING, "Could not query subscriber/NREN default language. " . "Falling back to system language default! " . $dbqe->getMessage());
             } catch (DBStatementException $dbse) {
                 Logger::log_event(LOG_WARNING, "Could not query subscriber/NREN default language. " . "Falling back to system default! " . $dbse->getMessage());
             }
         }
     }
     $sspdir = Config::get_config('simplesaml_path');
     /* turn off warnings to keep the page header tidy */
     $level = error_reporting(E_ERROR);
     /* poll the accept languages only, if we can load simplesamlphp
      * simplesamlphp *should* always be enabled (otherwise no authN :)),
      * But there can be configurations in bypass auth-mode without a working
      * simplesamlphp instance
      */
     if (file_exists($sspdir . "/lib/_autoload.php")) {
         require_once $sspdir . '/lib/_autoload.php';
         $accept_languages = SimpleSAML_Utilities::getAcceptLanguage();
         $available_languages = Config::get_config('language.available');
         if (empty($accept_languages)) {
             Logger::log_event(LOG_DEBUG, "Simplesamlphp instance seems to be not " . "configured, or not configured properly. Translator " . "will not use the browser's accept-header to determine " . "language settings.");
         }
         foreach ($accept_languages as $key => $value) {
             if (array_search($key, $available_languages) === FALSE) {
                 continue;
             } else {
                 $this->language = $key;
                 return;
             }
         }
     }
     /* turn on warnings again */
     error_reporting($level);
     $this->language = $this->defaultLanguage;
     return;
 }
开发者ID:henrikau,项目名称:confusa,代码行数:86,代码来源:Translator.php

示例12: deleteLogo

 /**
  * Delete the NREN logo for the given position within Confusa. This will
  * really delete the physical file containing the logo.
  *
  * @param $position string a position from
  *                  ConfusaConstants::$ALLOWED_IMG_POSITIONS
  * @param $nren string the name of the NREN, whose custom-logo should be
  *                     removed
  * @return void
  */
 private function deleteLogo($position, $nren)
 {
     $basepath = Config::get_config('custom_logo') . $nren . "/custom_";
     $basepath .= $position . ".";
     $result = FALSE;
     foreach (ConfusaConstants::$ALLOWED_IMG_SUFFIXES as $sfx) {
         $logoName = $basepath . $sfx;
         if (file_exists($logoName)) {
             $result = unlink($logoName);
             break;
         }
     }
     if ($result === FALSE) {
         Framework::error_output($this->translateTag('l10n_error_delete_logo', 'stylist'));
         Logger::log_event(LOG_INFO, "[nadm] Error when trying to delete " . "NREN logo {$logoName}, for NREN {$nren}.");
     } else {
         Framework::success_output($this->translateTag('l10n_success_delete_logo', 'stylist'));
     }
 }
开发者ID:henrikau,项目名称:confusa,代码行数:29,代码来源:stylist.php

示例13: revokeCert

 public function revokeCert($key, $reason)
 {
     /* TODO: method stub
      *
      * At a first glance there seems to be no revoke function in php-openssl.
      * shell_exec('openssl ca -revoke...') would be possible but... eew...
      * Generously leaving this decision to Henrik ;-)
      *
      */
     $cmd = "./../cert_handle/revoke_cert.sh {$key} " . ConfusaConstants::$OPENSSL_CRL_FILE;
     $res = exec($cmd, $output, $return);
     foreach ($output as $line) {
         $msg .= $line . "<BR />\n";
     }
     if ((int) $return != 0) {
         Logger::log_event(LOG_NOTICE, "Problems revoking certificate for " . $this->getFullDN() . "({$key})");
         throw new CGE_KeyRevokeException($msg);
     }
     Logger::log_event(LOG_NOTICE, "Revoked certificate {$key} for user " . $this->getFullDN());
     if (!$this->deleteCertFromDB($key)) {
         Logger::log_event(LOG_NOTICE, "Could not delete certificate ({$key}) from database, revocation only partially completed.");
     }
     return true;
 }
开发者ID:henrikau,项目名称:confusa,代码行数:24,代码来源:CA_Standalone.php

示例14: new_access_token

 function new_access_token($requestToken, $consumer)
 {
     $data = $this->getAuthorizedData($requestToken->key);
     if (isset($data[ConfusaConstants::$OAUTH_VALIDITY_ATTRIBUTE])) {
         $validity = $data[ConfusaConstants::$OAUTH_VALIDITY_ATTRIBUTE];
     } else {
         $validity = ConfusaConstants::$DEFAULT_REAUTH_TIMEOUT;
     }
     /* need the validity in seconds */
     $validity = $validity * 60;
     Logger::log_event(LOG_DEBUG, '[OAuthDataStore_Confusa] OAuth new_access_token(' . $requestToken . ',' . $consumer . ')');
     $token = new OAuthToken(SimpleSAML_Utilities::generateID(), SimpleSAML_Utilities::generateID());
     $this->store->set('access', $token->key, $consumer->key, $token, $validity);
     return $token;
 }
开发者ID:henrikau,项目名称:confusa,代码行数:15,代码来源:OAuthDataStore_Confusa.php

示例15: create

 /**
  * MDB2Wrapper::create() create the connection (connect and initialize)
  *
  * This function will retrieve the database-credentials from the
  * config-file. From this, it will connect tot he database and store the
  * connection so the other functions can use it.
  *
  * At the moment, this is hard-coded to mysql (see the naming
  * below), but if we should ever change to another database, this is the
  * place to add the logic).
  *
  */
 private static function create()
 {
     $uname = Config::get_config('mysql_username');
     $passwd = Config::get_config('mysql_password');
     $host = Config::get_config('mysql_host');
     $db = Config::get_config('mysql_db');
     $dsn = "mysql://{$uname}:{$passwd}@{$host}/{$db}";
     $options = array('debug' => 2, 'result_buffering' => true);
     MDB2Wrapper::$conn = MDB2::factory($dsn, $options);
     if (PEAR::isError(MDB2Wrapper::$conn)) {
         Logger::log_event(LOG_WARNING, MDB2Wrapper::$conn->getMessage());
         /* FIXME l10n, better error-reporting */
         echo "Cannot connect to database: " . MDB2Wrapper::$conn->getMessage() . "<br>\n";
         die(MDB2Wrapper::$conn->getMessage());
     }
 }
开发者ID:henrikau,项目名称:confusa,代码行数:28,代码来源:MDB2Wrapper.php


注:本文中的Logger::log_event方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。