Пример #1
0
 public static function insertEntry($siteid, $score, $usercount, $challcount, $comment = '')
 {
     $entry = new self(array('sitehist_sid' => $siteid, 'sitehist_date' => time(), 'sitehist_score' => $score, 'sitehist_usercount' => $usercount, 'sitehist_challcount' => $challcount, 'sitehist_comment' => $comment));
     if (WECHALL_DEBUG_SCORING) {
         echo WC_HTML::message('Inserting Site History Item...');
     }
     return $entry->insert();
 }
Пример #2
0
 public static function insertEntry(GWF_User $user, WC_Site $site, $onsitescore, $comment)
 {
     $user = GWF_User::getByID($user->getID());
     $max = $site->getOnsiteScore();
     $perc = $max <= 0 ? 0 : round($onsitescore / $max * 10000);
     $entry = new self(array('userhist_uid' => $user->getVar('user_id'), 'userhist_date' => time(), 'userhist_sid' => $site->getVar('site_id'), 'userhist_percent' => $perc, 'userhist_onsitescore' => $onsitescore, 'userhist_rank' => WC_RegAt::calcRank($user), 'userhist_totalscore' => $user->getVar('user_level'), 'userhist_comment' => $comment));
     if (WECHALL_DEBUG_SCORING) {
         echo WC_HTML::message('Inserting User History entry...');
     }
     return $entry->insert();
 }
Пример #3
0
 public static function insertEntry(GWF_User $user, WC_Site $site, $type, $onsitescore_new = 0, $onsitescore_old = 0, $scoregain = 0, $onsiterank = 0)
 {
     $uid = $user->getID();
     $user = GWF_User::getByID($uid);
     $max = $site->getOnsiteScore();
     $perc_new = $max <= 0 ? 0 : round($onsitescore_new / $max * 10000);
     $perc_old = $max <= 0 ? 0 : round($onsitescore_old / $max * 10000);
     $perc_gain = $perc_new - $perc_old;
     $options = 0;
     $data = $user->getUserData();
     if (isset($data['WC_NO_XSS'])) {
         $options |= self::NO_XSS;
     }
     $entry = new self(array('userhist_uid' => $uid, 'userhist_date' => time(), 'userhist_sid' => $site->getID(), 'userhist_percent' => $perc_new, 'userhist_onsitescore' => $onsitescore_new, 'userhist_rank' => WC_RegAt::calcExactRank($user), 'userhist_totalscore' => $user->getVar('user_level'), 'userhist_gain_perc' => $perc_gain, 'userhist_gain_score' => $scoregain, 'userhist_type' => $type, 'userhist_onsiterank' => $onsiterank, 'userhist_options' => $options));
     if (WECHALL_DEBUG_SCORING) {
         echo WC_HTML::message('Inserting User History entry...');
     }
     return $entry->insert();
 }
Пример #4
0
 /**
  * Recalc and update all scores for this site.
  * @return void
  */
 public function recalcSite()
 {
     require_once 'WC_RegAt.php';
     if (WECHALL_DEBUG_SCORING) {
         echo WC_HTML::message('msg_site_recalc', array($this->displayName()));
     }
     $this->recalcAverage();
     $this->recalcScore();
     WC_RegAt::calcSite($this);
     WC_RegAt::calcTotalscores();
 }