Added new options to inject custom html code into the header and footer area.

This also includes a database version upgrade
This commit is contained in:
Andre Lorbach 2008-10-22 16:06:56 +02:00
parent 8006bc56b9
commit 0256ace844
9 changed files with 73 additions and 9 deletions

View File

@ -150,6 +150,10 @@ if ( isset($_POST['op']) )
if ( isset ($_POST['SearchCustomButtonCaption']) ) { $content['SearchCustomButtonCaption'] = $_POST['SearchCustomButtonCaption']; }
if ( isset ($_POST['SearchCustomButtonSearch']) ) { $content['SearchCustomButtonSearch'] = $_POST['SearchCustomButtonSearch']; }
if ( isset ($_POST['InjectHtmlHeader']) ) { $content['InjectHtmlHeader'] = $_POST['InjectHtmlHeader']; }
if ( isset ($_POST['InjectBodyHeader']) ) { $content['InjectBodyHeader'] = $_POST['InjectBodyHeader']; }
if ( isset ($_POST['InjectBodyFooter']) ) { $content['InjectBodyFooter'] = $_POST['InjectBodyFooter']; }
// Save configuration variables now
SaveGeneralSettingsIntoDB();
}

View File

@ -85,6 +85,12 @@ $CFG['TreatNotFoundFiltersAsTrue'] = 0; // If you filter / search for messages,
$CFG['PopupMenuTimeout'] = 3000; // This variable defines the default timeout value for popup menus in milliseconds. (those menus which popup when you click on the value of a field.
// ---
// --- Custom HTML Code
$CFG['InjectHtmlHeader'] = ""; // Use this variable to inject custom html into the html <head> area!
$CFG['InjectBodyHeader'] = ""; // Use this variable to inject custom html into the begin of the <body> area!
$CFG['InjectBodyFooter'] = ""; // Use this variable to inject custom html into the end of the <body> area!
// ---
// --- Define which fields you want to see
//$CFG['ShowMessage'] = true; // If enabled, the Message column will be appended to the columns list.
//Eventlog based fields: $CFG['Columns'] = array ( SYSLOG_DATE, SYSLOG_HOST, SYSLOG_EVENT_LOGTYPE, SYSLOG_EVENT_SOURCE, /*SYSLOG_EVENT_CATEGORY, */SYSLOG_EVENT_ID, SYSLOG_MESSAGE );

View File

@ -0,0 +1,6 @@
-- New Database Structure Updates
ALTER TABLE `logcon_config` ADD `propvalue_text` TEXT NOT NULL AFTER `propvalue` ;
-- Insert data
-- Updated Data

View File

@ -75,6 +75,9 @@ $content['SHOW_DONATEBUTTON'] = true; // Default = true!
$content['EXTRA_METATAGS'] = "";
$content['EXTRA_JAVASCRIPT'] = "";
$content['EXTRA_STYLESHEET'] = "";
$content['EXTRA_HTMLHEAD'] = "";
$content['EXTRA_HEADER'] = "";
$content['EXTRA_FOOTER'] = "";
$content['CURRENTURL'] = "";
// ---
@ -685,8 +688,14 @@ function InitConfigurationValues()
{
for($i = 0; $i < count($rows); $i++)
{
$CFG[ $rows[$i]['propname'] ] = $rows[$i]['propvalue'];
$content[ $rows[$i]['propname'] ] = $rows[$i]['propvalue'];
// Obtain the right value
if ( isset($rows[$i]['propvalue_text']) && strlen($rows[$i]['propvalue_text']) > 0 )
$myValue = $rows[$i]['propvalue_text'];
else
$myValue = $rows[$i]['propvalue'];
$CFG[ $rows[$i]['propname'] ] = $myValue;
$content[ $rows[$i]['propname'] ] = $myValue;
}
}
}
@ -777,7 +786,7 @@ function InitConfigurationValues()
$_SESSION['AUTORELOAD_ID'] = 0;
}
// Theme Handling
// --- Theme Handling
if ( !isset($content['web_theme']) ) { $content['web_theme'] = GetConfigSetting("ViewDefaultTheme", "default", CFGLEVEL_USER); }
if ( isset($_SESSION['CUSTOM_THEME']) && VerifyTheme($_SESSION['CUSTOM_THEME']) )
$content['user_theme'] = $_SESSION['CUSTOM_THEME'];
@ -786,6 +795,16 @@ function InitConfigurationValues()
// Init Theme About Info ^^
InitThemeAbout($content['user_theme']);
// ---
// --- Handle HTML Injection stuff
if ( strlen(GetConfigSetting("InjectHtmlHeader", false)) > 0 )
$content['EXTRA_HTMLHEAD'] .= $CFG['InjectHtmlHeader'];
if ( strlen(GetConfigSetting("InjectBodyHeader", false)) > 0 )
$content['EXTRA_HEADER'] .= $CFG['InjectBodyHeader'];
if ( strlen(GetConfigSetting("InjectBodyFooter", false)) > 0 )
$content['EXTRA_FOOTER'] .= $CFG['InjectBodyFooter'];
// ---
// Init main langauge file now!
IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/main.php' );
@ -1349,6 +1368,11 @@ function SaveGeneralSettingsIntoDB()
WriteConfigValue( "DebugUserLogin", true );
WriteConfigValue( "MiscDebugToSyslog", true );
WriteConfigValue( "MiscMaxExecutionTime", true );
// Custom HTML Code
WriteConfigValue( "InjectHtmlHeader", true );
WriteConfigValue( "InjectBodyHeader", true );
WriteConfigValue( "InjectBodyFooter", true );
}
function SaveUserGeneralSettingsIntoDB()

View File

@ -45,7 +45,7 @@ $errdesc = "";
$errno = 0;
// --- Current Database Version, this is important for automated database Updates!
$content['database_internalversion'] = "5"; // Whenever incremented, a database upgrade is needed
$content['database_internalversion'] = "6"; // Whenever incremented, a database upgrade is needed
$content['database_installedversion'] = "0"; // 0 is default which means Prior Versioning Database
// ---
@ -361,13 +361,19 @@ function WriteConfigValue($szPropName, $is_global = true, $userid = false, $grou
if ( !isset($rows) )
{
// New Entry
$result = DB_Query("INSERT INTO " . DB_CONFIG . " (propname, propvalue, is_global) VALUES ( '" . $szPropName . "', '" . $szDbValue . "', " . $is_global . ")");
if ( strlen($szDbValue) < 255 )
$result = DB_Query("INSERT INTO " . DB_CONFIG . " (propname, propvalue, is_global) VALUES ( '" . $szPropName . "', '" . $szDbValue . "', " . $is_global . ")");
else
$result = DB_Query("INSERT INTO " . DB_CONFIG . " (propname, propvalue_text, is_global) VALUES ( '" . $szPropName . "', '" . $szDbValue . "', " . $is_global . ")");
DB_FreeQuery($result);
}
else
{
// Update Entry
$result = DB_Query("UPDATE " . DB_CONFIG . " SET propvalue = '" . $szDbValue . "' WHERE propname = '" . $szPropName . "' AND is_global = " . $is_global);
if ( strlen($szDbValue) < 255 )
$result = DB_Query("UPDATE " . DB_CONFIG . " SET propvalue = '" . $szDbValue . "', propvalue_text = '' WHERE propname = '" . $szPropName . "' AND is_global = " . $is_global);
else
$result = DB_Query("UPDATE " . DB_CONFIG . " SET propvalue_text = '" . $szDbValue . "', propvalue = '' WHERE propname = '" . $szPropName . "' AND is_global = " . $is_global);
DB_FreeQuery($result);
}
}

View File

@ -92,6 +92,9 @@ $content['LN_ADMIN_GLOBALONLY'] = "Global Options Only";
$content['LN_GEN_DEBUGTOSYSLOG'] = "Send Debug to local syslog server";
$content['LN_GEN_POPUPMENUTIMEOUT'] = "Popupmenu Timeout in milli seconds";
$content['LN_ADMIN_SCRIPTTIMEOUT'] = "PHP Script Timeout in seconds";
$content['LN_GEN_INJECTHTMLHEADER'] = "Inject this html code into the &lt;head&gt; area.";
$content['LN_GEN_INJECTBODYHEADER'] = "Inject this html code at the beginning of the &lt;body&gt; area.";
$content['LN_GEN_INJECTBODYFOOTER'] = "Inject this html code at the end &lt;body&gt; area.";
// User Center
$content['LN_USER_CENTER'] = "User Options";

View File

@ -108,7 +108,6 @@
<!-- ENDIF ENABLEUSEROPTIONS="true" -->
</tr>
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_GEN_PREPENDTITLE}</b></td>
<td align="right" class="line1" ><input type="text" name="PrependTitle" size="35" maxlength="255" value="{PrependTitle}" {DISABLE_GLOBALEDIT_FORMCONTROL}></td>
@ -245,12 +244,25 @@
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_GEN_DEBUGUSERLOGIN}</b></td>
<td align="right" class="line1" colspan="2"><input type="checkbox" name="DebugUserLogin" value="yes" {DebugUserLogin_checked} {DISABLE_GLOBALEDIT_FORMCONTROL}></td>
<td align="right" class="line2" colspan="2"><input type="checkbox" name="DebugUserLogin" value="yes" {DebugUserLogin_checked} {DISABLE_GLOBALEDIT_FORMCONTROL}></td>
</tr>
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_GEN_DEBUGTOSYSLOG}</b></td>
<td align="right" class="line2" colspan="2"><input type="checkbox" name="MiscDebugToSyslog" value="yes" {MiscDebugToSyslog_checked} {DISABLE_GLOBALEDIT_FORMCONTROL}></td>
<td align="right" class="line1" colspan="2"><input type="checkbox" name="MiscDebugToSyslog" value="yes" {MiscDebugToSyslog_checked} {DISABLE_GLOBALEDIT_FORMCONTROL}></td>
</tr>
<tr>
<td align="left" class="cellmenu2_naked" valign="_top"><b>{LN_GEN_INJECTHTMLHEADER}</b></td>
<td align="right" class="line2" colspan="2"><textarea name="InjectHtmlHeader" cols="85" rows="3" {DISABLE_GLOBALEDIT_FORMCONTROL}>{InjectHtmlHeader}</textarea></td>
</tr>
<tr>
<td align="left" class="cellmenu2_naked" valign="_top"><b>{LN_GEN_INJECTBODYHEADER}</b></td>
<td align="right" class="line2" colspan="2"><textarea name="InjectBodyHeader" cols="85" rows="3" {DISABLE_GLOBALEDIT_FORMCONTROL}>{InjectBodyHeader}</textarea></td>
</tr>
<tr>
<td align="left" class="cellmenu2_naked" valign="_top"><b>{LN_GEN_INJECTBODYFOOTER}</b></td>
<td align="right" class="line2" colspan="2"><textarea name="InjectBodyFooter" cols="85" rows="3" {DISABLE_GLOBALEDIT_FORMCONTROL}>{InjectBodyFooter}</textarea></td>
</tr>
<tr>
<tr>
<td align="center" colspan="3">
<input type="submit" value="{LN_ADMIN_SEND}">

View File

@ -35,5 +35,6 @@
</tr>
</table>
{EXTRA_FOOTER}
</body>
</html>

View File

@ -11,8 +11,10 @@
</script>
<script type='text/javascript' src='{BASEPATH}js/common.js'></script>
{EXTRA_JAVASCRIPT}
{EXTRA_HTMLHEAD}
</head>
<body TOPMARGIN="0" LEFTMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
{EXTRA_HEADER}
<!-- IF MAXIMIZED!="true" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mainheader">