Esempio n. 1
0
function adrotate_manage_group()
{
    global $wpdb, $adrotate_config, $adrotate_debug;
    $status = $view = $group_edit_id = '';
    if (isset($_GET['status'])) {
        $status = esc_attr($_GET['status']);
    }
    if (isset($_GET['view'])) {
        $view = esc_attr($_GET['view']);
    }
    if (isset($_GET['group'])) {
        $group_edit_id = esc_attr($_GET['group']);
    }
    if (isset($_GET['month']) and isset($_GET['year'])) {
        $month = esc_attr($_GET['month']);
        $year = esc_attr($_GET['year']);
    } else {
        $month = date("m");
        $year = date("Y");
    }
    $monthstart = mktime(0, 0, 0, $month, 1, $year);
    $monthend = mktime(0, 0, 0, $month + 1, 0, $year);
    $today = adrotate_date_start('day');
    $now = adrotate_now();
    $today = adrotate_date_start('day');
    $in2days = $now + 172800;
    $in7days = $now + 604800;
    ?>
	<div class="wrap">
		<h1><?php 
    _e('Group Management', 'adrotate');
    ?>
</h1>

		<?php 
    if ($status > 0) {
        adrotate_status($status);
    }
    ?>

		<?php 
    if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "adrotate_groups';") and $wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "adrotate_linkmeta';")) {
        ?>
			<div class="tablenav">
				<div class="alignleft actions">
					<a class="row-title" href="<?php 
        echo admin_url('/admin.php?page=adrotate-groups&view=manage');
        ?>
"><?php 
        _e('Manage', 'adrotate');
        ?>
</a> | 
					<a class="row-title" href="<?php 
        echo admin_url('/admin.php?page=adrotate-groups&view=addnew');
        ?>
"><?php 
        _e('Add New', 'adrotate');
        ?>
</a>
					<?php 
        if ($group_edit_id and $adrotate_config['stats'] == 1) {
            ?>
					| <a class="row-title" href="<?php 
            echo admin_url('/admin.php?page=adrotate-groups&view=report&group=' . $group_edit_id);
            ?>
"><?php 
            _e('Report', 'adrotate');
            ?>
</a>
					<?php 
        }
        ?>
				</div>
			</div>

	    	<?php 
        if ($view == "" or $view == "manage") {
            ?>

				<?php 
            include "dashboard/publisher/groups-main.php";
            ?>

		   	<?php 
        } else {
            if ($view == "addnew" or $view == "edit") {
                ?>

				<?php 
                include "dashboard/publisher/groups-edit.php";
                ?>

		   	<?php 
            } else {
                if ($view == "report") {
                    ?>

				<?php 
                    include "dashboard/publisher/groups-report.php";
                    ?>

		   	<?php 
                }
            }
        }
        ?>
		<?php 
    } else {
        ?>
			<?php 
        echo adrotate_error('db_error');
        ?>
		<?php 
    }
    ?>
		<br class="clear" />

		<?php 
    adrotate_credits();
    ?>

	</div>
<?php 
}
Esempio n. 2
0
function adrotate_preview($banner_id)
{
    global $wpdb, $adrotate_debug;
    if ($banner_id) {
        $now = adrotate_now();
        $banner = $wpdb->get_row($wpdb->prepare("SELECT * FROM `{$wpdb->prefix}adrotate` WHERE `id` = %d;", $banner_id));
        if ($adrotate_debug['general'] == true) {
            echo "<p><strong>[DEBUG][adrotate_preview()] Ad information</strong><pre>";
            print_r($banner);
            echo "</pre></p>";
        }
        if ($banner) {
            $image = str_replace('%folder%', '/wp-content/banners/', $banner->image);
            $output = adrotate_ad_output($banner->id, 0, $banner->title, $banner->bannercode, $banner->tracker, $image, 'N');
        } else {
            $output = adrotate_error('ad_expired');
        }
    } else {
        $output = adrotate_error('ad_no_id');
    }
    return $output;
}
Esempio n. 3
0
function adrotate_fallback($group, $case, $site = 0)
{
    $fallback_output = '';
    if ($group > 0) {
        $fallback_output = adrotate_group($group, 0, 0, $site);
    } else {
        if ($case == 'expired') {
            $fallback_output = adrotate_error('ad_expired');
        }
        if ($case == 'unqualified') {
            $fallback_output = adrotate_error('ad_unqualified');
        }
    }
    return $fallback_output;
}