|
|
<?
/*
HPE - News Portal Engine
Copyright (C) 2000-2001 Mike Krus
This program is free software; it is distributed in the hope
that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
READ LICENSE.TXT IN THE BASE DIRECTORY FOR INFORMATION
ABOUT REDISTRIBUTING THIS SOURCE CODE
*/
require_once "HPE/HPE.inc";
$HPEtheNEWSmodule = $HPEtheConfig->modhandlers[0]["control"];
$HPEtheNEWSmodule->parser->forcecache = 1;
$HPEcats = new HPECatInfo;
if(!isset($HPEtheConfig->uriarray[1])) die("must provide source id");
else $source = $HPEtheConfig->uriarray[1];
$HPEtheNEWSmodule->parser->read($source);
if($HPEtheNEWSmodule->parser->id == 0) {
$HPEthePager->beginpage($HPEstrings["newsinfo_title"]);
echo $HPEtheThemeMaker->TPLSectionBegin($HPEstrings["newsinfo_boxtitle"]);
echo "<H1 align=center>This source does not exist</H1>\n";
echo $HPEtheThemeMaker->TPLSectionEnd();
$HPEthePager->endpage();
die("");
}
if(!isset($first)) $first = 0;
$newrating = 0;
$message = "";
if(isset($ACTION)) {
if($ACTION == "vote") {
$HPEtheNEWSmodule->parser->uvote($voteID);
} else if($ACTION == "broken") {
if($HPEtheUser->userid) $header = "From: $HPEtheUser->name <$HPEtheUser->email>";
else $header = "From: $HPEtheConfig->adminname <$HPEtheConfig->adminemail>";
mail($HPEtheConfig->adminemail, "Broken source $source", "$header\n\nSource $source is broken\n" .
$HPEtheConfig->siteurl . "newsinfo.php?source=$source\n\n", $header);
$message = $HPEstrings["newsinfo_brokenthanks"];
} else if($ACTION == "edit" && isset($onpage)) {
if(!isset($maxitems)) $maxitems = 0;
if($HPEtheUser->pagetypes[$onpage] != 0) $message = $HPEstrings["en_wrongpagetype"];
else {
$maxitems = (int) $maxitems;
if($maxitems < 0) $maxitems = 0;
$file = $HPEtheConfig->siteroot . "editpage.php?EDITPAGE=$onpage&OP=EDITMOD&MOD=$module&" .
"PARAM=$nid,$maxitems";
if(isset($done)) $file .= "&done=" . urlencode($done);
else $file .= "&done=" . urlencode($HPEtheConfig->pagehandlers[$HPEtheUser->pagetypes[$onpage]]["url"] . "?page=$onpage");
header("Location: $file");
exit;
}
}
}
$HPEthePager->beginpage($HPEstrings["newsinfo_title"]);
?>
<script LANGUAGE="JavaScript"> <!--
function addNetscapePanel() {
if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) {
window.sidebar.addPanel ("<? echo $HPEtheNEWSmodule->parser->name ?>", "<? echo $HPEtheConfig->siteurl ?>mozilla.php3?_w=s&_i=<? echo $HPEtheNEWSmodule->parser->id?>","");
} else {
var rv = window.confirm ("This page is enhanced for use with Netscape 6. " + "Would you like to upgrade now?");
if (rv) document.location.href = "http://home.netscape.com";
}
}
//--> </script>
<DIV align=center>
<?
echo $HPEtheThemeMaker->TPLSectionBegin($HPEstrings["newsinfo_boxtitle"]);
if($message != "")
echo "<P align=center><font color=red size=+1>$message</font></P><HR size=1 noshade>\n\n";
echo "<table width=\"100%\" cellspacing=10><TR valign=top><TD width=\"70%\">\n\n";
if($HPEtheNEWSmodule->parser->icon != "")
echo "<A HREF=\"$HPEtheNEWSmodule->parser->url\"><IMG align=right " .
"SRC=\"$HPEtheNEWSmodule->parser->icon\" hspace=10 vspace=5 " .
"alt=\"$HPEtheNEWSmodule->parser->name\" border=0></A>\n";
echo "<big><B><A HREF=\"" . $HPEtheNEWSmodule->parser->url . "\">" . $HPEtheNEWSmodule->parser->name .
"</A></b></big>\n";
echo "<a href=\"" . $HPEtheConfig->siteroot . "export.php3?_f=rss91&_w=f&_i=" .
$HPEtheNEWSmodule->parser->id . "\"><img src=\"" . $HPEtheConfig->siteroot . "HPE/Images/xml.gif\" " .
"alt=\"RSS .91\" border=0 hspace=10 width=36 height=14></a>\n";
if($HPEtheNEWSmodule->parser->description != "")
echo "<br><small>" . $HPEtheNEWSmodule->parser->description . "</small>\n\n";
echo "<P>\n" . $HPEstrings["newsinfo_incat"] . ": ";
if($HPEtheConfig->storenewsindb)
echo "<a href=\"newsnav.php3?cat=" . $HPEtheNEWSmodule->parser->categorie . "\">";
else echo "<a href=\"sitesbycat.php3?NEWSCAT=" . $HPEtheNEWSmodule->parser->categorie . "\">";
echo "<em>" . $HPEcats->catsbyid[$HPEtheNEWSmodule->parser->categorie]["name"] . "</em></a><BR>\n";
echo "<B>" . $HPEstrings["newsinfo_urating"] . ": <IMG SRC=\"" . $HPEtheConfig->siteroot .
"HPE/Images/etoile_" . $HPEtheNEWSmodule->parser->urating . ".gif\" ALT=\"User Rating\" width=65 " .
"height=13></B>";
if($HPEtheNEWSmodule->parser->uratingvotes)
echo " <small>(" . $HPEtheNEWSmodule->parser->uratingvotes . " " . $HPEstrings["newsinfo_votes"] .
")</small>\n";
else echo " <em>This site has not been rated yet!</em>\n";
echo "</P>\n<BR clear=right>\n";
echo $HPEtheThemeMaker->TPLFrameBegin();
if($HPEtheUser->userid) {
echo "\n<table width=100% border=0>\n";
if(isset($onpage) && isset($module)) {
if(!isset($nid)) {
$file = $HPEthePager->makePagePath("base");
include $file;
$cl = "HPE" . $HPEtheConfig->pagehandlers[$HPEtheUser->pagetypes[$onpage]]["base"] . "Pager";
$HPEthePageHandler = new $cl($onpage);
$HPEthePageHandler->parse();
$HPEthePageHandler->getModuleInfo($module, $modtype, $modparam);
$pl = split(",", $modparam);
$nid = $pl[0];
$maxitems = $pl[1];
}
echo "<tr><form action=\"$HPEtheConfig->uri\" method=\"POST\">\n";
echo "<input type=hidden name=\"ACTION\" value=\"edit\">\n";
echo "<input type=hidden name=\"nid\" value=\"$nid\">\n";
echo "<input type=hidden name=\"onpage\" value=\"$onpage\">\n";
echo "<input type=hidden name=\"module\" value=\"$module\">\n\n";
if(isset($done)) echo "<input type=hidden name=\"done\" value=\"$done\">\n\n";
echo "<th align=right>" . $HPEstrings["en_maxitems"] . "</th><td><input type=text name=\"maxitems\" size=3 maxlength=3 value=\"$maxitems\"> <input type=submit value=\"" . $HPEstrings["en_submit"] . "\"></td></tr>\n";
echo "<tr><td colspan=2><small>" . $HPEstrings["en_maxitemsexplain"] . "</small></td></tr>\n";
echo "<tr><td colspan=2><hr size=1 noshade></td></form></tr>\n\n";
}
echo "<tr><form action=\"" . $HPEtheConfig->uri . "\" method=\"POST\">\n";
echo "<input type=hidden name=\"ACTION\" value=\"vote\">\n";
echo "<input type=hidden name=\"first\" value=\"$first\">\n";
if(isset($onpage) && isset($module)) {
echo "<input type=hidden name=\"onpage\" value=\"$onpage\">\n";
echo "<input type=hidden name=\"module\" value=\"$module\">\n\n";
}
echo "<th align=right>" . $HPEstrings["newsinfo_votebooth"] . "</th><td><SELECT name=\"voteID\">\n";
for($i=1; $i<6; $i++) echo "<OPTION value=$i>$i\n";
echo "</SELECT> <input type=submit value=\"" . $HPEstrings["newsinfo_ratethis"].
"\"></td></form></tr>\n";
echo "</table>\n\n";
echo "<HR noshade size=1>\n\n";
echo "<table width=100% border=0 cellspacing=5><TR valign=center>\n";
echo "<tr><form action=addnews.php3 method=post><TD align=left><input type=hidden name=\"source\" " .
"value=\"$source\"><input type=submit value=\"" . $HPEstrings["newsinfo_add2page"] . "\"></TD>\n";
echo "<TD><font size=1>" . $HPEstrings["newsinfo_add2pageabout"] . "</font></TD></form></tr></table>\n";
echo "<HR noshade size=1>\n\n";
}
echo "<table width=100% border=0><TR valign=center>\n";
echo "<td align=center><a href=\"javascript:addNetscapePanel()\"><img src=\"" . $HPEtheConfig->siteroot .
"HPE/Images/add-button.gif\" width=100 height=45 border=0 ALT=\"Add To Netscape 6 Sidebar\"></a>" .
"</TD>\n";
echo "<td align=center><a href=\"export.php3?id=" . $HPEtheNEWSmodule->parser->id . "&what=f\"><img " .
"src=\"" . $HPEtheConfig->siteroot . "HPE/Images/hpeexport.gif\" width=100 height=45 border=0 " .
"ALT=\"Export to your site\"></a></td>\n";
if($HPEtheUser->isadmin && 0) {
$url = $HPEtheConfig->siteurl . "export.php3?_f=rss91&_w=f&_i=" . $HPEtheNEWSmodule->parser->id;
echo "<td align=center><a href=\"http://127.0.0.1/userLand/viewSubscriptions.wsf?url=" .
urlencode($url) . "&subscribe=Add\">Add to RU</A></td>\n";
}
echo "<td align=center><a href=\"" . $HPEtheConfig->siteroot . "wap.php3?_w=s&_i=" .
$HPEtheNEWSmodule->parser->id . "\"><img src=\"" . $HPEtheConfig->siteroot .
"HPE/Images/hpewap.gif\" width=100 height=45 border=0 ALT=\"Read via WAP\"></a></A></td>\n";
echo "</tr></table>\n";
echo $HPEtheThemeMaker->TPLFrameEnd();
if($HPEtheNEWSmodule->parser->editor) {
$ecfp = $HPEinc . "/$HPEtheConfig->cachepath/$HPEtheDB->dbtnewspublisher/$HPEtheDB->dbtnewspublisher." .
$HPEtheNEWSmodule->parser->editor . ".txt";
$data = "";
if(file_exists($ecfp) && (time() - filemtime($ecfp)) < 3600) {
$ecf = fopen($ecfp, "r");
if($ecf) {
$data = fread($ecf, filesize($ecfp));
fclose($ecf);
$data = unserialize($data);
}
}
if($data == "") {
$row = $HPEtheDB->one_array("SELECT * FROM $HPEtheDB->dbtnewspublisher WHERE pubid=" .
$HPEtheNEWSmodule->parser->editor);
if($row) {
$data = array();
$data["pubid"] = $HPEtheNEWSmodule->parser->editor;
$data["puburl"] = $row["url"];
$data["pubicon"] = $row["icon"];
$data["pubname"] = $row["name"];
$result = $HPEtheDB->query("SELECT siteid, sitename, description, categorie FROM " .
$HPEtheDB->dbtnewssites . " WHERE editor=" .
$HPEtheNEWSmodule->parser->editor .
" ORDER BY sitename;");
$n = 0;
if(!$HPEtheDB->iserror($result) && $HPEtheDB->getrowcount($result))
{
$data["sources"] = array();
while($row = $HPEtheDB->getrow($result))
{
$data["sources"][$n]["id"] = $row["siteid"];
$data["sources"][$n]["name"] = $row["sitename"];
$data["sources"][$n]["desc"] = $row["description"];
$data["sources"][$n]["cat"] = $row["categorie"];
$n++;
}
}
$data["nsrc"] = $n;
$ecf = fopen($ecfp, "w");
if($ecf) {
$wdata = serialize($data);
fwrite($ecf, $wdata, strlen($wdata));
fclose($ecf);
}
} else echo "$HPEtheDB->dberr\n\n";
}
echo $HPEstrings["newsinfo_bypub"] . " <b><a href=\"" . $data["puburl"] . "\">" .
$data["pubname"] . "</A></b>\n\n";
$m = min($first+30, $data["nsrc"]);
if($m) {
echo "<UL>\n";
for($i=$first; $i<$m; $i++) {
echo "<li><a href=\"" . $HPEtheConfig->siteroot . "sources/info/" . $data["sources"][$i]["id"] .
"\"><b>" . $data["sources"][$i]["name"] . "</b></A> \n";
echo "<small>[<em>In <a href=\"$HPEtheConfig->siteroot";
if($HPEtheConfig->storenewsindb)
echo "newsnav.php3?cat=" . $data["sources"][$i]["cat"] . "\">";
else echo "sitesbycat.php3?NEWSCAT=" . $data["sources"][$i]["cat"] . "\">";
echo $HPEcats->catsbyid[$data["sources"][$i]["cat"]]["name"] . "</a></em>]</small>\n";
if($data["sources"][$i]["desc"] != "")
echo "<BR><small>" . $data["sources"][$i]["desc"] . "</small>\n";
}
echo "</UL>\n";
}
if($first) {
$nfirst = $first - 30;
if($nfirst < 0) $nfirst = 0;
echo "<A HREF=\"" . $HPEtheConfig->uri . "?first=$nfirst\">" .
$HPEstrings["newsinfo_previous"] . "</A>";
if($i < $data["nsrc"]) echo " | ";
}
if($i < $data["nsrc"])
echo "<A HREF=\"" . $HPEtheConfig->uri . "?first=" . ($first+30) . "\">" .
$HPEstrings["newsinfo_next"] . "</A>";
if($data["pubicon"] != "")
echo "<center><A HREF=\"" . $data["puburl"] . "\"><IMG SRC=\"" . $data["pubicon"] .
"\" hspace=10 vspace=5 alt=\"Editor Logo\" border=0></A></center>\n";
}
echo "</TD><TD width=\"30%\">\n";
echo $HPEtheNEWSmodule->showNews($source) . "\n";
echo "</TD></TR></table>\n";
echo "<table width=100% border=0><TR valign=top>\n";
echo "<HR noshade size=1>\n";
if($HPEtheConfig->hasemail) $action = $HPEtheConfig->uri;
else $action = "mailto:$HPEtheConfig->adminemail?subject=Broken+source+$source";
echo "<form action=\"$action\" method=post><input type=hidden name=\"ACTION\" value=\"broken\">";
echo "<TD align=center width=50%><input type=submit value=\"" . $HPEstrings["newsinfo_broken"] . "\">";
echo "<br><small>" . $HPEstrings["newsinfo_brokenabout"] . "</small></p></TD></form>\n";
if($data["pubid"]) {
echo "<TD align=center width=50%><small><A HREF=export.php?what=p&id=" . $data["pubid"] . ">" .
"<img src=\"" . $HPEtheConfig->siteroot . "HPE/Images/hpeexport.gif\" width=100 height=45 " .
"border=0 ALT=\"Export to your site\"></A>" .
"<BR>Export all items for this publisher</small></TD>\n";
}
echo "</TR></TABLE><BR>\n";
echo $HPEtheThemeMaker->TPLSectionEnd();
?>
</DIV>
</form>
<? $HPEthePager->endpage() ?>
|