diff --git a/src/include/functions_config.php b/src/include/functions_config.php index bb81085..cf83742 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -132,8 +132,12 @@ $currentSourceID = $_SESSION['currentSourceID']; else { - // No Source stored in session, then to so now! - $_SESSION['currentSourceID'] = $currentSourceID; + if ( isset($CFG['DefaultSourceID']) && isset($content['Sources'][ $CFG['DefaultSourceID'] ]) ) + // Set Source to preconfigured sourceID! + $_SESSION['currentSourceID'] = $CFG['DefaultSourceID']; + else + // No Source stored in session, then to so now! + $_SESSION['currentSourceID'] = $currentSourceID; } } diff --git a/src/include/functions_frontendhelpers.php b/src/include/functions_frontendhelpers.php index e790e96..9520aab 100644 --- a/src/include/functions_frontendhelpers.php +++ b/src/include/functions_frontendhelpers.php @@ -67,13 +67,36 @@ function InstallFileReminder() function CreateCurrentUrl() { - global $content; + global $content, $CFG; $content['CURRENTURL'] = $_SERVER['PHP_SELF']; // . "?" . $_SERVER['QUERY_STRING'] // Init additional_url helper variable $content['additional_url'] = ""; $content['additional_url_uidonly'] = ""; $content['additional_url_sortingonly'] = ""; + $content['additional_url_sourceonly'] = ""; + + // Hidden Vars Counter + $hvCounter = 0; + + // Append SourceID into everything! + if ( (isset($CFG['DefaultSourceID']) && isset($content['Sources'][ $CFG['DefaultSourceID'] ])) && isset($_SESSION['currentSourceID']) ) + { + + // If the DefaultSourceID differes from the SourceID in our Session, we will append the sourceid within all URL's! + if ( $CFG['DefaultSourceID'] != $_SESSION['currentSourceID'] ) + { + $content['additional_url'] .= "&sourceid=" . $_SESSION['currentSourceID']; + $content['additional_url_uidonly'] = "&sourceid=" . $_SESSION['currentSourceID']; + $content['additional_url_sortingonly'] = "&sourceid=" . $_SESSION['currentSourceID']; + $content['additional_url_sourceonly'] = "&sourceid=" . $_SESSION['currentSourceID']; + + // For forms! + $content['HIDDENVARS_SOURCE'][$hvCounter]['varname'] = "sourceid"; + $content['HIDDENVARS_SOURCE'][$hvCounter]['varvalue'] = $_SESSION['currentSourceID']; + $hvCounter++; + } + } // Now the query string: if ( isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0 ) @@ -82,7 +105,6 @@ function CreateCurrentUrl() $content['CURRENTURL'] .= "?"; $queries = explode ("&", $_SERVER['QUERY_STRING']); - $counter = 0; for ( $i = 0; $i < count($queries); $i++ ) { // Some properties need to be filtered out. @@ -92,8 +114,8 @@ function CreateCurrentUrl() if ( isset($tmpvars[1]) ) // Only if value param is set! { // For forms! - $content['HIDDENVARS'][$counter]['varname'] = $tmpvars[0]; - $content['HIDDENVARS'][$counter]['varvalue'] = $tmpvars[1]; + $content['HIDDENVARS'][$hvCounter]['varname'] = $tmpvars[0]; + $content['HIDDENVARS'][$hvCounter]['varvalue'] = $tmpvars[1]; if ( strlen($tmpvars[1]) > 0 ) { @@ -114,7 +136,7 @@ function CreateCurrentUrl() $content['additional_url'] .= "&" . $tmpvars[0] . "=" . $tmpvars[1]; } - $counter++; + $hvCounter++; } } } diff --git a/src/install.php b/src/install.php index 46d4258..e38af00 100644 --- a/src/install.php +++ b/src/install.php @@ -592,7 +592,8 @@ else if ( $content['INSTALL_STEP'] == 8 ) } //Add the first source! - $firstsource = "\$CFG['Sources']['Source1']['ID'] = 'Source1';\r\n" . + $firstsource = "\$CFG['DefaultSourceID'] = 'Source1';\r\n\r\n" . + "\$CFG['Sources']['Source1']['ID'] = 'Source1';\r\n" . "\$CFG['Sources']['Source1']['Name'] = '" . $_SESSION['SourceName'] . "';\r\n" . "\$CFG['Sources']['Source1']['SourceType'] = " . $_SESSION['SourceType'] . ";\r\n"; if ( $_SESSION['SourceType'] == SOURCE_DISK ) diff --git a/src/search.php b/src/search.php index 802b7aa..37584ba 100644 --- a/src/search.php +++ b/src/search.php @@ -169,9 +169,15 @@ if ( (isset($_POST['search']) || isset($_GET['search'])) ) if ( isset($_GET['filter_message']) && strlen($_GET['filter_message']) > 0 ) $content['searchstr'] .= $_GET['filter_message']; } + + // Append sourceid if needed + if ( isset($_GET['sourceid']) && isset($content['Sources'][ $_GET['sourceid'] ]) ) + $sourceidstr = "&sourceid=" . $_GET['sourceid']; + else + $sourceidstr = ""; // Redirect to the index page now! - RedirectPage( "index.php?filter=" . urlencode( trim($content['searchstr']) ) . "&search=Search"); + RedirectPage( "index.php?filter=" . urlencode( trim($content['searchstr']) ) . "&search=Search" . $sourceidstr); } // --- diff --git a/src/templates/details.html b/src/templates/details.html index 3df4db9..573c77a 100644 --- a/src/templates/details.html +++ b/src/templates/details.html @@ -8,7 +8,7 @@
- |