'.__('General Info', 'adrotate'), __('General Info', 'adrotate'), 'adrotate_ad_manage', 'adrotate', 'adrotate_info');
$adrotate_pro = add_submenu_page('adrotate', 'AdRotate > '.__('AdRotate Pro', 'adrotate'), __('AdRotate Pro', 'adrotate'), 'adrotate_ad_manage', 'adrotate-pro', 'adrotate_pro');
$adrotate_adverts = add_submenu_page('adrotate', 'AdRotate > '.__('Manage Ads', 'adrotate'), __('Manage Ads', 'adrotate'), 'adrotate_ad_manage', 'adrotate-ads', 'adrotate_manage');
$adrotate_groups = add_submenu_page('adrotate', 'AdRotate > '.__('Manage Groups', 'adrotate'), __('Manage Groups', 'adrotate'), 'adrotate_group_manage', 'adrotate-groups', 'adrotate_manage_group');
$adrotate_schedules = add_submenu_page('adrotate', 'AdRotate Pro > '.__('Manage Schedules', 'adrotate'), __('Manage Schedules', 'adrotate'), 'adrotate_ad_manage', 'adrotate-schedules', 'adrotate_manage_schedules');
$adrotate_media = add_submenu_page('adrotate', 'AdRotate Pro > '.__('Manage Media', 'adrotate'), __('Manage Media', 'adrotate'), 'adrotate_ad_manage', 'adrotate-media', 'adrotate_manage_media');
$adrotate_settings = add_submenu_page('adrotate', 'AdRotate > '.__('Settings', 'adrotate'), __('Settings', 'adrotate'), 'manage_options', 'adrotate-settings', 'adrotate_options');
// Add help tabs
add_action('load-'.$adrotate_page, 'adrotate_help_info');
add_action('load-'.$adrotate_pro, 'adrotate_help_info');
add_action('load-'.$adrotate_adverts, 'adrotate_help_info');
add_action('load-'.$adrotate_groups, 'adrotate_help_info');
add_action('load-'.$adrotate_schedules, 'adrotate_help_info');
add_action('load-'.$adrotate_media, 'adrotate_help_info');
add_action('load-'.$adrotate_settings, 'adrotate_help_info');
}
/*-------------------------------------------------------------
Name: adrotate_info
Purpose: Admin general info page
Receive: -none-
Return: -none-
-------------------------------------------------------------*/
function adrotate_info() {
global $wpdb, $adrotate_advert_status;
?>
get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate';") AND $wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate_groups';") AND $wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate_schedule';") AND $wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate_linkmeta';")) { ?>
get_results("SELECT `id`, `title`, `type`, `tracker`, `weight` FROM `".$wpdb->prefix."adrotate` WHERE `type` = 'active' OR `type` = 'error' OR `type` = 'expired' OR `type` = '2days' OR `type` = '7days' OR `type` = 'disabled' ORDER BY `sortorder` ASC, `id` ASC;");
$activebanners = $errorbanners = $disabledbanners = 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;");
$type = $singlebanner->type;
if($type == 'active' AND $stoptime <= $in7days) $type = '7days';
if($type == 'active' AND $stoptime <= $in2days) $type = '2days';
if($type == 'active' AND $stoptime <= $now) $type = 'expired';
if($type == 'active' OR $type == '7days') {
$activebanners[$singlebanner->id] = array(
'id' => $singlebanner->id,
'title' => $singlebanner->title,
'type' => $type,
'tracker' => $singlebanner->tracker,
'weight' => $singlebanner->weight,
'firstactive' => $starttime,
'lastactive' => $stoptime
);
}
if($type == 'error' OR $type == 'expired' OR $type == '2days') {
$errorbanners[$singlebanner->id] = array(
'id' => $singlebanner->id,
'title' => $singlebanner->title,
'type' => $type,
'tracker' => $singlebanner->tracker,
'weight' => $singlebanner->weight,
'firstactive' => $starttime,
'lastactive' => $stoptime
);
}
if($type == 'disabled') {
$disabledbanners[$singlebanner->id] = array(
'id' => $singlebanner->id,
'title' => $singlebanner->title,
'type' => $type,
'tracker' => $singlebanner->tracker,
'weight' => $singlebanner->weight,
'firstactive' => $starttime,
'lastactive' => $stoptime
);
}
}
?>
get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate_groups';") AND $wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate_linkmeta';")) { ?>