function adrotate_moderate()
{
    global $wpdb, $current_user, $userdata, $adrotate_config, $adrotate_debug;
    $status = $view = $ad_edit_id = '';
    if (isset($_GET['status'])) {
        $status = esc_attr($_GET['status']);
    }
    if (isset($_GET['view'])) {
        $view = esc_attr($_GET['view']);
    }
    if (isset($_GET['ad'])) {
        $ad_edit_id = esc_attr($_GET['ad']);
    }
    $now = adrotate_now();
    $today = adrotate_date_start('day');
    $in2days = $now + 172800;
    $in7days = $now + 604800;
    $in84days = $now + 7257600;
    ?>
	<div class="wrap">
		<h1><?php 
    _e('Moderation queue', 'adrotate-pro');
    ?>
</h1>

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

		<?php 
    $allbanners = $wpdb->get_results("SELECT `id`, `title`, `type`, `tracker`, `mobile`, `tablet`, `crate`, `budget`, `irate`, `weight` FROM `{$wpdb->prefix}adrotate` WHERE `type` = 'queue' OR `type` = 'reject' ORDER BY `id` ASC;");
    $queued = $rejected = false;
    foreach ($allbanners as $singlebanner) {
        $starttime = $stoptime = 0;
        $starttime = $wpdb->get_var("SELECT `starttime` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = '" . $singlebanner->id . "' AND `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` ORDER BY `starttime` ASC LIMIT 1;");
        $stoptime = $wpdb->get_var("SELECT `stoptime` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = '" . $singlebanner->id . "' AND `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` ORDER BY `stoptime` DESC LIMIT 1;");
        if ($singlebanner->type == 'queue') {
            $queued[$singlebanner->id] = array('id' => $singlebanner->id, 'title' => $singlebanner->title, 'type' => $singlebanner->type, 'tracker' => $singlebanner->tracker, 'mobile' => $singlebanner->mobile, 'tablet' => $singlebanner->tablet, 'weight' => $singlebanner->weight, 'budget' => $singlebanner->budget, 'crate' => $singlebanner->crate, 'irate' => $singlebanner->irate, 'firstactive' => $starttime, 'lastactive' => $stoptime);
        }
        if ($singlebanner->type == 'reject') {
            $rejected[$singlebanner->id] = array('id' => $singlebanner->id, 'title' => $singlebanner->title, 'type' => $singlebanner->type, 'tracker' => $singlebanner->tracker, 'mobile' => $singlebanner->mobile, 'tablet' => $singlebanner->tablet, 'weight' => $singlebanner->weight, 'firstactive' => $starttime, 'lastactive' => $stoptime);
        }
    }
    ?>

    	<?php 
    if ($view == "" or $view == "manage") {
        // Show list of queued ads
        include "dashboard/publisher/moderation-queue.php";
        // Show rejected ads, if any
        if ($rejected) {
            include "dashboard/publisher/moderation-rejected.php";
        }
    } else {
        if ($view == "message") {
            $wpnonceaction = 'adrotate_moderate_' . $request_id;
            if (wp_verify_nonce($_REQUEST['_wpnonce'], $wpnonceaction)) {
                include "dashboard/publisher/moderation-message.php";
            } else {
                adrotate_nonce_error();
                exit;
            }
        }
    }
    ?>
		<br class="clear" />

		<?php 
    adrotate_credits();
    ?>

		<br class="clear" />
	</div>
<?php 
}
Beispiel #2
0
function adrotate_manage_media()
{
    global $wpdb, $adrotate_config;
    ?>

	<div class="wrap">
		<h1><?php 
    _e('Media Management available in AdRotate Pro', 'adrotate');
    ?>
</h1>

		<p><?php 
    _e('Upload images to the AdRotate Pro banners folder from here.', 'adrotate');
    ?>
 <br /> <?php 
    _e('This is useful if you use responsive adverts with multiple images or have HTML5 adverts containing multiple files.', 'adrotate');
    ?>
<br /><?php 
    _e('Media uploading and management is available in AdRotate Pro.', 'adrotate');
    ?>
 <a href="admin.php?page=adrotate-pro"><?php 
    _e('More information', 'adrotate');
    ?>
</a>.</p>

		<h3><?php 
    _e('Upload new file', 'adrotate');
    ?>
</h3>
		<label for="adrotate_image"><input tabindex="1" type="file" name="adrotate_image" disabled /><br /><em><strong><?php 
    _e('Accepted files:', 'adrotate');
    ?>
</strong> jpg, jpeg, gif, png, swf and flv. <?php 
    _e('For HTML5 ads you can also upload html and javascript files.', 'adrotate');
    ?>
 <?php 
    _e('Maximum size is 512Kb.', 'adrotate');
    ?>
</em><br /><em><strong><?php 
    _e('Important:', 'adrotate');
    ?>
</strong> <?php 
    _e('Make sure your file has no spaces or special characters in the name. Replace spaces with a - or _.', 'adrotate');
    ?>
<br /><?php 
    _e('If you remove spaces from filenames for HTML5 adverts also edit the html file so it knows about the changed name. For example for the javascript file.', 'adrotate');
    ?>
</em></label>
	
		<?php 
    if (get_option('adrotate_responsive_required') > 0) {
        ?>
	        <p><em><?php 
        _e('For responsive adverts make sure the filename is in the following format; "imagename.full.ext". A full set of sized images is strongly recommended.', 'adrotate');
        ?>
</em><br />
	        <em><?php 
        _e('For smaller size images use ".320", ".480", ".768" or ".1024" in the filename instead of ".full" for the various viewports.', 'adrotate');
        ?>
</em><br />
	        <em><strong><?php 
        _e('Example:', 'adrotate');
        ?>
</strong> <?php 
        _e('image.full.jpg, image.320.jpg and image.768.jpg will serve the same advert for different viewports.', 'adrotate');
        ?>
</em></p>
		<?php 
    }
    ?>
	
		<p class="submit">
			<input tabindex="2" type="submit" name="adrotate_media_submit" class="button-primary" value="<?php 
    _e('Upload file', 'adrotate');
    ?>
" disabled /> <em><?php 
    _e('Click only once per file!', 'adrotate');
    ?>
</em>
		</p>
		
		<h3><?php 
    _e('Available files in', 'adrotate');
    ?>
 '<?php 
    echo $adrotate_config['banner_folder'];
    ?>
'</h3>
		<table class="widefat" style="margin-top: .5em">
		
			<thead>
			<tr>
		        <th><?php 
    _e('Name', 'adrotate');
    ?>
</th>
		        <th width="12%"><center><?php 
    _e('Actions', 'adrotate');
    ?>
</center></th>
			</tr>
			</thead>
		
			<tbody>
		    <tr><td>your-awesome-campaign.jpg</td><td><center><?php 
    _e('Delete', 'adrotate');
    ?>
</center></td></tr>
		    <tr class="alternate"><td>728x90-advert.jpg</td><td><center><?php 
    _e('Delete', 'adrotate');
    ?>
</center></td></tr>
		    <tr><td>adrotate-468x60.jpg</td><td><center><?php 
    _e('Delete', 'adrotate');
    ?>
</center></td></tr>
		    <tr class="alternate"><td>html5-468x60-blue_edge.js</td><td><center><?php 
    _e('Delete', 'adrotate');
    ?>
</center></td></tr>
		    <tr><td>html5-468x60-blue.html</td><td><center><?php 
    _e('Delete', 'adrotate');
    ?>
</center></td></tr>
		    <tr class="alternate"><td>adrotate-200x200-blue.jpg</td><td><center><?php 
    _e('Delete', 'adrotate');
    ?>
</center></td></tr>
		    <tr><td>advertising-campaign.jpg</td><td><center><?php 
    _e('Delete', 'adrotate');
    ?>
</center></td></tr>
			</tbody>
		</table>
		<p><center>
			<?php 
    _e("Make sure the banner images are not in use by adverts when you delete them!", "adrotate");
    ?>
<br /><?php 
    _e('Manage your banner folder from here with AdRotate Pro.', 'adrotate');
    ?>
 <a href="admin.php?page=adrotate-pro"><?php 
    _e('Upgrade today!', 'adrotate');
    ?>
</a>

		</center></p>

		<br class="clear" />

		<?php 
    adrotate_credits();
    ?>

		<br class="clear" />
	</div>
<?php 
}
Beispiel #3
0
function adrotate_manage_group()
{
    global $wpdb, $userdata;
    $message = $_GET['message'];
    if ($_GET['edit_group']) {
        $group_edit_id = $_GET['edit_group'];
    }
    ?>

	<div class="wrap">
		<h2>Banner groups</h2>

		<?php 
    if ($message == 'created') {
        ?>
			<div id="message" class="updated fade"><p>Group <strong>created</strong>.</p></div>
		<?php 
    } else {
        if ($message == 'updated') {
            ?>
			<div id="message" class="updated fade"><p>Group <strong>updated</strong>.</p></div>
		<?php 
        } else {
            if ($message == 'deleted') {
                ?>
			<div id="message" class="updated fade"><p>Group <strong>deleted</strong>.</p></div>
		<?php 
            } else {
                if ($message == 'deleted_banners') {
                    ?>
			<div id="message" class="updated fade"><p>Group <strong>deleted</strong>. Including all <strong>ads</strong> that were in that group.</p></div>
		<?php 
                }
            }
        }
    }
    ?>

		<?php 
    if (!$group_edit_id) {
        ?>
			<form name="groups" id="post" method="post" action="admin.php?page=adrotate4">
	    	<input type="hidden" name="adrotate_action" value="group_delete" />

			<div class="tablenav">

				<div class="alignleft">
					<select name='adrotate_action' id='cat' class='postform' >
				        <option value="">Bulk Actions</option>
				        <option value="group_delete">Delete Group</option>
				        <option value="group_delete_banners">Delete Group including ads</option>
					</select>
					<input type="submit" id="post-action-submit" value="Go" class="button-secondary" />
				</div>
			</div>

		   	<table class="widefat" style="margin-top: .5em">
	  			<thead>
	  				<tr>
						<th scope="col" class="check-column">&nbsp;</th>
						<th scope="col" width="5%"><center>ID</center></th>
						<th scope="col">Name</th>
						<th scope="col" width="10%"><center>Fallback</center></th>
						<th scope="col" width="10%"><center>Banners</center></th>
					</tr>
	  			</thead>
				<tbody>
	  			
			<?php 
        if (adrotate_mysql_table_exists($wpdb->prefix . 'adrotate_groups')) {
            ?>
				<?php 
            $groups = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "adrotate_groups` ORDER BY `id`");
            if ($groups) {
                foreach ($groups as $group) {
                    $banners_in_group = $wpdb->get_var("SELECT COUNT(*) FROM `" . $wpdb->prefix . "adrotate` WHERE `group` = {$group->id}");
                    $class = 'alternate' != $class ? 'alternate' : '';
                    ?>
					    <tr id='group-<?php 
                    echo $group->id;
                    ?>
' class=' <?php 
                    echo $class;
                    ?>
'>
							<th scope="row" class="check-column"><input type="checkbox" name="groupcheck[]" value="<?php 
                    echo $group->id;
                    ?>
" /></th>
							<td><center><?php 
                    echo $group->id;
                    ?>
</center></td>
							<td><strong><a class="row-title" href="<?php 
                    echo get_option('siteurl') . '/wp-admin/admin.php?page=adrotate4&amp;edit_group=' . $group->id;
                    ?>
" title="Edit"><?php 
                    echo $group->name;
                    ?>
</a></strong></td>
							<td><center><?php 
                    if ($group->fallback == 0) {
                        echo "No";
                    } else {
                        echo $group->fallback;
                    }
                    ?>
</center></td>
							<td><center><?php 
                    echo $banners_in_group;
                    ?>
</center></td>
						</tr>
		 			<?php 
                }
                ?>
				<?php 
            } else {
                ?>
					<tr id='no-groups'>
						<th scope="row" class="check-column">&nbsp;</th>
						<td colspan="3"><em>No groups created yet!</em></td>
					</tr>
				<?php 
            }
            ?>
			<?php 
        } else {
            ?>
				<tr id='no-id'><td scope="row" colspan="4"><span style="font-weight: bold; color: #f00;">There was an error locating the database table for the AdRotate groups. Please deactivate and re-activate AdRotate from the plugin page!!<br />If this does not solve the issue please seek support at <a href="http://meandmymac.net/support/">http://meandmymac.net support</a></span></td></tr>
			<?php 
        }
        ?>
	 			</tbody>
			</table>

			<br class="clear" />

		   	<table class="widefat" style="margin-top: .5em">
	  			<thead>
	  				<tr>
						<th scope="col" colspan="2">Create a new group</th>
					</tr>
	  			</thead>
				<tbody>
	  			
			<?php 
        if (adrotate_mysql_table_exists($wpdb->prefix . 'adrotate_groups')) {
            ?>
				<?php 
            $groups = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "adrotate_groups` ORDER BY `id`");
            ?>
				    <tr id='group-new'>
						<th scope="row">Name:</th>
						<td><input tabindex="1" name="adrotate_group" type="text" class="search-input" size="40" value="" autocomplete="off" /></td>
					</tr>
				    <tr id='group-new'>
						<th scope="row">Fallback ads?</th>
						<td><select name="adrotate_fallback">
				        <option value="0">No</option>
					<?php 
            if ($groups and count($groups) > 1) {
                ?>
						<?php 
                foreach ($groups as $group) {
                    ?>
					        <option value="<?php 
                    echo $group->id;
                    ?>
"><?php 
                    echo $group->id;
                    ?>
 - <?php 
                    echo $group->name;
                    ?>
</option>
			 			<?php 
                }
                ?>
					<?php 
            }
            ?>
						</select> <em>You need atleast two groups to use this feature!</em></td>
					</tr>
					
			<?php 
        } else {
            ?>
				<tr id='no-id'><td scope="row" colspan="4"><span style="font-weight: bold; color: #f00;">There was an error locating the database table for the AdRotate groups. Please deactivate and re-activate AdRotate from the plugin page!!<br />If this does not solve the issue please seek support at <a href="http://meandmymac.net/support/">http://meandmymac.net support</a></span></td></tr>
			<?php 
        }
        ?>
	 			</tbody>
			</table>
			
	    	<p class="submit">
				<input tabindex="3" type="submit" name="adrotate_group_submit" class="button-primary" value="Add Group" />
				<a href="admin.php?page=adrotate4" class="button">Cancel</a>
	    	</p>

			</form>

			<br class="clear" />
			<?php 
        adrotate_credits();
        ?>

		<?php 
    } else {
        ?>

			<?php 
        $edit_group = $wpdb->get_row("SELECT * FROM `" . $wpdb->prefix . "adrotate_groups` WHERE `id` = '{$group_edit_id}'");
        $groups = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "adrotate_groups` ORDER BY `id`");
        if ($message == 'field_error') {
            ?>
				<div id="message" class="updated fade"><p>Please fill in a name for your group!</p></div>
			<?php 
        }
        if ($group_edit_id > 0) {
            ?>
			  	<form method="post" action="admin.php?page=adrotate4">
			    	<input type="hidden" name="adrotate_id" value="<?php 
            echo $group_edit_id;
            ?>
" />

			    	<table class="widefat" style="margin-top: .5em">

						<thead>
						<tr valign="top">
							<th colspan="2" bgcolor="#DDD">You can change the name of the group here. The ID stays the same!</th>
						</tr>
						</thead>

						<tbody>
				      	<tr>
					        <th scope="row" width="25%">ID:</th>
					        <td><?php 
            echo $edit_group->id;
            ?>
</td>
				      	</tr>
				      	<tr>
					        <th scope="row" width="25%">Name:</th>
					        <td><input tabindex="1" name="adrotate_group" type="text" size="67" class="search-input" autocomplete="off" value="<?php 
            echo $edit_group->name;
            ?>
" /></td>
				      	</tr>
				      	<tr>
					        <th scope="row" width="25%">Fallback ads:</th>
					        <td><select name="adrotate_fallback">
						        <option value="0">No</option>
							<?php 
            if ($groups and count($groups) > 1) {
                ?>
								<?php 
                foreach ($groups as $group) {
                    ?>
							        <option value="<?php 
                    echo $group->id;
                    ?>
" <?php 
                    if ($group->id == $group_edit_id) {
                        echo 'disabled';
                    }
                    ?>
 <?php 
                    if ($group->id == $edit_group->fallback) {
                        echo 'selected';
                    }
                    ?>
><?php 
                    echo $group->id;
                    ?>
 - <?php 
                    echo $group->name;
                    ?>
</option>
					 			<?php 
                }
                ?>
							<?php 
            }
            ?>
								</select> <em>You need atleast two groups to use this feature!</em>
							</td>
				      	</tr>
				      	</tbody>

					</table>

			    	<p class="submit">
						<input tabindex="2" type="submit" name="adrotate_group_submit" class="button-primary" value="Save Group" />
						<a href="admin.php?page=adrotate4" class="button">Cancel</a>
			    	</p>

			  	</form>
			<?php 
        } else {
            ?>
			    <table class="widefat" style="margin-top: .5em">
			    	<thead>
					<tr valign="top">
						<th>Error!</th>
					</tr>
					</thead>

					<tbody>
			      	<tr>
				        <td>No valid group ID specified! <a href="admin.php?page=adrotate4">Continue</a>.</td>
			      	</tr>
			      	</tbody>
				</table>
			<?php 
        }
        ?>
		<?php 
    }
    ?>
	</div>
<?php 
}