get_row("SELECT * FROM ".$wpdb->prefix."allvideogallery_profiles WHERE id=".$profileid); $query = "SELECT * FROM ".$wpdb->prefix."allvideogallery_videos WHERE published=1"; if( isset($_GET['slg']) ) { $slug = $_GET['slg']; $query .= " AND slug!='$slug'"; } if($catid) { $gallery = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."allvideogallery_categories WHERE id=".$catid); $query .= " AND category='$gallery->name'"; $arr_params['catid'] = $gallery->slug; } $arr_params['sort'] = $sort; switch($sort) { case 'latest' : $query .= ' ORDER BY id DESC'; break; case 'popular' : $query .= ' ORDER BY hits DESC'; break; case 'random' : $query .= ' ORDER BY RAND()'; break; case 'featured' : $query .= ' AND featured=1 ORDER BY ordering'; break; default : $query .= ' ORDER BY ordering'; unset( $arr_params['sort'] ); break; } $videos = $wpdb->get_results($query); $custid = ( $profile->custom_gallery_id ) ? $profile->custom_gallery_id : 'avs_gallery'; $custpage = ( $profile->custom_page_url ) ? $profile->custom_page_url : ''; $limit = $profile->rows * $profile->cols; $count = ( $count != 0 && $count < count($videos) ) ? $count : count($videos); $total = ceil( $count / $limit ); $start = isset( $_GET['start'] ) ? $_GET['start'] : 1; $limitstart = ($start - 1) * $limit; $limitend = $start * $limit; if($count < $limitend) $limitend = $count; $output = ''; $output .= '
';
$output .= '