Example #1
0
 public function insert()
 {
     $msg = array();
     $path = isset($_POST['path']) ? _encrypt($_POST['path'], 'DECODE') : '';
     $size = isset($_POST['size']) ? _encrypt($_POST['size'], 'DECODE') : 0;
     $type = isset($_POST['type']) ? _encrypt($_POST['type'], 'DECODE') : 'image';
     $type = explode(',', $this->getUPtype($type, true));
     $watermark = $_POST['iswatermark'] == "true" ? "yes" : "no";
     if (!is_dir(G_UPLOAD . $path)) {
         $msg['ok'] = 'no';
         $msg['text'] = $path . "文件夹不存在";
         echo json_encode($msg);
         exit;
     }
     System::load_app_class("admin", G_ADMIN_DIR, "no");
     $admincheck = admin::StaticCheckAdminInfo() ? 1 : 0;
     if (is_array($_FILES['Filedata'])) {
         System::load_sys_class('upload', 'sys', 'no');
         upload::upload_config($type, $size, $path);
         upload::go_upload($_FILES['Filedata'], $watermark);
         if (!upload::$ok) {
             $msg['ok'] = 'no';
             $msg['text'] = upload::$error;
         } else {
             $msg['ok'] = 'yes';
             $msg['text'] = $path . '/' . upload::$filedir . "/" . upload::$filename;
         }
         echo json_encode($msg);
     }
 }
Example #2
0
 public function upimage()
 {
     //System::load_app_class('Uploader','','no');
     //上传图片框中的描述表单名称,
     //$title = htmlspecialchars($_POST['pictitle'], ENT_QUOTES);
     //$path = htmlspecialchars($_POST['dir'], ENT_QUOTES);
     if (!isset($_POST['pictitle']) && !isset($_FILES['upfile'])) {
         exit;
     }
     $title = $_POST['pictitle'];
     $path = G_UPLOAD . 'shopimg/';
     System::load_sys_class('upload', 'sys', 'no');
     upload::upload_config(array('png', 'jpg', 'jpeg', 'gif'), 500000, 'shopimg');
     upload::go_upload($_FILES['upfile']);
     if (!upload::$ok) {
         $url = '';
         $title = $title;
         $originalName = '';
         $state = upload::$error;
     } else {
         $url = G_UPLOAD_PATH . '/shopimg/' . upload::$filedir . "/" . upload::$filename;
         $title = $title;
         $originalName = '';
         $state = 'SUCCESS';
     }
     echo "{'url':'" . $url . "','title':'" . $title . "','original':'" . $originalName . "','state':'" . $state . "'}";
     //{'url':'upload/20130728/13749880933714.jpg','title':'梨花.jpg','original':'梨花.jpg','state':'SUCCESS'}
 }
Example #3
0
 public function insert()
 {
     $msg = array();
     $path = isset($_POST['path']) ? _encrypt($_POST['path'], 'DECODE') : '';
     $size = isset($_POST['size']) ? _encrypt($_POST['size'], 'DECODE') : 0;
     $type = isset($_POST['type']) ? _encrypt($_POST['type'], 'DECODE') : 'image';
     $type = explode(',', $this->getUPtype($type, true));
     if (!is_dir(G_UPLOAD . $path)) {
         $msg['ok'] = 'no';
         $msg['text'] = $path . "文件夹不存在";
         echo json_encode($msg);
         exit;
     }
     if (is_array($_FILES['Filedata'])) {
         System::load_sys_class('upload', 'sys', 'no');
         upload::upload_config($type, $size, $path);
         upload::go_upload($_FILES['Filedata']);
         if (!upload::$ok) {
             $msg['ok'] = 'no';
             $msg['text'] = upload::$error;
         } else {
             $msg['ok'] = 'yes';
             $msg['text'] = $path . '/' . upload::$filedir . "/" . upload::$filename;
         }
         echo json_encode($msg);
     }
 }
Example #4
0
 public function quanzi_update()
 {
     $id = intval($this->segment(4));
     $quanzi = $this->db->GetOne("select * from `@#_quanzi` where `id`='{$id}'");
     if (!$quanzi) {
         _message("参数错误");
     }
     if (isset($_POST["submit"])) {
         if ($_POST['title'] == null) {
             _message("圈子名不能为空");
         }
         $title = htmlspecialchars($_POST['title']);
         $guanli = intval($_POST['guanli']);
         $jiaru = $_POST['jiaru'];
         $jianjie = htmlspecialchars($_POST['jianjie']);
         $gongao = htmlspecialchars($_POST['gongao']);
         $time = time();
         if (isset($_FILES['img'])) {
             System::load_sys_class('upload', 'sys', 'no');
             upload::upload_config(array('png', 'jpg', 'jpeg', 'gif'), 500000, 'quanzi');
             upload::go_upload($_FILES['img']);
             if (!upload::$ok) {
                 _message(upload::$error, null, 3);
             } else {
                 $img = upload::$filedir . "/" . upload::$filename;
                 $size = getimagesize(G_UPLOAD_PATH . "/quanzi/" . $img);
                 $max = 120;
                 $w = $size[0];
                 $h = $size[1];
                 if ($w > 120 or $h > 120) {
                     if ($w > $h) {
                         $w2 = $max;
                         $h2 = $h * ($max / $w);
                         upload::thumbs($w2, $h2, 1);
                     } else {
                         $h2 = $max;
                         $w2 = $w * ($max / $h);
                         upload::thumbs($w2, $h2, 1);
                     }
                 }
             }
         } else {
             $img = $_POST['imgold'];
         }
         $this->db->Query("UPDATE `@#_quanzi` SET title='{$title}',img='{$img}',guanli='{$guanli}',jianjie='{$jianjie}',gongao='{$gongao}',jiaru='{$jiaru}',time='{$time}' where`id`='{$id}'");
         _message("修改成功", WEB_PATH . "/admin/quanzi");
     }
     include $this->tpl(ROUTE_M, 'quanzi.update');
 }
Example #5
0
 public function shop_img_insert()
 {
     if (is_array($_FILES['Filedata'])) {
         System::load_sys_class('upload', 'sys', 'no');
         upload::upload_config(array('png', 'jpg', 'jpeg', 'gif'), 500000, 'shopimg');
         upload::go_upload($_FILES['Filedata']);
         $msg = array();
         if (!upload::$ok) {
             $msg['ok'] = 'no';
             $msg['text'] = upload::$error;
         } else {
             $msg['ok'] = 'yes';
             $msg['text'] = upload::$filedir . "/" . upload::$filename;
         }
         echo json_encode($msg);
     }
 }
Example #6
0
 public function modifiylink()
 {
     $linkid = intval($this->segment(4));
     $linkinfo = $this->db->GetOne("SELECT * FROM `@#_link` where `id`='{$linkid}'");
     if (!$linkinfo) {
         _message("参数不正确");
     }
     if (isset($_POST['submit'])) {
         $name = htmlspecialchars($_POST['name']);
         $url = htmlspecialchars($_POST['url']);
         if ($linkinfo['type'] == 1) {
             $this->db->Query("UPDATE `@#_link` SET `name`='{$name}',`url`='{$url}' WHERE `id`={$linkid}");
             if ($this->db->affected_rows()) {
                 _message("修改成功", WEB_PATH . '/' . ROUTE_M . '/' . ROUTE_C . "/lists");
             } else {
                 _message("修改失败");
             }
         }
         if ($linkinfo['type'] == 2) {
             $logo = $linkinfo['logo'];
             if (isset($_FILES['image'])) {
                 System::load_sys_class('upload', 'sys', 'no');
                 upload::upload_config(array('png', 'jpg', 'jpeg', 'gif'), 500000, 'linkimg');
                 upload::go_upload($_FILES['image']);
                 if (!upload::$ok) {
                     _message(upload::$error, WEB_PATH . '/' . ROUTE_M . '/' . ROUTE_C . "/lists");
                 }
                 $logo = upload::$filedir . "/" . upload::$filename;
             }
             $this->db->Query("UPDATE `@#_link` SET `name`='{$name}',`url`='{$url}',`logo`='{$logo}' WHERE `id`='{$linkid}'");
             if ($this->db->affected_rows()) {
                 _message("修改成功", WEB_PATH . '/' . ROUTE_M . '/' . ROUTE_C . "/lists");
             } else {
                 _message("修改失败");
             }
         }
     }
     include $this->tpl(ROUTE_M, 'link.editlink');
 }
Example #7
0
 public function singphotoup()
 {
     if (!empty($_FILES)) {
         /*
         	更新时间:2014-04-28
         	xu
         */
         /*
         			$uid=isset($_POST['uid']) ? $_POST['uid'] : NULL;		
         			$ushell=isset($_POST['ushell']) ? $_POST['ushell'] : NULL;
         			$login=$this->checkuser($uid,$ushell);
         			if(!$login){echo "上传失败";exit;}
         */
         System::load_sys_class('upload', 'sys', 'no');
         upload::upload_config(array('png', 'jpg', 'jpeg', 'gif'), 1000000, 'shaidan');
         upload::go_upload($_FILES['Filedata']);
         if (!upload::$ok) {
             echo _message(upload::$error, null, 3);
         } else {
             $img = upload::$filedir . "/" . upload::$filename;
             $size = getimagesize(G_UPLOAD_PATH . "/shaidan/" . $img);
             $max = 700;
             $w = $size[0];
             $h = $size[1];
             if ($w > 700) {
                 $w2 = $max;
                 $h2 = $h * ($max / $w);
                 upload::thumbs($w2, $h2, 1);
             }
             echo trim("shaidan/" . $img);
         }
     }
 }