Beispiel #1
0
 protected function savePic($photo)
 {
     $db = new WorldsPicsModel();
     foreach ($photo as $p) {
         $data['name'] = $p['savename'];
         $data['w_id'] = $_SESSION['w_id'];
         //dump($data);
         if (!$db->add($data)) {
             continue;
         }
     }
     //显示已经上传的图片
     $db = new WorldsPicsModel();
     unset($map);
     $map['w_id'] = $_SESSION['w_id'];
     $rs = $db->where($map)->select();
     $this->assign('rs', $rs);
     $this->display("WapAdmin:addPic");
 }
Beispiel #2
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);
 }
Beispiel #3
0
 protected function showSavePic($map)
 {
     $map['w_id'] = $map == '' ? $_SESSION['w_id'] : $map['w_id'];
     $db = new WorldsPicsModel();
     $rs = $db->where($map)->select();
     $this->assign('rs', $rs);
     $this->display('Index:addWorldsPic');
     //dump($rs);
 }