Пример #1
0
//分析所在子站
switch_cache($arc->archive['sid']);
$sid = $arc->archive['sid'];
if_siteclosed($sid);
//分析权限与扣积分,文章出售
$ispre = 0;
//是否启动前导页
$pretpl = $arc->channel['pretpl'];
if (!arc_allow($arc->archive, 'aread')) {
    //分析权限,如果有备用页,则进入备用页。
    if (!$pretpl) {
        message('noarchbrowspermis');
    }
    $ispre = 1;
}
if ($crids = $arc->arc_crids()) {
    //需要对当前用户扣值
    $cridstr = '';
    foreach ($crids['total'] as $k => $v) {
        $cridstr .= ($cridstr ? ',' : '') . abs($v) . $currencys[$k]['unit'] . $currencys[$k]['cname'];
    }
    $commu = read_cache('commu', 8);
    if (!empty($commu['setting']['autoarc'])) {
        //不自动扣值的情况:如有前导页,进前导页,否则提示出订阅链接,选择是否订阅
        if (!$pretpl) {
            message('purarcwantpaycur' . $cridstr . "<br><br><a href=\"tools/subscribe.php?aid={$aid}\">>>" . lang('subscribe') . "</a>");
        }
        $ispre = 1;
    } else {
        //自动扣值,当前会员扣值及向出售者支付积分
        if (!$curuser->crids_enough($crids['total'])) {
Пример #2
0
$inajax = empty($inajax) ? 0 : 1;
$aid = empty($aid) ? 0 : max(0, intval($aid));
$isatm = empty($isatm) ? 0 : 1;
!$aid && cumessage('confchoosarchi');
!$memberid && cumessage('nousernosubper');
$commu = read_cache('commu', 8);
empty($commu) && cumessage('choosecommuitem');
if (empty($commu['ucadd'])) {
    !$curuser->pmbypmids('cuadd', $commu['setting']['apmid']) && cumessage('younoitempermis');
    $arc = new cls_archive();
    !$arc->arcid($aid) && cumessage('choosearchive');
    !$arc->archive['checked'] && cumessage('poinarcnoche');
    switch_cache($arc->archive['sid']);
    $sid = $arc->archive['sid'];
    $stritem = $isatm ? 'attachment' : 'archive';
    if (!($crids = $arc->arc_crids($isatm))) {
        cumessage("youalrpurchasestritem", '', $stritem);
    }
    $cridstr = '';
    foreach ($crids['total'] as $k => $v) {
        $cridstr .= ($cridstr ? ',' : '') . abs($v) . $currencys[$k]['unit'] . $currencys[$k]['cname'];
    }
    if (!$curuser->crids_enough($crids['total'])) {
        cumessage('younopurcstriwanenocurr', '', $stritem);
    }
    $curuser->updatecrids($crids['total'], 0, lang("purchasestritem", $stritem));
    $curuser->payrecord($arc->aid, $isatm, $cridstr, 1);
    if (!empty($crids['sale'])) {
        $actuser = new cls_userinfo();
        $actuser->activeuser($arc->archive['mid']);
        foreach ($crids['sale'] as $k => $v) {