Просмотр поста

.
X-Master

Привет! Пожалуйста, выпустите этот код для Johncms 6.x.x, пожалуйста


$q = mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 'm' AND `close` != '1'");

$c = mysql_result($q, 0);

$num = rand(0, ($c - 1)); 

$post = mysql_query ("SELECT `user_id`,`id`,`from`, `time`, `text` FROM `forum` WHERE `type` = 'm' AND `close` != '1' LIMIT " . $num . ", 1;");

$post1 = mysql_fetch_array($post); 

echo '<img src="../files/photo/'.$post1['user_id'].'_small.jpg" width="32" height="32" alt="'. $post1['from']. '" />';

echo '<a href="../str/anketa.php?id='. $post1['user_id']. '">'. $post1['from']. '</a> ('. date("d.m.y H:i", $post1['time']). ')<br/>';

$text = $post1['text'];

$cut='50'; //количество символов поста на главную 

if (!isset ($set_forum) || empty ($set_forum))

$set_forum = array('farea' => 0, 'upfp' => 0, 'farea_w' => 20, 'farea_h' => 4, 'postclip' => 1, 'postcut' => 2);

if ($set_forum['postcut'] && mb_strlen($text) > $cut) {

$text = mb_substr($text, 0, $cut);

$text = checkout($text, 1, 0);

$text = preg_replace('#\[c\](.*?)\[/c\]#si', '<div class="quote">\1</div>', $text);

echo $text . '...<br /><a href="../forum/index.php?act=post&amp;id=' . $post1['id'] . '">Читать все &gt;&gt;</a>';

} else {

 

// Или, обрабатываем тэги и выводим весь тек 

$text = checkout($text, 1, 1);

if ($set_user['smileys'])

$text = smileys($text, $post1['rights'] ? 1 : 0);

echo $text;

}