public static function by_user($user_id) { $query = db()->query("SELECT * FROM bots, bot_user WHERE bots.id=bot_user.bot_id AND bot_user.user_id=" . db()->quote($user_id) . " ORDER BY name") or die(dberror()); $array = array(); while ($data = $query->fetch()) { $array[$data['id']] = BOT::withRow($data); } return $array; }
function action_get_delete_bot($params) { if (user()->right() == 'ADMIN') { BOT::withID($params['values'][0])->delete(); } else { user()->delete_bot($params['values'][0]); } header('Location: ' . view('bot_management', $params)); die; }
public function create_bot($name, $host, $port, $password) { $this->bots = false; BOT::create($name, $host, $port, $password, $this->id); }