DRY use OC_Template::printErrorPage

This commit is contained in:
Bart Visscher 2013-07-21 22:30:32 +02:00
parent df8ad46dae
commit 8c5df31c49
2 changed files with 10 additions and 22 deletions

View File

@ -220,16 +220,11 @@ class OC_Files {
if (!OC_Config::getValue('allowZipDownload', true)) { if (!OC_Config::getValue('allowZipDownload', true)) {
$l = OC_L10N::get('lib'); $l = OC_L10N::get('lib');
header("HTTP/1.0 409 Conflict"); header("HTTP/1.0 409 Conflict");
$tmpl = new OC_Template('', 'error', 'user'); OC_Template::printErrorPage(
$errors = array( $l->t('ZIP download is turned off.'),
array( $l->t('Files need to be downloaded one by one.')
'error' => $l->t('ZIP download is turned off.'), . '<br/><a href="javascript:history.back()">' . $l->t('Back to Files') . '</a>'
'hint' => $l->t('Files need to be downloaded one by one.')
. '<br/><a href="javascript:history.back()">' . $l->t('Back to Files') . '</a>',
)
); );
$tmpl->assign('errors', $errors);
$tmpl->printPage();
exit; exit;
} }
@ -252,17 +247,12 @@ class OC_Files {
if ($totalsize > $zipLimit) { if ($totalsize > $zipLimit) {
$l = OC_L10N::get('lib'); $l = OC_L10N::get('lib');
header("HTTP/1.0 409 Conflict"); header("HTTP/1.0 409 Conflict");
$tmpl = new OC_Template('', 'error', 'user'); OC_Template::printErrorPage(
$errors = array( $l->t('Selected files too large to generate zip file.'),
array( 'Download the files in smaller chunks, seperately'
'error' => $l->t('Selected files too large to generate zip file.'), .' or kindly ask your administrator.<br/><a href="javascript:history.back()">'
'hint' => 'Download the files in smaller chunks, seperately' . $l->t('Back to Files') . '</a>'
.' or kindly ask your administrator.<br/><a href="javascript:history.back()">'
. $l->t('Back to Files') . '</a>',
)
); );
$tmpl->assign('errors', $errors);
$tmpl->printPage();
exit; exit;
} }
} }

View File

@ -185,9 +185,7 @@ class OC_Setup {
$hint = $l->t('Please double check the <a href=\'%s\'>installation guides</a>.', $hint = $l->t('Please double check the <a href=\'%s\'>installation guides</a>.',
'http://doc.owncloud.org/server/5.0/admin_manual/installation.html'); 'http://doc.owncloud.org/server/5.0/admin_manual/installation.html');
$tmpl = new OC_Template('', 'error', 'guest'); OC_Template::printErrorPage($error, $hint);
$tmpl->assign('errors', array(1 => array('error' => $error, 'hint' => $hint)));
$tmpl->printPage();
exit(); exit();
} }
} }