function updateusercredit($uid, $type, $level) { $uid = intval($uid); if (!$uid || !in_array($type, array('buyercredit', 'sellercredit')) || !in_array($level, array('good', 'soso', 'bad'))) { return; } if ($cache = C::t('forum_spacecache')->fetch($uid, $type)) { $expiration = $cache['expiration']; $cache = dunserialize($cache['value']); } else { $init = array('good' => 0, 'soso' => 0, 'bad' => 0, 'total' => 0); $cache = array('all' => $init, 'before' => $init, 'halfyear' => $init, 'thismonth' => $init, 'thisweek' => $init); $expiration = getexpiration(); } foreach (array('all', 'before', 'halfyear', 'thismonth', 'thisweek') as $key) { $cache[$key][$level]++; $cache[$key]['total']++; } C::t('forum_spacecache')->insert(array('uid' => $uid, 'variable' => $type, 'value' => serialize($cache), 'expiration' => $expiration), false, true); $score = $level == 'good' ? 1 : ($level == 'soso' ? 0 : -1); C::t('common_member_status')->increase($uid, array($type => $score)); }
function updateusercredit($uid, $type, $level) { $uid = intval($uid); if (!$uid || !in_array($type, array('buyercredit', 'sellercredit')) || !in_array($level, array('good', 'soso', 'bad'))) { return; } if ($cache = DB::fetch_first("SELECT value, expiration FROM " . DB::table('forum_spacecache') . " WHERE uid='{$uid}' AND variable='{$type}'")) { $expiration = $cache['expiration']; $cache = unserialize($cache['value']); } else { $init = array('good' => 0, 'soso' => 0, 'bad' => 0, 'total' => 0); $cache = array('all' => $init, 'before' => $init, 'halfyear' => $init, 'thismonth' => $init, 'thisweek' => $init); $expiration = getexpiration(); } foreach (array('all', 'before', 'halfyear', 'thismonth', 'thisweek') as $key) { $cache[$key][$level]++; $cache[$key]['total']++; } DB::query("REPLACE INTO " . DB::table('forum_spacecache') . " (uid, variable, value, expiration) VALUES ('{$uid}', '{$type}', '" . addslashes(serialize($cache)) . "', '{$expiration}')"); $score = $level == 'good' ? 1 : ($level == 'soso' ? 0 : -1); DB::query("UPDATE " . DB::table('common_member_status') . " SET {$type}={$type}+({$score}) WHERE uid='{$uid}'"); }
function updateusercredit($uid, $type, $level) { global $timestamp, $db, $tablepre; $uid = intval($uid); if (!$uid || !in_array($type, array('buyercredit', 'sellercredit')) || !in_array($level, array('good', 'soso', 'bad'))) { return; } $query = $db->query("SELECT value, expiration FROM {$tablepre}spacecaches WHERE uid='{$uid}' AND variable='{$type}'"); if ($cache = $db->fetch_array($query)) { $expiration = $cache['expiration']; $cache = unserialize($cache['value']); } else { $init = array('good' => 0, 'soso' => 0, 'bad' => 0, 'total' => 0); $cache = array('all' => $init, 'before' => $init, 'halfyear' => $init, 'thismonth' => $init, 'thisweek' => $init); $expiration = getexpiration(); } foreach (array('all', 'before', 'halfyear', 'thismonth', 'thisweek') as $key) { $cache[$key][$level]++; $cache[$key]['total']++; } $db->query("REPLACE INTO {$tablepre}spacecaches (uid, variable, value, expiration) VALUES ('{$uid}', '{$type}', '" . addslashes(serialize($cache)) . "', '{$expiration}')"); $score = $level == 'good' ? 1 : ($level == 'soso' ? 0 : -1); $db->query("UPDATE {$tablepre}memberfields SET {$type}={$type}+({$score}) WHERE uid='{$uid}'"); }
if ($e_month == $s_month) { $wheresql = "sf.birthmonth='{$s_month}' AND sf.birthday>='{$s_day}' AND sf.birthday<='{$e_day}'"; } else { $wheresql = "(sf.birthmonth='{$s_month}' AND sf.birthday>='{$s_day}') OR (sf.birthmonth='{$e_month}' AND sf.birthday<='{$e_day}' AND sf.birthday>'0')"; } $query = DB::query("SELECT sf.uid,sf.birthyear,sf.birthmonth,sf.birthday,s.username\r\n\t\t\t\tFROM " . DB::table('common_member_profile') . " sf\r\n\t\t\t\tLEFT JOIN " . DB::table('common_member') . " s USING(uid)\r\n\t\t\t\tWHERE (sf.uid IN ({$space['feedfriend']})) AND ({$wheresql})"); while ($value = DB::fetch($query)) { $value['istoday'] = 0; if ($value['birthmonth'] == $n_month && $value['birthday'] == $n_day) { $value['istoday'] = 1; } $key = sprintf("%02d", $value['birthmonth']) . sprintf("%02d", $value['birthday']); $birthlist[$key][] = $value; ksort($birthlist); } DB::query("REPLACE INTO " . DB::table('forum_spacecache') . " (uid, variable, value, expiration) VALUES ('{$_G['uid']}', 'birthday', '" . addslashes(serialize($birthlist)) . "', '" . getexpiration() . "')"); } else { $birthlist = unserialize($birthdaycache['value']); } } if ($_G['setting']['taskon']) { require_once libfile('class/task'); $tasklib =& task::instance(); $taskarr = $tasklib->tasklist('canapply'); $task = $taskarr[array_rand($taskarr)]; } if ($_G['setting']['magicstatus']) { loadcache('magics'); if (!empty($_G['cache']['magics'])) { $magic = $_G['cache']['magics'][array_rand($_G['cache']['magics'])]; $magic['description'] = cutstr($magic['description'], 34, '');
$value['uid'] = $value['fuid']; $value['username'] = $value['fusername']; if (empty($oluids[$value['uid']])) { $olfriendlist[$value['uid']] = $value; $olfcount++; if ($olfcount == 15) { break; } } } } if ($space['feedfriend']) { $birthdaycache = C::t('forum_spacecache')->fetch($_G['uid'], 'birthday'); if (empty($birthdaycache) || TIMESTAMP > $birthdaycache['expiration']) { $birthlist = C::t('common_member_profile')->fetch_all_will_birthday_by_uid($space['feedfriend']); C::t('forum_spacecache')->insert(array('uid' => $_G['uid'], 'variable' => 'birthday', 'value' => serialize($birthlist), 'expiration' => getexpiration()), false, true); } else { $birthlist = dunserialize($birthdaycache['value']); } } if ($_G['setting']['taskon']) { require_once libfile('class/task'); $tasklib =& task::instance(); $taskarr = $tasklib->tasklist('canapply'); $task = $taskarr[array_rand($taskarr)]; } if ($_G['setting']['magicstatus']) { loadcache('magics'); if (!empty($_G['cache']['magics'])) { $magic = $_G['cache']['magics'][array_rand($_G['cache']['magics'])]; $magic['description'] = cutstr($magic['description'], 34, '');