init()) {
echo "Cannot open database \n";
exit;
}
// Prepare SMTP class
$smtp = new smtp_class;
$smtp->host_name = "mail2.imagineis.com";
$smtp->localhost = "localhost";
// Send mail function
function smtp_mail($from, $to, $subject, $body, $replyto = "", $bcc = "")
{
global $smtp;
$hdr = array(
"From: $from",
"To: $to",
"Subject: $subject"
);
if ($replyto) { $hdr[] = "Reply-to: $replyto"; }
if ($bcc) { $hdr[] = "Bcc: $bcc"; }
if (!$smtp->SendMessage($from, array($to), $hdr, $body)) {
echo "
Could not send the message to $to.\nError: ".$smtp->error."
\n";
}
}
function show_submissions_list($CatID)
{
global $PHP_SELF;
global $db;
global $SEE_ALL_SUBMISSIONS;
global $TOP_CAT_NAME;
if ($SEE_ALL_SUBMISSIONS) {
$sub = $db->get_Submissions();
} else {
// Need to replace with function to show only for this CatID
$sub = $db->get_Submissions();
};
print "
";
print "$LinkName - $Desc \n";
print "URL: $Url\n";
// Print submitter name and email
print " (Name: $Name - $Email) \n";
// Print category
print " Category: $LinkCatName \n";
print "[";
// Link to approve a sumbission
print "Approve ";
// Link to delete a sumbission
print "Delete ";
// Link to edit a sumbission
print "Edit";
print "]";
print "
";
}
}
print "
\n";
return;
}
function start_page($CatID="",$title="",$msg="")
{
global $PHP_SELF;
global $SITE_URL;
print_header($CatID,$title,$msg);
if(!empty($msg))
{
print "\n
$msg
\n";
}
print "
';
return;
}
function start_browse($CatID="")
{
global $PHP_SELF;
global $db;
global $ADMIN_MODE;
global $TOP_CAT_NAME;
$data = $db->get_Cats($CatID);
$links = $db->get_Links($CatID);
$OurCatID = $CatID;
if(empty($CatID) || ($CatID == "0"))
{
$currentID = "top";
$currentName = "$TOP_CAT_NAME";
} else {
$currentID = $CatID;
$currentName = $db->get_CatNames($CatID);
}
// Print list of sub categories
if(!empty($data))
{
$data_cnt = count ($data);
$data_left = $data_cnt >> 1;
print '
';
print "
\n";
while ( list ( $key,$val ) = each ($data))
{
$CatID = stripslashes($val["CatID"]);
$CatName = stripslashes($val["CatName"]);
$LinksInCat = $db->get_TotalLinksInCat_cnt($CatID);
print "
Feel free to add your own links. You must select a category, ";
print "it won't accept top level links. Your entry stands a much better chance of getting ";
print "added if your description is exceptionally short and clear, is in the right category,";
print "isn't spammy, and your site intrigues me. I reserve the right to edit, deny or delete ";
print "your link at any time. Follow links at your own risk.
\n";
if ($ADMIN_MODE) {
print "\n\n";
print "
Submissions
\n";
show_submissions_list($CatID);
$CatID = $OurCatID; // restore CatID
// Show form to add a subcategory
print "\n\n";
print "
\n";
}
// Print the footer
print_footer();
return;
}
// Print drop-down box for available categories
function show_cat_selection($SelName = "CatID", $IncludeTop = true, $SecSel = "NULL")
{
global $PHP_SELF;
global $db;
global $ADMIN_MODE;
global $TOP_CAT_NAME;
print "\n";
return;
}
function show_edit_link($LinkID="",$title="",$msg="")
{
global $PHP_SELF;
global $db;
global $TOP_CAT_NAME;
global $FULL_ADMIN_ACCESS;
print_header($CatID,$title,$msg);
$thislink = $db->get_OneLink($LinkID);
if (empty($thislink)) {
print "