Просмотр файла newmir/index.php

Размер файла: 5.68Kb
<?php
require_once ("../includes/start.php");
require_once ("../includes/functions.php");
require_once ("../includes/header.php");
include_once (BASEDIR."themes/".$config['themes']."/index.php");
require_once ("../local/newmir.dat");
if (isset($_GET['start'])) {$start = (int)$_GET['start'];} else {$start = 0;}
if (isset($_GET['action'])) {$action = check($_GET['action']);} else {$action = "";}
show_title('messages.gif', $name_r);
if ($action=="") {
if (is_admin(array(101,102,103,105))){ echo '<a href="'.ADMINDIR.'newmir.php?'.SID.'">Управление</a>'; }
if (file_exists(DATADIR."datanewmir/database.dat")) {
$lines = file(DATADIR."datanewmir/database.dat");
$total = count($lines);
if ($total>0) {
foreach($lines as $boardval){
$data = explode("|", $boardval);	
$totalboard = counter_string(DATADIR."datanewmir/$data[2].dat");
echo '<div class="b"><img src="../images/img/online.gif" alt="image" /> ';
echo '<b><a href="index.php?action=newmir&amp;id='.$data[2].'&amp;'.SID.'">'.$data[0].'</a></b> ('.(int)$totalboard.')</div>';
echo '<div>';
if($totalboard>0){
$fileboard = file(DATADIR."datanewmir/$data[2].dat");
$lostlist = explode("|",end($fileboard));
if (utf_strlen($lostlist[0])>35) {$lostlist[0]=utf_substr($lostlist[0],0,30); $lostlist[0].="...";}
echo 'Свежая статья:<br /><a href="index.php?action=view&amp;id='.$lostlist[6].'&amp;bid='.$lostlist[5].'&amp;'.SID.'">'.$lostlist[0].'</a><br />';
echo '<small>('.date_fixed($lostlist[3]).')</small>'; 
} else {echo $name_eror5;}
echo '</div>';
}
$total2=(int)$total+1;
echo '</div><div class="b"><img src="../images/img/online.gif" alt="image" /> ';
echo '<b><a href="../board/index.php?'.SID.'">Доска объявлений</a></b> ('.stats_board().')</div>';
echo '<div>Ваши объявления<br />';
echo '<br />Всего рубрик: <b>'.$total2.'</b><br />';
} else {show_error($name_eror1);}
} else {show_error($name_eror1);}}
if ($action=="newmir"){
$id = (int)$_GET['id'];
if (file_exists(DATADIR."datanewmir/$id.dat")){
$string = search_string(DATADIR."datanewmir/database.dat", $id, 2);
if ($string) {
echo '<a href="#down"><img src="../images/img/downs.gif" alt="image" /></a> ';
echo '<a href="index.php?'.SID.'">'.$name_r2.'</a>';
if (is_admin(array(101,102,103,105))){
echo ' | <a href="add.php?id='.$id.'&amp;'.SID.'">Добавить</a>';
echo ' | <a href="'.ADMINDIR.'newmir.php?'.SID.'">Управление</a>';}
echo '<br /><br /><b><img src="../images/img/online.gif" alt="image" /> '.$string[0].'</b><br /> ('.$string[1].')<br />';
if (file_exists(DATADIR."datanewmir/$id.dat")){
$files = file(DATADIR."datanewmir/$id.dat");
$newlines = array();
foreach($files as $bkey=>$bvalue){
$bdata = explode("|", $bvalue);
if($bdata[4]<SITETIME){ 
$newlines[] = (int)$bkey;}}
if(count($newlines)>0){
delete_lines(DATADIR."datanewmir/$id.dat", $newlines);}
$files = array_reverse($files);
$total = count($files);
if ($total>0) {
if ($start < 0 || $start >= $total){$start = 0;}
if ($total < $start + $config['boardspost']){ $end = $total; }
else {$end = $start + $config['boardspost']; }
for ($i = $start; $i < $end; $i++){	
$data = explode("|",$files[$i]);
if (utf_strlen($data[2])>100) {
$data[2] = utf_substr($data[2],0,100); $data[2].="...";}
echo '<div class="b"><img src="../images/img/edit.gif" alt="image" /> '.($i+1).'. <b><font color=black>'.$data[0].'</font></b></div>';
echo '<b>Кратко:</b>'.$data[2].'<br /><a href="index.php?action=view&amp;id='.$id.'&amp;bid='.$data[5].'&amp;start='.$start.'&amp;'.SID.'">'.$name_r3.'.</a><br /><small>('.date_fixed($data[3]).')</small>';
if (is_admin(array(101,102,103,105))){
echo '<br />Добавил: <a href="../pages/anketa.php?uz='.$data[1].'&amp;'.SID.'">'.nickname($data[1]).'</a><br />';}}
page_jumpnavigation('index.php?action=newmir&amp;id='.$id.'&amp;', $config['boardspost'], $start, $total);
page_strnavigation('index.php?action=newmir&amp;id='.$id.'&amp;', $config['boardspost'], $start, $total);
echo '<br />Всего статей: <b>'.(int)$total.'</b><br />';} else {show_error($name_eror4);}} else {show_error($name_eror4);}} else {show_error($name_eror3);}} else {show_error($name_eror3);}
echo '<br /><img src="../images/img/back.gif" alt="image" /> <a href="index.php?'.SID.'">Вернуться</a>';} if($config['userfiles']==1){ ob_start('newlos'); }
if($action=="view"){
$id = (int)$_GET['id'];
$bid = (int)$_GET['bid'];
if (file_exists(DATADIR."datanewmir/$id.dat")){
$string = search_string(DATADIR."datanewmir/database.dat", $id, 2);
if ($string) {
$bstr = search_string(DATADIR."datanewmir/$id.dat", $bid, 5);
if ($bstr) {
echo '<a href="#down"><img src="../images/img/downs.gif" alt="image" /></a> ';
echo '<b><img src="../images/img/board.gif" alt="image" /> '.$bstr[0].'</b><br /><br />';
echo 'Текст статьи: '.$bstr[2].'<br /><br />';
echo 'Пожаловаться:<a href="../pages/privat.php?action=submit&amp;uz='.$bstr[1].'&amp;'.SID.'">Администратору</a><br />';
echo 'Дата размещения:  '.date_fixed($bstr[3]).'<br />';
echo 'Опубликовано до: <b>'.date_fixed($bstr[4]).'</b><br />';
} else {show_error($name_eror2);}
} else {show_error($name_eror3);}
} else {show_error($name_eror3);}
echo '<br /><br /><img src="../images/img/back.gif" alt="image" /> <a href="index.php?action=newmir&amp;id='.$id.'&amp;start='.$start.'&amp;'.SID.'">Вернуться</a><br />'; 	
echo '<img src="../images/img/board.gif" alt="image" /> <a href="index.php?'.SID.'">'.$name_r2.'</a>'; 	}
echo '<br /><img src="../images/img/homepage.gif" alt="image" /> <a href="../index.php?'.SID.'">На главную</a>';
include_once ("../themes/".$config['themes']."/foot.php");
?>