Advertising Code

pull/1/head
root 18 years ago
parent cfac4bb068
commit 9e544cba90

@ -27,6 +27,8 @@
$tmpid = $id + 1000;
if($PHP_SELF == "/disputes.php")
$tmpid = $id + 1500;
if($PHP_SELF == "/advertising.php")
$tmpid = $id + 2000;
switch($tmpid)
{
@ -114,6 +116,16 @@
case 1508:
case 1509:
case 1510: $expand = " explode('disputes');"; break;
case 2000:
case 2001:
case 2002:
case 2003:
case 2004:
case 2005:
case 2006:
case 2007:
case 2008:
case 2009: $expand = " explode('advertising');"; break;
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
@ -122,6 +134,7 @@
<title><?=$title?></title>
<? if($_SESSION['_config']['header'] != "") { ?><?=$_SESSION['_config']['header']?><? } ?>
<link rel="stylesheet" href="/styles/default.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="JavaScript" type="text/javascript">
function explode(e) {
if (document.getElementById(e).style.display == 'none') {
@ -226,6 +239,12 @@ function hideall() {
<h3 onclick="explode('disputes')">+ <?=_("Disputes/Abuses")?></h3>
<ul class="menu" id="disputes"><li><a href="disputes.php?id=0"><?=_("More Information")?></a></li><li><a href="disputes.php?id=1"><?=_("Email Dispute")?></a></li><li><a href="disputes.php?id=2"><?=_("Domain Dispute")?></a></li><? if($_SESSION['profile']['admin'] == 1) { ?><li><a href="disputes.php?id=3"><?=_("Abuses")?></a></li><? } ?></ul>
</div>
<? if($_SESSION['profile']['adadmin'] >= 1) { ?>
<div class="relatedLinks">
<h3 onclick="explode('advertising')">+ <?=_("Advertising")?></h3>
<ul class="menu" id="advertising"><li><a href="advertising.php?id=1"><?=_("New Ad")?></a></li><li><a href="advertising.php?id=0"><?=_("View Ads")?></a></li></ul>
</div>
<? } ?>
</div>
<div id="content">
<div class="story">

@ -198,7 +198,7 @@
function includeit($id = "0", $section = "index")
{
$id = intval($id);
if($section != "index" && $section != "account" && $section != "wot" && $section != "help" && $section != "gpg" && $section != "disputes" && $section != "tverify")
if($section != "index" && $section != "account" && $section != "wot" && $section != "help" && $section != "gpg" && $section != "disputes" && $section != "tverify" && $section != "advertising")
{
$section = "index";
}

@ -91,17 +91,10 @@ google_color_border = "FFFFFF";
<div class="relatedLinks">
<h3 onclick="explode('recom')"><?=_("Web Links")?></h3>
<ul class="menu" id="recom"><?
$arr = array( "www.detektei.de" => "Detektei",
"www.emion.de" => "Internetagentur",
"www.suma-group.com" => "Suchmaschinenoptimierung",
"www.emion-gmbh.de" => "Webverzeichnis",
"www.traumhaus4me.de" => "Haus Hauskauf Immobilien",
"www.guxme.de" => "K&uuml;nstler",
"www.tintencenter.com" => "Druckerpatrone Tintenpatrone",
"www.sms-sprueche-bilder.de" => "ringtones",
"www.tuerkei-ferien.de/lastminute/index.htm" => "Lastminute T&uuml;rkei");
foreach($arr as $key => $val)
echo "<li><a href='http://$key' target='_new'>$val</a></li>";
$query = "select * from `advertising` where `expires`>NOW() and `active`=1";
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
echo "<li><a href='$row[link]' target='_new'>$row[title]</a></li>";
?></ul>
</div>
</div>

@ -0,0 +1,82 @@
<? /*
Copyright (C) 2004 by Duane Groth <duane_at_CAcert_dot_org>
This file is part of CAcert.
CAcert has been released under the CAcert Source License
which can be found included with these source files or can
be downloaded from the internet from the following address:
http://www.cacert.org/src-lic.php
CAcert is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the License for more details.
*/ ?>
<?
$tdcols = 6;
if($_SESSION['profile']['adadmin'] == 2)
$tdcols++;
if(intval($_REQUEST['approve']) > 0 && $_SESSION['profile']['adadmin'] >= 2)
{
$approve = intval($_REQUEST['approve']);
$query = "select * from `advertising` where `id`='$approve' and `expires`='0000-00-00 00:00:00'";
$res = mysql_query($query);
if(mysql_num_rows($res) > 0)
{
$row = mysql_fetch_assoc($res);
$end = date("Y-m-d H:i:s", mktime(date("H"), date("i"), date("s"), date("m")+$row['months'], date("d"), date("Y")));
$query = "update `advertising` set `expires`='$end', `active`=1, `approvedby`='".$_SESSION['profile']['id']."' where `id`='$approve'";
mysql_query($query);
echo "<p>The ad was approved and is now active.</p>\n";
}
}
?>
<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper" width="500">
<tr>
<td colspan="<?=$tdcols?>" class="title"><?=_("View Advertising")?> <a href="advertising.php?id=<?=$id?>&showall=1"><?=_("Show All")?></a></td>
</tr>
<tr>
<td class="DataTD">ID</td>
<td class="DataTD">Link</td>
<td class="DataTD">Status</td>
<td class="DataTD">Expires</td>
<td class="DataTD">Edit</td>
<td class="DataTD">Disable</td>
<? if($_SESSION['profile']['adadmin'] == 2) { echo "\t<td class='DataTD'>Approve</td>\n"; }
?> </tr>
<?
$query = "select *,UNIX_TIMESTAMP(`expires`)-UNIX_TIMESTAMP(NOW()) as `timeleft` from `advertising` where `replaced`=0 ";
if($_REQUEST['showall'] != 1)
$query .= "and `active`=1 having `timeleft` > 0 ";
$query .= "order by `id` desc";
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
{
if($row['expires'] == "0000-00-00 00:00:00")
$status = "Pending";
else if($row['active'] == 1 && $row['timeleft'] > 0)
$status = "Active";
else if($row['timeleft'] <= 0)
$status = "Expired";
else if($row['active'] != 1)
$status = "Disabled";
else
$status = "Unknown";
echo "<tr><td class='DataTD'>$row[id]</td><td class='DataTD'><a href='$row[link]' target='_new'>$row[title]</a></td>";
echo "<td class='DataTD'>$status</td><td class='DataTD'>$row[expires]</td><td class='DataTD'>Edit</td>";
echo "<td class='DataTD'>Disable</td>";
if($_SESSION['profile']['adadmin'] == 2)
{
if($status == "Pending" && $row['expires'] == "0000-00-00 00:00:00")
echo "<td class='DataTD'><a href='advertising.php?id=0&approve=$row[id]'>Approve</a></td>";
else if($status == "Active")
echo "<td class='DataTD'><a href='advertising.php?id=0&deactive=$row[id]'>De-Activate</a></td>";
else
echo "<td class='DataTD'>N/A</td>";
}
echo "</tr>\n";
}
?>
</table>

@ -0,0 +1,35 @@
<? /*
Copyright (C) 2004 by Duane Groth <duane_at_CAcert_dot_org>
This file is part of CAcert.
CAcert has been released under the CAcert Source License
which can be found included with these source files or can
be downloaded from the internet from the following address:
http://www.cacert.org/src-lic.php
CAcert is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the License for more details.
*/ ?>
<? global $errmsg, $link, $title, $months; if($errmsg != "") { ?><p style="color:red"><?=$errmsg?></p><? } ?>
<form method="post" action="advertising.php" ACCEPTCHARSET="utf-8">
<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
<tr>
<td colspan="6" class="title"><?=_("New Advertisement")?></td>
</tr>
<tr><td class='DataTD'>Link Title:</td><td class='DataTD'><input type="text" name="title" value="<?=$title?>"></td></tr>
<tr><td class='DataTD'>URL:</td><td class='DataTD'><input type="text" name="link" value="<?=$link?>"></td></tr>
<tr><td class='DataTD'>Months:</td><td class='DataTD'><select name="months"><?
for($i = 1; $i <= 12; $i++)
{
echo "<option value='$i'";
if($months == $i)
echo " selected";
echo ">$i Months</option>";
}
?></td></tr>
<tr><td class='DataTD' colspan='2'><input type="submit" name="process" value="Submit New Advertisment"></tr>
</table>
<input type="hidden" name="oldid" value="<?=$id?>">
</form>

@ -0,0 +1,84 @@
<? /*
Copyright (C) 2004 by Duane Groth <duane_at_CAcert_dot_org>
This file is part of CAcert.
CAcert has been released under the CAcert Source License
which can be found included with these source files or can
be downloaded from the internet from the following address:
http://www.cacert.org/src-lic.php
CAcert is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the License for more details.
*/ ?>
<?
if($_SESSION['profile']['adadmin'] <= 0)
{
showheader(_("My CAcert.org Account!"));
echo _("You don't have access to this area.");
showfooter();
exit;
}
$id = intval($_REQUEST['id']);
if($id == 2)
$id = 0;
$oldid = intval($_POST['oldid']);
$process = $_POST['process'];
loadem("account");
$errmsg = "";
if($oldid == 1 && $process != "")
{
$title = mysql_real_escape_string(strip_tags(trim(htmlentities($_POST['title']))));
$link = mysql_real_escape_string(strip_tags(trim($_POST['link'])));
$months = intval($_POST['months']);
if(!strstr($link, "://"))
{
$link = "http://".$link;
}
if($months < 1 || $months > 12)
{
$id = 1;
$errmsg .= _("You can only place an advertisement for up to 12 months.<br />");
unset($process);
unset($oldid);
}
if(strlen($title) <= 5)
{
$id = 1;
$errmsg .= _("Link title was too short.<br />");
unset($process);
unset($oldid);
}
if(strlen($link) <= 10)
{
$id = 1;
$errmsg .= _("Link URI was too short.<br />");
unset($process);
unset($oldid);
}
}
if($oldid == 1 && $process != "")
{
$query = "insert into `advertising` set `link`='$link', `title`='$title', `months`='$months', `who`='".$_SESSION['profile']['id']."',
`when`=NOW()";
mysql_query($query);
unset($link);
unset($title);
unset($months);
$id = 1;
$errmsg = _("Your advertisement request has been lodge in the system and administrators notified. Once the information has been reviewed, you will be notified if the link was acceptable or declined and the reason for the decline. If the request is successful the system will generate an invoice.");
}
showheader(_("CAcert.org Advertising Section"));
includeit($id, "advertising");
showfooter();
?>
Loading…
Cancel
Save