コード例 #1
0
}
global $current_action;
$current_action = 'edit';
$_GET['id'] = (int) $_GET['id'];
if (isset($_POST['update'])) {
    if (do_edit('adunit', $_POST, $_GET['id'])) {
        global $edited;
        $edited = 1;
        MAD_Admin_Redirect::redirect('edit_ad_unit.php?edited=1&id=' . $_GET['id'] . '');
    } else {
        global $edited;
        $edited = 2;
    }
}
if ($edited != 2) {
    $editdata = get_adunit_detail($_GET['id']);
    $editdata['creative_type'] = $editdata['adv_type'];
    $editdata['custom_creative_width'] = $editdata['adv_width'];
    $editdata['custom_creative_height'] = $editdata['adv_height'];
    $editdata['click_url'] = $editdata['adv_click_url'];
    $editdata['tracking_pixel'] = $editdata['adv_impression_tracking_url'];
    $editdata['creative_url'] = $editdata['adv_bannerurl'];
    $editdata['html_body'] = $editdata['adv_chtml'];
}
require_once MAD_PATH . '/www/cp/templates/header.tpl.php';
?>

    <script language="JavaScript">

        function showadiv(id) {
//safe function to show an element with a specified id
コード例 #2
0
function do_edit($type, $data, $detail)
{
    global $maindb;
    if ($type == 'runninglimit') {
        if (!isset($detail) or !is_numeric($detail)) {
            global $errormessage;
            $errormessage = 'Invalid Campaign ID.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        if (!isset($data['new_limit']) or !is_numeric($data['new_limit'])) {
            global $errormessage;
            $errormessage = 'Invalid Limit entered.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        mysql_query("UPDATE md_campaign_limit set total_amount_left='{$data['new_limit']}' where campaign_id='{$detail}'", $maindb);
        return true;
    }
    if ($type == 'adunit') {
        global $maindb;
        $current_unit_detail = get_adunit_detail($detail);
        if (empty($data['adv_name']) or (!is_numeric($data['custom_creative_width']) or !is_numeric($data['custom_creative_height']))) {
            global $errormessage;
            $errormessage = 'Please fill out all required fields.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        if ($data['creative_type'] == 3) {
            if (empty($data['html_body'])) {
                global $errormessage;
                $errormessage = 'Please enter a HTML body for your ad.';
                global $editdata;
                $editdata = $data;
                return false;
            }
        }
        if ($data['creative_type'] == 2) {
            if (empty($data['creative_url']) or empty($data['click_url'])) {
                global $errormessage;
                $errormessage = 'Please enter a Creative URL and Click URL for your ad.';
                global $editdata;
                $editdata = $data;
                return false;
            }
        }
        if ($data['creative_type'] == 1) {
            if (empty($data['click_url'])) {
                global $errormessage;
                $errormessage = 'Please enter a Click URL for your ad.';
                global $editdata;
                $editdata = $data;
                return false;
            }
            if (!file_exists($_FILES['creative_file']['tmp_name']) || !is_uploaded_file($_FILES['creative_file']['tmp_name'])) {
                $no_creative = 1;
                if ($current_unit_detail['adv_type'] != 1) {
                    global $errormessage;
                    $errormessage = 'Please upload a creative for your ad.';
                    global $editdata;
                    $editdata = $data;
                    return false;
                }
            } else {
                $no_creative = 0;
            }
        }
        // IF CREATIVE TYPE =1, ATTEMPT TO UPLOAD CREATIVE
        if ($data['creative_type'] == 1 && $no_creative != 1) {
            $creative_server = getconfig_var('default_creative_server');
            // Generate Creative Hash
            $uniqid = uniqid(time());
            $creative_hash = md5($uniqid);
            $file_extension = strtolower(substr(strrchr($_FILES['creative_file']['name'], "."), 1));
            // Case: Remote Creative Server (FTP)
            if (getconfig_var('default_creative_server') > 1) {
                list($width, $height, $type, $attr) = getimagesize($_FILES['creative_file']['tmp_name']);
                if ($height != $data['custom_creative_height'] or $width != $data['custom_creative_width'] or empty($file_extension)) {
                    global $errormessage;
                    $errormessage = 'The image you uploaded does not appear to be in the right dimensions. Please upload a valid image sized ' . $data['custom_creative_width'] . 'x' . $data['custom_creative_height'] . '';
                    global $editdata;
                    $editdata = $data;
                    return false;
                }
                $creative_server_detail = get_creativeserver_detail(getconfig_var('default_creative_server'));
                if ($creative_server_detail['entry_id'] < 1) {
                    global $errormessage;
                    $errormessage = 'The default creative server does not seem to exist. Please change your creative server in your mAdserve control panel under Configuration>Creative Servers';
                    global $editdata;
                    $editdata = $data;
                    return false;
                }
                // Attempt: Upload
                include MAD_PATH . '/modules/ftp/ftp.class.php';
                try {
                    $ftp = new Ftp();
                    $ftp->connect($creative_server_detail['remote_host']);
                    $ftp->login($creative_server_detail['remote_user'], $creative_server_detail['remote_password']);
                    $ftp->put($creative_server_detail['remote_directory'] . $creative_hash . '.' . $file_extension, $_FILES['creative_file']['tmp_name'], FTP_BINARY);
                } catch (FtpException $e) {
                    global $errormessage;
                    $errormessage = 'FTP Client was unable to upload creative to remote server. Error given: ' . $e->getMessage() . '';
                    global $editdata;
                    $editdata = $data;
                    return false;
                }
                // End: Upload
            }
            // End Case: Remote Creative Server (FTP)
            // Case: Local Creative Server
            if (getconfig_var('default_creative_server') == 1) {
                include MAD_PATH . '/modules/upload/class.upload.php';
                $handle = new Upload($_FILES['creative_file']);
                $handle->allowed = array('image/*');
                $handle->file_new_name_body = $creative_hash;
                if ($handle->uploaded) {
                    $image_width = $handle->image_src_x;
                    $image_height = $handle->image_src_y;
                    if (!empty($image_width) && !empty($image_height) && ($image_height != $data['custom_creative_height'] or $image_width != $data['custom_creative_width'])) {
                        global $errormessage;
                        $errormessage = 'The image you uploaded does not appear to be in the right dimensions. Please upload an image sized ' . $data['custom_creative_width'] . 'x' . $data['custom_creative_height'] . '';
                        global $editdata;
                        $editdata = $data;
                        return false;
                    }
                    $handle->Process(MAD_PATH . MAD_CREATIVE_DIR);
                    if ($handle->processed) {
                        // OK
                    } else {
                        global $errormessage;
                        $errormessage = 'Creative could not be uploaded. Please check if your creative directory is writeable (' . MAD_CREATIVE_DIR . ') and that you have uploaded a valid image file.';
                        global $editdata;
                        $editdata = $data;
                        return false;
                    }
                } else {
                    // Not OK
                    global $errormessage;
                    $errormessage = 'Creative could not be uploaded. Please check if your creative directory is writeable (' . MAD_CREATIVE_DIR . ') and that you have uploaded a valid image file.';
                    global $editdata;
                    $editdata = $data;
                    return false;
                }
            }
            // End Case: Local Creative Sercer
            mysql_query("UPDATE md_ad_units set unit_hash='{$creative_hash}', adv_creative_extension='{$file_extension}', creativeserver_id='{$creative_server}' where adv_id='{$detail}'", $maindb);
        }
        // END CREATIVE UPLOAD
        if (!isset($data['adv_mraid'])) {
            $data['adv_mraid'] = '';
        }
        $data['creative_type'] = sanitize($data['creative_type']);
        $data['click_url'] = sanitize($data['click_url']);
        $data['html_body'] = sanitize($data['html_body']);
        $data['creative_url'] = sanitize($data['creative_url']);
        $data['tracking_pixel'] = sanitize($data['tracking_pixel']);
        $data['adv_name'] = sanitize($data['adv_name']);
        $data['custom_creative_height'] = sanitize($data['custom_creative_height']);
        $data['custom_creative_width'] = sanitize($data['custom_creative_width']);
        $data['adv_mraid'] = sanitize($data['adv_mraid']);
        mysql_query("UPDATE md_ad_units set adv_type='{$data['creative_type']}', adv_click_url='{$data['click_url']}', adv_chtml='{$data['html_body']}', adv_bannerurl='{$data['creative_url']}', adv_impression_tracking_url='{$data['tracking_pixel']}', adv_name='{$data['adv_name']}', adv_height='{$data['custom_creative_height']}', adv_width='{$data['custom_creative_width']}', adv_mraid='{$data['adv_mraid']}' where adv_id='{$detail}'", $maindb);
        return true;
    }
    if ($type == 'campaign') {
        if (!isset($data['as_values_1'])) {
            $data['as_values_1'] = '';
        }
        if (!isset($data['placement_select'])) {
            $data['placement_select'] = '';
        }
        if (!isset($data['channel_select'])) {
            $data['channel_select'] = '';
        }
        if (!isset($data['target_iphone'])) {
            $data['target_iphone'] = '';
        }
        if (!isset($data['target_ipod'])) {
            $data['target_ipod'] = '';
        }
        if (!isset($data['target_ipad'])) {
            $data['target_ipad'] = '';
        }
        if (!isset($data['target_android'])) {
            $data['target_android'] = '';
        }
        if (!isset($data['target_other'])) {
            $data['target_other'] = '';
        }
        $countries_active = 0;
        $separate_countries = explode(',', $data['as_values_1']);
        foreach ($separate_countries as $my_tag) {
            if (!empty($my_tag)) {
                $countries_active = 1;
            }
        }
        if (!is_numeric($data['campaign_priority']) or empty($data['campaign_name'])) {
            global $errormessage;
            $errormessage = 'Please fill out all required fields.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        if ($data['geo_targeting'] == 2 && $countries_active != 1) {
            global $errormessage;
            $errormessage = 'Please select at least one country you want to target.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        if ($data['publication_targeting'] == 2 && count($data['placement_select']) < 1) {
            global $errormessage;
            $errormessage = 'Please select at least one placement you want to target.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        if ($data['channel_targeting'] == 2 && count($data['channel_select']) < 1) {
            global $errormessage;
            $errormessage = 'Please select at least one channel you want to target.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        if ($data['device_targeting'] == 2 && ($data['target_iphone'] != 1 && $data['target_ipod'] != 1 && $data['target_ipad'] != 1 && $data['target_android'] != 1 && $data['target_other'] != 1)) {
            global $errormessage;
            $errormessage = 'Please select at least one device type you want to target.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        if ($data['campaign_type'] == 'network' && !is_numeric($data['campaign_networkid'])) {
            global $errormessage;
            $errormessage = 'Please select an ad network to send your campaign traffic to.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        if (!empty($data['total_amount']) && !is_numeric($data['total_amount'])) {
            global $errormessage;
            $errormessage = 'Your daily cap needs to be a numeric value.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        if ($data['start_date_type'] == 2 && empty($data['startdate_value'])) {
            global $errormessage;
            $errormessage = 'Please choose a start date for your campaign.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        if ($data['end_date_type'] == 2 && empty($data['enddate_value'])) {
            global $errormessage;
            $errormessage = 'Please choose an end date for your campaign.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        if ($data['start_date_type'] == 2) {
            $start_date = explode('/', $data['startdate_value']);
            $start_date_array['year'] = $start_date[2];
            $start_date_array['day'] = $start_date[1];
            $start_date_array['month'] = $start_date[0];
            $start_date_array['unix'] = strtotime("{$start_date_array['year']}-{$start_date_array['month']}-{$start_date_array['day']}");
        }
        if ($data['end_date_type'] == 2) {
            $end_date = explode('/', $data['enddate_value']);
            $end_date_array['year'] = $end_date[2];
            $end_date_array['day'] = $end_date[1];
            $end_date_array['month'] = $end_date[0];
            $end_date_array['unix'] = strtotime("{$end_date_array['year']}-{$end_date_array['month']}-{$end_date_array['day']}");
        }
        if ($data['end_date_type'] == 2 && $end_date_array['unix'] < time()) {
            global $errormessage;
            $errormessage = 'The end date you entered is in the past. Please choose an end date in the future.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        $creation_timestamp = time();
        /* Date Stuff */
        if ($data['start_date_type'] == 1) {
            $start_date_array['year'] = date("Y");
            $start_date_array['day'] = date("d");
            $start_date_array['month'] = date("m");
        }
        if ($data['end_date_type'] == 1) {
            $end_date_array['year'] = '2090';
            $end_date_array['day'] = '12';
            $end_date_array['month'] = '12';
        }
        if ($data['start_date_type'] == 2) {
            $start_date = explode('/', $data['startdate_value']);
            $start_date_array['year'] = $start_date[2];
            $start_date_array['day'] = $start_date[1];
            $start_date_array['month'] = $start_date[0];
            $start_date_array['unix'] = strtotime("{$start_date_array['year']}-{$start_date_array['month']}-{$start_date_array['day']}");
        }
        if ($data['end_date_type'] == 2) {
            $end_date = explode('/', $data['enddate_value']);
            $end_date_array['year'] = $end_date[2];
            $end_date_array['day'] = $end_date[1];
            $end_date_array['month'] = $end_date[0];
            $end_date_array['unix'] = strtotime("{$end_date_array['year']}-{$end_date_array['month']}-{$end_date_array['day']}");
        }
        $data['startdate_value'] = '' . $start_date_array['year'] . '-' . $start_date_array['month'] . '-' . $start_date_array['day'] . '';
        $data['enddate_value'] = '' . $end_date_array['year'] . '-' . $end_date_array['month'] . '-' . $end_date_array['day'] . '';
        if (!isset($data['target_android'])) {
            $data['target_android'] = '';
        }
        if (!isset($data['target_other'])) {
            $data['target_other'] = '';
        }
        if (!isset($data['target_ipad'])) {
            $data['target_ipad'] = '';
        }
        if (!isset($data['target_iphone'])) {
            $data['target_iphone'] = '';
        }
        if (!isset($data['target_ipod'])) {
            $data['target_ipod'] = '';
        }
        $data['campaign_type'] = sanitize($data['campaign_type']);
        $data['campaign_name'] = sanitize($data['campaign_name']);
        $data['campaign_desc'] = sanitize($data['campaign_desc']);
        $data['startdate_value'] = sanitize($data['startdate_value']);
        $data['enddate_value'] = sanitize($data['enddate_value']);
        $data['campaign_networkid'] = sanitize($data['campaign_networkid']);
        $data['campaign_priority'] = sanitize($data['campaign_priority']);
        $data['target_iphone'] = sanitize($data['target_iphone']);
        $data['target_ipod'] = sanitize($data['target_ipod']);
        $data['target_ipad'] = sanitize($data['target_ipad']);
        $data['target_android'] = sanitize($data['target_android']);
        $data['target_other'] = sanitize($data['target_other']);
        $data['ios_version_min'] = sanitize($data['ios_version_min']);
        $data['ios_version_max'] = sanitize($data['ios_version_max']);
        $data['android_version_min'] = sanitize($data['android_version_min']);
        $data['android_version_max'] = sanitize($data['android_version_max']);
        $data['geo_targeting'] = sanitize($data['geo_targeting']);
        $data['publication_targeting'] = sanitize($data['publication_targeting']);
        $data['channel_targeting'] = sanitize($data['channel_targeting']);
        $data['device_targeting'] = sanitize($data['device_targeting']);
        global $maindb;
        mysql_query("UPDATE md_campaigns set campaign_type='{$data['campaign_type']}', campaign_name='{$data['campaign_name']}', campaign_desc='{$data['campaign_desc']}', campaign_start='{$data['startdate_value']}', campaign_end='{$data['enddate_value']}', campaign_networkid='{$data['campaign_networkid']}', campaign_priority='{$data['campaign_priority']}', target_iphone='{$data['target_iphone']}', target_ipod='{$data['target_ipod']}', target_ipad='{$data['target_ipad']}', target_android='{$data['target_android']}', target_other='{$data['target_other']}', ios_version_min='{$data['ios_version_min']}', ios_version_max='{$data['ios_version_max']}', android_version_min='{$data['android_version_min']}', android_version_max='{$data['android_version_max']}', country_target='{$data['geo_targeting']}', publication_target='{$data['publication_targeting']}', channel_target='{$data['channel_targeting']}', device_target='{$data['device_targeting']}' where campaign_id='{$detail}'", $maindb);
        reset_campaign_targeting($detail);
        // Extra Targeting Variables
        // Country
        if ($data['geo_targeting'] == 2) {
            $separate_countries = explode(',', $data['as_values_1']);
            foreach ($separate_countries as $country_tag) {
                if (!empty($country_tag)) {
                    // Add Country
                    add_campaign_targeting($detail, 'geo', $country_tag);
                }
            }
        }
        //End Country
        // Channel
        if ($data['channel_targeting'] == 2 && is_array($data['channel_select'])) {
            foreach ($data['channel_select'] as $channel_id) {
                add_campaign_targeting($detail, 'channel', $channel_id);
            }
        }
        // End Channel
        // Placement
        if ($data['publication_targeting'] == 2 && is_array($data['placement_select'])) {
            foreach ($data['placement_select'] as $placement_id) {
                add_campaign_targeting($detail, 'placement', $placement_id);
            }
        }
        // End Placement
        // End: Extra Targeting Variables
        mysql_query("UPDATE md_campaign_limit set cap_type='{$data['cap_type']}', total_amount='{$data['total_amount']}', total_amount_left='{$data['total_amount']}' where campaign_id='{$detail}'", $maindb);
        return true;
    }
    if ($type == 'user') {
        global $user_detail;
        if (!check_permission('add_administrator', $user_detail['user_id']) && $data['account_type'] != 2) {
            global $errormessage;
            $errormessage = 'You are not permitted to a group other than the Advertiser group.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        if (empty($data['first_name']) or empty($data['last_name']) or empty($data['email_address'])) {
            global $errormessage;
            $errormessage = 'Please fill out all required fields.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        if (!empty($data['new_password']) && $data['new_password_2'] != $data['new_password']) {
            global $errormessage;
            $errormessage = 'The passwords you entered do not match.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        $data['email_address'] = strtolower($data['email_address']);
        $data['first_name'] = sanitize($data['first_name']);
        $data['last_name'] = sanitize($data['last_name']);
        $data['company_name'] = sanitize($data['company_name']);
        $data['phone_number'] = sanitize($data['phone_number']);
        $data['fax_number'] = sanitize($data['fax_number']);
        $data['company_address'] = sanitize($data['company_address']);
        $data['company_city'] = sanitize($data['company_city']);
        $data['company_state'] = sanitize($data['company_state']);
        $data['company_zip'] = sanitize($data['company_zip']);
        $data['company_country'] = sanitize($data['company_country']);
        $data['tax_id'] = sanitize($data['tax_id']);
        mysql_query("UPDATE md_uaccounts set first_name='{$data['first_name']}', last_name='{$data['last_name']}', email_address='{$data['email_address']}', account_type='{$data['account_type']}', company_name='{$data['company_name']}', phone_number='{$data['phone_number']}', fax_number='{$data['fax_number']}', company_address='{$data['company_address']}', company_city='{$data['company_city']}', company_state='{$data['company_state']}', company_zip='{$data['company_zip']}', company_country='{$data['company_country']}', tax_id='{$data['tax_id']}' where user_id='{$detail}'", $maindb);
        if (!empty($data['new_password'])) {
            $data['password_md5'] = md5($data['new_password']);
            mysql_query("UPDATE md_uaccounts set pass_word='{$data['password_md5']}' where user_id='{$detail}'", $maindb);
        }
        return true;
    }
    if ($type == 'group') {
        if (empty($data['group_name'])) {
            global $errormessage;
            $errormessage = 'Please enter a group name.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        $data['group_name'] = sanitize($data['group_name']);
        mysql_query("UPDATE md_user_groups set group_name='{$data['group_name']}' where entry_id='{$detail}'", $maindb);
        return true;
    }
    if ($type == 'channel') {
        if (empty($data['channel_name'])) {
            global $errormessage;
            $errormessage = 'Please enter a channel name.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        $data['channel_name'] = sanitize($data['channel_name']);
        mysql_query("UPDATE md_channels set channel_name='{$data['channel_name']}' where channel_id='{$detail}'", $maindb);
        return true;
    }
    if ($type == 'network') {
        if (!isset($data['network_auto_approve'])) {
            $data['network_auto_approve'] = '';
        }
        if (!isset($data['network_aa_min'])) {
            $data['network_aa_min'] = '';
        }
        if (!isset($data['network_aa_min_cpc'])) {
            $data['network_aa_min_cpc'] = '';
        }
        if (!isset($data['network_aa_min_cpm'])) {
            $data['network_aa_min_cpm'] = '';
        }
        $data['network_auto_approve'] = sanitize($data['network_auto_approve']);
        $data['network_aa_min'] = sanitize($data['network_aa_min']);
        $data['network_aa_min_cpc'] = sanitize($data['network_aa_min_cpc']);
        $data['network_aa_min_cpm'] = sanitize($data['network_aa_min_cpm']);
        mysql_query("UPDATE md_networks set network_auto_approve='{$data['network_auto_approve']}', network_aa_min='{$data['network_aa_min']}', network_aa_min_cpc='{$data['network_aa_min_cpc']}', network_aa_min_cpm='{$data['network_aa_min_cpm']}' where entry_id='{$detail}'", $maindb);
        return true;
    }
    if ($type == 'creative_server') {
        if (empty($data['server_name']) or empty($data['remote_host']) or empty($data['remote_user']) or empty($data['remote_password']) or empty($data['remote_directory']) or empty($data['server_default_url'])) {
            global $errormessage;
            $errormessage = 'Please fill out all required fields.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        $data['server_type'] = sanitize($data['server_type']);
        $data['server_name'] = sanitize($data['server_name']);
        $data['remote_host'] = sanitize($data['remote_host']);
        $data['remote_user'] = sanitize($data['remote_user']);
        $data['remote_password'] = sanitize($data['remote_password']);
        $data['remote_directory'] = sanitize($data['remote_directory']);
        $data['server_default_url'] = sanitize($data['server_default_url']);
        mysql_query("UPDATE md_creative_servers set server_name='{$data['server_name']}', remote_host='{$data['remote_host']}', remote_user='******'remote_user']}', remote_password='******'remote_password']}', server_type='{$data['server_type']}', remote_directory='{$data['remote_directory']}', server_default_url='{$data['server_default_url']}' where entry_id='{$detail}'", $maindb);
        return true;
    }
    if ($type == 'placement') {
        if (!isset($data['mobfox_min_cpc_active'])) {
            $data['mobfox_min_cpc_active'] = '';
        }
        if (!isset($data['mobfox_backfill_active'])) {
            $data['mobfox_backfill_active'] = '';
        }
        if (!is_numeric($data['zone_refresh']) or empty($data['zone_name']) or $data['zone_type'] == 'banner' && (!is_numeric($data['custom_zone_width']) or !is_numeric($data['custom_zone_height'])) or empty($data['zone_type'])) {
            global $errormessage;
            $errormessage = 'Please fill out all required fields.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        if ($data['mobfox_min_cpc_active'] == 1 && (!is_numeric($data['min_cpc']) or !is_numeric($data['min_cpm']) or $data['min_cpm'] > 5 or $data['min_cpc'] > 0.2)) {
            global $errormessage;
            $errormessage = 'Invalid minimum CPC/CPM values entered.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        $zone_detail = get_zone_detail($detail);
        $publication_detail = get_publication_detail($zone_detail['publication_id']);
        if ($publication_detail['inv_type'] == 3 && $data['zone_type'] == 'interstitial') {
            global $errormessage;
            $errormessage = 'Full Page Interstitials are supported only inside iOS and Android applications.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        $data['zone_name'] = sanitize($data['zone_name']);
        $data['zone_type'] = sanitize($data['zone_type']);
        $data['custom_zone_width'] = sanitize($data['custom_zone_width']);
        $data['custom_zone_height'] = sanitize($data['custom_zone_height']);
        $data['zone_refresh'] = sanitize($data['zone_refresh']);
        $data['zone_channel'] = sanitize($data['zone_channel']);
        $data['zone_description'] = sanitize($data['zone_description']);
        $data['mobfox_backfill_active'] = sanitize($data['mobfox_backfill_active']);
        $data['mobfox_min_cpc_active'] = sanitize($data['mobfox_min_cpc_active']);
        $data['min_cpc'] = sanitize($data['min_cpc']);
        $data['min_cpm'] = sanitize($data['min_cpm']);
        $data['backfill_alt_1'] = sanitize($data['backfill_alt_1']);
        $data['backfill_alt_2'] = sanitize($data['backfill_alt_2']);
        $data['backfill_alt_3'] = sanitize($data['backfill_alt_3']);
        mysql_query("UPDATE md_zones set zone_name='{$data['zone_name']}', zone_type='{$data['zone_type']}', zone_width='{$data['custom_zone_width']}', zone_height='{$data['custom_zone_height']}', zone_refresh='{$data['zone_refresh']}', zone_channel='{$data['zone_channel']}', zone_description='{$data['zone_description']}', mobfox_backfill_active='{$data['mobfox_backfill_active']}', mobfox_min_cpc_active='{$data['mobfox_min_cpc_active']}', min_cpc='{$data['min_cpc']}', min_cpm='{$data['min_cpm']}', backfill_alt_1='{$data['backfill_alt_1']}', backfill_alt_2='{$data['backfill_alt_2']}', backfill_alt_3='{$data['backfill_alt_3']}' where entry_id='{$detail}'", $maindb);
        return true;
    }
    if ($type == 'publication') {
        if (empty($data['inv_name']) or !is_numeric($data['inv_type']) or empty($data['inv_address']) or !is_numeric($data['inv_defaultchannel'])) {
            global $errormessage;
            $errormessage = 'Please fill out all required fields.';
            global $editdata;
            $editdata = $data;
            return false;
        }
        $data['inv_type'] = sanitize($data['inv_type']);
        $data['inv_name'] = sanitize($data['inv_name']);
        $data['inv_description'] = sanitize($data['inv_description']);
        $data['inv_address'] = sanitize($data['inv_address']);
        $data['inv_defaultchannel'] = sanitize($data['inv_defaultchannel']);
        mysql_query("UPDATE md_publications set inv_type='{$data['inv_type']}', inv_name='{$data['inv_name']}', inv_description='{$data['inv_description']}', inv_address='{$data['inv_address']}', inv_defaultchannel='{$data['inv_defaultchannel']}' where inv_id='{$detail}'", $maindb);
        return true;
    }
}