public function delete_by_id($id) { $data = self::fetch($id); if ($return = parent::delete($id)) { self::update_groupid_by_uid($data['uid']); } return $return; }
public function delete_by_voteid($voteids) { $ret = 0; $voteids = (array) $voteids; if ($ret = parent::delete($voteids)) { C::t('vote_item')->delete_by_voteid($voteids); } return $ret; }
public function delete_by_tid($tids) { $tids = (array) $tids; C::t('feed_post')->delete_by_tid($tids); //删除收藏 C::t('feed_collection')->delete_by_tid($tids); //删除投票 C::t('vote')->delete_by_id_idtype($tids, 'feed'); parent::delete($tids); }
public function delete($sids) { if ($ret = parent::delete($sids)) { $sids = (array) $sids; foreach ($sids as $sid) { $target = './qrcode/' . $sid[0] . '/' . $sid . '.png'; @unlink(getglobal('setting/attachdir') . $target); } } return $ret; }
public function delete_by_picid($picid) { if (!($data = parent::fetch($picid))) { return 0; } $ret = 0; if ($ret = parent::delete($picid)) { if ($data['aid']) { C::t('attachment')->delete_by_aid($data['aid']); } } return $ret; }
public function delete_by_id($id) { //删除此应用的快捷方式 $return = array(); /*foreach(DB::fetch_all("select icoid from ".DB::table('icos')." where type='storage' and oid='{$id}'") as $value){ $return['icoids'][]=$value['icoid']; C::t('icos')->delete_by_icoid($value['icoid'],true); }*/ if (parent::delete($id)) { $return['msg'] = 'success'; } return $return; }
public function update_by_voteid($voteid, $item, $itemnew) { if (!($vote = C::t('vote')->fetch($voteid))) { return false; } //删除已有的项目 $sql = 'voteid=%d'; $param = array($this->_table, $voteid); if ($item && ($ids = array_keys($item))) { $sql .= " and itemid NOT IN(%n)"; $param[] = $ids; } $dels = array(); foreach (DB::fetch_all("select itemid,aid from %t where {$sql}", $param) as $value) { if ($value['aid']) { C::t('attachment')->delete_by_aid($value['aid']); } $dels[] = $value['itemid']; } if (parent::delete($dels)) { C::t('vote_item_count')->delete_by_itemid($dels); } //更新已有项目 $addcopyaids = array(); foreach ($item as $key => $value) { if (empty($value['content']) && !$value['aid']) { self::delete_by_itemid($key); } $value['content'] = getstr($value['content']); parent::update($key, $value); } //添加新项目 $disp = DB::result_first("select max(disp) from %t where voteid=%d", array($this->_table, $voteid)); foreach ($itemnew as $key => $value) { if (empty($value['content']) && !$value['aid']) { continue; } $disp++; $setarr = array('voteid' => $voteid, 'content' => getstr($value['content']), 'type' => $value['aid'] ? 2 : 1, 'aid' => intval($value['aid']), 'disp' => $disp, 'number' => 0); if (parent::insert($setarr, 1) && $setarr['aid']) { C::t('attachment')->addcopy_by_aid($setarr['aid']); } } return true; }
public function delete($val, $unbuffered = false, $fetch_archive = 0) { $ret = false; if ($val) { if ($fetch_archive < 2) { $ret = parent::delete($val, $unbuffered); if ($fetch_archive) { $_ret = C::t($this->_table . '_archive')->delete($val, $unbuffered); if (!$unbuffered) { $ret = $ret + $_ret; } } } else { $ret = C::t($this->_table . '_archive')->delete($val, $unbuffered); } } return $ret; }
public function delete_by_newid($newid) { //删除信息; //删除信息 $data = parent::fetch($newid); if ($ret = parent::delete($newid)) { //删除编辑器附件 if ($data['attachs']) { $attachs = explode(',', $data['attachs']); C::t('attachment')->addcopy_by_aid($attachs, -1); } //删除图片内容 C::t('news_pic')->delete_by_newid($newid); //删除信息查阅者 C::t('news_viewer')->delete_by_newid($newid); //删除投票 C::t('vote')->delete_by_id_idtype($newid, 'news'); //删除评论 C::t('comment')->delete_by_id_idtype($newid, 'news'); } return $ret; }
public function delete_by_orgid($orgid) { if (!($org = parent::fetch($orgid))) { return array('error' => '删除错误!要删除的对象已经不存在'); } if (self::fetch_all_by_forgid($org['orgid'], true) || $org['fid'] && C::t('folder')->fetch_all_by_pfid($org['fid'], true) || $org['fid'] && C::t('icos')->fetch_all_by_pfid($org['fid'], '', 0, '', '', 0, true)) { return array('error' => '删除错误!请检查以下内容:<br><ul><li>此部门没有下级部门</li><li>此部门共享目录下没有文件或子目录</li></ul>'); } if ($org['fid']) { C::t('folder')->delete_by_fid($org['fid'], true); } C::t('organization_user')->delete_by_orgid($orgid); if (parent::delete($orgid)) { /*include_once libfile('function/cache'); updatecache('organization');*/ if ($this->_wxbind) { self::deleteDepartment($org['worgid']); } return $org; } else { return array('error' => '删除错误'); } }
public function delete_by_cid($cids) { $cids = (array) $cids; $ret = 0; foreach (DB::fetch_all("select qid,aid,type,img from %t where cid IN (%n) ", array('comment_attach', $cids)) as $value) { if (parent::delete($value['qid'])) { $ret += 1; if ($value['aid'] > 0) { C::t('attachment')->delete_by_aid($value['aid']); } if ($value['type'] == 'link') { $imgarr = $value['img'] ? explode('icon', $value['img']) : array(); if (isset($imgarr[1]) && ($did = DB::result_first("select did from %t where pic=%s", array('icon', 'icon' . $imgarr[1])))) { C::t('icon')->update_copys_by_did($did, -1); } } } } return $ret; }
public function delete_by_did($did, $force = false) { if (!($data = self::fetch($did))) { return false; } if ($force || $data['isdelete']) { //删除版本 C::t('document_reversion')->delete_by_did($did); //删除评论 C::t('comment')->delete_by_id_idtype($did, 'document'); return parent::delete($did); } else { return parent::update($did, array('isdelete' => TIMESTAMP)); } }
public function delete_by_fieldid($fieldid) { $this->clear_cache('fields_0'); $this->clear_cache('fields_1'); return parent::delete($fieldid); }
public function delete_by_catid($catid) { //同时删除所有下级分类,分类下的信息失去分类,如果是唯一的顶级分类,不允许删除 //判断是否为唯一的顶级分类; if ($data = parent::fetch($catid) && $data['pid'] == 0) { if (DB::result_first("select COUNT(*) from %t where pid='0'", array($this->_table)) < 2) { return 0; } } $catids = self::getSonByCatid($catid); $ret = 0; if ($catids) { $ret = parent::delete($catids); DB::update('news', array('catid' => 0), "catid IN (" . dimplode($catids) . ")"); } return $ret; }
public function delete_by_did($dids) { if (!is_array($dids)) { $dids = array($dids); } $attachs = array(); foreach (DB::fetch_all("select revid,aid,attachs from %t where did IN (%n) ", array($this->_table, $dids)) as $value) { if ($value['attachs']) { $attachs = array_merge($attachs, explode(',', $value['attachs'])); } $attachs[] = $value['aid']; $revids[] = $value['revid']; } foreach ($attachs as $aid) { C::t('attachment')->delete_by_aid($aid); } return parent::delete($revids); }
public function delete($val, $unbuffered = false, $fetch_archive = 0) { $ret = false; if ($val = dintval($val, true)) { foreach ((array) $val as $key => $uid) { if ($uid == 1) { unset($val[$key]); } //暂时限制uid=1的用户不允许删除 } $ret = parent::delete($val, $unbuffered, $fetch_archive); if ($this->_allowmem) { $data = ($data = memory('get', 'deleteuids')) === false ? array() : $data; foreach ((array) $val as $uid) { $data[$uid] = $uid; } memory('set', 'deleteuids', $data, 86400 * 2); } } return $ret; }
public function remove_uid_by_cid($cid, $uid) { //管理员必须留一人 $data = DB::fetch_first("select * from %t where cid=%d and uid=%d", array($this->_table, $cid, $uid)); if ($data['perm'] > 2 && DB::result_first("select COUNT(*) from %t where cid=%d and perm>2", array($this->_table, $cid)) < 2) { return array('error' => '至少需要一名管理员'); } $permtitle = array('1' => '关注成员', '2' => '协作成员', '3' => '管理员'); if ($uid != getglobal('uid')) { //发送通知 $appid = C::t('app_market')->fetch_appid_by_mod('{dzzscript}?mod=corpus', 1); $corpus = C::t('corpus')->fetch($cid); $notevars = array('from_id' => $appid, 'from_idtype' => 'app', 'url' => DZZSCRIPT . '?mod=corpus&op=list&cid=' . $corpus['cid'] . '&do=user', 'author' => getglobal('username'), 'authorid' => getglobal('uid'), 'dataline' => dgmdate(TIMESTAMP), 'corpusname' => getstr($corpus['name'], 30), 'permtitle' => $permtitle[$data['perm']]); $action = 'corpus_user_remove'; $type = 'corpus_user_remove_' . $cid; dzz_notification::notification_add($uid, $type, $action, $notevars, 0, 'dzz/corpus'); } return parent::delete($data['id']); }
public function delete_permanent_by_pfid($pfid) { if (!($class = parent::fetch($pfid))) { return false; } foreach (self::fetch_all_by_pfid($pfid, $class['cid']) as $value) { self::delete_permanent_by_pfid($value['fid'], $class['cid']); } if ($class['did']) { C::t('document')->delete_by_did($class['did'], true); } //删除评论 C::t('comment')->delete_by_id_idtype($class['fid'], 'corpus'); return parent::delete($pfid); }
public function delete_by_id_idtype($ids, $idtype) { $ids = (array) $ids; $dels = array(); foreach (DB::fetch_all("select * from %t where id IN (%n) and idtype=%s", array($this->_table, $ids, $idtype)) as $value) { $dels[] = $value['cid']; } if ($return = parent::delete($dels)) { //删除@ C::t('comment_at')->delete_by_cid($dels); //删除附件 C::t('comment_attach')->delete_by_cid($dels); } return parent::delete($dels); }
public function delete_by_tpid($tpids) { $tpids = (array) $tpids; foreach (DB::fetch_all("select attachs from %t where tpid IN (%n)", array($this->_table, $tpids)) as $value) { if ($value['attachs']) { C::t('attachment')->addcopy_by_aid(explode(',', $value['attachs']), -1); } } return parent::delete($tpids); }
public function delete_permanent_by_cid($cid) { $data = parent::fetch($cid); //删除文集用户 DB::query("delete from %t where cid=%d", array('corpus_user', $cid)); //删除文集相关事件 DB::query("delete from %t where bz=%s", array('corpus_event', 'corpus_' . $cid)); //删除文集内容 foreach (DB::fetch_all("select fid from %t where cid=%d ", array('corpus_class', $cid)) as $value) { C::t('corpus_class')->delete_by_fid($value['fid'], true); } //删除文集封面 $aids = C::t('corpus_setting')->getCoverAids(); if (!in_array($data['aid'], $aids)) { //用户自定义的封面删除 C::t('attachment')->delete_by_aid($data['aid']); } if ($return = parent::delete($cid)) { if ($data['archivetime'] > 0) { self::setArchiveMonthTree($data['archivetime']); } } return $return; }
public function delete($cachenames) { parent::delete($cachenames); if ($this->_allowmem || $this->_isfilecache) { foreach ((array) $cachenames as $cachename) { $this->_allowmem && memory('rm', $cachename); $this->_isfilecache && @unlink(DZZ_ROOT . './data/cache/cache_' . $cachename . '.php'); } } }