[art-web] [controllers] Check an index exists in $_GET before trying to access it
- From: Thomas Wood <thos src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [art-web] [controllers] Check an index exists in $_GET before trying to access it
- Date: Sat, 31 Oct 2009 22:20:21 +0000 (UTC)
commit 34657f05627eda56b610ad9ecc7fc26f3036bbc6
Author: Thomas Wood <thos gnome org>
Date: Sat Oct 31 22:21:32 2009 +0000
[controllers] Check an index exists in $_GET before trying to access it
Accessing an index in an array such as $_GET if it does not exist will
cause PHP to generate a warning.
controllers/backgrounds.php | 11 ++++++-----
controllers/themes.php | 11 ++++++-----
2 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/controllers/backgrounds.php b/controllers/backgrounds.php
index b096547..8fb8502 100644
--- a/controllers/backgrounds.php
+++ b/controllers/backgrounds.php
@@ -1,7 +1,7 @@
<?php
/*
- * Copyright (C) 2008 Thomas Wood <thos gnome org>
+ * Copyright (C) 2008, 2009 Thomas Wood <thos gnome org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -18,6 +18,7 @@
*/
require ('config.inc.php');
+require ("common.inc.php");
/* load model */
require ("models/backgrounds.php");
@@ -28,11 +29,11 @@ preg_match ('/^\/backgrounds\/(abstract|gnome|nature|other|search)\/?([0-9]+)?$/
$category = $params[1];
$background_id = $params[2];
-$page = $_GET['page'];
+$page = GET ('page');
if (!is_numeric ($page))
$page = 1;
-$limit = $_GET['limit'];
+$limit = GET ('limit');
if (!is_numeric ($limit))
$limit = 12;
@@ -41,9 +42,9 @@ $start = ($page - 1) * $limit;
if ($category)
if ($category == "search")
{
- $search = mysql_escape_string ($_GET['text']);
+ $search = mysql_escape_string (GET ('text'));
$search = "background.name LIKE '%".$search."%'";
- $search_text = htmlspecialchars ($_GET['text']);
+ $search_text = htmlspecialchars (GET ('text'));
$view_data = $bg->search_items ($search, $start, $limit, "name");
$total_backgrounds = $bg->search_total ($search);
diff --git a/controllers/themes.php b/controllers/themes.php
index b9e42a8..0d4442c 100644
--- a/controllers/themes.php
+++ b/controllers/themes.php
@@ -1,7 +1,7 @@
<?php
/*
- * Copyright (C) 2008 Thomas Wood <thos gnome org>
+ * Copyright (C) 2008, 2009 Thomas Wood <thos gnome org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -18,6 +18,7 @@
*/
require ("config.inc.php");
+require ("common.inc.php");
/* load model */
require ("models/themes.php");
@@ -30,11 +31,11 @@ $category = $params[1];
$theme_id = $params[2];
-$page = $_GET['page'];
+$page = GET ('page');
if (!is_numeric ($page))
$page = 1;
-$limit = $_GET['limit'];
+$limit = GET ('limit');
if (!is_numeric ($limit))
$limit = 12;
@@ -43,9 +44,9 @@ $start = ($page - 1) * $limit;
if ($category)
if ($category == 'search')
{
- $search = mysql_escape_string ($_GET['text']);
+ $search = mysql_escape_string (GET ('text'));
$search = "theme.name LIKE '%".$search."%'";
- $search_text = htmlspecialchars ($_GET['text']);
+ $search_text = htmlspecialchars (GET ('text'));
$view_data = $themes->search_items ($search, $start, $limit, "name");
$total_themes = $themes->search_total ($search);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]