Merge branch 'master' of https://github.com/alchemy-fr/Phraseanet into PHRAS-2419_refacto_Icons_actions_under_Thumbnail

This commit is contained in:
Harrys Ravalomanana
2019-05-08 11:16:08 +04:00
99 changed files with 11700 additions and 13653 deletions

View File

@@ -1,101 +1,125 @@
version: 2
version: 2.1
orbs:
aws-ecr: circleci/aws-ecr@4.0.1
jobs:
build:
working_directory: ~/alchemy-fr/Phraseanet
parallelism: 2
shell: /bin/bash --login
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
docker:
- image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37
command: /sbin/init
steps:
- checkout
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
- run:
build:
working_directory: ~/alchemy-fr/Phraseanet
command: nvm install v10.12.0 && nvm alias default v10.12.0
- run:
working_directory: ~/alchemy-fr/Phraseanet
command: 'sudo service memcached status || sudo service memcached start; sudo
redis-cli ping >/dev/null 2>&1 || sudo service redis-server start; sudo
service mysql status || sudo service mysql start; sudo service rabbitmq-server
status || sudo service rabbitmq-server start; '
# Dependencies
# This would typically go in either a build or a build-and-test job when using workflows
# Restore the dependency cache
- restore_cache:
keys:
# This branch if available
- v1-dep-{{ .Branch }}-
# Default branch if not
- v1-dep-master-
# Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
- v1-dep-
# This is based on your 1.0 configuration file or project settings
- run: git clone https://github.com/alanxz/rabbitmq-c
- run: cd rabbitmq-c && git checkout 2ca1774489328cde71195f5fa95e17cf3a80cb8a
- run: cd rabbitmq-c && git submodule init && git submodule update && autoreconf -i && ./configure && make && sudo make install
# disabled because pear.php.net is down cause of security failure
#- run: pecl channel-update pear.php.net
- run: yes '' | pecl install amqp-1.9.3
- run: yes '' | pecl install imagick
- run: sudo apt-get install libzmq-dev
- run: yes '' | pecl install zmq-beta
- run: echo "extension = amqp.so" > /opt/circleci/php/$(phpenv global)/etc/conf.d/amqp.ini
- run: echo "extension = zmq.so" > /opt/circleci/php/$(phpenv global)/etc/conf.d/zmq.ini
- run: echo "date.timezone = UTC" > /opt/circleci/php/$(phpenv global)/etc/conf.d/timezone.ini
- run: sed -i 's/^\(session.cache_limiter = \).*/\1""/' /opt/circleci/php/$(phpenv global)/etc/php.ini
- run: npm rebuild node-sass
# This is based on your 1.0 configuration file or project settings
- run: composer install --no-progress --no-interaction --optimize-autoloader
# This is based on your 1.0 configuration file or project settings
- run: node -v
- run: npm -v
- run: npm install
- run: if [[ ! -e elasticsearch-2.3.3 ]]; then wget --no-check-certificate https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-2.3.3.tar.gz && tar -xvf elasticsearch-2.3.3.tar.gz && elasticsearch-2.3.3/bin/plugin install analysis-icu; fi
- run:
command: elasticsearch-2.3.3/bin/elasticsearch
background: true
# Save dependency cache
- save_cache:
key: v1-dep-{{ .Branch }}-{{ epoch }}
paths:
# This is a broad list of cache paths to include many possible development environments
# You can probably delete some of these entries
- vendor/bundle
- ~/virtualenvs
- ~/.m2
- ~/.ivy2
- ~/.bundle
- ~/.go_workspace
- ~/.gradle
- ~/.cache/bower
# These cache paths were specified in the 1.0 config
- elasticsearch-2.3.3
- node_modules
- ~/.composer
# This is based on your 1.0 configuration file or project settings
- run: mysql -u ubuntu -e 'CREATE DATABASE update39_test;CREATE DATABASE ab_test;CREATE DATABASE db_test;SET @@global.sql_mode=STRICT_ALL_TABLES;SET @@global.max_allowed_packet=33554432;SET @@global.wait_timeout=999999;';
# This is based on your 1.0 configuration file or project settings
- run: ./bin/developer system:uninstall -v
- run: ./bin/setup system:install -v --email=test@phraseanet.com --password=test --db-host=127.0.0.1 --db-user=ubuntu --db-template=fr-simple --db-password= --databox=db_test --appbox=ab_test --server-name=http://127.0.0.1 -y;
- run: ./bin/developer ini:setup-tests-dbs -v
- run: ./bin/console searchengine:index:create -v
- run: ./bin/developer phraseanet:regenerate-sqlite -v
- run: ./bin/developer phraseanet:generate-js-fixtures -v
# Test
# This would typically be a build job when using workflows, possibly combined with build
# This is based on your 1.0 configuration file or project settings
- run: case $CIRCLE_NODE_INDEX in 0) EXIT=0; php -d memory_limit=-1 bin/phpunit --log-junit $CIRCLE_TEST_REPORTS/phpunit/junit-unit.xml --exclude-group legacy || EXIT=$?; php -d memory_limit=-1 bin/phpunit --log-junit $CIRCLE_TEST_REPORTS/phpunit/junit-legacy-no-web.xml --group legacy --exclude-group web || EXIT=$?; exit $EXIT;; 1) php -d memory_limit=-1 bin/phpunit --log-junit $CIRCLE_TEST_REPORTS/phpunit/junit-legacy-web.xml --group web ;; esac
# Teardown
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
# Save test results
- store_test_results:
path: /tmp/circleci-test-results
# Save artifacts
- store_artifacts:
path: /tmp/circleci-artifacts
- store_artifacts:
path: /tmp/circleci-test-results
parallelism: 2
shell: /bin/bash --login
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
docker:
- image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37
command: /sbin/init
steps:
- checkout
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
- run:
working_directory: ~/alchemy-fr/Phraseanet
command: nvm install v10.12.0 && nvm alias default v10.12.0
- run:
working_directory: ~/alchemy-fr/Phraseanet
command: 'sudo service memcached status || sudo service memcached start; sudo
redis-cli ping >/dev/null 2>&1 || sudo service redis-server start; sudo
service mysql status || sudo service mysql start; sudo service rabbitmq-server
status || sudo service rabbitmq-server start; '
# Dependencies
# This would typically go in either a build or a build-and-test job when using workflows
# Restore the dependency cache
- restore_cache:
keys:
# This branch if available
- v1-dep-{{ .Branch }}-
# Default branch if not
- v1-dep-master-
# Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
- v1-dep-
# This is based on your 1.0 configuration file or project settings
- run: echo 127.0.0.1 redis elasticsearch db rabbitmq | sudo tee -a /etc/hosts
- run: git clone https://github.com/alanxz/rabbitmq-c
- run: cd rabbitmq-c && git checkout 2ca1774489328cde71195f5fa95e17cf3a80cb8a
- run: cd rabbitmq-c && git submodule init && git submodule update && autoreconf -i && ./configure && make && sudo make install
# disabled because pear.php.net is down cause of security failure
#- run: pecl channel-update pear.php.net
- run: yes '' | pecl install amqp-1.9.3
- run: yes '' | pecl install imagick
- run: sudo apt-get install libzmq-dev
- run: yes '' | pecl install zmq-beta
- run: echo "extension = amqp.so" > /opt/circleci/php/$(phpenv global)/etc/conf.d/amqp.ini
- run: echo "extension = zmq.so" > /opt/circleci/php/$(phpenv global)/etc/conf.d/zmq.ini
- run: echo "date.timezone = UTC" > /opt/circleci/php/$(phpenv global)/etc/conf.d/timezone.ini
- run: sed -i 's/^\(session.cache_limiter = \).*/\1""/' /opt/circleci/php/$(phpenv global)/etc/php.ini
- run: npm rebuild node-sass
# This is based on your 1.0 configuration file or project settings
- run: composer install --no-progress --no-interaction --optimize-autoloader
# This is based on your 1.0 configuration file or project settings
- run: node -v
- run: npm -v
- run: npm install
- run: if [[ ! -e elasticsearch-2.3.3 ]]; then wget --no-check-certificate https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-2.3.3.tar.gz && tar -xvf elasticsearch-2.3.3.tar.gz && elasticsearch-2.3.3/bin/plugin install analysis-icu; fi
- run:
command: elasticsearch-2.3.3/bin/elasticsearch
background: true
# Save dependency cache
- save_cache:
key: v1-dep-{{ .Branch }}-{{ epoch }}
paths:
# This is a broad list of cache paths to include many possible development environments
# You can probably delete some of these entries
- vendor/bundle
- ~/virtualenvs
- ~/.m2
- ~/.ivy2
- ~/.bundle
- ~/.go_workspace
- ~/.gradle
- ~/.cache/bower
# These cache paths were specified in the 1.0 config
- elasticsearch-2.3.3
- node_modules
- ~/.composer
# This is based on your 1.0 configuration file or project settings
- run: mysql -u ubuntu -e 'CREATE DATABASE update39_test;CREATE DATABASE ab_test;CREATE DATABASE db_test;SET @@global.sql_mode=STRICT_ALL_TABLES;SET @@global.max_allowed_packet=33554432;SET @@global.wait_timeout=999999;';
# This is based on your 1.0 configuration file or project settings
- run: ./bin/developer system:uninstall -v
- run: ./bin/setup system:install -v --email=test@phraseanet.com --password=test --db-host=127.0.0.1 --db-user=ubuntu --db-template=fr-simple --db-password= --databox=db_test --appbox=ab_test --server-name=http://127.0.0.1 -y;
- run: ./bin/developer ini:setup-tests-dbs -v
- run: ./bin/console searchengine:index:create -v
- run: ./bin/developer phraseanet:regenerate-sqlite -v
- run: ./bin/developer phraseanet:generate-js-fixtures -v
# Test
# This would typically be a build job when using workflows, possibly combined with build
# This is based on your 1.0 configuration file or project settings
- run: case $CIRCLE_NODE_INDEX in 0) EXIT=0; php -d memory_limit=-1 bin/phpunit --log-junit $CIRCLE_TEST_REPORTS/phpunit/junit-unit.xml --exclude-group legacy || EXIT=$?; php -d memory_limit=-1 bin/phpunit --log-junit $CIRCLE_TEST_REPORTS/phpunit/junit-legacy-no-web.xml --group legacy --exclude-group web || EXIT=$?; exit $EXIT;; 1) php -d memory_limit=-1 bin/phpunit --log-junit $CIRCLE_TEST_REPORTS/phpunit/junit-legacy-web.xml --group web ;; esac
# Teardown
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
# Save test results
- store_test_results:
path: /tmp/circleci-test-results
# Save artifacts
- store_artifacts:
path: /tmp/circleci-artifacts
- store_artifacts:
path: /tmp/circleci-test-results
workflows:
version: 2
oldfashion:
jobs:
- build
newfashion:
jobs:
- aws-ecr/build_and_push_image:
account-url: AWS_ACCOUNT_URL
aws-access-key-id: AWS_ACCESS_KEY_ID
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
context: "AWS London"
create-repo: true
dockerfile: Dockerfile
#profile-name: myProfileName
region: AWS_DEFAULT_REGION
repo: "${AWS_RESOURCE_NAME_PREFIX}/phraseanet"
tag: "alpha-0.1"

2
.gitignore vendored
View File

@@ -69,3 +69,5 @@ grammar/jison-*
pimple.json
playbook.retry
npm-debug.log
/Phrasea_datas

View File

@@ -40,3 +40,4 @@ Phraseanet c/o Alchemy
75009 Paris - France
+33 1 53 20 43 80
info@alchemy.fr

97
Dockerfile Normal file
View File

@@ -0,0 +1,97 @@
FROM php:7.1-fpm-stretch as phraseanet_prod
RUN apt-get update \
&& apt-get install -y \
apt-transport-https \
ca-certificates \
gnupg2 \
&& apt-get update \
&& apt-get install -y --no-install-recommends zlib1g-dev \
git \
ghostscript \
gpac \
imagemagick \
libav-tools \
libfreetype6-dev \
libicu-dev \
libjpeg62-turbo-dev \
libmagickwand-dev \
libmcrypt-dev \
libpng-dev \
librabbitmq-dev \
libssl-dev \
libxslt-dev \
libzmq3-dev \
locales \
mcrypt \
supervisor \
swftools \
unoconv \
unzip \
xpdf \
&& update-locale "LANG=fr_FR.UTF-8 UTF-8" \
&& dpkg-reconfigure --frontend noninteractive locales \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-install zip exif iconv mbstring pcntl sockets xsl intl pdo_mysql gettext bcmath mcrypt \
&& pecl install redis amqp-1.9.3 zmq-beta imagick-beta \
&& docker-php-ext-enable redis amqp zmq imagick \
&& pecl clear-cache \
&& docker-php-source delete \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /var/log/supervisor
#&& chown -R app: /var/log/supervisor
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
&& php -r "unlink('composer-setup.php');"
# Node Installation (node + yarn)
# Reference :
# https://linuxize.com/post/how-to-install-node-js-on-ubuntu-18.04/
# https://yarnpkg.com/lang/en/docs/install/#debian-stable
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
&& apt install nodejs \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update && apt-get install -y --no-install-recommends yarn \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/
RUN mkdir /entrypoint /var/alchemy \
&& useradd -u 1000 app \
&& mkdir -p /home/app/.composer \
&& chown -R app: /home/app /var/alchemy
ADD ./docker/phraseanet/ /
WORKDIR /var/alchemy/
COPY config /var/alchemy/config
COPY grammar /var/alchemy/grammar
COPY lib /var/alchemy/lib
COPY resources /var/alchemy/resources
RUN ls -la
COPY templates-profiler /var/alchemy/templates-profiler
COPY templates /var/alchemy/templates
COPY tests /var/alchemy/tests
COPY tmp /var/alchemy/tmp
COPY www /var/alchemy/www
COPY composer.json /var/alchemy/
COPY composer.lock /var/alchemy/
COPY gulpfile.js /var/alchemy/
COPY Makefile /var/alchemy/
COPY package-lock.json /var/alchemy/
COPY package.json /var/alchemy/
COPY phpunit.xml.dist /var/alchemy/
COPY yarn.lock /var/alchemy/
RUN ls -la
RUN make install_composer
RUN make clean_assets
RUN make install_asset_dependencies
RUN make install_assets
CMD ["php-fpm"]

18
Dockerfile-debug Normal file
View File

@@ -0,0 +1,18 @@
ARG phraseanet
FROM $phraseanet
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
iproute2 \
&& rm -rf /var/lib/apt/lists/* \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& pecl clear-cache
ADD ./docker/phraseanet-debug/ /
RUN chmod +x /entrypoint.sh /usr/local/bin/docker-*
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]

7
Dockerfile-nginx Normal file
View File

@@ -0,0 +1,7 @@
FROM nginx:1.15
RUN useradd -u 1000 app
ADD ./docker/nginx/ /
COPY www /var/alchemy/Phraseanet/

View File

@@ -8,18 +8,15 @@ install_composer:
composer install --ignore-platform-reqs
install_asset_dependencies:
yarn upgrade
yarn install
./node_modules/.bin/gulp build
install_assets:
./node_modules/.bin/gulp install-assets
clean_assets:
rm -rf ./node_modules
rm -rf ./www/assets
rm -Rf ./cache/*
mkdir ./node_modules
touch ./node_modules/.gitkeep
config:
@php bin/console compile:configuration

View File

@@ -42,3 +42,4 @@ For development with Phraseanet API see https://docs.phraseanet.com/4.0/en/Devel
Phraseanet is licensed under GPL-v3 license.

6
Vagrantfile vendored
View File

@@ -35,7 +35,7 @@ else if which('ifconfig')
end
$php = [ "5.6", "7.0", "7.1", "7.2" ]
$phpVersion = ENV['phpversion'] ? ENV['phpversion'] : "5.6";
$phpVersion = ENV['phpversion'] ? ENV['phpversion'] : "7.0";
unless Vagrant.has_plugin?('vagrant-hostmanager')
raise "vagrant-hostmanager is not installed! Please run\n vagrant plugin install vagrant-hostmanager\n\n"
@@ -119,7 +119,9 @@ Vagrant.configure("2") do |config|
]
end
config.vm.box = "ubuntu/trusty64"
# Switch between Phraseanet box and native trusty64
config.vm.box = "alchemy/Phraseanet-vagrant-dev"
#config.vm.box = "ubuntu/trusty64"
config.ssh.forward_agent = true
config_net(config)

View File

@@ -78,7 +78,6 @@
"hoa/router": "~2.0",
"igorw/get-in": "~1.0",
"imagine/imagine": "0.6.x-dev",
"ircmaxell/random-lib": "~1.0",
"jms/serializer": "~0.10",
"jms/translation-bundle": "dev-rebase-2015-10-20",
"justinrainbow/json-schema": "2.0.3 as 1.6.1",
@@ -120,7 +119,8 @@
"alchemy/queue-bundle": "^0.1.5",
"google/recaptcha": "^1.1",
"facebook/graph-sdk": "^5.6",
"box/spout": "^2.7"
"box/spout": "^2.7",
"paragonie/random-lib": "^2.0"
},
"require-dev": {
"mikey179/vfsStream": "~1.5",

219
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "adf4074eb26ea80d414430d4f7b61311",
"content-hash": "7dd755dbcbdcf15e87b4e2e8967c1314",
"packages": [
{
"name": "alchemy-fr/tcpdf-clone",
@@ -131,16 +131,16 @@
},
{
"name": "alchemy/embed-bundle",
"version": "0.3.7",
"version": "0.3.8",
"source": {
"type": "git",
"url": "https://github.com/alchemy-fr/embed-bundle.git",
"reference": "ce7408c7a47387eed3df2a743577d6e0e25f991f"
"reference": "8a9699bc51e2b2997ccfd357bb2892f3702c33ef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/embed-bundle/zipball/ce7408c7a47387eed3df2a743577d6e0e25f991f",
"reference": "ce7408c7a47387eed3df2a743577d6e0e25f991f",
"url": "https://api.github.com/repos/alchemy-fr/embed-bundle/zipball/8a9699bc51e2b2997ccfd357bb2892f3702c33ef",
"reference": "8a9699bc51e2b2997ccfd357bb2892f3702c33ef",
"shasum": ""
},
"require-dev": {
@@ -178,10 +178,10 @@
],
"description": "Embed resources bundle",
"support": {
"source": "https://github.com/alchemy-fr/embed-bundle/tree/0.3.7",
"source": "https://github.com/alchemy-fr/embed-bundle/tree/0.3.8",
"issues": "https://github.com/alchemy-fr/embed-bundle/issues"
},
"time": "2017-05-30T13:18:21+00:00"
"time": "2019-01-11T10:35:41+00:00"
},
{
"name": "alchemy/geonames-api-consumer",
@@ -3742,61 +3742,6 @@
],
"time": "2014-11-20T16:49:30+00:00"
},
{
"name": "ircmaxell/random-lib",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/ircmaxell/RandomLib.git",
"reference": "e9e0204f40e49fa4419946c677eccd3fa25b8cf4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ircmaxell/RandomLib/zipball/e9e0204f40e49fa4419946c677eccd3fa25b8cf4",
"reference": "e9e0204f40e49fa4419946c677eccd3fa25b8cf4",
"shasum": ""
},
"require": {
"ircmaxell/security-lib": "^1.1",
"php": ">=5.3.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^1.11",
"mikey179/vfsstream": "^1.6",
"phpunit/phpunit": "^4.8|^5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"psr-0": {
"RandomLib": "lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anthony Ferrara",
"email": "ircmaxell@ircmaxell.com",
"homepage": "http://blog.ircmaxell.com"
}
],
"description": "A Library For Generating Secure Random Numbers",
"homepage": "https://github.com/ircmaxell/RandomLib",
"keywords": [
"cryptography",
"random",
"random-numbers",
"random-strings"
],
"time": "2016-09-07T15:52:06+00:00"
},
{
"name": "ircmaxell/security-lib",
"version": "v1.1.0",
@@ -4956,6 +4901,68 @@
],
"time": "2016-11-28T09:17:04+00:00"
},
{
"name": "paragonie/random-lib",
"version": "v2.0.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/RandomLib.git",
"reference": "b73a1cb8eae7a346824ccee42298046dedbf2415"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/RandomLib/zipball/b73a1cb8eae7a346824ccee42298046dedbf2415",
"reference": "b73a1cb8eae7a346824ccee42298046dedbf2415",
"shasum": ""
},
"require": {
"ircmaxell/security-lib": "^1.1",
"paragonie/random_compat": "^2",
"paragonie/sodium_compat": "^1.3",
"php": ">=5.3.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^1.11",
"mikey179/vfsstream": "^1.6",
"phpunit/phpunit": "^4.8 || >=5.0.0 <5.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"psr-0": {
"RandomLib": "lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anthony Ferrara",
"email": "ircmaxell@ircmaxell.com",
"homepage": "http://blog.ircmaxell.com"
},
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "A Library For Generating Secure Random Numbers",
"homepage": "https://github.com/ircmaxell/RandomLib",
"keywords": [
"cryptography",
"random",
"random-numbers",
"random-strings"
],
"time": "2017-10-06T23:34:21+00:00"
},
{
"name": "paragonie/random_compat",
"version": "v2.0.4",
@@ -5004,6 +5011,88 @@
],
"time": "2016-11-07T23:38:38+00:00"
},
{
"name": "paragonie/sodium_compat",
"version": "v1.9.1",
"source": {
"type": "git",
"url": "https://github.com/paragonie/sodium_compat.git",
"reference": "87125d5b265f98c4d1b8d83a1f0726607c229421"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/87125d5b265f98c4d1b8d83a1f0726607c229421",
"reference": "87125d5b265f98c4d1b8d83a1f0726607c229421",
"shasum": ""
},
"require": {
"paragonie/random_compat": ">=1",
"php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7|^8"
},
"require-dev": {
"phpunit/phpunit": "^3|^4|^5"
},
"suggest": {
"ext-libsodium": "PHP < 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security.",
"ext-sodium": "PHP >= 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security."
},
"type": "library",
"autoload": {
"files": [
"autoload.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"ISC"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com"
},
{
"name": "Frank Denis",
"email": "jedisct1@pureftpd.org"
}
],
"description": "Pure PHP implementation of libsodium; uses the PHP extension if it exists",
"keywords": [
"Authentication",
"BLAKE2b",
"ChaCha20",
"ChaCha20-Poly1305",
"Chapoly",
"Curve25519",
"Ed25519",
"EdDSA",
"Edwards-curve Digital Signature Algorithm",
"Elliptic Curve Diffie-Hellman",
"Poly1305",
"Pure-PHP cryptography",
"RFC 7748",
"RFC 8032",
"Salpoly",
"Salsa20",
"X25519",
"XChaCha20-Poly1305",
"XSalsa20-Poly1305",
"Xchacha20",
"Xsalsa20",
"aead",
"cryptography",
"ecdh",
"elliptic curve",
"elliptic curve cryptography",
"encryption",
"libsodium",
"php",
"public-key cryptography",
"secret-key cryptography",
"side-channel resistant"
],
"time": "2019-03-20T17:19:05+00:00"
},
{
"name": "php-ffmpeg/php-ffmpeg",
"version": "0.5.1",
@@ -5766,6 +5855,11 @@
{
"name": "roave/security-advisories",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/Roave/SecurityAdvisories.git",
"reference": "0698207bf8a9bed212fdde2d8c7cdc77085660c4"
},
"conflict": {
"adodb/adodb-php": "<5.20.6",
"amphp/artax": ">=2,<2.0.4|>0.7.1,<1.0.4",
@@ -8342,6 +8436,7 @@
"mock",
"xunit"
],
"abandoned": true,
"time": "2015-10-02T06:51:40+00:00"
},
{

View File

@@ -8,6 +8,7 @@ main:
key: ''
api_require_ssl: true
api_token_header: false
delete-account-require-email-confirmation: true
database:
host: 127.0.0.1
port: 3306
@@ -90,7 +91,9 @@ main:
client_secret: null
border-manager:
enabled: true
extension-mapping: { }
extension-mapping:
otc: application/vnd.oasis.opendocument.chart-template
ttc: application/x-font-ttf
checkers:
-
type: Checker\Sha256
@@ -283,3 +286,7 @@ workers:
user: guest
password: guest
vhost: /
user_account:
deleting_policies:
email_confirmation: true

View File

@@ -0,0 +1,84 @@
user app;
worker_processes auto;
error_log /var/log/ngnix_error.log info;
#error_log /dev/stdout info;
pid /var/run/nginx.pid;
#daemon off;
events {
worker_connections 1024;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_tokens off;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /dev/stdout main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
reset_timedout_connection on;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300;
resolver 127.0.0.11;
upstream backend {
server phraseanet:9000;
}
server {
listen 80;
server_name localhost;
error_log on;
access_log on;
root /var/alchemy/Phraseanet/www;
index index.php;
location /api {
rewrite ^(.*)$ /api.php/$1 last;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /index.php/$1 last;
}
# PHP scripts -> PHP-FPM server listening on 127.0.0.1:9000
location ~ ^/(index|index_dev|api)\.php(/|$) {
fastcgi_pass backend;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ ^/(status|ping)$ {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_pass backend;
}
}
}

View File

@@ -0,0 +1,9 @@
#!/bin/sh
set -e
if [ ! -z ${DOCKER_XDEBUG_ENABLED} ]; then
. usr-bin/docker-xdebug-enable
fi
exec "$@"

View File

@@ -0,0 +1,4 @@
#!/bin/sh
/sbin/ip route|awk '/default/ { print $3 }'
# TODO support MacOS & Windows host IP

View File

@@ -0,0 +1,5 @@
#!/bin/sh
unset HOST_IP
unset XDEBUG_CONFIG
unset XDEBUG_REMOTE_HOST

View File

@@ -0,0 +1,9 @@
#!/bin/sh
set -e
HOST_IP=$(docker-get-host-ip);
export HOST_IP
export XDEBUG_CONFIG="remote_enable=1 remote_host=${HOST_IP} idekey=PHPSTORM";
export XDEBUG_REMOTE_HOST="${HOST_IP}";

View File

@@ -0,0 +1,28 @@
[program:scheduler-phraseanet]
command=php /var/alchemy/Phraseanet/bin/console task-manager:scheduler:run ; the program (relative uses PATH, can take args)
stdout_logfile=/var/log/supervisor/scheduler-phraseanet.log ; stdout log path, NONE for none; default AUTO
stderr_logfile=/var/log/supervisor/scheduler-phraseanet_error.log ; stderr log path, NONE for none; default AUTO
process_name=%(program_name)s ; process_name expr (default %(program_name)s)
numprocs=1 ; number of processes copies to start (def 1)
directory=/tmp ; directory to cwd to before exec (def no cwd)
priority=999 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected)
startsecs=0 ; number of secs prog must stay running (def. 1)
startretries=3 ; max # of serial start failures (default 3)
exitcodes=0,2 ; 'expected' exit codes for process (default 0,2)
stopsignal=INT ; signal used to kill process (default TERM)
stopwaitsecs=20 ; max num secs to wait b4 SIGKILL (default 10)
stopasgroup=true ; send stop signal to the UNIX process group (default false)
killasgroup=true ; SIGKILL the UNIX process group (def false)
redirect_stderr=true ; redirect proc stderr to stdout (default false)
user=1000 ; setuid to this UNIX account to run the program
stdout_logfile_maxbytes=50MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
stdout_events_enabled=false ; emit events on stdout writes (default false)
stderr_logfile_maxbytes=10MB ; max # logfile bytes b4 rotation (default 50MB)
stderr_logfile_backups=10 ; # of stderr logfile backups (default 10)
stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
stderr_events_enabled=false ; emit events on stderr writes (default false)
environment=HOME=/var/alchemy/Phraseanet,USER=app,PATH="/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin" ; process environment additions (def no add)

View File

@@ -0,0 +1,380 @@
[www]
; Per pool prefix
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
; - 'chdir'
; - 'php_values'
; - 'php_admin_values'
; When not set, the global prefix (or NONE) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = app
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000
; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
;listen.backlog = 511
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
;listen.group = app
;listen.mode = 0660
; When POSIX Access Control Lists are supported you can set them using
; these options, value is a comma separated list of user/group names.
; When set, listen.owner and listen.group are ignored
;listen.acl_users =
;listen.acl_groups =
; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
;listen.allowed_clients = 127.0.0.1
; Specify the nice(2) priority to apply to the pool processes (only if set)
; The value can vary from -19 (highest priority) to 20 (lower priority)
; Note: - It will only work if the FPM master process is launched as root
; - The pool processes will inherit the master process priority
; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user
; or group is differrent than the master process user. It allows to create proce
ss
; core dump and ptrace the process for the pool user.
; Default Value: no
; process.dumpable = yes
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
; dynamic - the number of child processes are set dynamically based on the
; following directives. With this process management, there will be
; always at least 1 children.
; pm.max_children - the maximum number of children that can
; be alive at the same time.
; pm.start_servers - the number of children created on startup.
; pm.min_spare_servers - the minimum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is less than this
; of 'idle' processes is greater than this
; number then some children will be killed.
; ondemand - no children are created at startup. Children will be forked when
; new requests will connect. The following parameter are used:
; pm.max_children - the maximum number of children that
; can be alive at the same time.
; pm.process_idle_timeout - The number of seconds after which
; an idle process will be killed.
; Note: This value is mandatory.
pm = dynamic
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 2
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 1
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 3
; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s
;pm.process_idle_timeout = 10s;
; The number of requests each child process should execute before respawning.
;pm.max_requests = 500
; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. It shows the following informations:
; pool - the name of the pool;
; process manager - static, dynamic or ondemand;
; start time - the date and time FPM has started;
; start since - number of seconds since FPM has started;
; accepted conn - the number of request accepted by the pool;
; listen queue - the number of request in the queue of pending
; connections (see backlog in listen(2));
; max listen queue - the maximum number of requests in the queue
; of pending connections since FPM has started;
; listen queue len - the size of the socket queue of pending connections;
; idle processes - the number of idle processes;
; active processes - the number of active processes;
; total processes - the number of idle + active processes;
; max active processes - the maximum number of active processes since FPM
; has started;
; max children reached - number of times, the process limit has been reached,
; Example output:
; pool: www
; process manager: static
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 62636
; accepted conn: 190460
; listen queue: 0
; max listen queue: 1
; listen queue len: 42
; idle processes: 4
; active processes: 11
; total processes: 15
; max active processes: 12
; max children reached: 0
;
; By default the status page output is formatted as text/plain. Passing either
; 'html', 'xml' or 'json' in the query string will return the corresponding
; output syntax. Example:
; http://www.foo.bar/status
; http://www.foo.bar/status?json
; http://www.foo.bar/status?html
; query string will also return status for each pool process.
; Example:
; http://www.foo.bar/status?full
; http://www.foo.bar/status?json&full
; http://www.foo.bar/status?html&full
; http://www.foo.bar/status?xml&full
; The Full status returns for each process:
; pid - the PID of the process;
; state - the state of the process (Idle, Running, ...);
; start time - the date and time the process has started;
; start since - the number of seconds since the process has started;
; requests - the number of requests the process has served;
; request duration - the duration in µs of the requests;
; request method - the request method (GET, POST, ...);
; request URI - the request URI with the query string;
; content length - the content length of the request (only with POST);
; user - the user (PHP_AUTH_USER) (or '-' if not set);
; script - the main script called (or '-' if not set);
; last request cpu - the %cpu the last request consumed
; it's always 0 if the process is not in Idle state
; it's always 0 if the process is not in Idle state
; because memory calculation is done when the request
; processing has terminated;
; If the process is in Idle state, then informations are related to the
; last request the process has served. Otherwise informations are related to
; the current request being served.
; Example output:
; ************************
; pid: 31330
; state: Running
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 63087
; requests: 12808
; request duration: 1250261
; request method: GET
; request URI: /test_mem.php?N=10000
; content length: 0
; user: -
; script: /home/fat/web/docs/php/test_mem.php
; last request cpu: 0.00
; It's available in: /usr/local/share/php/fpm/status.html
;
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
;pm.status_path = /status
; The ping URI to call the monitoring page of FPM. If this value is not set, no
; URI will be recognized as a ping page. This could be used to test from outside
; that FPM is alive and responding, or to
; - create a graph of FPM availability (rrd or such);
; - remove a server from a group if it is not responding (load balancing);
; - trigger alerts for the operating team (24/7).
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
;ping.path = /ping
;ping.response = pong
; The access log file
; Default: not set
;access.log = log/$pool.access.log
; The access log format.
; The following syntax is allowed
; %%: the '%' character
; %C: %CPU used by the request
; it can accept the following format:
; - %{user}C for user CPU only
; - %{system}C for system CPU only
; - %{total}C for user + system CPU (default)
; %d: time taken to serve the request
; it can accept the following format:
; - %{seconds}d (default)
; - %{miliseconds}d
; - %{mili}d
; - %{microseconds}d
; variable. Some exemples:
; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
; %f: script filename
; %l: content-length of the request (for POST request only)
; %m: request method
; %M: peak of memory allocated by PHP
; it can accept the following format:
; - %{bytes}M (default)
; - %{kilobytes}M
; - %{kilo}M
; - %{megabytes}M
; - %{mega}M
; %n: pool name
; %o: output header
; it must be associated with embraces to specify the name of the header:
; - %{Content-Type}o
; - %{X-Powered-By}o
; - %{Transfert-Encoding}o
; - ....
; %Q: the '?' character if query string exists
; %r: the request URI (without the query string, see %q and %Q)
; %R: remote IP address
; %s: status (response code)
; %t: server time the request was received
; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default)
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
; %T: time the log has been written (the request has finished)
; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default)
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
; %u: remote user
;
; Default: "%R - %u %t \"%m %r\" %s"
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
; The log file for slow requests
; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_slowlog_timeout = 0
; Depth of slow log stack trace.
; Default Value: 20
;request_slowlog_trace_depth = 20
; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_terminate_timeout = 0
; Set open file descriptor rlimit.
; Default Value: system defined value
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0
; Chroot to this directory at the start. This value must be defined as an
; absolute path. When this value is not set, chroot is not used.
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
; of its subdirectories. If the pool prefix is not set, the global prefix
; will be used instead.
; Note: chrooting is a great security feature and should be used whenever
; possible. However, all PHP paths will be relative to the chroot
; (error_log, sessions.save_path, ...).
; Default Value: not set
;chroot =
; Chdir to this directory at the start.
; Note: relative path can be used.
; Default Value: current directory or / when chroot
;chdir = /var/www
; process time (several ms).
; Default Value: no
;catch_workers_output = yes
; Clear environment in FPM workers
; Prevents arbitrary environment variables from reaching FPM worker processes
; by clearing the environment in workers before env vars specified in this
; pool configuration are added.
; Setting to "no" will make all environment variables available to PHP code
; via getenv(), $_ENV and $_SERVER.
; Default Value: yes
;clear_env = no
; Limits the extensions of the main script FPM will allow to parse. This can
; prevent configuration mistakes on the web server side. You should only limit
; FPM to .php extensions to prevent malicious users to use other extensions to
; execute php code.
; Note: set an empty value to allow all extensions.
; Default Value: .php
;security.limit_extensions = .php .php3 .php4 .php5 .php7
; Default Value: clean env
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp
; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI:
; php_value/php_flag - you can set classic ini defines which can
; be overwritten from PHP call 'ini_set'.
; php_admin_value/php_admin_flag - these directives won't be overwritten by
; PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
; Defining 'extension' will load the corresponding shared extension from
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
; overwrite previously defined php.ini values, but will append the new value
; instead.
; be overwritten from PHP call 'ini_set'.
; php_admin_value/php_admin_flag - these directives won't be overwritten by
; PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
; Defining 'extension' will load the corresponding shared extension from
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
; overwrite previously defined php.ini values, but will append the new value
; instead.
; Note: path INI options can be relative and will be expanded with the prefix
; (pool, global or /usr/local)
; Default Value: nothing is defined by default except the values in php.ini and
; specified at startup with the -d argument
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
;php_flag[display_errors] = off
;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M
request_terminate_timeout=300s

View File

@@ -0,0 +1,24 @@
[global]
daemonize = no
error_log = /var/log/fpm-php.www.log
process.max = 128
[www]
listen = 0.0.0.0:9000
;listen = /sock/php-fpm.sock
user = app
group = app
pm = dynamic
pm.max_children = 9
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.max_requests = 1000
request_terminate_timeout=300s
pm.status_path = /status
ping.path = /ping

File diff suppressed because it is too large Load Diff

View File

@@ -84,6 +84,15 @@ class CollectionRepositoryRegistry
throw new \OutOfBoundsException('No repository available for given base [baseId: ' . $baseId . ' ].');
}
public function getBaseIdMap()
{
if ($this->baseIdMap === null) {
$this->loadBaseIdMap();
}
return $this->baseIdMap;
}
public function purgeRegistry()
{
$this->baseIdMap = null;

View File

@@ -319,7 +319,9 @@ class CollectionService
$result = $userQuery->on_base_ids([ $reference->getBaseId()] )
->who_have_right([\ACL::ORDER_MASTER])
->execute()->get_results();
->include_templates(true)
->execute()
->get_results();
/** @var ACLProvider $acl */
$acl = $this->app['acl'];

View File

@@ -50,6 +50,7 @@ class CollectionController extends Controller
$query = $this->createUserQuery();
$admins = $query->on_base_ids([$bas_id])
->who_have_right([\ACL::ORDER_MASTER])
->include_templates(true)
->execute()
->get_results();
}

View File

@@ -233,6 +233,7 @@ class UserController extends Controller
->who_have_right($have_right)
->who_have_not_right($have_not_right)
->on_base_ids($on_base)
->include_templates(true)
->execute()
->get_results();

View File

@@ -88,9 +88,10 @@ use Alchemy\Phrasea\Status\StatusStructure;
use Alchemy\Phrasea\TaskManager\LiveInformation;
use Alchemy\Phrasea\Utilities\NullableDateTime;
use Doctrine\ORM\EntityManager;
use JMS\TranslationBundle\Annotation\Ignore;
use Guzzle\Http\Client as Guzzle;
use League\Fractal\Resource\Item;
use media_subdef;
use Neutron\TemporaryFilesystem\TemporaryFilesystemInterface;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Request;
@@ -905,19 +906,6 @@ class V1Controller extends Controller
public function addRecordAction(Request $request)
{
if (count($request->files->get('file')) == 0) {
return $this->getBadRequestAction($request, 'Missing file parameter');
}
$file = $request->files->get('file');
if (!$file instanceof UploadedFile) {
return $this->getBadRequestAction($request, 'You can upload one file at time');
}
if (!$file->isValid()) {
return $this->getBadRequestAction($request, 'Data corrupted, please try again');
}
if (!$request->get('base_id')) {
return $this->getBadRequestAction($request, 'Missing base_id parameter');
}
@@ -930,16 +918,54 @@ class V1Controller extends Controller
))->createResponse();
}
// Add file extension
$uploadedFilename = $file->getRealPath();
if (count($request->files->get('file')) == 0) {
if(count($request->get('url')) == 0) {
return $this->getBadRequestAction($request, 'Missing file parameter');
}
else {
// upload via url
$url = $request->get('url');
$pi = pathinfo($url); // filename, extension
$renamedFilename = $file->getRealPath() . '.' . pathinfo($file->getClientOriginalName(), PATHINFO_EXTENSION);
/** @var TemporaryFilesystemInterface $tmpFs */
$tmpFs = $this->app['temporary-filesystem'];
$tempfile = $tmpFs->createTemporaryFile('download_', null, $pi['extension']);
$this->getFilesystem()->rename($uploadedFilename, $renamedFilename);
try {
$guzzle = new Guzzle($url);
$res = $guzzle->get("", [], ['save_to' => $tempfile])->send();
}
catch (\Exception $e) {
return $this->getBadRequestAction($request, sprintf('Error "%s" downloading "%s"', $e->getMessage(), $url));
}
$media = $this->app->getMediaFromUri($renamedFilename);
if($res->getStatusCode() !== 200) {
return $this->getBadRequestAction($request, sprintf('Error %s downloading "%s"', $res->getStatusCode(), $url));
}
$Package = new File($this->app, $media, $collection, $file->getClientOriginalName());
$originalName = $pi['filename'] . '.' . $pi['extension'];
$newPathname = $tempfile;
}
}
else {
// upload via file
$file = $request->files->get('file');
if (!$file instanceof UploadedFile) {
return $this->getBadRequestAction($request, 'You can upload one file at time');
}
if (!$file->isValid()) {
return $this->getBadRequestAction($request, 'Data corrupted, please try again');
}
$originalName = $file->getClientOriginalName();
$newPathname = $file->getPathname() . '.' . $file->getClientOriginalExtension();
if (false === rename($file->getPathname(), $newPathname)) {
return Result::createError($request, 403, 'Error while renaming file')->createResponse();
}
}
$media = $this->app->getMediaFromUri($newPathname);
$Package = new File($this->app, $media, $collection, $originalName);
if ($request->get('status')) {
$Package->addAttribute(new Status($this->app, $request->get('status')));

View File

@@ -161,7 +161,33 @@ class QueryController extends Controller
$result = $engine->query($query, $options);
if ($this->getSettings()->getUserSetting($user, 'start_page') === 'LAST_QUERY') {
$userManipulator->setUserSetting($user, 'start_page_query', $query);
// try to save the "fulltext" query which will be restored on next session
try {
// local code to find "FULLTEXT" value from jsonQuery
$findFulltext = function($clause) use(&$findFulltext) {
if(array_key_exists('_ux_zone', $clause) && $clause['_ux_zone']=='FULLTEXT') {
return $clause['value'];
}
if($clause['type']=='CLAUSES') {
foreach($clause['clauses'] as $c) {
if(($r = $findFulltext($c)) !== null) {
return $r;
}
}
}
return null;
};
$userManipulator->setUserSetting($user, 'last_jsonquery', (string)$request->request->get('jsQuery'));
$jsQuery = @json_decode((string)$request->request->get('jsQuery'), true);
if(($ft = $findFulltext($jsQuery['query'])) !== null) {
$userManipulator->setUserSetting($user, 'start_page_query', $ft);
}
}
catch(\Exception $e) {
// no-op
}
}
// log array of collectionIds (from $options) for each databox

View File

@@ -90,35 +90,44 @@ class RecordController extends Controller
}
$recordCaptions["technicalInfo"] = $record->getPositionFromTechnicalInfos();
// escape record title before rendering
$recordTitle = explode("</span>", $record->get_title());
if (count($recordTitle) >1) {
$recordTitle[1] = htmlspecialchars($recordTitle[1]);
$recordTitle = implode("</span>", $recordTitle);
} else {
$recordTitle = htmlspecialchars($record->get_title());
}
return $this->app->json([
"desc" => $this->render('prod/preview/caption.html.twig', [
"desc" => $this->render('prod/preview/caption.html.twig', [
'record' => $record,
'highlight' => $query,
'searchEngine' => $searchEngine,
'searchOptions' => $options,
]),
"recordCaptions"=> $recordCaptions,
"html_preview" => $this->render('common/preview.html.twig', [
"recordCaptions" => $recordCaptions,
"html_preview" => $this->render('common/preview.html.twig', [
'record' => $record
]),
"others" => $this->render('prod/preview/appears_in.html.twig', [
"others" => $this->render('prod/preview/appears_in.html.twig', [
'parents' => $record->get_grouping_parents(),
'baskets' => $record->get_container_baskets($this->getEntityManager(), $this->getAuthenticatedUser()),
]),
"current" => $train,
"record" => $currentRecord,
"history" => $this->render('prod/preview/short_history.html.twig', [
"current" => $train,
"record" => $currentRecord,
"history" => $this->render('prod/preview/short_history.html.twig', [
'record' => $record,
]),
"popularity" => $this->render('prod/preview/popularity.html.twig', [
"popularity" => $this->render('prod/preview/popularity.html.twig', [
'record' => $record,
]),
"tools" => $this->render('prod/preview/tools.html.twig', [
"tools" => $this->render('prod/preview/tools.html.twig', [
'record' => $record,
]),
"pos" => $record->getNumber(),
"title" => $record->get_title(),
"databox_name" => $record->getDatabox()->get_dbname(),
"pos" => $record->getNumber(),
"title" => $recordTitle,
"databox_name" => $record->getDatabox()->get_dbname(),
"collection_name" => $record->getCollection()->get_name(),
"collection_logo" => $record->getCollection()->getLogo($record->getBaseId(), $this->app),
]);

View File

@@ -26,6 +26,7 @@ use Alchemy\Phrasea\Model\Entities\LazaretFile;
use Alchemy\Phrasea\Model\Entities\LazaretSession;
use DataURI\Exception\Exception as DataUriException;
use DataURI\Parser;
use Guzzle\Http\Client as Guzzle;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -76,6 +77,30 @@ class UploadController extends Controller
]);
}
public function getHead(Request $request)
{
$response = [
'content-type' => null,
'content-length' => null,
'basename' => null
];
try {
$url = $request->get('url');
$basename = pathinfo($url, PATHINFO_BASENAME);
$guzzle = new Guzzle($url);
$res = $guzzle->head("")->send();
$response['content-type'] = $res->getContentType();
$response['content-length'] = $res->getContentLength();
$response['basename'] = $basename;
}
catch (\Exception $e) {
// no-op : head will return no info but will not crash
}
return $this->app->json($response);
}
/**
* Upload processus
*
@@ -98,7 +123,7 @@ class UploadController extends Controller
'message' => '',
'element' => '',
'reasons' => [],
'id' => '',
'id' => '',
];
if (null === $request->files->get('files')) {
@@ -119,18 +144,44 @@ class UploadController extends Controller
throw new AccessDeniedHttpException('User is not allowed to add record on this collection');
}
/** @var UploadedFile $file */
$file = current($request->files->get('files'));
if (!$file->isValid()) {
throw new BadRequestHttpException('Uploaded file is invalid');
}
try {
if ($file->getClientOriginalName() === "blob" && $file->getClientMimeType() === "application/json") {
// a "upload by url" was done, we receive a tiny json that contains url.
$json = json_decode(file_get_contents($file->getRealPath()), true);
$url = $json['url'];
$pi = pathinfo($url); // filename, extension
$tempfile = $this->getTemporaryFilesystem()->createTemporaryFile('download_', null, $pi['extension']);
try {
$guzzle = new Guzzle($url);
$res = $guzzle->get("", [], ['save_to' => $tempfile])->send();
}
catch (\Exception $e) {
throw new BadRequestHttpException(sprintf('Error "%s" downloading "%s"', $e->getMessage(), $url));
}
if($res->getStatusCode() !== 200) {
throw new BadRequestHttpException(sprintf('Error %s downloading "%s"', $res->getStatusCode(), $url));
}
$uploadedFilename = $renamedFilename = $tempfile;
$originalName = $pi['filename'] . '.' . $pi['extension'];
} else {
// Add file extension, so mediavorus can guess file type for octet-stream file
$uploadedFilename = $file->getRealPath();
$renamedFilename = null;
if(!empty($this->app['conf']->get(['main', 'storage', 'tmp_files']))){
if(!empty($this->app['conf']->get(['main', 'storage', 'tmp_files']))) {
$tmpStorage = \p4string::addEndSlash($this->app['conf']->get(['main', 'storage', 'tmp_files'])).'upload/';
if(!is_dir($tmpStorage)){
@@ -139,12 +190,16 @@ class UploadController extends Controller
$renamedFilename = $tmpStorage. pathinfo($file->getRealPath(), PATHINFO_FILENAME) .'.' . pathinfo($file->getClientOriginalName(), PATHINFO_EXTENSION);
}else{
} else {
$renamedFilename = $file->getRealPath() . '.' . pathinfo($file->getClientOriginalName(), PATHINFO_EXTENSION);
}
$this->getFilesystem()->rename($uploadedFilename, $renamedFilename);
$originalName = $file->getClientOriginalName();
}
try {
$media = $this->app->getMediaFromUri($renamedFilename);
$collection = \collection::getByBaseId($this->app, $base_id);
@@ -153,7 +208,7 @@ class UploadController extends Controller
$this->getEntityManager()->persist($lazaretSession);
$packageFile = new File($this->app, $media, $collection, $file->getClientOriginalName());
$packageFile = new File($this->app, $media, $collection, $originalName);
$postStatus = $request->request->get('status');
@@ -184,7 +239,9 @@ class UploadController extends Controller
$code = $this->getBorderManager()->process( $lazaretSession, $packageFile, $callback, $forceBehavior);
$this->getFilesystem()->rename($renamedFilename, $uploadedFilename);
if($renamedFilename !== $uploadedFilename) {
$this->getFilesystem()->rename($renamedFilename, $uploadedFilename);
}
if (!!$forceBehavior) {
$reasons = [];

View File

@@ -17,20 +17,27 @@ use Alchemy\Phrasea\Application\Helper\EntityManagerAware;
use Alchemy\Phrasea\Application\Helper\NotifierAware;
use Alchemy\Phrasea\Authentication\Phrasea\PasswordEncoder;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\ControllerProvider\Root\Login;
use Alchemy\Phrasea\Core\Configuration\RegistrationManager;
use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Alchemy\Phrasea\Form\Login\PhraseaRenewPasswordForm;
use Alchemy\Phrasea\Model\Entities\ApiApplication;
use Alchemy\Phrasea\Model\Entities\FtpCredential;
use Alchemy\Phrasea\Model\Entities\Session;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\Manipulator\ApiAccountManipulator;
use Alchemy\Phrasea\Model\Manipulator\ApiApplicationManipulator;
use Alchemy\Phrasea\Model\Manipulator\BasketManipulator;
use Alchemy\Phrasea\Model\Manipulator\TokenManipulator;
use Alchemy\Phrasea\Model\Manipulator\UserManipulator;
use Alchemy\Phrasea\Model\Repositories\ApiAccountRepository;
use Alchemy\Phrasea\Model\Repositories\ApiApplicationRepository;
use Alchemy\Phrasea\Model\Repositories\BasketRepository;
use Alchemy\Phrasea\Model\Repositories\FeedPublisherRepository;
use Alchemy\Phrasea\Model\Repositories\TokenRepository;
use Alchemy\Phrasea\Model\Repositories\ValidationSessionRepository;
use Alchemy\Phrasea\Notification\Mail\MailRequestAccountDelete;
use Alchemy\Phrasea\Notification\Mail\MailRequestEmailUpdate;
use Alchemy\Phrasea\Notification\Mail\MailSuccessAccountDelete;
use Alchemy\Phrasea\Notification\Receiver;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -299,13 +306,102 @@ class AccountController extends Controller
$manager = $this->getEventManager();
$user = $this->getAuthenticatedUser();
$repo_baskets = $this->getBasketRepository();
$baskets = $repo_baskets->findActiveValidationAndBasketByUser($user);
$apiAccounts = $this->getApiAccountRepository()->findByUser($user);
$ownedFeeds = $this->getFeedPublisherRepository()->findBy(['user' => $user, 'owner' => true]);
$initiatedValidations = $this->getValidationSessionRepository()->findby(['initiator' => $user, ]);
return $this->render('account/account.html.twig', [
'user' => $user,
'evt_mngr' => $manager,
'notifications' => $manager->list_notifications_available($user),
'user' => $user,
'evt_mngr' => $manager,
'notifications' => $manager->list_notifications_available($user),
'baskets' => $baskets,
'api_accounts' => $apiAccounts,
'owned_feeds' => $ownedFeeds,
'initiated_validations' => $initiatedValidations,
]);
}
/**
* @param Request $request
* @return RedirectResponse
*/
public function processDeleteAccount(Request $request)
{
$user = $this->getAuthenticatedUser();
if($this->app['conf']->get(['user_account', 'deleting_policies', 'email_confirmation'])) {
// send email confirmation
try {
$receiver = Receiver::fromUser($user);
} catch (InvalidArgumentException $e) {
$this->app->addFlash('error', $this->app->trans('phraseanet::erreur: echec du serveur de mail'));
return $this->app->redirectPath('account');
}
$token = $this->getTokenManipulator()->createAccountDeleteToken($user, $user->getEmail());
$url = $this->app->url('account_confirm_delete', ['token' => $token->getValue()]);
$mail = MailRequestAccountDelete::create($this->app, $receiver);
$mail->setUserOwner($user);
$mail->setButtonUrl($url);
$mail->setExpiration($token->getExpiration());
$this->deliver($mail);
$this->app->addFlash('info', $this->app->trans('phraseanet::account: A confirmation e-mail has been sent. Please follow the instructions contained to continue account deletion'));
return $this->app->redirectPath('account');
} else {
$this->doDeleteAccount($user);
$response = $this->app->redirectPath('homepage', [
'redirect' => $request->query->get("redirect")
]);
$response->headers->clearCookie('persistent');
$response->headers->clearCookie('last_act');
return $response;
}
}
public function confirmDeleteAccount(Request $request)
{
if (($tokenValue = $request->query->get('token')) !== null ) {
if (null === $token = $this->getTokenRepository()->findValidToken($tokenValue)) {
$this->app->addFlash('error', $this->app->trans('Token not found'));
return $this->app->redirectPath('account');
}
$user = $token->getUser();
// delete account and datas
$this->doDeleteAccount($user);
$this->getTokenManipulator()->delete($token);
}
$response = $this->app->redirectPath('homepage', [
'redirect' => $request->query->get("redirect")
]);
$response->headers->clearCookie('persistent');
$response->headers->clearCookie('last_act');
return $response;
}
/**
* Update account information
*
@@ -406,6 +502,49 @@ class AccountController extends Controller
return $this->app->redirectPath('account');
}
/**
* @param User $user
*/
private function doDeleteAccount(User $user)
{
// basket
$repo_baskets = $this->getBasketRepository();
$baskets = $repo_baskets->findActiveByUser($user);
$this->getBasketManipulator()->removeBaskets($baskets);
// application
$applications = $this->getApiApplicationRepository()->findByUser($user);
$this->getApiApplicationManipulator()->deleteApiApplications($applications);
// revoke access and delete phraseanet user account
$list = array_keys($this->app['repo.collections-registry']->getBaseIdMap());
$this->app->getAclForUser($user)->revoke_access_from_bases($list);
if ($this->app->getAclForUser($user)->is_phantom()) {
// send confirmation email: the account has been deleted
try {
$receiver = Receiver::fromUser($user);
} catch (InvalidArgumentException $e) {
$this->app->addFlash('error', $this->app->trans('phraseanet::erreur: echec du serveur de mail'));
}
$mail = MailSuccessAccountDelete::create($this->app, $receiver);
$this->app['manipulator.user']->delete($user);
$this->deliver($mail);
}
$this->getAuthenticator()->closeAccount();
$this->app->addFlash('info', $this->app->trans('phraseanet::account The account has been deleted'));
}
/**
* @return PasswordEncoder
*/
@@ -501,4 +640,44 @@ class AccountController extends Controller
{
return $this->app['events-manager'];
}
/**
* @return BasketManipulator
*/
private function getBasketManipulator()
{
return $this->app['manipulator.basket'];
}
/**
* @return BasketRepository
*/
private function getBasketRepository()
{
return $this->app['repo.baskets'];
}
/**
* @return ApiApplicationManipulator
*/
private function getApiApplicationManipulator()
{
return $this->app['manipulator.api-application'];
}
/**
* @return FeedPublisherRepository
*/
private function getFeedPublisherRepository()
{
return $this->app['repo.feed-publishers'];
}
/**
* @return ValidationSessionRepository
*/
private function getValidationSessionRepository()
{
return $this->app['repo.validation-session'];
}
}

View File

@@ -806,7 +806,7 @@ class ThesaurusController extends Controller
if (!$t) {
$t = "...";
}
$fullBranch = " / " . $t . $fullBranch;
$fullBranch = " / " . htmlspecialchars($t) . $fullBranch;
}
}
$nodes = $xpathstruct->query("/record/description/*");
@@ -1159,7 +1159,7 @@ class ThesaurusController extends Controller
'1',
null
);
$fullpath = $dom->getElementsByTagName("fullpath_html")->item(0)->firstChild->nodeValue;
$fullpathHtml = $dom->getElementsByTagName("fullpath_html")->item(0)->firstChild->nodeValue;
$hits = $dom->getElementsByTagName("allhits")->item(0)->firstChild->nodeValue;
$languages = $synonyms = [];
@@ -1180,6 +1180,16 @@ class ThesaurusController extends Controller
$languages[$lng_code[0]] = $language;
}
// Escape path between span tag in fullpath_html
preg_match_all("'(<[^><]*>)(.*?)(<[^><]*>)'", $fullpathHtml, $matches, PREG_SET_ORDER);
$safeFullpath = '';
foreach($matches as $match) {
unset($match[0]); // full match result not used
$match[2] = htmlspecialchars($match[2]);
$safeFullpath .= implode('', $match);
}
return $this->render('thesaurus/properties.html.twig', [
'typ' => $request->get('typ'),
'bid' => $request->get('bid'),
@@ -1187,7 +1197,7 @@ class ThesaurusController extends Controller
'id' => $request->get('id'),
'dlg' => $request->get('dlg'),
'languages' => $languages,
'fullpath' => $fullpath,
'fullpath' => $safeFullpath,
'hits' => $hits,
'synonyms' => $synonyms,
]);

View File

@@ -66,6 +66,9 @@ class Upload implements ControllerProviderInterface, ServiceProviderInterface
$controllers->get('/html5-version/', 'controller.prod.upload:getHtml5UploadForm')
->bind('upload_html5_form');
$controllers->get('/head/', 'controller.prod.upload:getHead')
->bind('upload_head');
$controllers->post('/', 'controller.prod.upload:upload')
->bind('upload');

View File

@@ -52,6 +52,14 @@ class Account implements ControllerProviderInterface, ServiceProviderInterface
$controllers->get('/', 'account.controller:displayAccount')
->bind('account');
// allow to delete phraseanet account
$controllers->get('/delete/process', 'account.controller:processDeleteAccount')
->bind('account_process_delete');
$controllers->get('/delete/confirm', 'account.controller:confirmDeleteAccount')
->bind('account_confirm_delete');
// Updates current logged in user account
$controllers->post('/', 'account.controller:updateAccount')
->bind('submit_update_account');

View File

@@ -66,6 +66,9 @@ class RepositoriesServiceProvider implements ServiceProviderInterface
$app['repo.validation-participants'] = $app->share(function (PhraseaApplication $app) {
return $app['orm.em']->getRepository('Phraseanet:ValidationParticipant');
});
$app['repo.validation-session'] = $app->share(function (PhraseaApplication $app) {
return $app['orm.em']->getRepository('Phraseanet:ValidationSession');
});
$app['repo.story-wz'] = $app->share(function (PhraseaApplication $app) {
return $app['orm.em']->getRepository('Phraseanet:StoryWZ');
});

View File

@@ -18,7 +18,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @ORM\Table(name="ValidationSessions")
* @ORM\Entity
* @ORM\Entity(repositoryClass="Alchemy\Phrasea\Model\Repositories\ValidationSessionRepository")
*/
class ValidationSession
{

View File

@@ -57,6 +57,14 @@ class ApiApplicationManipulator implements ManipulatorInterface
$this->om->flush();
}
public function deleteApiApplications(array $applications)
{
foreach ($applications as $application) {
$this->om->remove($application);
}
$this->om->flush();
}
public function update(ApiApplication $application)
{
$this->om->persist($application);

View File

@@ -118,4 +118,12 @@ class BasketManipulator
$this->manager->remove($basket);
$this->manager->flush();
}
public function removeBaskets(array $baskets)
{
foreach ($baskets as $basket) {
$this->manager->remove($basket);
}
$this->manager->flush();
}
}

View File

@@ -26,6 +26,7 @@ class TokenManipulator implements ManipulatorInterface
const TYPE_FEED_ENTRY = 'FEED_ENTRY';
const TYPE_PASSWORD = 'password';
const TYPE_ACCOUNT_UNLOCK = 'account-unlock';
const TYPE_ACCOUNT_DELETE = 'account-delete';
const TYPE_DOWNLOAD = 'download';
const TYPE_MAIL_DOWNLOAD = 'mail-download';
const TYPE_EMAIL = 'email';
@@ -167,6 +168,16 @@ class TokenManipulator implements ManipulatorInterface
return $this->create($user, self::TYPE_ACCOUNT_UNLOCK, new \DateTime('+3 days'));
}
/**
* @param User $user
*
* @return Token
*/
public function createAccountDeleteToken(User $user, $email)
{
return $this->create($user, self::TYPE_ACCOUNT_DELETE, new \DateTime('+1 hour'), $email);
}
/**
* @param User $user
*

View File

@@ -0,0 +1,24 @@
<?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\Model\Repositories;
use Doctrine\ORM\EntityRepository;
/**
* ValidationSessionRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class ValidationSessionRepository extends EntityRepository
{
}

View File

@@ -17,6 +17,8 @@ use Alchemy\Phrasea\Notification\ReceiverInterface;
abstract class AbstractMail implements MailInterface
{
const MAIL_SKIN = 'default';
/** @var Application */
protected $app;
/** @var EmitterInterface */
@@ -59,6 +61,7 @@ abstract class AbstractMail implements MailInterface
'expiration' => $this->getExpiration(),
'buttonUrl' => $this->getButtonURL(),
'buttonText' => $this->getButtonText(),
'mailSkin' => $this->getMailSkin(),
]);
}
@@ -166,6 +169,14 @@ abstract class AbstractMail implements MailInterface
$this->url = $url;
}
/**
* @return string
*/
public function getMailSkin()
{
return self::MAIL_SKIN;
}
/**
* {@inheritdoc}
*/

View File

@@ -0,0 +1,105 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Notification\Mail;
use Alchemy\Phrasea\Exception\LogicException;
use Alchemy\Phrasea\Model\Entities\User;
class MailRequestAccountDelete extends AbstractMailWithLink
{
const MAIL_SKIN = 'warning';
/** @var User */
private $user;
/**
* Set the user owner
*
* @param User $userOwner
*/
public function setUserOwner(User $userOwner)
{
$this->user = $userOwner;
}
/**
* {@inheritdoc}
*/
public function getSubject()
{
return $this->app->trans('Email:deletion:request:subject Delete account confirmation');
}
/**
* {@inheritdoc}
*/
public function getMessage()
{
if (!$this->user) {
throw new LogicException('You must set a user before calling getMessage');
}
return $this->app->trans("Email:deletion:request:message Hello %civility% %firstName% %lastName%.
We have received an account deletion request for your account on %urlInstance%, please confirm this deletion by clicking on the link below.
If you are not at the origin of this request, please change your password as soon as possible %resetPassword%
Link is valid for one hour.", [
'%civility%' => $this->getOwnerCivility(),
'%firstName%'=> $this->user->getFirstName(),
'%lastName%' => $this->user->getLastName(),
'%urlInstance%' => '<a href="'.$this->getPhraseanetURL().'">'.$this->getPhraseanetURL().'</a>',
'%resetPassword%' => '<a href="'.$this->app->url('reset_password').'">'.$this->app->url('reset_password').'</a>',
]);
}
/**
* {@inheritdoc}
*/
public function getButtonText()
{
return $this->app->trans('Email:deletion:request:textButton Delete my account');
}
/**
* {@inheritdoc}
*/
public function getButtonURL()
{
return $this->url;
}
/**
* {@inheritdoc}
*/
public function getMailSkin()
{
return self::MAIL_SKIN;
}
private function getOwnerCivility()
{
if (!$this->user) {
throw new LogicException('You must set a user before calling getMessage');
}
$civilities = [
User::GENDER_MISS => 'Miss',
User::GENDER_MRS => 'Mrs',
User::GENDER_MR => 'Mr',
];
if (array_key_exists($this->user->getGender(), $civilities)) {
return $civilities[$this->user->getGender()];
} else {
return '';
}
}
}

View File

@@ -0,0 +1,45 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Notification\Mail;
class MailSuccessAccountDelete extends AbstractMail
{
/**
* {@inheritdoc}
*/
public function getSubject()
{
return $this->app->trans('Delete account successfull');
}
/**
* {@inheritdoc}
*/
public function getMessage()
{
return $this->app->trans('Your phraseanet account on %urlInstance% has been deleted!', ['%urlInstance%' => '<a href="'.$this->getPhraseanetURL().'">'.$this->getPhraseanetURL().'</a>']);
}
/**
* {@inheritdoc}
*/
public function getButtonText()
{
}
/**
* {@inheritdoc}
*/
public function getButtonURL()
{
}
}

View File

@@ -43,7 +43,7 @@ class QuotedTextNode extends Node
$private_fields = $context->getPrivateFields();
$private_fields = ValueChecker::filterByValueCompatibility($private_fields, $this->text);
foreach (QueryHelper::wrapPrivateFieldQueries($private_fields, $query_builder) as $private_field_query) {
foreach (QueryHelper::wrapPrivateFieldQueries($private_fields, $unrestricted_fields, $query_builder) as $private_field_query) {
$query = QueryHelper::applyBooleanClause($query, 'should', $private_field_query);
}

View File

@@ -61,7 +61,7 @@ class RawNode extends Node
$private_fields = $context->getPrivateFields();
$private_fields = ValueChecker::filterByValueCompatibility($private_fields, $this->text);
foreach (QueryHelper::wrapPrivateFieldQueries($private_fields, $query_builder) as $private_field_query) {
foreach (QueryHelper::wrapPrivateFieldQueries($private_fields, $unrestricted_fields, $query_builder) as $private_field_query) {
$query = QueryHelper::applyBooleanClause($query, 'should', $private_field_query);
}

View File

@@ -19,9 +19,11 @@ class TermNode extends AbstractTermNode
return $query;
};
$query = $query_builder($context->getUnrestrictedFields());
$unrestricted_fields = $context->getUnrestrictedFields();
$private_fields = $context->getPrivateFields();
foreach (QueryHelper::wrapPrivateFieldQueries($private_fields, $query_builder) as $concept_query) {
$query = $query_builder($unrestricted_fields);
foreach (QueryHelper::wrapPrivateFieldQueries($private_fields, $unrestricted_fields, $query_builder) as $concept_query) {
$query = QueryHelper::applyBooleanClause($query, 'should', $concept_query);
}

View File

@@ -66,12 +66,11 @@ class TextNode extends AbstractTermNode implements ContextAbleInterface
return $query;
};
// Unrestricted fields
$query = $query_builder($context->getUnrestrictedFields());
// Private fields
$unrestricted_fields = $context->getUnrestrictedFields();
$private_fields = $context->getPrivateFields();
foreach (QueryHelper::wrapPrivateFieldQueries($private_fields, $query_builder) as $private_field_query) {
$query = $query_builder($unrestricted_fields);
foreach (QueryHelper::wrapPrivateFieldQueries($private_fields, $unrestricted_fields, $query_builder) as $private_field_query) {
$query = QueryHelper::applyBooleanClause($query, 'should', $private_field_query);
}

View File

@@ -619,6 +619,8 @@ class ElasticSearchEngine implements SearchEngineInterface
foreach ($context->getHighlightedFields() as $field) {
switch ($field->getType()) {
case FieldMapping::TYPE_STRING:
case FieldMapping::TYPE_DOUBLE:
case FieldMapping::TYPE_DATE:
$index_field = $field->getIndexField();
$raw_index_field = $field->getIndexField(true);
$highlighted_fields[$index_field . ".light"] = [
@@ -628,13 +630,10 @@ class ElasticSearchEngine implements SearchEngineInterface
];
break;
case FieldMapping::TYPE_FLOAT:
case FieldMapping::TYPE_DOUBLE:
case FieldMapping::TYPE_INTEGER:
case FieldMapping::TYPE_LONG:
case FieldMapping::TYPE_SHORT:
case FieldMapping::TYPE_BYTE:
continue;
case FieldMapping::TYPE_DATE:
default:
continue;
}

View File

@@ -127,20 +127,21 @@ class Fetcher
private function getExecutedStatement()
{
if (!$this->statement) {
$sql = "SELECT r.record_id"
. ", r.coll_id AS collection_id"
. ", c.asciiname AS collection_name"
. ", r.uuid"
. ", r.status AS flags_bitfield"
. ", r.sha256" // -- TODO rename in "hash"
. ", r.originalname AS original_name"
. ", r.mime, r.type, r.parent_record_id, r.credate AS created_on, r.moddate AS updated_on"
. ", subdef.width, subdef.height, subdef.size"
. " FROM (record r INNER JOIN coll c ON (c.coll_id = r.coll_id))"
. " LEFT JOIN subdef ON subdef.record_id=r.record_id AND subdef.name='document'"
. " -- WHERE"
. " ORDER BY " . $this->options->getPopulateOrderAsSQL() . " " . $this->options->getPopulateDirectionAsSQL()
. " LIMIT :offset, :limit";
$sql = "SELECT r.*, c.asciiname AS collection_name, subdef.width, subdef.height, subdef.size\n"
. " FROM ((\n"
. " SELECT r.record_id, r.coll_id AS collection_id, r.uuid, r.status AS flags_bitfield, r.sha256,\n"
. " r.originalname AS original_name, r.mime, r.type, r.parent_record_id,\n"
. " r.credate AS created_on, r.moddate AS updated_on, r.coll_id\n"
. " FROM record r\n"
. " -- WHERE\n"
. " ORDER BY " . $this->options->getPopulateOrderAsSQL() . " " . $this->options->getPopulateDirectionAsSQL() . "\n"
. " LIMIT :offset, :limit\n"
. " ) AS r\n"
. " INNER JOIN coll c ON (c.coll_id = r.coll_id)\n"
. " )\n"
. " LEFT JOIN\n"
. " subdef ON subdef.record_id=r.record_id AND subdef.name='document'\n"
. " ORDER BY " . $this->options->getPopulateOrderAsSQL() . " " . $this->options->getPopulateDirectionAsSQL() . "";
$where = $this->delegate->buildWhereClause();
$sql = str_replace('-- WHERE', $where, $sql);

View File

@@ -0,0 +1,75 @@
<?php
/*
* This file is part of phrasea-4.0.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\SearchEngine\Elastic\Mapping;
class DoubleFieldMapping extends ComplexFieldMapping
{
/**
* @var bool
*/
private $enableAnalysis = true;
/**
* @var string|null
*/
private $analyzer = null;
/**
* @var string|null
*/
private $termVector = null;
/**
* @param string $name
*/
public function __construct($name)
{
parent::__construct($name, self::TYPE_DOUBLE);
}
public function disableAnalysis()
{
$this->enableAnalysis = false;
return $this;
}
public function enableAnalysis()
{
$this->enableAnalysis = true;
return $this;
}
/**
* @return array
*/
protected function getProperties()
{
$properties = [];
if ($this->analyzer) {
$properties['analyzer'] = $this->analyzer;
}
if (! $this->enableAnalysis) {
$properties['index'] = 'not_analyzed';
}
if ($this->termVector) {
$properties['term_vector'] = $this->termVector;
}
return array_replace(parent::getProperties(), $properties);
}
}

View File

@@ -19,28 +19,55 @@ class FieldToFieldMappingConverter
public function convertField(Field $field, array $locales)
{
if ($field->getType() === FieldMapping::TYPE_DATE) {
return new DateFieldMapping($field->getName(), FieldMapping::DATE_FORMAT_CAPTION);
$ret = null;
switch($field->getType()) {
case FieldMapping::TYPE_DATE:
$ret = new DateFieldMapping($field->getName(), FieldMapping::DATE_FORMAT_MYSQL_OR_CAPTION);
if (! $field->isFacet() && ! $field->isSearchable()) {
$ret->disableIndexing();
}
else {
$ret->addChild(
(new StringFieldMapping('light'))
->setAnalyzer('general_light')
->enableTermVectors()
);
}
break;
case FieldMapping::TYPE_STRING:
$ret = new StringFieldMapping($field->getName());
if (! $field->isFacet() && ! $field->isSearchable()) {
$ret->disableIndexing();
}
else {
$ret->addChild(
(new StringFieldMapping('raw'))
->enableRawIndexing());
$ret->addAnalyzedChildren($locales);
$ret->enableTermVectors(true);
}
break;
case FieldMapping::TYPE_DOUBLE:
$ret = new DoubleFieldMapping($field->getName());
if (! $field->isFacet() && ! $field->isSearchable()) {
$ret->disableIndexing();
}
else {
$ret->addChild(
(new StringFieldMapping('light'))
->setAnalyzer('general_light')
->enableTermVectors()
);
}
break;
default:
$ret = new FieldMapping($field->getName(), $field->getType());
break;
}
if ($field->getType() === FieldMapping::TYPE_STRING) {
$fieldMapping = new StringFieldMapping($field->getName());
if (! $field->isFacet() && ! $field->isSearchable()) {
$fieldMapping->disableIndexing();
} else {
$fieldMapping->addChild((new StringFieldMapping('raw'))->enableRawIndexing());
$child = new CompletionFieldMapping('suggest');
$fieldMapping->addChild($child);
$fieldMapping->addAnalyzedChildren($locales);
$fieldMapping->enableTermVectors(true);
}
return $fieldMapping;
}
return new FieldMapping($field->getName(), $field->getType());
return $ret;
}
}

View File

@@ -107,13 +107,28 @@ class QueryContext
*/
public function localizeField(Field $field)
{
$ret = null;
$index_field = $field->getIndexField();
if ($field->getType() === FieldMapping::TYPE_STRING) {
return $this->localizeFieldName($index_field);
} else {
return [$index_field];
switch($field->getType()) {
case FieldMapping::TYPE_STRING:
$ret = $this->localizeFieldName($index_field);
break;
case FieldMapping::TYPE_DATE:
case FieldMapping::TYPE_DOUBLE:
$ret = [
$index_field . '.light',
$index_field
];
break;
default:
$ret = [$index_field];
break;
}
return $ret;
}
private function localizeFieldName($field)

View File

@@ -10,13 +10,13 @@ class QueryHelper
{
private function __construct() {}
public static function wrapPrivateFieldQueries(array $fields, \Closure $query_builder)
public static function wrapPrivateFieldQueries(array $private_fields, array $unrestricted_fields, \Closure $query_builder)
{
// We make a boolean clause for each collection set to shrink query size
// (instead of a clause for each field, with his collection set)
$fields_map = [];
$collections_map = [];
foreach ($fields as $field) {
foreach ($private_fields as $field) {
$collections = $field->getDependantCollections();
$hash = self::hashCollections($collections);
$collections_map[$hash] = $collections;
@@ -31,7 +31,7 @@ class QueryHelper
foreach ($fields_map as $hash => $fields) {
// Right to query on a private field is dependant of document collection
// Here we make sure we can only match on allowed collections
$query = $query_builder($fields);
$query = $query_builder(array_merge($fields, $unrestricted_fields));
if ($query !== null) {
$queries[] = self::restrictQueryToCollections($query, $collections_map[$hash]);
}

View File

@@ -30,14 +30,14 @@ class ValueChecker
case FieldMapping::TYPE_LONG:
case FieldMapping::TYPE_SHORT:
case FieldMapping::TYPE_BYTE:
if ($is_numeric) {
// if ($is_numeric) {
$filtered[] = $item;
}
// }
break;
case FieldMapping::TYPE_DATE:
if ($is_valid_date) {
// if ($is_valid_date) {
$filtered[] = $item;
}
// }
break;
case FieldMapping::TYPE_STRING:
default:

View File

@@ -88,7 +88,7 @@ class PhraseanetExtension extends \Twig_Extension
$highlightValue = $highlights[$field];
// if field is multivalued, merge highlighted values with captions ones
if (is_array($value)) {
if (is_array($value) && count($value) > 1) {
$highlightValue = array_merge($highlightValue, array_diff($value, array_map(function($value) {
return str_replace(array('[[em]]', '[[/em]]'), array('', ''), $value);
}, $highlightValue)));

View File

@@ -89,6 +89,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
const TYPE_AUDIO_MP3 = 'AUDIO_MP3';
const TYPE_IMAGE = 'IMAGE';
const TYPE_NO_PLAYER = 'UNKNOWN';
const TYPE_PDF = 'PDF';
/*
* Technical datas types constants
@@ -407,6 +408,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
{
static $types = [
'application/x-shockwave-flash' => self::TYPE_FLEXPAPER,
'application/pdf' => self::TYPE_PDF,
'audio/mp3' => self::TYPE_AUDIO_MP3,
'audio/mpeg' => self::TYPE_AUDIO_MP3,
'image/gif' => self::TYPE_IMAGE,

View File

@@ -50,6 +50,21 @@ class patch_380alpha3a extends patchAbstract
{
$conn = $databox->get_connection();
$sql = "CREATE TABLE IF NOT EXISTS `log_colls` (\n"
. " `id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n"
. " `log_id` int(11) unsigned NOT NULL,\n"
. " `coll_id` int(11) unsigned NOT NULL,\n"
. " PRIMARY KEY (`id`),\n"
. " UNIQUE KEY `couple` (`log_id`,`coll_id`),\n"
. " KEY `log_id` (`log_id`),\n"
. " KEY `coll_id` (`coll_id`)\n"
. ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
$stmt = $conn->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
unset($stmt);
$removeProc = "DROP PROCEDURE IF EXISTS explode_log_table";
$stmt = $conn->prepare($removeProc);

View File

@@ -60,8 +60,14 @@ class patch_410alpha13a implements patchInterface
*/
public function apply(base $databox, Application $app)
{
// @see : https://phraseanet.atlassian.net/browse/PHRAS-2468
// to be able to migrate from 3.5 to 4.0.8, we must not delete the table anymore
// so the cli "bin/setup patch:log_coll_id" can be executed.
/*
$sql = "DROP TABLE IF EXISTS `log_colls`";
$databox->get_connection()->prepare($sql)->execute();
*/
/*
* no need to do those ops, it's done by system:upgrade after fixing the xml scheme

View File

@@ -6,6 +6,7 @@ main:
maintenance: false
key: ''
api_require_ssl: true
delete-account-require-email-confirmation: true
database:
host: 'sql-host'
port: 3306
@@ -240,3 +241,7 @@ video-editor:
- 1
- '1.5'
- 3
user_account:
deleting_policies:
email_confirmation: true

10389
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -66,7 +66,7 @@
"normalize-css": "^2.1.0",
"npm": "^6.0.0",
"npm-modernizr": "^2.8.3",
"phraseanet-production-client": "^0.33.0",
"phraseanet-production-client": "0.34.11",
"requirejs": "^2.3.5",
"tinymce": "^4.0.28",
"underscore": "^1.8.3",

View File

@@ -4,18 +4,18 @@
vars_files:
- vars/all.yml
roles:
- server
- repositories
- vagrant_local
- nginx
- mariadb
- elasticsearch
- rabbitmq
- php
- xdebug
- composer
- mailcatcher
- node
- yarn
# - server
# - repositories
# - vagrant_local
# - nginx
# - mariadb
# - elasticsearch
# - rabbitmq
# - php
# - xdebug
# - composer
# - mailcatcher
# - node
# - yarn
# - ffmpeg
- app
- ffmpeg

View File

@@ -28,3 +28,13 @@
lineinfile: dest=/etc/php/{{ phpversion }}/apache2/php.ini
regexp=';?max_input_vars\s*=\s*'
line='max_input_vars = 12000'
- name: set session.hash_bits_per_character apache2
lineinfile: dest=/etc/php/{{ phpversion }}/apache2/php.ini
regexp=';?session.hash_bits_per_character\s*=\s*'
line='session.hash_bits_per_character = 6'
- name: set session.hash_function apache2
lineinfile: dest=/etc/php/{{ phpversion }}/apache2/php.ini
regexp=';?session.hash_function\s*=\s*'
line='session.hash_function = 1'

View File

@@ -28,3 +28,13 @@
lineinfile: dest=/etc/php/{{ phpversion }}/cli/php.ini
regexp=';?max_input_vars\s*=\s*'
line='max_input_vars = 12000'
- name: set session.hash_function cli
lineinfile: dest=/etc/php/{{ phpversion }}/cli/php.ini
regexp=';?session.hash_function\s*=\s*'
line='session.hash_function = 1'
- name: set session.hash_bits_per_character cli
lineinfile: dest=/etc/php/{{ phpversion }}/cli/php.ini
regexp=';?session.hash_bits_per_character\s*=\s*'
line='session.hash_bits_per_character = 6'

View File

@@ -46,3 +46,16 @@
regexp=';?max_input_vars\s*=\s*'
line='max_input_vars = 12000'
notify: restart php{{ phpversion }}-fpm
- name: set session.hash_function fpm
lineinfile: dest=/etc/php/{{ phpversion }}/fpm/php.ini
regexp=';?session.hash_function\s*=\s*'
line='session.hash_function = 1'
notify: restart php{{ phpversion }}-fpm
- name: set session.hash_bits_per_character fpm
lineinfile: dest=/etc/php/{{ phpversion }}/fpm/php.ini
regexp=';?session.hash_bits_per_character\s*=\s*'
line='session.hash_bits_per_character = 6'
notify: restart php{{ phpversion }}-fpm

View File

@@ -0,0 +1,4 @@
---
- name: Update /etc/hosts
lineinfile: dest=/etc/hosts regexp='^127\.0\.0\.1' line='127.0.0.1 localhost {{ vagrant_local.vm.docker_hosts_container|default('') }}' owner=root group=root mode=0644
when: vagrant_local.vm.docker_hosts_container is defined

View File

@@ -10,3 +10,5 @@
- name: Update /etc/hosts
lineinfile: dest=/etc/hosts regexp='^127\.0\.0\.1' line='127.0.0.1 localhost {{ vagrant_local.vm.hostname|default('') }}' owner=root group=root mode=0644
when: vagrant_local.vm.hostname is defined
- include: docker-hosts-container.yml

View File

@@ -48,6 +48,8 @@ vagrant_local:
sharedfolder: ./
useVagrantCloud: '1'
syncType: nfs
hostname: ''
docker_hosts_container: 'db elasticsearch redis rabbitmq'
nginx:
install: '1'
docroot: /vagrant

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2018-12-11T12:17:04Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
<file date="2019-04-05T07:11:41Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
@@ -9,9 +9,9 @@
<trans-unit id="96f0767cb7ea65a7f86c8c9432e80d16cf9d8680" resname="Please provide the same passwords." approved="yes">
<source>Please provide the same passwords.</source>
<target state="translated">Bitte geben Sie diesselbe Passwörter ein.</target>
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
<jms:reference-file line="36">Form/Login/PhraseaRenewPasswordForm.php</jms:reference-file>
<jms:reference-file line="49">Form/Login/PhraseaRegisterForm.php</jms:reference-file>
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
</trans-unit>
<trans-unit id="90b8c9717bb7ed061dbf20fe1986c8b8593d43d4" resname="The token provided is not valid anymore" approved="yes">
<source>The token provided is not valid anymore</source>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2018-12-11T12:19:04Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<file date="2019-04-05T07:13:14Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
@@ -9,9 +9,9 @@
<trans-unit id="96f0767cb7ea65a7f86c8c9432e80d16cf9d8680" resname="Please provide the same passwords." approved="yes">
<source>Please provide the same passwords.</source>
<target state="translated">Please provide the same passwords.</target>
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
<jms:reference-file line="36">Form/Login/PhraseaRenewPasswordForm.php</jms:reference-file>
<jms:reference-file line="49">Form/Login/PhraseaRegisterForm.php</jms:reference-file>
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
</trans-unit>
<trans-unit id="90b8c9717bb7ed061dbf20fe1986c8b8593d43d4" resname="The token provided is not valid anymore" approved="yes">
<source>The token provided is not valid anymore</source>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2018-12-11T12:20:50Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
<file date="2019-04-05T07:14:53Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
@@ -9,9 +9,9 @@
<trans-unit id="96f0767cb7ea65a7f86c8c9432e80d16cf9d8680" resname="Please provide the same passwords." approved="yes">
<source>Please provide the same passwords.</source>
<target state="translated">Veuillez indiquer des mots de passe identiques.</target>
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
<jms:reference-file line="36">Form/Login/PhraseaRenewPasswordForm.php</jms:reference-file>
<jms:reference-file line="49">Form/Login/PhraseaRegisterForm.php</jms:reference-file>
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
</trans-unit>
<trans-unit id="90b8c9717bb7ed061dbf20fe1986c8b8593d43d4" resname="The token provided is not valid anymore" approved="yes">
<source>The token provided is not valid anymore</source>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2018-12-11T12:22:28Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
<file date="2019-04-05T07:16:35Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
@@ -9,9 +9,9 @@
<trans-unit id="96f0767cb7ea65a7f86c8c9432e80d16cf9d8680" resname="Please provide the same passwords.">
<source>Please provide the same passwords.</source>
<target state="new">Please provide the same passwords.</target>
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
<jms:reference-file line="36">Form/Login/PhraseaRenewPasswordForm.php</jms:reference-file>
<jms:reference-file line="49">Form/Login/PhraseaRegisterForm.php</jms:reference-file>
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
</trans-unit>
<trans-unit id="90b8c9717bb7ed061dbf20fe1986c8b8593d43d4" resname="The token provided is not valid anymore">
<source>The token provided is not valid anymore</source>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -232,12 +232,93 @@
</div>
</div>
<div class="well well-large" style="border: 1px solid #333333;">
<div style="max-width: 400px;margin-left: 52px">
<div style="max-width: 400px;margin-left: 2%;display: inline-block;width: 47%;margin-right: 1%;">
<input type="submit" class="btn btn-info btn-block btn-large" value="{{ 'boutton::valider' | trans }}"/>
</div>
<div style="max-width: 400px;margin-left: 1%;width: 47%;display: inline-block;margin-right: 2%;float: right;">
{% if not user.isadmin() and not user.hasLdapCreated() and (owned_feeds|length == 0) and (initiated_validations|length == 0) %}
<a href="#delete-account-process" type="button" role="button" data-toggle="modal" class="btn btn-danger btn-block btn-large">{{ 'phraseanet::account: Delete my account' | trans }}</a>
<!-- Modal -->
<div id="delete-account-process" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">{{ "phraseanet::account: Process to delete account" }}</h3>
</div>
<div class="modal-body">
<p>{{ "phraseanet::account: Are you sure you want to delete your account?" | trans }} </p>
<h6>{{ "phraseanet::account: List of data to be deleted" | trans }}</h6>
{% if baskets|length > 0 %}
- {{ 'Paniers' | trans }}
<ul style="padding-left: 30px">
{% for basket in baskets %}
<li>{{ basket.getName() }}</li>
{% endfor %}
</ul>
{% endif %}
{% if api_accounts|length > 0 %}
- {{ "My application " | trans }}
<ul style="padding-left: 30px">
{% for api_account in api_accounts %}
<li>{{ api_account.getApplication().getName() ~ " => Client_id: " ~ api_account.getApplication().getClientId() }}</li>
{% endfor %}
</ul>
{% endif%}
- {{ "phraseanet::account: My phraseanet account" | trans }}
<ul style="padding-left: 30px">
<li>Name : {{ user.getFirstName() ~ ' ' ~ user.getLastName() }}</li>
<li>Login : {{ user.getLogin() }}</li>
</ul>
</div>
<div class="modal-footer">
<label style="text-align: left;" class="form_label checkbox" for="delete_account_aggree">
{% if app['conf'].get(['user_account', 'deleting_policies', 'email_confirmation']) %}
{{ "phraseanet::account: I am agree to delete my account, need confirmation on mail" | trans }}
{% else %}
{{ "phraseanet::account: I am agree to delete my account" | trans }}
{% endif %}
<input class="input_element input-xlarge" type="checkbox" id="delete_account_aggree"/>
</label>
<button class="btn" data-dismiss="modal" aria-hidden="true">{{ "No" | trans }}</button>
<a id="delete_account_confirm" class="btn btn-info" style="opacity:0.5;pointer-events: none;" >{{ "Yes" | trans }}</a>
</div>
</div>
{% else %}
<p style="font-size: 12px"> {{ "phraseanet::account: << your account can be deleted via admin interface >> " | trans }}</p>
{% endif %}
</div>
</div>
</div>
</form>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var deleteButton = $("#delete_account_confirm");
$("#delete_account_aggree").bind("click", function(e) {
if ($(this).is(":checked")) {
deleteButton.attr("href", '{{ path("account_process_delete") }}');
deleteButton.css({"opacity": "1", "pointer-events": "auto"});
} else {
deleteButton.removeAttr("href");
deleteButton.css({"opacity": "0.5", "pointer-events": "none"});
}
});
});
</script>
{% endblock %}

View File

@@ -94,7 +94,7 @@
<tbody>
{% for session in data['sessions'] %}
{% set row = session['session'] %}
<tr title="{{ _self.tooltip_connected_users(row) | raw }}" class="{% if loop.index is odd %}odd{% else %}even{% endif %} usrTips" id="TREXP_{{ row.getId()}}">
<tr title="{{ _self.tooltip_connected_users(row) | e }}" class="{% if loop.index is odd %}odd{% else %}even{% endif %} usrTips" id="TREXP_{{ row.getId()}}">
{% if row.getId() == app['session'].get('session_id') %}
<td style="color:#ff0000"><i>{{ row.getUser().getDisplayName() }}</i></td>

View File

@@ -19,7 +19,7 @@
src="{{ url('alchemy_embed_view', {url: url|trim, autoplay: autoplay|default('false') }) }}"
frameborder="0" allowfullscreen></iframe>
</div>
{% elseif record_type == 'FLEXPAPER' %}
{% elseif record_type == 'FLEXPAPER' or record_type == 'PDF' %}
<div id="phraseanet-embed-frame" class="documentTips"
data-original-width="{{original_w}}"
data-original-height="{{original_h}}"

View File

@@ -49,7 +49,13 @@
<!-- End of header table -->
<!-- Subject table -->
<table width="90%" cellpadding="0" cellspacing="0" border="0" align="center" style="width:90% !important;">
<tr style="background-color:#a6aab0">
<tr style=
{% if mailSkin == constant('Alchemy\\Phrasea\\Notification\\Mail\\MailRequestAccountDelete::MAIL_SKIN') %}
"background: linear-gradient(to bottom, #ee5f5b, #bd362f)"
{% elseif mailSkin == constant('Alchemy\\Phrasea\\Notification\\Mail\\AbstractMail::MAIL_SKIN') %}
"background-color:#a6aab0"
{% endif %}
>
<td height="50" valign="center" align="center" style="font-family: Helvetica, Tahoma, Arial, sans-serif; font-size:16px; line-height:19px; font-weight:bold; color:#ffffff;">
{{ subject }}
</td>
@@ -72,7 +78,7 @@
<span style="color:#FFA500; color:#FFA500 !important; text-decoration:underline; cursor:pointer;">{{ senderMail }}</span></a><br/>
{% endif %}
<br/>
{{ messageText | nl2br }}
{{ messageText | raw | nl2br }}
<br/>
</td>
</tr>

View File

@@ -51,7 +51,7 @@
<tr>
<td>
<h2 class="title15">
{{basket.getName()|raw}}
{{basket.getName()|e}}
</h2>
{% if basket.getValidation().isFinished() %}
{{ '(validation) session terminee' | trans }}
@@ -116,7 +116,7 @@
<tr>
<td>
<h2 class="title15">
{{ basket.getName()|raw}}
{{ basket.getName()|e}}
</h2>
</td>
<td class="right">

View File

@@ -19,7 +19,7 @@
<img src='/assets/common/images/icons/basket_push_unread.png' title=''/>
{% endif %}
<img src='/assets/common/images/icons/basket.png' title=''/>
{{basket.getName()}}
{{basket.getName()|e}}
</span>
</a>
<div class="menu">
@@ -99,7 +99,7 @@
{% else %}
<img src='/assets/common/images/icons/basket.png' title=''/>
{% endif %}
{{basket.getName()}}
{{basket.getName()|e}}
</span>
</a>
<div class="menu">

View File

@@ -17,7 +17,7 @@
<div class="PNB10 LeftColumn">
<div class="PNB" style="text-align:center;">
{% if context == 'Push' %}
<img style="width: 36px; height: 36px" src="/assets/common/images/icons/push64.png"/>
<img style="width: 36px; height: 36px" src="/assets/common/images/icons/push-icon.png"/>
{% else %}
<img style="width: 36px; height: 36px" src="/assets/common/images/icons/validation.png"/>
{% endif %}

View File

@@ -264,6 +264,12 @@
<div class="PNB" id="rightFrame" style="left:auto; width:{{ w2 ~ '%' }}">
<div id="headBlock" class="PNB">
<div class="searchFormWrapper">
{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'QUERY' %}
<div id="FIRST_QUERY_CONTAINER" class="start-query" style="display: none" data-format="text">{{app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page_jsonquery') | raw}}</div>
{% elseif app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'LAST_QUERY' %}
<div id="FIRST_QUERY_CONTAINER" class="last-query" style="display: none" data-format="json">{{app['settings'].getUserSetting(app.getAuthenticatedUser(), 'last_jsonquery') | raw}}</div>
{% endif %}
<form id="searchForm" method="POST" action="{{ path('prod_query') }}" name="phrasea_query" class="phrasea_query">
<input id="SENT_query" name="qry" type="hidden" value="{{app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page_query')}}">
<input type="hidden" name="pag" id="formAnswerPage" value="">
@@ -404,27 +410,27 @@
</label>
<div class="term_select">
<div class="term_select_wrapper">
<select class="term_select_field" style="vertical-align:middle; width:30%;">
<div class="term_select_wrapper_template" style="display: none;">
<select class="term_select_field" style="vertical-align:middle; width:30%;">
<option value="">{{ 'Select a field' | trans }}</option>
{% for field_id, field in search_datas['fields'] %}
{% if field['type'] != 'date' %}
<option class="dbx db_{{field['sbas']|join(' db_')}}" value="{{field_id}}">{{field['fieldname']}}</option>
{% endif %}
{# {% if field['type'] != 'date' %}#}
<option class="dbx db_{{field['sbas']|join(' db_')}}" data-fieldtype="{{ field['type'] }}-FIELD" value="{{field_id}}">{{field['fieldname']}}</option>
{#{% endif %}#}
{% endfor %}
</select>
<select disabled style="vertical-align:middle; width: 23%;">
<option value="contains">{{ 'Contains' | trans }}</option>
<option value="equals">{{ 'Equals' | trans }}</option>
<select class="term_select_op" disabled style="vertical-align:middle; width: 23%;">
<option value=":">{{ 'Contains' | trans }}</option>
<option value="=">{{ 'Equals' | trans }}</option>
</select>
<input disabled style="vertical-align:middle; width: 32%;" placeholder="{{ 'Ex : Paris, bleu, montagne' | trans }}">
<input class="term_deleter" style="margin-bottom: 4px;" disabled>
<input class="term_select_value" disabled style="vertical-align:middle; width: 32%;" placeholder="{{ 'Ex : Paris, bleu, montagne' | trans }}">
<input class="term_deleter" style="margin-bottom: 4px;">
</div>
<button class="add_new_term"><span>&plus;</span> Add</button>
</div>
<div style="display:none;">
{# <div style="display:none;">
<select class="term_select_multiple" size="8" multiple onchange="prodApp.appEvents.emit('search.doCheckFilters', true);" name="fields[]" style="vertical-align:middle; width:99%;">
<option value="phraseanet--all--fields">{{ 'rechercher dans tous les champs' | trans }}</option>
{% for field_id, field in search_datas['fields'] %}
@@ -433,7 +439,7 @@
{% endif %}
{% endfor %}
</select>
</div>
</div>#}
</div>
<div id="ADVSRCH_DATE_ZONE">
@@ -449,13 +455,15 @@
</div>
</label>
<span>
<select name="date_field" class="input-medium check-filters" data-save="true" style="width: 166px;">
<select name="date_field" class="date-field input-medium check-filters" data-save="true" style="width: 166px;">
<option selected="selected"
value="">{{ 'Rechercher dans un champ date' | trans }}</option>
{% for fieldname, date in search_datas['dates'] %}
<option
class="dbx db_{{date['sbas']|join(' db_')}}" value="{{ fieldname }}">{{ fieldname }}</option>
{% endfor %}
<option value="updated_on">{{ 'updated_on' | trans }}</option>
<option value="created_on">{{ 'created_on' | trans }}</option>
</select>
</span>
<span id="ADVSRCH_DATE_SELECTORS" style="display: inline-block;height: 26px;line-height: 26px;">
@@ -498,13 +506,16 @@
{% for status_bit, status in databox.status %}
<tr>
<td>
<label class="checkbox inline custom_checkbox_label">
{% if status['img_off'] %}
<img src="{{status['img_off']}}" title="{{status['labels_off_i18n'][app['locale']]}}" />
{% endif %}
<input class="field_switch field_{{databox_id}} check-filters" data-save="true"
type="checkbox" value="0"
n="{{status_bit}}" name="status[{{databox_id}}][{{status_bit}}]" />
<input type="checkbox" class="field_switch field_{{databox_id}}"
value="0"
data-sbas_id="{{databox_id}}" data-sb="{{status_bit}}"
name="status[{{databox_id}}][{{status_bit}}]"
/>
<span class="custom_checkbox"></span>
{{status['labels_off_i18n'][app['locale']]}}
</label>
@@ -514,9 +525,11 @@
{% if status['img_on'] %}
<img src="{{status['img_on']}}" title="{{status['labels_on_i18n'][app['locale']]}}" />
{% endif %}
<input class="field_switch field_{{databox_id}} check-filters" data-save="true"
type="checkbox" value="1"
n="{{status_bit}}" name="status[{{databox_id}}][{{status_bit}}]"/>
<input type="checkbox" class="field_switch field_{{databox_id}}"
value="1"
data-sbas_id="{{databox_id}}" data-sb="{{status_bit}}"
name="status[{{databox_id}}][{{status_bit}}]"
/>
<span class="custom_checkbox"></span>
{{status['labels_on_i18n'][app['locale']]}}
</label>

View File

@@ -12,17 +12,17 @@
<table>
<tr>
<td>
<span class="name"><%= item.display_name %></span>
<span class="name"><%= htmlEncode(item.display_name) %></span>
</td>
</tr>
<tr>
<td>
<span class="email"><i><%= item.email %></i></span>
<span class="email"><i><%= htmlEncode(item.email) %></i></span>
</td>
</tr>
<tr>
<td>
<span class="subtite"><%= item.subtitle || '' %></span>
<span class="subtite"><%= htmlEncode(item.subtitle) || '' %></span>
</td>
</tr>
</table>
@@ -47,7 +47,7 @@
<table>
<tr>
<td>
<span class="name"><%= item.name %></span>
<span class="name"><%= htmlEncode(item.name) %></span>
</td>
</tr>
<tr>
@@ -81,12 +81,12 @@
<table>
<tr>
<td colspan="3">
<span class="name"><%= user.display_name %></span>
<span class="name"><%= htmlEncode(user.display_name) %></span>
</td>
</tr>
<tr>
<td colspan="3">
<span class="subtite"><%= user.subtitle || '' %></span>
<span class="subtite"><%= htmlEncode(user.subtitle) || '' %></span>
</td>
</tr>
<tr class="toggles">
@@ -201,12 +201,12 @@
<table>
<tr>
<td colspan="3">
<span class="name"><%= user.display_name %></span>
<span class="name"><%= htmlEncode(user.display_name) %></span>
</td>
</tr>
<tr>
<td colspan="3">
<span class="subtite"><%= user.subtitle || '' %></span>
<span class="subtite"><%= htmlEncode(user.subtitle) || '' %></span>
</td>
</tr>
<tr class="toggles">
@@ -242,12 +242,12 @@
<table>
<tr>
<td colspan="3">
<span class="name"><%= user.display_name %></span>
<span class="name"><%= htmlEncode(user.display_name) %></span>
</td>
</tr>
<tr>
<td colspan="3">
<span class="subtite"><%= user.subtitle || '' %></span>
<span class="subtite"><%= htmlEncode(user.subtitle) || '' %></span>
</td>
</tr>
<tr class="toggles">
@@ -267,3 +267,22 @@
</div>
</script>
<script>
function htmlEncode(str) {
return str.replace(/[&"'<>]/g, function(c){
switch (c)
{
case "&":
return "&amp;";
case "'":
return "&#39;";
case '"':
return "&quot;";
case "<":
return "&lt;";
case ">":
return "&gt;";
}
});
}
</script>

View File

@@ -31,7 +31,10 @@
<span>{{ 'Select files...' | trans }}</span>
<input type="file" name="files[]" multiple>
</span>
<br />
<br />
<p class="or_upload">{{ "Or" | trans }}</p>
<div class="url_upload"><input type="url" value="" id="add-url"><button class="add-url add_url_upload">{{ 'Add this url' | trans }}</button></div>
<br/>
<span class="comment">
({% trans with {'%maxFileSizeReadable%' : maxFileSizeReadable} %}maximum : %maxFileSizeReadable%{% endtrans %})
</span>

View File

@@ -16,11 +16,11 @@
{% if context %}
{% set zterm %}
{% trans with {'%term%' : term, '%context%' : context} %}thesaurus:: le terme %term% avec contexte %context%{% endtrans %}
{% trans with {'%term%' : term | e, '%context%' : context | e} %}thesaurus:: le terme %term% avec contexte %context%{% endtrans %}
{% endset %}
{% else %}
{% set zterm %}
{% trans with {'%term%' : term} %}thesaurus:: le terme %term% sans contexte{% endtrans %}
{% trans with {'%term%' : term | e} %}thesaurus:: le terme %term% sans contexte{% endtrans %}
{% endset %}
{% endif %}

View File

@@ -338,6 +338,8 @@
for(var sy=syl.item(0).firstChild; sy; sy=sy.nextSibling )
{
var lng = sy.getAttribute("lng");
var v = escapeHtmlDataFromXML(sy.getAttribute("v"));
html += "<tr>";
if(lng)
if(tFlags[lng])
@@ -347,7 +349,7 @@
else
html += "<td><span style='background-color:#cccccc'>&nbsp;?&nbsp;</span></td>";
html += "<td>&nbsp;"+sy.getAttribute("v")+"</td>";
html += "<td>&nbsp;"+ v +"</td>";
var hits = 0+sy.getAttribute("hits");
if(hits == 1)
@@ -361,6 +363,12 @@
return(html);
}
// Let the browser to do it
function escapeHtmlDataFromXML(data){
var d = document.createElement('div');
d.appendChild(document.createTextNode(data));
return d.innerHTML;
}
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//

View File

@@ -19,6 +19,7 @@ class RepositoriesServiceProviderTest extends ServiceProviderTestCase
['Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider', 'repo.baskets', 'Alchemy\Phrasea\Model\Repositories\BasketRepository'],
['Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider', 'repo.basket-elements', 'Alchemy\Phrasea\Model\Repositories\BasketElementRepository'],
['Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider', 'repo.validation-participants', 'Alchemy\Phrasea\Model\Repositories\ValidationParticipantRepository'],
['Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider', 'repo.validation-session', 'Alchemy\Phrasea\Model\Repositories\ValidationSessionRepository'],
['Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider', 'repo.story-wz', 'Alchemy\Phrasea\Model\Repositories\StoryWZRepository'],
['Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider', 'repo.orders', 'Alchemy\Phrasea\Model\Repositories\OrderRepository'],
['Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider', 'repo.order-elements', 'Alchemy\Phrasea\Model\Repositories\OrderElementRepository'],

View File

@@ -0,0 +1,66 @@
<?php
namespace Alchemy\Tests\Phrasea\Notification\Mail;
use Alchemy\Phrasea\Exception\LogicException;
use Alchemy\Phrasea\Notification\Mail\MailRequestAccountDelete;
/**
* @group functional
* @group legacy
* @covers Alchemy\Phrasea\Notification\Mail\MailRequestAccountDelete
*/
class MailRequestAccountDeleteTest extends MailWithLinkTestCase
{
/**
* @covers Alchemy\Phrasea\Notification\Mail\MailRequestAccountDelete::setUserOwner
*/
public function testSetUserOwner()
{
$this->assertEquals('Email:deletion:request:message Hello %civility% %firstName% %lastName%.
We have received an account deletion request for your account on %urlInstance%, please confirm this deletion by clicking on the link below.
If you are not at the origin of this request, please change your password as soon as possible %resetPassword%
Link is valid for one hour.', $this->getMail()->getMessage());
}
public function testShouldThrowALogicExceptionIfNoUserProvided()
{
$mail = MailRequestAccountDelete::create(
$this->getApplication(),
$this->getReceiverMock(),
$this->getEmitterMock(),
$this->getMessage(),
$this->getUrl(),
$this->getExpiration()
);
try {
$mail->getMessage();
$this->fail('Should have raised an exception');
} catch (LogicException $e) {
}
}
public function getMail()
{
$mail = MailRequestAccountDelete::create(
$this->getApplication(),
$this->getReceiverMock(),
$this->getEmitterMock(),
$this->getMessage(),
$this->getUrl(),
$this->getExpiration()
);
$user = $this->createUserMock();
$user->expects($this->any())
->method('getDisplayName')
->will($this->returnValue('JeanPhil'));
$mail->setUserOwner($user);
return $mail;
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Alchemy\Tests\Phrasea\Notification\Mail;
use Alchemy\Phrasea\Notification\Mail\MailSuccessAccountDelete;
/**
* @group functional
* @group legacy
* @covers Alchemy\Phrasea\Notification\Mail\MailSuccessAccountDelete
*/
class MailSuccessAccountDeleteTest extends MailTestCase
{
public function getMail()
{
return MailSuccessAccountDelete::create(
$this->getApplication(),
$this->getReceiverMock(),
$this->getEmitterMock(),
$this->getMessage()
);
}
}

View File

@@ -47,7 +47,9 @@ class QuotedTextNodeTest extends \PHPUnit_Framework_TestCase
public function testQueryBuildWithPrivateFields()
{
$public_field = new Field('foo', FieldMapping::TYPE_STRING, ['private' => false]);
$public_field = new Field('foo', FieldMapping::TYPE_STRING, [
'private' => false
]);
$private_field = new Field('bar', FieldMapping::TYPE_STRING, [
'private' => true,
'used_by_collections' => [1, 2, 3]
@@ -75,7 +77,10 @@ class QuotedTextNodeTest extends \PHPUnit_Framework_TestCase
"should": [{
"multi_match": {
"type": "phrase",
"fields": ["foo.fr", "foo.en"],
"fields": [
"foo.fr",
"foo.en"
],
"query": "baz",
"lenient": true
}
@@ -89,7 +94,12 @@ class QuotedTextNodeTest extends \PHPUnit_Framework_TestCase
"query": {
"multi_match": {
"type": "phrase",
"fields": ["private_caption.bar.fr", "private_caption.bar.en"],
"fields": [
"private_caption.bar.fr",
"private_caption.bar.en",
"foo.fr",
"foo.en"
],
"query": "baz",
"lenient": true
}

View File

@@ -126,12 +126,18 @@ class TermNodeTest extends \PHPUnit_Framework_TestCase
"bool": {
"should": [{
"multi_match": {
"fields": ["concept_path.bar"],
"fields": [
"concept_path.bar",
"concept_path.foo"
],
"query": "/baz"
}
}, {
"multi_match": {
"fields": ["concept_path.bar"],
"fields": [
"concept_path.bar",
"concept_path.foo"
],
"query": "/qux"
}
}]

View File

@@ -109,7 +109,12 @@ class TextNodeTest extends \PHPUnit_Framework_TestCase
},
"query": {
"multi_match": {
"fields": ["private_caption.bar.fr", "private_caption.bar.en"],
"fields": [
"private_caption.bar.fr",
"private_caption.bar.en",
"foo.fr",
"foo.en"
],
"query": "baz",
"type": "cross_fields",
"operator": "and",
@@ -216,7 +221,12 @@ class TextNodeTest extends \PHPUnit_Framework_TestCase
"bool": {
"should": [{
"multi_match": {
"fields": ["private_caption.bar.fr", "private_caption.bar.en"],
"fields": [
"private_caption.bar.fr",
"private_caption.bar.en",
"foo.fr",
"foo.en"
],
"query": "baz",
"type": "cross_fields",
"operator": "and",
@@ -224,7 +234,10 @@ class TextNodeTest extends \PHPUnit_Framework_TestCase
}
}, {
"multi_match": {
"fields": ["concept_path.bar"],
"fields": [
"concept_path.bar",
"concept_path.foo"
],
"query": "/qux"
}
}]

View File

@@ -26,28 +26,28 @@ class ValueCheckerTest extends \PHPUnit_Framework_TestCase
$values = [
[FieldMapping::TYPE_FLOAT , 42 , true ],
[FieldMapping::TYPE_FLOAT , '42' , true ],
[FieldMapping::TYPE_FLOAT , '42foo' , false],
[FieldMapping::TYPE_FLOAT , 'foo' , false],
[FieldMapping::TYPE_FLOAT , '42foo' , true],
[FieldMapping::TYPE_FLOAT , 'foo' , true],
[FieldMapping::TYPE_DOUBLE , 42 , true ],
[FieldMapping::TYPE_DOUBLE , '42' , true ],
[FieldMapping::TYPE_DOUBLE , '42foo' , false],
[FieldMapping::TYPE_DOUBLE , 'foo' , false],
[FieldMapping::TYPE_DOUBLE , '42foo' , true],
[FieldMapping::TYPE_DOUBLE , 'foo' , true],
[FieldMapping::TYPE_INTEGER, 42 , true ],
[FieldMapping::TYPE_INTEGER, '42' , true ],
[FieldMapping::TYPE_INTEGER, '42foo' , false],
[FieldMapping::TYPE_INTEGER, 'foo' , false],
[FieldMapping::TYPE_INTEGER, '42foo' , true],
[FieldMapping::TYPE_INTEGER, 'foo' , true],
[FieldMapping::TYPE_LONG , 42 , true ],
[FieldMapping::TYPE_LONG , '42' , true ],
[FieldMapping::TYPE_LONG , '42foo' , false],
[FieldMapping::TYPE_LONG , 'foo' , false],
[FieldMapping::TYPE_LONG , '42foo' , true],
[FieldMapping::TYPE_LONG , 'foo' , true],
[FieldMapping::TYPE_SHORT , 42 , true ],
[FieldMapping::TYPE_SHORT , '42' , true ],
[FieldMapping::TYPE_SHORT , '42foo' , false],
[FieldMapping::TYPE_SHORT , 'foo' , false],
[FieldMapping::TYPE_SHORT , '42foo' , true],
[FieldMapping::TYPE_SHORT , 'foo' , true],
[FieldMapping::TYPE_BYTE , 42 , true ],
[FieldMapping::TYPE_BYTE , '42' , true ],
[FieldMapping::TYPE_BYTE , '42foo' , false],
[FieldMapping::TYPE_BYTE , 'foo' , false],
[FieldMapping::TYPE_BYTE , '42foo' , true],
[FieldMapping::TYPE_BYTE , 'foo' , true],
[FieldMapping::TYPE_STRING , 'foo' , true ],
[FieldMapping::TYPE_STRING , '42' , true ],
@@ -61,8 +61,8 @@ class ValueCheckerTest extends \PHPUnit_Framework_TestCase
[FieldMapping::TYPE_BOOLEAN, 42 , true ],
[FieldMapping::TYPE_DATE , '2015/01/01' , true ],
[FieldMapping::TYPE_DATE , '2015/01/01 00:00:00', false],
[FieldMapping::TYPE_DATE , 'foo' , false],
[FieldMapping::TYPE_DATE , '2015/01/01 00:00:00', true],
[FieldMapping::TYPE_DATE , 'foo' , true],
];
foreach ($values as &$value) {

5890
yarn.lock

File diff suppressed because it is too large Load Diff