Exemple #1
0
function showcontent()
{
    global $uimages, $prefix, $db, $module_name;
    if (!isset($_GET['id'])) {
        URL::redirect(URL::index());
    }
    $id = intval($_GET['id']);
    $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
    $result = $db->sql_query("SELECT * FROM " . $prefix . "_reviews \n\tWHERE id='{$id}'");
    if ($db->sql_numrows($result) < 1) {
        URL::redirect(URL::index());
    }
    if ($page == 1 || $page == '') {
        $db->sql_query("UPDATE " . $prefix . "_reviews \n\t\tSET hits=hits+1 \n\t\tWHERE id='{$id}'");
    }
    require_once 'header.php';
    OpenTable();
    $myrow = $db->sql_fetchrow($result);
    $id = $myrow['id'];
    $date = $myrow['date'];
    $year = substr($date, 0, 4);
    $month = substr($date, 5, 2);
    $day = substr($date, 8, 2);
    $fdate = date('F jS Y', mktime(0, 0, 0, $month, $day, $year));
    $title = $myrow['title'];
    $text = $myrow['text'];
    $text = decode_bbcode($text, 1);
    $cover = $myrow['cover'];
    $reviewer = $myrow['reviewer'];
    $email = $myrow['email'];
    $hits = $myrow['hits'];
    $url = $myrow['url'];
    $url_title = $myrow['url_title'];
    $score = $myrow['score'];
    $language = $myrow['language'];
    $contentpages = explode('<!--pagebreak-->', $text);
    $pageno = count($contentpages);
    if ($page == '' || $page < 1) {
        $page = 1;
    }
    if ($page > $pageno) {
        $page = $pageno;
    }
    $arrayelement = (int) $page;
    $arrayelement--;
    echo '<table align="center"><tr><td>';
    if ($cover != '') {
        echo "<img src=\"images/reviews/{$cover}\" align=\"right\" border=\"1\" hspace=\"5\" alt=\"\" />";
    }
    echo "<span class=\"title\"><i><b>{$title}</b></i></span><br />";
    echo '<div style="text-align:justify;"><blockquote>' . $contentpages[$arrayelement];
    echo '</blockquote></div>';
    if (can_admin(strtolower($module_name))) {
        echo '<b>' . _ADMIN . '</b> [ <a href="' . URL::index('&amp;rop=mod_review&amp;id=' . $id) . '">' . _EDIT . '</a> | <a href="' . URL::index('&amp;rop=del_review&amp;id_del=' . $id) . '">' . _DELETE . '</a> ]<br />';
    }
    echo '<b>' . _ADDED . "</b> {$fdate}<br />";
    if ($reviewer != '') {
        echo '<b>' . _REVIEWER . "</b> <a href=\"mailto:{$email}\">{$reviewer}</a><br />";
    }
    if ($score != '') {
        echo '<b>' . _SCORE . '</b> ';
    }
    display_score($score);
    if ($url != '') {
        echo '<br /><b>' . _RELATEDLINK . ":</b> <a href=\"{$url}\" target=\"new\">{$url_title}</a>";
    }
    echo '<br /><b>' . _HITS . ":</b> {$hits}";
    echo '<br /><b>' . _LANGUAGE . ":</b> {$language}</td></tr></table>";
    echo '<div style="text-align:center;">';
    if ($pageno > 1) {
        echo '<br /><b>' . _PAGE . ":</b> {$page}/{$pageno}<br />";
    }
    //    $title = urlencode($title);
    if ($page >= $pageno) {
        $next_page = '';
    } else {
        $next_pagenumber = $page + 1;
        if ($page != 1) {
            $next_page .= '<img src="images/spacer.gif" width="10" height="2" alt="" /> &nbsp;&nbsp; ';
        }
        $next_page .= '
        <a href="' . URL::index("&amp;rop=showcontent&amp;id={$id}&amp;page={$next_pagenumber}") . '">' . _NEXTPAGE . " ({$next_pagenumber}/{$pageno})</a>\n        <a href=\"" . URL::index("&amp;rop=showcontent&amp;id={$id}&amp;page={$next_pagenumber}") . '">&#9658;</a>';
    }
    if ($page <= 1) {
        $previous_page = '';
    } else {
        $previous_pagenumber = $page - 1;
        $previous_page = '
        <a href="' . URL::index("&amp;rop=showcontent&amp;id={$id}&amp;page={$previous_pagenumber}") . '">&#9668;</a>
        <a href="' . URL::index("&amp;rop=showcontent&amp;id={$id}&amp;page={$previous_pagenumber}") . '">' . _PREVIOUSPAGE . " ({$previous_pagenumber}/{$pageno})</a>";
    }
    echo '' . $previous_page . " &nbsp;&nbsp; {$next_page}<br /><br />" . '[ <a href="' . URL::index() . '">' . _RBACK . '</a> | <a href="' . URL::index("&amp;rop=postcomment&amp;id={$id}") . '">' . _REPLYMAIN . '</a> ]</div>';
    CloseTable();
    if ($page == 1 || $page == '') {
        echo '<br />';
        r_comments($id, $title);
    }
}
Exemple #2
0
function showcontent($id, $page)
{
    global $admin, $uimages, $prefix, $db, $module_name;
    $id = intval($id);
    $page = intval($page);
    include 'header.php';
    OpenTable();
    if ($page == 1 or empty($page)) {
        $db->sql_query("UPDATE " . $prefix . "_reviews SET hits=hits+1 WHERE id='{$id}'");
    }
    $result = $db->sql_query("SELECT * FROM " . $prefix . "_reviews WHERE id='{$id}'");
    $myrow = $db->sql_fetchrow($result);
    $id = intval($myrow['id']);
    $date = $myrow['date'];
    $year = substr($date, 0, 4);
    $month = substr($date, 5, 2);
    $day = substr($date, 8, 2);
    $fdate = date("F jS Y", mktime(0, 0, 0, $month, $day, $year));
    $title = $myrow['title'];
    $title = filter($title, "nohtml");
    $text = urldecode(filter($myrow['text']));
    $cover = filter($myrow['cover'], "nohtml");
    $reviewer = filter($myrow['reviewer'], "nohtml");
    $email = filter($myrow['email'], "nohtml");
    $hits = intval($myrow['hits']);
    $url = filter($myrow['url'], "nohtml");
    $url_title = filter($myrow['url_title'], "nohtml");
    $score = intval($myrow['score']);
    $rlanguage = $myrow['rlanguage'];
    $contentpages = explode("[--pagebreak--]", $text);
    $pageno = count($contentpages);
    if ($page == "" || $page < 1) {
        $page = 1;
    }
    if ($page > $pageno) {
        $page = $pageno;
    }
    $arrayelement = (int) $page;
    $arrayelement--;
    echo "<p><i><b><font class=\"title\">{$title}</b></i></font><br>";
    echo "<BLOCKQUOTE><p align=justify>";
    if (!empty($cover)) {
        echo "<img src=\"images/reviews/{$cover}\" align=right border=1 vspace=2 alt=\"\">";
    }
    echo "{$contentpages[$arrayelement]}\r\n    </BLOCKQUOTE><p>";
    if (is_admin($admin)) {
        echo "<b>" . _ADMIN . "</b> [ <a href=\"modules.php?name={$module_name}&rop=mod_review&amp;id={$id}\">" . _EDIT . "</a> | <a href=modules.php?name={$module_name}&rop=del_review&amp;id_del={$id}>" . _DELETE . "</a> ]<br>";
    }
    echo "<b>" . _ADDED . "</b> {$fdate}<br>";
    if (!empty($reviewer)) {
        echo "<b>" . _REVIEWER . "</b> <a href=mailto:{$email}>{$reviewer}</a><br>";
    }
    if (!empty($score)) {
        echo "<b>" . _SCORE . "</b> ";
    }
    display_score($score);
    if (!empty($url)) {
        echo "<br><b>" . _RELATEDLINK . ":</b> <a href=\"{$url}\" target=new>{$url_title}</a>";
    }
    echo "<br><b>" . _HITS . ":</b> {$hits}";
    echo "<br><b>" . _LANGUAGE . ":</b> {$rlanguage}";
    if ($pageno > 1) {
        echo "<br><b>" . _PAGE . ":</b> {$page}/{$pageno}<br>";
    }
    echo "</font>";
    echo "</CENTER>";
    if ($page >= $pageno) {
        $next_page = "";
    } else {
        $next_pagenumber = $page + 1;
        if ($page != 1) {
            $next_page .= "<img src=\"images/blackpixel.gif\" width=\"10\" height=\"2\" border=\"0\" alt=\"\"> &nbsp;&nbsp; ";
        }
        $next_page .= "<a href=\"modules.php?name={$module_name}&rop=showcontent&amp;id={$id}&amp;page={$next_pagenumber}\">" . _NEXT . " ({$next_pagenumber}/{$pageno})</a> <a href=\"modules.php?name={$module_name}&rop=showcontent&amp;id={$id}&amp;page={$next_pagenumber}\"><img src=\"images/right.gif\" border=\"0\" alt=\"" . _NEXT . "\"></a>";
    }
    if ($page <= 1) {
        $previous_page = "";
    } else {
        $previous_pagenumber = $page - 1;
        $previous_page = "<a href=\"modules.php?name={$module_name}&rop=showcontent&amp;id={$id}&amp;page={$previous_pagenumber}\"><img src=\"images/left.gif\" border=\"0\" alt=\"" . _PREVIOUS . "\"></a> <a href=\"modules.php?name={$module_name}&rop=showcontent&amp;id={$id}&amp;page={$previous_pagenumber}\">" . _PREVIOUS . " ({$previous_pagenumber}/{$pageno})</a>";
    }
    echo "<center>" . "{$previous_page} &nbsp;&nbsp; {$next_page}<br><br>" . "[ <a href=\"modules.php?name={$module_name}\">" . _RBACK . "</a> | " . "<a href=\"modules.php?name={$module_name}&rop=postcomment&amp;id={$id}&amp;title={$title}\">" . _REPLYMAIN . "</a> ]";
    CloseTable();
    if ($page == 1 or empty($page)) {
        echo "<br>";
        r_comments($id, $title);
    }
    include "footer.php";
}