protected function themeUploadAction()
 {
     if ($file = waRequest::file('theme_files')) {
         /**
          * @var waRequestFile
          */
         if ($file->uploaded()) {
             try {
                 $theme = waTheme::extract($file->tmp_name);
                 $this->logAction('theme_upload', $theme->id);
                 $this->displayJson(array('theme' => $theme->id));
             } catch (Exception $e) {
                 waFiles::delete($file->tmp_name);
                 $this->displayJson(array(), $e->getMessage());
             }
         } else {
             $message = $file->error;
             if (!$message) {
                 $message = 'Error while file upload';
             }
             $this->displayJson(array(), $message);
         }
     } else {
         $this->displayJson(array(), 'Error while file upload');
     }
 }
Пример #2
0
 protected function themeUploadAction()
 {
     if ($file = waRequest::file('theme_files')) {
         /**
          * @var waRequestFile
          */
         if ($file->uploaded()) {
             try {
                 $theme = waTheme::extract($file->tmp_name);
                 $this->log('theme_upload');
                 $this->displayJson(array('theme' => $theme['id']));
             } catch (Exception $e) {
                 waFiles::delete($file->tmp_name);
                 $this->displayJson(array(), $e->getMessage());
             }
         } else {
             $this->displayJson(array(), $file->error);
         }
     }
 }