$event_result = $conn->query(add_event($username, "added", $_POST['special_mailer_types'])); } elseif ($_POST['change_special_mailers'] == 'remove_special_mailer') { $remove_mailers_result = $conn->query(remove_item("special_mailers", "daily_lead_data")); $remove_mailers_code_result = $conn->query(remove_item($_POST['special_mailer_types'], "daily_special_mailers")); $event_result = $conn->query(add_event($username, "removed", $_POST['special_mailer_types'])); } } /* Logic for adding web apps */ if (isset($_POST['change_web_apps'])) { if ($_POST['change_web_apps'] == "add_web_app") { $add_web_apps_result = $conn->query(add_item("web_apps", "daily_lead_data")); $drop_web_result = $conn->query(drop_rank("web")); $event_result = $conn->query(add_event($username, "added", "web app")); } elseif ($_POST['change_web_apps'] == "remove_web_app") { $remove_web_apps_result = $conn->query(remove_item("web_apps", "daily_lead_data")); $raise_web_result = $conn->query(raise_rank("web_apps")); $event_result = $conn->query(add_event($username, "removed", "web apps")); } } /* Logic for adding abandoned web apps */ if (isset($_POST['change_abandoned_web_apps'])) { if ($_POST['change_abandoned_web_apps'] == 'add_abandoned_web_app') { $add_abandoned_web_result = $conn->query(add_item("abandoned_web_apps", "daily_lead_data")); $event_result = $conn->query(add_event($username, "added", "abandoned web apps")); } elseif ($_POST['change_abandoned_web_apps'] == 'remove_abandoned_web_app') { $remove_abandoned_web_result = $conn->query(remove_item("abandoned_web_apps", "daily_lead_data")); $event_result = $conn->query(add_event($username, "removed", "abandoned web apps")); } } unset($_POST); header('Location: index.php');
function Execute(&$template, $request, &$dba, &$session, &$user) { global $_QUERYPARAMS, $_DATASTORE, $_USERGROUPS; if (!isset($request['id']) || !$request['id'] || intval($request['id']) == 0) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPIC')); $template->setInfo('content', $template->getVar('L_TOPICDOESNTEXIST'), FALSE); return TRUE; } /* Get our topic */ $topic = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE i.id = " . intval($request['id'])); if (!$topic || !is_array($topic) || empty($topic)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPIC')); $template->setInfo('content', $template->getVar('L_TOPICDOESNTEXIST'), FALSE); return TRUE; } $forum = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['forum'] . " FROM " . FORUMS . " f LEFT JOIN " . INFO . " i ON f.forum_id = i.id WHERE i.id = " . intval($topic['forum_id'])); /* Check the forum data given */ if (!$forum || !is_array($forum) || empty($forum)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE); return TRUE; } /* Make sure the we are trying to delete from a forum */ if (!($forum['row_type'] & FORUM)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_CANTDELFROMNONFORUM'), FALSE); return TRUE; } /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_DELETETOPIC'), $forum['row_left'], $forum['row_right']); /* Are we dealing with a topic or a poll? */ $type = $topic['poll'] == 1 ? 'polls' : 'topics'; /* Does this person have permission to remove this topic? */ if ($topic['poster_id'] == $user['id']) { if (get_map($user, $type, 'can_del', array('forum_id' => $forum['id'])) > $user['perms']) { $template->setInfo('content', $template->getVar('L_YOUNEEDPERMS'), FALSE); return TRUE; } } else { if (get_map($user, 'other_' . $type, 'can_del', array('forum_id' => $forum['id'])) > $user['perms']) { $template->setInfo('content', $template->getVar('L_YOUNEEDPERMS'), FALSE); return TRUE; } } $user_usergroups = $user['usergroups'] != '' ? iif(!unserialize($user['usergroups']), array(), unserialize($user['usergroups'])) : array(); $forum_usergroups = $forum['moderating_groups'] != '' ? iif(!unserialize($forum['moderating_groups']), array(), unserialize($forum['moderating_groups'])) : array(); /* Check if this user belongs to one of this forums moderatign groups, if any exist */ if (is_array($forum_usergroups) && !empty($forum_usergroups)) { if (is_array($user_usergroups) && !empty($user_usergroups)) { $error = true; foreach ($user_usergroups as $group) { if (!in_array($group, $forum_usergroups) && !$error) { $error = false; } else { $error = $_USERGROUPS[$group]; } } if (!$error) { $template->setInfo('content', $template->getVar('L_YOUNEEDPERMS'), FALSE); return TRUE; } } else { $template->setInfo('content', $template->getVar('L_YOUNEEDPERMS'), FALSE); return TRUE; } } /** * Remove the topic and all of its replies */ /* Remove the topic and all replies from the information table */ remove_item($topic['id'], 'topic_id'); if (!@touch(CACHE_FILE, time() - 86460)) { @unlink(CACHE_FILE); } if (!@touch(CACHE_EMAIL_FILE, time() - 86460)) { @unlink(CACHE_EMAIL_FILE); } /* Redirect the user */ $template->setInfo('content', sprintf($template->getVar('L_DELETEDTOPIC'), $topic['name'], $forum['name'])); $template->setRedirect('viewforum.php?id=' . $forum['id'], 3); return TRUE; }
function execute(&$request) { global $_QUERYPARAMS, $_DATASTORE, $_USERGROUPS; /* set the breadcrumbs bit */ k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION'); if (!isset($_REQUEST['id']) || !$_REQUEST['id'] || intval($_REQUEST['id']) == 0) { $action = new K4InformationAction(new K4LanguageElement('L_TOPICDOESNTEXIST'), 'content', FALSE); return $action->execute($request); } /* Get our topic */ $topic = $request['dba']->getRow("SELECT * FROM " . K4POSTS . " WHERE post_id = " . intval($_REQUEST['id'])); if (!$topic || !is_array($topic) || empty($topic)) { $action = new K4InformationAction(new K4LanguageElement('L_TOPICDOESNTEXIST'), 'content', FALSE); return $action->execute($request); } $forum = $request['dba']->getRow("SELECT * FROM " . K4FORUMS . " WHERE forum_id = " . intval($topic['forum_id'])); /* Check the forum data given */ if (!$forum || !is_array($forum) || empty($forum)) { $action = new K4InformationAction(new K4LanguageElement('L_FORUMDOESNTEXIST'), 'content', FALSE); return $action->execute($request); } /* Make sure the we are trying to delete from a forum */ if (!($forum['row_type'] & FORUM)) { $action = new K4InformationAction(new K4LanguageElement('L_CANTDELFROMNONFORUM'), 'content', FALSE); return $action->execute($request); } /* set the breadcrumbs bit */ k4_bread_crumbs($request['template'], $request['dba'], 'L_DELETETOPIC', $forum); /* Are we dealing with a topic or a poll? */ $type = $topic['is_poll'] == 1 ? 'polls' : 'topics'; /* Does this person have permission to remove this topic? */ if ($topic['poster_id'] == $request['user']->get('id')) { if (get_map($type, 'can_del', array('forum_id' => $forum['forum_id'])) > $request['user']->get('perms')) { no_perms_error($request); return TRUE; } } else { if (get_map('other_' . $type, 'can_del', array('forum_id' => $forum['forum_id'])) > $request['user']->get('perms')) { no_perms_error($request); return TRUE; } } if (!is_moderator($request['user']->getInfoArray(), $forum)) { no_perms_error($request); return TRUE; } /** * Remove the topic and all of its replies */ /* Remove the topic and all replies from the information table */ remove_item($topic['post_id'], 'post_id'); // delete this topics attachments remove_attachments($request, $topic); // delete any possible moved topic redirectors $request['dba']->executeUpdate("DELETE FROM " . K4POSTS . " WHERE moved_new_post_id = " . intval($topic['post_id'])); reset_cache('datastore'); reset_cache('email_queue'); /* Redirect the user */ $action = new K4InformationAction(new K4LanguageElement('L_DELETEDTOPIC', $topic['name'], $forum['name']), 'content', FALSE, 'viewforum.php?f=' . $forum['forum_id'], 3); return $action->execute($request); }
} else { $turn_cost = 0; $generic_state_change = "__TARGET__ is already {$state}."; } } else { if ($command == 'Kampo') { $covert = true; // *** Get Special Items From Inventory *** $user_id = self_char_id(); $root_item_type = 7; $itemCount = query_item('SELECT sum(amount) AS c FROM inventory WHERE owner = :owner AND item_type = :type GROUP BY item_type', array(':owner' => $user_id, ':type' => $herb_item_type)); $turn_cost = min($itemCount, $starting_turns - 1, 2); // Costs 1 or two depending on the number of items. if ($turn_cost && $itemCount > 0) { // *** If special item count > 0 *** remove_item($user_id, 'ginsengroot', $itemCount); add_item($user_id, 'tigersalve', $itemCount); $generic_skill_result_message = 'With intense focus you grind the ' . $itemsCount . ' roots into potent formulas.'; } else { // *** no special items, give error message *** $turn_cost = 0; $generic_skill_result_message = 'You do not have the necessary ginsengroots or energy to create any Kampo formulas.'; } } else { if ($command == 'Poison Touch') { $covert = true; $target->addStatus(POISON); $target->addStatus(WEAKENED); // Weakness kills strength. $target_damage = rand($poisonMinimum, $poisonMaximum); $victim_alive = $target->subtractHealth($target_damage);
/** * Execute our topic queue to delete moderated topics */ function execute_topic_queue() { global $_DBA, $_TOPICQUEUE; if (is_array($_TOPICQUEUE) && !empty($_TOPICQUEUE)) { array_values($_TOPICQUEUE); if (isset($_TOPICQUEUE[0])) { $queue = $_TOPICQUEUE[0]; $topics = unserialize($_TOPICQUEUE[0]['topicinfo']); if (is_array($topics) && !empty($topics)) { /* Reset the starting point of this array */ $topics = array_values($topics); $count = count($topics); /* Loop through the users */ for ($i = 0; $i < TOPIC_INTERVAL; $i++) { if (isset($topics[$i]) && intval($topics[$i]) != 0) { /* Remove this topic */ remove_item(intval($topics[$i]), 'topic_id'); unset($topics[$i]); } } /* If we have finished with this queue item */ if ($count <= TOPIC_INTERVAL) { $_DBA->executeUpdate("DELETE FROM " . TOPICQUEUE . " WHERE id = " . intval($_TOPICQUEUE[0]['id'])); } else { $topics = array_values($topics); $update = $_DBA->prepareStatement("UPDATE " . TOPICQUEUE . " SET topicinfo=? WHERE id=?"); $update->setString(1, serialize($topics)); $update->setInt(2, $_TOPICQUEUE[0]['id']); $update->executeUpdate(); } /* Reset the filetime on our email cache file */ if (!@touch(CACHE_TOPIC_FILE, time() - 86460)) { @unlink(CACHE_TOPIC_FILE); } } else { $_DBA->executeUpdate("DELETE FROM " . TOPICQUEUE . " WHERE id = " . intval($_TOPICQUEUE[0]['id'])); /* Reset the filetime on our email cache file */ if (!@touch(CACHE_TOPIC_FILE, time() - 86460)) { @unlink(CACHE_TOPIC_FILE); } } } } }
$conn->execute("delete from friends where id={$v}"); } header("Location: friends.php"); } else { $sql = "select friends_type from signup where UID={$_SESSION['UID']}"; $rs = $conn->execute($sql); $type = explode("|", $rs->fields['friends_type']); $cmd = explode("_", $_REQUEST[action_name]); if ($cmd[0] == "add" and $cmd[1] != "") { while (list($k, $v) = @each($_REQUEST[AID])) { echo $v; add_item("friends", "friends_type", "id = {$v}", $type[$cmd[1]]); } } elseif ($cmd[0] == "delete" and $cmd[1] != "") { while (list($k, $v) = @each($_REQUEST[AID])) { remove_item("friends", "friends_type", "id = {$v}", $type[$cmd[1]]); } } header("Location: friends.php"); } } if ($_REQUEST[invite_signup] != "") { for ($i = 0; $i < count($friends_email); $i++) { if ($friends_email[$i] != "") { $emails[] = $friends_email[$i]; $tag = "yes"; if ($friends_fname[$i] == "") { $err = "Please provide the firstname of your email."; break; } $fnames[] = $friends_fname[$i];
function remove_items_by_class($class) { $ids = get_itemids_by_class($class); foreach ($ids as $id) { remove_item((int) $id, check_qty((int) $id)); } }