function eZFatalError() { eZDebug::setHandleType(eZDebug::HANDLE_NONE); eZWebDAVContentBackend::appendLogEntry("****************************************"); eZWebDAVContentBackend::appendLogEntry("Fatal error: eZ Publish did not finish its request"); eZWebDAVContentBackend::appendLogEntry("The execution of eZ Publish was abruptly ended, the debug output is present below."); eZWebDAVContentBackend::appendLogEntry("****************************************"); // $templateResult = null; // eZDisplayResult( $templateResult ); }
/** * Checks authentication for the given $user. * * This method checks the given user/password credentials encapsulated in * $data. Returns true if the user was succesfully recognized and the * password is valid for him, false otherwise. In case no username and/or * password was provided in the request, empty strings are provided as the * parameters of this method. * * @param ezcWebdavBasicAuth $data * @return bool */ public function authenticateBasic(ezcWebdavBasicAuth $data) { $loginHandler = 'standard'; eZWebDAVContentBackend::appendLogEntry("Got username: {$data->username}"); // added by @ds to fix problems with IE6 SP2 if (preg_match('(^' . preg_quote($_SERVER['SERVER_NAME']) . '(.+))', $data->username, $matches) > 0) { $data->username = $matches[1]; } eZWebDAVContentBackend::appendLogEntry("Processed to username: {$data->username}"); $userClass = eZUserLoginHandler::instance($loginHandler); $user = $userClass->loginUser($data->username, $data->password); if (!$user instanceof eZUser) { return false; } eZWebDAVContentBackend::appendLogEntry("AuthenticatedBasic"); return true; }
/** * Logs to var/log/webdav.log AND var/<site_name>/log/webdav.log. * * From eZ Publish. * * @param string $logString String to record * @param string $label Label to put in front of $logString */ public static function appendLogEntry($logString, $label = false) { if (!isset(self::$useLogging)) { $webdavINI = eZINI::instance(self::WEBDAV_INI_FILE); self::$useLogging = $webdavINI->variable('GeneralSettings', 'Logging') === 'enabled'; } if (self::$useLogging) { if (PHP_SAPI === 'cli') { // var_dump( $logString ); } else { $varDir = realpath(eZSys::varDirectory()); $logDir = 'log'; $logName = 'webdav.log'; $fileName = $varDir . DIRECTORY_SEPARATOR . $logDir . DIRECTORY_SEPARATOR . $logName; if (!file_exists($varDir . DIRECTORY_SEPARATOR . $logDir)) { eZDir::mkdir($varDir . DIRECTORY_SEPARATOR . $logDir, 0775, true); } $logFile = fopen($fileName, 'a'); $nowTime = date("Y-m-d H:i:s : "); $text = $nowTime . $logString; if ($label) { $text .= ' [' . $label . ']'; } fwrite($logFile, $text . "\n"); fclose($logFile); } } }