From 43e03bfdff39390a23d3dc250c6a4b6e07bd72e7 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Mon, 29 Oct 2012 14:02:08 +0100 Subject: [PATCH 1/8] Fix #968 : Display job and company in push search engine --- lib/Alchemy/Phrasea/Controller/Prod/Push.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Push.php b/lib/Alchemy/Phrasea/Controller/Prod/Push.php index 6f567803a4..d9547abc6a 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Push.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Push.php @@ -37,6 +37,7 @@ class Push implements ControllerProviderInterface , 'lastname' => $user->get_lastname() , 'email' => $user->get_email() , 'display_name' => $user->get_display_name() + , 'subtitle' => sprintf('%s, %s', $user->get_job(), $user->get_company()) ); }; } From b8ae0eece559c2b7cb9cfe3b8651a3cc7e0fb255 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Mon, 29 Oct 2012 14:19:34 +0100 Subject: [PATCH 2/8] Fix #971 : Removing a story must remove its presence in all workzones --- .../Repositories/StoryWZRepository.php | 26 +++++++++++++++++++ lib/classes/deprecated/prodUtils.php | 7 +++++ 2 files changed, 33 insertions(+) diff --git a/lib/Doctrine/Repositories/StoryWZRepository.php b/lib/Doctrine/Repositories/StoryWZRepository.php index 763dc57fe3..01b6074157 100644 --- a/lib/Doctrine/Repositories/StoryWZRepository.php +++ b/lib/Doctrine/Repositories/StoryWZRepository.php @@ -103,4 +103,30 @@ class StoryWZRepository extends EntityRepository return $story; } + + public function findByRecord(\record_adapter $Story) + { + $dql = 'SELECT s FROM Entities\StoryWZ s WHERE s.sbas_id = :sbas_id + AND s.record_id = :record_id'; + + $query = $this->_em->createQuery($dql); + $query->setParameters(array( + 'sbas_id' => $Story->get_sbas_id(), + 'record_id' => $Story->get_record_id(), + )); + + $stories = $query->getResult(); + + foreach ($stories as $key => $story) { + try { + $record = $story->getRecord(); + } catch (\Exception_Record_AdapterNotFound $e) { + $this->getEntityManager()->remove($story); + $this->getEntityManager()->flush(); + unset($stories[$key]); + } + } + + return $stories; + } } diff --git a/lib/classes/deprecated/prodUtils.php b/lib/classes/deprecated/prodUtils.php index d07268ada4..4e6271b879 100644 --- a/lib/classes/deprecated/prodUtils.php +++ b/lib/classes/deprecated/prodUtils.php @@ -19,6 +19,7 @@ function deleteRecord($lst, $del_children) $Core = bootstrap::getCore(); $em = $Core->getEntityManager(); $BE_repository = $em->getRepository('\Entities\BasketElement'); + $StoryWZ_repository = $em->getRepository('\Entities\StoryWZ'); $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); @@ -84,6 +85,12 @@ function deleteRecord($lst, $del_children) } $ret[] = $record->get_serialize_key(); + $attachedStories = $StoryWZ_repository->findByRecord($record); + + foreach ($attachedStories as $attachedStory) { + $em->remove($attachedStory); + } + $basket_elements = $BE_repository->findElementsByRecord($record); foreach ($basket_elements as $basket_element) { From cfc02d39c61746a708bf9d300ed99a80d0f5b00e Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Mon, 29 Oct 2012 14:33:20 +0100 Subject: [PATCH 3/8] Fix #965 : add ghostscript binary --- config/binaries.sample.yml | 12 ++++++++++++ lib/Alchemy/Phrasea/Controller/Setup/Installer.php | 1 + lib/classes/patch/373.class.php | 2 ++ lib/classes/registry.class.php | 4 +++- 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 config/binaries.sample.yml diff --git a/config/binaries.sample.yml b/config/binaries.sample.yml new file mode 100644 index 0000000000..7624961052 --- /dev/null +++ b/config/binaries.sample.yml @@ -0,0 +1,12 @@ +binaries: + php_binary: '' + convert_binary: '' + composite_binary: '' + swf_extract_binary: '' + pdf2swf_binary: '' + swf_render_binary: '' + unoconv_binary: '' + ffmpeg_binary: '' + ffprobe_binary: '' + mp4box_binary: '' + pdftotext_binary: '' diff --git a/lib/Alchemy/Phrasea/Controller/Setup/Installer.php b/lib/Alchemy/Phrasea/Controller/Setup/Installer.php index 92d14b5044..445845a5bf 100644 --- a/lib/Alchemy/Phrasea/Controller/Setup/Installer.php +++ b/lib/Alchemy/Phrasea/Controller/Setup/Installer.php @@ -222,6 +222,7 @@ class Installer implements ControllerProviderInterface 'ffmpeg_binary' => $request->get('binary_ffmpeg'), 'mp4box_binary' => $request->get('binary_MP4Box'), 'pdftotext_binary' => $request->get('binary_xpdf'), + 'ghostscript_binary' => '', ); $app['Core']->getConfiguration()->setBinaries(array('binaries' => $binaries)); diff --git a/lib/classes/patch/373.class.php b/lib/classes/patch/373.class.php index 41ab8d6857..9d3c0ba299 100644 --- a/lib/classes/patch/373.class.php +++ b/lib/classes/patch/373.class.php @@ -90,6 +90,8 @@ class patch_373 implements patchInterface 'GV_pdftotext' => 'pdftotext_binary', ); + $binaries = array('ghostscript_binary' => ''); + foreach ($Regbinaries as $name) { $stmt->execute(array(':key' => $name)); $row = $stmt->fetch(\PDO::FETCH_ASSOC); diff --git a/lib/classes/registry.class.php b/lib/classes/registry.class.php index f4cd746fc9..f1866c9d7e 100644 --- a/lib/classes/registry.class.php +++ b/lib/classes/registry.class.php @@ -78,7 +78,9 @@ class registry implements registryInterface $binaries = $configuration->getBinaries(); if (isset($binaries['binaries'])) { foreach ($binaries['binaries'] as $name => $path) { - $this->cache->save($name, $path); + if ($path) { + $this->cache->save($name, $path); + } } } } From 9d12675bcb85b53a3dcc4c5e0c999a069c96b46e Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Mon, 29 Oct 2012 15:05:39 +0100 Subject: [PATCH 4/8] Fix #974 : Move story children as long as story --- .../Controller/Prod/MoveCollection.php | 1 - .../Phrasea/Helper/Record/MoveCollection.php | 19 +++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php index f58c70d678..1414845309 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php @@ -13,7 +13,6 @@ namespace Alchemy\Phrasea\Controller\Prod; use Silex\Application; use Silex\ControllerProviderInterface; -use Silex\ControllerCollection; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\JsonResponse; use Alchemy\Phrasea\Helper\Record as RecordHelper; diff --git a/lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php b/lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php index 548598b741..918e0b26fb 100644 --- a/lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php +++ b/lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php @@ -46,6 +46,8 @@ class MoveCollection extends RecordHelper */ protected $baseIdDestination; + protected $request; + /** * * @param \Alchemy\Phrasea\Core $core @@ -55,10 +57,7 @@ class MoveCollection extends RecordHelper public function __construct(Core $core, Request $request) { $this->baseIdDestination = $request->get('base_id'); - - if ($request->get("chg_coll_son") == "1") { - $this->flatten_groupings = true; - } + $this->request = $request; parent::__construct($core, $request); @@ -141,6 +140,18 @@ class MoveCollection extends RecordHelper $record->move_to_collection($collection, $appbox); } + if ($this->request->get("chg_coll_son") == "1") { + foreach ($this->selection as $record) { + if (!$record->is_grouping()) { + continue; + } + + foreach ($record->get_children() as $child) { + $child->move_to_collection($collection, $appbox); + } + } + } + return $this; } } From 9780d7ad10cdc97a3e5623bdfa2d03965d0e7d82 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Mon, 29 Oct 2012 16:23:34 +0100 Subject: [PATCH 5/8] Fix #963 : ajout de captcha sur les formulaires d'inscription --- www/login/register.php | 61 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/www/login/register.php b/www/login/register.php index 555ddc3467..794ec15d38 100644 --- a/www/login/register.php +++ b/www/login/register.php @@ -23,6 +23,11 @@ $registry = $appbox->get_registry(); require($registry->get('GV_RootPath') . 'lib/classes/deprecated/countries.php'); require_once($registry->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php'); +if ($registry->get('GV_captchas') + && trim($registry->get('GV_captcha_private_key')) !== '' + && trim($registry->get('GV_captcha_public_key')) !== '') + include($registry->get('GV_RootPath') . 'lib/vendor/recaptcha/recaptchalib.php'); + $register_enabled = login::register_enabled(); if ( ! $register_enabled) { @@ -68,7 +73,12 @@ $arrayVerif['form_email'] = true; $lstreceiver = array(); -$parm = $request->get_parms("form_login", "form_password", "form_city", "form_password_confirm", "form_gender", "form_lastname", "form_firstname", "form_email", "form_job", "form_company", 'demand', "form_activity", "form_phone", "form_fax", "form_address", "form_zip", "form_geonameid", "demand"); +$parm = $request->get_parms("form_login", "form_password", "form_city", + "form_password_confirm", "form_gender", "form_lastname", + "form_firstname", "form_email", "form_job", "form_company", + 'demand', "form_activity", "form_phone", "form_fax", + "form_address", "form_zip", "form_geonameid", "demand", + 'recaptcha_response_field', 'recaptcha_challenge_field'); /** * @todo transactionner cette page @@ -77,7 +87,18 @@ if ($request->has_post_datas()) { $needed = array_diff_key($arrayVerif, $request->get_post_datas()); - if (sizeof($needed) === 0 || (sizeof($needed) === 1 && isset($needed['form_login']) && $needed['form_login'] === true)) { + $captcha = true; + + if ($registry->get('GV_captchas') + && trim($registry->get('GV_captcha_private_key')) !== '' + && trim($registry->get('GV_captcha_public_key')) !== '' + && ! is_null($parm["recaptcha_challenge_field"]) + && ! is_null($parm["recaptcha_response_field"])) { + $checkCaptcha = recaptcha_check_answer($registry->get('GV_captcha_private_key'), $_SERVER["REMOTE_ADDR"], $parm["recaptcha_challenge_field"], $parm["recaptcha_response_field"]); + $captcha = $checkCaptcha->is_valid; + } + + if ($captcha && sizeof($needed) === 0 || (sizeof($needed) === 1 && isset($needed['form_login']) && $needed['form_login'] === true)) { foreach ($parm as $field => $value) { if (is_string($value) && isset($arrayVerif[$field]) && $arrayVerif[$field] === true) { @@ -310,6 +331,36 @@ foreach ($arrayVerif as $ar => $ver) { initialize_geoname_field($('#form_geonameid')); }); +get('GV_captchas') + && trim($registry->get('GV_captcha_private_key')) !== '' + && trim($registry->get('GV_captcha_public_key')) !== '') { + $captchaSys = '
+
+ +
+ ' . _('login::captcha: recopier les mots ci dessous') . ' : + +
' . recaptcha_get_html($registry->get('GV_captcha_public_key')) . '
'; + + ?> + + var RecaptchaOptions = { + theme : 'custom', + tabindex : 3, + lang : 'get_locale(); ?>' + }; + + + @@ -583,6 +634,12 @@ if ($register_enabled) { + + + + + +
From 39e1eb9945f36ac0db2e913970ca941c8d4ea9bc Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Mon, 29 Oct 2012 18:36:45 +0100 Subject: [PATCH 6/8] Fix #970 : fix default sort mode --- lib/Alchemy/Phrasea/Controller/Prod/Query.php | 2 +- www/client/answer.php | 2 +- www/client/index.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Query.php b/lib/Alchemy/Phrasea/Controller/Prod/Query.php index 2a43da1381..a239d847ef 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Query.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Query.php @@ -76,7 +76,7 @@ class Query implements ControllerProviderInterface $options->set_min_date($request->get('datemin')); $options->set_max_date($request->get('datemax')); $options->set_date_fields(explode('|', $request->get('datefield'))); - $options->set_sort($request->get('sort'), $request->get('ord', PHRASEA_ORDER_DESC)); + $options->set_sort($request->get('sort'), $request->get('ord', \searchEngine_options::SORT_MODE_DESC)); $options->set_use_stemming($request->get('stemme')); $form = serialize($options); diff --git a/www/client/answer.php b/www/client/answer.php index 1310f07ff6..4cd5af9873 100644 --- a/www/client/answer.php +++ b/www/client/answer.php @@ -123,7 +123,7 @@ $options->set_sort($parm['sort'], $parm['ord']); $options->set_use_stemming($parm['stemme']); if ($parm['ord'] === NULL) - $parm['ord'] = PHRASEA_ORDER_DESC; + $parm['ord'] = \searchEngine_options::SORT_MODE_DESC; else $parm['ord'] = (int) $parm['ord']; diff --git a/www/client/index.php b/www/client/index.php index c0bdf6cf40..156db807ae 100644 --- a/www/client/index.php +++ b/www/client/index.php @@ -289,7 +289,7 @@ if ($registry->get('GV_client_coll_ckbox') === 'popup') { - +
From 5733875d001ca9bf122580e2992e38afb7dbffef Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Mon, 29 Oct 2012 21:38:58 +0100 Subject: [PATCH 7/8] Update timezone --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 98c68198ad..45d1ab9c77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ before_script: - sudo mysql -e "GRANT ALL PRIVILEGES ON ab_unitTests.* TO 'phraseaUnitTests'@'localhost' IDENTIFIED BY 'iWvGxPE8' WITH GRANT OPTION" - sudo mysql -e "GRANT ALL PRIVILEGES ON db_unitTests.* TO 'phraseaUnitTests'@'localhost' IDENTIFIED BY 'iWvGxPE8' WITH GRANT OPTION" - mysql -e "source `pwd`/hudson/fixtures.sql" - - mysql -e 'SET GLOBAL time_zone = "+02:00";' + - mysql -e 'SET GLOBAL time_zone = "+01:00";' - mysql -e 'SET @@global.sql_mode= "";' - mysql -e 'SET @@global.wait_timeout= 999999;' - git clone git://github.com/alchemy-fr/Phraseanet-Extension.git From a68e2ba791fbca99f8f44ec3aec1e9a4c1ed1ff3 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 30 Oct 2012 10:50:52 +0100 Subject: [PATCH 8/8] Re-enable IE6 compatibility --- www/client/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/client/index.php b/www/client/index.php index c0bdf6cf40..d150462442 100644 --- a/www/client/index.php +++ b/www/client/index.php @@ -105,7 +105,7 @@ $user = User_Adapter::getInstance($usr_id, $appbox); } - +