<?php
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program 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. See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); }
$hlpfile = "manual/downloads.html";
$ModName = $module;
modules_get_language();
if (authorised(0, "Downloads::", "::", ACCESS_ADMIN)) {
//
// Downloads Modified Web Downloads
//
function downloads() {
global $hlpfile, $pntable, $dbconn;
include ("header.php");
GraphicAdmin($hlpfile);
OpenTable();
if (!authorised(0, 'Downloads::', '::', ACCESS_EDIT)) {
echo _DOWNLOADSACCESSNOAUTH;
include 'footer.php';
return;
}
echo "<center><font class=\"pn-logo\">"._DLOADPAGETITLE."</font><br><br>";
$result=$dbconn->Execute("SELECT count(*) FROM $pntable[downloads_downloads]");
list($numrows) = $result->fields;
echo "<font class=\"pn-normal\">"._THEREARE." <b>$numrows</b> "._DOWNLOADSINDB."</font></center>";
CloseTable();
echo "<br>";
/* Temporarily 'homeless' downloads functions (to be revised in admin.php breakup ) */
$result = $dbconn->Execute("SELECT count(*)
FROM ".$pntable['downloads_modrequest'].
" WHERE ".$pntable['downloads_modrequest_column']['brokendownload']."=1");
list($totalbrokendownloads) = $result->fields;
$result = $dbconn->Execute("SELECT count(*)
FROM ".$pntable['downloads_modrequest'].
" WHERE ".$pntable['downloads_modrequest_column']['brokendownload']."=0");
list($totalmodrequests) = $result->fields;
/* List Downloads waiting for validation */
$column = &$pntable['downloads_newdownload_column'];
$result = $dbconn->Execute("SELECT $column[lid], $column[cid], $column[sid],
$column[title], $column[url], $column[description],
$column[name], $column[email], $column[submitter],
$column[filesize], $column[version], $column[homepage]
FROM $pntable[downloads_newdownload]
ORDER BY $column[lid]");
// FTO Check EOF and databse error
if (!$result) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
if (!$result->EOF) {
OpenTable();
echo "<center><font class=\"pn-title\"><b>"._DOWNLOADSWAITINGVAL."</b></font></center><br><br>";
while(!$result->EOF) {
list($lid, $cid, $sid, $title, $url, $description, $name, $email, $submitter, $filesize, $version, $homepage) = $result->fields;
$result->MoveNext();
if ($submitter == "") {
$submitter = _NONE;
}
$homepage = ereg_replace("http://","",$homepage);
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"; // changed layout into a table
echo " <tr><td colspan=\"4\"><form action=\"admin.php\" method=\"post\">"
."<b>"._DOWNLOADID.": $lid</b><br><br></td></tr>"
."\n<tr><td colspan=\"4\">"._SUBMITTER.": <b>$submitter</b></td></tr>"
."\n<tr><td colspan=\"4\">"._DOWNLOADNAME.": <input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"></td></tr>"
."\n<tr><td colspan=\"4\">"._FILEURL.": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\"> [ <a target=\"_blank\" href=\"$url\">"._CHECK."</a> ]</td></tr>"
."\n<tr><td colspan=\"4\">"._DESCRIPTION.": <br><textarea name=\"description\" cols=\"60\" rows=\"10\">$description</textarea></td></tr>"
."\n<tr><td colspan=\"4\">"._AUTHORNAME.": <input type=\"text\" name=\"name\" size=\"20\" maxlength=\"100\" value=\"$name\"> "
.""._AUTHOREMAIL.": <input type=\"text\" name=\"email\" size=\"20\" maxlength=\"100\" value=\"$email\"></td></tr>"
."\n<tr><td colspan=\"4\">"._FILESIZE.": <input type=\"text\" name=\"filesize\" size=\"12\" maxlength=\"11\" value=\"$filesize\"></td></tr>"
."\n<tr><td colspan=\"4\">"._VERSION.": <input type=\"text\" name=\"version\" size=\"11\" maxlength=\"10\" value=\"$version\"></td></tr>"
."\n<tr><td colspan=\"4\">"._HOMEPAGE.": <input type=\"text\" name=\"homepage\" size=\"30\" maxlength=\"200\" value=\"http://$homepage\"> [ <a =\"http://$homepage\">"._VISIT."</a> ]</td></tr>";
$column = &$pntable['downloads_categories_column'];
$result2=$dbconn->Execute("SELECT $column[cid], $column[title]
FROM $pntable[downloads_categories]
ORDER BY $column[title]");
echo "<tr><td valign=\"top\"><input type=\"hidden\" name=\"new\" value=\"1\">"
."\n<input type=\"hidden\" name=\"hits\" value=\"0\">"
."\n<input type=\"hidden\" name=\"lid\" value=\"$lid\">"
."\n<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">"
."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
._CATEGORY.": <select name=\"cat\">";
// FTO Check EOF and databse error
if (!$result2) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result2->EOF) {
list($ccid, $ctitle) = $result2->fields;
$sel = "";
if ($cid==$ccid AND $sid==0) {
$sel = "selected";
}
echo "<option value=\"$ccid\" $sel>$ctitle</option>";
$column = &$pntable['downloads_subcategories_column'];
$result3=$dbconn->Execute("SELECT $column[sid], $column[title]
FROM $pntable[downloads_subcategories]
WHERE $column[cid]=$ccid ORDER BY $column[title]");
// FTO Check EOF and databse error
if (!$result3) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result3->EOF) {
list($ssid, $stitle) = $result3->fields;
$sel = "";
if ($sid == $ssid) {
$sel = "selected";
}
echo "<option value=\"$ccid-$ssid\" $sel>$ctitle / $stitle</option>";
$result3->MoveNext();
}
$result2->MoveNext();
}
echo "</select></td><td><input type=\"hidden\" name=\"submitter\" value=\"$submitter\">";
echo "<input type=\"hidden\" name=\"op\" value=\"DownloadsAddDownload\">"
."\n<input type=\"submit\" value="._ADD."> </form></td><td>"
."\n<form action=\"admin.php\" method=\"post\">"
."\n<input type=\"hidden\" name=\"op\" value=\"DownloadsDelNew\">"
."\n<input type=\"hidden\" name=\"lid\" value=\"$lid\">"
."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."\n<input type=\"submit\" value=\""._DELETE."\"></form></td>"
."\n<td width=\"10%\"> </td></tr></table><hr noshade><br>\n\n";
}
CloseTable();
echo "<br>";
}
/* Add a New Main Category */
OpenTable();
echo "<center><font class=\"pn-normal\">[ <a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsCleanVotes\">"._CLEANDOWNLOADSDB."</a> | "
."<a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsListBrokenDownloads\">"._BROKENDOWNLOADSREP." ($totalbrokendownloads)</a> | "
."<a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsListModRequests\">"._DOWNLOADMODREQUEST." ($totalmodrequests)</a> | "
."<a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsDownloadCheck\">"._VALIDATEDOWNLOADS."</a> ]</font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<form method=\"post\" action=\"admin.php\">"
."<font class=\"pn-title\"><b>"._ADDMAINCATEGORY."</b></font><br><br>"
.""._NAME.": <input type=\"text\" name=\"title\" size=\"30\" maxlength=\"100\"><br>"
.""._DESCRIPTION.":<br><textarea name=\"cdescription\" cols=\"60\" rows=\"10\"></textarea><br>"
."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."<input type=\"hidden\" name=\"op\" value=\"DownloadsAddCat\">"
."<input type=\"submit\" value=\""._ADD."\"><br>"
."</form>";
CloseTable();
echo "<br>";
// Add a New Sub-Category
$column = &$pntable['downloads_categories_column'];
$result=$dbconn->Execute("SELECT $column[cid], $column[title]
FROM $pntable[downloads_categories]
ORDER BY $column[title]");
if (!$result->EOF) {
OpenTable();
echo "<form method=\"post\" action=\"admin.php\">"
."<font class=\"pn-title\"><b>"._ADDSUBCATEGORY."</b></font><br><br>"
.""._NAME.": <input type=\"text\" name=\"title\" size=\"30\" maxlength=\"100\"> "._IN." ";
echo "<select name=\"cid\">";
// FTO Check EOF and databse error
if (!$result) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result->EOF) {
list($ccid, $ctitle) = $result->fields;
echo "<option value=\"$ccid\">$ctitle</option>";
$result->MoveNext();
}
echo "</select>"
."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."<input type=\"hidden\" name=\"op\" value=\"DownloadsAddSubCat\">"
."<input type=\"submit\" value=\""._ADD."\"><br>"
."</form>";
CloseTable();
echo "<br>";
}
// Add a New Download to Database
/*
* Hootbah: XXX FIXME XXX
* This seems a little odd. Why do the same query again.
*/
$column = &$pntable['downloads_categories_column'];
$result = $dbconn->Execute("SELECT $column[cid], $column[title]
FROM $pntable[downloads_categories]
ORDER BY $column[title]");
if (!$result->EOF) {
OpenTable();
echo "<form method=\"post\" action=\"admin.php\">"
."<font class=\"pn-title\"><b>"._ADDNEWDOWNLOAD."</b></font><br><br>"
.""._DOWNLOADNAME.": <input type=\"text\" name=\"title\" size=\"50\" maxlength=\"100\"><br>"
.""._FILEURL.": <input type=\"text\" name=\"url\" size=\"50\" maxlength=\"100\" value=\"http://\"><br>";
echo ""._CATEGORY.": <select name=\"cat\">";
// FTO Check EOF and databse error
if (!$result) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result->EOF) {
list($cid, $title) = $result->fields;
echo "<option value=\"$cid\">$title</option>";
$column = &$pntable['downloads_subcategories_column'];
$result2=$dbconn->Execute("SELECT $column[sid], $column[title]
FROM $pntable[downloads_subcategories]
WHERE $column[cid]=$cid ORDER BY $column[title]");
// FTO Check EOF and databse error
if (!$result2) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result2->EOF) {
list($sid, $stitle) = $result2->fields;
echo "<option value=\"$cid-$sid\">$title / $stitle</option>";
$result2->MoveNext();
}
$result->MoveNext();
}
echo "</select><br><br><br>"
.""._DESCRIPTION255."<br><textarea name=\"description\" cols=\"60\" rows=\"5\"></textarea><br><br><br>"
.""._AUTHORNAME.": <input type=\"text\" name=\"name\" size=\"30\" maxlength=\"60\"><br><br>"
.""._AUTHOREMAIL.": <input type=\"text\" name=\"email\" size=\"30\" maxlength=\"60\"><br><br>"
.""._FILESIZE.": <input type=\"text\" name=\"filesize\" size=\"12\" maxlength=\"11\"> ("._INBYTES.")<br><br>"
.""._VERSION.": <input type=\"text\" name=\"version\" size=\"11\" maxlength=\"10\"><br><br>"
.""._HOMEPAGE.": <input type=\"text\" name=\"homepage\" size=\"30\" maxlength=\"200\" value=\"http://\"><br><br>"
.""._HITS.": <input type=\"text\" name=\"hits\" size=\"12\" maxlength=\"11\" value=\"0\"><br><br>"
."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."<input type=\"hidden\" name=\"op\" value=\"DownloadsAddDownload\">"
."<input type=\"hidden\" name=\"new\" value=\"0\">"
."<input type=\"hidden\" name=\"lid\" value=\"0\">"
."<center><input type=\"submit\" value=\""._ADDURL."\"><br>"
."</form>";
CloseTable();
echo "<br>";
}
// Modify Category
$column = &$pntable['downloads_categories_column'];
$result=$dbconn->Execute("SELECT $column[cid], $column[title]
FROM $pntable[downloads_categories]
ORDER BY $column[title]");
if (!$result->EOF) {
OpenTable();
echo "<form method=\"post\" action=\"admin.php\">"
."<font class=\"pn-title\"><b>"._MODCATEGORY."</b></font><br><br>";
echo ""._CATEGORY.": <select name=\"cat\">";
// FTO Check EOF and databse error
if (!$result) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result->EOF) {
list($cid, $title) = $result->fields;
echo "<option value=\"$cid\">$title</option>";
$column = &$pntable['downloads_subcategories_column'];
$result2=$dbconn->Execute("SELECT $column[sid], $column[title]
FROM $pntable[downloads_subcategories]
WHERE $column[cid]=$cid ORDER BY $column[title]");
// FTO Check EOF and databse error
if (!$result2) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result2->EOF) {
list($sid, $stitle) = $result2->fields;
echo "<option value=\"$cid-$sid\">$title / $stitle</option>";
$result2->MoveNext();
}
$result->MoveNext();
}
echo "</select>"
."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."<input type=\"hidden\" name=\"op\" value=\"DownloadsModCat\">"
."<input type=\"submit\" value=\""._MODIFY."\">"
."</form>";
CloseTable();
echo "<br>";
}
// Modify Downloads
$result = $dbconn->Execute("SELECT COUNT(*) FROM $pntable[downloads_downloads]");
list($numrows) = $result->fields;
if ($numrows>0) {
OpenTable();
echo "<form method=\"post\" action=\"admin.php\">"
."<font class=\"pn-title\"><b>"._MODDOWNLOAD."</b></font><br><br>"
.""._DOWNLOADID.": <input type=\"text\" name=\"lid\" size=\"12\" maxlength=\"11\"> "
."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."<input type=\"hidden\" name=\"op\" value=\"DownloadsModDownload\">"
."<input type=\"submit\" value=\""._MODIFY."\">"
."</form>";
CloseTable();
echo "<br>";
}
include ("footer.php");
}
function DownloadsModDownload($lid) {
global $pntable, $dbconn, $hlpfile;
include ("header.php");
GraphicAdmin($hlpfile);
global $anonymous;
$column = &$pntable['downloads_downloads_column'];
$result = $dbconn->Execute("SELECT $column[cid], $column[sid], $column[title],
$column[url], $column[description], $column[name],
$column[email], $column[hits], $column[filesize],
$column[version], $column[homepage]
FROM $pntable[downloads_downloads]
WHERE $column[lid]=$lid");
OpenTable();
echo "<center><font class=\"pn-title\"><b>"._WEBDOWNLOADSADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"pn-title\"><b>"._MODDOWNLOAD."</b></font></center><br><br>";
// FTO Check EOF and databse error
if (!$result) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result->EOF) {
list($cid, $sid, $title, $url, $description, $name, $email, $hits, $filesize, $version, $homepage) = $result->fields;
$result->MoveNext();
$title = stripslashes($title); $description = stripslashes($description);
$homepage = ereg_replace("http://","",$homepage);
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"; // changed layout into a table
echo " <tr><td colspan=\"4\"><form action=\"admin.php\" method=\"post\">"
."<b>"._DOWNLOADID.": $lid</b><br><br></td></tr>"
."\n<tr><td colspan=\"4\">"._DOWNLOADNAME.": <input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"></td></tr>"
."\n<tr><td colspan=\"4\">"._FILEURL.": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\"> [ <a target=\"_blank\" href=\"$url\">"._CHECK."</a> ]</td></tr>"
."\n<tr><td colspan=\"4\">"._DESCRIPTION.": <br><textarea name=\"description\" cols=\"60\" rows=\"10\">$description</textarea></td></tr>"
."\n<tr><td colspan=\"4\">"._AUTHORNAME.": <input type=\"text\" name=\"name\" size=\"20\" maxlength=\"100\" value=\"$name\"> "
.""._AUTHOREMAIL.": <input type=\"text\" name=\"email\" size=\"20\" maxlength=\"100\" value=\"$email\"></td></tr>"
."\n<tr><td colspan=\"4\">"._FILESIZE.": <input type=\"text\" name=\"filesize\" size=\"12\" maxlength=\"11\" value=\"$filesize\"></td></tr>"
."\n<tr><td colspan=\"4\">"._VERSION.": <input type=\"text\" name=\"version\" size=\"11\" maxlength=\"10\" value=\"$version\"></td></tr>"
."\n<tr><td colspan=\"4\">"._HOMEPAGE.": <input type=\"text\" name=\"homepage\" size=\"30\" maxlength=\"200\" value=\"http://$homepage\"> [ <a href=\"http://$homepage\">"._VISIT."</a> ]</td></tr>"
."\n<tr><td colspan=\"4\">"._HITS.": <input type=\"text\" name=\"hits\" value=\"$hits\" size=\"12\" maxlength=\"11\"></td></tr>";
$column = &$pntable['downloads_categories_column'];
$result2=$dbconn->Execute("SELECT $column[cid], $column[title]
FROM $pntable[downloads_categories]
ORDER BY $column[title]");
echo "<tr><td valign=\"top\"><input type=\"hidden\" name=\"lid\" value=\"$lid\">"
.""._CATEGORY.": <select name=\"cat\">";
// FTO Check EOF and databse error
if (!$result2) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result2->EOF) {
list($ccid, $ctitle) = $result2->fields;
$sel = "";
if ($cid==$ccid AND $sid==0) {
$sel = "selected";
}
echo "<option value=\"$ccid\" $sel>$ctitle</option>";
$column = &$pntable['downloads_subcategories_column'];
$result3=$dbconn->Execute("SELECT $column[sid], $column[title]
FROM $pntable[downloads_subcategories]
WHERE $column[cid]=$ccid ORDER BY $column[title]");
// FTO Check EOF and databse error
if (!$result3) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result3->EOF) {
list($ssid, $stitle) = $result3->fields;
$sel = "";
if ($sid==$ssid) {
$sel = "selected";
}
echo "<option value=\"$ccid-$ssid\" $sel>$ctitle / $stitle</option>";
$result3->MoveNext();
}
$result2->MoveNext();
}
echo "</select></td><td> "
."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."<input type=\"hidden\" name=\"op\" value=\"DownloadsModDownloadS\">"
."\n<input type=\"submit\" value="._MODIFY."> </form></td><td>"
."\n<form action=\"admin.php\" method=\"post\">"
."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."\n<input type=\"hidden\" name=\"op\" value=\"DownloadsDelDownload\">"
."\n<input type=\"hidden\" name=\"lid\" value=\"$lid\">"
."\n<input type=\"submit\" value=\""._DELETE."\"></form></td>"
."\n<td width=\"10%\"> </td></tr></table>\n\n";
CloseTable();
echo "<br>";
// Modify or Add Editorial
$column = &$pntable['downloads_editorials_column'];
$resulted2 = $dbconn->Execute("SELECT $column[adminid],
$column[editorialtimestamp],
$column[editorialtext],
$column[editorialtitle]
FROM $pntable[downloads_editorials]
WHERE $column[downloadid]=$lid");
OpenTable();
// if returns 'bad query' status 0 (add editorial)
if ($resulted2->EOF) {
echo "<center><font class=\"pn-title\"><b>"._ADDEDITORIAL."</b></font></center><br><br>"
."<form action=\"admin.php\" method=\"post\">"
."<input type=\"hidden\" name=\"downloadid\" value=\"$lid\">"
.""._EDITORIALTITLE.":<br><input type=\"text\" name=\"editorialtitle\" value=\"$editorialtitle\" size=\"50\" maxlength=\"100\"><br>"
.""._EDITORIALTEXT.":<br><textarea name=\"editorialtext\" cols=\"60\" rows=\"10\">$editorialtext</textarea><br>"
."</select>"."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."<input type=\"hidden\" name=\"op\" value=\"DownloadsAddEditorial\"><input type=\"submit\" value=\"Add\">";
} else {
// if returns 'cool' then status 1 (modify editorial)
// FTO Check EOF and databse error
if (!$resulted2) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$resulted2->EOF) {
list($adminid, $editorialtimestamp, $editorialtext, $editorialtitle) = $resulted2->fields;
$editorialtitle = stripslashes($editorialtitle); $editorialtext = stripslashes($editorialtext);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $editorialtimestamp, $editorialtime);
$timestamp = mktime($editorialtime[4],$editorialtime[5],$editorialtime[6],$editorialtime[2],$editorialtime[3],$editorialtime[1]);
$formatted_date = date("F d, Y", $timestamp);
echo "<center><font class=\"pn-title\"><b>Modify Editorial</b></font></center><br><br>"
."<form action=\"admin.php\" method=\"post\">"
.""._AUTHOR.": $adminid<br>"
.""._DATEWRITTEN.": $formatted_date<br><br>"
."<input type=\"hidden\" name=\"downloadid\" value=\"$lid\">"
.""._EDITORIALTITLE.":<br><input type=\"text\" name=\"editorialtitle\" value=\"$editorialtitle\" size=\"50\" maxlength=\"100\"><br>"
.""._EDITORIALTEXT.":<br><textarea name=\"editorialtext\" cols=\"60\" rows=\"10\">$editorialtext</textarea><br>"
."</select>" ."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."<input type=\"hidden\" name=\"op\" value=\"DownloadsModEditorial\"><input type=\"submit\" value=\""._MODIFY."\"> [ <a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsDelEditorial&downloadid=$lid\">"._DELETE."</a> ]";
$resulted2->MoveNext();
}
}
CloseTable();
echo "<br>";
OpenTable();
/* Show Comments */
$column = &$pntable['downloads_votedata_column'];
$result5=$dbconn->Execute("SELECT $column[ratingdbid], $column[ratinguser],
$column[ratingcomments], $column[ratingtimestamp]
FROM $pntable[downloads_votedata]
WHERE $column[ratinglid] = $lid
AND $column[ratingcomments] != ''
ORDER BY $column[ratingtimestamp] DESC");
$totalcomments = $result5->PO_RecordCount();
echo "<table valign=top width=100%>";
echo "<tr><td colspan=7><b>Download Comments (total comments: $totalcomments)</b><br><br></td></tr>";
echo "<tr><td width=20 colspan=1><b>User </b></td><td colspan=5><b>Comment </b></td><td><b><center>Delete</center></b></td><br></tr>";
if ($totalcomments == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Comments<br></font></center></td></tr>";
$x=0;
$colorswitch="dddddd";
// FTO Check EOF and databse error
if (!$result5) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result5->EOF) {
list($ratingdbid, $ratinguser, $ratingcomments, $ratingtimestamp)=$result5->fields;
$ratingcomments = stripslashes($ratingcomments);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $ratingtimestamp, $ratingtime);
$timestamp = mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]);
$formatted_date = date("F d, Y", $timestamp); // time format should be customizable -- besfred
echo "<tr><td valign=top bgcolor=$colorswitch>$ratinguser</td><td valign=top colspan=5 bgcolor=$colorswitch>$ratingcomments</td><td bgcolor=$colorswitch><center><b><a href=admin.php?module=".$GLOBALS['module']."&op=DownloadsDelComment&lid=$lid&rid=$ratingdbid>X</a></b></center></td><br></tr>";
$x++;
if ($colorswitch=="dddddd") $colorswitch="ffffff";
else $colorswitch="dddddd";
$result5->MoveNext();
}
// Show Registered Users Votes
$column = &$pntable['downloads_votedata_column'];
$result5=$dbconn->Execute("SELECT $column[ratingdbid], $column[ratinguser],
$column[rating], $column[ratinghostname],
$column[ratingtimestamp]
FROM $pntable[downloads_votedata]
WHERE $column[ratinglid] = $lid
AND $column[ratinguser] != 'outside'
AND $column[ratinguser] != '$anonymous'
ORDER BY $column[ratingtimestamp] DESC");
$totalvotes = $result5->PO_RecordCount();
echo "<tr><td colspan=7><br><br><b>Registered User Votes (total votes: $totalvotes)</b><br><br></td></tr>";
echo "<tr><td><b>User </b></td><td><b>IP Address </b></td><td><b>Rating </b></td><td><b>User AVG Rating </b></td><td><b>Total Ratings </b></td><td><b>Date </b></td></font></b><td><b><center>Delete</center></b></td><br></tr>";
if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Registered User Votes<br></font></center></td></tr>";
$x=0;
$colorswitch="dddddd";
// FTO Check EOF and databse error
if (!$result5) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result5->EOF) {
list($ratingdbid, $ratinguser, $rating, $ratinghostname, $ratingtimestamp)=$result5->fields;
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $ratingtimestamp, $ratingtime);
$timestamp = mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]);
$formatted_date = date("F d, Y", $timestamp);
//Individual user information
$column = &$pntable['downloads_votedata_column'];
$result2=$dbconn->Execute("SELECT $column[rating]
FROM $pntable[downloads_votedata]
WHERE $column[ratinguser] = '$ratinguser'");
$usertotalcomments = $result2->PO_RecordCount();
$useravgrating = 0;
// FTO Check EOF and databse error
if (!$result2) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result2->EOF) {
list($rating2)=$result2->fields;
$useravgrating = $useravgrating + $rating2;
$result2->MoveNext();
}
$useravgrating = $useravgrating / $usertotalcomments;
$useravgrating = number_format($useravgrating, 1);
echo "<tr><td bgcolor=$colorswitch>$ratinguser</td><td bgcolor=$colorswitch>$ratinghostname</td><td bgcolor=$colorswitch>$rating</td><td bgcolor=$colorswitch>$useravgrating</td><td bgcolor=$colorswitch>$usertotalcomments</td><td bgcolor=$colorswitch>$formatted_date </font></b></td><td bgcolor=$colorswitch><center><b><a href=admin.php?module=".$GLOBALS['module']."&op=DownloadsDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";
$x++;
if ($colorswitch=="dddddd") $colorswitch="ffffff";
else $colorswitch="dddddd";
$result5->MoveNext();
}
// Show Unregistered Users Votes
$column = &$pntable['downloads_votedata_column'];
$result5=$dbconn->Execute("SELECT $column[ratingdbid], $column[rating],
$column[ratinghostname], $column[ratingtimestamp]
FROM $pntable[downloads_votedata]
WHERE $column[ratinglid] = $lid
AND $column[ratinguser] = '$anonymous'
ORDER BY $column[ratingtimestamp] DESC");
$totalvotes = $result5->PO_RecordCount();
echo "<tr><td colspan=7><b><br><br>Unregistered User Votes (total votes: $totalvotes)</b><br><br></td></tr>";
echo "<tr><td colspan=2><b>IP Address </b></td><td colspan=3><b>Rating </b></td><td><b>Date </b></font></td><td><b><center>Delete</center></b></td><br></tr>";
if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Unregistered User Votes<br></font></center></td></tr>";
$x=0;
$colorswitch="dddddd";
// FTO Check EOF and databse error
if (!$result5) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result5->EOF) {
list($ratingdbid, $rating, $ratinghostname, $ratingtimestamp)=$result5->fields;
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $ratingtimestamp, $ratingtime);
$timestamp = mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]);
$formatted_date = date("F d, Y", $timestamp);
echo "<td colspan=2 bgcolor=$colorswitch>$ratinghostname</td><td colspan=3 bgcolor=$colorswitch>$rating</td><td bgcolor=$colorswitch>$formatted_date </font></b></td><td bgcolor=$colorswitch><center><b><a href=admin.php?module=".$GLOBALS['module']."&op=DownloadsDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";
$x++;
if ($colorswitch=="dddddd") $colorswitch="ffffff";
else $colorswitch="dddddd";
$result5->MoveNext();
}
// Show Outside Users Votes
$column = &$pntable['downloads_votedata_column'];
$result5=$dbconn->Execute("SELECT $column[ratingdbid], $column[rating],
$column[ratinghostname], $column[ratingtimestamp]
FROM $pntable[downloads_votedata]
WHERE $column[ratinglid] = $lid
AND $column[ratinguser] = 'outside'
ORDER BY $column[ratingtimestamp] DESC");
$totalvotes = $result5->PO_RecordCount();
echo "<tr><td colspan=7><b><br><br>Outside User Votes (total votes: $totalvotes)</b><br><br></td></tr>";
echo "<tr><td colspan=2><b>IP Address </b></td><td colspan=3><b>Rating </b></td><td><b>Date </b></td></font></b><td><b><center>Delete</center></b></td><br></tr>";
if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Votes from Outside $sitename<br></font></center></td></tr>";
$x=0;
$colorswitch="dddddd";
// FTO Check EOF and databse error
if (!$result5) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result5->EOF) {
list($ratingdbid, $rating, $ratinghostname, $ratingtimestamp)=$result5->fields;
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $ratingtimestamp, $ratingtime);
$timestamp = mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]);
$formatted_date = date("F d, Y", $timestamp);
echo "<tr><td colspan=2 bgcolor=$colorswitch>$ratinghostname</td><td colspan=3 bgcolor=$colorswitch>$rating</td><td bgcolor=$colorswitch>$formatted_date </font></b></td><td bgcolor=$colorswitch><center><b><a href=admin.php?module=".$GLOBALS['module']."&op=DownloadsDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";
$x++;
if ($colorswitch=="dddddd") $colorswitch="ffffff";
else $colorswitch="dddddd";
$result5->MoveNext();
}
echo "<tr><td colspan=6><br></td></tr>";
echo "</table>";
}
echo "</form>";
CloseTable();
echo "<br>";
include ("footer.php");
}
function DownloadsDelComment($lid, $rid) {
global $pntable, $dbconn;
csrfcheck();
$column = &$pntable['downloads_votedata_column'];
$dbconn->Execute("UPDATE $pntable[downloads_votedata]
SET $column[ratingcomments]=''
WHERE $column[ratingdbid] = $rid");
$dbconn->Execute("UPDATE $pntable[downloads_downloads]
SET $column[totalcomments] = (totalcomments - 1)
WHERE $column[lid] = $lid");
pnRedirect('admin.php?module='.$GLOBALS['module'].'&op=DownloadsModDownload&lid='.$lid);
}
function DownloadsDelVote($lid, $rid) {
global $pntable, $dbconn;
csrfcheck();
$column = &$pntable['downloads_votedata_column'];
$dbconn->Execute("DELETE FROM $pntable[downloads_votedata]
WHERE $column[ratingdbid]=$rid");
$voteresult = $dbconn->Execute("SELECT $column[rating], $column[ratinguser],
$column[ratingcomments]
FROM $pntable[downloads_votedata]
WHERE $column[ratinglid] = $lid");
$totalvotesDB = $voteresult->PO_RecordCount();
include ("voteinclude.php");
$column = &$pntable['downloads_downloads_column'];
$dbconn->Execute("UPDATE $pntable[downloads_downloads]
SET $column[downloadratingsummary]=$finalrating,
$column[totalvotes]=$totalvotesDB,
$column[totalcomments]=$truecomments
WHERE $column[lid] = $lid");
pnRedirect('admin.php?module='.$GLOBALS['module'].'&op=DownloadsModDownload&lid='.$lid);
}
function DownloadsListBrokenDownloads() {
global $bgcolor1, $bgcolor2, $pntable, $dbconn, $hlpfile;
include ("header.php");
GraphicAdmin($hlpfile);
OpenTable();
echo "<center><font class=\"pn-title\"><b>"._WEBDOWNLOADSADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
$column = &$pntable['downloads_modrequest_column'];
$result = $dbconn->Execute("SELECT $column[requestid], $column[lid],
$column[modifysubmitter]
FROM $pntable[downloads_modrequest]
WHERE $column[brokendownload]=1 ORDER BY $column[requestid]");
$totalbrokendownloads = $result->PO_RecordCount();
echo "<center><font class=\"pn-title\"><b>"._DUSERREPBROKEN." ($totalbrokendownloads)</b></font></center><br><br><center>"
.""._DIGNOREINFO."<br>"
.""._DDELETEINFO."</center><br><br><br>"
."<table align=\"center\" width=\"450\">";
if ($totalbrokendownloads==0) {
echo "<center><font class=\"pn-title\">"._DNOREPORTEDBROKEN."</font></center><br><br><br>";
} else {
$colorswitch = $bgcolor2;
echo "<tr>"
."<td><b>"._DOWNLOAD."</b></td>"
."<td><b>"._SUBMITTER."</b></td>"
."<td><b>"._DOWNLOADOWNER."</b></td>"
."<td><b>"._IGNORE."</b></td>"
."<td><b>"._DELETE."</b></td>"
."<td><b>"._EDIT."</b></td>"
."</tr>";
// FTO Check EOF and databse error
if (!$result) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result->EOF) {
list($requestid, $lid, $modifysubmitter)=$result->fields;
$result->MoveNext();
$column = &$pntable['downloads_downloads_column'];
$result2 = $dbconn->Execute("SELECT $column[title], $column[url],
$column[submitter]
FROM $pntable[downloads_downloads]
WHERE $column[lid]=$lid");
if ($modifysubmitter != '$anonymous') {
$column = &$pntable['users_column'];
$result3 = $dbconn->Execute("SELECT $column[email]
FROM $pntable[users]
WHERE $column[uname]='$modifysubmitter'");
list($email)=$result3->fields;
}
list($title, $url, $owner)=$result2->fields;
$column = &$pntable['users_column'];
$result4 = $dbconn->Execute("SELECT $column[email]
FROM $pntable[users]
WHERE $column[uname]='$owner'");
list($owneremail)=$result4->fields;
echo "<tr>"
."<td bgcolor=\"$colorswitch\"><a href=\"$url\">$title</a>"
."</td>";
if ($email=='') {
echo "<td bgcolor=\"$colorswitch\">$modifysubmitter";
} else {
echo "<td bgcolor=\"$colorswitch\"><a href=\"mailto:$email\">$modifysubmitter</a>";
}
echo "</td>";
if ($owneremail=='') {
echo "<td bgcolor=\"$colorswitch\">$owner";
} else {
echo "<td bgcolor=\"$colorswitch\"><a href=\"mailto:$owneremail\">$owner</a>";
}
echo "</td>"
."<td bgcolor=\"$colorswitch\"><center><a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsIgnoreBrokenDownloads&lid=$lid\">X</a></center>"
."</td>"
."<td bgcolor=\"$colorswitch\"><center><a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsDelBrokenDownloads&lid=$lid\">X</a></center>"
."</td>"
."<td bgcolor=\"$colorswitch\"><center><a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsModDownload&lid=$lid\">X</a></center>"
."</td>"
."</tr>";
if ($colorswitch == $bgcolor2) {
$colorswitch = $bgcolor1;
} else {
$colorswitch = $bgcolor2;
}
}
}
echo "</table>";
CloseTable();
include ("footer.php");
}
function DownloadsDelBrokenDownloads($lid) {
global $pntable, $dbconn;
csrfcheck();
$dbconn->Execute("DELETE FROM $pntable[downloads_modrequest]
WHERE {$pntable[downloads_modrequest_column][lid]}=$lid");
$dbconn->Execute("DELETE FROM $pntable[downloads_downloads]
WHERE {$pntable[downloads_downloads_column][lid]}=$lid");
pnRedirect('admin.php?module='.$GLOBALS['module'].'&op=DownloadsListBrokenDownloads');
}
function DownloadsIgnoreBrokenDownloads($lid) {
global $pntable, $dbconn;
$dbconn->Execute("DELETE FROM $pntable[downloads_modrequest]
WHERE {$pntable[downloads_modrequest_column][lid]}=$lid
AND {$pntable[downloads_modrequest_column][brokendownload]}=1");
pnRedirect('admin.php?module='.$GLOBALS['module'].'&op=DownloadsListBrokenDownloads');
}
function DownloadsListModRequests() {
global $bgcolor2, $pntable, $dbconn, $hlpfile;
include ("header.php");
GraphicAdmin($hlpfile);
OpenTable();
echo "<center><font class=\"pn-title\"><b>"._WEBDOWNLOADSADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
$column = &$pntable['downloads_modrequest_column'];
$result = $dbconn->Execute("SELECT $column[requestid], $column[lid], $column[cid],
$column[sid], $column[title], $column[url],
$column[description], $column[modifysubmitter],
$column[name], $column[email], $column[filesize],
$column[version], $column[homepage]
FROM $pntable[downloads_modrequest]
WHERE $column[brokendownload]=0
ORDER BY $column[requestid]");
$totalmodrequests = $result->PO_RecordCount();
echo "<center><font class=\"pn-title\"><b>"._DUSERMODREQUEST." ($totalmodrequests)</b></font></center><br><br><br>";
echo "<table width=\"95%\"><tr><td>";
// FTO Check EOF and databse error
if (!$result) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result->EOF) {
list($requestid, $lid, $cid, $sid, $title, $url, $description, $modifysubmitter, $name, $email, $filesize, $version, $homepage)=$result->fields;
$result->MoveNext();
/*
* Hootbah: XXX FIXME XXX
* There is somthing odd here. Why not just use one or two queries with
* some joins?
*/
$column = &$pntable['downloads_downloads_column'];
$result2 = $dbconn->Execute("SELECT $column[cid], $column[sid], $column[title],
$column[url], $column[description], $column[name],
$column[email], $column[submitter],
$column[filesize], $column[version],
$column[homepage]
FROM $pntable[downloads_downloads]
WHERE $column[lid]=$lid");
list($origcid, $origsid, $origtitle, $origurl, $origdescription, $origname, $origemail, $owner, $origfilesize, $origversion, $orighomepage)=$result2->fields;
$column = &$pntable['downloads_categories_column'];
$result3 = $dbconn->Execute("select $column[title] from $pntable[downloads_categories] where $column[cid]=$cid");
$column = &$pntable['downloads_subcategories_column'];
$result4 = $dbconn->Execute("select $column[title] from $pntable[downloads_subcategories] where $column[cid]=$cid and $column[sid]=$sid");
$column = &$pntable['downloads_categories_column'];
$result5 = $dbconn->Execute("select $column[title] from $pntable[downloads_categories] where $column[cid]=$origcid");
$column = &$pntable['downloads_subcategories_column'];
$result6 = $dbconn->Execute("select $column[title] from $pntable[downloads_subcategories] where $column[cid]=$origcid and $column[sid]=$origsid");
$column = &$pntable['users_column'];
$result7 = $dbconn->Execute("select $column[email] from $pntable[users] where $column[uname]='$modifysubmitter'");
$column = &$pntable['users_column'];
$result8 = $dbconn->Execute("select $column[email] from $pntable[users] where $column[uname]='$owner'");
list($cidtitle)=$result3->fields;
list($sidtitle)=$result4->fields;
list($origcidtitle)=$result5->fields;
list($origsidtitle)=$result6->fields;
list($modifysubmitteremail)=$result7->fields;
list($owneremail)=$result8->fields;
$title = stripslashes($title);
$description = stripslashes($description);
if ($owner=="") {
$owner="administration";
}
if ($origsidtitle=="") {
$origsidtitle= "-----";
}
if ($sidtitle=="") {
$sidtitle= "-----";
}
echo "<table border=\"1\" bordercolor=\"black\" cellpadding=\"5\" cellspacing=\"0\" align=\"center\" width=\"450\">"
."<tr>"
."<td>"
."<table width=\"100%\" bgcolor=\"$bgcolor2\">"
."<tr>"
."<td valign=\"top\" width=\"45%\"><b>"._ORIGINAL."</b></td>"
."<td rowspan=\"10\" valign=\"top\" align=\"left\"><font class=\"pn-sub\"><br>"._DESCRIPTION.":<br>$origdescription</font></td>"
."</tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._TITLE.": $origtitle</td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._URL.": <a href=\"$origurl\">$origurl</a></td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._CATEGORY.": $origcidtitle</td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._SUBCATEGORY.": $origsidtitle</td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._AUTHORNAME.": $origname</td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._AUTHOREMAIL.": $origemail</td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._FILESIZE.": $origfilesize</td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._VERSION.": $origversion</td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._HOMEPAGE.": <a href=\"$orighomepage\" target=\"new\">$orighomepage</a></td></tr>"
."</table>"
."</td>"
."</tr>"
."<tr>"
."<td>"
."<table width=\"100%\">"
."<tr>"
."<td valign=\"top\" width=\"45%\"><b>"._PROPOSED."</b></td>"
."<td rowspan=\"10\" valign=\"top\" align=\"left\"><font class=\"pn-sub\"><br>"._DESCRIPTION.":<br>$description</font></td>"
."</tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._TITLE.": $title</td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._URL.": <a href=\"$url\">$url</a></td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._CATEGORY.": $cidtitle</td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._SUBCATEGORY.": $sidtitle</td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._AUTHORNAME.": $name</td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._AUTHOREMAIL.": $email</td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._FILESIZE.": $filesize</td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._VERSION.": $version</td></tr>"
."<tr><td valign=\"top\" width=\"45%\"><font class=\"pn-sub\">"._HOMEPAGE.": <a href=\"$homepage\" target=\"new\">$homepage</a></td></tr>"
."</table>"
."</td>"
."</tr>"
."</table>"
."<table align=\"center\" width=\"450\">"
."<tr>";
if ($modifysubmitteremail=="") {
echo "<td align=\"left\"><font class=\"pn-sub\">"._SUBMITTER.": $modifysubmitter</font></td>";
} else {
echo "<td align=\"left\"><font class=\"pn-sub\">"._SUBMITTER.": <a href=\"mailto:$modifysubmitteremail\">$modifysubmitter</a></font></td>";
}
if ($owneremail=="") {
echo "<td align=\"center\"><font class=\"pn-sub\">"._OWNER.": $owner</font></td>";
} else {
echo "<td align=\"center\"><font class=\"pn-sub\">"._OWNER.": <a href=\"mailto:$owneremail\">$owner</a></font></td>";
}
echo "<td align=\"right\"><font class=\"pn-sub\">( <a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsChangeModRequests&requestid=$requestid\">"._ACCEPT."</a> / <a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsChangeIgnoreRequests&requestid=$requestid\">"._IGNORE."</a> )</font></td></tr></table><br><br>";
}
if ($totalmodrequests == 0) {
echo "<center>"._NOMODREQUESTS."<br><br>"
.""._GOBACK."<br><br></center>";
}
echo "</td></tr></table>";
CloseTable();
include ("footer.php");
}
function DownloadsChangeModRequests($requestid) {
global $pntable, $dbconn;
csrfcheck();
$column = &$pntable['downloads_modrequest_column'];
$result = $dbconn->Execute("SELECT $column[requestid], $column[lid], $column[cid],
$column[sid], $column[title], $column[url],
$column[description], $column[name], $column[email],
$column[filesize], $column[version], $column[homepage]
FROM $pntable[downloads_modrequest]
WHERE $column[requestid]=$requestid");
// FTO Check EOF and databse error
if (!$result) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result->EOF) {
list($requestid, $lid, $cid, $sid, $title, $url, $description, $name, $email, $filesize, $version, $homepage)=$result->fields;
$title = stripslashes($title);
$description = stripslashes($description);
$column = &$pntable['downloads_downloads_column'];
$dbconn->Execute("UPDATE $pntable[downloads_downloads]
SET $column[cid]=$cid, $column[sid]=$sid,
$column[title]='$title', $column[url]='$url',
$column[description]='$description', $column[name]='$name',
$column[email]='$email', $column[filesize]='$filesize',
$column[version]='$version', $column[homepage]='$homepage'
WHERE $column[lid] = $lid");
$dbconn->Execute("DELETE FROM $pntable[downloads_modrequest]
WHERE {$pntable[downloads_modrequest_column][requestid]}=$requestid");
$result->MoveNext();
}
pnRedirect('admin.php?module='.$GLOBALS['module'].'&op=DownloadsListModRequests');
}
function DownloadsChangeIgnoreRequests($requestid) {
global $pntable, $dbconn;
$dbconn->Execute("DELETE FROM $pntable[downloads_modrequest]
WHERE {$pntable[downloads_modrequest_column][requestid]}=$requestid");
pnRedirect('admin.php?module='.$GLOBALS['module'].'&op=DownloadsListModRequests');
}
function DownloadsCleanVotes() {
global $pntable, $dbconn;
csrfcheck();
$totalvoteresult = $dbconn->Execute("SELECT DISTINCT ".$pntable['downloads_votedata_column']['ratinglid'].
" FROM ".$pntable['downloads_votedata']);
// FTO Check EOF and databse error
if (!$totalvoteresult) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$totalvoteresult->EOF) {
list($lid)=$totalvoteresult->fields;
$column = &$pntable['downloads_votedata_column'];
$voteresult = $dbconn->Execute("SELECT $column[rating], $column[ratinguser],
$column[ratingcomments]
FROM $pntable[downloads_votedata]
WHERE $column[ratinglid] = $lid");
$totalvotesDB = $voteresult->PO_RecordCount();
include ("voteinclude.php");
$column = &$pntable['downloads_downloads_column'];
$dbconn->Execute("UPDATE $pntable[downloads_downloads]
SET $column[downloadratingsummary]=$finalrating,
$column[totalvotes]=$totalvotesDB,
$column[totalcomments]=$truecomments
WHERE $column[lid] = $lid");
$totalvoteresult->MoveNext();
}
pnRedirect('admin.php?module='.$GLOBALS['module'].'&op=downloads');
}
function DownloadsModDownloadS($lid, $title, $url, $description, $name, $email, $hits, $cat, $filesize, $version, $homepage) {
global $pntable, $dbconn;
csrfcheck();
$cat = explode("-", $cat);
if ($cat[1]=="") {
$cat[1] = 0;
}
$title = stripslashes(FixQuotes($title));
$url = stripslashes(FixQuotes($url));
$description = stripslashes(FixQuotes($description));
$name = stripslashes(FixQuotes($name));
$email = stripslashes(FixQuotes($email));
$column = &$pntable['downloads_downloads_column'];
$dbconn->Execute("UPDATE $pntable[downloads_downloads]
SET $column[cid]='$cat[0]', $column[sid]='$cat[1]',
$column[title]='$title', $column[url]='$url',
$column[description]='$description', $column[name]='$name',
$column[email]='$email', $column[hits]='$hits',
$column[filesize]='$filesize', $column[version]='$version',
$column[homepage]='$homepage'
WHERE $column[lid]=$lid");
pnRedirect('admin.php?module='.$GLOBALS['module'].'&op=downloads');
}
function DownloadsDelDownload($lid) {
global $pntable, $dbconn;
$dbconn->Execute("DELETE FROM $pntable[downloads_downloads]
WHERE {$pntable[downloads_downloads_column][lid]}=$lid");
pnRedirect('admin.php?module='.$GLOBALS['module'].'&op=downloads');
}
function DownloadsModCat($cat) {
global $pntable, $dbconn, $hlpfile;
include ("header.php");
GraphicAdmin($hlpfile);
OpenTable();
echo "<center><font class=\"pn-title\"><b>"._WEBDOWNLOADSADMIN."</b></font></center>";
CloseTable();
echo "<br>";
$cat = explode("-", $cat);
if ($cat[1]=="") {
$cat[1] = 0;
}
OpenTable();
echo "<center><font class=\"pn-title\"><b>"._MODCATEGORY."</b></font></center><br><br>";
if ($cat[1]==0) {
$column = &$pntable['downloads_categories_column'];
$result=$dbconn->Execute("SELECT $column[title], $column[cdescription]
FROM $pntable[downloads_categories]
WHERE $column[cid]=$cat[0]");
list($title,$cdescription) = $result->fields;
$cdescription = stripslashes($cdescription);
echo "<form action=\"admin.php\" method=\"get\">"
.""._NAME.": <input type=\"text\" name=\"title\" value=\"$title\" size=\"51\" maxlength=\"50\"><br>"
.""._DESCRIPTION.":<br><textarea name=\"cdescription\" cols=\"60\" rows=\"10\">$cdescription</textarea><br>"
."<input type=\"hidden\" name=\"sub\" value=\"0\">"
."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."<input type=\"hidden\" name=\"op\" value=\"DownloadsModCatS\">"
."<table border=\"0\"><tr><td>"
."<input type=\"submit\" value=\""._SAVECHANGES."\"></form></td><td>"
."<form action=\"admin.php\" method=\"get\">"
."<input type=\"hidden\" name=\"sub\" value=\"0\">"
."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."<input type=\"hidden\" name=\"op\" value=\"DownloadsDelCat\">"
."<input type=\"submit\" value=\""._DELETE."\"></form></td></tr></table>";
} else {
$column = &$pntable['downloads_categories_column'];
$result=$dbconn->Execute("SELECT $column[title]
FROM $pntable[downloads_categories]
WHERE $column[cid]=$cat[0]");
list($ctitle) = $result->fields;
$column = &$pntable['downloads_subcategories_column'];
$result2=$dbconn->Execute("SELECT $column[title]
FROM $pntable[downloads_subcategories]
WHERE $column[sid]=$cat[1]");
list($stitle) = $result2->fields;
echo "<form action=\"admin.php\" method=\"get\">"
.""._CATEGORY.": $ctitle<br>"
.""._SUBCATEGORY.": <input type=\"text\" name=\"title\" value=\"$stitle\" size=\"51\" maxlength=\"50\"><br>"
."<input type=\"hidden\" name=\"sub\" value=\"1\">"
."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
."<input type=\"hidden\" name=\"sid\" value=\"$cat[1]\">"
."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."<input type=\"hidden\" name=\"op\" value=\"DownloadsModCatS\">"
."<table border=\"0\"><tr><td>"
."<input type=\"submit\" value=\""._SAVECHANGES."\"></form></td><td>"
."<form action=\"admin.php\" method=\"get\">"
."<input type=\"hidden\" name=\"sub\" value=\"1\">"
."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
."<input type=\"hidden\" name=\"sid\" value=\"$cat[1]\">"
."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."<input type=\"hidden\" name=\"op\" value=\"DownloadsDelCat\">"
."<input type=\"submit\" value=\""._DELETE."\"></form></td></tr></table>";
}
CloseTable();
include("footer.php");
}
function DownloadsModCatS($cid, $sid, $sub, $title, $cdescription) {
global $pntable, $dbconn;
csrfcheck();
if ($sub==0) {
$column = &$pntable['downloads_categories_column'];
$dbconn->Execute("UPDATE $pntable[downloads_categories]
SET $column[title]='$title',
$column[cdescription]='$cdescription'
WHERE $column[cid]=$cid");
} else {
$column = &$pntable['downloads_subcategories_column'];
$dbconn->Execute("UPDATE $pntable[downloads_subcategories]
SET $column[title]='$title'
WHERE $column[sid]=$sid");
}
pnRedirect('admin.php?module='.$GLOBALS['module'].'&op=downloads');
}
function DownloadsDelCat($cid, $sid, $sub, $ok=0) {
global $pntable, $dbconn, $hlpfile;
csrfcheck();
if($ok==1) {
if ($sub>0) {
$dbconn->Execute("DELETE FROM $pntable[downloads_subcategories]
WHERE {$pntable[downloads_subcategories_column][sid]}=$sid");
$dbconn->Execute("DELETE FROM $pntable[downloads_downloads]
WHERE {$pntable[downloads_downloads_column][sid]}=$sid");
} else {
$dbconn->Execute("DELETE FROM $pntable[downloads_categories]
WHERE {$pntable[downloads_categories_column][cid]}=$cid");
$dbconn->Execute("DELETE FROM $pntable[downloads_subcategories]
WHERE {$pntable[downloads_subcategories_column][cid]}=$cid");
$dbconn->Execute("DELETE FROM $pntable[downloads_downloads]
WHERE {$pntable[downloads_downloads_column][cid]}=$cid
AND {$pntable[downloads_downloads_column][sid]}=0");
}
pnRedirect('admin.php?module='.$GLOBALS['module'].'&op=downloads');
} else {
include("header.php");
GraphicAdmin($hlpfile);
OpenTable();
echo "<br><center><font class=\"pn-title\">";
echo "<b>"._DDELCATWARNING."</b><br><br>";
}
echo "\n<form action=\"admin.php\" method=\"post\">"
."<input type=\"hidden\" name=\"module\" value=\"".$GLOBALS['module']."\">"
."\n<input type=\"hidden\" name=\"op\" value=\"DownloadsDelCat\">"
."\n<input type=\"hidden\" name=\"cid\" value=\"$cid\">"
."\n<input type=\"hidden\" name=\"sid\" value=\"$sid\">"
."\n<input type=\"hidden\" name=\"sub\" value=\"$sub\">"
."\n<input type=\"hidden\" name=\"ok\" value=\"1\">"
."\n<input type=\"submit\" value=\""._YES."\">"
."\n<input type=\"reset\" value=\""._NO."\" onClick=\"window.location.href = 'admin.php?op=downloads'\">"
."\n<br><br>";
CloseTable();
include("footer.php");
}
function DownloadsDelNew($lid) {
global $pntable, $dbconn;
$dbconn->Execute("DELETE FROM $pntable[downloads_newdownload]
WHERE {$pntable['downloads_newdownload_column']['lid']}=$lid");
pnRedirect('admin.php?module='.$GLOBALS['module'].'&op=downloads');
}
function DownloadsAddCat($title, $cdescription) {
global $pntable, $dbconn, $hlpfile;
csrfcheck();
$column = &$pntable['downloads_categories_column'];
$result = $dbconn->Execute("SELECT $column[cid]
FROM $pntable[downloads_categories]
WHERE $column[title]='$title'");
if (!$result->EOF) {
include("header.php");
GraphicAdmin($hlpfile);
OpenTable();
echo "<br><center><font class=\"pn-title\">"
."<b>"._ERRORTHECATEGORY." $title "._ALREADYEXIST."</b><br><br>"
.""._GOBACK."<br><br>";
CloseTable();
include("footer.php");
} else {
// FTO : Call the GenId function to support autoinc.
// FTO : Add SEQ suffix to avoid conflict name with ORACLE
$newid = $dbconn->GenId("{$pntable['downloads_categories']}_SEQ");
$dbconn->Execute("INSERT INTO $pntable[downloads_categories]
($column[cid], $column[title], $column[cdescription])
VALUES ($newid, '$title', '$cdescription')");
pnRedirect('admin.php?module='.$GLOBALS['module'].'&op=downloads');
}
}
function DownloadsAddSubCat($cid, $title) {
global $pntable, $dbconn, $hlpfile;
csrfcheck();
$column = &$pntable['downloads_subcategories_column'];
$result = $dbconn->Execute("SELECT $column[cid]
FROM $pntable[downloads_subcategories]
WHERE $column[title]='$title' AND $column[cid]='$cid'");
if (!$result->EOF) {
include("header.php");
GraphicAdmin($hlpfile);
OpenTable();
echo "<br><center>";
echo "<font class=\"pn-title\">"
."<b>"._ERRORTHESUBCATEGORY." $title "._ALREADYEXIST."</b><br><br>"
.""._GOBACK."<br><br>";
include("footer.php");
} else {
// FTO : Call the GenId function to support autoinc.
// FTO : Add SEQ suffix to avoid conflict name with ORACLE
$newid = $dbconn->GenId("{$pntable['downloads_subcategories']}_SEQ");
$dbconn->Execute("INSERT INTO $pntable[downloads_subcategories]
($column[sid], $column[cid], $column[title])
VALUES ($newid, '$cid', '$title')");
pnRedirect('admin.php?module='.$GLOBALS['module'].'&op=downloads');
}
}
function DownloadsAddEditorial($downloadid, $editorialtitle, $editorialtext) {
global $aid, $pntable, $dbconn, $hlpfile;
csrfcheck();
$editorialtext = stripslashes(FixQuotes($editorialtext));
$column = &$pntable['downloads_editorials_column'];
//FTO Use a php date time to stay compatible with
// all databases.
$now=$dbconn->DBTimeStamp(mktime());
$dbconn->Execute("INSERT INTO $pntable[downloads_editorials]
($column[downloadid], $column[adminid],
$column[editorialtimestamp], $column[editorialtext],
$column[editorialtitle])
VALUES ($downloadid, '$aid', $now, '$editorialtext',
'$editorialtitle')");
include("header.php");
GraphicAdmin($hlpfile);
OpenTable();
echo "<center><br>"
."<font size=3>"
.""._EDITORIALADDED."<br><br>"
."[ <a href=\"admin.php?module=".$GLOBALS['module']."&op=downloads\">"._WEBDOWNLOADSADMIN."</a> ]<br><br>";
echo "<table border=\"0\"><tr><td align=\"left\">";
echo "<b>"._DOWNLOADID.":</b> $downloadid<br><br>"
."<b>"._EDITORIALTITLE.":</b><br><input type=\"text\" name=\"editorialtitle\" value=\"$editorialtitle\" size=\"50\" maxlength=\"100\" readonly><br><br>"
."<b>"._EDITORIALTEXT.":</b><br><textarea name=\"editorialtext\" cols=\"60\" rows=\"10\" readonly>$editorialtext</textarea><br>";
echo "</td></tr></table>";
CloseTable();
include("footer.php");
}
function DownloadsModEditorial($downloadid, $editorialtitle, $editorialtext) {
global $pntable, $dbconn, $hlpfile;
csrfcheck();
$editorialtext = stripslashes(FixQuotes($editorialtext));
$column = &$pntable['downloads_editorials_column'];
$dbconn->Execute("UPDATE $pntable[downloads_editorials]
SET $column[editorialtext]='$editorialtext',
$column[editorialtitle]='$editorialtitle'
WHERE $column[downloadid]=$downloadid");
include("header.php");
GraphicAdmin($hlpfile);
OpenTable();
echo "<br><center>"
."<font class=\"pn-title\">"
.""._EDITORIALMODIFIED."<br><br>"
."[ <a href=\"admin.php?module=".$GLOBALS['module']."&op=downloads\">"._WEBDOWNLOADSADMIN."</a> ]<br><br>";
CloseTable();
include("footer.php");
}
function DownloadsDelEditorial($downloadid) {
global $pntable, $dbconn, $hlpfile;
csrfcheck();
$dbconn->Execute("DELETE FROM $pntable[downloads_editorials]
WHERE {$pntable[downloads_editorials_column][downloadid]}=$downloadid");
include("header.php");
GraphicAdmin($hlpfile);
OpenTable();
echo "<br><center>"
."<font class=\"pn-title\">"
.""._EDITORIALREMOVED."<br><br>"
."[ <a href=\"admin.php?module=".$GLOBALS['module']."&op=downloads\">"._WEBDOWNLOADSADMIN."</a> ]<br><br>";
CloseTable();
include("footer.php");
}
function DownloadsDownloadCheck() {
global $pntable, $dbconn, $hlpfile;
include ("header.php");
GraphicAdmin($hlpfile);
OpenTable();
echo "<center><font class=\"pn-title\"><b>"._WEBDOWNLOADSADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"pn-title\"><b>"._DOWNLOADVALIDATION."</b></font></center><br>"
."<table width=\"100%\" align=\"center\"><tr><td colspan=\"2\" align=\"center\">"
."<a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsValidate&cid=0&sid=0\">"._CHECKALLDOWNLOADS."</a><br><br></td></tr>"
."<tr><td valign=\"top\"><center><b>"._CHECKCATEGORIES."</b><br>"._INCLUDESUBCATEGORIES."<br><br><font class=\"pn-sub\">";
$column = &$pntable['downloads_categories_column'];
$result = $dbconn->Execute("SELECT $column[cid], $column[title]
FROM $pntable[downloads_categories]
ORDER BY $column[title]");
// FTO Check EOF and databse error
if (!$result) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result->EOF) {
list($cid, $title) = $result->fields;
$transfertitle = str_replace (" ", "_", $title);
echo "<a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsValidate&cid=$cid&sid=0&ttitle=$transfertitle\">$title</a><br>";
$result->MoveNext();
}
echo "</font></center></td>";
echo "<td valign=\"top\"><center><b>"._CHECKSUBCATEGORIES."</b><br><br><br><font class=\"pn-sub\">";
$column = &$pntable['downloads_subcategories_column'];
$result = $dbconn->Execute("SELECT $column[sid], $column[cid], $column[title]
FROM $pntable[downloads_subcategories]
ORDER BY $column[title]");
// FTO Check EOF and databse error
if (!$result) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result->EOF) {
list($sid, $cid, $title) = $result->fields;
$transfertitle = str_replace (" ", "_", $title);
$column = &$pntable['downloads_categories_column'];
$result2 = $dbconn->Execute("SELECT $column[title]
FROM $pntable[downloads_categories]
WHERE $column[cid] = $cid");
// FTO Check EOF and databse error
if (!$result2) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result2->EOF) {
list($ctitle) = $result2->fields;
echo "<a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsValidate&cid=0&sid=$sid&ttitle=$transfertitle\">$ctitle</a>";
$result2->MoveNext();
}
echo " / <a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsValidate&cid=0&sid=$sid&ttitle=$transfertitle\">$title</a><br>";
$result->MoveNext();
}
echo "</font></center></td></tr></table>";
CloseTable();
include ("footer.php");
}
function DownloadsValidate($cid, $sid, $ttitle) {
global $bgcolor2, $pntable, $dbconn, $hlpfile;
include ("header.php");
GraphicAdmin($hlpfile);
OpenTable();
echo "<center><font class=\"pn-title\"><b>"._WEBDOWNLOADSADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
$transfertitle = str_replace ("_", "", $ttitle);
/* Check ALL Downloads */
echo "<table width=100% border=0>";
if ($cid==0 && $sid==0) {
echo "<tr><td colspan=\"3\"><center><b>"._CHECKALLDOWNLOADS."</b><br>"._BEPATIENT."</center><br><br></td></tr>";
$column = &$pntable['downloads_downloads_column'];
$result = $dbconn->Execute("SELECT $column[lid], $column[title], $column[url],
$column[name], $column[email], $column[submitter]
FROM $pntable[downloads_downloads]
ORDER BY $column[title]");
}
/* Check Categories & Subcategories */
if ($cid!=0 && $sid==0) {
echo "<tr><td colspan=\"3\"><center><b>"._VALIDATINGCAT.": $transfertitle</b><br>"._BEPATIENT."</center><br><br></td></tr>";
$column = &$pntable['downloads_downloads_column'];
$result = $dbconn->Execute("SELECT $column[lid], $column[title], $column[url],
$column[name], $column[email], $column[submitter]
FROM $pntable[downloads_downloads]
WHERE $column[cid]=$cid ORDER BY $column[title]");
}
/* Check Only Subcategory */
if ($cid==0 && $sid!=0) {
echo "<tr><td colspan=\"3\"><center><b>"._VALIDATINGSUBCAT.": $transfertitle</b><br>"._BEPATIENT."</center><br><br></td></tr>";
$column = &$pntable['downloads_downloads_column'];
$result = $dbconn->Execute("SELECT $column[lid], $column[title], $column[url],
$column[name], $column[email], $column[submitter]
FROM $pntable[downloads_downloads]
WHERE $column[sid]=$sid ORDER BY $column[title]");
}
echo "<tr><td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._STATUS."</b></td><td bgcolor=\"$bgcolor2\" width=\"100%\"><b>"._DOWNLOADTITLE."</b></td><td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._FUNCTIONS."</b></td></tr>";
// FTO Check EOF and databse error
if (!$result) {
PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
die();
}
while(!$result->EOF) {
list($lid, $title, $url, $name, $email, $submitter) = $result->fields;
$vurl = parse_url($url);
$fp = fsockopen ($vurl['host'], 80, $errno, $errstr, 30);
if (!$fp){
echo "<tr><td align=\"center\"><b> "._FAILED." (nc) </b></td>"
."<td> <a href=\"$url\" target=\"new\">$title</a> </td>"
."<td align=\"center\"><font class=\"pn-normal\"> [ <a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsModDownload&lid=$lid\">"._EDIT."</a> | <a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsDelDownload&lid=$lid\">"._DELETE."</a> ] </font>"
."</td></tr>";
} else {
fputs ($fp, "HEAD ".$url." HTTP/1.0\r\n\r\n");
$buffer = fgets($fp,256);
if( (eregi("OK", $buffer)) || (eregi("302 Found", $buffer)) ) {
echo "<tr><td align=\"center\"> "._OK." </td>"
."<td> <a href=\"$url\" target=\"new\">$title</a> </td>"
."<td align=\"center\"><font class=\"pn-normal\"> "._NONE." </font>"
."</td></tr>";
} else {
echo "<tr><td align=\"center\"><b> "._FAILED."</b> <br><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\" class=\"pn-normal\">".str_replace("HTTP/1.0", "", $buffer)."</font></td>"
."<td> <a href=\"$url\" target=\"new\">$title</a> </td>"
."<td align=\"center\"><font class=\"pn-normal\"> [ <a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsModDownload&lid=$lid\">"._EDIT."</a> | <a href=\"admin.php?module=".$GLOBALS['module']."&op=DownloadsDelDownload&lid=$lid\">"._DELETE."</a> ] </font>"
."</td></tr>";
}
fclose ($fp);
}
$result->MoveNext();
}
echo "</table>";
CloseTable();
include ("footer.php");
}
function DownloadsAddDownload($new, $lid, $title, $url, $cat,
$description, $name, $email, $submitter, $filesize, $version, $homepage, $hits)
{
global $pntable, $dbconn, $hlpfile;
csrfcheck();
/*
* Hootbah: XXX FIXME XXX I don't think we need the following query.
* It seems to be only used for numRows
*/
$column = &$pntable['downloads_downloads_column'];
$result = $dbconn->Execute("SELECT $column[url]
FROM $pntable[downloads_downloads]
WHERE $column[url]='$url'");
$numrows = $result->PO_RecordCount();
$error="";
if ($description=="") { $error = _ERRORNODESCRIPTION;}
elseif ($title=="") { $error = _ERRORNOTITLE; }
elseif ($numrows>0) { $error = _ERRORURLEXIST; }
elseif ($url=="") { $error = _ERRORNOURL; }
if ($hits == "") {
$hits = 0;
}
if ($error!="") {
include("header.php");
GraphicAdmin($hlpfile);
OpenTable();
echo "<center><font class=\"pn-title\"><b>"._WEBDOWNLOADSADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<br><center>"
."<font class=\"pn-title\">"
."<b>$error</b><br><br>"
.""._GOBACK."<br><br>";
CloseTable();
include("footer.php");
} else {
$cat = explode("-", $cat);
if ($cat[1]=="") {
$cat[1] = 0;
}
$title = stripslashes(FixQuotes($title));
$url = stripslashes(FixQuotes($url));
$description = stripslashes(FixQuotes($description));
$name = stripslashes(FixQuotes($name));
$email = stripslashes(FixQuotes($email));
$column = &$pntable['downloads_downloads_column'];
//FTO Use a php date time to stay compatible with
// all databases.
$now=$dbconn->DBTimeStamp(mktime());
// FTO : Call the GenId function to support autoinc.
// FTO : Add SEQ suffix to avoid conflict name with ORACLE
$newid = $dbconn->GenId("{$pntable['downloads_downloads']}_SEQ");
$dbconn->Execute("INSERT INTO $pntable[downloads_downloads]
($column[lid], $column[cid], $column[sid], $column[title],
$column[url], $column[description], $column[date], $column[name],
$column[email], $column[hits], $column[submitter],
$column[downloadratingsummary], $column[totalvotes],
$column[totalcomments], $column[filesize], $column[version],
$column[homepage])
VALUES ($newid, '$cat[0]', '$cat[1]', '$title', '$url',
'$description', $now, '$name', '$email', $hits,'$submitter',
0,0,0, '$filesize', '$version', '$homepage')");
global $nukeurl, $sitename;
include("header.php");
GraphicAdmin($hlpfile);
OpenTable();
echo "<br><center>";
echo "<font class=\"pn-title\">";
echo ""._NEWDOWNLOADADDED."<br><br>";
echo "[ <a href=\"admin.php?module=".$GLOBALS['module']."&op=downloads\">"._WEBDOWNLOADSADMIN."</a> ]</center><br><br>";
CloseTable();
if ($new==1) {
$dbconn->Execute("DELETE FROM $pntable[downloads_newdownload]
WHERE {$pntable[downloads_newdownload_column][lid]}=$lid");
}
include("footer.php");
}
}
function downloads_admin_main($var) {
// Please change parms X by $var['X'] when time
global $op;
extract($var);
switch ($op)
{
case "downloads":
downloads();
break;
case "DownloadsDelNew":
DownloadsDelNew($var['lid']);
break;
case "DownloadsAddCat":
DownloadsAddCat($var['title'],$var['cdescription']);
break;
case "DownloadsAddSubCat":
DownloadsAddSubCat($var['cid'], $var['title']);
break;
case "DownloadsAddDownload":
DownloadsAddDownload($new, $lid, $title, $url, $cat, $description, $name, $email, $submitter, $filesize, $version, $homepage, $hits);
break;
case "DownloadsAddEditorial":
DownloadsAddEditorial($downloadid, $editorialtitle, $editorialtext);
break;
case "DownloadsModEditorial":
DownloadsModEditorial($downloadid, $editorialtitle, $editorialtext);
break;
case "DownloadsDownloadCheck":
DownloadsDownloadCheck();
break;
case "DownloadsValidate":
DownloadsValidate($cid, $sid, $ttitle);
break;
case "DownloadsDelEditorial":
DownloadsDelEditorial($downloadid);
break;
case "DownloadsCleanVotes":
DownloadsCleanVotes();
break;
case "DownloadsListBrokenDownloads":
DownloadsListBrokenDownloads();
break;
case "DownloadsDelBrokenDownloads":
DownloadsDelBrokenDownloads($lid);
break;
case "DownloadsIgnoreBrokenDownloads":
DownloadsIgnoreBrokenDownloads($lid);
break;
case "DownloadsListModRequests":
DownloadsListModRequests();
break;
case "DownloadsChangeModRequests":
DownloadsChangeModRequests($requestid);
break;
case "DownloadsChangeIgnoreRequests":
DownloadsChangeIgnoreRequests($requestid);
break;
case "DownloadsDelCat":
DownloadsDelCat($cid, $sid, $sub, $ok);
break;
case "DownloadsModCat":
DownloadsModCat($cat);
break;
case "DownloadsModCatS":
DownloadsModCatS($cid, $sid, $sub, $title, $cdescription);
break;
case "DownloadsModDownload":
DownloadsModDownload($lid);
break;
case "DownloadsModDownloadS":
DownloadsModDownloadS($lid, $title, $url, $description, $name, $email, $hits, $cat, $filesize, $version, $homepage);
break;
case "DownloadsDelDownload":
DownloadsDelDownload($lid);
break;
case "DownloadsDelVote":
DownloadsDelVote($lid, $rid);
break;
case "DownloadsDelComment":
DownloadsDelComment($lid, $rid);
break;
default:
downloads();
break;
}
}
} else {
echo "Access Denied";
}
?>