Exemplo n.º 1
0
function updateOurOptions($values)
{
    global $vbulletin;
    $changed = false;
    if (!isset($vbulletin->kbank_options[$key])) {
        $vbulletin->kbank_options = array();
    }
    //safe procedure
    foreach ($values as $key => $value) {
        if (!isset($vbulletin->kbank['ouroptions'][$key]) or $vbulletin->kbank['ouroptions'][$key] != $value) {
            $changed = true;
            $vbulletin->kbank_options[$key] = $value;
            $vbulletin->kbank['ouroptions'][$key] = $value;
        }
    }
    if ($changed) {
        write_datastore('options', $vbulletin->kbank['ouroptions']);
    }
}
Exemplo n.º 2
0
 }
 //Top give award (by times and by amount). kBank Admin Only
 if ($name == 'topaward' or $name == 'topawardamount') {
     $cache = read_datastore($name);
     if ($cache['datetime'] < TIMENOW - $hour2update[$name] * 60 * 60 or $_GET['force'] == $vbulletin->kbank['force']) {
         $query_adminid = "SUBSTR(donate.comment,LOCATE('\"',donate.comment,19) + 1,LOCATE('\"',donate.comment,LOCATE('\"',donate.comment,19) + 1) - (LOCATE('\"',comment,19) + 1))";
         $tops_cache = $vbulletin->db->query_read("\n\t\t\t\tSELECT \n\t\t\t\t\t{$query_adminid} AS userid\n\t\t\t\t\t,user.username AS username\n\t\t\t\t\t,COUNT(*) AS count\n\t\t\t\t\t,SUM(ABS(donate.amount)) AS total\n\t\t\t\tFROM `" . TABLE_PREFIX . "kbank_donations` AS donate\n\t\t\t\tINNER JOIN `" . TABLE_PREFIX . "user` AS user ON (user.userid = {$query_adminid})\n\t\t\t\tWHERE donate.postid <> 0\n\t\t\t\t\tAND donate.from = 0\n\t\t\t\tGROUP BY userid\n\t\t\t\tORDER BY " . iif($name == 'topaward', 'count', 'total') . " DESC, " . iif($name == 'topaward', 'total', 'count') . " DESC\n\t\t\t");
         $tops = array();
         while ($top = $vbulletin->db->fetch_array($tops_cache)) {
             $tops[] = $top;
         }
         unset($top);
         $vbulletin->db->free_result($tops_cache);
         topChanges($tops, $cache['tops']);
         $cache = array('datetime' => TIMENOW, 'tops' => $tops);
         write_datastore($name, $cache);
     } else {
         $tops = $cache['tops'];
     }
     $top_message = array();
     foreach ($tops as $top) {
         $top_message[] = construct_phrase($vbphrase['kbank_misc_topaward_bit'], GetUsername($top, 'search.php?do=findawardedby&userid='), vb_number_format($top['count']), vb_number_format($top['total'], $vbulletin->kbank['roundup']), $vbulletin->kbank['name']) . topChangeDisplay($top);
     }
 }
 //List all available top
 if (isset($_GET[$vbulletin->kbank['url_varname']]) and !$top_message or $_GET['do'] == $vbulletin->kbank['url_varname']) {
     $url_prefix = $vbulletin->kbank['phpfile'] . "?{$session['sessionurl']}top=";
     $top_message = "<strong>{$vbphrase['kbank_misc_top']}</strong>\n\t\t\t<ul>";
     foreach (array_keys($hour2update) as $type) {
         if (in_array($type, $kBankAdminOnly)) {
             //This type is only for kBank Admin, skip