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_post_edit_bot($params) { if (user()->own_bot($params['values']['id'])) { BOT::withRow($params['values'])->update($params['values']); user()->bots(true); header('Location: ' . view('bot_management', $params)); die; } }