diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Query.php b/lib/Alchemy/Phrasea/Controller/Prod/Query.php index 97464cf85e..80a1713ef6 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Query.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Query.php @@ -272,18 +272,22 @@ class Query implements ControllerProviderInterface */ public function queryAnswerTrain(Application $app, Request $request) { - $searchEngine = null; - - if (($options = unserialize($request->request->get('options_serial', ''))) !== false) { - $searchEngine = new \searchEngine_adapter($app); - $searchEngine->set_options($options); + if (null === $optionsSerial = $request->request->get('options_serial')) { + $app->abort(400, 'Search engine options are missing'); } - $pos = (int) $request->request->get('pos'); + if (($options = unserialize($optionsSerial)) !== false) { + $searchEngine = new \searchEngine_adapter($app); + $searchEngine->set_options($options); + } else { + $app->abort(400, 'Provided search engine options are not valid'); + } + + $pos = (int) $request->request->get('pos', 1); $query = $request->request->get('query', ''); $record = new \record_preview($app, 'RESULT', $pos, '', '', $searchEngine, $query); - + return $app->json(array( 'current' => $app['twig']->render('prod/preview/result_train.html.twig', array( 'records' => $record->get_train($pos, $query, $searchEngine), diff --git a/www/prod/page0.js b/www/prod/page0.js index b062fb05ba..7dcf215683 100644 --- a/www/prod/page0.js +++ b/www/prod/page0.js @@ -2121,7 +2121,7 @@ function activeIcons() $('.TOOL_chgstatus_btn').live('click', function(){ var params = {}; var $this = $(this); - console.log(p4.Results.Selection.length()); + if ($this.hasClass('results_window')) { if (p4.Results.Selection.length() > 0) { params.lst = p4.Results.Selection.serialize();