Example #1
0
 public static function deleteInstance($pack)
 {
     $pack->auth->game_id = dbconnection::queryObject("SELECT * FROM instances WHERE instance_id = '{$pack->instance_id}'")->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     games::bumpGameVersion($pack);
     return instances::noauth_deleteInstance($pack);
 }
Example #2
0
 public static function logPlayerViewedInstance($pack)
 {
     $pack->auth->permission = "read_write";
     if (!users::authenticateUser($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     $instance = dbconnection::queryObject("SELECT * FROM instances WHERE instance_id = '{$pack->instance_id}';");
     if ($instance->factory_id) {
         $factory = dbconnection::queryObject("SELECT * FROM factories WHERE factory_id = '{$instance->factory_id}';");
         if ($factory->produce_expire_on_view) {
             instances::noauth_deleteInstance($instance);
         }
     }
     dbconnection::queryInsert("INSERT INTO user_log (user_id, game_id, event_type, content_id, created) VALUES ('{$pack->auth->user_id}', '{$pack->game_id}', 'VIEW_INSTANCE', '{$pack->instance_id}', CURRENT_TIMESTAMP);");
     return new return_package(0);
 }
Example #3
0
 public static function noauth_deleteTrigger($pack)
 {
     //and this "fixes" the security risk...
     if (strpos($_SERVER['REQUEST_URI'], 'noauth') !== false) {
         return new return_package(6, NULL, "Attempt to bypass authentication externally.");
     }
     dbconnection::query("DELETE FROM triggers WHERE trigger_id = '{$pack->trigger_id}' LIMIT 1");
     //cleanup
     $instances = dbconnection::queryArray("SELECT * FROM instances WHERE instance_id = '{$trigger->instance_id}'");
     for ($i = 0; $i < count($instances); $i++) {
         $pack->instance_id = $instances[$i]->instance_id;
         instances::noauth_deleteInstance($pack);
     }
     $reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$trigger->requirement_root_package_id}'");
     if ($reqPack) {
         $pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
         requirements::noauth_deleteRequirementPackage($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }