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 = "
"; $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 = " "; $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 .= "