diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index ae485b1af3..19b0bd97b8 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -606,6 +606,14 @@ class Application extends SilexApplication $twig->addFilter('formatOctets', new \Twig_Filter_Function('p4string::format_octets')); $twig->addFilter('base_from_coll', new \Twig_Filter_Function('phrasea::baseFromColl')); $twig->addFilter('AppName', new \Twig_Filter_Function('Alchemy\Phrasea\Controller\Admin\ConnectedUsers::appName')); + $twig->addFilter(new \Twig_SimpleFilter('escapeSimpleQuote', function ($value) { + $ret = str_replace("'", "\'", $value); + + return $ret; + })); + $twig->addFilter(new \Twig_SimpleFilter('escapeDoubleQuote', function ($value) { + return str_replace('"', '\"', $value); + })); return $twig; }) diff --git a/lib/Alchemy/Phrasea/Application/Root.php b/lib/Alchemy/Phrasea/Application/Root.php index 9d240a5045..35a10c21dd 100644 --- a/lib/Alchemy/Phrasea/Application/Root.php +++ b/lib/Alchemy/Phrasea/Application/Root.php @@ -31,7 +31,13 @@ return call_user_func(function($environment = PhraseaApplication::ENV_PROD) { $app->before(function (Request $request) use ($app) { if (0 === strpos($request->getPathInfo(), '/setup')) { - if (!$app['phraseanet.configuration-tester']->isBlank()) { + if (!$app['phraseanet.configuration-tester']->isInstalled()) { + if (!$app['phraseanet.configuration-tester']->isBlank()) { + if ('setup_upgrade_instructions' !== $app['request']->attributes->get('_route')) { + return $app->redirectPath('setup_upgrade_instructions'); + } + } + } elseif (!$app['phraseanet.configuration-tester']->isBlank()) { return $app->redirectPath('homepage'); } } else { diff --git a/lib/Alchemy/Phrasea/Command/Developer/ComposerInstall.php b/lib/Alchemy/Phrasea/Command/Developer/ComposerInstall.php index a02c7f4f0b..db22d57470 100644 --- a/lib/Alchemy/Phrasea/Command/Developer/ComposerInstall.php +++ b/lib/Alchemy/Phrasea/Command/Developer/ComposerInstall.php @@ -38,7 +38,7 @@ class ComposerInstall extends Command $composer->command('self-update'); $output->writeln("OK"); - $commands = array('install', '--optimize-autoloader'); + $commands = array('install', '--optimize-autoloader', '--quiet', '--no-interaction'); if ($input->getOption('prefer-source')) { $commands[] = '--prefer-source'; } diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Collection.php b/lib/Alchemy/Phrasea/Controller/Admin/Collection.php index 8c6f4ced84..b1db0c1a60 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Collection.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Collection.php @@ -1163,7 +1163,7 @@ class Collection implements ControllerProviderInterface if ($vi && isset($structFields[$ki])) { foreach ($vi->value as $oneValue) { $suggestedValues[] = array( - 'key' => $ki, 'value' => $f, 'name' => $oneValue + 'key' => $ki, 'value' => $f, 'name' => (string) $oneValue ); $f++; } diff --git a/lib/Alchemy/Phrasea/Controller/Setup.php b/lib/Alchemy/Phrasea/Controller/Setup.php index 896e7de61b..ff17e751f1 100644 --- a/lib/Alchemy/Phrasea/Controller/Setup.php +++ b/lib/Alchemy/Phrasea/Controller/Setup.php @@ -37,6 +37,9 @@ class Setup implements ControllerProviderInterface $controllers->get('/installer/', 'controller.setup:rootInstaller') ->bind('install_root'); + $controllers->get('/upgrade-instructions/', 'controller.setup:displayUpgradeInstructions') + ->bind('setup_upgrade_instructions'); + $controllers->get('/installer/step2/', 'controller.setup:getInstallForm') ->bind('install_step2'); @@ -70,6 +73,14 @@ class Setup implements ControllerProviderInterface ); } + public function displayUpgradeInstructions(Application $app, Request $request) + { + return $app['twig']->render('/setup/upgrade-instructions.html.twig', array( + 'locale' => $app['locale'], + 'available_locales' => Application::getAvailableLanguages(), + )); + } + public function getInstallForm(Application $app, Request $request) { $warnings = array(); diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/ConfigurationPanel.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/ConfigurationPanel.php index c965eed878..2c408ce979 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/ConfigurationPanel.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/ConfigurationPanel.php @@ -44,7 +44,6 @@ class ConfigurationPanel extends AbstractConfigurationPanel $params = array( 'configuration' => $configuration, - 'date_fields' => $this->getAvailableDateFields($app['phraseanet.appbox']->get_databoxes()), 'available_sort'=> $this->searchEngine->getAvailableSort(), ); @@ -64,6 +63,7 @@ class ConfigurationPanel extends AbstractConfigurationPanel } $configuration['default_sort'] = $request->request->get('default_sort'); + $configuration['stemming_enabled'] = (int) (Boolean) $request->request->get('stemming_enabled'); $this->saveConfiguration($configuration); @@ -89,6 +89,10 @@ class ConfigurationPanel extends AbstractConfigurationPanel $configuration['default_sort'] = null; } + if (!isset($configuration['stemming_enabled'])) { + $configuration['stemming_enabled'] = false; + } + return $configuration; } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php index 8f2923ace9..29f4e5237d 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php @@ -118,6 +118,16 @@ class PhraseaEngine implements SearchEngineInterface return $sort; } + /** + * {@inheritdoc} + */ + public function isStemmingEnabled() + { + $configuration = $this->getConfiguration(); + + return (Boolean) $configuration['stemming_enabled']; + } + /** * {@inheritdoc} */ diff --git a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineInterface.php b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineInterface.php index c2277d71dd..abcece3260 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineInterface.php +++ b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineInterface.php @@ -59,6 +59,11 @@ interface SearchEngineInterface */ public function getDefaultSort(); + /** + * @return string The default sort + */ + public function isStemmingEnabled(); + /** * @return array an array containing sort order values as key and sort order names as value */ diff --git a/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php b/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php index fc97b2f797..3e643c96de 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php +++ b/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php @@ -110,6 +110,14 @@ class SphinxSearchEngine implements SearchEngineInterface return 'relevance'; } + /** + * {@inheritdoc} + */ + public function isStemmingEnabled() + { + return true; + } + /** * {@inheritdoc} */ diff --git a/lib/classes/API/V1/adapter.php b/lib/classes/API/V1/adapter.php index 6919ecab83..dd62a199bf 100644 --- a/lib/classes/API/V1/adapter.php +++ b/lib/classes/API/V1/adapter.php @@ -400,7 +400,7 @@ class API_V1_adapter extends API_V1_Abstract 'active' => $app['phraseanet.registry']->get('GV_client_navigator'), ), 'office-plugin' => array( - 'active' => $registry->get('GV_client_navigator'), + 'active' => $app['phraseanet.registry']->get('GV_client_navigator'), ), 'homepage' => array( 'viewType' => $app['phraseanet.registry']->get('GV_home_publi'), diff --git a/lib/classes/module/report/dashboard.php b/lib/classes/module/report/dashboard.php index d7b09bedc5..d95145f1b5 100644 --- a/lib/classes/module/report/dashboard.php +++ b/lib/classes/module/report/dashboard.php @@ -54,7 +54,7 @@ class module_report_dashboard implements module_report_dashboard_componentInterf * @desc la periode par defaut d'affichage du dashboard * @var */ - public $periode = '-1 month'; + public $periode = '-5 days'; /** * @desc le sbasid de la base ou on effectue le report @@ -168,7 +168,7 @@ class module_report_dashboard implements module_report_dashboard_componentInterf { return $this->dashboard; } - + /** * @desc construct the legend for charts * if dmax === false dmax = now(); @@ -276,7 +276,7 @@ class module_report_dashboard implements module_report_dashboard_componentInterf $listeColl[] = (int) $value['coll_id']; } - $this->authorizedCollection[] = array( + $this->authorizedCollection[(int) $sbas] = array( 'sbas_id' => (int) $sbas, 'coll' => implode(',', $listeColl), 'name' => phrasea::sbas_labels($sbas, $this->app) diff --git a/lib/classes/record/adapter.php b/lib/classes/record/adapter.php index 4768e1ec82..959ddd7d66 100644 --- a/lib/classes/record/adapter.php +++ b/lib/classes/record/adapter.php @@ -1163,11 +1163,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface */ public function reindex() { - $connbas = connection::getPDOConnection($this->app, $this->get_sbas_id()); - $sql = 'UPDATE record SET status=(status & ~7 | 4) - WHERE record_id= :record_id'; - $stmt = $connbas->prepare($sql); - $stmt->execute(array(':record_id' => $this->record_id)); + $this->app['phraseanet.SE']->updateRecord($this); $this->delete_data_from_cache(self::CACHE_STATUS); return $this; diff --git a/templates/web/admin/collection/suggested_value.html.twig b/templates/web/admin/collection/suggested_value.html.twig index cf98cd37c9..fabcad9964 100644 --- a/templates/web/admin/collection/suggested_value.html.twig +++ b/templates/web/admin/collection/suggested_value.html.twig @@ -117,7 +117,7 @@ @@ -135,7 +135,7 @@
- +