コード例 #1
0
ファイル: magic_repent.php プロジェクト: tang86/discuz-utf8
 function usesubmit()
 {
     global $_G;
     if (empty($_GET['pid'])) {
         showmessage(lang('magic/repent', 'repent_info_nonexistence'));
     }
     $_G['tid'] = $_GET['ptid'];
     $post = getpostinfo($_GET['pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.replycredit', 't.status as thread_status'));
     $this->_check($post);
     require_once libfile('function/post');
     require_once libfile('function/delete');
     if ($post['first']) {
         if ($have_replycredit = C::t('forum_replycredit')->fetch($post['tid'])) {
             $thread = C::t('forum_thread')->fetch($post['tid']);
             if ($thread['replycredit']) {
                 updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => $replycredit));
             }
             C::t('forum_replycredit')->delete($post['tid']);
             C::t('common_credit_log')->delete_by_operation_relatedid(array('RCT', 'RCA', 'RCB'), $post['tid']);
         }
         deletethread(array($post['tid']));
         updateforumcount($post['fid']);
     } else {
         if ($post['replycredit'] > 0) {
             updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => -$post['replycredit']));
             C::t('common_credit_log')->delete_by_uid_operation_relatedid($post['authorid'], 'RCA', $post['tid']);
         }
         deletepost(array($_GET['pid']));
         updatethreadcount($post['tid']);
     }
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['tid']);
     showmessage(lang('magic/repent', 'repent_succeed'), $post['first'] ? 'forum.php?mod=forumdisplay&fid=' . $post['fid'] : dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true));
 }
コード例 #2
0
ファイル: magic_repent.php プロジェクト: pan289091315/Discuz
 function usesubmit()
 {
     global $_G;
     if (empty($_G['gp_pid'])) {
         showmessage(lang('magic/repent', 'repent_info_nonexistence'));
     }
     $_G['tid'] = $_G['gp_ptid'];
     $post = getpostinfo($_G['gp_pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.replycredit', 't.status as thread_status'));
     $this->_check($post);
     require_once libfile('function/post');
     require_once libfile('function/delete');
     if ($post['first']) {
         if ($have_replycredit = DB::fetch_first("SELECT * FROM " . DB::table('forum_replycredit') . " WHERE tid ='{$post['tid']}' LIMIT 1")) {
             if ($replycredit = DB::result_first("SELECT replycredit FROM " . DB::table('forum_thread') . " WHERE tid = '{$post['tid']}'")) {
                 updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => $replycredit));
             }
             DB::delete('forum_replycredit', "tid = '{$post['tid']}'");
             DB::delete('common_credit_log', "operation IN ('RCT', 'RCA', 'RCB') AND relatedid IN({$post['tid']})");
         }
         deletethread(array($post['tid']));
         updateforumcount($post['fid']);
     } else {
         if ($post['replycredit'] > 0) {
             updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => -$post['replycredit']));
             DB::delete('common_credit_log', "uid = '{$post['authorid']}' AND operation = 'RCA' AND relatedid IN({$post['tid']})");
         }
         deletepost(array($_G['gp_pid']));
         updatethreadcount($post['tid']);
     }
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['tid']);
     showmessage(lang('magic/repent', 'repent_succeed'), $post['first'] ? 'forum.php?mod=forumdisplay&fid=' . $post['fid'] : dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
 }
コード例 #3
0
 function usesubmit()
 {
     global $_G;
     $info = array('credits' => intval($_POST['credits']), 'percredit' => intval($_POST['percredit']), 'credittype' => $_G['gp_credittype'], 'left' => intval($_POST['credits']), 'magicid' => intval($this->magic['magicid']), 'receiver' => array());
     if ($info['credits'] < 1) {
         showmessage(lang('magic/gift', 'gift_bad_credits_input'));
     }
     if ($info['percredit'] < 1 || $info['percredit'] > $info['credits']) {
         showmessage(lang('magic/gift', 'gift_bad_percredit_input'));
     }
     $member = array();
     if (preg_match('/^extcredits[1-8]$/', $info['credittype'])) {
         $member = DB::fetch_first('SELECT * FROM ' . DB::table('common_member_count') . " WHERE uid = '{$_G['uid']}'");
         if ($member[$info['credittype']] < $info['credits']) {
             showmessage(lang('magic/gift', 'gift_credits_out_of_own'));
         }
         $extcredits = str_replace('extcredits', '', $info['credittype']);
         updatemembercount($_G['uid'], array($extcredits => -$info['credits']), 1, 'BGC', $this->magic['magicid']);
     } else {
         showmessage(lang('magic/gift', 'gift_bad_credittype_input'));
     }
     DB::update('common_member_field_home', array('magicgift' => addslashes(serialize($info))), array('uid' => $_G['uid']));
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']);
     showmessage(lang('magic/gift', 'gift_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
 }
コード例 #4
0
 function usesubmit()
 {
     global $_G;
     $getmoney = rand(1, intval($this->magic['price'] * 1.5));
     updatemembercount($_G['uid'], array($_G['setting']['creditstransextra'][3] => $getmoney), 1, 'MRC', $this->magic['magicid']);
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'uid', $_G['uid']);
     showmessage('magics_credit_message', '', array('credit' => $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][3]]['title'] . ' ' . $getmoney . ' ' . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][3]]['unit']), array('showdialog' => 1));
 }
コード例 #5
0
 function memcp_get_succeed($setting)
 {
     global $_G;
     if ($setting['MarketCredit']) {
         $creditArr = $setting['MarketCredit'];
         foreach ($creditArr as $id => &$value) {
             $value *= -1;
         }
         updatemembercount($_G['uid'], $creditArr);
     }
 }
コード例 #6
0
 public function expiration_finished($days)
 {
     $expiration = TIMESTAMP - intval($days) * 86400;
     $logs = DB::fetch_all("SELECT * FROM %t WHERE sellerid>0 AND status=5 AND lastupdate<%d", array($this->_table, $expiration));
     $members = array();
     foreach ($logs as $log) {
         $members[$log['sellerid']]['extcredits' . $log['basecredit']] += $log['credit'];
     }
     foreach ($members as $uid => $data) {
         updatemembercount($uid, $data);
     }
     DB::query("DELETE FROM %t WHERE sellerid>0 AND status=5 AND lastupdate<%d", array($this->_table, $expiration));
 }
コード例 #7
0
ファイル: callme.class.php プロジェクト: v998/dsu
 function dsu_amucallme_output($a)
 {
     global $_G;
     if ($_G['uid'] && in_array($_G['fid'], $this->fids)) {
         $turl = "forum.php?mod=redirect&goto=findpost&ptid={$a['values']['tid']}&pid={$a['values']['pid']}";
         $url = $_G["siteurl"] . $turl;
         $msg = $this->message;
         $reply = $_G["siteurl"] . "forum.php?mod=post&action=reply&tid={$a['values']['tid']}&repquote={$a['values']['pid']}";
         if (!$msg) {
             if (!function_exists('discuzcode')) {
                 include libfile('function/discuzcode');
             }
             $msg = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . cutstr(strip_tags(discuzcode($_G['gp_message'], 1, 0)), 40, '...');
         }
         $sendmsg = lang('plugin/dsu_amucallme', 'sendmsg', array('username' => $_G['username'], 'url' => $url, 'reply' => $reply, 'message' => $msg));
         $cmcost = array();
         if (file_exists('./data/plugindata/dsu_amucallme.data.php')) {
             require_once DISCUZ_ROOT . './data/plugindata/dsu_amucallme.data.php';
             $data_f2a = dstripslashes($data_f2a);
             $cmcost = $data_f2a[$_G['groupid']];
             $cmcost['cost'] = $cmcost['cost'] * '-1';
         }
         $max = 0;
         if ($cmcost['extcredits'] && $cmcost['cost']) {
             $max = intval($_G['member']["extcredits{$cmcost['extcredits']}"] / $cmcost['cost']);
         } else {
             $max = 100;
         }
         if ($a['values']['tid'] && $a['values']['pid'] && $max) {
             foreach ($this->usernames as $key => $val) {
                 if ($val && $_G['uid'] != $val && $max) {
                     updatemembercount($_G['uid'], array("extcredits{$cmcost['extcredits']}" => $cmcost['cost']), true, '', 0);
                     notification_add($val, $_G['uid'], $sendmsg, '', 0);
                     $max--;
                 }
             }
             foreach ($this->gusernames as $key => $val) {
                 if ($val && $_G['uid'] != $val && $max) {
                     updatemembercount($_G['uid'], array("extcredits{$cmcost['extcredits']}" => $cmcost['cost']), true, '', 0);
                     notification_add($val, $_G['uid'], $sendmsg, '', 0);
                     $max--;
                 }
             }
         }
     }
 }
コード例 #8
0
 function global_header()
 {
     global $_G;
     $sendConfig = array();
     $sendConfig = $_G['cache']['plugin']['send_jinbi'];
     //缓存插件变量值
     if (intval($sendConfig['status']) == 1) {
         //是否启动插件
         if (isset($_POST['regsubmit'])) {
             //会员注册后
             $uid = intval($_G['member']['uid']);
             if ($uid) {
                 $jinbi_num = intval($sendConfig['jinbi_num']);
                 //送金币数量
                 updatemembercount($uid, array("extcredits2" => $jinbi_num));
                 //更新金币数 (这个是function_core.php的现成函数)
                 //这里可以进行任何数据库的操作
             }
         }
     }
 }
コード例 #9
0
ファイル: credit.php プロジェクト: MCHacker/discuz-docker
 function common()
 {
     global $_G;
     if (!$_G['uid'] || !in_array('wechat', $_G['setting']['plugins']['available'])) {
         mobile_core::result(mobile_core::variable(array()));
     }
     $_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);
     if (!$_G['wechat']['setting']['wsq_apicredit']) {
         mobile_core::result(mobile_core::variable(array()));
     }
     $extcredit = 'extcredits' . $_G['wechat']['setting']['wsq_apicredit'];
     $ac = $_GET['ac'];
     $return = array();
     if (submitcheck('creditsubmit') && ($ac == 'inc' || $ac == 'dec') && $_GET['value'] > 0) {
         $v = $ac == 'inc' ? $_GET['value'] : -$_GET['value'];
         $log = lang('plugin/wechat', 'wsq_apicredit_log_' . $ac);
         updatemembercount(array($_G['uid']), array($extcredit => $v), true, '', 0, '', $log);
         $data = C::t('common_member_count')->fetch($_G['uid']);
         $return['extcredit'] = $data[$extcredit];
     } elseif ($ac == 'get') {
         $return['extcredit'] = getuserprofile($extcredit);
     }
     mobile_core::result(mobile_core::variable($return));
 }
コード例 #10
0
                        // 特殊奖励(N)非循环
                        if (is_array($teshu)) {
                            foreach ($teshu as $id => $result) {
                                updatemembercount($_G['uid'], array("extcredits{$result['extcredits']}" => $result['reward']), true, '', 0);
                            }
                        }
                        updatemembercount($_G['uid'], array("extcredits{$thisvars['ptjf']}" => $pt), true, '', 0);
                        break;
                    case 4:
                        // 特殊奖励(Y)循环
                        if (is_array($teshu)) {
                            foreach ($teshu as $id => $result) {
                                updatemembercount($_G['uid'], array("extcredits{$result['extcredits']}" => $result['reward']), true, '', 0);
                            }
                        }
                        updatemembercount($_G['uid'], array("extcredits{$thisvars['ptjf']}" => $pt), true, '', 0);
                        break;
                }
            }
        }
    }
}
//elseif($this_time == 0 && $this_H){
//    //今天连续打卡&整点打卡
//    $Hreward = rand($this_Hs['minreward'],$this_Hs['maxreward']);
//    $return_msg = '整点签到成功! 获得额外奖励'.$ptjfname.'+'.$Hreward;
//    C::t('#dsu_amupper#plugin_dsuamupper')->update($_G['uid'],array('lasttime'=> $_G['timestamp']));
//    updatemembercount($_G['uid'], array("extcredits{$thisvars['ptjf']}" => $Hreward), true,'',0);
//}
if ($return_msg) {
    if (defined('VIP_INITED')) {
コード例 #11
0
                 showmessage('activity_exile_field');
             }
             $ufielddata['userfield'][$key] = $value;
         }
     }
     if (!empty($activity['ufield']['extfield'])) {
         foreach ($activity['ufield']['extfield'] as $fieldid) {
             $value = cutstr(dhtmlspecialchars(trim($_GET['' . $fieldid])), 50, '.');
             $ufielddata['extfield'][$fieldid] = $value;
         }
     }
     $ufielddata = !empty($ufielddata) ? serialize($ufielddata) : '';
 }
 if ($_G['setting']['activitycredit'] && $activity['credit'] && empty($applyinfo['verified'])) {
     checklowerlimit(array('extcredits' . $_G['setting']['activitycredit'] => '-' . $activity['credit']));
     updatemembercount($_G['uid'], array($_G['setting']['activitycredit'] => '-' . $activity['credit']), true, 'ACC', $_G['tid']);
 }
 if ($applyinfo && $applyinfo['verified'] == 2) {
     $newinfo = array('tid' => $_G['tid'], 'username' => $_G['username'], 'uid' => $_G['uid'], 'message' => $message, 'verified' => $verified, 'dateline' => $_G['timestamp'], 'payment' => $payment, 'ufielddata' => $ufielddata);
     C::t('forum_activityapply')->update($applyinfo['appyid'], $newinfo);
 } else {
     $data = array('tid' => $_G['tid'], 'username' => $_G['username'], 'uid' => $_G['uid'], 'message' => $message, 'verified' => $verified, 'dateline' => $_G['timestamp'], 'payment' => $payment, 'ufielddata' => $ufielddata);
     C::t('forum_activityapply')->insert($data);
 }
 $applynumber = C::t('forum_activityapply')->fetch_count_for_thread($_G['tid']);
 C::t('forum_activity')->update($_G['tid'], array('applynumber' => $applynumber));
 if ($thread['authorid'] != $_G['uid']) {
     notification_add($thread['authorid'], 'activity', 'activity_notice', array('tid' => $_G['tid'], 'subject' => $thread['subject']));
     $space = array();
     space_merge($space, 'field_home');
     if (!empty($space['privacy']['feed']['newreply'])) {
コード例 #12
0
 public function before_deletepost($parameters)
 {
     $isfirstpost = $this->post['first'] ? 1 : 0;
     if ($this->thread['special'] == 3) {
         if ($this->thread['price'] < 0 && $this->thread['dateline'] + 1 == $this->post['dateline']) {
             showmessage('post_edit_reward_nopermission', NULL);
         }
     }
     if ($this->thread['special'] == 3 && $isfirstpost) {
         updatemembercount($this->post['authorid'], array($this->setting['creditstransextra'][2] => $this->thread['price']));
         C::t('common_credit_log')->delete_by_uid_operation_relatedid($this->thread['authorid'], 'RTC', $this->thread['tid']);
     }
 }
コード例 #13
0
$discuz = C::app();
$discuz->init();
$apitype = empty($_GET['attach']) || !preg_match('/^[a-z0-9]+$/i', $_GET['attach']) ? 'alipay' : $_GET['attach'];
require_once DISCUZ_ROOT . './api/trade/api_' . $apitype . '.php';
$PHP_SELF = $_SERVER['PHP_SELF'];
$_G['siteurl'] = dhtmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . preg_replace("/\\/+(api\\/trade)?\\/*\$/i", '', substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'))) . '/');
$notifydata = trade_notifycheck('credit');
if ($notifydata['validator']) {
    $orderid = $notifydata['order_no'];
    $postprice = $notifydata['price'];
    $order = C::t('forum_order')->fetch($orderid);
    $order = array_merge($order, C::t('common_member')->fetch_by_username($order['uid']));
    if ($order && floatval($postprice) == floatval($order['price']) && ($apitype == 'tenpay' || strtolower($_G['setting']['ec_account']) == strtolower($_REQUEST['seller_email']))) {
        if ($order['status'] == 1) {
            C::t('forum_order')->update($orderid, array('status' => '2', 'buyer' => "{$notifydata['trade_no']}\t{$apitype}", 'confirmdate' => $_G['timestamp']));
            updatemembercount($order['uid'], array($_G['setting']['creditstrans'] => $order['amount']), 1, 'AFD', $order['uid']);
            updatecreditbyaction($action, $uid = 0, $extrasql = array(), $needle = '', $coef = 1, $update = 1, $fid = 0);
            C::t('forum_order')->delete_by_submitdate($_G['timestamp'] - 60 * 86400);
            $submitdate = dgmdate($order['submitdate']);
            $confirmdate = dgmdate(TIMESTAMP);
            notification_add($order['uid'], 'credit', 'addfunds', array('orderid' => $order['orderid'], 'price' => $order['price'], 'value' => $_G['setting']['extcredits'][$_G['setting']['creditstrans']]['title'] . ' ' . $order['amount'] . ' ' . $_G['setting']['extcredits'][$_G['setting']['creditstrans']]['unit']), 1);
        }
    }
}
if ($notifydata['location']) {
    $url = rawurlencode('home.php?mod=spacecp&ac=credit');
    if ($apitype == 'tenpay') {
        echo <<<EOS
<meta name="TENCENT_ONLINE_PAYMENT" content="China TENCENT">
<html>
<body>
コード例 #14
0
ファイル: class_task.php プロジェクト: MCHacker/discuz-docker
 function reward_credit($extcreditid, $credits)
 {
     global $_G;
     $creditsarray[$extcreditid] = $credits;
     updatemembercount($_G['uid'], $creditsarray, 1, 'TRC', $this->task['taskid']);
 }
コード例 #15
0
ファイル: spacecp_magic.php プロジェクト: lemonstory/bbs
        C::t('common_member_field_home')->update($uid, array('magicgift' => $info['left'] > 0 ? serialize($info) : ''));
        $credittype = '';
        if (preg_match('/^extcredits[1-8]$/', $info['credittype'])) {
            $extcredits = str_replace('extcredits', '', $info['credittype']);
            updatemembercount($_G['uid'], array($extcredits => $percredit), 1, 'AGC', $info['magicid']);
            $credittype = $_G['setting']['extcredits'][$extcredits]['title'];
        }
        showmessage('haved_red_bag_gain', dreferer(), array('percredit' => $percredit, 'credittype' => $credittype), array('showdialog' => 1, 'locationtime' => true));
    }
    showmessage('space_no_red_bag', dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
} elseif ($op == 'retiregift') {
    $mid = 'gift';
    $memberfieldhome = C::t('common_member_field_home')->fetch($_G['uid']);
    $info = $memberfieldhome['magicgift'] ? dunserialize($memberfieldhome['magicgift']) : array();
    unset($memberfieldhome);
    $leftcredit = intval($info['left']);
    if ($leftcredit <= 0) {
        C::t('common_member_field_home')->update($_G['uid'], array('magicgift' => ''));
        showmessage('red_bag_no_credits');
    }
    $extcredits = str_replace('extcredits', '', $info['credittype']);
    $credittype = $_G['setting']['extcredits'][$extcredits]['title'];
    if (submitcheck('cancelsubmit')) {
        C::t('common_member_field_home')->update($_G['uid'], array('magicgift' => ''));
        if (preg_match('/^extcredits[1-8]$/', $info['credittype'])) {
            updatemembercount($_G['uid'], array($extcredits => $leftcredit), 1, 'RGC', $info['magicid']);
        }
        showmessage('return_red_bag', dreferer(), array('leftcredit' => $leftcredit, 'credittype' => $credittype), array('showdialog' => 1, 'locationtime' => true));
    }
}
include_once template('home/spacecp_magic');
コード例 #16
0
        $diffarray = array();
        $sql = $comma = '';
        if (is_array($_G['gp_extcreditsnew'])) {
            foreach ($_G['gp_extcreditsnew'] as $id => $value) {
                if ($member['extcredits' . $id] != ($value = intval($value))) {
                    $diffarray[$id] = $value - $member['extcredits' . $id];
                    $sql .= $comma . "extcredits{$id}='{$value}'";
                    $comma = ', ';
                }
            }
        }
        if ($diffarray) {
            foreach ($diffarray as $id => $diff) {
                $logs[] = dhtmlspecialchars("{$_G['timestamp']}\t{$_G[member][username]}\t{$_G['adminid']}\t{$member['username']}\t{$id}\t{$diff}\t0\t\t{$_G['gp_reason']}");
            }
            updatemembercount($_G['gp_uid'], $diffarray);
            writelog('ratelog', $logs);
        }
        cpmsg('members_edit_credits_succeed', "action=members&operation=credit&uid={$_G['gp_uid']}", 'succeed');
    }
} elseif ($operation == 'medal') {
    if (empty($_G['gp_uid']) && empty($_G['gp_username'])) {
        cpmsg('members_nonexistence', 'action=members&operation=medal' . (!empty($_G['gp_highlight']) ? "&highlight={$_G['gp_highlight']}" : ''), 'form', array(), '<input type="text" name="username" value="" class="txt" />');
    } else {
        $condition = !empty($_G['gp_uid']) ? "m.uid='{$_G['gp_uid']}'" : "m.username='******'gp_username']}'";
    }
    $member = DB::fetch_first("SELECT m.uid, m.username, mf.medals\r\n\t\tFROM " . DB::table('common_member') . " m\r\n\t\tLEFT JOIN " . DB::table('common_member_field_forum') . " mf ON m.uid=mf.uid\r\n\t\tWHERE {$condition}");
    if (!$member) {
        cpmsg('members_edit_nonexistence', '', 'error');
    }
    if (!submitcheck('medalsubmit')) {
コード例 #17
0
        list($tmp['uid']) = $ucresult;
        if ($tmp['uid'] <= 0) {
            showmessage('credits_password_invalid', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
        }
        if (!$outexange) {
            updatemembercount($_G['uid'], array($fromcredits => -$netamount, $tocredits => $exchangeamount), 1, 'CEC', $_G['uid']);
        } else {
            if (!array_key_exists($fromcredits, $_CACHE['creditsettings'][$tocredits]['creditsrc'])) {
                showmessage('extcredits_dataerror', NULL);
            }
            list($toappid, $tocredits) = explode('|', $tocredits);
            $ucresult = uc_credit_exchange_request($_G['uid'], $fromcredits, $tocredits, $toappid, $exchangeamount);
            if (!$ucresult) {
                showmessage('extcredits_dataerror', NULL);
            }
            updatemembercount($_G['uid'], array($fromcredits => -$netamount), 1, 'ECU', $_G['uid']);
            $netamount = $amount;
            $amount = $tocredits = 0;
        }
        showmessage('credits_transaction_succeed', 'home.php?mod=spacecp&ac=credit&op=exchange', array(), array('showdialog' => 1, 'showmsg' => true, 'locationtime' => true));
    }
} else {
    $wheresql = '';
    $list = array();
    $rid = intval($_GET['rid']);
    if ($_GET['rid']) {
        $wheresql = " AND rid='{$rid}'";
    }
    require_once libfile('function/forumlist');
    $select = forumselect(false, 0, $_GET['fid']);
    $keys = array_keys($_G['setting']['extcredits']);
コード例 #18
0
ファイル: function_delete.php プロジェクト: softhui/discuz
function deletealbums($albumids)
{
    global $_G;
    $sizes = $dels = $newids = $counts = array();
    $allowmanage = checkperm('managealbum');
    $value = C::t('home_album')->fetch($albumids);
    if ($value['albumid']) {
        if ($allowmanage || $value['uid'] == $_G['uid']) {
            $dels[] = $value;
            $newids[] = $value['albumid'];
            if (!empty($value['pic'])) {
                include_once libfile('function/home');
                pic_delete($value['pic'], 'album', 0, $value['picflag'] == 2 ? 1 : 0);
            }
        }
        $counts[$value['uid']]['albums'] -= 1;
    }
    if (empty($dels)) {
        return array();
    }
    $pics = $picids = array();
    $query = C::t('home_pic')->fetch_all_by_albumid($newids);
    foreach ($query as $value) {
        $pics[] = $value;
        $picids[] = $value['picid'];
        $sizes[$value['uid']] = $sizes[$value['uid']] + $value['size'];
    }
    if ($picids) {
        deletepics($picids);
    }
    C::t('home_album')->delete($newids);
    C::t('home_feed')->delete_by_id_idtype($newids, 'albumid');
    if ($picids) {
        C::t('home_clickuser')->delete_by_id_idtype($picids, 'picid');
    }
    if ($sizes) {
        foreach ($sizes as $uid => $value) {
            $attachsize = intval($sizes[$uid]);
            $albumnum = $counts[$uid]['albums'] ? $counts[$uid]['albums'] : 0;
            updatemembercount($uid, array('albums' => $albumnum, 'attachsize' => -$attachsize), false);
        }
    }
    return $dels;
}
コード例 #19
0
        $diffarray = array();
        $sql = $comma = '';
        if (is_array($_GET['extcreditsnew'])) {
            foreach ($_GET['extcreditsnew'] as $id => $value) {
                if ($member['extcredits' . $id] != ($value = intval($value))) {
                    $diffarray[$id] = $value - $member['extcredits' . $id];
                    $sql .= $comma . "extcredits{$id}='{$value}'";
                    $comma = ', ';
                }
            }
        }
        if ($diffarray) {
            foreach ($diffarray as $id => $diff) {
                $logs[] = dhtmlspecialchars("{$_G['timestamp']}\t{$_G[member][username]}\t{$_G['adminid']}\t{$member['username']}\t{$id}\t{$diff}\t0\t\t{$_GET['reason']}");
            }
            updatemembercount($_GET['uid'], $diffarray);
            writelog('ratelog', $logs);
        }
        cpmsg('members_edit_credits_succeed', "action=members&operation=credit&uid={$_GET['uid']}", 'succeed');
    }
} elseif ($operation == 'medal') {
    $membermf = C::t('common_member_field_forum' . $tableext)->fetch($_GET['uid']);
    $member = array_merge($member, $membermf);
    if (!submitcheck('medalsubmit')) {
        $medals = '';
        $membermedals = array();
        loadcache('medals');
        foreach (explode("\t", $member['medals']) as $key => $membermedal) {
            list($medalid, $medalexpiration) = explode("|", $membermedal);
            if (isset($_G['cache']['medals'][$medalid]) && (!$medalexpiration || $medalexpiration > TIMESTAMP)) {
                $membermedals[$key] = $medalid;
コード例 #20
0
 }
 while ($attach = DB::fetch($query)) {
     if (in_array($attach['uid'], $puidarray)) {
         $auidarray[$attach['uid']] = !empty($auidarray[$attach['uid']]) ? $auidarray[$attach['uid']] + 1 : 1;
     }
     dunlink($attach);
 }
 if ($auidarray) {
     updateattachcredits('-', $auidarray, $postattachcredits);
 }
 $logs = array();
 if ($pids) {
     $query = DB::query("SELECT r.extcredits, r.score, p.authorid, p.author FROM " . DB::table('forum_ratelog') . " r LEFT JOIN " . DB::table($posttable) . " p ON r.pid=p.pid WHERE r.pid IN ({$pids})");
     while ($author = DB::fetch($query)) {
         if ($author['score'] > 0) {
             updatemembercount($author['authorid'], array($author['extcredits'] => -$author['score']));
             $author['score'] = $_G['setting']['extcredits'][$id]['title'] . ' ' . -$author['score'] . ' ' . $_G['setting']['extcredits'][$id]['unit'];
             $logs[] = dhtmlspecialchars("{$_G['timestamp']}\t{$_G[member][username]}\t{$_G['adminid']}\t{$author['author']}\t{$author['extcredits']}\t{$author['score']}\t{$thread['tid']}\t{$thread['subject']}\t{$delpostsubmit}");
         }
     }
 }
 if (!empty($logs)) {
     writelog('ratelog', $logs);
     unset($logs);
 }
 DB::delete('common_credit_log', "operation='PRC' AND relatedid IN({$pids})");
 DB::query("DELETE FROM " . DB::table('forum_ratelog') . " WHERE pid IN ({$pids})");
 DB::query("DELETE FROM " . DB::table('forum_attachment') . " WHERE pid IN ({$pids})");
 DB::query("DELETE FROM " . DB::table('forum_attachmentfield') . " WHERE pid IN ({$pids})");
 DB::query("DELETE FROM " . DB::table('forum_postcomment') . " WHERE pid IN ({$pids})");
 DB::query("DELETE FROM " . DB::table($posttable) . " WHERE pid IN ({$pids})");
コード例 #21
0
ファイル: sign.inc.php プロジェクト: v998/dsu
         case 6:
             list($exacr, $exacz) = explode("|", $var['jlmain7']);
             break;
         case 7:
             list($exacr, $exacz) = explode("|", $var['jlmain8']);
             break;
         case 8:
             list($exacr, $exacz) = explode("|", $var['jlmain9']);
             break;
         case 9:
             list($exacr, $exacz) = explode("|", $var['jlmain10']);
             break;
     }
     $psc = $num + 1;
     if ($exacr && $exacz) {
         updatemembercount($_G['uid'], array($exacr => $exacz));
     }
 }
 if ($var['qdtype'] == '2') {
     $thread = DB::fetch_first("SELECT * FROM " . DB::table('forum_thread') . " WHERE tid='{$var['tidnumber']}'");
     $hft = dgmdate($_G['timestamp'], 'Y-m-d H:i', $var['tos']);
     if ($num >= 0 && $num <= 9 && $exacr && $exacz) {
         $message = "[quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_02]}[color=red]{$lang[tsn_03]}[/color][color=darkorange]{$lang[tsn_04]}{$psc}{$lang[tsn_05]}[/color]{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit}[/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}[/color][color=gray]{$lang[tsn_17]}[/color] [color=gray]{$_G[setting][extcredits][$exacr][title]} [/color][color=darkorange]{$exacz}[/color][color=gray]{$_G[setting][extcredits][$exacr][unit]}.{$another_vip}[/color][/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]";
     } else {
         $message = "[quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_09]}{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}.{$another_vip}[/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]";
     }
     require_once libfile('function/post');
     require_once libfile('function/forum');
     $pid = insertpost(array('fid' => $thread['fid'], 'tid' => $var['tidnumber'], 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => '', 'dateline' => $_G['timestamp'], 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => '0', 'anonymous' => '0', 'usesig' => '0', 'htmlon' => '0', 'bbcodeoff' => '0', 'smileyoff' => '0', 'parseurloff' => '0', 'attachment' => '0'));
     DB::query("UPDATE " . DB::table('forum_thread') . " SET lastposter='{$_G['username']}', lastpost='{$_G['timestamp']}', replies=replies+1 WHERE tid='{$var['tidnumber']}' AND fid='{$thread['fid']}'", 'UNBUFFERED');
     updatepostcredits('+', $_G['uid'], 'reply', $thread['fid']);
コード例 #22
0
        } else {
            $levelid = -1;
        }
        $newfid = C::t('forum_forum')->insert_group($fup, 'sub', $name, '3', $levelid);
        if ($newfid) {
            $jointype = intval($_GET['jointype']);
            $gviewperm = intval($_GET['gviewperm']);
            $fieldarray = array('fid' => $newfid, 'description' => $descriptionnew, 'jointype' => $jointype, 'gviewperm' => $gviewperm, 'dateline' => TIMESTAMP, 'founderuid' => $_G['uid'], 'foundername' => $_G['username'], 'membernum' => 1);
            C::t('forum_forumfield')->insert($fieldarray);
            C::t('forum_forumfield')->update_groupnum($fup, 1);
            C::t('forum_groupuser')->insert($newfid, $_G['uid'], $_G['username'], 1, TIMESTAMP);
            require_once libfile('function/cache');
            updatecache('grouptype');
        }
        if ($creditstransextra && $_G['group']['buildgroupcredits']) {
            updatemembercount($_G['uid'], array($creditstransextra => -$_G['group']['buildgroupcredits']), 1, 'BGR', $newfid);
        }
        include_once libfile('function/stat');
        updatestat('group');
        if ($levelid == -1) {
            showmessage('group_create_mod_succeed', "group.php?mod=my&view=manager", array(), array('alert' => 'right', 'showdialog' => 1, 'showmsg' => true, 'locationtime' => true));
        }
        showmessage('group_create_succeed', "forum.php?mod=group&action=manage&fid={$newfid}", array(), array('showdialog' => 1, 'showmsg' => true, 'locationtime' => true));
    }
    include template('diy:group/group:' . $_G['fid']);
} elseif ($action == 'manage') {
    if (!$_G['forum']['ismoderator']) {
        showmessage('group_admin_noallowed');
    }
    $specialswitch = $_G['current_grouplevel']['specialswitch'];
    $oparray = array('group', 'checkuser', 'manageuser', 'threadtype', 'demise');
コード例 #23
0
ファイル: forum_trade.php プロジェクト: tang86/discuz-utf8
             $netcredit = round($tradelog['number'] * $tradelog['basecredit'] * (1 - $_G['setting']['creditstax']));
             updatemembercount($tradelog['sellerid'], array($_G['setting']['creditstransextra'][5] => $netcredit));
         } else {
             $netcredit = 0;
         }
         $data = array('lastbuyer' => $tradelog['buyer'], 'lastupdate' => $_G['timestamp']);
         C::t('forum_trade')->update($tradelog['tid'], $tradelog['pid'], $data);
         C::t('forum_trade')->update_counter($tradelog['tid'], $tradelog['pid'], $tradelog['number'], $tradelog['price'], $netcredit);
         notification_add($tradelog['sellerid'], 'goods', 'trade_success', array('orderid' => $orderid, 'subject' => $tradelog['subject']));
         notification_add($tradelog['buyerid'], 'goods', 'trade_success', array('orderid' => $orderid, 'subject' => $tradelog['subject']));
     } elseif ($_GET['offlinestatus'] == 17) {
         C::t('forum_trade')->update_counter($tradelog['tid'], $tradelog['pid'], 0, 0, 0, $tradelog['number']);
         notification_add($tradelog['sellerid'], 'goods', 'trade_fefund_success', array('orderid' => $orderid, 'subject' => $tradelog['subject']));
         notification_add($tradelog['buyerid'], 'goods', 'trade_fefund_success', array('orderid' => $orderid, 'subject' => $tradelog['subject']));
         if ($_G['setting']['creditstransextra'][5] != -1 && $tradelog['basecredit']) {
             updatemembercount($tradelog['buyerid'], array($_G['setting']['creditstransextra'][5] => $tradelog['number'] * $tradelog['basecredit']));
         }
     }
     $_GET['message'] = trim($_GET['message']);
     if ($_GET['message']) {
         $_GET['message'] = $tradelog['message'] . "\t\t\t" . $_G['uid'] . "\t" . $_G['member']['username'] . "\t" . TIMESTAMP . "\t" . nl2br(strip_tags(substr($_GET['message'], 0, 200)));
     } else {
         $_GET['message'] = $tradelog['message'];
     }
     C::t('forum_tradelog')->update($orderid, array('status' => $_GET['offlinestatus'], 'lastupdate' => $_G['timestamp'], 'message' => $_GET['message']));
     showmessage('trade_orderstatus_updated', 'forum.php?mod=trade&orderid=' . $orderid);
 }
 if (submitcheck('tradesubmit')) {
     if ($tradelog['status'] == 0) {
         $update = array();
         $oldbasecredit = $tradelog['basecredit'];
コード例 #24
0
 if ($balance < $credits) {
     showmessage($lang['credit_shortage']);
 }
 $novelid = $_G['gp_novelid'];
 $novel = DB::fetch_first("SELECT * FROM " . DB::table("pdnovel_view") . (" WHERE novelid=" . $novelid . " AND display=0;"));
 if (!$novel) {
     showmessage("undefined_action", NULL);
 } else {
     if ($novel['posterid'] == $_G['uid']) {
         showmessage("thread_rate_member_invalid", NULL);
     }
 }
 DB::query("INSERT INTO " . DB::table("pdnovel_rate") . (" (novelid, uid, username, credits, dateline) VALUES (" . $novelid . ", {$_G['uid']}, '{$_G['username']}', {$credits}, {$_G['timestamp']})"), "UNBUFFERED");
 DB::query("UPDATE LOW_PRIORITY " . DB::table("pdnovel_view") . (" SET rate=rate+" . $credits . " WHERE novelid={$novelid}"), "UNBUFFERED");
 updatemembercount($_G['uid'], array($_G['setting']['creditstransextra'][1] => 0 - $credits), 1, "BAC", $novelid);
 updatemembercount($novel['posterid'], array($_G['setting']['creditstransextra'][1] => $credits), 1, "BAC", $novelid);
 if ($_POST['message']) {
     $message = getstr($_POST['message'], 600, 1, 1, 1, 0);
     $message = "<font color=red>" . $message . "</font>";
     $message = censor($message);
     if (censormod($message)) {
         $comment_status = 1;
     } else {
         $comment_status = 0;
     }
     $setarr = array("uid" => $_G['uid'], "username" => $_G['username'], "novelid" => $novelid, "postip" => $_G['onlineip'], "dateline" => $_G['timestamp'], "status" => $comment_status, "message" => $message);
     DB::insert("pdnovel_comment", $setarr);
     DB::query("UPDATE " . DB::table("pdnovel_view") . (" SET comments=comments+1 WHERE novelid=" . $novelid));
     DB::update("common_member_status", array("lastpost" => $_G['timestamp']), array("uid" => $_G['uid']));
 }
 showmessage("do_success", "pdnovel.php?mod=view&novelid=" . $novelid);
コード例 #25
0
ファイル: member_register.php プロジェクト: v998/discuzx-en
 include_once libfile('function/stat');
 updatestat('register');
 $_CORE =& discuz_core::instance();
 $_CORE->session->set('uid', $uid);
 $_CORE->session->set('username', $username);
 dsetcookie('auth', authcode("{$_G['member']['password']}\t{$_G['uid']}", 'ENCODE'), 2592000, 1, true);
 if ($invite['id']) {
     DB::update("common_invite", array('fuid' => $uid, 'fusername' => $username, 'regdateline' => $_G['timestamp'], 'status' => 2), array('id' => $invite['id']));
     updatestat('invite');
 }
 if ($invite['uid']) {
     if ($_G['setting']['inviteconfig']['inviteaddcredit']) {
         updatemembercount($uid, array($_G['setting']['inviteconfig']['inviterewardcredit'] => $_G['setting']['inviteconfig']['inviteaddcredit']));
     }
     if ($_G['setting']['inviteconfig']['invitedaddcredit']) {
         updatemembercount($invite['uid'], array($_G['setting']['inviteconfig']['inviterewardcredit'] => $_G['setting']['inviteconfig']['invitedaddcredit']));
     }
     require_once libfile('function/friend');
     friend_make($invite['uid'], $invite['username'], false);
     notification_add($invite['uid'], 'friend', 'invite_friend', array('actor' => '<a href="home.php?mod=space&uid=' . $invite['uid'] . '" target="_blank">' . $invite['username'] . '</a>'), 1);
     space_merge($invite, 'field_home');
     if (!empty($invite['privacy']['feed']['invite'])) {
         require_once libfile('function/feed');
         $tite_data = array('username' => '<a href="home.php?mod=space&uid=' . $_G['uid'] . '">' . $_G['username'] . '</a>');
         feed_add('friend', 'feed_invite', $tite_data, '', array(), '', array(), array(), '', '', '', 0, 0, '', $invite['uid'], $invite['username']);
     }
     if ($invite['appid']) {
         updatestat('appinvite');
     }
 }
 if ($welcomemsg && !empty($welcomemsgtxt)) {
コード例 #26
0
 private function _applyActivityTopic($res, $tid, $uid, $data)
 {
     // from forum_misc.php
     require_once libfile('function/post');
     $activity = DzForumActivity::getActivityByTid($tid);
     if ($activity['expiration'] && $activity['expiration'] < TIMESTAMP) {
         return $this->_makeErrorInfo($res, 'activity_stop');
     }
     $applyinfo = DzForumActivityApply::getApplyByTidUid($tid, $uid);
     if ($applyinfo && $applyinfo['verified'] < DzForumActivityApply::STATUS_VERIFIED_IMPROVE) {
         return $this->_makeErrorInfo($res, 'activity_repeat_apply');
     }
     global $_G;
     $_GET = $data;
     $thread = ForumUtils::getTopicInfo($tid);
     $payvalue = intval($_GET['payvalue']);
     $payment = $_GET['payment'] ? $payvalue : -1;
     $message = cutstr(dhtmlspecialchars($_GET['message']), 200);
     $verified = $thread['authorid'] == $uid ? 1 : 0;
     $ufielddata = '';
     if ($activity['ufield']) {
         $ufielddata = array();
         $version = MobcentDiscuz::getMobcentDiscuzVersion();
         $activity['ufield'] = $version != MobcentDiscuz::VERSION_X20 ? dunserialize($activity['ufield']) : unserialize($activity['ufield']);
         if (!empty($activity['ufield']['userfield'])) {
             if ($version == MobcentDiscuz::VERSION_X20) {
                 if (!class_exists('discuz_censor')) {
                     include libfile('class/censor');
                 }
             }
             $censor = discuz_censor::instance();
             loadcache('profilesetting');
             foreach ($data as $key => $value) {
                 if (empty($_G['cache']['profilesetting'][$key])) {
                     continue;
                 }
                 if (is_array($value)) {
                     $value = implode(',', $value);
                 }
                 $value = cutstr(dhtmlspecialchars(trim($value)), 100, '.');
                 // if ($_G['cache']['profilesetting'][$key]['formtype'] == 'file' && !preg_match("/^https?:\/\/(.*)?\.(jpg|png|gif|jpeg|bmp)$/i", $value)) {
                 //     showmessage('activity_imgurl_error');
                 // }
                 if (empty($value) && $key != 'residedist' && $key != 'residecommunity') {
                     return $this->_makeErrorInfo($res, 'activity_exile_field');
                 }
                 $ufielddata['userfield'][$key] = $value;
             }
         }
         if (!empty($activity['ufield']['extfield'])) {
             foreach ($activity['ufield']['extfield'] as $fieldid) {
                 $value = cutstr(dhtmlspecialchars(trim($_GET['' . $fieldid])), 50, '.');
                 $ufielddata['extfield'][$fieldid] = $value;
             }
         }
         $ufielddata = !empty($ufielddata) ? serialize($ufielddata) : '';
     }
     if ($_G['setting']['activitycredit'] && $activity['credit'] && empty($applyinfo['verified'])) {
         checklowerlimit(array('extcredits' . $_G['setting']['activitycredit'] => '-' . $activity['credit']));
         updatemembercount($uid, array($_G['setting']['activitycredit'] => '-' . $activity['credit']), true, 'ACC', $tid);
     }
     $data = array('tid' => $tid, 'username' => $_G['username'], 'uid' => $uid, 'message' => $message, 'verified' => $verified, 'dateline' => $_G['timestamp'], 'payment' => $payment, 'ufielddata' => $ufielddata);
     if ($applyinfo && $applyinfo['verified'] == DzForumActivityApply::STATUS_VERIFIED_IMPROVE) {
         DzForumActivityApply::updateApplyById($data, $applyinfo['applyid']);
     } else {
         DzForumActivityApply::insertApply($data);
     }
     DzForumActivity::updateApplyNumberByTid($tid);
     if ($thread['authorid'] != $uid) {
         notification_add($thread['authorid'], 'activity', 'activity_notice', array('tid' => $tid, 'subject' => $thread['subject']));
         $space = array();
         space_merge($space, 'field_home');
         if (!empty($space['privacy']['feed']['newreply'])) {
             $feed['icon'] = 'activity';
             $feed['title_template'] = 'feed_reply_activity_title';
             $feed['title_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$tid}\">{$thread['subject']}</a>", 'hash_data' => "tid{$tid}");
             $feed['id'] = $tid;
             $feed['idtype'] = 'tid';
             postfeed($feed);
         }
     }
     $res = $this->_makeErrorInfo($res, 'activity_completion');
     $res['rs'] = 1;
     return $res;
 }
コード例 #27
0
ファイル: modcp_report.php プロジェクト: v998/discuzx-en
    exit('Access Denied');
}
if (!empty($_G['fid'])) {
    $curcredits = $_G['setting']['creditstransextra'][8] ? $_G['setting']['creditstransextra'][8] : $_G['setting']['creditstrans'];
    if (submitcheck('reportsubmit')) {
        if ($_G['gp_reportids']) {
            foreach ($_G['gp_reportids'] as $reportid) {
                if (DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_report') . " WHERE id='{$reportid}' AND opuid='0'")) {
                    $creditchange = '';
                    $uid = $_G['gp_reportuids'][$reportid];
                    if ($uid != $_G['uid']) {
                        $msg = !empty($_G['gp_msg'][$reportid]) ? '<br />' . htmlspecialchars($_G['gp_msg'][$reportid]) : '';
                        if (!empty($_G['gp_creditsvalue'][$reportid])) {
                            $credittag = $_G['gp_creditsvalue'][$reportid] > 0 ? '+' : '';
                            $creditchange = '<br />' . lang('forum/misc', 'report_msg_your') . $_G['setting']['extcredits'][$curcredits]['title'] . '&nbsp;' . $credittag . $_G['gp_creditsvalue'][$reportid];
                            updatemembercount($uid, array($curcredits => intval($_G['gp_creditsvalue'][$reportid])), true, 'RPC', $reportid);
                        }
                        if ($creditchange || $msg) {
                            notification_add($uid, 'report', 'report_change_credits', array('creditchange' => $creditchange, 'msg' => $msg), 1);
                        }
                    }
                    $opresult = !empty($_G['gp_creditsvalue'][$reportid]) ? $curcredits . "\t" . intval($_G['gp_creditsvalue'][$reportid]) : 'ignore';
                    DB::query("UPDATE " . DB::table('common_report') . " SET opuid='{$_G['uid']}', opname='{$_G['username']}', optime='" . TIMESTAMP . "', opresult='{$opresult}' WHERE id='{$reportid}'");
                }
            }
            showmessage('modcp_report_success', "{$cpscript}?mod=modcp&action=report&fid={$_G['fid']}&lpp={$lpp}");
        }
    }
    $rewardlist = '';
    $report_reward = unserialize($_G['setting']['report_reward']);
    $offset = abs(ceil(($report_reward['max'] - $report_reward['min']) / 10));
コード例 #28
0
ファイル: post_editpost.php プロジェクト: v998/discuzx-en
     showmessage('post_edit_thread_ban_del', NULL);
 }
 if ($isfirstpost && $thread['replies'] > 0) {
     showmessage($thread['special'] == 3 ? 'post_edit_reward_already_reply' : 'post_edit_thread_already_reply', NULL);
 }
 if ($thread['special'] == 3) {
     if ($thread['price'] < 0 && $thread['dateline'] + 1 == $orig['dateline']) {
         showmessage('post_edit_reward_nopermission', NULL);
     }
 }
 if ($rushreply) {
     showmessage('post_edit_delete_rushreply_nopermission', NULL);
 }
 updatepostcredits('-', $orig['authorid'], $isfirstpost ? 'post' : 'reply', $_G['fid']);
 if ($thread['special'] == 3 && $isfirstpost) {
     updatemembercount($orig['authorid'], array($_G['setting']['creditstransextra'][2] => $thread['price']));
     DB::delete('common_credit_log', array('uid' => $thread['authorid'], 'operation' => 'RTC', 'relatedid' => $_G['tid']));
 }
 $thread_attachment = $post_attachment = 0;
 $query = DB::query("SELECT pid, attachment, thumb, remote, aid FROM " . DB::table('forum_attachment') . " WHERE tid='{$_G['tid']}'");
 while ($attach = DB::fetch($query)) {
     if ($attach['pid'] == $pid) {
         $post_attachment++;
         dunlink($attach);
     } else {
         $thread_attachment = 1;
     }
 }
 if ($post_attachment) {
     DB::query("DELETE FROM " . DB::table('forum_attachment') . " WHERE pid='{$pid}'", 'UNBUFFEREED');
     DB::query("DELETE FROM " . DB::table('forum_attachmentfield') . " WHERE pid='{$pid}'", 'UNBUFFERED');
コード例 #29
0
ファイル: function_home.php プロジェクト: upyun/discuz-plugin
function member_count_update($uid, $counts)
{
    global $_G;
    $setsqls = array();
    foreach ($counts as $key => $value) {
        if ($key == 'credit') {
            if ($_G['setting']['creditstransextra'][6]) {
                $key = 'extcredits' . intval($_G['setting']['creditstransextra'][6]);
            } elseif ($_G['setting']['creditstrans']) {
                $key = 'extcredits' . intval($_G['setting']['creditstrans']);
            } else {
                continue;
            }
        }
        $setsqls[$key] = $value;
    }
    if ($setsqls) {
        updatemembercount($uid, $setsqls);
    }
}
コード例 #30
0
ファイル: post_editpost.php プロジェクト: kleitz/sports
     showmessage('post_edit_delete_rushreply_nopermission', NULL);
 }
 if ($thread['displayorder'] >= 0) {
     updatepostcredits('-', $orig['authorid'], $isfirstpost ? 'post' : 'reply', $_G['fid']);
 }
 if ($thread['special'] == 3 && $isfirstpost) {
     updatemembercount($orig['authorid'], array($_G['setting']['creditstransextra'][2] => $thread['price']));
     DB::delete('common_credit_log', array('uid' => $thread['authorid'], 'operation' => 'RTC', 'relatedid' => $_G['tid']));
 }
 if ($thread['replycredit'] && $isfirstpost && !$isanonymous) {
     updatemembercount($orig['authorid'], array($replycredit_rule['extcreditstype'] => $thread['replycredit']), true, 'RCB', $_G['tid']);
     DB::delete('forum_replycredit', array('tid' => $_G['tid']));
 } elseif (!$isfirstpost && !$isanonymous) {
     if ($postreplycredit = DB::result_first("SELECT replycredit FROM " . DB::table($posttable) . " WHERE pid = '{$pid}' LIMIT 1")) {
         DB::query("UPDATE " . DB::table($posttable) . " SET replycredit = 0 WHERE pid = '{$pid}' LIMIT 1");
         updatemembercount($orig['authorid'], array($replycredit_rule['extcreditstype'] => '-' . $postreplycredit));
     }
 }
 $thread_attachment = $post_attachment = 0;
 $query = DB::query("SELECT pid, attachment, thumb, remote, aid FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE tid='{$_G['tid']}'");
 while ($attach = DB::fetch($query)) {
     if ($attach['pid'] == $pid) {
         if ($thread['displayorder'] >= 0) {
             $post_attachment++;
         }
         dunlink($attach);
     } else {
         $thread_attachment = 1;
     }
 }
 if ($post_attachment) {