- /* Otherwise, report an error. */
- $errTitle = sprintf( _("Error opening %s"), $default_pref );
- if (!is_readable($default_pref)) {
- $errString = $errTitle . "<br>\n" .
- _("Default preference file not found or not readable!") . "<br>\n" .
- _("Please contact your system administrator and report this error.") . "<br>\n";
- include_once(SM_PATH . 'functions/display_messages.php' );
- logout_error( $errString, $errTitle );
- exit;
- } else if (!@copy($default_pref, $filename)) {
+ /* If no legacies, check where we'd expect it to be located:
+ * under config/ */
+ if (!@file_exists($default_pref)) {
+ $default_pref = SM_PATH . 'config/default_pref';
+ }
+
+ /* If a default_pref file found, try to copy it, if none found,
+ * try to create an empty one. If that fails, report an error.
+ */
+ if (
+ ( is_readable($default_pref) && !@copy($default_pref, $filename) ) ||
+ !@touch($filename)
+ ) {