예제 #1
0
function deletecomments($id)
{
    global $config, $db;
    $id = intval($id);
    $row = $db->super_query("SELECT id, post_id, user_id, is_register, approve FROM " . PREFIX . "_comments WHERE id = '{$id}'");
    $db->query("DELETE FROM " . PREFIX . "_comments WHERE id = '{$id}'");
    $db->query("DELETE FROM " . PREFIX . "_comment_rating_log WHERE c_id = '{$id}'");
    if ($row['is_register']) {
        $db->query("UPDATE " . USERPREFIX . "_users SET comm_num=comm_num-1 WHERE user_id ='{$row['user_id']}'");
    }
    if ($row['approve']) {
        $db->query("UPDATE " . PREFIX . "_post SET comm_num=comm_num-1 WHERE id='{$row['post_id']}'");
    }
    if ($config['tree_comments']) {
        $sql_result = $db->query("SELECT id FROM " . PREFIX . "_comments WHERE parent = '{$id}'");
        while ($row = $db->get_row($sql_result)) {
            deletecomments($row['id']);
        }
    }
}
예제 #2
0
         $next = 0;
         $nextdeleteitem = 'feed';
     }
 }
 if ($deleteitem == 'feed') {
     C::t('home_follow_feed')->delete_by_uid($uids);
     $nextdeleteitem = 'comment';
 }
 if ($deleteitem == 'comment') {
     $comments = array();
     $query = C::t('home_comment')->fetch_all_by_uid($uids, 0, $pertask);
     foreach ($query as $comment) {
         $comments[] = $comment['cid'];
     }
     if ($comments) {
         deletecomments($comments);
     } else {
         $next = 0;
         $nextdeleteitem = 'allitem';
     }
 }
 if ($deleteitem == 'allitem') {
     require_once libfile('function/delete');
     $numdeleted = deletemember($uids);
     if ($isfounder && !empty($_GET['includeuc'])) {
         loaducenter();
         uc_user_delete($uids);
     }
     if (!empty($_GET['uidarray'])) {
         cpmsg('members_delete_succeed', '', 'succeed', array('numdeleted' => $numdeleted));
     } else {
예제 #3
0
        foreach ($moderate as $cid => $act) {
            $moderation[$act][] = $cid;
            $moderatedata[$act][$_G['gp_idtypes'][$cid]][] = $cid;
        }
    }
    foreach ($moderatedata as $act => $typeids) {
        foreach ($typeids as $idtype => $ids) {
            $op = $act == 'ignore' ? 1 : 2;
            updatemoderate($idtype . '_cid', $ids, $op);
        }
    }
    if ($validate_cids = dimplode($moderation['validate'])) {
        DB::update('home_comment', array('status' => '0'), "cid IN ({$validate_cids})");
        $validates = DB::affected_rows();
    }
    if (!empty($moderation['delete'])) {
        require_once libfile('function/delete');
        $comments = deletecomments($moderation['delete']);
        $deletes = count($comments);
    }
    if ($ignore_cids = dimplode($moderation['ignore'])) {
        DB::update('home_comment', array('status' => '2'), "cid IN ({$ignore_cids})");
        $ignores = DB::affected_rows();
    }
    if ($_G['gp_fast']) {
        echo callback_js($_G['gp_cid']);
        exit;
    } else {
        cpmsg('moderate_comments_succeed', "action=moderate&operation=comments&page={$page}&filter={$filter}&dateline={$_G['gp_dateline']}&username={$_G['gp_username']}&keyword={$_G['gp_keyword']}&idtype={$_G['gp_idtype']}&tpp={$_G['gp_tpp']}&showcensor={$showcensor}", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'deletes' => $deletes));
    }
}
예제 #4
0
            showmessage('content_is_too_short');
        }
        $message = censor($message);
        if (censormod($message)) {
            $comment_status = 1;
        } else {
            $comment_status = 0;
        }
        DB::update('home_comment', array('message' => $message, 'status' => $comment_status), array('cid' => $comment['cid']));
        showmessage('do_success', dreferer(), array('cid' => $comment['cid']), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
    }
    $comment['message'] = $bbcode->html2bbcode($comment['message']);
} elseif ($_GET['op'] == 'delete') {
    if (submitcheck('deletesubmit')) {
        require_once libfile('function/delete');
        if (deletecomments(array($cid))) {
            showmessage('do_success', dreferer(), array('cid' => $cid), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
        } else {
            showmessage('no_privilege');
        }
    }
} elseif ($_GET['op'] == 'reply') {
    $query = DB::query("SELECT * FROM " . DB::table('home_comment') . " WHERE cid='{$cid}'");
    if (!($comment = DB::fetch($query))) {
        showmessage('comments_do_not_exist');
    }
    if ($comment['idtype'] == 'uid' && ($seccodecheck || $secqaacheck)) {
        $seccodecheck = 0;
        $secqaacheck = 0;
    }
    $config = urlencode(getsiteurl() . 'home.php?mod=misc&ac=swfupload&op=config&doodle=1');
	[UCenter Home] (C) 2007-2008 Comsenz Inc.
	$Id: admincp_comment.php 12986 2009-08-04 04:24:33Z xupeng $
*/

if(!defined('IN_UCHOME') || !defined('IN_ADMINCP')) {
	exit('Access Denied');
}

//权限
if(!$allowmanage = checkperm('managecomment')) {
	$_GET['uid'] = $_SGLOBAL['supe_uid'];//只能操作本人的
}

if(submitcheck('deletesubmit')) {
	include_once(S_ROOT.'./source/function_delete.php');
	if(!empty($_POST['ids']) && deletecomments($_POST['ids'])) {
		cpmessage('do_success', $_POST['mpurl']);
	} else {
		cpmessage('the_correct_choice_to_delete_comments', $_POST['mpurl']);
	}
}

$mpurl = 'admincp.php?ac=comment';

//处理搜索
$intkeys = array('cid', 'id', 'authorid', 'uid');
$strkeys = array('author', 'ip', 'idtype');
$randkeys = array(array('sstrtotime','dateline'));
$likekeys = array('title', 'message');
$results = getwheres($intkeys, $strkeys, $randkeys, $likekeys);
$wherearr = $results['wherearr'];
예제 #6
0
        showsetting('comment_search_author', 'author', $author, 'text');
        showsetting('comment_search_authorid', 'authorid', $authorid, 'text');
        showsetting('comment_search_uid', 'uid', $uid, 'text');
        showsetting('comment_search_message', 'message', $message, 'text');
        showsetting('comment_search_ip', 'ip', $ip, 'text');
        showsetting('comment_search_time', array('starttime', 'endtime'), array($starttime, $endtime), 'daterange');
        echo '<input type="hidden" name="fromumanage" value="' . $fromumanage . '">';
        showsubmit('searchsubmit');
        showtablefooter();
        showformfooter();
        showtagfooter('div');
    } else {
        $cids = authcode($cids, 'DECODE');
        $cidsadd = $cids ? explode(',', $cids) : $_GET['delete'];
        include_once libfile('function/delete');
        $deletecount = count(deletecomments($cidsadd));
        $cpmsg = cplang('comment_succeed', array('deletecount' => $deletecount));
        ?>
	<script type="text/JavaScript">alert('<?php 
        echo $cpmsg;
        ?>
');parent.$('commentforum').searchsubmit.click();</script>
	<?php 
    }
    if (submitcheck('searchsubmit', 1)) {
        $comments = $commentcount = '0';
        $sql = $error = '';
        $authorids = array();
        $author = trim($author);
        if ($id != '') {
            $id = explode(',', $id);
예제 #7
0
function deleteinfo($ids)
{
    global $_SGLOBAL;
    include_once S_ROOT . './source/function_delete.php';
    $deltype = array();
    $reportuser = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('report') . " WHERE rid IN (" . simplode($ids) . ")");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $value['user'] = unserialize($value['uids']);
        $reportuser[] = array_shift(array_flip($value['user']));
        $deltype[$value['idtype']][] = $value['id'];
    }
    $gid = getgroupid($_SGLOBAL['member']['experience'], $_SGLOBAL['member']['groupid']);
    //Perform the corresponding delete operations
    $i = 0;
    $_SGLOBAL['usergroup'][$gid]['managebatch'] = 1;
    foreach ($deltype as $key => $value) {
        switch ($key) {
            case 'blogid':
                $_SGLOBAL['usergroup'][$gid]['manageblog'] = 1;
                deleteblogs($value);
                break;
            case 'picid':
                $_SGLOBAL['usergroup'][$gid]['managealbum'] = 1;
                deletepics($value);
                break;
            case 'albumid':
                $_SGLOBAL['usergroup'][$gid]['managealbum'] = 1;
                deletealbums($value);
                break;
            case 'tid':
                $_SGLOBAL['usergroup'][$gid]['managethread'] = 1;
                deletethreads(0, $value);
                break;
            case 'tagid':
                $_SGLOBAL['usergroup'][$gid]['managemtag'] = 1;
                deletemtag($value);
                break;
            case 'sid':
                $_SGLOBAL['usergroup'][$gid]['manageshare'] = 1;
                deleteshares($value);
                break;
            case 'uid':
                $_SGLOBAL['usergroup'][$gid]['managedelspace'] = 1;
                foreach ($value as $uid) {
                    deletespace($uid);
                }
                break;
            case 'eventid':
                $_SGLOBAL['usergroup'][$gid]['manageevent'] = 1;
                deleteevents($value);
                break;
            case 'pid':
                $_SGLOBAL['usergroup'][$gid]['managepoll'] = 1;
                deletepolls($value);
                break;
            case 'comment':
                $_SGLOBAL['usergroup'][$gid]['managecomment'] = 1;
                deletecomments($value);
                break;
            case 'post':
                $_SGLOBAL['usergroup'][$gid]['managethread'] = 1;
                deleteposts(0, $value);
                break;
        }
        //The first reporter award
        getreward('report', 1, $reportuser[$i], '', 0);
        $i++;
    }
}
예제 #8
0
파일: comments.php 프로젝트: rapando/noDB
<?php

switch ($_GET['req']) {
    case '1':
        addcomment();
        break;
    case '2':
        fetchcomments();
        break;
    case '3':
        deletecomments();
        break;
}
function addcomment()
{
    $name = ucwords(trim(strip_tags($_GET['name'])));
    $comment = trim(strip_tags($_GET['comment']));
    $data = json_decode(file_get_contents('../files/comments.json', true));
    $i = count($data);
    $data[$i]['name'] = $name;
    $data[$i]['comment'] = $comment;
    $data[$i]['moment'] = time();
    file_put_contents('../files/comments.json', json_encode($data));
    print json_encode("Comment posted!");
}
function fetchcomments()
{
    $data = file_get_contents('../files/comments.json');
    print $data;
}
function deletecomments()