Вход Регистрация
Файл: muzxit.ru/stars/index.php
Строк: 137
<?php


define
('_IN_JOHNCMS', 1);
$headmod = 'stars';
require(
'../incfiles/core.php');
$lng_stars = core::load_lng('stars');
if (isset(
$_SESSION['ref']))
    unset(
$_SESSION['ref']);
    
if(!
mysql_num_rows(mysql_query("
SHOW TABLES LIKE "
stars"

"
)))
    
header("location: install.php");    
// Задаем заголовки страницы
$textl = $lng_stars['stars'];    
require(
'../incfiles/head.php');
$cats = mysql_fetch_assoc(mysql_query("select * from `stars` where `id` = '$id';"));
if(
$id)
{
    
$pref = 'where `cid` = '' . $id . '' order by `type` asc, `name` asc';
}
else
{
    
$pref = 'where `type` = '0' and `cid` = '0' order by `name` asc';
}
$sql = mysql_query("select * from `stars` " . $pref . " limit " . $start . ", " . $kmess . ";");

$cats2 = mysql_fetch_assoc(mysql_query("select * from `stars` where `id` = '$cats[cid]';"));
$cats3 = $cats2['cid'] != 0 ? mysql_fetch_assoc(mysql_query("select * from `stars` where `id` = '$cats2[cid]';")) : null;
/*
---------------------------------
Верхнее меню навигации
---------------------------------
*/
echo '<div class="topmenu">
<div class="phdr2">'
 
. ($id ?  '<a href="index.php">' . $lng_stars['stars'] . '</a>'
 
. ($cats3 != null ? ' - <a href="index.php?id=' . $cats2['cid'] . '">' . $cats3['name'] . '</a>' : null)
 . (
$cats['cid'] != 0 ? ' - <a href="index.php?id=' . $cats['cid'] . '">' . $cats2['name'] . '</a>' : null)
 . 
' - <b>' . $cats['name'] . '</b>' : '<b>' . $lng_stars['stars'] . '</b>')
. 
'</div>';
echo 
'<div class="topmenu"><a href="films.php">' . $lng_stars['search_stars'] . '</a></div>';


$total = mysql_result(mysql_query("select count(*) from `stars` " . $pref . ";"),0);
if(
$cats['type'] == 0)
{
    if(
$total < 1)
    {
        if(
$rights >= 8)
        {
            echo 
'<div class="alarm">' . $lng_stars['empty'] . '</div>
            <div class="bmenu"><a href="addcat.php' 
. ($id ? '?id=' . $id : null) . '">' . $lng_stars['addcat'] . '</a></div>'
            
. ($id ? '<div class="bmenu"><a href="add.php?id=' . $id . '">' . $lng_stars['add'] . '</a></div>' : null);
        }
    }
    else
    {
    
        echo 
'<div class="menu">';
        
$i = 0;
        
$razm = $agent_web == 'web' ? '64' : '32';
        while(
$cat = mysql_fetch_assoc($sql))
        {
            
$total_star = 0;
            
$_t1 = mysql_query("select * from `stars` where `cid` = '$cat[id]'");
            while(
$_t2 = mysql_fetch_assoc($_t1))
            {
                if(
$_t2['type'] == 1)
                    
$total_star++;
                
$_t3 = mysql_query("select * from `stars` where `cid` = '$_t2[id]'");
                while(
$t3 = mysql_fetch_assoc($_t3))
                {
                    if(
$t3['type'] == 1)
                        
$total_star++;
                    
$_t4 = mysql_query("select * from `stars` where `cid` = '$t3[id]'");
                    while(
$t4 = mysql_fetch_assoc($_t4))
                    {
                        if(
$t4['type'] == 1)
                            
$total_star++;
                    }
                }
            }
            
            echo 
$i % 2 ? '<div class="list2">' : '<div class="list1">';
            echo 
'<table cellpadding="0" cellspacing="0"><tr><td>';
            if(
$cat['type'] == 1)
            {
                if(
file_exists('photo/' . $cat['id'] . '.jpg'))
                    
$img = '<img src="photo/' . $cat['id'] . '.jpg" alt="' . $cat['name'] . '" width="' . $razm . '" height="' . $razm . '" />&#160;</td><td>';
                elseif(
file_exists('photo/' . $cat['id'] . '.jpeg'))
                    
$img = '<img src="photo/' . $cat['id'] . '.jpeg" alt="' . $cat['name'] . '" width="' . $razm . '" height="' . $razm . '" />&#160;</td><td>';
                elseif(
file_exists('photo/' . $cat['id'] . '.bmp'))
                    
$img = '<img src="photo/' . $cat['id'] . '.bmp" alt="' . $cat['name'] . '" width="' . $razm . '" height="' . $razm . '" />&#160;</td><td>';
                elseif(
file_exists('photo/' . $cat['id'] . '.png'))
                    
$img = '<img src="photo/' . $cat['id'] . '.png" alt="' . $cat['name'] . '" width="' . $razm . '" height="' . $razm . '" />&#160;</td><td>';
                elseif(
file_exists('photo/' . $cat['id'] . '.gif'))
                    
$img = '<img src="photo/' . $cat['id'] . '.gif" alt="' . $cat['name'] . '" width="' . $razm . '" height="' . $razm . '" />&#160;</td><td>';
                else
                    
$img = '<img src="../images/star.gif" width="' . $razm . '" height="' . $razm . '" />&#160;</td><td>';
            }
            else
            {
$img = '<img src="../movie.png" width="16" height="16" />&#160;</td><td>';
            }
            echo 
$img . '<a href="index.php?id=' . $cat['id'] . '">' . $cat['name'] . '</a> ' . ($cat['type'] != 1 ? '[' . $total_star . ']' : null);
            echo 
'</td></tr></table></div>';
              ++
$i;
        }
        echo 
'</div>
        <div class="phdr">' 
. $lng['total'] . ': ' . $total . '</div>';
        if (
$total > $kmess) {
                echo 
'<div class="topmenu">' . functions::display_pagination('index.php?id=' . $id . '&amp;', $start, $total, $kmess) . '</div>' .
                     
'<p><form action="index.php" method="get"><input type="text" name="page" size="2"/>' .
                     
'<input type="submit" value="' . $lng['to_page'] . ' &gt;&gt;"/></form></p>';
            }
          if(
$rights >= 8)
        {
            echo 
'<div class="gmenu">
            <div class="bmenu"><a href="addcat.php' 
. ($id ? '?id=' . $id : null) . '">' . $lng_stars['addcat'] . '</a></div>' . ($id ? '<div class="bmenu"><a href="add.php?id=' . $id . '">' . $lng_stars['add'] . '</a></div>' : null) . '</div>';
        }
    }
}
else
{
    
$sql = mysql_query("select * from `stars` where `id` = '$id'");
    
$total = mysql_num_rows($sql);
    if(
$total < 1)
    {
        if(
$rights >= 6)
        {
            echo 
'<div class="alarm">' . $lng_stars['emptystar'] . '</div>
            <div class="gmenu"><a href="addcat.php' 
. ($id ? '&amp;id=' . $id : null) . '">' . $lng_stars['addcat'] . '</a></div>';
        }
    }
    else
    {
        
$star = mysql_fetch_assoc($sql);
        echo 
'<div class="phdr">' . $star['name'] . '</div>
        <div class="topmenu">'
;
        if(
file_exists('photo/' . $id . '.jpg'))
            echo 
'<img src="photo/' . $id . '.jpg" alt="' . $star['name'] . '" />';
        elseif(
file_exists('photo/' . $id . '.jpeg'))
            echo 
'<img src="photo/' . $id . '.jpeg" alt="' . $star['name'] . '" />';
        elseif(
file_exists('photo/' . $id . '.bmp'))
            echo 
'<img src="photo/' . $id . '.bmp" alt="' . $star['name'] . '" />';
        elseif(
file_exists('photo/' . $id . '.png'))
            echo 
'<img src="photo/' . $id . '.png" alt="' . $star['name'] . '" />';
        elseif(
file_exists('photo/' . $id . '.gif'))
            echo 
'<img src="photo/' . $id . '.gif" alt="' . $star['name'] . '" />';
        echo 
'</div>';
        echo 
'<div class="phpcode">
        <div class="topmenu"><b>' 
. $lng_stars['name'] . '</b>: ' . $star['name'] . '</div>
        ' 
. (!empty($star['namelat']) ? '<div class="topmenu"><b>' . $lng_stars['namelat'] . '</b>: ' . $star['namelat'] . '</div>' : null) .         
        
'<div class="topmenu"><b>' . $lng_stars['birth'] . '</b>: ' . $star['birth'] . '</div>'
         
. (!empty($star['where_born']) ? '<div class="topmenu"><b>' . $lng_stars['where_born'] . '</b>: ' . $star['where_born'] . '</div>' : null) .
        
'<div class="topmenu"><b>' . $lng_stars['about'] . '</b>: ' . functions::checkout($star['about'], 1, 1) . '</div>';
        if(!empty(
$star['films']))
        {
            echo 
'<div class="topmenu"><b>' . $lng_stars['films'] . '</b>: ';
            
$films = explode(';', $star['films']);
            
$text = null;
            foreach(
$films as $key)
            {
                
$key = trim($key);
                
$text .= '<a href="films.php?search=' . rawurlencode($key) . '"><b>' . $key . '</b></a>, ';
            }
            
$text2 = explode(',', $text);
            unset(
$text2[end($text2)]);
               unset(
$text2[count($text2)-1]);
               
               
$texts = array();
            
//$text2 = implode(',', $text2);
            
foreach($text2 as $keys)
            {
                if(
$keys != end($text2))
                    
$pref = ',';
                   else
                       
$pref = '';
                   
$texts[] = $keys.$pref;
            }
            echo 
implode('', $texts);
            echo 
'</div>';
        }
        echo 
'</div>' . ($rights >= 8 ? '<div class="gmenu"><a href="addfile.php?id=' . $id . '">' . $lng_stars['edit_foto'] . '</a></div><div class="gmenu"><a href="edit.php?id=' . $id . '">' . $lng['edit'] . '</a></div>' : null);
    }
}
/*
---------------------------------
Нижнее меню навигации
---------------------------------
*/
echo '<div class="topmenu">
<div class="bmenu">'
 
. ($id ?  '<a href="index.php">' . $lng_stars['stars'] . '</a>'
 
. ($cats3 != null ? ' - <a href="index.php?id=' . $cats2['cid'] . '">' . $cats3['name'] . '</a>' : null)
 . (
$cats['cid'] != 0 ? ' - <a href="index.php?id=' . $cats['cid'] . '">' . $cats2['name'] . '</a>' : null)
 . 
' - <b>' . $cats['name'] . '</b>' : '<b>' . $lng_stars['stars'] . '</b>')
. 
'</div></div>';


require(
'../incfiles/end.php');
?>
Онлайн: 1
Реклама