$string['exportqueuedforced'] = 'Portfolio export has been successfully queued for transfer (the remote system has enforced queued transfers)';
$string['exportedpreviously'] = 'Previous exports';
$string['exportexceptionnoexporter'] = 'A portfolio_export_exception was thrown with an active session but no exporter object';
+$string['exportexpired'] = 'Portfolio export expired';
+$string['exportexpireddesc'] = 'You tried to repeat the export of some information, or start an empty export. To do that properly you should go back to the original location and start again. This sometimes happens if you use the back button after an export has completed, or by bookmarking an invalid url.';
$string['failedtosendpackage'] = 'Failed to send your data to the selected portfolio system: original error was $a';
$string['failedtopackage'] = 'Could not find files to package';
$string['filedenied'] = 'Access denied to this file';
);
}
+ /** wrapper function to print a friendly error to users
+ *
+ * this is generally caused by them hitting an expired transfer
+ * through the usage of the backbutton
+ */
+ public static function print_expired_export() {
+ $title = get_string('exportexpired', 'portfolio');
+ print_header($title, $title);
+ notify(get_string('exportexpireddesc', 'portfolio'));
+ print_footer();
+ exit;
+ }
+
}
?>
unset($SESSION->portfolioexport);
redirect($CFG->wwwroot);
} else {
- throw $e;
+ portfolio_exporter::print_expired_export();
}
}
if ($cancel) {
}
}
} else {
+
+ if (empty($_GET) && empty($_POST)) {
+ portfolio_exporter::print_expired_export();
+ }
// we'e just posted here for the first time and have might the instance already
if ($instance = optional_param('instance', 0, PARAM_INT)) {
// this can throw exceptions but there's no point catching and rethrowing here
$instance = null;
}
- $callbackfile = required_param('callbackfile', PARAM_PATH);
- $callbackclass = required_param('callbackclass', PARAM_ALPHAEXT);
+ $callbackfile = optional_param('callbackfile', null, PARAM_PATH);
+ $callbackclass = optional_param('callbackclass', null, PARAM_ALPHAEXT);
+
+ if (empty($callbackfile) || empty($callbackclass)) {
+ portfolio_exporter::print_expired_export();
+ }
$callbackargs = array();
foreach (array_keys(array_merge($_GET, $_POST)) as $key) {