Example #1
0
 /**
  * 常规上传
  */
 public function upload()
 {
     $grouplist = getcache('grouplist', 'member');
     if ($this->isadmin == 0 && !$grouplist[$this->groupid]['allowattachment']) {
         return false;
     }
     if ($this->isadmin == 1) {
         define('IN_ADMIN', true);
     }
     pc_base::load_sys_class('attachment', '', 0);
     $module = trim($_GET['module']);
     $catid = intval($_GET['catid']);
     $siteid = $this->get_siteid();
     $site_setting = get_site_setting($siteid);
     $site_allowext = $site_setting['upload_allowext'];
     $attachment = new attachment($module, $catid, $siteid);
     $attachment->set_userid($this->userid);
     $a = $attachment->upload('upload', $site_allowext);
     if ($a) {
         $filepath = $attachment->uploadedfiles[0]['filepath'];
         $fn = intval($_GET['CKEditorFuncNum']);
         $this->upload_json($a[0], $filepath, $attachment->uploadedfiles[0]['filename']);
         $attachment->mkhtml($fn, $this->upload_url . $filepath, '');
     }
 }