<tr> <td><h3 class="yellow_text"><?php echo $row['title']; ?> </h3></td> </tr> </table> <table class="news_content" cellpadding="4"> <tr> <td> <?php } $text = preg_replace("#((http|https|ftp)://(\\S*?\\.\\S*?))(\\s|\\;|\\)|\\]|\\[|\\{|\\}|,|\"|'|:|\\<|\$|\\.\\s)#ie", "'<a href=\"\$1\" target=\"_blank\">http://\$3</a>\$4'", $row['body']); if ($GLOBALS['news']['limitHomeCharacters'] == true) { echo website::limit_characters($text, 200); $output .= website::limit_characters($row['body'], 200); } else { echo nl2br($text); $output .= nl2br($row['body']); } $commentsNum = mysql_query("SELECT COUNT(id) FROM news_comments WHERE newsid='" . $row['id'] . "'"); if ($GLOBALS['news']['enableComments'] == TRUE) { $comments = '| <a href="?p=news&newsid=' . $row['id'] . '">Comments (' . mysql_result($commentsNum, 0) . ')</a>'; } else { $comments = NULL; } echo ' <br/><br/><br/> <i class="gray_text"> Written by ' . $row['author'] . ' | ' . $row['date'] . ' ' . $comments . '</i> </td> </tr>
public static function getNews() { if ($GLOBALS['news']['enable'] == true) { echo '<div class="box_two_title">Latest News</div>'; if (cache::exists('news') == TRUE) { cache::loadCache('news'); } else { connect::selectDB('webdb'); $result = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT " . $GLOBALS['news']['maxShown']); if (mysql_num_rows($result) == 0) { echo 'No news was found'; } else { $output = NULL; while ($row = mysql_fetch_assoc($result)) { if (file_exists($row['image'])) { echo $newsPT1 = ' <table class="news" width="100%"> <tr> <td><h3 class="yellow_text">' . $row['title'] . '</h3></td> </tr> </table> <table class="news_content" cellpadding="4"> <tr> <td><img src="' . $row['image'] . '" alt=""/></td> <td>'; } else { echo $newsPT1 = ' <table class="news" width="100%"> <tr> <td><h3 class="yellow_text">' . $row['title'] . '</h3></td> </tr> </table> <table class="news_content" cellpadding="4"> <tr> <td>'; } $output .= $newsPT1; unset($newsPT1); $text = html_entity_decode(preg_replace("\n\t\t\t\t\t\t #((http|https|ftp)://(\\S*?\\.\\S*?))(\\s|\\;|\\)|\\]|\\[|\\{|\\}|,|\"|'|:|\\<|\$|\\.\\s)#ie", "'<a href=\"\$1\" target=\"_blank\">http://\$3</a>\$4'", $row['body'])); if ($GLOBALS['news']['limitHomeCharacters'] == true) { echo website::limit_characters($text, 200); $output .= website::limit_characters($row['body'], 200); } else { echo nl2br($text); $output .= nl2br($row['body']); } $commentsNum = mysql_query("SELECT COUNT(id) FROM news_comments WHERE newsid='" . $row['id'] . "'"); if ($GLOBALS['news']['enableComments'] == TRUE) { $comments = '| <a href="?p=news&newsid=' . $row['id'] . '">Comments (' . mysql_result($commentsNum, 0) . ')</a>'; } else { $comments = ''; } echo $newsPT2 = ' <br/><br/><br/> <i class="gray_text"> Written by ' . $row['author'] . ' | ' . $row['date'] . ' ' . $comments . '</i> </td> </tr> </table>'; $output .= $newsPT2; unset($newsPT2); } echo '<hr/> <a href="?p=news">View older news...</a>'; cache::buildCache('news', $output); } } } }