и да, создатель компонента молчит)
файл flirtiki\model.php
<?php class modelFlirtiki extends cmsModel{ private $options; public function __construct() { parent::__construct(); $this->options = cmsController::loadOptions('flirtiki'); } public function getFlirtiks($user_id = false, $id = false){ if ($user_id) { return $this->getItemByField('flirtiki', 'komu', $user_id); } if ($id) { return $this->getItemById('flirtiki', $id); } return $this->get('flirtiki'); } public function getFlirtiksCount($user_id = false, $reset = true) { $count = $user_id ? $this->filterEqual('i.komu', $user_id)->getCount('flirtiki') : $this->getCount('flirtiki'); if ($reset) { $this->resetFilters(); } return $count; } public function getStartUsers($my_id, $my_gender, $only_one_user = false){ $this->filterEqual('i.gender', ($my_gender == 1) ? 2 : 1); $this->getUserExisys($my_id); $this->order_by = 'rand()'; return $only_one_user ? $this->getItem('cms_users') : $this->get('cms_users');; } public function get12Users($sender, $my_gender, $my_id){ $this->getUserExisys($my_id, 'end'); $this->filterNotEqual('i.id', $sender)->filterEqual('i.gender', ($my_gender == 1) ? 2 : 1); if($this->options['no_avatar']) { $this->filterNotNull('i.avatar'); } $this->getUserUnion($sender, ($my_gender == 1) ? 2 : 1); return $this->selectOnly('i.id, i.nickname, i.avatar, i.gender')->get('cms_users'); } public function getUserExisys($my_id, $and = 'start'){ if ($and == 'start'){ $this->filterIsNull('i.is_deleted'); $this->where .= " AND "; } $this->where .= "i.id NOT IN (SELECT ot_kogo FROM {$this->db->prefix}flirtiki WHERE komu= {$my_id}) AND i.id NOT IN (SELECT komu FROM {$this->db->prefix}flirtiki WHERE ot_kogo={$my_id})"; if ($and == 'end'){ $this->where .= " AND "; $this->filterIsNull('i.is_deleted'); } return $this; } public function getUserUnion($sender, $my_gender){ $this->where .= " LIMIT 0, 11 UNION SELECT i.id, i.nickname, i.avatar, i.gender FROM {$this->db->prefix}users i WHERE (i.id = {$sender}) AND (i.gender = {$my_gender}) ORDER BY RAND() "; return $this; } public function sendFlirtik($data) { return $this->insert('flirtiki', $data); } public function updateFlirtik($id, $data) { return $this->update('flirtiki', $id, $data); } public function updateTry($id, $try) { if($try > 0) { } else { } } public function deleteFlirtik($id) { return $this->delete('flirtiki', $id); } public function getCities() { return $this->useCache('geo.cities')->get('geo_cities'); } public function isFiltered($city_id = false, $from = false, $to = false) { if ($city_id){ $this->filterEqual('i.city', $city_id); } if ($from){ } if ($to){ } return $this; } public function deleteFlirt($id) { return $this->delete('flirtiki', $id); } public function deleteController($id){ $this->db->dropTable('flirtiki'); $this->filterEqual('url', '{flirtiki:my}')->deleteFiltered('menu_items'); $this->filterEqual('controller', 'flirtiki')->deleteFiltered('users_tabs'); $this->filterEqual('controller', 'flirtiki')->deleteFiltered('activity_types'); return parent::deleteController($id); } } ?>