예제 #1
0
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;
}
예제 #2
0
 /**
  * triggerAdminIssues() - post error-messages
  *
  * Function will report issues in the form of errors to the screen when an
  * admin looks at the portal and something is amiss. This includes:
  *
  * - missing privacy notice for the NREN
  * - missing about_nren text
  * - incomplete or missing attribute-map
  *
  * @param	void
  * @return	void
  * @access	private
  */
 private function triggerAdminIssues()
 {
     if (!isset($this->person)) {
         return;
     }
     $nren = $this->person->getNREN();
     if (!$nren) {
         return;
     }
     $url_arg = "?mode=admin&show=text&anticsrf=" . Framework::getAntiCSRF();
     if (!$nren->hasHelpText()) {
         Framework::warning_output("Missing NREN help-text. <a href=\"stylist.php" . $url_arg . "#edit_help\">Configure</a>");
     }
     if (!$nren->hasAboutText()) {
         Framework::warning_output("Missing About-NREN text. <a href=\"stylist.php" . $url_arg . "#edit_about\">Configure</a>");
     }
     if (!$nren->hasPrivacyNotice()) {
         Framework::warning_output("Missing privacy-notice. <a href=\"stylist.php" . $url_arg . "#edit_pn\">Configure</a>");
     }
 }
예제 #3
0
 /**
  * Decorate a given template with the tags from the dictiornary in the
  * right language. This is nothing more than repeated consulation of a
  * LUT. The dictionary usually consists of two components: A definition file
  * including all the tags plus their translation in one language, usually
  * English. The second file contains the tags again and a number of
  * translations. We merge together the contents of both files and see what
  * we can find regarding the currently set language.
  *
  * Don't decorate the template if the passed dictionary is null or
  * the definition file does not exists.
  *
  * @param $template The template that is to be decorated
  * @param $dictionaryName The definition file prefix from which the texts
  *                        are taken
  *
  * @return The decorated template
  */
 public function decorateTemplate($template, $dictionaryName)
 {
     /* if the dictionary is null or does not exist, don't decorate the template */
     if (empty($dictionaryName)) {
         return $template;
     }
     $definitions = $this->getTranslationArray($dictionaryName);
     if (empty($definitions)) {
         return $template;
     }
     /* warn only *once* if dictionary entries are missing */
     $warn_missing = FALSE;
     foreach ($definitions as $tag => $entry) {
         /* manual cast, because json_decode returns objects of stdClass */
         $entry = (array) $entry;
         if (isset($entry[$this->language])) {
             $template->assign($tag, $entry[$this->language]);
         } else {
             $template->assign($tag, $entry[$this->defaultLanguage]);
             if (!isset($entry[$this->defaultLanguage])) {
                 Logger::log_event(LOG_WARNING, "Missing tranlsation entry for {$tag} in " . __FILE__);
                 if ($warn_missing === FALSE) {
                     Framework::warning_output("Translation problem: The dictionary " . "for this page does not contain any entry for " . "certain texts! Some parts of the page may appear blank.");
                     $warn_missing = TRUE;
                 }
             }
         }
     }
     return $template;
 }