Exemplo n.º 1
0
 function update($uploaddb)
 {
     $fieldService = L::loadClass('ActivityField', 'activity');
     if ($this->tid) {
         $defaultAttach = $userAttach = array();
         foreach ($uploaddb as $key => $value) {
             if ($value['id']) {
                 $attach = array();
                 $attach = $fieldService->getField($value['id']);
                 $this->attachs[$attach['fieldname']] = $value['fileuploadurl'];
                 if ($attach['fieldname'] && $attach['ifdel'] == 1) {
                     $userAttach[$attach['fieldname']] = $value['fileuploadurl'];
                 } elseif ($attach['fieldname'] && !$attach['ifdel']) {
                     $defaultAttach[$attach['fieldname']] = $value['fileuploadurl'];
                 }
             }
         }
         $defaultValueTableName = getActivityValueTableNameByActmid();
         $userDefinedValueTableName = getActivityValueTableNameByActmid($this->actmid, 1, 1);
         if ($defaultAttach) {
             $this->db->update("UPDATE {$defaultValueTableName} SET " . S::sqlSingle($defaultAttach) . " WHERE tid=" . S::sqlEscape($this->tid));
         }
         if ($userAttach) {
             $this->db->update("UPDATE {$userDefinedValueTableName} SET " . S::sqlSingle($userAttach) . " WHERE tid=" . S::sqlEscape($this->tid));
         }
     } else {
         foreach ($uploaddb as $key => $value) {
             $this->attachs['fileuploadurl'] = $value['fileuploadurl'];
         }
     }
     return true;
 }
Exemplo n.º 2
0
 function updataById($tplid, $array)
 {
     $array = $this->_checkData($array);
     if (!$array) {
         return null;
     }
     $this->_db->update("UPDATE " . $this->_tableName . " SET " . S::sqlSingle($array, false) . " WHERE tplid=" . S::sqlEscape($tplid));
 }
Exemplo n.º 3
0
 function update($uploaddb)
 {
     $attaches = array();
     foreach ($uploaddb as $v) {
         $attaches['attach' . $v['id']] = $v['fileuploadurl'];
     }
     $attaches && $this->db->pw_update("SELECT * FROM pw_auth_certificate WHERE uid=" . S::sqlEscape($this->uid), "UPDATE pw_auth_certificate SET " . S::sqlSingle($attaches) . ' WHERE uid=' . $this->uid, "INSERT INTO pw_auth_certificate SET " . S::sqlSingle($attaches) . ',state=0,uid=' . $this->uid);
 }
Exemplo n.º 4
0
 function update($sign, $array)
 {
     $array = $this->_checkData($array);
     if (!$array) {
         return null;
     }
     $this->_db->update('UPDATE ' . $this->_tableName . ' SET ' . S::sqlSingle($array, false) . ' WHERE sign=' . S::sqlEscape($sign));
 }
Exemplo n.º 5
0
function writetoollog($log)
{
    global $db, $db_bbsurl;
    $log['type'] = getLangInfo('toollog', $log['type']);
    $log['filename'] = S::escapeChar($log['filename']);
    $log['username'] = S::escapeChar($log['username']);
    $log['descrip'] = S::escapeChar(getLangInfo('toollog', $log['descrip'], $log));
    $db->update("INSERT INTO pw_toollog SET " . S::sqlSingle(array('type' => $log['type'], 'filename' => $log['filename'], 'nums' => $log['nums'], 'money' => $log['money'], 'descrip' => $log['descrip'], 'uid' => $log['uid'], 'touid' => $log['touid'], 'username' => $log['username'], 'ip' => $log['ip'], 'time' => $log['time'])));
}
Exemplo n.º 6
0
 function add($array)
 {
     $array = $this->_checkData($array);
     if (!$array) {
         return false;
     }
     $this->_db->update("INSERT INTO " . $this->_tableName . " SET " . S::sqlSingle($array, false));
     return $this->_db->insert_id();
 }
Exemplo n.º 7
0
 function _insertData($array)
 {
     $array = $this->_checkData($array);
     if (!$array || !$array['invokepieceid'] || !$array['data']) {
         return null;
     }
     $this->_db->update("INSERT INTO " . $this->_tableName . " SET " . S::sqlSingle($array, false));
     return $this->_db->insert_id();
 }
Exemplo n.º 8
0
 function replaceData($array)
 {
     $array = $this->_checkData($array);
     if (!$array || !$array['name']) {
         return null;
     }
     $this->_db->update("REPLACE INTO " . $this->_tableName . " SET " . S::sqlSingle($array, false));
     return $this->_db->insert_id();
 }
Exemplo n.º 9
0
function writeforumlog($log)
{
    $log['username1'] = S::escapeChar($log['username1']);
    $log['username2'] = S::escapeChar($log['username2']);
    $log['field1'] = S::escapeChar($log['field1']);
    $log['field2'] = S::escapeChar($log['field2']);
    $log['field3'] = S::escapeChar($log['field3']);
    $log['descrip'] = S::escapeChar(getLangInfo('log', $log['descrip'], $log));
    $GLOBALS['db']->update("INSERT INTO pw_forumlog SET " . S::sqlSingle(array('type' => $log['type'], 'username1' => $log['username1'], 'username2' => $log['username2'], 'field1' => $log['field1'], 'field2' => $log['field2'], 'field3' => $log['field3'], 'descrip' => $log['descrip'], 'timestamp' => $log['timestamp'], 'ip' => $log['ip']), false));
}
Exemplo n.º 10
0
 function updateByAlias($alias, $array)
 {
     $array = $this->_checkData($array);
     if (!$array) {
         return null;
     }
     if (isset($array['id'])) {
         unset($array['id']);
     }
     return $this->_db->update("UPDATE " . $this->_tableName . " SET " . S::sqlSingle($array, false) . " WHERE alias=" . S::sqlEscape($alias));
 }
Exemplo n.º 11
0
 function update($uploaddb)
 {
     global $db_charset, $timestamp;
     foreach ($uploaddb as $key => $value) {
         $value['name'] = pwConvert($value['name'], $db_charset, 'utf-8');
         $this->db->update("INSERT INTO pw_attachs SET " . S::sqlSingle(array('fid' => 0, 'uid' => $this->uid, 'tid' => 0, 'pid' => 0, 'hits' => 0, 'name' => $value['name'], 'type' => $value['type'], 'size' => $value['size'], 'attachurl' => $value['fileuploadurl'], 'uploadtime' => $timestamp, 'ifthumb' => $value['ifthumb'])));
         $aid = $this->db->insert_id();
         $this->attachs[$aid] = array('aid' => $aid, 'name' => stripslashes($value['name']), 'type' => $value['type'], 'attachurl' => $value['fileuploadurl'], 'needrvrc' => $value['needrvrc'], 'special' => $value['special'], 'ctype' => $value['ctype'], 'size' => $value['size'], 'hits' => 0, 'desc' => str_replace('\\', '', $value['descrip']), 'ifthumb' => $value['ifthumb']);
     }
     return true;
 }
Exemplo n.º 12
0
function setoParams($config)
{
    global $db;
    $updatecache = false;
    foreach ($config as $key => $value) {
        if (${'o_' . $key} != $value) {
            $db->pw_update('SELECT hk_name FROM pw_hack WHERE hk_name=' . S::sqlEscape("o_{$key}"), 'UPDATE pw_hack SET ' . S::sqlSingle(array('hk_value' => $value, 'vtype' => 'string')) . ' WHERE hk_name=' . S::sqlEscape("o_{$key}"), 'INSERT INTO pw_hack SET ' . S::sqlSingle(array('hk_name' => "o_{$key}", 'vtype' => 'string', 'hk_value' => $value)));
            $updatecache = true;
        }
    }
    $updatecache && updatecache_conf('o', true);
}
Exemplo n.º 13
0
 function publishTemplatizedAction($uid, $descrip, $appid)
 {
     //插入动态信息
     global $timestamp;
     //$rt = $this->db->get_one("SELECT * FROM pw_userapp WHERE uid=".S::sqlEscape($uid)." AND appid=".S::sqlEscape($appid));
     $appclient = L::loadClass('appclient');
     $rt = $appclient->getUserAppByUidAndAppid($uid, $appid);
     if ($rt['allowfeed']) {
         $descrip = S::escapeChar($descrip);
         $this->db->update("INSERT INTO pw_feed SET " . S::sqlSingle(array('uid' => $uid, 'type' => 'app', 'descrip' => $descrip, 'timestamp' => $timestamp), false));
         return new ApiResponse(true);
     }
     return new ApiResponse(false);
 }
Exemplo n.º 14
0
/**
 * Ìí¼Ó
 * @param int $uid
 * @param string $username
 * @return null
 */
function advertRecord($uid = 0, $username = '')
{
    global $onlineip, $timestamp, $db, $winduid, $inv_linktype, $inv_linkscore, $inv_linkcredit;
    if (empty($uid) || empty($username)) {
        return false;
    }
    $sql = "SELECT ip FROM pw_inviterecord WHERE uid=" . S::sqlEscape($uid) . " AND ip=" . S::sqlEscape($onlineip) . "";
    $rt = $db->get_one($sql);
    if ($rt && $rt['ip'] == $onlineip) {
        return false;
    }
    $visit = array('uid' => $uid, 'username' => $username, 'typeid' => $inv_linktype, 'reward' => $inv_linkscore, 'unit' => $inv_linkcredit, 'ip' => $onlineip, 'create_time' => $timestamp);
    $sql = 'INSERT INTO pw_inviterecord SET ' . S::sqlSingle($visit);
    $db->update($sql);
    return true;
}
Exemplo n.º 15
0
 function banUser($uid)
 {
     $uid = intval($uid);
     if ($uid < 1) {
         return $this->buildResponse(USER_INVALID_PARAMS);
     }
     $timestamp = time();
     $GLOBALS['db_cvtime'] != 0 && ($timestamp += $GLOBALS['db_cvtime'] * 60);
     $userService = L::loadClass('UserService', 'user');
     /* @var $userService PW_UserService */
     $userService->update($uid, array('groupid' => 6));
     $userService->setUserStatus($uid, PW_USERSTATUS_BANUSER, true);
     $banArray = array('uid' => $uid, 'fid' => 0, 'type' => 2, 'startdate' => $timestamp, 'days' => 0, 'admin' => '', 'reason' => '');
     $GLOBALS['db']->update("REPLACE INTO `pw_banuser` SET " . S::sqlSingle($banArray), false);
     return $this->buildResponse(0);
 }
Exemplo n.º 16
0
 /**
  * 创建AA活动号
  * @param int $tid 帖子id
  * @param int $uid 发起人id
  * @param int $actmid 二级分类id
  * @param string $subject 帖子标题
  * @return string T
  * @access private
  */
 function create_aa_payment($tid, $uid, $actmid = 0, $subject)
 {
     global $db_bbsname;
     require_once R_P . 'lib/activity/alipay.php';
     $AlipayInterface = new AlipayInterface('create_aa_payment');
     $out_biz_no = $this->sitehash . '_' . $tid . '_' . $this->generatestr(6);
     !$uid && ($uid = $this->winduid);
     $userService = L::loadClass('UserService', 'user');
     /* @var $userService PW_UserService */
     $userInfo = $userService->get($uid, false, false, true);
     $tradeinfo = $userInfo['tradeinfo'];
     $tradeinfo = unserialize($tradeinfo);
     $user_id = $tradeinfo['user_id'];
     $param = array('out_biz_no' => $out_biz_no, 'subject' => $subject, 'detail' => '', 'seller_id' => $user_id, 'out_forum_no' => $this->sitehash, 'out_forum_name' => $db_bbsname);
     require_once R_P . 'require/posthost.php';
     $returnResult = PostHost($AlipayInterface->alipayurl($param), '', 'POST');
     //获取XML值
     $xml_parser = xml_parser_create();
     xml_parse_into_struct($xml_parser, $returnResult, $arr_vals);
     xml_parser_free($xml_parser);
     foreach ($arr_vals as $value) {
         if ($value['tag'] == 'ERROR') {
             $error = $value['value'];
         } elseif ($value['tag'] == 'IS_SUCCESS') {
             $is_success = $value['value'];
         } elseif ($value['tag'] == 'BATCH_NO') {
             $batch_no = $value['value'];
         }
     }
     if ($error == 'AA_FAIL_TO_CREATE_AA_NEED_CERTIFY') {
         //未实名认证
         $tradeinfo['iscertified'] = 'F';
         $tradeinfo = addslashes(serialize($tradeinfo));
         $userService = L::loadClass('UserService', 'user');
         /* @var $userService PW_UserService */
         $userService->update($uid, array(), array(), array('tradeinfo' => $tradeinfo));
         $defaultValueTableName = getActivityValueTableNameByActmid();
         $this->db->update("UPDATE {$defaultValueTableName} SET iscertified=0 WHERE tid=" . S::sqlEscape($tid));
         //更新实名认证状态
     } elseif ($is_success == 'T' && $batch_no) {
         $defaultValueTableName = getActivityValueTableNameByActmid();
         $sqlarray = array('out_biz_no' => $out_biz_no, 'batch_no' => $batch_no, 'user_id' => $user_id);
         $this->db->update("UPDATE {$defaultValueTableName} SET " . S::sqlSingle($sqlarray) . " WHERE tid=" . S::sqlEscape($tid));
         return $is_success;
     }
     return $error;
 }
Exemplo n.º 17
0
function addSingleFriend($updatemem, $winduid, $frienduid, $timestamp, $status, $friendtype = 0, $checkmsg = '')
{
    global $db;
    $attentionService = L::loadClass('Attention', 'friend');
    /* @var $attentionService PW_Attention */
    if ($isAttention = $attentionService->isFollow($winduid, $frienduid)) {
        $db->update("UPDATE pw_friends SET status = " . S::sqlEscape($attentionService->_s_new_friend) . " WHERE uid=" . S::sqlEscape($winduid) . " AND friendid=" . S::sqlEscape($frienduid));
    } else {
        $pwSQL = S::sqlSingle(array('uid' => $winduid, 'friendid' => $frienduid, 'joindate' => $timestamp, 'status' => $status, 'descrip' => $checkmsg, 'ftid' => $friendtype));
        $db->update("INSERT INTO pw_friends SET {$pwSQL}");
    }
    if ($updatemem) {
        $userService = L::loadClass('UserService', 'user');
        /* @var $userService PW_UserService */
        $userService->updateByIncrement($winduid, array(), array('f_num' => 1));
    }
}
Exemplo n.º 18
0
 function add($uid, $appid, $appname, $allowfeed, $descrip)
 {
     global $timestamp;
     /*
     $this->db->update("REPLACE INTO pw_userapp SET " . S::sqlSingle(array(
     	'uid'		=> $uid,
     	'appid'		=> $appid,
     	'appname'	=> $appname,
     )));
     */
     pwQuery::replace('pw_userapp', array('uid' => $uid, 'appid' => $appid, 'appname' => $appname));
     if ($allowfeed) {
         $descrip = S::escapeChar($descrip);
         $this->db->update("INSERT INTO pw_feed SET " . S::sqlSingle(array('uid' => $uid, 'type' => 'app', 'descrip' => $descrip, 'timestamp' => $timestamp), false));
     }
     return new ApiResponse(true);
 }
Exemplo n.º 19
0
 /**
  * 更新在线的游客信息
  *
  * @return boolean
  */
 function updateOnlineGuest()
 {
     global $fid, $tid, $timestamp, $onlineip, $db_onlinetime, $wind_in, $db;
     if (!($guestInfo = $this->getGuestInfo())) {
         return false;
     }
     $ifhide = $GLOBALS['_G']['allowhide'] && GetCookie('hideid') ? 1 : 0;
     if ($guestInfo['token'] == 0) {
         // 删除过期的游客或者同IP在60秒内更新过的游客(防止恶意刷人数的行为)
         $db->update('DELETE FROM pw_online_guest WHERE lastvisit<' . S::sqlEscape($timestamp - $db_onlinetime) . ' OR (ip = ' . S::sqlEscape($guestInfo['ip']) . ' AND  lastvisit>' . S::sqlEscape($timestamp - $this->tokenTime) . ')');
         $token = rand(1, 255);
         $this->setGuestToken($token);
     } else {
         // 间隔一段时间删除过期用户,避免频繁删除导致性能下降
         if ($timestamp % 20 == 0) {
             $db->update('DELETE FROM pw_online_guest WHERE lastvisit<' . S::sqlEscape($timestamp - $db_onlinetime));
         }
         $token = $guestInfo['token'];
     }
     $pwSQL = S::sqlSingle(array('ip' => $guestInfo['ip'], 'token' => $token, 'lastvisit' => $timestamp, 'fid' => $fid, 'tid' => $tid, 'action' => $this->page_index[$wind_in], 'ifhide' => $ifhide));
     $db->update("REPLACE INTO pw_online_guest SET " . $pwSQL);
 }
Exemplo n.º 20
0
function autoban($uid)
{
    global $db, $db_banby, $db_banmax, $db_bantype, $db_banlimit, $timestamp;
    $userService = L::loadClass('UserService', 'user');
    /* @var $userService PW_UserService */
    $rt = $userService->get($uid, true, true);
    if ($rt['groupid'] == '-1' || $rt['groupid'] == '6') {
        switch ($db_banby) {
            case 1:
                $banby = $rt['postnum'];
                break;
            case 2:
                $banby = $rt['rvrc'] / 10;
                break;
            case 3:
                $banby = $rt['money'];
                break;
            default:
                $banby = $rt['postnum'];
        }
        if ($rt['groupid'] == '-1') {
            if ($banby < $db_banmax) {
                $userService->update($uid, array('groupid' => 6));
                $pwSQL = S::sqlSingle(array('uid' => $uid, 'fid' => 0, 'type' => $db_bantype, 'startdate' => $timestamp, 'days' => $db_banlimit, 'admin' => 'autoban', 'reason' => ''));
                $db->update("REPLACE INTO pw_banuser SET {$pwSQL}");
            }
        } elseif ($banby >= $db_banmax) {
            $bandb = $db->get_one("SELECT id FROM pw_banuser WHERE uid=" . S::sqlEscape($uid) . " AND fid='0'");
            if (!$bandb) {
                $userService->update($uid, array('groupid' => -1));
            } elseif ($bandb['type'] == 1 && $timestamp - $bandb['startdate'] > $bandb['days'] * 86400) {
                $userService->update($uid, array('groupid' => -1));
                $db->update("DELETE FROM pw_banuser WHERE id=" . S::sqlEscape($bandb['id']));
            }
        }
        //* $_cache = getDatastore();
        //* $_cache->delete('UID_'.$uid);
    }
}
Exemplo n.º 21
0
 function update($uploaddb)
 {
     foreach ($uploaddb as $key => $value) {
         if ($value['id']) {
             $attach = $this->db->get_one("SELECT fieldname FROM pw_pcfield WHERE fieldid=" . S::sqlEscape($value['id']));
         }
         if ($value['attname'] == 'postcate' && $attach['fieldname'] == 'pcattach') {
             $fieldname = 'pcattach';
         } else {
             $fieldname = 'field' . $value['id'];
         }
         $this->attachs[$fieldname] = $value['fileuploadurl'];
         if ($value['attname'] == 'topic') {
             $tablename = GetTopcitable($this->pcid);
         } elseif ($value['attname'] == 'postcate') {
             $tablename = GetPcatetable($this->pcid);
         }
     }
     if ($this->attachs) {
         $this->db->update("UPDATE {$tablename} SET " . S::sqlSingle($this->attachs) . " WHERE tid=" . S::sqlEscape($this->tid));
     }
     return true;
 }
Exemplo n.º 22
0
 /**
  * 构造更新的sql
  * 
  * @see S::sqlSingle
  * @access protected
  * @param array $arr 更新数据数组
  * @return string
  */
 function _getUpdateSqlString($arr)
 {
     return S::sqlSingle($arr);
 }
Exemplo n.º 23
0
 function updateData($tid)
 {
     $this->db->update("UPDATE pw_activity SET " . S::sqlSingle(array('subject' => $this->data['subject'], 'starttime' => $this->data['starttime'], 'endtime' => $this->data['endtime'], 'location' => $this->data['location'], 'num' => $this->data['num'], 'sexneed' => $this->data['sexneed'], 'costs' => $this->data['costs'], 'deadline' => $this->data['deadline'])) . " WHERE tid=" . S::sqlEscape($tid));
 }
Exemplo n.º 24
0
            Showmsg('undefined_action');
        }
        $needcur = $days * $rt['sright']['sellprice'];
        $cur = $credit->get($winduid, $rt['sright']['selltype']);
        if ($cur === false) {
            Showmsg('numerics_checkfailed');
        }
        if ($cur < $needcur) {
            Showmsg('noenough_currency');
        }
        $credit->addLog('main_buygroup', array($rt['sright']['selltype'] => -$needcur), array('uid' => $winduid, 'username' => $windid, 'ip' => $onlineip, 'gptitle' => $rt['grouptitle'], 'days' => $days));
        if (!$credit->set($winduid, $rt['sright']['selltype'], -$needcur)) {
            Showmsg('numerics_checkfailed');
        }
        $userService = L::loadClass('UserService', 'user');
        /* @var $userService PW_UserService */
        if ($options == 1) {
            if ($winddb['groupid'] == '-1') {
                $userService->update($winduid, array('groupid' => $gid));
            } else {
                $groups = $mb['groups'] ? $mb['groups'] . $winddb['groupid'] . ',' : ",{$winddb['groupid']},";
                $userService->update($winduid, array('groupid' => $gid, 'groups' => $groups));
            }
        } else {
            $groups = $mb['groups'] ? $mb['groups'] . $gid . ',' : ",{$gid},";
            $userService->update($winduid, array('groups' => $groups));
        }
        $db->pw_update("SELECT uid FROM pw_extragroups WHERE uid=" . S::sqlEscape($winduid) . " AND gid=" . S::sqlEscape($gid), "UPDATE pw_extragroups SET " . S::sqlSingle(array('togid' => $winddb['groupid'], 'startdate' => $timestamp, 'days' => $days)) . " WHERE uid=" . S::sqlEscape($winduid) . "AND gid=" . S::sqlEscape($gid), "INSERT INTO pw_extragroups SET " . S::sqlSingle(array('uid' => $winduid, 'togid' => $winddb['groupid'], 'gid' => $gid, 'startdate' => $timestamp, 'days' => $days)));
        refreshto("profile.php?action=buy", 'group_buy_success');
    }
}
Exemplo n.º 25
0
            $price = $toolinfo['price'] * $nums;
            !$toolinfo['creditype'] && ($toolinfo['creditype'] = 'currency');
            if ($credit->get($winduid, $toolinfo['creditype']) < $price) {
                $creditname = $credit->cType[$toolinfo['creditype']];
                if (array_key_exists($toolinfo['creditype'], $db_creditpay)) {
                    procUnLock('tool_buy', $winduid);
                    Showmsg('unenough_currency');
                } else {
                    procUnLock('tool_buy', $winduid);
                    Showmsg('unenough_money');
                }
            }
            $credit->addLog('hack_toolbuy', array($toolinfo['creditype'] => -$price), array('uid' => $winduid, 'username' => $windid, 'ip' => $onlineip, 'nums' => $nums, 'toolname' => $toolinfo['name']));
            $credit->set($winduid, $toolinfo['creditype'], -$price);
            $db->update("UPDATE pw_tools SET stock=stock-" . S::sqlEscape($nums) . " WHERE id=" . S::sqlEscape($id));
            $db->pw_update("SELECT uid FROM pw_usertool WHERE uid=" . S::sqlEscape($winduid) . " AND toolid=" . S::sqlEscape($id), "UPDATE pw_usertool SET nums=nums+" . S::sqlEscape($nums) . " WHERE uid=" . S::sqlEscape($winduid) . " AND toolid=" . S::sqlEscape($id), "INSERT INTO pw_usertool SET " . S::sqlSingle(array('nums' => $nums, 'uid' => $winduid, 'toolid' => $id, 'sellstatus' => $sell_status)));
            require_once R_P . 'require/tool.php';
            $logdata = array('type' => 'buy', 'nums' => $nums, 'money' => $price, 'descrip' => 'buy_descrip', 'uid' => $winduid, 'username' => $windid, 'ip' => $onlineip, 'time' => $timestamp, 'toolname' => $toolinfo['name'], 'from' => '');
            writetoollog($logdata);
            procUnLock('tool_buy', $winduid);
        }
        refreshto("profile.php?action=toolcenter", 'operate_success');
    }
} elseif ($job == 'use' || $job == 'ajax') {
    $toolid = (int) S::getGP('toolid');
    if (!$toolid) {
        $tooldb = array();
        $query = $db->query("SELECT * FROM pw_usertool u LEFT JOIN pw_tools t ON t.id=u.toolid WHERE u.uid=" . S::sqlEscape($winduid) . "ORDER BY vieworder");
        while ($rt = $db->fetch_array($query)) {
            $rt['descrip'] = substrs($rt['descrip'], 45);
            $tooldb[] = $rt;
Exemplo n.º 26
0
 function add($fieldData)
 {
     $pwSQL = S::sqlSingle($fieldData);
     return $this->_db->update("REPLACE INTO pw_banuser SET {$pwSQL}");
     //return $this->_insert($fieldData);
 }
Exemplo n.º 27
0
 function addArgument($tid)
 {
     global $timestamp;
     $this->db->update("INSERT INTO pw_argument SET " . S::sqlSingle(array('tid' => $tid, 'cyid' => $this->colonyid, 'postdate' => $timestamp, 'lastpost' => $timestamp)));
 }
Exemplo n.º 28
0
<?php

!function_exists('readover') && exit('Forbidden');
$g = $db->get_one("SELECT p.gid,p.rvalue AS allowbuy,u.grouptitle FROM pw_permission p LEFT JOIN pw_usergroups u ON p.gid=u.gid WHERE p.uid='0' AND p.fid='0' AND p.gid=" . S::sqlEscape($rt['paycredit']) . " AND p.rkey='allowbuy' AND u.gptype='special'");
if ($g && $g['allowbuy']) {
    $userService = L::loadClass('UserService', 'user');
    /* @var $userService PW_UserService */
    if ($rt['extra_1'] == 1) {
        if ($rt['groupid'] == '-1') {
            $userService->update($rt['uid'], array('groupid' => $g['gid']));
        } else {
            $groups = $rt['groups'] ? $rt['groups'] . $rt['groupid'] . ',' : ",{$rt['groupid']},";
            $userService->update($rt['uid'], array('groupid' => $g['gid'], 'groups' => $groups));
        }
    } else {
        $groups = $rt['groups'] ? $rt['groups'] . $g['gid'] . ',' : ",{$g['gid']},";
        $userService->update($rt['uid'], array('groups' => $groups));
    }
    $db->pw_update("SELECT uid FROM pw_extragroups WHERE uid=" . S::sqlEscape($rt['uid']) . " AND gid=" . S::sqlEscape($g['gid']), "UPDATE pw_extragroups SET " . S::sqlSingle(array('togid' => $rt['groupid'], 'startdate' => $timestamp, 'days' => $rt['number'])) . " WHERE uid=" . S::sqlEscape($rt['uid']) . " AND gid=" . S::sqlEscape($g['gid']), "INSERT INTO pw_extragroups SET " . S::sqlSingle(array('uid' => $rt['uid'], 'togid' => $rt['groupid'], 'gid' => $g['gid'], 'startdate' => $timestamp, 'days' => $rt['number'])));
    M::sendNotice(array($rt['username']), array('title' => getLangInfo('writemsg', 'groupbuy_title'), 'content' => getLangInfo('writemsg', 'groupbuy_content', array('fee' => $fee, 'gname' => $g['grouptitle'], 'number' => $rt['number']))));
    $ret_url = 'profile.php?action=buy';
}
Exemplo n.º 29
0
 function jobRewardInviteCode($userid, $reward)
 {
     $timestamp = $this->_timestamp;
     $invnum = $reward['num'];
     $day = $reward['day'];
     for ($i = 0; $i < $invnum; $i++) {
         $invcode = randstr(16);
         $this->_db->update("INSERT INTO pw_invitecode" . " SET " . S::sqlSingle(array('invcode' => $invcode, 'uid' => $userid, 'usetime' => $day, 'createtime' => $timestamp)));
     }
 }
Exemplo n.º 30
0
 function insert($tid)
 {
     $sql = $upids = $tagids = array();
     foreach ($this->tags as $key => $value) {
         if (!$value) {
             continue;
         }
         $rt = $this->db->get_one("SELECT tagid FROM pw_tags WHERE tagname=" . S::sqlEscape($value));
         if (!$rt) {
             $this->db->update("INSERT INTO pw_tags SET " . S::sqlSingle(array('tagname' => $value, 'num' => 1)));
             $tagid = $this->db->insert_id();
         } else {
             $tagid = $rt['tagid'];
             $upids[] = $tagid;
         }
         $sql[] = array($tagid, $tid);
         $tagids[] = $tagid;
     }
     if ($upids) {
         $this->db->update("UPDATE pw_tags SET num=num+1 WHERE tagid IN(" . S::sqlImplode($upids) . ')');
     }
     if ($sql) {
         $this->db->update("INSERT INTO pw_tagdata (tagid,tid) VALUES " . S::sqlMulti($sql));
     }
     if ($tagids) {
         $statistics = L::loadClass('Statistics', 'datanalyse');
         $statistics->addtag($tagids);
     }
 }