Открыть Ответить

Модуль Pages

4

4

1
16.12.2009 05:11:40 16.12.2009 17:40:40
Модуль Pages

как убрать те надписи, кот. отмечены красным? что поправить в модуле надо?...

Версия системы SLAED CMS 2.6 Lite
Версия PHP PHP 5
Сервер Сервер в интернете
0wnell
0wnell
4.6

4.6

2
16.12.2009 17:37:29 16.12.2009 17:41:05

Если оформление, смотрите файлы:

templates/Stability/basic.html
и
templates/Stability/title.html


О сколько нам открытий чудных, Готовит просвещенья дух, И опыт, сын ошибок трудных, И гений, парадоксов друг...

SLAED CMS
SLAED CMS
3.24

3.24

3
16.12.2009 19:20:27

я имею ввиду надписи убрать: Статьи и заголовок статьи, в данном случае - Audrey Kitching (Одри Китчинг)

0wnell
0wnell
4.6

4.6

4
16.12.2009 19:54:42

я имею ввиду надписи убрать: Статьи и заголовок статьи, в данном случае - Audrey Kitching (Одри Китчинг)

версию озвуч

decide
decide
3.89

3.89

5
16.12.2009 19:58:20

Файл: modules/Pages/index.php
Функция: function page($pid, $pagenum=0) {
Удалите следующее:

PHP
title(""._PAGESNOTE."");

и

PHP
"<font class=\"option\">$title</font><br />".

О сколько нам открытий чудных, Готовит просвещенья дух, И опыт, сын ошибок трудных, И гений, парадоксов друг...

SLAED CMS
SLAED CMS
3.24

3.24

6
16.12.2009 20:30:11

SLAED CMS, спасибо. Завтра попробую.

decide, версия у меня 2.6 лайт.

ну и сразу вопрос не в тему. как убрать иконку отображающую тему новости, а то сама новость смещается из-за неё и выглядит не очень красиво. Убрать нужно полностью, чтобы новость строго по центру была.

title

Версия системы SLAED CMS 2.6 Lite
Версия PHP PHP 5
Сервер Сервер в интернете
0wnell
0wnell
4.6

4.6

7
16.12.2009 20:52:07

SLAED CMS, такс...насчет Pages. Сделал все как вы сказали.., теперь при нажатии на статью тупо белый экран и все..

а готового нет такого модуля?

Версия системы SLAED CMS 2.6 Lite
0wnell
0wnell
4.6

4.6

8
16.12.2009 21:16:42

0wnell, скопируйте код ниже и замените им свой код в modules/Pages/index.php

Код страницы:

Код
<?php
if (!defined('MODULE_FILE')) {
	Header("Location: ../../index.php");
	exit;
}
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
require_once("config/config_pages.php");
$pagetitle = "$defis "._CONTENT_NAME."";

function categories($id="") {
	global $prefix, $db, $module_name, $multilingual, $currentlang, $tablenumhome, $homesubcat, $catdescrhome, $shownumeric;
	static $massiv, $massiv2;
	$id = (intval($id)) ? $id : 0;
	if ($id) {
		$where = "WHERE parentid = '$id'";
	} elseif ($id && $multilingual) {
		$where = "WHERE parentid = '$id' AND (planguage='$currentlang' OR planguage='')";
	} elseif ($multilingual) {
		$where = "WHERE planguage='$currentlang' OR planguage=''";
	} else {
		$where = "";
	}
	$tdwidth = intval(100/$tablenumhome);
	if (!is_array($massiv)) {
		$result = $db->sql_query("SELECT cid, title, description, parentid FROM ".$prefix."_pages_categories ".$where."");
		while (list($cid, $title, $description, $parentid) = $db->sql_fetchrow($result)) $massiv[] = array($cid, $title, $description, $parentid);
	}
	if (!is_array($massiv2)) {
		$result = $db->sql_query("SELECT cid, title, description, parentid FROM ".$prefix."_pages_categories");
		while (list($cid, $title, $description, $parentid) = $db->sql_fetchrow($result)) $massiv2[] = array($cid, $title, $description, $parentid);
	}
	if ($massiv) {
		foreach ($massiv as $key => $val) {
			if ($val[3] == $id) {
				$description = ($catdescrhome) ? "<tr><td colspan=\"2\"><i>".$val[2]."</i></td></tr>" : "";
				$ccontent .= "<td valign=\"top\" width=\"".$tdwidth."%\"><table border=\"0\"><tr><td><img border=\"0\" src=\"images/blocks/Pages.gif\" title=\"$title\"></td><td width=\"100%\"><a href=\"index.php?name=$module_name&op=cat&id=$val[0]\" title=\"$val[1]\"><b>$val[1]</b></a></td></tr>".$description."";
				if ($homesubcat == 1 && $massiv2) {
					foreach ($massiv2 as $key => $val2) {
						if ($val[0] == $val2[3]) {
							$ccontent .= "<tr><td colspan=\"2\"><img border=\"0\" src=\"images/navi.gif\" title=\"$val2[1]\"> <a href=\"index.php?name=$module_name&op=cat&id=$val2[0]\" title=\"$val2[1]\">$val2[1]</a></td></tr>";
						}
					}
				}
				$ccontent .= "</table></td>";
				if ($cont == ($tablenumhome - 1)) {
					$ccontent .= "</tr><tr>";
					$cont = 0;
				} else {
					$cont++;
				}
			}
		}
	}
	if ($ccontent) {
		OpenTable();
		echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"10\" align=\"center\"><tr>".$ccontent."</td></tr></table>";
		if ($shownumeric == 1) {
			list($pages_num) = $db->sql_fetchrow($db->sql_query("SELECT Count(pid) FROM ".$prefix."_pages WHERE active='1'"));
			list($cat_num) = $db->sql_fetchrow($db->sql_query("SELECT Count(cid) FROM ".$prefix."_pages_categories"));
			echo "<hr><center>"._ALLP.": <b>$pages_num</b> "._ALLP2." <b>$cat_num</b> "._ALLP3."</center>";
		}
		CloseTable();
	}
}

function main() {
	global $db, $prefix, $module_name, $multilingual, $currentlang, $tablenumhome, $newhome, $newhomenum, $datetime;
    head();
	title(""._PAGESNOTE."");
	categories();
	$newhomenum = intval($newhomenum);
	if ($newhome == 1) {
		$result = $db->sql_query("SELECT pid, title, hometext, date FROM ".$prefix."_pages WHERE cid != '0' AND date <= now() AND active = '1' ORDER BY pid DESC LIMIT $newhomenum");
		if ($db->sql_numrows($result) > 0) {
			OpenTable();
			echo "<font class=\"option\">"._NEWPAGES."</font><hr>";
			while (list($p_pid, $p_title, $p_hometext, $date) = $db->sql_fetchrow($result)) {
				formatTimestamp($date);
				echo "<a href=\"index.php?name=$module_name&op=page&pid=$p_pid\" title=\"$p_title\"><b>$p_title</b></a><br />".bb_decode($p_hometext)."<br /><br />"._SENDDATE.": $datetime<br /><br />";
			}
			CloseTable();
		}
	}
	$result2 = $db->sql_query("SELECT pid, title, hometext, date FROM ".$prefix."_pages WHERE cid = '0' AND date <= now() AND active = '1' ORDER BY pid DESC");
	if ($db->sql_numrows($result2) > 0) {
		OpenTable();
		echo "<font class=\"option\">"._PAGESHOMECATS."</font><hr>";
		while (list($p_pid, $p_title, $p_hometext, $date) = $db->sql_fetchrow($result2)) {
			formatTimestamp($date);
			echo "<a href=\"index.php?name=$module_name&op=page&pid=$p_pid\" title=\"$p_title\"><b>$p_title</b></a><br/>".bb_decode($p_hometext)."<br /><br />"._SENDDATE.": $datetime<br /><br />";
		}
		CloseTable();
	}
	get_page($module_name);
	foot();
}

function cat() {
    global $db, $prefix, $module_name, $numpage, $pagenum, $datetime, $pagetitle, $defis, $hometext;
	$cid = intval($_GET['id']);
	list($c_title, $c_description) = $db->sql_fetchrow($db->sql_query("SELECT title, description FROM ".$prefix."_pages_categories WHERE cid='$cid'"));
	$pagetitle = "$defis "._CONTENT_NAME." $defis $c_title";
	$hometext = $c_description;
	head();
	title(""._PAGESNOTE."");
	OpenTable();
	echo "<center><font class=\"option\">$c_title</font><br />$c_description</center>";
	CloseTable();
	categories($cid);
    if ($pagenum == "") $pagenum = 1;
	$offset = ($pagenum - 1) * $numpage;
	$offset = intval($offset);
	$numpage = intval($numpage);
	$result = $db->sql_query("SELECT pid, title, hometext, date, counter FROM ".$prefix."_pages WHERE cid ='$cid' AND date <= now() AND active = '1' ORDER BY pid DESC LIMIT $offset, $numpage");
    if ($db->sql_numrows($result) > 0) {
		OpenTable();
		$i = 0;
		while (list($p_pid, $p_title, $p_hometext, $date, $p_counter) = $db->sql_fetchrow($result)) {
			formatTimestamp($date);
			$hr = ($i) ? "<hr>" : "";
			echo "$hr<b><a href=\"index.php?name=$module_name&op=page&pid=$p_pid\" title=\"$p_title\">$p_title</a></b><br />".bb_decode($p_hometext)."<br /><br />"._SENDDATE.": $datetime<br />"._COUNTPAGE.": $p_counter "._COUNT."";
			$i++;
		}
		CloseTable();
    }
	list($numstories) = $db->sql_fetchrow($db->sql_query("SELECT Count(pid) FROM ".$prefix."_pages WHERE cid ='$cid' AND date <= now() AND active = '1'"));
    $numpages = ceil($numstories / $numpage);
	num_page($module_name, $numstories, $numpages, $numpage, "op=cat&id=".$cid."&");
	get_page($module_name);
    foot();
}

function page($pid, $pagenum=0) {
    global $pagetitle, $hometext, $bodytext, $db, $prefix, $module_name, $admin, $pagecatlink, $pagecatnumlinc, $admin_file, $defis, $datetime;
    $pid = intval($pid);
	$result = $db->sql_query("SELECT cid, title, hometext, bodytext, date, counter  FROM ".$prefix."_pages WHERE pid='$pid' AND date <= now() AND active = '1'");
	if ($db->sql_numrows($result) > 0) {
		if ($pagenum == 0) $db->sql_query("UPDATE ".$prefix."_pages SET counter=counter+1 WHERE pid='$pid'");
		list($cid, $title, $hometext, $bodytext, $date, $counter) = $db->sql_fetchrow($result);
		$cid = intval($cid);
		$pagetitle = "$defis "._CONTENT_NAME." $defis $title";	
		formatTimestamp($date);
		$contentpages = explode("[pagebreak]", $bodytext);
		$pageno = count($contentpages);
		if ($pagenum=="" || $pagenum < 1) $pagenum = 1;
		if ($pagenum > $pageno) $pagenum = $pageno;
		$arrayelement = (int)$pagenum;
		$arrayelement --;
		list($c_title, $c_description) = $db->sql_fetchrow($db->sql_query("SELECT title, description FROM ".$prefix."_pages_categories WHERE cid='$cid'"));
		$c_title = ($c_title) ? $c_title : ""._PAGESHOMECATS."";
		$pagetitle = "$defis "._CONTENT_NAME." $defis $c_title $defis $title";	
		head();
		OpenTable();
		echo "<center><font class=\"option\">$c_title</font><br />$c_description</center>";
		CloseTable();
		OpenTable();
		echo "".bb_decode($hometext)."<hr>".bb_decode($contentpages[$arrayelement]).""
		."<hr>"._SENDDATE.": $datetime<br />"._COUNTPAGE.": $counter "._COUNT."";
		if (is_admin($admin)) {
			echo "<hr><center>[ <a href=".$admin_file.".php?op=delete_page&id=$pid>"._DELETE."</a> | <a href=".$admin_file.".php?op=add_pages&id=$pid>"._EDIT."</a> | <a href=".$admin_file.".php?op=active_pages&id=$pid&act=0>"._OFFPAGE."</a> ]</center>";
		}
		CloseTable();
		num_page($module_name, 1, $pageno, 1, "op=page&pid=".$pid."&");
		if ($pagecatlink == 1) {
			$pagecatnumlinc = intval($pagecatnumlinc);
			$result2 = $db->sql_query("SELECT pid, title FROM ".$prefix."_pages WHERE cid='$cid' AND pid !='$pid' AND date <= now() AND active = '1' LIMIT $pagecatnumlinc");
			if ($db->sql_numrows($result2) > 0) {
				OpenTable();
				echo "<font class=\"option\">"._LINKPAGES."</font><hr>";
				while (list($l_pid, $l_title) = $db->sql_fetchrow($result2)) {
					echo "<table border=\"0\"><tr><td><a href=\"index.php?name=$module_name&op=page&pid=$l_pid\" title=\"$l_title\"><img border=\"0\" src=\"images/blocks/News.gif\" alt=\"$l_title\"></a></td><td><a href=\"index.php?name=$module_name&op=page&pid=$l_pid\" title=\"$l_title\"><b>$l_title</b></a></td></tr></table>";
				}
				CloseTable();
			}
		}
		get_page($module_name);
		foot();
	} else {
		Header("Location: index.php?name=".$module_name."");
	}
}

switch($op) {
	case "cat":
    cat();
    break;

    case "page":
    page($pid, $pagenum);
    break;

    default:
    main();
    break;
}
?>
GRAFLEKX
GRAFLEKX
3.92

3.92

9
16.12.2009 21:27:31

0wnell, ну и сразу вопрос не в тему. как убрать иконку отображающую тему новости, а то сама новость смещается из-за неё и выглядит не очень красиво. Убрать нужно полностью, чтобы новость строго по центру была.

0wnell, скопируйте код ниже и замените им свой код в modules/News/index.php

Код страницы:

Код
<?php
if (!defined("MODULE_FILE")) {
	Header("Location: ../../index.php");
	exit;
}
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
require_once("function/comments.php");
include("config/config_fields.php");

function news($new_topic=0) {
	global $db, $storyhome, $topicname, $topicimage, $topictext, $datetime, $user, $prefix, $multilingual, $currentlang, $sitename, $user_news, $pagenum, $anonymous, $module_name, $pagetitle, $defis;
	$querylang = ($multilingual == 1) ? "AND (alanguage='$currentlang' OR alanguage='')" : "";
	$new_topic = (isset($new_topic)) ? intval($new_topic) : 0;
	$storynum = (isset($user[3]) && $user[3] <= $storyhome && $user_news == 1) ? intval($user[3]) : $storyhome;
	if ($new_topic == 0) {
		$qdb = "WHERE ihome='0' AND s.time <= NOW() AND status='1'";
		$pagetitle = "$defis "._NEWS."";
		head();
    } else {
		$qdb = "WHERE topic='$new_topic' AND s.time <= NOW() AND status='1'";
		list($topic_title) = $db->sql_fetchrow($db->sql_query("SELECT topictext FROM ".$prefix."_topics WHERE topicid='$new_topic'"));
		$pagetitle = "$defis "._NEWS." $defis $topic_title";
		head();
        OpenTable();
        if (!$topic_title) {
			echo "<center><font class=\"title\">$sitename</font><br /><br />"._NOINFO4TOPIC."<br /><br />[ <a href=\"index.php?name=News\">"._GOTONEWSINDEX."</a> | <a href=\"index.php?name=Topics\">"._SELECTNEWTOPIC."</a> ]</center>";
        } else {
			echo "<center><font class=\"title\">$topic_title</font><br><br>"
			."[ <a href=\"index.php\">"._GOTOHOME."</a> | <a href=\"index.php?name=Topics\">"._SELECTNEWTOPIC."</a> ]</center>";
		}
        CloseTable();
	}
	$pagenum = (!$pagenum) ? 1 : $pagenum;
	$offset = ($pagenum-1) * $storynum;
	$offset = intval($offset);
	$storynum = intval($storynum);
	$result = $db->sql_query("SELECT sid, s.catid, s.aid, s.title, s.time, s.hometext, s.bodytext, s.comments, s.counter, s.topic, s.acomm, s.score, s.ratings, c.title, t.topicid, t.topicname, t.topicimage, t.topictext FROM ".$prefix."_stories AS s LEFT JOIN ".$prefix."_stories_cat AS c on (s.catid=c.catid) LEFT JOIN ".$prefix."_topics AS t on (s.topic=t.topicid) $qdb $querylang ORDER BY s.time DESC LIMIT $offset, $storynum");
	while (list($s_sid , $catid, $aid, $title, $time, $hometext, $bodytext, $comments, $counter, $topic, $acomm, $score, $ratings, $ctitle, $topicid, $topicname, $topicimage, $topictext) = $db->sql_fetchrow($result)) {
		if ($catid > 0) $cattitle = $ctitle;
		$topicimage = ($topicimage) ? $topicimage : "AllTopics.gif";
		$topictext = ($topictext) ? $topictext : ""._ALL."";
		formatTimestamp($time);
        $c_count = $comments;
        if ($catid != 0) {
            $title_cat = text_filter($ctitle);
			$story_link = "<a href=\"index.php?name=News&op=article&sid=$s_sid\" title=\"$title_cat - $title\">";
			$story_link_c = "<a href=\"index.php?name=News&op=article&sid=$s_sid#$s_sid\" title=\"$title_cat - $title\">";
            $title = "<a href=\"index.php?name=News&op=cat&catid=$catid\" title=\"$title_cat\"><font class=\"storycat\">$title_cat</a> - </font><a href=\"index.php?name=News&op=article&sid=$s_sid\" title=\"$title\"><font class=\"storytitle\">$title</font></a>";
        } else {
			$story_link = "<a href=\"index.php?name=News&op=article&sid=$s_sid\" title=\"$title\">";
			$story_link_c = "<a href=\"index.php?name=News&op=article&sid=$s_sid#$s_sid\" title=\"$title\">";
			$title = "<a href=\"index.php?name=News&op=article&sid=$s_sid\" title=\"$title\"><font class=\"storytitle\">$title</font></a>";
		}
        if ($acomm == 0) {
			if ($c_count == 0) {
				$m_com = "| $story_link_c"._COMMENTS."</a>";
			} elseif ($c_count == 1) {
				$m_com = "| $story_link_c"._COMMENT.": $c_count</a>";
			} elseif ($c_count > 1) {
				$m_com = "| $story_link_c"._COMMENTS.": $c_count</a>";
			}
        } else {
			$m_com = "";
		}
		$posted = ($aid) ? "<a href=\"index.php?name=Account&op=info&uname=$aid\">$aid</a>" : $anonymous;
		$morelink = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"left\">$story_link<b>"._READMORE."</b></a> | "._PDATE.": $datetime | "._POSTEDBY.": $posted | "._READS.": $counter $m_com <td align=\"right\"><a href=\"index.php?name=News&op=printpage&sid=$s_sid\"><img src=\"images/blocks/Print.gif\" border=\"0\" alt=\""._PRINTER."\" title=\""._PRINTER."\" align=\"center\"></a>&nbsp;&nbsp;<a href=\"index.php?name=News&op=friendsend&sid=$s_sid\"><img src=\"images/blocks/Contact.gif\" border=\"0\" alt=\""._FRIEND."\" title=\""._FRIEND."\" align=\"center\"></a></td></tr></table>";
        if ($score != 0) {
            $rated = substr($score / $ratings, 0, 4);
        } else {
            $rated = 0;
        }
        $morelink = str_replace(" |  | ", " | ", $morelink);
		//$cimg = ($topicimage) ? "<a href=\"index.php?name=$module_name&new_topic=$topicid\"><img src=\"images/topics/".$topicimage."\" border=\"0\" alt=\"$topictext\" title=\"$topictext\" align=\"right\" hspace=\"10\" vspace=\"10\"></a>" : "";
        basic($aid, $datetime, $title, $counter, bb_decode($hometext), $morelink, $topicid, $cimg, $topicname);
    }
	list($numstories) = $db->sql_fetchrow($db->sql_query("SELECT Count(sid) AS csid FROM ".$prefix."_stories AS s $qdb $querylang"));
	$numpages = ceil($numstories / $storynum);
	if (isset($new_topic)) {
		num_page($module_name, $numstories, $numpages, $storynum, "new_topic=".$new_topic."&");
	} else {
		num_page($module_name, $numstories, $numpages, $storynum);
	}
    foot();
}

function cat($catid) {
    global $storyhome, $topicname, $topicimage, $topictext, $datetime, $user, $prefix, $multilingual, $currentlang, $db, $module_name, $pagenum;
	head();
	$querylang = ($multilingual == 1) ? "AND (alanguage='$currentlang' OR alanguage='')" : "";
	$storynum = (isset($user[3])) ? intval($user[3]) : $storyhome;
    $catid = intval($catid);
	$pagenum = (!$pagenum) ? 1 : $pagenum;
    $offset = ($pagenum-1) * $storynum;
	$offset = intval($offset);
	$storynum = intval($storynum);
	$sql = "SELECT sid, s.catid, s.aid, s.title, s.time, s.hometext, s.bodytext, s.comments, s.counter, s.topic, s.acomm, s.score, s.ratings, c.title, t.topicid, t.topicname, t.topicimage, t.topictext FROM ".$prefix."_stories AS s LEFT JOIN ".$prefix."_stories_cat AS c on (s.catid=c.catid) LEFT JOIN ".$prefix."_topics AS t on (s.topic=t.topicid) WHERE s.catid='$catid' AND s.time <= NOW() AND status='1' $querylang ORDER BY s.time DESC LIMIT $offset, $storynum";
	$result = $db->sql_query($sql);
	while (list($s_sid , $catid, $aid, $title, $time, $hometext, $bodytext, $comments, $counter, $topic, $acomm, $score, $ratings, $ctitle, $topicid, $topicname, $topicimage, $topictext) = $db->sql_fetchrow($result)) {
		$n_catid = intval($catid);
		if ($catid > 0) $cattitle = $ctitle;
		$topicimage = ($topicimage) ? $topicimage : "AllTopics.gif";
		$topictext = ($topictext) ? $topictext : ""._ALL."";
		formatTimestamp($time);
        $c_count = $comments;
		$title_cat = text_filter($ctitle);
		$story_link = "<a href=\"index.php?name=News&op=article&sid=$s_sid\" title=\"$title_cat - $title\">";
		$story_link_c = "<a href=\"index.php?name=News&op=article&sid=$s_sid#$s_sid\" title=\"$title_cat - $title\">";
		$title = "<a href=\"index.php?name=News&op=cat&catid=$catid\" title=\"$title_cat\"><font class=\"storycat\">$title_cat</a> - </font><a href=\"index.php?name=News&op=article&sid=$s_sid\" title=\"$title\"><font class=\"storytitle\">$title</font></a>";
		if ($acomm == 0) {
			if ($c_count == 0) {
				$m_com = "| $story_link_c"._COMMENTS."</a>";
			} elseif ($c_count == 1) {
				$m_com = "| $story_link_c"._COMMENT.": $c_count</a>";
			} elseif ($c_count > 1) {
				$m_com = "| $story_link_c"._COMMENTS.": $c_count</a>";
			}
		} else {
			$m_com = "";
        }
		$posted = ($aid) ? "<a href=\"index.php?name=Account&op=info&uname=$aid\">$aid</a>" : $anonymous;
		$morelink = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"left\">$story_link<b>"._READMORE."</b></a> | "._PDATE.": $datetime | "._POSTEDBY.": $posted | "._READS.": $counter $m_com <td align=\"right\"><a href=\"index.php?name=News&op=printpage&sid=$s_sid\"><img src=\"images/blocks/Print.gif\" border=\"0\" alt=\""._PRINTER."\" title=\""._PRINTER."\" align=\"center\"></a>&nbsp;&nbsp;<a href=\"index.php?name=News&op=friendsend&sid=$s_sid\"><img src=\"images/blocks/Contact.gif\" border=\"0\" alt=\""._FRIEND."\" title=\""._FRIEND."\" align=\"center\"></a></td></tr></table>";
        if ($score != 0) {
            $rated = substr($score / $ratings, 0, 4);
        } else {
            $rated = 0;
        }
        $morelink = str_replace(" |  | ", " | ", $morelink);
		$cimg = ($topicimage) ? "<a href=\"index.php?name=$module_name&new_topic=$topicid\"><img src=\"images/topics/".$topicimage."\" border=\"0\" alt=\"$topictext\" title=\"$topictext\" align=\"right\" hspace=\"10\" vspace=\"10\"></a>" : "";
		basic($aid, $datetime, $title, $counter, bb_decode($hometext), $morelink, $topicid, $cimg, $topicname);
	}
	list($numstories) = $db->sql_fetchrow($db->sql_query("SELECT Count(catid) AS csid FROM ".$prefix."_stories AS s WHERE s.catid='$n_catid' AND s.time <= NOW() AND status='1' $querylang"));
	$numpages = ceil($numstories / $storynum);
	num_page($module_name, $numstories, $numpages, $storynum, "op=cat&catid=".$n_catid."&");
	foot();
}

function article($sid) {
	global $db, $storyhome, $topicname, $topicimage, $topictext, $datetime, $user, $prefix, $conffi, $multilingual, $currentlang, $sitename, $user_news, $pagenum, $anonymous, $module_name, $pagetitle, $defis, $admin_file, $hometext, $bodytext;
	$sid = intval($sid);
	$result = $db->sql_query("SELECT s.catid, s.aid, s.time, s.title, s.hometext, s.bodytext, s.field, s.counter, s.topic, s.acomm, s.score, s.ratings, s.associated, c.title, t.topicid, t.topicname, t.topicimage, t.topictext FROM ".$prefix."_stories AS s LEFT JOIN ".$prefix."_stories_cat AS c on (s.catid=c.catid) LEFT JOIN ".$prefix."_topics AS t on (s.topic=t.topicid) WHERE sid='$sid' AND s.time <= NOW() AND status='1'");
	if ($db->sql_numrows($result) == 1) {
		list($catid, $aid, $time, $title, $hometext, $bodytext, $field, $counter, $topic, $acomm, $score, $ratings, $associated, $ctitle, $topicid, $topicname, $topicimage, $topictext) = $db->sql_fetchrow($result);
		$db->sql_query("UPDATE ".$prefix."_stories SET counter=counter+1 where sid='$sid'");
		$pagetitle = ($catid != 0) ? "$defis "._NEWS." $defis $ctitle $defis $title" : "$defis "._NEWS." $defis $title";
		head();
		formatTimestamp($time);
		$fields = ($conffi['news']) ? fields_out($field, $conffi['news']) : "";
		$fields = ($fields) ? "<br /><br />".$fields."" : "";
		$bodytext = (!$bodytext) ? "".$hometext."".$fields."" : "".$hometext."<br /><br />".$bodytext."".$fields."";
		$title = ($catid != 0) ? "<a href=\"index.php?name=$module_name&op=cat&catid=$catid\"><font class=\"storycat\">$ctitle</a> - </font><font class=\"storytitle\">$title</font>" : "<font class=\"storytitle\">$title</font>";
		$topicimage = ($topicimage) ? $topicimage : "AllTopics.gif";
		$topictext = ($topictext) ? $topictext : ""._ALL."";
		$posted = ($aid) ? ""._POSTEDBY.": <a href=\"index.php?name=Account&op=info&uname=$aid\">$aid</a> | "._DATE.": $datetime" : ""._POSTEDBY.": $anonymous | "._DATE.": $datetime";
		//$cimg = ($topicimage) ? "<a href=\"index.php?name=$module_name&new_topic=$topicid\"><img src=\"images/topics/".$topicimage."\" border=\"0\" alt=\"$topictext\" title=\"$topictext\" align=\"right\" hspace=\"10\" vspace=\"10\"></a>" : "";
		basic($aid, $datetime, $title, $counter, bb_decode($bodytext), $posted, $topicid, $cimg, $topicname);
		OpenTable();
		echo "<center>[ <a href=\"index.php?name=$module_name&op=printpage&sid=$sid\" title=\""._PRINTER."\">"._PRINTER."</a> | <a href=\"index.php?name=$module_name&op=friendsend&sid=$sid\" title=\""._FRIEND."\">"._FRIEND."</a>";
		if (is_admin($admin)) {
			echo " | <a href=\"".$admin_file.".php?op=AddStory\">"._ADD."</a> | <a href=\"".$admin_file.".php?op=AddStory&id=$sid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=DeleteStory&id=$sid\">"._DELETE."</a> ]</center>";
		} else {
			echo " ]</center>";
		}
		CloseTable();
		OpenTable();
		echo "<center><font class=\"option\">"._RATEARTICLE."</center></font></center><br>"
		."<table align=\"center\"><tr><td>"._AVERAGESCORE.": </td><td>".vote_graphic($ratings, $score)."</td><td>"._VOTES.":</td><td>$ratings</td></tr></table>"
		."<hr><table width=\"100%\" align=\"center\" border=\"0\"><tr><td><form action=\"index.php?name=$module_name\" method=\"post\">"
		."<input type=\"hidden\" name=\"sid\" value=\"$sid\">"
		."<input type=\"hidden\" name=\"op\" value=\"ratearticle\">"
		."<input type=\"radio\" name=\"score\" value=\"5\"> <img src=\"images/articles/stars-5.gif\" border=\"0\" alt=\""._EXCELLENT."\" title=\""._EXCELLENT."\"></td>"
		."<td><input type=\"radio\" name=\"score\" value=\"4\"> <img src=\"images/articles/stars-4.gif\" border=\"0\" alt=\""._VERYGOOD."\" title=\""._VERYGOOD."\"></td>"
		."<td><input type=\"radio\" name=\"score\" value=\"3\"> <img src=\"images/articles/stars-3.gif\" border=\"0\" alt=\""._GOOD."\" title=\""._GOOD."\"></td>"
		."<td><input type=\"radio\" name=\"score\" value=\"2\"> <img src=\"images/articles/stars-2.gif\" border=\"0\" alt=\""._REGULAR."\" title=\""._REGULAR."\"></td>"
		."<td><input type=\"radio\" name=\"score\" value=\"1\"> <img src=\"images/articles/stars-1.gif\" border=\"0\" alt=\""._BAD."\" title=\""._BAD."\"></td>"
		."<td align=\"right\"><input type=\"submit\" value=\""._CASTMYVOTE."\"></td></tr></form></table>";
		CloseTable();
		if ($associated != "") {
			OpenTable();
			echo "<center><font class=\"option\">"._ASTOPIC."</font></center><br>";
			$asso_t = explode("-", $associated);
			for ($i = 0; $i<sizeof($asso_t); $i++) {
				if ($asso_t[$i] != "") {
					$t = intval($asso_t[$i]);
					$result = $db->sql_query("SELECT sid, title, time FROM ".$prefix."_stories WHERE topic='$t' AND sid!='$sid' ORDER BY time DESC LIMIT 0, 10");
					while(list($s_sid, $title, $time)= $db->sql_fetchrow($result)) {
						echo "<table><tr><td><img src=\"images/blocks/News.gif\" border=\"0\" title=\"$title\"></td><td>$time - <a href=\"index.php?name=News&op=article&sid=$s_sid\" title=\"$title\">$title</a></td></tr></table>";
					}
				}
			}
			CloseTable();
		}
		if ($acomm == 0) {
			echo "<a name=\"$sid\"></a>";
			ShowComments($sid);
		}
		foot();
	} else {
		Header("Location: index.php");
	}
}

function ratearticle($sid, $score) {
    global $prefix, $db, $ratecookie;
    $score = intval($score);
    $sid = intval($sid);
    if ($score) {
        if ($score > 5) $score = 5;
		if ($score < 1) $score = 1;
		if ($score != 1 AND $score != 2 AND $score != 3 AND $score != 4 AND $score != 5) {
            Header("Location: index.php");
            die();
        }
        if (isset($ratecookie)) $r_cookie = explode(":", addslashes(base64_decode($ratecookie)));
        for ($i = 0; $i < sizeof($r_cookie); $i++) {
            if ($r_cookie[$i] == $sid) $a = 1;
        }
        if ($a == 1) {
            Header("Location: index.php?name=News&op=ratecomplete&sid=$sid&rated=1");
        } else {
            $result = $db->sql_query("UPDATE ".$prefix."_stories SET score=score+$score, ratings=ratings+1 WHERE sid='$sid'");
            $info = base64_encode("$rcookie$sid:");
            setcookie("ratecookie","$info",time()+3600);
            update_points(7);
            Header("Location: index.php?name=News&op=ratecomplete&sid=$sid");
        }
    } else {
        head();
        title(""._ARTICLERATING."");
        OpenTable();
        echo "<center>"._DIDNTRATE."<br><br>"._GOBACK."</center>";
        CloseTable();
        foot();
    }
}

function ratecomplete($sid, $rated=0) {
    head();
    title(""._ARTICLERATING."");
    OpenTable();
    if ($rated == 0) {
        echo "<center>"._THANKSVOTEARTICLE."<br><br>"
		."[ <a href=\"index.php?name=News&op=article&sid=$sid\">"._BACKTOARTICLEPAGE."</a> ]</center>";
    } elseif ($rated == 1) {
        echo "<center>"._ALREADYVOTEDARTICLE."<br><br>"
		."[ <a href=\"index.php?name=News&op=article&sid=$sid\">"._BACKTOARTICLEPAGE."</a> ]</center>";
    }
    CloseTable();
    foot();
}

function printpage($sid) {
    global $site_logo, $homeurl, $sitename, $datetime, $prefix, $db, $module_name, $defis, $ThemeSel;
	$defis = urldecode($defis);
    $sid = intval($sid);
	$result = $db->sql_query("SELECT title, time, hometext, bodytext, topic FROM ".$prefix."_stories WHERE sid='$sid' AND time <= NOW() AND status='1'");
    if ($db->sql_numrows($result) == 1) {
		list($title, $time, $hometext, $bodytext, $topic) = $db->sql_fetchrow($result);
		list($topictext) = $db->sql_fetchrow($db->sql_query("SELECT topictext FROM ".$prefix."_topics WHERE topicid='$topic'"));
		formatTimestamp($time);
		echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"
		."<html>\n"
		."<head>\n"
		."<meta http-equiv=\"content-type\" content=\"text/html; charset="._CHARSET."\">\n"
		."<link rel=\"stylesheet\" href=\"templates/$ThemeSel/style.css\" type=\"text/css\">\n"
		."<title>$title $defis "._NEWS." $defis $sitename</title></head><body><table border=\"0\" align=\"center\"><tr><td><table border=\"0\" width=\"640\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><table border=\"0\" width=\"640\" cellpadding=\"20\" cellspacing=\"1\" class=\"bodyline\"><tr><td><center><a href=\"$homeurl\"><img src=\"images/logos/$site_logo\" border=\"0\" alt=\"$sitename\"></a><br><br><font class=\"content\"><b>$title</b></font><br><font class=tiny><b>"._PDATE.":</b> $datetime<br /><b>"._PTOPIC.":</b> $topictext</font><br /><br /></center><font class=\"content\">".bb_decode($hometext)."<br /><br />".bb_decode($bodytext)."<br /><br /></font></td></tr></table></td></tr></table><br /><center><font class=\"content\">"._COMESFROM.": <a href=\"$homeurl\">$homeurl</a><br />"._THEURL.": <a href=\"$homeurl/index.php?name=$module_name&op=article&sid=$sid\">$homeurl/index.php?name=$module_name&op=article&sid=$sid</a></font></td></tr></table></body></html>";
	} else {
		Header("Location: index.php");
	}
}

function friendsend($sid) {
    global $user, $userinfo, $prefix, $db, $module_name, $pagetitle, $defis, $stop;
	$sid = intval($sid);
	$result = $db->sql_query("SELECT title FROM ".$prefix."_stories WHERE sid='$sid' AND time <= NOW() AND status='1'");
	if ($db->sql_numrows($result) == 1) {
		list($title) = $db->sql_fetchrow($result);
		$title = stripslashes($title);
		$pagetitle = "$defis "._NEWS." $defis $title $defis "._FRIEND."";
		head();
		title(""._FRIEND."");
		if ($stop) warning($stop, "", "", 1);
		OpenTable();
		echo "<center><font class=\"content\"><b>"._YOUSENDSTORY." \"$title\" "._TOAFRIEND."</b></center><br>"
		."<form action=\"index.php?name=$module_name\" method=\"post\">"
		."<input type=\"hidden\" name=\"sid\" value=\"$sid\">";
		if (is_user($user)) {
			getusrinfo($user);
			$yn = $userinfo['user_name'];
			$ye = $userinfo['user_email'];
		}
		echo "<table align=\"center\"><tr><td>"._YOURNAME.":</td><td><input type=\"text\" name=\"yname\" value=\"$yn\" size=\"30\"></td></tr>"
		."<tr><td>"._YOUREMAIL.":</td><td><input type=\"text\" name=\"ymail\" value=\"$ye\" size=\"30\"></td></tr>"
		."<tr><td>"._FFRIENDNAME.":</td><td><input type=\"text\" name=\"fname\" size=\"30\"></td></tr>"
		."<tr><td>"._FFRIENDEMAIL.":</td><td><input type=\"text\" name=\"fmail\" size=\"30\"></td></tr></table><br>"
		."<center><input type=\"hidden\" name=\"op\" value=\"sendstory\">\n"
		."<input type=\"submit\" value="._SEND.">\n"
		."</form></center>\n";
		CloseTable();
		foot();
	} else {
		Header("Location: index.php");
	}
}

function sendstory($sid, $yname, $ymail, $fname, $fmail) {
    global $sitename, $homeurl, $prefix, $db, $module_name, $stop;
	checkemail($ymail);
	checkemail($fmail);
	if (!$stop) {
		$sid = intval($sid);
		list($title, $time, $topic) = $db->sql_fetchrow($db->sql_query("SELECT title, time, topic FROM ".$prefix."_stories WHERE sid='$sid'"));
		$title = stripslashes($title);
		$time = stripslashes($time);
		$topic = intval($topic);
		list($topictext) = $db->sql_fetchrow($db->sql_query("SELECT topictext FROM ".$prefix."_topics WHERE topicid='$topic'"));
		$topictext = stripslashes($topictext);
		$subject = "$sitename - "._INTERESTING."";
		$message = ""._HELLO." $fname!<br />"._YOURFRIEND." $yname "._CONSIDERED."<br /><br />"._FSTORY.": $title<br />"._PDATE.": ".formatTimestamp($time)."<br />"._PTOPIC.": $topictext<br /><br />"._THEURL.": <a href=\"$homeurl/index.php?name=$module_name&op=article&sid=$sid\" target=\"_blank\">$homeurl/index.php?name=$module_name&op=article&sid=$sid</a><br /><br />"._YOUCANREAD.": <a href=\"$homeurl\" target=\"_blank\">$sitename</a><br />"._FSITEURL.": <a href=\"$homeurl\" target=\"_blank\">$homeurl</a>";
		mail_send($fmail, $ymail, $subject, $message, 0, 3);
		update_points(6);
		head();
		title(""._FRIEND."");
		warning(""._FSTORY." \"$title\" "._HASSENT." $fname", "?name=$module_name&op=article&sid=$sid", 5, 2);
		foot();
	} else {
		friendsend($sid);
	}
}

switch ($op) {
	default:
    news($new_topic);
    break;

	case "cat":
	cat($catid);
    break;
	
	case "article":
    article($sid);
    break;
	
	case "ratearticle":
    ratearticle($sid, $score);
    break;

    case "ratecomplete":
    ratecomplete($sid, $rated);
    break;

	case "printpage":
    printpage($sid);
    break;
	
	case "sendstory":
    sendstory($sid, $yname, $ymail, $fname, $fmail);
    break;

    case "friendsend":
    friendsend($sid);
    break;
}
?>
GRAFLEKX
GRAFLEKX
3.92

3.92

10
16.12.2009 21:44:03

GRAFLEKX, спасибо! Все прекрасно работает, как я и хотел)

0wnell
0wnell
4.6

4.6

Открыть Ответить
Хотите опробовать SLAED CMS в действии?
Идеи и предложения
Обратная связь
Подтверждение

Поделиться
QR-код

Предварительный просмотр