Merge branch '3.8'

Conflicts:
	composer.json
	composer.lock
	config/configuration.sample.yml
	lib/Alchemy/Phrasea/Application.php
	lib/Alchemy/Phrasea/Application/Api.php
	lib/Alchemy/Phrasea/Controller/Admin/Collection.php
	lib/Alchemy/Phrasea/Controller/Admin/Users.php
	lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php
	lib/Alchemy/Phrasea/Controller/Prod/Export.php
	lib/Alchemy/Phrasea/Controller/Prod/Language.php
	lib/Alchemy/Phrasea/Controller/Prod/Push.php
	lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php
	lib/Alchemy/Phrasea/Controller/Report/Informations.php
	lib/Alchemy/Phrasea/Controller/Report/Root.php
	lib/Alchemy/Phrasea/Controller/Root/Developers.php
	lib/Alchemy/Phrasea/Controller/Root/Login.php
	lib/Alchemy/Phrasea/Controller/Root/Session.php
	lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php
	lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php
	lib/Alchemy/Phrasea/Controller/Utils/PathFileTest.php
	lib/Alchemy/Phrasea/Core/Version.php
	lib/Alchemy/Phrasea/Form/Login/PhraseaAuthenticationForm.php
	lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php
	lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php
	lib/classes/API/OAuth2/Application.php
	lib/classes/API/V1/adapter.php
	lib/classes/Feed/Adapter.php
	lib/classes/Feed/Aggregate.php
	lib/classes/Feed/Collection.php
	lib/classes/Feed/Entry/Adapter.php
	lib/classes/ZipArchiveImproved.php
	lib/classes/caption/Field/Value.php
	lib/classes/caption/record.php
	lib/classes/eventsmanager/notify/feed.php
	lib/classes/media/subdef.php
	lib/classes/module/report/connexion.php
	lib/classes/module/report/download.php
	lib/classes/record/adapter.php
	lib/classes/registry.php
	lib/classes/set/export.php
	lib/classes/setup.php
	lib/classes/task/abstract.php
	lib/classes/task/period/emptyColl.php
	lib/classes/uuid.php
	lib/conf.d/_GV_template.inc
	lib/conf.d/bases_structure.xml
	lib/conf.d/configuration.yml
	lib/conf.d/minifyGroupsConfig.php
	locale/de_DE/LC_MESSAGES/phraseanet.mo
	locale/de_DE/LC_MESSAGES/phraseanet.po
	locale/en_GB/LC_MESSAGES/phraseanet.mo
	locale/en_GB/LC_MESSAGES/phraseanet.po
	locale/fr_FR/LC_MESSAGES/phraseanet.mo
	locale/fr_FR/LC_MESSAGES/phraseanet.po
	locale/nl_NL/LC_MESSAGES/phraseanet.mo
	locale/nl_NL/LC_MESSAGES/phraseanet.po
	locale/phraseanet.pot
	templates/web/account/account.html.twig
	templates/web/account/base.html.twig
	templates/web/admin/databox/databox.html.twig
	templates/web/admin/index.html.twig
	templates/web/admin/setup.html.twig
	templates/web/admin/tree.html.twig
	templates/web/client/index.html.twig
	templates/web/common/caption.html.twig
	templates/web/common/caption_templates/answer.html.twig
	templates/web/common/caption_templates/basket_element.html.twig
	templates/web/common/caption_templates/internal_publi.html.twig
	templates/web/common/caption_templates/lazaret.html.twig
	templates/web/common/caption_templates/overview.html.twig
	templates/web/common/caption_templates/preview.html.twig
	templates/web/common/index_bootstrap.html.twig
	templates/web/common/indexfloat.html.twig
	templates/web/common/thumbnail.html.twig
	templates/web/developers/application_form.html.twig
	templates/web/lightbox/IE6/feed.html.twig
	templates/web/lightbox/IE6/validate.html.twig
	templates/web/lightbox/feed.html.twig
	templates/web/lightbox/validate.html.twig
	templates/web/prod/actions/Download/prepare.html.twig
	templates/web/prod/actions/publish/publish.html.twig
	templates/web/prod/index.html.twig
	templates/web/prod/preview/caption.html.twig
	templates/web/prod/results/answerlist.html.twig
	templates/web/thesaurus/accept.html.twig
	templates/web/thesaurus/export-text-dialog.html.twig
	templates/web/thesaurus/export-text.html.twig
	templates/web/thesaurus/export-topics-dialog.html.twig
	templates/web/thesaurus/export-topics.html.twig
	templates/web/thesaurus/index.html.twig
	templates/web/thesaurus/link-field-step1.html.twig
	templates/web/thesaurus/link-field-step2.html.twig
	templates/web/thesaurus/link-field-step3.html.twig
	templates/web/thesaurus/new-term.html.twig
	templates/web/thesaurus/properties.html.twig
	templates/web/thesaurus/search.html.twig
	templates/web/thesaurus/thesaurus.html.twig
	tests/Alchemy/Tests/Phrasea/Application/ApiJsonTest.php
	tests/Alchemy/Tests/Phrasea/Application/ApiYamlTest.php
	tests/Alchemy/Tests/Phrasea/Application/LightboxTest.php
	tests/Alchemy/Tests/Phrasea/Application/OAuth2Test.php
	tests/Alchemy/Tests/Phrasea/Application/OverviewTest.php
	tests/Alchemy/Tests/Phrasea/Authentication/PersistentCookie/ManagerTest.php
	tests/Alchemy/Tests/Phrasea/Cache/RedisCacheTest.php
	tests/Alchemy/Tests/Phrasea/Command/Compile/ConfigurationTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Admin/FieldsTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Admin/PublicationTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Admin/SubdefsTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Admin/UsersTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJSONPTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/BasketTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/BridgeTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/EditTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/FeedTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/LanguageTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/MoveCollectionTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/PrinterTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/PushTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/RootTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/StoryTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/ToolsTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/TooltipTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/UploadTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/UsrListsTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Prod/WorkZoneTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Root/LoginTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Root/RSSFeedTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Utils/ConnectionTestTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Utils/PathFileTestTest.php
	tests/Alchemy/Tests/Phrasea/Core/Provider/FTPServiceProviderTest.php
	tests/Alchemy/Tests/Phrasea/Core/Provider/LocaleServiceProviderTest.php
	tests/Alchemy/Tests/Phrasea/Core/Provider/PhraseanetServiceProviderTest.php
	tests/Alchemy/Tests/Phrasea/Core/Provider/RegistrationServiceProviderTest.php
	tests/Alchemy/Tests/Phrasea/Core/Provider/TaskManagerServiceProviderTest.php
	tests/Alchemy/Tests/Phrasea/Http/XSendFile/NginxModeTest.php
	tests/Alchemy/Tests/Phrasea/Metadata/Tag/TfEditDateTest.php
	tests/Alchemy/Tests/Phrasea/Metadata/Tag/TfMimeTypeTest.php
	tests/Alchemy/Tests/Phrasea/SearchEngine/SearchEngineAbstractTest.php
	tests/classes/Feed/Feed_AggregateTest.php
	tests/classes/PhraseanetPHPUnitAbstract.php
	tests/db-ref.sqlite
This commit is contained in:
Nicolas Le Goff
2014-06-17 15:30:41 +02:00
146 changed files with 5549 additions and 1054 deletions

View File

@@ -5,6 +5,29 @@
"config": {
"bin-dir" : "bin/"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/alchemy-fr/tcpdf-clone"
},
{
"type": "git",
"url": "https://github.com/romainneutron/ProcessManager.git"
},
{
"type": "vcs",
"url": "https://github.com/nlegoff/PHP-FFmpeg"
},
{
"type": "vcs",
"url": "https://github.com/nlegoff/Mediavorus"
},
{
"type": "vcs",
"url": "https://github.com/nlegoff/Media-Alchemyst"
}
],
"minimum-stability" : "dev",
"require": {
"php" : ">=5.4",
"alchemy/oauth2php" : "1.0.0",
@@ -28,8 +51,8 @@
"jms/serializer" : "~0.10",
"jms/translation-bundle" : "~1.1",
"justinrainbow/json-schema" : "~1.3",
"mediavorus/mediavorus" : "~0.4.0",
"media-alchemyst/media-alchemyst" : "~0.4, >=0.4.4",
"mediavorus/mediavorus" : "dev-fix-video-dim as 0.4.3",
"media-alchemyst/media-alchemyst" : "0.4.x@dev",
"monolog/monolog" : "~1.3",
"mrclay/minify" : "~2.1.6",
"neutron/process-manager" : "2.0.x-dev@dev",
@@ -38,7 +61,7 @@
"neutron/sphinxsearch-api" : "~2.0.6",
"neutron/recaptcha" : "~0.1.0",
"neutron/temporary-filesystem" : "~2.1",
"php-ffmpeg/php-ffmpeg" : "~0.4, >=0.4.3",
"php-ffmpeg/php-ffmpeg" : "dev-fix-aspect-ratio as 0.4.4",
"php-xpdf/php-xpdf" : "~0.2.1",
"phpexiftool/phpexiftool" : "~0.3",
"react/zmq" : "~0.2",
@@ -70,10 +93,6 @@
{
"type": "git",
"url": "https://github.com/alchemy-fr/tcpdf-clone"
},
{
"type": "git",
"url": "https://github.com/romainneutron/ProcessManager.git"
}
],
"autoload": {

78
composer.lock generated
View File

@@ -1,9 +1,10 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "2b68364c4ebb09b6f5c3902e0afdcc1a",
"hash": "6dbba3e72a44255a6292ee8fedbce88e",
"packages": [
{
"name": "alchemy-fr/tcpdf-clone",
@@ -2018,26 +2019,26 @@
},
{
"name": "media-alchemyst/media-alchemyst",
"version": "0.4.4",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/alchemy-fr/Media-Alchemyst.git",
"reference": "067599fd669b86ff3a1cfb344730014b4a339b7e"
"url": "https://github.com/nlegoff/Media-Alchemyst.git",
"reference": "e812e631b74ebb0c7b3dd5f4e981d84a7b3c4029"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/Media-Alchemyst/zipball/067599fd669b86ff3a1cfb344730014b4a339b7e",
"reference": "067599fd669b86ff3a1cfb344730014b4a339b7e",
"url": "https://api.github.com/repos/nlegoff/Media-Alchemyst/zipball/e812e631b74ebb0c7b3dd5f4e981d84a7b3c4029",
"reference": "e812e631b74ebb0c7b3dd5f4e981d84a7b3c4029",
"shasum": ""
},
"require": {
"alchemy/ghostscript": "~0.4.0",
"imagine/imagine": "0.6.x@dev",
"mediavorus/mediavorus": "~0.4.2",
"mediavorus/mediavorus": "dev-fix-video-dim as 0.4.3",
"monolog/monolog": "~1.0",
"neutron/temporary-filesystem": "~2.1",
"php": ">=5.3.3",
"php-ffmpeg/php-ffmpeg": "~0.4.2",
"php-ffmpeg/php-ffmpeg": "dev-fix-aspect-ratio as 0.4.4",
"php-mp4box/php-mp4box": "~0.3.0",
"php-unoconv/php-unoconv": "~0.3.0",
"pimple/pimple": "~1.0",
@@ -2062,7 +2063,6 @@
"MediaAlchemyst": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -2087,20 +2087,23 @@
"video",
"video processing"
],
"time": "2014-01-31 11:32:50"
"support": {
"source": "https://github.com/nlegoff/Media-Alchemyst/tree/master"
},
"time": "2014-06-10 13:51:13"
},
{
"name": "mediavorus/mediavorus",
"version": "0.4.3",
"version": "dev-fix-video-dim",
"source": {
"type": "git",
"url": "https://github.com/romainneutron/MediaVorus.git",
"reference": "7cc8c0b8d3440eaff9aa68fff2185216fd72bd75"
"url": "https://github.com/nlegoff/Mediavorus.git",
"reference": "f11cd2453d5acbc6ac52421dc4edd760433b1515"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/romainneutron/MediaVorus/zipball/7cc8c0b8d3440eaff9aa68fff2185216fd72bd75",
"reference": "7cc8c0b8d3440eaff9aa68fff2185216fd72bd75",
"url": "https://api.github.com/repos/nlegoff/Mediavorus/zipball/f11cd2453d5acbc6ac52421dc4edd760433b1515",
"reference": "f11cd2453d5acbc6ac52421dc4edd760433b1515",
"shasum": ""
},
"require": {
@@ -2133,7 +2136,6 @@
"MediaVorus": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -2148,7 +2150,10 @@
"keywords": [
"metadata"
],
"time": "2014-01-06 15:45:32"
"support": {
"source": "https://github.com/nlegoff/Mediavorus/tree/fix-video-dim"
},
"time": "2014-06-10 14:03:47"
},
{
"name": "monolog/monolog",
@@ -2597,16 +2602,16 @@
},
{
"name": "php-ffmpeg/php-ffmpeg",
"version": "0.4.4",
"version": "dev-fix-aspect-ratio",
"source": {
"type": "git",
"url": "https://github.com/alchemy-fr/PHP-FFmpeg.git",
"reference": "8dfaf1815802614352bbd10eac7299a100bf9757"
"url": "https://github.com/nlegoff/PHP-FFmpeg.git",
"reference": "c2ea1ca7ab0a4da0e876e36c8cddbfa4d92dbba6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/PHP-FFmpeg/zipball/8dfaf1815802614352bbd10eac7299a100bf9757",
"reference": "8dfaf1815802614352bbd10eac7299a100bf9757",
"url": "https://api.github.com/repos/nlegoff/PHP-FFmpeg/zipball/c2ea1ca7ab0a4da0e876e36c8cddbfa4d92dbba6",
"reference": "c2ea1ca7ab0a4da0e876e36c8cddbfa4d92dbba6",
"shasum": ""
},
"require": {
@@ -2627,7 +2632,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.4-dev"
"dev-master": "0.5-dev"
}
},
"autoload": {
@@ -2635,7 +2640,6 @@
"FFMpeg": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -2662,7 +2666,10 @@
"video",
"video processing"
],
"time": "2013-12-17 16:54:46"
"support": {
"source": "https://github.com/nlegoff/PHP-FFmpeg/tree/fix-aspect-ratio"
},
"time": "2014-06-10 10:27:04"
},
{
"name": "php-mp4box/php-mp4box",
@@ -4900,9 +4907,20 @@
}
],
"aliases": [
{
"alias": "0.4.3",
"alias_normalized": "0.4.3.0",
"version": "dev-fix-video-dim",
"package": "mediavorus/mediavorus"
},
{
"alias": "0.4.4",
"alias_normalized": "0.4.4.0",
"version": "dev-fix-aspect-ratio",
"package": "php-ffmpeg/php-ffmpeg"
}
],
"minimum-stability": "stable",
"minimum-stability": "dev",
"stability-flags": {
"alchemy/task-manager": 20,
"alchemy/zippy": 20,
@@ -4913,6 +4931,10 @@
"doctrine/migrations": 20,
"behat/behat": 20,
"behat/gherkin": 20
"mediavorus/mediavorus": 20,
"media-alchemyst/media-alchemyst": 20,
"php-ffmpeg/php-ffmpeg": 20,
"doctrine/data-fixtures": 20
},
"platform": {
"php": ">=5.4"

View File

@@ -4,6 +4,8 @@ languages:
default: 'fr'
main:
maintenance: false
languages: []
key: ''
database:
host: 127.0.0.1
port: 3306
@@ -169,6 +171,9 @@ registration-fields:
-
name: company
required: true
-
name: lastname
required: true
-
name: firstname
required: true
@@ -184,3 +189,15 @@ h264-pseudo-streaming:
type: nginx
mapping: []
plugins: []
api_cors:
enabled: false
allow_credentials: false
allow_origin: []
allow_headers: []
allow_methods: []
expose_headers: []
max_age: 0
hosts: []
session:
idle: 0
lifetime: 604800 # 1 week

View File

@@ -67,8 +67,6 @@ use Alchemy\Phrasea\Controller\Root\Session;
use Alchemy\Phrasea\Controller\Setup as SetupController;
use Alchemy\Phrasea\Controller\Thesaurus\Thesaurus;
use Alchemy\Phrasea\Controller\Thesaurus\Xmlhttp as ThesaurusXMLHttp;
use Alchemy\Phrasea\Controller\Utils\ConnectionTest;
use Alchemy\Phrasea\Controller\Utils\PathFileTest;
use Alchemy\Phrasea\Controller\User\Notifications;
use Alchemy\Phrasea\Controller\User\Preferences;
use Alchemy\Phrasea\Core\PhraseaExceptionHandler;
@@ -101,6 +99,7 @@ use Alchemy\Phrasea\Core\Provider\LocaleServiceProvider;
use Alchemy\Phrasea\Core\Provider\ManipulatorServiceProvider;
use Alchemy\Phrasea\Core\Provider\NotificationDelivererServiceProvider;
use Alchemy\Phrasea\Core\Provider\ORMServiceProvider;
use Alchemy\Phrasea\Core\Provider\PhraseaEventServiceProvider;
use Alchemy\Phrasea\Core\Provider\PhraseanetServiceProvider;
use Alchemy\Phrasea\Core\Provider\PluginServiceProvider;
use Alchemy\Phrasea\Core\Provider\PhraseaVersionServiceProvider;
@@ -121,6 +120,7 @@ use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Form\Extension\HelpTypeExtension;
use Alchemy\Phrasea\Twig\JSUniqueID;
use Alchemy\Phrasea\Twig\Fit;
use Alchemy\Phrasea\Twig\Camelize;
use Alchemy\Phrasea\Twig\BytesConverter;
use Alchemy\Phrasea\Utilities\CachedTranslator;
@@ -155,8 +155,8 @@ use XPDF\XPDFServiceProvider;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGenerator;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormTypeInterface;
@@ -317,8 +317,10 @@ class Application extends SilexApplication
$this->register(new SessionHandlerServiceProvider());
$this->register(new SessionServiceProvider(), [
'session.test' => $this->getEnvironment() === static::ENV_TEST
'session.test' => $this->getEnvironment() === static::ENV_TEST,
'session.storage.options' => array('cookie_lifetime' => 0)
]);
$this['session.storage.test'] = $this->share(function ($app) {
return new MockArraySessionStorage();
});
@@ -378,6 +380,7 @@ class Application extends SilexApplication
$this->register(new FileServeServiceProvider());
$this->register(new ManipulatorServiceProvider());
$this->register(new PluginServiceProvider());
$this->register(new PhraseaEventServiceProvider());
$this['phraseanet.exception_handler'] = $this->share(function ($app) {
$handler = PhraseaExceptionHandler::register($app['debug']);
@@ -471,12 +474,12 @@ class Application extends SilexApplication
$this['dispatcher'] = $this->share(
$this->extend('dispatcher', function ($dispatcher, Application $app) {
$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));
$dispatcher->addSubscriber(new CookiesDisablerSubscriber($app));
$dispatcher->addListener(KernelEvents::RESPONSE, array($app, 'addUTF8Charset'), -128);
$dispatcher->addSubscriber($app['phraseanet.logout-subscriber']);
$dispatcher->addSubscriber($app['phraseanet.locale-subscriber']);
$dispatcher->addSubscriber($app['phraseanet.maintenance-subscriber']);
$dispatcher->addSubscriber($app['phraseanet.cookie-disabler-subscriber']);
$dispatcher->addSubscriber($app['phraseanet.session-manager-subscriber']);
$dispatcher->addSubscriber(new PhraseaInstallSubscriber($app));
return $dispatcher;
@@ -557,25 +560,6 @@ class Application extends SilexApplication
return $this->redirect($this->url($route, $parameters));
}
public function initSession(GetResponseEvent $event)
{
if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
return;
}
if (false !== stripos($event->getRequest()->server->get('HTTP_USER_AGENT'), 'flash')
&& $event->getRequest()->getRequestUri() === '/prod/upload/') {
if (null !== $sessionId = $event->getRequest()->request->get('php_session_id')) {
$request = $event->getRequest();
$request->cookies->set($this['session']->getName(), $sessionId);
return $request;
}
}
}
public function addUTF8Charset(FilterResponseEvent $event)
{
if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
@@ -642,6 +626,7 @@ class Application extends SilexApplication
// add filters truncate, wordwrap, nl2br
$twig->addExtension(new \Twig_Extensions_Extension_Text());
$twig->addExtension(new JSUniqueID());
$twig->addExtension(new Fit());
$twig->addExtension(new Camelize());
$twig->addExtension(new BytesConverter());
@@ -667,23 +652,32 @@ class Application extends SilexApplication
return ConnectedUsers::appName($app['translator'], $value);
}));
$twig->addFilter(new \Twig_SimpleFilter('escapeSimpleQuote', function ($value) {
$ret = str_replace("'", "\\'", $value);
return $ret;
return str_replace("'", "\\'", $value);
}));
$twig->addFilter(new \Twig_SimpleFilter('thesaurus', function (\Twig_Environment $twig, $value) {
if (!$value instanceof \ThesaurusValue) {
return str_replace(['[[em]]', '[[/em]]'], ['<em>', '</em>'], twig_escape_filter($twig, $value));
}
return "<a class=\"bounce\" onclick=\"bounce('" . $value->getField()->get_databox()->get_sbas_id() . "','"
. str_replace("'", "\\'", $value->getQuery())
. "', '"
. str_replace("'", "\\'", $value->getField()->get_name())
. "');return(false);\">"
. str_replace(['[[em]]', '[[/em]]'], ['<em>', '</em>'], twig_escape_filter($twig, $value->getValue()))
. "</a>";
}, ['needs_environment' => true, 'is_safe' => ['html']]));
$twig->addFilter(new \Twig_SimpleFilter('highlight', function (\Twig_Environment $twig, $string) {
return str_replace(array('[[em]]', '[[/em]]'), array('<em>', '</em>'), $string);
}, array('needs_environment' => true,'is_safe' => array('html'))));
$twig->addFilter(new \Twig_SimpleFilter('linkify', function (\Twig_Environment $twig, $string) {
return preg_replace(
"(([^']{1})((https?|file):((/{2,4})|(\\{2,4}))[\w:#%/;$()~_?/\-=\\\.&]*)([^']{1}))"
, '$1 $2 <a title="' . _('Open the URL in a new window') . '" class="ui-icon ui-icon-extlink" href="$2" style="display:inline;padding:2px 5px;margin:0 4px 0 2px;" target="_blank"> &nbsp;</a>$7'
, $string
);
}, array('needs_environment' => true, 'is_safe' => array('html'))));
$twig->addFilter(new \Twig_SimpleFilter('bounce', function (\Twig_Environment $twig, $fieldValue, $fieldName, $searchRequest, $sbasId) {
// bounce value if it is present in thesaurus as well
return "<a class=\"bounce\" onclick=\"bounce('" .$sbasId . "','"
. str_replace("'", "\\'",$searchRequest)
. "', '"
. str_replace("'", "\\'", $fieldName)
. "');return(false);\">"
. $fieldValue
. "</a>";
}, array('needs_environment' => true, 'is_safe' => array('html'))));
$twig->addFilter(new \Twig_SimpleFilter('escapeDoubleQuote', function ($value) {
return str_replace('"', '\"', $value);
@@ -843,8 +837,6 @@ class Application extends SilexApplication
$this->mount('/admin/fields', new Fields());
$this->mount('/admin/task-manager', new TaskManager());
$this->mount('/admin/subdefs', new Subdefs());
$this->mount('/admin/tests/connection', new ConnectionTest());
$this->mount('/admin/tests/pathurl', new PathFileTest());
$this->mount('/client/', new ClientRoot());
$this->mount('/client/baskets', new ClientBasket());
@@ -881,8 +873,6 @@ class Application extends SilexApplication
$this->mount('/session/', new Session());
$this->mount('/setup', new SetupController());
$this->mount('/setup/connection_test/', new ConnectionTest());
$this->mount('/setup/test/', new PathFileTest());
$this->mount('/report/', new ReportRoot());
$this->mount('/report/activity', new ReportActivity());

View File

@@ -12,13 +12,14 @@
namespace Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Core\Event\Subscriber\ApiCorsSubscriber;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Controller\Api\Oauth2;
use Alchemy\Phrasea\Controller\Api\Result;
use Alchemy\Phrasea\Controller\Api\V1;
use Alchemy\Phrasea\Core\Event\ApiResultEvent;
use Alchemy\Phrasea\Core\Event\Subscriber\ApiOauth2ErrorsSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\ApiExceptionHandlerSubscriber;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Monolog\Logger;
use Monolog\Processor\WebProcessor;
use Silex\Application as SilexApplication;
@@ -71,6 +72,8 @@ return call_user_func(function ($environment = PhraseaApplication::ENV_PROD) {
$app->after(function (Request $request, Response $response) use ($app) {
$app['dispatcher']->dispatch(PhraseaEvents::API_RESULT, new ApiResultEvent($request, $response));
});
$app['dispatcher']->addSubscriber(new ApiCorsSubscriber($app));
$app['dispatcher']->dispatch(PhraseaEvents::API_LOAD_END, new ApiLoadEndEvent());
return $app;
}, isset($environment) ? $environment : PhraseaApplication::ENV_PROD);

View File

@@ -15,6 +15,8 @@ use Alchemy\Phrasea\Border\Checker\CheckerInterface;
use Alchemy\Phrasea\Border\Attribute\AttributeInterface;
use Alchemy\Phrasea\Metadata\Tag\TfArchivedate;
use Alchemy\Phrasea\Metadata\Tag\TfQuarantine;
use Alchemy\Phrasea\Metadata\Tag\TfBasename;
use Alchemy\Phrasea\Metadata\Tag\TfFilename;
use Alchemy\Phrasea\Metadata\Tag\TfRecordid;
use Alchemy\Phrasea\Border\Attribute\Metadata as MetadataAttr;
use Alchemy\Phrasea\Model\Entities\LazaretAttribute;
@@ -242,20 +244,37 @@ class Manager
)
)
);
$file->addAttribute(
new MetadataAttr(
new Metadata(
new TfBasename(), new MonoValue(pathinfo($file->getOriginalName(), PATHINFO_BASENAME))
)
)
);
$file->addAttribute(
new MetadataAttr(
new Metadata(
new TfFilename(), new MonoValue(pathinfo($file->getOriginalName(), PATHINFO_FILENAME))
)
)
);
$newMetadata = $file->getMedia()->getMetadatas()->toArray();
foreach ($file->getAttributes() as $attribute) {
switch ($attribute->getName()) {
/**
* @todo implement METATAG aka metadata by fieldname (where as
* current metadata is metadata by source.
*/
case AttributeInterface::NAME_METAFIELD:
$values = $attribute->getValue();
$value = $attribute->getField()->is_multi() ? new Multi($values) : new MonoValue(array_pop($values));
$newMetadata[] = new Metadata($attribute->getField()->get_tag(), $value);
$tag = $attribute->getField()->get_tag();
if ($tag instanceof \Alchemy\Phrasea\Metadata\Tag\Nosource) {
$tag->setTagname($attribute->getField()->get_name());
$_meta = new Metadata($tag, $value);
} else {
$_meta = new Metadata($attribute->getField()->get_tag(), $value);
}
$newMetadata[] = $_meta;
break;
case AttributeInterface::NAME_METADATA:
@@ -342,7 +361,6 @@ class Manager
$attribute->setName($fileAttribute->getName());
$attribute->setValue($fileAttribute->asString());
$attribute->setLazaretFile($lazaretFile);
$lazaretFile->addAttribute($attribute);
$this->app['EM']->persist($attribute);

View File

@@ -16,7 +16,6 @@ use MediaVorus\Utils\AudioMimeTypeGuesser;
use MediaVorus\Utils\PostScriptMimeTypeGuesser;
use MediaVorus\Utils\RawImageMimeTypeGuesser;
use MediaVorus\Utils\VideoMimeTypeGuesser;
use Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
class MimeGuesserConfiguration
@@ -36,7 +35,6 @@ class MimeGuesserConfiguration
{
$guesser = MimeTypeGuesser::getInstance();
$guesser->register(new FileBinaryMimeTypeGuesser());
$guesser->register(new RawImageMimeTypeGuesser());
$guesser->register(new PostScriptMimeTypeGuesser());
$guesser->register(new AudioMimeTypeGuesser());

View File

@@ -254,11 +254,11 @@ class Collection implements ControllerProviderInterface
}
if ('json' === $app['request']->getRequestFormat()) {
return $app->json([
'success' => $success,
'msg' => $msg,
'bas_id' => $collection->get_base_id()
]);
return $app->json(array(
'success' => $success,
'msg' => $msg,
'bas_id' => $collection->get_base_id()
));
}
return $app->redirectPath('admin_display_collection', [

View File

@@ -12,6 +12,8 @@
namespace Alchemy\Phrasea\Controller\Admin;
use Alchemy\Phrasea\Exception\SessionNotFound;
use Alchemy\Phrasea\Helper\DatabaseHelper;
use Alchemy\Phrasea\Helper\PathHelper;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
@@ -24,7 +26,6 @@ class Root implements ControllerProviderInterface
$app['controller.admin.root'] = $this;
$controllers = $app['controllers_factory'];
$app['firewall']->addMandatoryAuthentication($controllers);
$controllers->before(function (Request $request) use ($app) {
@@ -447,6 +448,24 @@ class Root implements ControllerProviderInterface
->assert('bit', '\d+')
->bind('database_submit_statusbit');
$controllers->get('/tests/connection/mysql/', function (Application $app, Request $request) {
$dbHelper = new DatabaseHelper($app, $request);
return $app->json($dbHelper->checkConnection());
});
$controllers->get('/tests/pathurl/path/', function (Application $app, Request $request) {
$pathHelper = new PathHelper($app, $request);
return $app->json($pathHelper->checkPath());
});
$controllers->get('/tests/pathurl/url/', function (Application $app, Request $request) {
$pathHelper = new PathHelper($app, $request);
return $app->json($pathHelper->checkUrl());
});
return $controllers;
}
}

View File

@@ -194,7 +194,7 @@ class Users implements ControllerProviderInterface
}
$filename = sprintf('user_export_%s.csv', date('Ymd'));
$response = new CSVFileResponse($filename, function() use ($app, $userTable) {
$response = new CSVFileResponse($filename, function () use ($app, $userTable) {
$app['csv.exporter']->export('php://output', $userTable);
});
@@ -341,7 +341,7 @@ class Users implements ControllerProviderInterface
} while (count($results) > 0);
$filename = sprintf('user_export_%s.csv', date('Ymd'));
$response = new CSVFileResponse($filename, function() use ($app, $buffer) {
$response = new CSVFileResponse($filename, function () use ($app, $buffer) {
$app['csv.exporter']->export('php://output', $buffer);
});
@@ -521,7 +521,7 @@ class Users implements ControllerProviderInterface
return $app->redirectPath('users_display_import_file', ['error' => 'file-invalid']);
}
$equivalenceToMysqlField = self::getEquivalenceToMysqlField();
$equivalenceToMysqlField = Users::getEquivalenceToMysqlField();
$loginDefined = $pwdDefined = $mailDefined = false;
$loginNew = [];
$out = [
@@ -531,7 +531,7 @@ class Users implements ControllerProviderInterface
$nbUsrToAdd = 0;
$lines = array();
$app['csv.interpreter']->addObserver(function(array $row) use (&$lines) {
$app['csv.interpreter']->addObserver(function (array $row) use (&$lines) {
$lines[] = $row;
});
$app['csv.lexer']->parse($file->getPathname(), $app['csv.interpreter']);

View File

@@ -97,7 +97,8 @@ class DoDownload implements ControllerProviderInterface
'list' => $list,
'records' => $records,
'token' => $token,
'anonymous' => $request->query->get('anonymous', false)
'anonymous' => $request->query->get('anonymous', false),
'type' => $request->query->get('type', \Session_Logger::EVENT_EXPORTDOWNLOAD)
]));
}
@@ -143,12 +144,12 @@ class DoDownload implements ControllerProviderInterface
$app->abort(404, 'Download file not found');
}
$app['dispatcher']->addListener(KernelEvents::TERMINATE, function (PostResponseEvent $event) use ($list, $app) {
$app['dispatcher']->addListener(KernelEvents::RESPONSE, function (PostResponseEvent $event) use ($list, $app) {
\set_export::log_download(
$app,
$list,
$event->getRequest()->request->get('type'),
(null !== $event->getRequest()->request->get('anonymous') ? true : false),
$event->getRequest()->get('type'),
!!$event->getRequest->get('anonymous', false),
(isset($list['email']) ? $list['email'] : '')
);
});

View File

@@ -345,7 +345,7 @@ class Edit implements ControllerProviderInterface
$editDirty = true;
}
if (is_array($rec['metadatas'])) {
if (isset($rec['metadatas']) && is_array($rec['metadatas'])) {
$record->set_metadatas($rec['metadatas']);
}

View File

@@ -228,7 +228,7 @@ class Export implements ControllerProviderInterface
$remaingEmails = $destMails;
$url = $app->url('prepare_download', ['token' => $token->getValue(), 'anonymous']);
$url = $app->url('prepare_download', ['token' => $token->getValue(), 'anonymous' => false, 'type' => \Session_Logger::EVENT_EXPORTMAIL]);
$emitter = new Emitter($app['authentication']->getUser()->getDisplayName(), $app['authentication']->getUser()->getEmail());

View File

@@ -22,8 +22,9 @@ class Language implements ControllerProviderInterface
$controller = $app['controllers_factory'];
$controller->get("/", function (Application $app) {
$app['firewall']->addMandatoryAuthentication($controller);
$controller->get("/", function (Application $app) {
$out = [];
$out['thesaurusBasesChanged'] = $app->trans('prod::recherche: Attention : la liste des bases selectionnees pour la recherche a ete changee.');
$out['confirmDel'] = $app->trans('paniers::Vous etes sur le point de supprimer ce panier. Cette action est irreversible. Souhaitez-vous continuer ?');

View File

@@ -32,7 +32,7 @@ class Push implements ControllerProviderInterface
protected function getUserFormatter(Application $app)
{
return function (User $user) use ($app) {
$subtitle = array_filter([$user->getJob(), $user->getCompany()]);
$subtitle = array_filter([$user->getPosition(), $user->getCompany()]);
return [
'type' => 'USER',
@@ -217,12 +217,17 @@ class Push implements ControllerProviderInterface
$app['EM']->flush();
$url = $app->url('lightbox_compare', [
'basket' => $Basket->getId(),
'LOG' => $app['manipulator.token']->createBasketAccessToken($Basket, $user_receiver),
]);
$arguments = array(
'ssel_id' => $Basket->getId(),
);
$receipt = $request->get('recept') ? $app['authentication']->getUser()->getEmail() : '';
if (!$app['phraseanet.registry']->get('GV_force_push_authentication') || !$request->get('force_authentication')) {
$arguments['LOG'] = $app['manipulator.token']->createBasketAccessToken($Basket, $user_receiver);
}
$url = $app->url('lightbox_compare', $arguments);
$receipt = $request->get('recept') ? $app['authentication']->getUser()->get_email() : '';
$params = [
'from' => $app['authentication']->getUser()->getId(),

View File

@@ -99,12 +99,10 @@ class Tooltip implements ControllerProviderInterface
public function displayPreview(Application $app, $sbas_id, $record_id)
{
$record = new \record_adapter($app, $sbas_id, $record_id);
return $app['twig']->render(
'prod/Tooltip/Preview.html.twig'
, ['record' => $record, 'not_wrapped' => true]
);
return $app['twig']->render('prod/Tooltip/Preview.html.twig', array(
'record' => new \record_adapter($app, $sbas_id, $record_id),
'not_wrapped' => true
));
}
public function displayCaption(Application $app, $sbas_id, $record_id, $context)

View File

@@ -309,8 +309,6 @@ class Activity implements ControllerProviderInterface
$activity->setConfig(false);
if ($request->request->get('printcsv') == 'on') {
$activity->setHasLimit(false);
$activity->setPrettyString(false);
@@ -862,13 +860,13 @@ class Activity implements ControllerProviderInterface
$result = $report->getResult();
array_unshift($result, $headers);
$collection = new CallbackCollection($result, function($row) use ($report) {
$collection = new CallbackCollection($result, function ($row) use ($report) {
// restrict to displayed fields
return array_map('strip_tags', array_intersect_key($row, $report->getDisplay()));
});
$filename = sprintf('report_export_%s_%s.csv', $type, date('Ymd'));
$response = new CSVFileResponse($filename, function() use ($app, $collection) {
$response = new CSVFileResponse($filename, function () use ($app, $collection) {
$app['csv.exporter']->export('php://output', $collection);
});

View File

@@ -520,13 +520,13 @@ class Informations implements ControllerProviderInterface
$result = $report->getResult();
array_unshift($result, $headers);
$collection = new CallbackCollection($result, function($row) use ($report) {
$collection = new CallbackCollection($result, function ($row) use ($report) {
// restrict fields to the displayed ones
return array_map('strip_tags', array_intersect_key($row, $report->getDisplay()));
});
$filename = sprintf('report_export_%s_%s.csv', $type, date('Ymd'));
$response = new CSVFileResponse($filename, function() use ($app, $collection) {
$response = new CSVFileResponse($filename, function () use ($app, $collection) {
$app['csv.exporter']->export('php://output', $collection);
});

View File

@@ -18,7 +18,6 @@ use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
class Root implements ControllerProviderInterface
{
@@ -486,28 +485,28 @@ class Root implements ControllerProviderInterface
$result = array();
$result[] = array_keys($conf_nav);
foreach($report['nav']['result'] as $row) {
foreach ($report['nav']['result'] as $row) {
$result[] = array_values($row);
};
$result[] = array_keys($conf_os);
foreach($report['os']['result'] as $row) {
foreach ($report['os']['result'] as $row) {
$result[] = array_values($row);
};
$result[] = array_keys($conf_res);
foreach($report['res']['result'] as $row) {
foreach ($report['res']['result'] as $row) {
$result[] = array_values($row);
};
$result[] = array_keys($conf_mod);
foreach($report['mod']['result'] as $row) {
foreach ($report['mod']['result'] as $row) {
$result[] = array_values($row);
};
$result[] = array_keys($conf_combo);
foreach($report['combo']['result'] as $row) {
foreach ($report['combo']['result'] as $row) {
$result[] = array_values($row);
};
$filename = sprintf('report_export_info_%s.csv', date('Ymd'));
$response = new CSVFileResponse($filename, function() use ($app, $result) {
$response = new CSVFileResponse($filename, function () use ($app, $result) {
$app['csv.exporter']->export('php://output', $result);
});
@@ -686,13 +685,13 @@ class Root implements ControllerProviderInterface
$result = $report->getResult();
array_unshift($result, $headers);
$collection = new CallbackCollection($result, function($row) use ($report) {
$collection = new CallbackCollection($result, function ($row) use ($report) {
// restrict fields to the displayed ones
return array_map('strip_tags', array_intersect_key($row, $report->getDisplay()));
});
$filename = sprintf('report_export_%s_%s.csv', $type, date('Ymd'));
$response = new CSVFileResponse($filename, function() use ($app, $collection) {
$response = new CSVFileResponse($filename, function () use ($app, $collection) {
$app['csv.exporter']->export('php://output', $collection);
});

View File

@@ -64,6 +64,10 @@ class Developers implements ControllerProviderInterface
->assert('application', '\d+')
->bind('submit_application_callback');
$controllers->post('/application/{id}/webhook/', $this->call('renewAppWebhook'))
->assert('id', '\d+')
->bind('submit_application_webhook');
return $controllers;
}
@@ -111,6 +115,30 @@ class Developers implements ControllerProviderInterface
return $app->json(['success' => true]);
}
/**
* Change application webhook
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
* @param integer $id The application id
* @return JsonResponse
*/
public function renewAppWebhook(Application $app, Request $request, $id)
{
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed'));
}
if (null !== $request->request->get("webhook")) {
$app['manipulator.api-application']->setWebhook($request->request->get("webhook"));
} else {
return $app->json(['success' => false]);
}
return $app->json(array('success' => true));
}
/**
* Authorize application to use a grant password type.
*

View File

@@ -284,6 +284,12 @@ class Login implements ControllerProviderInterface
unset($requestData['geonameid-completer']);
}
// Remove multiselect field for validation this field is added client side
// with bootstrap multiselect plugin
if (isset($requestData['multiselect'])) {
unset($requestData['multiselect']);
}
$form->bind($requestData);
$data = $form->getData();
@@ -717,7 +723,7 @@ class Login implements ControllerProviderInterface
$feeds = $app['repo.feeds']->findBy(['public' => true], ['updatedOn' => 'DESC']);
$form = $app->form(new PhraseaAuthenticationForm());
$form = $app->form(new PhraseaAuthenticationForm($app));
$form->setData([
'redirect' => $request->query->get('redirect')
]);
@@ -739,7 +745,7 @@ class Login implements ControllerProviderInterface
*/
public function authenticate(PhraseaApplication $app, Request $request)
{
$form = $app->form(new PhraseaAuthenticationForm());
$form = $app->form(new PhraseaAuthenticationForm($app));
$redirector = function (array $params = []) use ($app) {
return $app->redirectPath('homepage', $params);
};
@@ -1027,7 +1033,7 @@ class Login implements ControllerProviderInterface
$session->setToken($token)->setNonce($nonce);
$response->headers->setCookie(new Cookie('persistent', $token));
$response->headers->setCookie(new Cookie('persistent', $token, time() + $app['phraseanet.configuration']['session']['lifetime']));
$app['EM']->persist($session);
$app['EM']->flush();

View File

@@ -28,6 +28,9 @@ class Session implements ControllerProviderInterface
$controllers->post('/update/', 'controller.session:updateSession')
->bind('update_session');
$controllers->post('/notifications/', 'controller.session:getNotifications')
->bind('list_notifications');
$controller = $controllers->post('/delete/{id}', 'controller.session:deleteSession')
->bind('delete_session');
@@ -36,6 +39,76 @@ class Session implements ControllerProviderInterface
return $controllers;
}
/**
* Check things to notify
*
* @param Application $app
* @param Request $request
* @return JsonResponse
*/
public function getNotifications(Application $app, Request $request)
{
if (!$request->isXmlHttpRequest()) {
$app->abort(400);
}
$ret = array(
'status' => 'unknown',
'message' => '',
'notifications' => false,
'changed' => array()
);
if ($app['authentication']->isAuthenticated()) {
$usr_id = $app['authentication']->getUser()->get_id();
if ($usr_id != $request->request->get('usr')) { // I logged with another user
$ret['status'] = 'disconnected';
return $app->json($ret);
}
} else {
$ret['status'] = 'disconnected';
return $app->json($ret);
}
try {
$app['phraseanet.appbox']->get_connection();
} catch (\Exception $e) {
return $app->json($ret);
}
if (1 > $moduleId = (int) $request->request->get('module')) {
$ret['message'] = 'Missing or Invalid `module` parameter';
return $app->json($ret);
}
$ret['status'] = 'ok';
$ret['notifications'] = $app['twig']->render('prod/notifications.html.twig', array(
'notifications' => $app['events-manager']->get_notifications()
));
$baskets = $app['EM']->getRepository('\Entities\Basket')->findUnreadActiveByUser($app['authentication']->getUser());
foreach ($baskets as $basket) {
$ret['changed'][] = $basket->getId();
}
if (in_array($app['session']->get('phraseanet.message'), array('1', null))) {
if ($app['phraseanet.configuration']['main']['maintenance']) {
$ret['message'] .= _('The application is going down for maintenance, please logout.');
}
if ($app['phraseanet.registry']->get('GV_message_on')) {
$ret['message'] .= strip_tags($app['phraseanet.registry']->get('GV_message'));
}
}
return $app->json($ret);
}
/**
* Check session state
*

View File

@@ -12,6 +12,8 @@
namespace Alchemy\Phrasea\Controller;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Helper\DatabaseHelper;
use Alchemy\Phrasea\Helper\PathHelper;
use Alchemy\Phrasea\Setup\Requirements\BinariesRequirements;
use Alchemy\Phrasea\Setup\Requirements\FilesystemRequirements;
use Alchemy\Phrasea\Setup\Requirements\LocalesRequirements;
@@ -46,6 +48,24 @@ class Setup implements ControllerProviderInterface
$controllers->post('/installer/install/', 'controller.setup:doInstall')
->bind('install_do_install');
$controllers->get('/connection_test/mysql/', function (Application $app, Request $request) {
$dbHelper = new DatabaseHelper($app, $request);
return $app->json($dbHelper->checkConnection());
});
$controllers->get('/test/path/', function (Application $app, Request $request) {
$pathHelper = new PathHelper($app, $request);
return $app->json($pathHelper->checkPath());
});
$controllers->get('/test/url/', function (Application $app, Request $request) {
$pathHelper = new PathHelper($app, $request);
return $app->json($pathHelper->checkUrl());
});
return $controllers;
}

View File

@@ -739,7 +739,7 @@ class Xmlhttp implements ControllerProviderInterface
public function OpenBranchJson(Application $app, Request $request)
{
if (null === $lng = $request->get('lng')) {
if (null === ($lng = $request->get('lng'))) {
$data = explode('_', $app['locale']);
if (count($data) > 0) {
$lng = $data[0];
@@ -750,6 +750,15 @@ class Xmlhttp implements ControllerProviderInterface
$sbid = (int) $request->get('sbid');
$lcoll = '';
$collections = $app['authentication']->getUser()->ACL()
->get_granted_base(array(), array($sbid)); // array(), $sbid);
foreach ($collections as $collection) {
$lcoll .= ($lcoll?",":"") . $collection->get_coll_id();
}
$site = $app['phraseanet.configuration']['main']['key'];
$usr_id = $app['authentication']->getUser()->get_id();
$tids = explode('.', $request->get('id'));
$thid = implode('.', $tids);
@@ -765,11 +774,14 @@ class Xmlhttp implements ControllerProviderInterface
if ($lthid == 1) {
$dthid = str_replace('.', 'd', $thid);
$sql = 'SELECT COUNT(DISTINCT record_id) AS n
FROM thit WHERE value LIKE :like ';
$sql = 'SELECT COUNT(DISTINCT r.record_id) AS n
FROM (thit AS t INNER JOIN record AS r USING(record_id))
INNER JOIN collusr AS c ON c.site=:site AND c.usr_id=:usr_id AND r.coll_id=c.coll_id
WHERE t.value LIKE :like AND r.coll_id IN('.$lcoll.') AND (r.status^c.mask_xor)&c.mask_and=0';
$sqlparm = array(':like' => $dthid . '%', ':site'=>$site, ':usr_id'=>$usr_id);
$stmt = $connbas->prepare($sql);
$stmt->execute([':like' => $dthid . '%']);
$stmt->execute($sqlparm);
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -778,14 +790,16 @@ class Xmlhttp implements ControllerProviderInterface
}
$sql = 'SELECT
SUBSTRING_INDEX(SUBSTR(value, ' . ($lthid + 1) . '), "d", 1) AS k ,
COUNT(DISTINCT record_id) AS n
FROM thit
WHERE value LIKE :like
SUBSTRING_INDEX(SUBSTR(t.value, ' . ($lthid + 1) . '), "d", 1) AS k ,
COUNT(DISTINCT t.record_id) AS n
FROM (thit AS t INNER JOIN record AS r USING(record_id))
INNER JOIN collusr AS c ON c.site=:site AND c.usr_id=:usr_id AND r.coll_id=c.coll_id
WHERE t.value LIKE :like AND r.coll_id IN('.$lcoll.') AND (r.status^c.mask_xor)&c.mask_and=0
GROUP BY k';
$sqlparm = array(':like' => $dthid . '%', ':site'=>$site, ':usr_id'=>$usr_id);
$stmt = $connbas->prepare($sql);
$stmt->execute([':like' => $dthid . '%']);
$stmt->execute(array(':like' => $dthid . '%'));
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -795,14 +809,16 @@ class Xmlhttp implements ControllerProviderInterface
} elseif (strlen($thid) > 1) {
$dthid = str_replace('.', 'd', $thid);
$sql = 'SELECT
SUBSTRING_INDEX(SUBSTR(value, ' . ($lthid) . '), \'d\', 1) AS k ,
COUNT(DISTINCT record_id) AS n
FROM thit
WHERE value LIKE :like
SUBSTRING_INDEX(SUBSTR(t.value, ' . ($lthid) . '), \'d\', 1) AS k ,
COUNT(DISTINCT t.record_id) AS n
FROM (thit AS t INNER JOIN record AS r USING(record_id))
INNER JOIN collusr AS c ON c.site=:site AND c.usr_id=:usr_id AND r.coll_id=c.coll_id
WHERE t.value LIKE :like AND r.coll_id IN('.$lcoll.') AND (r.status^c.mask_xor)&c.mask_and=0
GROUP BY k';
$sqlparm = array(':like' => $dthid . '%', ':site'=>$site, ':usr_id'=>$usr_id);
$stmt = $connbas->prepare($sql);
$stmt->execute([':like' => $dthid . '%']);
$stmt->execute($sqlparm);
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -811,14 +827,16 @@ class Xmlhttp implements ControllerProviderInterface
}
$sql = 'SELECT
SUBSTRING_INDEX(SUBSTR(value, ' . ($lthid + 2) . '), \'d\', 1) AS k ,
COUNT(DISTINCT record_id) AS n
FROM thit
WHERE value LIKE :like
SUBSTRING_INDEX(SUBSTR(t.value, ' . ($lthid + 2) . '), \'d\', 1) AS k ,
COUNT(DISTINCT t.record_id) AS n
FROM (thit AS t INNER JOIN record AS r USING(record_id))
INNER JOIN collusr AS c ON c.site=:site AND c.usr_id=:usr_id AND r.coll_id=c.coll_id
WHERE t.value LIKE :like AND r.coll_id IN('.$lcoll.') AND (r.status^c.mask_xor)&c.mask_and=0
GROUP BY k';
$sqlparm = array(':like' => $dthid . '%', ':site'=>$site, ':usr_id'=>$usr_id);
$stmt = $connbas->prepare($sql);
$stmt->execute([':like' => $dthid . '%']);
$stmt->execute($sqlparm);
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -905,7 +923,7 @@ class Xmlhttp implements ControllerProviderInterface
$html .= '<UL ' . $field0 . '>' . "\n";
if ($request->get('sortsy') && $request->get('lng')) {
if ($request->get('sortsy') && $lng != '') {
ksort($tts, SORT_STRING);
} elseif ($request->get('type') == 'C') {
$tts = array_reverse($tts);

View File

@@ -1,99 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Controller\Utils;
use Silex\Application;
use Silex\ControllerProviderInterface;
class ConnectionTest implements ControllerProviderInterface
{
public function connect(Application $app)
{
$app['controller.utils.connection-test'] = $this;
$controllers = $app['controllers_factory'];
/**
* @todo : check this as it would lead to a security issue
*/
$controllers->get('/mysql/', function (Application $app) {
$request = $app['request'];
$hostname = $request->query->get('hostname', '127.0.0.1');
$port = (int) $request->query->get('port', 3306);
$user = $request->query->get('user');
$password = $request->query->get('password');
$dbname = $request->query->get('dbname');
$connection_ok = $db_ok = $is_databox = $is_appbox = $empty = false;
try {
$conn = $app['dbal.provider']->get([
'host' => $hostname,
'port' => $port,
'user' => $user,
'password' => $password,
]);
$conn->connect();
$connection_ok = true;
} catch (\Exception $e) {
}
if ($dbname && $connection_ok === true) {
try {
$conn = $app['dbal.provider']->get([
'host' => $hostname,
'port' => $port,
'user' => $user,
'password' => $password,
'dbname' => $dbname,
]);
$conn->connect();
$db_ok = true;
$sql = "SHOW TABLE STATUS";
$stmt = $conn->prepare($sql);
$stmt->execute();
$empty = $stmt->rowCount() === 0;
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row) {
if ($row["Name"] === 'sitepreff') {
$is_appbox = true;
}
if ($row["Name"] === 'pref') {
$is_databox = true;
}
}
} catch (\Exception $e) {
}
}
$datas = [
'connection' => $connection_ok
, 'database' => $db_ok
, 'is_empty' => $empty
, 'is_appbox' => $is_appbox
, 'is_databox' => $is_databox
];
return $app->json($datas);
});
return $controllers;
}
}

View File

@@ -1,46 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Controller\Utils;
use Symfony\Component\HttpFoundation\Request;
use Silex\Application;
use Silex\ControllerProviderInterface;
class PathFileTest implements ControllerProviderInterface
{
public function connect(Application $app)
{
$app['controller.utils.pathfile-test'] = $this;
$controllers = $app['controllers_factory'];
/**
* @todo : check this as it would lead to a security issue
*/
$controllers->get('/path/', function (Application $app, Request $request) {
return $app->json([
'exists' => file_exists($request->query->get('path'))
, 'file' => is_file($request->query->get('path'))
, 'dir' => is_dir($request->query->get('path'))
, 'readable' => is_readable($request->query->get('path'))
, 'writeable' => is_writable($request->query->get('path'))
, 'executable' => is_executable($request->query->get('path'))
]);
});
$controllers->get('/url/', function (Application $app, Request $request) {
return $app->json(['code' => \http_query::getHttpCodeFromUrl($request->query->get('url'))]);
});
return $controllers;
}
}

View File

@@ -0,0 +1,207 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event\Subscriber;
use Alchemy\Phrasea\Application;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
class ApiCorsSubscriber implements EventSubscriberInterface
{
/**
* Simple headers as defined in the spec should always be accepted
*/
protected static $simpleHeaders = array(
'accept',
'accept-language',
'content-language',
'origin',
);
private $app;
private $options;
public function __construct(Application $app)
{
$this->app = $app;
}
public static function getSubscribedEvents()
{
return array(
KernelEvents::REQUEST => array('onKernelRequest', 128),
);
}
public function onKernelRequest(GetResponseEvent $event)
{
if (!$this->app['phraseanet.configuration']['api_cors']['enabled']) {
return;
}
if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
return;
}
$request = $event->getRequest();
if (!preg_match('{api/v(\d+)}i', $request->getPathInfo() ?: '/')) {
return;
}
// skip if not a CORS request
if (!$request->headers->has('Origin') || $request->headers->get('Origin') == $request->getSchemeAndHttpHost()) {
return;
}
$options = array_merge(array(
'allow_credentials'=> false,
'allow_origin'=> array(),
'allow_headers'=> array(),
'allow_methods'=> array(),
'expose_headers'=> array(),
'max_age'=> 0,
'hosts'=> array(),
), $this->app['phraseanet.configuration']['api_cors']);
// skip if the host is not matching
if (!$this->checkHost($request, $options)) {
return;
}
// perform preflight checks
if ('OPTIONS' === $request->getMethod()) {
$event->setResponse($this->getPreflightResponse($request, $options));
return;
}
if (!$this->checkOrigin($request, $options)) {
$response = new Response('', 403, array('Access-Control-Allow-Origin' => 'null'));
$event->setResponse($response);
return;
}
$this->app['dispatcher']->addListener(KernelEvents::RESPONSE, array($this, 'onKernelResponse'));
$this->options = $options;
}
public function onKernelResponse(FilterResponseEvent $event)
{
if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
return;
}
$response = $event->getResponse();
$request = $event->getRequest();
// add CORS response headers
$response->headers->set('Access-Control-Allow-Origin', $request->headers->get('Origin'));
if ($this->options['allow_credentials']) {
$response->headers->set('Access-Control-Allow-Credentials', 'true');
}
if ($this->options['expose_headers']) {
$response->headers->set('Access-Control-Expose-Headers', strtolower(implode(', ', $this->options['expose_headers'])));
}
}
protected function getPreflightResponse(Request $request, array $options)
{
$response = new Response();
if ($options['allow_credentials']) {
$response->headers->set('Access-Control-Allow-Credentials', 'true');
}
if ($options['allow_methods']) {
$response->headers->set('Access-Control-Allow-Methods', implode(', ', $options['allow_methods']));
}
if ($options['allow_headers']) {
$headers = in_array('*', $options['allow_headers'])
? $request->headers->get('Access-Control-Request-Headers')
: implode(', ', array_map('strtolower', $options['allow_headers']));
$response->headers->set('Access-Control-Allow-Headers', $headers);
}
if ($options['max_age']) {
$response->headers->set('Access-Control-Max-Age', $options['max_age']);
}
if (!$this->checkOrigin($request, $options)) {
$response->headers->set('Access-Control-Allow-Origin', 'null');
return $response;
}
$response->headers->set('Access-Control-Allow-Origin', $request->headers->get('Origin'));
// check request method
if (!in_array(strtoupper($request->headers->get('Access-Control-Request-Method')), $options['allow_methods'], true)) {
$response->setStatusCode(405);
return $response;
}
/**
* We have to allow the header in the case-set as we received it by the client.
* Firefox f.e. sends the LINK method as "Link", and we have to allow it like this or the browser will deny the
* request.
*/
if (!in_array($request->headers->get('Access-Control-Request-Method'), $options['allow_methods'], true)) {
$options['allow_methods'][] = $request->headers->get('Access-Control-Request-Method');
$response->headers->set('Access-Control-Allow-Methods', implode(', ', $options['allow_methods']));
}
// check request headers
$headers = $request->headers->get('Access-Control-Request-Headers');
if ($options['allow_headers'] !== true && $headers) {
$headers = trim(strtolower($headers));
foreach (preg_split('{, *}', $headers) as $header) {
if (in_array($header, self::$simpleHeaders, true)) {
continue;
}
if (!in_array($header, $options['allow_headers'], true)) {
$response->setStatusCode(400);
$response->setContent('Unauthorized header '.$header);
break;
}
}
}
return $response;
}
protected function checkOrigin(Request $request, array $options)
{
// check origin
$origin = $request->headers->get('Origin');
if (in_array('*', $options['allow_origin']) || in_array($origin, $options['allow_origin'])) {
return true;
}
return false;
}
protected function checkHost(Request $request, array $options)
{
if (count($options['hosts']) === 0) {
return true;
}
foreach ($options['hosts'] as $hostRegexp) {
if (preg_match('{'.$hostRegexp.'}i', $request->getHost())) {
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,157 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event\Subscriber;
use Alchemy\Phrasea\Application;
use Entities\SessionModule;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
class SessionManagerSubscriber implements EventSubscriberInterface
{
private $app;
public function __construct(Application $app)
{
$this->app = $app;
}
public static function getSubscribedEvents()
{
return array(
KernelEvents::REQUEST => array(
array('initSession', Application::EARLY_EVENT),
array('checkSessionActivity', Application::LATE_EVENT)
)
);
}
public function initSession(GetResponseEvent $event)
{
if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
return;
}
if ($this->isFlashUploadRequest($event->getRequest())) {
if (null !== $sessionId = $event->getRequest()->request->get('php_session_id')) {
$request = $event->getRequest();
$request->cookies->set($this->app['session']->getName(), $sessionId);
return $request;
}
}
}
/**log real human activity on application, to keep session alive*/
public function checkSessionActivity(GetResponseEvent $event)
{
$modulesIds = array(
"prod" => 1,
"client" => 2,
"admin" => 3,
"thesaurus" => 5,
"report" => 10,
"lightbox" => 6,
);
$pathInfo = array_filter(explode('/', $event->getRequest()->getPathInfo()));
if (count($pathInfo) < 1) {
return;
}
$moduleName = strtolower($pathInfo[1]);
if (!array_key_exists($moduleName, $modulesIds) ) {
return;
}
// this route is polled by js in admin/databox to refresh infos (progress bar...)
if (preg_match("#^/admin/databox/[0-9]+/informations/documents/#", $event->getRequest()->getPathInfo()) == 1) {
return;
}
// this route is polled by js in admin/tasks to refresh tasks status
if ($event->getRequest()->getPathInfo() == "/admin/task-manager/tasks/" && $event->getRequest()->getContentType() == 'json') {
return;
}
if ($this->isFlashUploadRequest($event->getRequest())) {
return;
}
if ($event->getRequest()->query->has('LOG')) {
return;
}
// if we are already disconnected (ex. from another window), quit immediatly
if (!($this->app['authentication']->isAuthenticated())) {
if ($event->getRequest()->isXmlHttpRequest()) {
$response = new Response("End-Session", 403);
} else {
$response = new RedirectResponse($this->app["url_generator"]->generate("homepage", array("redirect"=>'..' . $event->getRequest()->getPathInfo())));
}
$response->headers->set('X-Phraseanet-End-Session', '1');
$event->setResponse($response);
return;
}
$session = $this->app['EM']->find('Entities\Session', $this->app['session']->get('session_id'));
$idle = 0;
if (isset($this->app["phraseanet.configuration"]["session"]["idle"])) {
$idle = (int) ($this->app["phraseanet.configuration"]["session"]["idle"]);
}
$now = new \DateTime();
$dt = $now->getTimestamp() - $session->getUpdated()->getTimestamp();
if ($idle > 0 && $dt > $idle) {
// we must disconnet due to idletime
$this->app['authentication']->closeAccount();
if ($event->getRequest()->isXmlHttpRequest()) {
$response = new Response("End-Session", 403);
} else {
$response = new RedirectResponse($this->app["url_generator"]->generate("homepage", array("redirect"=>'..' . $event->getRequest()->getPathInfo())));
}
$response->headers->set('X-Phraseanet-End-Session', '1');
$event->setResponse($response);
return;
}
$moduleId = $modulesIds[$moduleName];
$session->setUpdated(new \DateTime());
if (!$session->hasModuleId($moduleId)) {
$module = new SessionModule();
$module->setModuleId($moduleId);
$module->setSession($session);
$session->addModule($module);
$this->app['EM']->persist($module);
} else {
$this->app['EM']->persist($session->getModuleById($moduleId)->setUpdated(new \DateTime()));
}
$this->app['EM']->persist($session);
$this->app['EM']->flush();
}
private function isFlashUploadRequest(Request $request)
{
return false !== stripos($request->server->get('HTTP_USER_AGENT'), 'flash')
&& $request->getRequestUri() === '/prod/upload/';
}
}

View File

@@ -26,8 +26,9 @@ class CSVServiceProvider implements ServiceProviderInterface
{
$app['csv.exporter.config'] = $app->share(function () {
$config = new ExporterConfig();
return $config
->setDelimiter(",")
->setDelimiter(";")
->setEnclosure('"')
->setEscape("\\")
->setToCharset('UTF-8')
@@ -40,7 +41,14 @@ class CSVServiceProvider implements ServiceProviderInterface
});
$app['csv.lexer.config'] = $app->share(function ($app) {
return new LexerConfig();
$lexer = new LexerConfig();
$lexer->setDelimiter(';')
->setEnclosure('"')
->setEscape("\\")
->setToCharset('UTF-8')
->setFromCharset('UTF-8');
return $lexer;
});
$app['csv.lexer'] = $app->share(function ($app) {

View File

@@ -0,0 +1,46 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Provider;
use Alchemy\Phrasea\Core\Event\Subscriber\CookiesDisablerSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\LogoutSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\MaintenanceSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\PhraseaLocaleSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\SessionManagerSubscriber;
use Silex\Application;
use Silex\ServiceProviderInterface;
class PhraseaEventServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
$app['phraseanet.logout-subscriber'] = $app->share(function (Application $app) {
return new LogoutSubscriber();
});
$app['phraseanet.locale-subscriber'] = $app->share(function (Application $app) {
return new PhraseaLocaleSubscriber($app);
});
$app['phraseanet.maintenance-subscriber'] = $app->share(function (Application $app) {
return new MaintenanceSubscriber($app);
});
$app['phraseanet.cookie-disabler-subscriber'] = $app->share(function (Application $app) {
return new CookiesDisablerSubscriber($app);
});
$app['phraseanet.session-manager-subscriber'] = $app->share(function (Application $app) {
return new SessionManagerSubscriber($app);
});
}
public function boot(Application $app)
{
}
}

View File

@@ -14,9 +14,17 @@ namespace Alchemy\Phrasea\Form\Login;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Silex\Application;
class PhraseaAuthenticationForm extends AbstractType
{
private $app;
public function __construct(Application $app)
{
$this->app = $app;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('login', 'text', [
@@ -37,15 +45,22 @@ class PhraseaAuthenticationForm extends AbstractType
],
]);
$builder->add('remember-me', 'checkbox', [
'label' => 'Remember me',
'mapped' => false,
'required' => false,
'attr' => [
'checked' => 'checked',
'value' => '1',
]
]);
if ($this->app['phraseanet.configuration']['session']['idle'] < 1) {
$builder->add('remember-me', 'checkbox' , array(
'label' => _('Remember me'),
'mapped' => false,
'required' => false,
'attr' => array(
'value' => '1',
)
));
} else {
$builder->add('remember-me', 'hidden' , array(
'label' => '',
'mapped' => false,
'required' => false
));
}
$builder->add('redirect', 'hidden', [
'required' => false,

View File

@@ -0,0 +1,70 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Helper;
use Symfony\Component\HttpFoundation\Request;
class DatabaseHelper extends Helper
{
public function checkConnection()
{
$hostname = $this->request->query->get('hostname', '127.0.0.1');
$port = (int) $this->request->query->get('port', 3306);
$user = $this->request->query->get('user');
$password = $this->request->query->get('password');
$dbname = $this->request->query->get('dbname');
$connection_ok = $db_ok = $is_databox = $is_appbox = $empty = false;
try {
$conn = new \connection_pdo('test', $hostname, $port, $user, $password, null, array(), false);
$connection_ok = true;
} catch (\Exception $e) {
}
if ($dbname && $connection_ok === true) {
try {
$conn = new \connection_pdo('test', $hostname, $port, $user, $password, $dbname, array(), false);
$db_ok = true;
$sql = "SHOW TABLE STATUS";
$stmt = $conn->prepare($sql);
$stmt->execute();
$empty = $stmt->rowCount() === 0;
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row) {
if ($row["Name"] === 'sitepreff') {
$is_appbox = true;
}
if ($row["Name"] === 'pref') {
$is_databox = true;
}
}
} catch (\Exception $e) {
}
}
return array(
'connection' => $connection_ok,
'database' => $db_ok,
'is_empty' => $empty,
'is_appbox' => $is_appbox,
'is_databox' => $is_databox
);
}
}

View File

@@ -0,0 +1,34 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Helper;
use Symfony\Component\HttpFoundation\Request;
class PathHelper extends Helper
{
public function checkPath()
{
return array(
'exists' => file_exists($this->request->query->get('path')),
'file' => is_file($this->request->query->get('path')),
'dir' => is_dir($this->request->query->get('path')),
'readable' => is_readable($this->request->query->get('path')),
'writeable' => is_writable($this->request->query->get('path')),
'executable' => is_executable($this->request->query->get('path')),
);
}
public function checkUrl()
{
return array('code' => \http_query::getHttpCodeFromUrl($this->request->query->get('url')));
}
}

View File

@@ -26,8 +26,13 @@ class Nosource extends AbstractTag
protected $Writable = false;
protected $Description = 'An empty source';
public function setTagname($name)
{
$this->Name = $name;
}
public function getTagname()
{
return '';
return $this->Name;
}
}

View File

@@ -623,18 +623,14 @@ class PhraseaEngine implements SearchEngineInterface
$sxe = @simplexml_load_string($res['xml']);
foreach ($fields as $name => $field) {
if ($sxe && $sxe->description && $sxe->description->$name) {
$val = [];
foreach ($sxe->description->$name as $value) {
$val[] = (string) $value;
$newValues = array();
if ($sxe && $sxe->description && $sxe->description->{$name}) {
foreach ($sxe->description->{$name} as $value) {
$newValues[(string) $value['meta_id']] = (string) $value;
}
$separator = $field['separator'] ? $field['separator'][0] : '';
$val = implode(' ' . $separator . ' ', $val);
} else {
$val = $field['value'];
}
$ret[] = $val;
$ret[$name] = $newValues;
}
}
return $ret;

View File

@@ -23,6 +23,7 @@ class SearchEngineOptions
const TYPE_AUDIO = 'audio';
const TYPE_DOCUMENT = 'document';
const TYPE_FLASH = 'flash';
const TYPE_UNKNOWN = 'unknown';
const TYPE_ALL = '';
const SORT_RELEVANCE = 'relevance';
const SORT_CREATED_ON = 'created_on';
@@ -378,6 +379,9 @@ class SearchEngineOptions
case self::TYPE_IMAGE:
$this->record_type = self::TYPE_IMAGE;
break;
case self::TYPE_UNKNOWN:
$this->record_type = self::TYPE_UNKNOWN;
break;
}
return $this;

View File

@@ -519,40 +519,7 @@ class SphinxSearchEngine implements SearchEngineInterface
*/
public function excerpt($query, $fields, \record_adapter $record, SearchEngineOptions $options = null)
{
if (null === $options) {
$options = new SearchEngineOptions();
}
$this->applyOptions($options);
$index = '';
// in this case search is done on metas
if ($options->getFields() || $options->getBusinessFieldsOn()) {
if ($options->isStemmed() && $options->getLocale()) {
$index = 'metadatas' . $this->CRCdatabox($record->get_databox()) . '_stemmed_' . $options->getLocale();
} else {
$index = 'metadatas' . $this->CRCdatabox($record->get_databox());
}
} else {
if ($options->isStemmed() && $options->getLocale()) {
$index = 'documents' . $this->CRCdatabox($record->get_databox()) . '_stemmed_' . $options->getLocale();
} else {
$index = 'documents' . $this->CRCdatabox($record->get_databox());
}
}
$opts = [
'before_match' => "[[em]]",
'after_match' => "[[/em]]",
];
$fields_to_send = [];
foreach ($fields as $k => $f) {
$fields_to_send[$k] = $f['value'];
}
return $this->sphinx->BuildExcerpts($fields_to_send, $index, $query, $opts);
return array();
}
/**

View File

@@ -111,10 +111,14 @@ class Firewall
return $this;
}
public function requireAuthentication()
public function requireAuthentication(Request $request = null)
{
$params = array();
if (null !== $request) {
$params['redirect'] = '..' . $request->getPathInfo();
}
if (!$this->app['authentication']->isAuthenticated()) {
return new RedirectResponse($this->app->path('homepage'));
return new RedirectResponse($this->app->path('homepage', $params));
}
}
@@ -127,7 +131,7 @@ class Firewall
$app = $this->app;
$controllers->before(function (Request $request) use ($app) {
if (null !== $response = $app['firewall']->requireAuthentication()) {
if (null !== $response = $app['firewall']->requireAuthentication($request)) {
return $response;
}
});

View File

@@ -0,0 +1,89 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Twig;
class Fit extends \Twig_Extension
{
public function getName()
{
return 'fit';
}
public function getFunctions()
{
return array(
'fitIn' => new \Twig_Function_Method($this, 'fitIn')
);
}
public function fitIn(array $content, array $box)
{
$contentRatio = $content['width'] / $content['height'];
$boxRatio = $box['width'] / $box['height'];
if ($contentRatio > $boxRatio) {
if ($box['width'] > $content['width']) {
$width = $content['width'];
} else {
$width = $box['width'];
}
$height = $width / $content['width'] * $content['height'];
$left = 0;
$top = 0;
if ($contentRatio > 1) {
// mode landscape
$top = ($box['height'] - $height) / 2;
} elseif ($contentRatio < 1) {
// mode portrait
$left = ($box['width'] - $width) / 2;
} else {
// square mode
$top = ($box['height'] - $height) / 2;
$left = ($box['width'] - $width) / 2;
}
} else {
if ($box['height'] > $content['height']) {
$height = $content['height'];
} else {
$height = $box['height'];
}
$width = $height * $contentRatio;
$left = 0;
$top = 0;
if ($contentRatio > 1) {
// mode landscape
$top = ($box['height'] - $height) / 2;
} elseif ($contentRatio < 1) {
// mode portrait
$left = ($box['width'] - $width) / 2;;
} else {
// square mode
$top = ($box['height'] - $height) / 2;
$left = ($box['width'] - $width) / 2;;
}
}
return array(
'width' => round($width),
'height' => round($height),
'top' => round($top),
'left' => round($left)
);
}
}

View File

@@ -0,0 +1,95 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Exception\RuntimeException;
class API_Webhook
{
const NEW_FEED_ENTRY = "new_feed_entry";
protected $appbox;
protected $id;
protected $type;
protected $data;
protected $created;
public function __construct(appbox $appbox, $id)
{
$this->appbox = $appbox;
$this->id = $id;
$sql = 'SELECT `type`, `data`, created
FROM api_webhooks
WHERE id = :id';
$stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute(array(':id' => $id));
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
if (!$row) {
throw new RuntimeException('Webhooks not found');
}
$stmt->closeCursor();
$this->type = $row['type'];
$this->data = json_decode($row['data']);
$this->created = new \DateTime($row['created']);
}
public function delete()
{
$sql = 'DELETE FROM api_webhooks WHERE id = :id';
$stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute(array(':id' => $this->id));
$stmt->closeCursor();
return;
}
public static function create(appbox $appbox, $type, array $data)
{
$sql = 'INSERT INTO api_webhooks (id, `type`, `data`, created)
VALUES (null, :type, :data, NOW())';
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute(array(
'type' => $type,
'data' => json_encode($data),
));
$stmt->closeCursor();
return new API_Webhook($appbox, $appbox->get_connection()->lastInsertId());
}
/**
* @return \DateTime
*/
public function getCreated()
{
return $this->created;
}
/**
* @return mixed
*/
public function getData()
{
return $this->data;
}
/**
* @return mixed
*/
public function getType()
{
return $this->type;
}
}

View File

@@ -0,0 +1,722 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
*
* @package Feeds
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cacheableInterface
{
/**
*
* @var int
*/
protected $id;
/**
*
* @var collection
*/
protected $collection;
/**
*
* @var array
*/
protected $publishers;
/**
*
* @var boolean
*/
protected $public;
/**
*
* @var Feed_Publisher_Adapter
*/
protected $owner;
/**
*
* @var string
*/
protected $icon_url;
const CACHE_ENTRY_NUMBER = 'entrynumber';
const CACHE_USER_TOKEN = 'usr_token';
const MAX_ENTRIES = 20;
public function __construct(Application $app, $id)
{
$this->app = $app;
$this->id = (int) $id;
$this->load();
return $this;
}
protected function load()
{
try {
$datas = $this->get_data_from_cache();
$this->title = $datas['title'];
$this->subtitle = $datas['subtitle'];
$this->collection = $datas['base_id'] ? collection::get_from_base_id($this->app, $datas['base_id']) : null;
$this->created_on = $datas['created_on'];
$this->updated_on = $datas['updated_on'];
$this->public = $datas['public'];
return $this;
} catch (\Exception $e) {
}
$sql = 'SELECT id, title, subtitle, created_on, updated_on, base_id, public
FROM feeds WHERE id = :feed_id';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute(array(':feed_id' => $this->id));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
if (!$row)
throw new NotFoundHttpException('Feed not found');
$this->title = $row['title'];
$this->subtitle = $row['subtitle'];
if (!is_null($row['base_id']))
$this->collection = collection::get_from_base_id($this->app, $row['base_id']);
$this->created_on = new DateTime($row['created_on']);
$this->updated_on = new DateTime($row['updated_on']);
$this->public = !!$row['public'];
$base_id = $this->collection instanceof collection ? $this->collection->get_base_id() : null;
$datas = array(
'title' => $this->title
, 'subtitle' => $this->subtitle
, 'base_id' => $base_id
, 'created_on' => $this->created_on
, 'updated_on' => $this->updated_on
, 'public' => $this->public
);
$this->set_data_to_cache($datas);
return $this;
}
/**
*
* @return string
*/
public function get_icon_url()
{
if ($this->icon_url) {
return $this->icon_url;
}
$url = '/skins/icons/rss32.gif';
$file = $this->app['root.path']
. '/www/custom/feed_' . $this->get_id() . '.jpg';
if (file_exists($file)) {
$url = '/custom/feed_' . $this->get_id() . '.jpg';
}
$this->icon_url = $url;
return $this->icon_url;
}
/**
*
* @param string $file The path to the file
* @return Feed_Adapter
*/
public function set_icon($file)
{
if (!file_exists($file)) {
throw new \Alchemy\Phrasea\Exception\InvalidArgumentException('File does not exists');
}
$config_file = $this->app['root.path'] . '/config/feed_' . $this->get_id() . '.jpg';
$www_file = $this->app['root.path'] . '/www/custom/feed_' . $this->get_id() . '.jpg';
copy($file, $config_file);
copy($file, $www_file);
$this->icon_url = null;
return $this;
}
public function set_created_on(DateTime $created_on)
{
$sql = 'UPDATE feeds SET created_on = :created_on
WHERE id = :feed_id';
$params = array(
':created_on' => $created_on->format(DATE_ISO8601)
, ':feed_id' => $this->get_id()
);
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
$stmt->closeCursor();
$this->created_on = $created_on;
$this->delete_data_from_cache();
return $this;
}
public function reset_icon()
{
$config_file = $this->app['root.path']
. '/config/feed_' . $this->get_id() . '.jpg';
$www_file = $this->app['root.path']
. '/www/custom/feed_' . $this->get_id() . '.jpg';
if (is_file($config_file))
unlink($config_file);
if (is_file($www_file))
unlink($www_file);
$this->icon_url = null;
return $this;
}
/**
*
* @return boolean
*/
public function is_aggregated()
{
return false;
}
/**
*
* @param User_Adapter $user
* @return boolean
*/
public function is_owner(User_Adapter $user)
{
$this->load_publishers();
if (!$this->owner) {
return false;
}
return $this->owner->get_user()->get_id() === $user->get_id();
}
/**
*
* @param User_Adapter $user
* @return boolean
*/
public function is_publisher(User_Adapter $user)
{
return in_array($user->get_id(), array_keys($this->get_publishers()));
}
/**
* Tells if a user has access to the feed
*
* @param User_Adapter $user
* @return type
*/
public function has_access(User_Adapter $user)
{
if ($this->get_collection() instanceof collection) {
return $user->ACL()->has_access_to_base($this->collection->get_base_id());
}
return true;
}
/**
*
* @return boolean
*/
public function is_public()
{
if ($this->get_collection() instanceof collection) {
return false;
}
return $this->public;
}
/**
*
* @return array
*/
public function get_publishers()
{
return $this->load_publishers();
}
/**
*
* @return collection
*/
public function get_collection()
{
return $this->collection;
}
/**
*
* @param User_Adapter $user
* @return Feed_Adapter
*/
public function add_publisher(User_Adapter $user)
{
if (in_array($user->get_id(), array_keys($this->get_publishers()))) {
return $this;
}
Feed_Publisher_Adapter::create($this->app, $user, $this, false);
$this->publishers = null;
return $this;
}
/**
*
* @return array
*/
protected function load_publishers()
{
if (is_array($this->publishers)) {
return $this->publishers;
}
$sql = 'SELECT id, usr_id, owner FROM feed_publishers
WHERE feed_id = :feed_id';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute(array(':feed_id' => $this->id));
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row) {
try {
$publisher = new Feed_Publisher_Adapter($this->app, $row['id']);
} catch (\Exception_Feed_PublisherNotFound $e) {
continue;
}
$this->publishers[$row['usr_id']] = $publisher;
if ($publisher->is_owner()) {
$this->owner = $publisher;
}
}
return $this->publishers;
}
/**
*
* @return int
*/
public function get_id()
{
return $this->id;
}
/**
*
* @param collection $collection
* @return Feed_Adapter
*/
public function set_collection(collection $collection = null)
{
$base_id = null;
if ($collection instanceof collection) {
$base_id = $collection->get_base_id();
}
$sql = 'UPDATE feeds SET base_id = :base_id, updated_on = NOW()
WHERE id = :feed_id';
$params = array(':base_id' => $base_id, ':feed_id' => $this->get_id());
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
$stmt->closeCursor();
$this->collection = $collection;
$this->delete_data_from_cache();
return $this;
}
/**
*
* @param boolean $boolean
* @return Feed_Adapter
*/
public function set_public($boolean)
{
$boolean = !!$boolean;
$sql = 'UPDATE feeds SET public = :public, updated_on = NOW()
WHERE id = :feed_id';
$params = array(
':public' => $boolean ? '1' : '0',
':feed_id' => $this->get_id()
);
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
$stmt->closeCursor();
$this->public = $boolean;
$this->delete_data_from_cache();
$feed_collection = new Feed_Collection($this->app, array());
$feed_collection->delete_data_from_cache(Feed_Collection::CACHE_PUBLIC);
return $this;
}
/**
*
* @param string $title
* @return Feed_Adapter
*/
public function set_title($title)
{
$title = trim(strip_tags($title));
if ($title === '')
throw new Exception_InvalidArgument();
$sql = 'UPDATE feeds SET title = :title, updated_on = NOW()
WHERE id = :feed_id';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute(array(':title' => $title, ':feed_id' => $this->get_id()));
$stmt->closeCursor();
$this->title = $title;
$this->delete_data_from_cache();
return $this;
}
/**
*
* @param string $subtitle
* @return Feed_Adapter
*/
public function set_subtitle($subtitle)
{
$subtitle = strip_tags($subtitle);
$sql = 'UPDATE feeds SET subtitle = :subtitle, updated_on = NOW()
WHERE id = :feed_id';
$params = array(':subtitle' => $subtitle, ':feed_id' => $this->get_id());
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
$stmt->closeCursor();
$this->subtitle = $subtitle;
$this->delete_data_from_cache();
return $this;
}
public static function create(Application $app, User_Adapter $user, $title, $subtitle)
{
$sql = 'INSERT INTO feeds (id, title, subtitle, created_on, updated_on)
VALUES (null, :title, :subtitle, NOW(), NOW())';
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute(array(':title' => $title, ':subtitle' => $subtitle));
$stmt->closeCursor();
$feed_id = $app['phraseanet.appbox']->get_connection()->lastInsertId();
$feed = new self($app, $feed_id);
Feed_Publisher_Adapter::create($app, $user, $feed, true);
return $feed;
}
public static function load_with_user(Application $app, User_Adapter $user, $id)
{
$feed = new self($app, $id);
$coll = $feed->get_collection();
if (
$feed->is_public()
|| $coll === null
|| in_array($coll->get_base_id(), array_keys($user->ACL()->get_granted_base()))
) {
return $feed;
}
throw new NotFoundHttpException('Feed not found');
}
/**
*
* @return int
*/
public function get_count_total_entries()
{
try {
return $this->get_data_from_cache(self::CACHE_ENTRY_NUMBER);
} catch (\Exception $e) {
}
$sql = 'SELECT count(id) as number
FROM feed_entries WHERE feed_id = :feed_id';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute(array(':feed_id' => $this->get_id()));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$number = $row ? (int) $row['number'] : 0;
$stmt->closeCursor();
$this->set_data_to_cache($number, self::CACHE_ENTRY_NUMBER);
return $number;
}
/**
*
* @return void
*/
public function delete()
{
$this->reset_icon();
while ($this->get_count_total_entries() > 0) {
$entries_coll = $this->get_entries(0, 10);
foreach ($entries_coll->get_entries() as $entry) {
$entry->delete();
}
unset($entries_coll);
$this->delete_data_from_cache(self::CACHE_ENTRY_NUMBER);
}
foreach ($this->get_publishers() as $publishers)
$publishers->delete();
$sql = 'DELETE FROM feed_tokens WHERE feed_id = :feed_id';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute(array(':feed_id' => $this->get_id()));
$stmt->closeCursor();
$sql = 'DELETE FROM feeds WHERE id = :feed_id';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute(array(':feed_id' => $this->get_id()));
$stmt->closeCursor();
$this->delete_data_from_cache();
$feed_coll = new Feed_Collection($this->app, array());
$feed_coll->delete_data_from_cache(Feed_Collection::CACHE_PUBLIC);
return;
}
/**
*
* @param int $offset_start
* @param int $how_many
* @return Feed_Entry_Collection
*/
public function get_entries($offset_start, $how_many)
{
$offset_start = (int) $offset_start;
$how_many = $how_many > self::MAX_ENTRIES ? self::MAX_ENTRIES : (int) $how_many;
$sql = 'SELECT id
FROM feed_entries
WHERE feed_id = :feed_id
ORDER BY id DESC
LIMIT ' . $offset_start . ', ' . $how_many;
$params = array(
':feed_id' => $this->get_id()
);
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$result = new Feed_Entry_Collection();
foreach ($rs as $row) {
$entry = new Feed_Entry_Adapter($this->app, $this, $row['id']);
$result->add_entry($entry);
}
return $result;
}
/**
*
* @param registryInterface $registry
* @param string $format
* @param int $page
* @return Feed_Link
*/
public function get_homepage_link(registryInterface $registry, $format, $page = null)
{
if (!$this->is_public()) {
return null;
}
switch ($format) {
case self::FORMAT_ATOM:
return new Feed_Link(
sprintf('%s/feeds/feed/%s/atom/%s'
, rtrim($registry->get('GV_ServerName'), '/')
, $this->get_id()
, ($page ? '?page=' . $page : '')
)
, sprintf('%s - %s', $this->get_title(), 'Atom')
, 'application/atom+xml'
);
break;
case self::FORMAT_RSS:
default:
return new Feed_Link(
sprintf('%s/feeds/feed/%s/rss/%s'
, rtrim($registry->get('GV_ServerName'), '/')
, $this->get_id()
, ($page ? '?page=' . $page : '')
)
, sprintf('%s - %s', $this->get_title(), 'RSS')
, 'application/rss+xml'
);
break;
}
}
/**
*
* @param User_Adapter $user
* @param boolean $renew
* @return string
*/
protected function get_token(User_Adapter $user, $renew = false)
{
$cache_key = self::CACHE_USER_TOKEN . '_' . $user->get_id();
try {
if (!$renew) {
return $this->get_data_from_cache($cache_key);
}
} catch (\Exception $e) {
}
$sql = 'SELECT token FROM feed_tokens
WHERE usr_id = :usr_id AND feed_id = :feed_id
AND aggregated IS NULL';
$params = array(
':usr_id' => $user->get_id(),
':feed_id' => $this->get_id()
);
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
if (!$row || $renew === true) {
$token = random::generatePassword(12, random::LETTERS_AND_NUMBERS);
$sql = 'REPLACE INTO feed_tokens (id, token, feed_id, usr_id, aggregated)
VALUES (null, :token, :feed_id, :usr_id, :aggregated)';
$params = array(
':token' => $token
, ':feed_id' => $this->get_id()
, ':usr_id' => $user->get_id()
, ':aggregated' => null
);
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
$this->delete_data_from_cache($cache_key);
} else {
$token = $row['token'];
}
$this->set_data_to_cache($token, $cache_key);
return $token;
}
/**
*
* @param registryInterface $registry
* @param User_Adapter $user
* @param string $format
* @param int $page
* @param boolean $renew_token
* @return Feed_Link
*/
public function get_user_link(registryInterface $registry, User_Adapter $user, $format, $page = null, $renew_token = false)
{
switch ($format) {
case self::FORMAT_ATOM:
return new Feed_Link(
sprintf('%s/feeds/userfeed/%s/%s/atom/'
, rtrim($registry->get('GV_ServerName'), '/')
, $this->get_token($user, $renew_token)
, $this->get_id()
, ($page ? '?page=' . $page : '')
)
, sprintf('%s - %s', $this->get_title(), 'Atom')
, 'application/atom+xml'
);
break;
case self::FORMAT_RSS:
return new Feed_Link(
sprintf('%s/feeds/userfeed/%s/%s/rss/%s'
, rtrim($registry->get('GV_ServerName'), '/')
, $this->get_token($user, $renew_token)
, $this->get_id()
, ($page ? '?page=' . $page : '')
)
, sprintf('%s - %s', $this->get_title(), 'RSS')
, 'application/rss+xml'
);
break;
}
}
public function get_cache_key($option = null)
{
return 'feed_adapter_' . $this->get_id() . '_' . ($option ? '_' . $option : '');
}
public function get_data_from_cache($option = null)
{
return $this->app['phraseanet.appbox']->get_data_from_cache($this->get_cache_key($option));
}
public function set_data_to_cache($value, $option = null, $duration = 0)
{
return $this->app['phraseanet.appbox']->set_data_to_cache($value, $this->get_cache_key($option), $duration);
}
public function delete_data_from_cache($option = null)
{
return $this->app['phraseanet.appbox']->delete_data_from_cache($this->get_cache_key($option));
}
}

View File

@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
class ThesaurusValue
class caption_Field_ThesaurusValue
{
/** @var string */
private $value;

View File

@@ -51,7 +51,20 @@ class caption_Field_Value implements cache_cacheableInterface
protected $record;
protected $app;
protected static $localCache = [];
/**
* Query to ask to the search engine to bounce to the current value;
* This property is set if the value is matched against a thesaurus value;
*
* @var string
*/
protected $qjs;
/**
* Tells whether the value is matched against a thesaurus value.
*/
protected $isThesaurusValue;
protected static $localCache = array();
/**
*
@@ -71,6 +84,11 @@ class caption_Field_Value implements cache_cacheableInterface
$this->retrieveValues();
}
public function getQjs()
{
return $this->qjs;
}
protected function retrieveValues()
{
try {
@@ -336,7 +354,6 @@ class caption_Field_Value implements cache_cacheableInterface
public function highlight_thesaurus()
{
$value = $this->getValue();
$databox = $this->databox_field->get_databox();
$XPATH_thesaurus = $databox->get_xpath_thesaurus();
@@ -374,18 +391,33 @@ class caption_Field_Value implements cache_cacheableInterface
if($context_noacc != "")
$note += ($node->getAttribute("k") == $context_noacc) ? 1 : 0;
if ($note > $bestnote) {
$bestnote = $note;
$bestnode = $node;
}
}
if ($bestnode) {
list($term, $context) = $this->splitTermAndContext(str_replace(["[[em]]", "[[/em]]"], ["", ""], $value));
$qjs = $term . ($context ? '['.$context.']' : '');
$value = new ThesaurusValue($bestnode->getAttribute('v'), $this->databox_field, $qjs);
if ($bestnode) {
list($term, $context) = $this->splitTermAndContext(str_replace(array("[[em]]", "[[/em]]"), array("", ""), $value));
// a value has been found in thesaurus, update value & set the query to bounce to the value
$this->value = $bestnode->getAttribute('v');
$this->qjs = $term . ($context ? '['.$context.']' : '');
$this->isThesaurusValue = true;
} else {
$this->isThesaurusValue = false;
}
return $value;
return $this;
}
/**
* @return boolean
*/
public function isThesaurusValue()
{
if (null === $this->isThesaurusValue) {
$this->highlight_thesaurus();
}
return $this->isThesaurusValue;
}
/**
@@ -466,6 +498,11 @@ class caption_Field_Value implements cache_cacheableInterface
unset(self::$localCache[$this->get_cache_key($option)]);
}
public function __toString()
{
return $this->value;
}
public static function purge()
{
self::$localCache = [];

View File

@@ -197,27 +197,27 @@ class caption_field implements cache_cacheableInterface
*
* @return mixed
*/
public function get_serialized_values($custom_separator = false, $highlightTheso = false)
public function get_serialized_values($custom_separator = false, $highlight = false)
{
if ($this->databox_field->is_multi() === true) {
if ($custom_separator !== false)
$separator = $custom_separator;
else
$separator = $this->databox_field->get_separator();
return self::serialize_value($this->values, $separator, $highlightTheso);
} else {
foreach ($this->values as $value) {
/* @var $value Caption_Field_Value */
if ($highlightTheso) {
return $value->highlight_thesaurus();
} else {
return $value->getValue();
}
}
if (0 === count($this->values)) {
return null;
}
return null;
if ($this->is_multi()) {
$separator = $custom_separator !== false ? $custom_separator : $this->databox_field->get_separator();
return self::serialize_value($this->values, $separator, $highlight);
}
$value = current($this->values);
/* @var $value Caption_Field_Value */
if ($highlight) {
return $value->highlight_thesaurus();
}
return $value->getValue();
}
/**
@@ -256,17 +256,6 @@ class caption_field implements cache_cacheableInterface
return $this->databox_field;
}
/**
*
* @return string
*/
public function highlight_thesaurus()
{
$value = $this->get_serialized_values(false, true);
return $value;
}
/**
*
* @param string $serialized_value

View File

@@ -174,55 +174,40 @@ class caption_record implements caption_interface, cache_cacheableInterface
*/
public function get_highlight_fields($highlight = '', Array $grep_fields = null, SearchEngineInterface $searchEngine = null, $includeBusiness = false, SearchEngineOptions $options = null)
{
return $this->highlight_fields($highlight, $grep_fields, $searchEngine, $includeBusiness, $options);
}
/**
* @todo move this fun in caption_field object
* @param string $highlight
* @param array $grep_fields
* @param SearchEngineInterface $searchEngine
* @return array
*/
protected function highlight_fields($highlight, Array $grep_fields = null, SearchEngineInterface $searchEngine = null, $includeBusiness = false, SearchEngineOptions $options = null)
{
$fields = [];
$fields = array();
foreach ($this->get_fields($grep_fields, $includeBusiness) as $meta_struct_id => $field) {
$value = preg_replace(
"(([^']{1})((https?|file):((/{2,4})|(\\{2,4}))[\w:#%/;$()~_?/\-=\\\.&]*)([^']{1}))"
, '$1 $2 <a title="' . $this->app->trans('Open the URL in a new window') . '" class="ui-icon ui-icon-extlink" href="$2" style="display:inline;padding:2px 5px;margin:0 4px 0 2px;" target="_blank"> &nbsp;</a>$7'
, $highlight ? $field->highlight_thesaurus() : $field->get_serialized_values(false, false)
);
$fields[$field->get_name()] = [
'value' => $value,
/** @Ignore */
'label' => $field->get_databox_field()->get_label($this->app['locale']),
$values = array();
foreach ($field->get_values() as $metaId => $v) {
$values[$metaId] = array(
'value' => $v->getValue(),
'from_thesaurus' => $highlight ? $v->isThesaurusValue() : false,
'qjs' => $v->getQjs(),
);
}
$fields[$field->get_name()] = array(
'values' => $values,
'name' => $field->get_name(),
'label' => $field->get_databox_field()->get_label($this->app['locale.I18n']),
'separator' => $field->get_databox_field()->get_separator(),
];
'sbas_id' => $field->get_databox_field()->get_databox()->get_sbas_id()
);
}
if ($searchEngine instanceof SearchEngineInterface) {
$ret = $searchEngine->excerpt($highlight, $fields, $this->record, $options);
// sets highlighted value from search engine, highlighted values will now
// be surrounded by [[em]][[/em]] tags
if ($ret) {
$n = -1;
foreach ($fields as $key => $value) {
$n++;
if (!isset($fields[$key])) {
if (!isset($ret[$key])) {
continue;
}
if (strpos($fields[$key]['value'], '<a class="bounce" ') !== false) {
continue;
foreach ($ret[$key] as $metaId => $newValue) {
$fields[$key]['values'][$metaId]['value'] = $newValue;
}
//if(strpos($fields[$key]['value'], '<a ') === false)
$fields[$key]['value'] = $ret[$n];
}
}
}

View File

@@ -63,8 +63,14 @@ class databox_status
return;
}
$path = $this->path = $app['root.path'] . "/config/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]);
$url = $this->url = "/custom/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]);
$uniqid = md5(implode('-', array(
$sbas_params[$sbas_id]["host"],
$sbas_params[$sbas_id]["port"],
$sbas_params[$sbas_id]["dbname"]
)));
$path = $this->path = $app['root.path'] . "/config/status/" . $uniqid;
$url = $this->url = "/custom/status/" . $uniqid;
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
$xmlpref = $databox->get_structure();

View File

@@ -44,7 +44,6 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
];
$dom_xml = new DOMDocument('1.0', 'UTF-8');
$dom_xml->preserveWhiteSpace = false;
$dom_xml->formatOutput = true;
@@ -58,7 +57,11 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
$dom_xml->appendChild($root);
$datas = $dom_xml->saveXml();
$data = $dom_xml->saveXml();
API_Webhook::create($this->app['phraseanet.appbox'], API_Webhook::NEW_FEED_ENTRY, array_merge(
array('feed_id' => $entry->get_feed()->get_id()), $params
));
$Query = new \User_Query($this->app);
@@ -74,11 +77,6 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
$start = 0;
$perLoop = 100;
$from = [
'email' => $entry->getAuthorEmail(),
'name' => $entry->getAuthorName()
];
do {
$results = $Query->limit($start, $perLoop)->execute()->get_results();
@@ -108,7 +106,7 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
}
}
$this->broker->notify($user_to_notif->getId(), __CLASS__, $datas, $mailed);
$this->broker->notify($user_to_notif->getId(), __CLASS__, $data, $mailed);
}
$start += $perLoop;
} while (count($results) > 0);
@@ -118,13 +116,13 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
/**
*
* @param Array $datas
* @param Array $data
* @param boolean $unread
* @return Array
*/
public function datas($datas, $unread)
public function datas($data, $unread)
{
$sx = simplexml_load_string($datas);
$sx = simplexml_load_string($data);
$entry = $this->app['repo.feed-entries']->find((int) $sx->entry_id);

View File

@@ -200,13 +200,12 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$stmt->closeCursor();
if ($row) {
$this->width = (int) $row['width'];
$this->size = (int) $row['size'];
$this->height = (int) $row['height'];
$this->mime = $row['mime'];
$this->file = $row['file'];
$this->etag = $row['etag'];
$this->etag = $row['etag'] !== null ? $row['etag'] : md5(time() . $row['path'] .$row['file']);
$this->path = p4string::addEndSlash($row['path']);
$this->is_substituted = ! ! $row['substit'];
$this->subdef_id = (int) $row['subdef_id'];
@@ -742,7 +741,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
return;
}
if (in_array($this->mime, ['video/mp4'])) {
if ($this->app['phraseanet.h264-factory']->isH264Enabled() && in_array($this->mime, array('video/mp4'))) {
if (null !== $url = $this->app['phraseanet.h264']->getUrl($this->get_pathfile())) {
$this->url = $url;

View File

@@ -91,8 +91,9 @@ class module_report_connexion extends module_report
/**
* @desc build the result from the specified sql
* @param array $champ all the field from the request displayed in a array
* @param string $sql the request from buildreq
* @param array $champ all the field from the request displayed in a array
* @param string $sql the request from buildreq
* @return $this->result
*/
protected function buildResult(Application $app, $rs)
{

View File

@@ -94,8 +94,9 @@ class module_report_download extends module_report
/**
* @desc build the result from the specified sql
* @param array $champ all the field from the request displayed in a array
* @param string $sql the request from buildreq
* @param array $champ all the field from the request displayed in a array
* @param string $sql the request from buildreq
* @return $this->result
*/
protected function buildResult(Application $app, $rs)
{

View File

@@ -0,0 +1,78 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
class patch_384alpha2a implements patchInterface
{
/** @var string */
private $release = '3.8.4-alpha.2';
/** @var array */
private $concern = array(base::APPLICATION_BOX);
/**
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function require_all_upgrades()
{
return false;
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$finder = new Finder();
$fs = new Filesystem();
foreach ($finder->files()->in($app['root.path'].'/config/status') as $file) {
if (!$file->isFile()) {
continue;
}
$fileName = $file->getFileName();
$chunks = explode('-', $fileName);
if (count($chunks) < 4) {
continue;
}
$suffix = array_pop($chunks);
$uniqid = md5(implode('-', $chunks));
$fs->rename($file->getRealPath(), $app['root.path'].'/config/status/' . $uniqid . '-' . $suffix);
if ($fs->exists($app['root.path'] . '/www/custom/status/' . $file->getFileName())) {
$fs->remove($app['root.path'] . '/www/custom/status/' . $file->getFileName());
}
}
$app['filesystem']->mirror($app['root.path'] . '/config/status/', $app['root.path'] . '/www/custom/status/');
}
}

View File

@@ -0,0 +1,68 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
class patch_384alpha3a implements patchInterface
{
/** @var string */
private $release = '3.8.4-alpha.3';
/** @var array */
private $concern = array(base::APPLICATION_BOX);
/**
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function require_all_upgrades()
{
return false;
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$config = $app['phraseanet.configuration']->getConfig();
$config['api_cors'] = array(
'enabled' => false,
'allow_credentials' => false,
'allow_origin' => array(),
'allow_headers' => array(),
'allow_methods' => array(),
'expose_headers' => array(),
'max_age' => 0,
'hosts' => array(),
);
$app['phraseanet.configuration']->setConfig($config);
return true;
}
}

View File

@@ -0,0 +1,62 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
class patch_384alpha4a implements patchInterface
{
/** @var string */
private $release = '3.8.4-alpha.4';
/** @var array */
private $concern = array(base::APPLICATION_BOX);
/**
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function require_all_upgrades()
{
return false;
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$config = $app['phraseanet.configuration']->getConfig();
$config['session'] = array(
'idle' => 0,
'lifetime' => 604800,
);
$app['phraseanet.configuration']->setConfig($config);
return true;
}
}

View File

@@ -0,0 +1,57 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
class patch_384alpha5a implements patchInterface
{
/** @var string */
private $release = '3.8.4-alpha.5';
/** @var array */
private $concern = array(base::DATA_BOX);
/**
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function require_all_upgrades()
{
return false;
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
$sql = "UPDATE log_docs SET `action`='mail' WHERE `action`='download' AND LOCATE('@', comment)";
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
return true;
}
}

View File

@@ -895,12 +895,12 @@ class record_adapter implements record_Interface, cache_cacheableInterface
}
if (count($fields_to_retrieve) > 0) {
$retrieved_fields = $this->get_caption()->get_highlight_fields($highlight, $fields_to_retrieve, $searchEngine, false, $options);
$titles = [];
foreach ($retrieved_fields as $key => $value) {
if (trim($value['value'] === ''))
continue;
$titles[] = $value['value'];
$retrieved_fields = $this->get_caption()->get_highlight_fields($highlight, $fields_to_retrieve, $searchEngine);
$titles = array();
foreach ($retrieved_fields as $value) {
foreach ($value['values'] as $v) {
$titles[] = $v['value'];
}
}
$title = trim(implode(' - ', $titles));
}

View File

@@ -463,7 +463,7 @@ class record_preview extends record_adapter
$width = 350;
$height = 150;
$url = Url::factory('http://chart.apis.google.com/chart?' .
$url = Url::factory('https://chart.googleapis.com/chart?' .
'chs=' . $width . 'x' . $height .
'&chd=t:' . implode(',', $views) .
'&cht=lc' .
@@ -544,7 +544,7 @@ class record_preview extends record_adapter
$width = 550;
$height = 100;
$url = Url::factory('http://chart.apis.google.com/chart?'
$url = Url::factory('https://chart.googleapis.com/chart?'
. 'cht=p3&chf=bg,s,00000000&chd=t:'
. implode(',', $referrers)
. '&chs=' . $width . 'x' . $height
@@ -619,7 +619,7 @@ class record_preview extends record_adapter
$width = 250;
$height = 150;
$url = Url::factory('http://chart.apis.google.com/chart?' .
$url = Url::factory('https://chart.googleapis.com/chart?' .
'chs=' . $width . 'x' . $height .
'&chd=t:' . implode(',', $dwnls) .
'&cht=lc' .

View File

@@ -761,12 +761,7 @@ class set_export extends set_abstract
$tmplog = [];
$files = $list['files'];
$event_names = [
'mail-export' => Session_Logger::EVENT_EXPORTMAIL,
'download' => Session_Logger::EVENT_EXPORTDOWNLOAD
];
$event_name = isset($event_names[$type]) ? $event_names[$type] : Session_Logger::EVENT_EXPORTDOWNLOAD;
$event_name = in_array($type, array(Session_Logger::EVENT_EXPORTMAIL,Session_Logger::EVENT_EXPORTDOWNLOAD)) ? $type : Session_Logger::EVENT_EXPORTDOWNLOAD;
foreach ($files as $record) {
foreach ($record["subdefs"] as $o => $obj) {
@@ -774,8 +769,7 @@ class set_export extends set_abstract
$record_object = new record_adapter($app, $sbas_id, $record['record_id']);
$app['phraseanet.logger']($record_object->get_databox())
->log($record_object, $event_name, $o, $comment);
$app['phraseanet.logger']($record_object->get_databox())->log($record_object, $event_name, $o, $comment);
if ($o != "caption") {
$log["rid"] = $record_object->get_record_id();
@@ -792,6 +786,12 @@ class set_export extends set_abstract
}
}
$export_types = array(
'download' => 0,
'mail-export' => 2,
'ftp' => 4
);
$list_base = array_unique(array_keys($tmplog));
if (!$anonymous) {

View File

@@ -0,0 +1,144 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Guzzle\Http\Client as GuzzleClient;
class task_period_apiwebhooks extends task_appboxAbstract
{
public static function getName()
{
return _('Api Webhook');
}
public static function help()
{
return _('Notify Phraseanet Oauth2 client applications using webhooks.');
}
protected function retrieveContent(appbox $appbox)
{
$stmt = $appbox->get_connection()->prepare('SELECT id, `type`, `data` FROM api_webhooks');
$stmt->execute();
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
return $rs;
}
protected function processOneContent(appbox $appbox, array $row)
{
$data = null;
switch ($row['type']) {
case \API_Webhook::NEW_FEED_ENTRY:
$data = $this->processNewFeedEntry($row);
}
if (null === $data) {
return;
}
$urls = $this->getApplicationHookUrls($appbox);
$this->sendData($urls, $data);
}
protected function postProcessOneContent(appbox $appbox, array $row)
{
$w = new API_Webhook($appbox, $row['id']);
$w->delete();
}
protected function getApplicationHookUrls(appbox $appbox)
{
$stmt = $appbox->get_connection()->prepare('
SELECT webhook_url
FROM api_applications
WHERE webhook_url IS NOT NULL
');
$stmt->execute();
$rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
return array_map(function ($row) {
return $row['webhook_url'];
}, $rows);
}
protected function sendData(array $urls, array $data)
{
if (count($urls) === 0) {
return;
}
$client = new GuzzleClient();
$body = json_encode($data);
$requests = array();
foreach ($urls as $url) {
$requests[] = $client->createRequest('POST', $url, array(
'Content-Type' => 'application/vnd.phraseanet.event+json'
), $body);
}
$client->send($requests);
}
protected function processNewFeedEntry(array $row)
{
$data = json_decode($row['data']);
if (!isset($data->{"feed_id"}) || !isset($data->{"entry_id"})) {
return;
}
$feed = new Feed_Adapter($this->dependencyContainer, $data->{"feed_id"});
$entry = new \Feed_Entry_Adapter($this->dependencyContainer, $feed, $data->{"entry_id"});
$query = new \User_Query($this->dependencyContainer);
$query->include_phantoms(true)
->include_invite(false)
->include_templates(false)
->email_not_null(true);
if ($entry->get_feed()->get_collection()) {
$query->on_base_ids(array($entry->get_feed()->get_collection()->get_base_id()));
}
$start = 0;
$perLoop = 100;
$users = array();
do {
$results = $query->limit($start, $perLoop)->execute()->get_results();
foreach ($results as $user) {
$users[] = array(
'email' => $user->get_email(),
'firstname' => $user->get_firstname() ?: null,
'lastname' => $user->get_lastname() ?: null,
);
}
$start += $perLoop;
} while (count($results) > 0);
return array(
'event' => $row['type'],
'users_were_notified' => !!$data->{"notify_email"},
'feed' => array(
'id' => $feed->get_id(),
'title' => $feed->get_title(),
'description' => $feed->get_subtitle() ?: null,
),
'entry' => array(
'id' => $entry->get_id(),
'author' => array(
'name' => $entry->get_author_name(),
'email' => $entry->get_author_email()
),
'title' => $entry->get_title(),
'description' => $entry->get_subtitle() ?: null,
),
'users' => $users
);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,6 +4,7 @@ languages:
default: 'fr'
main:
maintenance: false
key: ''
database:
host: 'sql-host'
port: 3306
@@ -172,6 +173,9 @@ registration-fields:
-
name: company
required: true
-
name: lastname
required: true
-
name: firstname
required: true
@@ -187,3 +191,16 @@ h264-pseudo-streaming:
type: nginx
mapping: []
plugins: []
api_cors:
enabled: false
allow_credentials: false
allow_origin: []
allow_headers: []
allow_methods: []
expose_headers: []
max_age: 0
hosts: []
session:
idle: 0
# 1 week
lifetime: 604800

View File

@@ -8,13 +8,19 @@
* You may wish to use the Minify URI Builder app to suggest
* changes. http://yourdomain/min/builder/
* */
$groups = [
'authentication_css' => [
$groups = array(
'account' => array(
'//include/jslibs/jquery.contextmenu_scroll.js',
'//assets/jquery.cookie/jquery.cookie.js',
'//include/jquery.common.js',
'//skins/account/account.js'
),
'authentication_css' => array(
'//assets/normalize-css/normalize.css',
'//assets/build/login.css',
'//assets/font-awesome/css/font-awesome.css',
'//assets/jquery.ui/themes/base/jquery.ui.autocomplete.css'
],
),
'authentication' => [
'//assets/modernizr/modernizr.js',
'//assets/requirejs/require.js',

View File

@@ -4,11 +4,39 @@
{% extends "common/index_bootstrap.html.twig" %}
{% block stylesheet %}
<link rel="stylesheet" type="text/css" href="{{ path('minifier', { 'f' : 'assets/build/account.css' }) }}"/>
<link rel="stylesheet" type="text/css" href="{{ path('minifier', { 'f' : 'skins/build/account.css,include/jslibs/jquery.contextmenu.css' }) }}"/>
<style type="text/css">
.context-menu-theme-vista .context-menu-item .context-menu-item-inner {
padding: 4px 20px;
margin-left: 0;
color: #75ABFF;
}
.context-menu-theme-vista .context-menu-item-hover {
background-image: none;
background-color: #75ABFF;
border: none;
}
.context-menu-theme-vista .context-menu-item-hover .context-menu-item-inner {
color: #212121;
}
.context-menu-theme-vista {
background-image: none;
background-color: #212121;
-webkit-border-bottom-left-radius: 3px;
-webkit-border-bottom-right-radius: 3px;
-moz-border-radius-bottomleft: 3px;
-moz-border-radius-bottomright: 3px;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
}
</style>
{% endblock %}
{% block javascript %}
<script type="text/javascript" language="javascript" src="{{ path('minifier', { 'f' : '/skins/account/account.js' }) }}"></script>
<script type="text/javascript" src="{{ path('minifier', { 'g' : 'account' }) }}"></script>
{% endblock %}
{% block content %}
@@ -46,6 +74,7 @@
</div>
</div>
</div>
<div id="DIALOG"></div>
{% block scripts %}
<script type="text/javascript">
// close alerts

View File

@@ -335,6 +335,10 @@
} else if(submitLink.hasClass('reload-tree')) {
reloadTree('bases:bases', true);
}
if ("undefined" !== typeof datas.msg) {
alert(datas.msg);
}
} else {
alert(datas.msg);
}

View File

@@ -1,7 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="{{ app['locale'] }}">
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title> </title>
<link type="text/css" rel="stylesheet" href="{{ path('minifier', { 'f' : 'skins/common/main.css' }) }}">
{% block stylesheet %}{% endblock %}

View File

@@ -139,7 +139,7 @@
</form>
<form style="display:inline;" method="post" action="{{ path('admin_database_unmount', {'databox_id': databox.get_sbas_id()}) }}">
<button type="button" class="btn confirm" data-confirm-msg="{{ 'admin::base: Confirmer vous l\'arret de la publication de la base' | trans }}">
<button type="button" class="btn submiter confirm reload" data-confirm-msg="{{ 'admin::base: Confirmer vous l\'arret de la publication de la base' | trans }}">
<img src="/skins/icons/db-remove.png" />
{{ "admin::base: arreter la publication de la base" | trans }}
</button>
@@ -245,6 +245,11 @@
<script type="text/javascript">
function refreshDatabaseInformations()
{
// stop the refresh if the page changed
if($("#thesaurus_indexed_bar").length == 0) {
return;
}
$.ajax({
type: "GET",
url: "/admin/databox/{{ databox.get_sbas_id() }}/informations/documents/",
@@ -284,13 +289,14 @@
$("#printLogoDIV_OK").hide();
$("#printLogoDIV_NONE").show();
}
// refresh every 10 sec.
setTimeout("refreshDatabaseInformations();", 10000);
}
});
setTimeout("refreshDatabaseInformations();", 10000);
}
$(document).ready(function(){
refreshDatabaseInformations();
$('#is_indexable').bind('change', function(){
var form = $(this).closest('form');
@@ -385,6 +391,9 @@
enableFormsCallback(data.result);
}
});
// start the refresh of the page content (progress bar etc...)
setTimeout("refreshDatabaseInformations();", 2000);
});
</script>

View File

@@ -28,6 +28,34 @@
bodySize.x = $(window).width();
}
function pollNotifications(){
$.ajax({
type: "POST",
url: "{{ path('list_notifications') }}",
dataType: 'json',
data: {
module : 3,
usr : {{ app['authentication'].getUser().get_id() }}
},
error: function(){
window.setTimeout("pollNotifications();", 10000);
},
timeout: function(){
window.setTimeout("pollNotifications();", 10000);
},
success: function(data){
if(data)
manageSession(data);
var t = 120000;
if(data.apps && parseInt(data.apps)>1)
t = Math.round((Math.sqrt(parseInt(data.apps)-1) * 1.3 * 120000));
window.setTimeout("pollNotifications();", t);
return;
}
});
}
var language = {
serverName: '{{ app['conf'].get('servername') | e('js') }}',
serverError: '{{ 'phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique' | trans | e('js') }}',
@@ -55,6 +83,102 @@
$(window).bind('resize',function(){resize();});
resize();
});
}
function enableFormsCallback(datas)
{
$('#right-ajax').removeClass('loading').html(datas);
enableForms($('#right-ajax form:not(.no-ajax)'));
$.each($('#right-ajax a:not(.no-ajax)'),function(i, el){
enableLink($(el));
});
return;
}
function enableLink(link) {
$(link).bind('click',function(event){
var dest = link.attr('href');
if(dest && dest.indexOf('#') !== 0) {
$('#right-ajax').empty().addClass('loading').parent().show();
$.get(dest, function(data) {
enableFormsCallback(data);
});
return false;
}
});
}
function activeTree(click)
{
$('#FNDR').treeview({
collapsed: true,
animated: "medium"
});
$.each($('#tree a[target=right]'),function(){
var dest = $(this).attr('href');
$(this).bind('click',function(){
$('#right-ajax').empty().addClass('loading').parent().show();
$.get(dest, function(data) {
enableFormsCallback(data);
});
$('#tree .selected').removeClass('selected');
$(this).parent().addClass('selected');
return false;
});
$(this).removeAttr('target');
});
if(click === true)
{
if($('#tree .selected').length > 0)
$('#tree .selected a').trigger('click');
else
$('.zone_online_users').trigger('click');
}
}
$(document).ready(
function(){
resize();
setTimeout('pollNotifications();',15000);
activeTree(true);
}
);
function resize()
{
bodySize.y = $(window).height() - $('#mainMenu').outerHeight();
bodySize.x = $(window).width();
}
$(window).bind('resize',function(){resize();});
function reloadTree(position, click){
$.ajax({
type: "GET",
url: "/admin/tree/",
data: {
position : position
},
success: function(datas){
$('#FNDR').empty().append(datas);
activeTree(click);
return;
}
});
}
</script>
<script type="text/javascript" src="{{ path('minifier', { 'f' : '/assets/requirejs/require.js,/scripts/apps/admin/require.config.js,/scripts/apps/admin/main/main.js' }) }}"></script>
{% endblock %}

View File

@@ -186,17 +186,13 @@
</li>
{% endif %}
{% if (app['acl'].get(app['authentication'].getUser()).has_right_on_base( collection.get_base_id(), 'canadmin')) %}
{% if (app['acl'].get(app['authentication'].getUser()).has_right_on_base( collection.get_base_id(), 'canmodifrecord')
and app['acl'].get(app['authentication'].getUser()).has_right_on_base( collection.get_base_id(), 'manage')
and app['acl'].get(app['authentication'].getUser()).has_right_on_sbas( sbas_id, 'bas_manage') ) %}
{% if app['acl'].get(app['authentication'].getUser()).has_right_on_base( collection.get_base_id(), 'canadmin')) %}
<li>
<a target="right" href="{{ path('admin_users_search', { 'base_id' : [ collection.get_base_id() ] }) }}" class="ajax">
<img src="/skins/admin/Users.png"/>
<span>{{ 'admin::utilisateurs: utilisateurs' | trans }}</span>
</a>
</li>
{% endif %}
{% endif %}
</ul>

View File

@@ -1,7 +1,7 @@
<html lang="{{ app['locale'] }}">
<head>
<title>{{ app['conf'].get(['registry', 'general', 'title']) }} Client</title>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" type="image/x-icon" href="/skins/client/favicon.ico" />
<style ID="MYS" type="text/css">
@@ -438,20 +438,20 @@
document.styleSheets[0][propname][3].style.height = (w)+"px"; // .h160px
}
function sessionactive(){
function pollNotifications(){
$.ajax({
type: "POST",
url: "/session/update/",
url: "/session/notifications/",
dataType: 'json',
data: {
app : 2,
usr : {{ app['authentication'].getUser().getId() }}
},
error: function(){
window.setTimeout("sessionactive();", 10000);
window.setTimeout("pollNotifications();", 10000);
},
timeout: function(){
window.setTimeout("sessionactive();", 10000);
window.setTimeout("pollNotifications();", 10000);
},
success: function(data){
if(data)
@@ -459,7 +459,7 @@
var t = 120000;
if(data.apps && parseInt(data.apps)>1)
t = Math.round((Math.sqrt(parseInt(data.apps)-1) * 1.3 * 120000));
window.setTimeout("sessionactive();", t);
window.setTimeout("pollNotifications();", t);
return;
}

View File

@@ -1,26 +1,17 @@
{% import 'common/caption_templates/answer.html.twig' as cap_ans %}
{% import 'common/caption_templates/basket_element.html.twig' as cap_bas %}
{% import 'common/caption_templates/internal_publi.html.twig' as cap_pub %}
{% import 'common/caption_templates/lazaret.html.twig' as cap_laz %}
{% import 'common/caption_templates/overview.html.twig' as cap_ovr %}
{% import 'common/caption_templates/preview.html.twig' as cap_prev %}
{% import 'common/macros.html.twig' as macro %}
{% if app['authentication'].getUser() %}
{% set business = app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.get_base_id(), 'canmodifrecord') %}
{% else %}
{% set business = false %}
{% endif %}
{% set business = app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.get_base_id(), 'canmodifrecord')|default(false) %}
{% if view == 'answer' %}
{{cap_ans.format_caption(record, highlight|default(''), searchEngine|default(null), searchOptions|default(null), business)}}
{{ macro.format_caption(record, highlight|default(''), searchEngine|default(null), searchOptions|default(null), business, false, true) }}
{% elseif view == 'lazaret' %}
{{cap_laz.format_caption(record, highlight|default(''), searchEngine|default(null), searchOptions|default(null), business)}}
{{ macro.format_caption(record, highlight|default(''), searchEngine|default(null), searchOptions|default(null), business, true, true) }}
{% elseif view == 'preview' %}
{{cap_prev.format_caption(record, highlight|default(''), searchEngine|default(null), searchOptions|default(null), business)}}
{{ macro.format_caption(record, highlight|default(''), searchEngine|default(null), searchOptions|default(null), business, true, false) }}
{% elseif view == 'basket' %}
{{cap_bas.format_caption(record, highlight|default(''), searchEngine|default(null), searchOptions|default(null), business)}}
{{ macro.format_caption(record, highlight|default(''), searchEngine|default(null), searchOptions|default(null), business, true, false) }}
{% elseif view == 'overview' %}
{{cap_ovr.format_caption(record, highlight|default(''), searchEngine|default(null), searchOptions|default(null), business)}}
{{ macro.format_caption(record, highlight|default(''), searchEngine|default(null), searchOptions|default(null), business, false, false) }}
{% elseif view == 'publi' %}
{{cap_pub.format_caption(record, '', null, null, business)}}
{{ macro.format_caption(record, '', null, business, true, true) }}
{% endif %}

View File

@@ -1,9 +0,0 @@
{% macro format_caption(record, highlight, searchEngine, options, includeBusiness) %}
{% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness, options) %}
<div class="desc{% if loop.index is odd %}im{% endif %}pair"><b>{{ value.label }}</b> : {{ value.value | thesaurus }}</div>
{% endfor %}
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'technical_display') == 'group' %}
<hr/>
{% include 'common/technical_datas.html.twig' %}
{% endif %}
{% endmacro %}

View File

@@ -1,5 +0,0 @@
{% macro format_caption(record, highlight, searchEngine, options, includeBusiness) %}
{% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness, options) %}
<div class="desc{% if loop.index is odd %}im{% endif %}pair"><b>{{ value.label }}</b> : {{ value.value | thesaurus }}</div>
{% endfor %}
{% endmacro %}

View File

@@ -1,9 +0,0 @@
{% macro format_caption(record, highlight, searchEngine, options, includeBusiness) %}
{% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness, options) %}
<div class="desc{% if loop.index is odd %}im{% endif %}pair"><b>{{ value.label }}</b> : {{ value.value | thesaurus }}</div>
{% endfor %}
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'technical_display') == 'group' %}
<hr/>
{% include 'common/technical_datas.html.twig' %}
{% endif %}
{% endmacro %}

View File

@@ -1,9 +0,0 @@
{% macro format_caption(record, highlight, searchEngine, options, includeBusiness) %}
{% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness, options) %}
<div class="desc{% if loop.index is odd %}im{% endif %}pair"><b>{{ value.label }}</b> : {{ value.value | thesaurus }}</div>
{% endfor %}
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'technical_display') == 'group' %}
<hr/>
{% include 'common/technical_datas.html.twig' %}
{% endif %}
{% endmacro %}

View File

@@ -1,5 +0,0 @@
{% macro format_caption(record, highlight, searchEngine, options, includeBusiness) %}
{% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness, options) %}
<div><b>{{ value.label }}</b> : {{ value.value }}</div>
{% endfor %}
{% endmacro %}

View File

@@ -1,5 +0,0 @@
{% macro format_caption(record, highlight, searchEngine, options, includeBusiness) %}
{% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness, options) %}
<div class="desc{% if loop.index is odd %}im{% endif %}pair"><b>{{ value.label }}</b> : {{ value.value | thesaurus }}</div>
{% endfor %}
{% endmacro %}

View File

@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="{{ app['locale'] }}" style="overflow:hidden;">
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{% if local_title is defined%}{{local_title}} | {% endif %}{{ app['conf'].get(['registry', 'general', 'title']) }} {% if module_name is defined %} - {{ module_name }} {% endif %}</title>
<link type="text/css" rel="stylesheet" href="{{ path('minifier', { 'f' : 'include/jslibs/jquery-ui-1.10.3/css/'~ jquery_theme|default('ui-lightness') ~'/jquery-ui-1.10.3.custom.css' }) }}" />

View File

@@ -1,7 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="{{ app['locale'] }}">
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{% if local_title is defined%}{{local_title}} | {% endif %}{{ app['conf'].get(['registry', 'general', 'title']) }} - {{ module_name }} </title>
<link type="text/css" rel="stylesheet" href="{{ path('minifier', { 'f' : 'skins/common/main.css' }) }}">
{% block stylesheet %}{% endblock %}

View File

@@ -29,7 +29,7 @@
<td style="width:70px;"class="text-right hidden-phone">
<div class="btn-group">
<a href="javascript:Recaptcha.reload()" class="btn btn-mini btn-info"><i class="icon-refresh"></i></a>
<a href="javascript:Recaptcha.switch_type('image')" class="btn btn-mini btn-info"><i class="icon-volume-up"></i></i></a>
<a href="javascript:Recaptcha.switch_type('image')" class="btn btn-mini btn-info"><i class="icon-volume-up"></i></a>
<a href="javascript:Recaptcha.showhelp()" class="btn btn-mini btn-info"><i class="icon-question-sign"></i></a>
</div>
</td>
@@ -39,7 +39,7 @@
<div class="btn-toolbar">
<div class="btn-group text-right">
<a href="javascript:Recaptcha.reload()" class="btn btn-info"><i class="icon-refresh"></i></a>
<a href="javascript:Recaptcha.switch_type('image')" class="btn btn-info"><i class="icon-volume-up"></i></i></a>
<a href="javascript:Recaptcha.switch_type('image')" class="btn btn-info"><i class="icon-volume-up"></i></a>
<a href="javascript:Recaptcha.showhelp()" class="btn btn-info"><i class="icon-question-sign"></i></a>
</div>
</div>
@@ -79,3 +79,39 @@
{% endfor %}
{% endfor %}
{% endmacro %}
{% macro caption_value(field, bounceable) %}
{% autoescape false %}
{% set terms = [] %}
{% for data in field.values %}
{% if data.from_thesaurus and bounceable %}
{% set value = data.value|e|bounce(field.name, data.qjs, field.sbas_id) %}
{% else %}
{% set value = data.value|e %}
{% endif %}
{% set terms = [value]|merge(terms) %}
{% endfor %}
{{ terms|join(' ' ~ field.separator ~ ' ') }}
{% endautoescape %}
{% endmacro %}
{% macro caption_field(field, bounceable, extra_classes) %}
<div class="desc {{ extra_classes|join(' ') }}">
<b>{{ field.label }}</b> :
{{ _self.caption_value(field, bounceable|default(true))|highlight|linkify }}
</div>
{% endmacro %}
{% macro format_caption(record, highlight, search_engine, include_business, bounceable, technical_data) %}
{% for field in record.get_caption().get_highlight_fields(highlight, null, search_engine, include_business) %}
{% set extra_classes = ['pair'] %}
{% if loop.index is odd %}
{% set extra_classes = ['impair'] %}
{% endif %}
{{ _self.caption_field(field, bounceable|default(true), extra_classes) }}
{% endfor %}
{% if technical_data|default(true) and app['authentication'].getUser() is not none and app['authentication'].getUser().getPrefs('technical_display') == 'group' %}
<hr/>
{% include 'common/technical_datas.html.twig' %}
{% endif %}
{% endmacro %}

View File

@@ -0,0 +1,23 @@
{% macro audio_player(thumbnail, url, original_w, original_h, fit) %}
{% set random = thumbnail.get_random() %}
<div class="record record_audio audioTips" style="width:{{fit.width}}px;height:{{fit.height}}px;top:{{fit.top}}px;">
<div id="preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}" class="PNB" style=""></div>
<input type="hidden" name="width" value="{{original_w}}"/>
<input type="hidden" name="height" value="{{original_h}}"/>
</div>
<script type="text/javascript">
swfobject.embedSWF(
"/include/jslibs/audio-player/player.swf",
"preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}",
"{{original_w}}", "{{original_h}}", "9.0.0", false, false, {
menu: "false",
flashvars: "playerID=2&autostart=yes&noinfo=yes&animation=no&remaining=yes&soundFile={{url}}",
movie: "/include/jslibs/audio-player/player.swf",
allowFullScreen :"true",
wmode: "transparent"
}, false
);
</script>
{% endmacro %}

View File

@@ -0,0 +1,21 @@
{% macro pdf_player(thumbnail, url, original_w, original_h, fit) %}
{% set random = thumbnail.get_random() %}
<div class="record record_document imgTips" style="position:relative;width:{{fit.width}}px;height:{{fit.height}}px;top:{{fit.top}}px;">
<div id="preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}" class="PNB" style=""></div>
<input type="hidden" name="width" value="{{original_w}}"/>
<input type="hidden" name="height" value="{{original_h}}"/>
</div>
<script type="text/javascript">
swfobject.embedSWF(
"/include/FlexPaper_flash/FlexPaperViewer.swf",
"preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}",
"100%", "100%", "9.0.0", false, false, {
menu: "false",
flashvars: "SwfFile={{url}}&Scale=0.6&ZoomTransition=easeOut&ZoomTime=0.5&ZoomInterval=0.1&FitPageOnLoad=true&FitWidthOnLoad=true&PrintEnabled=true&FullScreenAsMaxWindow=false&localeChain={{app['locale']}}",
movie: "/include/FlexPaper_flash/FlexPaperViewer.swf",
allowFullScreen :"true",
wmode: "transparent"
}, false
);
</script>
{% endmacro %}

View File

@@ -0,0 +1,35 @@
{% macro video_player(thumbnail, url, original_w, original_h, fit) %}
{% set random = thumbnail.get_random %}
<div class="record record_video imgTips" style="position:relative;width:{{fit.width}}px;height:{{fit.height}}px;top:{{fit.top}}px;">
<div id="preview{{random}}" class="PNB"></div>
<input type="hidden" name="width" value="{{original_w}}"/>
<input type="hidden" name="height" value="{{original_h}}"/>
</div>
<script type="text/javascript">
flowplayer("preview{{random}}", {
src:"/include/jslibs/flowplayer/flowplayer-3.2.18.swf",
wmode: "transparent"
},
{
clip: {
url:"{{url|url_encode}}",
autoPlay: true,
autoBuffering:true,
{% if app['phraseanet.h264-factory'].isH264Enabled() %}
provider: "h264streaming",
{% endif %}
scaling:"fit"
},
onError:function(code,message) {
getNewVideoToken("{{thumbnail.get_sbas_id() ~'_'~thumbnail.get_record_id()}}", this);
},
plugins: {
{% if app['phraseanet.h264-factory'].isH264Enabled() %}
h264streaming: {
url: "/include/jslibs/flowplayer/pseudostreaming/flowplayer.pseudostreaming-3.2.13.swf"
}
{% endif %}
}
});
</script>
{% endmacro %}

View File

@@ -1,229 +1,65 @@
{% macro format(thumbnail, b_w, b_h, extraclass, wrap, lazyload)%}
{% set record_type = thumbnail.get_type() %}
{% macro format(thumbnail, box_w, box_h, extra_class, wrap, lazyload) %}
{% set record_type = thumbnail.get_type() %}
{% set box_w = box_w|round %}
{% set box_h = box_h|default(box_w)|round %}
{% if record_type == 'AUDIO_MP3' %}
{% set original_w = 320 %}
{% set original_h = 60 %}
{% set b_width = b_w %}
{% set b_height = b_h|default(b_w) %}
{% if record_type == 'AUDIO_MP3' %}
{% set d_width = 320 %}
{% set d_height = 60 %}
{% set top = 0 %}
{% elseif record_type == 'FLEXPAPER' %}
{% set d_width = 800 %}
{% set d_height = 600 %}
{% set top = 0 %}
{% else %}
{% set b_ratio = b_width / b_height %}
{% set thumbnail_height = thumbnail.get_height() > 0 ? thumbnail.get_height() : 120 %}
{% set thumbnail_width = thumbnail.get_width() > 0 ? thumbnail.get_width() : 120 %}
{% set i_ratio = thumbnail_width / thumbnail_height %}
{% if i_ratio > b_ratio%}
{% if b_width > thumbnail_width %}
{% set d_width = thumbnail_width %}
{% else %}
{% set d_width = b_width %}
{% endif %}
{% set d_height = d_width / thumbnail_width * thumbnail_height %}
{% set top = (b_height - d_height) / 2 %}
{% else %}
{% if b_height > thumbnail_height %}
{% set d_height = thumbnail_height %}
{% else %}
{% set d_height = b_height %}
{% endif %}
{% set d_width = d_height * thumbnail_width / thumbnail_height %}
{% set top = ((b_height - d_height) / 2) %}
{% endif %}
{% endif %}
{% if app['authentication'].isAuthenticated() == true %}
{% set url = thumbnail.get_url() %}
{% else %}
{% set url = thumbnail.get_permalink().get_url() %}
{% endif %}
{% if wrap %}
<div style="width:{{b_width|round}}px;height:{{b_height|round}}px;" class="thumb_wrapper {{extraclass|default('')}}">
{% endif %}
{% if record_type == 'VIDEO_MP4' or record_type == 'VIDEO_FLV' %}
{% set random = random(100000) %}
<div class="record record_video imgTips" style="position:relative;width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
<div id="preview{{random}}" class="PNB"></div>
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
</div>
<script type="text/javascript">
flowplayer("preview{{random}}",
{src:"/include/jslibs/flowplayer/flowplayer-3.2.18.swf", wmode: "transparent"},
{clip:{url:"{{url|url_encode}}",autoPlay: true,autoBuffering:true,provider: "h264streaming",scaling:"fit"},
onError:function(code,message){getNewVideoToken("{{thumbnail.get_sbas_id() ~'_'~thumbnail.get_record_id()}}", this);},
plugins: {
{% if app['phraseanet.h264-factory'].isH264Enabled() %}
h264streaming: {
url: "/include/jslibs/flowplayer/pseudostreaming/flowplayer.pseudostreaming-3.2.13.swf"
}
{% endif %}
}
});
</script>
{% set fit_size = {
"width":original_w,
"height":original_h,
"top":0,
"left": 0
} %}
{% elseif record_type == 'FLEXPAPER' %}
{% set random = random(100000) %}
<div class="record record_document imgTips" style="position:relative;width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
<div id="preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}" class="PNB" style=""></div>
<input type="hidden" name="width" value="{{d_width}}"/>
<input type="hidden" name="height" value="{{d_height}}"/>
</div>
<script type="text/javascript">
swfobject.embedSWF("/include/FlexPaper_flash/FlexPaperViewer.swf",
"preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}",
"100%", "100%", "9.0.0", false, false,
{menu: "false",flashvars: "SwfFile={{url}}&Scale=0.6&ZoomTransition=easeOut&ZoomTime=0.5&ZoomInterval=0.1&FitPageOnLoad=true&FitWidthOnLoad=true&PrintEnabled=true&FullScreenAsMaxWindow=false&localeChain={{app['locale']}}", movie: "/include/FlexPaper_flash/FlexPaperViewer.swf", allowFullScreen :"true",wmode: "transparent"}, false);</script>
{% set original_w = 800 %}
{% set original_h = 600 %}
{% set fit_size = {
"width":800,
"height":600,
"top":0,
"left": 0
} %}
{% else %}
{% set original_h = thumbnail.get_height() > 0 ? thumbnail.get_height() : 120 %}
{% set original_w = thumbnail.get_width() > 0 ? thumbnail.get_width() : 120 %}
{% set fit_size = fitIn(
{"width":original_w, "height":original_h},
{"width":box_w, "height":box_h}
)%}
{% endif %}
{% set url = app['authentication'].isAuthenticated() ? thumbnail.get_url() : thumbnail.get_permalink().get_url() %}
{% if wrap %}
<div
style="width:{{box_w}}px;height:{{box_h}}px;"
class="thumb_wrapper {{extra_class|default('')}}"
>
{% endif %}
{% if record_type == 'VIDEO_MP4' or record_type == 'VIDEO_FLV' %}
{% import 'common/players/video.html.twig' as player %}
{{ player.video_player(thumbnail, url, original_w, original_h, fit_size) }}
{% elseif record_type == 'FLEXPAPER' %}
{% import 'common/players/pdf.html.twig' as player %}
{{ player.pdf_player(thumbnail, url, original_w, original_h, fit_size) }}
{% elseif record_type == 'AUDIO_MP3' %}
{% set random = random(100000) %}
<div class="record record_audio audioTips" style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
<div id="preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}" class="PNB" style=""></div>
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
</div>
<script type="text/javascript">
swfobject.embedSWF("/include/jslibs/audio-player/player.swf",
"preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}",
"{{d_width}}", "{{d_height}}", "9.0.0", false, false,
{menu: "false",flashvars: "playerID=2&autostart=yes&noinfo=yes&animation=no&remaining=yes&soundFile={{url}}", movie: "/include/jslibs/audio-player/player.swf", allowFullScreen :"true",wmode: "transparent"}, false);</script>
{% import 'common/players/audio.html.twig' as player %}
{{ player.audio_player(thumbnail, url, original_w, original_h, fit_size) }}
{% else %}
<img class="{% if lazyload %}lazyload{% endif %} record record_image imgTips zoomable thumb" oncontextMenu="return(false);"
style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;"
style="width:{{fit_size.width}}px;height:{{fit_size.height}}px;top:{{fit_size.top}}px;"
src="{% if lazyload %}/skins/grey.gif{% else %}{{ url }}{% endif %}" data-original="{{ url }}" ondragstart="return false;">
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
<input type="hidden" name="width" value="{{original_w}}"/>
<input type="hidden" name="height" value="{{original_h}}"/>
{% endif %}
{% if wrap %}
</div>
{% endif %}
{% endmacro %}
{% macro format_fit(thumbnail, b_w, b_h, extraclass, wrap)%}
{% set record_type = thumbnail.get_type() %}
{% if record_type == 'AUDIO_MP3' %}
{% set d_width = 320 %}
{% set d_height = 60 %}
{% set top = 0 %}
{% elseif record_type == 'FLEXPAPER' %}
{% set d_width = 800 %}
{% set d_height = 600 %}
{% set top = 0 %}
{% else %}
{% set b_width = b_w %}
{% set b_height = b_h|default(b_w) %}
{% set b_ratio = b_width / b_height %}
{% set thumbnail_height = thumbnail.get_height() > 0 ? thumbnail.get_height() : 120 %}
{% set thumbnail_width = thumbnail.get_width() > 0 ? thumbnail.get_width() : 120 %}
{% set i_ratio = thumbnail_width / thumbnail_height %}
{% if i_ratio > b_ratio%}
{% set d_height = b_height %}
{% set d_width = d_height * thumbnail_width / thumbnail_height %}
{% set left = (b_height - d_height) / 2 %}
{% else %}
{% if b_height > thumbnail_height %}
{% set d_height = thumbnail_height %}
{% else %}
{% set d_height = b_height %}
{% endif %}
{% set d_width = d_height * thumbnail_width / thumbnail_height %}
{% set top = ((b_height - d_height) / 2) %}
{% endif %}
{% endif %}
{% if app['authentication'].isAuthenticated() == true %}
{% set url = thumbnail.get_url() %}
{% else %}
{% set url = thumbnail.get_permalink().get_url() %}
{% endif %}
{% if wrap %}
<div style="width:{{b_width|round}}px;height:{{b_height|round}}px;" class="thumb_wrapper {{extraclass|default('')}}">
{% endif %}
{% if record_type == 'VIDEO_MP4' or record_type == 'VIDEO_FLV' %}
{% set random = random(100000) %}
<div class="record record_video imgTips" style="position:relative;width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
<div id="preview{{random}}" class="PNB"></div>
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
</div>
<script type="text/javascript">
flowplayer("preview{{random}}",
{src:"/include/jslibs/flowplayer/flowplayer-3.2.18.swf", wmode: "transparent"},
{clip:{url:"{{url}}",autoPlay: true,autoBuffering:true,provider: "h264streaming",scaling:"fit"},
onError:function(code,message){getNewVideoToken({{thumbnail.get_sbas_id() ~'_'~thumbnail.get_record_id()}}, this);},
plugins: {
{% if app['phraseanet.h264-factory'].isH264Enabled() %}
h264streaming: {
url: "/include/jslibs/flowplayer/pseudostreaming/flowplayer.pseudostreaming-3.2.13.swf"
}
{% endif %}
}
});
</script>
{% elseif record_type == 'FLEXPAPER' %}
{% set random = random(100000) %}
<div class="record record_document imgTips" style="position:relative;width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
<div id="preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}" class="PNB" style=""></div>
<input type="hidden" name="width" value="{{d_width}}"/>
<input type="hidden" name="height" value="{{d_height}}"/>
</div>
<script type="text/javascript">
swfobject.embedSWF("/include/FlexPaper_flash/FlexPaperViewer.swf",
"preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}",
"100%", "100%", "9.0.0", false, false,
{menu: "false",flashvars: "SwfFile={{url}}&Scale=0.6&ZoomTransition=easeOut&ZoomTime=0.5&ZoomInterval=0.1&FitPageOnLoad=true&FitWidthOnLoad=true&PrintEnabled=true&FullScreenAsMaxWindow=false&localeChain={{app['locale']}}", movie: "/include/FlexPaper_flash/FlexPaperViewer.swf", allowFullScreen :"true",wmode: "transparent"}, false);</script>
{% elseif record_type == 'AUDIO_MP3' %}
{% set random = random(100000) %}
<div class="record record_audio audioTips" style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
<div id="preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}" class="PNB" style=""></div>
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
</div>
<script type="text/javascript">
swfobject.embedSWF("/include/jslibs/audio-player/player.swf",
"preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}",
"{{d_width}}", "{{d_height}}", "9.0.0", false, false,
{menu: "false",flashvars: "playerID=2&autostart=yes&noinfo=yes&animation=no&remaining=yes&soundFile={{url}}", movie: "/include/jslibs/audio-player/player.swf", allowFullScreen :"true",wmode: "transparent"}, false);</script>
{% else %}
<img class="record record_image imgTips zoomable thumb" oncontextMenu="return(false);"
style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;"
src="{{url}}" ondragstart="return false;">
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
{% endif %}
{% if wrap %}
</div>
{% endif %}
{% endmacro %}

View File

@@ -67,6 +67,25 @@
>
</td>
</tr>
{% if application.get_type() == constant("API_OAuth2_Application::WEB_TYPE") %}
<tr>
<td>
{% trans "Define a webhook URL" %}
<p style="font-size: 10px;max-width: 450px">
{% trans "Gives the option to your application to communicate with Phraseanet. This webhook can be used to trigger some actions on your application side." %}
</p>
</td>
<td class="url_callback">
<span class="url_webhook_input">{{ application.getWebhook() }}</span>
<a href="{{ path("submit_application_webhook", {"id" : application.get_id()}) }}" class="save_webhook btn btn-small btn-info" style="display:none;">
{% trans "Save" %}
</a>
<button type="button" class="webhook-modify-btn btn btn-small">
{% trans "Modify" %}
</button>
</td>
</tr>
{% endif %}
</tbody>
</table>

View File

@@ -98,7 +98,7 @@
</div>
{% if app_type == "web" %}
<div class="control-group">
<div class="control-group callback-control-group">
<label for="callback" class="control-label"><b>{{ "URL de callback" | trans }}</b></label>
<div class="controls">
<select name="scheme-callback" class="input-mini">

View File

@@ -1,7 +1,7 @@
{% extends "lightbox/index_layout.html.twig" %}
{% import 'common/thumbnail.html.twig' as thumbnail %}
{% import 'common/caption_templates/preview.html.twig' as caption %}
{% import 'common/macros.html.twig' as macro %}
{% block javascript %}
<script type="text/javascript" src="{{ path('minifier', { 'g' : 'lightboxie6' }) }}"></script>
@@ -83,7 +83,7 @@
<div class="lightbox_container">
{% set business = app['acl'].get(app['authentication'].getUser()).has_right_on_base(first_item.getRecord(app).get_base_id(), 'canmodifrecord') %}
{% if first_item %}
{{caption.format_caption(first_item.getRecord(app), '', null, null, business)}}
{{caption.format_caption(first_item.get_record(), '', null null, business, false, fals)}}
{% endif %}
</div>
</div>

View File

@@ -1,7 +1,7 @@
{% extends "lightbox/index_layout.html.twig" %}
{% import 'common/thumbnail.html.twig' as thumbnail %}
{% import 'common/caption_templates/preview.html.twig' as caption %}
{% import 'common/macros.html.twig' as macro %}
{% block javascript %}
<script type="text/javascript" src="{{ path('minifier', { 'g' : 'lightboxie6' }) }}"></script>
@@ -95,7 +95,7 @@
<div class="lightbox_container">
{% if basket_element %}
{% set business = app['acl'].get(app['authentication'].getUser()).has_right_on_base(basket_element.getRecord(app).get_base_id(), 'canmodifrecord') %}
{{caption.format_caption(basket_element.getRecord(app), '', null, null, business)}}
{{caption.format_caption(basket_element.getRecord(app), '', null, null, business, false, false)}}
{% endif %}
</div>
</div>

View File

@@ -1,7 +1,7 @@
{% extends "lightbox/index_layout.html.twig" %}
{% import 'common/thumbnail.html.twig' as thumbnail %}
{% import 'common/caption_templates/preview.html.twig' as caption %}
{% import 'common/macros.html.twig' as macro %}
{% block javascript %}
<script type="text/javascript" src="{{ path('minifier', { 'g' : 'lightbox' }) }}"></script>
@@ -83,7 +83,7 @@
<div class="lightbox_container PNB">
{% set business = app['acl'].get(app['authentication'].getUser()).has_right_on_base(first_item.getRecord(app).get_base_id(), 'canmodifrecord') %}
{% if first_item %}
{{caption.format_caption(first_item.getRecord(app), '', null, null, business)}}
{{caption.format_caption(first_item.getRecord(app), '', null, null, business, false, false)}}
{% endif %}
</div>
</div>

View File

@@ -1,7 +1,7 @@
{% extends "lightbox/index_layout.html.twig" %}
{% import 'common/thumbnail.html.twig' as thumbnail %}
{% import 'common/caption_templates/preview.html.twig' as caption %}
{% import 'common/macros.html.twig' as macro %}
{% block javascript %}
<script type="text/javascript" src="{{ path('minifier', { 'g' : 'lightbox' }) }}"></script>
@@ -98,7 +98,7 @@
<div class="lightbox_container PNB">
{% if basket_element %}
{% set business = app['acl'].get(app['authentication'].getUser()).has_right_on_base(basket_element.getRecord(app).get_base_id(), 'canmodifrecord') %}
{{caption.format_caption(basket_element.getRecord(app), '', null, null, business)}}
{{caption.format_caption(basket_element.getRecord(app), '', null, null, business, false, false)}}
{% endif %}
</div>
</div>

View File

@@ -1,8 +1,8 @@
<div class="popover" style="display:block;{% if maxwidth %}max-width:{{ maxwidth }}px;{% endif %}{% if width %}width:{{ width }}px;{% endif %}position:relative;">
<div class="popover" style="display:block;{% if maxwidth is not none %}max-width:{{ maxwidth }}px;{% endif %}{% if width is not none %}width:{{ width }}px;{% endif %}position:relative;">
<div class="arrow"></div>
<div class="popover-inner" style="width:auto;">
<h3 class="popover-title">
{% if title %}
{% if title is not none %}
{{ title }}
{% endif %}
<button data-dismiss="modal" class="close tooltip_closer" style="display:none;">×</button>

View File

@@ -19,7 +19,7 @@
</div>
{% elseif list['complete'] is defined and list['complete'] %}
<div class="alert alert-success">
{% set url = path('document_download', {'token': token.getValue()}) %}
{% set url = path('document_download', {'token': token.getValue(), 'type': type, 'anonymous': anonymous}) %}
{% set before_link = '<a href="' ~ url ~ '" target="_self">' %}
{% set after_link = '</a>' %}
{% trans with {'%before_link%' : before_link, '%after_link%' : after_link} %}Your documents are ready. If the download does not start, %before_link%click here%after_link%{% endtrans %}
@@ -105,7 +105,7 @@
{% set time = time < 1 ? 2 : (time > 10 ? 10 : time) %}
{% if list['complete'] is not defined %} {# Zip not done #}
$.post("{{ path('execute_download', {'token': token.getValue()}) }}", function(data){
$.post("{{ path('execute_download', {'token': token.getValue(), 'type': type, 'anonymous': anonymous}) }}", function(data){
var data = $.parseJSON(data);
if(data.success) {
$('form[name=download]').submit();

View File

@@ -208,6 +208,7 @@
<textarea name="message" style="display:none;"></textarea>
<input type="hidden" name="duration" value=""/>
<input type="checkbox" value="1" name="recept" style="display:none;"/>
<input type="checkbox" value="1" name="force_authentication" style="display:none;"/>
<div class="PNB badges"></div>
</form>
<div class="PNB10 footer">

View File

@@ -39,7 +39,7 @@
{% set title = publishing.basket().getName() %}
{% set desc = publishing.basket().getDescription() %}
{% endif %}
<input class="required_text checkbox" checked="checked" type="checkbox" name="notify" id="feed_add_notify" value="1" />
<input class="required_text checkbox" type="checkbox" name="notify" id="feed_add_notify" value="1" />
<label for="feed_add_notify">{{ 'Notify users about this publication' | trans }}</label><br/>
<label for="feed_add_title">{{ 'publication : titre' | trans }}</label>
<input class="required_text" type="text" name="title" id="feed_add_title" value="{{title}}" />

View File

@@ -1025,20 +1025,20 @@
p4.reg_delete="{% if app['settings'].getUserSetting(app['authentication'].getUser(), "warning_on_delete_story") %}true{% else %}false{% endif %}";
});
function sessionactive(){
function pollNotifications(){
$.ajax({
type: "POST",
url: "{{ path('update_session') }}",
url: "{{ path('list_notifications') }}",
dataType: "json",
data: {
module : 1,
usr : {{app['authentication'].getUser().getId()}}
},
error: function(){
window.setTimeout("sessionactive();", 10000);
window.setTimeout("pollNotifications();", 10000);
},
timeout: function(){
window.setTimeout("sessionactive();", 10000);
window.setTimeout("pollNotifications();", 10000);
},
success: function(data){
if(data)
@@ -1046,7 +1046,7 @@
var t = 120000;
if(data.apps && parseInt(data.apps)>1)
t = Math.round((Math.sqrt(parseInt(data.apps)-1) * 1.3 * 60000));
window.setTimeout("sessionactive();", t);
window.setTimeout("pollNotifications();", t);
return;
}

View File

@@ -1,4 +1,4 @@
{% import 'common/caption_templates/preview.html.twig' as caption %}
{% import 'common/macros.html.twig' as macro %}
{% if app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.get_base_id, 'canmodifrecord') %}
<div class="edit_button" style="text-align:right">
@@ -13,9 +13,7 @@
</div>
{% set business = app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.get_base_id(), 'canmodifrecord') %}
{% if record.is_from_reg() %}
{{caption.format_caption(record, '', null, null, business)}}
{{caption.format_caption(record, '', null, null, business, false, true)}}
{% else %}
{{caption.format_caption(record, highlight, searchEngine, searchOptions, business)}}
{{caption.format_caption(record, highlight, searchEngine, searchOptions, business, false, true)}}
{% endif %}
<hr style="margin:10px 0;"/>
{% include 'common/technical_datas.html.twig' %}

View File

@@ -1,22 +1,20 @@
{% extends "prod/results/answerabstract.html.twig" %}
{% block content %}
{% import 'common/caption_templates/answer.html.twig' as caption %}
{% import 'common/macros.html.twig' as macro %}
{% for record in results.getResults() %}
<div class='list ui-corner-all'>
<table style='width:100%;' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td valign="top" style='width:{{th_size+50}}px'>
{{record_format.block(record, highlight, searchEngine, 'IMGT', false)}}
{{ record_format.block(record, highlight, searchEngine, 'IMGT', false) }}
</td>
<td valign="middle">
<div class='desc' style='max-height:{{th_size+70}}px;overflow-y:auto;'>
<div class="fixeddesc">
{% set business = app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.get_base_id(), 'canmodifrecord') %}
{{caption.format_caption(record, highlight, searchEngine, searchOptions, business)}}
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'technical_display') == 'group' %}<hr/>{{record.get_technical_infos|raw}}{% endif %}
{{ macro.format_caption(record, highlight, searchEngine, searchOptions, business, true, true) }}
</div>
</div>
</td>

View File

@@ -23,7 +23,7 @@
<div style="padding: 4px;">
<div style="height:40px; position: relative; z-index: 95;">
<div class="title">
{{record.get_title(highlight, searchEngine)|thesaurus}}
{{record.get_title}}
</div>
<div class="status">
{{record.get_status_icons|raw}}

View File

@@ -14,6 +14,11 @@
<span class="name"><%= item.display_name %></span>
</td>
</tr>
<tr>
<td>
<span class="email"><i><%= item.email %></i></span>
</td>
</tr>
<tr>
<td>
<span class="subtite"><%= item.subtitle || '' %></span>
@@ -123,7 +128,7 @@
<script type="text/template" id="feedback_sendform_tpl">
<form>
<div class="Feedback" style="display:none;">
<div class="Feedback control-group" style="display:none;">
<label for="PushSendFormDuration">{% trans %}Time for feedback (days){% endtrans %}</label>
<select id="PushSendFormDuration" name="duration" class="input-block-level">
<option {% if 20 == app['conf'].get(['registry', 'actions', 'validation-expiration-days']) %}selected="selected"{% endif %} value="20">20</option>
@@ -135,20 +140,39 @@
<option {% if 1 == app['conf'].get(['registry', 'actions', 'validation-expiration-days']) %}selected="selected"{% endif %} value="1">1</option>
</select>
</div>
<div>
<label for="PushSendFormRecept">{% trans %}Name{% endtrans %}</label>
<div class="control-group">
<label for="PushSendFormName">{% trans %}Name{% endtrans %}</label>
<input id="PushSendFormName" type="text" name="name" class="input-block-level"/>
</div>
<div>
<div class="control-group">
<label for="PushSendFormMessage">{% trans %}Message{% endtrans %}</label>
<textarea id="PushSendFormMessage" name="message" class="input-block-level"></textarea>
<textarea id="PushSendFormMessage" name="message" class="input-block-level" rows="6"></textarea>
</div>
<div>
<div class="control-group">
<label for="PushSendFormRecept" class="checkbox">
<input id="PushSendFormRecept" type="checkbox" name="recept" value="1"/>
{% trans %}Accuse de reception{% endtrans %}
</label>
</div>
{% if app['phraseanet.registry'].get('GV_force_push_authentication') %}
<div class="control-group">
<label for="PushForceAuthentication" class="checkbox">
<input id="PushForceAuthentication" type="checkbox" checked="checked" name="force_authentication" value="1"/>
{% trans %}Force authentication{% endtrans %}
</label>
</div>
<div class="control-group info">
<span class="help-inline" style="font-style: italic">
<i class="icon-info-sign"></i>
{% trans %}
The parameter "force authentication" forces the recipient(s) of the push to possess a Phraseanet account
to see its contents.
This avoids anonymous users to access to the content of the push if they were able to get the display
url through a forwarded mail for example.
{% endtrans %}
</span>
</div>
{% endif %}
</form>
</script>

View File

@@ -727,10 +727,13 @@ function TXdblClick(e)
var tid = $(x).closest('li').attr('id');
if(tid.substr(0,5)=="TX_P.")
{
var sbid = tid.split(".")[1];
var term = $(x).hasClass('separator') ? $(x).prev().text() : $(x).text();
doThesSearch('T', sbid, term, null);
var tids = tid.split(".");
if(tids.length > 3)
{
var sbid = tids[1];
var term = $(x).hasClass('separator') ? $(x).prev().text() : $(x).text();
doThesSearch('T', sbid, term, null);
}
}
break;
case "wiz_2": // replace by

View File

@@ -31,25 +31,25 @@
{% set title1 = "report:: Utilisateurs les plus actifs" | trans %}
{% set title2 = "report:: utilisateurs" | trans %}
{% set title3 = "report:: telechargements document" | trans %}
{{ dash.table(title1 , title2, title3, item.top_ten_user_doc, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{{ dash.table(title1~"("~ title3~")", title2, title3, item.top_ten_user_doc, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{% endif %}
{% if "top_ten_user_prev"|key_exists(item) %}
{% set title1 = "report:: Utilisateurs les plus actifs" | trans %}
{% set title2 = "report:: utilisateurs" | trans %}
{% set title3 = "report:: telechargements preview" | trans %}
{{ dash.table(title1 , title2, title3, item.top_ten_user_prev, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{{ dash.table(title1~"("~ title3~")", title2, title3, item.top_ten_user_prev, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{%endif %}
{% if "top_ten_user_poiddoc"|key_exists(item) %}
{% set title1 = "report:: Utilisateurs les plus actifs" | trans %}
{% set title2 = "report:: utilisateurs" | trans %}
{% set title3 = "report:: poids document" | trans %}
{{ dash.table(title1 , title2, title3, item.top_ten_user_poiddoc, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "true", "false") }}
{{ dash.table(title1~"("~ title3~")", title2, title3, item.top_ten_user_poiddoc, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "true", "false") }}
{%endif %}
{% if "top_ten_user_poidprev"|key_exists(item) %}
{% set title1 = "report:: Utilisateurs les plus actifs" | trans %}
{% set title2 = "report:: utilisateurs" | trans %}
{% set title3 = "report:: poids preview" | trans %}
{{ dash.table(title1, title2, title3, item.top_ten_user_poidprev, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "true", "false") }}
{{ dash.table(title1~"("~ title3~")", title2, title3, item.top_ten_user_poidprev, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "true", "false") }}
{%endif %}
{% if "top_dl_doc"|key_exists(item) %}
{% set title1 = "report:: documents les plus telecharges" | trans %}

View File

@@ -8,7 +8,7 @@
<!--<![endif]-->
<head>
{% block head %}
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="user-scalable=no, width=980px" />
<title>{% block title %}{% endblock %} - Reports </title>
{% block stylesheet %}{% endblock %}

Some files were not shown because too many files have changed in this diff Show More