コード例 #1
0
ファイル: tags.php プロジェクト: kimblemj/server
 public static function deleteTag($pack)
 {
     $pack->auth->game_id = dbconnection::queryObject("SELECT * FROM tags WHERE tag_id = '{$pack->tag_id}'")->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM tags WHERE tag_id = '{$pack->tag_id}' LIMIT 1");
     //cleanup
     $tags = dbconnection::queryArray("SELECT * FROM object_tags WHERE tag_id = '{$pack->tag_id}'");
     for ($i = 0; $i < count($tags); $i++) {
         $pack->object_tag_id = $tags[$i]->object_tag_id;
         tags::deleteObjectTag($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_HAS_TAGGED_ITEM' AND content_id = '{$pack->tag_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'GAME_HAS_TAGGED_ITEM' AND content_id = '{$pack->tag_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_HAS_NOTE_WITH_TAG' AND content_id = '{$pack->tag_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
コード例 #2
0
ファイル: web_pages.php プロジェクト: kimblemj/server
 public static function deleteWebPage($pack)
 {
     $webpage = dbconnection::queryObject("SELECT * FROM web_pages WHERE web_page_id = '{$pack->web_page_id}'");
     $pack->auth->game_id = $webpage->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM web_pages WHERE web_page_id = '{$pack->web_page_id}' LIMIT 1");
     //cleanup
     $options = dbconnection::queryArray("SELECT * FROM dialog_options WHERE link_type = 'EXIT_TO_WEB_PAGE' AND link_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($options); $i++) {
         $pack->dialog_option_id = $options[$i]->dialog_option_id;
         dialogs::deleteDialogOption($pack);
     }
     $tabs = dbconnection::queryArray("SELECT * FROM tabs WHERE type = 'WEB_PAGE' AND content_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($tabs); $i++) {
         $pack->tab_id = $tabs[$i]->tab_id;
         tabs::deleteTab($pack);
     }
     $tags = dbconnection::queryArray("SELECT * FROM object_tags WHERE object_type = 'WEB_PAGE' AND object_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($tags); $i++) {
         $pack->object_tag_id = $tags[$i]->object_tag_id;
         tags::deleteObjectTag($pack);
     }
     $instances = dbconnection::queryArray("SELECT * FROM instances WHERE object_type = 'WEB_PAGE' AND object_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($instances); $i++) {
         $pack->instance_id = $instances[$i]->instance_id;
         instances::deleteInstance($pack);
     }
     $factories = dbconnection::queryArray("SELECT * FROM factories WHERE object_type = 'WEB_PAGE' AND object_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($factories); $i++) {
         $pack->factory_id = $factories[$i]->factory_id;
         factories::deleteFactory($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_VIEWED_WEB_PAGE' AND content_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
コード例 #3
0
ファイル: plaques.php プロジェクト: kimblemj/server
 public static function deletePlaque($pack)
 {
     $plaque = dbconnection::queryObject("SELECT * FROM plaques WHERE plaque_id = '{$pack->plaque_id}'");
     $pack->auth->game_id = $plaque->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM plaques WHERE plaque_id = '{$pack->plaque_id}' LIMIT 1");
     //cleanup
     /* Comment out until we've decided on desired behavior...
        $eventpack = dbconnection::queryObject("SELECT * FROM event_packages WHERE event_package_id = '{$plaque->event_package_id}'");
        if($eventpack)
        {
            $pack->event_package_id = $eventpack->event_package_id;
            events::deleteEventPackage($pack);
        }
        */
     $options = dbconnection::queryArray("SELECT * FROM dialog_options WHERE link_type = 'EXIT_TO_PLAQUE' AND link_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($options); $i++) {
         $pack->dialog_option_id = $options[$i]->dialog_option_id;
         dialogs::deleteDialogOption($pack);
     }
     $tabs = dbconnection::queryArray("SELECT * FROM tabs WHERE type = 'PLAQUE' AND content_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($tabs); $i++) {
         $pack->tab_id = $tabs[$i]->tab_id;
         tabs::deleteTab($pack);
     }
     $tags = dbconnection::queryArray("SELECT * FROM object_tags WHERE object_type = 'PLAQUE' AND object_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($tags); $i++) {
         $pack->object_tag_id = $tags[$i]->object_tag_id;
         tags::deleteObjectTag($pack);
     }
     $instances = dbconnection::queryArray("SELECT * FROM instances WHERE object_type = 'PLAQUE' AND object_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($instances); $i++) {
         $pack->instance_id = $instances[$i]->instance_id;
         instances::deleteInstance($pack);
     }
     $factories = dbconnection::queryArray("SELECT * FROM factories WHERE object_type = 'PLAQUE' AND object_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($factories); $i++) {
         $pack->factory_id = $factories[$i]->factory_id;
         factories::deleteFactory($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_VIEWED_PLAQUE' AND content_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }