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/Command/Setup/Install.php b/lib/Alchemy/Phrasea/Command/Setup/Install.php
index d6ccbc50a5..8a8fcc9262 100644
--- a/lib/Alchemy/Phrasea/Command/Setup/Install.php
+++ b/lib/Alchemy/Phrasea/Command/Setup/Install.php
@@ -272,6 +272,7 @@ class Install extends Command
'ffprobe_binary' => $this->executableFinder->find('ffprobe', $this->executableFinder->find('avprobe')),
'mp4box_binary' => $this->executableFinder->find('MP4Box'),
'pdftotext_binary' => $this->executableFinder->find('pdf2text'),
+ 'ghostscript_binary' => $this->executableFinder->find('gs'),
);
}
}
diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Push.php b/lib/Alchemy/Phrasea/Controller/Prod/Push.php
index c7f86b4e5f..5bfc52bd64 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/Push.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/Push.php
@@ -36,6 +36,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())
);
};
}
diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Query.php b/lib/Alchemy/Phrasea/Controller/Prod/Query.php
index 0861988187..db6d45a3d9 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/Query.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/Query.php
@@ -130,7 +130,7 @@ class Query implements ControllerProviderInterface
$options->set_min_date($request->request->get('datemin'));
$options->set_max_date($request->request->get('datemax'));
$options->set_date_fields(explode('|', $request->request->get('datefield')));
- $options->set_sort($request->request->get('sort'), $request->request->get('ord', PHRASEA_ORDER_DESC));
+ $options->set_sort($request->request->get('sort'), $request->request->get('ord', \searchEngine_options::SORT_MODE_DESC));
$options->set_use_stemming($request->request->get('stemme'));
$form = serialize($options);
diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Records.php b/lib/Alchemy/Phrasea/Controller/Prod/Records.php
index f69e2d0537..3f21cd581e 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/Records.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/Records.php
@@ -209,6 +209,8 @@ class Records implements ControllerProviderInterface
));
$basketElementsRepository = $app['EM']->getRepository('\Entities\BasketElement');
+ $StoryWZRepository = $app['EM']->getRepository('\Entities\StoryWZ');
+
$deleted = array();
foreach ($records as $record) {
@@ -220,6 +222,12 @@ class Records implements ControllerProviderInterface
$deleted[] = $element->getRecord($app)->get_serialize_key();
}
+ $attachedStories = $StoryWZRepository->findByRecord($record);
+
+ foreach ($attachedStories as $attachedStory) {
+ $app['EM']->remove($attachedStory);
+ }
+
$record->delete();
$deleted[] = $record->get_serialize_key();
} catch (\Exception $e) {
diff --git a/lib/Alchemy/Phrasea/Controller/Root/Login.php b/lib/Alchemy/Phrasea/Controller/Root/Login.php
index 2c0e79308e..70cf4503ed 100644
--- a/lib/Alchemy/Phrasea/Controller/Root/Login.php
+++ b/lib/Alchemy/Phrasea/Controller/Root/Login.php
@@ -443,6 +443,25 @@ class Login implements ControllerProviderInterface
*/
public function displayRegisterForm(Application $app, Request $request)
{
+ $captchaSys = '';
+
+ if ($app['phraseanet.registry']->get('GV_captchas')
+ && $app['phraseanet.registry']->get('GV_captcha_private_key')
+ && $app['phraseanet.registry']->get('GV_captcha_public_key')) {
+
+ require_once __DIR__ . '/../../../../../lib/vendor/recaptcha/recaptchalib.php';
+
+ $captchaSys = '
+
+
+
+ ' . _('login::captcha: recopier les mots ci dessous') . ' :
+
+
' . recaptcha_get_html($app['phraseanet.registry']->get('GV_captcha_public_key')) . '
';
+ }
+
$login = new \login();
if (false === $login->register_enabled($app)) {
return $app->redirect('/login/?notice=no-register-available');
@@ -482,20 +501,23 @@ class Login implements ControllerProviderInterface
}
}
+
+
$arrayVerif = $this->getRegisterFieldConfiguration($app);
return $app['twig']->render('login/register.html.twig', array(
- 'inscriptions' => giveMeBases($app),
- 'parms' => $request->query->all(),
- 'needed' => $needed,
- 'arrayVerif' => $arrayVerif,
- 'demandes' => $request->query->get('demand', array()),
- 'lng' => $app['locale']
+ 'inscriptions' => giveMeBases($app),
+ 'parms' => $request->query->all(),
+ 'needed' => $needed,
+ 'arrayVerif' => $arrayVerif,
+ 'demandes' => $request->query->get('demand', array()),
+ 'lng' => $app['locale'],
+ 'captcha_system' => $captchaSys,
));
}
/**
- * Get the register form
+ * Do the registration
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
@@ -503,6 +525,28 @@ class Login implements ControllerProviderInterface
*/
public function register(Application $app, Request $request)
{
+ $captchaOK = true;
+
+ if ($app['phraseanet.registry']->get('GV_captchas')
+ && $request->request->get('GV_captcha_private_key')
+ && $request->request->get('GV_captcha_public_key')
+ && $request->request->get("recaptcha_challenge_field")
+ && $request->request->get("recaptcha_response_field")) {
+ $checkCaptcha = recaptcha_check_answer(
+ $app['phraseanet.registry']->get('GV_captcha_private_key'),
+ $request->server->get('REMOTE_ADDR'),
+ $request->request->get["recaptcha_challenge_field"],
+ $request->request->get["recaptcha_response_field"]
+ );
+ $captchaOK = $checkCaptcha->is_valid;
+ }
+
+ if (!$captchaOK) {
+ return $app->redirect($app['url_generator']->generate('login_register', array(
+ 'error' => $captcha
+ )));
+ }
+
$arrayVerif = $this->getRegisterFieldConfiguration($app);
$parameters = $request->request->all();
@@ -555,7 +599,9 @@ class Login implements ControllerProviderInterface
}
if (sizeof($needed) > 0) {
- return $app->redirect(sprintf('/register/?%s', http_build_query(array('needed' => $needed))));
+ return $app->redirect($app['url_generator']->generate('login_register', array(
+ 'needed' => $needed
+ )));
}
require_once($app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php');
diff --git a/lib/Doctrine/Repositories/StoryWZRepository.php b/lib/Doctrine/Repositories/StoryWZRepository.php
index d81e609c05..77c3f809bf 100644
--- a/lib/Doctrine/Repositories/StoryWZRepository.php
+++ b/lib/Doctrine/Repositories/StoryWZRepository.php
@@ -104,4 +104,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 912adef73e..62a3c57902 100644
--- a/lib/classes/deprecated/prodUtils.php
+++ b/lib/classes/deprecated/prodUtils.php
@@ -19,6 +19,7 @@ use Alchemy\Phrasea\Application;
function deleteRecord(Application $app, $lst, $del_children)
{
$BE_repository = $app['EM']->getRepository('\Entities\BasketElement');
+ $StoryWZ_repository = $em->getRepository('\Entities\StoryWZ');
$ACL = $app['phraseanet.user']->ACL();
@@ -77,6 +78,12 @@ function deleteRecord(Application $app, $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) {
diff --git a/lib/classes/patch/373.class.php b/lib/classes/patch/373.class.php
index 8ff0bb5240..ba662f243c 100644
--- a/lib/classes/patch/373.class.php
+++ b/lib/classes/patch/373.class.php
@@ -90,7 +90,7 @@ class patch_373 implements patchInterface
'GV_pdftotext' => 'pdftotext_binary',
);
- $binaries = array();
+ $binaries = array('ghostscript_binary' => '');
foreach ($Regbinaries as $name) {
$stmt->execute(array(':key' => $name));
diff --git a/lib/classes/registry.class.php b/lib/classes/registry.class.php
index aa914f1ed5..b40aa15567 100644
--- a/lib/classes/registry.class.php
+++ b/lib/classes/registry.class.php
@@ -61,7 +61,9 @@ class registry implements registryInterface
$binaries = $app['phraseanet.configuration']->getBinaries();
if (isset($binaries['binaries'])) {
foreach ($binaries['binaries'] as $name => $path) {
- $this->cache->save($name, $path);
+ if ($path) {
+ $this->cache->save($name, $path);
+ }
}
}
}
diff --git a/templates/web/login/register.html.twig b/templates/web/login/register.html.twig
index b32727893d..92506e656b 100644
--- a/templates/web/login/register.html.twig
+++ b/templates/web/login/register.html.twig
@@ -95,6 +95,15 @@
{% endblock %}
{% block content %}
+ {% if captcha_system != '' %}
+
+ {% endif %}