mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 11:33:17 +00:00
Use short array declaration
This commit is contained in:
@@ -57,10 +57,10 @@ $cli = new CLI("
|
||||
. ' Phraseanet Developer Tools ', Version::getName() . ' ' . Version::getNumber());
|
||||
|
||||
if ($cli['configuration']->isSetup()) {
|
||||
$helpers = array(
|
||||
$helpers = [
|
||||
'db' => new ConnectionHelper($cli['EM']->getConnection()),
|
||||
'em' => new EntityManagerHelper($cli['EM'])
|
||||
);
|
||||
];
|
||||
|
||||
$helperSet = $cli['console']->getHelperSet();
|
||||
foreach ($helpers as $name => $helper) {
|
||||
@@ -80,7 +80,7 @@ $cli->command(new Uninstaller());
|
||||
$cli->command(new \module_console_systemTemplateGenerator('system:generate-templates'));
|
||||
|
||||
|
||||
$cli['console']->addCommands(array(
|
||||
$cli['console']->addCommands([
|
||||
// DBAL Commands
|
||||
new RunSqlCommand(),
|
||||
new ImportCommand(),
|
||||
@@ -99,6 +99,6 @@ $cli['console']->addCommands(array(
|
||||
new ConvertMappingCommand(),
|
||||
new RunDqlCommand(),
|
||||
new ValidateSchemaCommand(),
|
||||
));
|
||||
]);
|
||||
|
||||
exit($cli->runCLI());
|
||||
|
10
builder.php
10
builder.php
@@ -48,20 +48,20 @@ $finder
|
||||
->ignoreVCS(false)
|
||||
->in(__DIR__);
|
||||
|
||||
$files = array();
|
||||
$files = [];
|
||||
|
||||
foreach ($finder as $file) {
|
||||
$files[$file->getRealpath()] = $file->getRealpath();
|
||||
}
|
||||
|
||||
foreach (array(
|
||||
foreach ([
|
||||
__DIR__ . '/bin/behat',
|
||||
__DIR__ . '/bin/developer',
|
||||
__DIR__ . '/bin/doctrine.php',
|
||||
__DIR__ . '/bin/doctrine',
|
||||
__DIR__ . '/bin/phpunit',
|
||||
__DIR__ . '/bin/validate-json',
|
||||
) as $binary) {
|
||||
] as $binary) {
|
||||
if (is_file($binary)) {
|
||||
$files[$binary] = $binary;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ $finder = new Finder();
|
||||
$finder
|
||||
->ignoreDotFiles(false)
|
||||
->ignoreVCS(false)
|
||||
->in(array('logs'));
|
||||
->in(['logs']);
|
||||
|
||||
foreach ($finder as $file) {
|
||||
$files[$file->getRealpath()] = $file->getRealpath();
|
||||
@@ -118,7 +118,7 @@ $finder
|
||||
->in(__DIR__);
|
||||
|
||||
|
||||
$dirs = array();
|
||||
$dirs = [];
|
||||
|
||||
foreach ($finder as $dir) {
|
||||
$dirs[] = $dir->getRealpath();
|
||||
|
@@ -49,13 +49,13 @@ $console
|
||||
|
||||
$bridge->set_oauth_token($configuration['dailymotion']['dev_token']);
|
||||
|
||||
$options = array();
|
||||
$samples = array(
|
||||
$options = [];
|
||||
$samples = [
|
||||
'title' => $record->get_title(),
|
||||
'description' => 'Upload functionnal test',
|
||||
'tags' => 'phraseanet upload test dm api',
|
||||
'private' => true,
|
||||
);
|
||||
];
|
||||
|
||||
foreach($bridge->get_fields() as $field) {
|
||||
$options[$field['name']] = isset($samples[$field['name']]) ? $samples[$field['name']] : uniqid('test_upload');
|
||||
|
@@ -29,9 +29,9 @@ $finder
|
||||
->files()
|
||||
->name('phraseanet-*.po')
|
||||
->in(
|
||||
array(
|
||||
[
|
||||
__DIR__ . '/' . $argv[1],
|
||||
)
|
||||
]
|
||||
)
|
||||
;
|
||||
|
||||
|
@@ -152,13 +152,13 @@ use Symfony\Component\Form\Exception\FormException;
|
||||
|
||||
class Application extends SilexApplication
|
||||
{
|
||||
private static $availableLanguages = array(
|
||||
private static $availableLanguages = [
|
||||
'de_DE' => 'Deutsch',
|
||||
'en_GB' => 'English',
|
||||
'fr_FR' => 'Français',
|
||||
'nl_NL' => 'Dutch',
|
||||
);
|
||||
private static $flashTypes = array('warning', 'info', 'success', 'error');
|
||||
];
|
||||
private static $flashTypes = ['warning', 'info', 'success', 'error'];
|
||||
private $environment;
|
||||
|
||||
const ENV_DEV = 'dev';
|
||||
@@ -222,9 +222,9 @@ class Application extends SilexApplication
|
||||
|
||||
$this->register(new MediaAlchemystServiceProvider());
|
||||
$this['media-alchemyst.configuration'] = $this->share(function (Application $app) {
|
||||
$configuration = array();
|
||||
$configuration = [];
|
||||
|
||||
foreach (array(
|
||||
foreach ([
|
||||
'swftools.pdf2swf.binaries' => 'pdf2swf_binary',
|
||||
'swftools.swfrender.binaries' => 'swf_render_binary',
|
||||
'swftools.swfextract.binaries' => 'swf_extract_binary',
|
||||
@@ -239,7 +239,7 @@ class Application extends SilexApplication
|
||||
'mp4box.timeout' => 'mp4box_timeout',
|
||||
'swftools.timeout' => 'swftools_timeout',
|
||||
'unoconv.timeout' => 'unoconv_timeout',
|
||||
) as $parameter => $key) {
|
||||
] as $parameter => $key) {
|
||||
if (isset($this['configuration']['binaries'][$key])) {
|
||||
$configuration[$parameter] = $this['configuration']['binaries'][$key];
|
||||
}
|
||||
@@ -284,20 +284,20 @@ class Application extends SilexApplication
|
||||
});
|
||||
|
||||
$this->register(new SearchEngineServiceProvider());
|
||||
$this->register(new SessionServiceProvider(), array(
|
||||
$this->register(new SessionServiceProvider(), [
|
||||
'session.test' => $this->getEnvironment() === static::ENV_TEST
|
||||
));
|
||||
]);
|
||||
$this->register(new ServiceControllerServiceProvider());
|
||||
$this->register(new SwiftmailerServiceProvider());
|
||||
$this->register(new TasksServiceProvider());
|
||||
$this->register(new TemporaryFilesystemServiceProvider());
|
||||
$this->register(new TokensServiceProvider());
|
||||
$this->register(new TwigServiceProvider(), array(
|
||||
'twig.options' => array(
|
||||
$this->register(new TwigServiceProvider(), [
|
||||
'twig.options' => [
|
||||
'cache' => $this['root.path'] . '/tmp/cache_twig/',
|
||||
),
|
||||
'twig.form.templates' => array('login/common/form_div_layout.html.twig')
|
||||
));
|
||||
],
|
||||
'twig.form.templates' => ['login/common/form_div_layout.html.twig']
|
||||
]);
|
||||
$this->register(new FormServiceProvider());
|
||||
|
||||
$this->setupTwig();
|
||||
@@ -319,24 +319,24 @@ class Application extends SilexApplication
|
||||
if ($app['phraseanet.registry']->get('GV_smtp')) {
|
||||
$transport = new \Swift_Transport_EsmtpTransport(
|
||||
$app['swiftmailer.transport.buffer'],
|
||||
array($app['swiftmailer.transport.authhandler']),
|
||||
[$app['swiftmailer.transport.authhandler']],
|
||||
$app['swiftmailer.transport.eventdispatcher']
|
||||
);
|
||||
|
||||
$encryption = null;
|
||||
|
||||
if (in_array($app['phraseanet.registry']->get('GV_smtp_secure'), array('ssl', 'tls'))) {
|
||||
if (in_array($app['phraseanet.registry']->get('GV_smtp_secure'), ['ssl', 'tls'])) {
|
||||
$encryption = $app['phraseanet.registry']->get('GV_smtp_secure');
|
||||
}
|
||||
|
||||
$options = $app['swiftmailer.options'] = array_replace(array(
|
||||
$options = $app['swiftmailer.options'] = array_replace([
|
||||
'host' => $app['phraseanet.registry']->get('GV_smtp_host'),
|
||||
'port' => $app['phraseanet.registry']->get('GV_smtp_port'),
|
||||
'username' => $app['phraseanet.registry']->get('GV_smtp_user'),
|
||||
'password' => $app['phraseanet.registry']->get('GV_smtp_password'),
|
||||
'encryption' => $encryption,
|
||||
'auth_mode' => null,
|
||||
), $app['swiftmailer.options']);
|
||||
], $app['swiftmailer.options']);
|
||||
|
||||
$transport->setHost($options['host']);
|
||||
$transport->setPort($options['port']);
|
||||
@@ -400,8 +400,8 @@ class Application extends SilexApplication
|
||||
|
||||
$this['dispatcher'] = $this->share(
|
||||
$this->extend('dispatcher', function ($dispatcher, Application $app) {
|
||||
$dispatcher->addListener(KernelEvents::REQUEST, array($app, 'initSession'), 254);
|
||||
$dispatcher->addListener(KernelEvents::RESPONSE, array($app, 'addUTF8Charset'), -128);
|
||||
$dispatcher->addListener(KernelEvents::REQUEST, [$app, 'initSession'], 254);
|
||||
$dispatcher->addListener(KernelEvents::RESPONSE, [$app, 'addUTF8Charset'], -128);
|
||||
$dispatcher->addSubscriber(new LogoutSubscriber());
|
||||
$dispatcher->addSubscriber(new PhraseaLocaleSubscriber($app));
|
||||
$dispatcher->addSubscriber(new MaintenanceSubscriber($app));
|
||||
@@ -411,7 +411,7 @@ class Application extends SilexApplication
|
||||
})
|
||||
);
|
||||
|
||||
$this['log.channels'] = array('monolog', 'task-manager.logger');
|
||||
$this['log.channels'] = ['monolog', 'task-manager.logger'];
|
||||
|
||||
$this->register(new LocaleServiceProvider());
|
||||
|
||||
@@ -462,7 +462,7 @@ class Application extends SilexApplication
|
||||
*
|
||||
* @throws FormException if any given option is not applicable to the given type
|
||||
*/
|
||||
public function form($type = 'form', $data = null, array $options = array(), FormBuilderInterface $parent = null)
|
||||
public function form($type = 'form', $data = null, array $options = [], FormBuilderInterface $parent = null)
|
||||
{
|
||||
return $this['form.factory']->create($type, $data, $options, $parent);
|
||||
}
|
||||
@@ -475,7 +475,7 @@ class Application extends SilexApplication
|
||||
*
|
||||
* @return string The generated path
|
||||
*/
|
||||
public function path($route, $parameters = array())
|
||||
public function path($route, $parameters = [])
|
||||
{
|
||||
return $this['url_generator']->generate($route, $parameters, UrlGenerator::ABSOLUTE_PATH);
|
||||
}
|
||||
@@ -488,7 +488,7 @@ class Application extends SilexApplication
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function redirectPath($route, $parameters = array())
|
||||
public function redirectPath($route, $parameters = [])
|
||||
{
|
||||
return $this->redirect($this->path($route, $parameters));
|
||||
}
|
||||
@@ -501,7 +501,7 @@ class Application extends SilexApplication
|
||||
*
|
||||
* @return string The generated URL
|
||||
*/
|
||||
public function url($route, $parameters = array())
|
||||
public function url($route, $parameters = [])
|
||||
{
|
||||
return $this['url_generator']->generate($route, $parameters, UrlGenerator::ABSOLUTE_URL);
|
||||
}
|
||||
@@ -514,7 +514,7 @@ class Application extends SilexApplication
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function redirectUrl($route, $parameters = array())
|
||||
public function redirectUrl($route, $parameters = [])
|
||||
{
|
||||
return $this->redirect($this->url($route, $parameters));
|
||||
}
|
||||
@@ -671,7 +671,7 @@ class Application extends SilexApplication
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getFlash($type, array $default = array())
|
||||
public function getFlash($type, array $default = [])
|
||||
{
|
||||
return $this['session']->getFlashBag()->get($type, $default);
|
||||
}
|
||||
@@ -763,7 +763,7 @@ class Application extends SilexApplication
|
||||
*/
|
||||
public function getOpenCollections()
|
||||
{
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
public function bindRoutes()
|
||||
|
@@ -39,24 +39,24 @@ return call_user_func(function ($environment = PhraseaApplication::ENV_PROD) {
|
||||
|
||||
$result = new \API_V1_result($app, $request, $apiAdapter);
|
||||
|
||||
return $result->set_datas(array(
|
||||
return $result->set_datas([
|
||||
'name' => $app['phraseanet.registry']->get('GV_homeTitle'),
|
||||
'type' => 'phraseanet',
|
||||
'description' => $app['phraseanet.registry']->get('GV_metaDescription'),
|
||||
'documentation' => 'https://docs.phraseanet.com/Devel',
|
||||
'versions' => array(
|
||||
'1' => array(
|
||||
'versions' => [
|
||||
'1' => [
|
||||
'number' => $apiAdapter->get_version(),
|
||||
'uri' => '/api/v1/',
|
||||
'authenticationProtocol' => 'OAuth2',
|
||||
'authenticationVersion' => 'draft#v9',
|
||||
'authenticationEndPoints' => array(
|
||||
'authenticationEndPoints' => [
|
||||
'authorization_token' => '/api/oauthv2/authorize',
|
||||
'access_token' => '/api/oauthv2/token'
|
||||
)
|
||||
)
|
||||
)
|
||||
))->get_response();
|
||||
]
|
||||
]
|
||||
]
|
||||
])->get_response();
|
||||
});
|
||||
|
||||
$app->mount('/api/oauthv2', new Oauth2());
|
||||
|
@@ -50,9 +50,9 @@ return call_user_func(function ($environment = PhraseaApplication::ENV_PROD) {
|
||||
$app->bindRoutes();
|
||||
|
||||
if (PhraseaApplication::ENV_DEV === $app->getEnvironment()) {
|
||||
$app->register($p = new WebProfilerServiceProvider(), array(
|
||||
$app->register($p = new WebProfilerServiceProvider(), [
|
||||
'profiler.cache_dir' => $app['root.path'] . '/tmp/cache/profiler',
|
||||
));
|
||||
]);
|
||||
$app->mount('/_profiler', $p);
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,7 @@ class ACLProvider
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $cache = array();
|
||||
private static $cache = [];
|
||||
|
||||
private $app;
|
||||
|
||||
@@ -51,7 +51,7 @@ class ACLProvider
|
||||
*/
|
||||
public function purge()
|
||||
{
|
||||
self::$cache = array();
|
||||
self::$cache = [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -61,7 +61,7 @@ class AccountCreator
|
||||
* @throws RuntimeException In case the AccountCreator is disabled
|
||||
* @throws InvalidArgumentException In case a user with the same email already exists
|
||||
*/
|
||||
public function create(Application $app, $id, $email = null, array $templates = array())
|
||||
public function create(Application $app, $id, $email = null, array $templates = [])
|
||||
{
|
||||
if (!$this->enabled) {
|
||||
throw new RuntimeException('Account creator is disabled');
|
||||
@@ -81,7 +81,7 @@ class AccountCreator
|
||||
|
||||
$user = \User_Adapter::create($app, $login, $this->random->generatePassword(), $email, false, false);
|
||||
|
||||
$base_ids = array();
|
||||
$base_ids = [];
|
||||
foreach ($this->appbox->get_databoxes() as $databox) {
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$base_ids[] = $collection->get_base_id();
|
||||
|
@@ -88,7 +88,7 @@ class Authenticator
|
||||
|
||||
public function refreshAccount(Session $session)
|
||||
{
|
||||
if (!$this->em->getRepository('Alchemy\Phrasea\Model\Entities\Session')->findOneBy(array('id' => $session->getId()))) {
|
||||
if (!$this->em->getRepository('Alchemy\Phrasea\Model\Entities\Session')->findOneBy(['id' => $session->getId()])) {
|
||||
throw new RuntimeException('Unable to refresh the session, it does not exist anymore');
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,7 @@ class Context
|
||||
|
||||
public function setContext($context)
|
||||
{
|
||||
if (false === in_array($context, array(static::CONTEXT_OAUTH2_NATIVE, static::CONTEXT_OAUTH2_TOKEN, static::CONTEXT_NATIVE, static::CONTEXT_GUEST), true)) {
|
||||
if (false === in_array($context, [static::CONTEXT_OAUTH2_NATIVE, static::CONTEXT_OAUTH2_TOKEN, static::CONTEXT_NATIVE, static::CONTEXT_GUEST], true)) {
|
||||
throw new InvalidArgumentException(sprintf('`%s` is not a valid context', $context));
|
||||
}
|
||||
|
||||
|
@@ -39,7 +39,7 @@ class Manager
|
||||
{
|
||||
$session = $this->em
|
||||
->getRepository('Alchemy\Phrasea\Model\Entities\Session')
|
||||
->findOneBy(array('token' => $cookieValue));
|
||||
->findOneBy(['token' => $cookieValue]);
|
||||
|
||||
if (!$session) {
|
||||
return false;
|
||||
|
@@ -36,7 +36,7 @@ class NativeAuthentication implements PasswordAuthenticationInterface
|
||||
*/
|
||||
public function getUsrId($username, $password, Request $request)
|
||||
{
|
||||
if (in_array($username, array('invite', 'autoregister'))) {
|
||||
if (in_array($username, ['invite', 'autoregister'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class NativeAuthentication implements PasswordAuthenticationInterface
|
||||
LIMIT 0, 1';
|
||||
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute(array(':login' => $username));
|
||||
$stmt->execute([':login' => $username]);
|
||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
@@ -71,11 +71,11 @@ class NativeAuthentication implements PasswordAuthenticationInterface
|
||||
$sql = 'UPDATE usr SET usr_password = :password, nonce = :nonce
|
||||
WHERE usr_id = :usr_id';
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute(array(
|
||||
$stmt->execute([
|
||||
':password' => $row['usr_password'],
|
||||
':nonce' => $row['nonce'],
|
||||
':usr_id' => $row['usr_id'],
|
||||
));
|
||||
]);
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ abstract class AbstractProvider implements ProviderInterface
|
||||
*/
|
||||
public function getTemplates(Identity $identity)
|
||||
{
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -51,14 +51,14 @@ class Facebook extends AbstractProvider
|
||||
*/
|
||||
public function authenticate()
|
||||
{
|
||||
return new RedirectResponse($this->facebook->getLoginUrl(array(
|
||||
return new RedirectResponse($this->facebook->getLoginUrl([
|
||||
'scope' => 'email',
|
||||
'redirect_uri' => $this->generator->generate(
|
||||
'login_authentication_provider_callback',
|
||||
array('providerId' => $this->getId()),
|
||||
['providerId' => $this->getId()],
|
||||
UrlGenerator::ABSOLUTE_URL
|
||||
)
|
||||
)));
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -26,7 +26,7 @@ class Factory
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
public function build($name, array $options = array())
|
||||
public function build($name, array $options = [])
|
||||
{
|
||||
$name = implode('', array_map(function ($chunk) {
|
||||
return ucfirst(strtolower($chunk));
|
||||
|
@@ -84,16 +84,16 @@ class Github extends AbstractProvider
|
||||
|
||||
$this->session->set('github.provider.state', $state);
|
||||
|
||||
return new RedirectResponse('https://github.com/login/oauth/authorize?' . http_build_query(array(
|
||||
return new RedirectResponse('https://github.com/login/oauth/authorize?' . http_build_query([
|
||||
'client_id' => $this->key,
|
||||
'scope' => 'user,user:email',
|
||||
'state' => $state,
|
||||
'redirect_uri' => $this->generator->generate(
|
||||
'login_authentication_provider_callback',
|
||||
array('providerId' => $this->getId()),
|
||||
['providerId' => $this->getId()],
|
||||
UrlGenerator::ABSOLUTE_URL
|
||||
),
|
||||
), '', '&'));
|
||||
], '', '&'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,16 +120,16 @@ class Github extends AbstractProvider
|
||||
try {
|
||||
$guzzleRequest = $this->client->post('access_token');
|
||||
|
||||
$guzzleRequest->addPostFields(array(
|
||||
$guzzleRequest->addPostFields([
|
||||
'code' => $request->query->get('code'),
|
||||
'redirect_uri' => $this->generator->generate(
|
||||
'login_authentication_provider_callback',
|
||||
array('providerId' => $this->getId()),
|
||||
['providerId' => $this->getId()],
|
||||
UrlGenerator::ABSOLUTE_URL
|
||||
),
|
||||
'client_id' => $this->key,
|
||||
'client_secret' => $this->secret,
|
||||
));
|
||||
]);
|
||||
$guzzleRequest->setHeader('Accept', 'application/json');
|
||||
$response = $guzzleRequest->send();
|
||||
} catch (GuzzleException $e) {
|
||||
|
@@ -38,16 +38,16 @@ class GooglePlus extends AbstractProvider
|
||||
|
||||
$this->plus = new \Google_PlusService($this->client);
|
||||
|
||||
$this->client->setScopes(array(
|
||||
$this->client->setScopes([
|
||||
'https://www.googleapis.com/auth/plus.me',
|
||||
'https://www.googleapis.com/auth/userinfo.email',
|
||||
));
|
||||
]);
|
||||
|
||||
$this->client->setRedirectUri(
|
||||
$this->generator->generate(
|
||||
'login_authentication_provider_callback', array(
|
||||
'login_authentication_provider_callback', [
|
||||
'providerId' => $this->getId(),
|
||||
), UrlGenerator::ABSOLUTE_URL
|
||||
], UrlGenerator::ABSOLUTE_URL
|
||||
)
|
||||
);
|
||||
|
||||
@@ -218,7 +218,7 @@ class GooglePlus extends AbstractProvider
|
||||
try {
|
||||
$request = $this->guzzle->get(sprintf(
|
||||
'https://www.googleapis.com/oauth2/v1/tokeninfo?%s',
|
||||
http_build_query(array('access_token' => $token['access_token']), '', '&')
|
||||
http_build_query(['access_token' => $token['access_token']], '', '&')
|
||||
));
|
||||
$response = $request->send();
|
||||
} catch (GuzzleException $e) {
|
||||
|
@@ -84,17 +84,17 @@ class Linkedin extends AbstractProvider
|
||||
|
||||
$this->session->set('linkedin.provider.state', $state);
|
||||
|
||||
return new RedirectResponse('https://www.linkedin.com/uas/oauth2/authorization?' . http_build_query(array(
|
||||
return new RedirectResponse('https://www.linkedin.com/uas/oauth2/authorization?' . http_build_query([
|
||||
'response_type' => 'code',
|
||||
'client_id' => $this->key,
|
||||
'scope' => 'r_basicprofile r_emailaddress',
|
||||
'state' => $state,
|
||||
'redirect_uri' => $this->generator->generate(
|
||||
'login_authentication_provider_callback',
|
||||
array('providerId' => $this->getId()),
|
||||
['providerId' => $this->getId()],
|
||||
UrlGenerator::ABSOLUTE_URL
|
||||
),
|
||||
), '', '&'));
|
||||
], '', '&'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,17 +119,17 @@ class Linkedin extends AbstractProvider
|
||||
}
|
||||
|
||||
try {
|
||||
$guzzleRequest = $this->client->post('https://www.linkedin.com/uas/oauth2/accessToken?' . http_build_query(array(
|
||||
$guzzleRequest = $this->client->post('https://www.linkedin.com/uas/oauth2/accessToken?' . http_build_query([
|
||||
'grant_type' => 'authorization_code',
|
||||
'code' => $request->query->get('code'),
|
||||
'redirect_uri' => $this->generator->generate(
|
||||
'login_authentication_provider_callback',
|
||||
array('providerId' => $this->getId()),
|
||||
['providerId' => $this->getId()],
|
||||
UrlGenerator::ABSOLUTE_URL
|
||||
),
|
||||
'client_id' => $this->key,
|
||||
'client_secret' => $this->secret,
|
||||
), '', '&'));
|
||||
], '', '&'));
|
||||
$response = $guzzleRequest->send();
|
||||
} catch (GuzzleException $e) {
|
||||
throw new NotAuthenticatedException('Unable to query LinkedIn access token', $e->getCode(), $e);
|
||||
|
@@ -23,7 +23,7 @@ class Identity
|
||||
const PROPERTY_USERNAME = 'username';
|
||||
const PROPERTY_COMPANY = 'company';
|
||||
|
||||
private $data = array(
|
||||
private $data = [
|
||||
self::PROPERTY_ID => null,
|
||||
self::PROPERTY_IMAGEURL => null,
|
||||
self::PROPERTY_EMAIL => null,
|
||||
@@ -31,9 +31,9 @@ class Identity
|
||||
self::PROPERTY_LASTNAME => null,
|
||||
self::PROPERTY_USERNAME => null,
|
||||
self::PROPERTY_COMPANY => null,
|
||||
);
|
||||
];
|
||||
|
||||
public function __construct(array $data = array())
|
||||
public function __construct(array $data = [])
|
||||
{
|
||||
$this->data = array_merge($this->data, $data);
|
||||
}
|
||||
@@ -55,10 +55,10 @@ class Identity
|
||||
*/
|
||||
public function getDisplayName()
|
||||
{
|
||||
$data = array_filter(array(
|
||||
$data = array_filter([
|
||||
$this->get(self::PROPERTY_FIRSTNAME),
|
||||
$this->get(self::PROPERTY_LASTNAME),
|
||||
));
|
||||
]);
|
||||
|
||||
return implode(' ', $data);
|
||||
}
|
||||
|
@@ -74,11 +74,11 @@ class Twitter extends AbstractProvider
|
||||
$code = $this->twitter->request(
|
||||
'POST',
|
||||
$this->twitter->url('oauth/request_token', ''),
|
||||
array('oauth_callback' => $this->generator->generate(
|
||||
['oauth_callback' => $this->generator->generate(
|
||||
'login_authentication_provider_callback',
|
||||
array('providerId' => $this->getId()),
|
||||
['providerId' => $this->getId()],
|
||||
UrlGenerator::ABSOLUTE_URL
|
||||
))
|
||||
)]
|
||||
);
|
||||
|
||||
if ($code != 200) {
|
||||
@@ -92,7 +92,7 @@ class Twitter extends AbstractProvider
|
||||
return new RedirectResponse(sprintf(
|
||||
'%s?%s',
|
||||
$this->twitter->url("oauth/authenticate", ''),
|
||||
http_build_query(array('oauth_token' => $oauth['oauth_token']), '', '&')
|
||||
http_build_query(['oauth_token' => $oauth['oauth_token']], '', '&')
|
||||
));
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class Twitter extends AbstractProvider
|
||||
$code = $this->twitter->request(
|
||||
'POST',
|
||||
$this->twitter->url('oauth/access_token', ''),
|
||||
array('oauth_verifier' => $request->query->get('oauth_verifier'))
|
||||
['oauth_verifier' => $request->query->get('oauth_verifier')]
|
||||
);
|
||||
|
||||
if ($code != 200) {
|
||||
@@ -248,11 +248,11 @@ class Twitter extends AbstractProvider
|
||||
*/
|
||||
public static function create(UrlGenerator $generator, SessionInterface $session, array $options)
|
||||
{
|
||||
$twitter = new \tmhOAuth(array(
|
||||
$twitter = new \tmhOAuth([
|
||||
'consumer_key' => $options['consumer-key'],
|
||||
'consumer_secret' => $options['consumer-secret'],
|
||||
'timezone' => date_default_timezone_get(),
|
||||
));
|
||||
]);
|
||||
|
||||
return new Twitter($generator, $session, $twitter);
|
||||
}
|
||||
|
@@ -85,16 +85,16 @@ class Viadeo extends AbstractProvider
|
||||
|
||||
$this->session->set('viadeo.provider.state', $state);
|
||||
|
||||
return new RedirectResponse('https://secure.viadeo.com/oauth-provider/authorize2?' . http_build_query(array(
|
||||
return new RedirectResponse('https://secure.viadeo.com/oauth-provider/authorize2?' . http_build_query([
|
||||
'client_id' => $this->key,
|
||||
'state' => $state,
|
||||
'response_type' => 'code',
|
||||
'redirect_uri' => $this->generator->generate(
|
||||
'login_authentication_provider_callback',
|
||||
array('providerId' => $this->getId()),
|
||||
['providerId' => $this->getId()],
|
||||
UrlGenerator::ABSOLUTE_URL
|
||||
),
|
||||
)));
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,13 +138,13 @@ class Viadeo extends AbstractProvider
|
||||
try {
|
||||
$guzzleRequest = $this->client->post('https://secure.viadeo.com/oauth-provider/access_token2');
|
||||
|
||||
$guzzleRequest->addPostFields(array(
|
||||
$guzzleRequest->addPostFields([
|
||||
'grant_type' => 'authorization_code',
|
||||
'code' => $request->query->get('code'),
|
||||
'redirect_uri' => $this->generator->generate('login_authentication_provider_callback', array('providerId' => $this->getId()), UrlGenerator::ABSOLUTE_URL),
|
||||
'redirect_uri' => $this->generator->generate('login_authentication_provider_callback', ['providerId' => $this->getId()], UrlGenerator::ABSOLUTE_URL),
|
||||
'client_id' => $this->key,
|
||||
'client_secret' => $this->secret,
|
||||
));
|
||||
]);
|
||||
$guzzleRequest->setHeader('Accept', 'application/json');
|
||||
$response = $guzzleRequest->send();
|
||||
} catch (GuzzleException $e) {
|
||||
|
@@ -16,7 +16,7 @@ use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
||||
|
||||
class ProvidersCollection implements \Countable, \IteratorAggregate
|
||||
{
|
||||
private $providers = array();
|
||||
private $providers = [];
|
||||
|
||||
public function getIterator()
|
||||
{
|
||||
|
@@ -42,7 +42,7 @@ class SuggestionFinder
|
||||
|
||||
$sql = 'SELECT usr_id FROM usr WHERE usr_mail = :email';
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':email' => $infos->get(Identity::PROPERTY_EMAIL)));
|
||||
$stmt->execute([':email' => $infos->get(Identity::PROPERTY_EMAIL)]);
|
||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
|
@@ -87,11 +87,11 @@ class MetaField implements AttributeInterface
|
||||
*/
|
||||
public function asString()
|
||||
{
|
||||
return serialize(array(
|
||||
return serialize([
|
||||
'id' => $this->databox_field->get_id(),
|
||||
'sbas_id' => $this->databox_field->get_databox()->get_sbas_id(),
|
||||
'value' => $this->value
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -20,8 +20,8 @@ use Alchemy\Phrasea\Border\File;
|
||||
abstract class AbstractChecker implements CheckerInterface
|
||||
{
|
||||
protected $app;
|
||||
protected $databoxes = array();
|
||||
protected $collections = array();
|
||||
protected $databoxes = [];
|
||||
protected $collections = [];
|
||||
|
||||
public function __construct(Application $app)
|
||||
{
|
||||
@@ -44,7 +44,7 @@ abstract class AbstractChecker implements CheckerInterface
|
||||
throw new \LogicException('You can not restrict on databoxes and collections simultanously');
|
||||
}
|
||||
|
||||
$this->databoxes = array();
|
||||
$this->databoxes = [];
|
||||
|
||||
foreach ($this->toIterator($databoxes) as $databox) {
|
||||
if (! $databox instanceof \databox) {
|
||||
@@ -72,7 +72,7 @@ abstract class AbstractChecker implements CheckerInterface
|
||||
throw new \LogicException('You can not restrict on databoxes and collections simultanously');
|
||||
}
|
||||
|
||||
$this->collections = array();
|
||||
$this->collections = [];
|
||||
|
||||
foreach ($this->toIterator($collections) as $collection) {
|
||||
if (! $collection instanceof \collection) {
|
||||
@@ -122,6 +122,6 @@ abstract class AbstractChecker implements CheckerInterface
|
||||
*/
|
||||
protected function toIterator($data)
|
||||
{
|
||||
return new \ArrayObject(is_array($data) ? $data : array($data));
|
||||
return new \ArrayObject(is_array($data) ? $data : [$data]);
|
||||
}
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ class Filename extends AbstractChecker
|
||||
* @param Application $app
|
||||
* @param array $options An array of options. available : 'sensitive' (false by default)
|
||||
*/
|
||||
public function __construct(Application $app, array $options = array())
|
||||
public function __construct(Application $app, array $options = [])
|
||||
{
|
||||
if ( ! isset($options['sensitive'])) {
|
||||
$options['sensitive'] = false;
|
||||
|
@@ -65,7 +65,7 @@ class File
|
||||
$this->app = $app;
|
||||
$this->media = $media;
|
||||
$this->collection = $collection;
|
||||
$this->attributes = array();
|
||||
$this->attributes = [];
|
||||
$this->originalName = $originalName ? : pathinfo($this->media->getFile()->getPathname(), PATHINFO_BASENAME);
|
||||
}
|
||||
|
||||
@@ -96,13 +96,13 @@ class File
|
||||
return $this->uuid;
|
||||
}
|
||||
|
||||
$availableUUIDs = array(
|
||||
$availableUUIDs = [
|
||||
'XMP-exif:ImageUniqueID',
|
||||
'SigmaRaw:ImageUniqueID',
|
||||
'IPTC:UniqueDocumentID',
|
||||
'ExifIFD:ImageUniqueID',
|
||||
'Canon:ImageUniqueID',
|
||||
);
|
||||
];
|
||||
|
||||
if (! $this->uuid) {
|
||||
$metadatas = $this->media->getMetadatas();
|
||||
|
@@ -49,7 +49,7 @@ use XPDF\PdfToText;
|
||||
*/
|
||||
class Manager
|
||||
{
|
||||
protected $checkers = array();
|
||||
protected $checkers = [];
|
||||
protected $app;
|
||||
protected $filesystem;
|
||||
protected $pdfToText;
|
||||
@@ -279,12 +279,12 @@ class Manager
|
||||
)
|
||||
);
|
||||
|
||||
$metadatas = array();
|
||||
$metadatas = [];
|
||||
|
||||
/**
|
||||
* @todo $key is not tagname but fieldname
|
||||
*/
|
||||
$fieldToKeyMap = array();
|
||||
$fieldToKeyMap = [];
|
||||
|
||||
if (! $fieldToKeyMap) {
|
||||
foreach ($file->getCollection()->get_databox()->get_meta_structure() as $databox_field) {
|
||||
@@ -292,7 +292,7 @@ class Manager
|
||||
$tagname = $databox_field->get_tag()->getTagname();
|
||||
|
||||
if ( ! isset($fieldToKeyMap[$tagname])) {
|
||||
$fieldToKeyMap[$tagname] = array();
|
||||
$fieldToKeyMap[$tagname] = [];
|
||||
}
|
||||
|
||||
$fieldToKeyMap[$tagname][] = $databox_field->get_name();
|
||||
@@ -309,7 +309,7 @@ class Manager
|
||||
|
||||
foreach ($fieldToKeyMap[$key] as $k) {
|
||||
if ( ! isset($metadatas[$k])) {
|
||||
$metadatas[$k] = array();
|
||||
$metadatas[$k] = [];
|
||||
}
|
||||
|
||||
$metadatas[$k] = array_merge($metadatas[$k], $metadata->getValue()->asArray());
|
||||
@@ -328,7 +328,7 @@ class Manager
|
||||
$key = $attribute->getField()->get_name();
|
||||
|
||||
if ( ! isset($metadatas[$key])) {
|
||||
$metadatas[$key] = array();
|
||||
$metadatas[$key] = [];
|
||||
}
|
||||
|
||||
$metadatas[$key] = array_merge($metadatas[$key], $attribute->getValue());
|
||||
@@ -344,7 +344,7 @@ class Manager
|
||||
|
||||
foreach ($fieldToKeyMap[$key] as $k) {
|
||||
if ( ! isset($metadatas[$k])) {
|
||||
$metadatas[$k] = array();
|
||||
$metadatas[$k] = [];
|
||||
}
|
||||
|
||||
$metadatas[$k] = array_merge($metadatas[$k], $attribute->getValue()->getValue()->asArray());
|
||||
@@ -368,7 +368,7 @@ class Manager
|
||||
|
||||
$databox = $element->get_databox();
|
||||
|
||||
$metas = array();
|
||||
$metas = [];
|
||||
|
||||
foreach ($metadatas as $fieldname => $values) {
|
||||
foreach ($databox->get_meta_structure()->get_elements() as $databox_field) {
|
||||
@@ -377,7 +377,7 @@ class Manager
|
||||
|
||||
if ($databox_field->is_multi()) {
|
||||
|
||||
$tmpValues = array();
|
||||
$tmpValues = [];
|
||||
foreach ($values as $value) {
|
||||
$tmpValues = array_merge($tmpValues, \caption_field::get_multi_values($value, $databox_field->get_separator()));
|
||||
}
|
||||
@@ -388,11 +388,11 @@ class Manager
|
||||
if ( ! trim($value)) {
|
||||
continue;
|
||||
}
|
||||
$metas[] = array(
|
||||
$metas[] = [
|
||||
'meta_struct_id' => $databox_field->get_id(),
|
||||
'meta_id' => null,
|
||||
'value' => $value,
|
||||
);
|
||||
];
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -402,11 +402,11 @@ class Manager
|
||||
continue;
|
||||
}
|
||||
|
||||
$metas[] = array(
|
||||
$metas[] = [
|
||||
'meta_struct_id' => $databox_field->get_id(),
|
||||
'meta_id' => null,
|
||||
'value' => $value,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ class MetaFieldsBag extends ArrayCollection implements MetaBagInterface
|
||||
*/
|
||||
public function toMetadataArray(\databox_descriptionStructure $metadatasStructure)
|
||||
{
|
||||
$metas = array();
|
||||
$metas = [];
|
||||
$unicode = new \unicode();
|
||||
|
||||
foreach ($metadatasStructure as $databox_field) {
|
||||
@@ -34,7 +34,7 @@ class MetaFieldsBag extends ArrayCollection implements MetaBagInterface
|
||||
|
||||
$values = $this->get($databox_field->get_name())->getValue();
|
||||
|
||||
$tmp = array();
|
||||
$tmp = [];
|
||||
|
||||
foreach ($values as $value) {
|
||||
foreach (\caption_field::get_multi_values($value, $databox_field->get_separator()) as $v) {
|
||||
@@ -52,11 +52,11 @@ class MetaFieldsBag extends ArrayCollection implements MetaBagInterface
|
||||
$value = $unicode->parseDate($value);
|
||||
}
|
||||
|
||||
$metas[] = array(
|
||||
$metas[] = [
|
||||
'meta_struct_id' => $databox_field->get_id(),
|
||||
'value' => $value,
|
||||
'meta_id' => null
|
||||
);
|
||||
];
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -69,11 +69,11 @@ class MetaFieldsBag extends ArrayCollection implements MetaBagInterface
|
||||
$value = $unicode->parseDate($value);
|
||||
}
|
||||
|
||||
$metas[] = array(
|
||||
$metas[] = [
|
||||
'meta_struct_id' => $databox_field->get_id(),
|
||||
'value' => $value,
|
||||
'meta_id' => null
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ class MetadataBag extends ArrayCollection implements MetaBagInterface
|
||||
*/
|
||||
public function toMetadataArray(\databox_descriptionStructure $metadatasStructure)
|
||||
{
|
||||
$metas = array();
|
||||
$metas = [];
|
||||
$unicode = new \unicode();
|
||||
|
||||
foreach ($metadatasStructure as $databox_field) {
|
||||
@@ -42,7 +42,7 @@ class MetadataBag extends ArrayCollection implements MetaBagInterface
|
||||
|
||||
$values = $this->get($databox_field->get_tag()->getTagname())->getValue()->asArray();
|
||||
|
||||
$tmp = array();
|
||||
$tmp = [];
|
||||
|
||||
foreach ($values as $value) {
|
||||
foreach (\caption_field::get_multi_values($value, $databox_field->get_separator()) as $v) {
|
||||
@@ -60,11 +60,11 @@ class MetadataBag extends ArrayCollection implements MetaBagInterface
|
||||
$value = $unicode->parseDate($value);
|
||||
}
|
||||
|
||||
$metas[] = array(
|
||||
$metas[] = [
|
||||
'meta_struct_id' => $databox_field->get_id(),
|
||||
'value' => $value,
|
||||
'meta_id' => null
|
||||
);
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$value = $this->get($databox_field->get_tag()->getTagname())->getValue()->asString();
|
||||
@@ -75,11 +75,11 @@ class MetadataBag extends ArrayCollection implements MetaBagInterface
|
||||
$value = $unicode->parseDate($value);
|
||||
}
|
||||
|
||||
$metas[] = array(
|
||||
$metas[] = [
|
||||
'meta_struct_id' => $databox_field->get_id(),
|
||||
'value' => $value,
|
||||
'meta_id' => null
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ class Visa
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->responses = array();
|
||||
$this->responses = [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -15,7 +15,7 @@ use Alchemy\Phrasea\Exception\RuntimeException;
|
||||
|
||||
class ConnectionFactory
|
||||
{
|
||||
private $connections = array();
|
||||
private $connections = [];
|
||||
|
||||
/**
|
||||
* Returns a Redis connection.
|
||||
@@ -26,9 +26,9 @@ class ConnectionFactory
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function getRedisConnection(array $options = array())
|
||||
public function getRedisConnection(array $options = [])
|
||||
{
|
||||
$options = array_replace(array('host' => 'localhost', 'port' => 6379), $options);
|
||||
$options = array_replace(['host' => 'localhost', 'port' => 6379], $options);
|
||||
if (null !== $cache = $this->getConnection('redis', $options)) {
|
||||
return $cache;
|
||||
}
|
||||
@@ -58,9 +58,9 @@ class ConnectionFactory
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function getMemcacheConnection(array $options = array())
|
||||
public function getMemcacheConnection(array $options = [])
|
||||
{
|
||||
$options = array_replace(array('host' => 'localhost', 'port' => 11211), $options);
|
||||
$options = array_replace(['host' => 'localhost', 'port' => 11211], $options);
|
||||
if (null !== $cache = $this->getConnection('memcache', $options)) {
|
||||
return $cache;
|
||||
}
|
||||
@@ -91,9 +91,9 @@ class ConnectionFactory
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function getMemcachedConnection(array $options = array())
|
||||
public function getMemcachedConnection(array $options = [])
|
||||
{
|
||||
$options = array_replace(array('host' => 'localhost', 'port' => 11211), $options);
|
||||
$options = array_replace(['host' => 'localhost', 'port' => 11211], $options);
|
||||
if (null !== $cache = $this->getConnection('memcached', $options)) {
|
||||
return $cache;
|
||||
}
|
||||
|
@@ -22,8 +22,8 @@ class Manager
|
||||
private $file;
|
||||
/** @var Compiler */
|
||||
private $compiler;
|
||||
private $registry = array();
|
||||
private $drivers = array();
|
||||
private $registry = [];
|
||||
private $drivers = [];
|
||||
/** @var Logger */
|
||||
private $logger;
|
||||
/** @var Factory */
|
||||
@@ -37,7 +37,7 @@ class Manager
|
||||
$this->factory = $factory;
|
||||
|
||||
if (!is_file($file)) {
|
||||
$this->registry = array();
|
||||
$this->registry = [];
|
||||
$this->save();
|
||||
} else {
|
||||
$this->registry = require $file;
|
||||
@@ -55,7 +55,7 @@ class Manager
|
||||
$driver->flushAll();
|
||||
}
|
||||
|
||||
$this->registry = array();
|
||||
$this->registry = [];
|
||||
$this->save();
|
||||
|
||||
return $this;
|
||||
@@ -78,7 +78,7 @@ class Manager
|
||||
$cache = $this->factory->create($name, $options);
|
||||
} catch (RuntimeException $e) {
|
||||
$this->logger->error($e->getMessage());
|
||||
$cache = $this->factory->create('array', array());
|
||||
$cache = $this->factory->create('array', []);
|
||||
}
|
||||
|
||||
$cache->setNamespace(md5(__DIR__));
|
||||
|
@@ -96,13 +96,13 @@ class RedisCache extends CacheProvider implements Cache
|
||||
{
|
||||
$stats = $this->_redis->info();
|
||||
|
||||
return array(
|
||||
return [
|
||||
Cache::STATS_HITS => false,
|
||||
Cache::STATS_MISSES => false,
|
||||
Cache::STATS_UPTIME => $stats['uptime_in_seconds'],
|
||||
Cache::STATS_MEMORY_USAGE => $stats['used_memory'],
|
||||
Cache::STATS_MEMORY_AVAILIABLE => false,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -73,7 +73,7 @@ class BuildMissingSubdefs extends Command
|
||||
if ( ! $record->has_subdef($subdef->get_name())) {
|
||||
$todo = true;
|
||||
}
|
||||
if (in_array($subdef->get_name(), array('preview', 'thumbnail', 'thumbnailgif'))) {
|
||||
if (in_array($subdef->get_name(), ['preview', 'thumbnail', 'thumbnailgif'])) {
|
||||
try {
|
||||
$sub = $record->get_subdef($subdef->get_name());
|
||||
if ( ! $sub->is_physically_present()) {
|
||||
@@ -85,7 +85,7 @@ class BuildMissingSubdefs extends Command
|
||||
}
|
||||
|
||||
if ($todo) {
|
||||
$record->generate_subdefs($databox, $this->container, array($subdef->get_name()));
|
||||
$record->generate_subdefs($databox, $this->container, [$subdef->get_name()]);
|
||||
$this->container['monolog']->addInfo("generate " . $subdef->get_name() . " for record " . $record->get_record_id());
|
||||
$n ++;
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ class CheckConfig extends AbstractCheckCommand
|
||||
|
||||
protected function provideRequirements()
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
BinariesProbe::create($this->container),
|
||||
CacheServerProbe::create($this->container),
|
||||
DataboxStructureProbe::create($this->container),
|
||||
@@ -52,6 +52,6 @@ class CheckConfig extends AbstractCheckCommand
|
||||
SearchEngineProbe::create($this->container),
|
||||
SubdefsPathsProbe::create($this->container),
|
||||
SystemProbe::create($this->container),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ class CreateCollection extends Command
|
||||
if ($new_collection && $input->getOption('base_id_rights')) {
|
||||
|
||||
$query = new \User_Query($this->container);
|
||||
$total = $query->on_base_ids(array($input->getOption('base_id_rights')))->get_total();
|
||||
$total = $query->on_base_ids([$input->getOption('base_id_rights')])->get_total();
|
||||
|
||||
$n = 0;
|
||||
while ($n < $total) {
|
||||
|
@@ -25,7 +25,7 @@ abstract class AbstractRoutesDumper extends Command
|
||||
$maxNameLength = 0;
|
||||
$maxMethodsLength = 0;
|
||||
|
||||
$data = array();
|
||||
$data = [];
|
||||
|
||||
foreach ($routes as $name => $route) {
|
||||
$methods = implode('|', $route->getMethods());
|
||||
@@ -40,12 +40,12 @@ abstract class AbstractRoutesDumper extends Command
|
||||
$warning = true;
|
||||
}
|
||||
|
||||
$data[] = array(
|
||||
$data[] = [
|
||||
'name' => $name,
|
||||
'methods' => $methods ?: 'ALL',
|
||||
'pattern' => $pattern,
|
||||
'warning' => $warning
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($data as $route) {
|
||||
|
@@ -59,7 +59,7 @@ class BowerInstall extends Command
|
||||
|
||||
if ($input->getOption('clear-cache')) {
|
||||
$output->write("Cleaning bower cache... ");
|
||||
$bower->command(array('cache', 'clean'));
|
||||
$bower->command(['cache', 'clean']);
|
||||
$output->writeln("<comment>OK</comment>");
|
||||
}
|
||||
|
||||
|
@@ -42,7 +42,7 @@ class ComposerInstall extends Command
|
||||
$output->writeln("<error>ERROR</error> Failed to update composer, bypassing");
|
||||
}
|
||||
|
||||
$commands = array('install', '--optimize-autoloader', '--quiet', '--no-interaction');
|
||||
$commands = ['install', '--optimize-autoloader', '--quiet', '--no-interaction'];
|
||||
if ($input->getOption('prefer-source')) {
|
||||
$commands[] = '--prefer-source';
|
||||
}
|
||||
@@ -50,11 +50,11 @@ class ComposerInstall extends Command
|
||||
try {
|
||||
if ($input->getOption('no-dev')) {
|
||||
$output->write("Installing dependencies <info>without</info> developer packages ");
|
||||
$composer->command(array_merge($commands, array('--no-dev')));
|
||||
$composer->command(array_merge($commands, ['--no-dev']));
|
||||
$output->writeln("<comment>OK</comment>");
|
||||
} else {
|
||||
$output->write("Installing dependencies <info>with</info> developer packages ");
|
||||
$composer->command(array_merge($commands, array('--dev')));
|
||||
$composer->command(array_merge($commands, ['--dev']));
|
||||
$output->writeln("<comment>OK</comment>");
|
||||
}
|
||||
} catch (ExecutionFailureException $e) {
|
||||
|
@@ -32,7 +32,7 @@ class Uninstaller extends Command
|
||||
{
|
||||
$root = $this->container['root.path'];
|
||||
|
||||
foreach (array(
|
||||
foreach ([
|
||||
$root.'/tmp/configuration-compiled.php',
|
||||
$root.'/config/configuration.yml',
|
||||
$root.'/config/services.yml',
|
||||
@@ -44,20 +44,20 @@ class Uninstaller extends Command
|
||||
$root.'/config/_GV.php.old',
|
||||
$root.'/tmp/cache_registry.php',
|
||||
$root.'/tmp/cache_registry.yml',
|
||||
) as $file) {
|
||||
] as $file) {
|
||||
if (is_file($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (array(
|
||||
foreach ([
|
||||
$root.'/tmp/serializer',
|
||||
$root.'/tmp/cache_twig',
|
||||
$root.'/tmp/cache_minify',
|
||||
$root.'/tmp/download',
|
||||
$root.'/tmp/locks',
|
||||
$root.'/tmp/cache',
|
||||
) as $dir) {
|
||||
] as $dir) {
|
||||
if (is_dir($dir)) {
|
||||
$finder = new Finder();
|
||||
foreach ($finder->files()->in($dir) as $file) {
|
||||
|
@@ -32,13 +32,13 @@ class BowerDriver extends AbstractBinary
|
||||
*
|
||||
* @return BowerDriver
|
||||
*/
|
||||
public static function create($conf = array(), LoggerInterface $logger = null)
|
||||
public static function create($conf = [], LoggerInterface $logger = null)
|
||||
{
|
||||
if (!$conf instanceof ConfigurationInterface) {
|
||||
$conf = new Configuration($conf);
|
||||
}
|
||||
|
||||
$binaries = $conf->get('bower.binaries', array('bower'));
|
||||
$binaries = $conf->get('bower.binaries', ['bower']);
|
||||
|
||||
return static::load($binaries, $logger, $conf);
|
||||
}
|
||||
|
@@ -32,13 +32,13 @@ class ComposerDriver extends AbstractBinary
|
||||
*
|
||||
* @return ComposerDriver
|
||||
*/
|
||||
public static function create($conf = array(), LoggerInterface $logger = null)
|
||||
public static function create($conf = [], LoggerInterface $logger = null)
|
||||
{
|
||||
if (!$conf instanceof ConfigurationInterface) {
|
||||
$conf = new Configuration($conf);
|
||||
}
|
||||
|
||||
$binaries = $conf->get('composer.binaries', array('composer'));
|
||||
$binaries = $conf->get('composer.binaries', ['composer']);
|
||||
|
||||
return static::load($binaries, $logger, $conf);
|
||||
}
|
||||
|
@@ -32,13 +32,13 @@ class GruntDriver extends AbstractBinary
|
||||
*
|
||||
* @return GruntDriver
|
||||
*/
|
||||
public static function create($conf = array(), LoggerInterface $logger = null)
|
||||
public static function create($conf = [], LoggerInterface $logger = null)
|
||||
{
|
||||
if (!$conf instanceof ConfigurationInterface) {
|
||||
$conf = new Configuration($conf);
|
||||
}
|
||||
|
||||
$binaries = $conf->get('grunt.binaries', array('grunt'));
|
||||
$binaries = $conf->get('grunt.binaries', ['grunt']);
|
||||
|
||||
return static::load($binaries, $logger, $conf);
|
||||
}
|
||||
|
@@ -32,13 +32,13 @@ class RecessDriver extends AbstractBinary
|
||||
*
|
||||
* @return RecessDriver
|
||||
*/
|
||||
public static function create($conf = array(), LoggerInterface $logger = null)
|
||||
public static function create($conf = [], LoggerInterface $logger = null)
|
||||
{
|
||||
if (!$conf instanceof ConfigurationInterface) {
|
||||
$conf = new Configuration($conf);
|
||||
}
|
||||
|
||||
$binaries = $conf->get('recess.binaries', array('recess'));
|
||||
$binaries = $conf->get('recess.binaries', ['recess']);
|
||||
|
||||
return static::load($binaries, $logger, $conf);
|
||||
}
|
||||
|
@@ -32,13 +32,13 @@ class UglifyJsDriver extends AbstractBinary
|
||||
*
|
||||
* @return UglifyJsDriver
|
||||
*/
|
||||
public static function create($conf = array(), LoggerInterface $logger = null)
|
||||
public static function create($conf = [], LoggerInterface $logger = null)
|
||||
{
|
||||
if (!$conf instanceof ConfigurationInterface) {
|
||||
$conf = new Configuration($conf);
|
||||
}
|
||||
|
||||
$binaries = $conf->get('uglifyjs.binaries', array('uglifyjs'));
|
||||
$binaries = $conf->get('uglifyjs.binaries', ['uglifyjs']);
|
||||
|
||||
return static::load($binaries, $logger, $conf);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ abstract class AbstractPluginCommand extends Command
|
||||
{
|
||||
protected function validatePlugins(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$manifests = array();
|
||||
$manifests = [];
|
||||
|
||||
$output->write("Validating plugins...");
|
||||
foreach ($this->container['plugins.explorer'] as $directory) {
|
||||
|
@@ -68,7 +68,7 @@ class RecordAdd extends Command
|
||||
if (!$input->getOption('yes')) {
|
||||
do {
|
||||
$continue = strtolower($dialog->ask($output, sprintf("Will add record <info>%s</info> (%s) on collection <info>%s</info>\n<question>Continue ? (y/N)</question>", $file, $media->getType(), $collection->get_label($this->container['locale.I18n'])), 'N'));
|
||||
} while ( ! in_array($continue, array('y', 'n')));
|
||||
} while ( ! in_array($continue, ['y', 'n']));
|
||||
|
||||
if (strtolower($continue) !== 'y') {
|
||||
$output->writeln('Aborted !');
|
||||
|
@@ -55,7 +55,7 @@ class RescanTechnicalDatas extends Command
|
||||
$dialog = $this->getHelperSet()->get('dialog');
|
||||
do {
|
||||
$continue = mb_strtolower($dialog->ask($output, sprintf('Estimated duration is %s, <question>continue ? (y/N)</question>', $duration), 'N'));
|
||||
} while ( ! in_array($continue, array('y', 'n')));
|
||||
} while ( ! in_array($continue, ['y', 'n']));
|
||||
|
||||
if (strtolower($continue) !== 'y') {
|
||||
$output->writeln('Aborting !');
|
||||
|
@@ -41,7 +41,7 @@ class CheckEnvironment extends AbstractCheckCommand
|
||||
*/
|
||||
protected function provideRequirements()
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
new BinariesRequirements(),
|
||||
new CacheServerRequirement(),
|
||||
new FilesystemRequirements(),
|
||||
@@ -50,6 +50,6 @@ class CheckEnvironment extends AbstractCheckCommand
|
||||
new PhraseaRequirements(),
|
||||
new PhpRequirements(),
|
||||
new SystemRequirements(),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -129,14 +129,14 @@ class Install extends Command
|
||||
$abName = $dialog->ask($output, "DB name (phraseanet) : ", 'phraseanet');
|
||||
|
||||
try {
|
||||
$abConn = new \connection_pdo('appbox', $hostname, $port, $dbUser, $dbPassword, $abName, array(), $this->container['debug']);
|
||||
$abConn = new \connection_pdo('appbox', $hostname, $port, $dbUser, $dbPassword, $abName, [], $this->container['debug']);
|
||||
$output->writeln("\n\t<info>Application-Box : Connection successful !</info>\n");
|
||||
} catch (\Exception $e) {
|
||||
$output->writeln("\n\t<error>Invalid connection parameters</error>\n");
|
||||
}
|
||||
} while (!$abConn);
|
||||
} else {
|
||||
$abConn = new \connection_pdo('appbox', $input->getOption('db-host'), $input->getOption('db-port'), $input->getOption('db-user'), $input->getOption('db-password'), $input->getOption('appbox'), array(), $this->container['debug']);
|
||||
$abConn = new \connection_pdo('appbox', $input->getOption('db-host'), $input->getOption('db-port'), $input->getOption('db-user'), $input->getOption('db-password'), $input->getOption('appbox'), [], $this->container['debug']);
|
||||
$output->writeln("\n\t<info>Application-Box : Connection successful !</info>\n");
|
||||
}
|
||||
|
||||
@@ -155,12 +155,12 @@ class Install extends Command
|
||||
|
||||
if ($dbName) {
|
||||
try {
|
||||
$dbConn = new \connection_pdo('databox', $credentials['hostname'], $credentials['port'], $credentials['user'], $credentials['password'], $dbName, array(), $this->container['debug']);
|
||||
$dbConn = new \connection_pdo('databox', $credentials['hostname'], $credentials['port'], $credentials['user'], $credentials['password'], $dbName, [], $this->container['debug']);
|
||||
$output->writeln("\n\t<info>Data-Box : Connection successful !</info>\n");
|
||||
|
||||
do {
|
||||
$template = $dialog->ask($output, 'Choose a language template for metadata structure, available are fr (french) and en (english) (en) : ', 'en');
|
||||
} while (!in_array($template, array('en', 'fr')));
|
||||
} while (!in_array($template, ['en', 'fr']));
|
||||
|
||||
$output->writeln("\n\tLanguage selected is <info>'$template'</info>\n");
|
||||
} catch (\Exception $e) {
|
||||
@@ -171,12 +171,12 @@ class Install extends Command
|
||||
}
|
||||
} while ($retry);
|
||||
} else {
|
||||
$dbConn = new \connection_pdo('databox', $input->getOption('db-host'), $input->getOption('db-port'), $input->getOption('db-user'), $input->getOption('db-password'), $input->getOption('databox'), array(), $this->container['debug']);
|
||||
$dbConn = new \connection_pdo('databox', $input->getOption('db-host'), $input->getOption('db-port'), $input->getOption('db-user'), $input->getOption('db-password'), $input->getOption('databox'), [], $this->container['debug']);
|
||||
$output->writeln("\n\t<info>Data-Box : Connection successful !</info>\n");
|
||||
$template = $input->getOption('db-template') ? : 'en';
|
||||
}
|
||||
|
||||
return array($dbConn, $template);
|
||||
return [$dbConn, $template];
|
||||
}
|
||||
|
||||
private function getCredentials(InputInterface $input, OutputInterface $output, DialogHelper $dialog)
|
||||
@@ -205,7 +205,7 @@ class Install extends Command
|
||||
throw new \RuntimeException('You have to provide both email and password');
|
||||
}
|
||||
|
||||
return array($email, $password);
|
||||
return [$email, $password];
|
||||
}
|
||||
|
||||
private function getDataPath(InputInterface $input, OutputInterface $output, DialogHelper $dialog)
|
||||
@@ -259,7 +259,7 @@ class Install extends Command
|
||||
|
||||
private function detectBinaries()
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'php_binary' => $this->executableFinder->find('php'),
|
||||
'phraseanet_indexer' => $this->executableFinder->find('phraseanet_indexer'),
|
||||
'pdf2swf_binary' => $this->executableFinder->find('pdf2swf'),
|
||||
@@ -272,6 +272,6 @@ class Install extends Command
|
||||
'pdftotext_binary' => $this->executableFinder->find('pdftotext'),
|
||||
'ghostscript_binary' => $this->executableFinder->find('gs'),
|
||||
'recess_binary' => $this->executableFinder->find('recess'),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -45,11 +45,11 @@ class XSendFileMappingGenerator extends Command
|
||||
$factory = new XSendFileFactory($this->container['monolog'], true, $type, $this->computeMapping($paths));
|
||||
$mode = $factory->getMode(true);
|
||||
|
||||
$conf = array(
|
||||
$conf = [
|
||||
'enabled' => $enabled,
|
||||
'type' => $type,
|
||||
'mapping' => $mode->getMapping(),
|
||||
);
|
||||
];
|
||||
|
||||
if ($input->getOption('write')) {
|
||||
$output->write("Writing configuration ...");
|
||||
@@ -60,7 +60,7 @@ class XSendFileMappingGenerator extends Command
|
||||
} else {
|
||||
$output->writeln("Configuration will <info>not</info> be written, use <info>--write</info> option to write it");
|
||||
$output->writeln("");
|
||||
$output->writeln(Yaml::dump(array('xsendfile' => $conf), 4));
|
||||
$output->writeln(Yaml::dump(['xsendfile' => $conf], 4));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -68,10 +68,10 @@ class XSendFileMappingGenerator extends Command
|
||||
|
||||
private function computeMapping($paths)
|
||||
{
|
||||
return array_merge(array(
|
||||
array('mount-point' => 'protected_lazaret', 'directory' => $this->container['root.path'] . '/tmp/lazaret'),
|
||||
array('mount-point' => 'protected_download', 'directory' => $this->container['root.path'] . '/tmp/download'),
|
||||
), array_map(array($this, 'pathsToConf'), array_unique($paths)));
|
||||
return array_merge([
|
||||
['mount-point' => 'protected_lazaret', 'directory' => $this->container['root.path'] . '/tmp/lazaret'],
|
||||
['mount-point' => 'protected_download', 'directory' => $this->container['root.path'] . '/tmp/download'],
|
||||
], array_map([$this, 'pathsToConf'], array_unique($paths)));
|
||||
}
|
||||
|
||||
private function pathsToConf($path)
|
||||
@@ -79,7 +79,7 @@ class XSendFileMappingGenerator extends Command
|
||||
static $n = 0;
|
||||
$n++;
|
||||
|
||||
return array('mount-point' => 'protected_dir_'.$n, 'directory' => $path);
|
||||
return ['mount-point' => 'protected_dir_'.$n, 'directory' => $path];
|
||||
}
|
||||
|
||||
private function extractPath(\appbox $appbox)
|
||||
|
@@ -38,7 +38,7 @@ class SchedulerRun extends Command
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
declare(ticks=1);
|
||||
$this->container['signal-handler']->register(array(SIGINT, SIGTERM), array($this, 'signalHandler'));
|
||||
$this->container['signal-handler']->register([SIGINT, SIGTERM], [$this, 'signalHandler']);
|
||||
$this->container['task-manager']->addSubscriber(new LockFileSubscriber($this->container['task-manager.logger'], $this->container['root.path'].'/tmp/locks'));
|
||||
$this->container['task-manager']->start();
|
||||
}
|
||||
|
@@ -36,18 +36,18 @@ class TaskList extends Command
|
||||
$errors ++;
|
||||
}
|
||||
|
||||
return array(
|
||||
return [
|
||||
$task->getId(),
|
||||
$task->getName(),
|
||||
$task->getStatus() !== 'started' ? $task->getStatus() . " (warning)" : $task->getStatus(),
|
||||
$error ? $info['actual'] . " (error)" : $info['actual'],
|
||||
$info['process-id'],
|
||||
);
|
||||
];
|
||||
}, $this->container['manipulator.task']->getRepository()->findAll());
|
||||
|
||||
$this
|
||||
->getHelperSet()->get('table')
|
||||
->setHeaders(array('Id', 'Name', 'Status', 'Actual', 'Process Id'))
|
||||
->setHeaders(['Id', 'Name', 'Status', 'Actual', 'Process Id'])
|
||||
->setRows($rows)
|
||||
->render($output);
|
||||
|
||||
|
@@ -137,11 +137,11 @@ class Step31 implements DatasUpgraderInterface
|
||||
|
||||
$sql = 'UPDATE record SET uuid = :uuid, sha256 = :sha256 WHERE record_id = :record_id';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
':uuid' => $uuid,
|
||||
'sha256' => $sha256,
|
||||
':record_id' => $record['record_id'],
|
||||
);
|
||||
];
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
$stmt->closeCursor();
|
||||
|
@@ -73,7 +73,7 @@ class Step35 implements DatasUpgraderInterface
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
|
||||
foreach ($rs as $row) {
|
||||
$stmt->execute(array(':record_id' => $row['record_id']));
|
||||
$stmt->execute([':record_id' => $row['record_id']]);
|
||||
|
||||
try {
|
||||
$record = new \record_adapter($this->app, $databox->get_sbas_id(), $row['record_id']);
|
||||
@@ -138,7 +138,7 @@ class Step35 implements DatasUpgraderInterface
|
||||
{
|
||||
$metas = $record->get_databox()->get_meta_structure();
|
||||
|
||||
$datas = $metadatas = array();
|
||||
$datas = $metadatas = [];
|
||||
|
||||
if (false !== $sxe = simplexml_load_string($xml)) {
|
||||
$fields = $sxe->xpath('/record/description');
|
||||
@@ -176,18 +176,18 @@ class Step35 implements DatasUpgraderInterface
|
||||
foreach ($datas as $meta_struct_id => $values) {
|
||||
if (is_array($values)) {
|
||||
foreach ($values as $value) {
|
||||
$metadatas[] = array(
|
||||
$metadatas[] = [
|
||||
'meta_struct_id' => $meta_struct_id
|
||||
, 'meta_id' => null
|
||||
, 'value' => $value
|
||||
);
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$metadatas[] = array(
|
||||
$metadatas[] = [
|
||||
'meta_struct_id' => $meta_struct_id
|
||||
, 'meta_id' => null
|
||||
, 'value' => $values
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ class Step35 implements DatasUpgraderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$stmt[$databox->get_sbas_id()]->execute(array(':originalname' => $original, ':record_id' => $record['record_id']));
|
||||
$stmt[$databox->get_sbas_id()]->execute([':originalname' => $original, ':record_id' => $record['record_id']]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -26,7 +26,7 @@ use vierbergenlars\SemVer\version;
|
||||
*/
|
||||
class UpgradeDBDatas extends Command
|
||||
{
|
||||
protected $upgrades = array();
|
||||
protected $upgrades = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -63,10 +63,10 @@ EOF
|
||||
throw new \Exception('You CAN NOT provide a `from` AND `at-version` option at the same time');
|
||||
}
|
||||
|
||||
$versions = array(
|
||||
$versions = [
|
||||
'Upgrade\\Step31' => '3.1',
|
||||
'Upgrade\\Step35' => '3.5',
|
||||
);
|
||||
];
|
||||
|
||||
if (null !== $input->getOption('from')) {
|
||||
foreach ($versions as $classname => $version) {
|
||||
@@ -91,7 +91,7 @@ EOF
|
||||
|
||||
public function setUpgrades(array $upgrades)
|
||||
{
|
||||
$this->upgrades = array();
|
||||
$this->upgrades = [];
|
||||
|
||||
foreach ($upgrades as $upgrade) {
|
||||
$this->addUpgrade($upgrade);
|
||||
@@ -131,7 +131,7 @@ EOF
|
||||
|
||||
do {
|
||||
$continue = strtolower($dialog->ask($output, $question . '<question>Continue ? (Y/n)</question>', 'Y'));
|
||||
} while ( ! in_array($continue, array('y', 'n')));
|
||||
} while ( ! in_array($continue, ['y', 'n']));
|
||||
|
||||
if (strtolower($continue) !== 'y') {
|
||||
$output->writeln('Aborting !');
|
||||
|
@@ -130,12 +130,12 @@ class Collection implements ControllerProviderInterface
|
||||
{
|
||||
$collection = \collection::get_from_base_id($app, $bas_id);
|
||||
|
||||
$admins = array();
|
||||
$admins = [];
|
||||
|
||||
if ($app['acl']->get($app['authentication']->getUser())->has_right_on_base($bas_id, 'manage')) {
|
||||
$query = new \User_Query($app);
|
||||
$admins = $query->on_base_ids(array($bas_id))
|
||||
->who_have_right(array('order_master'))
|
||||
$admins = $query->on_base_ids([$bas_id])
|
||||
->who_have_right(['order_master'])
|
||||
->execute()
|
||||
->get_results();
|
||||
}
|
||||
@@ -155,12 +155,12 @@ class Collection implements ControllerProviderInterface
|
||||
break;
|
||||
}
|
||||
|
||||
return $app['twig']->render('admin/collection/collection.html.twig', array(
|
||||
return $app['twig']->render('admin/collection/collection.html.twig', [
|
||||
'collection' => $collection,
|
||||
'admins' => $admins,
|
||||
'errorMsg' => $errorMsg,
|
||||
'reloadTree' => $request->query->get('reload-tree') === '1'
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,8 +175,8 @@ class Collection implements ControllerProviderInterface
|
||||
{
|
||||
$success = false;
|
||||
|
||||
if (count($admins = $request->request->get('admins', array())) > 0) {
|
||||
$newAdmins = array();
|
||||
if (count($admins = $request->request->get('admins', [])) > 0) {
|
||||
$newAdmins = [];
|
||||
|
||||
foreach ($admins as $admin) {
|
||||
$newAdmins[] = $admin;
|
||||
@@ -189,17 +189,17 @@ class Collection implements ControllerProviderInterface
|
||||
try {
|
||||
$userQuery = new \User_Query($app);
|
||||
|
||||
$result = $userQuery->on_base_ids(array($bas_id))
|
||||
->who_have_right(array('order_master'))
|
||||
$result = $userQuery->on_base_ids([$bas_id])
|
||||
->who_have_right(['order_master'])
|
||||
->execute()->get_results();
|
||||
|
||||
foreach ($result as $user) {
|
||||
$app['acl']->get($user)->update_rights_to_base($bas_id, array('order_master' => false));
|
||||
$app['acl']->get($user)->update_rights_to_base($bas_id, ['order_master' => false]);
|
||||
}
|
||||
|
||||
foreach (array_filter($newAdmins) as $admin) {
|
||||
$user = \User_Adapter::getInstance($admin, $app);
|
||||
$app['acl']->get($user)->update_rights_to_base($bas_id, array('order_master' => true));
|
||||
$app['acl']->get($user)->update_rights_to_base($bas_id, ['order_master' => true]);
|
||||
}
|
||||
$conn->commit();
|
||||
|
||||
@@ -210,10 +210,10 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => (int) $success,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -246,17 +246,17 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $msg,
|
||||
'bas_id' => $collection->get_base_id()
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_base_id(),
|
||||
'success' => (int) $success,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -281,17 +281,17 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful removal') : _('An error occured'),
|
||||
'bas_id' => $collection->get_base_id()
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_base_id(),
|
||||
'success' => (int) $success,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -316,17 +316,17 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful removal') : _('An error occured'),
|
||||
'bas_id' => $collection->get_base_id()
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_base_id(),
|
||||
'success' => (int) $success,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -351,17 +351,17 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful removal') : _('An error occured'),
|
||||
'bas_id' => $collection->get_base_id()
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_base_id(),
|
||||
'success' => (int) $success,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -387,17 +387,17 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful removal') : _('An error occured'),
|
||||
'bas_id' => $collection->get_base_id()
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_base_id(),
|
||||
'success' => (int) $success,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -415,19 +415,19 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ($file->getClientSize() > 1024 * 1024) {
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-too-big',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
if (!$file->isValid()) {
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-invalid',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
$collection = \collection::get_from_base_id($app, $bas_id);
|
||||
@@ -437,17 +437,17 @@ class Collection implements ControllerProviderInterface
|
||||
|
||||
$app['filesystem']->remove($file->getPathname());
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-error',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 1,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -465,19 +465,19 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ($file->getClientSize() > 1024 * 1024) {
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-too-big',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
if (!$file->isValid()) {
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-invalid',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
$collection = \collection::get_from_base_id($app, $bas_id);
|
||||
@@ -487,17 +487,17 @@ class Collection implements ControllerProviderInterface
|
||||
|
||||
$app['filesystem']->remove($file->getPathname());
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-error',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 1,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -515,19 +515,19 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ($file->getClientSize() > 65535) {
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-too-big',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
if (!$file->isValid()) {
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-invalid',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
$collection = \collection::get_from_base_id($app, $bas_id);
|
||||
@@ -536,17 +536,17 @@ class Collection implements ControllerProviderInterface
|
||||
$app['phraseanet.appbox']->write_collection_pic($app['media-alchemyst'], $app['filesystem'], $collection, $file, \collection::PIC_WM);
|
||||
$app['filesystem']->remove($file->getPathname());
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-error',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 1,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -564,19 +564,19 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ($file->getClientSize() > 65535) {
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-too-big',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
if (!$file->isValid()) {
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-invalid',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
$collection = \collection::get_from_base_id($app, $bas_id);
|
||||
@@ -585,17 +585,17 @@ class Collection implements ControllerProviderInterface
|
||||
$app['phraseanet.appbox']->write_collection_pic($app['media-alchemyst'], $app['filesystem'], $collection, $file, \collection::PIC_LOGO);
|
||||
$app['filesystem']->remove($file->getPathname());
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-error',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 1,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -627,32 +627,32 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $msg
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
if ($collection->get_record_amount() > 0) {
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_sbas_id(),
|
||||
'success' => 0,
|
||||
'error' => 'collection-not-empty',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
if ($success) {
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_sbas_id(),
|
||||
'success' => 1,
|
||||
'reload-tree' => 1,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_sbas_id(),
|
||||
'success' => 0,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -677,16 +677,16 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('The publication has been stopped') : _('An error occured')
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_sbas_id(),
|
||||
'success' => (int) $success,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -715,17 +715,17 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful update') : _('An error occured')
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_base_id(),
|
||||
'success' => (int) $success,
|
||||
'reload-tree' => 1,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
public function labels(Application $app, Request $request, $bas_id)
|
||||
@@ -753,17 +753,17 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful update') : _('An error occured')
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_base_id(),
|
||||
'success' => (int) $success,
|
||||
'reload-tree' => 1,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -792,16 +792,16 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful update') : _('An error occured')
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_sbas_id(),
|
||||
'success' => (int) $success,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -826,16 +826,16 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful update') : _('An error occured')
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_sbas_id(),
|
||||
'success' => (int) $success,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -860,16 +860,16 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful update') : _('An error occured')
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array(
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_sbas_id(),
|
||||
'success' => (int) $success,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -883,7 +883,7 @@ class Collection implements ControllerProviderInterface
|
||||
{
|
||||
$databox = $app['phraseanet.appbox']->get_databox(\phrasea::sbasFromBas($app, $bas_id));
|
||||
$collection = \collection::get_from_base_id($app, $bas_id);
|
||||
$structFields = $suggestedValues = $basePrefs = array();
|
||||
$structFields = $suggestedValues = $basePrefs = [];
|
||||
|
||||
foreach ($databox->get_meta_structure() as $meta) {
|
||||
if ($meta->is_readonly()) {
|
||||
@@ -900,9 +900,9 @@ class Collection implements ControllerProviderInterface
|
||||
foreach ($z[0] as $ki => $vi) {
|
||||
if ($vi && isset($structFields[$ki])) {
|
||||
foreach ($vi->value as $oneValue) {
|
||||
$suggestedValues[] = array(
|
||||
$suggestedValues[] = [
|
||||
'key' => $ki, 'value' => $f, 'name' => (string) $oneValue
|
||||
);
|
||||
];
|
||||
$f++;
|
||||
}
|
||||
}
|
||||
@@ -912,7 +912,7 @@ class Collection implements ControllerProviderInterface
|
||||
$z = $sxe->xpath('/baseprefs');
|
||||
if ($z && is_array($z)) {
|
||||
foreach ($z[0] as $ki => $vi) {
|
||||
$pref = array('status' => null, 'xml' => null);
|
||||
$pref = ['status' => null, 'xml' => null];
|
||||
|
||||
if ($ki == 'status') {
|
||||
$pref['status'] = $vi;
|
||||
@@ -925,13 +925,13 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app['twig']->render('admin/collection/suggested_value.html.twig', array(
|
||||
return $app['twig']->render('admin/collection/suggested_value.html.twig', [
|
||||
'collection' => $collection,
|
||||
'databox' => $databox,
|
||||
'suggestedValues' => $suggestedValues,
|
||||
'structFields' => $structFields,
|
||||
'basePrefs' => $basePrefs,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -959,17 +959,17 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful update') : _('An error occured'),
|
||||
'bas_id' => $collection->get_base_id()
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_collection_display_suggested_values', array(
|
||||
return $app->redirectPath('admin_collection_display_suggested_values', [
|
||||
'bas_id' => $collection->get_sbas_id(),
|
||||
'success' => (int) $success,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -984,12 +984,12 @@ class Collection implements ControllerProviderInterface
|
||||
{
|
||||
$collection = \collection::get_from_base_id($app, $bas_id);
|
||||
|
||||
$out = array('total' => array('totobj' => 0, 'totsiz' => 0, 'mega' => '0', 'giga' => '0'), 'result' => array());
|
||||
$out = ['total' => ['totobj' => 0, 'totsiz' => 0, 'mega' => '0', 'giga' => '0'], 'result' => []];
|
||||
|
||||
foreach ($collection->get_record_details() as $vrow) {
|
||||
|
||||
$last_k1 = $last_k2 = null;
|
||||
$outRow = array('midobj' => 0, 'midsiz' => 0);
|
||||
$outRow = ['midobj' => 0, 'midsiz' => 0];
|
||||
|
||||
if ($vrow['amount'] > 0 || $last_k1 !== $vrow['coll_id']) {
|
||||
|
||||
@@ -1059,9 +1059,9 @@ class Collection implements ControllerProviderInterface
|
||||
$out['total']['giga'] = $out['total']['totsiz'] / (1024 * 1024 * 1024);
|
||||
}
|
||||
|
||||
return $app['twig']->render('admin/collection/details.html.twig', array(
|
||||
return $app['twig']->render('admin/collection/details.html.twig', [
|
||||
'collection' => $collection,
|
||||
'table' => $out,
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -42,13 +42,13 @@ class ConnectedUsers implements ControllerProviderInterface
|
||||
ORDER BY s.updated DESC';
|
||||
|
||||
$date = new \DateTime('-2 hours');
|
||||
$params = array('date' => $date->format('Y-m-d h:i:s'));
|
||||
$params = ['date' => $date->format('Y-m-d h:i:s')];
|
||||
|
||||
$query = $app['EM']->createQuery($dql);
|
||||
$query->setParameters($params);
|
||||
$sessions = $query->getResult();
|
||||
|
||||
$result = array();
|
||||
$result = [];
|
||||
|
||||
foreach ($sessions as $session) {
|
||||
$info = '';
|
||||
@@ -76,15 +76,15 @@ class ConnectedUsers implements ControllerProviderInterface
|
||||
));
|
||||
}
|
||||
|
||||
$result[] = array(
|
||||
$result[] = [
|
||||
'session' => $session,
|
||||
'info' => $info,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'sessions' => $result,
|
||||
'applications' => array(
|
||||
'applications' => [
|
||||
'0' => 0,
|
||||
'1' => 0,
|
||||
'2' => 0,
|
||||
@@ -94,8 +94,8 @@ class ConnectedUsers implements ControllerProviderInterface
|
||||
'6' => 0,
|
||||
'7' => 0,
|
||||
'8' => 0,
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($result as $session) {
|
||||
foreach ($session['session']->getModules() as $module) {
|
||||
@@ -105,7 +105,7 @@ class ConnectedUsers implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app['twig']->render('admin/connected-users.html.twig', array('data' => $ret));
|
||||
return $app['twig']->render('admin/connected-users.html.twig', ['data' => $ret]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,7 +117,7 @@ class ConnectedUsers implements ControllerProviderInterface
|
||||
*/
|
||||
public static function appName($appId)
|
||||
{
|
||||
$appRef = array(
|
||||
$appRef = [
|
||||
'0' => _('admin::monitor: module inconnu'),
|
||||
'1' => _('admin::monitor: module production'),
|
||||
'2' => _('admin::monitor: module client'),
|
||||
@@ -127,7 +127,7 @@ class ConnectedUsers implements ControllerProviderInterface
|
||||
'6' => _('admin::monitor: module comparateur'),
|
||||
'7' => _('admin::monitor: module validation'),
|
||||
'8' => _('admin::monitor: module upload'),
|
||||
);
|
||||
];
|
||||
|
||||
return isset($appRef[$appId]) ? $appRef[$appId] : null;
|
||||
}
|
||||
|
@@ -72,11 +72,11 @@ class Dashboard implements ControllerProviderInterface
|
||||
break;
|
||||
}
|
||||
|
||||
$parameters = array(
|
||||
$parameters = [
|
||||
'cache_flushed' => $request->query->get('flush_cache') === 'ok',
|
||||
'admins' => \User_Adapter::get_sys_admins($app),
|
||||
'email_status' => $emailStatus,
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('admin/dashboard.html.twig', $parameters);
|
||||
}
|
||||
@@ -91,10 +91,10 @@ class Dashboard implements ControllerProviderInterface
|
||||
public function flush(Application $app, Request $request)
|
||||
{
|
||||
if ($app['phraseanet.cache-service']->flushAll()) {
|
||||
return $app->redirectPath('admin_dashbord', array('flush_cache' => 'ok'));
|
||||
return $app->redirectPath('admin_dashbord', ['flush_cache' => 'ok']);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_dashbord', array('flush_cache' => 'ko'));
|
||||
return $app->redirectPath('admin_dashbord', ['flush_cache' => 'ko']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,7 +117,7 @@ class Dashboard implements ControllerProviderInterface
|
||||
try {
|
||||
$receiver = new Receiver(null, $mail);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
return $app->redirectPath('admin_dashbord', array('email' => 'not-sent'));
|
||||
return $app->redirectPath('admin_dashbord', ['email' => 'not-sent']);
|
||||
}
|
||||
|
||||
$mail = MailTest::create($app, $receiver);
|
||||
@@ -125,7 +125,7 @@ class Dashboard implements ControllerProviderInterface
|
||||
$app['notification.deliverer']->deliver($mail);
|
||||
$app['swiftmailer.spooltransport']->getSpool()->flushQueue($app['swiftmailer.transport']);
|
||||
|
||||
return $app->redirectPath('admin_dashbord', array('email' => 'sent'));
|
||||
return $app->redirectPath('admin_dashbord', ['email' => 'sent']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,7 +153,7 @@ class Dashboard implements ControllerProviderInterface
|
||||
*/
|
||||
public function addAdmins(Application $app, Request $request)
|
||||
{
|
||||
if (count($admins = $request->request->get('admins', array())) > 0) {
|
||||
if (count($admins = $request->request->get('admins', [])) > 0) {
|
||||
|
||||
if (!in_array($app['authentication']->getUser()->get_id(), $admins)) {
|
||||
$admins[] = $app['authentication']->getUser()->get_id();
|
||||
|
@@ -181,12 +181,12 @@ class Databox implements ControllerProviderInterface
|
||||
break;
|
||||
}
|
||||
|
||||
return $app['twig']->render('admin/databox/databox.html.twig', array(
|
||||
return $app['twig']->render('admin/databox/databox.html.twig', [
|
||||
'databox' => $databox,
|
||||
'showDetail' => (int) $request->query->get("sta") < 1,
|
||||
'errorMsg' => $errorMsg,
|
||||
'reloadTree' => $request->query->get('reload-tree') === '1'
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,11 +199,11 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function getDatabaseCGU(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
return $app['twig']->render('admin/databox/cgus.html.twig', array(
|
||||
return $app['twig']->render('admin/databox/cgus.html.twig', [
|
||||
'languages' => $app['locales.available'],
|
||||
'cgus' => $app['phraseanet.appbox']->get_databox($databox_id)->get_cgus(),
|
||||
'current_locale' => $app['locale']
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,17 +235,17 @@ class Databox implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $msg,
|
||||
'sbas_id' => $databox->get_sbas_id()
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'databox_id' => $databox->get_sbas_id(),
|
||||
'success' => (int) $success,
|
||||
);
|
||||
];
|
||||
|
||||
if ($databox->get_record_amount() > 0) {
|
||||
$params['error'] = 'databox-not-empty';
|
||||
@@ -279,10 +279,10 @@ class Databox implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful update') : _('An error occured')
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox->get_sbas_id() . '/?success=' . (int) $success . '&reload-tree=1');
|
||||
@@ -308,17 +308,17 @@ class Databox implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful update') : _('An error occured'),
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_database', array(
|
||||
return $app->redirectPath('admin_database', [
|
||||
'databox_id' => $databox_id,
|
||||
'success' => (int) $success,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,17 +341,17 @@ class Databox implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful update') : _('An error occured'),
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_database', array(
|
||||
return $app->redirectPath('admin_database', [
|
||||
'databox_id' => $databox_id,
|
||||
'success' => (int) $success,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -367,20 +367,20 @@ class Databox implements ControllerProviderInterface
|
||||
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
|
||||
|
||||
try {
|
||||
foreach ($request->request->get('TOU', array()) as $loc => $terms) {
|
||||
foreach ($request->request->get('TOU', []) as $loc => $terms) {
|
||||
$databox->update_cgus($loc, $terms, !!$request->request->get('valid', false));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('admin_database_display_cgus', array(
|
||||
return $app->redirectPath('admin_database_display_cgus', [
|
||||
'databox_id' => $databox_id,
|
||||
'success' => 0,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_database_display_cgus', array(
|
||||
return $app->redirectPath('admin_database_display_cgus', [
|
||||
'databox_id' => $databox_id,
|
||||
'success' => 1,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -405,7 +405,7 @@ class Databox implements ControllerProviderInterface
|
||||
$query = new \User_Query($app);
|
||||
$n = 0;
|
||||
|
||||
while ($n < $query->on_base_ids(array($othCollSel))->get_total()) {
|
||||
while ($n < $query->on_base_ids([$othCollSel])->get_total()) {
|
||||
$results = $query->limit($n, 50)->execute()->get_results();
|
||||
|
||||
foreach ($results as $user) {
|
||||
@@ -417,17 +417,17 @@ class Databox implements ControllerProviderInterface
|
||||
|
||||
$app['phraseanet.appbox']->get_connection()->commit();
|
||||
|
||||
return $app->redirectPath('admin_database', array(
|
||||
return $app->redirectPath('admin_database', [
|
||||
'databox_id' => $databox_id,
|
||||
'mount' => 'ok',
|
||||
));
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$app['phraseanet.appbox']->get_connection()->rollBack();
|
||||
|
||||
return $app->redirectPath('admin_database', array(
|
||||
return $app->redirectPath('admin_database', [
|
||||
'databox_id' => $databox_id,
|
||||
'mount' => 'ko',
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,30 +449,30 @@ class Databox implements ControllerProviderInterface
|
||||
$app['phraseanet.appbox']->write_databox_pic($app['media-alchemyst'], $app['filesystem'], $databox, $file, \databox::PIC_PDF);
|
||||
unlink($file->getPathname());
|
||||
|
||||
return $app->redirectPath('admin_database', array(
|
||||
return $app->redirectPath('admin_database', [
|
||||
'databox_id' => $databox_id,
|
||||
'success' => '1',
|
||||
));
|
||||
]);
|
||||
} else {
|
||||
return $app->redirectPath('admin_database', array(
|
||||
return $app->redirectPath('admin_database', [
|
||||
'databox_id' => $databox_id,
|
||||
'success' => '0',
|
||||
'error' => 'file-too-big',
|
||||
));
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
return $app->redirectPath('admin_database', array(
|
||||
return $app->redirectPath('admin_database', [
|
||||
'databox_id' => $databox_id,
|
||||
'success' => '0',
|
||||
'error' => 'file-invalid',
|
||||
));
|
||||
]);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('admin_database', array(
|
||||
return $app->redirectPath('admin_database', [
|
||||
'databox_id' => $databox_id,
|
||||
'success' => '0',
|
||||
'error' => 'file-error',
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,17 +496,17 @@ class Databox implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful removal') : _('An error occured'),
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_database', array(
|
||||
return $app->redirectPath('admin_database', [
|
||||
'databox_id' => $databox_id,
|
||||
'error' => 'file-too-big',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -529,17 +529,17 @@ class Databox implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful update') : _('An error occured'),
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_database', array(
|
||||
return $app->redirectPath('admin_database', [
|
||||
'databox_id' => $databox_id,
|
||||
'error' => 'file-too-big',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -566,17 +566,17 @@ class Databox implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful update') : _('An error occured'),
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_database', array(
|
||||
return $app->redirectPath('admin_database', [
|
||||
'databox_id' => $databox_id,
|
||||
'error' => 'file-too-big',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -601,16 +601,16 @@ class Databox implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('The publication has been stopped') : _('An error occured'),
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_databases', array(
|
||||
return $app->redirectPath('admin_databases', [
|
||||
'reload-tree' => 1,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -649,17 +649,17 @@ class Databox implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $msg,
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_database', array(
|
||||
return $app->redirectPath('admin_database', [
|
||||
'databox_id' => $databox_id,
|
||||
'error' => 'file-too-big',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -678,7 +678,7 @@ class Databox implements ControllerProviderInterface
|
||||
|
||||
$app['phraseanet.appbox'] = $app['phraseanet.appbox'];
|
||||
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'success' => false,
|
||||
'msg' => _('An error occured'),
|
||||
'sbas_id' => null,
|
||||
@@ -688,7 +688,7 @@ class Databox implements ControllerProviderInterface
|
||||
'thesaurus_indexed' => 0,
|
||||
'viewname' => null,
|
||||
'printLogoURL' => null
|
||||
);
|
||||
];
|
||||
|
||||
try {
|
||||
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
|
||||
@@ -724,9 +724,9 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function getReorder(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
return $app['twig']->render('admin/collection/reorder.html.twig', array(
|
||||
'collections' => $app['acl']->get($app['authentication']->getUser())->get_granted_base(array(), array($databox_id)),
|
||||
));
|
||||
return $app['twig']->render('admin/collection/reorder.html.twig', [
|
||||
'collections' => $app['acl']->get($app['authentication']->getUser())->get_granted_base([], [$databox_id]),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -740,7 +740,7 @@ class Databox implements ControllerProviderInterface
|
||||
public function setReorder(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
try {
|
||||
foreach ($request->request->get('order', array()) as $data) {
|
||||
foreach ($request->request->get('order', []) as $data) {
|
||||
$collection = \collection::get_from_base_id($app, $data['id']);
|
||||
$collection->set_ord($data['offset']);
|
||||
}
|
||||
@@ -750,17 +750,17 @@ class Databox implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Successful update') : _('An error occured'),
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_database_display_collections_order', array(
|
||||
return $app->redirectPath('admin_database_display_collections_order', [
|
||||
'databox_id' => $databox_id,
|
||||
'success' => (int) $success,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -787,10 +787,10 @@ class Databox implements ControllerProviderInterface
|
||||
public function createCollection(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
if (($name = trim($request->request->get('name', ''))) === '') {
|
||||
return $app->redirectPath('admin_database_display_new_collection_form', array(
|
||||
return $app->redirectPath('admin_database_display_new_collection_form', [
|
||||
'databox_id' => $databox_id,
|
||||
'error' => 'name',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -800,7 +800,7 @@ class Databox implements ControllerProviderInterface
|
||||
if (($request->request->get('ccusrothercoll') === "on")
|
||||
&& (null !== $othcollsel = $request->request->get('othcollsel'))) {
|
||||
$query = new \User_Query($app);
|
||||
$total = $query->on_base_ids(array($othcollsel))->get_total();
|
||||
$total = $query->on_base_ids([$othcollsel])->get_total();
|
||||
$n = 0;
|
||||
while ($n < $total) {
|
||||
$results = $query->limit($n, 20)->execute()->get_results();
|
||||
@@ -811,9 +811,9 @@ class Databox implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', array('bas_id' => $collection->get_base_id(), 'success' => 1, 'reload-tree' => 1));
|
||||
return $app->redirectPath('admin_display_collection', ['bas_id' => $collection->get_base_id(), 'success' => 1, 'reload-tree' => 1]);
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('admin_database_submit_collection', array('databox_id' => $databox_id, 'error' => 'error'));
|
||||
return $app->redirectPath('admin_database_submit_collection', ['databox_id' => $databox_id, 'error' => 'error']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -829,15 +829,15 @@ class Databox implements ControllerProviderInterface
|
||||
{
|
||||
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
|
||||
|
||||
$details = array();
|
||||
$total = array('total_subdefs' => 0, 'total_size' => 0);
|
||||
$details = [];
|
||||
$total = ['total_subdefs' => 0, 'total_size' => 0];
|
||||
|
||||
foreach ($databox->get_record_details($request->query->get('sort')) as $collName => $colDetails) {
|
||||
$details[$collName] = array(
|
||||
$details[$collName] = [
|
||||
'total_subdefs' => 0,
|
||||
'total_size' => 0,
|
||||
'medias' => array()
|
||||
);
|
||||
'medias' => []
|
||||
];
|
||||
|
||||
foreach ($colDetails as $subdefName => $subdefDetails) {
|
||||
$details[$collName]['total_subdefs'] += $subdefDetails['n'];
|
||||
@@ -845,18 +845,18 @@ class Databox implements ControllerProviderInterface
|
||||
$details[$collName]['total_size'] += $subdefDetails['siz'];
|
||||
$total['total_size'] += $subdefDetails['siz'];
|
||||
|
||||
$details[$collName]['medias'][] = array (
|
||||
$details[$collName]['medias'][] = [
|
||||
'subdef_name' => $subdefName,
|
||||
'total_subdefs' => $subdefDetails['n'],
|
||||
'total_size' => $subdefDetails['siz'],
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $app['twig']->render('admin/databox/details.html.twig', array(
|
||||
return $app['twig']->render('admin/databox/details.html.twig', [
|
||||
'databox' => $databox,
|
||||
'table' => $details,
|
||||
'total' => $total
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -69,28 +69,28 @@ class Databoxes implements ControllerProviderInterface
|
||||
public function getDatabases(Application $app, Request $request)
|
||||
{
|
||||
$sbasIds = array_merge(
|
||||
array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_sbas(array('bas_manage')))
|
||||
, array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_sbas(array('bas_modify_struct')))
|
||||
array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_sbas(['bas_manage']))
|
||||
, array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_sbas(['bas_modify_struct']))
|
||||
);
|
||||
|
||||
$sbas = array();
|
||||
$sbas = [];
|
||||
foreach ($sbasIds as $sbasId) {
|
||||
$sbas[$sbasId] = array(
|
||||
$sbas[$sbasId] = [
|
||||
'version' => 'unknown',
|
||||
'image' => '/skins/icons/db-remove.png',
|
||||
'server_info' => '',
|
||||
'name' => _('Unreachable server')
|
||||
);
|
||||
];
|
||||
|
||||
try {
|
||||
$databox = $app['phraseanet.appbox']->get_databox($sbasId);
|
||||
|
||||
$sbas[$sbasId] = array(
|
||||
$sbas[$sbasId] = [
|
||||
'version' => $databox->get_version(),
|
||||
'image' => '/skins/icons/foldph20close_0.gif',
|
||||
'server_info' => $databox->get_connection()->server_info(),
|
||||
'name' => \phrasea::sbas_labels($sbasId, $app)
|
||||
);
|
||||
];
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
@@ -128,14 +128,14 @@ class Databoxes implements ControllerProviderInterface
|
||||
|
||||
$upgrader = new \Setup_Upgrade($app);
|
||||
|
||||
return $app['twig']->render('admin/databases.html.twig', array(
|
||||
return $app['twig']->render('admin/databases.html.twig', [
|
||||
'files' => new \DirectoryIterator($app['root.path'] . '/lib/conf.d/data_templates'),
|
||||
'sbas' => $sbas,
|
||||
'error_msg' => $errorMsg,
|
||||
'recommendations' => $upgrader->getRecommendations(),
|
||||
'advices' => $request->query->get('advices', array()),
|
||||
'advices' => $request->query->get('advices', []),
|
||||
'reloadTree' => (Boolean) $request->query->get('reload-tree'),
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,11 +149,11 @@ class Databoxes implements ControllerProviderInterface
|
||||
public function createDatabase(Application $app, Request $request)
|
||||
{
|
||||
if ('' === $dbName = $request->request->get('new_dbname', '')) {
|
||||
return $app->redirectPath('admin_databases', array('error' => 'no-empty'));
|
||||
return $app->redirectPath('admin_databases', ['error' => 'no-empty']);
|
||||
}
|
||||
|
||||
if (\p4string::hasAccent($dbName)) {
|
||||
return $app->redirectPath('admin_databases', array('error' => 'special-chars'));
|
||||
return $app->redirectPath('admin_databases', ['error' => 'special-chars']);
|
||||
}
|
||||
|
||||
if ((null === $request->request->get('new_settings')) && (null !== $dataTemplate = $request->request->get('new_data_template'))) {
|
||||
@@ -169,9 +169,9 @@ class Databoxes implements ControllerProviderInterface
|
||||
$dataTemplate = new \SplFileInfo($app['root.path'] . '/lib/conf.d/data_templates/' . $dataTemplate . '.xml');
|
||||
|
||||
try {
|
||||
$connbas = new \connection_pdo('databox_creation', $hostname, $port, $user, $password, $dbName, array(), $app['debug']);
|
||||
$connbas = new \connection_pdo('databox_creation', $hostname, $port, $user, $password, $dbName, [], $app['debug']);
|
||||
} catch (\PDOException $e) {
|
||||
return $app->redirectPath('admin_databases', array('success' => 0, 'error' => 'database-failed'));
|
||||
return $app->redirectPath('admin_databases', ['success' => 0, 'error' => 'database-failed']);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -179,9 +179,9 @@ class Databoxes implements ControllerProviderInterface
|
||||
$base->registerAdmin($app['authentication']->getUser());
|
||||
$app['acl']->get($app['authentication']->getUser())->delete_data_from_cache();
|
||||
|
||||
return $app->redirectPath('admin_database', array('databox_id' => $base->get_sbas_id(), 'success' => 1, 'reload-tree' => 1));
|
||||
return $app->redirectPath('admin_database', ['databox_id' => $base->get_sbas_id(), 'success' => 1, 'reload-tree' => 1]);
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('admin_databases', array('success' => 0, 'error' => 'base-failed'));
|
||||
return $app->redirectPath('admin_databases', ['success' => 0, 'error' => 'base-failed']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,17 +195,17 @@ class Databoxes implements ControllerProviderInterface
|
||||
|
||||
try {
|
||||
$data_template = new \SplFileInfo($app['root.path'] . '/lib/conf.d/data_templates/' . $dataTemplate . '.xml');
|
||||
$connbas = new \connection_pdo('databox_creation', $hostname, $port, $userDb, $passwordDb, $dbName, array(), $app['debug']);
|
||||
$connbas = new \connection_pdo('databox_creation', $hostname, $port, $userDb, $passwordDb, $dbName, [], $app['debug']);
|
||||
try {
|
||||
$base = \databox::create($app, $connbas, $data_template, $app['phraseanet.registry']);
|
||||
$base->registerAdmin($app['authentication']->getUser());
|
||||
|
||||
return $app->redirectPath('admin_database', array('databox_id' => $base->get_sbas_id(), 'success' => 1, 'reload-tree' => 1));
|
||||
return $app->redirectPath('admin_database', ['databox_id' => $base->get_sbas_id(), 'success' => 1, 'reload-tree' => 1]);
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('admin_databases', array('success' => 0, 'error' => 'base-failed'));
|
||||
return $app->redirectPath('admin_databases', ['success' => 0, 'error' => 'base-failed']);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('admin_databases', array('success' => 0, 'error' => 'database-failed'));
|
||||
return $app->redirectPath('admin_databases', ['success' => 0, 'error' => 'database-failed']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,11 +220,11 @@ class Databoxes implements ControllerProviderInterface
|
||||
public function databaseMount(Application $app, Request $request)
|
||||
{
|
||||
if ('' === $dbName = trim($request->request->get('new_dbname', ''))) {
|
||||
return $app->redirectPath('admin_databases', array('success' => 0, 'error' => 'no-empty'));
|
||||
return $app->redirectPath('admin_databases', ['success' => 0, 'error' => 'no-empty']);
|
||||
}
|
||||
|
||||
if (\p4string::hasAccent($dbName)) {
|
||||
return $app->redirectPath('admin_databases', array('success' => 0, 'error' => 'special-chars'));
|
||||
return $app->redirectPath('admin_databases', ['success' => 0, 'error' => 'special-chars']);
|
||||
}
|
||||
|
||||
if ((null === $request->request->get('new_settings'))) {
|
||||
@@ -242,11 +242,11 @@ class Databoxes implements ControllerProviderInterface
|
||||
$base->registerAdmin($app['authentication']->getUser());
|
||||
$app['phraseanet.appbox']->get_connection()->commit();
|
||||
|
||||
return $app->redirectPath('admin_database', array('databox_id' => $base->get_sbas_id(), 'success' => 1, 'reload-tree' => 1));
|
||||
return $app->redirectPath('admin_database', ['databox_id' => $base->get_sbas_id(), 'success' => 1, 'reload-tree' => 1]);
|
||||
} catch (\Exception $e) {
|
||||
$app['phraseanet.appbox']->get_connection()->rollBack();
|
||||
|
||||
return $app->redirectPath('admin_databases', array('success' => 0, 'error' => 'mount-failed'));
|
||||
return $app->redirectPath('admin_databases', ['success' => 0, 'error' => 'mount-failed']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,11 +263,11 @@ class Databoxes implements ControllerProviderInterface
|
||||
$base->registerAdmin($app['authentication']->getUser());
|
||||
$app['phraseanet.appbox']->get_connection()->commit();
|
||||
|
||||
return $app->redirectPath('admin_database', array('databox_id' => $base->get_sbas_id(), 'success' => 1, 'reload-tree' => 1));
|
||||
return $app->redirectPath('admin_database', ['databox_id' => $base->get_sbas_id(), 'success' => 1, 'reload-tree' => 1]);
|
||||
} catch (\Exception $e) {
|
||||
$app['phraseanet.appbox']->get_connection()->rollBack();
|
||||
|
||||
return $app->redirectPath('admin_databases', array('success' => 0, 'error' => 'mount-failed'));
|
||||
return $app->redirectPath('admin_databases', ['success' => 0, 'error' => 'mount-failed']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -283,20 +283,20 @@ class Databoxes implements ControllerProviderInterface
|
||||
{
|
||||
$info = $app['task-manager.live-information']->getManager();
|
||||
if (TaskManagerStatus::STATUS_STARTED === $info['actual']) {
|
||||
return $app->redirectPath('admin_databases', array('success' => 0, 'error' => 'scheduler-started'));
|
||||
return $app->redirectPath('admin_databases', ['success' => 0, 'error' => 'scheduler-started']);
|
||||
}
|
||||
|
||||
try {
|
||||
$upgrader = new \Setup_Upgrade($app);
|
||||
$advices = $app['phraseanet.appbox']->forceUpgrade($upgrader, $app);
|
||||
|
||||
return $app->redirectPath('admin_databases', array('success' => 1, 'notice' => 'restart', 'advices' => $advices));
|
||||
return $app->redirectPath('admin_databases', ['success' => 1, 'notice' => 'restart', 'advices' => $advices]);
|
||||
} catch (\Exception_Setup_UpgradeAlreadyStarted $e) {
|
||||
return $app->redirectPath('admin_databases', array('success' => 0, 'error' => 'already-started'));
|
||||
return $app->redirectPath('admin_databases', ['success' => 0, 'error' => 'already-started']);
|
||||
} catch (\Exception_Setup_FixBadEmailAddresses $e) {
|
||||
return $app->redirectPath('admin_databases', array('success' => 0, 'error' => 'bad-email'));
|
||||
return $app->redirectPath('admin_databases', ['success' => 0, 'error' => 'bad-email']);
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('admin_databases', array('success' => 0, 'error' => 'unknow'));
|
||||
return $app->redirectPath('admin_databases', ['success' => 0, 'error' => 'unknow']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -90,7 +90,7 @@ class Fields implements ControllerProviderInterface
|
||||
|
||||
public function updateFields(Application $app, Request $request, $sbas_id)
|
||||
{
|
||||
$fields = array();
|
||||
$fields = [];
|
||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||
$metaStructure = $databox->get_meta_structure();
|
||||
$connection = $databox->get_connection();
|
||||
@@ -125,7 +125,7 @@ class Fields implements ControllerProviderInterface
|
||||
|
||||
public function getLanguage(Application $app, Request $request)
|
||||
{
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'something_wrong' => _('Something wrong happened, please try again or contact an admin.'),
|
||||
'created_success' => _('%s field has been created with success.'),
|
||||
'deleted_success' => _('%s field has been deleted with success.'),
|
||||
@@ -136,29 +136,29 @@ class Fields implements ControllerProviderInterface
|
||||
'validation_tag_invalid' => _('Field source is not valid.'),
|
||||
'field_error' => _('Field %s contains errors.'),
|
||||
'fields_save' => _('Your configuration has been successfuly saved.'),
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
public function displayApp(Application $app, Request $request, $sbas_id)
|
||||
{
|
||||
$languages = array();
|
||||
$languages = [];
|
||||
|
||||
foreach ($app['locales.available'] as $code => $language) {
|
||||
$data = explode('_', $code);
|
||||
$languages[$data[0]] = $language;
|
||||
}
|
||||
|
||||
return $app['twig']->render('/admin/fields/index.html.twig', array(
|
||||
return $app['twig']->render('/admin/fields/index.html.twig', [
|
||||
'sbas_id' => $sbas_id,
|
||||
'languages' => $languages,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
public function listDcFields(Application $app, Request $request)
|
||||
{
|
||||
$data = $app['serializer']->serialize(array_values(\databox::get_available_dcfields()), 'json');
|
||||
|
||||
return new Response($data, 200, array('content-type' => 'application/json'));
|
||||
return new Response($data, 200, ['content-type' => 'application/json']);
|
||||
}
|
||||
|
||||
public function listVocabularies(Application $app, Request $request)
|
||||
@@ -166,10 +166,10 @@ class Fields implements ControllerProviderInterface
|
||||
$vocabularies = VocabularyController::getAvailable($app);
|
||||
|
||||
return $app->json(array_map(function ($vocabulary) {
|
||||
return array(
|
||||
return [
|
||||
'type' => $vocabulary->getType(),
|
||||
'name' => $vocabulary->getName(),
|
||||
);
|
||||
];
|
||||
}, $vocabularies));
|
||||
}
|
||||
|
||||
@@ -177,16 +177,16 @@ class Fields implements ControllerProviderInterface
|
||||
{
|
||||
$vocabulary = VocabularyController::get($app, $type);
|
||||
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'type' => $vocabulary->getType(),
|
||||
'name' => $vocabulary->getName(),
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
public function searchTag(Application $app, Request $request)
|
||||
{
|
||||
$term = trim(strtolower($request->query->get('term')));
|
||||
$res = array();
|
||||
$res = [];
|
||||
|
||||
if ($term) {
|
||||
$provider = new TagProvider();
|
||||
@@ -199,11 +199,11 @@ class Fields implements ControllerProviderInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
$res[] = array(
|
||||
$res[] = [
|
||||
'id' => $namespace . '/' . $tagname,
|
||||
'label' => $datas['namespace'] . ' / ' . $datas['tagname'],
|
||||
'value' => $datas['namespace'] . ':' . $datas['tagname'],
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,7 +216,7 @@ class Fields implements ControllerProviderInterface
|
||||
$tag = \databox_field::loadClassFromTagName($tagname);
|
||||
$json = $app['serializer']->serialize($tag, 'json');
|
||||
|
||||
return new Response($json, 200, array('Content-Type' => 'application/json'));
|
||||
return new Response($json, 200, ['Content-Type' => 'application/json']);
|
||||
}
|
||||
|
||||
public function createField(Application $app, Request $request, $sbas_id)
|
||||
@@ -236,11 +236,11 @@ class Fields implements ControllerProviderInterface
|
||||
$app->abort(500, _(sprintf('Field %s could not be created, please try again or contact an admin.', $data['name'])));
|
||||
}
|
||||
|
||||
return $app->json($field->toArray(), 201, array(
|
||||
'location' => $app->path('admin_fields_show_field', array(
|
||||
return $app->json($field->toArray(), 201, [
|
||||
'location' => $app->path('admin_fields_show_field', [
|
||||
'sbas_id' => $sbas_id,
|
||||
'id' => $field->get_id()
|
||||
))));
|
||||
])]);
|
||||
}
|
||||
|
||||
public function listFields(Application $app, $sbas_id)
|
||||
@@ -361,11 +361,11 @@ class Fields implements ControllerProviderInterface
|
||||
|
||||
private function getMandatoryFieldProperties()
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'name', 'multi', 'thumbtitle', 'tag', 'business', 'indexable',
|
||||
'required', 'separator', 'readonly', 'type', 'tbranch', 'report',
|
||||
'vocabulary-type', 'vocabulary-restricted', 'dces-element', 'labels'
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
private function validateNameField(\databox_descriptionStructure $metaStructure, array $field)
|
||||
|
@@ -42,7 +42,7 @@ class Publications implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
return $app['twig']
|
||||
->render('admin/publications/list.html.twig', array('feeds' => $feeds));
|
||||
->render('admin/publications/list.html.twig', ['feeds' => $feeds]);
|
||||
})->bind('admin_feeds_list');
|
||||
|
||||
$controllers->post('/create/', function (PhraseaApplication $app, Request $request) {
|
||||
@@ -82,7 +82,7 @@ class Publications implements ControllerProviderInterface
|
||||
$feed = $app["EM"]->find('Alchemy\Phrasea\Model\Entities\Feed', $id);
|
||||
|
||||
return $app['twig']
|
||||
->render('admin/publications/fiche.html.twig', array('feed' => $feed, 'error' => $app['request']->query->get('error')));
|
||||
->render('admin/publications/fiche.html.twig', ['feed' => $feed, 'error' => $app['request']->query->get('error')]);
|
||||
})
|
||||
->bind('admin_feeds_feed')
|
||||
->assert('id', '\d+');
|
||||
@@ -112,17 +112,17 @@ class Publications implements ControllerProviderInterface
|
||||
$feed = $app["EM"]->find('Alchemy\Phrasea\Model\Entities\Feed', $request->attributes->get('id'));
|
||||
|
||||
if (!$feed->isOwner($app['authentication']->getUser())) {
|
||||
return $app->redirectPath('admin_feeds_feed', array('id' => $request->attributes->get('id'), 'error' => _('You are not the owner of this feed, you can not edit it')));
|
||||
return $app->redirectPath('admin_feeds_feed', ['id' => $request->attributes->get('id'), 'error' => _('You are not the owner of this feed, you can not edit it')]);
|
||||
}
|
||||
})
|
||||
->bind('admin_feeds_feed_update')
|
||||
->assert('id', '\d+');
|
||||
|
||||
$controllers->post('/feed/{id}/iconupload/', function (PhraseaApplication $app, Request $request, $id) {
|
||||
$datas = array(
|
||||
$datas = [
|
||||
'success' => false,
|
||||
'message' => '',
|
||||
);
|
||||
];
|
||||
$feed = $app["EM"]->find('Alchemy\Phrasea\Model\Entities\Feed', $id);
|
||||
|
||||
if (null === $feed) {
|
||||
@@ -213,7 +213,7 @@ class Publications implements ControllerProviderInterface
|
||||
$error = "An error occured";
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_feeds_feed', array('id' => $id, 'error' => $error));
|
||||
return $app->redirectPath('admin_feeds_feed', ['id' => $id, 'error' => $error]);
|
||||
})
|
||||
->bind('admin_feeds_feed_add_publisher')
|
||||
->assert('id', '\d+');
|
||||
@@ -240,7 +240,7 @@ class Publications implements ControllerProviderInterface
|
||||
$error = "An error occured";
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_feeds_feed', array('id' => $id, 'error' => $error));
|
||||
return $app->redirectPath('admin_feeds_feed', ['id' => $id, 'error' => $error]);
|
||||
})
|
||||
->bind('admin_feeds_feed_remove_publisher')
|
||||
->assert('id', '\d+');
|
||||
|
@@ -43,7 +43,7 @@ class Root implements ControllerProviderInterface
|
||||
|
||||
$section = $request->query->get('section', false);
|
||||
|
||||
$available = array(
|
||||
$available = [
|
||||
'connected',
|
||||
'registrations',
|
||||
'taskmanager',
|
||||
@@ -52,7 +52,7 @@ class Root implements ControllerProviderInterface
|
||||
'collection',
|
||||
'user',
|
||||
'users'
|
||||
);
|
||||
];
|
||||
|
||||
$feature = 'connected';
|
||||
$featured = false;
|
||||
@@ -67,7 +67,7 @@ class Root implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$databoxes = $off_databoxes = array();
|
||||
$databoxes = $off_databoxes = [];
|
||||
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||
try {
|
||||
if (!$app['acl']->get($app['authentication']->getUser())->has_access_to_sbas($databox->get_sbas_id())) {
|
||||
@@ -82,14 +82,14 @@ class Root implements ControllerProviderInterface
|
||||
$databoxes[] = $databox;
|
||||
}
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'feature' => $feature,
|
||||
'featured' => $featured,
|
||||
'databoxes' => $databoxes,
|
||||
'off_databoxes' => $off_databoxes
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('admin/index.html.twig', array(
|
||||
return $app['twig']->render('admin/index.html.twig', [
|
||||
'module' => 'admin',
|
||||
'events' => $app['events-manager'],
|
||||
'module_name' => 'Admin',
|
||||
@@ -99,7 +99,7 @@ class Root implements ControllerProviderInterface
|
||||
'databoxes' => $databoxes,
|
||||
'off_databoxes' => $off_databoxes,
|
||||
'tree' => $app['twig']->render('admin/tree.html.twig', $params),
|
||||
));
|
||||
]);
|
||||
})->bind('admin');
|
||||
|
||||
$controllers->get('/tree/', function (Application $app, Request $request) {
|
||||
@@ -111,7 +111,7 @@ class Root implements ControllerProviderInterface
|
||||
|
||||
$section = $request->query->get('section', false);
|
||||
|
||||
$available = array(
|
||||
$available = [
|
||||
'connected',
|
||||
'registrations',
|
||||
'taskmanager',
|
||||
@@ -120,7 +120,7 @@ class Root implements ControllerProviderInterface
|
||||
'collection',
|
||||
'user',
|
||||
'users'
|
||||
);
|
||||
];
|
||||
|
||||
$feature = 'connected';
|
||||
$featured = false;
|
||||
@@ -136,7 +136,7 @@ class Root implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$databoxes = $off_databoxes = array();
|
||||
$databoxes = $off_databoxes = [];
|
||||
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||
try {
|
||||
if (!$app['acl']->get($app['authentication']->getUser())->has_access_to_sbas($databox->get_sbas_id())) {
|
||||
@@ -152,12 +152,12 @@ class Root implements ControllerProviderInterface
|
||||
$databoxes[] = $databox;
|
||||
}
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'feature' => $feature,
|
||||
'featured' => $featured,
|
||||
'databoxes' => $databoxes,
|
||||
'off_databoxes' => $off_databoxes
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('admin/tree.html.twig', $params);
|
||||
})->bind('admin_display_tree');
|
||||
@@ -168,7 +168,7 @@ class Root implements ControllerProviderInterface
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
if (0 !== count($tests = $request->query->get('tests', array()))) {
|
||||
if (0 !== count($tests = $request->query->get('tests', []))) {
|
||||
$app->abort(400, _('Missing tests parameter'));
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ class Root implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app->json(array('results' => $result));
|
||||
return $app->json(['results' => $result]);
|
||||
})
|
||||
->bind('admin_test_paths');
|
||||
|
||||
@@ -213,13 +213,13 @@ class Root implements ControllerProviderInterface
|
||||
$errorsStructure = true;
|
||||
}
|
||||
|
||||
return $app['twig']->render('admin/structure.html.twig', array(
|
||||
return $app['twig']->render('admin/structure.html.twig', [
|
||||
'databox' => $databox,
|
||||
'errors' => $errors,
|
||||
'structure' => $structure,
|
||||
'errorsStructure' => $errorsStructure,
|
||||
'updateOk' => $updateOk
|
||||
));
|
||||
]);
|
||||
})->assert('databox_id', '\d+')
|
||||
->bind('database_display_stucture');
|
||||
|
||||
@@ -242,9 +242,9 @@ class Root implements ControllerProviderInterface
|
||||
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
|
||||
$databox->saveStructure($domst);
|
||||
|
||||
return $app->redirectPath('database_display_stucture', array('databox_id' => $databox_id, 'success' => 1));
|
||||
return $app->redirectPath('database_display_stucture', ['databox_id' => $databox_id, 'success' => 1]);
|
||||
} else {
|
||||
return $app->redirectPath('database_display_stucture', array('databox_id' => $databox_id, 'success' => 0, 'error' => 'struct'));
|
||||
return $app->redirectPath('database_display_stucture', ['databox_id' => $databox_id, 'success' => 0, 'error' => 'struct']);
|
||||
}
|
||||
})->assert('databox_id', '\d+')
|
||||
->bind('database_submit_stucture');
|
||||
@@ -254,9 +254,9 @@ class Root implements ControllerProviderInterface
|
||||
$app->abort(403);
|
||||
}
|
||||
|
||||
return $app['twig']->render('admin/statusbit.html.twig', array(
|
||||
return $app['twig']->render('admin/statusbit.html.twig', [
|
||||
'databox' => $app['phraseanet.appbox']->get_databox($databox_id),
|
||||
));
|
||||
]);
|
||||
})->assert('databox_id', '\d+')
|
||||
->bind('database_display_statusbit');
|
||||
|
||||
@@ -290,7 +290,7 @@ class Root implements ControllerProviderInterface
|
||||
if (isset($status[$bit])) {
|
||||
$status = $status[$bit];
|
||||
} else {
|
||||
$status = array(
|
||||
$status = [
|
||||
"labeloff" => '',
|
||||
"labelon" => '',
|
||||
"img_off" => '',
|
||||
@@ -299,7 +299,7 @@ class Root implements ControllerProviderInterface
|
||||
"path_on" => '',
|
||||
"searchable" => false,
|
||||
"printable" => false,
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($app['locales.I18n.available'] as $code => $language) {
|
||||
$status['labels_on'][$code] = null;
|
||||
@@ -307,10 +307,10 @@ class Root implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app['twig']->render('admin/statusbit/edit.html.twig', array(
|
||||
return $app['twig']->render('admin/statusbit/edit.html.twig', [
|
||||
'status' => $status,
|
||||
'errorMsg' => $errorMsg
|
||||
));
|
||||
]);
|
||||
})->assert('databox_id', '\d+')
|
||||
->assert('bit', '\d+')
|
||||
->bind('database_display_statusbit_form');
|
||||
@@ -332,7 +332,7 @@ class Root implements ControllerProviderInterface
|
||||
$error = true;
|
||||
}
|
||||
|
||||
return $app->json(array('success' => !$error));
|
||||
return $app->json(['success' => !$error]);
|
||||
})
|
||||
->bind('admin_statusbit_delete')
|
||||
->assert('databox_id', '\d+')
|
||||
@@ -343,15 +343,15 @@ class Root implements ControllerProviderInterface
|
||||
$app->abort(403);
|
||||
}
|
||||
|
||||
$properties = array(
|
||||
$properties = [
|
||||
'searchable' => $request->request->get('searchable') ? '1' : '0',
|
||||
'printable' => $request->request->get('printable') ? '1' : '0',
|
||||
'name' => $request->request->get('name', ''),
|
||||
'labelon' => $request->request->get('label_on', ''),
|
||||
'labeloff' => $request->request->get('label_off', ''),
|
||||
'labels_on' => $request->request->get('labels_on', array()),
|
||||
'labels_off' => $request->request->get('labels_off', array()),
|
||||
);
|
||||
'labels_on' => $request->request->get('labels_on', []),
|
||||
'labels_off' => $request->request->get('labels_off', []),
|
||||
];
|
||||
|
||||
\databox_status::updateStatus($app, $databox_id, $bit, $properties);
|
||||
|
||||
@@ -363,41 +363,41 @@ class Root implements ControllerProviderInterface
|
||||
try {
|
||||
\databox_status::updateIcon($app, $databox_id, $bit, 'off', $file);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return $app->redirectPath('database_display_statusbit_form', array(
|
||||
return $app->redirectPath('database_display_statusbit_form', [
|
||||
'databox_id' => $databox_id,
|
||||
'bit' => $bit,
|
||||
'error' => 'rights',
|
||||
));
|
||||
]);
|
||||
} catch (\Exception_InvalidArgument $e) {
|
||||
return $app->redirectPath('database_display_statusbit_form', array(
|
||||
return $app->redirectPath('database_display_statusbit_form', [
|
||||
'databox_id' => $databox_id,
|
||||
'bit' => $bit,
|
||||
'error' => 'unknow-error',
|
||||
));
|
||||
]);
|
||||
} catch (\Exception_Upload_FileTooBig $e) {
|
||||
return $app->redirectPath('database_display_statusbit_form', array(
|
||||
return $app->redirectPath('database_display_statusbit_form', [
|
||||
'databox_id' => $databox_id,
|
||||
'bit' => $bit,
|
||||
'error' => 'too-big',
|
||||
));
|
||||
]);
|
||||
} catch (\Exception_Upload_Error $e) {
|
||||
return $app->redirectPath('database_display_statusbit_form', array(
|
||||
return $app->redirectPath('database_display_statusbit_form', [
|
||||
'databox_id' => $databox_id,
|
||||
'bit' => $bit,
|
||||
'error' => 'upload-error',
|
||||
));
|
||||
]);
|
||||
} catch (\Exception_Upload_CannotWriteFile $e) {
|
||||
return $app->redirectPath('database_display_statusbit_form', array(
|
||||
return $app->redirectPath('database_display_statusbit_form', [
|
||||
'databox_id' => $databox_id,
|
||||
'bit' => $bit,
|
||||
'error' => 'wright-error',
|
||||
));
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('database_display_statusbit_form', array(
|
||||
return $app->redirectPath('database_display_statusbit_form', [
|
||||
'databox_id' => $databox_id,
|
||||
'bit' => $bit,
|
||||
'error' => 'unknow-error',
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,45 +409,45 @@ class Root implements ControllerProviderInterface
|
||||
try {
|
||||
\databox_status::updateIcon($app, $databox_id, $bit, 'on', $file);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return $app->redirectPath('database_display_statusbit_form', array(
|
||||
return $app->redirectPath('database_display_statusbit_form', [
|
||||
'databox_id' => $databox_id,
|
||||
'bit' => $bit,
|
||||
'error' => 'rights',
|
||||
));
|
||||
]);
|
||||
} catch (\Exception_InvalidArgument $e) {
|
||||
return $app->redirectPath('database_display_statusbit_form', array(
|
||||
return $app->redirectPath('database_display_statusbit_form', [
|
||||
'databox_id' => $databox_id,
|
||||
'bit' => $bit,
|
||||
'error' => 'unknow-error',
|
||||
));
|
||||
]);
|
||||
} catch (\Exception_Upload_FileTooBig $e) {
|
||||
return $app->redirectPath('database_display_statusbit_form', array(
|
||||
return $app->redirectPath('database_display_statusbit_form', [
|
||||
'databox_id' => $databox_id,
|
||||
'bit' => $bit,
|
||||
'error' => 'too-big',
|
||||
));
|
||||
]);
|
||||
} catch (\Exception_Upload_Error $e) {
|
||||
return $app->redirectPath('database_display_statusbit_form', array(
|
||||
return $app->redirectPath('database_display_statusbit_form', [
|
||||
'databox_id' => $databox_id,
|
||||
'bit' => $bit,
|
||||
'error' => 'upload-error',
|
||||
));
|
||||
]);
|
||||
} catch (\Exception_Upload_CannotWriteFile $e) {
|
||||
return $app->redirectPath('database_display_statusbit_form', array(
|
||||
return $app->redirectPath('database_display_statusbit_form', [
|
||||
'databox_id' => $databox_id,
|
||||
'bit' => $bit,
|
||||
'error' => 'wright-error',
|
||||
));
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('database_display_statusbit_form', array(
|
||||
return $app->redirectPath('database_display_statusbit_form', [
|
||||
'databox_id' => $databox_id,
|
||||
'bit' => $bit,
|
||||
'error' => 'unknow-error',
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $app->redirectPath('database_display_statusbit', array('databox_id' => $databox_id, 'success' => 1));
|
||||
return $app->redirectPath('database_display_statusbit', ['databox_id' => $databox_id, 'success' => 1]);
|
||||
})->assert('databox_id', '\d+')
|
||||
->assert('bit', '\d+')
|
||||
->bind('database_submit_statusbit');
|
||||
|
@@ -68,11 +68,11 @@ class Setup implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app['twig']->render('admin/setup.html.twig', array(
|
||||
return $app['twig']->render('admin/setup.html.twig', [
|
||||
'GV' => $GV,
|
||||
'update_post_datas' => $update,
|
||||
'listTimeZone' => \DateTimeZone::listAbbreviations()
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,13 +85,13 @@ class Setup implements ControllerProviderInterface
|
||||
public function postGlobals(Application $app, Request $request)
|
||||
{
|
||||
if (\setup::create_global_values($app, $request->request->all())) {
|
||||
return $app->redirectPath('setup_display_globals', array(
|
||||
return $app->redirectPath('setup_display_globals', [
|
||||
'success' => 1
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('setup_display_globals', array(
|
||||
return $app->redirectPath('setup_display_globals', [
|
||||
'success' => 0
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -36,10 +36,10 @@ class Subdefs implements ControllerProviderInterface
|
||||
$controllers->get('/{sbas_id}/', function (Application $app, $sbas_id) {
|
||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||
|
||||
return $app['twig']->render('admin/subdefs.html.twig', array(
|
||||
return $app['twig']->render('admin/subdefs.html.twig', [
|
||||
'databox' => $databox,
|
||||
'subdefs' => $databox->get_subdef_structure()
|
||||
));
|
||||
]);
|
||||
})
|
||||
->bind('admin_subdefs_subdef')
|
||||
->assert('sbas_id', '\d+');
|
||||
@@ -47,11 +47,11 @@ class Subdefs implements ControllerProviderInterface
|
||||
$controllers->post('/{sbas_id}/', function (Application $app, Request $request, $sbas_id) {
|
||||
$delete_subdef = $request->request->get('delete_subdef');
|
||||
$toadd_subdef = $request->request->get('add_subdef');
|
||||
$Parmsubdefs = $request->request->get('subdefs', array());
|
||||
$Parmsubdefs = $request->request->get('subdefs', []);
|
||||
|
||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||
|
||||
$add_subdef = array('class' => null, 'name' => null, 'group' => null);
|
||||
$add_subdef = ['class' => null, 'name' => null, 'group' => null];
|
||||
foreach ($add_subdef as $k => $v) {
|
||||
if (!isset($toadd_subdef[$k]) || trim($toadd_subdef[$k]) === '')
|
||||
unset($add_subdef[$k]);
|
||||
@@ -81,7 +81,7 @@ class Subdefs implements ControllerProviderInterface
|
||||
|
||||
foreach ($Parmsubdefs as $post_sub) {
|
||||
|
||||
$options = array();
|
||||
$options = [];
|
||||
|
||||
$post_sub_ex = explode('_', $post_sub);
|
||||
|
||||
@@ -91,7 +91,7 @@ class Subdefs implements ControllerProviderInterface
|
||||
$class = $request->request->get($post_sub . '_class');
|
||||
$downloadable = $request->request->get($post_sub . '_downloadable');
|
||||
|
||||
$defaults = array('path', 'meta', 'mediatype');
|
||||
$defaults = ['path', 'meta', 'mediatype'];
|
||||
|
||||
foreach ($defaults as $def) {
|
||||
$parm_loc = $request->request->get($post_sub . '_' . $def);
|
||||
@@ -104,7 +104,7 @@ class Subdefs implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
$mediatype = $request->request->get($post_sub . '_mediatype');
|
||||
$media = $request->request->get($post_sub . '_' . $mediatype, array());
|
||||
$media = $request->request->get($post_sub . '_' . $mediatype, []);
|
||||
|
||||
foreach ($media as $option => $value) {
|
||||
|
||||
@@ -115,13 +115,13 @@ class Subdefs implements ControllerProviderInterface
|
||||
$options[$option] = $value;
|
||||
}
|
||||
|
||||
$labels = $request->request->get($post_sub . '_label', array());
|
||||
$labels = $request->request->get($post_sub . '_label', []);
|
||||
|
||||
$subdefs->set_subdef($group, $name, $class, $downloadable, $options, $labels);
|
||||
}
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_subdefs_subdef', array('sbas_id' => $databox->get_sbas_id()));
|
||||
return $app->redirectPath('admin_subdefs_subdef', ['sbas_id' => $databox->get_sbas_id()]);
|
||||
})
|
||||
->bind('admin_subdefs_subdef_update')
|
||||
->assert('sbas_id', '\d+');
|
||||
|
@@ -122,10 +122,10 @@ class TaskManager implements ControllerProviderInterface
|
||||
|
||||
public function getTasks(Application $app, Request $request)
|
||||
{
|
||||
return $app['twig']->render('admin/task-manager/list.html.twig', array(
|
||||
return $app['twig']->render('admin/task-manager/list.html.twig', [
|
||||
'available_jobs' => $app['task-manager.available-jobs'],
|
||||
'tasks' => $app['manipulator.task']->getRepository()->findAll(),
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
public function postCreateTask(Application $app, Request $request)
|
||||
@@ -143,7 +143,7 @@ class TaskManager implements ControllerProviderInterface
|
||||
$job->getEditor()->getDefaultPeriod()
|
||||
);
|
||||
|
||||
return $app->redirectPath('admin_tasks_task_show', array('task' => $task->getId()));
|
||||
return $app->redirectPath('admin_tasks_task_show', ['task' => $task->getId()]);
|
||||
}
|
||||
|
||||
public function getSchedulerLog(Application $app, Request $request)
|
||||
@@ -153,10 +153,10 @@ class TaskManager implements ControllerProviderInterface
|
||||
$logFile->clear();
|
||||
}
|
||||
|
||||
return $app['twig']->render('admin/task-manager/log.html.twig', array(
|
||||
return $app['twig']->render('admin/task-manager/log.html.twig', [
|
||||
'logfile' => $logFile,
|
||||
'logname' => 'Scheduler',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
public function getTaskLog(Application $app, Request $request, Task $task)
|
||||
@@ -166,10 +166,10 @@ class TaskManager implements ControllerProviderInterface
|
||||
$logFile->clear();
|
||||
}
|
||||
|
||||
return $app['twig']->render('admin/task-manager/log.html.twig', array(
|
||||
return $app['twig']->render('admin/task-manager/log.html.twig', [
|
||||
'logfile' => $logFile,
|
||||
'logname' => sprintf('%s (task id %d)', $task->getName(), $task->getId()),
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
public function postTaskDelete(Application $app, Request $request, Task $task)
|
||||
@@ -197,13 +197,13 @@ class TaskManager implements ControllerProviderInterface
|
||||
{
|
||||
$app['manipulator.task']->resetCrashes($task);
|
||||
|
||||
return $app->json(array('success' => true));
|
||||
return $app->json(['success' => true]);
|
||||
}
|
||||
|
||||
public function postSaveTask(Application $app, Request $request, Task $task)
|
||||
{
|
||||
if (!$this->doValidateXML($request->request->get('settings'))) {
|
||||
return $app->json(array('success' => false, 'message' => sprintf('Unable to load XML %s', $request->request->get('xml'))));
|
||||
return $app->json(['success' => false, 'message' => sprintf('Unable to load XML %s', $request->request->get('xml'))]);
|
||||
}
|
||||
|
||||
$form = $app->form(new TaskForm());
|
||||
@@ -212,13 +212,13 @@ class TaskManager implements ControllerProviderInterface
|
||||
if ($form->isValid()) {
|
||||
$app['manipulator.task']->update($task);
|
||||
|
||||
return $app->json(array('success' => true));
|
||||
return $app->json(['success' => true]);
|
||||
}
|
||||
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => false,
|
||||
'message' => implode("\n", $form->getErrors())
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
public function postTaskFacility(Application $app, Request $request, Task $task)
|
||||
@@ -246,16 +246,16 @@ class TaskManager implements ControllerProviderInterface
|
||||
$form = $app->form(new TaskForm());
|
||||
$form->setData($task);
|
||||
|
||||
return $app['twig']->render($editor->getTemplatePath(), array(
|
||||
return $app['twig']->render($editor->getTemplatePath(), [
|
||||
'task' => $task,
|
||||
'form' => $form->createView(),
|
||||
'view' => 'XML',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
public function validateXML(Application $app, Request $request)
|
||||
{
|
||||
return $app->json(array('success' => $this->doValidateXML($request->getContent())));
|
||||
return $app->json(['success' => $this->doValidateXML($request->getContent())]);
|
||||
}
|
||||
|
||||
private function doValidateXML($string)
|
||||
|
@@ -50,7 +50,7 @@ class Users implements ControllerProviderInterface
|
||||
|
||||
$controllers->post('/rights/reset/', function (Application $app, Request $request) {
|
||||
try {
|
||||
$datas = array('error' => false);
|
||||
$datas = ['error' => false];
|
||||
|
||||
$helper = new UserHelper\Edit($app, $request);
|
||||
$helper->resetRights();
|
||||
@@ -70,7 +70,7 @@ class Users implements ControllerProviderInterface
|
||||
});
|
||||
|
||||
$controllers->post('/rights/apply/', function (Application $app) {
|
||||
$datas = array('error' => true);
|
||||
$datas = ['error' => true];
|
||||
|
||||
try {
|
||||
$rights = new UserHelper\Edit($app, $app['request']);
|
||||
@@ -88,7 +88,7 @@ class Users implements ControllerProviderInterface
|
||||
|
||||
$rights->apply_infos();
|
||||
|
||||
$datas = array('error' => false);
|
||||
$datas = ['error' => false];
|
||||
} catch (\Exception $e) {
|
||||
$datas['message'] = $e->getMessage();
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class Users implements ControllerProviderInterface
|
||||
$rights = new UserHelper\Edit($app, $app['request']);
|
||||
$rights->apply_quotas();
|
||||
|
||||
return $app->json(array('message' => '', 'error' => false));
|
||||
return $app->json(['message' => '', 'error' => false]);
|
||||
});
|
||||
|
||||
$controllers->post('/rights/time/', function (Application $app) {
|
||||
@@ -125,7 +125,7 @@ class Users implements ControllerProviderInterface
|
||||
$rights = new UserHelper\Edit($app, $app['request']);
|
||||
$rights->apply_time();
|
||||
|
||||
return $app->json(array('message' => '', 'error' => false));
|
||||
return $app->json(['message' => '', 'error' => false]);
|
||||
});
|
||||
|
||||
$controllers->post('/rights/masks/', function (Application $app) {
|
||||
@@ -138,7 +138,7 @@ class Users implements ControllerProviderInterface
|
||||
$rights = new UserHelper\Edit($app, $app['request']);
|
||||
$rights->apply_masks();
|
||||
|
||||
return $app->json(array('message' => '', 'error' => false));
|
||||
return $app->json(['message' => '', 'error' => false]);
|
||||
});
|
||||
|
||||
$controllers->match('/search/', function (Application $app) {
|
||||
@@ -152,8 +152,8 @@ class Users implements ControllerProviderInterface
|
||||
|
||||
$users = new UserHelper\Manage($app, $app['request']);
|
||||
|
||||
$userTable = array(
|
||||
array(
|
||||
$userTable = [
|
||||
[
|
||||
'ID',
|
||||
'Login',
|
||||
'Last Name',
|
||||
@@ -170,12 +170,12 @@ class Users implements ControllerProviderInterface
|
||||
'Job',
|
||||
'Company',
|
||||
'Position'
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($users->export() as $user) {
|
||||
/* @var $user \User_Adapter */
|
||||
$userTable[] = array(
|
||||
$userTable[] = [
|
||||
$user->get_id(),
|
||||
$user->get_login(),
|
||||
$user->get_lastname(),
|
||||
@@ -192,12 +192,12 @@ class Users implements ControllerProviderInterface
|
||||
$user->get_job(),
|
||||
$user->get_company(),
|
||||
$user->get_position()
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$CSVDatas = \format::arr_to_csv($userTable);
|
||||
|
||||
$response = new Response($CSVDatas, 200, array('Content-Type' => 'text/csv'));
|
||||
$response = new Response($CSVDatas, 200, ['Content-Type' => 'text/csv']);
|
||||
$response->headers->set('Content-Disposition', 'attachment; filename=export.csv');
|
||||
|
||||
return $response;
|
||||
@@ -220,10 +220,10 @@ class Users implements ControllerProviderInterface
|
||||
$user_query = new \User_Query($app);
|
||||
|
||||
$like_value = $request->query->get('term');
|
||||
$rights = $request->query->get('filter_rights') ? : array();
|
||||
$have_right = $request->query->get('have_right') ? : array();
|
||||
$have_not_right = $request->query->get('have_not_right') ? : array();
|
||||
$on_base = $request->query->get('on_base') ? : array();
|
||||
$rights = $request->query->get('filter_rights') ? : [];
|
||||
$have_right = $request->query->get('have_right') ? : [];
|
||||
$have_not_right = $request->query->get('have_not_right') ? : [];
|
||||
$on_base = $request->query->get('on_base') ? : [];
|
||||
|
||||
$elligible_users = $user_query
|
||||
->on_sbas_where_i_am($app['acl']->get($app['authentication']->getUser()), $rights)
|
||||
@@ -238,15 +238,15 @@ class Users implements ControllerProviderInterface
|
||||
->execute()
|
||||
->get_results();
|
||||
|
||||
$datas = array();
|
||||
$datas = [];
|
||||
|
||||
foreach ($elligible_users as $user) {
|
||||
$datas[] = array(
|
||||
$datas[] = [
|
||||
'email' => $user->get_email() ? : ''
|
||||
, 'login' => $user->get_login() ? : ''
|
||||
, 'name' => $user->get_display_name() ? : ''
|
||||
, 'id' => $user->get_id()
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return $app->json($datas);
|
||||
@@ -254,7 +254,7 @@ class Users implements ControllerProviderInterface
|
||||
|
||||
$controllers->post('/create/', function (Application $app) {
|
||||
|
||||
$datas = array('error' => false, 'message' => '', 'data' => null);
|
||||
$datas = ['error' => false, 'message' => '', 'data' => null];
|
||||
try {
|
||||
$request = $app['request'];
|
||||
$module = new UserHelper\Manage($app, $app['request']);
|
||||
@@ -284,15 +284,15 @@ class Users implements ControllerProviderInterface
|
||||
$on_base = $request->request->get('base_id') ? : null;
|
||||
$on_sbas = $request->request->get('sbas_id') ? : null;
|
||||
|
||||
$elligible_users = $user_query->on_bases_where_i_am($app['acl']->get($app['authentication']->getUser()), array('canadmin'))
|
||||
$elligible_users = $user_query->on_bases_where_i_am($app['acl']->get($app['authentication']->getUser()), ['canadmin'])
|
||||
->like($like_field, $like_value)
|
||||
->on_base_ids($on_base)
|
||||
->on_sbas_ids($on_sbas);
|
||||
|
||||
$offset = 0;
|
||||
$buffer = array();
|
||||
$buffer = [];
|
||||
|
||||
$buffer[] = array(
|
||||
$buffer[] = [
|
||||
'ID'
|
||||
, 'Login'
|
||||
, _('admin::compte-utilisateur nom')
|
||||
@@ -309,7 +309,7 @@ class Users implements ControllerProviderInterface
|
||||
, _('admin::compte-utilisateur poste')
|
||||
, _('admin::compte-utilisateur societe')
|
||||
, _('admin::compte-utilisateur activite')
|
||||
);
|
||||
];
|
||||
do {
|
||||
$elligible_users->limit($offset, 20);
|
||||
$offset += 20;
|
||||
@@ -317,7 +317,7 @@ class Users implements ControllerProviderInterface
|
||||
$results = $elligible_users->execute()->get_results();
|
||||
|
||||
foreach ($results as $user) {
|
||||
$buffer[] = array(
|
||||
$buffer[] = [
|
||||
$user->get_id()
|
||||
, $user->get_login()
|
||||
, $user->get_lastname()
|
||||
@@ -334,16 +334,16 @@ class Users implements ControllerProviderInterface
|
||||
, $user->get_job()
|
||||
, $user->get_company()
|
||||
, $user->get_position()
|
||||
);
|
||||
];
|
||||
}
|
||||
} while (count($results) > 0);
|
||||
|
||||
$out = \format::arr_to_csv($buffer);
|
||||
|
||||
$response = new Response($out, 200, array(
|
||||
$response = new Response($out, 200, [
|
||||
'Content-type' => 'text/csv',
|
||||
'Content-Disposition' => 'attachment; filename=export.csv',
|
||||
));
|
||||
]);
|
||||
|
||||
$response->setCharset('UTF-8');
|
||||
|
||||
@@ -355,15 +355,15 @@ class Users implements ControllerProviderInterface
|
||||
$lastMonth = time() - (3 * 4 * 7 * 24 * 60 * 60);
|
||||
$sql = "DELETE FROM demand WHERE date_modif < :date";
|
||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':date' => date('Y-m-d', $lastMonth)));
|
||||
$stmt->execute([':date' => date('Y-m-d', $lastMonth)]);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$baslist = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(array('canadmin')));
|
||||
$baslist = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(['canadmin']));
|
||||
|
||||
$sql = 'SELECT usr_id, usr_login FROM usr WHERE model_of = :usr_id';
|
||||
|
||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':usr_id' => $app['authentication']->getUser()->get_id()));
|
||||
$stmt->execute([':usr_id' => $app['authentication']->getUser()->get_id()]);
|
||||
$models = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
@@ -381,7 +381,7 @@ class Users implements ControllerProviderInterface
|
||||
$stmt->closeCursor();
|
||||
|
||||
$currentUsr = null;
|
||||
$table = array('user' => array(), 'coll' => array());
|
||||
$table = ['user' => [], 'coll' => []];
|
||||
|
||||
foreach ($rs as $row) {
|
||||
if ($row['usr_id'] != $currentUsr) {
|
||||
@@ -391,7 +391,7 @@ class Users implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if (!isset($table['coll'][$row['usr_id']])) {
|
||||
$table['coll'][$row['usr_id']] = array();
|
||||
$table['coll'][$row['usr_id']] = [];
|
||||
}
|
||||
|
||||
if (!in_array($row['base_id'], $table['coll'][$row['usr_id']])) {
|
||||
@@ -401,17 +401,17 @@ class Users implements ControllerProviderInterface
|
||||
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $app['twig']->render('admin/user/demand.html.twig', array(
|
||||
return $app['twig']->render('admin/user/demand.html.twig', [
|
||||
'table' => $table,
|
||||
'models' => $models,
|
||||
));
|
||||
]);
|
||||
})->bind('users_display_demands');
|
||||
|
||||
$controllers->post('/demands/', function (Application $app, Request $request) {
|
||||
|
||||
$templates = $deny = $accept = $options = array();
|
||||
$templates = $deny = $accept = $options = [];
|
||||
|
||||
foreach ($request->request->get('template', array()) as $tmp) {
|
||||
foreach ($request->request->get('template', []) as $tmp) {
|
||||
if (trim($tmp) != '') {
|
||||
$tmp = explode('_', $tmp);
|
||||
|
||||
@@ -421,29 +421,29 @@ class Users implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($request->request->get('deny', array()) as $den) {
|
||||
foreach ($request->request->get('deny', []) as $den) {
|
||||
$den = explode('_', $den);
|
||||
if (count($den) == 2 && !isset($templates[$den[0]])) {
|
||||
$deny[$den[0]][$den[1]] = $den[1];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($request->request->get('accept', array()) as $acc) {
|
||||
foreach ($request->request->get('accept', []) as $acc) {
|
||||
$acc = explode('_', $acc);
|
||||
if (count($acc) == 2 && !isset($templates[$acc[0]])) {
|
||||
$accept[$acc[0]][$acc[1]] = $acc[1];
|
||||
$options[$acc[0]][$acc[1]] = array('HD' => false, 'WM' => false);
|
||||
$options[$acc[0]][$acc[1]] = ['HD' => false, 'WM' => false];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($request->request->get('accept_hd', array()) as $accHD) {
|
||||
foreach ($request->request->get('accept_hd', []) as $accHD) {
|
||||
$accHD = explode('_', $accHD);
|
||||
if (count($accHD) == 2 && isset($accept[$accHD[0]]) && isset($options[$accHD[0]][$accHD[1]])) {
|
||||
$options[$accHD[0]][$accHD[1]]['HD'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($request->request->get('watermark', array()) as $wm) {
|
||||
foreach ($request->request->get('watermark', []) as $wm) {
|
||||
$wm = explode('_', $wm);
|
||||
if (count($wm) == 2 && isset($accept[$wm[0]]) && isset($options[$wm[0]][$wm[1]])) {
|
||||
$options[$wm[0]][$wm[1]]['WM'] = true;
|
||||
@@ -451,8 +451,8 @@ class Users implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if (count($templates) > 0 || count($deny) > 0 || count($accept) > 0) {
|
||||
$done = array();
|
||||
$cache_to_update = array();
|
||||
$done = [];
|
||||
$cache_to_update = [];
|
||||
|
||||
foreach ($templates as $usr => $template_id) {
|
||||
$user = \User_Adapter::getInstance($usr, $app);
|
||||
@@ -464,7 +464,7 @@ class Users implements ControllerProviderInterface
|
||||
$app['acl']->get($user)->apply_model($user_template, $base_ids);
|
||||
|
||||
if (!isset($done[$usr])) {
|
||||
$done[$usr] = array();
|
||||
$done[$usr] = [];
|
||||
}
|
||||
|
||||
foreach ($base_ids as $base_id) {
|
||||
@@ -477,7 +477,7 @@ class Users implements ControllerProviderInterface
|
||||
AND (base_id = " . implode(' OR base_id = ', $base_ids) . ")";
|
||||
|
||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':usr_id' => $usr));
|
||||
$stmt->execute([':usr_id' => $usr]);
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
|
||||
@@ -491,10 +491,10 @@ class Users implements ControllerProviderInterface
|
||||
foreach ($deny as $usr => $bases) {
|
||||
$cache_to_update[$usr] = true;
|
||||
foreach ($bases as $bas) {
|
||||
$stmt->execute(array(':usr_id' => $usr, ':base_id' => $bas));
|
||||
$stmt->execute([':usr_id' => $usr, ':base_id' => $bas]);
|
||||
|
||||
if (!isset($done[$usr])) {
|
||||
$done[$usr] = array();
|
||||
$done[$usr] = [];
|
||||
}
|
||||
|
||||
$done[$usr][$bas] = false;
|
||||
@@ -508,28 +508,28 @@ class Users implements ControllerProviderInterface
|
||||
$cache_to_update[$usr] = true;
|
||||
|
||||
foreach ($bases as $bas) {
|
||||
$app['acl']->get($user)->give_access_to_sbas(array(\phrasea::sbasFromBas($app, $bas)));
|
||||
$app['acl']->get($user)->give_access_to_sbas([\phrasea::sbasFromBas($app, $bas)]);
|
||||
|
||||
$rights = array(
|
||||
$rights = [
|
||||
'canputinalbum' => '1'
|
||||
, 'candwnldhd' => ($options[$usr][$bas]['HD'] ? '1' : '0')
|
||||
, 'nowatermark' => ($options[$usr][$bas]['WM'] ? '0' : '1')
|
||||
, 'candwnldpreview' => '1'
|
||||
, 'actif' => '1'
|
||||
);
|
||||
];
|
||||
|
||||
$app['acl']->get($user)->give_access_to_base(array($bas));
|
||||
$app['acl']->get($user)->give_access_to_base([$bas]);
|
||||
$app['acl']->get($user)->update_rights_to_base($bas, $rights);
|
||||
|
||||
if (!isset($done[$usr])) {
|
||||
$done[$usr] = array();
|
||||
$done[$usr] = [];
|
||||
}
|
||||
|
||||
$done[$usr][$bas] = true;
|
||||
|
||||
$sql = "DELETE FROM demand WHERE usr_id = :usr_id AND base_id = :base_id";
|
||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':usr_id' => $usr, ':base_id' => $bas));
|
||||
$stmt->execute([':usr_id' => $usr, ':base_id' => $bas]);
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
}
|
||||
@@ -544,7 +544,7 @@ class Users implements ControllerProviderInterface
|
||||
$sql = 'SELECT usr_mail FROM usr WHERE usr_id = :usr_id';
|
||||
|
||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':usr_id' => $usr));
|
||||
$stmt->execute([':usr_id' => $usr]);
|
||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
@@ -579,7 +579,7 @@ class Users implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app->redirectPath('users_display_demands', array('success' => 1));
|
||||
return $app->redirectPath('users_display_demands', ['success' => 1]);
|
||||
})->bind('users_submit_demands');
|
||||
|
||||
$controllers->get('/import/file/', function (Application $app, Request $request) {
|
||||
@@ -588,16 +588,16 @@ class Users implements ControllerProviderInterface
|
||||
|
||||
$controllers->post('/import/file/', function (Application $app, Request $request) {
|
||||
if ((null === $file = $request->files->get('files')) || !$file->isValid()) {
|
||||
return $app->redirectPath('users_display_import_file', array('error' => 'file-invalid'));
|
||||
return $app->redirectPath('users_display_import_file', ['error' => 'file-invalid']);
|
||||
}
|
||||
|
||||
$equivalenceToMysqlField = self::getEquivalenceToMysqlField();
|
||||
$loginDefined = $pwdDefined = $mailDefined = false;
|
||||
$loginNew = array();
|
||||
$out = array(
|
||||
'ignored_row' => array(),
|
||||
'errors' => array()
|
||||
);
|
||||
$loginNew = [];
|
||||
$out = [
|
||||
'ignored_row' => [],
|
||||
'errors' => []
|
||||
];
|
||||
$nbUsrToAdd = 0;
|
||||
|
||||
$lines = \format::csv_to_arr($file->getPathname());
|
||||
@@ -633,15 +633,15 @@ class Users implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if (!$loginDefined) {
|
||||
return $app->redirectPath('users_display_import_file', array('error' => 'row-login'));
|
||||
return $app->redirectPath('users_display_import_file', ['error' => 'row-login']);
|
||||
}
|
||||
|
||||
if (!$pwdDefined) {
|
||||
return $app->redirectPath('users_display_import_file', array('error' => 'row-pwd'));
|
||||
return $app->redirectPath('users_display_import_file', ['error' => 'row-pwd']);
|
||||
}
|
||||
|
||||
if (!$mailDefined) {
|
||||
return $app->redirectPath('users_display_import_file', array('error' => 'row-mail'));
|
||||
return $app->redirectPath('users_display_import_file', ['error' => 'row-mail']);
|
||||
}
|
||||
|
||||
foreach ($lines as $nbLine => $line) {
|
||||
@@ -703,15 +703,15 @@ class Users implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if (count($out['errors']) > 0 && $nbUsrToAdd === 0) {
|
||||
return $app['twig']->render('admin/user/import/file.html.twig', array(
|
||||
return $app['twig']->render('admin/user/import/file.html.twig', [
|
||||
'errors' => $out['errors']
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
if ($nbUsrToAdd === 0) {
|
||||
return $app->redirectPath('users_display_import_file', array(
|
||||
return $app->redirectPath('users_display_import_file', [
|
||||
'error' => 'no-user'
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
$sql = "
|
||||
@@ -720,22 +720,22 @@ class Users implements ControllerProviderInterface
|
||||
INNER JOIN basusr
|
||||
ON (basusr.usr_id=usr.usr_id)
|
||||
WHERE usr.model_of = :usr_id
|
||||
AND base_id in(" . implode(', ', array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(array('manage')))) . ")
|
||||
AND base_id in(" . implode(', ', array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(['manage']))) . ")
|
||||
AND usr_login not like '(#deleted_%)'
|
||||
GROUP BY usr_id";
|
||||
|
||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':usr_id' => $app['authentication']->getUser()->get_id()));
|
||||
$stmt->execute([':usr_id' => $app['authentication']->getUser()->get_id()]);
|
||||
$models = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $app['twig']->render('/admin/user/import/view.html.twig', array(
|
||||
return $app['twig']->render('/admin/user/import/view.html.twig', [
|
||||
'nb_user_to_add' => $nbUsrToAdd,
|
||||
'models' => $models,
|
||||
'lines_serialized' => serialize($lines),
|
||||
'columns_serialized' => serialize($columns),
|
||||
'errors' => $out['errors']
|
||||
));
|
||||
]);
|
||||
})->bind('users_submit_import_file');
|
||||
|
||||
$controllers->post('/import/', function (Application $app, Request $request) {
|
||||
@@ -759,7 +759,7 @@ class Users implements ControllerProviderInterface
|
||||
$equivalenceToMysqlField = Users::getEquivalenceToMysqlField();
|
||||
|
||||
foreach ($lines as $nbLine => $line) {
|
||||
$curUser = array();
|
||||
$curUser = [];
|
||||
foreach ($columns as $nbCol => $colName) {
|
||||
if (!isset($equivalenceToMysqlField[$colName]) || !isset($line[$nbCol])) {
|
||||
continue;
|
||||
@@ -859,7 +859,7 @@ class Users implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
$app['acl']->get($NewUser)->apply_model(
|
||||
\User_Adapter::getInstance($model, $app), array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(array('manage')))
|
||||
\User_Adapter::getInstance($model, $app), array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(['manage']))
|
||||
);
|
||||
|
||||
$nbCreation++;
|
||||
@@ -867,7 +867,7 @@ class Users implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_users_search', array('user-updated' => $nbCreation));
|
||||
return $app->redirectPath('admin_users_search', ['user-updated' => $nbCreation]);
|
||||
})->bind('users_submit_import');
|
||||
|
||||
$controllers->get('/import/example/csv/', function (Application $app) {
|
||||
@@ -913,7 +913,7 @@ class Users implements ControllerProviderInterface
|
||||
|
||||
public static function getEquivalenceToMysqlField()
|
||||
{
|
||||
$equivalenceToMysqlField = array();
|
||||
$equivalenceToMysqlField = [];
|
||||
|
||||
$equivalenceToMysqlField['civilite'] = 'usr_sexe';
|
||||
$equivalenceToMysqlField['gender'] = 'usr_sexe';
|
||||
|
@@ -86,15 +86,15 @@ class Oauth2 implements ControllerProviderInterface
|
||||
return $app->redirectPath('oauth2_authorize');
|
||||
}
|
||||
} catch (RequireCaptchaException $e) {
|
||||
return $app->redirectPath('oauth2_authorize', array('error' => 'captcha'));
|
||||
return $app->redirectPath('oauth2_authorize', ['error' => 'captcha']);
|
||||
} catch (AccountLockedException $e) {
|
||||
return $app->redirectPath('oauth2_authorize', array('error' => 'account-locked'));
|
||||
return $app->redirectPath('oauth2_authorize', ['error' => 'account-locked']);
|
||||
}
|
||||
|
||||
$app['authentication']->openAccount(\User_Adapter::getInstance($usr_id, $app));
|
||||
}
|
||||
|
||||
return new Response($app['twig']->render($template, array("auth" => $oauth2_adapter)));
|
||||
return new Response($app['twig']->render($template, ["auth" => $oauth2_adapter]));
|
||||
}
|
||||
|
||||
//check if current client is already authorized by current user
|
||||
@@ -114,10 +114,10 @@ class Oauth2 implements ControllerProviderInterface
|
||||
$params['account_id'] = $account->get_id();
|
||||
|
||||
if (!$app_authorized && $action_accept === null) {
|
||||
$params = array(
|
||||
$params = [
|
||||
"auth" => $oauth2_adapter,
|
||||
"errorMessage" => $errorMessage,
|
||||
);
|
||||
];
|
||||
|
||||
return new Response($app['twig']->render($template, $params));
|
||||
} elseif (!$app_authorized && $action_accept !== null) {
|
||||
@@ -149,7 +149,7 @@ class Oauth2 implements ControllerProviderInterface
|
||||
*/
|
||||
$controllers->post('/token', function (\Silex\Application $app, Request $request) {
|
||||
if ( ! $request->isSecure()) {
|
||||
throw new HttpException(400, 'This route requires the use of the https scheme', null, array('content-type' => 'application/json'));
|
||||
throw new HttpException(400, 'This route requires the use of the https scheme', null, ['content-type' => 'application/json']);
|
||||
}
|
||||
|
||||
$app['oauth']->grantAccessToken($request);
|
||||
|
@@ -142,7 +142,7 @@ class V1 implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return array('ressource' => $ressource, 'general' => $general, 'aspect' => $aspect, 'action' => $action);
|
||||
return ['ressource' => $ressource, 'general' => $general, 'aspect' => $aspect, 'action' => $action];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -227,7 +227,7 @@ class V1 implements ControllerProviderInterface
|
||||
$controllers->get('/monitor/task/{task}/', function (SilexApplication $app, Request $request, $task) {
|
||||
return $app['api']->get_task($app, $task)->get_response();
|
||||
})
|
||||
->convert('task', array($app['converter.task'], 'convert'))
|
||||
->convert('task', [$app['converter.task'], 'convert'])
|
||||
->before($mustBeAdmin)->assert('task', '\d+');
|
||||
|
||||
/**
|
||||
@@ -244,7 +244,7 @@ class V1 implements ControllerProviderInterface
|
||||
$controllers->post('/monitor/task/{task}/', function (SilexApplication $app, Request $request, $task) {
|
||||
return $app['api']->set_task_property($app, $task)->get_response();
|
||||
})
|
||||
->convert('task', array($app['converter.task'], 'convert'))
|
||||
->convert('task', [$app['converter.task'], 'convert'])
|
||||
->before($mustBeAdmin)->assert('task', '\d+');
|
||||
|
||||
/**
|
||||
@@ -260,7 +260,7 @@ class V1 implements ControllerProviderInterface
|
||||
$controllers->post('/monitor/task/{task}/start/', function (SilexApplication $app, Request $request, $task) {
|
||||
return $app['api']->start_task($app, $task)->get_response();
|
||||
})
|
||||
->convert('task', array($app['converter.task'], 'convert'))
|
||||
->convert('task', [$app['converter.task'], 'convert'])
|
||||
->before($mustBeAdmin);
|
||||
|
||||
/**
|
||||
@@ -276,7 +276,7 @@ class V1 implements ControllerProviderInterface
|
||||
$controllers->post('/monitor/task/{task}/stop/', function (SilexApplication $app, Request $request, $task) {
|
||||
return $app['api']->stop_task($app, $task)->get_response();
|
||||
})
|
||||
->convert('task', array($app['converter.task'], 'convert'))
|
||||
->convert('task', [$app['converter.task'], 'convert'])
|
||||
->before($mustBeAdmin);
|
||||
|
||||
/**
|
||||
|
@@ -71,9 +71,9 @@ class Baskets implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
return $app->redirectPath('get_client_baskets', array(
|
||||
return $app->redirectPath('get_client_baskets', [
|
||||
'courChuId' => $request->request->get('courChuId', '')
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,9 +122,9 @@ class Baskets implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
return $app->redirectPath('get_client_baskets', array(
|
||||
return $app->redirectPath('get_client_baskets', [
|
||||
'courChuId' => null !== $basket ? $basket->getId() : ''
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,9 +154,9 @@ class Baskets implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
return $app->redirectPath('get_client_baskets', array(
|
||||
return $app->redirectPath('get_client_baskets', [
|
||||
'courChuId' => $basket ? $basket->getId() : ''
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,13 +185,13 @@ class Baskets implements ControllerProviderInterface
|
||||
return (Boolean) $basket->getPusherId();
|
||||
});
|
||||
|
||||
return $app['twig']->render('client/baskets.html.twig', array(
|
||||
return $app['twig']->render('client/baskets.html.twig', [
|
||||
'total_baskets' => $baskets->count(),
|
||||
'user_baskets' => $basketCollections[1],
|
||||
'recept_user_basket' => $basketCollections[0],
|
||||
'selected_basket' => $selectedBasket,
|
||||
'selected_basket_elements' => $selectedBasket ? $selectedBasket->getElements() : new ArrayCollection()
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -215,10 +215,10 @@ class Baskets implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => true,
|
||||
'message' => '',
|
||||
'no_view' => $noview
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ class Root implements ControllerProviderInterface
|
||||
|
||||
$controllers->before(function (Request $request) use ($app) {
|
||||
if (!$app['authentication']->isAuthenticated() && null !== $request->query->get('nolog')) {
|
||||
return $app->redirectPath('login_authenticate_as_guest', array('redirect' => 'client'));
|
||||
return $app->redirectPath('login_authenticate_as_guest', ['redirect' => 'client']);
|
||||
}
|
||||
$app['firewall']->requireAuthentication();
|
||||
});
|
||||
@@ -116,17 +116,17 @@ class Root implements ControllerProviderInterface
|
||||
return new Response($app['twig']->render("client/help.html.twig"));
|
||||
}
|
||||
|
||||
$resultData = array();
|
||||
$resultData = [];
|
||||
|
||||
foreach ($searchData as $record) {
|
||||
try {
|
||||
$record->get_subdef('document');
|
||||
$lightInfo = $app['twig']->render('common/technical_datas.html.twig', array('record' => $record));
|
||||
$lightInfo = $app['twig']->render('common/technical_datas.html.twig', ['record' => $record]);
|
||||
} catch (\Exception $e) {
|
||||
$lightInfo = '';
|
||||
}
|
||||
|
||||
$caption = $app['twig']->render('common/caption.html.twig', array('view' => 'answer', 'record' => $record));
|
||||
$caption = $app['twig']->render('common/caption.html.twig', ['view' => 'answer', 'record' => $record]);
|
||||
|
||||
$docType = $record->get_type();
|
||||
$isVideo = ($docType == 'video');
|
||||
@@ -148,7 +148,7 @@ class Root implements ControllerProviderInterface
|
||||
$previewExists = false;
|
||||
}
|
||||
|
||||
$resultData[] = array(
|
||||
$resultData[] = [
|
||||
'record' => $record,
|
||||
'mini_logo' => \collection::getLogo($record->get_base_id(), $app),
|
||||
'preview_exists' => $previewExists,
|
||||
@@ -160,10 +160,10 @@ class Root implements ControllerProviderInterface
|
||||
'is_document' => $isDocument,
|
||||
'can_download' => $canDownload,
|
||||
'can_add_to_basket' => $app['acl']->get($app['authentication']->getUser())->has_right_on_base($record->get_base_id(), 'canputinalbum')
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return new Response($app['twig']->render("client/answers.html.twig", array(
|
||||
return new Response($app['twig']->render("client/answers.html.twig", [
|
||||
'mod_col' => $modCol,
|
||||
'mod_row' => $modRow,
|
||||
'result_data' => $resultData,
|
||||
@@ -174,7 +174,7 @@ class Root implements ControllerProviderInterface
|
||||
'result' => $result,
|
||||
'proposals' => $currentPage === 1 ? $result->getProposals() : null,
|
||||
'help' => count($resultData) === 0 ? $this->getHelpStartPage($app) : '',
|
||||
)));
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,7 +210,7 @@ class Root implements ControllerProviderInterface
|
||||
*/
|
||||
public function getClientLanguage(Application $app, Request $request)
|
||||
{
|
||||
$out = array();
|
||||
$out = [];
|
||||
$out['createWinInvite'] = _('paniers:: Quel nom souhaitez vous donner a votre panier ?');
|
||||
$out['chuNameEmpty'] = _('paniers:: Quel nom souhaitez vous donner a votre panier ?');
|
||||
$out['noDLok'] = _('export:: aucun document n\'est disponible au telechargement');
|
||||
@@ -251,7 +251,7 @@ class Root implements ControllerProviderInterface
|
||||
$renderTopics = \queries::tree_topics($app['locale.I18n']);
|
||||
}
|
||||
|
||||
return new Response($app['twig']->render('client/index.html.twig', array(
|
||||
return new Response($app['twig']->render('client/index.html.twig', [
|
||||
'last_action' => !$app['authentication']->getUser()->is_guest() && false !== $request->cookies->has('last_act') ? $request->cookies->has('last_act') : null,
|
||||
'phrasea_home' => $this->getDefaultClientStartPage($app),
|
||||
'render_topics' => $renderTopics,
|
||||
@@ -260,13 +260,13 @@ class Root implements ControllerProviderInterface
|
||||
'storage_access' => $this->getDocumentStorageAccess($app),
|
||||
'tabs_setup' => $this->getTabSetup($app),
|
||||
'module' => 'client',
|
||||
'menubar' => $app['twig']->render('common/menubar.html.twig', array('module' => 'client')),
|
||||
'menubar' => $app['twig']->render('common/menubar.html.twig', ['module' => 'client']),
|
||||
'css_file' => $this->getCssFile($app),
|
||||
'basket_status' => null !== $app['authentication']->getUser()->getPrefs('client_basket_status') ? $app['authentication']->getUser()->getPrefs('client_basket_status') : "1",
|
||||
'mod_pres' => null !== $app['authentication']->getUser()->getPrefs('client_view') ? $app['authentication']->getUser()->getPrefs('client_view') : '',
|
||||
'start_page' => $app['authentication']->getUser()->getPrefs('start_page'),
|
||||
'start_page_query' => null !== $app['authentication']->getUser()->getPrefs('start_page_query') ? $app['authentication']->getUser()->getPrefs('start_page_query') : ''
|
||||
)));
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,15 +276,15 @@ class Root implements ControllerProviderInterface
|
||||
*/
|
||||
private function getGridProperty()
|
||||
{
|
||||
return array(
|
||||
array('w' => '3', 'h' => '2', 'name' => '3*2', 'selected' => '0'),
|
||||
array('w' => '5', 'h' => '4', 'name' => '5*4', 'selected' => '0'),
|
||||
array('w' => '4', 'h' => '10', 'name' => '4*10', 'selected' => '0'),
|
||||
array('w' => '6', 'h' => '3', 'name' => '6*3', 'selected' => '1'),
|
||||
array('w' => '8', 'h' => '4', 'name' => '8*4', 'selected' => '0'),
|
||||
array('w' => '1', 'h' => '10', 'name' => 'list*10', 'selected' => '0'),
|
||||
array('w' => '1', 'h' => '100', 'name' => 'list*100', 'selected' => '0')
|
||||
);
|
||||
return [
|
||||
['w' => '3', 'h' => '2', 'name' => '3*2', 'selected' => '0'],
|
||||
['w' => '5', 'h' => '4', 'name' => '5*4', 'selected' => '0'],
|
||||
['w' => '4', 'h' => '10', 'name' => '4*10', 'selected' => '0'],
|
||||
['w' => '6', 'h' => '3', 'name' => '6*3', 'selected' => '1'],
|
||||
['w' => '8', 'h' => '4', 'name' => '8*4', 'selected' => '0'],
|
||||
['w' => '1', 'h' => '10', 'name' => 'list*10', 'selected' => '0'],
|
||||
['w' => '1', 'h' => '100', 'name' => 'list*100', 'selected' => '0']
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -295,22 +295,22 @@ class Root implements ControllerProviderInterface
|
||||
*/
|
||||
private function getDocumentStorageAccess(Application $app)
|
||||
{
|
||||
$allDataboxes = $allCollections = array();
|
||||
$allDataboxes = $allCollections = [];
|
||||
|
||||
foreach ($app['acl']->get($app['authentication']->getUser())->get_granted_sbas() as $databox) {
|
||||
if (count($app['phraseanet.appbox']->get_databoxes()) > 0) {
|
||||
$allDataboxes[$databox->get_sbas_id()] = array('databox' => $databox, 'collections' => array());
|
||||
$allDataboxes[$databox->get_sbas_id()] = ['databox' => $databox, 'collections' => []];
|
||||
}
|
||||
|
||||
if (count($databox->get_collections()) > 0) {
|
||||
foreach ($app['acl']->get($app['authentication']->getUser())->get_granted_base(array(), array($databox->get_sbas_id())) as $coll) {
|
||||
foreach ($app['acl']->get($app['authentication']->getUser())->get_granted_base([], [$databox->get_sbas_id()]) as $coll) {
|
||||
$allDataboxes[$databox->get_sbas_id()]['collections'][$coll->get_base_id()] = $coll;
|
||||
$allCollections[$coll->get_base_id()] = $coll;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array('databoxes' => $allDataboxes, 'collections' => $allCollections);
|
||||
return ['databoxes' => $allDataboxes, 'collections' => $allCollections];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,16 +321,16 @@ class Root implements ControllerProviderInterface
|
||||
*/
|
||||
private function getTabSetup(Application $app)
|
||||
{
|
||||
$tong = array(
|
||||
$tong = [
|
||||
$app['phraseanet.registry']->get('GV_ong_search') => 1,
|
||||
$app['phraseanet.registry']->get('GV_ong_advsearch') => 2,
|
||||
$app['phraseanet.registry']->get('GV_ong_topics') => 3
|
||||
);
|
||||
];
|
||||
|
||||
unset($tong[0]);
|
||||
|
||||
if (count($tong) == 0) {
|
||||
$tong = array(1 => 1);
|
||||
$tong = [1 => 1];
|
||||
}
|
||||
|
||||
ksort($tong);
|
||||
@@ -348,7 +348,7 @@ class Root implements ControllerProviderInterface
|
||||
{
|
||||
$cssPath = __DIR__ . '/../../../../../www/skins/client/';
|
||||
|
||||
$css = array();
|
||||
$css = [];
|
||||
$cssFile = $app['authentication']->getUser()->getPrefs('client_css');
|
||||
|
||||
$finder = new Finder();
|
||||
@@ -387,8 +387,8 @@ class Root implements ControllerProviderInterface
|
||||
$query .= $clientQuery;
|
||||
}
|
||||
|
||||
$opAdv = $request->request->get('opAdv', array());
|
||||
$queryAdv = $request->request->get('qryAdv', array());
|
||||
$opAdv = $request->request->get('opAdv', []);
|
||||
$queryAdv = $request->request->get('qryAdv', []);
|
||||
|
||||
if (count($opAdv) > 0 && count($opAdv) == count($queryAdv)) {
|
||||
foreach ($opAdv as $opId => $op) {
|
||||
@@ -423,7 +423,7 @@ class Root implements ControllerProviderInterface
|
||||
return $this->getPublicationStartPage($app);
|
||||
}
|
||||
|
||||
if (in_array($startPage, array('QUERY', 'LAST_QUERY'))) {
|
||||
if (in_array($startPage, ['QUERY', 'LAST_QUERY'])) {
|
||||
return $this->getQueryStartPage($app);
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ class Root implements ControllerProviderInterface
|
||||
*/
|
||||
private function getQueryStartPage(Application $app)
|
||||
{
|
||||
$collections = $queryParameters = array();
|
||||
$collections = $queryParameters = [];
|
||||
|
||||
$searchSet = json_decode($app['authentication']->getUser()->getPrefs('search'));
|
||||
|
||||
@@ -456,11 +456,11 @@ class Root implements ControllerProviderInterface
|
||||
$queryParameters["pag"] = 0;
|
||||
$queryParameters["search_type"] = SearchEngineOptions::RECORD_RECORD;
|
||||
$queryParameters["qryAdv"] = '';
|
||||
$queryParameters["opAdv"] = array();
|
||||
$queryParameters["status"] = array();
|
||||
$queryParameters["opAdv"] = [];
|
||||
$queryParameters["status"] = [];
|
||||
$queryParameters["recordtype"] = SearchEngineOptions::TYPE_ALL;
|
||||
$queryParameters["sort"] = $app['phraseanet.registry']->get('GV_phrasea_sort', '');
|
||||
$queryParameters["infield"] = array();
|
||||
$queryParameters["infield"] = [];
|
||||
$queryParameters["ord"] = SearchEngineOptions::SORT_MODE_DESC;
|
||||
|
||||
$subRequest = Request::create('/client/query/', 'POST', $queryParameters);
|
||||
@@ -476,10 +476,10 @@ class Root implements ControllerProviderInterface
|
||||
*/
|
||||
private function getPublicationStartPage(Application $app)
|
||||
{
|
||||
return $app['twig']->render('client/home_inter_pub_basket.html.twig', array(
|
||||
return $app['twig']->render('client/home_inter_pub_basket.html.twig', [
|
||||
'feeds' => Aggregate::createFromUser($app, $app['authentication']->getUser()),
|
||||
'image_size' => (int) $app['authentication']->getUser()->getPrefs('images_size')
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -53,11 +53,11 @@ class Lightbox implements ControllerProviderInterface
|
||||
}
|
||||
switch ($datas['type']) {
|
||||
case \random::TYPE_FEED_ENTRY:
|
||||
return $app->redirectPath('lightbox_feed_entry', array('entry_id' => $datas['datas']));
|
||||
return $app->redirectPath('lightbox_feed_entry', ['entry_id' => $datas['datas']]);
|
||||
break;
|
||||
case \random::TYPE_VALIDATE:
|
||||
case \random::TYPE_VIEW:
|
||||
return $app->redirectPath('lightbox_validation', array('basket' => $datas['datas']));
|
||||
return $app->redirectPath('lightbox_validation', ['basket' => $datas['datas']]);
|
||||
break;
|
||||
}
|
||||
});
|
||||
@@ -88,11 +88,11 @@ class Lightbox implements ControllerProviderInterface
|
||||
$template = 'lightbox/IE6/index.html.twig';
|
||||
}
|
||||
|
||||
return new Response($app['twig']->render($template, array(
|
||||
return new Response($app['twig']->render($template, [
|
||||
'baskets_collection' => $basket_collection,
|
||||
'module_name' => 'Lightbox',
|
||||
'module' => 'lightbox'
|
||||
)
|
||||
]
|
||||
));
|
||||
})
|
||||
->bind('lightbox');
|
||||
@@ -107,10 +107,10 @@ class Lightbox implements ControllerProviderInterface
|
||||
->getRepository('Alchemy\Phrasea\Model\Entities\BasketElement')
|
||||
->findUserElement($sselcont_id, $app['authentication']->getUser());
|
||||
|
||||
$parameters = array(
|
||||
$parameters = [
|
||||
'basket_element' => $basketElement,
|
||||
'module_name' => '',
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('lightbox/note_form.html.twig', $parameters);
|
||||
})
|
||||
@@ -123,10 +123,10 @@ class Lightbox implements ControllerProviderInterface
|
||||
$BasketElement = $repository->findUserElement($sselcont_id, $app['authentication']->getUser());
|
||||
|
||||
if ($app['browser']->isMobile()) {
|
||||
$output = $app['twig']->render('lightbox/basket_element.html.twig', array(
|
||||
$output = $app['twig']->render('lightbox/basket_element.html.twig', [
|
||||
'basket_element' => $BasketElement,
|
||||
'module_name' => $BasketElement->getRecord($app)->get_title()
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
return new Response($output);
|
||||
@@ -145,16 +145,16 @@ class Lightbox implements ControllerProviderInterface
|
||||
|
||||
$Basket = $BasketElement->getBasket();
|
||||
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
$ret['number'] = $BasketElement->getRecord($app)->get_number();
|
||||
$ret['title'] = $BasketElement->getRecord($app)->get_title();
|
||||
|
||||
$ret['preview'] = $app['twig']->render($template_preview, array('record' => $BasketElement->getRecord($app), 'not_wrapped' => true));
|
||||
$ret['options_html'] = $app['twig']->render($template_options, array('basket_element' => $BasketElement));
|
||||
$ret['agreement_html'] = $app['twig']->render($template_agreement, array('basket' => $Basket, 'basket_element' => $BasketElement));
|
||||
$ret['selector_html'] = $app['twig']->render($template_selector, array('basket_element' => $BasketElement));
|
||||
$ret['note_html'] = $app['twig']->render($template_note, array('basket_element' => $BasketElement));
|
||||
$ret['caption'] = $app['twig']->render($template_caption, array('view' => 'preview', 'record' => $BasketElement->getRecord($app)));
|
||||
$ret['preview'] = $app['twig']->render($template_preview, ['record' => $BasketElement->getRecord($app), 'not_wrapped' => true]);
|
||||
$ret['options_html'] = $app['twig']->render($template_options, ['basket_element' => $BasketElement]);
|
||||
$ret['agreement_html'] = $app['twig']->render($template_agreement, ['basket' => $Basket, 'basket_element' => $BasketElement]);
|
||||
$ret['selector_html'] = $app['twig']->render($template_selector, ['basket_element' => $BasketElement]);
|
||||
$ret['note_html'] = $app['twig']->render($template_note, ['basket_element' => $BasketElement]);
|
||||
$ret['caption'] = $app['twig']->render($template_caption, ['view' => 'preview', 'record' => $BasketElement->getRecord($app)]);
|
||||
|
||||
return $app->json($ret);
|
||||
}
|
||||
@@ -168,10 +168,10 @@ class Lightbox implements ControllerProviderInterface
|
||||
$item = $entry->getItem($item_id);
|
||||
|
||||
if ($app['browser']->isMobile()) {
|
||||
$output = $app['twig']->render('lightbox/feed_element.html.twig', array(
|
||||
$output = $app['twig']->render('lightbox/feed_element.html.twig', [
|
||||
'feed_element' => $item,
|
||||
'module_name' => $item->getRecord($app)->get_title()
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
return new Response($output);
|
||||
@@ -184,13 +184,13 @@ class Lightbox implements ControllerProviderInterface
|
||||
$template_options = 'lightbox/IE6/feed_options_box.html.twig';
|
||||
}
|
||||
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
$ret['number'] = $item->getRecord($app)->get_number();
|
||||
$ret['title'] = $item->getRecord($app)->get_title();
|
||||
|
||||
$ret['preview'] = $app['twig']->render($template_preview, array('record' => $item->getRecord($app), 'not_wrapped' => true));
|
||||
$ret['options_html'] = $app['twig']->render($template_options, array('feed_element' => $item));
|
||||
$ret['caption'] = $app['twig']->render($template_caption, array('view' => 'preview', 'record' => $item->getRecord($app)));
|
||||
$ret['preview'] = $app['twig']->render($template_preview, ['record' => $item->getRecord($app), 'not_wrapped' => true]);
|
||||
$ret['options_html'] = $app['twig']->render($template_options, ['feed_element' => $item]);
|
||||
$ret['caption'] = $app['twig']->render($template_caption, ['view' => 'preview', 'record' => $item->getRecord($app)]);
|
||||
|
||||
$ret['agreement_html'] = $ret['selector_html'] = $ret['note_html'] = '';
|
||||
|
||||
@@ -233,13 +233,13 @@ class Lightbox implements ControllerProviderInterface
|
||||
$template = 'lightbox/IE6/validate.html.twig';
|
||||
}
|
||||
|
||||
$response = new Response($app['twig']->render($template, array(
|
||||
$response = new Response($app['twig']->render($template, [
|
||||
'baskets_collection' => $basket_collection,
|
||||
'basket' => $basket,
|
||||
'local_title' => strip_tags($basket->getName()),
|
||||
'module' => 'lightbox',
|
||||
'module_name' => _('admin::monitor: module validation')
|
||||
)
|
||||
]
|
||||
));
|
||||
$response->setCharset('UTF-8');
|
||||
|
||||
@@ -280,13 +280,13 @@ class Lightbox implements ControllerProviderInterface
|
||||
$template = 'lightbox/IE6/validate.html.twig';
|
||||
}
|
||||
|
||||
$response = new Response($app['twig']->render($template, array(
|
||||
$response = new Response($app['twig']->render($template, [
|
||||
'baskets_collection' => $basket_collection,
|
||||
'basket' => $basket,
|
||||
'local_title' => strip_tags($basket->getName()),
|
||||
'module' => 'lightbox',
|
||||
'module_name' => _('admin::monitor: module validation')
|
||||
)
|
||||
]
|
||||
));
|
||||
$response->setCharset('UTF-8');
|
||||
|
||||
@@ -314,13 +314,13 @@ class Lightbox implements ControllerProviderInterface
|
||||
$content = $feed_entry->getItems();
|
||||
$first = $content->first();
|
||||
|
||||
$output = $app['twig']->render($template, array(
|
||||
$output = $app['twig']->render($template, [
|
||||
'feed_entry' => $feed_entry,
|
||||
'first_item' => $first,
|
||||
'local_title' => $feed_entry->getTitle(),
|
||||
'module' => 'lightbox',
|
||||
'module_name' => _('admin::monitor: module validation')
|
||||
)
|
||||
]
|
||||
);
|
||||
$response = new Response($output, 200);
|
||||
$response->setCharset('UTF-8');
|
||||
@@ -331,13 +331,13 @@ class Lightbox implements ControllerProviderInterface
|
||||
->assert('entry_id', '\d+');
|
||||
|
||||
$controllers->get('/ajax/LOAD_REPORT/{basket}/', function (SilexApplication $app, Basket $basket) {
|
||||
return new Response($app['twig']->render('lightbox/basket_content_report.html.twig', array('basket' => $basket)));
|
||||
return new Response($app['twig']->render('lightbox/basket_content_report.html.twig', ['basket' => $basket]));
|
||||
})
|
||||
->bind('lightbox_ajax_report')
|
||||
->assert('basket', '\d+');
|
||||
|
||||
$controllers->post('/ajax/SET_NOTE/{sselcont_id}/', function (SilexApplication $app, $sselcont_id) {
|
||||
$output = array('error' => true, 'datas' => _('Erreur lors de l\'enregistrement des donnees'));
|
||||
$output = ['error' => true, 'datas' => _('Erreur lors de l\'enregistrement des donnees')];
|
||||
|
||||
$request = $app['request'];
|
||||
$note = $request->request->get('note');
|
||||
@@ -359,15 +359,15 @@ class Lightbox implements ControllerProviderInterface
|
||||
$app['EM']->flush();
|
||||
|
||||
if ($app['browser']->isMobile()) {
|
||||
$datas = $app['twig']->render('lightbox/sc_note.html.twig', array('basket_element' => $basket_element));
|
||||
$datas = $app['twig']->render('lightbox/sc_note.html.twig', ['basket_element' => $basket_element]);
|
||||
|
||||
$output = array('error' => false, 'datas' => $datas);
|
||||
$output = ['error' => false, 'datas' => $datas];
|
||||
} else {
|
||||
$template = 'lightbox/sc_note.html.twig';
|
||||
|
||||
$datas = $app['twig']->render($template, array('basket_element' => $basket_element));
|
||||
$datas = $app['twig']->render($template, ['basket_element' => $basket_element]);
|
||||
|
||||
$output = array('error' => false, 'datas' => $datas);
|
||||
$output = ['error' => false, 'datas' => $datas];
|
||||
}
|
||||
|
||||
return $app->json($output);
|
||||
@@ -387,11 +387,11 @@ class Lightbox implements ControllerProviderInterface
|
||||
|
||||
$releasable = false;
|
||||
try {
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'error' => true,
|
||||
'releasable' => false,
|
||||
'datas' => _('Erreur lors de la mise a jour des donnes ')
|
||||
);
|
||||
];
|
||||
|
||||
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\BasketElement');
|
||||
|
||||
@@ -423,11 +423,11 @@ class Lightbox implements ControllerProviderInterface
|
||||
$releasable = _('Do you want to send your report ?');
|
||||
}
|
||||
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'error' => false
|
||||
, 'datas' => ''
|
||||
, 'releasable' => $releasable
|
||||
);
|
||||
];
|
||||
} catch (ControllerException $e) {
|
||||
$ret['datas'] = $e->getMessage();
|
||||
}
|
||||
@@ -439,7 +439,7 @@ class Lightbox implements ControllerProviderInterface
|
||||
|
||||
$controllers->post('/ajax/SET_RELEASE/{basket}/', function (SilexApplication $app, Basket $basket) {
|
||||
|
||||
$datas = array('error' => true, 'datas' => '');
|
||||
$datas = ['error' => true, 'datas' => ''];
|
||||
|
||||
try {
|
||||
if (!$basket->getValidation()) {
|
||||
@@ -466,20 +466,20 @@ class Lightbox implements ControllerProviderInterface
|
||||
$participant = $basket->getValidation()->getParticipant($app['authentication']->getUser(), $app);
|
||||
|
||||
$expires = new \DateTime('+10 days');
|
||||
$url = $app->url('lightbox', array('LOG' => $app['tokens']->getUrlToken(
|
||||
$url = $app->url('lightbox', ['LOG' => $app['tokens']->getUrlToken(
|
||||
\random::TYPE_VALIDATE
|
||||
, $basket->getValidation()->getInitiator($app)->get_id()
|
||||
, $expires
|
||||
, $basket->getId()
|
||||
)));
|
||||
)]);
|
||||
|
||||
$to = $basket->getValidation()->getInitiator($app)->get_id();
|
||||
$params = array(
|
||||
$params = [
|
||||
'ssel_id' => $basket->getId(),
|
||||
'from' => $app['authentication']->getUser()->get_id(),
|
||||
'url' => $url,
|
||||
'to' => $to
|
||||
);
|
||||
];
|
||||
|
||||
$app['events-manager']->trigger('__VALIDATION_DONE__', $params);
|
||||
|
||||
@@ -488,9 +488,9 @@ class Lightbox implements ControllerProviderInterface
|
||||
$app['EM']->merge($participant);
|
||||
$app['EM']->flush();
|
||||
|
||||
$datas = array('error' => false, 'datas' => _('Envoie avec succes'));
|
||||
$datas = ['error' => false, 'datas' => _('Envoie avec succes')];
|
||||
} catch (ControllerException $e) {
|
||||
$datas = array('error' => true, 'datas' => $e->getMessage());
|
||||
$datas = ['error' => true, 'datas' => $e->getMessage()];
|
||||
}
|
||||
|
||||
return $app->json($datas);
|
||||
|
@@ -80,7 +80,7 @@ class Minifier implements ControllerProviderInterface
|
||||
* array('//static' => 'D:\\staticStorage') // Windows
|
||||
* </code>
|
||||
*/
|
||||
$min_symlinks = array();
|
||||
$min_symlinks = [];
|
||||
|
||||
/**
|
||||
* If you upload files from Windows to a non-Windows server, Windows may report
|
||||
|
@@ -33,7 +33,7 @@ class Permalink extends AbstractDelivery
|
||||
$that = $this;
|
||||
|
||||
$retrieveRecord = function ($app, $databox, $token, $record_id, $subdef) {
|
||||
if (in_array($subdef, array(\databox_subdef::CLASS_PREVIEW, \databox_subdef::CLASS_THUMBNAIL)) && $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\FeedItem')->isRecordInPublicFeed($app, $databox->get_sbas_id(), $record_id)) {
|
||||
if (in_array($subdef, [\databox_subdef::CLASS_PREVIEW, \databox_subdef::CLASS_THUMBNAIL]) && $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\FeedItem')->isRecordInPublicFeed($app, $databox->get_sbas_id(), $record_id)) {
|
||||
$record = $databox->get_record($record_id);
|
||||
} else {
|
||||
$record = \media_Permalink_Adapter::challenge_token($app, $databox, $token, $record_id, $subdef);
|
||||
@@ -51,13 +51,13 @@ class Permalink extends AbstractDelivery
|
||||
|
||||
$record = $retrieveRecord($app, $databox, $token, $record_id, $subdef);
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'subdef_name' => $subdef
|
||||
, 'module_name' => 'overview'
|
||||
, 'module' => 'overview'
|
||||
, 'view' => 'overview'
|
||||
, 'record' => $record
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('overview.html.twig', $params);
|
||||
};
|
||||
@@ -86,7 +86,7 @@ class Permalink extends AbstractDelivery
|
||||
}
|
||||
$response = $that->deliverContent($app['request'], $record, $subdef, $watermark, $stamp, $app);
|
||||
|
||||
$linkToCaption = $app->url("permalinks_caption", array('sbas_id' => $sbas_id, 'record_id' => $record_id, 'token' => $token));
|
||||
$linkToCaption = $app->url("permalinks_caption", ['sbas_id' => $sbas_id, 'record_id' => $record_id, 'token' => $token]);
|
||||
$response->headers->set('Link', $linkToCaption);
|
||||
|
||||
return $response;
|
||||
@@ -108,7 +108,7 @@ class Permalink extends AbstractDelivery
|
||||
|
||||
$response = $that->deliverContent($app['request'], $record, $subdef, $watermark, $stamp, $app);
|
||||
|
||||
$linkToCaption = $app->url("permalinks_caption", array('sbas_id' => $sbas_id, 'record_id' => $record_id, 'token' => $token));
|
||||
$linkToCaption = $app->url("permalinks_caption", ['sbas_id' => $sbas_id, 'record_id' => $record_id, 'token' => $token]);
|
||||
$response->headers->set('Link', $linkToCaption);
|
||||
|
||||
return $response;
|
||||
@@ -121,7 +121,7 @@ class Permalink extends AbstractDelivery
|
||||
$record = $retrieveRecord($app, $databox, $token, $record_id, \databox_subdef::CLASS_THUMBNAIL);
|
||||
$caption = $record->get_caption();
|
||||
|
||||
return new Response($caption->serialize(\caption_record::SERIALIZE_JSON), 200, array("Content-Type" => 'application/json'));
|
||||
return new Response($caption->serialize(\caption_record::SERIALIZE_JSON), 200, ["Content-Type" => 'application/json']);
|
||||
})
|
||||
->assert('sbas_id', '\d+')->assert('record_id', '\d+')
|
||||
->bind('permalinks_caption');
|
||||
|
@@ -111,10 +111,10 @@ class BasketController implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'basket' => $basket,
|
||||
'ordre' => $request->query->get('order')
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('prod/WorkZone/Basket.html.twig', $params);
|
||||
}
|
||||
@@ -152,17 +152,17 @@ class BasketController implements ControllerProviderInterface
|
||||
$app['EM']->flush();
|
||||
|
||||
if ($request->getRequestFormat() === 'json') {
|
||||
$data = array(
|
||||
$data = [
|
||||
'success' => true
|
||||
, 'message' => _('Basket created')
|
||||
, 'basket' => array(
|
||||
, 'basket' => [
|
||||
'id' => $Basket->getId()
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
|
||||
return $app->json($data);
|
||||
} else {
|
||||
return $app->redirectPath('prod_baskets_basket', array('basket' => $Basket->getId()));
|
||||
return $app->redirectPath('prod_baskets_basket', ['basket' => $Basket->getId()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,10 +171,10 @@ class BasketController implements ControllerProviderInterface
|
||||
$app['EM']->remove($basket);
|
||||
$app['EM']->flush();
|
||||
|
||||
$data = array(
|
||||
$data = [
|
||||
'success' => true
|
||||
, 'message' => _('Basket has been deleted')
|
||||
);
|
||||
];
|
||||
|
||||
if ($request->getRequestFormat() === 'json') {
|
||||
return $app->json($data);
|
||||
@@ -194,10 +194,10 @@ class BasketController implements ControllerProviderInterface
|
||||
|
||||
$app['EM']->flush();
|
||||
|
||||
$data = array(
|
||||
$data = [
|
||||
'success' => true
|
||||
, 'message' => _('Record removed from basket')
|
||||
);
|
||||
];
|
||||
|
||||
if ($request->getRequestFormat() === 'json') {
|
||||
return $app->json($data);
|
||||
@@ -227,11 +227,11 @@ class BasketController implements ControllerProviderInterface
|
||||
$msg = _('An error occurred');
|
||||
}
|
||||
|
||||
$data = array(
|
||||
$data = [
|
||||
'success' => $success
|
||||
, 'message' => $msg
|
||||
, 'basket' => array('id' => $basket->getId())
|
||||
);
|
||||
, 'basket' => ['id' => $basket->getId()]
|
||||
];
|
||||
|
||||
if ($request->getRequestFormat() === 'json') {
|
||||
return $app->json($data);
|
||||
@@ -242,17 +242,17 @@ class BasketController implements ControllerProviderInterface
|
||||
|
||||
public function displayUpdateForm(Application $app, BasketEntity $basket)
|
||||
{
|
||||
return $app['twig']->render('prod/Baskets/Update.html.twig', array('basket' => $basket));
|
||||
return $app['twig']->render('prod/Baskets/Update.html.twig', ['basket' => $basket]);
|
||||
}
|
||||
|
||||
public function displayReorderForm(Application $app, BasketEntity $basket)
|
||||
{
|
||||
return $app['twig']->render('prod/Baskets/Reorder.html.twig', array('basket' => $basket));
|
||||
return $app['twig']->render('prod/Baskets/Reorder.html.twig', ['basket' => $basket]);
|
||||
}
|
||||
|
||||
public function reorder(Application $app, BasketEntity $basket)
|
||||
{
|
||||
$ret = array('success' => false, 'message' => _('An error occured'));
|
||||
$ret = ['success' => false, 'message' => _('An error occured')];
|
||||
try {
|
||||
$order = $app['request']->request->get('element');
|
||||
|
||||
@@ -266,7 +266,7 @@ class BasketController implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
$app['EM']->flush();
|
||||
$ret = array('success' => true, 'message' => _('Basket updated'));
|
||||
$ret = ['success' => true, 'message' => _('Basket updated')];
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
@@ -289,11 +289,11 @@ class BasketController implements ControllerProviderInterface
|
||||
$message = _('Basket has been unarchived');
|
||||
}
|
||||
|
||||
$data = array(
|
||||
$data = [
|
||||
'success' => true
|
||||
, 'archive' => $archive_status
|
||||
, 'message' => $message
|
||||
);
|
||||
];
|
||||
|
||||
if ($request->getRequestFormat() === 'json') {
|
||||
return $app->json($data);
|
||||
@@ -338,10 +338,10 @@ class BasketController implements ControllerProviderInterface
|
||||
|
||||
$app['EM']->flush();
|
||||
|
||||
$data = array(
|
||||
$data = [
|
||||
'success' => true
|
||||
, 'message' => sprintf(_('%d records added'), $n)
|
||||
);
|
||||
];
|
||||
|
||||
if ($request->getRequestFormat() === 'json') {
|
||||
return $app->json($data);
|
||||
@@ -370,10 +370,10 @@ class BasketController implements ControllerProviderInterface
|
||||
|
||||
$app['EM']->flush();
|
||||
|
||||
$data = array(
|
||||
$data = [
|
||||
'success' => true
|
||||
, 'message' => sprintf(_('%d records moved'), $n)
|
||||
);
|
||||
];
|
||||
|
||||
if ($request->getRequestFormat() === 'json') {
|
||||
return $app->json($data);
|
||||
|
@@ -100,12 +100,12 @@ class Bridge implements ControllerProviderInterface
|
||||
public function doPostManager(Application $app, Request $request)
|
||||
{
|
||||
$route = new RecordHelper\Bridge($app, $request);
|
||||
$params = array(
|
||||
$params = [
|
||||
'user_accounts' => \Bridge_Account::get_accounts_by_user($app, $app['authentication']->getUser()),
|
||||
'available_apis' => \Bridge_Api::get_availables($app),
|
||||
'route' => $route,
|
||||
'current_account_id' => '',
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('prod/actions/Bridge/index.html.twig', $params);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ class Bridge implements ControllerProviderInterface
|
||||
$error_message = $e->getMessage();
|
||||
}
|
||||
|
||||
$params = array('error_message' => $error_message);
|
||||
$params = ['error_message' => $error_message];
|
||||
|
||||
return $app['twig']->render('prod/actions/Bridge/callback.html.twig', $params);
|
||||
}
|
||||
@@ -158,10 +158,10 @@ class Bridge implements ControllerProviderInterface
|
||||
$this->requireConnection($app, $account);
|
||||
$account->get_api()->get_connector()->disconnect();
|
||||
|
||||
return $app->redirectPath('bridge_load_elements', array(
|
||||
return $app->redirectPath('bridge_load_elements', [
|
||||
'account_id' => $account_id,
|
||||
'type' => $account->get_api()->get_connector()->get_default_element_type(),
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
public function doPostAccountDelete(Application $app, Request $request, $account_id)
|
||||
@@ -183,7 +183,7 @@ class Bridge implements ControllerProviderInterface
|
||||
$message = _('Something went wrong, please contact an administrator');
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'message' => $message));
|
||||
return $app->json(['success' => $success, 'message' => $message]);
|
||||
}
|
||||
|
||||
public function doGetloadRecords(Application $app, Request $request, $account_id)
|
||||
@@ -196,13 +196,13 @@ class Bridge implements ControllerProviderInterface
|
||||
|
||||
$this->requireConnection($app, $account);
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'adapter_action' => 'load-records'
|
||||
, 'account' => $account
|
||||
, 'elements' => $elements
|
||||
, 'error_message' => $request->query->get('error')
|
||||
, 'notice_message' => $request->query->get('notice')
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('prod/actions/Bridge/records_list.html.twig', $params);
|
||||
}
|
||||
@@ -218,14 +218,14 @@ class Bridge implements ControllerProviderInterface
|
||||
|
||||
$elements = $account->get_api()->list_elements($type, $offset_start, $quantity);
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'action_type' => $type,
|
||||
'adapter_action' => 'load-elements',
|
||||
'account' => $account,
|
||||
'elements' => $elements,
|
||||
'error_message' => $request->query->get('error'),
|
||||
'notice_message' => $request->query->get('notice'),
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('prod/actions/Bridge/element_list.html.twig', $params);
|
||||
}
|
||||
@@ -240,14 +240,14 @@ class Bridge implements ControllerProviderInterface
|
||||
$this->requireConnection($app, $account);
|
||||
$elements = $account->get_api()->list_containers($type, $offset_start, $quantity);
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'action_type' => $type,
|
||||
'adapter_action' => 'load-containers',
|
||||
'account' => $account,
|
||||
'elements' => $elements,
|
||||
'error_message' => $request->query->get('error'),
|
||||
'notice_message' => $request->query->get('notice'),
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('prod/actions/Bridge/element_list.html.twig', $params);
|
||||
}
|
||||
@@ -257,11 +257,11 @@ class Bridge implements ControllerProviderInterface
|
||||
$account = \Bridge_Account::load_account($app, $account_id);
|
||||
|
||||
$this->requireConnection($app, $account);
|
||||
$elements = $request->query->get('elements_list', array());
|
||||
$elements = $request->query->get('elements_list', []);
|
||||
$elements = is_array($elements) ? $elements : explode(';', $elements);
|
||||
|
||||
$destination = $request->query->get('destination');
|
||||
$route_params = array();
|
||||
$route_params = [];
|
||||
$class = $account->get_api()->get_connector()->get_object_class_from_type($element_type);
|
||||
|
||||
switch ($action) {
|
||||
@@ -270,25 +270,25 @@ class Bridge implements ControllerProviderInterface
|
||||
|
||||
case 'modify':
|
||||
if (count($elements) != 1) {
|
||||
return $app->redirectPath('bridge_load_elements', array(
|
||||
return $app->redirectPath('bridge_load_elements', [
|
||||
'account_id' => $account_id,
|
||||
'type' => $element_type,
|
||||
'page' => '',
|
||||
'error' => _('Vous ne pouvez pas editer plusieurs elements simultanement'),
|
||||
));
|
||||
]);
|
||||
}
|
||||
foreach ($elements as $element_id) {
|
||||
if ($class === \Bridge_Api_Interface::OBJECT_CLASS_ELEMENT) {
|
||||
$route_params = array('element' => $account->get_api()->get_element_from_id($element_id, $element_type));
|
||||
$route_params = ['element' => $account->get_api()->get_element_from_id($element_id, $element_type)];
|
||||
}
|
||||
if ($class === \Bridge_Api_Interface::OBJECT_CLASS_CONTAINER) {
|
||||
$route_params = array('element' => $account->get_api()->get_container_from_id($element_id, $element_type));
|
||||
$route_params = ['element' => $account->get_api()->get_container_from_id($element_id, $element_type)];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'moveinto':
|
||||
$route_params = array('containers' => $account->get_api()->list_containers($destination, 0, 0));
|
||||
$route_params = ['containers' => $account->get_api()->list_containers($destination, 0, 0)];
|
||||
break;
|
||||
|
||||
case 'deleteelement':
|
||||
@@ -299,7 +299,7 @@ class Bridge implements ControllerProviderInterface
|
||||
break;
|
||||
}
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'account' => $account,
|
||||
'destination' => $destination,
|
||||
'element_type' => $element_type,
|
||||
@@ -309,7 +309,7 @@ class Bridge implements ControllerProviderInterface
|
||||
'elements' => $elements,
|
||||
'error_message' => $request->query->get('error'),
|
||||
'notice_message' => $request->query->get('notice'),
|
||||
);
|
||||
];
|
||||
|
||||
$params = array_merge($params, $route_params);
|
||||
$template = 'prod/actions/Bridge/' . $account->get_api()->get_connector()->get_name() . '/' . $element_type . '_' . $action . ($destination ? '_' . $destination : '') . '.html.twig';
|
||||
@@ -323,7 +323,7 @@ class Bridge implements ControllerProviderInterface
|
||||
|
||||
$this->requireConnection($app, $account);
|
||||
|
||||
$elements = $request->request->get('elements_list', array());
|
||||
$elements = $request->request->get('elements_list', []);
|
||||
$elements = is_array($elements) ? $elements : explode(';', $elements);
|
||||
|
||||
$destination = $request->request->get('destination');
|
||||
@@ -342,7 +342,7 @@ class Bridge implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if (count($errors) > 0) {
|
||||
$params = array(
|
||||
$params = [
|
||||
'element' => $account->get_api()->get_element_from_id($element_id, $element_type),
|
||||
'account' => $account,
|
||||
'destination' => $destination,
|
||||
@@ -353,7 +353,7 @@ class Bridge implements ControllerProviderInterface
|
||||
'error_message' => _('Request contains invalid datas'),
|
||||
'constraint_errors' => $errors,
|
||||
'notice_message' => $request->request->get('notice'),
|
||||
);
|
||||
];
|
||||
|
||||
$template = 'prod/actions/Bridge/' . $account->get_api()->get_connector()->get_name() . '/' . $element_type . '_' . $action . ($destination ? '_' . $destination : '') . '.html.twig';
|
||||
|
||||
@@ -417,14 +417,14 @@ class Bridge implements ControllerProviderInterface
|
||||
|
||||
$route->grep_records($account->get_api()->acceptable_records());
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'route' => $route,
|
||||
'account' => $account,
|
||||
'error_message' => $request->query->get('error'),
|
||||
'notice_message' => $request->query->get('notice'),
|
||||
'constraint_errors' => null,
|
||||
'adapter_action' => 'upload',
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render(
|
||||
'prod/actions/Bridge/' . $account->get_api()->get_connector()->get_name() . '/upload.html.twig', $params
|
||||
@@ -433,7 +433,7 @@ class Bridge implements ControllerProviderInterface
|
||||
|
||||
public function doPostUpload(Application $app, Request $request)
|
||||
{
|
||||
$errors = array();
|
||||
$errors = [];
|
||||
$account = \Bridge_Account::load_account($app, $request->request->get('account_id'));
|
||||
$this->requireConnection($app, $account);
|
||||
|
||||
@@ -448,14 +448,14 @@ class Bridge implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if (count($errors) > 0) {
|
||||
$params = array(
|
||||
$params = [
|
||||
'route' => $route,
|
||||
'account' => $account,
|
||||
'error_message' => _('Request contains invalid datas'),
|
||||
'constraint_errors' => $errors,
|
||||
'notice_message' => $request->request->get('notice'),
|
||||
'adapter_action' => 'upload',
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('prod/actions/Bridge/' . $account->get_api()->get_connector()->get_name() . '/upload.html.twig', $params);
|
||||
}
|
||||
|
@@ -63,7 +63,7 @@ class DoDownload implements ControllerProviderInterface
|
||||
$app->abort(500, 'Invalid datas');
|
||||
}
|
||||
|
||||
$records = array();
|
||||
$records = [];
|
||||
|
||||
foreach ($list['files'] as $file) {
|
||||
if (!is_array($file) || !isset($file['base_id']) || !isset($file['record_id'])) {
|
||||
@@ -81,14 +81,14 @@ class DoDownload implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
return new Response($app['twig']->render(
|
||||
'/prod/actions/Download/prepare.html.twig', array(
|
||||
'/prod/actions/Download/prepare.html.twig', [
|
||||
'module_name' => _('Export'),
|
||||
'module' => _('Export'),
|
||||
'list' => $list,
|
||||
'records' => $records,
|
||||
'token' => $token,
|
||||
'anonymous' => $request->query->get('anonymous', false)
|
||||
)));
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,17 +153,17 @@ class DoDownload implements ControllerProviderInterface
|
||||
try {
|
||||
$datas = $app['tokens']->helloToken($token);
|
||||
} catch (NotFoundHttpException $e) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => false,
|
||||
'message' => 'Invalid token'
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
if (false === $list = @unserialize((string) $datas['datas'])) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => false,
|
||||
'message' => 'Invalid datas'
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
set_time_limit(0);
|
||||
@@ -178,9 +178,9 @@ class DoDownload implements ControllerProviderInterface
|
||||
sprintf($app['root.path'] . '/tmp/download/%s.zip', $datas['value']) // Dest file
|
||||
);
|
||||
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => true,
|
||||
'message' => ''
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ class Download implements ControllerProviderInterface
|
||||
{
|
||||
$lst = $request->request->get('lst');
|
||||
$ssttid = $request->request->get('ssttid', '');
|
||||
$subdefs = $request->request->get('obj', array());
|
||||
$subdefs = $request->request->get('obj', []);
|
||||
|
||||
$download = new \set_export($app, $lst, $ssttid);
|
||||
|
||||
@@ -77,14 +77,14 @@ class Download implements ControllerProviderInterface
|
||||
throw new \RuntimeException('Download token could not be generated');
|
||||
}
|
||||
|
||||
$app['events-manager']->trigger('__DOWNLOAD__', array(
|
||||
$app['events-manager']->trigger('__DOWNLOAD__', [
|
||||
'lst' => $lst,
|
||||
'downloader' => $app['authentication']->getUser()->get_id(),
|
||||
'subdefs' => $subdefs,
|
||||
'from_basket' => $ssttid,
|
||||
'export_file' => $download->getExportName()
|
||||
));
|
||||
]);
|
||||
|
||||
return $app->redirectPath('prepare_download', array('token' => $token));
|
||||
return $app->redirectPath('prepare_download', ['token' => $token]);
|
||||
}
|
||||
}
|
||||
|
@@ -39,11 +39,11 @@ class Edit implements ControllerProviderInterface
|
||||
|
||||
$controllers->post('/', function (Application $app, Request $request) {
|
||||
|
||||
$records = RecordsRequest::fromRequest($app, $request, RecordsRequest::FLATTEN_YES_PRESERVE_STORIES, array('canmodifrecord'));
|
||||
$records = RecordsRequest::fromRequest($app, $request, RecordsRequest::FLATTEN_YES_PRESERVE_STORIES, ['canmodifrecord']);
|
||||
|
||||
$thesaurus = false;
|
||||
$status = $ids = $elements = $suggValues =
|
||||
$fields = $JSFields = array();
|
||||
$fields = $JSFields = [];
|
||||
$databox = null;
|
||||
|
||||
$multipleDataboxes = count($records->databoxes()) > 1;
|
||||
@@ -60,12 +60,12 @@ class Edit implements ControllerProviderInterface
|
||||
|
||||
$separator = $meta->get_separator();
|
||||
|
||||
$JSFields[$meta->get_id()] = array(
|
||||
$JSFields[$meta->get_id()] = [
|
||||
'meta_struct_id' => $meta->get_id()
|
||||
, 'name' => $meta->get_name()
|
||||
, '_status' => 0
|
||||
, '_value' => ''
|
||||
, '_sgval' => array()
|
||||
, '_sgval' => []
|
||||
, 'required' => $meta->is_required()
|
||||
, 'label' => $meta->get_label($app['locale.I18n'])
|
||||
, 'readonly' => $meta->is_readonly()
|
||||
@@ -79,7 +79,7 @@ class Edit implements ControllerProviderInterface
|
||||
, 'separator' => $separator
|
||||
, 'vocabularyControl' => $meta->getVocabularyControl() ? $meta->getVocabularyControl()->getType() : null
|
||||
, 'vocabularyRestricted' => $meta->getVocabularyControl() ? $meta->isVocabularyRestricted() : false
|
||||
);
|
||||
];
|
||||
|
||||
if (trim($meta->get_tbranch()) !== '') {
|
||||
$thesaurus = true;
|
||||
@@ -92,7 +92,7 @@ class Edit implements ControllerProviderInterface
|
||||
foreach ($records->collections() as $collection) {
|
||||
/* @var $record record_adapter */
|
||||
|
||||
$suggValues['b' . $collection->get_base_id()] = array();
|
||||
$suggValues['b' . $collection->get_base_id()] = [];
|
||||
|
||||
if ($sxe = simplexml_load_string($collection->get_prefs())) {
|
||||
$z = $sxe->xpath('/baseprefs/sugestedValues');
|
||||
@@ -107,7 +107,7 @@ class Edit implements ControllerProviderInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
$suggValues['b' . $collection->get_base_id()][$field->get_id()] = array();
|
||||
$suggValues['b' . $collection->get_base_id()][$field->get_id()] = [];
|
||||
|
||||
foreach ($vi->value as $oneValue) {
|
||||
$suggValues['b' . $collection->get_base_id()][$field->get_id()][] = (string) $oneValue;
|
||||
@@ -124,7 +124,7 @@ class Edit implements ControllerProviderInterface
|
||||
$dbstatus = \databox_status::getDisplayStatus($app);
|
||||
if (isset($dbstatus[$databox->get_sbas_id()])) {
|
||||
foreach ($dbstatus[$databox->get_sbas_id()] as $n => $statbit) {
|
||||
$status[$n] = array();
|
||||
$status[$n] = [];
|
||||
$status[$n]['label0'] = $statbit['labels_off_i18n'][$app['locale.I18n']];
|
||||
$status[$n]['label1'] = $statbit['labels_on_i18n'][$app['locale.I18n']];
|
||||
$status[$n]['img_off'] = $statbit['img_off'];
|
||||
@@ -138,24 +138,24 @@ class Edit implements ControllerProviderInterface
|
||||
* generate javascript elements
|
||||
*/
|
||||
foreach ($databox->get_meta_structure() as $field) {
|
||||
$databox_fields[$field->get_id()] = array(
|
||||
$databox_fields[$field->get_id()] = [
|
||||
'dirty' => false,
|
||||
'meta_struct_id' => $field->get_id(),
|
||||
'values' => array()
|
||||
);
|
||||
'values' => []
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($records as $record) {
|
||||
$indice = $record->get_number();
|
||||
$elements[$indice] = array(
|
||||
$elements[$indice] = [
|
||||
'bid' => $record->get_base_id(),
|
||||
'rid' => $record->get_record_id(),
|
||||
'sselcont_id' => null,
|
||||
'_selected' => false,
|
||||
'fields' => $databox_fields
|
||||
);
|
||||
];
|
||||
|
||||
$elements[$indice]['statbits'] = array();
|
||||
$elements[$indice]['statbits'] = [];
|
||||
if ($app['acl']->get($app['authentication']->getUser())->has_right_on_base($record->get_base_id(), 'chgstatus')) {
|
||||
foreach ($status as $n => $s) {
|
||||
$tmp_val = substr(strrev($record->get_status()), $n, 1);
|
||||
@@ -172,7 +172,7 @@ class Edit implements ControllerProviderInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
$values = array();
|
||||
$values = [];
|
||||
foreach ($field->get_values() as $value) {
|
||||
$type = $id = null;
|
||||
|
||||
@@ -181,38 +181,38 @@ class Edit implements ControllerProviderInterface
|
||||
$id = $value->getVocabularyId();
|
||||
}
|
||||
|
||||
$values[$value->getId()] = array(
|
||||
$values[$value->getId()] = [
|
||||
'meta_id' => $value->getId(),
|
||||
'value' => $value->getValue(),
|
||||
'vocabularyId' => $id,
|
||||
'vocabularyType' => $type
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$elements[$indice]['fields'][$meta_struct_id] = array(
|
||||
$elements[$indice]['fields'][$meta_struct_id] = [
|
||||
'dirty' => false,
|
||||
'meta_struct_id' => $meta_struct_id,
|
||||
'values' => $values
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$elements[$indice]['subdefs'] = array();
|
||||
$elements[$indice]['subdefs'] = [];
|
||||
|
||||
$thumbnail = $record->get_thumbnail();
|
||||
|
||||
$elements[$indice]['subdefs']['thumbnail'] = array(
|
||||
$elements[$indice]['subdefs']['thumbnail'] = [
|
||||
'url' => $thumbnail->get_url()
|
||||
, 'w' => $thumbnail->get_width()
|
||||
, 'h' => $thumbnail->get_height()
|
||||
);
|
||||
];
|
||||
|
||||
$elements[$indice]['preview'] = $app['twig']->render('common/preview.html.twig', array('record' => $record));
|
||||
$elements[$indice]['preview'] = $app['twig']->render('common/preview.html.twig', ['record' => $record]);
|
||||
|
||||
$elements[$indice]['type'] = $record->get_type();
|
||||
}
|
||||
}
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'multipleDataboxes' => $multipleDataboxes,
|
||||
'recordsRequest' => $records,
|
||||
'databox' => $databox,
|
||||
@@ -224,13 +224,13 @@ class Edit implements ControllerProviderInterface
|
||||
'fields' => $fields,
|
||||
'JSonSuggValues' => json_encode($suggValues),
|
||||
'thesaurus' => $thesaurus,
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('prod/actions/edit_default.html.twig', $params);
|
||||
});
|
||||
|
||||
$controllers->get('/vocabulary/{vocabulary}/', function (Application $app, Request $request, $vocabulary) {
|
||||
$datas = array('success' => false, 'message' => '', 'results' => array());
|
||||
$datas = ['success' => false, 'message' => '', 'results' => []];
|
||||
|
||||
$sbas_id = (int) $request->query->get('sbas_id');
|
||||
|
||||
@@ -251,15 +251,15 @@ class Edit implements ControllerProviderInterface
|
||||
|
||||
$results = $VC->find($query, $app['authentication']->getUser(), $databox);
|
||||
|
||||
$list = array();
|
||||
$list = [];
|
||||
|
||||
foreach ($results as $Term) {
|
||||
/* @var $Term \Alchemy\Phrasea\Vocabulary\Term */
|
||||
$list[] = array(
|
||||
$list[] = [
|
||||
'id' => $Term->getId(),
|
||||
'context' => $Term->getContext(),
|
||||
'value' => $Term->getValue(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$datas['success'] = true;
|
||||
@@ -270,7 +270,7 @@ class Edit implements ControllerProviderInterface
|
||||
|
||||
$controllers->post('/apply/', function (Application $app, Request $request) {
|
||||
|
||||
$records = RecordsRequest::fromRequest($app, $request, RecordsRequest::FLATTEN_YES_PRESERVE_STORIES, array('canmodifrecord'));
|
||||
$records = RecordsRequest::fromRequest($app, $request, RecordsRequest::FLATTEN_YES_PRESERVE_STORIES, ['canmodifrecord']);
|
||||
|
||||
if (count($records->databoxes()) !== 1) {
|
||||
throw new \Exception('Unable to edit on multiple databoxes');
|
||||
@@ -289,7 +289,7 @@ class Edit implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
foreach ($newsubdef_reg->get_subdefs() as $name => $value) {
|
||||
if (!in_array($name, array('thumbnail', 'preview'))) {
|
||||
if (!in_array($name, ['thumbnail', 'preview'])) {
|
||||
continue;
|
||||
}
|
||||
$media = $app['mediavorus']->guess($value->get_pathfile());
|
||||
@@ -307,7 +307,7 @@ class Edit implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if (!is_array($request->request->get('mds'))) {
|
||||
return $app->json(array('message' => '', 'error' => false));
|
||||
return $app->json(['message' => '', 'error' => false]);
|
||||
}
|
||||
|
||||
$databoxes = $records->databoxes();
|
||||
@@ -354,7 +354,7 @@ class Edit implements ControllerProviderInterface
|
||||
* todo : this should not work
|
||||
*/
|
||||
if ($write_edit_el instanceof \databox_field) {
|
||||
$fields = $record->get_caption()->get_fields(array($write_edit_el->get_name()), true);
|
||||
$fields = $record->get_caption()->get_fields([$write_edit_el->get_name()], true);
|
||||
$field = array_pop($fields);
|
||||
|
||||
$meta_id = null;
|
||||
@@ -364,21 +364,21 @@ class Edit implements ControllerProviderInterface
|
||||
$meta_id = array_pop($values)->getId();
|
||||
}
|
||||
|
||||
$metas = array(
|
||||
array(
|
||||
$metas = [
|
||||
[
|
||||
'meta_struct_id' => $write_edit_el->get_id(),
|
||||
'meta_id' => $meta_id,
|
||||
'value' => $date_obj->format('Y-m-d h:i:s'),
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
|
||||
$record->set_metadatas($metas, true);
|
||||
}
|
||||
|
||||
$newstat = $record->get_status();
|
||||
$statbits = ltrim($statbits, 'x');
|
||||
if (!in_array($statbits, array('', 'null'))) {
|
||||
$mask_and = ltrim(str_replace(array('x', '0', '1', 'z'), array('1', 'z', '0', '1'), $statbits), '0');
|
||||
if (!in_array($statbits, ['', 'null'])) {
|
||||
$mask_and = ltrim(str_replace(['x', '0', '1', 'z'], ['1', 'z', '0', '1'], $statbits), '0');
|
||||
if ($mask_and != '') {
|
||||
$newstat = \databox_status::operation_and_not($app, $newstat, $mask_and);
|
||||
}
|
||||
@@ -407,7 +407,7 @@ class Edit implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app->json(array('success' => true));
|
||||
return $app->json(['success' => true]);
|
||||
});
|
||||
|
||||
return $controllers;
|
||||
|
@@ -67,13 +67,13 @@ class Export implements ControllerProviderInterface
|
||||
$request->request->get('story')
|
||||
);
|
||||
|
||||
return new Response($app['twig']->render('common/dialog_export.html.twig', array(
|
||||
return new Response($app['twig']->render('common/dialog_export.html.twig', [
|
||||
'download' => $download,
|
||||
'ssttid' => $request->request->get('ssel'),
|
||||
'lst' => $download->serialize_list(),
|
||||
'default_export_title' => $app['phraseanet.registry']->get('GV_default_export_title'),
|
||||
'choose_export_title' => $app['phraseanet.registry']->get('GV_choose_export_title')
|
||||
)));
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,10 +100,10 @@ class Export implements ControllerProviderInterface
|
||||
$msg = sprintf(_('Error while connecting to FTP'));
|
||||
}
|
||||
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'message' => $msg
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +116,7 @@ class Export implements ControllerProviderInterface
|
||||
{
|
||||
$download = new \set_exportftp($app, $request->request->get('lst'), $request->request->get('ssttid'));
|
||||
|
||||
$mandatoryParameters = array('address', 'login', 'dest_folder', 'prefix_folder', 'obj');
|
||||
$mandatoryParameters = ['address', 'login', 'dest_folder', 'prefix_folder', 'obj'];
|
||||
|
||||
foreach ($mandatoryParameters as $parameter) {
|
||||
if (!$request->request->get($parameter)) {
|
||||
@@ -125,10 +125,10 @@ class Export implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if (count($download->get_display_ftp()) == 0) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => false,
|
||||
'message' => _("You do not have required rights to send these documents over FTP")
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -153,15 +153,15 @@ class Export implements ControllerProviderInterface
|
||||
$request->request->get('logfile')
|
||||
);
|
||||
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => true,
|
||||
'message' => _('Export saved in the waiting queue')
|
||||
));
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => false,
|
||||
'message' => _('Something went wrong')
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,19 +197,19 @@ class Export implements ControllerProviderInterface
|
||||
$list['export_name'] = sprintf("%s.zip", $download->getExportName());
|
||||
$list['email'] = implode(';', preg_split($separator, $request->request->get("destmail", "")));
|
||||
|
||||
$destMails = array();
|
||||
$destMails = [];
|
||||
//get destination mails
|
||||
foreach (explode(";", $list['email']) as $mail) {
|
||||
if (filter_var($mail, FILTER_VALIDATE_EMAIL)) {
|
||||
$destMails[] = $mail;
|
||||
} else {
|
||||
$app['events-manager']->trigger('__EXPORT_MAIL_FAIL__', array(
|
||||
$app['events-manager']->trigger('__EXPORT_MAIL_FAIL__', [
|
||||
'usr_id' => $app['authentication']->getUser()->get_id(),
|
||||
'lst' => $lst,
|
||||
'ssttid' => $ssttid,
|
||||
'dest' => $mail,
|
||||
'reason' => \eventsmanager_notify_downloadmailfail::MAIL_NO_VALID
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ class Export implements ControllerProviderInterface
|
||||
|
||||
$remaingEmails = $destMails;
|
||||
|
||||
$url = $app->url('prepare_download', array('token' => $token, 'anonymous'));
|
||||
$url = $app->url('prepare_download', ['token' => $token, 'anonymous']);
|
||||
|
||||
$emitter = new Emitter($app['authentication']->getUser()->get_display_name(), $app['authentication']->getUser()->get_email());
|
||||
|
||||
@@ -250,30 +250,30 @@ class Export implements ControllerProviderInterface
|
||||
//some mails failed
|
||||
if (count($remaingEmails) > 0) {
|
||||
foreach ($remaingEmails as $mail) {
|
||||
$app['events-manager']->trigger('__EXPORT_MAIL_FAIL__', array(
|
||||
$app['events-manager']->trigger('__EXPORT_MAIL_FAIL__', [
|
||||
'usr_id' => $app['authentication']->getUser()->get_id(),
|
||||
'lst' => $lst,
|
||||
'ssttid' => $ssttid,
|
||||
'dest' => $mail,
|
||||
'reason' => \eventsmanager_notify_downloadmailfail::MAIL_FAIL
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
} elseif (!$token && count($destMails) > 0) { //couldn't generate token
|
||||
foreach ($destMails as $mail) {
|
||||
$app['events-manager']->trigger('__EXPORT_MAIL_FAIL__', array(
|
||||
$app['events-manager']->trigger('__EXPORT_MAIL_FAIL__', [
|
||||
'usr_id' => $app['authentication']->getUser()->get_id(),
|
||||
'lst' => $lst,
|
||||
'ssttid' => $ssttid,
|
||||
'dest' => $mail,
|
||||
'reason' => 0
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => true,
|
||||
'message' => ''
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -44,9 +44,9 @@ class Feed implements ControllerProviderInterface
|
||||
$feeds = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->getAllForUser(
|
||||
$app['acl']->get($app['authentication']->getUser())
|
||||
);
|
||||
$publishing = RecordsRequest::fromRequest($app, $request, true, array(), array('bas_chupub'));
|
||||
$publishing = RecordsRequest::fromRequest($app, $request, true, [], ['bas_chupub']);
|
||||
|
||||
return $app['twig']->render('prod/actions/publish/publish.html.twig', array('publishing' => $publishing, 'feeds' => $feeds));
|
||||
return $app['twig']->render('prod/actions/publish/publish.html.twig', ['publishing' => $publishing, 'feeds' => $feeds]);
|
||||
});
|
||||
|
||||
$controllers->post('/entry/create/', function (Application $app, Request $request) {
|
||||
@@ -56,7 +56,7 @@ class Feed implements ControllerProviderInterface
|
||||
$app->abort(404, "Feed not found");
|
||||
}
|
||||
|
||||
$publisher = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\FeedPublisher')->findOneBy(array('feed' => $feed, 'usrId' => $app['authentication']->getUser()->get_id()));
|
||||
$publisher = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\FeedPublisher')->findOneBy(['feed' => $feed, 'usrId' => $app['authentication']->getUser()->get_id()]);
|
||||
|
||||
if ('' === $title = trim($request->request->get('title', ''))) {
|
||||
$app->abort(400, "Bad request");
|
||||
@@ -76,7 +76,7 @@ class Feed implements ControllerProviderInterface
|
||||
|
||||
$feed->addEntry($entry);
|
||||
|
||||
$publishing = RecordsRequest::fromRequest($app, $request, true, array(), array('bas_chupub'));
|
||||
$publishing = RecordsRequest::fromRequest($app, $request, true, [], ['bas_chupub']);
|
||||
foreach ($publishing as $record) {
|
||||
$item = new FeedItem();
|
||||
$item->setEntry($entry)
|
||||
@@ -90,9 +90,9 @@ class Feed implements ControllerProviderInterface
|
||||
$app['EM']->persist($feed);
|
||||
$app['EM']->flush();
|
||||
|
||||
$app['events-manager']->trigger('__FEED_ENTRY_CREATE__', array('entry_id' => $entry->getId(), 'notify_email' => (Boolean) $request->request->get('notify')), $entry);
|
||||
$app['events-manager']->trigger('__FEED_ENTRY_CREATE__', ['entry_id' => $entry->getId(), 'notify_email' => (Boolean) $request->request->get('notify')], $entry);
|
||||
|
||||
$datas = array('error' => false, 'message' => false);
|
||||
$datas = ['error' => false, 'message' => false];
|
||||
|
||||
return $app->json($datas);
|
||||
})
|
||||
@@ -110,7 +110,7 @@ class Feed implements ControllerProviderInterface
|
||||
|
||||
$feeds = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->getAllForUser($app['acl']->get($app['authentication']->getUser()));
|
||||
|
||||
$datas = $app['twig']->render('prod/actions/publish/publish_edit.html.twig', array('entry' => $entry, 'feeds' => $feeds));
|
||||
$datas = $app['twig']->render('prod/actions/publish/publish_edit.html.twig', ['entry' => $entry, 'feeds' => $feeds]);
|
||||
|
||||
return new Response($datas);
|
||||
})
|
||||
@@ -121,7 +121,7 @@ class Feed implements ControllerProviderInterface
|
||||
});
|
||||
|
||||
$controllers->post('/entry/{id}/update/', function (Application $app, Request $request, $id) {
|
||||
$datas = array('error' => true, 'message' => '', 'datas' => '');
|
||||
$datas = ['error' => true, 'message' => '', 'datas' => ''];
|
||||
$entry = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\FeedEntry')->find($id);
|
||||
|
||||
if (null === $entry) {
|
||||
@@ -170,13 +170,13 @@ class Feed implements ControllerProviderInterface
|
||||
$app['EM']->persist($entry);
|
||||
$app['EM']->flush();
|
||||
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'error' => false,
|
||||
'message' => 'succes',
|
||||
'datas' => $app['twig']->render('prod/feeds/entry.html.twig', array(
|
||||
'datas' => $app['twig']->render('prod/feeds/entry.html.twig', [
|
||||
'entry' => $entry
|
||||
))
|
||||
));
|
||||
])
|
||||
]);
|
||||
})
|
||||
->bind('prod_feeds_entry_update')
|
||||
->assert('id', '\d+')->before(function (Request $request) use ($app) {
|
||||
@@ -184,7 +184,7 @@ class Feed implements ControllerProviderInterface
|
||||
});
|
||||
|
||||
$controllers->post('/entry/{id}/delete/', function (Application $app, Request $request, $id) {
|
||||
$datas = array('error' => true, 'message' => '');
|
||||
$datas = ['error' => true, 'message' => ''];
|
||||
|
||||
$entry = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\FeedEntry')->find($id);
|
||||
|
||||
@@ -198,7 +198,7 @@ class Feed implements ControllerProviderInterface
|
||||
$app['EM']->remove($entry);
|
||||
$app['EM']->flush();
|
||||
|
||||
return $app->json(array('error' => false, 'message' => 'succes'));
|
||||
return $app->json(['error' => false, 'message' => 'succes']);
|
||||
})
|
||||
->bind('prod_feeds_entry_delete')
|
||||
->assert('id', '\d+')->before(function (Request $request) use ($app) {
|
||||
@@ -212,11 +212,11 @@ class Feed implements ControllerProviderInterface
|
||||
|
||||
$feeds = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->getAllForUser($app['acl']->get($app['authentication']->getUser()));
|
||||
|
||||
$datas = $app['twig']->render('prod/feeds/feeds.html.twig', array(
|
||||
$datas = $app['twig']->render('prod/feeds/feeds.html.twig', [
|
||||
'feeds' => $feeds,
|
||||
'feed' => new Aggregate($app['EM'], $feeds),
|
||||
'page' => $page
|
||||
));
|
||||
]);
|
||||
|
||||
return new Response($datas);
|
||||
})->bind('prod_feeds');
|
||||
@@ -231,7 +231,7 @@ class Feed implements ControllerProviderInterface
|
||||
}
|
||||
$feeds = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->getAllForUser($app['acl']->get($app['authentication']->getUser()));
|
||||
|
||||
$datas = $app['twig']->render('prod/feeds/feeds.html.twig', array('feed' => $feed, 'feeds' => $feeds, 'page' => $page));
|
||||
$datas = $app['twig']->render('prod/feeds/feeds.html.twig', ['feed' => $feed, 'feeds' => $feeds, 'page' => $page]);
|
||||
|
||||
return new Response($datas);
|
||||
})
|
||||
@@ -249,12 +249,12 @@ class Feed implements ControllerProviderInterface
|
||||
null, $renew
|
||||
);
|
||||
|
||||
$output = array(
|
||||
$output = [
|
||||
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
|
||||
. '</p><p>' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '</p>
|
||||
<div><input type="text" readonly="readonly" class="input_select_copy" value="' . $link->getURI() . '"/></div>',
|
||||
'titre' => _('publications::votre rss personnel')
|
||||
);
|
||||
];
|
||||
|
||||
return $app->json($output);
|
||||
})->bind('prod_feeds_subscribe_aggregated');
|
||||
@@ -268,12 +268,12 @@ class Feed implements ControllerProviderInterface
|
||||
}
|
||||
$link = $app['feed.user-link-generator']->generate($feed, $app['authentication']->getUser(), FeedLinkGenerator::FORMAT_RSS, null, $renew);
|
||||
|
||||
$output = array(
|
||||
$output = [
|
||||
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
|
||||
. '</p><p>' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '</p>
|
||||
<div><input type="text" style="width:100%" value="' . $link->getURI() . '"/></div>',
|
||||
'titre' => _('publications::votre rss personnel')
|
||||
);
|
||||
];
|
||||
|
||||
return $app->json($output);
|
||||
})
|
||||
|
@@ -29,7 +29,7 @@ class Language implements ControllerProviderInterface
|
||||
|
||||
$controller->get("/", function (Application $app) {
|
||||
|
||||
$out = array();
|
||||
$out = [];
|
||||
$out['thesaurusBasesChanged'] = _('prod::recherche: Attention : la liste des bases selectionnees pour la recherche a ete changee.');
|
||||
$out['confirmDel'] = _('paniers::Vous etes sur le point de supprimer ce panier. Cette action est irreversible. Souhaitez-vous continuer ?');
|
||||
$out['serverError'] = _('phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique');
|
||||
|
@@ -87,7 +87,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
*/
|
||||
public function listElement(Application $app, Request $request)
|
||||
{
|
||||
$baseIds = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(array('canaddrecord')));
|
||||
$baseIds = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(['canaddrecord']));
|
||||
|
||||
$lazaretFiles = null;
|
||||
|
||||
@@ -100,7 +100,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
return $app['twig']->render(
|
||||
'prod/upload/lazaret.html.twig', array('lazaretFiles' => $lazaretFiles)
|
||||
'prod/upload/lazaret.html.twig', ['lazaretFiles' => $lazaretFiles]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
*/
|
||||
public function getElement(Application $app, Request $request, $file_id)
|
||||
{
|
||||
$ret = array('success' => false, 'message' => '', 'result' => array());
|
||||
$ret = ['success' => false, 'message' => '', 'result' => []];
|
||||
|
||||
$lazaretFile = $app['EM']->find('Alchemy\Phrasea\Model\Entities\LazaretFile', $file_id);
|
||||
|
||||
@@ -126,7 +126,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
return $app->json($ret);
|
||||
}
|
||||
|
||||
$file = array(
|
||||
$file = [
|
||||
'filename' => $lazaretFile->getOriginalName(),
|
||||
'base_id' => $lazaretFile->getBaseId(),
|
||||
'created' => $lazaretFile->getCreated()->format(\DateTime::ATOM),
|
||||
@@ -134,7 +134,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
'pathname' => $app['root.path'] . '/tmp/lazaret/' . $lazaretFile->getFilename(),
|
||||
'sha256' => $lazaretFile->getSha256(),
|
||||
'uuid' => $lazaretFile->getUuid(),
|
||||
);
|
||||
];
|
||||
|
||||
$ret['result'] = $file;
|
||||
$ret['success'] = true;
|
||||
@@ -157,11 +157,11 @@ class Lazaret implements ControllerProviderInterface
|
||||
*/
|
||||
public function addElement(Application $app, Request $request, $file_id)
|
||||
{
|
||||
$ret = array('success' => false, 'message' => '', 'result' => array());
|
||||
$ret = ['success' => false, 'message' => '', 'result' => []];
|
||||
|
||||
//Optional parameter
|
||||
$keepAttributes = !!$request->request->get('keep_attributes', false);
|
||||
$attributesToKeep = $request->request->get('attributes', array());
|
||||
$attributesToKeep = $request->request->get('attributes', []);
|
||||
|
||||
//Mandatory parameter
|
||||
if (null === $request->request->get('bas_id')) {
|
||||
@@ -258,7 +258,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
try {
|
||||
$app['filesystem']->remove(array($lazaretFileName, $lazaretThumbFileName));
|
||||
$app['filesystem']->remove([$lazaretFileName, $lazaretThumbFileName]);
|
||||
} catch (IOException $e) {
|
||||
|
||||
}
|
||||
@@ -277,7 +277,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
*/
|
||||
public function denyElement(Application $app, Request $request, $file_id)
|
||||
{
|
||||
$ret = array('success' => false, 'message' => '', 'result' => array());
|
||||
$ret = ['success' => false, 'message' => '', 'result' => []];
|
||||
|
||||
$lazaretFile = $app['EM']->find('Alchemy\Phrasea\Model\Entities\LazaretFile', $file_id);
|
||||
/* @var $lazaretFile LazaretFile */
|
||||
@@ -306,7 +306,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
$app['EM']->flush();
|
||||
|
||||
try {
|
||||
$app['filesystem']->remove(array($lazaretFileName, $lazaretThumbFileName));
|
||||
$app['filesystem']->remove([$lazaretFileName, $lazaretThumbFileName]);
|
||||
} catch (IOException $e) {
|
||||
|
||||
}
|
||||
@@ -324,7 +324,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
*/
|
||||
public function emptyLazaret(Application $app, Request $request)
|
||||
{
|
||||
$ret = array('success' => false, 'message' => '', 'result' => array());
|
||||
$ret = ['success' => false, 'message' => '', 'result' => []];
|
||||
|
||||
$lazaretFiles = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\LazaretFile')->findAll();
|
||||
|
||||
@@ -355,7 +355,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
*/
|
||||
public function acceptElement(Application $app, Request $request, $file_id)
|
||||
{
|
||||
$ret = array('success' => false, 'message' => '', 'result' => array());
|
||||
$ret = ['success' => false, 'message' => '', 'result' => []];
|
||||
|
||||
//Mandatory parameter
|
||||
if (null === $recordId = $request->request->get('record_id')) {
|
||||
@@ -416,7 +416,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
try {
|
||||
$app['filesystem']->remove(array($lazaretFileName, $lazaretThumbFileName));
|
||||
$app['filesystem']->remove([$lazaretFileName, $lazaretThumbFileName]);
|
||||
} catch (IOException $e) {
|
||||
|
||||
}
|
||||
|
@@ -46,32 +46,32 @@ class MoveCollection implements ControllerProviderInterface
|
||||
|
||||
public function displayForm(Application $app, Request $request)
|
||||
{
|
||||
$records = RecordsRequest::fromRequest($app, $request, false, array('candeleterecord'));
|
||||
$records = RecordsRequest::fromRequest($app, $request, false, ['candeleterecord']);
|
||||
|
||||
$sbas_ids = array_map(function (\databox $databox) {
|
||||
return $databox->get_sbas_id();
|
||||
}, $records->databoxes());
|
||||
|
||||
$collections = $app['acl']->get($app['authentication']->getUser())
|
||||
->get_granted_base(array('canaddrecord'), $sbas_ids);
|
||||
->get_granted_base(['canaddrecord'], $sbas_ids);
|
||||
|
||||
$parameters = array(
|
||||
$parameters = [
|
||||
'records' => $records,
|
||||
'message' => '',
|
||||
'collections' => $collections,
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('prod/actions/collection_default.html.twig', $parameters);
|
||||
}
|
||||
|
||||
public function apply(Application $app, Request $request)
|
||||
{
|
||||
$records = RecordsRequest::fromRequest($app, $request, false, array('candeleterecord'));
|
||||
$records = RecordsRequest::fromRequest($app, $request, false, ['candeleterecord']);
|
||||
|
||||
$datas = array(
|
||||
$datas = [
|
||||
'success' => false,
|
||||
'message' => '',
|
||||
);
|
||||
];
|
||||
|
||||
try {
|
||||
if (null === $request->request->get('base_id')) {
|
||||
@@ -106,15 +106,15 @@ class MoveCollection implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'success' => true,
|
||||
'message' => _('Records have been successfuly moved'),
|
||||
);
|
||||
];
|
||||
} catch (\Exception $e) {
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'success' => false,
|
||||
'message' => _('An error occured'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return $app->json($ret);
|
||||
|
@@ -91,10 +91,10 @@ class Order implements ControllerProviderInterface
|
||||
{
|
||||
$success = false;
|
||||
$collectionHasOrderAdmins = new ArrayCollection();
|
||||
$toRemove = array();
|
||||
$toRemove = [];
|
||||
|
||||
$records = RecordsRequest::fromRequest($app, $request, true, array('cancmd'));
|
||||
$hasOneAdmin = array();
|
||||
$records = RecordsRequest::fromRequest($app, $request, true, ['cancmd']);
|
||||
$hasOneAdmin = [];
|
||||
|
||||
if (!$records->isEmpty()) {
|
||||
$order = new OrderEntity();
|
||||
@@ -110,8 +110,8 @@ class Order implements ControllerProviderInterface
|
||||
|
||||
if (!isset($hasOneAdmin[$record->get_base_id()])) {
|
||||
$query = new \User_Query($app);
|
||||
$hasOneAdmin[$record->get_base_id()] = (Boolean) count($query->on_base_ids(array($record->get_base_id()))
|
||||
->who_have_right(array('order_master'))
|
||||
$hasOneAdmin[$record->get_base_id()] = (Boolean) count($query->on_base_ids([$record->get_base_id()])
|
||||
->who_have_right(['order_master'])
|
||||
->execute()->get_results());
|
||||
}
|
||||
|
||||
@@ -146,10 +146,10 @@ class Order implements ControllerProviderInterface
|
||||
$order->setTodo($order->getElements()->count());
|
||||
|
||||
try {
|
||||
$app['events-manager']->trigger('__NEW_ORDER__', array(
|
||||
$app['events-manager']->trigger('__NEW_ORDER__', [
|
||||
'order_id' => $order->getId(),
|
||||
'usr_id' => $order->getUsrId()
|
||||
));
|
||||
]);
|
||||
$success = true;
|
||||
|
||||
$app['EM']->persist($order);
|
||||
@@ -168,16 +168,16 @@ class Order implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $msg,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('prod_orders', array(
|
||||
return $app->redirectPath('prod_orders', [
|
||||
'success' => (int) $success,
|
||||
'action' => 'send'
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,19 +195,19 @@ class Order implements ControllerProviderInterface
|
||||
$perPage = (int) $request->query->get('per-page', 10);
|
||||
$sort = $request->query->get('sort');
|
||||
|
||||
$baseIds = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(array('order_master')));
|
||||
$baseIds = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(['order_master']));
|
||||
|
||||
$ordersList = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Order')->listOrders($baseIds, $offsetStart, $perPage, $sort);
|
||||
$total = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Order')->countTotalOrders($baseIds);
|
||||
|
||||
return $app['twig']->render('prod/orders/order_box.html.twig', array(
|
||||
return $app['twig']->render('prod/orders/order_box.html.twig', [
|
||||
'page' => $page,
|
||||
'perPage' => $perPage,
|
||||
'total' => $total,
|
||||
'previousPage' => $page < 2 ? false : ($page - 1),
|
||||
'nextPage' => $page >= ceil($total / $perPage) ? false : $page + 1,
|
||||
'orders' => new ArrayCollection($ordersList)
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -225,9 +225,9 @@ class Order implements ControllerProviderInterface
|
||||
throw new NotFoundHttpException('Order not found');
|
||||
}
|
||||
|
||||
return $app['twig']->render('prod/orders/order_item.html.twig', array(
|
||||
return $app['twig']->render('prod/orders/order_item.html.twig', [
|
||||
'order' => $order
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -261,7 +261,7 @@ class Order implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
$n = 0;
|
||||
$elements = $request->request->get('elements', array());
|
||||
$elements = $request->request->get('elements', []);
|
||||
foreach ($order->getElements() as $orderElement) {
|
||||
if (in_array($orderElement->getId(), $elements)) {
|
||||
$sbas_id = \phrasea::sbasFromBas($app, $orderElement->getBaseId());
|
||||
@@ -286,12 +286,12 @@ class Order implements ControllerProviderInterface
|
||||
if ($n > 0) {
|
||||
$order->setTodo($order->getTodo() - $n);
|
||||
|
||||
$app['events-manager']->trigger('__ORDER_DELIVER__', array(
|
||||
$app['events-manager']->trigger('__ORDER_DELIVER__', [
|
||||
'ssel_id' => $order->getBasket()->getId(),
|
||||
'from' => $app['authentication']->getUser()->get_id(),
|
||||
'to' => $dest_user->get_id(),
|
||||
'n' => $n
|
||||
));
|
||||
]);
|
||||
}
|
||||
$success = true;
|
||||
|
||||
@@ -304,17 +304,17 @@ class Order implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Order has been sent') : _('An error occured while sending, please retry or contact an admin if problem persists'),
|
||||
'order_id' => $order_id
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('prod_orders', array(
|
||||
return $app->redirectPath('prod_orders', [
|
||||
'success' => (int) $success,
|
||||
'action' => 'send'
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,7 +334,7 @@ class Order implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
$n = 0;
|
||||
$elements = $request->request->get('elements', array());
|
||||
$elements = $request->request->get('elements', []);
|
||||
foreach ($order->getElements() as $orderElement) {
|
||||
if (in_array($orderElement->getId(),$elements)) {
|
||||
$orderElement->setOrderMasterId($app['authentication']->getUser()->get_id());
|
||||
@@ -349,11 +349,11 @@ class Order implements ControllerProviderInterface
|
||||
if ($n > 0) {
|
||||
$order->setTodo($order->getTodo() - $n);
|
||||
|
||||
$app['events-manager']->trigger('__ORDER_NOT_DELIVERED__', array(
|
||||
$app['events-manager']->trigger('__ORDER_NOT_DELIVERED__', [
|
||||
'from' => $app['authentication']->getUser()->get_id(),
|
||||
'to' => $order->getUsrId(),
|
||||
'n' => $n
|
||||
));
|
||||
]);
|
||||
}
|
||||
$success = true;
|
||||
|
||||
@@ -364,16 +364,16 @@ class Order implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json(array(
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('Order has been denied') : _('An error occured while denying, please retry or contact an admin if problem persists'),
|
||||
'order_id' => $order_id
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('prod_orders', array(
|
||||
return $app->redirectPath('prod_orders', [
|
||||
'success' => (int) $success,
|
||||
'action' => 'send'
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ class Printer implements ControllerProviderInterface
|
||||
$controllers->post('/', function (Application $app) {
|
||||
$printer = new RecordHelper\Printer($app, $app['request']);
|
||||
|
||||
return $app['twig']->render('prod/actions/printer_default.html.twig', array('printer' => $printer, 'message' => ''));
|
||||
return $app['twig']->render('prod/actions/printer_default.html.twig', ['printer' => $printer, 'message' => '']);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -50,7 +50,7 @@ class Printer implements ControllerProviderInterface
|
||||
}
|
||||
$PDF = new PDFExport($app, $printer->get_elements(), $layout);
|
||||
|
||||
$response = new Response($PDF->render(), 200, array('Content-Type' => 'application/pdf'));
|
||||
$response = new Response($PDF->render(), 200, ['Content-Type' => 'application/pdf']);
|
||||
$response->headers->set('Pragma', 'public', true);
|
||||
$response->setMaxAge(0);
|
||||
|
||||
|
@@ -61,16 +61,16 @@ class Property implements ControllerProviderInterface
|
||||
$app->abort(400);
|
||||
}
|
||||
|
||||
$records = RecordsRequest::fromRequest($app, $request, false, array('chgstatus'));
|
||||
$records = RecordsRequest::fromRequest($app, $request, false, ['chgstatus']);
|
||||
$databoxStatus = \databox_status::getDisplayStatus($app);
|
||||
$statusBit = $nRec = array();
|
||||
$statusBit = $nRec = [];
|
||||
|
||||
foreach ($records as $record) {
|
||||
//perform logic
|
||||
$sbasId = $record->get_databox()->get_sbas_id();
|
||||
|
||||
if (!isset($nRec[$sbasId])) {
|
||||
$nRec[$sbasId] = array('stories' => 0, 'records' => 0);
|
||||
$nRec[$sbasId] = ['stories' => 0, 'records' => 0];
|
||||
}
|
||||
|
||||
$nRec[$sbasId]['records']++;
|
||||
@@ -80,7 +80,7 @@ class Property implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if (!isset($statusBit[$sbasId])) {
|
||||
$statusBit[$sbasId] = isset($databoxStatus[$sbasId]) ? $databoxStatus[$sbasId] : array();
|
||||
$statusBit[$sbasId] = isset($databoxStatus[$sbasId]) ? $databoxStatus[$sbasId] : [];
|
||||
|
||||
foreach (array_keys($statusBit[$sbasId]) as $bit) {
|
||||
$statusBit[$sbasId][$bit]['nset'] = 0;
|
||||
@@ -101,11 +101,11 @@ class Property implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return new Response($app['twig']->render('prod/actions/Property/index.html.twig', array(
|
||||
return new Response($app['twig']->render('prod/actions/Property/index.html.twig', [
|
||||
'records' => $records,
|
||||
'statusBit' => $statusBit,
|
||||
'nRec' => $nRec
|
||||
)));
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,29 +121,29 @@ class Property implements ControllerProviderInterface
|
||||
$app->abort(400);
|
||||
}
|
||||
|
||||
$records = RecordsRequest::fromRequest($app, $request, false, array('canmodifrecord'));
|
||||
$records = RecordsRequest::fromRequest($app, $request, false, ['canmodifrecord']);
|
||||
|
||||
$recordsType = array();
|
||||
$recordsType = [];
|
||||
|
||||
foreach ($records as $record) {
|
||||
//perform logic
|
||||
$sbasId = $record->get_databox()->get_sbas_id();
|
||||
|
||||
if (!isset($recordsType[$sbasId])) {
|
||||
$recordsType[$sbasId] = array();
|
||||
$recordsType[$sbasId] = [];
|
||||
}
|
||||
|
||||
if (!isset($recordsType[$sbasId][$record->get_type()])) {
|
||||
$recordsType[$sbasId][$record->get_type()] = array();
|
||||
$recordsType[$sbasId][$record->get_type()] = [];
|
||||
}
|
||||
|
||||
$recordsType[$sbasId][$record->get_type()][] = $record;
|
||||
}
|
||||
|
||||
return new Response($app['twig']->render('prod/actions/Property/type.html.twig', array(
|
||||
return new Response($app['twig']->render('prod/actions/Property/type.html.twig', [
|
||||
'records' => $records,
|
||||
'recordsType' => $recordsType,
|
||||
)));
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,9 +155,9 @@ class Property implements ControllerProviderInterface
|
||||
*/
|
||||
public function changeStatus(Application $app, Request $request)
|
||||
{
|
||||
$applyStatusToChildren = $request->request->get('apply_to_children', array());
|
||||
$records = RecordsRequest::fromRequest($app, $request, false, array('chgstatus'));
|
||||
$updated = array();
|
||||
$applyStatusToChildren = $request->request->get('apply_to_children', []);
|
||||
$records = RecordsRequest::fromRequest($app, $request, false, ['chgstatus']);
|
||||
$updated = [];
|
||||
$postStatus = (array) $request->request->get('status');
|
||||
|
||||
foreach ($records as $record) {
|
||||
@@ -178,7 +178,7 @@ class Property implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app->json(array('success' => true, 'updated' => $updated), 201);
|
||||
return $app->json(['success' => true, 'updated' => $updated], 201);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,10 +190,10 @@ class Property implements ControllerProviderInterface
|
||||
*/
|
||||
public function changeType(Application $app, Request $request)
|
||||
{
|
||||
$typeLst = $request->request->get('types', array());
|
||||
$records = RecordsRequest::fromRequest($app, $request, false, array('canmodifrecord'));
|
||||
$typeLst = $request->request->get('types', []);
|
||||
$records = RecordsRequest::fromRequest($app, $request, false, ['canmodifrecord']);
|
||||
$forceType = $request->request->get('force_types', '');
|
||||
$updated = array();
|
||||
$updated = [];
|
||||
|
||||
foreach ($records as $record) {
|
||||
try {
|
||||
@@ -208,7 +208,7 @@ class Property implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app->json(array('success' => true, 'updated' => $updated), 201);
|
||||
return $app->json(['success' => true, 'updated' => $updated], 201);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -233,10 +233,10 @@ class Property implements ControllerProviderInterface
|
||||
|
||||
$record->set_binary_status(strrev($newStatus));
|
||||
|
||||
return array(
|
||||
return [
|
||||
'current_status' => $currentStatus,
|
||||
'new_status' => $newStatus
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@@ -36,9 +36,9 @@ class Push implements ControllerProviderInterface
|
||||
protected function getUserFormatter()
|
||||
{
|
||||
return function (\User_Adapter $user) {
|
||||
$subtitle = array_filter(array($user->get_job(), $user->get_company()));
|
||||
$subtitle = array_filter([$user->get_job(), $user->get_company()]);
|
||||
|
||||
return array(
|
||||
return [
|
||||
'type' => 'USER'
|
||||
, 'usr_id' => $user->get_id()
|
||||
, 'firstname' => $user->get_firstname()
|
||||
@@ -46,7 +46,7 @@ class Push implements ControllerProviderInterface
|
||||
, 'email' => $user->get_email()
|
||||
, 'display_name' => $user->get_display_name()
|
||||
, 'subtitle' => implode(', ', $subtitle)
|
||||
);
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -55,23 +55,23 @@ class Push implements ControllerProviderInterface
|
||||
$userFormatter = $this->getUserFormatter();
|
||||
|
||||
return function (UsrList $List) use ($userFormatter, $app) {
|
||||
$entries = array();
|
||||
$entries = [];
|
||||
|
||||
foreach ($List->getEntries() as $entry) {
|
||||
/* @var $entry UsrListEntry */
|
||||
$entries[] = array(
|
||||
$entries[] = [
|
||||
'Id' => $entry->getId(),
|
||||
'User' => $userFormatter($entry->getUser($app))
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return array(
|
||||
return [
|
||||
'type' => 'LIST'
|
||||
, 'list_id' => $List->getId()
|
||||
, 'name' => $List->getName()
|
||||
, 'length' => count($entries)
|
||||
, 'entries' => $entries
|
||||
);
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -125,13 +125,13 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$RecommendedUsers = $userSelection($push->get_elements());
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'push' => $push,
|
||||
'message' => '',
|
||||
'lists' => $repository->findUserLists($app['authentication']->getUser()),
|
||||
'context' => 'Push',
|
||||
'RecommendedUsers' => $RecommendedUsers
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('prod/actions/Push.html.twig', $params);
|
||||
});
|
||||
@@ -143,13 +143,13 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$RecommendedUsers = $userSelection($push->get_elements());
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'push' => $push,
|
||||
'message' => '',
|
||||
'lists' => $repository->findUserLists($app['authentication']->getUser()),
|
||||
'context' => 'Feedback',
|
||||
'RecommendedUsers' => $RecommendedUsers
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('prod/actions/Push.html.twig', $params);
|
||||
});
|
||||
@@ -157,10 +157,10 @@ class Push implements ControllerProviderInterface
|
||||
$controllers->post('/send/', function (Application $app) {
|
||||
$request = $app['request'];
|
||||
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'success' => false,
|
||||
'message' => _('Unable to send the documents')
|
||||
);
|
||||
];
|
||||
|
||||
try {
|
||||
$pusher = new RecordHelper\Push($app, $app['request']);
|
||||
@@ -220,7 +220,7 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$app['EM']->flush();
|
||||
|
||||
$url = $app->url('lightbox_compare', array(
|
||||
$url = $app->url('lightbox_compare', [
|
||||
'basket' => $Basket->getId(),
|
||||
'LOG' => $app['tokens']->getUrlToken(
|
||||
\random::TYPE_VIEW,
|
||||
@@ -228,11 +228,11 @@ class Push implements ControllerProviderInterface
|
||||
null,
|
||||
$Basket->getId()
|
||||
)
|
||||
));
|
||||
]);
|
||||
|
||||
$receipt = $request->get('recept') ? $app['authentication']->getUser()->get_email() : '';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'from' => $app['authentication']->getUser()->get_id()
|
||||
, 'from_email' => $app['authentication']->getUser()->get_email()
|
||||
, 'to' => $user_receiver->get_id()
|
||||
@@ -242,7 +242,7 @@ class Push implements ControllerProviderInterface
|
||||
, 'accuse' => $receipt
|
||||
, 'message' => $request->request->get('message')
|
||||
, 'ssel_id' => $Basket->getId()
|
||||
);
|
||||
];
|
||||
|
||||
$app['events-manager']->trigger('__PUSH_DATAS__', $params);
|
||||
}
|
||||
@@ -258,10 +258,10 @@ class Push implements ControllerProviderInterface
|
||||
, count($receivers)
|
||||
);
|
||||
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'success' => true,
|
||||
'message' => $message
|
||||
);
|
||||
];
|
||||
} catch (ControllerException $e) {
|
||||
$ret['message'] = $e->getMessage() . $e->getFile() . $e->getLine();
|
||||
}
|
||||
@@ -272,10 +272,10 @@ class Push implements ControllerProviderInterface
|
||||
$controllers->post('/validate/', function (Application $app) {
|
||||
$request = $app['request'];
|
||||
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'success' => false,
|
||||
'message' => _('Unable to send the documents')
|
||||
);
|
||||
];
|
||||
|
||||
$app['EM']->beginTransaction();
|
||||
|
||||
@@ -349,16 +349,16 @@ class Push implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
$participants[$app['authentication']->getUser()->get_id()] = array(
|
||||
$participants[$app['authentication']->getUser()->get_id()] = [
|
||||
'see_others' => 1,
|
||||
'usr_id' => $app['authentication']->getUser()->get_id(),
|
||||
'agree' => 0,
|
||||
'HD' => 0
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($participants as $key => $participant) {
|
||||
foreach (array('see_others', 'usr_id', 'agree', 'HD') as $mandatoryparam) {
|
||||
foreach (['see_others', 'usr_id', 'agree', 'HD'] as $mandatoryparam) {
|
||||
if (!array_key_exists($mandatoryparam, $participant))
|
||||
throw new ControllerException(sprintf(_('Missing mandatory parameter %s'), $mandatoryparam));
|
||||
}
|
||||
@@ -418,7 +418,7 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$app['EM']->flush();
|
||||
|
||||
$url = $app->url('lightbox_validation', array(
|
||||
$url = $app->url('lightbox_validation', [
|
||||
'basket' => $Basket->getId(),
|
||||
'LOG' => $app['tokens']->getUrlToken(
|
||||
\random::TYPE_VALIDATE,
|
||||
@@ -426,11 +426,11 @@ class Push implements ControllerProviderInterface
|
||||
null,
|
||||
$Basket->getId()
|
||||
)
|
||||
));
|
||||
]);
|
||||
|
||||
$receipt = $request->get('recept') ? $app['authentication']->getUser()->get_email() : '';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'from' => $app['authentication']->getUser()->get_id(),
|
||||
'from_email' => $app['authentication']->getUser()->get_email(),
|
||||
'to' => $participant_user->get_id(),
|
||||
@@ -441,7 +441,7 @@ class Push implements ControllerProviderInterface
|
||||
'message' => $request->request->get('message'),
|
||||
'ssel_id' => $Basket->getId(),
|
||||
'duration' => (int) $request->request->get('duration'),
|
||||
);
|
||||
];
|
||||
|
||||
$app['events-manager']->trigger('__PUSH_VALIDATION__', $params);
|
||||
}
|
||||
@@ -457,10 +457,10 @@ class Push implements ControllerProviderInterface
|
||||
, count($request->request->get('participants'))
|
||||
);
|
||||
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'success' => true,
|
||||
'message' => $message
|
||||
);
|
||||
];
|
||||
|
||||
$app['EM']->commit();
|
||||
} catch (ControllerException $e) {
|
||||
@@ -478,9 +478,9 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$query = new \User_Query($app);
|
||||
|
||||
$query->on_bases_where_i_am($app['acl']->get($app['authentication']->getUser()), array('canpush'));
|
||||
$query->on_bases_where_i_am($app['acl']->get($app['authentication']->getUser()), ['canpush']);
|
||||
|
||||
$query->in(array($usr_id));
|
||||
$query->in([$usr_id]);
|
||||
|
||||
$result = $query->include_phantoms()
|
||||
->limit(0, 1)
|
||||
@@ -512,7 +512,7 @@ class Push implements ControllerProviderInterface
|
||||
->assert('list_id', '\d+');
|
||||
|
||||
$controllers->post('/add-user/', function (Application $app, Request $request) use ($userFormatter) {
|
||||
$result = array('success' => false, 'message' => '', 'user' => null);
|
||||
$result = ['success' => false, 'message' => '', 'user' => null];
|
||||
|
||||
try {
|
||||
if (!$app['acl']->get($app['authentication']->getUser())->has_right('manageusers'))
|
||||
@@ -577,7 +577,7 @@ class Push implements ControllerProviderInterface
|
||||
})->bind('prod_push_do_add_user');
|
||||
|
||||
$controllers->get('/add-user/', function (Application $app, Request $request) {
|
||||
$params = array('callback' => $request->query->get('callback'));
|
||||
$params = ['callback' => $request->query->get('callback')];
|
||||
|
||||
return $app['twig']->render('prod/User/Add.html.twig', $params);
|
||||
})->bind('prod_push_add_user');
|
||||
@@ -587,7 +587,7 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$query = new \User_Query($app);
|
||||
|
||||
$query->on_bases_where_i_am($app['acl']->get($app['authentication']->getUser()), array('canpush'));
|
||||
$query->on_bases_where_i_am($app['acl']->get($app['authentication']->getUser()), ['canpush']);
|
||||
|
||||
$query->like(\User_Query::LIKE_FIRSTNAME, $request->query->get('query'))
|
||||
->like(\User_Query::LIKE_LASTNAME, $request->query->get('query'))
|
||||
@@ -602,7 +602,7 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$lists = $repository->findUserListLike($app['authentication']->getUser(), $request->query->get('query'));
|
||||
|
||||
$datas = array();
|
||||
$datas = [];
|
||||
|
||||
if ($lists) {
|
||||
foreach ($lists as $list) {
|
||||
@@ -627,7 +627,7 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$query = new \User_Query($app);
|
||||
|
||||
$query->on_bases_where_i_am($app['acl']->get($app['authentication']->getUser()), array('canpush'));
|
||||
$query->on_bases_where_i_am($app['acl']->get($app['authentication']->getUser()), ['canpush']);
|
||||
|
||||
if ($request->get('query')) {
|
||||
$query->like($request->get('like_field'), $request->get('query'))
|
||||
@@ -661,13 +661,13 @@ class Push implements ControllerProviderInterface
|
||||
->limit($offset_start, $perPage)
|
||||
->execute()->get_results();
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
'query' => $query
|
||||
, 'results' => $results
|
||||
, 'list' => $list
|
||||
, 'sort' => $sort
|
||||
, 'ord' => $ord
|
||||
);
|
||||
];
|
||||
|
||||
if ($request->get('type') === 'fragment') {
|
||||
return new Response(
|
||||
|
@@ -61,7 +61,7 @@ class Query implements ControllerProviderInterface
|
||||
|
||||
$mod = $app['authentication']->getUser()->getPrefs('view');
|
||||
|
||||
$json = array();
|
||||
$json = [];
|
||||
|
||||
$options = SearchEngineOptions::fromRequest($app, $request);
|
||||
|
||||
@@ -196,12 +196,12 @@ class Query implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$json['results'] = $app['twig']->render($template, array(
|
||||
$json['results'] = $app['twig']->render($template, [
|
||||
'results' => $result,
|
||||
'highlight' => $result->getQuery(),
|
||||
'searchEngine' => $app['phraseanet.SE'],
|
||||
'suggestions' => $prop
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$json['query'] = $query;
|
||||
@@ -239,12 +239,12 @@ class Query implements ControllerProviderInterface
|
||||
|
||||
$record = new \record_preview($app, 'RESULT', $pos, '', $app['phraseanet.SE'], $query);
|
||||
|
||||
return $app->json(array(
|
||||
'current' => $app['twig']->render('prod/preview/result_train.html.twig', array(
|
||||
return $app->json([
|
||||
'current' => $app['twig']->render('prod/preview/result_train.html.twig', [
|
||||
'records' => $record->get_train($pos, $query, $app['phraseanet.SE']),
|
||||
'selected' => $pos
|
||||
))
|
||||
));
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,9 +258,9 @@ class Query implements ControllerProviderInterface
|
||||
{
|
||||
$record = new \record_preview($app, 'REG', $request->request->get('pos'), $request->request->get('cont'));
|
||||
|
||||
return new Response($app['twig']->render('prod/preview/reg_train.html.twig', array(
|
||||
return new Response($app['twig']->render('prod/preview/reg_train.html.twig', [
|
||||
'container_records' => $record->get_container()->get_children(),
|
||||
'record' => $record
|
||||
)));
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
@@ -96,48 +96,48 @@ class Records implements ControllerProviderInterface
|
||||
|
||||
if ($record->is_from_reg()) {
|
||||
$train = $app['twig']->render('prod/preview/reg_train.html.twig',
|
||||
array('record' => $record)
|
||||
['record' => $record]
|
||||
);
|
||||
}
|
||||
|
||||
if ($record->is_from_basket() && $reloadTrain) {
|
||||
$train = $app['twig']->render('prod/preview/basket_train.html.twig',
|
||||
array('record' => $record)
|
||||
['record' => $record]
|
||||
);
|
||||
}
|
||||
|
||||
if ($record->is_from_feed()) {
|
||||
$train = $app['twig']->render('prod/preview/feed_train.html.twig',
|
||||
array('record' => $record)
|
||||
['record' => $record]
|
||||
);
|
||||
}
|
||||
|
||||
return $app->json(array(
|
||||
"desc" => $app['twig']->render('prod/preview/caption.html.twig', array(
|
||||
return $app->json([
|
||||
"desc" => $app['twig']->render('prod/preview/caption.html.twig', [
|
||||
'record' => $record,
|
||||
'highlight' => $query,
|
||||
'searchEngine' => $searchEngine
|
||||
)),
|
||||
"html_preview" => $app['twig']->render('common/preview.html.twig', array(
|
||||
]),
|
||||
"html_preview" => $app['twig']->render('common/preview.html.twig', [
|
||||
'record' => $record
|
||||
)),
|
||||
"others" => $app['twig']->render('prod/preview/appears_in.html.twig', array(
|
||||
]),
|
||||
"others" => $app['twig']->render('prod/preview/appears_in.html.twig', [
|
||||
'parents' => $record->get_grouping_parents(),
|
||||
'baskets' => $record->get_container_baskets($app['EM'], $app['authentication']->getUser())
|
||||
)),
|
||||
]),
|
||||
"current" => $train,
|
||||
"history" => $app['twig']->render('prod/preview/short_history.html.twig', array(
|
||||
"history" => $app['twig']->render('prod/preview/short_history.html.twig', [
|
||||
'record' => $record
|
||||
)),
|
||||
"popularity" => $app['twig']->render('prod/preview/popularity.html.twig', array(
|
||||
]),
|
||||
"popularity" => $app['twig']->render('prod/preview/popularity.html.twig', [
|
||||
'record' => $record
|
||||
)),
|
||||
"tools" => $app['twig']->render('prod/preview/tools.html.twig', array(
|
||||
]),
|
||||
"tools" => $app['twig']->render('prod/preview/tools.html.twig', [
|
||||
'record' => $record
|
||||
)),
|
||||
]),
|
||||
"pos" => $record->get_number(),
|
||||
"title" => $record->get_title($query, $searchEngine)
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,14 +149,14 @@ class Records implements ControllerProviderInterface
|
||||
*/
|
||||
public function doDeleteRecords(Application $app, Request $request)
|
||||
{
|
||||
$records = RecordsRequest::fromRequest($app, $request, !!$request->request->get('del_children'), array(
|
||||
$records = RecordsRequest::fromRequest($app, $request, !!$request->request->get('del_children'), [
|
||||
'candeleterecord'
|
||||
));
|
||||
]);
|
||||
|
||||
$basketElementsRepository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\BasketElement');
|
||||
$StoryWZRepository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\StoryWZ');
|
||||
|
||||
$deleted = array();
|
||||
$deleted = [];
|
||||
|
||||
foreach ($records as $record) {
|
||||
try {
|
||||
@@ -194,13 +194,13 @@ class Records implements ControllerProviderInterface
|
||||
*/
|
||||
public function whatCanIDelete(Application $app, Request $request)
|
||||
{
|
||||
$records = RecordsRequest::fromRequest($app, $request, !!$request->request->get('del_children'), array(
|
||||
$records = RecordsRequest::fromRequest($app, $request, !!$request->request->get('del_children'), [
|
||||
'candeleterecord'
|
||||
));
|
||||
]);
|
||||
|
||||
return $app['twig']->render('prod/actions/delete_records_confirm.html.twig', array(
|
||||
return $app['twig']->render('prod/actions/delete_records_confirm.html.twig', [
|
||||
'records' => $records
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -215,7 +215,7 @@ class Records implements ControllerProviderInterface
|
||||
{
|
||||
$records = RecordsRequest::fromRequest($app, $request, !!$request->request->get('renew_children_url'));
|
||||
|
||||
$renewed = array();
|
||||
$renewed = [];
|
||||
foreach ($records as $record) {
|
||||
$renewed[$record->get_serialize_key()] = $record->get_preview()->renew_url();
|
||||
};
|
||||
|
@@ -50,7 +50,7 @@ class Root implements ControllerProviderInterface
|
||||
|
||||
$cssPath = $app['root.path'] . '/www/skins/prod/';
|
||||
|
||||
$css = array();
|
||||
$css = [];
|
||||
$cssfile = false;
|
||||
|
||||
$finder = new Finder();
|
||||
@@ -87,25 +87,25 @@ class Root implements ControllerProviderInterface
|
||||
$queries_topics = \queries::tree_topics($app['locale.I18n']);
|
||||
}
|
||||
|
||||
$sbas = $bas2sbas = array();
|
||||
$sbas = $bas2sbas = [];
|
||||
|
||||
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||
$sbas_id = $databox->get_sbas_id();
|
||||
|
||||
$sbas['s' + $sbas_id] = array(
|
||||
$sbas['s' + $sbas_id] = [
|
||||
'sbid' => $sbas_id,
|
||||
'seeker' => null);
|
||||
'seeker' => null];
|
||||
|
||||
foreach ($databox->get_collections() as $coll) {
|
||||
$bas2sbas['b' . $coll->get_base_id()] = array(
|
||||
$bas2sbas['b' . $coll->get_base_id()] = [
|
||||
'sbid' => $sbas_id,
|
||||
'ckobj' => array('checked' => false),
|
||||
'ckobj' => ['checked' => false],
|
||||
'waschecked' => false
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $app['twig']->render('prod/index.html.twig', array(
|
||||
return $app['twig']->render('prod/index.html.twig', [
|
||||
'module_name' => 'Production',
|
||||
'WorkZone' => new Helper\WorkZone($app, $app['request']),
|
||||
'module_prod' => new Helper\Prod($app, $app['request']),
|
||||
@@ -127,7 +127,7 @@ class Root implements ControllerProviderInterface
|
||||
'thesau_json_sbas' => json_encode($sbas),
|
||||
'thesau_json_bas2sbas' => json_encode($bas2sbas),
|
||||
'thesau_languages' => $app['locales.available'],
|
||||
));
|
||||
]);
|
||||
})->bind('prod');
|
||||
|
||||
return $controllers;
|
||||
|
@@ -57,8 +57,8 @@ class Share implements ControllerProviderInterface
|
||||
$app->abort(403);
|
||||
}
|
||||
|
||||
return new Response($app['twig']->render('prod/Share/record.html.twig', array(
|
||||
return new Response($app['twig']->render('prod/Share/record.html.twig', [
|
||||
'record' => $record,
|
||||
)));
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ class Story implements ControllerProviderInterface
|
||||
});
|
||||
|
||||
$controllers->get('/create/', function (Application $app) {
|
||||
return $app['twig']->render('prod/Story/Create.html.twig', array());
|
||||
return $app['twig']->render('prod/Story/Create.html.twig', []);
|
||||
})->bind('prod_stories_create');
|
||||
|
||||
$controllers->post('/', function (Application $app, Request $request) {
|
||||
@@ -61,7 +61,7 @@ class Story implements ControllerProviderInterface
|
||||
$Story->appendChild($record);
|
||||
}
|
||||
|
||||
$metadatas = array();
|
||||
$metadatas = [];
|
||||
|
||||
foreach ($collection->get_databox()->get_meta_structure() as $meta) {
|
||||
if ($meta->get_thumbtitle()) {
|
||||
@@ -70,11 +70,11 @@ class Story implements ControllerProviderInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
$metadatas[] = array(
|
||||
$metadatas[] = [
|
||||
'meta_struct_id' => $meta->get_id()
|
||||
, 'meta_id' => null
|
||||
, 'value' => $value
|
||||
);
|
||||
];
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -90,29 +90,29 @@ class Story implements ControllerProviderInterface
|
||||
$app['EM']->flush();
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
$data = array(
|
||||
$data = [
|
||||
'success' => true
|
||||
, 'message' => _('Story created')
|
||||
, 'WorkZone' => $StoryWZ->getId()
|
||||
, 'story' => array(
|
||||
, 'story' => [
|
||||
'sbas_id' => $Story->get_sbas_id(),
|
||||
'record_id' => $Story->get_record_id(),
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
|
||||
return $app->json($data);
|
||||
} else {
|
||||
return $app->redirectPath('prod_stories_story', array(
|
||||
return $app->redirectPath('prod_stories_story', [
|
||||
'sbas_id' => $StoryWZ->getSbasId(),
|
||||
'record_id' => $StoryWZ->getRecordId(),
|
||||
));
|
||||
]);
|
||||
}
|
||||
})->bind('prod_stories_do_create');
|
||||
|
||||
$controllers->get('/{sbas_id}/{record_id}/', function (Application $app, $sbas_id, $record_id) {
|
||||
$Story = new \record_adapter($app, $sbas_id, $record_id);
|
||||
|
||||
$html = $app['twig']->render('prod/WorkZone/Story.html.twig', array('Story' => $Story));
|
||||
$html = $app['twig']->render('prod/WorkZone/Story.html.twig', ['Story' => $Story]);
|
||||
|
||||
return new Response($html);
|
||||
})
|
||||
@@ -139,15 +139,15 @@ class Story implements ControllerProviderInterface
|
||||
$n++;
|
||||
}
|
||||
|
||||
$data = array(
|
||||
$data = [
|
||||
'success' => true
|
||||
, 'message' => sprintf(_('%d records added'), $n)
|
||||
);
|
||||
];
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
return $app->json($data);
|
||||
} else {
|
||||
return $app->redirectPath('prod_stories_story', array('sbas_id' => $sbas_id,'record_id' => $record_id));
|
||||
return $app->redirectPath('prod_stories_story', ['sbas_id' => $sbas_id,'record_id' => $record_id]);
|
||||
}
|
||||
})->assert('sbas_id', '\d+')->assert('record_id', '\d+');
|
||||
|
||||
@@ -161,15 +161,15 @@ class Story implements ControllerProviderInterface
|
||||
|
||||
$Story->removeChild($record);
|
||||
|
||||
$data = array(
|
||||
$data = [
|
||||
'success' => true
|
||||
, 'message' => _('Record removed from story')
|
||||
);
|
||||
];
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
return $app->json($data);
|
||||
} else {
|
||||
return $app->redirectPath('prod_stories_story', array('sbas_id' => $sbas_id,'record_id' => $record_id));
|
||||
return $app->redirectPath('prod_stories_story', ['sbas_id' => $sbas_id,'record_id' => $record_id]);
|
||||
}
|
||||
})
|
||||
->bind('prod_stories_story_remove_element')
|
||||
@@ -191,7 +191,7 @@ class Story implements ControllerProviderInterface
|
||||
return new Response(
|
||||
$app['twig']->render(
|
||||
'prod/Story/Reorder.html.twig'
|
||||
, array('story' => $story)
|
||||
, ['story' => $story]
|
||||
)
|
||||
);
|
||||
})
|
||||
@@ -200,7 +200,7 @@ class Story implements ControllerProviderInterface
|
||||
->assert('record_id', '\d+');
|
||||
|
||||
$controllers->post('/{sbas_id}/{record_id}/reorder/', function (Application $app, $sbas_id, $record_id) {
|
||||
$ret = array('success' => false, 'message' => _('An error occured'));
|
||||
$ret = ['success' => false, 'message' => _('An error occured')];
|
||||
try {
|
||||
|
||||
$story = new \record_adapter($app, $sbas_id, $record_id);
|
||||
@@ -218,19 +218,19 @@ class Story implements ControllerProviderInterface
|
||||
$stmt = $story->get_databox()->get_connection()->prepare($sql);
|
||||
|
||||
foreach ($app['request']->request->get('element') as $record_id => $ord) {
|
||||
$params = array(
|
||||
$params = [
|
||||
':ord' => $ord,
|
||||
':parent_id' => $story->get_record_id(),
|
||||
':children_id' => $record_id
|
||||
);
|
||||
];
|
||||
$stmt->execute($params);
|
||||
}
|
||||
|
||||
$stmt->closeCursor();
|
||||
|
||||
$ret = array('success' => true, 'message' => _('Story updated'));
|
||||
$ret = ['success' => true, 'message' => _('Story updated')];
|
||||
} catch (ControllerException $e) {
|
||||
$ret = array('success' => false, 'message' => $e->getMessage());
|
||||
$ret = ['success' => false, 'message' => $e->getMessage()];
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
@@ -52,13 +52,13 @@ class TOU implements ControllerProviderInterface
|
||||
*/
|
||||
public function denyTermsOfUse(Application $app, Request $request, $sbas_id)
|
||||
{
|
||||
$ret = array('success' => false, 'message' => '');
|
||||
$ret = ['success' => false, 'message' => ''];
|
||||
|
||||
try {
|
||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||
|
||||
$app['acl']->get($app['authentication']->getUser())->revoke_access_from_bases(
|
||||
array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(array(), array($databox->get_sbas_id())))
|
||||
array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base([], [$databox->get_sbas_id()]))
|
||||
);
|
||||
$app['acl']->get($app['authentication']->getUser())->revoke_unused_sbas_rights();
|
||||
|
||||
@@ -81,8 +81,8 @@ class TOU implements ControllerProviderInterface
|
||||
*/
|
||||
public function displayTermsOfUse(Application $app, Request $request)
|
||||
{
|
||||
$toDisplay = $request->query->get('to_display', array());
|
||||
$data = array();
|
||||
$toDisplay = $request->query->get('to_display', []);
|
||||
$data = [];
|
||||
|
||||
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||
if (count($toDisplay) > 0 && !in_array($databox->get_sbas_id(), $toDisplay)) {
|
||||
@@ -98,9 +98,9 @@ class TOU implements ControllerProviderInterface
|
||||
$data[$databox->get_label($app['locale.I18n'])] = $cgus[$app['locale']]['value'];
|
||||
}
|
||||
|
||||
return new Response($app['twig']->render('/prod/TOU.html.twig', array(
|
||||
return new Response($app['twig']->render('/prod/TOU.html.twig', [
|
||||
'TOUs' => $data,
|
||||
'local_title' => _('Terms of use')
|
||||
)));
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
@@ -59,21 +59,21 @@ class Tools implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$var = array(
|
||||
$var = [
|
||||
'records' => $records,
|
||||
'record' => $record,
|
||||
'metadatas' => $metadatas,
|
||||
);
|
||||
];
|
||||
|
||||
return $app['twig']->render('prod/actions/Tools/index.html.twig', $var);
|
||||
});
|
||||
|
||||
$controllers->post('/rotate/', function (Application $app, Request $request) {
|
||||
$return = array('success' => true, 'errorMessage' => '');
|
||||
$return = ['success' => true, 'errorMessage' => ''];
|
||||
|
||||
$records = RecordsRequest::fromRequest($app, $request, false);
|
||||
|
||||
$rotation = in_array($request->request->get('rotation'), array('-90', '90', '180')) ? $request->request->get('rotation', 90) : 90;
|
||||
$rotation = in_array($request->request->get('rotation'), ['-90', '90', '180']) ? $request->request->get('rotation', 90) : 90;
|
||||
|
||||
foreach ($records as $record) {
|
||||
foreach ($record->get_subdefs() as $name => $subdef) {
|
||||
@@ -92,9 +92,9 @@ class Tools implements ControllerProviderInterface
|
||||
})->bind('prod_tools_rotate');
|
||||
|
||||
$controllers->post('/image/', function (Application $app, Request $request) {
|
||||
$return = array('success' => true);
|
||||
$return = ['success' => true];
|
||||
|
||||
$selection = RecordsRequest::fromRequest($app, $request, false, array('canmodifrecord'));
|
||||
$selection = RecordsRequest::fromRequest($app, $request, false, ['canmodifrecord']);
|
||||
|
||||
foreach ($selection as $record) {
|
||||
|
||||
@@ -169,10 +169,10 @@ class Tools implements ControllerProviderInterface
|
||||
$app->abort(400, 'Missing file parameter');
|
||||
}
|
||||
|
||||
return $app['twig']->render('prod/actions/Tools/iframeUpload.html.twig', array(
|
||||
return $app['twig']->render('prod/actions/Tools/iframeUpload.html.twig', [
|
||||
'success' => $success,
|
||||
'message' => $message,
|
||||
));
|
||||
]);
|
||||
})->bind('prod_tools_hd_substitution');
|
||||
|
||||
$controllers->post('/chgthumb/', function (Application $app, Request $request) {
|
||||
@@ -223,22 +223,22 @@ class Tools implements ControllerProviderInterface
|
||||
$app->abort(400, 'Missing file parameter');
|
||||
}
|
||||
|
||||
return $app['twig']->render('prod/actions/Tools/iframeUpload.html.twig', array(
|
||||
return $app['twig']->render('prod/actions/Tools/iframeUpload.html.twig', [
|
||||
'success' => $success,
|
||||
'message' => $message,
|
||||
));
|
||||
]);
|
||||
})->bind('prod_tools_thumbnail_substitution');
|
||||
|
||||
$controllers->post('/thumb-extractor/confirm-box/', function (Application $app, Request $request) {
|
||||
$return = array('error' => false, 'datas' => '');
|
||||
$return = ['error' => false, 'datas' => ''];
|
||||
$template = 'prod/actions/Tools/confirm.html.twig';
|
||||
|
||||
try {
|
||||
$record = new \record_adapter($app, $request->request->get('sbas_id'), $request->request->get('record_id'));
|
||||
$var = array(
|
||||
$var = [
|
||||
'video_title' => $record->get_title()
|
||||
, 'image' => $request->request->get('image', '')
|
||||
);
|
||||
];
|
||||
$return['datas'] = $app['twig']->render($template, $var);
|
||||
} catch (\Exception $e) {
|
||||
$return['datas'] = _('an error occured');
|
||||
@@ -249,7 +249,7 @@ class Tools implements ControllerProviderInterface
|
||||
});
|
||||
|
||||
$controllers->post('/thumb-extractor/apply/', function (Application $app, Request $request) {
|
||||
$return = array('success' => false, 'message' => '');
|
||||
$return = ['success' => false, 'message' => ''];
|
||||
|
||||
try {
|
||||
$record = new \record_adapter($app, $request->request->get('sbas_id'), $request->request->get('record_id'));
|
||||
|
@@ -84,14 +84,14 @@ class Tooltip implements ControllerProviderInterface
|
||||
|
||||
public function displayBasket(Application $app, Basket $basket)
|
||||
{
|
||||
return $app['twig']->render('prod/Tooltip/Basket.html.twig', array('basket' => $basket));
|
||||
return $app['twig']->render('prod/Tooltip/Basket.html.twig', ['basket' => $basket]);
|
||||
}
|
||||
|
||||
public function displayStory(Application $app, $sbas_id, $record_id)
|
||||
{
|
||||
$Story = new \record_adapter($app, $sbas_id, $record_id);
|
||||
|
||||
return $app['twig']->render('prod/Tooltip/Story.html.twig', array('Story' => $Story));
|
||||
return $app['twig']->render('prod/Tooltip/Story.html.twig', ['Story' => $Story]);
|
||||
}
|
||||
|
||||
public function displayUserBadge(Application $app, $usr_id)
|
||||
@@ -100,7 +100,7 @@ class Tooltip implements ControllerProviderInterface
|
||||
|
||||
return $app['twig']->render(
|
||||
'prod/Tooltip/User.html.twig'
|
||||
, array('user' => $user)
|
||||
, ['user' => $user]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ class Tooltip implements ControllerProviderInterface
|
||||
|
||||
return $app['twig']->render(
|
||||
'prod/Tooltip/Preview.html.twig'
|
||||
, array('record' => $record, 'not_wrapped' => true)
|
||||
, ['record' => $record, 'not_wrapped' => true]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -132,12 +132,12 @@ class Tooltip implements ControllerProviderInterface
|
||||
|
||||
return $app['twig']->render(
|
||||
'prod/Tooltip/Caption.html.twig'
|
||||
, array(
|
||||
, [
|
||||
'record' => $record,
|
||||
'view' => $context,
|
||||
'highlight' => $app['request']->request->get('query'),
|
||||
'searchEngine' => $search_engine,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
public function displayTechnicalDatas(Application $app, $sbas_id, $record_id)
|
||||
@@ -152,7 +152,7 @@ class Tooltip implements ControllerProviderInterface
|
||||
|
||||
return $app['twig']->render(
|
||||
'prod/Tooltip/TechnicalDatas.html.twig'
|
||||
, array('record' => $record, 'document' => $document)
|
||||
, ['record' => $record, 'document' => $document]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ class Tooltip implements ControllerProviderInterface
|
||||
|
||||
return $app['twig']->render(
|
||||
'prod/Tooltip/DataboxField.html.twig'
|
||||
, array('field' => $field)
|
||||
, ['field' => $field]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ class Tooltip implements ControllerProviderInterface
|
||||
|
||||
return $app['twig']->render(
|
||||
'prod/Tooltip/DCESFieldInfo.html.twig'
|
||||
, array('field' => $field)
|
||||
, ['field' => $field]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ class Tooltip implements ControllerProviderInterface
|
||||
|
||||
return $app['twig']->render(
|
||||
'prod/Tooltip/DataboxFieldRestrictions.html.twig'
|
||||
, array('field' => $field)
|
||||
, ['field' => $field]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -76,12 +76,12 @@ class Upload implements ControllerProviderInterface
|
||||
$maxFileSize = $this->getUploadMaxFileSize();
|
||||
|
||||
return $app['twig']->render(
|
||||
'prod/upload/upload-flash.html.twig', array(
|
||||
'prod/upload/upload-flash.html.twig', [
|
||||
'sessionId' => session_id(),
|
||||
'collections' => $this->getGrantedCollections($app['acl']->get($app['authentication']->getUser())),
|
||||
'maxFileSize' => $maxFileSize,
|
||||
'maxFileSizeReadable' => \p4string::format_octets($maxFileSize)
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,11 +97,11 @@ class Upload implements ControllerProviderInterface
|
||||
$maxFileSize = $this->getUploadMaxFileSize();
|
||||
|
||||
return $app['twig']->render(
|
||||
'prod/upload/upload.html.twig', array(
|
||||
'prod/upload/upload.html.twig', [
|
||||
'collections' => $this->getGrantedCollections($app['acl']->get($app['authentication']->getUser())),
|
||||
'maxFileSize' => $maxFileSize,
|
||||
'maxFileSizeReadable' => \p4string::format_octets($maxFileSize)
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,14 +121,14 @@ class Upload implements ControllerProviderInterface
|
||||
*/
|
||||
public function upload(Application $app, Request $request)
|
||||
{
|
||||
$datas = array(
|
||||
$datas = [
|
||||
'success' => false,
|
||||
'code' => null,
|
||||
'message' => '',
|
||||
'element' => '',
|
||||
'reasons' => array(),
|
||||
'reasons' => [],
|
||||
'id' => '',
|
||||
);
|
||||
];
|
||||
|
||||
if (null === $request->files->get('files')) {
|
||||
throw new BadRequestHttpException('Missing file parameter');
|
||||
@@ -185,7 +185,7 @@ class Upload implements ControllerProviderInterface
|
||||
|
||||
$forceBehavior = $request->request->get('forceAction');
|
||||
|
||||
$reasons = array();
|
||||
$reasons = [];
|
||||
$elementCreated = null;
|
||||
|
||||
$callback = function ($element, $visa, $code) use (&$reasons, &$elementCreated) {
|
||||
@@ -205,7 +205,7 @@ class Upload implements ControllerProviderInterface
|
||||
$app['filesystem']->rename($renamedFilename, $uploadedFilename);
|
||||
|
||||
if (!!$forceBehavior) {
|
||||
$reasons = array();
|
||||
$reasons = [];
|
||||
}
|
||||
|
||||
if ($elementCreated instanceof \record_adapter) {
|
||||
@@ -237,7 +237,7 @@ class Upload implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$params = array('lazaret_file' => $elementCreated);
|
||||
$params = ['lazaret_file' => $elementCreated];
|
||||
|
||||
$app['events-manager']->trigger('__UPLOAD_QUARANTINE__', $params);
|
||||
|
||||
@@ -246,14 +246,14 @@ class Upload implements ControllerProviderInterface
|
||||
$message = _('The file was moved to the quarantine');
|
||||
}
|
||||
|
||||
$datas = array(
|
||||
$datas = [
|
||||
'success' => true,
|
||||
'code' => $code,
|
||||
'message' => $message,
|
||||
'element' => $element,
|
||||
'reasons' => $reasons,
|
||||
'id' => $id,
|
||||
);
|
||||
];
|
||||
} catch (\Exception $e) {
|
||||
$datas['message'] = _('Unable to add file to Phraseanet');
|
||||
}
|
||||
@@ -275,16 +275,16 @@ class Upload implements ControllerProviderInterface
|
||||
*/
|
||||
private function getGrantedCollections(\ACL $acl)
|
||||
{
|
||||
$collections = array();
|
||||
$collections = [];
|
||||
|
||||
foreach ($acl->get_granted_base(array('canaddrecord')) as $collection) {
|
||||
foreach ($acl->get_granted_base(['canaddrecord']) as $collection) {
|
||||
$databox = $collection->get_databox();
|
||||
|
||||
if ( ! isset($collections[$databox->get_sbas_id()])) {
|
||||
$collections[$databox->get_sbas_id()] = array(
|
||||
$collections[$databox->get_sbas_id()] = [
|
||||
'databox' => $databox,
|
||||
'databox_collections' => array()
|
||||
);
|
||||
'databox_collections' => []
|
||||
];
|
||||
}
|
||||
|
||||
$collections[$databox->get_sbas_id()]['databox_collections'][] = $collection;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user