本文整理汇总了PHP中Framework::error_output方法的典型用法代码示例。如果您正苦于以下问题:PHP Framework::error_output方法的具体用法?PHP Framework::error_output怎么用?PHP Framework::error_output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framework
的用法示例。
在下文中一共展示了Framework::error_output方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Create a new MailManager and set all the relevant header flags for
* sending a message from $sender to $pers->getEmail
*
* @param $pers Person A person object containing recipient information
* @param $sender string The sender, as to be defined in the mail's
* envelope
* @param $senderName string The name that should appear in the sender
* field
* @param $sendHeader string The sender, as to be defined in the mail's
* header
*/
public function __construct($pers, $sender, $senderName, $sendHeader, $alternateAddress = null)
{
if (!$pers instanceof Person) {
throw new ConfusaGenException("Error: First argument to the " . "MailManager constructor is not a " . "valid person object!");
}
$this->mailer = new PHPMailer();
if (is_null($this->mailer)) {
Framework::error_output("Could not create mailer. Aborting");
return;
}
$this->mailer->CharSet = "UTF-8";
$this->mailer->Mailer = "sendmail";
/* set the envelope "from" address using the sendmail option -f, and
* the return-path header */
$this->mailer->Sender = $sender;
/* set the header "from" address */
$this->mailer->From = $sendHeader;
$this->mailer->FromName = $senderName;
$this->mailer->WordWrap = 80;
$this->toAddr = $pers->getEmail();
if (!is_null($alternateAddress)) {
$this->toAddr = $alternateAddress;
}
$this->mailer->AddAddress($this->toAddr, $pers->getName());
$help_desk = $pers->getSubscriber()->getHelpEmail();
/* add a reply-to to the helpdesk, if a helpdesk is defined */
if (isset($help_desk)) {
$support_name = $pers->getSubscriber()->getOrgName() . " support";
$this->mailer->AddReplyTo($help_desk, $support_name);
}
}
示例2: handleMaintText
private function handleMaintText()
{
if (array_key_exists("nren_maint_msg", $_POST)) {
if ($this->person->getNREN()->setMaintMsg($this->person, $_POST['nren_maint_msg'])) {
Framework::success_output($this->translateTag("l10n_nren_maint_msg_success", 'portal_config'));
} else {
Framework::error_output($this->translateTag("l10n_nren_maint_msg_failure", 'portal_config'));
}
}
}
示例3: 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'));
}
示例4: pre_process
public function pre_process($person)
{
parent::pre_process($person);
$script = file_get_contents('../include/fetch_attr.js');
$this->tpl->assign('rawScript', $script);
if (!$person->isNRENAdmin() && !$person->isSubscriberAdmin()) {
return;
}
if (isset($_POST['attributes_operation'])) {
switch ($_POST['attributes_operation']) {
case 'update_map':
$cn = Input::sanitizeText($_POST['cn']);
$mail = Input::sanitizeText($_POST['mail']);
/* only NREN-admin can change the mapping for
* - organization-identifier
* - entitlement
*/
if ($this->person->isNRENAdmin()) {
$epodn = Input::sanitizeText($_POST['epodn']);
$entitlement = Input::sanitizeText($_POST['entitlement']);
if ($this->person->getNREN()->saveMap($this->person->getEPPNKey(), $epodn, $cn, $mail, $entitlement)) {
Framework::success_output($this->translateTag('l10n_suc_updmap', 'attributes'));
}
} else {
if ($this->person->isSubscriberAdmin()) {
try {
$result = $this->person->getSubscriber()->saveMap($this->person->getEPPNKey(), $cn, $mail);
} catch (DBQueryException $dbqe) {
Framework::error_output($this->translateTag('l10n_err_updmap1', 'attributes') . "<br />" . $this->translateTag('l10n_label_cn', 'attributes') . ": " . htmlentities($cn) . "<br />" . $this->translateTag('l10n_label_mail', 'attributes') . ": " . htmlentities($mail) . "<br />" . $this->translateMessageTag('err_servsaid') . " " . htmlentities($dbqe->getMessage()));
Logger::log_event(LOG_NOTICE, __FILE__ . ", " . __LINE__ . ": " . $dbqe->getMessage());
} catch (DBStatementException $dbse) {
Framework::error_output("Could not update the subscriber-mapping, probably due to a " . "problem with the server-configuration. Server said: " . htmlentities($dbse->getMessage()));
Logger::log_event(LOG_NOTICE, __FILE__ . ", " . __LINE__ . ": " . $dbse->getMessage());
}
if ($result === true) {
Framework::success_output($this->translateTag('l10n_suc_updmap', 'attributes'));
}
}
}
break;
default:
Framework::error_output("Unknown operation chosen on attributes mask!");
break;
}
}
}
示例5: process
/**
* Display CSR generation choices. Fail if user has not accepted AUP
* or number of registered e-mail addresses does not match the number
* mandated by the NREN.
* @see Content_Page::process()
*/
function process()
{
if (CS::getSessionKey('hasAcceptedAUP') !== true) {
Framework::error_output($this->translateTag("l10n_err_aupagreement", "processcsr"));
return;
}
$numberRequiredEmails = $this->person->getNREN()->getEnableEmail();
switch ($numberRequiredEmails) {
case 'n':
case '0':
break;
case '1':
case 'm':
$numberEmails = count($this->person->getRegCertEmails());
if ($numberEmails < 1) {
Framework::error_output($this->translateTag('l10n_err_emailmissing', 'processcsr'));
$this->tpl->assign('disable_next_button', true);
}
break;
default:
break;
}
if (isset($_GET['show'])) {
switch ($_GET['show']) {
case 'upload_csr':
/* FIXME: constants */
$this->tpl->assign('nextScript', 'upload_csr.php');
$this->tpl->assign('upload_csr', true);
break;
case 'paste_csr':
$this->tpl->assign('nextScript', 'upload_csr.php');
$this->tpl->assign('paste_csr', true);
break;
default:
$this->tpl->assign('nextScript', 'browser_csr.php');
$this->tpl->assign('browser_csr', true);
break;
}
} else {
$this->tpl->assign('nextScript', 'browser_csr.php');
$this->tpl->assign('browser_csr', true);
}
$user_cert_enabled = $this->person->testEntitlementAttribute(Config::get_config('entitlement_user'));
$this->tpl->assign('user_cert_enabled', $user_cert_enabled);
$this->tpl->assign('content', $this->tpl->fetch('receive_csr.tpl'));
}
示例6: 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);
}
示例7: confusaErrorHandler
function confusaErrorHandler($errno, $errstr, $errfile, $errline)
{
$msg = "";
$display_errors = ini_get('display_errors') == true || ini_get('display_errors') == "stdout";
switch ($errno) {
case E_ERROR:
case E_USER_ERROR:
$msg = "PHP Fatal Error: {$errstr} in {$errfile} on line {$errline}";
if ($display_errors) {
Framework::error_output($msg);
}
break;
case E_WARNING:
case E_USER_WARNING:
$msg = "PHP Warning: {$errstr} in {$errfile} on line {$errline}";
if ($display_errors) {
Framework::warning_output($msg);
}
break;
case E_NOTICE:
case E_USER_NOTICE:
$msg = "PHP Notice: {$errstr} in {$errfile} on line {$errline}";
if ($display_errors) {
Framework::message_output($msg);
}
break;
case E_STRICT:
$msg = "PHP Strict: {$errstr} in {$errfile} on line {$errline}";
break;
default:
$msg = "PHP Unknown: {$errstr} in {$errfile} on line {$errline}";
if ($display_errors) {
Framework::message_output($msg);
}
break;
}
/* if logging is turned on, log the errors to the respective PHP log */
if (ini_get('log_errors') && error_reporting() & $errno) {
error_log($msg);
}
return true;
}
示例8: deleteCertFromDB
public function deleteCertFromDB($key)
{
Framework::error_output(__FILE__ . ":" . __LINE__ . " This function (deleteCertFromDB) should not be called in online-mode!");
return false;
}
示例9: getAboutText
/**
* getAboutText
* Get the about-text for a certain NREN, so it can be displayed in Confusa's
* about-section
*
* @param Person $person the current person for tag-replacement
*/
public function getAboutText($person)
{
$query = "SELECT about FROM nrens WHERE nren_id = ? AND about IS NOT NULL";
try {
$res = MDB2Wrapper::execute($query, array('text'), array($this->getID()));
} catch (DBStatementException $dbse) {
Framework::error_output($this->translateMessageTag('abt_err_dbstat') . " " . htmlentities($dbse->getMessage()));
Logger::log_event(LOG_INFO, "Could not retrive about-text for NREN {$nren} " . "due to an error with the statement. " . "Server said: " . $dbse->getMessage());
return null;
} catch (DBQueryException $dbqe) {
Framework::error_output($this->translateMessageTag('abt_err_dbquery') . " " . htmlentities($nren));
Logger::log_event(LOG_INFO, "Could not retrieve about-text for NREN {$nren} " . "due to an error in the statement. Server said: " . $dbqe->getMessage());
return null;
}
if (count($res) > 0) {
$at = $res[0]['about'];
$at = stripslashes($at);
$at = Input::br2nl($at);
$textile = new Textile();
return $this->replaceTags($textile->TextileRestricted($at, 0), $person);
}
return null;
}
示例10: 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;
}
示例11: signCSR
/**
* Sign the CSR with the passed authToken. If signing succeeds, the class
* member authKey is set to the orderNumber/certHash. If not, an error is
* displayer
* @param $authToken pubkey hash of the CSR that is to be signed
*/
private function signCSR($authToken)
{
$csr = CSR::getFromDB($this->person->getX509ValidCN(), $authToken);
if (!isset($csr) || !$csr) {
$errorTag = PW::create();
Framework::error_output("[{$errorTag}] Did not find CSR with auth_token " . htmlentities($auth_token));
$msg = "User " . $this->person->getEPPN() . " ";
$msg .= "tried to delete CSR with auth_token " . $authToken . " but was unsuccessful";
Logger::logEvent(LOG_NOTICE, "Process_CSR", "approveCSR({$authToken})", $msg, __LINE__, $errorTag);
return false;
}
try {
if (!isset($this->ca)) {
Framework::error_output($this->translateTag('l10n_err_noca', 'processcsr'));
return false;
}
$permission = $this->person->mayRequestCertificate();
if ($permission->isPermissionGranted() === false) {
Framework::error_output($this->translateTag('l10n_err_noperm1', 'processcsr') . "<br /><br />" . $permission->getFormattedReasons() . "<br />" . $this->translateTag('l10n_err_noperm2', 'processcsr'));
return;
}
$this->authKey = $this->ca->signKey($csr);
} catch (CGE_ComodoAPIException $capie) {
Framework::error_output($this->translateTag('l10n_sign_error', 'processcsr') . htmlentities($capie));
return false;
} catch (ConfusaGenException $e) {
$msg = $this->translateTag('l10n_sign_error', 'processcsr') . "<br /><br /><i>" . htmlentities($e->getMessage()) . "</i><br />";
Framework::error_output($msg);
return false;
} catch (KeySigningException $kse) {
Framework::error_output($this->translateTag('l10n_sign_error', 'processcsr') . htmlentites($kse->getMessage()));
return false;
}
CSR::deleteFromDB($this->person, $authToken);
}
示例12: 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}.");
}
示例13: retrieveMap
/**
* retrieveMap() return the map for the subscriber
*
* @param void
* @return Array|null the array for the subscriber or null if not set
* @access private
*/
private function retrieveMap()
{
if (is_null($this->nren->getID())) {
throw new ConfusaGenException("Cannot find map for subscriber when NREN-ID is not set!");
}
if (is_null($this->db_id)) {
throw new ConfusaGenException("Cannot find map for subscriber when Subscriber-ID is not set!");
}
$this->hasMap = false;
$query = "SELECT * FROM attribute_mapping WHERE subscriber_id=? AND nren_id=?";
$params = array('text', 'text');
$data = array($this->db_id, $this->nren->getID());
try {
$res = MDB2Wrapper::execute($query, $params, $data);
switch (count($res)) {
case 0:
$this->hasMap = false;
return false;
case 1:
$this->hasMap = true;
$this->map = $res[0];
return true;
default:
$this->hasMap = false;
$msg = "Too many hits (" . count($res) . ") were found in the database. ";
$msg .= __CLASS__ . __FUNCTION__ . " gets confused. Aborting.";
Logger::log_event(LOG_NOTICE, $msg);
Framework::error_output($msg);
return false;
}
} catch (ConfusaGenException $e) {
/* FIXME */
Framework::error_output($e->getMessage());
return false;
}
}
示例14: displayInvalidCharError
/**
* Show an error (in the framework) about an invalid character found
* during sanitation.
*
* @param $original The original string, e.g. as it was received via the
* POST array
* @param $sanitized The string as it appeared after sanitizing it
* @param $dictEntry The dictionary entry to look up from the dictionary
* when referring to the input element that cause the
* sanitation.
* @param $dictionary The dictionary from which the entry should be looked
* up. If this is NULL, the current page's dictionary
* will be used by default.
*/
protected function displayInvalidCharError($original, $sanitized, $dictEntry = NULL, $dictionary = NULL)
{
$invalidChars = Input::findSanitizedCharacters($original, $sanitized);
$errorMsg = "";
if (empty($dictionary)) {
$dictionary = $this->dictionary;
}
if (isset($dictEntry)) {
$errorMsg .= $this->translateTag($dictEntry, $this->dictionary);
}
$errorMsg .= " ";
$errorMsg .= $this->translateTag('l10n_err_sanitation', 'messages');
$errorMsg .= " {$invalidChars}";
Framework::error_output($errorMsg);
}
示例15: revoke_list
/**
* Revoke a list of certificates possibly belonging to more than one end-entity
* based on an array of auth_keys stored in the session. Based on the number of
* certificates that are going to be revoked, this may take some time.
*
* @param string $reason The reason for revocation (as in RFC 3280)
*
*/
private function revoke_list($reason)
{
if (Config::get_config('ca_mode') === CA_COMODO && Config::get_config('capi_test') === true) {
Framework::message_output($this->translateTag('l10n_msg_revsim1', 'revocation'));
}
$auth_keys = CS::getSessionKey('auth_keys');
CS::deleteSessionKey('auth_keys');
if (is_null($auth_keys)) {
Framework::error_output("Lost session! Please log-out of Confusa, " . "log-in again and try again!\n");
return;
}
$num_certs = count($auth_keys);
$num_certs_revoked = 0;
Logger::log_event(LOG_INFO, "Trying to revoke {$num_certs} certificates." . "Administrator contacted us from " . $_SERVER['REMOTE_ADDR'] . " in a bulk (list) revocation request.");
foreach ($auth_keys as $auth_key) {
try {
if (!$this->ca->revokeCert($auth_key, $reason)) {
Framework::error_output("Could not revoke certificate " . htmlentities($auth_key) . ".");
} else {
$num_certs_revoked = $num_certs_revoked + 1;
}
} catch (ConfusaGenException $cge) {
Framework::error_output($cge->getMessage());
}
}
Logger::log_event(LOG_INFO, "Successfully revoked {$num_certs_revoked} certificates out of {$num_certs}. " . "Administrator contacted us from " . $_SERVER['REMOTE_ADDR'] . " in a bulk (list) revocation request.");
Framework::message_output($this->translateTag('l10n_suc_revoke1', 'revocation') . " " . $num_certs_revoked . " " . $this->translateTag('l10n_suc_revoke2', 'revocation') . " " . $num_certs);
}