From: <ag...@us...> - 2008-03-17 13:57:15
|
Revision: 45 http://panda-admin.svn.sourceforge.net/panda-admin/?rev=45&view=rev Author: agrassi Date: 2008-03-17 06:57:19 -0700 (Mon, 17 Mar 2008) Log Message: ----------- Added newsletter (un)subscription templates Fixed small bug in header.php with https detection Modified Paths: -------------- trunk/extra/libnewsletter.php trunk/tpl/header.php Added Paths: ----------- trunk/extra/confirm.php trunk/extra/subscribe.php trunk/extra/unsubscribe.php Added: trunk/extra/confirm.php =================================================================== --- trunk/extra/confirm.php (rev 0) +++ trunk/extra/confirm.php 2008-03-17 13:57:19 UTC (rev 45) @@ -0,0 +1,49 @@ +<?php + +require_once("libnewsletter.php"); + + +$nwl_array = array("fu...@bu...", + "un...@du...e", + "ci...@li...", + "oom...@du...") ; + +function gen_sub_form($arr) { +?> +<form name="input" action="#"> +e-mail: <input type="text" name="email"> <br /> +newsletter: +<select name="nwl"> +<? + foreach($arr as $nwl) { +?> + <option value="<?= $nwl ?>"><?= $nwl ?></option> +<? } ?> +</select> +<input type="submit" value="Submit"> +</form> +<? +} +?> + +<html> +<head> +<title>Mailing list subscription form</title> +</head> + +<body> + +<? + if($_GET["code"]) { +?> +Confirming code <?= $_GET["code"] ?>.... +<? + $res = confirm($_GET["code"]); + $res == "TRUE" ? printf("done! $res") : printf("failed: $res"); + } + else { + echo "No code supplied"; + die; + } ?> +</body> +</html> Modified: trunk/extra/libnewsletter.php =================================================================== --- trunk/extra/libnewsletter.php 2008-03-06 11:38:15 UTC (rev 44) +++ trunk/extra/libnewsletter.php 2008-03-17 13:57:19 UTC (rev 45) @@ -18,7 +18,7 @@ */ // Hardcode this to the central newsletter handler -define('ABSOLUTE_URL','http://localhost/panda/newsletters/'); +define('ABSOLUTE_URL','http://localhost/p/newsletters/'); function subscribe($email,$newsletter) { @@ -35,7 +35,7 @@ fclose($sock); if($result == 'TRUE') { - return TRUE; + return "TRUE"; } else { return $result; } @@ -51,7 +51,7 @@ fclose($sock); if($result == 'TRUE') { - return TRUE; + return "TRUE"; } else { return $result; } @@ -73,12 +73,11 @@ fclose($sock); if($result == 'TRUE') { - return TRUE; + return "TRUE"; } else { return $result; } } - ?> Added: trunk/extra/subscribe.php =================================================================== --- trunk/extra/subscribe.php (rev 0) +++ trunk/extra/subscribe.php 2008-03-17 13:57:19 UTC (rev 45) @@ -0,0 +1,50 @@ +<?php + +require_once("libnewsletter.php"); + + +$nwl_array = array("fu...@bu...", + "un...@du...e", + "ci...@li...", + "oom...@du...") ; + +function gen_sub_form($arr) { +?> +<form name="input" action="#"> +e-mail: <input type="text" name="email"> <br /> +newsletter: +<select name="nwl"> +<? + foreach($arr as $nwl) { +?> + <option value="<?= $nwl ?>"><?= $nwl ?></option> +<? } ?> +</select> +<input type="submit" value="Submit"> +</form> +<? +} +?> + +<html> +<head> +<title>Mailing list subscription form</title> +</head> + +<body> + +<? + if($_GET["email"]) { +?> +Subscribing you to the newsletter... +<? + $res = subscribe($_GET["email"],$_GET["nwl"]); + $res == "TRUE" ? printf("done! $res") : printf("failed: $res"); + } + else { +?> +Enter the email address to be subscribed:<br /> +<? gen_sub_form($nwl_array); + } ?> +</body> +</html> Added: trunk/extra/unsubscribe.php =================================================================== --- trunk/extra/unsubscribe.php (rev 0) +++ trunk/extra/unsubscribe.php 2008-03-17 13:57:19 UTC (rev 45) @@ -0,0 +1,50 @@ +<?php + +require_once("libnewsletter.php"); + + +$nwl_array = array("fu...@bu...", + "un...@du...e", + "ci...@li...", + "oom...@du...") ; + +function gen_sub_form($arr) { +?> +<form name="input" action="#"> +e-mail: <input type="text" name="email"> <br /> +newsletter: +<select name="nwl"> +<? + foreach($arr as $nwl) { +?> + <option value="<?= $nwl ?>"><?= $nwl ?></option> +<? } ?> +</select> +<input type="submit" value="Submit"> +</form> +<? +} +?> + +<html> +<head> +<title>Mailing list subscription form</title> +</head> + +<body> + +<? + if($_GET["email"]) { +?> +Unsubscribing you from the newsletter... +<? + $res = unsubscribe($_GET["email"],$_GET["nwl"]); + $res == "TRUE" ? printf("done! $res") : printf("failed: $res"); + } + else { +?> +Enter the email address to be unsubscribed:<br /> +<? gen_sub_form($nwl_array); + } ?> +</body> +</html> Modified: trunk/tpl/header.php =================================================================== --- trunk/tpl/header.php 2008-03-06 11:38:15 UTC (rev 44) +++ trunk/tpl/header.php 2008-03-17 13:57:19 UTC (rev 45) @@ -19,7 +19,7 @@ */ ?> <?= '<?xml version="1.0"?>' ?> - +<? if($_SERVER['HTTPS'] == 'on') { $is_https="s"; } else { $is_https=""; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" @@ -38,7 +38,7 @@ <a href='<?= make_link(array()).'?mode=email' ?>'>e-mail</a> <a href='<?= make_link(array()).'?mode=domain' ?>'><?= _("domains") ?></a> <a href='<?= make_link(array()).'?mode=domainalias' ?>'><?= _("alias domains") ?></a> - <a href='<?= "http://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF']) . "/nwadmin" ?>' target="_blank">newsletter</a> + <a href='<?= "http" . $is_https . "://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF']) . "/nwadmin" ?>' target="_blank">newsletter</a> <? if(is_administrator()) { ?> <br /> <a href='<?= make_link(array()).'?mode=users' ?>'><?= _("users") ?></a> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |