<?php
/*========================================================*\
||########################################################||
||# #||
||# WB News v1.0.0 #||
||# ---------------------------------------------------- #||
||# Copyright (c) 2004-2005 #||
||# Created: 9th September 2005 #||
||# Filename: sendmsg.php #||
||# #||
||########################################################||
/*========================================================*/
/**
* @author $Author: pmcilwaine $
* @version $Id: news-sendmsg.php,v 1.1.2.2.2.1 2008/07/14 11:04:07 pmcilwaine Exp $
*/
require_once( "global.php" );
$auth->login_if( !$auth->is_logged() );
$page = new PageTemplateEngine( BuildPath("admin/main-page.ihtml") );
$tmpl->SetFilename( BuildPath("admin/sendmessage.ihtml") );
$params = array(
"entry" => "\t<li>%s</li>\n\t",
"separator" => FALSE,
"class_open" => "open",
"links" => toolbarmenu()
);
$toolbar = include( INCDIR . "/page-menu.php" );
$rows =& $tmpl->AddParam( "rows", array() );
$news =& $tmpl->AddParam( "news", array() );
$page->AddParam( "toolbar", $toolbar );
$page->AddParam( "userinfo", $userinfo );
$pagemenu =& $tmpl->AddParam( "pagemenu", array() );
$params = array(
"entry" => "\t<li>%s</li>\n\t",
"separator" => FALSE,
"links" => array(
"A" => array(
"label" => "&Back",
"return_page" => TRUE
)
)
);
$pagemenu = include( INCDIR . "/page-menu.php" );
$fields = array(
"id",
"newsid",
"time",
"email_to",
"email_from",
"message",
"ipaddress"
);
$cond = array();
$cond = join( " AND ", $cond );
$offset = isset($_REQUEST["offset"]) ? intval( $_REQUEST["offset"] ) : 0;
$ids = $DB->ListBy( TBL_SEND, NULL, $fields, NULL, 20, $offset );
$count_ids = $DB->CountBy( TBL_SEND, $cond );
$DB->query( "SELECT \"id\", \"title\" FROM " . TBL_NEWS );
$news = array();
while ( $DB->next_record() )
{
$news[ $DB->field("id") ] = htmlspecialchars($DB->field("title"));
}
if ( is_array($ids) && count($ids) != 0 )
{
foreach ( $ids as $id )
{
$rows[$id["newsid"]][$id["id"]] = array(
"time" => tz_date( $config["dateFormat"], $id["time"] ),
"email_to" => htmlspecialchars($id["email_to"]),
"email_from" => htmlspecialchars($id["email_from"]),
"message" => nl2br(htmlspecialchars($id["message"])),
"ipaddress" => htmlspecialchars($id["ipaddress"])
);
}
}
$pagemenu =& $tmpl->AddParam( "pagemenu", array() );
$page->BindParam( "pagemenu", $tmpl );
$params = array(
"entry" => "\t<li>%s</li>\n\t",
"separator" => "\t<li>|</li>\n\t",
"links" => buildmenu( $theme_info["pagemenu_build"] )
);
$params = array_merge( $params, $theme_info["pagemenu"] );
$pagemenu = include( INCDIR . "/page-menu.php" );
$tmpl->Pagination( $count_ids, $offset, 20 );
$page->ParseContent( $tmpl->GetHTML() );
$page->ShowPage();
?>