cvs: pearweb /include pear-rest.php

[email protected] ("Helgi ?ormar ?orbj?rnsson")
Newsgroups php.pear.cvs,php.pear.core
Message-ID <cvsdufuz1209257711@cvsserver>
dufuz		Sun Apr 27 00:55:11 2008 UTC

  Modified files:              
    /pearweb/include	pear-rest.php 
  Log:
  Cosmetics and use SITE for package type
  
http://cvs.php.net/viewvc.cgi/pearweb/include/pear-rest.php?r1=1.50&r2=1.51&diff_format=u
Index: pearweb/include/pear-rest.php
diff -u pearweb/include/pear-rest.php:1.50 pearweb/include/pear-rest.php:1.51
--- pearweb/include/pear-rest.php:1.50	Sun Mar  9 00:52:11 2008
+++ pearweb/include/pear-rest.php	Sun Apr 27 00:55:11 2008
@@ -56,18 +56,19 @@
             @chmod($cdir, 0777);
         }
 
-        $category = $dbh->getRow('SELECT * FROM categories WHERE name = ?', array($category),
-            DB_FETCHMODE_ASSOC);
+        $sql = 'SELECT name, description FROM categories WHERE name = ?';
+        $category = $dbh->getRow($sql, array($category), DB_FETCHMODE_ASSOC);
         if (PEAR::isError($category)) {
             return $category;
         }
 
-        $query = "SELECT p.name AS name " .
-            "FROM packages p, categories c " .
-            "WHERE p.package_type = 'pear' " .
-            "AND p.category = c.id AND c.name = ? AND p.approved = 1";
+        $query = '
+            SELECT p.name AS name
+            FROM packages p, categories c
+            WHERE p.package_type = ?
+            AND p.category = c.id AND c.name = ? AND p.approved = 1';
 
-        $sth = $dbh->getAll($query, array($category['name']), DB_FETCHMODE_ASSOC);
+        $sth = $dbh->getAll($query, array(SITE, $category['name']), DB_FETCHMODE_ASSOC);
         if (PEAR::isError($sth)) {
             return $sth;
         }
@@ -131,6 +132,7 @@
 
         include_once 'pear-database-category.php';
         $packages = category::listPackages($category);
+
         $fullpackageinfo = '<?xml version="1.0" encoding="UTF-8" ?>
 <f xmlns="http://pear.php.net/dtd/rest.categorypackageinfo"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.