execute($sql); return $res->fields['total']; } /* get banner ad counts */ public function advCount_banner($for) { global $db; switch ($for) { case "backend-menu-entry7-sub1":$db_add_query = "WHERE `adv_group` IN(1, 2)"; break; case "backend-menu-entry7-sub2":$db_add_query = "WHERE `adv_group` IN(7, 8, 9, 10, 11, 12)"; break; case "backend-menu-entry7-sub3":$db_add_query = "WHERE `adv_group` IN(13, 14, 15)"; break; case "backend-menu-entry7-sub4":$db_add_query = "WHERE `adv_group` IN(16, 17, 18, 19, 20, 49)"; break; case "backend-menu-entry7-sub5":$db_add_query = "WHERE `adv_group` IN(21, 22, 23, 24)"; break; case "backend-menu-entry7-sub6":$db_add_query = "WHERE `adv_group` IN(25, 26, 27, 28)"; break; case "backend-menu-entry7-sub7":$db_add_query = "WHERE `adv_group` IN(29, 30, 31, 32, 33, 34)"; break; case "backend-menu-entry7-sub8":$db_add_query = "WHERE `adv_group` IN(35, 36)"; break; case "backend-menu-entry7-sub9":$db_add_query = "WHERE `adv_group` IN(37, 38)"; break; case "backend-menu-entry7-sub10":$db_add_query = "WHERE `adv_group` IN(39, 40)"; break; case "backend-menu-entry7-sub11":$db_add_query = "WHERE `adv_group` IN(41, 42)"; break; case "backend-menu-entry7-sub12":$db_add_query = "WHERE `adv_group` IN(43, 44)"; break; case "backend-menu-entry7-sub13":$db_add_query = "WHERE `adv_group` IN(45, 46, 47, 48)"; break; case "backend-menu-entry7-sub14":$db_add_query = "WHERE `adv_group` IN(50, 51, 52, 53, 54, 55)"; break; default:break; } $sql = sprintf("SELECT COUNT(*) AS `total` FROM `db_advbanners` %s", $db_add_query); $res = $db->execute($sql); return $res->fields['total']; } /* main ad group details */ public function mainAdvBannerDetails($_dsp = '', $entry_id = '', $db_id = '', $ad_state = '', $ad_name = '', $ad_desc = '', $ad_type = '', $ad_group = '', $ad_code = '') { global $class_filter; if ($_POST and ($_GET['do'] == 'add' or $_GET['do'] == 'update')) { $ad_set = self::processBannerEntry(); if ($_GET['do'] == 'add' and !$ad_set) { $entryid = (int) $_POST['hc_id']; $ad_type = "adv_type_" . $entryid; $ad_name = $class_filter->clr_str($_POST['frontend_global_name']); $ad_desc = $class_filter->clr_str($_POST['backend_menu_members_entry1_sub2_entry_desc']); $ad_group = intval($_POST['adv_group_ids']); $ad_code = $_POST['backend_adv_text_code']; } } return self::advBannerDetails($_dsp, $entry_id, $db_id, $ad_state, $ad_name, $ad_desc, $ad_type, $ad_group, $ad_code); } /* main jw files details */ public function mainAdvCodeDetails($_dsp = '', $entry_id = '', $db_id = '', $db_state = '', $db_type = '', $db_name = '', $db_key = '', $db_code = '') { global $class_filter; if ($_POST and ($_GET['do'] == 'add' or $_GET['do'] == 'update')) { $ad_set = self::processJWfileEntry(); if ($_GET['do'] == 'add' and !$ad_set) { $db_name = $class_filter->clr_str($_POST['frontend_global_name']); $db_type = $class_filter->clr_str($_POST['jw_type']); $db_code = $class_filter->clr_str($_POST['backend_adv_file_code']); } } return self::JWadvCodes($_dsp, $entry_id, $db_id, $db_state, $db_type, $db_name, $db_key, $db_code); } /* main videojs ad entries details */ public function vjsAdvAdDetails($_dsp = '', $entry_id = '', $ad_id = '', $ad_state = '', $ad_name = '', $ad_key = '', $ad_type = '', $ad_position = '', $ad_offset = '', $ad_duration = '', $ad_client = '', $ad_format = '', $ad_server = '', $ad_file = '', $ad_tag = '', $ad_comp_div = '', $ad_comp_id = '', $ad_comp_w = '', $ad_comp_h = '', $ad_click_track = '', $ad_click_url = '', $ad_track_events = '', $ad_impressions = '', $ad_clicks = '', $ad_primary = '', $ad_mobile = '', $ad_custom = '', $ad_custom_url = '', $ad_skip = '') { global $class_filter; if ($_POST and ($_GET['do'] == 'add' or $_GET['do'] == 'update')) { $ad_set = self::processVJSadEntry(); if ($_GET['do'] == 'add' and !$ad_set) { $entryid = (int) $_POST['hc_id']; $ad_client = "vjs_client_" . $entryid; $ad_custom = "vjs_custom_" . $entryid; $ad_type = "vjs_type_" . $entryid; $ad_name = $class_filter->clr_str($_POST['frontend_global_name']); $ad_tag = $_POST['backend_adv_vjs_tag']; $ad_custom_url = $_POST['backend_adv_vjs_clickthrough']; $ad_mobile = (int) $_POST['backend_adv_vjs_ad_mobile']; $ad_comp_div = intval($_POST['backend_adv_vjs_ad_comp']); $ad_skip = intval($_POST['backend_adv_jw_skip']); $ad_comp_id = $class_filter->clr_str($_POST['backend_adv_vjs_ad_comp_unit']); $ad_comp_w = intval($_POST['backend_adv_vjs_ad_comp_width']); $ad_comp_h = intval($_POST['backend_adv_vjs_ad_comp_height']); } } echo $jw_ads = VGenerate::declareJS('$(document).ready(function(){' . self::VJSadvDetailsJS() . '});'); return self::VJSadvDetails($_dsp, $entry_id, $db_id, $ad_state, $ad_name, $ad_key, $ad_type, $ad_position, $ad_offset, $ad_duration, $ad_client, $ad_format, $ad_server, $ad_file, $ad_width, $ad_height, $ad_bitrate, $ad_tag, $ad_comp_div, $ad_comp_id, $ad_comp_w, $ad_comp_h, $ad_click_track, $ad_click_url, $ad_impressions, $ad_clicks, $ad_primary, $ad_mobile, $ad_custom, $ad_custom_url, $ad_skip); } /* main jw ad entries details */ public function mainAdvAdDetails($_dsp = '', $entry_id = '', $ad_id = '', $ad_state = '', $ad_name = '', $ad_key = '', $ad_type = '', $ad_position = '', $ad_offset = '', $ad_duration = '', $ad_client = '', $ad_format = '', $ad_server = '', $ad_file = '', $ad_tag = '', $ad_comp_div = '', $ad_comp_id = '', $ad_comp_w = '', $ad_comp_h = '', $ad_click_track = '', $ad_click_url = '', $ad_track_events = '', $ad_impressions = '', $ad_clicks = '', $ad_primary = '') { global $class_filter; if ($_POST and ($_GET['do'] == 'add' or $_GET['do'] == 'update')) { $ad_set = self::processJWadEntry(); if ($_GET['do'] == 'add' and !$ad_set) { $entryid = (int) $_POST['hc_id']; $jw_client = "jw_client_" . $entryid; $ad_type = "jw_type_" . $entryid; $jw_format = "jw_format_" . $entryid; $jw_server = "jw_server_" . $entryid; $jw_file = "jw_file_" . $entryid; $jw_position = "jw_position_" . $entryid; $ad_name = $class_filter->clr_str($_POST['frontend_global_name']); $ad_position = $class_filter->clr_str($_POST[$jw_position]); $ad_offset = intval($_POST['backend_adv_jw_offset']); $ad_duration = floatval($_POST['backend_adv_jw_duration']); $ad_client = $class_filter->clr_str($_POST[$jw_client]); $ad_format = $class_filter->clr_str($_POST[$jw_format]); $ad_server = $class_filter->clr_str($_POST[$jw_server]); $ad_file = $class_filter->clr_str($_POST[$jw_file]); $ad_width = $class_filter->clr_str($_POST['backend_adv_jw_width']); $ad_height = $class_filter->clr_str($_POST['backend_adv_jw_height']); $ad_bitrate = $class_filter->clr_str($_POST['backend_adv_jw_bitrate']); $ad_tag = $_POST['backend_adv_jw_tag']; $ad_comp_div = intval($_POST['backend_adv_jw_ad_comp']); $ad_comp_id = $class_filter->clr_str($_POST['backend_adv_jw_ad_comp_id']); $ad_comp_w = intval($_POST['backend_adv_jw_ad_comp_w']); $ad_comp_h = intval($_POST['backend_adv_jw_ad_comp_h']); $ad_click_track = intval($_POST['backend_adv_jw_clicktracking']); $ad_click_url = $_POST['backend_adv_jw_clickthrough']; } } echo $jw_ads = VGenerate::declareJS('$(document).ready(function(){' . self::JWadvDetailsJS() . '});'); return self::JWadvDetails($_dsp, $entry_id, $db_id, $ad_state, $ad_name, $ad_key, $ad_type, $ad_position, $ad_offset, $ad_duration, $ad_client, $ad_format, $ad_server, $ad_file, $ad_width, $ad_height, $ad_bitrate, $ad_tag, $ad_comp_div, $ad_comp_id, $ad_comp_w, $ad_comp_h, $ad_click_track, $ad_click_url, $ad_impressions, $ad_clicks, $ad_primary); } /* main fp ad entries details */ public function fpAdvAdDetails($_dsp = '', $entry_id = '', $ad_id = '', $ad_state = '', $ad_name = '', $ad_key = '', $ad_cuepoint = '', $ad_file = '') { global $class_filter; if ($_POST and ($_GET['do'] == 'add' or $_GET['do'] == 'update')) { $ad_set = self::processFPadEntry(); if ($_GET['do'] == 'add' and !$ad_set) { $ad_name = $class_filter->clr_str($_POST['frontend_global_name']); $ad_cuepoint = $class_filter->clr_str($_POST['backend_adv_fp_cuepoint']); $ad_file = $class_filter->clr_str($_POST['fp_file']); } } echo $jw_ads = VGenerate::declareJS('$(document).ready(function(){' . self::JWadvDetailsJS() . '});'); return self::FPadvDetails($_dsp, $entry_id, $db_id, $ad_state, $ad_name, $ad_key, $ad_cuepoint, $ad_file); } /* player ads, count menu entries */ public function playerAdCount($for) { global $db; switch ($for) { case "ad_codes": $tbl = 'db_jwadcodes'; break; case "vjs_ads": $tbl = 'db_vjsadentries'; break; case "jw_ads": $tbl = 'db_jwadentries'; break; case "fp_ads": $tbl = 'db_fpadentries'; break; } $t = $db->execute(sprintf("SELECT COUNT(*) AS `total` FROM `%s`;", $tbl)); return $t->fields['total']; } /* jwplayer files, codes */ public function JWadvCodes($_dsp = '', $entry_id = '', $db_id = '', $db_state = '', $db_type = '', $db_name = '', $db_key = '', $db_code = '') { global $class_filter, $language; $_init = VbeEntries::entryInit($_dsp, $db_id, $entry_id); $_dsp = $_init[0]; $_btn = $_GET['do'] != 'add' ? VGenerate::simpleDivWrap('left-float', '', VGenerate::basicInput('button', 'save_changes', 'save-entry-button button-grey search-button form-button ' . ($_GET['do'] == 'add' ? 'new-entry' : 'update-entry'), '', $entry_id, '' . ($_GET['do'] == 'add' ? $language['frontend.global.savenew'] : $language['frontend.global.saveupdate']) . ''), 'display: inline-block-off;') : null; $_sel1 = ''; $html .= '
'; $html .= ''; return $html; } /* ad file upload/update */ public function beAdvFileUpload() { global $class_filter, $cfg, $db, $language; $ufn = $_FILES['jw_adfile']['name']; $upload_file_type = strtoupper(VFileinfo::getExtension($ufn)); $upload_file_orig = md5($_FILES['jw_adfile']['name']) . '.' . strtolower($upload_file_type); $upload_file_name = $class_filter->clr_str($_FILES['jw_adfile']['tmp_name']); $upload_in = $cfg['player_dir'] . '/ad_files/'; $upload_dst = $upload_in . $upload_file_orig; $upload_allowed = array('FLV', 'MP4', 'WEBM', 'SWF', 'GIF', 'JPG', 'JPEG', 'PNG'); $error_message = !in_array($upload_file_type, $upload_allowed) ? $language['notif.error.invalid.request'] : null; echo $show_error = $error_message != '' ? VGenerate::noticeTpl('', $error_message, '') : null; echo $clear_input = $error_message != '' ? VGenerate::declareJS('$(\'input[name$="jw_adfile"]\').val("");') : null; if ($error_message == '') { $db_id = intval($_POST['hc_id']); $f = $db->execute(sprintf("SELECT `db_code` FROM `db_jwadcodes` WHERE `db_type`='file' AND `db_id`='%s' LIMIT 1;", $db_id)); if (file_exists($upload_dst)) {@unlink($upload_dst);} if ($f->fields['db_code'] != '' and file_exists($upload_in . $f->fields['db_code'])) { @unlink($upload_in . $f->fields['db_code']); } if (rename($upload_file_name, $upload_dst)) { @chmod($upload_dst, 0644); $db->execute(sprintf("UPDATE `db_jwadcodes` SET `db_code`='%s' WHERE `db_id`='%s' LIMIT 1;", $upload_file_orig, $db_id)); echo VGenerate::declareJS('$("#adfilename' . $db_id . '").html("' . $upload_file_orig . '");'); echo VGenerate::noticeTpl('', '', $language['notif.success.request']); } } } /* videojs ad details, edit */ public function VJSadvDetails($_dsp = '', $entry_id = '', $db_id = '', $ad_state = '', $ad_name = '', $ad_key = '', $ad_type = '', $ad_position = '', $ad_offset = '', $ad_duration = '', $ad_client = '', $ad_format = '', $ad_server = '', $ad_file = '', $ad_width = '', $ad_height = '', $ad_bitrate = '', $ad_tag = '', $ad_comp_div = '', $ad_comp_id = '', $ad_comp_w = '', $ad_comp_h = '', $ad_click_track = '', $ad_click_url = '', $ad_track_events = '', $ad_impressions = '', $ad_clicks = '', $ad_primary = '', $ad_mobile = '', $ad_custom = '', $ad_custom_url = '', $ad_skip = '') { global $class_filter, $language, $db; $_init = VbeEntries::entryInit($_dsp, $db_id, $entry_id); $_dsp = $_init[0]; $int_id = (int) $db_id; $_btn = $_GET['do'] != 'add' ? VGenerate::simpleDivWrap('left-float', '', VGenerate::basicInput('button', 'save_changes', 'save-entry-button button-grey search-button form-button ' . ($_GET['do'] == 'add' ? 'new-entry' : 'update-entry'), '', $entry_id, '' . ($_GET['do'] == 'add' ? $language['frontend.global.savenew'] : $language['frontend.global.saveupdate']) . ''), 'display: inline-block-off;') : null; $_sel0 = ''; $_sel1 = ''; $sql = sprintf("SELECT `db_key`, `db_type`, `db_name`, `db_code` FROM `db_jwadcodes` WHERE `db_active`='1';"); $res = $db->execute($sql); if ($res->fields['db_key']) { $_sel2 = ''; } $html .= ''; return $html; } public function VJSadvDetailsJS() { $js = 'var dsrc = "' . ($_GET['do'] == 'add' ? '#mem-add-new-entry-' : '#ct-entry-details1-') . '";'; return $js; } /* jwplayer ad details, edit */ public function JWadvDetails($_dsp = '', $entry_id = '', $db_id = '', $ad_state = '', $ad_name = '', $ad_key = '', $ad_type = '', $ad_position = '', $ad_offset = '', $ad_duration = '', $ad_client = '', $ad_format = '', $ad_server = '', $ad_file = '', $ad_width = '', $ad_height = '', $ad_bitrate = '', $ad_tag = '', $ad_comp_div = '', $ad_comp_id = '', $ad_comp_w = '', $ad_comp_h = '', $ad_click_track = '', $ad_click_url = '', $ad_track_events = '', $ad_impressions = '', $ad_clicks = '', $ad_primary = '') { global $class_filter, $language, $db; $_init = VbeEntries::entryInit($_dsp, $db_id, $entry_id); $_dsp = $_init[0]; $int_id = (int) $db_id; $af = $db->execute("SELECT `db_key`, `db_name`, `db_code` FROM `db_jwadcodes` WHERE `db_type`='file' AND `db_active`='1';"); $_btn = $_GET['do'] != 'add' ? VGenerate::simpleDivWrap('left-float', '', VGenerate::basicInput('button', 'save_changes', 'save-entry-button button-grey search-button form-button ' . ($_GET['do'] == 'add' ? 'new-entry' : 'update-entry'), '', $entry_id, '' . ($_GET['do'] == 'add' ? $language['frontend.global.savenew'] : $language['frontend.global.saveupdate']) . ''), 'display: inline-block-off;') : null; $_sel0 = ''; $_sel1 = ''; $_sel2 = ''; $ad_srv = explode(',', $language['backend.adv.jw.server.list']); $_sel3 = ''; $ad_evt = explode(',', $language['backend.adv.jw.events']); $_sel5 = null; foreach ($ad_evt as $b) { $_sel5 .= VGenerate::simpleDivWrap('row top-padding3', '', VGenerate::simpleDivWrap('left-float lh20', '', '') . VGenerate::simpleDivWrap('left-float lh20 wd50', '', $b)); } $_sel4 = ''; if ($af->fields['db_key']) { $_sel6 = ''; } $html .= ''; return $html; } /* banner ad details, edit */ public function advBannerDetails($_dsp = '', $entry_id = '', $db_id = '', $ad_state = '', $ad_name = '', $ad_desc = '', $ad_type = '', $ad_group = '', $ad_code = '') { global $class_filter, $language; $_init = VbeEntries::entryInit($_dsp, $db_id, $entry_id); $_date = date('D, m/d/Y, H:i:s A', strtotime($dc_date)); $_dsp = $_init[0]; $_btn = $_GET['do'] != 'add' ? VGenerate::simpleDivWrap('left-float', '', VGenerate::basicInput('button', 'save_changes', 'save-entry-button button-grey search-button form-button ' . ($_GET['do'] == 'add' ? 'new-entry' : 'update-entry'), '', $entry_id, '' . ($_GET['do'] == 'add' ? $language['frontend.global.savenew'] : $language['frontend.global.saveupdate']) . '')) : null; $_sel0 = ''; $html .= ''; $html .= VGenerate::declareJS('$(function(){SelectList.init("adv_group_ids_' . ((int) $db_id) . '");SelectList.init("adv_type_' . ((int) $db_id) . '");});'); return $html; } /* flowplayer ad details, edit */ public function FPadvDetails($_dsp = '', $entry_id = '', $db_id = '', $ad_state = '', $ad_name = '', $ad_key = '', $ad_cuepoint = '', $ad_css = '', $ad_file = '') { global $class_filter, $language, $db; $_init = VbeEntries::entryInit($_dsp, $db_id, $entry_id); $_date = date('D, m/d/Y, H:i:s A', strtotime($dc_date)); $_dsp = $_init[0]; $int_id = (int) $db_id; $af = $db->execute("SELECT `db_key`, `db_type`, `db_name`, `db_code` FROM `db_jwadcodes` WHERE `db_type`='code' AND `db_active`='1';"); $_btn = $_GET['do'] != 'add' ? VGenerate::simpleDivWrap('left-float', '', VGenerate::basicInput('button', 'save_changes', 'save-entry-button button-grey search-button form-button ' . ($_GET['do'] == 'add' ? 'new-entry' : 'update-entry'), '', $entry_id, '' . ($_GET['do'] == 'add' ? $language['frontend.global.savenew'] : $language['frontend.global.saveupdate']) . ''), 'display: inline-block-off;') : null; if ($af->fields['db_key']) { $_sel6 = ''; } $html .= ''; $html .= VGenerate::declareJS('$(function(){SelectList.init("fp_file_' . $int_id . '");});'); return $html; } public function JWadvDetailsJS() { $js = 'var dsrc = "' . ($_GET['do'] == 'add' ? '#mem-add-new-entry-' : '#ct-entry-details1-') . '";'; $js .= '$(".ad-client").change(function(){'; $js .= 'var aid = $(this).attr("rel-id");'; $js .= 'var aval = $(this).val();'; $js .= 'if(aval == "vast"){'; $js .= 'if($(dsrc+aid+" .ad-server").val() == "custom"){'; $js .= '$(dsrc+aid+" .ad-off, "+dsrc+aid+" .ad-server").prop("disabled", false);'; $js .= '} else {'; $js .= '$(dsrc+aid+" .ad-server").prop("disabled", false);'; $js .= '}'; $js .= '} else {'; $js .= '$(dsrc+aid+" .ad-off, "+dsrc+aid+" .ad-server").prop("disabled", true);'; $js .= '}'; $js .= '});'; $js .= '$(".ad-position").change(function(){'; $js .= 'var aid = $(this).attr("rel-id");'; $js .= 'var aval = $(this).val();'; $js .= 'if(aval == "offset"){'; $js .= '$(dsrc+aid+" .ad-offset").prop("disabled", false);'; $js .= '} else {'; $js .= '$(dsrc+aid+" .ad-offset").prop("disabled", true);'; $js .= '}'; $js .= '});'; $js .= '$(".ad-server").change(function(){'; $js .= 'var aid = $(this).attr("rel-id");'; $js .= 'var aval = $(this).val();'; $js .= 'if(aval == "custom"){'; $js .= '$(dsrc+aid+" .ad-off").prop("disabled", false);'; $js .= '} else {'; $js .= '$(dsrc+aid+" .ad-off").prop("disabled", true);'; $js .= '}'; $js .= '});'; $js .= '$(".ad-position").each(function(){'; $js .= 'var aid = $(this).attr("rel-id");'; $js .= 'var aval = $(this).val();'; $js .= 'if(aval == "offset"){'; $js .= '$(dsrc+aid+" .ad-offset").prop("disabled", false);'; $js .= '} else {'; $js .= '$(dsrc+aid+" .ad-offset").prop("disabled", true);'; $js .= '}'; $js .= '});'; $js .= '$(".ad-client").each(function(){'; $js .= 'var aid = $(this).attr("rel-id");'; $js .= 'var aval = $(this).val();'; $js .= 'if(aval == "vast"){'; $js .= '$(dsrc+aid+" .ad-off, "+dsrc+aid+" .ad-server").prop("disabled", false);'; $js .= '} else {'; $js .= '$(dsrc+aid+" .ad-off, "+dsrc+aid+" .ad-server").prop("disabled", true);'; $js .= '}'; $js .= '});'; $js .= '$(".ad-server").each(function(){'; $js .= 'var aid = $(this).attr("rel-id");'; $js .= 'var aval = $(this).val();'; $js .= 'if($(dsrc+aid+" .ad-client").val() == "ima"){$(dsrc+aid+" .ad-server").prop("disabled", true);}'; $js .= 'if(aval == "custom" && $(dsrc+aid+" .ad-client").val() == "vast"){'; $js .= '$(dsrc+aid+" .ad-off").prop("disabled", false);'; $js .= '} else {'; $js .= '$(dsrc+aid+" .ad-off").prop("disabled", true);'; $js .= '}'; $js .= '});'; return $js; } /* processing banner entry */ public function processBannerEntry() { global $class_database, $db, $language; $form = VArraySection::getArray("adv_banners"); $allowedFields = $form[1]; $requiredFields = $form[2]; $error_message = VForm::checkEmptyFields($allowedFields, $requiredFields); if ($error_message != '') { echo VGenerate::noticeTpl('', $error_message, ''); } if ($error_message == '') { $ad_name = $form[0]['adv_name']; $ad_type = $form[0]['adv_type']; $ad_descr = $form[0]['adv_description']; $ad_group = $form[0]['adv_group']; $ad_code = $form[0]['adv_code']; $ad_id = intval($_POST['hc_id']); switch ($_GET['do']) { case "update": $sql = sprintf("UPDATE `db_advbanners` SET `adv_name`='%s', `adv_type`='%s', `adv_description`='%s', `adv_group`='%s', `adv_code`='%s' WHERE `adv_id`='%s' LIMIT 1;", $ad_name, $ad_type, $ad_descr, $ad_group, $ad_code, $ad_id); $db->execute($sql); break; case "add": $class_database->doInsert('db_advbanners', $form[0]); break; } if ($db->Affected_Rows() > 0) { echo VGenerate::noticeTpl('', '', $language['notif.success.request']); return true; } else { return false; } } } /* processing jw ad file entry */ public function processJWfileEntry() { global $class_database, $db, $language; $form = VArraySection::getArray("jw_files"); $allowedFields = $form[1]; $requiredFields = $form[2]; $error_message = VForm::checkEmptyFields($allowedFields, $requiredFields); if ($error_message != '') { echo VGenerate::noticeTpl('', $error_message, ''); } if ($error_message == '') { $db_name = $form[0]['db_name']; $db_type = $form[0]['db_type']; $db_code = $form[0]['db_code']; $db_id = intval($_POST['hc_id']); switch ($_GET['do']) { case "update": $sql = sprintf("UPDATE `db_jwadcodes` SET `db_name`='%s' %s WHERE `db_id`='%s' LIMIT 1;", $db_name, (isset($_POST['backend_adv_file_code']) ? ", `db_code`='" . $db_code . "'" : null), $db_id); $db->execute($sql); break; case "add": $class_database->doInsert('db_jwadcodes', $form[0]); break; } if ($db->Affected_Rows() > 0) { echo VGenerate::noticeTpl('', '', $language['notif.success.request']); return true; } else { return false; } } } /* processing videojs general ad entries */ public function processVJSadEntry() { global $class_database, $db, $language; $form = VArraySection::getArray("vjs_ads"); $allowedFields = $form[1]; $requiredFields = $form[2]; $error_message = VForm::checkEmptyFields($allowedFields, $requiredFields); if ($error_message != '') { echo VGenerate::noticeTpl('', $error_message, ''); } if ($error_message == '') { $db_id = intval($_POST['hc_id']); $ad_name = $form[0]['ad_name']; $ad_type = $form[0]['ad_type']; $ad_client = $form[0]['ad_client']; $ad_custom = $form[0]['ad_custom']; $ad_custom_url = $form[0]['ad_custom_url']; $ad_skip = $form[0]['ad_skip']; $ad_tag = $form[0]['ad_tag']; $ad_mobile = $form[0]['ad_mobile']; $ad_comp_div = $form[0]['ad_comp_div']; $ad_comp_id = $form[0]['ad_comp_id']; $ad_comp_w = $form[0]['ad_comp_w']; $ad_comp_h = $form[0]['ad_comp_h']; switch ($_GET['do']) { case "update": $sql = sprintf("UPDATE `db_vjsadentries` SET `ad_name`='%s', `ad_type`='%s', `ad_client`='%s', `ad_tag`='%s', `ad_mobile`='%s', `ad_comp_div`='%s', `ad_comp_id`='%s', `ad_comp_w`='%s', `ad_comp_h`='%s', `ad_custom`='%s', `ad_custom_url`='%s', `ad_skip`='%s' WHERE `ad_id`='%s' LIMIT 1;", $ad_name, $ad_type, $ad_client, $ad_tag, $ad_mobile, $ad_comp_div, $ad_comp_id, $ad_comp_w, $ad_comp_h, $ad_custom, $ad_custom_url, $ad_skip, $db_id); $db->execute($sql); break; case "add": $class_database->doInsert('db_vjsadentries', $form[0]); break; } if ($db->Affected_Rows() > 0) { echo VGenerate::noticeTpl('', '', $language['notif.success.request']); return true; } else { return false; } } } /* processing jw general ad entries */ public function processJWadEntry() { global $class_database, $db, $language; $form = VArraySection::getArray("jw_ads"); $allowedFields = $form[1]; $requiredFields = $form[2]; $error_message = VForm::checkEmptyFields($allowedFields, $requiredFields); if ($error_message != '') { echo VGenerate::noticeTpl('', $error_message, ''); } if ($error_message == '') { $db_id = intval($_POST['hc_id']); $ad_name = $form[0]['ad_name']; $ad_type = $form[0]['ad_type']; $ad_position = $form[0]['ad_position']; $ad_offset = $form[0]['ad_offset']; $ad_duration = $form[0]['ad_duration']; $ad_client = $form[0]['ad_client']; $ad_format = $form[0]['ad_format']; $ad_server = $form[0]['ad_server']; $ad_file = $form[0]['ad_file']; $ad_width = $form[0]['ad_width']; $ad_height = $form[0]['ad_height']; $ad_bitrate = $form[0]['ad_bitrate']; $ad_tag = $form[0]['ad_tag']; $ad_comp_div = $form[0]['ad_comp_div']; $ad_comp_id = $form[0]['ad_comp_id']; $ad_comp_w = $form[0]['ad_comp_w']; $ad_comp_h = $form[0]['ad_comp_h']; $ad_click_track = $form[0]['ad_click_track']; $ad_click_url = $form[0]['ad_click_url']; switch ($_GET['do']) { case "update": $sql = sprintf("UPDATE `db_jwadentries` SET `ad_name`='%s', `ad_type`='%s', `ad_position`='%s', `ad_offset`='%s', `ad_duration`='%s', `ad_client`='%s', `ad_format`='%s', `ad_server`='%s', `ad_file`='%s', `ad_width`='%s', `ad_height`='%s', `ad_bitrate`='%s', `ad_tag`='%s', `ad_comp_div`='%s', `ad_comp_id`='%s', `ad_comp_w`='%s', `ad_comp_h`='%s', `ad_click_track`='%s', `ad_click_url`='%s' WHERE `ad_id`='%s' LIMIT 1;", $ad_name, $ad_type, $ad_position, $ad_offset, $ad_duration, $ad_client, $ad_format, $ad_server, $ad_file, $ad_width, $ad_height, $ad_bitrate, $ad_tag, $ad_comp_div, $ad_comp_id, $ad_comp_w, $ad_comp_h, $ad_click_track, $ad_click_url, $db_id); $db->execute($sql); break; case "add": $class_database->doInsert('db_jwadentries', $form[0]); break; } if ($db->Affected_Rows() > 0) { echo VGenerate::noticeTpl('', '', $language['notif.success.request']); return true; } else { return false; } } } /* processing fp general ad entries */ public function processFPadEntry() { return; global $class_database, $db, $language; $form = VArraySection::getArray("fp_ads"); $allowedFields = $form[1]; $requiredFields = $form[2]; $error_message = VForm::checkEmptyFields($allowedFields, $requiredFields); if ($error_message != '') { echo VGenerate::noticeTpl('', $error_message, ''); } if ($error_message == '') { $db_id = intval($_POST['hc_id']); $ad_name = $form[0]['ad_name']; $ad_cuepoint = $form[0]['ad_cuepoint']; $ad_css = $form[0]['ad_css']; $ad_file = $form[0]['ad_file']; switch ($_GET['do']) { case "update": $sql = sprintf("UPDATE `db_fpadentries` SET `ad_name`='%s', `ad_cuepoint`='%s', `ad_css`='%s', `ad_file`='%s' WHERE `ad_id`='%s' LIMIT 1;", $ad_name, $ad_cuepoint, $ad_css, $ad_file, $db_id); $db->execute($sql); break; case "add": $class_database->doInsert('db_fpadentries', $form[0]); break; } if ($db->Affected_Rows() > 0) { echo VGenerate::noticeTpl('', '', $language['notif.success.request']); return true; } else { return false; } } } /* ad group details, edit */ public function advGroupDetails($_dsp = '', $entry_id = '', $db_id = '', $ad_state = '', $ad_name = '', $ad_desc = '', $ad_type = '', $ad_width = '', $ad_height = '', $ad_class, $ad_style) { global $class_filter, $language; $_init = VbeEntries::entryInit($_dsp, $db_id, $entry_id); $_date = date('D, m/d/Y, H:i:s A', strtotime($dc_date)); $_dsp = $_init[0]; $_btn = $_init[1]; $_btn = $_GET['do'] != 'add' ? VGenerate::simpleDivWrap('left-float', '', VGenerate::basicInput('button', 'save_changes', 'save-entry-button button-grey search-button form-button ' . ($_GET['do'] == 'add' ? 'new-entry' : 'update-entry'), '', $entry_id, '' . ($_GET['do'] == 'add' ? $language['frontend.global.savenew'] : $language['frontend.global.saveupdate']) . '')) : null; $html .= ''; return $html; } /* processing group entry */ public function processGroupEntry() { global $class_database, $db, $language; $form = VArraySection::getArray("adv_groups"); $allowedFields = $form[1]; $requiredFields = $form[2]; $error_message = VForm::checkEmptyFields($allowedFields, $requiredFields); if ($error_message != '') { echo VGenerate::noticeTpl('', $error_message, ''); } if ($error_message == '') { $ad_descr = $form[0]['adv_description']; $ad_width = $form[0]['adv_width']; $ad_height = $form[0]['adv_height']; $ad_class = $form[0]['adv_class']; $ad_style = $form[0]['adv_style']; $ad_rot = $form[0]['adv_rotate']; $ad_id = intval($_POST['hc_id']); switch ($_GET['do']) { case "update": $sql = sprintf("UPDATE `db_advgroups` SET `adv_description`='%s', `adv_width`='%s', `adv_height`='%s', `adv_class`='%s', `adv_style`='%s', `adv_rotate`='%s' WHERE `db_id`='%s' LIMIT 1;", $ad_descr, $ad_width, $ad_height, $ad_class, $ad_style, $ad_rot, $ad_id); $db->execute($sql); break; } if ($db->Affected_Rows() > 0) { echo VGenerate::noticeTpl('', '', $language['notif.success.request']); } } } }