Example #1
0
 switch ($sOperation) {
     case 'backup':
         require_once APPROOT . '/application/startup.inc.php';
         require_once APPROOT . '/application/loginwebpage.class.inc.php';
         LoginWebPage::DoLogin(true);
         // Check user rights and prompt if needed (must be admin)
         $oPage = new ajax_page("");
         $oPage->no_cache();
         $oPage->SetContentType('text/html');
         if (utils::GetConfig()->Get('demo_mode')) {
             $oPage->add("<div data-error-stimulus=\"Error\">Sorry, iTop is in <b>demonstration mode</b>: the feature is disabled.</div>");
         } else {
             try {
                 set_time_limit(0);
                 $oBB = new BackupExec(APPROOT . 'data/backups/manual/', 0);
                 $sRes = $oBB->Process(time() + 36000);
                 // 10 hours to complete should be sufficient!
             } catch (Exception $e) {
                 $oPage->p('Error: ' . $e->getMessage());
             }
         }
         $oPage->output();
         break;
     case 'restore_get_token':
         require_once APPROOT . '/application/startup.inc.php';
         require_once APPROOT . '/application/loginwebpage.class.inc.php';
         LoginWebPage::DoLogin(true);
         // Check user rights and prompt if needed (must be admin)
         $oPage = new ajax_page("");
         $oPage->no_cache();
         $oPage->SetContentType('text/html');