function delete() { $q = new mysql_squid_builder(); $sql = "SELECT ID FROM webfilters_sqacls"; $results = $q->QUERY_SQL($sql); while ($ligne = mysql_fetch_assoc($results)) { $aclid = $ligne["ID"]; if (!is_numeric($aclid)) { $aclid = 0; } if ($aclid == 0) { echo "ACL ID = 0 ???\n"; return; } if (!delete_link($aclid)) { return; } echo "\n\n**********************\nACL {$aclid} Delete Access rules\n"; $q->QUERY_SQL("DELETE FROM webfilters_sqaclaccess WHERE aclid={$aclid}"); if (!$q->ok) { echo $q->mysql_error . "\n"; return; } echo "ACL {$aclid} Delete ACL rule\n"; $q->QUERY_SQL("DELETE FROM webfilters_sqacls WHERE ID={$aclid}"); if (!$q->ok) { echo $q->mysql_error . "\n"; return; } } }
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ************************************************************************/ define('OPENLD_ROOT', './'); require OPENLD_ROOT . 'admin_header.php'; $req_page = isset($_REQUEST['page']) ? is_numeric($_REQUEST['page']) ? $_REQUEST['page'] : '1' : '1'; $req_id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '0'; $req_cat = isset($_REQUEST['category']) ? $_REQUEST['category'] : ''; ($hook = get_hook('admin_browse_before_sql_input_check')) ? eval($hook) : null; //SQL Operations if (isset($_REQUEST['delete'])) { delete_category($_REQUEST['delete']); } elseif (isset($_REQUEST['delete_link'])) { delete_link($_REQUEST['delete_link']); } elseif (isset($_REQUEST['move_cat_sql'])) { move_category($req_id, $req_page, $_REQUEST['move_cat_sql'], $_REQUEST['to_new_parent']); } elseif (isset($_REQUEST['move_link_sql'])) { move_link($req_id, $req_page, $_REQUEST['move_link_sql'], $_REQUEST['to_new_parent']); } elseif (isset($_REQUEST['edit_cat_sql'])) { edit_a_category($req_id, $req_page, $_REQUEST['cat_id']); } elseif (isset($_REQUEST['edit_link_sql'])) { edit_a_link($req_id, $req_page, $_REQUEST['edit_link_sql']); } elseif (isset($_REQUEST['add_a_link'])) { add_a_link($req_id); } elseif (isset($_REQUEST['add_a_category'])) { add_a_category($req_id); } elseif (isset($_REQUEST['unaccept'])) { unaccept_category($_REQUEST['unaccept']); } elseif (isset($_REQUEST['unaccept_link'])) {
<h2>MVC Example</h2> <p>This section shows off a fake MVC example. Look at the person.php file in controllers to see code commented out on how many of these operations would work.</p> <h2>People List</h2> <table><thead><tr><td>Name</td><td></td></tr></thead> <tbody> <? foreach($people as $person) { ?> <tr><td><?php echo link_to("/person/show/" . $person['id'], $person['name']); ?> </td> <td><?php echo delete_link('/person/destroy?id=' . $person["id"], png('delete'), "Are you sure you want to delete " . $person['name'] . "?"); ?> </td></tr> <? } ?> </tbody><table>
} } // update a link if (isset($_POST['update_link']) && $_POST['update_link'] == 'update') { $link_id = (int) $_GET['link_id']; $update_status = update_link($link_id); if ($update_status === true) { header('Location: ' . $_SERVER["PHP_SELF"] . '?page_name=links&link_id=' . $link_id); } else { $error = $update_status; } } // delete a link if (isset($_POST['confirm_delete_link']) && $_POST['confirm_delete_link'] == 'Yes') { $link_id = (int) $_GET['link_id']; $delete_status = delete_link($link_id); if ($delete_status === true) { header('Location: ' . $_SERVER["PHP_SELF"] . '?page_name=links'); } else { $error = $delete_status; } } // cancel delete link if (isset($_POST['cancel_delete_link']) && $_POST['cancel_delete_link'] == 'No') { header('Location: ' . $_SERVER["PHP_SELF"] . '?page_name=links'); } // get main content // get all links always $links = get_links(); $menu_links = array(); $rss_links = array();
?> <li><?php echo $key->name; ?> (<a href='/user/key/<?php echo $key->id; ?> /edit' rel='facebox' />edit</a>) (<span class='x'><?php echo delete_link('X', url_for('UserController', 'delete_key', $key->id)); ?> </span>)</li> <?php } ?> </ul> </table> <div class='right'> <p><?php echo delete_link('Delete Account', url_for('UserController', 'delete'), true, 'Are you sure? \\n This will delete all packages and remove your channel from the pear server.'); ?> </div> <br style='clear:both' /> <script type='text/javascript'> function verifyField() { if($F('user_password') == $F('v_password')) { return true; } new Effect.Highlight($('v_password'), {startcolor: '#ff0000', endcolor: '#ffffff'}); return false; } </script>
<ul class='versions'> <?php foreach ($versions as $_version) { $url = url_for('VersionController', 'show', $package->user->username, $package->name, $_version->version); ?> <li><?php echo link_to($_version->version, $url); ?> - <?php echo date("F j, Y", DateHelper::from_db($_version->created_at)); ?> </li> <?php } ?> </ul> <?php if ($this->is_logged_in() && $this->user->id == $package->user_id) { ?> <div> <div class='right'> <p><?php echo delete_link('Delete Package', url_for('PackageController', 'delete', $package->id), true, 'Are you sure? \\n This will delete all versions of this package'); ?> </p> </div> </div> <br style='clear:both;'/> <?php }
<h1>Details: <?php echo $package->name; ?> - <?php echo $version->version; ?> </h1> <?php echo $this->render_partial('version/_version_info.php'); if ($this->is_logged_in() && $this->user->id == $version->package->user_id) { ?> <p><?php echo delete_link('Delete Version', url_for('VersionController', 'delete', $package->id, $version->id)); ?> </p> <?php }
function link_item ($range_id, $create = FALSE, $echo = FALSE, $refresh = FALSE, $link_update = FALSE) { global $filesize; if ($create) { $link_data = parse_link(Request::get('the_link')); if ($link_data["HTTP/1.0 200 OK"] || $link_data["HTTP/1.1 200 OK"] || $link_data["HTTP/1.1 302 Found"] || $link_data["HTTP/1.0 302 Found"]) { if (!$link_update) { if (insert_link_db($range_id, $link_data["Content-Length"], $refresh)) { if ($refresh) { delete_link($refresh, TRUE); } } $tmp = TRUE; } else { $filesize = $link_data["Content-Length"]; edit_item( $link_update, FALSE, Request::get('name'), Request::get('description'), Request::int('protect'), Request::get('the_link'), $filesize ); $tmp = TRUE; } } else { $tmp = FALSE; } return $tmp; } else { if ($echo) { echo link_form($refresh,$link_update); return; } else { return link_form($refresh,$link_update); } } }
$return['data'] = $item_html; $return['msg'] = _('Link inserted successfully'); return $return; } $login = Session::get_session_user(); $db = new ossim_db(); $conn = $db->connect(); $action = POST('action'); $data = POST('data'); ossim_valid($action, OSS_DIGIT, 'illegal:' . _('Action')); if (ossim_error()) { die(ossim_error()); } if ($action != '' && isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { switch ($action) { case 1: $response = get_link_select($conn, $data); break; case 2: $response = delete_link($conn, $data); break; case 3: $response = insert_link($conn, $data); break; default: $response['error'] = TRUE; $response['msg'] = 'Wrong Option Chosen'; } echo json_encode($response); $db->close(); }
if ($result->c > 0) { if (isset($_POST['submitLink'])) { if (isset($_POST['id']) && !is_link_creator(getDirectReference($_POST['id']))) { Session::Messages($langLinkNotOwner, 'alert-error'); } else { $_POST['selectcategory'] = getIndirectReference(-2); //ensure that simple users cannot change category submit_link(); $message = isset($_POST['id']) ? $langLinkMod : $langLinkAdded; Session::Messages($message, 'alert-success'); } redirect_to_home_page("modules/link/index.php"); } switch ($action) { case 'deletelink': if (is_link_creator($id)) { delete_link($id); Session::Messages($langLinkDeleted, 'alert-success'); } else { Session::Messages($langLinkNotOwner, 'alert-danger'); } redirect_to_home_page("modules/link/index.php"); break; } if (isset($_GET['action'])) { $tool_content .= action_bar(array( array('title' => $langBack, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code", 'icon' => 'fa-reply', 'level' => 'primary-label')));
} head_table($head); $no = 1; while ($row = db_fetch($query)) { start_row("class='odd gradeX'"); text_cell($no, "align='center'"); if (empty($id_item)) { //tidak ada parameter get id_item text_cell($row['item_code'], "align='left'"); text_cell($row['item_name'], "align='left'"); } text_cell($row['id_category'], "align='center'"); text_cell($row['category_name'], "align='left'"); //text_cell($row['description'], "align='left'"); start_column("align='center' "); delete_link('tb_maping_item_category', $row['id'], $_SESSION['key'], "", "item=" . $id_item); end_column(); end_row(); $no++; } //ini satu item yang akan dikirim ke halaman form butuh item nya biar tidak bisa dirubah $item_ = $find_item['item_code'] . " >> " . $find_item['item_name']; if (!empty($id_item)) { input_hidden("item_name", $item_); input_hidden("id_item", $id_item); //parameter post id item untuk dikirim ke halaman form } end_table(); if (!empty($id_item)) { link_text("?" . $parameter_key . "kd_tabel=tb_items", '<- kembali', "class='btn btn-default'"); }
function delete_sysmaps_element($selementids) { zbx_value2array($selementids); if (empty($selementids)) { return true; } $result = true; $linkids = array(); $sql = 'SELECT linkid ' . ' FROM sysmaps_links ' . ' WHERE ' . DBcondition('selementid1', $selementids) . ' OR ' . DBcondition('selementid2', $selementids); $res = DBselect($sql); while ($rows = DBfetch($res)) { $linkids[] = $rows['linkid']; } if (!empty($linkids)) { $result &= delete_link($linkids); } if (!$result) { return $result; } return DBexecute('DELETE FROM sysmaps_elements WHERE ' . DBcondition('selementid', $selementids)); }
} else { $question = createQuestion(sprintf(_('Wollen Sie die Datei "%s" von %s wirklich löschen?'), $result['filename'], $result['fullname']), array('open' => $open_id.'_rm_')); } } //Loeschen von Dateien im wirklich-ernst Mode if ($open_cmd == 'rm') { if (delete_document($open_id)) $msg.="msg§" . _("Die Datei wurde gelöscht") . "§"; else $msg.="error§" . _("Die Datei konnte nicht gelöscht werden") . "§"; } //Loeschen von verlinkten Dateien im wirklich-ernst Mode if ($open_cmd == 'rl') { if (delete_link($open_id)) $msg.="msg§" . _("Die Verlinkung wurde gelöscht") . "§"; else $msg.="error§" . _("Die Verlinkung konnte nicht gelöscht werden") . "§"; } //wurde Code fuer Aendern des Namens und der Beschreibung von Ordnern oder Dokumenten ubermittelt (=id+"_c_"), wird entsprechende Funktion aufgerufen if ($open_cmd == 'c') { $change=$open_id; } //wurde Code fuer Speichern von Aenderungen uebermittelt (=id+"_sc_"), wird entsprechende Funktion aufgerufen if ($open_cmd == 'sc' && (!Request::submitted("cancel"))) { edit_item($open_id, Request::int('type'), Request::get('change_name'), Request::get('change_description'), Request::int('change_protected', 0)); }
/** * Delete Map * * @param array $sysmaps * @param array $sysmaps['sysmapid'] * @return boolean */ public static function delete($sysmapids) { $result = true; try { self::BeginTransaction(__METHOD__); // Permissions $options = array('sysmapids' => $sysmapids, 'editable' => 1, 'preservekeys' => 1); $del_sysmaps = self::get($options); foreach ($sysmapids as $snum => $sysmapid) { if (!isset($del_sysmaps[$sysmapid])) { self::exception(ZBX_API_ERROR_PERMISSIONS, S_NO_PERMISSION); } } //--- // delete maps from selements of other maps $selementids = array(); $sql = 'SELECT se.selementid ' . ' FROM sysmaps_elements se' . ' WHERE ' . DBcondition('se.elementid', $sysmapids) . ' AND se.elementtype=' . SYSMAP_ELEMENT_TYPE_MAP; $db_elements = DBselect($sql); while ($db_element = DBfetch($db_elements)) { $selementids[$db_element['selementid']] = $db_element['selementid']; } if (!empty($selementids)) { $sysmap_linkids = array(); $sql = 'SELECT linkid ' . ' FROM sysmaps_links ' . ' WHERE ' . DBcondition('selementid1', $selementids) . ' OR ' . DBcondition('selementid2', $selementids); $res = DBselect($sql); while ($rows = DBfetch($res)) { $sysmap_linkids[$rows['linkid']] = $rows['linkid']; } if (!empty($sysmap_linkids)) { DBexecute('DELETE FROM sysmaps_link_triggers WHERE ' . DBcondition('linkid', $sysmap_linkids)); DBexecute('DELETE FROM sysmaps_links WHERE ' . DBcondition('linkid', $sysmap_linkids)); } DBexecute('DELETE FROM sysmaps_elements WHERE ' . DBcondition('selementid', $selementids)); } //---- $res = DBselect('SELECT linkid FROM sysmaps_links WHERE ' . DBcondition('sysmapid', $sysmapids)); while ($rows = DBfetch($res)) { $result &= delete_link($rows['linkid']); } $result &= DBexecute('DELETE FROM sysmaps_elements WHERE ' . DBcondition('sysmapid', $sysmapids)); $result &= DBexecute("DELETE FROM profiles WHERE idx='web.favorite.sysmapids' AND source='sysmapid' AND " . DBcondition('value_id', $sysmapids)); $result &= DBexecute('DELETE FROM screens_items WHERE ' . DBcondition('resourceid', $sysmapids) . ' AND resourcetype=' . SCREEN_RESOURCE_MAP); $result &= DBexecute('DELETE FROM sysmaps WHERE ' . DBcondition('sysmapid', $sysmapids)); $result = self::EndTransaction($result, __METHOD__); return array('sysmapids' => $sysmapids); } catch (APIException $e) { self::EndTransaction(false, __METHOD__); $error = $e->getErrors(); $error = reset($error); self::setError(__METHOD__, $e->getCode(), $error); return false; } }
$linkid = $_REQUEST['linkid']; show_messages($result, 'Link updated', 'Cannot update link'); } else { // add link $result = add_link($_REQUEST['sysmapid'], $_REQUEST['selementid1'], $_REQUEST['selementid2'], get_request('triggers', array()), $_REQUEST['drawtype'], $_REQUEST['color']); $linkid = $result; show_messages($result, 'Link added', 'Cannot add link'); } add_audit_if($result, AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_MAP, 'Name [' . $sysmap['name'] . '] Link [' . $linkid . '] updated '); if ($result) { unset($_REQUEST['form']); } } else { if (isset($_REQUEST['delete'])) { if (isset($_REQUEST['linkid'])) { $result = delete_link($_REQUEST['linkid']); show_messages($result, 'Link deleted', 'Cannot delete link'); add_audit_if($result, AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_MAP, 'Name [' . $sysmap['name'] . '] Link [' . $_REQUEST['linkid'] . '] deleted'); if ($result) { unset($_REQUEST['linkid']); unset($_REQUEST['form']); } } else { if (isset($_REQUEST['selementid'])) { $result = delete_sysmaps_element($_REQUEST['selementid']); show_messages($result, 'Element deleted', 'Cannot delete element'); add_audit_if($result, AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_MAP, 'Name [' . $sysmap['name'] . '] Element [' . $_REQUEST['selementid'] . '] deleteed '); if ($result) { unset($_REQUEST['selementid']); unset($_REQUEST['form']); }
delete_sysmaps_element($db_selementids); $db_linkids = array(); $res = DBselect('SELECT linkid FROM sysmaps_links WHERE sysmapid=' . $sysmapid); while ($db_link = DBfetch($res)) { $db_linkids[$db_link['linkid']] = $db_link['linkid']; } foreach ($links as $id => $link) { $link['sysmapid'] = $sysmapid; if (isset($link['new'])) { $result = add_link($link); } else { $result = update_link($link); unset($db_linkids[$link['linkid']]); } } delete_link($db_linkids); $result = DBend(true); if ($result) { print 'if(Confirm("' . S_MAP_SAVED_RETURN_Q . '")){ location.href = "sysmaps.php"; }'; } else { throw new Exception(S_MAP_SAVE_OPERATION_FAILED . "\n\r"); } } catch (Exception $e) { if (isset($transaction)) { DBend(false); } $msg = $e->getMessage() . "\n\r"; ob_clean(); print 'alert(' . zbx_jsvalue($msg) . ');'; } @ob_flush();