Example #1
0
 require_once R_P . 'require/credit.php';
 //* include_once pwCache::getPath(D_P . 'data/bbscache/forum_cache.php');
 pwCache::getData(D_P . 'data/bbscache/forum_cache.php');
 if ($type == '1') {
     //$db->update("UPDATE pw_threads SET state='1' WHERE tid=" . S::sqlEscape($tid));
     pwQuery::update('pw_threads', 'tid=:tid', array($tid), array('state' => 1));
     $db->update('UPDATE pw_reward SET ' . S::sqlSingle(array('author' => $rt['author'], 'pid' => $pid)) . ' WHERE tid=' . S::sqlEscape($tid));
     //$db->update("UPDATE $pw_posts SET ifreward='2' WHERE pid=" . S::sqlEscape($pid));
     pwQuery::update($pw_posts, 'pid=:pid', array($pid), array('ifreward' => '2'));
     $credit->addLog('reward_answer', array($rs['cbtype'] => $rs['cbval']), array('uid' => $rt['authorid'], 'username' => $rt['author'], 'ip' => $onlineip, 'fname' => $forum[$fid]['name']));
     $credit->set($rt['authorid'], $rs['cbtype'], $rs['cbval'], false);
     //最佳答案者加分
     $credit->addLog('reward_return', array($rs['cbtype'] => $rs['cbval']), array('uid' => $authorid, 'username' => $author, 'ip' => $onlineip, 'fname' => $forum[$fid]['name']));
     $credit->set($authorid, $rs['cbtype'], $rs['cbval'], false);
     //悬赏者返分
     return_value($rt['tid'], $rs['catype'], $rs['caval']);
 } else {
     $rt['ifreward'] && Showmsg('reward_helped');
     $rs['caval'] < 1 && Showmsg('reward_help_error');
     $db->update('UPDATE pw_reward SET caval=caval-1 WHERE tid=' . S::sqlEscape($rt['tid']));
     //$db->update("UPDATE $pw_posts SET ifreward='1' WHERE pid=" . S::sqlEscape($pid));
     pwQuery::update($pw_posts, 'pid=:pid', array($pid), array('ifreward' => '1'));
     $credit->addLog('reward_active', array($rs['catype'] => 1), array('uid' => $rt['authorid'], 'username' => $rt['author'], 'ip' => $onlineip, 'fname' => $forum[$fid]['name']));
     $credit->set($rt['authorid'], $rs['catype'], 1, false);
     //热心助人者加分
 }
 $credit->runsql();
 /* clear cache */
 //* $threads = L::loadClass('threads', 'forum');
 //* $threads->delThreads($tid);
 if ($_POST['ifmsg']) {
Example #2
0
    require_once R_P . 'require/header.php';
    require_once PrintEot('reward');
    footer();
} else {
    PostCheck();
    require_once R_P . 'require/credit.php';
    //* include_once pwCache::getPath(D_P . 'data/bbscache/forum_cache.php');
    pwCache::getData(D_P . 'data/bbscache/forum_cache.php');
    if ($type == '1') {
        //$db->update("UPDATE pw_threads SET state='2' WHERE tid=" . S::sqlEscape($tid));
        pwQuery::update('pw_threads', 'tid=:tid', array($tid), array('state' => 2));
        $credit->addLog('reward_return', array($rt['cbtype'] => $rt['cbval'] * 2), array('uid' => $authorid, 'username' => $author, 'ip' => $onlineip, 'fname' => $forum[$fid]['name']));
        $credit->set($authorid, $rt['cbtype'], $rt['cbval'] * 2);
    } else {
        if ($timestamp < $rt['timelimit'] && $groupid != '3' && $groupid != '4') {
            Showmsg('reward_time_limit');
        }
        //$db->update("UPDATE pw_threads SET state='3' WHERE tid=" . S::sqlEscape($tid));
        pwQuery::update('pw_threads', 'tid=:tid', array($tid), array('state' => 3));
    }
    return_value($tid, $rt['catype'], $rt['caval']);
    if ($ifmsg) {
        if ($type == '1') {
            $affect = $credit->cType[$rt['cbtype']] . ":" . $rt['cbval'] * 2;
        } else {
            $affect = '';
        }
        M::sendNotice(array($rt['author']), array('title' => getLangInfo('writemsg', 'endreward_title_' . $type), 'content' => getLangInfo('writemsg', 'endreward_content_' . $type, array('manager' => $windid, 'fid' => $fid, 'tid' => $tid, 'subject' => $rt['subject'], 'postdate' => get_date($rt['postdate']), 'forum' => $forum[$fid]['name'], 'affect' => $affect, 'admindate' => get_date($timestamp), 'reason' => 'None'))));
    }
    refreshto("read.php?tid={$tid}&ds=1", 'operate_success');
}
    $response = "No request provided";
    return_value($response, 400);
    die;
}
//Act if user requested progress information
if ($progress) {
    $curr_progress = $controller->check_progress($request);
    //Return resouce if we are finished processing
    if ($curr_progress == 'Complete') {
        $curr_progress = $controller->get_resource($request);
    }
    return_value($curr_progress, 200);
} else {
    $controller->queue($request);
    $response = "Request received please wait while we process";
    return_value($response, 201);
}
/**
 *
 */
class Controller extends Queue_manager
{
    function __construct()
    {
    }
    /**
     * Check progress of request
     * @param {String} $request
     */
    function check_progress($request)
    {