Beispiel #1
0
 function delete()
 {
     $name = MODULE_NAME;
     $model = M($name);
     $pk = $model->getPk();
     $id = $_REQUEST[$pk];
     if (isset($id)) {
         if (false !== $model->delete($id)) {
             delattach(array('moduleid' => '231', 'id' => $id));
             $this->success(L('delete_ok'));
         } else {
             $this->error(L('delete_error') . ': ' . $model->getDbError());
         }
     } else {
         $this->error(L('do_empty'));
     }
 }
 public function delete()
 {
     $catid = intval($_GET['id']);
     $module = $this->categorys[$catid]['module'];
     if ($this->categorys[$catid]['type'] == 1) {
         if ($this->categorys[$catid]['arrchildid'] != $catid) {
             $this->error(L('category_does_not_allow_delete'));
         }
         $this->dao->delete($catid);
         delattach("catid in({$catid})");
     } else {
         $module = M($module);
         $arrchildid = $this->categorys[$catid]['arrchildid'];
         $where = "catid in(" . $arrchildid . ")";
         $count = $module->where($where)->count();
         if ($count) {
             $this->error(L('category_does_not_allow_delete'));
         }
         $this->dao->delete($arrchildid);
         //$moduleid = $this->module[$module];
         //delattach("moduleid =$moduleid and catid in($arrchildid)");
         $arr = explode(',', $arrchildid);
         foreach ((array) $arr as $r) {
             if ($this->categorys[$r]['module'] == 'Page') {
                 $module = M('Page');
                 $module->delete($r);
             }
         }
     }
     $this->repair();
     savecache('Category');
     $this->success(L('do_success'));
 }
Beispiel #3
0
     rights($con, $bid, $token);
 } else {
     if ($ask == "attach") {
         attach($con, $token, $path, $filename, $price, $auth);
     } else {
         if ($ask == "attachdl") {
             attachdl($con, $token, $id);
         } else {
             if ($ask == "attachinfo") {
                 attachinfo($con, $id, $token);
             } else {
                 if ($ask == "unusedattachinfo") {
                     unusedattachinfo($con, $token);
                 } else {
                     if ($ask == "delattach") {
                         delattach($con, $token, $id);
                     } else {
                         if ($ask == "editpreview") {
                             editpreview($con, $token, $bid, $tid, $pid);
                         } else {
                             if ($ask == "sendmsg") {
                                 sendmsg($con, $token, $to, $text);
                             } else {
                                 if ($ask == "msg") {
                                     msg($con, $token, $type);
                                 } else {
                                     if ($ask == "changepsd") {
                                         changepsd($con, $token);
                                     } else {
                                         if ($ask == "currentUserInfo") {
                                             currentUserInfo($con, $token);
 /**
  * 批量删除
  *
  */
 function deleteall()
 {
     $name = MODULE_NAME;
     $model = M($name);
     $M = C('M');
     $ids = $_POST['ids'];
     if (!empty($ids) && is_array($ids)) {
         $id = implode(',', $ids);
         if ($M[$name]) {
             $olddata = $model->field('keywords')->where("id in({$id})")->select();
             foreach ((array) $olddata as $r) {
                 $where['name'] = array('in', $r['keywords']);
                 $where['moduleid'] = array('eq', $this->moduleid);
                 if (APP_LANG) {
                     $where['lang'] = array('eq', LANG_ID);
                 }
                 M('Tags')->where($where)->setDec('num');
             }
             M('Tags_data')->where("id in({$id})")->delete();
             M('Tags')->where('num<=0')->delete();
             M('Content')->delete($id);
         }
         if (false !== $model->delete($id)) {
             if (in_array($name, $this->cache_model)) {
                 savecache($name);
             }
             if ($this->moduleid) {
                 delattach("moduleid={$this->moduleid} and id in({$id})");
             }
             if ($name == 'Order') {
                 M('Order_data')->where('order_id in(' . $id . ')')->delete();
             }
             $this->success(L('delete_ok'));
         } else {
             $this->error(L('delete_error') . ': ' . $model->getDbError());
         }
     } else {
         $this->error(L('do_empty'));
     }
 }
Beispiel #5
0
 function deleteall()
 {
     $ids = $_POST['ids'];
     if (!empty($ids) && is_array($ids)) {
         $user = $this->dao;
         $id = implode(',', $ids);
         if (false !== $user->delete($id)) {
             $roleuser = M('RoleUser');
             $roleuser->where('user_id in(' . $id . ')')->delete();
             delattach("moduleid=0 and catid=0 and id=0 and userid in({$id})");
             $this->success(L('delete_ok'));
         } else {
             $this->error(L('delete_error'));
         }
     } else {
         $this->error(L('do_empty'));
     }
 }
 function cleanfile()
 {
     $r = delattach(array('status' => 0, 'userid' => $this->userid));
     if ($r) {
         $this->success(L('delete_ok'));
     } else {
         $this->error(L('delete_error'));
     }
 }
 public function delete()
 {
     $catid = intval($_GET['id']);
     $module = $this->categorys[$catid]['module'];
     $moduleid = $this->categorys[$catid]['moduleid'];
     if (!$this->categorys[$catid]) {
         $this->error(L('do_empty'));
     }
     if ($this->categorys[$catid]['child']) {
         $this->error(L('category_does_not_allow_delete'));
     }
     if ($this->categorys[$catid]['type'] == 1) {
         $this->dao->delete($catid);
         delattach("catid={$catid}");
     } elseif ($module == 'Page') {
         $this->dao->delete($catid);
         M('Page')->delete($catid);
         delattach("moduleid ={$moduleid} and catid in({$catid})");
     } elseif ($module == 'Feedback' || $module == 'Guestbook') {
         $this->dao->delete($catid);
         M($module)->where('1')->delete();
     } else {
         $where = "catid ={$catid} ";
         //$arrchildid = $this->categorys[$catid]['arrchildid'];
         $count = M($module)->where($where)->count();
         if ($count) {
             $this->error(L('category_does_not_allow_delete'));
         }
         $this->dao->delete($catid);
         //$moduleid = $this->mod[$module];
         delattach(" moduleid ={$moduleid} and catid={$catid} ");
     }
     $this->repair();
     savecache('Category');
     $this->success(L('do_success'));
 }
 function delete()
 {
     $id = intval($_GET['id']);
     $r = $this->dao->find($id);
     if (empty($r)) {
         $this->error(L('do_empty'));
     }
     $tablename = C('DB_PREFIX') . $this->module[$id]['name'];
     $m = $this->dao->delete($id);
     if ($m) {
         $this->dao->execute("DROP TABLE IF EXISTS `" . $tablename . "`");
         $module = ucfirst($this->module[$id]['name']);
         M('Menu')->where("model='" . $module . "'")->delete();
         M('Field')->where('moduleid=' . $id)->delete();
         M('Content')->where('mid=' . $id)->delete();
         $pnid = M('Node')->where("name='" . $module . "'")->find();
         M('Node')->where("name='" . $module . "'")->delete();
         M('Node')->where("pid='" . $pnid . "'")->delete();
         delattach("moduleid ={$id}");
         savecache('Module');
         savecache('Menu');
         @unlink(CACHE_PATH . 'Data/' . $id . '_Field.php');
         $this->success(L('do_ok'));
     }
 }