Warning: include_once(/home/dcs/public_html/assets/snippets/AdsManager/AdsManager.inc.php) [function.include-once]: failed to open stream: No such file or directory in /home/dcs/public_html/manager/processors/execute_module.processor.php(98) : eval()'d code on line 30 Warning: include_once() [function.include]: Failed opening '/home/dcs/public_html/assets/snippets/AdsManager/AdsManager.inc.php' for inclusion (include_path='/home/dcs/public_html/manager/includes/') in /home/dcs/public_html/manager/processors/execute_module.processor.php(98) : eval()'d code on line 30 Fatal error: Class 'AdsManager' not found in /home/dcs/public_html/manager/processors/execute_module.processor.php(98) : eval()'d code on line 32
CODE ZIXO: Graphical advertisement manegement Warning! Ads manager is not yet installed. During the installation process, 3 mysql tables will be created and a folder for banner placement [/assets/snipplets/AdsManager/banners].
//<?
//////////////////////////////////////////////////////
//
// AdsManager by CODE ZIXO
//
// GPL license
//
/////////////////////////////////////////////////////
global $theme;
global $_lang;
global $siteURL;
global $base_path;
$basePath = $modx->config['base_path'];
$siteURL = $modx->config['site_url'];
//-- get theme
$tb_prefix = $modx->db->config['table_prefix'];
$theme = $modx->db->select('setting_value', '`' . $tb_prefix . 'system_settings`', 'setting_name=\'manager_theme\'', '');
$theme = $modx->db->getRow($theme);
$theme = ($theme['setting_value'] <> '') ? '/' . $theme['setting_value'] : '';
//-- setup initial vars
$output = '';
//-- include php files
include_once $base_path.'manager/includes/controls/datagrid.class.php';
include_once $base_path.'assets/snippets/adsmanager/adsmanager.inc.php';
$rotator = new AdsManager();
//-- get POST vars
$mode = (isset ($_POST['mode'])) ? (int)$_POST['mode'] : 1;
$id = (isset ($_POST['idd'])) ? (int)$_POST['idd'] : 1;
$from = (isset ($_POST['from'])) ? $_POST['from'] : '';
$to = (isset ($_POST['to'])) ? $_POST['to'] : '';
//-- process POST actions if required
$output .= ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html '.($modx->config['manager_direction'] == 'rtl' ? 'dir="rtl"' : '').' lang="'.$modx->config['manager_lang_attribute'].'" xml:lang="'.$modx->config['manager_lang_attribute'].'">
<head>
<title>Ads management</title>
<script type="text/javascript">var MODX_MEDIA_PATH = "media";</script>
<link rel="stylesheet" type="text/css" href="media/style' . $theme . '/style.css" />
<link rel="stylesheet" type="text/css" href="media/style' . $theme . '/coolButtons2.css" />
<link rel="stylesheet" type="text/css" href="media/style' . $theme . '/tabs.css"/>
<link rel="stylesheet" type="text/css" href="../assets/snippets/adsmanager/datepicker.css"/>
<script type="text/javascript" src="../assets/snippets/adsmanager/MooTools.js"></script>
<script type="text/javascript" src="../assets/snippets/adsmanager/DatePicker.js"></script>
<script type="text/javascript">
function goto(id)
{
$("mode").value = id;
$("ussr").submit();
}
function edit(id)
{
$("idd").value = id;
goto(3);
}
function save()
{
goto(4);
}
function add()
{
goto(6);
}
function banner_delete()
{
if (confirm("Are you sure ?"))
{
goto(9);
}
}
function set_dates(begin, end)
{
$("from").value = begin;
$("to").value = end;
}
</script>
</head><body><form name="ussr" id="ussr" method="post" action="#" enctype="multipart/form-data" style="padding:30px;">';
$output .= '
<div class="sectionHeader"><h2><a href="http://code.zixo.ru/">CODE ZIXO:</a> Graphical advertisement manegement</h2></div>
<div class="sectionBody">
';
if ($mode != 8)
if (!($rotator->db_table_exists($rotator->db_prefix.'ads'))) { $mode = 7; }
if ($mode == 1) { /// active banners list
if (isset($_POST['from'])) {
$start = $_POST['from'];
} else {$start = "2008-01-01";}
if (isset($_POST['to'])) {
$end = $_POST['to'];
} else {$end = date('Y-m-d');}
$output.=
"
<h2>List of enabled banners</h2>
Form
<input type='text' name='from' id='from' class='DatePicker'
alt='{format:\"yyyy-mm-dd\", yearStart:2015, yearRange:10, yearOrder: \"desc\"}'
value='$start' />
to
<input type='text' name='to' id='to' class='DatePicker'
alt='{format:\"yyyy-mm-dd\", yearStart:2015, yearRange:10, yearOrder: \"desc\"}'
value='$end' />
<input type='hidden' name='idd' id='idd'>
<input type='hidden' name='mode' id='mode'>
<input type='button' value='Update' onclick='javascript:goto(1);'>
<br /><br />
<table class='grid'>
<tr>
<td class='gridHeader'>Name</td>
<td class='gridHeader'>Tags</td>
<td class='gridHeader'>Views</td>
<td class='gridHeader'>Clicks</td>
<td class='gridHeader'>CTR</td>
</tr>
";
if (isset($_POST['from'])) {
$stat = $rotator->get_banner_stats($start, $end, '1');
} else {
$stat = $rotator->get_banner_stats('', '', '1');
}
foreach ($stat as $s)
{
$output .= "
<tr>
<td><a href='javascript:edit(\"".$s['id']."\");'>".$s['title']."</a></td>
<td>".$s['tags']."</td>
<td>".$s['bshow']."</td>
<td>".$s['bclick']."</td>
<td>".$s['ctr']."</td>
</tr>
";
}
$output .= '</table>';
$output .= '<br /><br/> <input type="button" value="Add banner" onclick="javascript:goto(5);">';
$output .= '<input type="button" value="List of disabled baners" onclick="javascript:set_dates(\'\', \'\');goto(2);">';
} else if ($mode == 2) { /// disabled banners
if (isset($_POST['from'])) {
$start = $_POST['from'];
} else {$start = "2008-01-01";}
if (isset($_POST['to'])) {
$end = $_POST['to'];
} else {$end = date('Y-m-d');}
$output.=
"
<h2>Disabled list</h2>
Form
<input type='text' name='from' id='from' class='DatePicker'
alt='{format:\"yyyy-mm-dd\", yearStart:2015, yearRange:10, yearOrder: \"desc\"}'
value='$start' />
to
<input type='text' name='to' id='to' class='DatePicker'
alt='{format:\"yyyy-mm-dd\", yearStart:2015, yearRange:10, yearOrder: \"desc\"}'
value='$end' />
<input type='hidden' name='idd' id='idd'>
<input type='hidden' name='mode' id='mode'>
<input type='button' value='Update' onclick='javascript:goto(2);'>
<br /><br />
<table class='grid'>
<tr>
<td class='gridHeader'>Name</td>
<td class='gridHeader'>Tags</td>
<td class='gridHeader'>Views</td>
<td class='gridHeader'>Clicks</td>
<td class='gridHeader'>CTR</td>
</tr>
";
if (isset($_POST['from'])) {
$stat = $rotator->get_banner_stats($start, $end, '0');
} else {
$stat = $rotator->get_banner_stats('', '', '0');
}
foreach ($stat as $s)
{
$output .= "
<tr>
<td><a href='javascript:edit(\"".$s['id']."\");'>".$s['title']."</a></td>
<td>".$s['filter']."</td>
<td>".$s['bshow']."</td>
<td>".$s['bclick']."</td>
<td>".$s['ctr']."</td>
</tr>
";
}
$output .= '</table>';
$output .= '<br /><br/> <input type=button value="Add" onclick="javascript:goto(5);">';
$output .= '<input type=button value="List of enabled banners" onclick="set_dates(\'\', \'\');javascript:goto(1);">';
} else if ($mode == 3) { /// edit
$banner = $rotator->get_banner($id);
$img = $banner['img'];
$filter = $banner['filter'];
$link = $banner['link'];
$title = $banner['title'];
$width = $banner['width'];
$height = $banner['height'];
$active = $banner['active'];
$output .=
"
<input type='hidden' name='idd' id='idd' value='$id'>
<input type='hidden' name='mode' id='mode'>
<input type='hidden' name='active' id='active' value='$active'>
<img src='$img' alt='not found'><br /><br />
<table class=grid>
<tr><td class='gridHeader'>Image:</td><td> <input type='text' name='img' id='img' value='$img' size='60' /></tr>
<tr><td class='gridHeader'>Title:</td><td> <input type='text' name='title' id='title' value='$title' /></tr>
<tr><td class='gridHeader'>Link:</td><td> <input type='text' name='link' id='link' value='$link' size='60' /></tr>
<tr><td class='gridHeader'>Width:</td><td> <input type=text name=width id=width value='$width' /></tr>
<tr><td class='gridHeader'>Height:</td><td> <input type='text' name='height' id='height' value='$height' /></tr>
<tr><td class='gridHeader'>Tags:</td><td> <input type='text' name='filter' id='filter' value='$filter' /></tr>
</table><br /><br />
<h3>Clicks</h3>
<table class='grid'>
<tr>
<td class='gridHeader'>Date:</td>
<td class='gridHeader'>IP:</td>
</tr>
";
$output .= $rotator->show_clicks($id);
$output .=
"
</table><br /><br />
<input type='button' onclick='save();' value='Save'>
";
if ($active == '1')
{
$output .= "<input type='button' onclick='$(\"active\").value=\"0\"; save();' value='Disable'>";
} else {
$output .= "<input type='button' onclick='$(\"active\").value=\"1\"; save();' value='Enable'>";
}
if ($active == '0')
{ $output .= '<input type="button" value="Delete" onclick="javascript:banner_delete();"><br /><br/> ';}
$output .= "<input type='button' onclick='goto(1);' value='Go back'>";
} else if ($mode == 4) { /// save
$img = $_POST['img'];
$filter = $_POST['filter'];
$link = $_POST['link'];
$title = $_POST['title'];
$width = $_POST['width'];
$height = $_POST['height'];
$active = $_POST['active'];
$rotator->save_banner($id, $title, $img, $width, $height, $link, $active, $filter);
echo "
<input type='hidden' name='mode' id='mode' value='1'>
<script type='text/javascript'>$('ussr').submit();</script>
";
} else if ($mode == 5) { /// new
$output .=
"
<input type='hidden' name='mode' id='mode'>
<input type='hidden' name='active' id='active' value='1'>
<table class='grid'>
<tr><th>Image (GIF, PNG, JPG, SWF):</th><td> <input type='text' name='img' id='img' size='60' /><br \>
<input type='hidden' name='MAX_FILE_SIZE' value='100000' />
<input name='userfile' type='file' />
</tr>
<tr><td class='gridHeader'>Width:</td><td> <input type=text name=width id=width></tr>
<tr><td class='gridHeader'>Height:</td><td> <input type=text name=height id=height></tr>
<tr><td class='gridHeader'>Title:</td><td> <input type=text name=title id=title></tr>
<tr><td class='gridHeader'>Link:</td><td> <input type=text name=link id=link size=60></tr>
<tr><td class='gridHeader'>Tags:</td><td> <input type=text name=filter id=filter></tr>
</table><br /><br />
<input type=button onclick='add();' value='Save'>
<input type=button onclick='goto(1);' value='Go back'>
";
} else if ($mode == 6) { // save new
$baseURL = $_SERVER['REQUEST_URI'];
$baseURL = substr($baseURL, 0, strpos($baseURL, '/manager/'));
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
$img = $rotator->banners_path . '/' . $_FILES['userfile']['name'];
$dir = $basePath . $img;
move_uploaded_file($_FILES['userfile']['tmp_name'], $dir );
} else {
$baseURL = '';
$img = $_POST['img'];
}
if (file_exists($dir))
{
$filter = $_POST['filter'];
$link = $_POST['link'];
$title = $_POST['title'];
$width = $_POST['width'];
$height = $_POST['height'];
$active = $_POST['active'];
$rotator->add_banner($title, $baseURL.$img, $width, $height, $link, $active, $filter);
echo "
<input type='hidden' name='mode' id='mode' value='1'>
<script type='text/javascript'>$('ussr').submit();</script>
";
} else {
echo "
<input type='hidden' name='mode' id='mode' value='1'>
<h2>Cannot add banner! Check if [/assets/snipplets/adsmanager/banners]
exist and if it is writeable!
</h2>
<input type='button' onclick='goto(8);' value='Go back'>
";
}
} else if ($mode == 7) { // prepare for install
$output .= '<h2>Warning! Ads manager is not yet installed.</h2>
<input type="hidden" name="mode" id="mode" />
<p>
During the installation process, three mysql tables will be created and a folder for
banner placement [/assets/snipplets/adsmanager/banners]. <br /><br />
<input type="button" onclick="goto(8);" value="Start the installation" />
</p>
';
// $output .= $rotator->install();
} else if ($mode == 8) { // installation
$output .= '<h2>Installation finished!</h2>
<p>Please, make sure the [/assets/snipplets/adsmanager/banners] is writeable!</p>
<input type="hidden" name="mode" id="mode" /><br /><br />
';
$output .= $rotator->install();
$output .= '<br /><br />
<input type="button" onclick="goto(1);" value="Go to the Ads Manager" />
';
} else if ($mode == 9) { // delete
$rotator->delete_banner($id);
echo "
<input type='hidden' name='mode' id='mode' value='1' />
<script type='text/javascript'>$('ussr').submit();</script>
";
}
$output.='</div></form></body></html>';
return $output;
//?>Possibly another idea for the future could be vertical and horizontal options, that way you could run sets and an ad group would grab only from one type of ad, just thinking out laud.I mentioned that earlier too but I’d say that’s what the unfinished tags/filters are for which would be a more flexible option.
If you use something like Adblock Plus, you’ll need to whitelist any website you’re using this with because resources won’t link up due to ad-stripping.I’m just RQ this as it’s why some would have had problems earlier with buttons not working.
... Any news on this?... I would hate to tinker with adding such options, if someone else is allready doing the job.
Quote from: islander at Feb 14, 2009, 05:03 AMPossibly another idea for the future could be vertical and horizontal options, that way you could run sets and an ad group would grab only from one type of ad, just thinking out laud.I mentioned that earlier too but I’d say that’s what the unfinished tags/filters are for which would be a more flexible option.