cvs: pearweb /public_html package-delete.php pkginfo.php

From: Date: Sat, 26 Jan 2002 09:37:36 +0000
Subject: cvs: pearweb /public_html package-delete.php pkginfo.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-2130@lists.php.net to get a copy of this message
mj Sat Jan 26 04:37:36 2002 EDT Added files: /pearweb/public_html package-delete.php Modified files: /pearweb/public_html pkginfo.php Log: * Add interface to delete packages. Index: pearweb/public_html/pkginfo.php diff -u pearweb/public_html/pkginfo.php:1.14 pearweb/public_html/pkginfo.php:1.15 --- pearweb/public_html/pkginfo.php:1.14 Thu Jan 24 15:47:41 2002 +++ pearweb/public_html/pkginfo.php Sat Jan 26 04:37:35 2002 @@ -95,8 +95,11 @@ </tr> <tr> <td colspan="2" align="right"> - <?php print_link("/package-edit.php?id=" . @$_GET['pacid'], - make_image("edit.gif", "Edit package information (Administrators only)")); ?> +<?php print_link("/package-edit.php?id=" . @$_GET['pacid'], + make_image("edit.gif", "Edit package information (Administrators only)")); ?> +&nbsp; +<?php print_link("/package-delete.php?id=" . @$_GET['pacid'], + make_image("delete.gif", "Delete package (Administrators only)")); ?> </td> </tr> </table> Index: pearweb/public_html/package-delete.php +++ pearweb/public_html/package-delete.php <?php /** * Interface to delete a package. * * $Id: package-delete.php,v 1.1 2002/01/26 09:37:35 mj Exp $ */ // XXX: This interface does *not* delete the release files on the // harddisk yet! auth_require(true); require_once "HTML/Form.php"; response_header("Delete package"); echo "<h1>Delete package</h1>"; if (!isset($_GET['id'])) { PEAR::raiseError("No package ID specified."); response_footer(); exit(); } $form = new HTML_Form($_SERVER['PHP_SELF'] . "?id=" . $_GET['id'], "POST"); if (!isset($_POST['confirm'])) { $bb = new Borderbox("Confirmation"); $form->start(); echo "Are you sure that you want to delete the package?<br /><br />"; $form->displaySubmit("yes", "confirm"); echo "&nbsp;"; $form->displaySubmit("no", "confirm"); echo "<br /><br /><font color=\"#ff0000\"><b>Warning:</b> Deleting the package will remove all package information and all releases!</font>"; $form->end(); $bb->end(); } else if ($_POST['confirm'] == "yes") { // XXX: Implement backup functionality // make_backup($_GET['id']); $tables = array("releases" => "package", "maintains" => "package", "deps" => "package", "files" => "package", "packages" => "id"); echo "<pre>\n"; foreach ($tables as $table => $field) { $query = sprintf("DELETE FROM %s WHERE %s = '%s'", $table, $field, $_GET['id'] ); echo "Removing package information from table \"" . $table . "\": "; $dbh->query($query); echo "<b>" . $dbh->affectedRows() . "</b> rows affected.\n"; } echo "</pre>\nPackage " . $_GET['id'] . " has been deleted.\n"; } else if ($_POST['confirm'] == "no") { echo "The package has not been deleted.\n<br /><br />\n"; echo "Go back to the " . make_link("/pkginfo.php?pacid=" . $_GET['id'], "package details") . "."; } response_footer(); ?>

« previous php.pear.cvs (#2130) next »