|
|
@ -102,17 +102,16 @@ class AddPointsController extends Zend_Controller_Action
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Fix the assurer flag
|
|
|
|
// Fix the assurer flag
|
|
|
|
$where = array();
|
|
|
|
$query = 'UPDATE `users` SET `assurer` = 1 WHERE `users`.`id` = :user AND '.
|
|
|
|
$query = '`users`.`id` = ?';
|
|
|
|
|
|
|
|
$where[] = $this->db->quoteInto($query, $user['id']);
|
|
|
|
'EXISTS(SELECT * FROM `cats_passed` AS `cp`, `cats_variant` AS `cv` '.
|
|
|
|
$query = 'exists(select * from `cats_passed` as `cp`, ' .
|
|
|
|
'WHERE `cp`.`variant_id` = `cv`.`id` AND `cv`.`type_id` = 1 AND '.
|
|
|
|
'`cats_variant` as `cv` where `cp`.`variant_id` = `cv`.`id` and ' .
|
|
|
|
'`cp`.`user_id` = :user) AND '.
|
|
|
|
'`cv`.`type_id` = 1 and `cp`.`user_id` = ?';
|
|
|
|
|
|
|
|
$where[] = $this->db->quoteInto($query, $user['id']);
|
|
|
|
'(SELECT SUM(`points`) FROM `notary` WHERE `to` = :user AND '.
|
|
|
|
$query = '(select sum(`points`) from `notary` where `to`= ? and ' .
|
|
|
|
'`expire` < now()) >= 100';
|
|
|
|
'`expire` > now()) >= 100';
|
|
|
|
$query_params['user'] = $user['id'];
|
|
|
|
$where[] = $this->db->quoteInto($query, $user['id']);
|
|
|
|
$this->db->query($query, $query_params);
|
|
|
|
$this->db->update('users', array('assurer' => 1), $where);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|