$oBrick->restoreAt($iTime); if (!$oBrick->save()) { throw new ErrorException("Can't save !"); } if (file_exists(DOMParser::getCachePathFor($sPage))) { unlink(DOMParser::getCachePathFor($sPage)); } $wout->redirect('/admin/' . $sPage); }); $wout->get('/admin/list/:ref/element/add/:page', 'admin_middleware', function ($sListRef, $sPage) use($wout, $utils) { $oListBrick = new ListBrick($sPage, $sListRef, $utils->getDefaultLanguage()); $aListBrickContent = $oListBrick->content; $aListBrickContent[] = Utils::genUID(); $oListBrick->content = $aListBrickContent; $utils->globals->session('stored_data', array('modal' => array('url' => '/ajax/list.manager.html', 'data' => array($oListBrick->save() ? 'success' : 'error' => true, 'page' => $sPage, 'list' => $sListRef)))); $wout->redirect('/admin/' . $sPage); }); $wout->get('/admin/list/:ref/element/:element/delete/:page', 'admin_middleware', function ($sListRef, $iElementIndex, $sPage) use($wout, $utils) { $oListBrick = new ListBrick($sPage, $sListRef, $utils->getDefaultLanguage()); $aListBrickContent = $oListBrick->content; array_splice($aListBrickContent, $iElementIndex, 1); $oListBrick->content = $aListBrickContent; $utils->globals->session('stored_data', array('modal' => array('url' => '/ajax/list.manager.html', 'data' => array($oListBrick->save() ? 'success' : 'error' => true, 'page' => $sPage, 'list' => $sListRef)))); $wout->redirect('/admin/' . $sPage); }); $wout->get('/admin/exit/', function () use($wout) { session_destroy(); unset($_SESSION); $_SESSION = array(); $wout->redirect('/'); });
$oModal->displayRestoreBox($sType, new $sBrickClass($sPage, $sRef, $utils->globals->session('lang', $utils->getDefaultLanguage()))); }); $wout->post('/ajax/sitemap.html', 'ajax_admin_middleware', function () use($wout, $utils) { $oModal = new Modals(); $aPages = $utils->getPages(); $oModal->setTitle("Édition des pages du site", "sitemap-image"); $oModal->displaySitemapBox($aPages); }); $wout->post('/ajax/sitemap.order.html', 'ajax_admin_middleware', function () use($wout, $utils) { $utils->data->set(':sitemap', $utils->globals->post('order')); die($utils->data->save()); }); $wout->post('/ajax/list.manager.html', 'ajax_admin_middleware', function () use($wout, $utils) { $oListBrick = new ListBrick($utils->globals->post('page'), $utils->globals->post('list'), $utils->getDefaultLanguage()); $oModal = new Modals(); $oModal->setTitle("Gestion de la liste", "category"); $oModal->displayListManagerBox($utils->globals->post('list'), $oListBrick); }); $wout->post('/ajax/list/:ref/list.order.html', 'ajax_admin_middleware', function ($sListRef) use($wout, $utils) { $oListBrick = new ListBrick($utils->globals->post('page'), $sListRef, $utils->getDefaultLanguage()); $oListBrick->content = $utils->globals->post('order'); die($oListBrick->save()); }); $wout->post('/ajax/about.html', 'ajax_admin_middleware', function () use($wout, $utils) { $oBranding = Branding::getInstance(); $oBranding->brand = $utils->data->get(':config:brand', Branding::BRAND_POSIB); $sChangelog = file_get_contents(POSIB . 'changelog.inc'); $oModal = new Modals(); $oModal->setTitle("À propos de...", 'infocard'); $oModal->displayAboutBox($oBranding, $sChangelog); });