Чтение RSS каналов

Форум

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

Модуль News сортировка сообщений

0

0
1
14.12.2009 18:14:24
Сейчас вывод новостей происходит так -последние новости почему то выводятся в самом низу странички.... хотя логически можно было бы предположить, что новые сообщения должны вытеснять вниз более старые. Видел похожую тему, но не помню было ли там решение -не могу найти нужный топик. Может кто ткнёт носом в код или топик?


Версия системы: SLAED CMS 4.2 Pro
Версия PHP: PHP 5
Сервер: Сервер в интернете
2
14.12.2009 19:13:3214.12.2009 19:19:14
sheft, тоесть как это? Смайл - 01
Странно.
Проверьте MODULES/NEWS/INDEX.PHP
Функция function news()
Код:
} else {
$caton = 1;
$field = "";
$order = (!$home) ? "WHERE time <= now() AND status!='0' ".$lang." ORDER BY time DESC" : "WHERE ihome='0' AND time <= now() AND status!='0' ".$lang." ORDER BY time DESC";
$ordernum = (!$home) ? "time <= now() AND status!='0'" : "ihome='0' AND time <= now() AND status!='0'";
$news_logo = ""._NEWS."";
$pagetitle = "".$conf['defis']." $news_logo";
}

должен точно соответствовать приведенному выше.
Если есть разница, то замените на этот...
Должен быть именно оператор сортировки в обратном порядке DESC...

Или сделаем еще проще, замените функцию целиком, чтобы не заморачиваться на этот код:
function news() {
global $prefix, $db, $admin_file, $user, $conf, $confu, $confn, $home, $pagetitle, $currentlang;
$lang = ($conf['multilingual']) ? "AND (c.language='$currentlang' OR c.language='')" : "";
$newnum = user_news($user[3], $confn['newnum']);
$sbest = (isset($_GET['best'])) ? 1 : 0;
$shits = (isset($_GET['hits'])) ? 1 : 0;
$scat = (isset($_GET['cat'])) ? $_GET['cat'] : 0;
if ($sbest && $confn['newrate']) {
$caton = 0;
$field = "best=1&";
$order = "WHERE time <= now() AND status!='0' ".$lang." ORDER BY score DESC";
$ordernum = "time <= now() AND status!='0'";
$news_logo = ""._BEST."";
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." $news_logo";
} elseif ($shits && $confn['newrate']) {
$caton = 0;
$field = "hits=1&";
$order = "WHERE time <= now() AND status!='0' ".$lang." ORDER BY counter DESC";
$ordernum = "time <= now() AND status!='0'";
$news_logo = ""._POP."";
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." $news_logo";
} elseif ($scat) {
$caton = 1;
$field = "cat=$scat&";
list($cat_title, $cat_description) = $db->sql_fetchrow($db->sql_query("SELECT title, description FROM ".$prefix."_categories WHERE id='$scat'"));
$order = "WHERE catid='$scat' AND time <= now() AND status!='0' ".$lang." ORDER BY time DESC";
$ordernum = "catid='$scat' AND time <= now() AND status!='0'";
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." $cat_title";
} else {
$caton = 1;
$field = "";
$order = (!$home) ? "WHERE time <= now() AND status!='0' ".$lang." ORDER BY time DESC" : "WHERE ihome='0' AND time <= now() AND status!='0' ".$lang." ORDER BY time DESC";
$ordernum = (!$home) ? "time <= now() AND status!='0'" : "ihome='0' AND time <= now() AND status!='0'";
$news_logo = ""._NEWS."";
$pagetitle = "".$conf['defis']." $news_logo";
}
head();
if (!$home) {
if ($scat) {
menu($cat_title);
} else {
menu($news_logo);
}
if ($caton == 1) categories($conf['name'], $confn['newcol'], $confn['newsub'], $confn['newcatdesc'], $scat);
}
$num = isset($_GET['num']) ? intval($_GET['num']) : "1";
$offset = ($num-1) * $newnum;
$offset = intval($offset);
$result = $db->sql_query("SELECT s.sid, s.catid, s.name, s.title, UNIX_TIMESTAMP(s.time) as formatted, s.hometext, s.comments, s.counter, s.acomm, s.score, s.ratings, c.id, c.title, c.description, c.img, u.user_name FROM ".$prefix."_stories AS s LEFT JOIN ".$prefix."_categories AS c ON (s.catid=c.id) LEFT JOIN ".$prefix."_users AS u ON (s.uid=u.user_id) ".$order." LIMIT $offset, $newnum");
if ($db->sql_numrows($result) > 0) {
while (list($sid, $catid, $uname, $stitle, $formatted, $hometext, $comments, $counter, $acomm, $score, $ratings, $cid, $ctitle, $cdescription, $cimg, $user_name) = $db->sql_fetchrow($result)) {
$time = date(""._DATESTRING."", $formatted);
$title = "<a href=\"index.php?name=".$conf['name']."&op=view&id=$sid\" title=\"$stitle\">".$stitle."</a> ".new_graphic($formatted)."";
$read = "<a href=\"index.php?name=".$conf['name']."&op=view&id=$sid\" title=\"$stitle\">"._READMORE."</a>";
$post = ($user_name) ? " "._POSTEDBY.": ".user_info($user_name, 1)."" : (($uname) ? " "._POSTEDBY.": ".$uname."" : " "._POSTEDBY.": ".$confu['anonym']."");
$ndate = ($confn['newdate']) ? " "._DATE.": ".$time."" : "";
$reads = ($confn['newread']) ? " "._READS.": ".$counter."" : "";
if (!$acomm) {
if ($comments == 0) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\" title=\"$stitle\">"._COMMENTS."</a>";
} elseif ($comments == 1) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\" title=\"$stitle\">"._COMMENT.": $comments</a>";
} elseif ($comments > 1) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\" title=\"$stitle\">"._COMMENTS.": $comments</a>";
}
} else {
$comm = "";
}
$arating = " ".ajax_rating(0, $sid, $conf['name'], $ratings, $score)."";
$print = " ".ad_print("index.php?name=".$conf['name']."&op=printe&id=".$sid."")."";
$admin = (is_moder($conf['name'])) ? " ".ad_edit("".$admin_file.".php?op=news_add&id=".$sid."")."" : "";
$cdescription = ($cdescription) ? $cdescription : $ctitle;
$cimg = ($cimg) ? "<a href=\"index.php?name=".$conf['name']."&cat=$cid\"><img src=\"images/categories/".$cimg."\" border=\"0\" alt=\"$cdescription\" title=\"$cdescription\" align=\"right\" hspace=\"10\" vspace=\"10\"></a>" : "";
$link = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"75%\" align=\"left\"><b>".$read."</b>".$post."".$ndate."".$reads."".$comm."</td><td>".$arating."</td><td align=\"right\">".$print."".$admin."</td></tr></table>";
basic($cid, $cimg, $ctitle, $sid, $title, bb_decode($hometext, $conf['name']), $link, $read, $post, $ndate, $reads, $comm, $arating, $print, $admin);
}
num_article($conf['name'], $newnum, $field, "sid", "_stories", "catid", $ordernum);
}
foot();
}
3.97

3.97
3
14.12.2009 19:58:08
да в коде указана сортировка по убыванию, код верный, но такое ощущение что сортировка вообще не срабатывает. Добавил три сообщения подряд, два оказались в центре, одно в самом низу - http://silon.su

по какому принципу идут сообщения, не ясно...

<?php
# Copyright © 2005 - 2008 SLAED
# Website: http://www.slaed.net

if (!defined("MODULE_FILE")) {
header("Location: ../../index.php");
exit;
}
get_lang($conf['name']);
include("config/config_news.php");

function menu($logo) {
global $conf, $confn;
$home = "<a href=\"index.php?name=".$conf['name']."\" title=\""._HOME."\">"._HOME."</a>";
$best = ($confn['newrate']) ? "<a href=\"index.php?name=".$conf['name']."&best=1\" title=\""._BEST."\">"._BEST."</a>" : "";
$pop = ($confn['newrate']) ? "<a href=\"index.php?name=".$conf['name']."&hits=1\" title=\""._POP."\">"._POP."</a>" : "";
$liste = "<a href=\"index.php?name=".$conf['name']."&op=liste\" title=\""._LIST."\">"._LIST."</a>";
$add = ((is_user() && $confn['add'] == 1) || (!is_user() && $confn['addquest'] == 1)) ? "<a href=\"index.php?name=".$conf['name']."&op=add\" title=\""._ADD."\">"._ADD."</a>" : "";
$navi = "[ <a href=\"index.php?name=".$conf['name']."\" title=\""._HOME."\">"._HOME."</a>";
$navi .= ($confn['newrate']) ? " | <a href=\"index.php?name=".$conf['name']."&best=1\" title=\""._BEST."\">"._BEST."</a> | <a href=\"index.php?name=".$conf['name']."&hits=1\" title=\""._POP."\">"._POP."</a>" : "";
$navi .= " | <a href=\"index.php?name=".$conf['name']."&op=liste\" title=\""._LIST."\">"._LIST."</a>";
$navi .= ((is_user() && $confn['add'] == 1) || (!is_user() && $confn['addquest'] == 1)) ? " | <a href=\"index.php?name=".$conf['name']."&op=add\" title=\""._ADD."\">"._ADD."</a>" : "";
$navi .= " ]";
search($logo, $conf['name'], $navi, $home, $best, $pop, $liste, $add);
}

function news() {
global $prefix, $db, $admin_file, $user, $conf, $confu, $confn, $home, $pagetitle;
$cwhere = catmids($conf['name'], "s.catid");
$newnum = user_news($user[3], $confn['newnum']);
$sbest = (isset($_GET['best'])) ? 1 : 0;
$shits = (isset($_GET['hits'])) ? 1 : 0;
$scat = (isset($_GET['cat'])) ? intval($_GET['cat']) : 0;
if ($sbest && $confn['newrate']) {
$caton = 0;
$field = "best=1&";
$order = "WHERE s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.score DESC";
$ordernum = "time <= now() AND status!='0'";
$news_logo = ""._BEST."";
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." $news_logo";
} elseif ($shits && $confn['newrate']) {
$caton = 0;
$field = "hits=1&";
$order = "WHERE s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.counter DESC";
$ordernum = "time <= now() AND status!='0'";
$news_logo = ""._POP."";
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." $news_logo";
} elseif ($scat) {
$caton = 1;
$field = "cat=$scat&";
list($cat_title, $cat_description) = $db->sql_fetchrow($db->sql_query("SELECT title, description FROM ".$prefix."_categories WHERE id='$scat'"));
$order = "WHERE s.catid='$scat' AND s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.time DESC";
$ordernum = "catid='$scat' AND time <= now() AND status!='0'";
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." $cat_title";
} else {
$caton = 1;
$field = "";
$order = (!$home) ? "WHERE s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.time DESC" : "WHERE s.ihome='0' AND s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.time DESC";
$ordernum = (!$home) ? "time <= now() AND status!='0'" : "ihome='0' AND time <= now() AND status!='0'";
$news_logo = ""._NEWS."";
$pagetitle = "".$conf['defis']." $news_logo";
}
head();
if (!$home) {
if ($scat) {
menu($cat_title);
} else {
menu($news_logo);
}
if ($scat) templ("catlink", catlink($conf['name'], $scat, $confn['defis'], _NEWS));
if ($caton == 1) categories($conf['name'], $confn['newcol'], $confn['newsub'], $confn['newcatdesc'], $scat);
}
$num = isset($_GET['num']) ? intval($_GET['num']) : "1";
$offset = ($num-1) * $newnum;
$offset = intval($offset);
$result = $db->sql_query("SELECT s.sid, s.catid, s.name, s.title, UNIX_TIMESTAMP(s.time) as formatted, s.hometext, s.comments, s.counter, s.acomm, s.score, s.ratings, c.id, c.title, c.description, c.img, u.user_name FROM ".$prefix."_stories AS s LEFT JOIN ".$prefix."_categories AS c ON (s.catid=c.id) LEFT JOIN ".$prefix."_users AS u ON (s.uid=u.user_id) ".$order." LIMIT $offset, $newnum");
if ($db->sql_numrows($result) > 0) {
while (list($sid, $catid, $uname, $stitle, $formatted, $hometext, $comments, $counter, $acomm, $score, $ratings, $cid, $ctitle, $cdescription, $cimg, $user_name) = $db->sql_fetchrow($result)) {
$time = date(_DATESTRING, $formatted);
$title = "<a href=\"index.php?name=".$conf['name']."&op=view&id=$sid\" title=\"$stitle\">".$stitle."</a> ".new_graphic($formatted)."";
$read = "<a href=\"index.php?name=".$conf['name']."&op=view&id=$sid\" title=\"$stitle\">"._READMORE."</a>";
$post = ($user_name) ? " "._POSTEDBY.": ".user_info($user_name, 1)."" : (($uname) ? " "._POSTEDBY.": ".$uname."" : " "._POSTEDBY.": ".$confu['anonym']."");
$ndate = ($confn['newdate']) ? " "._DATE.": ".$time."" : "";
$reads = ($confn['newread']) ? " "._READS.": ".$counter."" : "";
if (!$acomm) {
if ($comments == 0) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\" title=\"$stitle\">"._COMMENTS."</a>";
} elseif ($comments == 1) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\" title=\"$stitle\">"._COMMENT.": $comments</a>";
} elseif ($comments > 1) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\" title=\"$stitle\">"._COMMENTS.": $comments</a>";
}
} else {
$comm = "";
}
$arating = " ".ajax_rating(0, $sid, $conf['name'], $ratings, $score, "");
$print = " ".ad_print("index.php?name=".$conf['name']."&op=printe&id=".$sid."");
$admin = (is_moder($conf['name'])) ? " ".add_menu($sid, "<a href=\"".$admin_file.".php?op=news_add&id=".$sid."\" title=\""._FULLEDIT."\">"._FULLEDIT."</a>||<a href=\"".$admin_file.".php?op=news_delete&id=".$sid."\" OnClick=\"return DelCheck(this, '"._DELETE." &quot;$stitle&quot;?');\" title=\""._ONDELETE."\">"._ONDELETE."</a>") : "";
$cdescription = ($cdescription) ? $cdescription : $ctitle;
$cimg = ($cimg) ? "<a href=\"index.php?name=".$conf['name']."&cat=$cid\"><img src=\"images/categories/".$cimg."\" border=\"0\" alt=\"$cdescription\" title=\"$cdescription\" align=\"right\" hspace=\"10\" vspace=\"10\"></a>" : "";
$link = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"75%\" align=\"left\"><b>".$read."</b>".$post."".$ndate."".$reads."".$comm."</td><td>".$arating."</td><td align=\"right\">".$print."".$admin."</td></tr></table>";
basic($cid, $cimg, $ctitle, $sid, $title, bb_decode($hometext, $conf['name']), $link, $read, $post, $ndate, $reads, $comm, $arating, $print, $admin);
}
num_article($conf['name'], $newnum, $field, "sid", "_stories", "catid", $ordernum);
}
foot();
}

function liste() {
global $prefix, $db, $pagetitle, $conf, $confu, $confn;
$cwhere = catmids($conf['name'], "s.catid");
$newlistnum = intval($confn['newlistnum']);
$let = (!preg_match("/[^a-zA-Zа-яА-Я0-9]/", $_GET['let'])) ? $_GET['let'] : "";
if ($let) {
$field = "op=liste&let=".urlencode($let)."&";
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." "._LIST." ".$conf['defis']." $let";
$order = "WHERE UPPER(s.title) LIKE '".$let."%' AND s.time <= now() AND s.status!='0'";
} else {
$field = "op=liste&";
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." "._LIST."";
$order = "WHERE s.time <= now() AND s.status!='0'";
}
$num = isset($_GET['num']) ? intval($_GET['num']) : "1";
$offset = ($num-1) * $newlistnum;
$offset = intval($offset);
$result = $db->sql_query("SELECT s.sid, s.catid, s.name, s.title, s.time, c.id, c.title, u.user_name FROM ".$prefix."_stories AS s LEFT JOIN ".$prefix."_categories AS c ON (s.catid=c.id) LEFT JOIN ".$prefix."_users AS u ON (s.uid=u.user_id) ".$order." ".$cwhere." ORDER BY time DESC LIMIT $offset, $newlistnum");
head();
menu(""._LIST."");
if ($db->sql_numrows($result) > 0) {
open();
if ($confn['newletter']) letter($conf['name']);
echo "<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\" class=\"sort\" id=\"sort_id\"><tr>"
."<th>"._ID."</th><th>"._TITLE."</th><th>"._CATEGORY."</th><th>"._DATE."</th><th>"._POSTEDBY."</th></tr>";
while (list($sid, $catid, $uname, $stitle, $time, $cid, $ctitle, $user_name) = $db->sql_fetchrow($result)) {
$ctitle = (!$ctitle) ? ""._NO."" : "<a href=\"index.php?name=".$conf['name']."&cat=$cid\" title=\"".$ctitle."\">".cutstr($ctitle, 10)."</a>";
$post = ($user_name) ? user_info($user_name, 1) : (($uname) ? $uname : $confu['anonym']);
echo "<tr class=\"bgcolor1\">"
."<td align=\"center\">".$sid."</td>"
."<td><a href=\"index.php?name=".$conf['name']."&op=view&id=$sid\" title=\"".$stitle."\">".cutstr($stitle, 35)."</a></td>"
."<td align=\"center\">".$ctitle."</td>"
."<td align=\"center\">".format_time($time)."</td>"
."<td align=\"center\">".$post."</td></tr>";
}
echo "</table>";
close();
$ordernum = ($let) ? "UPPER(title) LIKE '".$let."%' AND time <= now() AND status!='0'" : "time <= now() AND status!='0'";
num_article($conf['name'], $newlistnum, $field, "sid", "_stories", "catid", $ordernum);
} else {
warning(_NO_INFO, "", "", 2);
}
foot();
}

function printe() {
global $prefix, $db, $pagetitle, $conf, $confn;
$id = intval($_GET['id']);
$cwhere = catmids($conf['name'], "catid");
$result = $db->sql_query("SELECT title, time, hometext, bodytext FROM ".$prefix."_stories WHERE sid='$id' AND time <= now() AND status!='0' ".$cwhere."");
if ($db->sql_numrows($result) == 1) {
$db->sql_query("UPDATE ".$prefix."_stories SET counter=counter+1 WHERE sid='$id'");
list($stitle, $date, $hometext, $bodytext) = $db->sql_fetchrow($result);
get_theme_inc();
$conf['defis'] = urldecode($conf['defis']);
$title = "$stitle ".$conf['defis']." "._NEWS." ".$conf['defis']." ".$conf['sitename']."";
$ptitle = "".format_time($date)." - ".$stitle."";
$text = ($bodytext) ? "".bb_decode($hometext, $conf['name'])."<br /><br />".bb_decode($bodytext, $conf['name'])."" : bb_decode($hometext, $conf['name']);
$url = ""._COMESFROM.": <a href=\"".$conf['homeurl']."\" title=\"".$conf['sitename']."\">".$conf['homeurl']."</a><br />"._THEURL.": <a href=\"".$conf['homeurl']."/index.php?name=".$conf['name']."&op=view&id=$id\" title=\"".$stitle."\">".$conf['homeurl']."/index.php?name=".$conf['name']."&op=view&id=$id</a>";
prints($title, $ptitle, str_replace("[pagebreak]", "", $text), $url);
} else {
header("Location: index.php?name=".$conf['name']."");
}
}

function view() {
global $prefix, $db, $admin_file, $conf, $confu, $confn, $pagetitle, $hometext, $bodytext;
$id = (isset($_GET['id'])) ? intval($_GET['id']) : 0;
$pag = (isset($_GET['pag'])) ? intval($_GET['pag']) : 0;
$word = (isset($_GET['word'])) ? text_filter($_GET['word']) : "";
$cwhere = catmids($conf['name'], "s.catid");
$result = $db->sql_query("SELECT s.catid, s.name, s.title, s.time, s.hometext, s.bodytext, s.field, s.comments, s.counter, s.acomm, s.score, s.ratings, s.associated, c.id, c.title, c.description, c.img, u.user_name FROM ".$prefix."_stories AS s LEFT JOIN ".$prefix."_categories AS c ON (s.catid=c.id) LEFT JOIN ".$prefix."_users AS u ON (s.uid=u.user_id) WHERE s.sid = '$id' AND s.time <= now() AND s.status!='0' ".$cwhere."");
if ($db->sql_numrows($result) == 1) {
$db->sql_query("UPDATE ".$prefix."_stories SET counter=counter+1 WHERE sid='$id'");
list($catid, $uname, $title, $time, $hometext, $bodytext, $field, $comments, $counter, $acomm, $score, $ratings, $associated, $cid, $ctitle, $cdescription, $cimg, $user_name) = $db->sql_fetchrow($result);
$pagetitle = (intval($catid)) ? "".$conf['defis']." "._NEWS." ".$conf['defis']." $ctitle ".$conf['defis']." $title" : "".$conf['defis']." "._NEWS." ".$conf['defis']." $title";
head();
menu(_NEWS);
if ($catid) templ("catlink", catlink($conf['name'], $catid, $confn['defis'], _NEWS));
$fields = fields_out($field, $conf['name']);
$fields = ($fields) ? "<br /><br />".$fields."" : "";
$text = (!$bodytext) ? "".$hometext."".$fields."" : "".$hometext."<br /><br />".$bodytext."".$fields."";
$conpag = explode("[pagebreak]", $text);
$pageno = count($conpag);
$pag = ($pag == "" || $pag < 1) ? 1 : $pag;
if ($pag > $pageno) $pag = $pageno;
$arrayelement = (int)$pag;
$arrayelement--;
$post = ($user_name) ? _POSTEDBY.": ".user_info($user_name, 1) : (($uname) ? _POSTEDBY.": ".$uname : _POSTEDBY.": ".$confu['anonym']);
$ndate = ($confn['newdate']) ? " "._DATE.": ".format_time($time) : "";
$reads = ($confn['newread']) ? " "._READS.": ".$counter."" : "";
$arating = " ".ajax_rating(1, $id, $conf['name'], $ratings, $score, "");
$print = " ".ad_print("index.php?name=".$conf['name']."&op=printe&id=".$id."");
$admin = (is_moder($conf['name'])) ? " ".add_menu($id, "<a href=\"".$admin_file.".php?op=news_add&id=".$id."\" title=\""._FULLEDIT."\">"._FULLEDIT."</a>||<a href=\"".$admin_file.".php?op=news_delete&id=".$id."\" OnClick=\"return DelCheck(this, '"._DELETE." &quot;$title&quot;?');\" title=\""._ONDELETE."\">"._ONDELETE."</a>") : "";
$cdescription = ($cdescription) ? $cdescription : $ctitle;
$cimg = ($cimg) ? "<a href=\"index.php?name=".$conf['name']."&cat=$cid\"><img src=\"images/categories/".$cimg."\" border=\"0\" alt=\"$cdescription\" title=\"$cdescription\" align=\"right\" hspace=\"10\" vspace=\"10\"></a>" : "";
$link = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"75%\" align=\"left\">".$post."".$ndate."".$reads."</td><td>".$arating."</td><td align=\"right\">".$print."".$admin."</td></tr></table>";
basic($cid, $cimg, $ctitle, $id, search_color($title, $word), search_color(bb_decode($conpag[$arrayelement], $conf['name']), $word), $link, "", $post, $ndate, $reads, "", $arating, $print, $admin);
num_pages($conf['name'], 1, $pageno, 1, "op=view&id=".$id."&");
if ($confn['newassoc']) {
if ($associated[strlen($associated)-1] == "-") $associated = substr($associated, 0, -1);
$asso = str_replace("-", ",", $associated);
$limit = intval($confn['newasocnum']);
$result = $db->sql_query("SELECT sid, title, time FROM ".$prefix."_stories WHERE catid IN (".$asso.") AND sid!='$id' AND time <= now() AND status!='0' ORDER BY time DESC LIMIT 0, ".$limit."");
if ($db->sql_numrows($result) > 0) {
open();
echo "<h2 style=\"margin: 0 0 5px 0;\">"._ASSTORY."</h2>"
."<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">";
while(list($s_sid, $title, $time) = $db->sql_fetchrow($result)) {
echo "<tr><td><a href=\"index.php?name=".$conf['name']."&op=view&id=$s_sid\" title=\"$title\"><img src=\"".img_find("all/news")."\" border=\"0\"></a></td><td>".format_time($time)." - <a href=\"index.php?name=".$conf['name']."&op=view&id=$s_sid\" title=\"$title\">$title</a></td></tr>";
}
echo "</table>";
close();
}
}
if (!$acomm) {
echo "<a name=\"$id\"></a>";
show_com($id);
}
foot();
} else {
header("Location: index.php?name=".$conf['name']."");
}
}

function add() {
global $prefix, $db, $user, $conf, $confn, $confu, $pagetitle, $stop;
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." "._ADD."";
if ((is_user() && $confn['add'] == 1) || (!is_user() && $confn['addquest'] == 1)) {
head();
menu(""._ADD."");
if ($stop) warning($stop, "", "", 1);
$subject = save_text($_POST['subject']);
$catid = intval($_POST['catid']);
$hometext = save_text($_POST['hometext']);
$bodytext = save_text($_POST['bodytext']);
$field = fields_save($_POST['field']);
$postname = text_filter(substr($_POST['postname'], 0, 25));
if ($hometext) preview($subject, $hometext, $bodytext, $field, $conf['name']);
warning(""._SUBMIT."", "", "", 2);
open();
echo "<form name=\"post\" action=\"index.php?name=".$conf['name']."\" method=\"post\">";
if (is_user()) {
echo "<div class=\"left\">"._YOURNAME.":</div><div class=\"center\">".text_filter(substr($user[1], 0, 25))."</div>";
} else {
$postname = ($postname) ? $postname : $confu['anonym'];
echo "<div class=\"left\">"._YOURNAME.":</div><div class=\"center\"><input type=\"text\" name=\"postname\" value=\"".$postname."\" size=\"65\" class=\"".$conf['style']."\"></div>";
}
echo "<div class=\"left\">"._TITLE.":</div><div class=\"center\"><input type=\"text\" name=\"subject\" value=\"".$subject."\" maxlength=\"80\" size=\"65\" class=\"".$conf['style']."\"></div>"
."<div class=\"left\">"._CATEGORY.":</div><div class=\"center\">".getcat($conf['name'], $catid, "catid", $conf['style'], "<option value=\"\">"._HOMECAT."</option>")."</div>"
."<div class=\"left\">"._TEXT.":</div><div class=\"center\">".textarea("1", "hometext", $hometext, $conf['name'], "5")."</div>"
."<div class=\"left\">"._ENDTEXT.":</div><div class=\"center\">".textarea("2", "bodytext", $bodytext, $conf['name'], "15")."</div>"
."".fields_in($field, $conf['name']).""
."".captcha_random().""
."<div class=\"button\"><select name=\"posttype\">"
."<option value=\"preview\">"._PREVIEW."</option>"
."<option value=\"save\">"._SEND."</option></select>"
."<input type=\"hidden\" name=\"op\" value=\"send\">"
." <input type=\"submit\" value=\""._OK."\" class=\"fbutton\"></div></form>";
close();
foot();
} else {
header("Location: index.php?name=".$conf['name']."");
}
}

function send() {
global $prefix, $db, $user, $conf, $confn, $stop;
if ((is_user() && $confn['add'] == 1) || (!is_user() && $confn['addquest'] == 1)) {
$postname = text_filter(substr($_POST['postname'], 0, 25));
$subject = save_text($_POST['subject']);
$hometext = save_text($_POST['hometext']);
$bodytext = save_text($_POST['bodytext']);
$field = fields_save($_POST['field']);
$catid = intval($_POST['catid']);
if (!$subject) $stop = ""._CERROR."";
if (!$hometext) $stop = ""._CERROR1."";
if (!$postname && !is_user()) $stop = ""._CERROR3."";
if (captcha_check()) $stop = ""._SECCODEINCOR."";
if (!$stop && $_POST['posttype'] == "save") {
$postid = (is_user()) ? intval($user[0]) : "";
$postname = (!is_user()) ? $postname : "";
$ip = getip();
$db->sql_query("INSERT INTO ".$prefix."_stories (sid, catid, uid, name, title, time, hometext, bodytext, field, comments, counter, ihome, acomm, score, ratings, associated, ip_sender, status) VALUES (NULL, '$catid', '$postid', '$postname', '$subject', now(), '$hometext', '$bodytext', '$field', '0', '0', '0', '0', '0', '0', '0', '$ip', '0')");
update_points(31);
head();
menu(""._ADD."");
warning(""._SUBTEXT."", "?name=".$conf['name']."", 10, 2);
foot();
} else {
add();
}
} else {
header("Location: index.php?name=".$conf['name']."");
}
}

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

case "liste":
liste();
break;

case "printe":
printe();
break;

case "view":
view();
break;

case "add":
add();
break;

case "send":
send();
break;
}
?>


Версия системы: SLAED CMS 4.2 Pro
Версия PHP: PHP 5
Сервер: Сервер в интернете
4
14.12.2009 20:18:34
sheft, замените полностью Ваш код на этот:

<?php
# Copyright © 2005 - 2008 SLAED
# Website: http://www.slaed.net

if (!defined("MODULE_FILE")) {
Header("Location: ../../index.php");
exit;
}
get_lang($conf['name']);
include("config/config_news.php");

function menu($logo) {
global $conf, $confn;
$home = "<a href=\"index.php?name=".$conf['name']."\" title=\""._HOME."\">"._HOME."</a>";
$best = ($confn['newrate']) ? "<a href=\"index.php?name=".$conf['name']."&best=1\" title=\""._BEST."\">"._BEST."</a>" : "";
$pop = ($confn['newrate']) ? "<a href=\"index.php?name=".$conf['name']."&hits=1\" title=\""._POP."\">"._POP."</a>" : "";
$liste = "<a href=\"index.php?name=".$conf['name']."&op=liste\" title=\""._LIST."\">"._LIST."</a>";
$add = ((is_user() && $confn['add'] == 1) || (!is_user() && $confn['addquest'] == 1)) ? "<a href=\"index.php?name=".$conf['name']."&op=add\" title=\""._ADD."\">"._ADD."</a>" : "";
$navi = "[ <a href=\"index.php?name=".$conf['name']."\" title=\""._HOME."\">"._HOME."</a>";
$navi .= ($confn['newrate']) ? " | <a href=\"index.php?name=".$conf['name']."&best=1\" title=\""._BEST."\">"._BEST."</a> | <a href=\"index.php?name=".$conf['name']."&hits=1\" title=\""._POP."\">"._POP."</a>" : "";
$navi .= " | <a href=\"index.php?name=".$conf['name']."&op=liste\" title=\""._LIST."\">"._LIST."</a>";
$navi .= ((is_user() && $confn['add'] == 1) || (!is_user() && $confn['addquest'] == 1)) ? " | <a href=\"index.php?name=".$conf['name']."&op=add\" title=\""._ADD."\">"._ADD."</a>" : "";
$navi .= " ]";
search($logo, $conf['name'], $navi, $home, $best, $pop, $liste, $add);
}

function news() {
global $prefix, $db, $admin_file, $user, $conf, $confu, $confn, $home, $pagetitle, $currentlang;
$lang = ($conf['multilingual']) ? "AND (c.language='$currentlang' OR c.language='')" : "";
$newnum = user_news($user[3], $confn['newnum']);
$sbest = (isset($_GET['best'])) ? 1 : 0;
$shits = (isset($_GET['hits'])) ? 1 : 0;
$scat = (isset($_GET['cat'])) ? $_GET['cat'] : 0;
if ($sbest && $confn['newrate']) {
$caton = 0;
$field = "best=1&";
$order = "WHERE time <= now() AND status!='0' ".$lang." ORDER BY score DESC";
$ordernum = "time <= now() AND status!='0'";
$news_logo = ""._BEST."";
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." $news_logo";
} elseif ($shits && $confn['newrate']) {
$caton = 0;
$field = "hits=1&";
$order = "WHERE time <= now() AND status!='0' ".$lang." ORDER BY counter DESC";
$ordernum = "time <= now() AND status!='0'";
$news_logo = ""._POP."";
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." $news_logo";
} elseif ($scat) {
$caton = 1;
$field = "cat=$scat&";
list($cat_title, $cat_description) = $db->sql_fetchrow($db->sql_query("SELECT title, description FROM ".$prefix."_categories WHERE id='$scat'"));
$order = "WHERE catid='$scat' AND time <= now() AND status!='0' ".$lang." ORDER BY time DESC";
$ordernum = "catid='$scat' AND time <= now() AND status!='0'";
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." $cat_title";
} else {
$caton = 1;
$field = "";
$order = (!$home) ? "WHERE time <= now() AND status!='0' ".$lang." ORDER BY time DESC" : "WHERE ihome='0' AND time <= now() AND status!='0' ".$lang." ORDER BY time DESC";
$ordernum = (!$home) ? "time <= now() AND status!='0'" : "ihome='0' AND time <= now() AND status!='0'";
$news_logo = ""._NEWS."";
$pagetitle = "".$conf['defis']." $news_logo";
}
head();
if (!$home) {
if ($scat) {
menu($cat_title);
} else {
menu($news_logo);
}
if ($caton == 1) categories($conf['name'], $confn['newcol'], $confn['newsub'], $confn['newcatdesc'], $scat);
}
$num = isset($_GET['num']) ? intval($_GET['num']) : "1";
$offset = ($num-1) * $newnum;
$offset = intval($offset);
$result = $db->sql_query("SELECT s.sid, s.catid, s.name, s.title, UNIX_TIMESTAMP(s.time) as formatted, s.hometext, s.comments, s.counter, s.acomm, s.score, s.ratings, c.id, c.title, c.description, c.img, u.user_name FROM ".$prefix."_stories AS s LEFT JOIN ".$prefix."_categories AS c ON (s.catid=c.id) LEFT JOIN ".$prefix."_users AS u ON (s.uid=u.user_id) ".$order." LIMIT $offset, $newnum");
if ($db->sql_numrows($result) > 0) {
while (list($sid, $catid, $uname, $stitle, $formatted, $hometext, $comments, $counter, $acomm, $score, $ratings, $cid, $ctitle, $cdescription, $cimg, $user_name) = $db->sql_fetchrow($result)) {
$time = date(""._DATESTRING."", $formatted);
$title = "<a href=\"index.php?name=".$conf['name']."&op=view&id=$sid\" title=\"$stitle\">".$stitle."</a> ".new_graphic($formatted)."";
$read = "<a href=\"index.php?name=".$conf['name']."&op=view&id=$sid\" title=\"$stitle\">"._READMORE."</a>";
$post = ($user_name) ? " "._POSTEDBY.": ".user_info($user_name, 1)."" : (($uname) ? " "._POSTEDBY.": ".$uname."" : " "._POSTEDBY.": ".$confu['anonym']."");
$ndate = ($confn['newdate']) ? " "._DATE.": ".$time."" : "";
$reads = ($confn['newread']) ? " "._READS.": ".$counter."" : "";
if (!$acomm) {
if ($comments == 0) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\" title=\"$stitle\">"._COMMENTS."</a>";
} elseif ($comments == 1) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\" title=\"$stitle\">"._COMMENT.": $comments</a>";
} elseif ($comments > 1) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\" title=\"$stitle\">"._COMMENTS.": $comments</a>";
}
} else {
$comm = "";
}
$arating = " ".ajax_rating(0, $sid, $conf['name'], $ratings, $score)."";
$print = " ".ad_print("index.php?name=".$conf['name']."&op=printe&id=".$sid."")."";
$admin = (is_moder($conf['name'])) ? " ".ad_edit("".$admin_file.".php?op=news_add&id=".$sid."")."" : "";
$cdescription = ($cdescription) ? $cdescription : $ctitle;
$cimg = ($cimg) ? "<a href=\"index.php?name=".$conf['name']."&cat=$cid\"><img src=\"images/categories/".$cimg."\" border=\"0\" alt=\"$cdescription\" title=\"$cdescription\" align=\"right\" hspace=\"10\" vspace=\"10\"></a>" : "";
$link = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"75%\" align=\"left\"><b>".$read."</b>".$post."".$ndate."".$reads."".$comm."</td><td>".$arating."</td><td align=\"right\">".$print."".$admin."</td></tr></table>";
basic($cid, $cimg, $ctitle, $sid, $title, bb_decode($hometext, $conf['name']), $link, $read, $post, $ndate, $reads, $comm, $arating, $print, $admin);
}
num_article($conf['name'], $newnum, $field, "sid", "_stories", "catid", $ordernum);
}
foot();
}

function liste() {
global $prefix, $db, $pagetitle, $conf, $confu, $confn, $currentlang;
$lang = ($conf['multilingual']) ? "AND (c.language='$currentlang' OR c.language='')" : "";
$newlistnum = intval($confn['newlistnum']);
$let = (!preg_match("/[^a-zA-Zа-яА-Я0-9]/", $_GET['let'])) ? $_GET['let'] : "";
if ($let) {
$field = "op=liste&let=".urlencode($let)."&";
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." "._LIST." ".$conf['defis']." $let";
$order = "WHERE UPPER(s.title) LIKE '".$let."%' AND time <= now() AND status!='0'";
} else {
$field = "op=liste&";
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." "._LIST."";
$order = "WHERE time <= now() AND status!='0'";
}
$num = isset($_GET['num']) ? intval($_GET['num']) : "1";
$offset = ($num-1) * $newlistnum;
$offset = intval($offset);
$result = $db->sql_query("SELECT s.sid, s.catid, s.name, s.title, s.time, c.id, c.title, u.user_name FROM ".$prefix."_stories AS s LEFT JOIN ".$prefix."_categories AS c ON (s.catid=c.id) LEFT JOIN ".$prefix."_users AS u ON (s.uid=u.user_id) ".$order." ".$lang." ORDER BY time DESC LIMIT $offset, $newlistnum");
head();
menu(""._LIST."");
if ($db->sql_numrows($result) > 0) {
open();
if ($confn['newletter']) letter($conf['name']);
echo "<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\" class=\"sort\" id=\"sort_id\"><tr>"
."<th>"._ID."</th><th>"._TITLE."</th><th>"._CATEGORY."</th><th>"._DATE."</th><th>"._POSTEDBY."</th></tr>";
while (list($sid, $catid, $uname, $stitle, $time, $cid, $ctitle, $user_name) = $db->sql_fetchrow($result)) {
$ctitle = (!$ctitle) ? ""._NO."" : "<a href=\"index.php?name=".$conf['name']."&cat=$cid\" title=\"".$ctitle."\">".cutstr($ctitle, 10)."</a>";
$post = ($user_name) ? user_info($user_name, 1) : (($uname) ? $uname : $confu['anonym']);
echo "<tr class=\"bgcolor1\">"
."<td align=\"center\">".$sid."</td>"
."<td><a href=\"index.php?name=".$conf['name']."&op=view&id=$sid\" title=\"".$stitle."\">".cutstr($stitle, 35)."</a></td>"
."<td align=\"center\">".$ctitle."</td>"
."<td align=\"center\">".format_time($time)."</td>"
."<td align=\"center\">".$post."</td></tr>";
}
echo "</table>";
close();
$ordernum = ($let) ? "UPPER(title) LIKE '".$let."%' AND time <= now() AND status!='0'" : "time <= now() AND status!='0'";
num_article($conf['name'], $newlistnum, $field, "sid", "_stories", "catid", $ordernum);
} else {
warning(""._NO_INFO."", "", "", 2);
}
foot();
}

function printe() {
global $prefix, $db, $pagetitle, $conf, $confn;
$id = intval($_GET['id']);
$result = $db->sql_query("SELECT title, time, hometext, bodytext FROM ".$prefix."_stories WHERE sid='$id' AND time <= now() AND status!='0'");
if ($db->sql_numrows($result) == 1) {
$db->sql_query("UPDATE ".$prefix."_stories SET counter=counter+1 WHERE sid='$id'");
list($stitle, $date, $hometext, $bodytext) = $db->sql_fetchrow($result);
get_theme_inc();
$conf['defis'] = urldecode($conf['defis']);
$title = "$stitle ".$conf['defis']." "._NEWS." ".$conf['defis']." ".$conf['sitename']."";
$ptitle = "".format_time($date)." - ".$stitle."";
$text = ($bodytext) ? "".bb_decode($hometext, $conf['name'])."<br /><br />".bb_decode($bodytext, $conf['name'])."" : bb_decode($hometext, $conf['name']);
$url = ""._COMESFROM.": <a href=\"".$conf['homeurl']."\" title=\"".$conf['sitename']."\">".$conf['homeurl']."</a><br />"._THEURL.": <a href=\"".$conf['homeurl']."/index.php?name=".$conf['name']."&op=view&id=$id\" title=\"".$stitle."\">".$conf['homeurl']."/index.php?name=".$conf['name']."&op=view&id=$id</a>";
prints($title, $ptitle, str_replace("[pagebreak]", "", $text), $url);
} else {
Header("Location: index.php?name=".$conf['name']."");
}
}

function view() {
global $prefix, $db, $admin_file, $conf, $confu, $confn, $pagetitle, $hometext, $bodytext;
$id = intval($_GET['id']);
$pag = intval($_GET['pag']);
$word = ($_GET['word']) ? text_filter($_GET['word']) : "";
$result = $db->sql_query("SELECT s.sid, s.catid, s.name, s.title, s.time, s.hometext, s.bodytext, s.field, s.comments, s.counter, s.acomm, s.score, s.ratings, s.associated, c.id, c.title, c.description, c.img, u.user_name FROM ".$prefix."_stories AS s LEFT JOIN ".$prefix."_categories AS c ON (s.catid=c.id) LEFT JOIN ".$prefix."_users AS u ON (s.uid=u.user_id) WHERE sid = '$id' AND time <= now() AND status!='0'");
if ($db->sql_numrows($result) == 1) {
$db->sql_query("UPDATE ".$prefix."_stories SET counter=counter+1 WHERE sid='$id'");
list($sid, $catid, $uname, $title, $time, $hometext, $bodytext, $field, $comments, $counter, $acomm, $score, $ratings, $associated, $cid, $ctitle, $cdescription, $cimg, $user_name) = $db->sql_fetchrow($result);
$pagetitle = (intval($catid)) ? "".$conf['defis']." "._NEWS." ".$conf['defis']." $ctitle ".$conf['defis']." $title" : "".$conf['defis']." "._NEWS." ".$conf['defis']." $title";
head();
menu(""._NEWS."");
$fields = fields_out($field, $conf['name']);
$fields = ($fields) ? "<br /><br />".$fields."" : "";
$text = (!$bodytext) ? "".$hometext."".$fields."" : "".$hometext."<br /><br />".$bodytext."".$fields."";
$conpag = explode("[pagebreak]", $text);
$pageno = count($conpag);
$pag = ($pag == "" || $pag < 1) ? 1 : $pag;
if ($pag > $pageno) $pag = $pageno;
$arrayelement = (int)$pag;
$arrayelement--;
$post = ($user_name) ? ""._POSTEDBY.": ".user_info($user_name, 1)."" : (($uname) ? ""._POSTEDBY.": ".$uname."" : ""._POSTEDBY.": ".$confu['anonym']."");
$ndate = ($confn['newdate']) ? " "._DATE.": ".format_time($time)."" : "";
$reads = ($confn['newread']) ? " "._READS.": ".$counter."" : "";
$arating = " ".ajax_rating(1, $sid, $conf['name'], $ratings, $score)."";
$print = " ".ad_print("index.php?name=".$conf['name']."&op=printe&id=".$sid."")."";
$admin = (is_moder($conf['name'])) ? " ".ad_edit("".$admin_file.".php?op=news_add&id=".$sid."")."" : "";
$cdescription = ($cdescription) ? $cdescription : $ctitle;
$cimg = ($cimg) ? "<a href=\"index.php?name=".$conf['name']."&cat=$cid\"><img src=\"images/categories/".$cimg."\" border=\"0\" alt=\"$cdescription\" title=\"$cdescription\" align=\"right\" hspace=\"10\" vspace=\"10\"></a>" : "";
$link = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"75%\" align=\"left\">".$post."".$ndate."".$reads."</td><td>".$arating."</td><td align=\"right\">".$print."".$admin."</td></tr></table>";
basic($cid, $cimg, $ctitle, $sid, search_color($title, $word), search_color(bb_decode($conpag[$arrayelement], $conf['name']), $word), $link, $read, $post, $ndate, $reads, $comm, $arating, $print, $admin);
num_pages($conf['name'], 1, $pageno, 1, "op=view&id=".$id."&");
if ($confn['newassoc']) {
if ($associated[strlen($associated)-1] == "-") $associated = substr($associated, 0, -1);
$asso = str_replace("-", ",", $associated);
$limit = intval($confn['newasocnum']);
$result = $db->sql_query("SELECT sid, title, time FROM ".$prefix."_stories WHERE catid IN (".$asso.") AND sid!='$sid' AND time <= now() AND status!='0' ORDER BY time DESC LIMIT 0, ".$limit."");
if ($db->sql_numrows($result) > 0) {
open();
echo "<h2 style=\"margin: 0 0 5px 0;\">"._ASSTORY."</h2>"
."<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">";
while(list($s_sid, $title, $time) = $db->sql_fetchrow($result)) {
echo "<tr><td><a href=\"index.php?name=".$conf['name']."&op=view&id=$s_sid\" title=\"$title\"><img src=\"".img_find("all/news")."\" border=\"0\"></a></td><td>".format_time($time)." - <a href=\"index.php?name=".$conf['name']."&op=view&id=$s_sid\" title=\"$title\">$title</a></td></tr>";
}
echo "</table>";
close();
}
}
if (!$acomm) {
echo "<a name=\"$sid\"></a>";
show_com($sid);
}
foot();
} else {
Header("Location: index.php?name=".$conf['name']."");
}
}

function add() {
global $prefix, $db, $user, $conf, $confn, $confu, $pagetitle, $stop;
$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." "._ADD."";
if ((is_user() && $confn['add'] == 1) || (!is_user() && $confn['addquest'] == 1)) {
head();
menu(""._ADD."");
if ($stop) warning($stop, "", "", 1);
$subject = save_text($_POST['subject']);
$catid = intval($_POST['catid']);
$hometext = save_text($_POST['hometext']);
$bodytext = save_text($_POST['bodytext']);
$field = fields_save($_POST['field']);
$postname = text_filter(substr($_POST['postname'], 0, 25));
if ($hometext) preview($subject, $hometext, $bodytext, $field, $conf['name']);
warning(""._SUBMIT."", "", "", 2);
open();
echo "<form name=\"post\" action=\"index.php?name=".$conf['name']."\" method=\"post\">";
if (is_user()) {
echo "<div class=\"left\">"._YOURNAME.":</div><div class=\"center\">".text_filter(substr($user[1], 0, 25))."</div>";
} else {
$postname = ($postname) ? $postname : $confu['anonym'];
echo "<div class=\"left\">"._YOURNAME.":</div><div class=\"center\"><input type=\"text\" name=\"postname\" value=\"".$postname."\" size=\"65\" class=\"".$conf['style']."\"></div>";
}
echo "<div class=\"left\">"._TITLE.":</div><div class=\"center\"><input type=\"text\" name=\"subject\" value=\"".$subject."\" maxlength=\"80\" size=\"65\" class=\"".$conf['style']."\"></div>"
."<div class=\"left\">"._CATEGORY.":</div><div class=\"center\"><select name=\"catid\" class=\"".$conf['style']."\">".getcat($conf['name'], $catid)."</select></div>"
."<div class=\"left\">"._TEXT.":</div><div class=\"center\">".textarea("1", "hometext", $hometext, $conf['name'], "5")."</div>"
."<div class=\"left\">"._ENDTEXT.":</div><div class=\"center\">".textarea("2", "bodytext", $bodytext, $conf['name'], "15")."</div>"
."".fields_in($field, $conf['name']).""
."".captcha_random().""
."<div class=\"button\"><select name=\"posttype\">"
."<option value=\"preview\">"._PREVIEW."</option>"
."<option value=\"save\">"._SEND."</option></select>"
."<input type=\"hidden\" name=\"op\" value=\"send\">"
." <input type=\"submit\" value=\""._OK."\" class=\"fbutton\"></div></form>";
close();
foot();
} else {
Header("Location: index.php?name=".$conf['name']."");
}
}

function send() {
global $prefix, $db, $user, $conf, $confn, $stop;
if ((is_user() && $confn['add'] == 1) || (!is_user() && $confn['addquest'] == 1)) {
$postname = text_filter(substr($_POST['postname'], 0, 25));
$subject = save_text($_POST['subject']);
$hometext = save_text($_POST['hometext']);
$bodytext = save_text($_POST['bodytext']);
$field = fields_save($_POST['field']);
$catid = intval($_POST['catid']);
if (!$subject) $stop = ""._CERROR."";
if (!$hometext) $stop = ""._CERROR1."";
if (!$postname && !is_user()) $stop = ""._CERROR3."";
if (captcha_check()) $stop = ""._SECCODEINCOR."";
if (!$stop && $_POST['posttype'] == "save") {
$postid = (is_user()) ? intval($user[0]) : "";
$postname = (!is_user()) ? $postname : "";
$ip = getip();
$db->sql_query("INSERT INTO ".$prefix."_stories (sid, catid, uid, name, title, time, hometext, bodytext, field, comments, counter, ihome, acomm, score, ratings, associated, ip_sender, status) VALUES (NULL, '$catid', '$postid', '$postname', '$subject', now(), '$hometext', '$bodytext', '$field', '0', '0', '0', '0', '0', '0', '0', '$ip', '0')");
update_points(31);
head();
menu(""._ADD."");
warning(""._SUBTEXT."", "?name=".$conf['name']."", 10, 2);
foot();
} else {
add();
}
} else {
Header("Location: index.php?name=".$conf['name']."");
}
}

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

case "liste":
liste();
break;

case "printe":
printe();
break;

case "view":
view();
break;

case "add":
add();
break;

case "send":
send();
break;

case "save_com":
save_com();
break;
}
?>
3.97

3.97
5
14.12.2009 21:58:00
заменил, результат нулевой, сообщения выводятся в порядке далёком от нормального, по сути ничего не сменилось- два сообщения по центру, вторая по счёту новость на предпоследнем месте и самое последнее по дате сообщение в самом низу. Это может быть связано с шаблоном?


Версия системы: SLAED CMS 4.2 Pro
Версия PHP: PHP 5
Сервер: Сервер в интернете
6
14.12.2009 22:05:4614.12.2009 22:08:11
sheft, хм, теоритически может, если у Вас там несколько переменных вывода контента вставлены.
Может быть всё, что угодно.
Попробуйте вывести через родной шаблон.
Тяжело конечно так рассуждать, нужно, в идеале, весь код Вашего сайта видеть.
Версий 4.2 было выпущено во множестве модификаций, и в каждой свои глюки.
3.97

3.97
7
14.12.2009 22:38:2614.12.2009 22:42:04
сменил шаблон на celestial - порядок новостей не изменился, тотже самый беспорядок, наверное всё таки шаблон не виноват.... версия слаеда кстати 4.3.2 pro, просто в меню выбора этой версии нет.
8
14.12.2009 22:51:36
sheft, интересно. ок, завтра посмотрю что там может быть.
3.97

3.97
9
15.12.2009 03:04:36
Ладно попробую предположить. Была такая кака с про версией 3,0. Виной был хостинг, а точнее кодировка базы данных на сервере. Где некоторые таблицы базы не верно сортировались. Попробуйте поиграться с кодировкой.
Кстати какая сейчас на базу установлена?

Ещё как вариант, вы сильно намудрили с перестановкой статей по числам создания. Возможно одна из статей имеет неверную дату создания. Как пример у меня был раз случай, статья имела время создания 31.11.2019 00:00:00 при этом чудом стояла между нормальными.

Просмотрите все статьи вручном режиме.

Но может я и не прав. Смайл - 13


Версия системы: SLAED CMS 3.5 Pro
Версия PHP: PHP 5
Сервер: Сервер в интернете
4.26

4.26
10
15.12.2009 09:06:1615.12.2009 09:14:06
про кодировку тоже уже подумал, база была в кодировке UTF-8 но при этом не отображался русский язык, новости на русском просто не добавлялись, на англ всё работало, в конфигах Slaeda был указан при этом UTF-8... Саппорт посоветовал тоже поиграться с кодировками, в итоге всё "заработало" при установке в конфиге движка $dbcode = "cp1251"; но база по прежнему в utf-8 в этом видимо и проблема...

Просмотрите все статьи вручном режиме. - этого я не понял..
в админке новости выводятся в порядке создания сверху вниз, сортировка по номеру.

как правильнее сделать? сохранить дамп базы, исправить все utf-8 на cp1251 и залить дамп по новой? или есть способы наживую заменить кодировку базы?
Открыть Ответить
новыедолжныпохожуюткнётвиделбылотемуносомсообщениястарыеможетболеевнизвытеснятьтопик
Хотите опробовать SLAED CMS в действии?

Технологии

PHP MySQL HTML 5 CSS 3 jQuery jQuery UI

Контакты

  • D-49179, Deutschland
    Ostercappeln, Im Siek 6
  • +49 176 61966679

  • https://slaed.net
Идеи и предложения
Обратная связь