示例#1
0
 function Delete($ids)
 {
     if (MEMBER_ID < 1) {
         return '游客不能执行此操作';
     }
     if (is_numeric($ids)) {
         $where = " where `id` = '{$ids}' ";
     } else {
         if (is_string($ids)) {
             $where = $ids;
         } else {
             if (is_array($ids)) {
                 $where = " where `id` in ('" . implode("','", $ids) . "') ";
             } else {
                 return '所指定的微博有误。';
             }
         }
     }
     if (!$ids) {
         return '微博已经不存在了';
     }
     $query = DB::query("select * from " . TABLE_PREFIX . "topic_verify {$where} ");
     $topics = array();
     while ($rs = DB::fetch($query)) {
         if (jdisallow($rs['uid'])) {
             return '您没有权限执行此操作';
         }
         $topics[] = $rs;
     }
     if (count($topics) < 1) {
         return '微博已经不存在了';
     }
     $tbs = array('report' => 'tid', 'sms_receive_log' => 'tid', 'topic_favorite' => 'tid', 'topic_longtext' => 'tid', 'topic_mention' => 'tid', 'topic_more' => 'tid', 'topic_qun' => 'tid', 'topic_reply' => array('tid', 'replyid'), 'topic_tag' => 'item_id', 'topic_url' => 'tid', 'topic_vote' => 'tid', 'wall_draft' => 'tid', 'wall_playlist' => 'tid', 'topic_recommend' => 'tid', 'topic_live' => 'tid', 'topic_talk' => 'tid', 'topic_channel' => 'tid', 'topic_dig' => 'tid', 'topic_topic_image' => 'tid');
     $topictids = array();
     foreach ($topics as $topic) {
         $topictids[] = $topic['tid'];
         if (false !== strpos($topic['content'], '#')) {
             preg_match_all('~<T>#(.+?)#</T>~', $topic['content'], $subpatterns);
             if ($subpatterns && is_array($subpatterns[1])) {
                 Load::logic('tag');
                 $TagLogic = new TagLogic('topic');
                 $TagLogic->Delete(array('item_id' => $topic['tid'], 'tag' => $subpatterns['1']));
             }
         }
         if ($topic['imageid']) {
         }
         if ($topic['attachid']) {
             jlogic('attach')->delete($topic['attachid']);
         }
         if ($topic['videoid']) {
             $sql = "select `id`,`video_img` from `" . TABLE_PREFIX . "topic_video` where `id`='" . $topic['videoid'] . "' ";
             $topic_video = DB::fetch_first($sql);
             jio()->DeleteFile($topic_video['video_img']);
             DB::query("delete from `" . TABLE_PREFIX . "topic_video` where `id` = '{$topic['videoid']}'");
         }
         #音乐
         if ($topic['musicid']) {
             DB::query("delete from `" . TABLE_PREFIX . "topic_music` where `id` = '{$topic['musicid']}'");
         }
         $tid = $topic['tid'];
         if ($tid > 0) {
             if (!empty($topic['item']) && $topic['item_id'] > 0) {
                 jfunc('app');
                 app_delete_relation($topic['item'], $topic['item_id'], $topic['tid']);
             }
             foreach ($tbs as $k => $vs) {
                 $vs = (array) $vs;
                 foreach ($vs as $v) {
                     DB::query("delete from `" . TABLE_PREFIX . "{$k}` where `{$v}`='{$tid}'", "SKIP_ERROR");
                 }
             }
         }
         #删除审核表里的数据
         DB::query(" delete from `" . TABLE_PREFIX . "topic_verify` where `id` = {$topic['id']}");
         if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $GLOBALS['_J']['config']['company_enable']) {
             $cpstring = DB::fetch_first("SELECT companyid,departmentid FROM " . DB::table('members') . " WHERE uid = '" . $topic['uid'] . "'");
             if ($cpstring['companyid'] > 0 || $cpstring['departmentid'] > 0) {
                 $CpLogic = jlogic('cp');
                 if ($cpstring['companyid'] > 0) {
                     $CpLogic->update('company', $cpstring['companyid'], 0, -1);
                 }
                 if ($cpstring['departmentid'] > 0) {
                     $CpLogic->update('department', $cpstring['departmentid'], 0, -1);
                 }
             }
         }
     }
     if ($GLOBALS['_J']['plugins']['func']['deletetopic']) {
         hookscript('deletetopic', 'funcs', is_array($topictids) ? $topictids : array($topictids), 'deletetopic');
     }
     return '';
 }
示例#2
0
 function getCommonInterestUser()
 {
     $code = 'common_interest';
     $uid = MEMBER_ID;
     if ($uid < 1) {
         echo '登录可见';
     }
     Load::logic('tag');
     $TagLogic = new TagLogic('topic');
     $user_list = $TagLogic->getCommonInterestUser($uid, 10);
     if ($user_list) {
         include template("topic_right_user_ajax");
     } else {
         echo "<script type='text/javascript'>";
         echo "\$('#common_interest_div').remove()";
         echo "</script>";
     }
 }