Esempio n. 1
0
 public function __wakeup()
 {
     Customweb_Core_Util_Error::deactivateErrorMessages();
     date_default_timezone_set(@date_default_timezone_get());
     Customweb_Core_Util_Error::activateErrorMessages();
     // In case 'date' is set, we need to convert from PHP serialized object
     if (isset($this->date)) {
         if (isset($this->timezone_type) && isset($this->timezone) && $this->timezone_type == 3) {
             $this->dateTime = new DateTime($this->date, new DateTimeZone($this->timezone));
         } else {
             $this->dateTime = new DateTime($this->date);
         }
     } else {
         $this->dateTime = new DateTime($this->dateTimeAsString);
     }
 }
Esempio n. 2
0
 /**
  * Resolves the given file name over the include path. In case the file could not
  * be found the method throws an exception.
  *
  * @param string $fileName
  * @throws Customweb_Core_Exception_FileNotFoundException
  * @return string The absolute path to the file.
  */
 public static function resolveFileOnIncludePath($fileName)
 {
     if (function_exists('stream_resolve_include_path')) {
         if (($path = stream_resolve_include_path($fileName)) === false) {
             throw new Customweb_Core_Exception_FileNotFoundException($fileName);
         } else {
             return $path;
         }
     } else {
         $include_path = explode(PATH_SEPARATOR, get_include_path());
         Customweb_Core_Util_Error::deactivateErrorMessages();
         foreach ($include_path as $path) {
             $file = realpath($path . '/' . $fileName);
             if (@file_exists($file)) {
                 return $file;
             }
         }
         Customweb_Core_Util_Error::activateErrorMessages();
         throw new Customweb_Core_Exception_FileNotFoundException($fileName);
     }
 }