aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php48
1 files changed, 3 insertions, 45 deletions
diff --git a/index.php b/index.php
index 030fdfa3..47fef3ed 100644
--- a/index.php
+++ b/index.php
@@ -578,51 +578,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM
578 } 578 }
579 579
580 if ($targetPage == Router::$PAGE_IMPORT) { 580 if ($targetPage == Router::$PAGE_IMPORT) {
581 // Upload a Netscape bookmark dump to import its contents 581 header('Location: ./admin/import');
582
583 if (! isset($_POST['token']) || ! isset($_FILES['filetoupload'])) {
584 // Show import dialog
585 $PAGE->assign(
586 'maxfilesize',
587 get_max_upload_size(
588 ini_get('post_max_size'),
589 ini_get('upload_max_filesize'),
590 false
591 )
592 );
593 $PAGE->assign(
594 'maxfilesizeHuman',
595 get_max_upload_size(
596 ini_get('post_max_size'),
597 ini_get('upload_max_filesize'),
598 true
599 )
600 );
601 $PAGE->assign('pagetitle', t('Import') .' - '. $conf->get('general.title', 'Shaarli'));
602 $PAGE->renderPage('import');
603 exit;
604 }
605
606 // Import bookmarks from an uploaded file
607 if (isset($_FILES['filetoupload']['size']) && $_FILES['filetoupload']['size'] == 0) {
608 // The file is too big or some form field may be missing.
609 $msg = sprintf(
610 t(
611 'The file you are trying to upload is probably bigger than what this webserver can accept'
612 .' (%s). Please upload in smaller chunks.'
613 ),
614 get_max_upload_size(ini_get('post_max_size'), ini_get('upload_max_filesize'))
615 );
616 echo '<script>alert("'. $msg .'");document.location=\'./?do='.Router::$PAGE_IMPORT .'\';</script>';
617 exit;
618 }
619 if (! $sessionManager->checkToken($_POST['token'])) {
620 die('Wrong token.');
621 }
622 $netscapeBookmarkUtils = new NetscapeBookmarkUtils($bookmarkService, $conf, $history);
623 $status = $netscapeBookmarkUtils->import($_POST, $_FILES);
624 echo '<script>alert("'.$status.'");document.location=\'./?do='
625 .Router::$PAGE_IMPORT .'\';</script>';
626 exit; 582 exit;
627 } 583 }
628 584
@@ -1064,6 +1020,8 @@ $app->group('', function () {
1064 $this->get('/admin/shaare/{id:[0-9]+}/pin', '\Shaarli\Front\Controller\Admin\ManageShaareController:pinBookmark'); 1020 $this->get('/admin/shaare/{id:[0-9]+}/pin', '\Shaarli\Front\Controller\Admin\ManageShaareController:pinBookmark');
1065 $this->get('/admin/export', '\Shaarli\Front\Controller\Admin\ExportController:index'); 1021 $this->get('/admin/export', '\Shaarli\Front\Controller\Admin\ExportController:index');
1066 $this->post('/admin/export', '\Shaarli\Front\Controller\Admin\ExportController:export'); 1022 $this->post('/admin/export', '\Shaarli\Front\Controller\Admin\ExportController:export');
1023 $this->get('/admin/import', '\Shaarli\Front\Controller\Admin\ImportController:index');
1024 $this->post('/admin/import', '\Shaarli\Front\Controller\Admin\ImportController:import');
1067 1025
1068 $this->get('/links-per-page', '\Shaarli\Front\Controller\Admin\SessionFilterController:linksPerPage'); 1026 $this->get('/links-per-page', '\Shaarli\Front\Controller\Admin\SessionFilterController:linksPerPage');
1069 $this->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility'); 1027 $this->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility');