Example #1
0
function theindex($new_topic = 0)
{
    global $db, $storyhome, $topicname, $topicimage, $topictext, $datetime, $user, $cookie, $nukeurl, $prefix, $multilingual, $currentlang, $articlecomm, $sitename, $user_news;
    if ($multilingual == 1) {
        $querylang = "AND (alanguage='{$currentlang}' OR alanguage='')";
    } else {
        $querylang = "";
    }
    include "header.php";
    automated_news();
    if (isset($cookie[3]) and $user_news == 1) {
        $storynum = $cookie[3];
    } else {
        $storynum = $storyhome;
    }
    if ($new_topic == 0) {
        $qdb = "WHERE (ihome='0' OR catid='0')";
        $home_msg = "";
    } else {
        $qdb = "WHERE topic='{$new_topic}'";
        $result_a = $db->sql_query("SELECT topictext FROM " . $prefix . "_topics WHERE topicid='{$new_topic}'");
        $row_a = $db->sql_fetchrow($result_a);
        $numrows_a = $db->sql_numrows($result_a);
        $topic_title = stripslashes(check_html($row_a['topictext'], "nohtml"));
        OpenTable();
        if ($numrows_a == 0) {
            echo "<center><font class=\"title\">{$sitename}</font><br><br>" . _NOINFO4TOPIC . "<br><br>[ <a href=\"modules.php?name=News\">" . _GOTONEWSINDEX . "</a> | <a href=\"modules.php?name=Topics\">" . _SELECTNEWTOPIC . "</a> ]</center>";
        } else {
            echo "<center><font class=\"title\">{$sitename}: {$topic_title}</font><br><br>" . "<form action=\"modules.php?name=Search\" method=\"post\">" . "<input type=\"hidden\" name=\"topic\" value=\"{$new_topic}\">" . "" . _SEARCHONTOPIC . ": <input type=\"name\" name=\"query\" size=\"30\">&nbsp;&nbsp;" . "<input type=\"submit\" value=\"" . _SEARCH . "\">" . "</form>" . "[ <a href=\"index.php\">" . _GOTOHOME . "</a> | <a href=\"modules.php?name=Topics\">" . _SELECTNEWTOPIC . "</a> ]</center>";
        }
        CloseTable();
        echo "<br>";
    }
    $result = $db->sql_query("SELECT sid, catid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM " . $prefix . "_stories {$qdb} {$querylang} ORDER BY sid DESC limit {$storynum}");
    while ($row = $db->sql_fetchrow($result)) {
        $s_sid = intval($row['sid']);
        $catid = intval($row['catid']);
        $aid = stripslashes($row['aid']);
        $title = stripslashes(check_html($row['title'], "nohtml"));
        $time = $row['time'];
        $hometext = stripslashes($row['hometext']);
        $bodytext = stripslashes($row['bodytext']);
        $comments = stripslashes($row['comments']);
        $counter = intval($row['counter']);
        $topic = intval($row['topic']);
        $informant = stripslashes($row['informant']);
        $notes = stripslashes($row['notes']);
        $acomm = intval($row['acomm']);
        $score = intval($row['score']);
        $ratings = intval($row['ratings']);
        if ($catid > 0) {
            $row2 = $db->sql_fetchrow($db->sql_query("SELECT title FROM " . $prefix . "_stories_cat WHERE catid='{$catid}'"));
            $cattitle = stripslashes(check_html($row2['title'], "nohtml"));
        }
        getTopics($s_sid);
        formatTimestamp($time);
        $subject = stripslashes(check_html($subject, "nohtml"));
        $introcount = strlen($hometext);
        $fullcount = strlen($bodytext);
        $totalcount = $introcount + $fullcount;
        $c_count = $comments;
        $r_options = "";
        if (isset($cookie[4])) {
            $r_options .= "&amp;mode={$cookie['4']}";
        }
        if (isset($cookie[5])) {
            $r_options .= "&amp;order={$cookie['5']}";
        }
        if (isset($cookie[6])) {
            $r_options .= "&amp;thold={$cookie['6']}";
        }
        $story_link = "<a href=\"modules.php?name=News&amp;file=article&amp;sid={$s_sid}{$r_options}\">";
        $morelink = "(";
        if ($fullcount > 0 or $c_count > 0 or $articlecomm == 0 or $acomm == 1) {
            $morelink .= "{$story_link}<b>" . _READMORE . "</b></a> | ";
        } else {
            $morelink .= "";
        }
        if ($fullcount > 0) {
            $morelink .= "{$totalcount} " . _BYTESMORE . " | ";
        }
        if ($articlecomm == 1 and $acomm == 0) {
            if ($c_count == 0) {
                $morelink .= "{$story_link}" . _COMMENTSQ . "</a>";
            } elseif ($c_count == 1) {
                $morelink .= "{$story_link}{$c_count} " . _COMMENT . "</a>";
            } elseif ($c_count > 1) {
                $morelink .= "{$story_link}{$c_count} " . _COMMENTS . "</a>";
            }
        }
        $sid = intval($s_sid);
        if ($catid != 0) {
            $row3 = $db->sql_fetchrow($db->sql_query("SELECT title FROM " . $prefix . "_stories_cat WHERE catid='{$catid}'"));
            $title1 = stripslashes(check_html($row3['title'], "nohtml"));
            $title = "<a href=\"modules.php?name=News&amp;file=categories&amp;op=newindex&amp;catid={$catid}\"><font class=\"storycat\">{$title1}</font></a>: {$title}";
            $morelink .= " | <a href=\"modules.php?name=News&amp;file=categories&amp;op=newindex&amp;catid={$catid}\">{$title1}</a>";
        }
        if ($score != 0) {
            $rated = substr($score / $ratings, 0, 4);
        } else {
            $rated = 0;
        }
        $morelink .= " | " . _SCORE . " {$rated}";
        $morelink .= ")";
        $morelink = str_replace(" |  | ", " | ", $morelink);
        themeindex($aid, $informant, $datetime, $title, $counter, $topic, $hometext, $notes, $morelink, $topicname, $topicimage, $topictext);
    }
    include "footer.php";
}
function theindex($catid)
{
    global $storyhome, $httpref, $httprefmax, $topicname, $topicimage, $topictext, $datetime, $user, $cookie, $nukeurl, $prefix, $multilingual, $currentlang, $db, $articlecomm, $module_name;
    if ($multilingual == 1) {
        $querylang = "AND (alanguage='{$currentlang}' OR alanguage='')";
        /* the OR is needed to display stories who are posted to ALL languages */
    } else {
        $querylang = "";
    }
    include "header.php";
    if (isset($cookie[3])) {
        $storynum = $cookie[3];
    } else {
        $storynum = $storyhome;
    }
    $catid = intval($catid);
    $db->sql_query("update " . $prefix . "_stories_cat set counter=counter+1 where catid='{$catid}'");
    $result = $db->sql_query("SELECT sid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM " . $prefix . "_stories where catid='{$catid}' {$querylang} ORDER BY sid DESC limit {$storynum}");
    while ($row = $db->sql_fetchrow($result)) {
        $s_sid = intval($row['sid']);
        $aid = stripslashes($row['aid']);
        $title = stripslashes(check_html($row['title'], "nohtml"));
        $time = $row['time'];
        $hometext = stripslashes($row['hometext']);
        $bodytext = stripslashes($row['bodytext']);
        $comments = intval($row['comments']);
        $counter = intval($row['counter']);
        $topic = intval($row['topic']);
        $informant = stripslashes($row['informant']);
        $notes = stripslashes($row['notes']);
        $acomm = intval($row['acomm']);
        $score = intval($row['score']);
        $ratings = intval($row['ratings']);
        getTopics($s_sid);
        formatTimestamp($time);
        $subject = stripslashes(check_html($subject, "nohtml"));
        $introcount = strlen($hometext);
        $fullcount = strlen($bodytext);
        $totalcount = $introcount + $fullcount;
        $c_count = $comments;
        $r_options = "";
        if (isset($cookie[4])) {
            $r_options .= "&amp;mode={$cookie['4']}";
        }
        if (isset($cookie[5])) {
            $r_options .= "&amp;order={$cookie['5']}";
        }
        if (isset($cookie[6])) {
            $r_options .= "&amp;thold={$cookie['6']}";
        }
        $story_link = "<a href=\"modules.php?name=News&amp;file=article&amp;sid={$s_sid}{$r_options}\">";
        $morelink = "(";
        if ($fullcount > 0 or $c_count > 0 or $articlecomm == 0 or $acomm == 1) {
            $morelink .= "{$story_link}<b>" . _READMORE . "</b></a> | ";
        } else {
            $morelink .= "";
        }
        if ($fullcount > 0) {
            $morelink .= "{$totalcount} " . _BYTESMORE . " | ";
        }
        if ($articlecomm == 1 and $acomm == 0) {
            if ($c_count == 0) {
                $morelink .= "{$story_link}" . _COMMENTSQ . "</a>";
            } elseif ($c_count == 1) {
                $morelink .= "{$story_link}{$c_count} " . _COMMENT . "</a>";
            } elseif ($c_count > 1) {
                $morelink .= "{$story_link}{$c_count} " . _COMMENTS . "</a>";
            }
        }
        if ($score != 0) {
            $rated = substr($score / $ratings, 0, 4);
        } else {
            $rated = 0;
        }
        $morelink .= " | " . _SCORE . " {$rated}";
        $morelink .= ")";
        $morelink = str_replace(" |  | ", " | ", $morelink);
        $sid = intval($s_sid);
        $row2 = $db->sql_fetchrow($db->sql_query("select title from " . $prefix . "_stories_cat where catid='{$catid}'"));
        $title1 = stripslashes(check_html($row2['title'], "nohtml"));
        $title = "{$title1}: {$title}";
        themeindex($aid, $informant, $datetime, $title, $counter, $topic, $hometext, $notes, $morelink, $topicname, $topicimage, $topictext);
    }
    if ($httpref == 1) {
        $referer = $_SERVER["HTTP_REFERER"];
        if ($referer == "" or ereg("unknown", $referer) or eregi($nukeurl, $referer)) {
        } else {
            $db->sql_query("insert into " . $prefix . "_referer values (NULL, '{$referer}')");
        }
        $numrows = $db->sql_numrows($db->sql_query("select * from " . $prefix . "_referer"));
        if ($numrows == $httprefmax) {
            $db->sql_query("delete from " . $prefix . "_referer");
        }
    }
    include "footer.php";
}
Example #3
0
function aff_news($op, $catid, $marqeur)
{
    $url = $op;
    if ($op == "edito-newindex") {
        if ($marqeur == 0) {
            aff_edito();
        }
        $op = "news";
    }
    if ($op == "newindex") {
        if ($catid == "") {
            $op = "news";
        } else {
            $op = "categories";
        }
    }
    if ($op == "newtopic") {
        $op = "topics";
    }
    if ($op == "newcategory") {
        $op = "categories";
    }
    $news_tab = prepa_aff_news($op, $catid, $marqeur);
    $story_limit = 0;
    while ($story_limit < sizeof($news_tab)) {
        $story_limit++;
        $aid = unserialize($news_tab[$story_limit]['aid']);
        $informant = unserialize($news_tab[$story_limit]['informant']);
        $datetime = unserialize($news_tab[$story_limit]['datetime']);
        $title = unserialize($news_tab[$story_limit]['title']);
        $counter = unserialize($news_tab[$story_limit]['counter']);
        $topic = unserialize($news_tab[$story_limit]['topic']);
        $hometext = unserialize($news_tab[$story_limit]['hometext']);
        $notes = unserialize($news_tab[$story_limit]['notes']);
        $morelink = unserialize($news_tab[$story_limit]['morelink']);
        $topicname = unserialize($news_tab[$story_limit]['topicname']);
        $topicimage = unserialize($news_tab[$story_limit]['topicimage']);
        $topictext = unserialize($news_tab[$story_limit]['topictext']);
        $s_id = unserialize($news_tab[$story_limit]['id']);
        themeindex($aid, $informant, $datetime, $title, $counter, $topic, $hometext, $notes, $morelink, $topicname, $topicimage, $topictext, $s_id);
    }
    $transl1 = translate("Next Page");
    $transl2 = translate("Home");
    global $storyhome, $cookie;
    if (isset($cookie[3])) {
        $storynum = $cookie[3];
    } else {
        $storynum = $storyhome;
    }
    if ($op == "categories") {
        if (sizeof($news_tab) == $storynum) {
            $marqeur = $marqeur + sizeof($news_tab);
            echo "<p align=\"right\"><a href=\"index.php?op={$url}&amp;catid={$catid}&amp;marqeur={$marqeur}\" class=\"page_suivante\" title=\"{$transl1}\">{$transl1}</a></p>";
        } else {
            if ($marqeur >= $storynum) {
                echo "<p align=\"right\"><a href=\"index.php?op={$url}&amp;catid={$catid}&amp;marqeur=0\" class=\"page_suivante\" title=\"{$transl2}\">{$transl2}</a></p>";
            }
        }
    }
    if ($op == "news") {
        if (sizeof($news_tab) == $storynum) {
            $marqeur = $marqeur + sizeof($news_tab);
            echo "<p align=\"right\"><a href=\"index.php?op={$url}&amp;catid={$catid}&amp;marqeur={$marqeur}\" class=\"page_suivante\" title=\"{$transl1}\">{$transl1}</a></p>";
        } else {
            if ($marqeur >= $storynum) {
                echo "<p align=\"right\"><a href=\"index.php?op={$url}&amp;catid={$catid}&amp;marqeur=0\" class=\"page_suivante\" title=\"{$transl2}\">{$transl2}</a></p>";
            }
        }
    }
    if ($op == "topics") {
        if (sizeof($news_tab) == $storynum) {
            $marqeur = $marqeur + sizeof($news_tab);
            echo "<p align=\"right\"><a href=\"index.php?op=newtopic&amp;topic={$catid}&amp;marqeur={$marqeur}\" class=\"page_suivante\" title=\"{$transl1}\">{$transl1}</a></p>";
        } else {
            if ($marqeur >= $storynum) {
                echo "<p align=\"right\"><a href=\"index.php?op=newtopic&amp;topic={$catid}&amp;marqeur=0\" class=\"page_suivante\" title=\"{$transl2}\">{$transl2}</a></p>";
            }
        }
    }
}