Fix query filters on video categories

parent 120d4bcb
......@@ -264,15 +264,17 @@ if(!class_exists('SH_Query')) {
// XXX TODO This filtering using a $_GET in the query class is SHIT.
// Move it in the gallery interface, and pass a fucking argument
$filter=false;
if(isset($_GET['sexhack_vselect']))
if(isset($_GET['shvs']))
{
switch($_GET['sexhack_vselect'])
switch($_GET['shvs'])
{
case 'premium':
case 'members':
case 'public':
$filter="hls_".$_GET['shvs'];
break;
case 'preview':
$filter=$_GET['sexhack_vselect'];
$filter=$_GET['shvs'];
break;
}
}
......@@ -280,6 +282,7 @@ if(!class_exists('SH_Query')) {
$results = array();
//$sql = $wpdb->prepare("SELECT * from {$wpdb->prefix}{$prefix}videos");
$sql = "SELECT * FROM {$wpdb->prefix}".SH_PREFIX."videos";
if($filter) $sql .= " WHERE ".$filter."!=''";
$dbres = $wpdb->get_results( $sql, ARRAY_A );
sexhack_log($dbres);
foreach($dbres as $row)
......@@ -421,15 +424,15 @@ if(!class_exists('SH_Query')) {
public static function get_Products($vcat=false)
{
$filter=false;
if(isset($_GET['sexhack_vselect']))
if(isset($_GET['shvs']))
{
switch($_GET['sexhack_vselect'])
switch($_GET['shvs'])
{
case 'premium':
case 'members':
case 'public':
case 'preview':
$filter=$_GET['sexhack_vselect'];
$filter=$_GET['shvs'];
break;
}
}
......
......@@ -134,11 +134,11 @@ if(!class_exists('SH_GalleryWidget')) {
echo $args['before_title'] . $title . $args['after_title'];
?>
<ul>
<li><a href="">All videos</a></li>
<li><a href="?sexhack_vselect=public">Public videos</a></li>
<li><a href="?sexhack_vselect=members">Members videos</a></li>
<li><a href="?sexhack_vselect=premium">Premium videos</a></li>
<li><a href="?sexhack_vselect=preview">Previews videos</a></li>
<li><a href="?shvs=all">All videos</a></li>
<li><a href="?shvs=public">Public videos</a></li>
<li><a href="?shvs=members">Members videos</a></li>
<li><a href="?shvs=premium">Premium videos</a></li>
<li><a href="?shvs=preview">Previews videos</a></li>
</ul>
<?php
echo $args['after_widget'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment