Beispiel #1
0
 function do_editpic()
 {
     iACP::MP('FILE.EDIT', 'page');
     $pic = iS::escapeStr($_GET['pic']);
     //$pic OR iPHP::alert("请选择图片!");
     if ($pic) {
         $src = iFS::fp($pic, '+http') . "?" . time();
         $srcPath = iFS::fp($pic, '+iPATH');
         $fsInfo = iFS::info($pic);
         $file_name = $fsInfo->filename;
         $file_path = $fsInfo->dirname;
         $file_ext = $fsInfo->extension;
         $file_id = 0;
         $rs = iFS::getFileData('filename', $file_name);
         if ($rs) {
             $file_path = $rs->path;
             $file_id = $rs->id;
             $file_ext = $rs->ext;
         }
     } else {
         $file_name = md5(uniqid());
         $src = false;
         $file_ext = 'jpg';
     }
     if ($_GET['indexid']) {
         $rs = iDB::all("SELECT * FROM `#iCMS@__filedata` where `indexid`='{$_GET['indexid']}' order by `id` ASC LIMIT 100");
         foreach ((array) $rs as $key => $value) {
             $filepath = $value['path'] . $value['filename'] . '.' . $value['ext'];
             $src[] = iFS::fp($filepath, '+http') . "?" . time();
         }
     }
     if ($_GET['pics']) {
         $src = explode(',', $_GET['pics']);
         if (count($src) == 1) {
             $src = $_GET['pics'];
         }
     }
     $max_size = (int) $this->upload_max_filesize;
     stristr($this->upload_max_filesize, 'm') && ($max_size = $max_size * 1024 * 1024);
     include iACP::view("files.editpic");
 }