| 1 |
<?php |
<?php |
| 2 |
// $Id: regcode.admin.php,v 1.1.2.17 2009/10/10 20:39:30 aidan Exp $ |
// $Id: regcode.admin.php,v 1.1.2.18 2009/10/14 14:48:11 aidan Exp $ |
| 3 |
|
|
| 4 |
require_once 'regcode.api.php'; |
require_once 'regcode.api.php'; |
| 5 |
|
|
| 508 |
*/ |
*/ |
| 509 |
function regcode_admin_list_getwhere() { |
function regcode_admin_list_getwhere() { |
| 510 |
// Grab a list of current filters |
// Grab a list of current filters |
| 511 |
$resource = db_query('SELECT name,value FROM {variable} WHERE name LIKE "regcode_filter_%"'); |
$resource = db_query("SELECT name,value FROM {variable} WHERE name LIKE 'regcode_filter_%'"); |
| 512 |
|
|
| 513 |
// Build array of applicable conditions |
// Build array of applicable conditions |
| 514 |
$conditions = array(); |
$conditions = array(); |
| 528 |
$cond = array(); |
$cond = array(); |
| 529 |
foreach ($conditions as $filter => $value) { |
foreach ($conditions as $filter => $value) { |
| 530 |
$value = preg_replace('/[^a-zA-Z0-9\s]+/', '', $value); |
$value = preg_replace('/[^a-zA-Z0-9\s]+/', '', $value); |
| 531 |
$cond[] = sprintf('%s = "%s"', $filter, $value); |
$cond[] = sprintf("%s = '%s'", $filter, $value); |
| 532 |
} |
} |
| 533 |
|
|
| 534 |
// Return the string |
// Return the string |
| 536 |
if (!empty($cond)) { |
if (!empty($cond)) { |
| 537 |
$string .= implode($cond, ' AND '); |
$string .= implode($cond, ' AND '); |
| 538 |
} else { |
} else { |
| 539 |
$string .= '1'; |
$string .= 'TRUE'; |
| 540 |
} |
} |
| 541 |
|
|
| 542 |
return $string; |
return $string; |