+// Filter to handle configuration
+function FILTER_HANDLE_HOME_IN_INDEX_SETTING ($filterData) {
+ // Is ext-sql_patches up-to-date?
+ if ((isExtensionInstalledAndNewer('sql_patches', '0.8.3')) && (isDisplayHomeInIndexEnabled())) {
+ // Is 'search' as same as 'index_home'?
+ if ($filterData['search'] == getIndexHome()) {
+ // Then set 'content' to link to index.php
+ $filterData['content'] = $filterData['prefix'] . '<strong><a class="you_are_here" href="{%url=index.php' . $filterData['link_add'] . '%}">' . getTitleFromMenu($filterData['access_level'], $filterData['search'], $filterData['type'], $filterData['add']) . '</a></strong>';
+ } // END - if
+ } // END - if
+
+ // Return data
+ return $filterData;
+}
+
+// Filter to add history entry
+function FILTER_ADD_HISTORY_ENTRY ($filterData) {
+ // Add the entry
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_history` (`history_subject`,`history_userid`,`history_value`) VALUES ('%s',%s,'%s')",
+ $filterData,
+ __FUNCTION__, __LINE__);
+
+ // Remember insert id for other filters
+ $filterData['history_id'] = SQL_INSERTID();
+
+ // Return data
+ return $filterData;
+}
+
+// Filter for initializing ext-sql_patches
+function FILTER_GENERATE_FILE_SECRET_HASH ($filterData) {
+ // Transfer POINTS word
+ if (isExtensionInstalledAndNewer('sql_patches', '0.0.3')) {
+ // Okay, recent enough, so transfer the word for POINTS
+ setConfigEntry('POINTS', getPointsWord());
+ } // END - if
+
+ // Init key
+ setConfigEntry('secret_key', '');
+
+ // Read key from secret file
+ if ((getFileHash() == '') || (getMasterSalt() == '') || (getPassScramble() == '')) {
+ // Maybe need setup of secret key!
+ loadIncludeOnce('inc/gen_sql_patches.php');
+ } // END - if
+
+ // Test again
+ if ((getFileHash() != '') && (getMasterSalt() != '') && (getPassScramble() != '')) {
+ // File hash fas generated so we can also file the secret file... hopefully.
+ $hashFile = sprintf("%s%s.%s.cache", getPath(), getCachePath(), getFileHash());
+
+ // Is the secret key file readable?
+ if (isFileReadable($hashFile)) {
+ // Read file
+ setConfigEntry('secret_key', readFromFile($hashFile));
+ } else {
+ // Remove it from database
+ updateConfiguration('file_hash', '');
+
+ // Cannot read secret file!
+ reportBug(__FILE__, __LINE__, 'Cannot read secret file! Please try to reload.');
+ }
+ } // END - if
+
+ // Return data
+ return $filterData;
+}
+