/**
  * @param string $strLangName
  * @param null $strLangModule
  *
  * @return string
  */
 protected function renderError($strLangName, $strLangModule = null)
 {
     $strError = $this->getLang($strLangName, $strLangModule);
     $objHistory = new class_history();
     $arrHistory = explode("&", $objHistory->getAdminHistory(0));
     if ($this->getArrModule("template") == "/folderview.tpl") {
         $strError .= ' ' . class_link::getLinkAdminManual('href="javascript:window.parent.location.reload();"', $this->getLang('commons_back'));
     } else {
         $strError .= ' ' . class_link::getLinkAdminManual("href=\"" . $arrHistory[0] . "&" . $arrHistory[1] . "\"", $this->getLang("commons_back"));
     }
     return $this->objToolkit->warningBox($strError);
 }
 /**
  * Processes a portal-request
  *
  * @param string $strModule
  * @param string $strAction
  * @param string $strLanguageParam
  *
  * @throws class_exception
  * @return string
  */
 private function processPortalRequest($strModule, $strAction, $strLanguageParam)
 {
     $strReturn = "";
     //process language-param
     if (class_module_system_module::getModuleByName("languages") != null) {
         $objLanguage = new class_module_languages_language();
         $objLanguage->setStrPortalLanguage($strLanguageParam);
     }
     //Load the portal parts
     $objModule = class_module_system_module::getModuleByName($strModule);
     if ($objModule != null) {
         if (_xmlLoader_) {
             if ($objModule->getStrXmlNamePortal() != "") {
                 $strClassname = str_replace(".php", "", $objModule->getStrXmlNamePortal());
                 $objModuleRequested = new $strClassname();
                 $strReturn = $objModuleRequested->action($strAction);
             } else {
                 $objModuleRequested = $objModule->getPortalInstanceOfConcreteModule();
                 $strReturn = $objModuleRequested->action($strAction);
             }
         } else {
             if ($strModule == "pages") {
                 $strAction = "";
             }
             //fill the history array to track actions
             $objHistory = new class_history();
             $objHistory->setPortalHistory();
             $objModuleRequested = $objModule->getPortalInstanceOfConcreteModule();
             $strReturn = $objModuleRequested->action($strAction);
         }
     } else {
         if (_xmlLoader_ === false) {
             if (count(class_carrier::getInstance()->getObjDB()->getTables()) == 0 && file_exists(_realpath_ . "/installer.php")) {
                 class_response_object::getInstance()->setStrRedirectUrl(_webpath_ . "/installer.php");
                 return "";
                 //throw new class_exception("Module Pages not installed, redirect to installer", class_exception::$level_ERROR);
             }
         }
         throw new class_exception("module " . $strModule . " not installed!", class_exception::$level_FATALERROR);
     }
     return $strReturn;
 }
Exemplo n.º 3
0
 /**
  * Generates a delete-button. The passed element name and question is shown as a modal dialog
  * when the icon was clicked. So set the link-href-param for the final deletion, otherwise the
  * user has no more chance to delete the record!
  *
  * @param string $strElementName
  * @param string $strQuestion
  * @param string $strLinkHref
  *
  * @return string
  */
 public function listDeleteButton($strElementName, $strQuestion, $strLinkHref)
 {
     $strElementName = uniStrReplace(array('\''), array('\\\''), $strElementName);
     $strQuestion = uniStrReplace("%%element_name%%", htmlToString($strElementName, true), $strQuestion);
     //get the reload-url
     $objHistory = new class_history();
     $strParam = "";
     if (uniStrpos($strLinkHref, "javascript:") === false) {
         $strParam = "reloadUrl=" . urlencode($objHistory->getAdminHistory());
         if (uniSubstr($strLinkHref, -4) == ".php" || uniSubstr($strLinkHref, -5) == ".html") {
             $strParam = "?" . $strParam;
         } else {
             $strParam = "&" . $strParam;
         }
     }
     //create the list-button and the js code to show the dialog
     $strButton = class_link::getLinkAdminManual("href=\"#\" onclick=\"javascript:jsDialog_1.setTitle('" . class_carrier::getInstance()->getObjLang()->getLang("dialog_deleteHeader", "system") . "'); jsDialog_1.setContent('" . $strQuestion . "', '" . class_carrier::getInstance()->getObjLang()->getLang("dialog_deleteButton", "system") . "',  '" . $strLinkHref . $strParam . "'); jsDialog_1.init(); return false;\"", "", class_carrier::getInstance()->getObjLang()->getLang("commons_delete", "system"), "icon_delete");
     return $this->listButton($strButton);
 }
Exemplo n.º 4
0
 /**
  * Returns the URL at the given position (from HistoryArray)
  *
  * @param int $intPosition
  * @deprecated use class_history::getAdminHistory() instead
  * @see class_history::getAdminHistory()
  * @return string
  */
 protected function getHistory($intPosition = 0)
 {
     $objHistory = new class_history();
     return $objHistory->getAdminHistory($intPosition);
 }
Exemplo n.º 5
0
 /**
  * Used to handle the current exception.
  * Decides, if the execution should be stopped, or continued.
  * Therefore the errorlevel defines the "weight" of the exception
  *
  * @return void
  */
 public function processException()
 {
     //set which POST parameters should read out
     $arrPostParams = array("module", "action", "page", "systemid");
     $objHistory = new class_history();
     //send an email to the admin?
     $strAdminMail = "";
     try {
         if (class_db::getInstance()->getBitConnected()) {
             $strAdminMail = class_module_system_setting::getConfigValue("_system_admin_email_");
         }
     } catch (Exception $objEx) {
     }
     if ($strAdminMail != "") {
         $strMailtext = "";
         $strMailtext .= "The system installed at " . _webpath_ . " registered an error!\n\n";
         $strMailtext .= "The error message was:\n";
         $strMailtext .= "\t" . $this->getMessage() . "\n\n";
         $strMailtext .= "The level of this error was:\n";
         $strMailtext .= "\t";
         if ($this->getErrorlevel() == self::$level_FATALERROR) {
             $strMailtext .= "FATAL ERROR";
         }
         if ($this->getErrorlevel() == self::$level_ERROR) {
             $strMailtext .= "REGULAR ERROR";
         }
         $strMailtext .= "\n\n";
         $strMailtext .= "File and line number the error was thrown:\n";
         $strMailtext .= "\t" . basename($this->getFile()) . " in line " . $this->getLine() . "\n\n";
         $strMailtext .= "Callstack / Backtrace:\n\n";
         $strMailtext .= $this->getTraceAsString();
         $strMailtext .= "\n\n";
         $strMailtext .= "User: "******" (" . class_carrier::getInstance()->getObjSession()->getUsername() . ")\n";
         $strMailtext .= "Source host: " . getServer("REMOTE_ADDR") . " (" . @gethostbyaddr(getServer("REMOTE_ADDR")) . ")\n";
         $strMailtext .= "Query string: " . getServer("REQUEST_URI") . "\n";
         $strMailtext .= "POST data (selective):\n";
         foreach ($arrPostParams as $strParam) {
             if (getPost($strParam) != "") {
                 $strMailtext .= "\t" . $strParam . ": " . getPost($strParam) . "\n";
             }
         }
         $strMailtext .= "\n\n";
         $strMailtext .= "Last actions called:\n";
         $strMailtext .= "Admin:\n";
         $arrHistory = $objHistory->getArrAdminHistory();
         if (is_array($arrHistory)) {
             foreach ($arrHistory as $intIndex => $strOneUrl) {
                 $strMailtext .= " #" . $intIndex . ": " . $strOneUrl . "\n";
             }
         }
         $strMailtext .= "Portal:\n";
         $arrHistory = $objHistory->getArrPortalHistory();
         if (is_array($arrHistory)) {
             foreach ($arrHistory as $intIndex => $strOneUrl) {
                 $strMailtext .= " #" . $intIndex . ": " . $strOneUrl . "\n";
             }
         }
         $strMailtext .= "\n\n";
         $strMailtext .= "If you don't know what to do, feel free to open a ticket.\n\n";
         $strMailtext .= "For more help visit http://www.kajona.de.\n\n";
         $objMail = new class_mail();
         $objMail->setSubject("Error on website " . _webpath_ . " occured!");
         $objMail->setSender($strAdminMail);
         $objMail->setText($strMailtext);
         $objMail->addTo($strAdminMail);
         $objMail->sendMail();
         $objMessageHandler = new class_module_messaging_messagehandler();
         $objMessage = new class_module_messaging_message();
         $objMessage->setStrBody($strMailtext);
         $objMessage->setObjMessageProvider(new class_messageprovider_exceptions());
         $objMessageHandler->sendMessageObject($objMessage, new class_module_user_group(class_module_system_setting::getConfigValue("_admins_group_id_")));
     }
     if ($this->intErrorlevel == class_exception::$level_FATALERROR) {
         //Handle fatal errors.
         $strLogMessage = basename($this->getFile()) . ":" . $this->getLine() . " -- " . $this->getMessage();
         class_logger::getInstance()->addLogRow($strLogMessage, class_logger::$levelError);
         //fatal errors are displayed in every case
         if (_xmlLoader_ === true) {
             $strErrormessage = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
             $strErrormessage .= "<error>" . xmlSafeString($this->getMessage()) . "</error>";
         } else {
             $strErrormessage = "<html><head></head><body><div style=\"border: 1px solid red; padding: 5px; margin: 20px; font-family: arial,verdana,sans-serif; font-size: 12px;  \">\n";
             $strErrormessage .= "<div style=\"background-color: #cccccc; color: #000000; font-weight: bold; \">A fatal error occurred:</div>\n";
             $strErrormessage .= "<pre>" . htmlspecialchars($this->getMessage(), ENT_QUOTES, "UTF-8", false) . "</pre><br />";
             $strErrormessage .= "Please inform the administration about the error above.";
             $strErrormessage .= "</div></body></html>";
         }
         print $strErrormessage;
         //Execution has to be stopped here!
         if (class_response_object::getInstance()->getStrStatusCode() == "" || class_response_object::getInstance()->getStrStatusCode() == class_http_statuscodes::SC_OK) {
             class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_INTERNAL_SERVER_ERROR);
         }
         class_response_object::getInstance()->sendHeaders();
         die;
     } elseif ($this->intErrorlevel == class_exception::$level_ERROR) {
         //handle regular errors
         $strLogMessage = basename($this->getFile()) . ":" . $this->getLine() . " -- " . $this->getMessage();
         class_logger::getInstance()->addLogRow($strLogMessage, class_logger::$levelWarning);
         //check, if regular errors should be displayed:
         if ($this->intDebuglevel >= 1) {
             if (_xmlLoader_ === true) {
                 $strErrormessage = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
                 $strErrormessage .= "<error>" . xmlSafeString($this->getMessage()) . "</error>";
             } else {
                 $strErrormessage = "<html><head></head><body><div style=\"border: 1px solid red; padding: 5px; margin: 20px; font-family: arial,verdana,sans-serif; font-size: 12px; \">\n";
                 $strErrormessage .= "<div style=\"background-color: #cccccc; color: #000000; font-weight: bold; \">An error occurred:</div>\n";
                 $strErrormessage .= "<pre>" . htmlspecialchars($this->getMessage(), ENT_QUOTES, "UTF-8", false) . "</pre><br />";
                 //$strErrormessage .= basename($this->getFile()) ." in Line ".$this->getLine();
                 $strErrormessage .= "Please inform the administration about the error above.";
                 $strErrormessage .= "</div></body></html>";
             }
             print $strErrormessage;
             //if error was displayed, stop execution
             //die();
         }
     }
 }