get_files(e_IMAGE."banners/","","standard"); if (isset($_POST['update_menu'])) { $menu_pref['banner_caption'] = $e107->tp->toDB($_POST['banner_caption']); $menu_pref['banner_amount'] = intval($_POST['banner_amount']); $menu_pref['banner_rendertype'] = intval($_POST['banner_rendertype']); if (isset($_POST['multiaction_cat_active'])) { /*$array_cat = explode("-", $_POST['catid']); $cat=''; for($i = 0; $i < count($array_cat); $i++) { $cat .= $e107->tp->toDB($array_cat[$i])."|"; } $cat = substr($cat, 0, -1);*/ $cat = implode('|', $e107->tp->toDB($_POST['multiaction_cat_active'])); $menu_pref['banner_campaign'] = $cat; } $sysprefs->setArray('menu_pref'); banners_adminlog('01', $menu_pref['banner_caption'].'[!br!]'.$menu_pref['banner_amount'].', '.$menu_pref['banner_rendertype'].'[!br!]'.$menu_pref['banner_campaign']); $emessage->add(BANNER_MENU_L2, E_MESSAGE_SUCCESS); } if ($_POST['createbanner'] || $_POST['updatebanner']) { $start_date = (!$_POST['startmonth'] || !$_POST['startday'] || !$_POST['startyear'] ? 0 : mktime (0, 0, 0, $_POST['startmonth'], $_POST['startday'], $_POST['startyear'])); $end_date = (!$_POST['endmonth'] || !$_POST['endday'] || !$_POST['endyear'] ? 0 : mktime (0, 0, 0, $_POST['endmonth'], $_POST['endday'], $_POST['endyear'])); $cli = $e107->tp->toDB($_POST['client_name'] ? $_POST['client_name'] : $_POST['banner_client_sel']); $cLogin = $e107->tp->toDB($_POST['client_login']); $cPassword = $e107->tp->toDB($_POST['client_password']); $banImage = $e107->tp->toDB($_POST['banner_image']); $banURL = $e107->tp->toDB($_POST['click_url']); if ($_POST['banner_pages']) { // Section redundant? $postcampaign = $e107->tp->toDB($_POST['banner_campaign'] ? $_POST['banner_campaign'] : $_POST['banner_campaign_sel']); $pagelist = explode("\r", $_POST['banner_pages']); for($i = 0 ; $i < count($pagelist) ; $i++) { $pagelist[$i] = trim($pagelist[$i]); } $plist = implode("|", $pagelist); $pageparms = $postcampaign."^".$_POST['banner_listtype']."-".$plist; $pageparms = preg_replace("#\|$#", "", $pageparms); $pageparms = (trim($_POST['banner_pages']) == '') ? '' : $pageparms; $cam = $pageparms; $logString = $postcampaign.'[!br!]'; } else { $cam = $e107->tp->toDB($_POST['banner_campaign'] ? $_POST['banner_campaign'] : $_POST['banner_campaign_sel']); } $logString .= $cam.'[!br!]'.$cli.'[!br!]'.$banImage.'[!br!]'.$banURL; if ($_POST['createbanner']) { admin_update($sql->db_Insert("banner", "0, '".$cli."', '".$cLogin."', '".$cPassword."', '".$banImage."', '".$banURL."', '".intval($_POST['impressions_purchased'])."', '{$start_date}', '{$end_date}', '".intval($_POST['banner_class'])."', 0, 0, '', '".$cam."'"), 'insert', BNRLAN_63, false, false); banners_adminlog('02',$logString); } else { admin_update($sql->db_Update("banner", "banner_clientname='".$cli."', banner_clientlogin='".$cLogin."', banner_clientpassword='".$cPassword."', banner_image='".$banImage."', banner_clickurl='".$banURL."', banner_impurchased='".intval($_POST['impressions_purchased'])."', banner_startdate='{$start_date}', banner_enddate='{$end_date}', banner_active='".intval($_POST['banner_class'])."', banner_campaign='".$cam."' WHERE banner_id=".intval($_POST['eid'])), 'update', BNRLAN_64, false, false); banners_adminlog('03',$logString); } unset($_POST['client_name'], $_POST['client_login'], $_POST['client_password'], $_POST['banner_image'], $_POST['click_url'], $_POST['impressions_purchased'], $start_date, $end_date, $_POST['banner_enabled'], $_POST['startday'], $_POST['startmonth'], $_POST['startyear'], $_POST['endday'], $_POST['endmonth'], $_POST['endyear'], $_POST['banner_class'], $_POST['banner_pages'], $_POST['banner_listtype']); } /* DELETE ACTIONS */ if (isset($_POST['delete_cancel'])) { $emessage->addSession(BNRLAN_6); //redirect to main session_write_close(); header('Location:'.e_SELF); exit; } if ($action == "delete" && $sub_action && varsettrue($_POST['delete_confirm'])) { if($sql->db_Delete("banner", "banner_id=".intval($sub_action))) { $emessage->addSession(sprintf(BNRLAN_1, $sub_action), E_MESSAGE_SUCCESS); banners_adminlog('04','Id: '.intval($sub_action)); } else $emessage->addSession(LAN_DELETED_FAILED, E_MESSAGE_WARNING); //redirect to main session_write_close(); header('Location:'.e_SELF); exit; } elseif ($action == "delete" && $sub_action) { // shown only if JS is disabled or by direct url hit (?delete.banner_id) $emessage->add(BNRLAN_2, E_MESSAGE_WARNING); $text = "
".BNRLAN_5."
".$frm->admin_button('delete_confirm', LAN_CONFDELETE, 'delete no-confirm')." ".$frm->admin_button('delete_cancel', LAN_CANCEL, 'cancel')."
"; $e107->ns->tablerender(BNRLAN_5, $emessage->render().$text); require_once(e_ADMIN."footer.php"); exit; } if ($sql->db_Select("banner")) { while ($banner_row = $sql->db_Fetch()) { //extract($row); - killed by SecretR if (strpos($banner_row['banner_campaign'], "^") !== FALSE) { $campaignsplit = explode("^", $banner_row['banner_campaign']); $banner_row['banner_campaign'] = $campaignsplit[0]; } if ($banner_row['banner_campaign']) { $campaigns[] = $banner_row['banner_campaign']; } if ($banner_row['banner_clientname']) { $clients[] = $banner_row['banner_clientname']; } if ($banner_row['banner_clientlogin']) { $logins[] = $banner_row['banner_clientlogin']; } if ($banner_row['banner_clientpassword']) { $passwords[] = $banner_row['banner_clientpassword']; } } } if (!$action) { $text = "
".BNRLAN_7." "; if (!$banner_total = $sql->db_Select("banner")) { $text .= ""; } else { while ($banner_row = $sql->db_Fetch()) { //extract($row); - killed by SecretR $clickpercentage = ($banner_row['banner_clicks'] && $banner_row['banner_impressions'] ? round(($banner_row['banner_clicks'] / $banner_row['banner_impressions']) * 100)."%" : "-"); $impressions_left = ($banner_row['banner_impurchased'] ? $banner_row['banner_impurchased'] - $banner_row['banner_impressions'] : BNRLAN_16); $impressions_purchased = ($banner_row['banner_impurchased'] ? $banner_row['banner_impurchased'] : BNRLAN_16); $start_date = ($banner_row['banner_startdate'] ? strftime("%d %B %Y", $banner_row['banner_startdate']) : BNRLAN_17); $end_date = ($banner_row['banner_enddate'] ? strftime("%d %B %Y", $banner_row['banner_enddate']) : BNRLAN_17); if (strpos($banner_row['banner_campaign'], "^") !== FALSE) { $campaignsplit = explode("^", $banner_row['banner_campaign']); $banner_row['banner_campaign'] = $campaignsplit[0]; $textvisivilitychanged = "(*)"; } else { $textvisivilitychanged = ""; } $text .= " "; } } $text .= "
ID ".BNRLAN_9." ".BNRLAN_10." ".BNRLAN_11." ".BNRLAN_12." ".BNRLAN_13." ".LAN_OPTIONS."
".BNRLAN_15."
".$banner_row['banner_id']." ".($banner_row['banner_clientname'] ? $banner_row['banner_clientname'] : BNRLAN_66)." ".$banner_row['banner_clicks']." ".$clickpercentage." ".$impressions_purchased." ".$impressions_left." ".ADMIN_EDIT_ICON."
"; $e107->ns->tablerender(BNRLAN_42.' - '.BNRLAN_7, $emessage->render().$text); } if ($action == "create") { if ($sub_action == "edit" && $id) { if (!$sql->db_Select("banner", "*", "banner_id = '".$id."' " )) { $text .= "
".BNRLAN_15."
"; } else { while ($banner_row = $sql->db_Fetch()) { //extract($row); - killed by SecretR $_POST['client_name'] = $banner_row['banner_clientname']; $_POST['client_login'] = $banner_row['banner_clientlogin']; $_POST['client_password'] = $banner_row['banner_clientpassword']; $_POST['banner_image'] = $banner_row['banner_image']; $_POST['click_url'] = $banner_row['banner_clickurl']; $_POST['impressions_purchased'] = $banner_row['banner_impurchased']; $_POST['banner_campaign'] = $banner_row['banner_campaign']; $_POST['banner_active'] = $banner_row['banner_active']; if ($banner_row['banner_startdate']) { $tmp = getdate($banner_row['banner_startdate']); $_POST['startmonth'] = $tmp['mon']; $_POST['startday'] = $tmp['mday']; $_POST['startyear'] = $tmp['year']; } if ($banner_row['banner_enddate']) { $tmp = getdate($banner_row['banner_enddate']); $_POST['endmonth'] = $tmp['mon']; $_POST['endday'] = $tmp['mday']; $_POST['endyear'] = $tmp['year']; } if (strpos($_POST['banner_campaign'], "^") !== FALSE) { $campaignsplit = explode("^", $_POST['banner_campaign']); $listtypearray = explode("-", $campaignsplit[1]); $listtype = $listtypearray[0]; $campaign_pages = str_replace("|", "", $listtypearray[1]); $_POST['banner_campaign'] = $campaignsplit[0]; } else { $_POST['banner_campaign'] = $banner_row['banner_campaign']; } } } } $text = "
".($sub_action == "edit" ? BNRLAN_22 : BNRLAN_23)."
".BNRLAN_24."
".BNRLAN_25."
"; if (count($campaigns)) { $for_var = array(); $text .= "
".$frm->admin_button('add_new_campaign', BNRLAN_26a, 'action', '', array('other' => "onclick=\"e107Helper.toggle('add-new-campaign-cont', false); \$('banner_campaign_sel').selectedIndex=0; return false;\""))."
".BNRLAN_26."
"; } else { $text .= ""; } $text .= "
".BNRLAN_27."
".BNRLAN_28."
"; if (count($clients)) { $text .= "
".$frm->admin_button('add_new_client', BNRLAN_29a, 'action', '', array('other' => "onclick=\"e107Helper.toggle('add-new-client-cont', false); \$('banner_client_sel').selectedIndex=0; return false;\""))."
".BNRLAN_29."
"; } else { $text .= "
".BNRLAN_29."
"; } $text .= "
".BNRLAN_30."
".BNRLAN_31."
".BNRLAN_32."
".BNRLAN_33."
".BNRLAN_34."
0 = ".BNRLAN_35."
".BNRLAN_36."
".BNRLAN_38."
".BNRLAN_37."
".BNRLAN_38."
".MENLAN_4." ".$e_userclass->uc_dropdown('banner_class', $_POST['banner_active'], 'public,member,guest,admin,classes,nobody,classes')."
"; if ($sub_action == "edit" && $id) { $text .= " "; } else { $text .= " "; } $text .= "
"; $e107->ns->tablerender(BNRLAN_42.' - '.($sub_action == "edit" ? BNRLAN_22 : BNRLAN_23), $text); } if ($action == "menu") { $in_catname = array(); // Notice removal $all_catname = array(); $array_cat_in = explode("|", $menu_pref['banner_campaign']); if (!$menu_pref['banner_caption']) { $menu_pref['banner_caption'] = BANNER_MENU_L1; } $category_total = $sql -> db_Select("banner", "DISTINCT(banner_campaign) as banner_campaign", "ORDER BY banner_campaign", "mode=no_where"); while ($banner_row = $sql -> db_Fetch()) { //extract($row); - killed by SecretR $all_catname[] = $banner_row['banner_campaign']; if (in_array($banner_row['banner_campaign'], $array_cat_in)) { $in_catname[] = $banner_row['banner_campaign']; } } $text = " "; /* removed - checkboxes are OK $text .= " "; */ $e107->ns->tablerender(BNRLAN_68, $emessage->render().$text); } function admin_banner_adminmenu() { global $action; $act = $action; if ($act == "") { $act = "main"; } $var['main']['text'] = BNRLAN_58; $var['main']['link'] = e_SELF; $var['create']['text'] = BNRLAN_59; $var['create']['link'] = e_SELF."?create"; $var['menu']['text'] = BNRLAN_61; $var['menu']['link'] = e_SELF."?menu"; e_admin_menu(BNRLAN_62, $act, $var); } require_once(e_ADMIN."footer.php"); // Log event to admin log function banners_adminlog($msg_num='00', $woffle='') { global $pref, $admin_log; // if (!varset($pref['admin_log_log']['admin_banners'],0)) return; $admin_log->log_event('BANNER_'.$msg_num,$woffle,E_LOG_INFORMATIVE,''); } /** * Handle page DOM within the page header * * @return string JS source */ function headerjs() { require_once(e_HANDLER.'js_helper.php'); $ret = " "; return $ret; } ?>