Просмотр файла chatrotor/chat/4/index.php

Размер файла: 4.38Kb
<?php
#================================================#
#            == Чат для Rotor CMS ==             #
#              "Мега-чат"                        #
#             Made by:  Shur1k                   #
#             Site:  WAP.ROVNO.UA                #
#             ICQ: 444307535                     #
#              (c) 22.11.2010                    #
#================================================# 
require_once ('../../includes/start.php');
require_once ('../../includes/functions.php');
require_once ('../../includes/header.php');
include_once ('../../themes/' . $config['themes'] . '/index.php');

include_once ('../includes/functions.php'); // Дополнительные функции из wap-motor 19

if (isset($_GET['start'])) {$start = abs(intval($_GET['start']));} else {$start = 0;}
if (isset($_GET['imja'])){$imja = '[b]'.safe_decode(check($_GET['imja'])).'[/b], ';} else {$imja = "";}

show_title('types.png', 'Кафешка');
$config['newtitle'] = 'Кафешка';


echo '<a href="index.php?rand='.mt_rand(100,999).'&amp;'.SID.'">Обновить</a>';
if (is_admin(array(101,102,103,105))){echo ' / <a href="'.ADMINDIR.'4chatuser.php?start='.$start.'&amp;'.SID.'">Управление</a>';}
echo '<hr />';

if (is_user()){
echo '<div class="form" id="form">';
echo '<form action="add.php?'.SID.'" method="post">';
echo '<b>Сообщение:</b><br />';
echo '<textarea cols="20" rows="3" name="msg">'.$imja.'</textarea><br />';
echo '<input type="submit" value="Добавить" /></form></div>';

} else {show_login('Вы не авторизованы, чтобы добавить сообщение, необходимо');}

if (is_user()){
//------------------//
//----------------------------  Подключение бота  -----------------------------------------// 
if($config['botnik']==1){ 
if(empty($_SESSION['botochat'])){ 
     
$hellobots = array('Приветик', 'Здравствуй', 'Хай', 'Добро пожаловать', 'Салют', 'Hello', 'Здарова');  
$hellobots_rand = array_rand($hellobots);  
$hellobots_well = $hellobots[$hellobots_rand]; 

$mmagfi = file(DATADIR."4chat.dat"); 
$mmagshow = explode("|",end($mmagfi)); 

$weltext = no_br($hellobots_well.', '.nickname($log).'!|Олька||'.SITETIME.'|SIE-S65|127.0.0.2|0|'.$mmagshow[7].'|'.$mmagshow[8].'|'); 

write_files(DATADIR."4chat.dat", "$weltext\r\n"); 

$_SESSION['botochat']=1; 
}} 


//------------------//

$countstr = counter_string(DATADIR."4chat.dat");
if ($countstr>=$config['maxpostchat']) {
delete_lines(DATADIR."4chat.dat", array(0,1,2,3,4));
}
}

//---------------------------------------------------------------//
$file = file(DATADIR."4chat.dat");
$file = array_reverse($file);
$total = count($file);    

if ($total>0){

if ($start < 0 || $start >= $total){$start = 0;}
if ($total < $start + $config['chatpost']){ $end = $total; }
else {$end = $start + $config['chatpost']; }
for ($i = $start; $i < $end; $i++){

$data = explode("|",$file[$i]);

$useronline = user_online($data[1]);
$useravatars = user_avatars($data[1]);

if ($data[1]=='Олька'){$useravatars='<img src="img/bot.gif" alt="image" /> '; $useronline='<span style="color:#00ff00">[On]</span>';}



            echo '<div class="b">';
            echo '<div class="img">' . $useravatars . '</div>';

echo '<b><a href="index.php?imja='.safe_encode(nickname($data[1])).'&amp;'.SID.'#form">'.nickname($data[1]).'</a></b>  <small>('.date_fixed($data[3]).')</small><br />';
echo $useronline.'<a href="../../pages/anketa.php?uz=' . $data[1] . ' '.SID.'">[i]</a></div>';
echo '<div>'.bb_code($data[0]).'<br />';
echo '</div>';
}

page_jumpnavigation('index.php?', $config['chatpost'], $start, $total);
page_strnavigation('index.php?', $config['chatpost'], $start, $total);

} else {show_error('Сообщений нет, будь первым!');}



echo '<br /><a href="#up"><img src="../../images/img/ups.gif" alt="image" /></a> ';
echo '<a href="../../pages/pravila.php?'.SID.'">Правила</a> / ';
echo '<a href="../../pages/smiles.php?'.SID.'">Смайлы</a> / ';
echo '<a href="../index.php?'.SID.'">К комнатам</a><br /><br />';

echo '<img src="../../images/img/homepage.gif" alt="image" /> <a href="../index.php?'.SID.'">На главную</a>'; 

include_once ("../../themes/".$config['themes']."/foot.php");
?>