Fixed a few minor issues. Added a few missing options in General Options

This commit is contained in:
Andre Lorbach 2008-07-24 15:11:40 +02:00
parent 22763dc5d0
commit c51fc81f89
6 changed files with 73 additions and 12 deletions

View File

@ -62,8 +62,6 @@ if ( isset($_SESSION['SESSION_ISADMIN']) && $_SESSION['SESSION_ISADMIN'] == 1 )
else
$content['EditAllowed'] = false;
// Check for changes first | Abort if Edit is not allowed
if ( isset($_POST['op']) && $content['EditAllowed'] )
{
@ -78,7 +76,13 @@ if ( isset($_POST['op']) && $content['EditAllowed'] )
}
// Read default theme
if ( isset ($_POST['ViewDefaultTheme']) ) { $content['ViewDefaultTheme'] = DB_RemoveBadChars($_POST['ViewDefaultTheme']); }
if ( isset ($_POST['ViewDefaultTheme']) ) { $content['ViewDefaultTheme'] = $_POST['ViewDefaultTheme']; }
// Read default VIEW | Check if View exists as well!
if ( isset ($_POST['DefaultViewsID']) && isset($content['Views'][$_POST['DefaultViewsID']] )) { $content['DefaultViewsID'] = $_POST['DefaultViewsID']; }
// Read default SOURCES | Check if Source exists as well!
if ( isset ($_POST['DefaultSourceID']) && isset($content['Sources'][$_POST['DefaultSourceID']] )) { $content['DefaultSourceID'] = $_POST['DefaultSourceID']; }
// Read checkboxes
if ( isset ($_POST['ViewUseTodayYesterday']) ) { $content['ViewUseTodayYesterday'] = 1; } else { $content['ViewUseTodayYesterday'] = 0; }
@ -91,14 +95,14 @@ if ( isset($_POST['op']) && $content['EditAllowed'] )
if ( isset ($_POST['DebugUserLogin']) ) { $content['DebugUserLogin'] = 1; } else { $content['DebugUserLogin'] = 0; }
// Read Text number fields
if ( isset ($_POST['ViewMessageCharacterLimit']) && is_numeric($_POST['ViewMessageCharacterLimit']) ) { $content['ViewMessageCharacterLimit'] = DB_RemoveBadChars($_POST['ViewMessageCharacterLimit']); }
if ( isset ($_POST['ViewEntriesPerPage']) && is_numeric($_POST['ViewEntriesPerPage']) ) { $content['ViewEntriesPerPage'] = DB_RemoveBadChars($_POST['ViewEntriesPerPage']); }
if ( isset ($_POST['ViewEnableAutoReloadSeconds']) && is_numeric($_POST['ViewEnableAutoReloadSeconds']) ) { $content['ViewEnableAutoReloadSeconds'] = DB_RemoveBadChars($_POST['ViewEnableAutoReloadSeconds']); }
if ( isset ($_POST['ViewMessageCharacterLimit']) && is_numeric($_POST['ViewMessageCharacterLimit']) ) { $content['ViewMessageCharacterLimit'] = $_POST['ViewMessageCharacterLimit']; }
if ( isset ($_POST['ViewEntriesPerPage']) && is_numeric($_POST['ViewEntriesPerPage']) ) { $content['ViewEntriesPerPage'] = $_POST['ViewEntriesPerPage']; }
if ( isset ($_POST['ViewEnableAutoReloadSeconds']) && is_numeric($_POST['ViewEnableAutoReloadSeconds']) ) { $content['ViewEnableAutoReloadSeconds'] = $_POST['ViewEnableAutoReloadSeconds']; }
// Read Text fields
if ( isset ($_POST['PrependTitle']) ) { $content['PrependTitle'] = DB_RemoveBadChars($_POST['PrependTitle']); }
if ( isset ($_POST['SearchCustomButtonCaption']) ) { $content['SearchCustomButtonCaption'] = DB_RemoveBadChars($_POST['SearchCustomButtonCaption']); }
if ( isset ($_POST['SearchCustomButtonSearch']) ) { $content['SearchCustomButtonSearch'] = DB_RemoveBadChars($_POST['SearchCustomButtonSearch']); }
if ( isset ($_POST['PrependTitle']) ) { $content['PrependTitle'] = $_POST['PrependTitle']; }
if ( isset ($_POST['SearchCustomButtonCaption']) ) { $content['SearchCustomButtonCaption'] = $_POST['SearchCustomButtonCaption']; }
if ( isset ($_POST['SearchCustomButtonSearch']) ) { $content['SearchCustomButtonSearch'] = $_POST['SearchCustomButtonSearch']; }
// Save configuration variables now
SaveGeneralSettingsIntoDB();
@ -121,6 +125,32 @@ if ($content['MiscEnableGzipCompression'] == 1) { $content['MiscEnableGzipCompre
if ($content['DebugUserLogin'] == 1) { $content['DebugUserLogin_checked'] = "checked"; } else { $content['DebugUserLogin_checked'] = ""; }
// ---
// --- Init for DefaultView field!
// copy Views Array
$content['VIEWS'] = $content['Views'];
if ( !isset($content['DefaultViewsID']) ) { $content['DefaultViewsID'] = 'SYSLOG'; }
foreach ( $content['VIEWS'] as $myView )
{
if ( $myView['ID'] == $content['DefaultViewsID'] )
$content['VIEWS'][ $myView['ID'] ]['selected'] = "selected";
else
$content['VIEWS'][ $myView['ID'] ]['selected'] = "";
}
// ---
// --- Init for DefaultSource field!
// copy Views Array
$content['SOURCES'] = $content['Sources'];
if ( !isset($content['DefaultSourceID']) ) { $content['DefaultSourceID'] = ''; }
foreach ( $content['SOURCES'] as $myView )
{
if ( $myView['ID'] == $content['DefaultSourceID'] )
$content['SOURCES'][ $myView['ID'] ]['selected'] = "selected";
else
$content['SOURCES'][ $myView['ID'] ]['selected'] = "";
}
// ---
// --- BEGIN CREATE TITLE
$content['TITLE'] = InitPageTitle();
$content['TITLE'] .= " :: " . $content['LN_ADMINMENU_GENOPT'];

View File

@ -304,11 +304,12 @@ function DB_Exec($query)
function PrepareValueForDB($szValue)
{
//echo "<br>" . $szValue . "<br>!" . preg_match("/[^\\\\]['\\\\][^'\\\\]/e", $szValue, $matches) . "<br>";
// Copy value for DB and check for BadDB Chars!
if ( preg_match("/(?<!\\\\)\'|(?<!\\\\)\\\\/e", $szValue) )
// if ( preg_match("/(?<!\\\\)\'|\\\\\\\\/x", $szValue) ) /* OLD /(?<!\\\\)\'|(?<!\\\\)\\\\/e */
return DB_RemoveBadChars($szValue);
else
return $szValue;
// else
// return $szValue;
}
function WriteConfigValue($szPropName, $is_global = true, $userid = false, $groupid = false)

View File

@ -75,6 +75,8 @@ $content['LN_GEN_INTERNAL'] = "Internal";
$content['LN_GEN_DISABLED'] = "Function disabled";
$content['LN_GEN_CONFIGFILE'] = "Configuration File";
$content['LN_GEN_ACCESSDENIED'] = "Access denied to this function";
$content['LN_GEN_DEFVIEWS'] = "Default selected view";
$content['LN_GEN_DEFSOURCE'] = "Default selected source";
// User Center
$content['LN_USER_CENTER'] = "User Options";

View File

@ -75,6 +75,9 @@ $content['LN_GEN_INTERNAL'] = "Internal";
$content['LN_GEN_DISABLED'] = "Function disabled";
$content['LN_GEN_CONFIGFILE'] = "Configuration File";
$content['LN_GEN_ACCESSDENIED'] = "Access denied to this function";
$content['LN_GEN_DEFVIEWS'] = "Default selected view";
$content['LN_GEN_DEFSOURCE'] = "Default selected source";
// User Center
$content['LN_USER_CENTER'] = "User Options";

View File

@ -75,6 +75,8 @@ $content['LN_GEN_INTERNAL'] = "Internal";
$content['LN_GEN_DISABLED'] = "Function disabled";
$content['LN_GEN_CONFIGFILE'] = "Configuration File";
$content['LN_GEN_ACCESSDENIED'] = "Access denied to this function";
$content['LN_GEN_DEFVIEWS'] = "Default selected view";
$content['LN_GEN_DEFSOURCE'] = "Default selected source";
// User Center
$content['LN_USER_CENTER'] = "User Options";

View File

@ -34,6 +34,29 @@
</select>
</td>
</tr>
<tr>
<td align="left" class="cellmenu1" nowrap><b>{LN_GEN_DEFVIEWS}</b></td>
<td align="right" class="line1" width="100%">
<select id="DefaultViewsID" name="DefaultViewsID" size="1">
<!-- BEGIN VIEWS -->
<option {selected} value="{ID}">{DisplayName}</option>
<!-- END VIEWS -->
</select>
</td>
</tr>
<tr>
<td align="left" class="cellmenu1" nowrap><b>{LN_GEN_DEFSOURCE}</b></td>
<td align="right" class="line1" width="100%">
<select id="DefaultSourceID" name="DefaultSourceID" size="1">
<!-- BEGIN SOURCES -->
<option {selected} value="{ID}">{Name}</option>
<!-- END SOURCES -->
</select>
</td>
</tr>
<tr>
<td align="left" class="cellmenu1" nowrap><b>{LN_GEN_PREPENDTITLE}</b></td>
<td align="right" class="line1" ><input type="text" name="PrependTitle" size="40" maxlength="255" value="{PrependTitle}"></td>