Example #1
0
 public function del()
 {
     //删除微博
     $map['id'] = $_POST['w_id'];
     $db = new WorldsModel();
     $db->where($map)->delete();
     //删除回复
     unset($map);
     $map['w_id'] = $_POST['w_id'];
     $db = new WorldsResponsesModel();
     $db->where($map)->delete();
     //删除图片
     $db = new WorldsPicsModel();
     $rs = $db->where($map)->select();
     foreach ($rs as $rs) {
         $file1 = './Public/Upload/' . $rs['name'];
         $file2 = './Public/Upload/wap120_' . $rs['name'];
         $file3 = './Public/Upload/wap160_' . $rs['name'];
         unlink($file1);
         unlink($file2);
         unlink($file3);
     }
     $db->where($map)->delete();
     $this->ajaxReturn(1, '', 1);
 }
Example #2
0
 public function ty()
 {
     $db = new WorldsResponsesModel();
     $map['w_id'] = array('eq', 260);
     $map['name'] = array('neq', '');
     $result = $db->where($map)->select();
     $name = join(' @', $result['name']);
     dump($result);
     echo $db->getLastSql();
 }
Example #3
0
 public function delWorlds()
 {
     $db = new WorldsModel();
     if ($_POST['action'] == 'del') {
         $map['id'] = $_POST['w_id'];
         if (!$db->autoCheckToken($_POST)) {
             $this->gError("非法操作!", "index");
         } else {
             //删除微博
             $step1 = $db->where($map)->delete();
             //echo $db->getLastSql();
             //删除回复
             unset($map);
             $map['w_id'] = $_POST['w_id'];
             $db = new WorldsResponsesModel();
             $step2 = $db->where($map)->find() ? $db->where($map)->delete() : true;
             //删除图片
             $db = new WorldsPicsModel();
             $rs = $db->where($map)->select();
             foreach ($rs as $rs) {
                 $file1 = './Public/Upload/' . $rs['name'];
                 $file2 = './Public/Upload/wap120_' . $rs['name'];
                 $file3 = './Public/Upload/wap160_' . $rs['name'];
                 unlink($file1);
                 unlink($file2);
                 unlink($file3);
             }
             $db->where($map)->delete();
         }
         if ($step1 and $step2) {
             $this->gSuccess("删除成功!", "__APP__/WapAdmin/index");
         } else {
             $this->gError("呃,服务器开小差了~~~稍后再试,", "__APP__/WapAdmin/index");
         }
     }
     $w_id = $_GET['id'];
     $rs = $db->where("id={$w_id}")->relation(false)->find();
     $this->assign('rs', $rs);
     $this->assign('w_id', $_GET['id']);
     $this->display("WapAdmin:delWorlds");
     //dump($rs);
 }
Example #4
0
 public function addResponse()
 {
     import("ORG.Util.Input");
     $db = new WorldsResponsesModel();
     $data['text'] = Input::deleteHtmlTags($_POST['text']);
     $data['w_id'] = $_POST['w_id'];
     $data['ip'] = $_SESSION['user_ip'];
     $data['name'] = $_SESSION['sina']['name'];
     $data['url'] = 'http://t.sina.com/' . $_SESSION['sina']['id'];
     if ($id = $db->add($data)) {
         //echo $db->getLastSql();exit;
         $str1 = $data['text'] . "[IP:" . $_SESSION['user_ip'] . "]";
         $str2 = $data['text'] . " -<a href='" . $data['url'] . "'>" . $data['name'] . "</a>";
         echo $_SESSION['sina']['id'] != '' ? $str2 : $str1;
     } else {
         echo "<span style='color:red;'>Error</span>";
         echo '(⊙o⊙)…杯具,服务器出现错误!';
     }
     unset($data);
     $db = new WorldsModel();
     $data['last_time'] = date("Y-m-d H:i:s");
     $map['id'] = $_POST['w_id'];
     $db->where($map)->save($data);
 }
Example #5
0
 public function addResponse()
 {
     import('ORG.Util.Input');
     $db = new WorldsResponsesModel();
     $data['text'] = Input::deleteHtmlTags($_POST['text']);
     $data['w_id'] = $_POST['w_id'];
     $data['ip'] = $_SESSION['user_ip'];
     if ($db->add($data)) {
         unset($data);
         $db = new WorldsModel();
         $data['last_time'] = date("Y-m-d H:i:s");
         $map['id'] = $_POST['w_id'];
         $db->where($map)->save($data);
         $this->gSuccess("你的评论“" . $_POST['text'] . "“发表成功!", "viewWorlds?id=" . $_POST['w_id']);
     } else {
         $this->gError("呃," . $db->getError(), "viewWorlds?id=" . $_POST['w_id']);
     }
 }