
Przedszkolak

Postów: 13
Data rejestracji: 11.03.2006 22:00
|
Hej!
Pobra?em t? wtyczk? i j? troch? przerobi?em. Lecz niestety natkn??em si? na pewien problem. Ale zaczn? od pocz?tku co chc? osi?gn??.
Sukcesywnie przenios?em pole wpisywania wiadomo?ci na sam dó?. Równie? zmieni?em numer linii kodu który, odpowiedzialny jest za od?wie?ania postów. Zmieni?em równie? w zapytaniu do bazy ORDER z DESC na ASC. Wszystko po to aby osi?gn?? efekt pisania postów jak w zwyk?ych czatach (najstarsze posty u góry, najnowsze do do?u) Wszystko wygl?da ok na pierwszy rzut oka.
Przesy?am zdj?cie:

Do?aczam kod zmienionych plików:
shoutbox_panel.php
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: shoutbox_panel.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
|===
| by PolarFox aka Psc | http://unlogic.info | Build: 6
+--------------------------------------------------------*/
if (!defined('IN_FUSION')) { die('Access Denied'); }
include_once INFUSIONS."shoutbox_panel/infusion_db.php";
include_once INCLUDES."infusions_include.php";
///move to settings
//settings
$sb_online_t = (time()- 600 ); //10 mins (60*10)
$sb_chidden = '<p class="admin-message">hidden</p>';
$sb_bbcodes = 'smiley|b|i|color|url';
$sb_bbcodesp = 'b|i|u|url|color|quote';
function sbwrap($text) {
global $locale;
$i = 0; $tags = 0; $chars = 0; $res = "";
$str_len = strlen($text);
for ($i = 0; $i < $str_len; $i++) {
$chr = mb_substr($text, $i, 1, $locale['charset']);
if ($chr == "<") {
if (mb_substr($text, ($i + 1), 6, $locale['charset']) == "a href" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "img") {
$chr = " ".$chr;
$chars = 0;
}
$tags++;
} elseif ($chr == "&") {
if (mb_substr($text, ($i + 1), 5, $locale['charset']) == "quot;") {
$chars = $chars - 5;
} elseif (mb_substr($text, ($i + 1), 4, $locale['charset']) == "amp;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#39;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#92;") {
$chars = $chars - 4;
} elseif (mb_substr($text, ($i + 1), 3, $locale['charset']) == "lt;" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "gt;") {
$chars = $chars - 3;
}
} elseif ($chr == ">") {
$tags--;
} elseif ($chr == " ") {
$chars = 0;
} elseif (!$tags) {
$chars++;
}
if (!$tags && $chars == 18) {
$chr .= "<br />";
$chars = 0;
}
$res .= $chr;
}
return $res;
}
$shout_settings = get_settings('shoutbox_panel');
$link = FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : "");
$link = preg_replace("^(&|\?)s_action=(edit|delete)&shout_id=\d*^", "", $link);
$sep = stristr($link, "?") ? "&" : "?";
$shout_link = '';$shout_message = '';
if (iMEMBER && (isset($_GET['s_action']) && $_GET['s_action'] == "delete") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."' AND shout_hidden='0'"))) {
$result = dbquery("DELETE FROM ".DB_SHOUTBOX." WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
redirect($link);
}
if (!defined('ashSCRIPT')) {
add_to_head('<script type="text/javascript" src="'.INFUSIONS.'shoutbox_panel/ash.js"></script>');
define('ashSCRIPT', true);
}
opentable($locale['SB_title']);
echo '<div id="sb_adiv">';
if (iMEMBER || $shout_settings['guest_shouts'] == "1") {
include_once INCLUDES."bbcode_include.php";
if (isset($_POST['post_shout'])) {
$flood = false;
if (iMEMBER) {
$shout_name = $userdata['user_id'];
} elseif ($shout_settings['guest_shouts'] == "1") {
$shout_name = trim(stripinput($_POST['shout_name']));
$shout_name = preg_replace("(^[+0-9\s]*)", "", $shout_name);
if (isnum($shout_name)) { $shout_name = ""; }
include_once INCLUDES."securimage/securimage.php";
$securimage = new Securimage();
if (!isset($_POST['sb_captcha_code']) || $securimage->check($_POST['sb_captcha_code']) == false) { redirect($link); }
}
$shout_message = str_replace("\n", " ", $_POST['shout_message']);
$shout_message = preg_replace("/^(.{255}).*$/", "$1", $shout_message);
$shout_message = trim(stripinput(censorwords($shout_message)));
if (iMEMBER && (isset($_GET['s_action']) && $_GET['s_action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$comment_updated = false;
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."' AND shout_hidden='0'"))) {
if ($shout_message) {
$result = dbquery("UPDATE ".DB_SHOUTBOX." SET shout_message='$shout_message' WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
}
redirect($link);
} elseif ($shout_name && $shout_message) {
require_once INCLUDES."flood_include.php";
if (!flood_control("shout_datestamp", DB_SHOUTBOX, "shout_ip='".USER_IP."'")) {
$result = dbquery("INSERT INTO ".DB_SHOUTBOX." (shout_name, shout_message, shout_datestamp, shout_ip, shout_ip_type, shout_hidden) VALUES ('$shout_name', '$shout_message', '".time()."', '".USER_IP."', '".USER_IP_TYPE."', '0')");
}
}
redirect($link);
}
if (iMEMBER && (isset($_GET['s_action']) && $_GET['s_action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$esresult = dbquery(
"SELECT ts.shout_id, ts.shout_name, ts.shout_message, tu.user_id, tu.user_name
FROM ".DB_SHOUTBOX." ts
LEFT JOIN ".DB_USERS." tu ON ts.shout_name=tu.user_id
WHERE ts.shout_id='".$_GET['shout_id']."'".(iADMIN && checkrights('S')?'':" AND shout_hidden='0'") );
if (dbrows($esresult)) {
$esdata = dbarray($esresult);
if ((iADMIN && checkrights('S')) || (iMEMBER && $esdata['shout_name'] == $userdata['user_id'] && isset($esdata['user_name']))) {
if ((isset($_GET['s_action']) && $_GET['s_action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
$edit_url = $sep."s_action=edit&shout_id=".$esdata['shout_id'];
} else {
$edit_url = '';
}
$shout_link = $link.$edit_url;
$shout_message = $esdata['shout_message'];
}
} else {
$shout_link = $link;
$shout_message = '';
}
} else {
$shout_link = $link;
$shout_message = '';
}
$numrows = dbcount('(shout_id)', DB_SHOUTBOX,(checkrights('S')?'':"shout_hidden='0'"));
$result = dbquery(
"SELECT ts.shout_id, ts.shout_name, ts.shout_message, ts.shout_datestamp,".(checkrights('S')?'ts.shout_ip,ts.shout_hidden,':'')." tu.user_id, tu.user_name,tu.user_avatar,tu.user_level,tu.user_lastvisit,tu.user_status FROM ".DB_SHOUTBOX." ts
LEFT JOIN ".DB_USERS." tu ON ts.shout_name=tu.user_id
".(checkrights('S')?'':"WHERE shout_hidden='0'")."
ORDER BY ts.shout_datestamp ASC LIMIT 0,".$shout_settings['visible_shouts']);
if (dbrows($result)) {
$i = 0;
while ($data = dbarray($result)) {
echo "<div class='shoutboxname'>";
if ($data['user_name']) {
if($data['user_avatar']) { echo '<img style="float: left;" src="'.IMAGES.'avatars/'.$data['user_avatar'].'" width="32" hspace="4" vspace="1" />'; } //set ava
echo ($data['user_level']>=102?'<img src="'.INFUSIONS.'shoutbox_panel/sh_adm.png" border="0" title="Admin" alt="[A]"/> ':'').
'<span class="side">'.profile_link($data['shout_name'],$data['user_name'],$data['user_status']).'</span>';
} else {
echo $data['shout_name']."\n";
}
if (iMEMBER || $shout_settings['guest_shouts'] == "1") //if shout exist
echo " <a href='javascript:insertText(\"shout_message\",\"[b]".($data['user_name']?$data['user_name']:$data['shout_name'])."[/b], \", \"shout_form\");' class='small side'>[!]</a>";
if ((iADMIN && checkrights('S')) || (iMEMBER && $data['shout_name'] == $userdata['user_id'] && isset($data['user_name']))) {
echo "\n\n\n<a href='".$link.$sep."s_action=edit&shout_id=".$data['shout_id']."#edit_shout"."' onclick='ash_edit(\"".$data['shout_id']."\");return false;' class='side' title='".$locale['SB_edit']."'><img src='".INFUSIONS."shoutbox_panel/sh_edit.png' class='bbcode' alt='[e]' border='0'></a>\n";
echo "<a href='".$link.$sep."s_action=delete&shout_id=".$data['shout_id']."' onclick='ash_del(\"".$data['shout_id']."\");return false;' class='side' title='".$locale['SB_delete']."'><img src='".INFUSIONS."shoutbox_panel/sh_delete.png' class='bbcode' alt='[d]' border='0'></a>";
if(checkrights('S'))echo ''.$data['shout_ip'].'';
}
echo "</div>\n";
echo "<div class='shoutboxdate' style='vertical-align: middle;'>".($data['user_lastvisit']>$sb_online_t?'<img src="'.INFUSIONS.'shoutbox_panel/sh_online.png" border="0" title="Online" alt="[on]"/> ':'<img src="'.INFUSIONS.'shoutbox_panel/sh_offline.png" border="0" title="Offline" alt="[off]"/> ').showdate("forumdate", $data['shout_datestamp'])."</div>";
echo "<div class='shoutbox'>".(checkrights('S')&&$data['shout_hidden']?$sb_chidden:'').sbwrap(parseubb(parsesmileys($data['shout_message']), $sb_bbcodesp))."</div>\n";
//if ((iADMIN && checkrights('S')) || (iMEMBER && $data['shout_name'] == $userdata['user_id'] && isset($data['user_name']))) {
// echo "<a href='".$link.$sep."s_action=edit&shout_id=".$data['shout_id']."#edit_shout"."' onclick='ash_edit(\"".$data['shout_id']."\");return false;' class='side' title='".$locale['SB_edit']."'><img src='".INFUSIONS."shoutbox_panel/sh_edit.png' class='bbcode' alt='[e]' border='0'></a>\n";
// echo "<a href='".$link.$sep."s_action=delete&shout_id=".$data['shout_id']."' onclick='ash_del(\"".$data['shout_id']."\");return false;' class='side' title='".$locale['SB_delete']."'><img src='".INFUSIONS."shoutbox_panel/sh_delete.png' class='bbcode' alt='[d]' border='0'></a>";
//}
$i++;
if ($i != $numrows) { echo "<br />\n"; }
}
echo '</div>';
if ($numrows > $shout_settings['visible_shouts']) {
echo "<div style='text-align:center'>\n<a href='".INFUSIONS."shoutbox_panel/shoutbox_archive.php' class='side'>".$locale['SB_archive']."</a>\n</div>\n";
if(iMEMBER){echo '<script type="text/javascript">//<![CDATA[
document.write(\'<input style="float:right;" src="'.INFUSIONS.'shoutbox_panel/sh_more.png" class="bbcode" onclick="ash_addmore();return false;" title="More!" type="image">\');
//]]></script>'; }
}
} else {
echo "<div>".$locale['SB_no_msgs']."</div>\n";
}
echo "<a id='edit_shout' name='edit_shout'></a>\n";
echo "<form name='shout_form' method='post' action='$shout_link' ".(iMEMBER?'onsubmit="ash_send();return false;"':'').">\n";
if (iGUEST) {
echo $locale['SB_name']."<br />\n";
echo "<input type='text' name='shout_name' value='' class='textbox' maxlength='30' style='width:140px' /><br />\n";
echo $locale['SB_message']."<br />\n";
}
echo "<textarea name='shout_message' rows='2' cols='20' class='textbox' style='width:1070px' onKeyDown='textCount(c_sbform.shout_message,c_sbform.com_len);sh_center(event);' onKeyUp='textCount(c_sbform.shout_message,c_sbform.com_len);'>$shout_message</textarea><br />\n";
echo display_bbcodes("150px;", "shout_message", "shout_form", $sb_bbcodes);
if (iGUEST) {
echo $locale['SB_validation_code']."<br />\n";
echo "<img id='sb_captcha' src='".INCLUDES."securimage/securimage_show.php' alt='' /><br />\n";
echo "<a href='".INCLUDES."securimage/securimage_play.php'><img src='".INCLUDES."securimage/images/audio_icon.gif' alt='' class='tbl-border' style='margin-bottom:1px' /></a>\n";
echo "<a href='#' onclick=\"document.getElementById('sb_captcha').src = '".INCLUDES."securimage/securimage_show.php?sid=' + Math.random(); return false\"><img src='".INCLUDES."securimage/images/refresh.gif' alt='' class='tbl-border' /></a><br />\n";
echo $locale['SB_enter_validation_code']."<br />\n<input type='text' name='sb_captcha_code' class='textbox' style='width:100px' /><br />\n";
}
echo "<input type='submit' name='post_shout' value='wyslij' class='button' title='Ctrl+Enter' />\n";
echo '<script type="text/javascript">//<![CDATA[
document.write(\' <input style="font-weight:bold;" readonly="readonly" type="text" name="com_len" size="3" value="\'+sb_max+\'">'.(iMEMBER?' <input src="'.INFUSIONS.'shoutbox_panel/sh_refropt.png" class="bbcode" onclick="return overlay(this, \\\'asb_refrupd\\\', \\\'bottomright\\\');" title="Od¶wie¿ co ...sek" type="image"> <input src="'.INFUSIONS.'shoutbox_panel/sh_refresh.png" class="bbcode" onclick="ash_refresh(0);return false;" title="Od¶wie¿" type="image">':'').'\');
var sb_fldr="'.INFUSIONS.'shoutbox_panel/",inc_row='.$shout_settings['visible_shouts'].',c_sbform=document.forms["shout_form"];
//]]></script>';
if(iMEMBER){
echo '<div id="asb_refrupd" class="tbl1" style="display:none;border: 1px solid black; position: absolute; overflow: auto; width: 50px; height: auto;" onclick="overlayclose(\'asb_refrupd\');">
<label style="cursor:pointer;"><input name="ash_ab" value="-" type="radio" checked="checked" onclick="ash_setautor(0);">---</label>
<label style="cursor:pointer;"><input name="ash_ab" value="10" type="radio" onclick="ash_setautor(10);">10 s</label>
<label style="cursor:pointer;"><input name="ash_ab" value="20" type="radio" onclick="ash_setautor(20);">20 s</label>
<label style="cursor:pointer;"><input name="ash_ab" value="30" type="radio" onclick="ash_setautor(30);">30 s</label>';
echo "</div>";
}
echo '</form>';
} else {
echo "<div style='text-align:center'>".$locale['SB_login_req']."</div><br />\n";
}
closetable();
?>
ash.php
<?php
/*
| PHP-Fusion Content Management System
|===
| ajax-part-of-the-shoutbox
| by PolarFox aka Psc | http://unlogic.info | Build : 7
*/
$sb_online_t = (time()- 600 ); //10 mins (60*10)
$sb_chidden = '<p class="admin-message">hidden</p>';
$sb_bbcodesp = 'b|i|u|url|color|quote';
require_once('../../maincore.php');
if(iGUEST){exit;}//guests blocked
include_once INFUSIONS."shoutbox_panel/infusion_db.php";
include_once INCLUDES."infusions_include.php";
$shout_settings = get_settings('shoutbox_panel');
$shout_message = '';
header('Content-type: text/html; charset='.$locale['charset']);
if(isset($_GET['ash_edit']) && isnum($_GET['ash_edit'])) {
$esresult = dbquery(
"SELECT shout_name,shout_message,shout_hidden FROM ".DB_SHOUTBOX."
WHERE shout_id='".$_GET['ash_edit']."'");
if (dbrows($esresult)) {
$esdata = dbarray($esresult);
if ((iADMIN && checkrights("S")) || (iMEMBER && $esdata['shout_name'] == $userdata['user_id'] && $esdata['shout_hidden']=='0')) {
echo '<script type="text/javascript">//<![CDATA[
document.shout_form.shout_message.value = "'.str_replace(array(''','"',"\r\n","\r"),array('\'','\"','\n',''),$esdata['shout_message']).'"
document.shout_form.shout_message.focus();
//]]></script>';
}
exit('<!-- wrong parameters -->');
}
exit('<!-- no data -->');
}
else {
if ((isset($_GET['s_action']) && $_GET['s_action'] == "delete") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
if ((iADMIN && checkrights("S")) || (dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."' AND shout_hidden='0'"))) {
$result = dbquery("DELETE FROM ".DB_SHOUTBOX." WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
}
if (isset($_POST['post_shout'])&&!empty($_POST['shout_message'])) {
$flood = false;
$shout_name = $userdata['user_id'];
if(function_exists('iconv')){$shout_message = @iconv('UTF-8', $locale['charset'].'//TRANSLIT',$_POST['shout_message']);} //decoding via loc
else {$shout_message = $_POST['shout_message'];} //simply insert
$shout_message = preg_replace("/^(.{255}).*$/", "$1", str_replace("\n", " ",$shout_message));
$shout_message = trim(stripinput(censorwords($shout_message)));
if (iMEMBER && (isset($_GET['s_action']) && $_GET['s_action'] == "edit") && (isset($_GET['shout_id']) && isnum($_GET['shout_id']))) {
if ((iADMIN && checkrights("S")) || (iMEMBER && dbcount("(shout_id)", DB_SHOUTBOX, "shout_id='".$_GET['shout_id']."' AND shout_name='".$userdata['user_id']."'"))) {
if ($shout_message) {
$result = dbquery("UPDATE ".DB_SHOUTBOX." SET shout_message='$shout_message' WHERE shout_id='".$_GET['shout_id']."'".(iADMIN ? "" : " AND shout_name='".$userdata['user_id']."'"));
}
}
//ok upd
} elseif ($shout_name && $shout_message) {
require_once INCLUDES."flood_include.php";
if (!flood_control("shout_datestamp", DB_SHOUTBOX, "shout_ip='".USER_IP."'")) {
$result = dbquery("INSERT INTO ".DB_SHOUTBOX." (shout_name, shout_message, shout_datestamp, shout_ip, shout_ip_type, shout_hidden) VALUES ('$shout_name', '$shout_message', '".time()."', '".USER_IP."', '".USER_IP_TYPE."', '0')");
}
}
//ok send
}
function sbwrap($text) {
global $locale;
$i = 0; $tags = 0; $chars = 0; $res = "";
$str_len = strlen($text);
for ($i = 0; $i < $str_len; $i++) {
$chr = mb_substr($text, $i, 1, $locale['charset']);
if ($chr == "<") {
if (mb_substr($text, ($i + 1), 6, $locale['charset']) == "a href" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "img") {
$chr = " ".$chr;
$chars = 0;
}
$tags++;
} elseif ($chr == "&") {
if (mb_substr($text, ($i + 1), 5, $locale['charset']) == "quot;") {
$chars = $chars - 5;
} elseif (mb_substr($text, ($i + 1), 4, $locale['charset']) == "amp;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#39;" || mb_substr($text, ($i + 1), 4, $locale['charset']) == "#92;") {
$chars = $chars - 4;
} elseif (mb_substr($text, ($i + 1), 3, $locale['charset']) == "lt;" || mb_substr($text, ($i + 1), 3, $locale['charset']) == "gt;") {
$chars = $chars - 3;
}
} elseif ($chr == ">") {
$tags--;
} elseif ($chr == " ") {
$chars = 0;
} elseif (!$tags) {
$chars++;
}
if (!$tags && $chars == 18) {
$chr .= "<br />";
$chars = 0;
}
$res .= $chr;
}
return $res;
}
function ash_set_fpath($pathto) {global $settings;
return str_replace('../../', $settings['siteurl'], $pathto);
}
define('AINFUSIONS',ash_set_fpath(INFUSIONS));
define('AIMAGES',ash_set_fpath(IMAGES));
$row = 0 ;
if (isset($_GET['row']) && isnum($_GET['row'])) {$row = $_GET['row'];}
$numrows = dbcount('(shout_id)', DB_SHOUTBOX,(checkrights('S')?'':"shout_hidden='0'"));
$result = dbquery("SELECT ts.shout_id, ts.shout_name, ts.shout_message, ts.shout_datestamp,".(checkrights('S')?'ts.shout_ip,ts.shout_hidden,':'')." tu.user_id, tu.user_name,tu.user_avatar,tu.user_level,tu.user_lastvisit,tu.user_status FROM ".DB_SHOUTBOX." ts
LEFT JOIN ".DB_USERS." tu ON ts.shout_name=tu.user_id
".(checkrights('S')?'':"WHERE shout_hidden='0'")."
ORDER BY ts.shout_datestamp ASC LIMIT $row,".$shout_settings['visible_shouts']);
if (dbrows($result)) {
$i = 0;
while ($data = dbarray($result)) {
echo "<div class='shoutboxname'>";
if ($data['user_name']) {
if($data['user_avatar']) { echo '<img style="float: left;" src="'.AIMAGES.'avatars/'.$data['user_avatar'].'" width="32" hspace="4" vspace="1" />'; } //set ava
echo ($data['user_level']>=102?'<img src="'.AINFUSIONS.'shoutbox_panel/sh_adm.png" border="0" title="Admin" alt="[A]"/> ':'').
'<span class="side">'.ash_set_fpath(profile_link($data['shout_name'],$data['user_name'],$data['user_status'])).'</span>';
} else {
echo $data['shout_name']."\n";
}
if (iMEMBER || $shout_settings['guest_shouts'] == "1") //if shout exist
echo " <a href='javascript:insertText(\"shout_message\",\"[b]".($data['user_name']?$data['user_name']:$data['shout_name'])."[/b], \", \"shout_form\");' class='small side'>[!]</a>";
if ((iADMIN && checkrights('S')) || (iMEMBER && $data['shout_name'] == $userdata['user_id'] && isset($data['user_name']))) {
echo "\n\n\n<a href='".$link.$sep."s_action=edit&shout_id=".$data['shout_id']."#edit_shout"."' onclick='ash_edit(\"".$data['shout_id']."\");return false;' class='side' title='".$locale['SB_edit']."'><img src='".INFUSIONS."shoutbox_panel/sh_edit.png' class='bbcode' alt='[e]' border='0'></a>\n";
echo "<a href='".$link.$sep."s_action=delete&shout_id=".$data['shout_id']."' onclick='ash_del(\"".$data['shout_id']."\");return false;' class='side' title='".$locale['SB_delete']."'><img src='".INFUSIONS."shoutbox_panel/sh_delete.png' class='bbcode' alt='[d]' border='0'></a>";
if(checkrights('S'))echo ''.$data['shout_ip'].'';
}
echo "</div>\n";
echo "<div class='shoutboxdate' style='vertical-align: middle;'>".($data['user_lastvisit']>$sb_online_t?'<img src="'.INFUSIONS.'shoutbox_panel/sh_online.png" border="0" title="Online" alt="[on]"/> ':'<img src="'.INFUSIONS.'shoutbox_panel/sh_offline.png" border="0" title="Offline" alt="[off]"/> ').showdate("forumdate", $data['shout_datestamp'])."</div>";
echo "<div class='shoutbox'>".(checkrights('S')&&$data['shout_hidden']?$sb_chidden:'').sbwrap(parseubb(parsesmileys($data['shout_message']), $sb_bbcodesp))."</div>\n";
//if ((iADMIN && checkrights('S')) || (iMEMBER && $data['shout_name'] == $userdata['user_id'] && isset($data['user_name']))) {
// echo "<a href='".$link.$sep."s_action=edit&shout_id=".$data['shout_id']."#edit_shout"."' onclick='ash_edit(\"".$data['shout_id']."\");return false;' class='side' title='".$locale['SB_edit']."'><img src='".INFUSIONS."shoutbox_panel/sh_edit.png' class='bbcode' alt='[e]' border='0'></a>\n";
// echo "<a href='".$link.$sep."s_action=delete&shout_id=".$data['shout_id']."' onclick='ash_del(\"".$data['shout_id']."\");return false;' class='side' title='".$locale['SB_delete']."'><img src='".INFUSIONS."shoutbox_panel/sh_delete.png' class='bbcode' alt='[d]' border='0'></a>";
//}
$i++;
if ($i != $numrows) { echo "<br />\n"; }
}
}
else {
echo "<div>".$locale['SB_no_msgs']."</div>\n";
}
} //standart a-form
?>
W czym tkwi problem? Problem tkwi w tym ?e jak mo?na zobaczy? na powy?szym zdj?ciu, pod postem u?ytkownika "WIKI: dlaczego?" jest nast?pny post z odpowiedzi? oraz posty nowsze. Lecz ich nie wy?wietla poniewa? zapytanie do bazy polega na tym ?e wy?wietla posty wg daty od najmniejszej do najwi?kszej. Jak zrobi? aby posty starsze czyli te u góry chowa?y si?? Trudno mi to opisa? poniewa? nie mam tak za bardzo rozwini?tej wyobra?ni, dlatego do??czy?em zdj?cie.
Dodaj? równie? zdj?cie jak wy?wietla czat przy zmianie w plikach ash oraz sbpanel order z ASC na DESC.

Jak wy?wietli? 8 najnowszych wyników z bazy danych segreguj?c je od najstarszych do najnowszych? W tym tkwi mój problem.
A zapytanie w przypadku ASC wygl?da tak: wy?wietl 8 najstarszych wyników:
ORDER BY ts.shout_datestamp ASC LIMIT 0,".$shout_settings['visible_shouts']);
W przypadku DESC : wy?wietl 8 najnowszych wyników:
ORDER BY ts.shout_datestamp DESC LIMIT 0,".$shout_settings['visible_shouts']);
Edit: Z tego co czyta?em na Googlach to musz? u?y? funkcji array reverse :/
Edit 2: Ok, naprawilem ten b?ad, uzylem zapytanie w zapytaniu do MySQL-a i zmienilem order z ts.shout_datestamp na sb.shout_id. Dziala identycznie a shout_datestamp nie dzia?a? w podzapytaniach, nie wiem dlaczego? Jakas czarna magia tym w?ada... W kazdym badz_razie pozniej zmienie pliki i je wysle tutaj mo?e komu? si? to przyda ;)
SELECT * FROM(
SELECT ts.shout_id, ts.shout_name, ts.shout_message, ts.shout_datestamp, ts.shout_ip, ts.shout_hidden, tu.user_id, tu.user_name, tu.user_avatar, tu.user_level, tu.user_lastvisit, tu.user_status
FROM evo_shoutbox AS ts
LEFT JOIN evo_users AS tu ON ts.shout_name=tu.user_id
WHERE shout_hidden='0'
ORDER BY ts.shout_id DESC LIMIT 0,8
) AS sb
ORDER BY sb.shout_id ASC
Edytowane przez Pieka dnia 07.04.2012 20:43:39
_______________________
"A tomek ukrad? i przerobi? twój skradziony i przerobiony skrypt"
|