1<?php 2/******************************************************************************* 3** Basic Analysis and Security Engine (BASE) 4** Copyright (C) 2004 BASE Project Team 5** Copyright (C) 2000 Carnegie Mellon University 6** 7** (see the file 'base_main.php' for license details) 8** 9** Project Lead: Kevin Johnson <kjohnson@secureideas.net> 10** Built upon work by Roman Danyliw <rdd@cert.org>, <roman@danyliw.com> 11** 12** Purpose: Prints or generates HTML to display 13******************************************************************************** 14** Authors: 15******************************************************************************** 16** Kevin Johnson <kjohnson@secureideas.net 17** 18******************************************************************************** 19*/ 20/** The below check is to make sure that the conf file has been loaded before this one.... 21 ** This should prevent someone from accessing the page directly. -- Kevin 22 **/ 23defined( '_BASE_INC' ) or die( 'Accessing this file directly is not allowed.' ); 24 25function PrintBASESubHeader($page_title, $page_name, $back_link, $refresh = 0, $page = "") 26{ 27 GLOBAL $debug_mode, $BASE_VERSION, $BASE_path, $BASE_urlpath, $html_no_cache, 28 $max_script_runtime, $Use_Auth_System, $stat_page_refresh_time, $base_style, $refresh_stat_page; 29 30 if ( ini_get("safe_mode") != true ) 31 set_time_limit($max_script_runtime); 32 33 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 34<!-- '. _TITLE . $BASE_VERSION .' --> 35<HTML> 36 <HEAD><meta http-equiv="Content-Type" content="text/html; charset='. _CHARSET .'">'; 37 38 if ( $html_no_cache == 1 ) 39 echo '<META HTTP-EQUIV="pragma" CONTENT="no-cache">'; 40 41 if ( $refresh == 1 ) 42 PrintFreshPage($refresh_stat_page, $stat_page_refresh_time); 43 44 if (@$_COOKIE['archive'] == 0) 45 echo '<TITLE>' . _TITLE .': '.$page_title.'</TITLE>'; 46 else 47 echo '<TITLE>' . _TITLE .': '.$page_title.' -- ARCHIVE</TITLE>'; 48 49 echo '<LINK rel="stylesheet" type="text/css" HREF="'. $BASE_urlpath .'/styles/'. $base_style .'"> 50 </HEAD> 51 <BODY>'; 52 53 include("$BASE_path/base_hdr1.php"); 54 include("$BASE_path/base_hdr2.php"); 55 56 echo "<TABLE WIDTH=\"100%\"><TR><TD ALIGN=RIGHT>".$back_link."</TD></TR></TABLE><BR>"; 57 58 if ( $debug_mode > 0 ) PrintPageHeader(); 59} 60 61function PrintBASESubFooter() 62{ 63 GLOBAL $BASE_VERSION, $BASE_path, $BASE_urlpath, $Use_Auth_System; 64 echo "\n\n<!-- BASE Footer -->\n". 65 "<P>\n"; 66 include("$BASE_path/base_footer.php"); 67 echo "\n\n"; 68} 69 70 71function PrintFramedBoxHeader($title, $fore, $back) 72{ 73 echo ' 74<TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR="'.$fore.'"> 75<TR><TD> 76 <TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR="'.$back.'"> 77 <TR><TD class="sectiontitle"> '.$title.' </TD></TR> 78 <TR><TD>'; 79} 80 81function PrintFramedBoxFooter() 82{ 83 echo ' 84 </TD></TR></TABLE> 85</TD></TR></TABLE>'; 86} 87 88function PrintFreshPage($refresh_stat_page, $stat_page_refresh_time) 89{ 90 if ( $refresh_stat_page ) 91 echo '<META HTTP-EQUIV="REFRESH" CONTENT="'.$stat_page_refresh_time.'; URL='. 92 htmlspecialchars(CleanVariable($_SERVER["REQUEST_URI"], VAR_FSLASH | VAR_PERIOD | VAR_DIGIT | VAR_PUNC | VAR_LETTER), ENT_QUOTES).'">'."\n"; 93} 94 95function chk_select($stored_value, $current_value) 96{ 97 if ( strnatcmp($stored_value,$current_value) == 0 ) 98 return " SELECTED"; 99 else 100 return " "; 101} 102 103function chk_check($stored_value, $current_value) 104{ 105 if ( $stored_value == $current_value ) 106 return " CHECKED"; 107 else 108 return " "; 109} 110 111function dispYearOptions($stored_value) 112{ 113 // Creates the years for drop down boxes 114 $thisyear = date("Y"); 115 $options = ""; 116 $options = "<OPTION VALUE=' ' ".chk_select($stored_value, " ").">"._DISPYEAR."\n"; 117 for($i=1999; $i<=$thisyear; $i++) { 118 $options = $options ."<OPTION VALUE='".$i."' ".chk_select($stored_value, $i).">".$i."\n"; 119 } 120 $options = $options. "</SELECT>"; 121 122 return($options); 123} 124 125function PrintBASEAdminMenuHeader() 126{ 127 $menu = "<table width='100%' border=0><tr><td width='15%'>"; 128 $menu = $menu . "<div class='mainheadermenu'>"; 129 $menu = $menu . "<table border='0' class='mainheadermenu'>"; 130 $menu = $menu . "<tr><td class='menuitem'>". _USERMAN ."<br>"; 131 $menu = $menu . "<hr><a href='base_useradmin.php?action=list' class='menuitem'>"._LISTU."</a><br>"; 132 $menu = $menu . "<a href='base_useradmin.php?action=create' class='menuitem'>"._CREATEU."</a><br>"; 133 $menu = $menu . "<br>". _ROLEMAN ."<br><hr>"; 134 $menu = $menu . "<a href='base_roleadmin.php?action=list' class='menuitem'>"._LISTR."</a><br>"; 135 $menu = $menu . "<a href='base_roleadmin.php?action=create' class='menuitem'>"._CREATER."</a><br>"; 136 $menu = $menu . "</td></tr></table></div></td><td>"; 137 138 echo($menu); 139} 140 141function PrintBASEAdminMenuFooter() 142{ 143 $footer = "</td></tr></table>"; 144 145 echo($footer); 146} 147 148function PrintBASEHelpLink($target) 149{ 150 /* 151 This function will accept a target variable which will point to 152 an anchor in the base_help.php file. It will output a help icon 153 that will link to that target in a new window. 154 */ 155} 156 157 158 159?> 160