Location: PHPKode > projects > ADbNewsSender > ADbNewsSender_2.0.4/protected/admin/previewNL.php
<?php session_start();

//Copyright (c) Florian Grannemann
//Last change in version: 2.0 RC 2
/*
    ******************************************************************************
    ADbNewsSender 2

    Copyright (C) 2009  Florian Grannemann (hide@address.com)
    Website: http://adbnewssender.sf.net



    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    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.

    You should have received a copy of the GNU General Public License			
    along with this program.  If not, see http://www.gnu.org/licenses/
    ******************************************************************************
*/



//Do not edit anything unless you realy REALY know what you are doing!

 
//to avoid problems on some servers:
//if that makes problems, use 
//$path_to_protected=".."; instead
//But this should work on all UNIX-like systems:

    $path_to_protected=dirname(__FILE__)."/..";

    include "$path_to_protected/skeleton/public_apis.class.php.inc";
    include "$path_to_protected/skeleton/private_apis.class.php.inc";

    $path_to_db_conf="$path_to_protected/database/DBconf.php.inc";
    $path_to_db_defs="$path_to_protected/skeleton/includes/db_defs";

    $MyDB = new ADBNS_DB($path_to_db_defs,$path_to_db_conf);
    $MyCFG= new global_config_rw(&$MyDB);
    include "$path_to_protected/localisation/lang/".$MyCFG->get_config_value("Language")."/lang_admin_sendNL.php.inc";

    if($_REQUEST["what"]=="draft")
    {
	$Body="Drafts".$_SESSION["CurrentNL"]."_Body";
    }
    else
    {
	$Body="NL".$_SESSION["CurrentNL"]."_Body";
    }
    if($_SESSION["CurrentNL"] && $MyCFG->NL_exists(intval($_SESSION["CurrentNL"])))
    {

    
	if(!$_SESSION[$Body])
	{
	   //Message body not yet in session. Try to reload
	   print "<HTML><HEAD><META HTTP-EQUIV=\"refresh\" CONTENT=\"1\"></HEAD><BODY></BODY></HTML>";
	}
	else
	{
	    $Newsletter=stripslashes($_SESSION[$Body]);
	    //$Newsletter=$_REQUEST["Body"];
	    $Newsletter=preg_replace("/\[ArchiveEntryURL\]/",$TXT_RepArchiveURL,$Newsletter);
	    if(preg_match("/\[UnsubscribeLink\]/",$Newsletter))
	    {
		print preg_replace("/\[UnsubscribeLink\]/",$TXT_RepUnsubscribeLink,$Newsletter);
	    }
	    else
	    {
		$Newsletter=preg_replace("/<\/body>/i","",$Newsletter);
		$Newsletter=preg_replace("/<\/html>/i","",$Newsletter);
		print $Newsletter."<br>$TXT_RepUnsubscribeLink </body></html>";
	    }
	}	
    }
    else
    {
	print "<h1>$ErrorNLdoesnotExist</h1>";

    }


?>
Return current item: ADbNewsSender