Вход Регистрация
Файл: system/modules/radio/radio_list.php
Строк: 219
<?php
#==========================================
#    DLE Radio v.1
#==========================================
#    author: Elegant Division
#    url: http://e-div.com
#    e-mail: info@e-div.com
#==========================================

if(!defined('MOZG'))
    die(
'Hacking attempt!');
require 
ENGINE_DIR . "/modules/radio/data/config.php";
 if(  
$radio_config['work'] == "off" ){ 
$tpl->load_template ('radio/off.tpl');
$tpl->compile('content'); 
 
 
 }else{
// category
$radio_cat_info = get_vars ( "radio_cat" );
if ( !
is_array ( $radio_cat_info )) {

    
$radio_cat_info = array();
    
    
$db->query ( "SELECT * FROM " . PREFIX . "_radio_cat ORDER BY posi ASC" );
    while ( 
$row = $db->get_row () ) {
        
        
$radio_cat_info[$row['id']] = array();
        foreach ( 
$row as $key => $value ) $radio_cat_info[$row['id']][$key] = stripslashes( $value );
    
    }
    
    
set_vars ( "radio_cat", $radio_cat_info );
    
$db->free ();
}

$cat_sql = "";

if ( isset( 
$_REQUEST['rcat'] ) AND $radio_cat_info ) {

    if (
substr ( $_GET['rcat'], - 1, 1 ) == '/') $_GET['rcat'] = substr ( $_GET['rcat'], 0, - 1 );
    
$rcat = explode ( '/', $_GET['rcat'] );
    
$rcat = end ( $rcat );
    
$rcat = $db->safesql ( strip_tags ( $rcat ) );
    
    
$final_cat = "";
    
    foreach( 
$radio_cat_info as $value ){
        if( 
strtolower( $value['alt_name'] ) == strtolower( $rcat )) $final_cat = intval( $value['id'] );
    }
    
    if(  
$final_cat ) $cat_sql = "AND category='" . $final_cat . "'";
    
} 

// paginator settings
$perpage = ( ! $radio_config['perpage'] ? $perpage = "10" : intval( $radio_config['perpage'] ) );

$url_page = $config['home_url'] . "radio";
$user_query = "go=radio";

if (
$cstart) {
    
$cstart = $cstart - 1;
    
$cstart = $cstart * $perpage;
}

$i = $cstart;

// sql
$sql_select= "SELECT  * FROM `" . PREFIX . "_radio` WHERE  id  ";
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_radio WHERE id " . $cat_sql . "";

$count_all = $db->super_query( $sql_count );
$count_all = $count_all['count'];

$tpl->load_template( 'radio/radio_list.tpl' );

$radio_found = FALSE;
    
$db->query( $sql_select );
while ( 
$row = $db->get_row() ) {
    
    
$radio_found = TRUE;

    if( 
$row['cover'] ) $tpl->set( "{cover}", $config['home_url'] . "uploads/radio/" . $row['cover'] );
    else 
$tpl->set( "{cover}", "{theme}/images/nocover.png" );
    
$jid = 0;
                
$jid++;
    
$tpl->set('{jid}', $jid);
     
$tpl->set ('{aid}',$row['id']);
   
$tpl->set ('{url}',  stripslashes($row['stream']));
    
$tpl->set( "{title}", stripslashes( $row['name'] ));
    
$tpl->set( "{name}", stripslashes( $row['name'] ));
      
$tpl->set('{artist}', '');
   
$tpl->set('{author-n}','');
                
$expName = explode(' ', '');
                
$tpl->set('{author-f}', '');
                
$tpl->set('{author-id}', '');  
    if( 
$row['descr'] ) $tpl->set( "{descr}", stripslashes( $row['descr'] ));
    else 
$tpl->set( "{descr}", "" );
    
    if( 
$row['bitrate'] ) $tpl->set( "{bitrate}", intval( $row['bitrate'] ) . " kbps");
    else 
$tpl->set( "{bitrate}", "" );

 
$cat_link = "<a href="" . $config['home_url'] . "index.php?go=radio&rcat=" . $radio_cat_info[intval( $row['category'] )]['alt_name'] . "">" . stripslashes( $radio_cat_info[intval( $row['category'] )]['name'] ) . "</a>";
    
    if( 
$row['category'] ) $tpl->set( "{cat}", $cat_link );
    else 
$tpl->set( "{cat}", "" );
    
    
$tpl->compile('radioTable');
    
    
$i++;
    
}

$tpl->clear();
 if( 
$radio_found ) {

    
// header
    
if( isset( $radio_config['title'] )) $metatags['title'] = $radio_config['title'];
    if( isset( 
$radio_config['description'] )) $metatags['description'] = $radio_config['description'];
    if( isset( 
$radio_config['keywords'] )) $metatags['keywords'] = $radio_config['keywords'];

    
$tpl->load_template("radio/radio.tpl");
    
$tpl->set("{radio-list}", $tpl->result["radioTable"]);
$tpl->compile('content');
    
$tpl->clear();
 
} else {

$tpl->load_templates ('radio/no.tpl');
$tpl->compile('content');

}
// play now

$db->free();


//####################################################################################################################
//         Навигация
//####################################################################################################################
if( $count_all ) {
    
    
$tpl->load_template( 'nav.tpl' );

    
$no_prev = false;
    
$no_next = false;
    
    if( isset( 
$cstart ) and $cstart != "" and $cstart > 0 ) {
        
$prev = $cstart / $perpage;
        
        if( 
$config['allow_alt_url'] == "yes" ) {

            if (
$prev == 1) $prev_page = $url_page . "/";
            else 
$prev_page = $url_page . "/page/" . $prev . "/";

            
$tpl->set_block( "'[prev-link](.*?)[/prev-link]'si", "<a href="" . $prev_page . "">\1</a>" );

        } else {

            if (
$prev == 1) $prev_page = $PHP_SELF . "?" . $user_query;
            else 
$prev_page = $PHP_SELF . "?cstart=" . $prev . "&amp;" . $user_query;

            
$tpl->set_block( "'[prev-link](.*?)[/prev-link]'si", "<a href="" . $prev_page . "">\1</a>" );
        }
    
    } else {
        
$tpl->set_block( "'[prev-link](.*?)[/prev-link]'si", "<span>\1</span>" );
        
$no_prev = TRUE;
    }
    
    if( 
$perpage ) {

        
$pages = "";
        
        if( 
$count_all > $perpage ) {
            
            
$enpages_count = @ceil( $count_all / $perpage );
            
            
$cstart = ($cstart / $perpage) + 1;
            
            if( 
$enpages_count <= 10 ) {
                
                for(
$j = 1; $j <= $enpages_count; $j ++) {
                    
                    if( 
$j != $cstart ) {
                        
                        if( 
$config['allow_alt_url'] == "yes" ) {

                            if (
$j == 1) $pages .= "<a href="" . $url_page . "/">$j</a> ";
                            else 
$pages .= "<a href="" . $url_page . "/page/" . $j . "/">$j</a> ";

                        } else {

                            if (
$j == 1) $pages .= "<a href="$PHP_SELF?{$user_query}">$j</a> ";
                            else 
$pages .= "<a href="$PHP_SELF?cstart=$j&amp;$user_query">$j</a> ";

                        }
                    
                    } else 
$pages .= "<span>$j</span> ";
                
                }
            
            } else {
                
                
$start = 1;
                
$end = 10;
                
$nav_prefix = "<span class="nav_ext">{$lang['nav_trennen']}</span> ";
                
                if( 
$cstart > 0 ) {
                    
                    if( 
$cstart > 6 ) {
                        
                        
$start = $cstart - 4;
                        
$end = $start + 8;
                        
                        if( 
$end >= $enpages_count ) {
                            
$start = $enpages_count - 9;
                            
$end = $enpages_count - 1;
                            
$nav_prefix = "";
                        } else 
$nav_prefix = "<span class="nav_ext">{$lang['nav_trennen']}</span> ";
                    
                    }
                
                }
                
                if( 
$start >= 2 ) {
                    
                    if( 
$config['allow_alt_url'] == "yes" ) $pages .= "<a href="" . $url_page . "/">1</a> <span class="nav_ext">{$lang['nav_trennen']}</span> ";
                    else 
$pages .= "<a href="$PHP_SELF?{$user_query}">1</a> <span class="nav_ext">{$lang['nav_trennen']}</span> ";
                
                }
                
                for(
$j = $start; $j <= $end; $j ++) {
                    
                    if( 
$j != $cstart ) {

                        if( 
$config['allow_alt_url'] == "yes" ) {

                            if (
$j == 1) $pages .= "<a href="" . $url_page . "/">$j</a> ";
                            else 
$pages .= "<a href="" . $url_page . "/page/" . $j . "/">$j</a> ";

                        } else {

                            if (
$j == 1) $pages .= "<a href="$PHP_SELF?{$user_query}">$j</a> ";
                            else 
$pages .= "<a href="$PHP_SELF?cstart=$j&amp;$user_query">$j</a> ";

                        }
                    
                    } else 
$pages .= "<span>$j</span> ";
                
                }
                
                if( 
$cstart != $enpages_count ) {
                    
                    if( 
$config['allow_alt_url'] == "yes" ) $pages .= $nav_prefix . "<a href="" . $url_page . "/page/{$enpages_count}/">{$enpages_count}</a>";
                    else 
$pages .= $nav_prefix . "<a href="$PHP_SELF?cstart={$enpages_count}&amp;$user_query">{$enpages_count}</a>";
                
                } else 
$pages .= "<span>{$enpages_count}</span> ";
            
            }
        
        }
        
$tpl->set( '{pages}', $pages );
    }
    
    if( 
$perpage and $perpage < $count_all and $i < $count_all ) {
        
$next_page = $i / $perpage + 1;
        
        if( 
$config['allow_alt_url'] == "yes" ) {
            
$next = $url_page . '/page/' . $next_page . '/';
            
$tpl->set_block( "'[next-link](.*?)[/next-link]'si", "<a href="" . $next . "">\1</a>" );
        } else {
            
$next = $PHP_SELF . "?cstart=" . $next_page . "&amp;" . $user_query;
            
$tpl->set_block( "'[next-link](.*?)[/next-link]'si", "<a href="" . $next . "">\1</a>" );
        };
    
    } else {
        
$tpl->set_block( "'[next-link](.*?)[/next-link]'si", "<span>\1</span>" );
        
$no_next = TRUE;
    }
    
    if( ! 
$no_prev or ! $no_next ) {
        
$tpl->compile( 'navi' );

        switch ( 
$config['news_navigation'] ) {

            case 
"2" :
                
$tpl->result['content'] = $tpl->result['navi'].$tpl->result['content'];
                break;

            case 
"3" :
                
$tpl->result['content'] = $tpl->result['navi'].$tpl->result['content'].$tpl->result['navi'];
                break;

            default :
                
$tpl->result['content'] .= $tpl->result['navi'];
                break;
        
        }
    }
    
    
$tpl->clear();
}
}
?>
Онлайн: 2
Реклама