private function save($file)
 {
     $filename = $file['savepath'] . $file['savename'];
     if (!$this->uploadReplace && is_file($filename)) {
         $this->error = LParse(L('_FILE_REPLACE_ERROR_'), array($filename));
         return false;
     }
     if (!move_uploaded_file($file['tmp_name'], auto_charset($filename, 'utf-8', 'gbk'))) {
         $this->error = L('_FILE_MOVE_ERROR_');
         return false;
     }
     if ($this->thumb) {
         import("ORG.Util.Image");
         $image = Image::getImageInfo($filename);
         if (false !== $image) {
             $thumbWidth = explode(',', $this->thumbMaxWidth);
             $thumbHeight = explode(',', $this->thumbMaxHeight);
             $thumbPrefix = explode(',', $this->thumbPrefix);
             $thumbSuffix = explode(',', $this->thumbSuffix);
             $thumbPath = $this->thumbPath ? $this->thumbPath : $file['savepath'];
             for ($i = 0, $len = count($thumbWidth); $i < $len; $i++) {
                 $thumbname = $thumbPath . $thumbPrefix[$i] . substr($file['savename'], 0, strrpos($file['savename'], '.')) . $thumbSuffix[$i] . '.' . $file['extension'];
                 Image::thumb($filename, '', $thumbname, $thumbWidth[$i], $thumbHeight[$i], true);
             }
         }
     }
     if ($this->zipImages) {
         // TODO Image compression package on-line decompression
     }
     return true;
 }
예제 #2
0
 public function appError($errno, $errstr, $errfile, $errline)
 {
     switch ($errno) {
         case E_ERROR:
         case E_USER_ERROR:
             $errorStr = LParse(L('_APP_EXCEPTION_ERROR_STRING_'), array($errno, $errstr, basename($errfile), $errline));
             if (C('WEB_LOG_RECORD')) {
                 Log::write($errorStr, Log::ERR);
             }
             halt($errorStr);
             break;
         case E_STRICT:
         case E_USER_WARNING:
         case E_USER_NOTICE:
         default:
             $errorStr = LParse(L('_APP_EXCEPTION_ERROR_STRING_'), array($errno, $errstr, basename($errfile), $errline));
             Log::record($errorStr, Log::NOTICE);
             break;
     }
 }