Files
Phraseanet/lib/Alchemy/Phrasea/Controller/Admin/Setup.php
Romain Neutron ea7523f1db Merge branch '3.8'
Conflicts:
	lib/Alchemy/Phrasea/Controller/Admin/Publications.php
	lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php
	lib/Alchemy/Phrasea/Controller/Api/V1.php
	lib/Alchemy/Phrasea/Controller/Lightbox.php
	lib/Alchemy/Phrasea/Controller/Permalink.php
	lib/Alchemy/Phrasea/Controller/Prod/Feed.php
	lib/Alchemy/Phrasea/Controller/Prod/Order.php
	lib/Alchemy/Phrasea/Controller/Prod/Push.php
	lib/Alchemy/Phrasea/Controller/Prod/Share.php
	lib/Alchemy/Phrasea/Controller/Root/Login.php
	lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php
	lib/Alchemy/Phrasea/Controller/Root/Session.php
	lib/Alchemy/Phrasea/Controller/Setup.php
	lib/Alchemy/Phrasea/Core/CLIProvider/LessBuilderServiceProvider.php
	lib/Alchemy/Phrasea/Core/Provider/ORMServiceProvider.php
	lib/Alchemy/Phrasea/Core/Provider/TaskManagerServiceProvider.php
	lib/classes/Feed/Entry/Item.php
	lib/classes/record/adapter.php
	lib/classes/task/Scheduler.php
	lib/classes/task/manager.php
	lib/classes/task/period/RecordMover.php
	lib/classes/task/period/archive.php
	lib/classes/task/period/cindexer.php
	lib/classes/task/period/ftp.php
	lib/classes/task/period/ftpPull.php
	lib/classes/task/period/subdef.php
	lib/classes/task/period/writemeta.php
	tests/Alchemy/Tests/Phrasea/Border/ManagerTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Root/RSSFeedTest.php
	tests/classes/Feed/Entry/Feed_Entry_ItemTest.php
	tests/classes/PhraseanetPHPUnitAbstract.php
2013-10-31 14:01:44 +01:00

98 lines
2.6 KiB
PHP

<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Controller\Admin;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
use Alchemy\Phrasea\Application;
use Silex\Application as SilexApplication;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class Setup implements ControllerProviderInterface
{
public function connect(SilexApplication $app)
{
$app['controller.admin.setup'] = $this;
$controllers = $app['controllers_factory'];
$controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAdmin();
});
$controllers->get('/', 'controller.admin.setup:getGlobals')
->bind('setup_display_globals');
$controllers->post('/', 'controller.admin.setup:postGlobals')
->bind('setup_submit_globals');
return $controllers;
}
/**
* Display global values
*
* @param Application $app
* @param Request $request
* @return Response
*/
public function getGlobals(Application $app, Request $request)
{
$GV = require_once __DIR__ . "/../../../../conf.d/_GV_template.inc";
if (null !== $update = $request->query->get('update')) {
if (!!$update) {
$update = _('Update succeed');
} else {
$update = _('Update failed');
}
}
return $app['twig']->render('admin/setup.html.twig', array(
'GV' => $GV,
'update_post_datas' => $update,
'listTimeZone' => \DateTimeZone::listAbbreviations()
));
}
/**
* Submit global values
*
* @param Application $app
* @param Request $request
* @return RedirectResponse
*/
public function postGlobals(Application $app, Request $request)
{
if (\setup::create_global_values($app, $request->request->all())) {
return $app->redirectPath('setup_display_globals', array(
'success' => 1
));
}
return $app->redirectPath('setup_display_globals', array(
'success' => 0
));
}
}