Esempio n. 1
0
 private function processUpload()
 {
     if (empty($this->_requestFiles)) {
         return false;
     }
     foreach (array_keys($this->_requestFiles) as $v) {
         if (isset($this->_requestData[$v . '_x']) && isset($this->_requestData[$v . '_y']) && isset($this->_requestData[$v . '_w']) && isset($this->_requestData[$v . '_h'])) {
             $tailor = [$this->_requestData[$v . '_x'], $this->_requestData[$v . '_y'], $this->_requestData[$v . '_w'], $this->_requestData[$v . '_h']];
             $file = XiiUploader::run($v, $tailor);
             if (isset($file['tailor']) && $this->_model->hasAttribute($v)) {
                 $this->_requestData[$v] = is_array($file['tailor']) ? implode(XIIS_DEFAULT_SEPARATOR, $file['tailor']) : $file['tailor'];
             }
         } else {
             $file = XiiUploader::run($v);
             if (isset($file['file']) && $this->_model->hasAttribute($v)) {
                 $this->_requestData[$v] = is_array($file['file']) ? implode(XIIS_DEFAULT_SEPARATOR, $file['file']) : $file['file'];
             }
             if (isset($file['thumb']) && $this->_model->hasAttribute($v . '_thumb')) {
                 $this->_requestData[$v . '_thumb'] = is_array($file['thumb']) ? implode(XIIS_DEFAULT_SEPARATOR, $file['thumb']) : $file['thumb'];
             }
         }
     }
 }
Esempio n. 2
0
 public function actionError()
 {
     $errorCode = isset($this->_requestData[XIIS_FEEDBACK_CODE]) && is_numeric($this->_requestData[XIIS_FEEDBACK_CODE]) ? (int) $this->_requestData[XIIS_FEEDBACK_CODE] : 0;
     if ($errorCode >= 1000 && $errorCode < 1899) {
         $errorMsg = XiiArPlus::getErrorMessage($errorCode);
     } elseif ($errorCode >= 1900 && $errorCode < 1999) {
         $errorMsg = XiiUploader::getErrorMessage($errorCode);
     } else {
         $errorMsg = XiiError::getErrorMessage($errorCode);
     }
     self::$_outData = [XIIS_FEEDBACK_STATUS => false, XIIS_FEEDBACK_CODE => $errorCode, XIIS_FEEDBACK_MSG => $errorMsg, XIIS_FEEDBACK_DATA => []];
     if ($errorCode > 0) {
         self::$_outData[XIIS_FEEDBACK_STATUS] = true;
     }
 }