Просмотр файла ticket/read.php

Размер файла: 5.05Kb
<?php
#######################################
### Тикет система для JohnCMS 3.2.2 ###
###       Автор скрипта: desay      ###
###         ICQ: 640-976-131        ###
#######################################
defined('_IN_JOHNCMS') or die('Error: restricted access');

$headmod = 'ticket';
$textl = 'Тикет';

if (!$id ) {
    header('Location: index.php');
    exit;
}


$type = mysql_query("SELECT * FROM `ticket` WHERE `id` = '$id' AND `type`='1'");
$type1 = mysql_fetch_array($type);
        
        // Проверка, имеет ли право читать юзер
        if (($type1['user'] !=$user_id ) && $rights<7) {
            require_once ('../incfiles/head.php');
            //ECHo "$type1[user] =! $user_id ";
            echo '<div class="rmenu"><p>ОШИБКА!<br /><a href="index.php">Назад</a></p></div>';
            require_once ('../incfiles/end.php');
            exit;
        }



$reqt = mysql_query("SELECT * FROM `ticket` where `id`='$id' LIMIT 1;");
$arrt = mysql_fetch_array($reqt);
    echo '<div class="phdr"><a href="index.php"><b>Тикеты</b></a> | № '.$arrt[id].'</div>';
    
        echo  '<div class="gmenu">';
        if ($rights>1){
            echo '<div class="func">';
            if ($arrt[status]==1){
            echo '<a href="index.php?act=edit&amp;id='.$arrt[id].'&amp;close">Закрыть</a>';
            echo' | <a href="index.php?act=edit&amp;id='.$arrt[id].'&amp;smotr">На решение</a>'; 
            echo' | <b>Открыть</b>'; 
            }
            if ($arrt[status]==2){
            echo '<a href="index.php?act=edit&amp;id='.$arrt[id].'&amp;close">Закрыть</a>';
            echo' | <b>На решение</b>'; 
            echo' | <a href="index.php?act=edit&amp;id='.$arrt[id].'&amp;open">Открыть</a>'; 
            }
            if ($arrt[status]==3){
            echo '<b>Закрыть</b>';
            echo' | <a href="index.php?act=edit&amp;id='.$arrt[id].'&amp;smotr">На решение</a>'; 
            echo' | <a href="index.php?act=edit&amp;id='.$arrt[id].'&amp;open">Открыть</a>'; 
            }
           
            echo'</div>';
        }
$requ = mysql_query("SELECT `name`, `rights` FROM `users` where `id`='$arrt[user]' LIMIT 1");
  $arru = mysql_fetch_array($requ);        
                  $text = $arrt['text'];
                  $text = checkout($text, 1, 1);
             if ($set_user['smileys'])
                  $text = smileys($text, $arru['rights'] ? 1 : 0);
                   echo '' .$text.'';
               echo '<div class="sub">Добавил: <a href="../str/anketa.php?user='.$arrt[user].'">'.$arru[name].'</a><br/>';
                
        echo 'Время: ' . date("d.m.Y / H:i", $arrt['time'] + $set_user['sdvig'] * 3600) . '<br/>';
        $prior = array (
        1 => 'Низкий',
        2 => 'Средний',
        3 => 'Высокий');
        
        echo 'Приоритет: '.$prior[$arrt[prior]].'</div>';
        echo '</div>';

 echo '<div class="phdr">Комментарии</div>';
 
   echo '<div class="gmenu"><img src="img/add.gif" width="16" height="16" class="left" />&nbsp;<a href="index.php?act=say&amp;id='.$arrt[id].'">Добавить коммент</a></div>';

$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `ticket` where `tick_id`='$arrt[id]' and `type`='2';"), 0);
        
$req = mysql_query("SELECT * FROM `ticket` where `tick_id`='$arrt[id]' and `type`='2'  order by `time` DESC LIMIT $start, $kmess;");
if ($total != '0') {

 
    

    while ($arr = mysql_fetch_array($req)) {
        echo ($i % 2) ? '<div class="list1">' : '<div class="list2">';
        
$requa = mysql_query("SELECT `name`, `rights` FROM `users` where `id`='$arr[user]' LIMIT 1");
$arrua = mysql_fetch_array($requa);        
        
        echo '<a href="../str/anketa.php?user='.$arr[user].'">'.$arrua[name].'</a>';
                
        echo ' (' . date("d.m.Y / H:i", $arr['time'] + $set_user['sdvig'] * 3600) . ')<br/>';
                 $texto = $arr['text'];
                 $texto = checkout($texto, 1, 1);
             if ($set_user['smileys'])
                 $texto = smileys($texto, $arrua['rights'] ? 1 : 0);
                
                
        echo '' .$texto.'';
        if($rights >7)
        echo '<div class="sub"><a href="?act=del_komm&amp;id='.$arr[id].'&amp;do='.$arrt[id].'">Удалить</a></div>';
        
        echo '</div>';
        ++$i;
    }
	        if ($total > $kmess) {
            echo '<p>' . pagenav('index.php?act=read&amp;id='.$id.'&amp;', $start, $total, $kmess) .
                '</p>';
            echo '<p><form action="index.php?act=read&amp;id='.$arrt[id].'&amp;" method="post">Стр: <input type="text" name="page" size="2"/><input type="submit" value="&gt;&gt;"/></form></p>';
        }


   

}else {echo '<div class="rmenu">Ответов нет!</div>';}

echo '<div class="phdr">Всего: ' . $total . '</div>';
echo '<p><a href="index.php">Назад</a></p>';

?>