示例#1
0
 if ($_POST['operation'] == "delete" and $stritem != "") {
     for ($i = 0; $i < count($itemlist); $i++) {
         $mark_id = $itemlist[$i];
         $dataInfo = getRecordValue($DBPrefix . "logs", " id='{$mark_id}'");
         $cateId = $dataInfo['cateId'];
         $name = "";
         if ($dataInfo['tags'] != "") {
             $tags = explode(";", $dataInfo['tags']);
             for ($j = 0; $j < count($tags); $j++) {
                 $name .= " or name='" . $tags[$j] . "'";
             }
             $name = $name == "" ? "" : substr($name, 4);
         }
         update_cateCount($cateId, "minus", 1);
         if ($name != "") {
             update_num($DBPrefix . "tags", "logNums", " {$name}", "minus", 1);
         }
         //删除关联的附件
         $sql = "select * from " . $DBPrefix . "attachments where logId='{$mark_id}'";
         $result = $DMC->query($sql);
         while ($my = $DMC->fetchArray($result)) {
             @unlink("../attachments/" . $my['name']);
         }
         $sql = "delete from " . $DBPrefix . "attachments where logId='{$mark_id}'";
         $DMC->query($sql);
         //删除静态文件
         if (file_exists(F2BLOG_ROOT . "./cache/html/{$mark_id}.php")) {
             @unlink(F2BLOG_ROOT . "./cache/html/{$mark_id}.php");
         }
         if (file_exists(F2BLOG_ROOT . "./cache/html/{$mark_id}_index.php")) {
             @unlink(F2BLOG_ROOT . "./cache/html/{$mark_id}_index.php");
示例#2
0
    $sql = "delete from " . $DBPrefix . "comments where id='{$mark_id}'";
    $DMC->query($sql);
    header("Location:../index.php?load=read&id={$logId}");
}
//其它操作行为:编辑、删除等
if ($action == "operation") {
    $stritem = "";
    $itemlist = $_POST['itemlist'];
    $otype = $_POST['operation'] == "show" ? "adding" : "minus";
    $nums = 0;
    for ($i = 0; $i < count($itemlist); $i++) {
        $my = getRecordValue($DBPrefix . "comments", " id='{$itemlist[$i]}'");
        $logId = $my['logId'];
        $isSecret = $my['isSecret'];
        if ($_POST['operation'] == "delete" or $_POST['operation'] == "show" and $isSecret == 1 or $_POST['operation'] == "hidden" and $isSecret == 0) {
            update_num($DBPrefix . "logs", "commNums", " id='{$logId}'", $otype, 1);
            $nums = $nums + 1;
            if ($stritem != "") {
                $stritem .= " or id='{$itemlist[$i]}'";
            } else {
                $stritem .= "id='{$itemlist[$i]}'";
            }
            //删除的是主留言,其子留言也删除
            if ($_POST['operation'] == "delete") {
                $stritem .= " or parent='{$itemlist[$i]}'";
            }
        }
    }
    if ($_POST['operation'] == "delete" and $stritem != "") {
        $sql = "delete from " . $DBPrefix . "comments where {$stritem}";
        $DMC->query($sql);
 public function attr_download_get()
 {
     $this->check_token();
     $id = I('get.id');
     $score = intval(I('get.score'));
     $fileArr = get_info('attachments', array('id' => $id));
     if (empty($fileArr)) {
         $this->error(1404);
     }
     $filename = WEB_PATH . $fileArr['path'];
     if (!is_file($filename)) {
         $this->error(1404);
     }
     $uid = $this->uid;
     $score_log = M('score_log');
     $msg = "下载免费资料无需消耗金币或积分";
     $count = $score_log->where(array('table_id' => $id, 'uid' => $uid))->count();
     if ($count > 0) {
         $score = 0;
         $msg = "重复在下载专区下载无需消耗金币";
     }
     $member = M('member');
     if ($score > 0) {
         if ($member->getFieldById($uid, 'coin') < $score) {
             $this->error(1031);
         }
         $result = $member->where(array('id' => $uid))->setDec('coin', $score);
         $msg = "下载专区资料消耗金币";
     }
     $score_log->add(array('uid' => $uid, 'table_name' => 'attachments', 'table_id' => $id, 'uname' => $member->getFieldById($uid, 'nickname'), 'action' => MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME, 'type' => '_coin', 'score' => $score, 'msg' => $msg, 'create_time' => time()));
     update_num($fileArr['table'], array('id' => $fileArr['table_id']), 'download_num', 1, true);
     $http = new \Org\Util\Http();
     $ext = substr($filename, strrpos($filename, '.') + 1);
     $res = $http->download($filename, $fileArr['name']);
 }
示例#4
0
$PATH = "./";
include "{$PATH}/function.php";
// 验证用户是否处于登陆状态
check_login();
//保存参数
$action = $_GET['action'];
$order = $_GET['order'];
$page = $_GET['page'];
$seekname = $_REQUEST['seekname'];
$mark_id = $_GET['id'];
if ($action == "deltb") {
    $my = getRecordValue($DBPrefix . "guestbook", " id='{$mark_id}'");
    $logId = $my['logId'];
    //add_bloginfo("tbNums","minus",1);
    update_num($DBPrefix . "logs", "quoteNums", " id='{$logId}'", "minus", 1);
    $sql = "delete from " . $DBPrefix . "guestbook where id='{$mark_id}'";
    $DMC->query($sql);
    header("Location:../index.php?load=read&id={$logId}");
}
//其它操作行为:编辑、删除等
if ($action == "operation") {
    $stritem = "";
    $itemlist = $_POST['itemlist'];
    $otype = $_POST['operation'] == "show" ? "adding" : "minus";
    $nums = 0;
    for ($i = 0; $i < count($itemlist); $i++) {
        if ($stritem != "") {
            $stritem .= " or id='{$itemlist[$i]}'";
        } else {
            $stritem .= "id='{$itemlist[$i]}'";
 public function praise_put()
 {
     $this->check_token();
     $table = 'praise';
     $table_name = 'member_post';
     $catid = I('get.id', 0, 'intval');
     $uid = $this->uid;
     // 检测此赞是否存在
     $map = array('table_name' => $table_name, 'member_id' => $uid, 'catid' => $catid);
     $res = get_info($table, $map);
     if ($res) {
         // 取消赞
         $result = delete_data($table, array('id' => $res['id']));
         if ($result) {
             // 更新赞的数量
             update_num($table_name, array('id' => $catid), 'praise_num', 1, false);
             $msg = array('praise_status' => 2, 'msg' => '取消成功');
         } else {
             $this->error(1500);
         }
     } else {
         // 添加赞
         $_POST = array('table_name' => $table_name, 'member_id' => $uid, 'catid' => $catid);
         $result = update_data($table);
         if ($result) {
             // 更新赞的数量
             update_num($table_name, array('id' => $catid), 'praise_num', 1, true);
             $msg = array('praise_status' => 1, 'msg' => '添加成功');
         } else {
             $this->error(1500);
         }
     }
     $this->success($msg);
 }