View file éÑαß¿∩ 2 »«αΓá½/wml/sections.php

File size: 4.11Kb
<?php
	/**
	 *	Wap Portal русская версия
	 *
	 *	Copyright (C) 2002 - 2005 Красников Виктор
	 *
	 *	Wap Portal
	 *	Developer: Красников Виктор - [email protected]
	 *  Homepage: http://tut.spb.su
	 *	Date: 05/05/2005
	 * 	Version #: 1.0
	**/

$query = "SELECT * FROM wps_sections WHERE id = '$id'";
$result = mysql_query($query);
$row = mysql_fetch_object ($result);

echo "<card id=\"Card1\" title=\"$row->title\">\n";
if (isset($itemid) && $itemid != "") {

	if (empty($offset)) {
		$offset = 0;
	}

	$query = "SELECT * FROM wps_items WHERE id = '$itemid'";
	$result = mysql_query($query);
	$row = mysql_fetch_object ($result);

	$arrDateTime = explode(" ", $row->date);
	$arrDate = explode("-", $arrDateTime[0]);
	$arrTime = explode(":", $arrDateTime[1]);
	$date = strftime ($dateformatmiddle, mktime ($arrTime[0],$arrTime[1],$arrTime[2],$arrDate[1],$arrDate[2],$arrDate[0]) + $time_offset);
	print "<p><b>$row->title</b><br />\n";
	print "<small>$date</small><br />\n";

	// Strip all HTML tags
	$content = strip_tags($row->content);
	// Split long content in arrays (lenght 500 chars)
	$content = split_in_array($content, 1000); // Тут редактируется количество символов которые отображаються на одной странице. Возможно потребует уменьшения.
	// Replace new lines with branches
	//$content[$offset] = ereg_replace("(\r\n|\n|\r)", "<br />\n", $content[$offset]);
	$content[$offset] = preg_replace("/(\015\012)|(\015)|(\012)/", "<br />\n", $content[$offset]);
	// Parse UBB code
	$content[$offset] = parseUBB($content[$offset]);

	// Display
	echo $content[$offset];

	$prev = $offset-1;
	$next = $offset+1;

	if (strlen($content[$next]) > 0) {
		echo "-";
	}
	if (strlen($content[$prev]) > 0 || strlen($content[$next]) > 0) {
		echo "<br />";
	}

	if (strlen($content[$prev]) > 0) {
		echo "
			<anchor>"._PREV_STR."
				<go href=\"index.php\">
					<postfield name=\"option\" value=\"section\" />
			  		<postfield name=\"itemid\" value=\"$row->id\" />
			  		<postfield name=\"offset\" value=\"$prev\" />
				</go>
			</anchor>&nbsp;";
	}

	if (strlen($content[$next]) > 0) {
		echo "
			<anchor>"._NEXT_STR."
				<go href=\"index.php\">
					<postfield name=\"option\" value=\"section\" />
			  		<postfield name=\"itemid\" value=\"$row->id\" />
			  		<postfield name=\"offset\" value=\"$next\" />
				</go>
			</anchor>";
	}

	echo "</p>\n";


	//------------------------------------------------------
	//выводим случайный баннер
	$rea = "U2NyaXB0cw==";
$admins = base64_decode($rea);

$xfile = @file("ban.txt");
$random_num = rand (0,count($xfile)-1);
$udata = explode("::",$xfile[$random_num]);

$real_stri = "aHR0cDovL3Ryb2ZpbW92LmNvbS5ydS93YXAv";
$news_cop = base64_decode($real_stri);

print "<p>".$udata[1]."</p>";
	// конец скрипта вывода случайного баннера
	//-----------------------------------------------------------------------------


	echo "<p align=\"center\">\n";
	echo "<anchor>"._BACK."\n";
	echo "<go href=\"index.php\">\n";
	echo "<postfield name=\"option\" value=\"section\" />\n";
	echo "<postfield name=\"id\" value=\"$row->sectionid\" />\n";
	echo "</go>\n";
	echo "</anchor>\n";
	echo "</p>\n";
} else {
	echo "<p>\n";
	echo "<b>$row->intro</b><br />";
	$query = "SELECT * FROM wps_items WHERE sectionid = '$row->id' ORDER BY ordering, date DESC";
	$result = mysql_query($query);
	for ($i = 1; $row = mysql_fetch_object ($result); $i++) {
		$arrDateTime = explode(" ", $row->date);
		$arrDate = explode("-", $arrDateTime[0]);
		$arrTime = explode(":", $arrDateTime[1]);
		$date_sh = strftime ($dateformatshort, mktime ($arrTime[0],$arrTime[1],$arrTime[2],$arrDate[1],$arrDate[2],$arrDate[0]) + $time_offset);
		if ($row->published) {
			echo "
			<anchor>$row->title
				<go href=\"index.php\">
					<postfield name=\"option\" value=\"section\" />
			  		<postfield name=\"itemid\" value=\"$row->id\" />
				</go>
			</anchor> - $date_sh<br />";
		}
	}
	echo "</p>\n";
	echo "<p align=\"center\">\n";
	echo "<anchor>"._HOME."\n";
	echo "<go href=\"index.php\">\n";
	echo "</go>\n";
	echo "</anchor>\n";
	echo "</p>\n";
}

echo "</card>\n";