[Dehs-devel] r193 - trunk/www
Raphael Geissert
geissert at alioth.debian.org
Tue Jul 5 00:15:28 UTC 2011
Author: geissert
Date: 2011-07-05 00:15:28 +0000 (Tue, 05 Jul 2011)
New Revision: 193
Modified:
trunk/www/wwiz_detail.php
Log:
cleanup
Modified: trunk/www/wwiz_detail.php
===================================================================
--- trunk/www/wwiz_detail.php 2011-07-04 23:49:00 UTC (rev 192)
+++ trunk/www/wwiz_detail.php 2011-07-05 00:15:28 UTC (rev 193)
@@ -17,25 +17,30 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-if (array_key_exists("id",$_GET) and is_numeric($_GET[id])) {
- require("config_www.inc");
- header("Content-Type: text/plain");
- $sql="SELECT wwiz,watch, up_changes FROM pkgs where id=" . $_GET[id];
- $rsql=pg_exec($db, $sql);
- $res_array=pg_fetch_array($rsql);
- if (pg_numrows($rsql)==0) {
- print "Packages Id -> $_GET[id] - not found" ;
- pg_close($db);
- exit;
- }
- if (array_key_exists("type",$_GET)) {
- if ($_GET[type]=="up_changes") print $res_array['up_changes'];
- if ($_GET[type]=="watch") {
- if ($res_array[watch]) print $res_array[watch];
- else print $res_array['wwiz'];
- }
- }
- pg_close($db);
+if (isset($_GET['id']) && is_numeric($_GET['id']) && isset($_GET['type'])) {
+ $id = (int)$_GET['id'];
+
+ require('config_www.inc');
+ header('Content-Type: text/plain');
+
+ $sql="SELECT wwiz,watch, up_changes FROM pkgs where id=$id";
+ $rsql=pg_exec($db, $sql);
+
+ if (pg_numrows($rsql) == 0)
+ die ("Packages id $id not found");
+
+ $res_array=pg_fetch_array($rsql);
+ pg_close($db);
+
+ if ($_GET['type'] == 'up_changes')
+ print $res_array['up_changes'];
+ else if ($_GET['type'] == 'watch') {
+ if ($res_array['watch'])
+ print $res_array['watch'];
+ else
+ print $res_array['wwiz'];
+ } else
+ die ('Invalid request type');
+ pg_close($db);
}
-else print "Error in submitted id field";
-?>
\ No newline at end of file
+else print 'Invalid request';
More information about the Dehs-devel
mailing list