function gui_abort_instance($user, $activityId, $instanceId) { // Users can only abort instances they're currently running, or instances that they're the owner of if (!$this->getOne("select count(*)\n from " . GALAXIA_TABLE_PREFIX . "instance_activities gia, " . GALAXIA_TABLE_PREFIX . "instances gi\n where gia.instanceId=gi.instanceId and activityId=? and gia.instanceId=? and (user=? or owner=?)", array($activityId, $instanceId, $user, $user))) { return false; } include_once GALAXIA_LIBRARY . '/src/API/Instance.php'; $instance = new Instance($this->db); $instance->getInstance($instanceId); if (!empty($instance->instanceId)) { $instance->abort($activityId, $user); } unset($instance); }
function gui_abort_instance($user_id, $activity_id, $instance_id) { // Users can only abort instances they're currently running, or instances that they're the owner of if (!$this->mDb->getOne("select count(*)\n from `" . GALAXIA_TABLE_PREFIX . "instance_activities` gia\n INNER JOIN `" . GALAXIA_TABLE_PREFIX . "instances` gi ON gi.`instance_id`=gia.`instance_id`\n where `activity_id`=? and gia.`instance_id`=? and (gia.`user_id`=? or gi.`owner_id`=?)", array($activity_id, $instance_id, $user_id, $user_id))) { return false; } include_once GALAXIA_LIBRARY . '/src/API/Instance.php'; $instance = new Instance(); $instance->getInstance($instance_id); if (!empty($instance->instance_id)) { $instance->abort($activity_id, $user_id); } unset($instance); }