[art-web] [views] initialise some variables that are optional



commit aee2305bd28190c2623487ed81510f74010c0d5d
Author: Thomas Wood <thos gnome org>
Date:   Sat Oct 31 22:41:06 2009 +0000

    [views] initialise some variables that are optional
    
    These variables are optional in the view, but must be initialised to
    prevent PHP from warning that they are undefined.

 views/backgrounds.php |    5 ++++-
 views/themes.php      |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/views/backgrounds.php b/views/backgrounds.php
index 967f1ab..76ec58d 100644
--- a/views/backgrounds.php
+++ b/views/backgrounds.php
@@ -17,6 +17,9 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+/* initialise some variables */
+$search_text = '';
+$total_backgrounds = 0;
 
 require ("lib/pagination.php");
 require ("lib/template.php");
@@ -39,7 +42,7 @@ if (!$view_data)
   <li><a href="/backgrounds/other">Other</a></li>
   </ul>
   Search for backgrounds:
-  <?php if ($total_backgrounds < 1 && $search_text) echo "<p>No search results for &quot;$search_text&quot;</p>" ?>
+  <?php if ($total_backgrounds < 1 && isset ($search_text)) echo "<p>No search results for &quot;$search_text&quot;</p>" ?>
   <ul>
   <form method="get" action="/backgrounds/search">
     <input name="text" type="text" value="<?php echo $search_text?>">
diff --git a/views/themes.php b/views/themes.php
index 0a1a2ff..03b1a0b 100644
--- a/views/themes.php
+++ b/views/themes.php
@@ -17,6 +17,9 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+/* initialise some vairables */
+$search_text = '';
+$total_themes = 0;
 
 require ("lib/pagination.php");
 require ("lib/template.php");
@@ -53,7 +56,7 @@ if (!$view_data)
 }
 
 /* get the current page and ensure a default value is set */
-$cur_page = $_GET['page'];
+$cur_page = GET ('page');
 if (!is_numeric ($cur_page))
   $cur_page = 1;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]