本文整理汇总了PHP中Alchemy\Phrasea\Application::redirectPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::redirectPath方法的具体用法?PHP Application::redirectPath怎么用?PHP Application::redirectPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alchemy\Phrasea\Application
的用法示例。
在下文中一共展示了Application::redirectPath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post
/**
* {@inheritdoc}
*/
public function post(Application $app, Request $request)
{
$configuration = $this->getConfiguration();
$configuration['host'] = $request->request->get('host');
$configuration['port'] = $request->request->get('port');
$this->saveConfiguration($configuration);
return $app->redirectPath('admin_searchengine_get');
}
示例2: getGlobals
public function getGlobals(Application $app, Request $request)
{
$form = $app['registry.manipulator']->createForm($app['conf']);
if ('POST' === $request->getMethod()) {
$form->bind($request);
if ($form->isValid()) {
$app['conf']->set('registry', $app['registry.manipulator']->getRegistryData($form));
return $app->redirectPath('setup_display_globals');
}
}
return $app['twig']->render('admin/setup.html.twig', ['form' => $form->createView()]);
}
示例3: redirectOnLogRequests
/**
* @param Request $request
* @param PhraseaApplication $app
* @return RedirectResponse|null
*/
public function redirectOnLogRequests(Request $request, PhraseaApplication $app)
{
if (!$request->query->has('LOG')) {
return null;
}
if ($app->getAuthenticator()->isAuthenticated()) {
$app->getAuthenticator()->closeAccount();
}
if (null === ($token = $app['repo.tokens']->findValidToken($request->query->get('LOG')))) {
$app->addFlash('error', $app->trans('The URL you used is out of date, please login'));
return $app->redirectPath('homepage');
}
/** @var Token $token */
$app->getAuthenticator()->openAccount($token->getUser());
switch ($token->getType()) {
case TokenManipulator::TYPE_FEED_ENTRY:
return $app->redirectPath('lightbox_feed_entry', ['entry_id' => $token->getData()]);
case TokenManipulator::TYPE_VALIDATE:
case TokenManipulator::TYPE_VIEW:
return $app->redirectPath('lightbox_validation', ['basket' => $token->getData()]);
}
return null;
}
示例4: doInstall
public function doInstall(Application $app, Request $request)
{
set_time_limit(360);
$servername = $request->getScheme() . '://' . $request->getHttpHost() . '/';
$abConn = $dbConn = null;
$hostname = $request->request->get('ab_hostname');
$port = $request->request->get('ab_port');
$user_ab = $request->request->get('ab_user');
$ab_password = $request->request->get('ab_password');
$appbox_name = $request->request->get('ab_name');
$databox_name = $request->request->get('db_name');
try {
$abConn = $app['dbal.provider']->get(['host' => $hostname, 'port' => $port, 'user' => $user_ab, 'password' => $ab_password, 'dbname' => $appbox_name]);
$abConn->connect();
} catch (\Exception $e) {
return $app->redirectPath('install_step2', ['error' => $app->trans('Appbox is unreachable')]);
}
try {
if ($databox_name) {
$dbConn = $app['dbal.provider']->get(['host' => $hostname, 'port' => $port, 'user' => $user_ab, 'password' => $ab_password, 'dbname' => $databox_name]);
$dbConn->connect();
}
} catch (\Exception $e) {
return $app->redirectPath('install_step2', ['error' => $app->trans('Databox is unreachable')]);
}
$email = $request->request->get('email');
$password = $request->request->get('password');
$template = $request->request->get('db_template');
$dataPath = $request->request->get('datapath_noweb');
try {
$installer = $app['phraseanet.installer'];
$installer->setPhraseaIndexerPath($request->request->get('binary_phraseanet_indexer'));
$binaryData = [];
foreach (['php_binary' => $request->request->get('binary_php'), 'phraseanet_indexer' => $request->request->get('binary_phraseanet_indexer'), 'swf_extract_binary' => $request->request->get('binary_swfextract'), 'pdf2swf_binary' => $request->request->get('binary_pdf2swf'), 'swf_render_binary' => $request->request->get('binary_swfrender'), 'unoconv_binary' => $request->request->get('binary_unoconv'), 'ffmpeg_binary' => $request->request->get('binary_ffmpeg'), 'mp4box_binary' => $request->request->get('binary_MP4Box'), 'pdftotext_binary' => $request->request->get('binary_xpdf'), 'recess_binary' => $request->request->get('binary_recess')] as $key => $path) {
$binaryData[$key] = $path;
}
$user = $installer->install($email, $password, $abConn, $servername, $dataPath, $dbConn, $template, $binaryData);
$app['authentication']->openAccount($user);
return $app->redirectPath('admin', ['section' => 'taskmanager', 'notice' => 'install_success']);
} catch (\Exception $e) {
return $app->redirectPath('install_step2', ['error' => $app->trans('an error occured : %message%', ['%message%' => $e->getMessage()])]);
}
}
示例5: authenticate
/**
* Authenticate to phraseanet
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
* @return RedirectResponse
*/
public function authenticate(PhraseaApplication $app, Request $request)
{
$form = $app->form(new PhraseaAuthenticationForm());
$redirector = function (array $params = []) use($app) {
return $app->redirectPath('homepage', $params);
};
try {
return $this->doAuthentication($app, $request, $form, $redirector);
} catch (AuthenticationException $e) {
return $e->getResponse();
}
}
示例6: resetEmail
/**
* Reset Email
*
* @param Application $app
* @param Request $request
* @return RedirectResponse
*/
public function resetEmail(PhraseaApplication $app, Request $request)
{
if (null === ($password = $request->request->get('form_password')) || null === ($email = $request->request->get('form_email')) || null === ($emailConfirm = $request->request->get('form_email_confirm'))) {
$app->abort(400, $app->trans('Could not perform request, please contact an administrator.'));
}
$user = $app['authentication']->getUser();
if (!$app['auth.password-encoder']->isPasswordValid($user->getPassword(), $password, $user->getNonce())) {
$app->addFlash('error', $app->trans('admin::compte-utilisateur:ftp: Le mot de passe est errone'));
return $app->redirectPath('account_reset_email');
}
if (!\Swift_Validate::email($email)) {
$app->addFlash('error', $app->trans('forms::l\'email semble invalide'));
return $app->redirectPath('account_reset_email');
}
if ($email !== $emailConfirm) {
$app->addFlash('error', $app->trans('forms::les emails ne correspondent pas'));
return $app->redirectPath('account_reset_email');
}
$date = new \DateTime('1 day');
$token = $app['tokens']->getUrlToken(\random::TYPE_EMAIL, $app['authentication']->getUser()->getId(), $date, $app['authentication']->getUser()->getEmail());
$url = $app->url('account_reset_email', ['token' => $token]);
try {
$receiver = Receiver::fromUser($app['authentication']->getUser());
} catch (InvalidArgumentException $e) {
$app->addFlash('error', $app->trans('phraseanet::erreur: echec du serveur de mail'));
return $app->redirectPath('account_reset_email');
}
$mail = MailRequestEmailUpdate::create($app, $receiver, null);
$mail->setButtonUrl($url);
$mail->setExpiration($date);
$app['notification.deliverer']->deliver($mail);
$app->addFlash('info', $app->trans('admin::compte-utilisateur un email de confirmation vient de vous etre envoye. Veuillez suivre les instructions contenue pour continuer'));
return $app->redirectPath('account');
}
示例7: call_user_func
return call_user_func(function ($environment = PhraseaApplication::ENV_PROD) {
$app = new PhraseaApplication($environment);
$app->loadPlugins();
$app['exception_handler'] = $app->share(function ($app) {
return new PhraseaExceptionHandlerSubscriber($app['phraseanet.exception_handler']);
});
$app['monolog'] = $app->share($app->extend('monolog', function (Logger $monolog) {
$monolog->pushProcessor(new WebProcessor());
return $monolog;
}));
$app->before(function (Request $request) use($app) {
if (0 === strpos($request->getPathInfo(), '/setup')) {
if (!$app['phraseanet.configuration-tester']->isInstalled()) {
if (!$app['phraseanet.configuration-tester']->isBlank()) {
if ('setup_upgrade_instructions' !== $app['request']->attributes->get('_route')) {
return $app->redirectPath('setup_upgrade_instructions');
}
}
} elseif (!$app['phraseanet.configuration-tester']->isBlank()) {
return $app->redirectPath('homepage');
}
} else {
if (false === strpos($request->getPathInfo(), '/include/minify')) {
$app['firewall']->requireSetup();
}
}
}, Application::EARLY_EVENT);
$app->bindRoutes();
if (PhraseaApplication::ENV_DEV === $app->getEnvironment()) {
$app->register($p = new WebProfilerServiceProvider(), ['profiler.cache_dir' => $app['cache.path'] . '/profiler']);
$app->mount('/_profiler', $p);