本文整理汇总了PHP中misc::sanitize方法的典型用法代码示例。如果您正苦于以下问题:PHP misc::sanitize方法的具体用法?PHP misc::sanitize怎么用?PHP misc::sanitize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类misc
的用法示例。
在下文中一共展示了misc::sanitize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: misc
//.........这里部分代码省略.........
}
$searchresultSQL .= "(`{$long_field}`.listingsdbelements_field_name = '{$long_field}' AND `{$long_field}`.listingsdbelements_field_value+0 >= '{$min_long}')";
}
}
// Handle Sorting
// sort the listings
// this is the main SQL that grabs the listings
// basic sort by title..
$group_order_text = '';
$sortby = '';
$sorttype = '';
if ($config["special_sortby"] != 'none') {
$sortby = $config["special_sortby"] . ',';
$sorttype = $config["special_sorttype"] . ',';
}
if (!isset($_GET['sortby'])) {
$_GET['sortby'] = $config["sortby"];
}
if (!isset($_GET['sorttype'])) {
$_GET['sorttype'] = $config["sorttype"];
}
$sortby .= $_GET['sortby'];
$sorttype .= $_GET['sorttype'];
$sql_sort_type = '';
$sortby_array = explode(',', $sortby);
$sorttype_array = explode(',', $sorttype);
$sort_text = '';
$order_text = '';
$group_order_text = '';
$tablelist_nosort = $tablelist;
$sort_count = count($sortby_array);
for ($x = 0; $x < $sort_count; $x++) {
//make sure user input is sanitized before adding to query string
$sortby_array[$x] = $misc->sanitize($sortby_array[$x]);
$sorttype_array[$x] = $misc->sanitize($sorttype_array[$x], 4);
//limit length to 4 characters as sorttype can only be ASC or DESC
if ($sorttype_array[$x] != 'ASC' && $sorttype_array[$x] != 'DESC') {
$sorttype_array[$x] = '';
}
if ($sortby_array[$x] == 'listingsdb_id') {
if ($x == 0) {
$order_text .= 'ORDER BY listingsdb_id ' . $sorttype_array[$x];
} else {
$order_text .= ',listingsdb_id ' . $sorttype_array[$x];
}
} elseif ($sortby_array[$x] == 'listingsdb_title') {
if ($x == 0) {
$order_text .= 'ORDER BY listingsdb_title ' . $sorttype_array[$x];
} else {
$order_text .= ',listingsdb_title ' . $sorttype_array[$x];
}
} elseif ($sortby_array[$x] == 'random') {
if ($x == 0) {
$order_text .= 'ORDER BY rand() ' . $sorttype_array[$x];
} else {
$order_text .= ',rand() ' . $sorttype_array[$x];
}
} elseif ($sortby_array[$x] == 'listingsdb_featured') {
if ($x == 0) {
$order_text .= 'ORDER BY listingsdb_featured ' . $sorttype_array[$x];
} else {
$order_text .= ',listingsdb_featured ' . $sorttype_array[$x];
}
} elseif ($sortby_array[$x] == 'listingsdb_last_modified') {
if ($x == 0) {
$order_text .= 'ORDER BY listingsdb_last_modified ' . $sorttype_array[$x];