本文整理汇总了PHP中dbconnection::queryObject方法的典型用法代码示例。如果您正苦于以下问题:PHP dbconnection::queryObject方法的具体用法?PHP dbconnection::queryObject怎么用?PHP dbconnection::queryObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dbconnection
的用法示例。
在下文中一共展示了dbconnection::queryObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteScene
public static function deleteScene($pack)
{
$pack->auth->game_id = dbconnection::queryObject("SELECT * FROM scenes WHERE scene_id = '{$pack->scene_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 scenes WHERE scene_id = '{$pack->scene_id}' LIMIT 1");
//cleanup
$s = dbconnection::queryObject("SELECT * FROM scenes WHERE game_id = '{$pack->game_id}' LIMIT 1");
$s_id = $s ? $s->scene_id : 0;
dbconnection::query("UPDATE games SET intro_scene_id = '{$s_id}' WHERE intro_scene_id = '{$pack->scene_id}'");
$triggers = dbconnection::queryArray("SELECT * FROM triggers WHERE scene_id = '{$pack->scene_id}'");
for ($i = 0; $i < count($triggers); $i++) {
$pack->trigger_id = $triggers[$i]->trigger_id;
triggers::deleteTrigger($pack);
}
$instances = dbconnection::queryArray("SELECT * FROM instances WHERE object_type = 'SCENE' AND object_id = '{$pack->scene_id}'");
for ($i = 0; $i < count($instances); $i++) {
$pack->instance_id = $instances[$i]->instance_id;
instances::deleteInstance($pack);
}
games::bumpGameVersion($pack);
return new return_package(0);
}
示例2: getColors
public static function getColors($pack)
{
$sql_colors = dbconnection::queryObject("SELECT * FROM colors WHERE colors_id = '{$pack->colors_id}' LIMIT 1");
if (!$sql_colors) {
return new return_package(2, NULL, "The colors you've requested do not exist");
}
return new return_package(0, colors::colorsObjectFromSQL($sql_colors));
}
示例3: deleteItem
public static function deleteItem($pack)
{
$item = dbconnection::queryObject("SELECT * FROM items WHERE item_id = '{$pack->item_id}'");
$pack->auth->game_id = $item->game_id;
$pack->auth->permission = "read_write";
if (!editors::authenticateGameEditor($pack->auth)) {
return new return_package(6, NULL, "Failed Authentication");
}
dbconnection::query("DELETE FROM items WHERE item_id = '{$pack->item_id}' LIMIT 1");
//cleanup
$options = dbconnection::queryArray("SELECT * FROM dialog_options WHERE link_type = 'EXIT_TO_ITEM' AND link_id = '{$pack->item_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 = 'ITEM' AND content_id = '{$pack->item_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 = 'ITEM' AND object_id = '{$pack->item_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 = 'ITEM' AND object_id = '{$pack->item_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 = 'ITEM' AND object_id = '{$pack->item_id}'");
for ($i = 0; $i < count($factories); $i++) {
$pack->factory_id = $factories[$i]->factory_id;
factories::deleteFactory($pack);
}
$events = dbconnection::queryArray("SELECT * FROM events WHERE (event = 'GIVE_ITEM_PLAYER' OR event = 'TAKE_ITEM_PLAYER' OR event = 'GIVE_ITEM_GAME' OR event = 'TAKE_ITEM_GAME') AND content_id = '{$pack->item_id}'");
for ($i = 0; $i < count($events); $i++) {
$pack->event_id = $events[$i]->event_id;
events::deleteEvent($pack);
}
$reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_VIEWED_ITEM' AND content_id = '{$pack->item_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_ITEM' AND content_id = '{$pack->item_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_ITEM' AND content_id = '{$pack->item_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);
}
示例4: authenticateGameEditor
public static function authenticateGameEditor($pack)
{
if (!users::authenticateUser($pack)) {
return false;
}
if (dbconnection::queryObject("SELECT * FROM user_games WHERE user_id = '{$pack->user_id}' AND game_id = '{$pack->game_id}'")) {
return true;
}
util::errorLog("Failed Game Editor Authentication!");
return false;
}
示例5: deletePlaque
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);
}
示例6: deleteGroup
public static function deleteGroup($pack)
{
$group = dbconnection::queryObject("SELECT * FROM groups WHERE group_id = '{$pack->group_id}'");
$pack->auth->game_id = $group->game_id;
$pack->auth->permission = "read_write";
if (!editors::authenticateGameEditor($pack->auth)) {
return new return_package(6, NULL, "Failed Authentication");
}
dbconnection::query("DELETE FROM groups WHERE group_id = '{$pack->group_id}' LIMIT 1");
//cleanup
dbconnection::query("UPDATE game_user_groups SET group_id = 0 WHERE game_id = '{$group->game_id}' AND group_id = '{$group->group_id}';");
games::bumpGameVersion($pack);
return new return_package(0);
}
示例7: deleteNoteComment
public static function deleteNoteComment($pack)
{
$note_comment = dbconnection::queryObject("SELECT * FROM note_comments WHERE note_comment_id = '{$pack->note_comment_id}'");
$note = dbconnection::queryObject("SELECT * FROM notes WHERE note_id = '{$note_comment->note_id}'");
$pack->auth->game_id = $note_comment->game_id;
$pack->auth->permission = "read_write";
//tl;dr: must be game owner, note owner, or comment owner to delete comment
if (!(users::authenticateUser($pack->auth) && ($pack->auth->user_id == $note_comment->user_id || $pack->auth->user_id == $note->user_id)) && !editors::authenticateGameEditor($pack->auth)) {
return new return_package(6, NULL, "Failed Authentication");
}
dbconnection::query("DELETE FROM note_comments WHERE note_comment_id = '{$pack->note_comment_id}' LIMIT 1");
games::bumpGameVersion($pack);
return new return_package(0);
}
示例8: deleteOverlay
public static function deleteOverlay($pack)
{
$overlay = dbconnection::queryObject("SELECT * FROM overlays WHERE overlay_id = '{$pack->overlay_id}'");
$pack->auth->game_id = $overlay->game_id;
$pack->auth->permission = "read_write";
if (!editors::authenticateGameEditor($pack->auth)) {
return new return_package(6, NULL, "Failed Authentication");
}
dbconnection::query("DELETE FROM overlays WHERE overlay_id = '{$pack->overlay_id}' LIMIT 1");
//cleanup
$reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$overlay->requirement_root_package_id}'");
if ($reqPack) {
$pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
requirements::deleteRequirementPackage($pack);
}
games::bumpGameVersion($pack);
return new return_package(0);
}
示例9: getLeaderboard
public static function getLeaderboard($pack)
{
$insts = dbconnection::queryArray("SELECT * FROM instances WHERE game_id = '{$pack->game_id}' AND object_type = 'ITEM' AND object_id = '{$pack->item_id}' AND owner_type = 'USER' ORDER BY qty DESC LIMIT 10;");
$entries = array();
for ($i = 0; $i < count($insts); $i++) {
$inst = $insts[$i];
$user = dbconnection::queryObject("SELECT * FROM users WHERE user_id = '{$inst->owner_id}';");
$entries[$i] = new stdClass();
$entries[$i]->qty = $inst->qty;
if ($user) {
$entries[$i]->user_id = $user->user_id;
$entries[$i]->user_name = $user->user_name;
$entries[$i]->display_name = $user->display_name;
} else {
$entries[$i]->user_id = 0;
$entries[$i]->user_name = "(user not found)";
$entries[$i]->display_name = "(user not found)";
}
}
return new return_package(0, $entries);
}
示例10: deleteWebHook
public static function deleteWebHook($pack)
{
$webhook = dbconnection::queryObject("SELECT * FROM web_hooks WHERE web_hook_id = '{$pack->web_hook_id}'");
$pack->auth->game_id = $webhook->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_hooks WHERE web_hook_id = '{$pack->web_hook_id}' LIMIT 1");
//cleanup
$reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$webhook->requirement_root_package_id}'");
if ($reqPack) {
$pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
requirements::deleteRequirementPackage($pack);
}
$reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_HAS_RECEIVED_INCOMING_WEB_HOOK' AND content_id = '{$pack->web_hook_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);
}
示例11: getFullGame
public static function getFullGame($pack)
{
$pack->auth->permission = "read_write";
if (!users::authenticateUser($pack->auth)) {
return new return_package(6, NULL, "Failed Authentication");
}
$sql_game = dbconnection::queryObject("SELECT * FROM games WHERE game_id = '{$pack->game_id}' LIMIT 1");
if (!$sql_game) {
return new return_package(2, NULL, "The game you've requested does not exist");
}
$game = games::getGame($pack)->data;
$game->authors = users::getUsersForGame($pack)->data;
//pack already has auth and game_id
//heres where we just hack the pack for use in other requests without overhead of creating new packs
$pack->media_id = $game->media_id;
$game->media = media::getMedia($pack)->data;
$pack->media_id = $game->icon_media_id;
$game->icon_media = media::getMedia($pack)->data;
return new return_package(0, $game);
}
示例12: deleteFactory
public static function deleteFactory($pack)
{
$factory = dbconnection::queryObject("SELECT * FROM factories WHERE factory_id = '{$pack->factory_id}'");
$pack->auth->game_id = $factory->game_id;
$pack->auth->permission = "read_write";
if (!editors::authenticateGameEditor($pack->auth)) {
return new return_package(6, NULL, "Failed Authentication");
}
dbconnection::query("DELETE FROM factories WHERE factory_id = '{$pack->factory_id}' LIMIT 1");
//cleanup
$instances = dbconnection::queryArray("SELECT * FROM instances WHERE factory_id = '{$pack->factory_id}'");
for ($i = 0; $i < count($instances); $i++) {
$pack->instance_id = $instances[$i]->instance_id;
instances::deleteInstance($pack);
}
$instances = dbconnection::queryArray("SELECT * FROM instances WHERE object_type = 'FACTORY' AND object_id = '{$pack->factory_id}'");
for ($i = 0; $i < count($instances); $i++) {
$pack->instance_id = $instances[$i]->instance_id;
instances::deleteInstance($pack);
}
$reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$factory->requirement_root_package_id}'");
if ($reqPack) {
$pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
requirements::deleteRequirementPackage($pack);
}
$reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$factory->trigger_requirement_root_package_id}'");
if ($reqPack) {
$pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
requirements::deleteRequirementPackage($pack);
}
games::bumpGameVersion($pack);
return new return_package(0);
}
示例13: likeNote
public static function likeNote($pack)
{
$pack->auth->permission = "read_write";
if (!users::authenticateUser($pack->auth)) {
return new return_package(6, NULL, "Failed Authentication");
}
$existing = dbconnection::queryObject("SELECT * FROM note_likes" . " WHERE game_id = '" . intval($pack->game_id) . "'" . " AND note_id = '" . intval($pack->note_id) . "'" . " AND user_id = '" . intval($pack->auth->user_id) . "'");
if ($existing) {
return new return_package(0);
}
dbconnection::queryInsert("INSERT INTO note_likes" . " (game_id, note_id, user_id, created)" . " VALUES" . " ( '" . intval($pack->game_id) . "'" . " , '" . intval($pack->note_id) . "'" . " , '" . intval($pack->auth->user_id) . "'" . " , CURRENT_TIMESTAMP" . " )");
return new return_package(0);
}
示例14: deleteEvent
public static function deleteEvent($pack)
{
$pack->auth->game_id = dbconnection::queryObject("SELECT * FROM events WHERE event_id = '{$pack->event_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 events WHERE event_id = '{$pack->event_id}' LIMIT 1");
games::bumpGameVersion($pack);
return new return_package(0);
}
示例15: noauth_deleteTrigger
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);
}