/***************************************************************************
* Dolphin Smart Community Builder
* -----------------
* begin : Mon Mar 23 2006
* copyright : (C) 2006 BoonEx Group
* website : http://www.boonex.com/
* This file is part of Dolphin - Smart Community Builder
*
* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
* http://creativecommons.org/licenses/by/3.0/
*
* Dolphin 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 Creative Commons Attribution 3.0 License for more details.
* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
* see license.txt file; if not, write to marketing@boonex.com
***************************************************************************/
require_once( '../inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'admin_design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
$logged['admin'] = member_auth( 1, true, true );
// this is dynamic page - send headers to do not cache this page
send_headers_page_changed();
$title = "";
$url = "";
$description = "";
$action = "";
// get start & end dates
$start_date_default = "2005-01-01";
$end_date_default = "2010-01-01";
$start_date = $_POST['start_date'] ? $_POST['start_date'] : $start_date_default;
$start_date = strtotime($start_date);
$start_date = $start_date != -1 ? $start_date : strtotime($start_date_default);
$end_date = $_POST['end_date'] ? $_POST['end_date'] : $end_date_default;
$end_date = strtotime($end_date);
$end_date = $end_date != -1 ? $end_date : strtotime($end_date_default);
$end_date = $end_date < $start_date ? $start_date : $end_date;
$start_date = "FROM_UNIXTIME($start_date)";
$end_date = "FROM_UNIXTIME($end_date)";
$banner_pos = "";
if ( $_POST['pos_top'] == "on" ) $banner_pos .= '1';
if ( $_POST['pos_left'] == "on" ) $banner_pos .= '2';
if ( $_POST['pos_right'] == "on" ) $banner_pos .= '3';
if ( $_POST['pos_bottom'] == "on" ) $banner_pos .= '4';
$banner_pos = (int)$banner_pos;
if ( !$demo_mode && $_POST['action'] == 'modify' && $_POST['as_new'] != "on" )
{
$banner_title = process_db_input( $_POST['Title'] );
$banner_lhshift = (int)$_POST['lhshift'];
$banner_lvshift = (int)$_POST['lvshift'];
$banner_rhshift = (int)$_POST['rhshift'];
$banner_rvshift = (int)$_POST['rvshift'];
$banner_text = process_db_input( $_POST['Text'] );
$banner_active = ( $_POST['Active'] == 'on' ? 1 : 0 );
$banner_url = process_db_input( $_POST['Url'] );
db_res( "UPDATE `Banners` SET `Title` = '$banner_title', `lhshift` = '$banner_lhshift', `lvshift` = '$banner_lvshift', `rhshift` = '$banner_rhshift', `rvshift` = '$banner_rvshift', `Position` = '$banner_pos' , `Text` = '$banner_text', `Active` = '$banner_active', Url = '$banner_url', campaign_start = $start_date, campaign_end = $end_date WHERE ID = {$_POST['banner_id']}" );
}
if ( !$demo_mode && $_POST['action'] == 'new' || $_POST['as_new'] == "on" && $_POST['action'] == 'modify' )
{
$banner_title = process_db_input( $_POST['Title'] );
$banner_lhshift = (int)$_POST['lhshift'];
$banner_lvshift = (int)$_POST['lvshift'];
$banner_rhshift = (int)$_POST['rhshift'];
$banner_rvshift = (int)$_POST['rvshift'];
$banner_text = process_db_input( $_POST['Text'] );
$banner_active = ( $_POST['Active'] == 'on' ? 1 : 0 );
$banner_url = process_db_input( $_POST['Url'] );
db_res( "INSERT INTO `Banners` SET `Title` = '$banner_title', `lhshift` = '$banner_lhshift', `lvshift` = '$banner_lvshift', `rhshift` = '$banner_rhshift', `rvshift` = '$banner_rvshift', `Position` = '$banner_pos' , `Text` = '$banner_text', `Active` = '$banner_active', Url = '$banner_url', campaign_start = $start_date, campaign_end = $end_date, `Created` = NOW()" );
}
if ( !$demo_mode && (int)$_GET['banner_id'] && $_GET['action'] == "delete" )
{
$banner_id = (int)$_GET['banner_id'];
db_res( "DELETE FROM `Banners` WHERE ID = $banner_id" );
}
// Get banner info from database.
$q_str = "SELECT * FROM `Banners` ORDER BY `ID` DESC";
$banners_res = db_res( $q_str );
$_page['header'] = "Banners";
$_page['header_text'] = "Manage banners";
TopCodeAdmin();
ContentBlockHead("Preview:");
if ( $_GET['action'] == 'preview' && $_GET['banner_id'] )
{
$bann_arr = db_arr( "SELECT * FROM `Banners` WHERE `ID` = {$_GET['banner_id']}" );
echo "
\n";
echo process_line_output( $bann_arr['Title'] );
echo "". banner_put($bann_arr['ID'], 0) ." |
";
echo "
\n";
}
ContentBlockFoot();
ContentBlockHead("Banners");
if ( !mysql_num_rows( $banners_res ) )
{
echo "No banners available.";
}
else
{
echo "\n";
while ( $banns_arr = mysql_fetch_array( $banners_res ) )
{
$imp = db_arr("SELECT COUNT(*) FROM `BannersShows` WHERE `ID` = {$banns_arr['ID']}");
$clicks = db_arr("SELECT COUNT(*) FROM `BannersClicks` WHERE `ID` = {$banns_arr['ID']}");
if ( !$banns_arr['Active'] )
$class = 'table_err';
else
$class = 'panel';
echo "(Preview | ";
echo "Modify | ";
echo "Delete) ";
echo process_line_output( $banns_arr['Title'] );
echo " | \n";
echo "{$clicks[0]} clicks | \n";
echo "{$imp[0]} impressions | \n";
echo "
\n";
if ( $banns_arr['ID'] == $_GET['banner_id'] && !strlen($_GET['action']) )
{
$action = "modify";
$Title = $banns_arr['Title'];
$Url = $banns_arr['Url'];
$Text = $banns_arr['Text'];
$Active = $banns_arr['Active'];
$Position = $banns_arr['Position'];
$lhshift = $banns_arr['lhshift'];
$lvshift = $banns_arr['lvshift'];
$rhshift = $banns_arr['rhshift'];
$rvshift = $banns_arr['rvshift'];
$start_date = $banns_arr['campaign_start'];
$end_date = $banns_arr['campaign_end'];
}
}
echo "
\n";
}
echo '
';
if ( !$action )
{
$action = "new";
$Title = "";
$Url = "";
$Active = "";
$Text = "";
$Position = "";
$start_date = '';
$end_date = '';
}
ContentBlockFoot();
ContentBlockHead("Manage banners");
?>
ContentBlockFoot();
/*
ContentBlockHead(" ");
?>
For more information on how to place banners on your pages please read our "How to..."
www.aewebworks.com/login/howto.php
* You should write the path to banner image only in this area.
For exmple: <img src="http://www.some_domain/some_path/some_banner">
ContentBlockFoot();
*/
BottomCode();
?>