예제 #1
0
 /**
  * doDeleteEvent
  * 删除活动
  * @access public
  * @return void
  */
 public function doDeleteEvent()
 {
     $eventid['id'] = intval($_REQUEST['id']);
     //要删除的id.
     $eventid['uid'] = $this->mid;
     if (!CheckAuthorPermission(D('Event'), $eventid['id'])) {
         echo 0;
         exit;
     }
     $result = $this->event->doDeleteEvent($eventid);
     if (false != $result) {
         echo 1;
     } else {
         echo 0;
         //删除失败
     }
 }
예제 #2
0
 public function editDate()
 {
     $id = intval($_POST['id']);
     //越权判断
     if (empty($id) || 0 == $id || !CheckAuthorPermission(D('Vote'), $id)) {
         echo -1;
         return;
     }
     $map['id'] = $id;
     //查找这个投票的信息
     $voteDao = D('Vote');
     $vote_opt = $voteDao->where("id = {$id}")->field()->find();
     //没有找到对应的选项。这一个投票项不存在
     if (false == $vote_opt) {
         echo -2;
         return;
     } else {
         $deadline = mktime($_POST["hour"], 0, 0, $_POST["month"], $_POST["day"], $_POST["year"]);
         if ($deadline < time()) {
             echo -3;
             return;
         }
         $save['deadline'] = $deadline;
         //将新的选项添加
         if ($result = $voteDao->where($map)->save($save)) {
             echo 1;
             return;
         } else {
             echo 0;
             return;
         }
     }
 }
예제 #3
0
 public function doEditPoster()
 {
     $dao = D('Poster');
     $condition['id'] = intval($_POST['id']);
     //权限判断
     if (!CheckAuthorPermission($dao, $condition['id'])) {
         $this->error('对不起,您没有操作权限!');
     }
     $map['title'] = t($_POST['title']);
     $map['type'] = intval($_POST['type']);
     $map['content'] = h($_POST['explain']);
     $map['contact'] = t($_POST['contact']);
     // $address = explode(',',$_POST['areaid']);
     // $map['address_province'] = $address[0];
     // $map['address_city'] = $address[1];
     // $map['address_area'] = $address[2];
     $map['area'] = h($_POST['area']);
     if ($_POST['deadline']) {
         $map['deadline'] = $deadline = $this->_paramDate($_POST['deadline']);
         $sendPosterTime = $dao->where('id=' . intval($_POST['id']))->getField('cTime');
         $deadline < $sendPosterTime && $this->error("结束时间不得小于发布时间");
     } else {
         $map['deadline'] = NULL;
     }
     // 检查详细介绍
     if (get_str_length($map['content']) <= 0) {
         $this->error('详细介绍不能为空');
     }
     $map = $this->_extraField($map, $_POST);
     //得到上传的图片
     $option = array();
     if ($_FILES['cover']['size'] > 0) {
         $options['userId'] = $this->mid;
         $options['max_size'] = 2 * 1024 * 1024;
         //2MB
         $options['allow_exts'] = 'jpg,gif,png,jpeg,bmp';
         $options['attach_type'] = 'poster_cover';
         $data['upload_type'] = 'image';
         $cover = model('Attach')->upload($data, $options);
         if ($cover['status']) {
             $map['cover'] = $cover['info'][0]['save_path'] . $cover['info'][0]['save_name'];
             $map['attach_id'] = $cover['info'][0]['attach_id'];
         } else {
             $this->error($cover['info']);
         }
     }
     //$map['private'] = isset($_POST['friend'])?$_POST['friend']:0;
     $rs = $dao->where($condition)->save($map);
     if (false !== $rs) {
         //type=post&app_name=public&topicHtml=我分享了一个帖子“嵌入式系统”&source_url=http%3A%2F%2F192.168.24.214%2Fcamsns%2Findex.php%3Fapp%3Dposter%26mod%3DIndex%26act%3DposterDetail%26id%3D1
         // $_POST["content"]="";
         // $_POST["body"]="我在#".D('PosterSmallType')->getPosterSmallType($map['type'])."#中发布了". $map['title']."。";
         // $_POST['source_url']=U('//posterDetail',array('id'=>$condition['id']));
         // $_POST['type']="post";
         // $_POST['app_name']="poster";
         // $_POST['attach_id']=88;
         //exit(translatorGoogleAPI("好"));
         // echo post(U('public/Feed/My_PostFeed'),$_POST);
         // exit;
         // exit(post(U('public/Feed/My_PostFeed'),$_POST));
         // //             A('public/Feed/po');
         //exit($this->My_PostFeed());
         //$_SESSION['new_poster'] = $cover['info'] ? $cover['info'][0]['attach_id'] : 1;
         $this->assign('jumpUrl', U('//posterDetail', array('id' => $condition['id'], 'autoShare' => false, 'user_to_share' => true, 'auto_to_sendMessage' => true)));
         $this->success("编辑成功");
         exit;
     } else {
         $this->error('编辑失败');
     }
 }