Compare commits

..

13 commits

Author SHA1 Message Date
Benjamin Renard
0219714d4a Fix JS translations loading method to make translations available earlier 2022-04-24 20:17:48 +02:00
Benjamin Renard
3a61299005 Add handler for common HTTP errors 2022-04-24 19:11:37 +02:00
Benjamin Renard
e808e3bfb7 Remove unexisting translation template variables 2022-04-24 18:52:24 +02:00
Benjamin Renard
2c7689a43d fatal_error now accept extra parameter for error message formating 2022-04-24 18:51:59 +02:00
Benjamin Renard
6b20a4a526 smarty: fix handling extra parameters in add_error() & add_message() 2022-04-24 18:51:30 +02:00
Benjamin Renard
ced73d660e Add overtrue/phplint dev dependency and configure it 2022-04-24 18:30:13 +02:00
Benjamin Renard
c69dcfd38f Fix indentation method 2022-04-24 18:30:02 +02:00
Benjamin Renard
dba4c6fa9e Make logging & message handling functions accept extra parameters to format messages using sprintf 2022-04-24 18:29:21 +02:00
Benjamin Renard
efc7352404 Code cleaning 2022-04-24 17:43:44 +02:00
Benjamin Renard
78ffe5a8c7 Update install doc 2022-04-24 16:56:37 +02:00
Benjamin Renard
9886cb0720 Switch to SUXUMI bootstrap4dialog lib 2022-04-24 16:52:44 +02:00
Benjamin Renard
153ebd4902 Upgrade to Bootstrap 4.6 2022-04-24 16:52:16 +02:00
Benjamin Renard
444c1ec2fc Improve translations
- Add support for translations in JavaScript code using babel lib and
  a custom PO file converter to JSON (using sepia/po-parser lib for
  PO files parsing)
- Put translation CLI commands in a dedicated file
- update_messages CLI command now provide PO file initialization feature
  using msginit and support of compendium files
2022-04-24 16:46:38 +02:00
80 changed files with 15334 additions and 12058 deletions

1
.gitignore vendored
View file

@ -11,3 +11,4 @@
/.vim* /.vim*
/.less* /.less*
/.ssh /.ssh
/.phplint-cache

7
.phplint.yml Normal file
View file

@ -0,0 +1,7 @@
path: ./
jobs: 10
extensions:
- php
exclude:
- vendor
warning: true

View file

@ -3,6 +3,6 @@
require realpath(dirname(__FILE__).'/..')."/includes/core.php"; require realpath(dirname(__FILE__).'/..')."/includes/core.php";
if (is_callable('handle_cli_args')) if (is_callable('handle_cli_args'))
handle_cli_args(); handle_cli_args();
else else
logging('FATAL', "An error occured initializing CLI : handle_cli_args() function not found."); logging('FATAL', "An error occured initializing CLI : handle_cli_args() function not found.");

View file

@ -4,8 +4,8 @@ USER=$( basename $0 )
REAL_BIN=$( realpath -L $0|sed 's/\.wrapper$//' ) REAL_BIN=$( realpath -L $0|sed 's/\.wrapper$//' )
if [ "$( id -u -n )" != "$USER" ] if [ "$( id -u -n )" != "$USER" ]
then then
sudo -u $USER $REAL_BIN $@ sudo -u $USER $REAL_BIN $@
exit $? exit $?
fi fi
$REAL_BIN $@ $REAL_BIN $@
exit $? exit $?

View file

@ -4,6 +4,10 @@
"pear/console_table": "^1.3", "pear/console_table": "^1.3",
"brenard/php-unidecode": "dev-master", "brenard/php-unidecode": "dev-master",
"smarty-gettext/smarty-gettext": "^1.6", "smarty-gettext/smarty-gettext": "^1.6",
"smarty-gettext/tsmarty2c": "^0.2.1" "smarty-gettext/tsmarty2c": "^0.2.1",
"sepia/po-parser": "^6.0"
},
"require-dev": {
"overtrue/phplint": "^3.0"
} }
} }

566
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "a04f1f6d9c33a934cf0fe14d26de9ae7", "content-hash": "996b970dc0d35f8d9dc7a0dbcbb1c55b",
"packages": [ "packages": [
{ {
"name": "brenard/php-unidecode", "name": "brenard/php-unidecode",
@ -79,6 +79,10 @@
"pdo", "pdo",
"query" "query"
], ],
"support": {
"issues": "https://github.com/envms/fluentpdo/issues",
"source": "https://github.com/envms/fluentpdo/tree/legacy"
},
"time": "2018-04-27T19:01:30+00:00" "time": "2018-04-27T19:01:30+00:00"
}, },
{ {
@ -182,24 +186,28 @@
"keywords": [ "keywords": [
"console" "console"
], ],
"support": {
"issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Console_Table",
"source": "https://github.com/pear/Console_Table"
},
"time": "2018-01-25T20:47:17+00:00" "time": "2018-01-25T20:47:17+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",
"version": "1.1.1", "version": "1.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/container.git", "url": "https://github.com/php-fig/container.git",
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" "reference": "513e0666f7216c7459170d56df27dfcefe1689ea"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea",
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", "reference": "513e0666f7216c7459170d56df27dfcefe1689ea",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2.0" "php": ">=7.4.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -228,9 +236,63 @@
], ],
"support": { "support": {
"issues": "https://github.com/php-fig/container/issues", "issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/1.1.1" "source": "https://github.com/php-fig/container/tree/1.1.2"
}, },
"time": "2021-03-05T17:36:06+00:00" "time": "2021-11-05T16:50:12+00:00"
},
{
"name": "sepia/po-parser",
"version": "6.0.1",
"source": {
"type": "git",
"url": "https://github.com/raulferras/PHP-po-parser.git",
"reference": "f60a4a6259b08cc04807c4ad5f59ec5a006bb87b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/raulferras/PHP-po-parser/zipball/f60a4a6259b08cc04807c4ad5f59ec5a006bb87b",
"reference": "f60a4a6259b08cc04807c4ad5f59ec5a006bb87b",
"shasum": ""
},
"require": {
"php": ">=5.3",
"symfony/polyfill-mbstring": "^1"
},
"require-dev": {
"fzaninotto/faker": "^1.7",
"phpunit/phpunit": "^4.8.36",
"squizlabs/php_codesniffer": "^2.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Sepia\\PoParser\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Raúl Ferràs",
"email": "raul.ferras@gmail.com",
"role": "developer"
}
],
"description": "Gettext *.PO file parser for PHP.",
"homepage": "https://github.com/raulferras/PHP-po-parser",
"keywords": [
"gettext",
"i10n",
"i18n",
"po"
],
"support": {
"issues": "https://github.com/raulferras/PHP-po-parser/issues",
"source": "https://github.com/raulferras/PHP-po-parser/tree/6.0.1"
},
"time": "2020-05-29T05:20:47+00:00"
}, },
{ {
"name": "smarty-gettext/smarty-gettext", "name": "smarty-gettext/smarty-gettext",
@ -293,16 +355,16 @@
}, },
{ {
"name": "smarty-gettext/tsmarty2c", "name": "smarty-gettext/tsmarty2c",
"version": "0.2.1", "version": "0.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/smarty-gettext/tsmarty2c.git", "url": "https://github.com/smarty-gettext/tsmarty2c.git",
"reference": "84b342e6fb7b4b5b3e92e732635f3b0bbc217649" "reference": "fb899c70757f868cc3ee47824b04332b1ed02ea8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/smarty-gettext/tsmarty2c/zipball/84b342e6fb7b4b5b3e92e732635f3b0bbc217649", "url": "https://api.github.com/repos/smarty-gettext/tsmarty2c/zipball/fb899c70757f868cc3ee47824b04332b1ed02ea8",
"reference": "84b342e6fb7b4b5b3e92e732635f3b0bbc217649", "reference": "fb899c70757f868cc3ee47824b04332b1ed02ea8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -340,9 +402,9 @@
"homepage": "https://github.com/smarty-gettext/tsmarty2c", "homepage": "https://github.com/smarty-gettext/tsmarty2c",
"support": { "support": {
"issues": "https://github.com/smarty-gettext/tsmarty2c/issues", "issues": "https://github.com/smarty-gettext/tsmarty2c/issues",
"source": "https://github.com/smarty-gettext/tsmarty2c/tree/0.2.1" "source": "https://github.com/smarty-gettext/tsmarty2c/tree/0.2.2"
}, },
"time": "2020-11-11T21:40:04+00:00" "time": "2021-12-24T11:57:46+00:00"
}, },
{ {
"name": "smarty/smarty", "name": "smarty/smarty",
@ -408,26 +470,26 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v5.3.4", "version": "v5.4.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "ebd610dacd40d75b6a12bf64b5ccd494fc7d6ab1" "reference": "900275254f0a1a2afff1ab0e11abd5587a10e1d6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/ebd610dacd40d75b6a12bf64b5ccd494fc7d6ab1", "url": "https://api.github.com/repos/symfony/console/zipball/900275254f0a1a2afff1ab0e11abd5587a10e1d6",
"reference": "ebd610dacd40d75b6a12bf64b5ccd494fc7d6ab1", "reference": "900275254f0a1a2afff1ab0e11abd5587a10e1d6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2.5", "php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1", "symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php73": "^1.8", "symfony/polyfill-php73": "^1.9",
"symfony/polyfill-php80": "^1.16", "symfony/polyfill-php80": "^1.16",
"symfony/service-contracts": "^1.1|^2", "symfony/service-contracts": "^1.1|^2|^3",
"symfony/string": "^5.1" "symfony/string": "^5.1|^6.0"
}, },
"conflict": { "conflict": {
"psr/log": ">=3", "psr/log": ">=3",
@ -442,12 +504,12 @@
}, },
"require-dev": { "require-dev": {
"psr/log": "^1|^2", "psr/log": "^1|^2",
"symfony/config": "^4.4|^5.0", "symfony/config": "^4.4|^5.0|^6.0",
"symfony/dependency-injection": "^4.4|^5.0", "symfony/dependency-injection": "^4.4|^5.0|^6.0",
"symfony/event-dispatcher": "^4.4|^5.0", "symfony/event-dispatcher": "^4.4|^5.0|^6.0",
"symfony/lock": "^4.4|^5.0", "symfony/lock": "^4.4|^5.0|^6.0",
"symfony/process": "^4.4|^5.0", "symfony/process": "^4.4|^5.0|^6.0",
"symfony/var-dumper": "^4.4|^5.0" "symfony/var-dumper": "^4.4|^5.0|^6.0"
}, },
"suggest": { "suggest": {
"psr/log": "For using the console logger", "psr/log": "For using the console logger",
@ -487,7 +549,7 @@
"terminal" "terminal"
], ],
"support": { "support": {
"source": "https://github.com/symfony/console/tree/v5.3.4" "source": "https://github.com/symfony/console/tree/v5.4.7"
}, },
"funding": [ "funding": [
{ {
@ -503,20 +565,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-07-26T16:33:26+00:00" "time": "2022-03-31T17:09:19+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
"version": "v2.4.0", "version": "v2.5.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git", "url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
"reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -525,7 +587,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-main": "2.4-dev" "dev-main": "2.5-dev"
}, },
"thanks": { "thanks": {
"name": "symfony/contracts", "name": "symfony/contracts",
@ -554,7 +616,7 @@
"description": "A generic function and convention to trigger deprecation notices", "description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1"
}, },
"funding": [ "funding": [
{ {
@ -570,24 +632,25 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-03-23T23:28:01+00:00" "time": "2022-01-02T09:53:40+00:00"
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v5.3.4", "version": "v5.4.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
"reference": "17f50e06018baec41551a71a15731287dbaab186" "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/17f50e06018baec41551a71a15731287dbaab186", "url": "https://api.github.com/repos/symfony/finder/zipball/231313534dded84c7ecaa79d14bc5da4ccb69b7d",
"reference": "17f50e06018baec41551a71a15731287dbaab186", "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2.5", "php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-php80": "^1.16" "symfony/polyfill-php80": "^1.16"
}, },
"type": "library", "type": "library",
@ -616,7 +679,7 @@
"description": "Finds files and directories via an intuitive fluent interface", "description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/finder/tree/v5.3.4" "source": "https://github.com/symfony/finder/tree/v5.4.3"
}, },
"funding": [ "funding": [
{ {
@ -632,25 +695,28 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-07-23T15:54:19+00:00" "time": "2022-01-26T16:34:36+00:00"
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
"version": "v1.23.0", "version": "v1.25.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git", "url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" "reference": "30885182c981ab175d4d034db0f6f469898070ab"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab",
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", "reference": "30885182c981ab175d4d034db0f6f469898070ab",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.1"
}, },
"provide": {
"ext-ctype": "*"
},
"suggest": { "suggest": {
"ext-ctype": "For best performance" "ext-ctype": "For best performance"
}, },
@ -665,12 +731,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
] ],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -695,7 +761,7 @@
"portable" "portable"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0"
}, },
"funding": [ "funding": [
{ {
@ -711,20 +777,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-02-19T12:13:01+00:00" "time": "2021-10-20T20:35:02+00:00"
}, },
{ {
"name": "symfony/polyfill-intl-grapheme", "name": "symfony/polyfill-intl-grapheme",
"version": "v1.23.0", "version": "v1.25.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-intl-grapheme.git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git",
"reference": "24b72c6baa32c746a4d0840147c9715e42bb68ab" "reference": "81b86b50cf841a64252b439e738e97f4a34e2783"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/24b72c6baa32c746a4d0840147c9715e42bb68ab", "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783",
"reference": "24b72c6baa32c746a4d0840147c9715e42bb68ab", "reference": "81b86b50cf841a64252b439e738e97f4a34e2783",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -744,12 +810,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Grapheme\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
] ],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Grapheme\\": ""
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -776,7 +842,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.0" "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0"
}, },
"funding": [ "funding": [
{ {
@ -792,11 +858,11 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-27T09:17:38+00:00" "time": "2021-11-23T21:10:46+00:00"
}, },
{ {
"name": "symfony/polyfill-intl-normalizer", "name": "symfony/polyfill-intl-normalizer",
"version": "v1.23.0", "version": "v1.25.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git",
@ -825,12 +891,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
], ],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"classmap": [ "classmap": [
"Resources/stubs" "Resources/stubs"
] ]
@ -860,7 +926,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0"
}, },
"funding": [ "funding": [
{ {
@ -880,21 +946,24 @@
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.23.0", "version": "v1.25.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1" "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2df51500adbaebdc4c38dea4c89a2e131c45c8a1", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825",
"reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1", "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.1"
}, },
"provide": {
"ext-mbstring": "*"
},
"suggest": { "suggest": {
"ext-mbstring": "For best performance" "ext-mbstring": "For best performance"
}, },
@ -909,12 +978,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
] ],
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -940,7 +1009,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.0" "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0"
}, },
"funding": [ "funding": [
{ {
@ -956,20 +1025,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-27T09:27:20+00:00" "time": "2021-11-30T18:21:41+00:00"
}, },
{ {
"name": "symfony/polyfill-php73", "name": "symfony/polyfill-php73",
"version": "v1.23.0", "version": "v1.25.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php73.git", "url": "https://github.com/symfony/polyfill-php73.git",
"reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5",
"reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -986,12 +1055,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php73\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
], ],
"psr-4": {
"Symfony\\Polyfill\\Php73\\": ""
},
"classmap": [ "classmap": [
"Resources/stubs" "Resources/stubs"
] ]
@ -1019,7 +1088,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0"
}, },
"funding": [ "funding": [
{ {
@ -1035,20 +1104,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-02-19T12:13:01+00:00" "time": "2021-06-05T21:20:04+00:00"
}, },
{ {
"name": "symfony/polyfill-php80", "name": "symfony/polyfill-php80",
"version": "v1.23.0", "version": "v1.25.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php80.git", "url": "https://github.com/symfony/polyfill-php80.git",
"reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0" "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/eca0bf41ed421bed1b57c4958bab16aa86b757d0", "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c",
"reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0", "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1065,12 +1134,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
], ],
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"classmap": [ "classmap": [
"Resources/stubs" "Resources/stubs"
] ]
@ -1102,7 +1171,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.23.0" "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0"
}, },
"funding": [ "funding": [
{ {
@ -1118,25 +1187,29 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-02-19T12:13:01+00:00" "time": "2022-03-04T08:16:47+00:00"
}, },
{ {
"name": "symfony/service-contracts", "name": "symfony/service-contracts",
"version": "v2.4.0", "version": "v2.5.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/service-contracts.git", "url": "https://github.com/symfony/service-contracts.git",
"reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", "url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c",
"reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2.5", "php": ">=7.2.5",
"psr/container": "^1.1" "psr/container": "^1.1",
"symfony/deprecation-contracts": "^2.1|^3"
},
"conflict": {
"ext-psr": "<1.1|>=2"
}, },
"suggest": { "suggest": {
"symfony/service-implementation": "" "symfony/service-implementation": ""
@ -1144,7 +1217,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-main": "2.4-dev" "dev-main": "2.5-dev"
}, },
"thanks": { "thanks": {
"name": "symfony/contracts", "name": "symfony/contracts",
@ -1181,7 +1254,7 @@
"standards" "standards"
], ],
"support": { "support": {
"source": "https://github.com/symfony/service-contracts/tree/v2.4.0" "source": "https://github.com/symfony/service-contracts/tree/v2.5.1"
}, },
"funding": [ "funding": [
{ {
@ -1197,20 +1270,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-04-01T10:43:52+00:00" "time": "2022-03-13T20:07:29+00:00"
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v5.3.3", "version": "v5.4.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1" "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1", "url": "https://api.github.com/repos/symfony/string/zipball/92043b7d8383e48104e411bc9434b260dbeb5a10",
"reference": "bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1", "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1221,20 +1294,23 @@
"symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php80": "~1.15" "symfony/polyfill-php80": "~1.15"
}, },
"conflict": {
"symfony/translation-contracts": ">=3.0"
},
"require-dev": { "require-dev": {
"symfony/error-handler": "^4.4|^5.0", "symfony/error-handler": "^4.4|^5.0|^6.0",
"symfony/http-client": "^4.4|^5.0", "symfony/http-client": "^4.4|^5.0|^6.0",
"symfony/translation-contracts": "^1.1|^2", "symfony/translation-contracts": "^1.1|^2",
"symfony/var-exporter": "^4.4|^5.0" "symfony/var-exporter": "^4.4|^5.0|^6.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Component\\String\\": ""
},
"files": [ "files": [
"Resources/functions.php" "Resources/functions.php"
], ],
"psr-4": {
"Symfony\\Component\\String\\": ""
},
"exclude-from-classmap": [ "exclude-from-classmap": [
"/Tests/" "/Tests/"
] ]
@ -1264,7 +1340,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v5.3.3" "source": "https://github.com/symfony/string/tree/v5.4.3"
}, },
"funding": [ "funding": [
{ {
@ -1280,10 +1356,264 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-06-27T11:44:38+00:00" "time": "2022-01-02T09:53:40+00:00"
}
],
"packages-dev": [
{
"name": "n98/junit-xml",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/cmuench/junit-xml.git",
"reference": "0017dd92ac8cb619f02e32f4cffd768cfe327c73"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cmuench/junit-xml/zipball/0017dd92ac8cb619f02e32f4cffd768cfe327c73",
"reference": "0017dd92ac8cb619f02e32f4cffd768cfe327c73",
"shasum": ""
},
"require-dev": {
"phpunit/phpunit": "^9.5.0"
},
"type": "library",
"autoload": {
"psr-4": {
"N98\\JUnitXml\\": "src/N98/JUnitXml"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Münch",
"email": "c.muench@netz98.de"
}
],
"description": "JUnit XML Document generation library",
"support": {
"issues": "https://github.com/cmuench/junit-xml/issues",
"source": "https://github.com/cmuench/junit-xml/tree/1.1.0"
},
"time": "2020-12-25T09:08:58+00:00"
},
{
"name": "overtrue/phplint",
"version": "3.0.6",
"source": {
"type": "git",
"url": "https://github.com/overtrue/phplint.git",
"reference": "b4212c2c65bf50f6c823ab8e7c13c9ead9433241"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/overtrue/phplint/zipball/b4212c2c65bf50f6c823ab8e7c13c9ead9433241",
"reference": "b4212c2c65bf50f6c823ab8e7c13c9ead9433241",
"shasum": ""
},
"require": {
"ext-json": "*",
"n98/junit-xml": "1.1.0",
"php": ">=5.5.9",
"symfony/console": "^3.2|^4.0|^5.0",
"symfony/finder": "^3.0|^4.0|^5.0",
"symfony/process": "^3.3|^4.0|^5.0",
"symfony/yaml": "^3.0|^4.0|^5.0"
},
"require-dev": {
"brainmaestro/composer-git-hooks": "^2.7",
"friendsofphp/php-cs-fixer": "^2.16",
"jakub-onderka/php-console-highlighter": "^0.3.2 || ^0.4"
},
"bin": [
"bin/phplint"
],
"type": "library",
"extra": {
"hooks": {
"pre-commit": [
"composer fix-style"
],
"pre-push": [
"composer check-style"
]
}
},
"autoload": {
"psr-4": {
"Overtrue\\PHPLint\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "overtrue",
"email": "anzhengchao@gmail.com"
}
],
"description": "`phplint` is a tool that can speed up linting of php files by running several lint processes at once.",
"keywords": [
"check",
"lint",
"phplint",
"syntax"
],
"support": {
"issues": "https://github.com/overtrue/phplint/issues",
"source": "https://github.com/overtrue/phplint/tree/3.0.6"
},
"funding": [
{
"url": "https://github.com/overtrue",
"type": "github"
}
],
"time": "2021-11-30T15:45:02+00:00"
},
{
"name": "symfony/process",
"version": "v5.4.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "38a44b2517b470a436e1c944bf9b9ba3961137fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/38a44b2517b470a436e1c944bf9b9ba3961137fb",
"reference": "38a44b2517b470a436e1c944bf9b9ba3961137fb",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/polyfill-php80": "^1.16"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v5.4.7"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-03-18T16:18:52+00:00"
},
{
"name": "symfony/yaml",
"version": "v5.4.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "e80f87d2c9495966768310fc531b487ce64237a2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/e80f87d2c9495966768310fc531b487ce64237a2",
"reference": "e80f87d2c9495966768310fc531b487ce64237a2",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"symfony/console": "<5.3"
},
"require-dev": {
"symfony/console": "^5.3|^6.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"bin": [
"Resources/bin/yaml-lint"
],
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/yaml/tree/v5.4.3"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-01-26T16:32:32+00:00"
} }
], ],
"packages-dev": [],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": { "stability-flags": {
@ -1293,5 +1623,5 @@
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": [],
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.0.0" "plugin-api-version": "2.3.0"
} }

View file

@ -1,6 +1,6 @@
/var/www/eesyphp/data/logs/*.log { /var/www/eesyphp/data/logs/*.log {
daily daily
missingok missingok
rotate 7 rotate 7
sharedscripts sharedscripts
} }

View file

@ -2,37 +2,38 @@
## Dependencies : ## Dependencies :
This Debian packages have to be installed : Some Debian packages have to be installed :
- git *(only for deployment only)* ```bash
- composer (and unzip or zip) apt install git composer php-cli php-mail php-mail-mine php-net-smtp php-auth-sasl php-json php-mbstring php-intl smarty3
- php-cli # for PostgreSQL DB backend
- php-mail apt install php-pgsql
- php-mail-mine # for MySQL/MariaDB DB backend
- php-net-smtp apt install php-mysql
- php-auth-sasl # for sqlite DB backend
- php-json apt install sqlite3 php-sqlite3
- php-mbstring ```
- php-pgsql *(for PostgreSQL DB backend)*
- php-sqlite3 *(for sqlite DB backend, sqlite3 tool (provided by the same name package) is also used to create the DB file)*
- smarty3
## Deployment : ## Deployment :
To deploy this application, for instance in */var/www/eesyphp*, run this commands : To deploy this application, for instance in */var/www/eesyphp*, run this commands :
cd /var/www ```bash
adduser --home /var/www/eesyphp --no-create-home --disabled-password --gid 33 eesyphp cd /var/www
git clone https://gogs.example.org/example/eesyphp.git /var/www/eesyphp adduser --home /var/www/eesyphp --no-create-home --disabled-password --gid 33 eesyphp
chown eesyphp: /var/www/eesyphp git clone https://gogs.example.org/example/eesyphp.git /var/www/eesyphp
ln -s /var/www/eesyphp/bin/items.wrapper /usr/local/bin/eesyphp chown eesyphp: /var/www/eesyphp
ln -s /var/www/eesyphp/docs/eesyphp.cron /etc/cron.d/eesyphp ln -s /var/www/eesyphp/bin/items.wrapper /usr/local/bin/eesyphp
ln -s /var/www/eesyphp/docs/eesyphplogrotate /etc/logrotate.d/eesyphp ln -s /var/www/eesyphp/docs/eesyphp.cron /etc/cron.d/eesyphp
ln -s /var/www/eesyphp/docs/eesyphplogrotate /etc/logrotate.d/eesyphp
```
## Install PHP dependencies : ## Install PHP dependencies :
su - eesyphp ```bash
composer install su - eesyphp
composer install
```
## Initialize database : ## Initialize database :
@ -40,28 +41,33 @@ To deploy this application, for instance in */var/www/eesyphp*, run this command
To initialize SQLite database, run this commands : To initialize SQLite database, run this commands :
cd /var/www/eesyphp/data ```bash
sqlite3 db.sqlite3 < sqlite.init-db.sql cd /var/www/eesyphp/data
sqlite3 db.sqlite3 < sqlite.init-db.sql
```
### PostgreSQL ### PostgreSQL
To initialize PostgreSQL database, run this commands : To initialize PostgreSQL database, run this commands :
su - postgres ```bash
createuser -P items su - postgres
createdb -O items items createuser -P items
psql items < /var/www/eesyphp/data/pgsql.init-db.sql createdb -O items items
psql items < /var/www/eesyphp/data/pgsql.init-db.sql
```
### MariaDB / MySQL ### MariaDB / MySQL
To initialize MariaDB / MySQL database, run this commands : To initialize MariaDB / MySQL database, run this commands :
sudo mysql << EOF ```bash
CREATE DATABASE items; sudo mysql << EOF
GRANT ALL ON items.* TO items@localhost IDENTIFIED BY 'items'; CREATE DATABASE items;
EOF GRANT ALL ON items.* TO items@localhost IDENTIFIED BY 'items';
sudo mysql items < /var/www/eesyphp/data/mariadb-mysql.init-db.sql EOF
sudo mysql items < /var/www/eesyphp/data/mariadb-mysql.init-db.sql
```
## Configure PHP FPM pool : ## Configure PHP FPM pool :
@ -73,7 +79,7 @@ You could configure a dedicated *PHP FPM pool*.
[eesyphp] [eesyphp]
user = eesyphp user = eesyphp
group = www-data group = www-data
listen = /run/php7.0-fpm_eesyphp.sock listen = /run/php/php7.3-fpm-eesyphp.sock
listen.owner = www-data listen.owner = www-data
listen.group = www-data listen.group = www-data
pm = dynamic pm = dynamic
@ -117,7 +123,7 @@ You could configure a dedicated *VirtualHost*.
SSLCertificateKeyFile /etc/letsencrypt/live/eesyphp.example.org/privkey.pem SSLCertificateKeyFile /etc/letsencrypt/live/eesyphp.example.org/privkey.pem
<FilesMatch \.php$> <FilesMatch \.php$>
SetHandler "proxy:unix:/run/php7.0-fpm_eesyphp.sock|fcgi:///" SetHandler "proxy:unix:/run/php/php7.3-fpm-eesyphp.sock|fcgi:///"
</FilesMatch> </FilesMatch>
<Directory /var/www/eesyphp/public_html> <Directory /var/www/eesyphp/public_html>

View file

@ -1,34 +1,35 @@
<?php <?php
$cli_commands=array(); $cli_commands=array();
function add_cli_command($command, $handler, $short_desc, $usage_args=false, $long_desc=false, $override=false) { function add_cli_command($command, $handler, $short_desc, $usage_args=false, $long_desc=false,
global $cli_commands; $override=false) {
if (array_key_exists($command, $cli_commands) && !$override) { global $cli_commands;
logging('ERROR', sprintf(_("The CLI command '%s' already exists.", $command))); if (array_key_exists($command, $cli_commands) && !$override) {
return False; logging('ERROR', _("The CLI command '%s' already exists.", $command));
} return False;
}
if (!is_callable($handler)) { if (!is_callable($handler)) {
logging('ERROR', sprintf(_("The CLI command '%s' handler is not callable !"), $command)); logging('ERROR', _("The CLI command '%s' handler is not callable !"), $command);
return False; return False;
} }
$cli_commands[$command] = array ( $cli_commands[$command] = array (
'handler' => $handler, 'handler' => $handler,
'short_desc' => $short_desc, 'short_desc' => $short_desc,
'usage_args' => $usage_args, 'usage_args' => $usage_args,
'long_desc' => $long_desc, 'long_desc' => $long_desc,
); );
return True; return True;
} }
/* /*
************************************************************************************************************** *************************************************************************************************
* /!\ Code after this message will only be execute on CLI context /!\ * /!\ Code after this message will only be execute on CLI context /!\
************************************************************************************************************** *************************************************************************************************
*/ */
if (php_sapi_name() != "cli") if (php_sapi_name() != "cli")
return true; return true;
// Store current CLI command // Store current CLI command
$cli_command = null; $cli_command = null;
@ -38,105 +39,129 @@ $cli_command = null;
**/ **/
function usage($error=false) { function usage($error=false) {
global $cli_commands, $cli_command, $argv; global $cli_commands, $cli_command, $argv;
if ($error) // If more than 1 arguments passed, format error message using sprintf
echo "$error\n\n"; if (func_num_args() > 1) {
printf(_("Usage: %s [-h] [-qd] command\n"), basename($argv[0])); $error = call_user_func_array(
echo _(" -h Show this message\n"); 'sprintf',
echo _(" -q / -d Quiet/Debug mode\n"); array_merge(array($error), array_slice(func_get_args(), 1))
echo _(" --trace Trace mode (the most verbose)\n"); );
echo _(" command Command to run\n"); }
echo "\n";
echo _("Available commands:\n");
foreach ($cli_commands as $command => $info) { if ($error)
if ($cli_command && $command != $cli_command) echo "$error\n\n";
continue; printf(_("Usage: %s [-h] [-qd] command\n"), basename($argv[0]));
echo " ".str_replace("\n", "\n ", wordwrap("$command : "._($info['short_desc'])))."\n\n"; echo _(" -h Show this message\n");
echo " ".basename($argv[0])." $command ".($info['usage_args']?_($info['usage_args']):'')."\n"; echo _(" -q / -d Quiet/Debug mode\n");
if ($info['long_desc']) { echo _(" --trace Trace mode (the most verbose)\n");
if (is_array($info['long_desc'])) { echo _(" command Command to run\n");
$lines = array(); echo "\n";
foreach ($info['long_desc'] as $line) echo _("Available commands:\n");
$lines[] = _($line);
$info['long_desc'] = implode("\n", $lines);
}
else
$info['long_desc'] = _($info['long_desc']);
echo "\n ".str_replace("\n", "\n ", wordwrap($info['long_desc']))."\n"; foreach ($cli_commands as $command => $info) {
} if ($cli_command && $command != $cli_command)
echo "\n"; continue;
} echo (
" ".str_replace(
"\n", "\n ",
wordwrap("$command : "._($info['short_desc'])))
."\n\n");
echo (
" ".basename($argv[0])." $command ".
($info['usage_args']?_($info['usage_args']):'').
"\n");
if ($info['long_desc']) {
if (is_array($info['long_desc'])) {
$lines = array();
foreach ($info['long_desc'] as $line)
$lines[] = _($line);
$info['long_desc'] = implode("\n", $lines);
}
else
$info['long_desc'] = _($info['long_desc']);
exit(($error?1:0)); echo "\n ".str_replace("\n", "\n ", wordwrap($info['long_desc']))."\n";
}
echo "\n";
}
exit(($error?1:0));
} }
function handle_cli_args() { function handle_cli_args() {
global $log_level, $cli_commands, $cli_command, $argv; global $log_level, $cli_commands, $cli_command, $argv;
$log_level = 'INFO'; $log_level = 'INFO';
$cli_command = false; $cli_command = false;
$command_args = array(); $command_args = array();
for ($i=1; $i < count($argv); $i++) { for ($i=1; $i < count($argv); $i++) {
if (array_key_exists($argv[$i], $cli_commands)) { if (array_key_exists($argv[$i], $cli_commands)) {
if (!$cli_command) if (!$cli_command)
$cli_command = $argv[$i]; $cli_command = $argv[$i];
else else
usage(_("Only one command could be executed !")); usage(_("Only one command could be executed !"));
} }
else { else {
switch($argv[$i]) { switch($argv[$i]) {
case '-h': case '-h':
case '--help': case '--help':
usage(); usage();
break; break;
case '-d': case '-d':
case '--debug': case '--debug':
$log_level = 'DEBUG'; $log_level = 'DEBUG';
break; break;
case '-q': case '-q':
case '--quiet': case '--quiet':
$log_level = 'WARNING'; $log_level = 'WARNING';
break; break;
case '--trace': case '--trace':
$log_level = 'TRACE'; $log_level = 'TRACE';
break; break;
default: default:
if ($cli_command) if ($cli_command)
$command_args[] = $argv[$i]; $command_args[] = $argv[$i];
else else
usage( usage(
sprintf(_("Invalid parameter \"%s\".\nNote: Command's parameter/argument must be place after the command."), $argv[$i]) _(
); "Invalid parameter \"%s\".\nNote: Command's parameter/argument must be place ".
} "after the command."
} ), $argv[$i]
} );
}
}
}
if (!$cli_command) if (!$cli_command)
usage(); usage();
logging('DEBUG', 'Run '.basename($argv[0])." command $cli_command with argument(s) '".implode("', '", $command_args)."'"); logging(
'DEBUG', "Run %s command %s with argument(s) '%s'.",
basename($argv[0]), $cli_command, implode("', '", $command_args)
);
try { try {
$result = call_user_func($cli_commands[$cli_command]['handler'], $command_args); $result = call_user_func($cli_commands[$cli_command]['handler'], $command_args);
exit($result?0:1); exit($result?0:1);
} }
catch(Exception $e) { catch(Exception $e) {
log_exception(sprintf(_("An exception occured running command %s"), $cli_command)); log_exception($e, _("An exception occured running command %s"), $cli_command);
exit(1); exit(1);
} }
} }
function print_item_info($item) { function print_item_info($item) {
printf(_("Item #%s:\n"), $item['id']); printf(_("Item #%s:\n"), $item['id']);
printf("\t"._("ID: %s")."\n", $item['id']); printf("\t"._("ID: %s")."\n", $item['id']);
printf("\t"._("Name: '%s'")."\n", $item['name']); printf("\t"._("Name: '%s'")."\n", $item['name']);
printf("\t"._("Date: %s")."\n", format_time($item['date'])); printf("\t"._("Date: %s")."\n", format_time($item['date']));
printf("\t"._("Description: %s")."\n", ($item['description']?"'".$item['description']."'":_("Not set"))); printf(
printf("\t"._("Status: %s")."\n", $item['status']); "\t"._("Description: %s")."\n",
return true; ($item['description']?"'".$item['description']."'":_("Not set"))
);
printf("\t"._("Status: %s")."\n", $item['status']);
return true;
} }
@ -146,423 +171,248 @@ function print_item_info($item) {
$orderbys = array('id', 'name', 'date', 'status', 'description'); $orderbys = array('id', 'name', 'date', 'status', 'description');
function cli_list($command_args) { function cli_list($command_args) {
global $orderbys; global $orderbys;
$params = array( $params = array(
'order' => $orderbys[0], 'order' => $orderbys[0],
'order_direction' => 'ASC', 'order_direction' => 'ASC',
'all' => true, 'all' => true,
); );
$patterns = array(); $patterns = array();
for($i=0; $i < count($command_args); $i++) { for($i=0; $i < count($command_args); $i++) {
switch($command_args[$i]) { switch($command_args[$i]) {
case '-o': case '-o':
case '--orderby': case '--orderby':
$i++; $i++;
if(!in_array($command_args[$i], $orderbys)) if(!in_array($command_args[$i], $orderbys))
usage('Invalid --orderby clause'); usage('Invalid --orderby clause');
$params['order'] = $command_args[$i]; $params['order'] = $command_args[$i];
break; break;
case '-r': case '-r':
case '--reverse': case '--reverse':
$params['order_direction'] = 'DESC'; $params['order_direction'] = 'DESC';
break; break;
case '-s': case '-s':
case '--status': case '--status':
$i++; $i++;
if(!check_status($command_args[$i])) if(!check_status($command_args[$i]))
usage('Invalid -s/--status clause'); usage('Invalid -s/--status clause');
$params['status'] = $command_args[$i]; $params['status'] = $command_args[$i];
break; break;
default: default:
$patterns[] = $command_args[$i]; $patterns[] = $command_args[$i];
} }
} }
if (!empty($patterns)) if (!empty($patterns))
$params['pattern'] = implode(' ', $patterns); $params['pattern'] = implode(' ', $patterns);
$items = search_items($params); $items = search_items($params);
if (!is_array($items)) { if (!is_array($items)) {
logging("ERROR", "Invalid DB info return.\n"); logging("ERROR", "Invalid DB info return.\n");
return False; return False;
} }
if ($items['count'] == 0){ if ($items['count'] == 0){
echo _("No item.\n"); echo _("No item.\n");
return True; return True;
} }
$tbl = new Console_Table(); $tbl = new Console_Table();
$tbl->setHeaders( $tbl->setHeaders(
array( array(
'ID', 'ID',
'Name', 'Name',
'Date', 'Date',
'Status', 'Status',
'Description', 'Description',
) )
); );
foreach($items['items'] as $info) { foreach($items['items'] as $info) {
$tbl->addRow( $tbl->addRow(
array( array(
$info['id'], $info['id'],
$info['name'], $info['name'],
format_time($info['date']), format_time($info['date']),
$info['status'], $info['status'],
($info['description']?$info['description']:''), ($info['description']?$info['description']:''),
) )
); );
} }
echo $tbl->getTable(); echo $tbl->getTable();
echo "\n".sprintf(_("%d item(s)"), $items['count'])."\n"; echo "\n".sprintf(_("%d item(s)"), $items['count'])."\n";
return True; return True;
} }
add_cli_command( add_cli_command(
'list', 'list',
'cli_list', 'cli_list',
___("List/search items"), ___("List/search items"),
___("[patterns]"), ___("[patterns]"),
array( array(
___("-o|--orderby Ordering list criterion. Possible values:"), ___("-o|--orderby Ordering list criterion. Possible values:"),
" - ".implode("\n - ", $orderbys), " - ".implode("\n - ", $orderbys),
___("-r|--reverse Reverse order"), ___("-r|--reverse Reverse order"),
___("-s|--status Filter on status. Possible values:"), ___("-s|--status Filter on status. Possible values:"),
" - ".implode("\n - ", array_keys($status_list)), " - ".implode("\n - ", array_keys($status_list)),
) )
); );
function cli_show($command_args) { function cli_show($command_args) {
if (count($command_args) != 1 || !check_id($command_args[0])) if (count($command_args) != 1 || !check_id($command_args[0]))
usage(_('You must provide a valid ID.')); usage(_('You must provide a valid ID.'));
$item_id = $command_args[0]; $item_id = $command_args[0];
$item = get_item($item_id); $item = get_item($item_id);
if (!$item) if (!$item)
logging('FATAL', sprintf(_("Item #%s not found."), $item_id)); logging('FATAL', _("Item #%s not found."), $item_id);
print_item_info($item); print_item_info($item);
return True; return True;
} }
add_cli_command( add_cli_command(
'show', 'show',
'cli_show', 'cli_show',
___("Show item"), ___("Show item"),
___("[ID]") ___("[ID]")
); );
function cli_delete($command_args) { function cli_delete($command_args) {
if (count($command_args) != 1) if (count($command_args) != 1)
usage(_('You must provide item ID.')); usage(_('You must provide item ID.'));
// Check URI // Check URI
if (!check_id($command_args[0])) if (!check_id($command_args[0]))
logging('FATAL', _("Invalid item ID")); logging('FATAL', _("Invalid item ID"));
// Check exist // Check exist
$item_id = $command_args[0]; $item_id = $command_args[0];
$item = get_item($item_id); $item = get_item($item_id);
if (!$item) if (!$item)
logging('FATAL', sprintf(_("Item #%s not found."), $item_id)); logging('FATAL', _("Item #%s not found."), $item_id);
print_item_info($item); print_item_info($item);
// Sure ? // Sure ?
echo _("Are you sure you want to delete this item? Type 'yes' to continue: "); echo _("Are you sure you want to delete this item? Type 'yes' to continue: ");
$handle = fopen ("php://stdin","r"); $handle = fopen ("php://stdin","r");
$line = fgets($handle); $line = fgets($handle);
if(trim($line) != 'yes'){ if(trim($line) != 'yes'){
logging('WARNING', _("User cancel")); logging('WARNING', _("User cancel"));
exit; exit;
} }
echo "\n"; echo "\n";
if (!delete_item($item['id'])) if (!delete_item($item['id']))
logging('FATAL', sprintf(_("An error occured deleting item #%d."), $item_id)); logging('FATAL', _("An error occured deleting item #%d."), $item_id);
return True; return True;
} }
add_cli_command( add_cli_command(
'delete', 'delete',
'cli_delete', 'cli_delete',
___("Delete item"), ___("Delete item"),
___("[item ID]") ___("[item ID]")
); );
function cli_export($command_args) { function cli_export($command_args) {
$fd = fopen((count($command_args) >= 1?$command_args[0]:'php://output'), 'w'); $fd = fopen((count($command_args) >= 1?$command_args[0]:'php://output'), 'w');
export_items($fd); export_items($fd);
fclose($fd); fclose($fd);
logging('INFO', "Items export to '".(count($command_args) >= 1?$command_args[0]:'STDOUT')."'."); logging('INFO', "Items export to '".(count($command_args) >= 1?$command_args[0]:'STDOUT')."'.");
} }
add_cli_command( add_cli_command(
'export', 'export',
'cli_export', 'cli_export',
___("Export items (as CSV)"), ___("Export items (as CSV)"),
___("[output file path]") ___("[output file path]")
); );
function cli_restore($command_args) { function cli_restore($command_args) {
$fd = fopen((count($command_args) >= 1?$command_args[0]:'php://stdin'), 'r'); $fd = fopen((count($command_args) >= 1?$command_args[0]:'php://stdin'), 'r');
restore_items($fd); restore_items($fd);
fclose($fd); fclose($fd);
logging('INFO', "Items restored from '".(count($command_args) >= 1?$command_args[0]:'STDIN')."'."); logging('INFO', sprint(
"Items restored from '%s'",
(count($command_args) >= 1?$command_args[0]:'STDIN')
));
} }
add_cli_command( add_cli_command(
'restore', 'restore',
'cli_restore', 'cli_restore',
___("Restore items (from CSV)"), ___("Restore items (from CSV)"),
___("[input file path]") ___("[input file path]")
); );
function cli_cron($command_args) { function cli_cron($command_args) {
global $item_max_age; global $item_max_age;
if (!isset($item_max_age)) if (!isset($item_max_age))
$item_max_age = 30; $item_max_age = 30;
$just_try = false; $just_try = false;
for($i=0; $i < count($command_args); $i++) { for($i=0; $i < count($command_args); $i++) {
switch($command_args[$i]) { switch($command_args[$i]) {
case '-m': case '-m':
case '--max-age': case '--max-age':
$i++; $i++;
if(!check_id($command_args[$i])) if(!check_id($command_args[$i]))
usage('Invalid -m|--max-age clause'); usage('Invalid -m|--max-age clause');
$item_max_age = $command_args[$i]; $item_max_age = $command_args[$i];
break; break;
case '-j': case '-j':
case '--just-try': case '--just-try':
$just_try = true; $just_try = true;
break; break;
default: default:
usage('Invalid parameter '.$command_args[$i]); usage('Invalid parameter '.$command_args[$i]);
} }
}
if (!is_int($item_max_age) || $item_max_age <= 0)
logging('FATAL', 'Invalid $item_max_age value set in configuration: it\'s must be a positive integer.');
logging('DEBUG', "cli_cron(): item max age = $item_max_age day(s)");
$limit = time() - ($item_max_age * 86400);
logging('DEBUG', "Handle items expiration with creation date limit ".format_time($limit).".");
$items = search_items(array('all' => true));
$error = false;
foreach($items['items'] as $item) {
if ($item['date'] < $limit) {
if ($just_try) {
logging('DEBUG', 'Just-try mode: do not really delete item #'.$item['id'].' ('.$item['name'].', creation date: '.format_time($item['date']).')');
}
else if (delete_item($item['id'])) {
logging('INFO', 'item #'.$item['id'].' ('.$item['name'].') deleted (creation date: '.format_time($item['date']).')');
remove_item_attachments($item['id']);
}
else {
logging('ERROR', 'Fail to delete item "'.$item['id'].'" ('.$item['name'].', creation date: '.format_time($item['date']).')');
$error = true;
}
}
else {
logging('DEBUG', 'item "'.$item['id'].'" ('.$item['name'].') still valid (creation date: '.format_time($item['date']).')');
}
}
exit($error?1:0);
}
add_cli_command(
'cron',
'cli_cron',
___("Cron to handle item expiration"),
false,
array (
___("-j/--just-try Just-try mode : do not really removed expired item(s)"),
___("-m/--max-age Item expiration limit (in days, optional)"),
)
);
function cli_extract_messages($command_args) {
global $root_dir_path, $root_lang_dir, $smarty_templates_dir;
// List PHP files to parse
$php_files = run_external_command(
array('find', escapeshellarg($root_dir_path), '-name', "'*.php'"),
null, // no STDIN data
false // do not escape command args (already done)
);
if (!is_array($php_files) || $php_files[0] != 0) {
logging('FATAL', _("Fail to list PHP files."));
} }
// Extract messages from PHP files using xgettext if (!is_int($item_max_age) || $item_max_age <= 0)
$result = run_external_command(
array(
"xgettext",
"--from-code utf-8",
"--language=PHP",
"-o", "$root_lang_dir/php-messages.pot", // Output
"--omit-header", // No POT header
"--keyword=___", // Handle custom ___() translation function
"--files=-" // Read files to parse from STDIN
),
$php_files[1] // Pass PHP files list via STDIN
);
if (!is_array($result) || $result[0] != 0)
logging('FATAL', _("Fail to extract messages from PHP files using xgettext."));
// Extract messages from templates files using tsmarty2c.php
$result = run_external_command(
array (
"$root_dir_path/vendor/bin/tsmarty2c.php",
"-o", "$root_lang_dir/templates-messages.pot",
$smarty_templates_dir,
)
);
if (!is_array($result) || $result[0] != 0)
logging('FATAL', _("Fail to extract messages from template files using tsmarty2c.php script."));
// Merge previous results in ldapsaisie.pot file using msgcat
$result = run_external_command(array(
'msgcat',
"$root_lang_dir/php-messages.pot",
"$root_lang_dir/templates-messages.pot",
"-o", "$root_lang_dir/messages.pot",
));
if (!is_array($result) || $result[0] != 0)
logging('FATAL', _("Fail to merge messages using msgcat."));
}
add_cli_command(
'extract_messages',
'cli_extract_messages',
___("Extract messages that need to be translated"),
null,
___("This command could be used to generate/update lang/messages.pot file.")
);
function cli_update_messages($command_args) {
global $root_dir_path, $root_lang_dir, $smarty_templates_dir;
$pot_file = "$root_lang_dir/messages.pot";
if (!is_file($pot_file))
logging( logging(
'FATAL', sprintf( 'FATAL',
_("POT file not found (%s). Please run extract_messages first."), 'Invalid $item_max_age value set in configuration: it\'s must be a positive integer.');
$pot_file logging('DEBUG', "cli_cron(): item max age = $item_max_age day(s)");
)
);
if ($dh = opendir($root_lang_dir)) { $limit = time() - ($item_max_age * 86400);
$error = False; logging('DEBUG', "Handle items expiration with creation date limit ".format_time($limit).".");
while (($file = readdir($dh)) !== false) {
if (!is_dir($root_lang_dir . '/' . $file) || in_array($file, array('.', '..')) || is_link($root_lang_dir . '/' . $file))
continue;
logging('DEBUG', sprintf(_("Lang directory '%s' found"), $file)); $items = search_items(array('all' => true));
$error = false;
// Check LC_MESSAGES directory exists foreach($items['items'] as $item) {
$lang = $file; if ($item['date'] < $limit) {
$lang_dir = $root_lang_dir . '/' . $file . '/LC_MESSAGES' ; if ($just_try) {
if (!is_dir($lang_dir)) { logging('DEBUG', 'Just-try mode: do not really delete item #%s (%s, creation date: %s)',
logging('DEBUG', sprintf( $item['id'], $item['name'], format_time($item['date'])
_("LC_MESSAGES directory not found in lang '%s' directory, ignore it."),
$lang)
); );
continue;
} }
else if (delete_item($item['id'])) {
// Test .PO file is present logging('INFO', 'Item #%s (%s) deleted (creation date: %s)',
$po_file = $lang_dir . '/' . TEXT_DOMAIN . '.po'; $item['id'], $item['name'], format_time($item['date'])
if (!is_file($po_file)) {
logging('DEBUG', sprintf(
_("PO file not found in lang '%s' directory, ignore it."),
$lang)
); );
continue; remove_item_attachments($item['id']);
} }
else {
// Update messages in PO file from POT file using msgmerge logging('ERROR', 'Fail to delete item "%s" (%s, creation date: %s)',
$result = run_external_command( $item['id'], $item['name'], format_time($item['date'])
array("msgmerge", "-q", "-U", $po_file, $pot_file)
);
if (!is_array($result) || $result[0] != 0) {
logging('ERROR', sprintf(
_("Fail to update messages in %s PO file using msgmerge (%s)."),
$lang, $po_file)
); );
$error = True; $error = true;
} }
} }
closedir($dh); else {
return !$error; logging('DEBUG', 'Item "%s" (%s) still valid (creation date: %s)',
} $item['id'], $item['name'], format_time($item['date'])
logging('FATAL', sprintf(_("Fail to open root lang directory (%s)."), $root_dir_path));
}
add_cli_command(
'update_messages',
'cli_update_messages',
___("Update messages in existing translation PO lang files"),
null,
___("This command could be used to update PO files in lang/*/LC_MESSAGES directories.")
);
function cli_compile_messages($command_args) {
global $root_dir_path, $root_lang_dir, $smarty_templates_dir;
if ($dh = opendir($root_lang_dir)) {
$error = False;
while (($file = readdir($dh)) !== false) {
if (!is_dir($root_lang_dir . '/' . $file) || in_array($file, array('.', '..')) || is_link($root_lang_dir . '/' . $file))
continue;
logging('DEBUG', sprintf(_("Lang directory '%s' found"), $file));
// Check LC_MESSAGES directory exists
$lang = $file;
$lang_dir = $root_lang_dir . '/' . $file . '/LC_MESSAGES' ;
if (!is_dir($lang_dir)) {
logging('DEBUG', sprintf(
_("LC_MESSAGES directory not found in lang '%s' directory, ignore it."),
$lang)
);
continue;
}
// Test .PO file is present
$po_file = $lang_dir . '/' . TEXT_DOMAIN . '.po';
if (!is_file($po_file)) {
logging('DEBUG', sprintf(
_("PO file not found in lang '%s' directory, ignore it."),
$lang)
);
continue;
}
$mo_file = preg_replace('/\.po$/', '.mo', $po_file);
// Compile messages from PO file to MO file using msgfmt
$result = run_external_command(
array("msgfmt", "-o", $mo_file, $po_file)
); );
if (!is_array($result) || $result[0] != 0) {
logging('ERROR', sprintf(
_("Fail to compile messages from %s PO file as MO file using msgfmt (%s)."),
$lang, $po_file)
);
$error = True;
}
} }
closedir($dh);
return !$error;
} }
exit($error?1:0);
logging('FATAL', sprintf(_("Fail to open root lang directory (%s)."), $root_dir_path));
} }
add_cli_command( add_cli_command(
'compile_messages', 'cron',
'cli_compile_messages', 'cli_cron',
___("Compile messages from existing translation PO lang files to corresponding MO files"), ___("Cron to handle item expiration"),
null, false,
___("This command could be used to compile PO files in lang/*/LC_MESSAGES directories to MO files.") array (
___("-j/--just-try Just-try mode : do not really removed expired item(s)"),
___("-m/--max-age Item expiration limit (in days, optional)"),
)
); );

View file

@ -44,8 +44,8 @@ $smarty_templates_c_dir = "$tmp_root_dir/templates_c";
$default_locale = 'en_US.UTF8'; $default_locale = 'en_US.UTF8';
// Session // Session
$session_timeout = 1800; // Session timeout dur to inactivity (in seconds) $session_timeout = 1800; // Session timeout dur to inactivity (in seconds)
$session_max_duration = 43200; // Session max duration (in seconds, default : 12h) $session_max_duration = 43200; // Session max duration (in seconds, default : 12h)
/** /**
* Database configuration * Database configuration
@ -69,8 +69,8 @@ $db_pwd="items";
$db_options=array(); $db_options=array();
// Date/Datetime format in database (strptime format) // Date/Datetime format in database (strptime format)
$db_date_format = '%Y-%m-%d'; // Exemple : 2018-10-12 $db_date_format = '%Y-%m-%d'; // Exemple : 2018-10-12
$db_datetime_format = '%Y-%m-%d %H:%M:%S'; // Exemple : 2018-10-12 18:06:59 $db_datetime_format = '%Y-%m-%d %H:%M:%S'; // Exemple : 2018-10-12 18:06:59
*/ */
/* /*
@ -81,8 +81,8 @@ $db_pwd="items";
$db_options=array(); $db_options=array();
// Date/Datetime format in database (strptime format) // Date/Datetime format in database (strptime format)
$db_date_format = '%Y-%m-%d'; // Exemple : 2018-10-12 $db_date_format = '%Y-%m-%d'; // Exemple : 2018-10-12
$db_datetime_format = '%Y-%m-%d %H:%M:%S'; // Exemple : 2018-10-12 18:06:59 $db_datetime_format = '%Y-%m-%d %H:%M:%S'; // Exemple : 2018-10-12 18:06:59
*/ */
/* /*
@ -118,5 +118,5 @@ $mail_catch_all = false;
// Load local configuration file is present // Load local configuration file is present
if (is_file("$root_dir_path/includes/config.local.php")) { if (is_file("$root_dir_path/includes/config.local.php")) {
require "$root_dir_path/includes/config.local.php"; require "$root_dir_path/includes/config.local.php";
} }

View file

@ -4,13 +4,13 @@ error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
// Root directory path // Root directory path
if (__FILE__ != "") { if (__FILE__ != "") {
$script = __FILE__; $script = __FILE__;
} }
else { else {
// Fallback method : detect path from core.php path // Fallback method : detect path from core.php path
foreach(get_included_files() as $script) foreach(get_included_files() as $script)
if (basename($script) == 'core.php') if (basename($script) == 'core.php')
break; break;
} }
$root_dir_path=realpath(dirname($script).'/../'); $root_dir_path=realpath(dirname($script).'/../');
@ -29,7 +29,7 @@ require_once('config.inc.php');
// Check $public_root_url end // Check $public_root_url end
if (substr($public_root_url, -1)=='/') { if (substr($public_root_url, -1)=='/') {
$public_root_url=substr($public_root_url, 0, -1); $public_root_url=substr($public_root_url, 0, -1);
} }
// Define upload_tmp_dir // Define upload_tmp_dir
@ -49,6 +49,7 @@ $status_list = array (
require_once('hooks.php'); require_once('hooks.php');
require_once('cli.php'); require_once('cli.php');
require_once('translation-cli.php');
require_once('smarty.php'); require_once('smarty.php');
require_once('url.php'); require_once('url.php');
require_once('url-helpers.php'); require_once('url-helpers.php');
@ -58,4 +59,4 @@ require_once('mail.php');
// Initialize translation // Initialize translation
init_translation(); init_translation();
foreach($status_list as $key => $value) foreach($status_list as $key => $value)
$status_list[$key] = _($value); $status_list[$key] = _($value);

View file

@ -182,15 +182,15 @@ function update_item($id, $changes) {
} }
function change_item_status($id, $status) { function change_item_status($id, $status) {
if (update_item($id, array('status' => $status))) { if (update_item($id, array('status' => $status))) {
logging('INFO', "Status of item #$id changed to $status."); logging('INFO', "Status of item #$id changed to $status.");
return true; return true;
} }
return false; return false;
} }
function archive_item($id) { function archive_item($id) {
return change_item_status($id, 'archived'); return change_item_status($id, 'archived');
} }
function delete_item($id) { function delete_item($id) {
@ -285,7 +285,13 @@ function search_items($params) {
if (!empty($where)) if (!empty($where))
$query -> where($where); $query -> where($where);
foreach ($patterns_where as $patterns_word) foreach ($patterns_where as $patterns_word)
call_user_func_array(array($query, 'where'), array_merge(array('('.implode(' OR ', array_keys($patterns_word)).')'), array_values($patterns_word))); call_user_func_array(
array($query, 'where'),
array_merge(
array('('.implode(' OR ', array_keys($patterns_word)).')'),
array_values($patterns_word)
)
);
$result = $query -> orderBy($orderby) $result = $query -> orderBy($orderby)
-> limit($limit) -> limit($limit)
-> offset($offset) -> offset($offset)
@ -315,7 +321,13 @@ function search_items($params) {
if (!empty($where)) if (!empty($where))
$query_count -> where($where); $query_count -> where($where);
foreach ($patterns_where as $patterns_word) foreach ($patterns_where as $patterns_word)
call_user_func_array(array($query_count, 'where'), array_merge(array('('.implode(' OR ', array_keys($patterns_word)).')'), array_values($patterns_word))); call_user_func_array(
array($query_count, 'where'),
array_merge(
array('('.implode(' OR ', array_keys($patterns_word)).')'),
array_values($patterns_word)
)
);
$result_count = $query_count -> execute(); $result_count = $query_count -> execute();
@ -327,7 +339,9 @@ function search_items($params) {
return array( return array(
'count' => $count['count'], 'count' => $count['count'],
'first' => $offset+1, 'first' => $offset+1,
'last' => ($offset+$nb_by_page<$count['count']?$offset+$nb_by_page:$count['count']), 'last' => (
$offset+$nb_by_page<$count['count']?
$offset+$nb_by_page:$count['count']),
'nb_pages' => ceil($count['count']/$nb_by_page), 'nb_pages' => ceil($count['count']/$nb_by_page),
'page' => $page, 'page' => $page,
'items' => $items, 'items' => $items,
@ -339,103 +353,111 @@ function search_items($params) {
logging('ERROR', 'search_items() : search in DB return false'); logging('ERROR', 'search_items() : search in DB return false');
} }
catch (Exception $e) { catch (Exception $e) {
log_exception($e, "An exception occured searching items with params ".preg_replace("/\n[ \t]*/"," ",print_r($params,1))." infos from database : "); log_exception(
$e, "An exception occured searching items with params %s infos from database : ",
preg_replace("/\n[ \t]*/", " ", print_r($params, true))
);
} }
return false; return false;
} }
function export_items($fd=null) { function export_items($fd=null) {
if (!$fd) $fd = fopen('php://output', 'w'); if (!$fd) $fd = fopen('php://output', 'w');
fputcsv( fputcsv(
$fd, $fd,
array ( array (
'id', 'id',
'name', 'name',
'date', 'date',
'status', 'status',
'description', 'description',
) )
); );
$items = get_items(); $items = get_items();
foreach($items as $item) { foreach($items as $item) {
fputcsv( fputcsv(
$fd, $fd,
array( array(
$item['id'], $item['id'],
$item['name'], $item['name'],
$item['date'], $item['date'],
$item['status'], $item['status'],
$item['description'], $item['description'],
) )
); );
} }
return True; return True;
} }
function restore_items($fd=null) { function restore_items($fd=null) {
global $fpdo; global $fpdo;
if (!$fd) $fd = fopen('php://stdin', 'r'); if (!$fd) $fd = fopen('php://stdin', 'r');
try { try {
$result = $fpdo -> deleteFrom('item') $result = $fpdo -> deleteFrom('item')
-> execute(); -> execute();
if ($result === false) { if ($result === false) {
logging('ERROR', "An unknown error occured truncating item table in database."); logging('ERROR', "An unknown error occured truncating item table in database.");
return false; return false;
} }
} }
catch (Exception $e) { catch (Exception $e) {
logging('ERROR', "Error truncating item table in database : ".$e->getMessage()); logging('ERROR', "Error truncating item table in database : ".$e->getMessage());
return false; return false;
} }
$first_row = false; $first_row = false;
$line = 0; $line = 0;
$restored = 0; $restored = 0;
$error = false; $error = false;
$datetime_fields = array ( $datetime_fields = array (
'date', 'date',
); );
// Map fields to support hold CSV files format // Map fields to support hold CSV files format
$mapping = array ( $mapping = array (
'creation_date' => 'date', 'creation_date' => 'date',
'desc' => 'description', 'desc' => 'description',
); );
while (($row = fgetcsv($fd)) !== FALSE) { while (($row = fgetcsv($fd)) !== FALSE) {
$line++; $line++;
if ($first_row === false) { if ($first_row === false) {
$first_row = $row; $first_row = $row;
continue; continue;
} }
try { try {
$values = array(); $values = array();
for ($i=0; $i < count($first_row); $i++) { for ($i=0; $i < count($first_row); $i++) {
if (!$row[$i]) continue; if (!$row[$i]) continue;
$field = (array_key_exists($first_row[$i], $mapping)?$mapping[$first_row[$i]]:$first_row[$i]); $field = (
$value = (in_array($field, $datetime_fields)?db_time2datetime($row[$i]):$row[$i]); array_key_exists($first_row[$i], $mapping)?
$values[$field] = $value; $mapping[$first_row[$i]]:
} $first_row[$i]);
$result = $fpdo -> insertInto('item') $value = (in_array($field, $datetime_fields)?db_time2datetime($row[$i]):$row[$i]);
-> values($values) $values[$field] = $value;
-> execute(); }
$result = $fpdo -> insertInto('item')
-> values($values)
-> execute();
if ($result !== false) { if ($result !== false) {
$restored++; $restored++;
} }
else { else {
logging('ERROR', "Unkwown error occured restoring item from line #$line :\n".print_r($values, true)); logging('ERROR', "Unkwown error occured restoring item from line #$line :\n".print_r($values, true));
$error = true; $error = true;
} }
} }
catch (Exception $e) { catch (Exception $e) {
logging('ERROR', "Error restoring item from line #$line : ".$e->getMessage()."\n".print_r($values, true)); logging(
$error = true; 'ERROR',
} "Error restoring item from line #$line : ".$e->getMessage()."\n".print_r($values, true));
} $error = true;
logging('INFO', "$restored items restored"); }
}
logging('INFO', "$restored items restored");
// Trigger hooks // Trigger hooks
trigger_hook('items_restored'); trigger_hook('items_restored');
return !$error; return !$error;
} }

View file

@ -83,7 +83,8 @@ function check_email($value, $domain=NULL, $checkDns=true) {
/* /*
* Handling item POST data * Handling item POST data
*/ */
function handle_item_post_data(&$info, $enabled_fields=null, $required_fields=null, &$item=null, &$changes=null) { function handle_item_post_data(&$info, $enabled_fields=null, $required_fields=null, &$item=null,
&$changes=null) {
$field_errors=array(); $field_errors=array();
if (isset($_POST['submit'])) { if (isset($_POST['submit'])) {
logging('DEBUG', 'POST data : '.vardump($_POST)); logging('DEBUG', 'POST data : '.vardump($_POST));
@ -113,7 +114,10 @@ function handle_item_post_data(&$info, $enabled_fields=null, $required_fields=nu
} }
// description // description
if (isset($_POST['description']) && (!$enabled_fields || in_array('description', $enabled_fields))) { if (
isset($_POST['description']) &&
(!$enabled_fields || in_array('description', $enabled_fields))
) {
if (check_is_empty(trim($_POST['description']))) { if (check_is_empty(trim($_POST['description']))) {
$info['description'] = null; $info['description'] = null;
} }
@ -221,132 +225,143 @@ function can_do($item, $status=array()) {
* Generic Data/value helpers * Generic Data/value helpers
*/ */
function vardump($data) { function vardump($data) {
ob_start(); ob_start();
var_dump($data); var_dump($data);
$data = ob_get_contents(); $data = ob_get_contents();
ob_end_clean(); ob_end_clean();
return $data; return $data;
} }
function check_is_empty($val) { function check_is_empty($val) {
switch(gettype($val)) { switch(gettype($val)) {
case "boolean": case "boolean":
case "integer": case "integer":
case "double": case "double":
case "object": case "object":
case "resource": case "resource":
return False; return False;
case "array": case "array":
case "string": case "string":
if ($val == "0") return false; if ($val == "0") return false;
return empty($val); return empty($val);
case "NULL": case "NULL":
return True; return True;
} }
} }
/* /*
* Generic file/directory helpers * Generic file/directory helpers
*/ */
function dump_file($file_path, $max_age=3600) { function dump_file($file_path, $max_age=3600) {
if (is_file($file_path)) { if (is_file($file_path)) {
header('Content-Type: '.mime_content_type($file_path)); header('Content-Type: '.mime_content_type($file_path));
$last_modified_time = filemtime($file_path); $last_modified_time = filemtime($file_path);
$etag = md5_file($file_path); $etag = md5_file($file_path);
header("Cache-Control: max-age=$max_age, must-revalidate"); header("Cache-Control: max-age=$max_age, must-revalidate");
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $last_modified_time)." GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s", $last_modified_time)." GMT");
header("Etag: $etag"); header("Etag: $etag");
if ((isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && @strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time) || (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag)) { if (
header("HTTP/1.1 304 Not Modified"); (
exit(); isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
} @strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time
) || (
isset($_SERVER['HTTP_IF_NONE_MATCH']) &&
trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag
)
) {
header("HTTP/1.1 304 Not Modified");
exit();
}
header('Pragma: public'); header('Pragma: public');
header('Content-Length: ' . filesize($file_path)); header('Content-Length: ' . filesize($file_path));
readfile($file_path); readfile($file_path);
exit(); exit();
} }
header("HTTP/1.1 404 Not found"); header("HTTP/1.1 404 Not found");
exit(); exit();
} }
function delete_directory($dir, $recursive=true) { function delete_directory($dir, $recursive=true) {
$files = array_diff(scandir($dir), array('.','..')); $files = array_diff(scandir($dir), array('.','..'));
if ($recursive) { if ($recursive) {
foreach ($files as $file) { foreach ($files as $file) {
if (is_dir("$dir/$file")) { if (is_dir("$dir/$file")) {
if (!delete_directory("$dir/$file", true)) { if (!delete_directory("$dir/$file", true)) {
logging('ERROR', "delete_directory($dir) : Fail to delete sub-directory '$dir/$file'."); logging('ERROR', "delete_directory($dir) : Fail to delete sub-directory '$dir/$file'.");
return false; return false;
} }
} }
else if (!unlink("$dir/$file")) { else if (!unlink("$dir/$file")) {
logging('ERROR', "delete_directory($dir) : Fail to delete '$dir/$file'."); logging('ERROR', "delete_directory($dir) : Fail to delete '$dir/$file'.");
return false; return false;
} }
} }
} }
else if (!empty($files)) { else if (!empty($files)) {
logging('ERROR', "delete_directory($dir) : Directory is not empty."); logging('ERROR', "delete_directory($dir) : Directory is not empty.");
return false; return false;
} }
return rmdir($dir); return rmdir($dir);
} }
/* /*
* Run external command helper * Run external command helper
*/ */
/** /**
* Run external command * Run external command
* *
* @param[in] $command string|array The command. It's could be an array of the command with its arguments. * @param $command string|array The command. It's could be an array of the command with its
* @param[in] $data_stdin string|null The command arguments (optional, default: null) * arguments.
* @param[in] $escape_command_args boolean If true, the command will be escaped (optional, default: true) * @param $data_stdin string|null The command arguments (optional, default: null)
* * @param $escape_command_args boolean If true, the command will be escaped
* @retval false|array An array of return code, stdout and stderr result or False in case of fatal error * (optional, default: true)
**/ *
function run_external_command($command, $data_stdin=null, $escape_command_args=true) { * @return false|array An array of return code, stdout and stderr result or False in case of fatal
if (array($command)) * error
$command = implode(' ', $command); **/
if ($escape_command_args) function run_external_command($command, $data_stdin=null, $escape_command_args=true) {
$command = escapeshellcmd($command); if (array($command))
logging('DEBUG', "Run external command: '$command'"); $command = implode(' ', $command);
$descriptorspec = array( if ($escape_command_args)
0 => array("pipe", "r"), // stdin $command = escapeshellcmd($command);
1 => array("pipe", "w"), // stdout logging('DEBUG', "Run external command: '$command'");
2 => array("pipe", "w"), // stderr $descriptorspec = array(
); 0 => array("pipe", "r"), // stdin
$process = proc_open($command, $descriptorspec, $pipes); 1 => array("pipe", "w"), // stdout
2 => array("pipe", "w"), // stderr
);
$process = proc_open($command, $descriptorspec, $pipes);
if (!is_resource($process)) { if (!is_resource($process)) {
logging('ERROR', "Fail to run external command: '$command'"); logging('ERROR', "Fail to run external command: '$command'");
return false; return false;
} }
if (!is_null($data_stdin)) { if (!is_null($data_stdin)) {
fwrite($pipes[0], $data_stdin); fwrite($pipes[0], $data_stdin);
} }
fclose($pipes[0]); fclose($pipes[0]);
$stdout = stream_get_contents($pipes[1]); $stdout = stream_get_contents($pipes[1]);
fclose($pipes[1]); fclose($pipes[1]);
$stderr = stream_get_contents($pipes[2]); $stderr = stream_get_contents($pipes[2]);
fclose($pipes[2]); fclose($pipes[2]);
$return_value = proc_close($process); $return_value = proc_close($process);
$error = (!empty($stderr) || $return_value != 0); $error = (!empty($stderr) || $return_value != 0);
logging( logging(
($error?'ERROR':'DEBUG'), ($error?'ERROR':'DEBUG'),
"External command ".($error?"error":"result").":\n". "External command ".($error?"error":"result").":\n".
"\tCommand : $command\n". "\tCommand : $command\n".
"\tReturn code: $return_value\n". "\tReturn code: $return_value\n".
"\tOutput:\n". "\tOutput:\n".
"\t\t- Stdout :\n$stdout\n\n". "\t\t- Stdout :\n$stdout\n\n".
"\t\t- Stderr :\n$stderr" "\t\t- Stderr :\n$stderr"
); );
return array($return_value, $stdout, $stderr); return array($return_value, $stdout, $stderr);
} }

View file

@ -5,95 +5,99 @@ $hooks = array();
/** /**
* Registered a hook on a specific event * Registered a hook on a specific event
* *
* @param[in] $event string The event name * @param $event string The event name
* @param[in] $callable callable The callable to run on event * @param $callable callable The callable to run on event
* @param[in] $param mixed Paremeter that will be pass to the callable * @param $param mixed Paremeter that will be pass to the callable
* Use an array if you have multiple parameters to pass * Use an array if you have multiple parameters to pass
* *
* @retval void * @return void
*/ */
function register_hook($event, $callable, $param=NULL) { function register_hook($event, $callable, $param=NULL) {
global $hooks; global $hooks;
if (!array_key_exists($event, $hooks)) if (!array_key_exists($event, $hooks))
$hooks[$event] = array(); $hooks[$event] = array();
$hooks[$event][] = array ( $hooks[$event][] = array (
'callable' => $callable, 'callable' => $callable,
'param' => $param, 'param' => $param,
); );
} }
/** /**
* Run triggered actions on specific event * Run triggered actions on specific event
* *
* @param[in] $event string Event name * @param $event string Event name
* *
* @retval boolean True if all triggered actions succefully runned, false otherwise * @return boolean True if all triggered actions succefully runned, false otherwise
*/ */
function trigger_hook($event_name, $event_data=null) { function trigger_hook($event_name, $event_data=null) {
global $hooks; global $hooks;
$return = true; $return = true;
if (isset($hooks[$event_name]) && is_array($hooks[$event_name])) { if (isset($hooks[$event_name]) && is_array($hooks[$event_name])) {
if ($event_name == 'all') if ($event_name == 'all')
$event = new Event($event_data['event_name'], $event_data['event_data']); $event = new Event($event_data['event_name'], $event_data['event_data']);
else else
$event = new Event($event_name, $event_data); $event = new Event($event_name, $event_data);
foreach ($hooks[$event_name] as $e) { foreach ($hooks[$event_name] as $e) {
if (is_callable($e['callable'])) { if (is_callable($e['callable'])) {
try { try {
call_user_func_array($e['callable'],array($event, &$e['param'])); call_user_func_array($e['callable'],array($event, &$e['param']));
} }
catch(Exception $e) { catch(Exception $e) {
logException($e, "An exception occured running hook ".format_callable($e['callable'])." on event $event_name"); logException(
$return = false; $e, "An exception occured running hook ".format_callable($e['callable']).
} " on event $event_name");
} $return = false;
else { }
logging('ERROR', "The hook ".format_callable($e['callable'])." on event $event_name is not callable."); }
$return = false; else {
} logging(
} 'ERROR',
} "The hook ".format_callable($e['callable'])." on event $event_name is not callable.");
else $return = false;
logging('DEBUG', "No hook registered for event $event_name."); }
}
}
else
logging('DEBUG', "No hook registered for event $event_name.");
// Handle 'all' event // Handle 'all' event
if ($event_name != 'all') { if ($event_name != 'all') {
trigger_hook ( trigger_hook (
'all', 'all',
array ( array (
'event_name' => $event_name, 'event_name' => $event_name,
'event_data' => $event_data, 'event_data' => $event_data,
) )
); );
} }
return $return; return $return;
} }
class Event implements JsonSerializable { class Event implements JsonSerializable {
private $name; private $name;
private $data; private $data;
function __construct($name, $data) { function __construct($name, $data) {
$this -> name = $name; $this -> name = $name;
$this -> data = $data; $this -> data = $data;
} }
function __get($key) { function __get($key) {
if ($key == 'name') if ($key == 'name')
return $this -> name; return $this -> name;
elseif ($key == 'data') elseif ($key == 'data')
return $this -> data; return $this -> data;
elseif (is_array($this -> data) && array_key_exists($key, $this -> data)) elseif (is_array($this -> data) && array_key_exists($key, $this -> data))
return $this -> data[$key]; return $this -> data[$key];
return null; return null;
} }
public function jsonSerialize() { public function jsonSerialize() {
return array ( return array (
'name' => $this -> name, 'name' => $this -> name,
'data' => $this -> data, 'data' => $this -> data,
); );
} }
} }

View file

@ -15,99 +15,133 @@ $_log_file_fd=null;
// Log Levels // Log Levels
$_log_levels=array( $_log_levels=array(
'TRACE' => 0, 'TRACE' => 0,
'DEBUG' => 1, 'DEBUG' => 1,
'INFO' => 2, 'INFO' => 2,
'WARNING' => 3, 'WARNING' => 3,
'ERROR' => 4, 'ERROR' => 4,
'FATAL' => 5, 'FATAL' => 5,
); );
function logging($level, $message) { function logging($level, $message) {
global $log_file, $_log_file_fd, $_log_levels, $log_level, $argv; global $log_file, $_log_file_fd, $_log_levels, $log_level, $argv, $auth_user;
if (!array_key_exists($level, $_log_levels)) $level = 'INFO'; if (!array_key_exists($level, $_log_levels)) $level = 'INFO';
$level_id = $_log_levels[$level]; $level_id = $_log_levels[$level];
if (!array_key_exists($log_level, $_log_levels)) $log_level = 'INFO'; if (!array_key_exists($log_level, $_log_levels)) $log_level = 'INFO';
$log_level_id = $_log_levels[$log_level]; $log_level_id = $_log_levels[$log_level];
if ($level_id < $log_level_id) return true; if ($level_id < $log_level_id) return true;
if(is_null($_log_file_fd)) { if(is_null($_log_file_fd)) {
$_log_file_fd = fopen($log_file, 'a'); $_log_file_fd = fopen($log_file, 'a');
} }
if (php_sapi_name() == "cli") { // If more than 2 arguments passed, format message using sprintf
$msg=date('Y/m/d H:i:s').' - '.basename($argv[0])." - $level - $message\n"; if (func_num_args() > 2) {
} $message = call_user_func_array(
else { 'sprintf',
// With auth enabled array_merge(array($message), array_slice(func_get_args(), 2))
// global $auth_user; );
// $msg=date('Y/m/d H:i:s').' - '.$_SERVER['REQUEST_URI'].' - '.$_SERVER['REMOTE_ADDR']." - $auth_user - $level - $message\n"; }
$msg=date('Y/m/d H:i:s').' - '.$_SERVER['REQUEST_URI'].' - '.$_SERVER['REMOTE_ADDR']." - $level - $message\n";
}
fwrite($_log_file_fd , $msg); if (php_sapi_name() == "cli") {
$msg = implode(' - ', array(
date('Y/m/d H:i:s'),
basename($argv[0]),
$level,
$message
))."\n";
}
else {
$msg = array(
date('Y/m/d H:i:s'),
$_SERVER['REQUEST_URI'],
$_SERVER['REMOTE_ADDR'],
);
if (isset($auth_user))
$msg[] = ($auth_user?$auth_user:'anonymous');
$msg[] = $level;
$msg[] = $message;
$msg = implode(' - ', $msg)."\n";
}
if ($level == 'FATAL') fwrite($_log_file_fd , $msg);
if (function_exists('fatal_error'))
fatal_error($message);
else
die("\n$message\n\n");
elseif (php_sapi_name() == "cli")
echo $msg;
return true; if ($level == 'FATAL')
if (function_exists('fatal_error'))
fatal_error($message);
else
die("\n$message\n\n");
elseif (php_sapi_name() == "cli")
echo $msg;
return true;
} }
function change_log_file($file) { function change_log_file($file) {
global $log_file, $_log_file_fd; global $log_file, $_log_file_fd;
if ($file == $log_file) return True; if ($file == $log_file) return True;
if ($_log_file_fd) { if ($_log_file_fd) {
fclose($_log_file_fd); fclose($_log_file_fd);
$_log_file_fd = false; $_log_file_fd = false;
} }
$log_file = $file; $log_file = $file;
return True; return True;
} }
// Handle exception logging // Handle exception logging
function get_debug_backtrace_context($ignore_last=0) { function get_debug_backtrace_context($ignore_last=0) {
$traces = debug_backtrace(); $traces = debug_backtrace();
// Also ignore this function it self // Also ignore this function it self
$ignore_last++; $ignore_last++;
if (!is_array($traces) || count($traces) <= $ignore_last) if (!is_array($traces) || count($traces) <= $ignore_last)
return ""; return "";
$msg = array(); $msg = array();
for ($i=$ignore_last; $i < count($traces); $i++) { for ($i=$ignore_last; $i < count($traces); $i++) {
$trace = array("#$i"); $trace = array("#$i");
if (isset($traces[$i]['file'])) if (isset($traces[$i]['file']))
$trace[] = $traces[$i]['file'].(isset($traces[$i]['line'])?":".$traces[$i]['line']:""); $trace[] = $traces[$i]['file'].(isset($traces[$i]['line'])?":".$traces[$i]['line']:"");
if (isset($traces[$i]['class']) && isset($traces[$i]['function'])) if (isset($traces[$i]['class']) && isset($traces[$i]['function']))
$trace[] = $traces[$i]['class'] . " " . $traces[$i]['type'] . " " . $traces[$i]['function']. "()"; $trace[] = implode(" ", array(
elseif (isset($traces[$i]['function'])) $traces[$i]['class'],
$trace[] = $traces[$i]['function']. "()"; $traces[$i]['type'],
$msg[] = implode(" - ", $trace); $traces[$i]['function']. "()"));
} elseif (isset($traces[$i]['function']))
$trace[] = $traces[$i]['function']. "()";
$msg[] = implode(" - ", $trace);
}
return implode("\n", $msg); return implode("\n", $msg);
} }
function log_exception($exception, $prefix='') { function log_exception($exception, $prefix=null) {
logging("ERROR", ($prefix?"$prefix :\n":"An exception occured :\n"). get_debug_backtrace_context(1). "\n" . // If more than 2 arguments passed, format prefix message using sprintf
"## ".$exception->getFile().":".$exception->getLine(). " : ". $exception->getMessage()); if ($prefix && func_num_args() > 2) {
$prefix = call_user_func_array(
'sprintf',
array_merge(array($prefix), array_slice(func_get_args(), 2))
);
}
logging(
"ERROR", "%s:\n%s\n## %s:%d : %s",
($prefix?$prefix:"An exception occured"),
get_debug_backtrace_context(1),
$exception->getFile(), $exception->getLine(),
$exception->getMessage());
} }
set_exception_handler('log_exception'); set_exception_handler('log_exception');
// Handle PHP error logging // Handle PHP error logging
function log_php_eror($errno, $errstr, $errfile, $errline) { function log_php_eror($errno, $errstr, $errfile, $errline) {
logging("ERROR", "A PHP error occured : [$errno] $errstr\nFile : $errfile (line : $errline)"); logging("ERROR", "A PHP error occured : [%d] %s\nFile : %s (line : %d)",
$errno, $errstr, $errfile, $errline);
return False; return False;
} }
if ($log_level == 'DEBUG') if ($log_level == 'DEBUG')
set_error_handler('log_php_eror', E_ALL & ~E_STRICT); set_error_handler('log_php_eror', E_ALL & ~E_STRICT);
else else
set_error_handler('log_php_eror', E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); set_error_handler('log_php_eror', E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);

View file

@ -4,12 +4,15 @@
require_once($php_mail_path); require_once($php_mail_path);
require_once($php_mail_mime_path); require_once($php_mail_mime_path);
function send_mail($from, $to, $subject, $msg, $headers=array(), $attachments=array(), $crlf="\r\n") { function send_mail($from, $to, $subject, $msg, $headers=array(), $attachments=array(),
$crlf="\r\n") {
global $mail_send_method, $mail_headers, $mail_send_params, $mail_catch_all, $mail_sender; global $mail_send_method, $mail_headers, $mail_send_params, $mail_catch_all, $mail_sender;
$mail_obj = Mail::factory($mail_send_method, $mail_send_params); $mail_obj = Mail::factory($mail_send_method, $mail_send_params);
if ($mail_catch_all) { if ($mail_catch_all) {
$msg .= sprintf(_("\n\n\nMail initialy intended for %s."), (is_array($to)?implode(',', $to):$to)); $msg .= sprintf(
_("\n\n\nMail initialy intended for %s."),
(is_array($to)?implode(',', $to):$to));
$to = $mail_catch_all; $to = $mail_catch_all;
} }

View file

@ -4,7 +4,7 @@ if (php_sapi_name() == "cli")
// Define session max duration // Define session max duration
if (!isset($session_max_duration)) if (!isset($session_max_duration))
$session_max_duration = (12*60*60); // Default to 12h $session_max_duration = (12*60*60); // Default to 12h
ini_set('session.gc_maxlifetime', $session_max_duration); ini_set('session.gc_maxlifetime', $session_max_duration);
ini_set('session.cookie_lifetime', $session_max_duration); ini_set('session.cookie_lifetime', $session_max_duration);
@ -13,23 +13,26 @@ session_start();
// Init session key // Init session key
if (!isset($_SESSION['session_key'])) { if (!isset($_SESSION['session_key'])) {
$_SESSION['session_key']=uniqid(); $_SESSION['session_key']=uniqid();
} }
// Handle session timeout // Handle session timeout
if ($session_timeout) { if ($session_timeout) {
if (!isset($_SESSION['session_last_access'])) { if (!isset($_SESSION['session_last_access'])) {
logging('DEBUG', 'Set initial session last access'); logging('DEBUG', 'Set initial session last access');
$_SESSION['session_last_access'] = time(); $_SESSION['session_last_access'] = time();
} }
elseif ($_SESSION['session_last_access'] > (time() - $session_timeout)) { elseif ($_SESSION['session_last_access'] > (time() - $session_timeout)) {
logging('DEBUG', 'Session timeout not expired, update session last access (Previous value : '.$_SESSION['session_last_access'].')'); logging(
$_SESSION['session_last_access'] = time(); 'DEBUG',
} 'Session timeout not expired, update session last access '.
else { '(Previous value : '.$_SESSION['session_last_access'].')');
logging('INFO', 'Session destroyed due to inactivity'); $_SESSION['session_last_access'] = time();
session_destroy(); }
} else {
logging('INFO', 'Session destroyed due to inactivity');
session_destroy();
}
} }
function check_session_key($value=null) { function check_session_key($value=null) {

View file

@ -85,13 +85,27 @@ $smarty->assign('session_key', $_SESSION['session_key']);
if (!isset($_SESSION['errors'])) if (!isset($_SESSION['errors']))
$_SESSION['errors']=array(); $_SESSION['errors']=array();
function add_error($error) { function add_error($error) {
$_SESSION['errors'][]=$error; // If more than one arguments passed, format error message using sprintf
if (func_num_args() > 1) {
$error = call_user_func_array(
'sprintf',
array_merge(array($error), array_slice(func_get_args(), 1))
);
}
$_SESSION['errors'][] = $error;
} }
if (!isset($_SESSION['messages'])) if (!isset($_SESSION['messages']))
$_SESSION['messages']=array(); $_SESSION['messages']=array();
function add_message($message) { function add_message($message) {
$_SESSION['messages'][]=$message; // If more than one arguments passed, format message using sprintf
if (func_num_args() > 1) {
$message = call_user_func_array(
'sprintf',
array_merge(array($message), array_slice(func_get_args(), 1))
);
}
$_SESSION['messages'][] = $message;
} }
// Handle CSS & JS files included // Handle CSS & JS files included
@ -133,6 +147,13 @@ function display_template($template, $pagetitle=false) {
if (!$template) if (!$template)
logging("FATAL", _("No template specified.")); logging("FATAL", _("No template specified."));
global $smarty; global $smarty;
// If more than 2 arguments passed, format pagetitle using sprintf
if ($pagetitle & func_num_args() > 2) {
$pagetitle = call_user_func_array(
'sprintf',
array_merge(array($pagetitle), array_slice(func_get_args(), 2))
);
}
try { try {
_defineCommonTemplateVariables($template, $pagetitle); _defineCommonTemplateVariables($template, $pagetitle);
$smarty->display($template); $smarty->display($template);
@ -173,6 +194,14 @@ $ajax=false;
function fatal_error($error) { function fatal_error($error) {
global $smarty, $ajax, $api_mode; global $smarty, $ajax, $api_mode;
// If more than one arguments passed, format error message using sprintf
if (func_num_args() > 1) {
$error = call_user_func_array(
'sprintf',
array_merge(array($error), array_slice(func_get_args(), 1))
);
}
if (php_sapi_name() == "cli") if (php_sapi_name() == "cli")
die("FATAL ERROR : $error\n"); die("FATAL ERROR : $error\n");
@ -202,7 +231,11 @@ function smarty_item_status($params) {
else else
$class='danger'; $class='danger';
echo "<span class='badge badge-$class'>"; echo "<span class='badge badge-$class'>";
echo array_key_exists($params['item']['status'], $status_list)?$status_list[$params['item']['status']]:"Inconnu (".$params['item']['status'].")"; echo (
array_key_exists($params['item']['status'], $status_list)?
$status_list[$params['item']['status']]:
"Inconnu (".$params['item']['status'].")"
);
echo "</span>"; echo "</span>";
} }
smarty_register_function('item_status','smarty_item_status'); smarty_register_function('item_status','smarty_item_status');
@ -223,7 +256,10 @@ function smarty_table_ordered_th($params, $smarty) {
echo "<a href='".$params['url']."?order=".$params['order']."'>".$params['text']."</a>"; echo "<a href='".$params['url']."?order=".$params['order']."'>".$params['text']."</a>";
} }
if ($params['order']==$params['search']['order']) { if ($params['order']==$params['search']['order']) {
echo ' <i class="fa fa-sort-'.(strtolower($params['search']['order_direction'])=='asc'?'up':'down').'" aria-hidden="true"></i>'; echo (
' <i class="fa fa-sort-'.
(strtolower($params['search']['order_direction'])=='asc'?'up':'down').
'" aria-hidden="true"></i>');
} }
} }
smarty_register_function('table_ordered_th','smarty_table_ordered_th'); smarty_register_function('table_ordered_th','smarty_table_ordered_th');

View file

@ -0,0 +1,370 @@
<?php
/*
********************************************************************
* Translations CLI commands *
********************************************************************
*/
if (php_sapi_name() != "cli")
return true;
/**
* Convert PO file to JSON file
*
* @param string $locale The locale of the input PO file
* @param string $path The path of the input PO file
*
* @return string JSON encoded file content
*/
function po2json($locale, $path) {
$fileHandler = new \Sepia\PoParser\SourceHandler\FileSystem($path);
$poparser = new \Sepia\PoParser\Parser($fileHandler);
$catalog = $poparser->parse();
$headers = $catalog->getHeader();
$messages = array();
foreach ($catalog->getEntries() as $entry) {
// msg id json format
$msg = $entry->getMsgStr();
if ($entry->isPlural())
$msg = array($msg, $entry->getMsgIdPlural());
$messages[$entry->getMsgId()] = $msg;
}
return json_encode(array(
'messages' => $messages,
'locale' => $locale,
'domain' => TEXT_DOMAIN,
'plural_expr' => '(n > 1)',
));
}
/**
* Command to extract messages from PHP/JS & template files and
* generate the lang/messages.pot file.
*
* @param array $command_args The command arguments
* @return void
*/
function cli_extract_messages($command_args) {
global $root_dir_path, $root_lang_dir, $smarty_templates_dir;
// List PHP files to parse
$php_files = run_external_command(
array('find', escapeshellarg($root_dir_path), '-name', "'*.php'"),
null, // no STDIN data
false // do not escape command args (already done)
);
if (!is_array($php_files) || $php_files[0] != 0) {
logging('FATAL', _("Fail to list PHP files."));
}
// Extract messages from PHP files using xgettext
$result = run_external_command(
array(
"xgettext",
"--from-code utf-8",
"--language=PHP",
"-o", "$root_lang_dir/php-messages.pot", // Output
"--omit-header", // No POT header
"--keyword=___", // Handle custom ___() translation function
"--files=-" // Read files to parse from STDIN
),
$php_files[1] // Pass PHP files list via STDIN
);
if (!is_array($result) || $result[0] != 0)
logging('FATAL', _("Fail to extract messages from PHP files using xgettext."));
// List JS files to parse
$js_files = run_external_command(
array('find', escapeshellarg("$root_dir_path/public_html/js"), '-name', "'*.js'"),
null, // no STDIN data
false // do not escape command args (already done)
);
if (!is_array($js_files) || $js_files[0] != 0) {
logging('FATAL', _("Fail to list JS files."));
}
// Extract messages from JS files using xgettext
$result = run_external_command(
array(
"xgettext",
"--from-code utf-8",
"--language=JavaScript",
"-o", "$root_lang_dir/js-messages.pot", // Output
"--omit-header", // No POT header
"--keyword=___", // Handle custom ___() translation function
"--files=-" // Read files to parse from STDIN
),
$js_files[1] // Pass JS files list via STDIN
);
if (!is_array($result) || $result[0] != 0)
logging('FATAL', _("Fail to extract messages from JS files using xgettext."));
// Extract messages from templates files using tsmarty2c.php
$result = run_external_command(
array (
"$root_dir_path/vendor/bin/tsmarty2c.php",
"-o", "$root_lang_dir/templates-messages.pot",
$smarty_templates_dir,
)
);
if (!is_array($result) || $result[0] != 0)
logging(
'FATAL',
_("Fail to extract messages from template files using tsmarty2c.php script."));
$fd = fopen("$root_lang_dir/headers.pot", 'w');
$headers = array(
'msgid ""',
'msgstr ""',
'"POT-Creation-Date: '.date('Y-m-d H:iO').'\n"',
'"PO-Revision-Date: '.date('Y-m-d H:iO').'\n"',
'"MIME-Version: 1.0\n"',
'"Content-Type: text/plain; charset=utf-8\n"',
'"Content-Transfer-Encoding: 8bit\n"',
);
fwrite($fd, implode("\n", $headers));
fclose($fd);
// Merge previous results in messages.pot file using msgcat
$result = run_external_command(array(
'msgcat',
"$root_lang_dir/headers.pot",
"$root_lang_dir/php-messages.pot",
"$root_lang_dir/js-messages.pot",
"$root_lang_dir/templates-messages.pot",
"-t", "utf-8", "--use-first",
"-o", "$root_lang_dir/messages.pot",
));
if (!is_array($result) || $result[0] != 0)
logging('FATAL', _("Fail to merge messages using msgcat."));
}
add_cli_command(
'extract_messages',
'cli_extract_messages',
___("Extract messages that need to be translated"),
null,
___("This command could be used to generate/update lang/messages.pot file.")
);
/**
* Command to update messages from lang/messages.pot file to
* all PO file in lang/[lang]/LC_MESSAGES.
*
* @param array $command_args The command arguments
* @return void
*/
function cli_update_messages($command_args) {
global $root_dir_path, $root_lang_dir, $smarty_templates_dir;
$compendium_args = array();
foreach ($command_args as $path) {
if (!file_exists($path))
logging('FATAL', _("Compendium file %s not found."), $path);
$compendium_args[] = '-C';
$compendium_args[] = $path;
}
$pot_file = "$root_lang_dir/messages.pot";
if (!is_file($pot_file))
logging('FATAL', _("POT file not found (%s). Please run extract_messages first."), $pot_file);
if ($dh = opendir($root_lang_dir)) {
$error = False;
while (($file = readdir($dh)) !== false) {
if (
!is_dir($root_lang_dir . '/' . $file) ||
in_array($file, array('.', '..')) ||
is_link($root_lang_dir . '/' . $file)
)
continue;
logging('DEBUG', _("Lang directory '%s' found"), $file);
// Check LC_MESSAGES directory exists
$lang = $file;
$lang_dir = $root_lang_dir . '/' . $file . '/LC_MESSAGES' ;
if (!is_dir($lang_dir)) {
logging('DEBUG', _("LC_MESSAGES directory not found in lang '%s' directory, ignore it."),
$lang);
continue;
}
$po_file = $lang_dir . '/' . TEXT_DOMAIN . '.po';
$created = false;
if (!is_file($po_file)) {
// Init PO file from POT file using msginit
$result = run_external_command(
array("msginit", "-i", "$pot_file", "-l", "$lang", "-o", $po_file)
);
if (is_array($result) && $result[0] == 0) {
$created = true;
} else {
logging('ERROR', _("Fail to init messages in %s PO file using msginit (%s)."),
$lang, $po_file);
$error = True;
}
}
// Update messages in PO file from POT file using msgmerge
// Note: msginit does not accept compendium files, so we also run
// msgmerge on creation with compendium file(s).
if (is_file($po_file) && (!$created || $compendium_args)) {
$result = run_external_command(
array_merge(
array("msgmerge", "-q", "-U"),
$compendium_args,
array($po_file, $pot_file)
)
);
if (!is_array($result) || $result[0] != 0) {
logging('ERROR', _("Fail to update messages in %s PO file using msgmerge (%s)."),
$lang, $po_file);
$error = True;
}
}
elseif (!$created) {
logging('DEBUG', _("PO file not found in lang '%s' directory, ignore it."), $lang);
}
}
closedir($dh);
return !$error;
}
logging('FATAL', _("Fail to open root lang directory (%s)."), $root_dir_path);
}
add_cli_command(
'update_messages',
'cli_update_messages',
___("Update messages in translation PO lang files"),
null,
___("This command could be used to init/update PO files in lang/*/LC_MESSAGES directories.")
);
/**
* Command to compile messages from existing translation PO lang files
* to corresponding MO files and as JSON catalog (for translation in JS).
*
* @param array $command_args The command arguments
* @return void
*/
function cli_compile_messages($command_args) {
global $root_dir_path, $root_lang_dir, $smarty_templates_dir;
if ($dh = opendir($root_lang_dir)) {
$error = False;
while (($file = readdir($dh)) !== false) {
if (
!is_dir($root_lang_dir . '/' . $file) ||
in_array($file, array('.', '..'))
)
continue;
if (is_link($root_lang_dir . '/' . $file)) {
$real_lang_dir = readlink($root_lang_dir . '/' . $file);
if (dirname($real_lang_dir) != '.' || !is_dir($root_lang_dir . '/' . $real_lang_dir))
continue;
$lang = $file;
logging('DEBUG', _("Lang alias symlink found: %s -> %s"), $lang, $real_lang_dir);
// Create JSON catalog symlink (if not exists)
$js_link = "$root_dir_path/public_html/translations/$lang.js";
$link_target = "$real_lang_dir.js";
if (!file_exists($js_link)) {
if (symlink($link_target, $js_link)) {
logging('INFO', _("JSON catalog symlink for %s -> %s created (%s)"),
$lang, $real_lang_dir, $js_link);
}
else {
logging('ERROR', _("Fail to create JSON catalog symlink for %s -> %s (%s)"),
$lang, $real_lang_dir, $js_link);
$error = True;
}
}
elseif (readlink($js_link) == $link_target) {
logging('DEBUG', _("JSON catalog symlink for %s -> %s already exist (%s)"),
$lang, $real_lang_dir, $js_link);
}
else {
logging(
'WARNING',
_("JSON catalog file for %s already exist, but it's not a symlink to %s (%s)"),
$lang, $real_lang_dir, $js_link
);
$error = True;
}
continue;
}
logging('DEBUG', _("Lang directory '%s' found"), $file);
// Check LC_MESSAGES directory exists
$lang = $file;
$lang_dir = $root_lang_dir . '/' . $file . '/LC_MESSAGES' ;
if (!is_dir($lang_dir)) {
logging('DEBUG', _("LC_MESSAGES directory not found in lang '%s' directory, ignore it."),
$lang);
continue;
}
// Test .PO file is present
$po_file = $lang_dir . '/' . TEXT_DOMAIN . '.po';
if (!is_file($po_file)) {
logging('DEBUG', _("PO file not found in lang '%s' directory, ignore it."),
$lang);
continue;
}
$mo_file = preg_replace('/\.po$/', '.mo', $po_file);
// Compile messages from PO file to MO file using msgfmt
$result = run_external_command(
array("msgfmt", "-o", $mo_file, $po_file)
);
if (!is_array($result) || $result[0] != 0) {
logging(
'ERROR',
_("Fail to compile messages from %s PO file as MO file using msgfmt (%s)."),
$lang, $po_file
);
$error = True;
}
// Compile messages from PO file to JSON catalog file
$json_catalog = po2json($lang, $po_file);
$js_file = "$root_dir_path/public_html/translations/$lang.js";
if(!$fd = fopen($js_file, 'w')) {
logging('ERROR', _("Fail to open %s JSON catalog file in write mode (%s)."),
$lang, $js_file);
$error = True;
}
elseif (fwrite($fd, sprintf("translations_data = %s;", $json_catalog)) === false) {
logging('ERROR', _("Fail to write %s JSON catalog in file (%s)."),
$lang, $js_file);
$error = True;
}
else {
logging('INFO', _("%s JSON catalog writed (%s)."), $lang, $js_file);
}
}
closedir($dh);
return !$error;
}
logging('FATAL', _("Fail to open root lang directory (%s)."), $root_dir_path);
}
add_cli_command(
'compile_messages',
'cli_compile_messages',
___(
"Compile messages from existing translation PO lang files to ".
"corresponding MO files and JSON catalogs"
),
null,
___(
"This command could be used to compile PO files in lang/*/LC_MESSAGES ".
"directories to MO files and as JSON catalogs in public_html/translations."
)
);

View file

@ -3,13 +3,13 @@
// Gettext text domain // Gettext text domain
define('TEXT_DOMAIN', 'DEFAULT'); define('TEXT_DOMAIN', 'DEFAULT');
/* /**
* List available translation languages * List available translation languages
* *
* @param[in] $as_locales boolean If true, locale names will be return instead * @param $as_locales boolean If true, locale names will be return instead
* of primary languages (optional, default: false) * of primary languages (optional, default: false)
* *
* @retval array Array of available translation languages (or locales) * @return array Array of available translation languages (or locales)
*/ */
function get_available_langs($as_locales=false) { function get_available_langs($as_locales=false) {
global $root_lang_dir; global $root_lang_dir;
@ -35,14 +35,14 @@ function get_available_langs($as_locales=false) {
return $langs; return $langs;
} }
/* /**
* Get locale name corresponding to specified translation language * Get locale name corresponding to specified translation language
* *
* @param[in] $lang string The translation language * @param $lang string The translation language
* @param[in] $default string|null Default locale name to return if any available translation * @param $default string|null Default locale name to return if any available translation
* locales matched with the specified language * locales matched with the specified language
* (optional, default: $default_locale) * (optional, default: $default_locale)
* return string Corresponding locale * @return string Corresponding locale
*/ */
function lang2locale($lang, $default=null) { function lang2locale($lang, $default=null) {
global $default_locale; global $default_locale;
@ -56,21 +56,27 @@ function lang2locale($lang, $default=null) {
return $default; return $default;
} }
// Helper function: just mark message to translation /**
* Helper function: just mark message for translation
*
* @param string $msg The message to translate
*
* @return string The message without transformation
*/
function ___($msg) { function ___($msg) {
return $msg; return $msg;
} }
/* /**
* Initialize translation system * Initialize translation system
* *
* Detect best translation language and configure the translation * Detect best translation language and configure the translation
* system. * system.
* *
* @retval void * @return void
*/ */
function init_translation() { function init_translation() {
global $root_dir_path, $root_lang_dir, $default_locale; global $root_dir_path, $root_lang_dir, $default_locale, $smarty;
$root_lang_dir = "$root_dir_path/lang"; $root_lang_dir = "$root_dir_path/lang";
if (!class_exists('Locale')) { if (!class_exists('Locale')) {
@ -132,4 +138,11 @@ function init_translation() {
logging('TRACE', "Text domain fullpath is '$fullpath'."); logging('TRACE', "Text domain fullpath is '$fullpath'.");
logging('TRACE', "Text domain is '".textdomain(TEXT_DOMAIN)."'."); logging('TRACE', "Text domain is '".textdomain(TEXT_DOMAIN)."'.");
logging('TRACE', "Test: "._('Hello world !')); logging('TRACE', "Test: "._('Hello world !'));
// JS translation file
$js_translation_file = "translations/$lang.js";
if (php_sapi_name() != "cli" && is_file("$root_dir_path/public_html/$js_translation_file")) {
add_js_file(array("lib/babel.js", "js/translation.js", $js_translation_file));
$smarty->assign('lang', $lang);
}
} }

View file

@ -1,16 +1,16 @@
<?php <?php
function get_item_from_url($id, $fatal=false) { function get_item_from_url($id, $fatal=false) {
if (!check_id($id)) if (!check_id($id))
logging('FATAL', _('Invalid element identifier.')); logging('FATAL', _('Invalid element identifier.'));
$item = get_item($id); $item = get_item($id);
if(!is_array($item)) { if(!is_array($item)) {
$error = sprintf(_("Item #% s not found."), $id); $error = sprintf(_("Item #% s not found."), $id);
if ($fatal) if ($fatal)
logging('FATAL', $error); logging('FATAL', $error);
add_error($error); add_error($error);
return false; return false;
} }
return $item; return $item;
} }

View file

@ -12,7 +12,11 @@ function handle_search($request) {
global $smarty, $status_list; global $smarty, $status_list;
// Manage params // Manage params
if((isset($_REQUEST['clear']) && $_REQUEST['clear']=='true') || !isset($_SESSION['search']) || !is_array($_SESSION['search'])) { if(
(isset($_REQUEST['clear']) && $_REQUEST['clear']=='true') ||
!isset($_SESSION['search']) ||
!is_array($_SESSION['search'])
) {
$_SESSION['search']=array( $_SESSION['search']=array(
'pattern' => false, 'pattern' => false,
'status' => 'all', 'status' => 'all',
@ -81,17 +85,21 @@ function handle_search($request) {
logging('DEBUG', 'Search params : '.vardump($_SESSION['search'])); logging('DEBUG', 'Search params : '.vardump($_SESSION['search']));
$result = search_items($_SESSION['search']); $result = search_items($_SESSION['search']);
if (!is_array($result)) if (!is_array($result))
fatal_error(_("An error occurred while listing the items. If the problem persists, please contact support.")); fatal_error(
_("An error occurred while listing the items. ".
"If the problem persists, please contact support.")
);
$smarty -> assign('result', $result); $smarty -> assign('result', $result);
$smarty -> assign('search', $_SESSION['search']); $smarty -> assign('search', $_SESSION['search']);
$smarty -> assign('nbs_by_page', $nbs_by_page); $smarty -> assign('nbs_by_page', $nbs_by_page);
$smarty -> assign('status_list', $status_list); $smarty -> assign('status_list', $status_list);
add_css_file('lib/bootstrap4-dialog/bootstrap-dialog.min.css'); add_js_file(array(
add_js_file('lib/bootstrap4-dialog/bootstrap-dialog.min.js'); 'lib/bootstrap4dialog/dist/js/bootstrap4dialog.min.js',
add_js_file('lib/myconfirm.js'); 'js/myconfirm.js',
add_js_file('js/search.js'); 'js/search.js'
));
display_template("search.tpl", _("Search")); display_template("search.tpl", _("Search"));
} }
@ -111,11 +119,15 @@ function handle_show($request) {
$smarty->assign('item', $item); $smarty->assign('item', $item);
// Dialog // Dialog
add_css_file('lib/bootstrap4-dialog/bootstrap-dialog.min.css'); add_js_file(array(
add_js_file('lib/bootstrap4-dialog/bootstrap-dialog.min.js'); 'lib/bootstrap4dialog/dist/js/bootstrap4dialog.min.js',
add_js_file('lib/myconfirm.js'); 'js/myconfirm.js',
));
display_template("show.tpl", sprintf(_("Element %s"), (is_array($item)?$item['name']:"#".$request -> id))); display_template(
"show.tpl", _("Element %s"),
(is_array($item)?$item['name']:"#".$request -> id)
);
} }
add_url_handler('|^item/(?P<id>[0-9]+)$|', 'handle_show'); add_url_handler('|^item/(?P<id>[0-9]+)$|', 'handle_show');
@ -127,7 +139,7 @@ function handle_create($request) {
if (isset($_POST['submit']) && empty($field_errors)) { if (isset($_POST['submit']) && empty($field_errors)) {
$item = add_item($info); $item = add_item($info);
if (is_array($item)) { if (is_array($item)) {
add_message(sprintf(_("The element '% s' has been created."), $item['name'])); add_message(_("The element '% s' has been created."), $item['name']);
redirect('item/'.$item['id']); redirect('item/'.$item['id']);
} }
else { else {
@ -137,7 +149,9 @@ function handle_create($request) {
logging('DEBUG', 'Validated data : '.vardump($info)); logging('DEBUG', 'Validated data : '.vardump($info));
logging('DEBUG', 'Fields errors : '.vardump($field_errors)); logging('DEBUG', 'Fields errors : '.vardump($field_errors));
if (isset($_POST['submit']) && !empty($field_errors)) if (isset($_POST['submit']) && !empty($field_errors))
add_error(_("There are errors preventing this item from being saved. Please correct them before attempting to add this item.")); add_error(
_("There are errors preventing this item from being saved. ".
"Please correct them before attempting to add this item."));
$smarty->assign('submited', isset($_POST['submit'])); $smarty->assign('submited', isset($_POST['submit']));
$smarty->assign('info', $info); $smarty->assign('info', $info);
$smarty->assign('field_errors', $field_errors); $smarty->assign('field_errors', $field_errors);
@ -166,11 +180,11 @@ function handle_modify($request) {
} }
logging('DEBUG', 'Changes : '.vardump($changes)); logging('DEBUG', 'Changes : '.vardump($changes));
if (empty($changes)) { if (empty($changes)) {
add_message(sprintf(_("You have not made any changes to element '% s'."), $item['name'])); add_message(_("You have not made any changes to element '% s'."), $item['name']);
redirect('item/'.$item['id']); redirect('item/'.$item['id']);
} }
else if (update_item($item['id'], $changes) === true) { else if (update_item($item['id'], $changes) === true) {
add_message(sprintf(_("The element '% s' has been updated successfully."), $item['name'])); add_message(_("The element '% s' has been updated successfully."), $item['name']);
redirect('item/'.$item['id']); redirect('item/'.$item['id']);
} }
else { else {
@ -181,7 +195,9 @@ function handle_modify($request) {
logging('DEBUG', 'Fields errors : '.vardump($field_errors)); logging('DEBUG', 'Fields errors : '.vardump($field_errors));
$smarty->assign('submited', isset($_POST['submit'])); $smarty->assign('submited', isset($_POST['submit']));
if (isset($_POST['submit']) && !empty($field_errors)) if (isset($_POST['submit']) && !empty($field_errors))
add_error(_("There are errors preventing this item from being saved. Please correct them before attempting to save your changes.")); add_error(
_("There are errors preventing this item from being saved. ".
"Please correct them before attempting to save your changes."));
$smarty->assign('info', (!empty($info)?$info:$item)); $smarty->assign('info', (!empty($info)?$info:$item));
$smarty->assign('item_id', $item['id']); $smarty->assign('item_id', $item['id']);
$smarty->assign('field_errors', $field_errors); $smarty->assign('field_errors', $field_errors);
@ -191,7 +207,10 @@ function handle_modify($request) {
error_404(); error_404();
} }
display_template("form.tpl", sprintf(_("Element %s: Modification"), (is_array($item)?$item['name']:"#".$request -> id))); display_template(
"form.tpl", _("Element %s: Modification"),
(is_array($item)?$item['name']:"#".$request -> id)
);
} }
add_url_handler('|^item/(?P<id>[0-9]+)/modify$|', 'handle_modify'); add_url_handler('|^item/(?P<id>[0-9]+)/modify$|', 'handle_modify');
@ -200,7 +219,7 @@ function handle_archive($request) {
$item = get_item_from_url($request -> id); $item = get_item_from_url($request -> id);
if(!is_array($item)) { if(!is_array($item)) {
add_error(sprintf(_("Item #% s not found."), $request -> id)); add_error(_("Item #% s not found."), $request -> id);
redirect('item'); redirect('item');
} }
elseif ($item['status'] == 'archived') { elseif ($item['status'] == 'archived') {
@ -210,7 +229,7 @@ function handle_archive($request) {
add_error(_('You cannot archive this item.')); add_error(_('You cannot archive this item.'));
} }
else if (archive_item($item['id']) === true) { else if (archive_item($item['id']) === true) {
add_message(sprintf(_("The element '% s' has been archived successfully."), $item['name'])); add_message(_("The element '% s' has been archived successfully."), $item['name']);
} }
else { else {
add_error(_('An error occurred while archiving this item.')); add_error(_('An error occurred while archiving this item.'));
@ -224,13 +243,13 @@ function handle_delete($request) {
$item = get_item_from_url($request -> id); $item = get_item_from_url($request -> id);
if(!is_array($item)) { if(!is_array($item)) {
add_error(sprintf(_("Item #% s not found."), $request -> id)); add_error(_("Item #% s not found."), $request -> id);
} }
else if (!can_delete($item)) { else if (!can_delete($item)) {
add_error(_('You cannot delete this item.')); add_error(_('You cannot delete this item.'));
} }
else if (delete_item($item['id']) === true) { else if (delete_item($item['id']) === true) {
add_message(sprintf(_("The element '% s' has been deleted successfully."), $item['name'])); add_message(_("The element '% s' has been deleted successfully."), $item['name']);
} }
else { else {
add_error(_('An error occurred while deleting this item.')); add_error(_('An error occurred while deleting this item.'));

View file

@ -26,14 +26,17 @@ $url_patterns =array();
/** /**
* Add an URL pattern * Add an URL pattern
* *
* @param[in] $pattern string The URL pattern (required) * @param $pattern string The URL pattern (required)
* @param[in] $handler callable The URL pattern handler (must be callable, required) * @param $handler callable The URL pattern handler (must be callable, required)
* @param[in] $authenticated boolean Permit to define if this URL is accessible only for authenticated users (optional, default: true) * @param $authenticated boolean Permit to define if this URL is accessible only for
* @param[in] $override boolean Allow override if a command already exists with the same name (optional, default: false) * authenticated users (optional, default: true)
* @param[in] $api_mode boolean Enable API mode (optional, default: false) * @param $override boolean Allow override if a command already exists with the
* @param[in] $methods array|null HTTP method (optional, default: array('GET', 'POST')) * same name (optional, default: false)
* @param $api_mode boolean Enable API mode (optional, default: false)
* @param $methods array|null HTTP method (optional, default: array('GET', 'POST'))
**/ **/
function add_url_handler($pattern, $handler=null, $authenticated=false, $override=true, $api_mode=false, $methods=null) { function add_url_handler($pattern, $handler=null, $authenticated=false, $override=true,
$api_mode=false, $methods=null) {
if (is_null($methods)) if (is_null($methods))
$methods = array('GET', 'POST'); $methods = array('GET', 'POST');
elseif (!is_array($methods)) elseif (!is_array($methods))
@ -57,7 +60,10 @@ function add_url_handler($pattern, $handler=null, $authenticated=false, $overrid
); );
} }
elseif ($override) { elseif ($override) {
logging('DEBUG', "URL : override pattern '$pattern' with handler '$handler' (old handler = '".$url_patterns[$pattern]."')"); logging(
'DEBUG',
"URL : override pattern '$pattern' with handler '$handler' ".
"(old handler = '".$url_patterns[$pattern]."')");
$url_patterns[$pattern] = array( $url_patterns[$pattern] = array(
'handler' => $handler, 'handler' => $handler,
'authenticated' => $authenticated, 'authenticated' => $authenticated,
@ -71,6 +77,49 @@ function add_url_handler($pattern, $handler=null, $authenticated=false, $overrid
} }
} }
/**
* Show error page
*
* @param $request UrlRequest|null The request (optional, default: null)
* @param $error_code int|null The HTTP error code (optional, default: 400)
*
* @return void
**/
function error_page($request=null, $error_code=null) {
global $smarty;
$http_errors = array(
400 => array(
'pagetitle' => _("Bad request"),
'message' => _("Invalid request."),
),
401 => array(
'pagetitle' => _("Authentication required"),
'message' => _("You have to be authenticated to access to this page."),
),
403 => array(
'pagetitle' => _("Access denied"),
'message' => _("You do not have access to this application. If you think this is an error, please contact support."),
),
404 => array(
'pagetitle' => _("Whoops ! Page not found"),
'message' => _("The requested page can not be found."),
),
);
$error_code = ($error_code?intval($error_code):400);
if (array_key_exists($error_code, $http_errors))
$error = $http_errors[intval($error_code)];
else
$error = array(
'pagetitle' => _('Error'),
'message' => _('An unknown error occurred. If problem persist, please contact support.'),
);
http_response_code($error_code);
$smarty -> assign('message', $error['message']);
display_template('error_page.tpl', $error['pagetitle']);
exit();
}
/* /*
* Error 404 page * Error 404 page
*/ */
@ -83,8 +132,7 @@ function add_url_handler($pattern, $handler=null, $authenticated=false, $overrid
* @retval void * @retval void
**/ **/
function error_404($request=null) { function error_404($request=null) {
display_template('error_404.tpl', _("Whoops ! Page not found")); error_page($request, 404);
exit();
} }
$_404_url_handler = 'error_404'; $_404_url_handler = 'error_404';
@ -94,19 +142,23 @@ function set_404_url_handler($handler=null) {
} }
/* /**
* Interprets the requested URL and return the corresponding UrlRequest object * Interprets the requested URL and return the corresponding UrlRequest object
* *
* @param[in] $default_url string|null The default URL if current one does not * @param $default_url string|null The default URL if current one does not
* match with any configured pattern. * match with any configured pattern.
* *
* @retval UrlRequest The UrlRequest object corresponding to the the requested URL. * @return UrlRequest The UrlRequest object corresponding to the the requested URL.
*/ */
function get_request($default_url=null) { function get_request($default_url=null) {
global $url_patterns, $_404_url_handler; global $url_patterns, $_404_url_handler;
$current_url = get_current_url(); $current_url = get_current_url();
if ($current_url === false) { if ($current_url === false) {
logging('FATAL', _('Unable to determine the requested page. If the problem persists, please contact support.')); logging(
'FATAL',
_('Unable to determine the requested page. '.
'If the problem persists, please contact support.')
);
exit(); exit();
} }
if (!is_array($url_patterns)) { if (!is_array($url_patterns)) {
@ -115,7 +167,11 @@ function get_request($default_url=null) {
} }
logging('DEBUG', "URL : current url = '$current_url'"); logging('DEBUG', "URL : current url = '$current_url'");
logging('DEBUG', "URL : check current url with the following URL patterns :\n - ".implode("\n - ", array_keys($url_patterns))); logging(
'DEBUG',
"URL : check current url with the following URL patterns :\n - ".
implode("\n - ", array_keys($url_patterns))
);
foreach ($url_patterns as $pattern => $handler_infos) { foreach ($url_patterns as $pattern => $handler_infos) {
$m = url_match($pattern, $current_url, $handler_infos['methods']); $m = url_match($pattern, $current_url, $handler_infos['methods']);
if (is_array($m)) { if (is_array($m)) {
@ -134,7 +190,9 @@ function get_request($default_url=null) {
} }
// Error 404 // Error 404
$api_mode = (strpos($current_url, 'api/') === 0); $api_mode = (strpos($current_url, 'api/') === 0);
logging('DEBUG', "Current URL match with no pattern. Use error 404 handler (API mode=$api_mode)."); logging(
'DEBUG',
"Current URL match with no pattern. Use error 404 handler (API mode=$api_mode).");
return new UrlRequest( return new UrlRequest(
$current_url, $current_url,
array( array(
@ -148,11 +206,11 @@ function get_request($default_url=null) {
/** /**
* Check if the current requested URL match with a specific pattern * Check if the current requested URL match with a specific pattern
* *
* @param[in] $pattern string The URL pattern * @param $pattern string The URL pattern
* @param[in] $current_url string|false The current URL (optional) * @param $current_url string|false The current URL (optional)
* @param[in] $methods array|null HTTP method (optional, default: no check) * @param $methods array|null HTTP method (optional, default: no check)
* *
* @retval array|false The URL info if pattern matched, false otherwise. * @return array|false The URL info if pattern matched, false otherwise.
**/ **/
function url_match($pattern, $current_url=false, $methods=null) { function url_match($pattern, $current_url=false, $methods=null) {
if ($methods && !in_array($_SERVER['REQUEST_METHOD'], $methods)) if ($methods && !in_array($_SERVER['REQUEST_METHOD'], $methods))
@ -162,16 +220,19 @@ function url_match($pattern, $current_url=false, $methods=null) {
if (!$current_url) return False; if (!$current_url) return False;
} }
if (preg_match($pattern, $current_url, $m)) { if (preg_match($pattern, $current_url, $m)) {
logging('DEBUG', "URL : Match found with pattern '$pattern' :\n\t".str_replace("\n", "\n\t", print_r($m, 1))); logging(
'DEBUG',
"URL : Match found with pattern '$pattern' :\n\t".
str_replace("\n", "\n\t", print_r($m, 1)));
return $m; return $m;
} }
return False; return False;
} }
/* /**
* Retreive current requested URL and return it * Retreive current requested URL and return it
* *
* @retval string|false The current request URL or false if fail * @return string|false The current request URL or false if fail
**/ **/
function get_current_url() { function get_current_url() {
logging('DEBUG', "URL : request URI = '".$_SERVER['REQUEST_URI']."'"); logging('DEBUG', "URL : request URI = '".$_SERVER['REQUEST_URI']."'");
@ -183,7 +244,9 @@ function get_current_url() {
return ''; return '';
if (substr($_SERVER['REQUEST_URI'], 0, strlen($base)) != $base) { if (substr($_SERVER['REQUEST_URI'], 0, strlen($base)) != $base) {
logging('ERROR', "URL : request URI (".$_SERVER['REQUEST_URI'].") does not start with rewrite base ($base)"); logging(
'ERROR',
"URL : request URI (".$_SERVER['REQUEST_URI'].") does not start with rewrite base ($base)");
return False; return False;
} }
@ -206,7 +269,7 @@ function get_current_url() {
/** /**
* Try to detect rewrite base from public root URL * Try to detect rewrite base from public root URL
* *
* @retval string The detected rewrite base * @return string The detected rewrite base
**/ **/
function get_rewrite_base() { function get_rewrite_base() {
global $public_root_url; global $public_root_url;
@ -220,9 +283,9 @@ function get_rewrite_base() {
/** /**
* Trigger redirect to specified URL (or homepage if omited) * Trigger redirect to specified URL (or homepage if omited)
* *
* @param[in] $go string|false The destination URL * @param $go string|false The destination URL
* *
* @retval void * @return void
**/ **/
function redirect($go=false) { function redirect($go=false) {
global $public_root_url; global $public_root_url;
@ -244,7 +307,10 @@ function redirect($go=false) {
// Prevent loop // Prevent loop
if (isset($_SESSION['last_redirect']) && $_SESSION['last_redirect'] == $url) if (isset($_SESSION['last_redirect']) && $_SESSION['last_redirect'] == $url)
logging('FATAL', _('Unable to determine the requested page (loop detected). If the problem persists, please contact support.')); logging(
'FATAL',
_('Unable to determine the requested page (loop detected). '.
'If the problem persists, please contact support.'));
else else
$_SESSION['last_redirect'] = $url; $_SESSION['last_redirect'] = $url;
@ -256,10 +322,10 @@ function redirect($go=false) {
/** /**
* Handle the current requested URL * Handle the current requested URL
* *
* @param[in] $default_url string|null The default URL if current one does not * @param $default_url string|null The default URL if current one does not
* match with any configured pattern. * match with any configured pattern.
* *
* @retval void * @return void
**/ **/
function handle_request($default_url=null) { function handle_request($default_url=null) {
global $smarty, $api_mode; global $smarty, $api_mode;
@ -284,7 +350,8 @@ function handle_request($default_url=null) {
return call_user_func($request -> handler, $request); return call_user_func($request -> handler, $request);
} }
catch (Exception $e) { catch (Exception $e) {
log_exception($e, "An exception occured running URL handler function ".$request -> handler."()"); log_exception(
$e, "An exception occured running URL handler function ".$request -> handler."()");
logging('FATAL', _("This request could not be processed correctly.")); logging('FATAL', _("This request could not be processed correctly."));
} }
} }
@ -292,9 +359,9 @@ function handle_request($default_url=null) {
/** /**
* Remove trailing slash in specified URL * Remove trailing slash in specified URL
* *
* @param[in] $url string The URL * @param $url string The URL
* *
* @retval string The specified URL without trailing slash * @return string The specified URL without trailing slash
**/ **/
function remove_trailing_slash($url) { function remove_trailing_slash($url) {
if ($url == '/') if ($url == '/')
@ -310,9 +377,9 @@ function remove_trailing_slash($url) {
* Check if session key is present and valid and set AJAX * Check if session key is present and valid and set AJAX
* mode. * mode.
* *
* @param[in] $session_key string The current session key (optional) * @param $session_key string The current session key (optional)
* *
* @retval void * @return void
**/ **/
function check_ajax_request($session_key=null) { function check_ajax_request($session_key=null) {
global $ajax, $debug_ajax; global $ajax, $debug_ajax;
@ -328,18 +395,25 @@ function check_ajax_request($session_key=null) {
/** /**
* Get the public absolute URL * Get the public absolute URL
* *
* @param[in] $relative_url string|null Relative URL to convert (Default: current URL) * @param $relative_url string|null Relative URL to convert (Default: current URL)
* *
* @retval string The public absolute URL * @return string The public absolute URL
**/ **/
function get_absolute_url($relative_url=null) { function get_absolute_url($relative_url=null) {
global $public_root_url; global $public_root_url;
if (!is_string($relative_url)) if (!is_string($relative_url))
$relative_url = get_current_url(); $relative_url = get_current_url();
if ($public_root_url[0] == '/') { if ($public_root_url[0] == '/') {
logging('DEBUG', "URL :: get_absolute_url($relative_url): configured public root URL is relative ($public_root_url) => try to detect it from current request infos."); logging(
$public_root_url = 'http'.(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'?'s':'').'://'.$_SERVER['HTTP_HOST'].$public_root_url; 'DEBUG',
logging('DEBUG', "URL :: get_absolute_url($relative_url): detected public_root_url: $public_root_url"); "URL :: get_absolute_url($relative_url): configured public root URL is relative ".
"($public_root_url) => try to detect it from current request infos.");
$public_root_url = (
'http'.(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'?'s':'').'://'.
$_SERVER['HTTP_HOST'].$public_root_url);
logging(
'DEBUG',
"URL :: get_absolute_url($relative_url): detected public_root_url: $public_root_url");
} }
if (substr($relative_url, 0, 1) == '/') if (substr($relative_url, 0, 1) == '/')
@ -352,23 +426,23 @@ function get_absolute_url($relative_url=null) {
/** /**
* Check if specified URL is absolute * Check if specified URL is absolute
* *
* @param[in] $url string The URL to check * @param $url string The URL to check
* *
* @retval boolean True if specified URL is absolute, False otherwise * @return boolean True if specified URL is absolute, False otherwise
**/ **/
function is_absolute_url($url) { function is_absolute_url($url) {
return boolval(preg_match('#^https?://#', $url)); return boolval(preg_match('#^https?://#', $url));
} }
/* /**
* Add parameter in specified URL * Add parameter in specified URL
* *
* @param[in] &$url string The reference of the URL * @param &$url string The reference of the URL
* @param[in] $param string The parameter name * @param $param string The parameter name
* @param[in] $value string The parameter value * @param $value string The parameter value
* @param[in] $encode boolean Set if parameter value must be URL encoded (optional, default: true) * @param $encode boolean Set if parameter value must be URL encoded (optional, default: true)
* *
* @retval string|null The completed URL * @return string|null The completed URL
*/ */
function add_url_parameter(&$url, $param, $value, $encode=true) { function add_url_parameter(&$url, $param, $value, $encode=true) {
if (strpos($url, '?') === false) if (strpos($url, '?') === false)
@ -404,17 +478,21 @@ class UrlRequest {
public function __construct($current_url, $handler_infos, $url_params=array()) { public function __construct($current_url, $handler_infos, $url_params=array()) {
$this -> current_url = $current_url; $this -> current_url = $current_url;
$this -> handler = $handler_infos['handler']; $this -> handler = $handler_infos['handler'];
$this -> authenticated = (isset($handler_infos['authenticated'])?boolval($handler_infos['authenticated']):true); $this -> authenticated = (
$this -> api_mode = (isset($handler_infos['api_mode'])?boolval($handler_infos['api_mode']):false); isset($handler_infos['authenticated'])?
boolval($handler_infos['authenticated']):true);
$this -> api_mode = (
isset($handler_infos['api_mode'])?
boolval($handler_infos['api_mode']):false);
$this -> url_params = $url_params; $this -> url_params = $url_params;
} }
/** /**
* Get request info * Get request info
* *
* @param[in] $key string The name of the info * @param $key string The name of the info
* *
* @retval mixed The value * @return mixed The value
**/ **/
public function __get($key) { public function __get($key) {
if ($key == 'current_url') if ($key == 'current_url')
@ -439,9 +517,9 @@ class UrlRequest {
/** /**
* Check is request info is set * Check is request info is set
* *
* @param[in] $key string The name of the info * @param $key string The name of the info
* *
* @retval boolval True is info is set, False otherwise * @return boolval True is info is set, False otherwise
**/ **/
public function __isset($key) { public function __isset($key) {
if (in_array($key, array('current_url', 'handler', 'authenticated'))) if (in_array($key, array('current_url', 'handler', 'authenticated')))
@ -452,10 +530,11 @@ class UrlRequest {
/** /**
* Get request parameter * Get request parameter
* *
* @param[in] $parameter string The name of the parameter * @param $parameter string The name of the parameter
* @param[in] $decode string If true, the parameter value will be urldecoded (optional, default: true) * @param $decode string If true, the parameter value will be urldecoded
* (optional, default: true)
* *
* @retval mixed The value or false if parameter does not exists * @return mixed The value or false if parameter does not exists
**/ **/
public function get_param($parameter, $decode=true) { public function get_param($parameter, $decode=true) {
if (array_key_exists($parameter, $this->url_params)) { if (array_key_exists($parameter, $this->url_params)) {
@ -466,10 +545,10 @@ class UrlRequest {
return false; return false;
} }
/* /**
* Get request referer (if known) * Get request referer (if known)
* *
* @retval string|null The request referer URL if known, null otherwise * @return string|null The request referer URL if known, null otherwise
*/ */
public function get_referer() { public function get_referer() {
if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'])

View file

@ -1,10 +1,24 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2022-04-24 19:09+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: Benjamin Renard <brenard@easter-eggs.com>\n"
"Language-Team: \n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.4.2\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: /home/brenard/dev/eesyphp/includes/url-helpers.php:5 #: /home/brenard/dev/eesyphp/includes/url-helpers.php:5
msgid "Invalid element identifier." msgid "Invalid element identifier."
msgstr "Identifiant d'élément invalide." msgstr "Identifiant d'élément invalide."
#: /home/brenard/dev/eesyphp/includes/url-helpers.php:9 #: /home/brenard/dev/eesyphp/includes/url-helpers.php:9
#: /home/brenard/dev/eesyphp/includes/url-public.php:203 #: /home/brenard/dev/eesyphp/includes/url-public.php:222
#: /home/brenard/dev/eesyphp/includes/url-public.php:227 #: /home/brenard/dev/eesyphp/includes/url-public.php:246
#, php-format #, php-format
msgid "Item #% s not found." msgid "Item #% s not found."
msgstr "L'élément #%s est introuvable." msgstr "L'élément #%s est introuvable."
@ -13,24 +27,24 @@ msgstr "L'élément #%s est introuvable."
msgid "Smarty version not supported." msgid "Smarty version not supported."
msgstr "Une erreur est survenue en affichant cette page." msgstr "Une erreur est survenue en affichant cette page."
#: /home/brenard/dev/eesyphp/includes/smarty.php:134 #: /home/brenard/dev/eesyphp/includes/smarty.php:148
msgid "No template specified." msgid "No template specified."
msgstr "Aucun template spécifié." msgstr "Aucun template spécifié."
#: /home/brenard/dev/eesyphp/includes/smarty.php:145 #: /home/brenard/dev/eesyphp/includes/smarty.php:166
msgid "An error occurred while viewing this page." msgid "An error occurred while viewing this page."
msgstr "Une erreur est survenue en affichant cette page." msgstr "Une erreur est survenue en affichant cette page."
#: /home/brenard/dev/eesyphp/includes/url-public.php:7 #: /home/brenard/dev/eesyphp/includes/url-public.php:7
#: /home/brenard/dev/eesyphp/includes/translation.php:134 #: /home/brenard/dev/eesyphp/includes/translation.php:140
msgid "Hello world !" msgid "Hello world !"
msgstr "Bonjour tout le monde !" msgstr "Bonjour tout le monde !"
#: /home/brenard/dev/eesyphp/includes/url-public.php:27 #: /home/brenard/dev/eesyphp/includes/url-public.php:31
msgid "Any" msgid "Any"
msgstr "Peu importe" msgstr "Peu importe"
#: /home/brenard/dev/eesyphp/includes/url-public.php:84 #: /home/brenard/dev/eesyphp/includes/url-public.php:89
msgid "" msgid ""
"An error occurred while listing the items. If the problem persists, please " "An error occurred while listing the items. If the problem persists, please "
"contact support." "contact support."
@ -38,26 +52,25 @@ msgstr ""
"Une erreur est survenue en listant les éléments. Si le problème persiste, " "Une erreur est survenue en listant les éléments. Si le problème persiste, "
"merci de prendre contact avec le support." "merci de prendre contact avec le support."
#: /home/brenard/dev/eesyphp/includes/url-public.php:96 #: /home/brenard/dev/eesyphp/includes/url-public.php:104
#: /home/brenard/dev/eesyphp/templates/search.tpl:22
msgid "Search" msgid "Search"
msgstr "Rechercher" msgstr "Rechercher"
#: /home/brenard/dev/eesyphp/includes/url-public.php:118 #: /home/brenard/dev/eesyphp/includes/url-public.php:128
#, php-format #, php-format
msgid "Element %s" msgid "Element %s"
msgstr "Élément %s" msgstr "Élément %s"
#: /home/brenard/dev/eesyphp/includes/url-public.php:130 #: /home/brenard/dev/eesyphp/includes/url-public.php:142
#, php-format #, php-format
msgid "The element '% s' has been created." msgid "The element '% s' has been created."
msgstr "L'élément '%s' a bien été créé." msgstr "L'élément '%s' a bien été créé."
#: /home/brenard/dev/eesyphp/includes/url-public.php:134 #: /home/brenard/dev/eesyphp/includes/url-public.php:146
msgid "An error occurred while saving this item." msgid "An error occurred while saving this item."
msgstr "Une erreur est survenue en enregistrant cet élément." msgstr "Une erreur est survenue en enregistrant cet élément."
#: /home/brenard/dev/eesyphp/includes/url-public.php:140 #: /home/brenard/dev/eesyphp/includes/url-public.php:153
msgid "" msgid ""
"There are errors preventing this item from being saved. Please correct them " "There are errors preventing this item from being saved. Please correct them "
"before attempting to add this item." "before attempting to add this item."
@ -65,29 +78,29 @@ msgstr ""
"Des erreurs empêchent l'enregistrement de cet élément. Merci de les corriger " "Des erreurs empêchent l'enregistrement de cet élément. Merci de les corriger "
"avant de tenter d'ajouter cet élément." "avant de tenter d'ajouter cet élément."
#: /home/brenard/dev/eesyphp/includes/url-public.php:146 #: /home/brenard/dev/eesyphp/includes/url-public.php:160
msgid "New" msgid "New"
msgstr "Nouveau" msgstr "Nouveau"
#: /home/brenard/dev/eesyphp/includes/url-public.php:156 #: /home/brenard/dev/eesyphp/includes/url-public.php:170
msgid "You cannot edit this item." msgid "You cannot edit this item."
msgstr "Vous ne pouvez pas modifier cet élément." msgstr "Vous ne pouvez pas modifier cet élément."
#: /home/brenard/dev/eesyphp/includes/url-public.php:169 #: /home/brenard/dev/eesyphp/includes/url-public.php:183
#, php-format #, php-format
msgid "You have not made any changes to element '% s'." msgid "You have not made any changes to element '% s'."
msgstr "Vous n'avez apporté aucune modification à l'élément '%s'." msgstr "Vous n'avez apporté aucune modification à l'élément '%s'."
#: /home/brenard/dev/eesyphp/includes/url-public.php:173 #: /home/brenard/dev/eesyphp/includes/url-public.php:187
#, php-format #, php-format
msgid "The element '% s' has been updated successfully." msgid "The element '% s' has been updated successfully."
msgstr "L'élément '%s' a bien été mise à jour." msgstr "L'élément '%s' a bien été mise à jour."
#: /home/brenard/dev/eesyphp/includes/url-public.php:177 #: /home/brenard/dev/eesyphp/includes/url-public.php:191
msgid "An error occurred while updating this item." msgid "An error occurred while updating this item."
msgstr "Une erreur est survenue en mettant à jour cet élément." msgstr "Une erreur est survenue en mettant à jour cet élément."
#: /home/brenard/dev/eesyphp/includes/url-public.php:184 #: /home/brenard/dev/eesyphp/includes/url-public.php:199
msgid "" msgid ""
"There are errors preventing this item from being saved. Please correct them " "There are errors preventing this item from being saved. Please correct them "
"before attempting to save your changes." "before attempting to save your changes."
@ -95,38 +108,38 @@ msgstr ""
"Des erreurs empêchent l'enregistrement de cet élément. Merci de les corriger " "Des erreurs empêchent l'enregistrement de cet élément. Merci de les corriger "
"avant de tenter d'enregistrer vos modifications." "avant de tenter d'enregistrer vos modifications."
#: /home/brenard/dev/eesyphp/includes/url-public.php:194 #: /home/brenard/dev/eesyphp/includes/url-public.php:211
#, php-format #, php-format
msgid "Element %s: Modification" msgid "Element %s: Modification"
msgstr "Élément %s : Modification" msgstr "Élément %s : Modification"
#: /home/brenard/dev/eesyphp/includes/url-public.php:207 #: /home/brenard/dev/eesyphp/includes/url-public.php:226
msgid "This item is already archived." msgid "This item is already archived."
msgstr "Cet élément est déjà archivé." msgstr "Cet élément est déjà archivé."
#: /home/brenard/dev/eesyphp/includes/url-public.php:210 #: /home/brenard/dev/eesyphp/includes/url-public.php:229
msgid "You cannot archive this item." msgid "You cannot archive this item."
msgstr "Vous ne pouvez pas archiver cet élément." msgstr "Vous ne pouvez pas archiver cet élément."
#: /home/brenard/dev/eesyphp/includes/url-public.php:213 #: /home/brenard/dev/eesyphp/includes/url-public.php:232
#, php-format #, php-format
msgid "The element '% s' has been archived successfully." msgid "The element '% s' has been archived successfully."
msgstr "L'élément '%s' a bien été archivé." msgstr "L'élément '%s' a bien été archivé."
#: /home/brenard/dev/eesyphp/includes/url-public.php:216 #: /home/brenard/dev/eesyphp/includes/url-public.php:235
msgid "An error occurred while archiving this item." msgid "An error occurred while archiving this item."
msgstr "Une erreur est survenue en archivant cet élément." msgstr "Une erreur est survenue en archivant cet élément."
#: /home/brenard/dev/eesyphp/includes/url-public.php:230 #: /home/brenard/dev/eesyphp/includes/url-public.php:249
msgid "You cannot delete this item." msgid "You cannot delete this item."
msgstr "Vous ne pouvez pas supprimer cet élément." msgstr "Vous ne pouvez pas supprimer cet élément."
#: /home/brenard/dev/eesyphp/includes/url-public.php:233 #: /home/brenard/dev/eesyphp/includes/url-public.php:252
#, php-format #, php-format
msgid "The element '% s' has been deleted successfully." msgid "The element '% s' has been deleted successfully."
msgstr "L'élément '%s' a bien été supprimé." msgstr "L'élément '%s' a bien été supprimé."
#: /home/brenard/dev/eesyphp/includes/url-public.php:236 #: /home/brenard/dev/eesyphp/includes/url-public.php:255
msgid "An error occurred while deleting this item." msgid "An error occurred while deleting this item."
msgstr "Une erreur est survenue en supprimant cet élément." msgstr "Une erreur est survenue en supprimant cet élément."
@ -150,7 +163,182 @@ msgstr "Refusé"
msgid "Archived" msgid "Archived"
msgstr "Archivé" msgstr "Archivé"
#: /home/brenard/dev/eesyphp/includes/mail.php:12 #: /home/brenard/dev/eesyphp/includes/translation-cli.php:59
msgid "Fail to list PHP files."
msgstr "Impossible de lister les fichiers PHP."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:76
msgid "Fail to extract messages from PHP files using xgettext."
msgstr ""
"Impossible d'extraire les messages depuis les fichiers PHP en utilisant "
"xgettext."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:86
msgid "Fail to list JS files."
msgstr "Impossible de lister les fichiers JS."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:103
msgid "Fail to extract messages from JS files using xgettext."
msgstr ""
"Impossible d'extraire les messages depuis les fichiers JS en utilisant "
"xgettext."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:116
msgid ""
"Fail to extract messages from template files using tsmarty2c.php script."
msgstr ""
"Impossible d'extraire les messages depuis les fichiers template en utilisant "
"le script tsmarty2c.php."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:142
msgid "Fail to merge messages using msgcat."
msgstr "Impossible de fusionner les messages en utilisant msgcat."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:147
msgid "Extract messages that need to be translated"
msgstr "Extraire les messages devant être traduit"
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:149
msgid "This command could be used to generate/update lang/messages.pot file."
msgstr ""
"Cette commande peut-être utilisée pour générer/mettre à jour le fichier lang/"
"messages.pot."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:165
#, php-format
msgid "Compendium file %s not found."
msgstr "Fichier compendium %s introuvable."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:172
#, php-format
msgid "POT file not found (%s). Please run extract_messages first."
msgstr ""
"Fichier POT introuvable (%s). Merci de lancer la commande extract_messages "
"pour commencer."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:184
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:301
#, php-format
msgid "Lang directory '%s' found"
msgstr "Dossier de langue '%s' trouvé"
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:190
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:307
#, php-format
msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it."
msgstr ""
"Le dossier LC_MESSAGES est introuvable dans le dossier de langue '%s', on "
"l'ignore."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:205
#, php-format
msgid "Fail to init messages in %s PO file using msginit (%s)."
msgstr ""
"Impossible d'initialiser les messages dans le fichier PO %s en utilisant "
"msginit (%s)."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:223
#, php-format
msgid "Fail to update messages in %s PO file using msgmerge (%s)."
msgstr ""
"Impossible de mettre à jour les messages dans les fichiers PO %s en "
"utilisant msgmerge (%s)."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:229
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:315
#, php-format
msgid "PO file not found in lang '%s' directory, ignore it."
msgstr ""
"Le fichier PO est introuvable dans le dossier de langue '%s', on l'ignore."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:236
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:356
#, php-format
msgid "Fail to open root lang directory (%s)."
msgstr "Impossible d'ouvrir le dossier racine des langues (%s)."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:241
msgid "Update messages in translation PO lang files"
msgstr ""
"Mettre à jour les messages dans les fichiers de traduction PO existants"
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:243
msgid ""
"This command could be used to init/update PO files in lang/*/LC_MESSAGES "
"directories."
msgstr ""
"Cette commande peut-être utilisée pour initialiser/mettre à jour les "
"fichiers PO les dossiers lang/*/LC_MESSAGES."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:270
#, php-format
msgid "Lang alias symlink found: %s -> %s"
msgstr "Lien symbolique d'alias de langue trouvé : %s -> %s"
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:277
#, php-format
msgid "JSON catalog symlink for %s -> %s created (%s)"
msgstr "Lien symbolique de catalogue JSON pour %s -> %s créé (%s)"
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:281
#, php-format
msgid "Fail to create JSON catalog symlink for %s -> %s (%s)"
msgstr ""
"Impossible de créer le lien symbolique de catalogue JSON pour %s -> %s (%s)"
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:287
#, php-format
msgid "JSON catalog symlink for %s -> %s already exist (%s)"
msgstr "Le lien symbolique du catalogue JSON pour %s -> %s existe déjà (%s)"
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:293
#, php-format
msgid ""
"JSON catalog file for %s already exist, but it's not a symlink to %s (%s)"
msgstr ""
"Le catalogue JSON pour %s existe, mais il ne s'agit par d'un lien symbolique "
"vers %s (%s)"
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:329
#, php-format
msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)."
msgstr ""
"Impossible de compiler les messages depuis le fichier PO %s en tant que "
"fichier MO en utilisant msgfmt (%s)."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:339
#, php-format
msgid "Fail to open %s JSON catalog file in write mode (%s)."
msgstr "Impossible d'ouvrir le catalogue JSON %s en mode écriture (%s)."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:344
#, php-format
msgid "Fail to write %s JSON catalog in file (%s)."
msgstr "Impossible d'écrire le fichier du catalogue JSON %s (%s)."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:349
#, php-format
msgid "%s JSON catalog writed (%s)."
msgstr "Catalogue JSON %s créé (%s)."
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:362
msgid ""
"Compile messages from existing translation PO lang files to corresponding MO "
"files and JSON catalogs"
msgstr ""
"Compiler les messages depuis les fichiers PO de traduction existants vers "
"les fichiers MO et les catalogues JSON correspondant"
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:367
msgid ""
"This command could be used to compile PO files in lang/*/LC_MESSAGES "
"directories to MO files and as JSON catalogs in public_html/translations."
msgstr ""
"Cette commande peut-être utilisée pour compiler les fichiers PO dans les "
"dossiers lang/*/LC_MESSAGES en fichiers MO and en tant que catalogues JSON "
"dans public_html/translations."
#: /home/brenard/dev/eesyphp/includes/mail.php:14
#, php-format #, php-format
msgid "" msgid ""
"\n" "\n"
@ -163,11 +351,53 @@ msgstr ""
"\n" "\n"
"Mail originalement destiné à %s." "Mail originalement destiné à %s."
#: /home/brenard/dev/eesyphp/includes/url.php:86 #: /home/brenard/dev/eesyphp/includes/url.php:92
msgid "Bad request"
msgstr "Mauvaise requête"
#: /home/brenard/dev/eesyphp/includes/url.php:93
msgid "Invalid request."
msgstr "Requête invalide."
#: /home/brenard/dev/eesyphp/includes/url.php:96
msgid "Authentication required"
msgstr "Authentification requise"
#: /home/brenard/dev/eesyphp/includes/url.php:97
msgid "You have to be authenticated to access to this page."
msgstr "Vous devez être authentifié pour accéder à cette page."
#: /home/brenard/dev/eesyphp/includes/url.php:100
msgid "Access denied"
msgstr "Accès interdit"
#: /home/brenard/dev/eesyphp/includes/url.php:101
msgid ""
"You do not have access to this application. If you think this is an error, "
"please contact support."
msgstr ""
"Vous n'avez pas accès à cette application. Si vous pensez qu'il s'agit d'une "
"erreur, merci de prendre contact avec le support."
#: /home/brenard/dev/eesyphp/includes/url.php:104
msgid "Whoops ! Page not found" msgid "Whoops ! Page not found"
msgstr "Oups ! Page introuvable" msgstr "Oups ! Page introuvable"
#: /home/brenard/dev/eesyphp/includes/url.php:109 #: /home/brenard/dev/eesyphp/includes/url.php:105
msgid "The requested page can not be found."
msgstr "La page demandée est introuvable."
#: /home/brenard/dev/eesyphp/includes/url.php:113
msgid "Error"
msgstr "Erreur"
#: /home/brenard/dev/eesyphp/includes/url.php:114
msgid "An unknown error occurred. If problem persist, please contact support."
msgstr ""
"Une erreur inconnue est survenue. Si le problème persiste, merci de prendre "
"contact avec le support."
#: /home/brenard/dev/eesyphp/includes/url.php:159
msgid "" msgid ""
"Unable to determine the requested page. If the problem persists, please " "Unable to determine the requested page. If the problem persists, please "
"contact support." "contact support."
@ -175,7 +405,7 @@ msgstr ""
"Impossible de déterminer la page demandée. Si le problème persiste, merci de " "Impossible de déterminer la page demandée. Si le problème persiste, merci de "
"prendre contact avec le support." "prendre contact avec le support."
#: /home/brenard/dev/eesyphp/includes/url.php:247 #: /home/brenard/dev/eesyphp/includes/url.php:312
msgid "" msgid ""
"Unable to determine the requested page (loop detected). If the problem " "Unable to determine the requested page (loop detected). If the problem "
"persists, please contact support." "persists, please contact support."
@ -183,54 +413,54 @@ msgstr ""
"Impossible de déterminer la page demandée (boucle détectée). Si le problème " "Impossible de déterminer la page demandée (boucle détectée). Si le problème "
"persiste, merci de prendre contact avec le support." "persiste, merci de prendre contact avec le support."
#: /home/brenard/dev/eesyphp/includes/url.php:271 #: /home/brenard/dev/eesyphp/includes/url.php:337
msgid "This request cannot be processed." msgid "This request cannot be processed."
msgstr "Cette requête ne peut être traitée." msgstr "Cette requête ne peut être traitée."
#: /home/brenard/dev/eesyphp/includes/url.php:288 #: /home/brenard/dev/eesyphp/includes/url.php:355
msgid "This request could not be processed correctly." msgid "This request could not be processed correctly."
msgstr "Cette requête n'a put être traitée correctement." msgstr "Cette requête n'a put être traitée correctement."
#: /home/brenard/dev/eesyphp/includes/cli.php:7 #: /home/brenard/dev/eesyphp/includes/cli.php:8
#, php-format #, php-format
msgid "The CLI command '%s' already exists." msgid "The CLI command '%s' already exists."
msgstr "La commande CLI '%s' n'existe pas." msgstr "La commande CLI '%s' n'existe pas."
#: /home/brenard/dev/eesyphp/includes/cli.php:12 #: /home/brenard/dev/eesyphp/includes/cli.php:13
#, php-format #, php-format
msgid "The CLI command '%s' handler is not callable !" msgid "The CLI command '%s' handler is not callable !"
msgstr "La fonction implémentant la commande CLI '%s' n'est pas exécutable !" msgstr "La fonction implémentant la commande CLI '%s' n'est pas exécutable !"
#: /home/brenard/dev/eesyphp/includes/cli.php:45 #: /home/brenard/dev/eesyphp/includes/cli.php:54
#, php-format #, php-format
msgid "Usage: %s [-h] [-qd] command\n" msgid "Usage: %s [-h] [-qd] command\n"
msgstr "Utilisation: %s [-h] [-qd] commande\n" msgstr "Utilisation: %s [-h] [-qd] commande\n"
#: /home/brenard/dev/eesyphp/includes/cli.php:46 #: /home/brenard/dev/eesyphp/includes/cli.php:55
msgid " -h Show this message\n" msgid " -h Show this message\n"
msgstr " -h Affiche ce message\n" msgstr " -h Affiche ce message\n"
#: /home/brenard/dev/eesyphp/includes/cli.php:47 #: /home/brenard/dev/eesyphp/includes/cli.php:56
msgid " -q / -d Quiet/Debug mode\n" msgid " -q / -d Quiet/Debug mode\n"
msgstr " -q / -d Mode silencieux/debug\n" msgstr " -q / -d Mode silencieux/debug\n"
#: /home/brenard/dev/eesyphp/includes/cli.php:48 #: /home/brenard/dev/eesyphp/includes/cli.php:57
msgid " --trace Trace mode (the most verbose)\n" msgid " --trace Trace mode (the most verbose)\n"
msgstr " --trace Mode trace (le plus verbeux)\n" msgstr " --trace Mode trace (le plus verbeux)\n"
#: /home/brenard/dev/eesyphp/includes/cli.php:49 #: /home/brenard/dev/eesyphp/includes/cli.php:58
msgid " command Command to run\n" msgid " command Command to run\n"
msgstr " command La commande à exécuter\n" msgstr " command La commande à exécuter\n"
#: /home/brenard/dev/eesyphp/includes/cli.php:51 #: /home/brenard/dev/eesyphp/includes/cli.php:60
msgid "Available commands:\n" msgid "Available commands:\n"
msgstr "Commandes disponibles:\n" msgstr "Commandes disponibles:\n"
#: /home/brenard/dev/eesyphp/includes/cli.php:86 #: /home/brenard/dev/eesyphp/includes/cli.php:102
msgid "Only one command could be executed !" msgid "Only one command could be executed !"
msgstr "Une seul commande peut-être exécutée !" msgstr "Une seul commande peut-être exécutée !"
#: /home/brenard/dev/eesyphp/includes/cli.php:110 #: /home/brenard/dev/eesyphp/includes/cli.php:127
#, php-format #, php-format
msgid "" msgid ""
"Invalid parameter \"%s\".\n" "Invalid parameter \"%s\".\n"
@ -240,275 +470,198 @@ msgstr ""
"Note : Les paramètres/arguments de la requête doivent être placés après " "Note : Les paramètres/arguments de la requête doivent être placés après "
"celle-ci." "celle-ci."
#: /home/brenard/dev/eesyphp/includes/cli.php:127 #: /home/brenard/dev/eesyphp/includes/cli.php:149
#, php-format #, php-format
msgid "An exception occured running command %s" msgid "An exception occured running command %s"
msgstr "Une exception est survenue en exécutant la commande %s" msgstr "Une exception est survenue en exécutant la commande %s"
#: /home/brenard/dev/eesyphp/includes/cli.php:133 #: /home/brenard/dev/eesyphp/includes/cli.php:155
#, php-format #, php-format
msgid "Item #%s:\n" msgid "Item #%s:\n"
msgstr "Élément #%s :\n" msgstr "Élément #%s :\n"
#: /home/brenard/dev/eesyphp/includes/cli.php:134 #: /home/brenard/dev/eesyphp/includes/cli.php:156
#, php-format #, php-format
msgid "ID: %s" msgid "ID: %s"
msgstr "ID : %s" msgstr "ID : %s"
#: /home/brenard/dev/eesyphp/includes/cli.php:135 #: /home/brenard/dev/eesyphp/includes/cli.php:157
#, php-format #, php-format
msgid "Name: '%s'" msgid "Name: '%s'"
msgstr "Nom : %s" msgstr "Nom : %s"
#: /home/brenard/dev/eesyphp/includes/cli.php:136 #: /home/brenard/dev/eesyphp/includes/cli.php:158
#, php-format #, php-format
msgid "Date: %s" msgid "Date: %s"
msgstr "Date : %s" msgstr "Date : %s"
#: /home/brenard/dev/eesyphp/includes/cli.php:137 #: /home/brenard/dev/eesyphp/includes/cli.php:160
#, php-format #, php-format
msgid "Description: %s" msgid "Description: %s"
msgstr "Description : %s" msgstr "Description : %s"
#: /home/brenard/dev/eesyphp/includes/cli.php:137 #: /home/brenard/dev/eesyphp/includes/cli.php:161
msgid "Not set" msgid "Not set"
msgstr "Non-défini" msgstr "Non-défini"
#: /home/brenard/dev/eesyphp/includes/cli.php:138 #: /home/brenard/dev/eesyphp/includes/cli.php:163
#, php-format #, php-format
msgid "Status: %s" msgid "Status: %s"
msgstr "Statut : %s" msgstr "Statut : %s"
#: /home/brenard/dev/eesyphp/includes/cli.php:191 #: /home/brenard/dev/eesyphp/includes/cli.php:216
msgid "No item.\n" msgid "No item.\n"
msgstr "Aucun élément.\n" msgstr "Aucun élément.\n"
#: /home/brenard/dev/eesyphp/includes/cli.php:217 #: /home/brenard/dev/eesyphp/includes/cli.php:242
#, php-format #, php-format
msgid "%d item(s)" msgid "%d item(s)"
msgstr "%d élément(s)" msgstr "%d élément(s)"
#: /home/brenard/dev/eesyphp/includes/cli.php:223 #: /home/brenard/dev/eesyphp/includes/cli.php:248
msgid "List/search items" msgid "List/search items"
msgstr "Lister/rechercher les éléments" msgstr "Lister/rechercher les éléments"
#: /home/brenard/dev/eesyphp/includes/cli.php:224 #: /home/brenard/dev/eesyphp/includes/cli.php:249
msgid "[patterns]" msgid "[patterns]"
msgstr "[mots clés]" msgstr "[mots clés]"
#: /home/brenard/dev/eesyphp/includes/cli.php:226 #: /home/brenard/dev/eesyphp/includes/cli.php:251
msgid "-o|--orderby Ordering list criterion. Possible values:" msgid "-o|--orderby Ordering list criterion. Possible values:"
msgstr "-o|--orderby Critère de tri de la liste. Valeurs possibles :" msgstr "-o|--orderby Critère de tri de la liste. Valeurs possibles :"
#: /home/brenard/dev/eesyphp/includes/cli.php:228 #: /home/brenard/dev/eesyphp/includes/cli.php:253
msgid "-r|--reverse Reverse order" msgid "-r|--reverse Reverse order"
msgstr "-r|--reverse Ordre inverse" msgstr "-r|--reverse Ordre inverse"
#: /home/brenard/dev/eesyphp/includes/cli.php:229 #: /home/brenard/dev/eesyphp/includes/cli.php:254
msgid "-s|--status Filter on status. Possible values:" msgid "-s|--status Filter on status. Possible values:"
msgstr "-s|--status Filtrer sur le statut. Valeurs possibles :" msgstr "-s|--status Filtrer sur le statut. Valeurs possibles :"
#: /home/brenard/dev/eesyphp/includes/cli.php:236 #: /home/brenard/dev/eesyphp/includes/cli.php:261
msgid "You must provide a valid ID." msgid "You must provide a valid ID."
msgstr "Vous devez fournir un ID valide." msgstr "Vous devez fournir un ID valide."
#: /home/brenard/dev/eesyphp/includes/cli.php:242 #: /home/brenard/dev/eesyphp/includes/cli.php:267
#: /home/brenard/dev/eesyphp/includes/cli.php:266 #: /home/brenard/dev/eesyphp/includes/cli.php:291
#, php-format #, php-format
msgid "Item #%s not found." msgid "Item #%s not found."
msgstr "Élément #%s introuvable." msgstr "Élément #%s introuvable."
#: /home/brenard/dev/eesyphp/includes/cli.php:250 #: /home/brenard/dev/eesyphp/includes/cli.php:275
msgid "Show item" msgid "Show item"
msgstr "Voir un élément" msgstr "Voir un élément"
#: /home/brenard/dev/eesyphp/includes/cli.php:251 #: /home/brenard/dev/eesyphp/includes/cli.php:276
msgid "[ID]" msgid "[ID]"
msgstr "[ID]" msgstr "[ID]"
#: /home/brenard/dev/eesyphp/includes/cli.php:256 #: /home/brenard/dev/eesyphp/includes/cli.php:281
msgid "You must provide item ID." msgid "You must provide item ID."
msgstr "Vous devez fournir un ID valide." msgstr "Vous devez fournir un ID valide."
#: /home/brenard/dev/eesyphp/includes/cli.php:260 #: /home/brenard/dev/eesyphp/includes/cli.php:285
msgid "Invalid item ID" msgid "Invalid item ID"
msgstr "ID d'élément invalide" msgstr "ID d'élément invalide"
#: /home/brenard/dev/eesyphp/includes/cli.php:271 #: /home/brenard/dev/eesyphp/includes/cli.php:296
msgid "Are you sure you want to delete this item? Type 'yes' to continue: " msgid "Are you sure you want to delete this item? Type 'yes' to continue: "
msgstr "" msgstr ""
"Êtes-vous sûre de vouloir supprimer cet élément ? Taper 'yes' pour " "Êtes-vous sûre de vouloir supprimer cet élément ? Taper 'yes' pour "
"continuer : " "continuer : "
#: /home/brenard/dev/eesyphp/includes/cli.php:275 #: /home/brenard/dev/eesyphp/includes/cli.php:300
msgid "User cancel" msgid "User cancel"
msgstr "L'utilisateur a annulé" msgstr "L'utilisateur a annulé"
#: /home/brenard/dev/eesyphp/includes/cli.php:281 #: /home/brenard/dev/eesyphp/includes/cli.php:306
#, php-format #, php-format
msgid "An error occured deleting item #%d." msgid "An error occured deleting item #%d."
msgstr "Une erreur est survenue en supprimant l'élément #%d." msgstr "Une erreur est survenue en supprimant l'élément #%d."
#: /home/brenard/dev/eesyphp/includes/cli.php:288 #: /home/brenard/dev/eesyphp/includes/cli.php:313
msgid "Delete item" msgid "Delete item"
msgstr "Supprimer un élément" msgstr "Supprimer un élément"
#: /home/brenard/dev/eesyphp/includes/cli.php:289 #: /home/brenard/dev/eesyphp/includes/cli.php:314
msgid "[item ID]" msgid "[item ID]"
msgstr "[ID de l'élément]" msgstr "[ID de l'élément]"
#: /home/brenard/dev/eesyphp/includes/cli.php:301 #: /home/brenard/dev/eesyphp/includes/cli.php:326
msgid "Export items (as CSV)" msgid "Export items (as CSV)"
msgstr "Exporter les éléments (au format CSV)" msgstr "Exporter les éléments (au format CSV)"
#: /home/brenard/dev/eesyphp/includes/cli.php:302 #: /home/brenard/dev/eesyphp/includes/cli.php:327
msgid "[output file path]" msgid "[output file path]"
msgstr "[chemin du fichier de sortie]" msgstr "[chemin du fichier de sortie]"
#: /home/brenard/dev/eesyphp/includes/cli.php:314 #: /home/brenard/dev/eesyphp/includes/cli.php:342
msgid "Restore items (from CSV)" msgid "Restore items (from CSV)"
msgstr "Restaurer les éléments (depuis un fichier CSV)" msgstr "Restaurer les éléments (depuis un fichier CSV)"
#: /home/brenard/dev/eesyphp/includes/cli.php:315 #: /home/brenard/dev/eesyphp/includes/cli.php:343
msgid "[input file path]" msgid "[input file path]"
msgstr "[chemin du fichier d'entrée]" msgstr "[chemin du fichier d'entrée]"
#: /home/brenard/dev/eesyphp/includes/cli.php:374 #: /home/brenard/dev/eesyphp/includes/cli.php:412
msgid "Cron to handle item expiration" msgid "Cron to handle item expiration"
msgstr "Cron gérant l'expiration des éléments" msgstr "Cron gérant l'expiration des éléments"
#: /home/brenard/dev/eesyphp/includes/cli.php:377 #: /home/brenard/dev/eesyphp/includes/cli.php:415
msgid "-j/--just-try Just-try mode : do not really removed expired item(s)" msgid "-j/--just-try Just-try mode : do not really removed expired item(s)"
msgstr "" msgstr ""
"-j/--just-try Mode just-try : Ne supprime pas réellement les éléments " "-j/--just-try Mode just-try : Ne supprime pas réellement les éléments "
"expirés" "expirés"
#: /home/brenard/dev/eesyphp/includes/cli.php:378 #: /home/brenard/dev/eesyphp/includes/cli.php:416
msgid "-m/--max-age Item expiration limit (in days, optional)" msgid "-m/--max-age Item expiration limit (in days, optional)"
msgstr "" msgstr ""
"-m/--max-age Limite d'expiration des éléments (en secondes, optionnel)" "-m/--max-age Limite d'expiration des éléments (en secondes, optionnel)"
#: /home/brenard/dev/eesyphp/includes/cli.php:393 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:4
msgid "Fail to list PHP files." #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:171
msgstr "Impossible de lister les fichiers PHP." #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:200
msgid "Confirmation"
msgstr "Confirmation"
#: /home/brenard/dev/eesyphp/includes/cli.php:410 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:5
msgid "Fail to extract messages from PHP files using xgettext." msgid "Do you confirm?"
msgstr "" msgstr "Confirmez-vous ?"
"Impossible d'extraire les messages depuis les fichiers PHP en utilisant "
"xgettext."
#: /home/brenard/dev/eesyphp/includes/cli.php:421 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:11
msgid "" #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:108
"Fail to extract messages from template files using tsmarty2c.php script." msgid "Cancel"
msgstr "" msgstr "Annuler"
"Impossible d'extraire les messages depuis les fichiers template en utilisant "
"le script tsmarty2c.php."
#: /home/brenard/dev/eesyphp/includes/cli.php:431 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:17
msgid "Fail to merge messages using msgcat." #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:114
msgstr "Impossible de fusionner les messages en utilisant msgcat." msgid "Validate"
msgstr "Valider"
#: /home/brenard/dev/eesyphp/includes/cli.php:436 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:52
msgid "Extract messages that need to be translated" msgid "OK"
msgstr "Extraire les messages devant être traduit" msgstr "OK"
#: /home/brenard/dev/eesyphp/includes/cli.php:438 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:91
msgid "This command could be used to generate/update lang/messages.pot file." msgid "Question"
msgstr "" msgstr "Question"
"Cette commande peut-être utilisée pour générer/mettre à jour le fichier lang/"
"messages.pot."
#: /home/brenard/dev/eesyphp/includes/cli.php:449 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:92
#, php-format msgid "Please enter your answer below:"
msgid "POT file not found (%s). Please run extract_messages first." msgstr "Merci de saisir vos réponses ci-dessous :"
msgstr ""
"Fichier POT introuvable (%s). Merci de lancer la commande extract_messages "
"pour commencer."
#: /home/brenard/dev/eesyphp/includes/cli.php:460 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:143
#: /home/brenard/dev/eesyphp/includes/cli.php:519 msgid "Please wait"
#, php-format msgstr "Merci de patienter"
msgid "Lang directory '%s' found"
msgstr "Dossier de langue '%s' trouvé"
#: /home/brenard/dev/eesyphp/includes/cli.php:467 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:144
#: /home/brenard/dev/eesyphp/includes/cli.php:526 msgid "Please wait while your request is being processed."
#, php-format msgstr "Merci de patienter pendant le traitement de votre requête."
msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it."
msgstr ""
"Le dossier LC_MESSAGES est introuvable dans le dossier de langue '%s', on "
"l'ignore."
#: /home/brenard/dev/eesyphp/includes/cli.php:477 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:172
#: /home/brenard/dev/eesyphp/includes/cli.php:536 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:201
#, php-format msgid "Are you sure?"
msgid "PO file not found in lang '%s' directory, ignore it." msgstr "Êtes-vous sure ?"
msgstr ""
"Le fichier PO est introuvable dans le dossier de langue '%s', on l'ignore."
#: /home/brenard/dev/eesyphp/includes/cli.php:489
#, php-format
msgid "Fail to update messages in %s PO file using msgmerge (%s)."
msgstr ""
"Impossible de mettre à jour les messages dans les fichiers PO %s en "
"utilisant msgmerge (%s)."
#: /home/brenard/dev/eesyphp/includes/cli.php:499
#: /home/brenard/dev/eesyphp/includes/cli.php:560
#, php-format
msgid "Fail to open root lang directory (%s)."
msgstr "Impossible d'ouvrir le dossier racine des langues (%s)."
#: /home/brenard/dev/eesyphp/includes/cli.php:504
msgid "Update messages in existing translation PO lang files"
msgstr ""
"Mettre à jour les messages dans les fichiers de traduction PO existants"
#: /home/brenard/dev/eesyphp/includes/cli.php:506
msgid ""
"This command could be used to update PO files in lang/*/LC_MESSAGES "
"directories."
msgstr ""
"Cette commande peut-être utilisée pour mettre à jour les fichiers PO les "
"dossiers lang/*/LC_MESSAGES."
#: /home/brenard/dev/eesyphp/includes/cli.php:550
#, php-format
msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)."
msgstr ""
"Impossible de compiler les messages depuis le fichier PO %s en tant que "
"fichier MO en utilisant msgfmt (%s)."
#: /home/brenard/dev/eesyphp/includes/cli.php:565
msgid ""
"Compile messages from existing translation PO lang files to corresponding MO "
"files"
msgstr ""
"Compiler les messages depuis les fichiers PO de traduction existants vers "
"les fichiers MO correspondant"
#: /home/brenard/dev/eesyphp/includes/cli.php:567
msgid ""
"This command could be used to compile PO files in lang/*/LC_MESSAGES "
"directories to MO files."
msgstr ""
"Cette commande peut-être utilisée pour compiler les fichiers PO dans les "
"dossiers lang/*/LC_MESSAGES en fichiers MO."
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.4.2\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: /home/brenard/dev/eesyphp/templates/form.tpl:7 #: /home/brenard/dev/eesyphp/templates/form.tpl:7
#: /home/brenard/dev/eesyphp/templates/search.tpl:36 #: /home/brenard/dev/eesyphp/templates/search.tpl:36
@ -610,12 +763,10 @@ msgid "No item found."
msgstr "Aucun élément trouvé." msgstr "Aucun élément trouvé."
#: /home/brenard/dev/eesyphp/templates/search.tpl:68 #: /home/brenard/dev/eesyphp/templates/search.tpl:68
msgid "Element(s) %1 to %2 on %3" msgid "%3 element"
msgstr "Élément(s) %1 à %2 sur %3" msgid_plural "Elements %1 to %2 on %3"
msgstr[0] "%3 élément"
#: /home/brenard/dev/eesyphp/templates/error_404.tpl:3 msgstr[1] "Éléments %1 à %2 sur %3"
msgid "The requested page can not be found."
msgstr "La page demandée est introuvable."
#: /home/brenard/dev/eesyphp/templates/show.tpl:14 #: /home/brenard/dev/eesyphp/templates/show.tpl:14
msgid "Creation date" msgid "Creation date"
@ -644,3 +795,31 @@ msgstr "Cette application contient quelques pages de démo :"
#: /home/brenard/dev/eesyphp/templates/homepage.tpl:9 #: /home/brenard/dev/eesyphp/templates/homepage.tpl:9
msgid "Search page" msgid "Search page"
msgstr "Page de recherche" msgstr "Page de recherche"
#~ msgid "Update messages in existing translation PO lang files"
#~ msgstr ""
#~ "Mettre à jour les messages dans les fichiers de traduction PO existants"
#~ msgid ""
#~ "This command could be used to update PO files in lang/*/LC_MESSAGES "
#~ "directories."
#~ msgstr ""
#~ "Cette commande peut-être utilisée pour mettre à jour les fichiers PO les "
#~ "dossiers lang/*/LC_MESSAGES."
#~ msgid ""
#~ "Compile messages from existing translation PO lang files to corresponding "
#~ "MO files"
#~ msgstr ""
#~ "Compiler les messages depuis les fichiers PO de traduction existants vers "
#~ "les fichiers MO correspondant"
#~ msgid ""
#~ "This command could be used to compile PO files in lang/*/LC_MESSAGES "
#~ "directories to MO files."
#~ msgstr ""
#~ "Cette commande peut-être utilisée pour compiler les fichiers PO dans les "
#~ "dossiers lang/*/LC_MESSAGES en fichiers MO."
#~ msgid "Element(s) %1 to %2 on %3"
#~ msgstr "Élément(s) %1 à %2 sur %3"

7
lang/headers.pot Normal file
View file

@ -0,0 +1,7 @@
msgid ""
msgstr ""
"POT-Creation-Date: 2022-04-24 20:13+0200\n"
"PO-Revision-Date: 2022-04-24 20:13+0200\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"

48
lang/js-messages.pot Normal file
View file

@ -0,0 +1,48 @@
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:4
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:171
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:200
msgid "Confirmation"
msgstr ""
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:5
msgid "Do you confirm?"
msgstr ""
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:11
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:108
msgid "Cancel"
msgstr ""
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:17
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:114
msgid "Validate"
msgstr ""
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:44
msgid "Error"
msgstr ""
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:52
msgid "OK"
msgstr ""
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:91
msgid "Question"
msgstr ""
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:92
msgid "Please enter your answer below:"
msgstr ""
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:143
msgid "Please wait"
msgstr ""
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:144
msgid "Please wait while your request is being processed."
msgstr ""
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:172
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:201
msgid "Are you sure?"
msgstr ""

View file

@ -1,10 +1,18 @@
msgid ""
msgstr ""
"POT-Creation-Date: 2022-04-24 20:13+0200\n"
"PO-Revision-Date: 2022-04-24 20:13+0200\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: /home/brenard/dev/eesyphp/includes/url-helpers.php:5 #: /home/brenard/dev/eesyphp/includes/url-helpers.php:5
msgid "Invalid element identifier." msgid "Invalid element identifier."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-helpers.php:9 #: /home/brenard/dev/eesyphp/includes/url-helpers.php:9
#: /home/brenard/dev/eesyphp/includes/url-public.php:203 #: /home/brenard/dev/eesyphp/includes/url-public.php:222
#: /home/brenard/dev/eesyphp/includes/url-public.php:227 #: /home/brenard/dev/eesyphp/includes/url-public.php:246
#, php-format #, php-format
msgid "Item #% s not found." msgid "Item #% s not found."
msgstr "" msgstr ""
@ -13,114 +21,113 @@ msgstr ""
msgid "Smarty version not supported." msgid "Smarty version not supported."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/smarty.php:134 #: /home/brenard/dev/eesyphp/includes/smarty.php:148
msgid "No template specified." msgid "No template specified."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/smarty.php:145 #: /home/brenard/dev/eesyphp/includes/smarty.php:166
msgid "An error occurred while viewing this page." msgid "An error occurred while viewing this page."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:7 #: /home/brenard/dev/eesyphp/includes/url-public.php:7
#: /home/brenard/dev/eesyphp/includes/translation.php:134 #: /home/brenard/dev/eesyphp/includes/translation.php:140
msgid "Hello world !" msgid "Hello world !"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:27 #: /home/brenard/dev/eesyphp/includes/url-public.php:31
msgid "Any" msgid "Any"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:84 #: /home/brenard/dev/eesyphp/includes/url-public.php:89
msgid "" msgid ""
"An error occurred while listing the items. If the problem persists, please " "An error occurred while listing the items. If the problem persists, please "
"contact support." "contact support."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:96 #: /home/brenard/dev/eesyphp/includes/url-public.php:104
#: /home/brenard/dev/eesyphp/templates/search.tpl:22
msgid "Search" msgid "Search"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:118 #: /home/brenard/dev/eesyphp/includes/url-public.php:128
#, php-format #, php-format
msgid "Element %s" msgid "Element %s"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:130 #: /home/brenard/dev/eesyphp/includes/url-public.php:142
#, php-format #, php-format
msgid "The element '% s' has been created." msgid "The element '% s' has been created."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:134 #: /home/brenard/dev/eesyphp/includes/url-public.php:146
msgid "An error occurred while saving this item." msgid "An error occurred while saving this item."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:140 #: /home/brenard/dev/eesyphp/includes/url-public.php:153
msgid "" msgid ""
"There are errors preventing this item from being saved. Please correct them " "There are errors preventing this item from being saved. Please correct them "
"before attempting to add this item." "before attempting to add this item."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:146 #: /home/brenard/dev/eesyphp/includes/url-public.php:160
msgid "New" msgid "New"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:156 #: /home/brenard/dev/eesyphp/includes/url-public.php:170
msgid "You cannot edit this item." msgid "You cannot edit this item."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:169 #: /home/brenard/dev/eesyphp/includes/url-public.php:183
#, php-format #, php-format
msgid "You have not made any changes to element '% s'." msgid "You have not made any changes to element '% s'."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:173 #: /home/brenard/dev/eesyphp/includes/url-public.php:187
#, php-format #, php-format
msgid "The element '% s' has been updated successfully." msgid "The element '% s' has been updated successfully."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:177 #: /home/brenard/dev/eesyphp/includes/url-public.php:191
msgid "An error occurred while updating this item." msgid "An error occurred while updating this item."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:184 #: /home/brenard/dev/eesyphp/includes/url-public.php:199
msgid "" msgid ""
"There are errors preventing this item from being saved. Please correct them " "There are errors preventing this item from being saved. Please correct them "
"before attempting to save your changes." "before attempting to save your changes."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:194 #: /home/brenard/dev/eesyphp/includes/url-public.php:211
#, php-format #, php-format
msgid "Element %s: Modification" msgid "Element %s: Modification"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:207 #: /home/brenard/dev/eesyphp/includes/url-public.php:226
msgid "This item is already archived." msgid "This item is already archived."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:210 #: /home/brenard/dev/eesyphp/includes/url-public.php:229
msgid "You cannot archive this item." msgid "You cannot archive this item."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:213 #: /home/brenard/dev/eesyphp/includes/url-public.php:232
#, php-format #, php-format
msgid "The element '% s' has been archived successfully." msgid "The element '% s' has been archived successfully."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:216 #: /home/brenard/dev/eesyphp/includes/url-public.php:235
msgid "An error occurred while archiving this item." msgid "An error occurred while archiving this item."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:230 #: /home/brenard/dev/eesyphp/includes/url-public.php:249
msgid "You cannot delete this item." msgid "You cannot delete this item."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:233 #: /home/brenard/dev/eesyphp/includes/url-public.php:252
#, php-format #, php-format
msgid "The element '% s' has been deleted successfully." msgid "The element '% s' has been deleted successfully."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:236 #: /home/brenard/dev/eesyphp/includes/url-public.php:255
msgid "An error occurred while deleting this item." msgid "An error occurred while deleting this item."
msgstr "" msgstr ""
@ -144,7 +151,152 @@ msgstr ""
msgid "Archived" msgid "Archived"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/mail.php:12 #: /home/brenard/dev/eesyphp/includes/translation-cli.php:59
msgid "Fail to list PHP files."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:76
msgid "Fail to extract messages from PHP files using xgettext."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:86
msgid "Fail to list JS files."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:103
msgid "Fail to extract messages from JS files using xgettext."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:116
msgid ""
"Fail to extract messages from template files using tsmarty2c.php script."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:142
msgid "Fail to merge messages using msgcat."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:147
msgid "Extract messages that need to be translated"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:149
msgid "This command could be used to generate/update lang/messages.pot file."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:165
#, php-format
msgid "Compendium file %s not found."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:172
#, php-format
msgid "POT file not found (%s). Please run extract_messages first."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:184
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:301
#, php-format
msgid "Lang directory '%s' found"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:190
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:307
#, php-format
msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:205
#, php-format
msgid "Fail to init messages in %s PO file using msginit (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:223
#, php-format
msgid "Fail to update messages in %s PO file using msgmerge (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:229
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:315
#, php-format
msgid "PO file not found in lang '%s' directory, ignore it."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:236
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:356
#, php-format
msgid "Fail to open root lang directory (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:241
msgid "Update messages in translation PO lang files"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:243
msgid ""
"This command could be used to init/update PO files in lang/*/LC_MESSAGES "
"directories."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:270
#, php-format
msgid "Lang alias symlink found: %s -> %s"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:277
#, php-format
msgid "JSON catalog symlink for %s -> %s created (%s)"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:281
#, php-format
msgid "Fail to create JSON catalog symlink for %s -> %s (%s)"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:287
#, php-format
msgid "JSON catalog symlink for %s -> %s already exist (%s)"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:293
#, php-format
msgid ""
"JSON catalog file for %s already exist, but it's not a symlink to %s (%s)"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:329
#, php-format
msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:339
#, php-format
msgid "Fail to open %s JSON catalog file in write mode (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:344
#, php-format
msgid "Fail to write %s JSON catalog in file (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:349
#, php-format
msgid "%s JSON catalog writed (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:362
msgid ""
"Compile messages from existing translation PO lang files to corresponding MO "
"files and JSON catalogs"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:367
msgid ""
"This command could be used to compile PO files in lang/*/LC_MESSAGES "
"directories to MO files and as JSON catalogs in public_html/translations."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/mail.php:14
#, php-format #, php-format
msgid "" msgid ""
"\n" "\n"
@ -153,308 +305,302 @@ msgid ""
"Mail initialy intended for %s." "Mail initialy intended for %s."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:86 #: /home/brenard/dev/eesyphp/includes/url.php:92
msgid "Bad request"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:93
msgid "Invalid request."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:96
msgid "Authentication required"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:97
msgid "You have to be authenticated to access to this page."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:100
msgid "Access denied"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:101
msgid ""
"You do not have access to this application. If you think this is an error, "
"please contact support."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:104
msgid "Whoops ! Page not found" msgid "Whoops ! Page not found"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:109 #: /home/brenard/dev/eesyphp/includes/url.php:105
msgid "The requested page can not be found."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:113
msgid "Error"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:114
msgid "An unknown error occurred. If problem persist, please contact support."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:159
msgid "" msgid ""
"Unable to determine the requested page. If the problem persists, please " "Unable to determine the requested page. If the problem persists, please "
"contact support." "contact support."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:247 #: /home/brenard/dev/eesyphp/includes/url.php:312
msgid "" msgid ""
"Unable to determine the requested page (loop detected). If the problem " "Unable to determine the requested page (loop detected). If the problem "
"persists, please contact support." "persists, please contact support."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:271 #: /home/brenard/dev/eesyphp/includes/url.php:337
msgid "This request cannot be processed." msgid "This request cannot be processed."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:288 #: /home/brenard/dev/eesyphp/includes/url.php:355
msgid "This request could not be processed correctly." msgid "This request could not be processed correctly."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:7 #: /home/brenard/dev/eesyphp/includes/cli.php:8
#, php-format #, php-format
msgid "The CLI command '%s' already exists." msgid "The CLI command '%s' already exists."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:12 #: /home/brenard/dev/eesyphp/includes/cli.php:13
#, php-format #, php-format
msgid "The CLI command '%s' handler is not callable !" msgid "The CLI command '%s' handler is not callable !"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:45 #: /home/brenard/dev/eesyphp/includes/cli.php:54
#, php-format #, php-format
msgid "Usage: %s [-h] [-qd] command\n" msgid "Usage: %s [-h] [-qd] command\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:46 #: /home/brenard/dev/eesyphp/includes/cli.php:55
msgid " -h Show this message\n" msgid " -h Show this message\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:47 #: /home/brenard/dev/eesyphp/includes/cli.php:56
msgid " -q / -d Quiet/Debug mode\n" msgid " -q / -d Quiet/Debug mode\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:48 #: /home/brenard/dev/eesyphp/includes/cli.php:57
msgid " --trace Trace mode (the most verbose)\n" msgid " --trace Trace mode (the most verbose)\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:49 #: /home/brenard/dev/eesyphp/includes/cli.php:58
msgid " command Command to run\n" msgid " command Command to run\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:51 #: /home/brenard/dev/eesyphp/includes/cli.php:60
msgid "Available commands:\n" msgid "Available commands:\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:86 #: /home/brenard/dev/eesyphp/includes/cli.php:102
msgid "Only one command could be executed !" msgid "Only one command could be executed !"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:110 #: /home/brenard/dev/eesyphp/includes/cli.php:127
#, php-format #, php-format
msgid "" msgid ""
"Invalid parameter \"%s\".\n" "Invalid parameter \"%s\".\n"
"Note: Command's parameter/argument must be place after the command." "Note: Command's parameter/argument must be place after the command."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:127 #: /home/brenard/dev/eesyphp/includes/cli.php:149
#, php-format #, php-format
msgid "An exception occured running command %s" msgid "An exception occured running command %s"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:133 #: /home/brenard/dev/eesyphp/includes/cli.php:155
#, php-format #, php-format
msgid "Item #%s:\n" msgid "Item #%s:\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:134 #: /home/brenard/dev/eesyphp/includes/cli.php:156
#, php-format #, php-format
msgid "ID: %s" msgid "ID: %s"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:135 #: /home/brenard/dev/eesyphp/includes/cli.php:157
#, php-format #, php-format
msgid "Name: '%s'" msgid "Name: '%s'"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:136 #: /home/brenard/dev/eesyphp/includes/cli.php:158
#, php-format #, php-format
msgid "Date: %s" msgid "Date: %s"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:137 #: /home/brenard/dev/eesyphp/includes/cli.php:160
#, php-format #, php-format
msgid "Description: %s" msgid "Description: %s"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:137 #: /home/brenard/dev/eesyphp/includes/cli.php:161
msgid "Not set" msgid "Not set"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:138 #: /home/brenard/dev/eesyphp/includes/cli.php:163
#, php-format #, php-format
msgid "Status: %s" msgid "Status: %s"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:191 #: /home/brenard/dev/eesyphp/includes/cli.php:216
msgid "No item.\n" msgid "No item.\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:217 #: /home/brenard/dev/eesyphp/includes/cli.php:242
#, php-format #, php-format
msgid "%d item(s)" msgid "%d item(s)"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:223 #: /home/brenard/dev/eesyphp/includes/cli.php:248
msgid "List/search items" msgid "List/search items"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:224 #: /home/brenard/dev/eesyphp/includes/cli.php:249
msgid "[patterns]" msgid "[patterns]"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:226 #: /home/brenard/dev/eesyphp/includes/cli.php:251
msgid "-o|--orderby Ordering list criterion. Possible values:" msgid "-o|--orderby Ordering list criterion. Possible values:"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:228 #: /home/brenard/dev/eesyphp/includes/cli.php:253
msgid "-r|--reverse Reverse order" msgid "-r|--reverse Reverse order"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:229 #: /home/brenard/dev/eesyphp/includes/cli.php:254
msgid "-s|--status Filter on status. Possible values:" msgid "-s|--status Filter on status. Possible values:"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:236 #: /home/brenard/dev/eesyphp/includes/cli.php:261
msgid "You must provide a valid ID." msgid "You must provide a valid ID."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:242 #: /home/brenard/dev/eesyphp/includes/cli.php:267
#: /home/brenard/dev/eesyphp/includes/cli.php:266 #: /home/brenard/dev/eesyphp/includes/cli.php:291
#, php-format #, php-format
msgid "Item #%s not found." msgid "Item #%s not found."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:250 #: /home/brenard/dev/eesyphp/includes/cli.php:275
msgid "Show item" msgid "Show item"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:251 #: /home/brenard/dev/eesyphp/includes/cli.php:276
msgid "[ID]" msgid "[ID]"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:256 #: /home/brenard/dev/eesyphp/includes/cli.php:281
msgid "You must provide item ID." msgid "You must provide item ID."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:260 #: /home/brenard/dev/eesyphp/includes/cli.php:285
msgid "Invalid item ID" msgid "Invalid item ID"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:271 #: /home/brenard/dev/eesyphp/includes/cli.php:296
msgid "Are you sure you want to delete this item? Type 'yes' to continue: " msgid "Are you sure you want to delete this item? Type 'yes' to continue: "
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:275 #: /home/brenard/dev/eesyphp/includes/cli.php:300
msgid "User cancel" msgid "User cancel"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:281 #: /home/brenard/dev/eesyphp/includes/cli.php:306
#, php-format #, php-format
msgid "An error occured deleting item #%d." msgid "An error occured deleting item #%d."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:288 #: /home/brenard/dev/eesyphp/includes/cli.php:313
msgid "Delete item" msgid "Delete item"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:289 #: /home/brenard/dev/eesyphp/includes/cli.php:314
msgid "[item ID]" msgid "[item ID]"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:301 #: /home/brenard/dev/eesyphp/includes/cli.php:326
msgid "Export items (as CSV)" msgid "Export items (as CSV)"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:302 #: /home/brenard/dev/eesyphp/includes/cli.php:327
msgid "[output file path]" msgid "[output file path]"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:314 #: /home/brenard/dev/eesyphp/includes/cli.php:342
msgid "Restore items (from CSV)" msgid "Restore items (from CSV)"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:315 #: /home/brenard/dev/eesyphp/includes/cli.php:343
msgid "[input file path]" msgid "[input file path]"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:374 #: /home/brenard/dev/eesyphp/includes/cli.php:412
msgid "Cron to handle item expiration" msgid "Cron to handle item expiration"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:377 #: /home/brenard/dev/eesyphp/includes/cli.php:415
msgid "-j/--just-try Just-try mode : do not really removed expired item(s)" msgid "-j/--just-try Just-try mode : do not really removed expired item(s)"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:378 #: /home/brenard/dev/eesyphp/includes/cli.php:416
msgid "-m/--max-age Item expiration limit (in days, optional)" msgid "-m/--max-age Item expiration limit (in days, optional)"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:393 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:4
msgid "Fail to list PHP files." #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:171
#: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:200
msgid "Confirmation"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:410 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:5
msgid "Fail to extract messages from PHP files using xgettext." msgid "Do you confirm?"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:421 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:11
msgid "" #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:108
"Fail to extract messages from template files using tsmarty2c.php script." msgid "Cancel"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:431 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:17
msgid "Fail to merge messages using msgcat." #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:114
msgid "Validate"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:436 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:52
msgid "Extract messages that need to be translated" msgid "OK"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:438 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:91
msgid "This command could be used to generate/update lang/messages.pot file." msgid "Question"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:449 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:92
#, php-format msgid "Please enter your answer below:"
msgid "POT file not found (%s). Please run extract_messages first."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:460 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:143
#: /home/brenard/dev/eesyphp/includes/cli.php:519 msgid "Please wait"
#, php-format
msgid "Lang directory '%s' found"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:467 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:144
#: /home/brenard/dev/eesyphp/includes/cli.php:526 msgid "Please wait while your request is being processed."
#, php-format
msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:477 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:172
#: /home/brenard/dev/eesyphp/includes/cli.php:536 #: /home/brenard/dev/eesyphp/public_html/js/myconfirm.js:201
#, php-format msgid "Are you sure?"
msgid "PO file not found in lang '%s' directory, ignore it."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:489
#, php-format
msgid "Fail to update messages in %s PO file using msgmerge (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:499
#: /home/brenard/dev/eesyphp/includes/cli.php:560
#, php-format
msgid "Fail to open root lang directory (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:504
msgid "Update messages in existing translation PO lang files"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:506
msgid ""
"This command could be used to update PO files in lang/*/LC_MESSAGES "
"directories."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:550
#, php-format
msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:565
msgid ""
"Compile messages from existing translation PO lang files to corresponding MO "
"files"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:567
msgid ""
"This command could be used to compile PO files in lang/*/LC_MESSAGES "
"directories to MO files."
msgstr ""
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8\n"
#: /home/brenard/dev/eesyphp/templates/form.tpl:7 #: /home/brenard/dev/eesyphp/templates/form.tpl:7
#: /home/brenard/dev/eesyphp/templates/search.tpl:36 #: /home/brenard/dev/eesyphp/templates/search.tpl:36
#: /home/brenard/dev/eesyphp/templates/show.tpl:5 #: /home/brenard/dev/eesyphp/templates/show.tpl:5
@ -552,12 +698,10 @@ msgid "No item found."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/templates/search.tpl:68 #: /home/brenard/dev/eesyphp/templates/search.tpl:68
msgid "Element(s) %1 to %2 on %3" msgid "%3 element"
msgstr "" msgid_plural "Elements %1 to %2 on %3"
msgstr[0] ""
#: /home/brenard/dev/eesyphp/templates/error_404.tpl:3 msgstr[1] ""
msgid "The requested page can not be found."
msgstr ""
#: /home/brenard/dev/eesyphp/templates/show.tpl:14 #: /home/brenard/dev/eesyphp/templates/show.tpl:14
msgid "Creation date" msgid "Creation date"

View file

@ -3,8 +3,8 @@ msgid "Invalid element identifier."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-helpers.php:9 #: /home/brenard/dev/eesyphp/includes/url-helpers.php:9
#: /home/brenard/dev/eesyphp/includes/url-public.php:203 #: /home/brenard/dev/eesyphp/includes/url-public.php:222
#: /home/brenard/dev/eesyphp/includes/url-public.php:227 #: /home/brenard/dev/eesyphp/includes/url-public.php:246
#, php-format #, php-format
msgid "Item #% s not found." msgid "Item #% s not found."
msgstr "" msgstr ""
@ -13,113 +13,113 @@ msgstr ""
msgid "Smarty version not supported." msgid "Smarty version not supported."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/smarty.php:134 #: /home/brenard/dev/eesyphp/includes/smarty.php:148
msgid "No template specified." msgid "No template specified."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/smarty.php:145 #: /home/brenard/dev/eesyphp/includes/smarty.php:166
msgid "An error occurred while viewing this page." msgid "An error occurred while viewing this page."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:7 #: /home/brenard/dev/eesyphp/includes/url-public.php:7
#: /home/brenard/dev/eesyphp/includes/translation.php:134 #: /home/brenard/dev/eesyphp/includes/translation.php:140
msgid "Hello world !" msgid "Hello world !"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:27 #: /home/brenard/dev/eesyphp/includes/url-public.php:31
msgid "Any" msgid "Any"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:84 #: /home/brenard/dev/eesyphp/includes/url-public.php:89
msgid "" msgid ""
"An error occurred while listing the items. If the problem persists, please " "An error occurred while listing the items. If the problem persists, please "
"contact support." "contact support."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:96 #: /home/brenard/dev/eesyphp/includes/url-public.php:104
msgid "Search" msgid "Search"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:118 #: /home/brenard/dev/eesyphp/includes/url-public.php:128
#, php-format #, php-format
msgid "Element %s" msgid "Element %s"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:130 #: /home/brenard/dev/eesyphp/includes/url-public.php:142
#, php-format #, php-format
msgid "The element '% s' has been created." msgid "The element '% s' has been created."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:134 #: /home/brenard/dev/eesyphp/includes/url-public.php:146
msgid "An error occurred while saving this item." msgid "An error occurred while saving this item."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:140 #: /home/brenard/dev/eesyphp/includes/url-public.php:153
msgid "" msgid ""
"There are errors preventing this item from being saved. Please correct them " "There are errors preventing this item from being saved. Please correct them "
"before attempting to add this item." "before attempting to add this item."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:146 #: /home/brenard/dev/eesyphp/includes/url-public.php:160
msgid "New" msgid "New"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:156 #: /home/brenard/dev/eesyphp/includes/url-public.php:170
msgid "You cannot edit this item." msgid "You cannot edit this item."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:169 #: /home/brenard/dev/eesyphp/includes/url-public.php:183
#, php-format #, php-format
msgid "You have not made any changes to element '% s'." msgid "You have not made any changes to element '% s'."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:173 #: /home/brenard/dev/eesyphp/includes/url-public.php:187
#, php-format #, php-format
msgid "The element '% s' has been updated successfully." msgid "The element '% s' has been updated successfully."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:177 #: /home/brenard/dev/eesyphp/includes/url-public.php:191
msgid "An error occurred while updating this item." msgid "An error occurred while updating this item."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:184 #: /home/brenard/dev/eesyphp/includes/url-public.php:199
msgid "" msgid ""
"There are errors preventing this item from being saved. Please correct them " "There are errors preventing this item from being saved. Please correct them "
"before attempting to save your changes." "before attempting to save your changes."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:194 #: /home/brenard/dev/eesyphp/includes/url-public.php:211
#, php-format #, php-format
msgid "Element %s: Modification" msgid "Element %s: Modification"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:207 #: /home/brenard/dev/eesyphp/includes/url-public.php:226
msgid "This item is already archived." msgid "This item is already archived."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:210 #: /home/brenard/dev/eesyphp/includes/url-public.php:229
msgid "You cannot archive this item." msgid "You cannot archive this item."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:213 #: /home/brenard/dev/eesyphp/includes/url-public.php:232
#, php-format #, php-format
msgid "The element '% s' has been archived successfully." msgid "The element '% s' has been archived successfully."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:216 #: /home/brenard/dev/eesyphp/includes/url-public.php:235
msgid "An error occurred while archiving this item." msgid "An error occurred while archiving this item."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:230 #: /home/brenard/dev/eesyphp/includes/url-public.php:249
msgid "You cannot delete this item." msgid "You cannot delete this item."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:233 #: /home/brenard/dev/eesyphp/includes/url-public.php:252
#, php-format #, php-format
msgid "The element '% s' has been deleted successfully." msgid "The element '% s' has been deleted successfully."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url-public.php:236 #: /home/brenard/dev/eesyphp/includes/url-public.php:255
msgid "An error occurred while deleting this item." msgid "An error occurred while deleting this item."
msgstr "" msgstr ""
@ -143,7 +143,152 @@ msgstr ""
msgid "Archived" msgid "Archived"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/mail.php:12 #: /home/brenard/dev/eesyphp/includes/translation-cli.php:59
msgid "Fail to list PHP files."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:76
msgid "Fail to extract messages from PHP files using xgettext."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:86
msgid "Fail to list JS files."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:103
msgid "Fail to extract messages from JS files using xgettext."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:116
msgid ""
"Fail to extract messages from template files using tsmarty2c.php script."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:142
msgid "Fail to merge messages using msgcat."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:147
msgid "Extract messages that need to be translated"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:149
msgid "This command could be used to generate/update lang/messages.pot file."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:165
#, php-format
msgid "Compendium file %s not found."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:172
#, php-format
msgid "POT file not found (%s). Please run extract_messages first."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:184
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:301
#, php-format
msgid "Lang directory '%s' found"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:190
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:307
#, php-format
msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:205
#, php-format
msgid "Fail to init messages in %s PO file using msginit (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:223
#, php-format
msgid "Fail to update messages in %s PO file using msgmerge (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:229
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:315
#, php-format
msgid "PO file not found in lang '%s' directory, ignore it."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:236
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:356
#, php-format
msgid "Fail to open root lang directory (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:241
msgid "Update messages in translation PO lang files"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:243
msgid ""
"This command could be used to init/update PO files in lang/*/LC_MESSAGES "
"directories."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:270
#, php-format
msgid "Lang alias symlink found: %s -> %s"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:277
#, php-format
msgid "JSON catalog symlink for %s -> %s created (%s)"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:281
#, php-format
msgid "Fail to create JSON catalog symlink for %s -> %s (%s)"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:287
#, php-format
msgid "JSON catalog symlink for %s -> %s already exist (%s)"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:293
#, php-format
msgid ""
"JSON catalog file for %s already exist, but it's not a symlink to %s (%s)"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:329
#, php-format
msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:339
#, php-format
msgid "Fail to open %s JSON catalog file in write mode (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:344
#, php-format
msgid "Fail to write %s JSON catalog in file (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:349
#, php-format
msgid "%s JSON catalog writed (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:362
msgid ""
"Compile messages from existing translation PO lang files to corresponding MO "
"files and JSON catalogs"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/translation-cli.php:367
msgid ""
"This command could be used to compile PO files in lang/*/LC_MESSAGES "
"directories to MO files and as JSON catalogs in public_html/translations."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/mail.php:14
#, php-format #, php-format
msgid "" msgid ""
"\n" "\n"
@ -152,301 +297,253 @@ msgid ""
"Mail initialy intended for %s." "Mail initialy intended for %s."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:86 #: /home/brenard/dev/eesyphp/includes/url.php:92
msgid "Bad request"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:93
msgid "Invalid request."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:96
msgid "Authentication required"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:97
msgid "You have to be authenticated to access to this page."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:100
msgid "Access denied"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:101
msgid ""
"You do not have access to this application. If you think this is an error, "
"please contact support."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:104
msgid "Whoops ! Page not found" msgid "Whoops ! Page not found"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:109 #: /home/brenard/dev/eesyphp/includes/url.php:105
msgid "The requested page can not be found."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:113
msgid "Error"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:114
msgid "An unknown error occurred. If problem persist, please contact support."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:159
msgid "" msgid ""
"Unable to determine the requested page. If the problem persists, please " "Unable to determine the requested page. If the problem persists, please "
"contact support." "contact support."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:247 #: /home/brenard/dev/eesyphp/includes/url.php:312
msgid "" msgid ""
"Unable to determine the requested page (loop detected). If the problem " "Unable to determine the requested page (loop detected). If the problem "
"persists, please contact support." "persists, please contact support."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:271 #: /home/brenard/dev/eesyphp/includes/url.php:337
msgid "This request cannot be processed." msgid "This request cannot be processed."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/url.php:288 #: /home/brenard/dev/eesyphp/includes/url.php:355
msgid "This request could not be processed correctly." msgid "This request could not be processed correctly."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:7 #: /home/brenard/dev/eesyphp/includes/cli.php:8
#, php-format #, php-format
msgid "The CLI command '%s' already exists." msgid "The CLI command '%s' already exists."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:12 #: /home/brenard/dev/eesyphp/includes/cli.php:13
#, php-format #, php-format
msgid "The CLI command '%s' handler is not callable !" msgid "The CLI command '%s' handler is not callable !"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:45 #: /home/brenard/dev/eesyphp/includes/cli.php:54
#, php-format #, php-format
msgid "Usage: %s [-h] [-qd] command\n" msgid "Usage: %s [-h] [-qd] command\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:46 #: /home/brenard/dev/eesyphp/includes/cli.php:55
msgid " -h Show this message\n" msgid " -h Show this message\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:47 #: /home/brenard/dev/eesyphp/includes/cli.php:56
msgid " -q / -d Quiet/Debug mode\n" msgid " -q / -d Quiet/Debug mode\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:48 #: /home/brenard/dev/eesyphp/includes/cli.php:57
msgid " --trace Trace mode (the most verbose)\n" msgid " --trace Trace mode (the most verbose)\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:49 #: /home/brenard/dev/eesyphp/includes/cli.php:58
msgid " command Command to run\n" msgid " command Command to run\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:51 #: /home/brenard/dev/eesyphp/includes/cli.php:60
msgid "Available commands:\n" msgid "Available commands:\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:86 #: /home/brenard/dev/eesyphp/includes/cli.php:102
msgid "Only one command could be executed !" msgid "Only one command could be executed !"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:110 #: /home/brenard/dev/eesyphp/includes/cli.php:127
#, php-format #, php-format
msgid "" msgid ""
"Invalid parameter \"%s\".\n" "Invalid parameter \"%s\".\n"
"Note: Command's parameter/argument must be place after the command." "Note: Command's parameter/argument must be place after the command."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:127 #: /home/brenard/dev/eesyphp/includes/cli.php:149
#, php-format #, php-format
msgid "An exception occured running command %s" msgid "An exception occured running command %s"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:133 #: /home/brenard/dev/eesyphp/includes/cli.php:155
#, php-format #, php-format
msgid "Item #%s:\n" msgid "Item #%s:\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:134 #: /home/brenard/dev/eesyphp/includes/cli.php:156
#, php-format #, php-format
msgid "ID: %s" msgid "ID: %s"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:135 #: /home/brenard/dev/eesyphp/includes/cli.php:157
#, php-format #, php-format
msgid "Name: '%s'" msgid "Name: '%s'"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:136 #: /home/brenard/dev/eesyphp/includes/cli.php:158
#, php-format #, php-format
msgid "Date: %s" msgid "Date: %s"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:137 #: /home/brenard/dev/eesyphp/includes/cli.php:160
#, php-format #, php-format
msgid "Description: %s" msgid "Description: %s"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:137 #: /home/brenard/dev/eesyphp/includes/cli.php:161
msgid "Not set" msgid "Not set"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:138 #: /home/brenard/dev/eesyphp/includes/cli.php:163
#, php-format #, php-format
msgid "Status: %s" msgid "Status: %s"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:191 #: /home/brenard/dev/eesyphp/includes/cli.php:216
msgid "No item.\n" msgid "No item.\n"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:217 #: /home/brenard/dev/eesyphp/includes/cli.php:242
#, php-format #, php-format
msgid "%d item(s)" msgid "%d item(s)"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:223 #: /home/brenard/dev/eesyphp/includes/cli.php:248
msgid "List/search items" msgid "List/search items"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:224 #: /home/brenard/dev/eesyphp/includes/cli.php:249
msgid "[patterns]" msgid "[patterns]"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:226 #: /home/brenard/dev/eesyphp/includes/cli.php:251
msgid "-o|--orderby Ordering list criterion. Possible values:" msgid "-o|--orderby Ordering list criterion. Possible values:"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:228 #: /home/brenard/dev/eesyphp/includes/cli.php:253
msgid "-r|--reverse Reverse order" msgid "-r|--reverse Reverse order"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:229 #: /home/brenard/dev/eesyphp/includes/cli.php:254
msgid "-s|--status Filter on status. Possible values:" msgid "-s|--status Filter on status. Possible values:"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:236 #: /home/brenard/dev/eesyphp/includes/cli.php:261
msgid "You must provide a valid ID." msgid "You must provide a valid ID."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:242 #: /home/brenard/dev/eesyphp/includes/cli.php:267
#: /home/brenard/dev/eesyphp/includes/cli.php:266 #: /home/brenard/dev/eesyphp/includes/cli.php:291
#, php-format #, php-format
msgid "Item #%s not found." msgid "Item #%s not found."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:250 #: /home/brenard/dev/eesyphp/includes/cli.php:275
msgid "Show item" msgid "Show item"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:251 #: /home/brenard/dev/eesyphp/includes/cli.php:276
msgid "[ID]" msgid "[ID]"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:256 #: /home/brenard/dev/eesyphp/includes/cli.php:281
msgid "You must provide item ID." msgid "You must provide item ID."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:260 #: /home/brenard/dev/eesyphp/includes/cli.php:285
msgid "Invalid item ID" msgid "Invalid item ID"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:271 #: /home/brenard/dev/eesyphp/includes/cli.php:296
msgid "Are you sure you want to delete this item? Type 'yes' to continue: " msgid "Are you sure you want to delete this item? Type 'yes' to continue: "
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:275 #: /home/brenard/dev/eesyphp/includes/cli.php:300
msgid "User cancel" msgid "User cancel"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:281 #: /home/brenard/dev/eesyphp/includes/cli.php:306
#, php-format #, php-format
msgid "An error occured deleting item #%d." msgid "An error occured deleting item #%d."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:288 #: /home/brenard/dev/eesyphp/includes/cli.php:313
msgid "Delete item" msgid "Delete item"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:289 #: /home/brenard/dev/eesyphp/includes/cli.php:314
msgid "[item ID]" msgid "[item ID]"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:301 #: /home/brenard/dev/eesyphp/includes/cli.php:326
msgid "Export items (as CSV)" msgid "Export items (as CSV)"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:302 #: /home/brenard/dev/eesyphp/includes/cli.php:327
msgid "[output file path]" msgid "[output file path]"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:314 #: /home/brenard/dev/eesyphp/includes/cli.php:342
msgid "Restore items (from CSV)" msgid "Restore items (from CSV)"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:315 #: /home/brenard/dev/eesyphp/includes/cli.php:343
msgid "[input file path]" msgid "[input file path]"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:374 #: /home/brenard/dev/eesyphp/includes/cli.php:412
msgid "Cron to handle item expiration" msgid "Cron to handle item expiration"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:377 #: /home/brenard/dev/eesyphp/includes/cli.php:415
msgid "-j/--just-try Just-try mode : do not really removed expired item(s)" msgid "-j/--just-try Just-try mode : do not really removed expired item(s)"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:378 #: /home/brenard/dev/eesyphp/includes/cli.php:416
msgid "-m/--max-age Item expiration limit (in days, optional)" msgid "-m/--max-age Item expiration limit (in days, optional)"
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:393
msgid "Fail to list PHP files."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:410
msgid "Fail to extract messages from PHP files using xgettext."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:421
msgid ""
"Fail to extract messages from template files using tsmarty2c.php script."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:431
msgid "Fail to merge messages using msgcat."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:436
msgid "Extract messages that need to be translated"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:438
msgid "This command could be used to generate/update lang/messages.pot file."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:449
#, php-format
msgid "POT file not found (%s). Please run extract_messages first."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:460
#: /home/brenard/dev/eesyphp/includes/cli.php:519
#, php-format
msgid "Lang directory '%s' found"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:467
#: /home/brenard/dev/eesyphp/includes/cli.php:526
#, php-format
msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:477
#: /home/brenard/dev/eesyphp/includes/cli.php:536
#, php-format
msgid "PO file not found in lang '%s' directory, ignore it."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:489
#, php-format
msgid "Fail to update messages in %s PO file using msgmerge (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:499
#: /home/brenard/dev/eesyphp/includes/cli.php:560
#, php-format
msgid "Fail to open root lang directory (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:504
msgid "Update messages in existing translation PO lang files"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:506
msgid ""
"This command could be used to update PO files in lang/*/LC_MESSAGES "
"directories."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:550
#, php-format
msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)."
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:565
msgid ""
"Compile messages from existing translation PO lang files to corresponding MO "
"files"
msgstr ""
#: /home/brenard/dev/eesyphp/includes/cli.php:567
msgid ""
"This command could be used to compile PO files in lang/*/LC_MESSAGES "
"directories to MO files."
msgstr ""

View file

@ -102,12 +102,10 @@ msgid "No item found."
msgstr "" msgstr ""
#: /home/brenard/dev/eesyphp/templates/search.tpl:68 #: /home/brenard/dev/eesyphp/templates/search.tpl:68
msgid "Element(s) %1 to %2 on %3" msgid "%3 element"
msgstr "" msgid_plural "Elements %1 to %2 on %3"
msgstr[0] ""
#: /home/brenard/dev/eesyphp/templates/error_404.tpl:3 msgstr[1] ""
msgid "The requested page can not be found."
msgstr ""
#: /home/brenard/dev/eesyphp/templates/show.tpl:14 #: /home/brenard/dev/eesyphp/templates/show.tpl:14
msgid "Creation date" msgid "Creation date"

View file

@ -2,27 +2,27 @@
* Main interface components * Main interface components
*/ */
body { body {
font-family: arial, sans-serif; font-family: arial, sans-serif;
color: #606060; color: #606060;
} }
main[role="main"] { main[role="main"] {
margin-top: 1em; margin-top: 1em;
} }
a.navbar-brand img { a.navbar-brand img {
height: 27px; height: 27px;
} }
#footer { #footer {
border-top: 1px solid #333; border-top: 1px solid #333;
margin-top: 1em; margin-top: 1em;
padding-top: 1em; padding-top: 1em;
} }
#footer p { #footer p {
font-size: 0.8em; font-size: 0.8em;
text-align: center; text-align: center;
} }
/* /*
@ -38,29 +38,29 @@ img { max-width: 100%; }
* Messages/errors & fatal errors * Messages/errors & fatal errors
*/ */
.fatal_error_msg { .fatal_error_msg {
font-size: 0.8em; font-size: 0.8em;
color: #777; color: #777;
text-align: center; text-align: center;
font-style: italic; font-style: italic;
} }
.alert p { .alert p {
text-align: center; text-align: center;
} }
/* /*
* Tables * Tables
*/ */
th a, th a:hover { th a, th a:hover {
color: #000; color: #000;
text-decoration: none; text-decoration: none;
} }
/* /*
* Forms * Forms
*/ */
.form-inline .form-control, .form-inline label, .form-inline input, .form-inline select, .form-inline button { .form-inline .form-control, .form-inline label, .form-inline input, .form-inline select, .form-inline button {
margin-left: 1em!important; margin-left: 1em!important;
} }
label.required::after { label.required::after {
@ -68,17 +68,17 @@ label.required::after {
} }
.form-error { .form-error {
color: #dc3545; color: #dc3545;
} }
.invalid-feedback { .invalid-feedback {
display: block; display: block;
} }
span.form-control-plaintext { span.form-control-plaintext {
padding-top: calc(.375rem + 1px); padding-top: calc(.375rem + 1px);
padding-bottom: calc(.375rem + 1px); padding-bottom: calc(.375rem + 1px);
margin-bottom: 0; margin-bottom: 0;
font-size: inherit; font-size: inherit;
line-height: 1.5; line-height: 1.5;
} }

219
public_html/js/myconfirm.js Normal file
View file

@ -0,0 +1,219 @@
var myconfirm = function(opts) {
var confirm = false;
var dialog = Bootstrap4Dialog.show({
title: opts.title || _('Confirmation'),
message: opts.question || _('Do you confirm?'),
autodestroy: true,
type: opts.type || Bootstrap4Dialog.TYPE_LIGHT,
scrollable: opts.scrollable || false,
buttons: [
{
label: opts.cancel_label || _('Cancel'),
action: function(dialog) {
dialog.modal('hide');
}
},
{
label: opts.confirm_label || _('Validate'),
cssClass: 'btn-danger',
action: function(dialog) {
confirm = true;
dialog.modal('hide');
}
}
],
close: function() {
if (confirm) {
if (jQuery.type(opts.onconfirm) == 'function') {
opts.onconfirm(opts.data);
}
}
else {
if (jQuery.type(opts.oncancel) == 'function') {
opts.oncancel(opts.data);
}
}
}
});
return dialog;
};
var myalert = function(msg, title, opts) {
if (!opts) opts={};
var dialog = Bootstrap4Dialog.show({
title: title || opts.title || _('Error'),
message: msg,
autodestroy: true,
type: opts.type || Bootstrap4Dialog.TYPE_DANGER,
size: opts.size || Bootstrap4Dialog.SIZE_MEDIUM,
scrollable: opts.scrollable || false,
buttons: [
{
label: opts.btnLabel || _('OK'),
cssClass: opts.btnCssClass ||'btn-primary',
action: function(dialog) {
dialog.modal('hide');
}
},
],
close: function() {
if ($.type(opts.onclose) == 'function') {
opts.onclose(opts.data);
}
}
});
return dialog;
};
var myprompt = function(opts) {
if ($.type(opts) != "object") {
opts={};
}
var submited = false;
var onSubmitBtnClick = function(dialog) {
submited = true;
var val = dialog.getModalBody().find('input').val();
if (jQuery.type(opts.onsubmit) == 'function') {
if (!opts.onsubmit(val, opts.data)) {
if (jQuery.type(opts.onerror) == 'function') {
opts.onerror(val, opts.data);
}
if (!opts.closeonerror) {
return false;
}
}
}
dialog.modal('hide');
};
var dialog = Bootstrap4Dialog.show({
title: opts.title || _('Question'),
message: "<label for='myprompt_input'>"+(opts.label || _("Please enter your answer below:"))+"</label><input type='text' class='form-control' id='myprompt_input'/>",
autodestroy: true,
type: opts.type || Bootstrap4Dialog.TYPE_INFO,
size: opts.size || Bootstrap4Dialog.SIZE_MEDIUM,
data: {
oncancel: opts.oncancel,
onsubmit: opts.onsubmit,
onerror: opts.onerror,
closeonerror: opts.closeonerror || false,
default_answer: opts.default_answer,
onSubmitBtnClick: onSubmitBtnClick,
data: opts.data,
submited: false,
},
buttons: [
{
label: opts.cancel_label || _('Cancel'),
action: function(dialog) {
dialog.modal('hide');
}
},
{
label: opts.submit_label || _('Validate'),
cssClass: 'btn-danger',
action: onSubmitBtnClick
}
],
open: function() {
var input = dialog.getModalBody().find('input');
input.on('keyup', function (e) {
if (e.keyCode == 13) {
opts.onSubmitBtnClick(dialog);
}
});
if (opts.default_answer) {
input.val(opts.default_answer);
}
},
close: function() {
if (!submited && jQuery.type(opts.oncancel) == 'function') {
opts.oncancel(opts.data);
}
}
});
};
var myloadingalert = function(opts) {
if (!opts) opts={};
var opened = false;
var closed = false;
var dialog = Bootstrap4Dialog.show({
title: opts.title || _('Please wait'),
message: opts.message || _('Please wait while your request is being processed.'),
autodestroy: true,
type: opts.type || Bootstrap4Dialog.TYPE_INFO,
size: opts.size || Bootstrap4Dialog.SIZE_NORMAL,
centered: opts.centered || true,
closable: opts.closable || false,
open: function () {
if (closed)
dialog.modal('hide');
opened = true;
}
});
return {
'modal': dialog,
'close': function() {
if (opened)
dialog.modal('hide');
closed = true;
}
};
};
$( document ).ready(function () {
// Manage .myconfirm-link
$('.myconfirm-link').click(function(event) {
event.preventDefault();
myconfirm({
title: $(this).data("myconfirm-title") || _("Confirmation"),
question: "<p><strong>"+($(this).data("myconfirm-question") || _("Are you sure?"))+"</strong></p>",
onconfirm: function(data) {
window.location = data.confirm_url;
},
data: {
confirm_url: $(this).data('myconfirm-url')
}
});
});
// Manage .myloading-link
$('.myloading-link').click(function(event) {
event.preventDefault();
myloadingalert({
title: $(this).data("myloading-title"),
message: $(this).data("myloading-message"),
});
window.location = $(this).data('myloading-url');
});
// Manage .myconfirm-btn
$('.myconfirm-btn').click(function(event) {
if ($(this).data('myconfirm-btn-confirmed') == '1') {
$(this).data('myconfirm-btn-confirmed', '');
return true;
}
event.preventDefault();
myconfirm({
title: $(this).data("myconfirm-title") || _("Confirmation"),
question: "<p><strong>"+($(this).data("myconfirm-question") || _("Are you sure?"))+"</strong></p>",
onconfirm: function(data) {
data.btn.data('myconfirm-btn-confirmed', 1);
data.btn.click();
},
data: {
btn: $(this)
}
});
});
// Manage .myloading-btn
$('.myloading-btn').click(function(event) {
myloadingalert({
title: $(this).data("myloading-title"),
message: $(this).data("myloading-message"),
});
});
});

View file

@ -0,0 +1,23 @@
/*
* I18n
*/
var translations;
var translations_data;
function _(string) {
var translated = (translations?translations.gettext(string):string);
return (translated !== '') ? translated : string;
}
function ngettext(singular, plural, n) {
return (
translations?
translations.ngettext(singular, plural, n):
(n > 1?plural:singular)
);
}
$(document).ready( function() {
// Load Gettext translations
translations = babel.Translations.load(translations_data?translations_data:{}).install();
});

160
public_html/lib/babel.js Normal file
View file

@ -0,0 +1,160 @@
/**
* Babel JavaScript Support
*
* Copyright (C) 2008-2011 Edgewall Software
* All rights reserved.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://babel.edgewall.org/wiki/License.
*
* This software consists of voluntary contributions made by many
* individuals. For the exact contribution history, see the revision
* history and logs, available at http://babel.edgewall.org/log/.
*/
/**
* A simple module that provides a gettext like translation interface.
* The catalog passed to load() must be a object conforming to this
* interface::
*
* {
* messages: an object of {msgid: translations} items where
* translations is an array of messages or a single
* string if the message is not pluralizable.
* plural_expr: the plural expression for the language.
* locale: the identifier for this locale.
* domain: the name of the domain.
* }
*
* Missing elements in the object are ignored.
*
* Typical usage::
*
* var translations = babel.Translations.load(...).install();
*/
var babel = new function() {
var defaultPluralExpr = function(n) { return n == 1 ? 0 : 1; };
var formatRegex = /%?%(?:\(([^\)]+)\))?([disr])/g;
/**
* A translations object implementing the gettext interface
*/
var Translations = this.Translations = function(locale, domain) {
this.messages = {};
this.locale = locale || 'unknown';
this.domain = domain || 'messages';
this.pluralexpr = defaultPluralExpr;
};
/**
* Create a new translations object from the catalog and return it.
* See the babel-module comment for more details.
*/
Translations.load = function(catalog) {
var rv = new Translations();
rv.load(catalog);
return rv;
};
Translations.prototype = {
/**
* translate a single string.
*/
gettext: function(string) {
var translated = this.messages[string];
if (typeof translated == 'undefined')
return string;
return (typeof translated == 'string') ? translated : translated[0];
},
/**
* translate a pluralizable string
*/
ngettext: function(singular, plural, n) {
var translated = this.messages[singular];
if (typeof translated == 'undefined')
return (n == 1) ? singular : plural;
return translated[this.pluralexpr(n)];
},
/**
* Install this translation document wide. After this call, there are
* three new methods on the window object: _, gettext and ngettext
*/
install: function() {
var self = this;
window.gettext = function(string) {
return self.gettext(string);
};
window.ngettext = function(singular, plural, n) {
return self.ngettext(singular, plural, n);
};
return this;
},
/**
* Works like Translations.load but updates the instance rather
* then creating a new one.
*/
load: function(catalog) {
if (catalog.messages)
this.update(catalog.messages);
if (catalog.plural_expr)
this.setPluralExpr(catalog.plural_expr);
if (catalog.locale)
this.locale = catalog.locale;
if (catalog.domain)
this.domain = catalog.domain;
return this;
},
/**
* Updates the translations with the object of messages.
*/
update: function(mapping) {
for (var key in mapping)
if (mapping.hasOwnProperty(key))
this.messages[key] = mapping[key];
return this;
},
/**
* Sets the plural expression
*/
setPluralExpr: function(expr) {
this.pluralexpr = new Function('n', 'return +(' + expr + ')');
return this;
}
};
/**
* A python inspired string formatting function. Supports named and
* positional placeholders and "s", "d" and "i" as type characters
* without any formatting specifications.
*
* Examples::
*
* babel.format(_('Hello %s'), name)
* babel.format(_('Progress: %(percent)s%%'), {percent: 100})
*/
this.format = function() {
var arg, string = arguments[0], idx = 0;
if (arguments.length == 1)
return string;
else if (arguments.length == 2 && typeof arguments[1] == 'object')
arg = arguments[1];
else {
arg = [];
for (var i = 1, n = arguments.length; i != n; ++i)
arg[i - 1] = arguments[i];
}
return string.replace(formatRegex, function(all, name, type) {
if (all[0] == all[1]) return all.substring(1);
var value = arg[name || idx++];
return (type == 'i' || type == 'd') ? +value : value;
});
}
};

View file

@ -1 +0,0 @@
.bootstrap-dialog .modal-header{border-top-left-radius:4px;border-top-right-radius:4px}.bootstrap-dialog .bootstrap-dialog-title{color:#fff;display:inline-block;font-size:16px}.bootstrap-dialog .bootstrap-dialog-message{font-size:14px}.bootstrap-dialog .bootstrap-dialog-button-icon{margin-right:3px}.bootstrap-dialog .bootstrap-dialog-close-button{font-size:20px;float:right;opacity:.9;filter:alpha(opacity=90)}.bootstrap-dialog .bootstrap-dialog-close-button:hover{cursor:pointer;opacity:1;filter:alpha(opacity=100)}.bootstrap-dialog.type-default .modal-header{background-color:#fff}.bootstrap-dialog.type-default .bootstrap-dialog-title{color:#333}.bootstrap-dialog.type-info .modal-header{background-color:#5bc0de}.bootstrap-dialog.type-primary .modal-header{background-color:#337ab7}.bootstrap-dialog.type-success .modal-header{background-color:#5cb85c}.bootstrap-dialog.type-warning .modal-header{background-color:#f0ad4e}.bootstrap-dialog.type-danger .modal-header{background-color:#d9534f}.bootstrap-dialog.size-large .bootstrap-dialog-title{font-size:24px}.bootstrap-dialog.size-large .bootstrap-dialog-close-button{font-size:30px}.bootstrap-dialog.size-large .bootstrap-dialog-message{font-size:18px}.bootstrap-dialog .icon-spin{display:inline-block;-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@-ms-keyframes spin{0%{-ms-transform:rotate(0deg)}100%{-ms-transform:rotate(359deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}}

File diff suppressed because one or more lines are too long

View file

@ -1,111 +0,0 @@
.bootstrap-dialog {
/* dialog types */
/**
* Icon animation
* Copied from font-awesome: http://fontawesome.io/
**/
/** End of icon animation **/
}
.bootstrap-dialog .modal-header {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.bootstrap-dialog .bootstrap-dialog-title {
color: #fff;
display: inline-block;
font-size: 16px;
}
.bootstrap-dialog .bootstrap-dialog-message {
font-size: 14px;
}
.bootstrap-dialog .bootstrap-dialog-button-icon {
margin-right: 3px;
}
.bootstrap-dialog .bootstrap-dialog-close-button {
font-size: 20px;
float: right;
opacity: 0.9;
filter: alpha(opacity=90);
}
.bootstrap-dialog .bootstrap-dialog-close-button:hover {
cursor: pointer;
opacity: 1;
filter: alpha(opacity=100);
}
.bootstrap-dialog.type-default .modal-header {
background-color: #fff;
}
.bootstrap-dialog.type-default .bootstrap-dialog-title {
color: #333;
}
.bootstrap-dialog.type-info .modal-header {
background-color: #5bc0de;
}
.bootstrap-dialog.type-primary .modal-header {
background-color: #337ab7;
}
.bootstrap-dialog.type-success .modal-header {
background-color: #5cb85c;
}
.bootstrap-dialog.type-warning .modal-header {
background-color: #f0ad4e;
}
.bootstrap-dialog.type-danger .modal-header {
background-color: #d9534f;
}
.bootstrap-dialog.size-large .bootstrap-dialog-title {
font-size: 24px;
}
.bootstrap-dialog.size-large .bootstrap-dialog-close-button {
font-size: 30px;
}
.bootstrap-dialog.size-large .bootstrap-dialog-message {
font-size: 18px;
}
.bootstrap-dialog .icon-spin {
display: inline-block;
-moz-animation: spin 2s infinite linear;
-o-animation: spin 2s infinite linear;
-webkit-animation: spin 2s infinite linear;
animation: spin 2s infinite linear;
}
@-moz-keyframes spin {
0% {
-moz-transform: rotate(0deg);
}
100% {
-moz-transform: rotate(359deg);
}
}
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
}
}
@-o-keyframes spin {
0% {
-o-transform: rotate(0deg);
}
100% {
-o-transform: rotate(359deg);
}
}
@-ms-keyframes spin {
0% {
-ms-transform: rotate(0deg);
}
100% {
-ms-transform: rotate(359deg);
}
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(359deg);
}
}

View file

@ -1 +0,0 @@
.bootstrap-dialog .modal-header{border-top-left-radius:4px;border-top-right-radius:4px}.bootstrap-dialog .bootstrap-dialog-title{color:#fff;display:inline-block;font-size:16px}.bootstrap-dialog .bootstrap-dialog-message{font-size:14px}.bootstrap-dialog .bootstrap-dialog-button-icon{margin-right:3px}.bootstrap-dialog .bootstrap-dialog-close-button{font-size:20px;float:right;opacity:.9;filter:alpha(opacity=90)}.bootstrap-dialog .bootstrap-dialog-close-button:hover{cursor:pointer;opacity:1;filter:alpha(opacity=100)}.bootstrap-dialog.type-default .modal-header{background-color:#fff}.bootstrap-dialog.type-default .bootstrap-dialog-title{color:#333}.bootstrap-dialog.type-info .modal-header{background-color:#5bc0de}.bootstrap-dialog.type-primary .modal-header{background-color:#337ab7}.bootstrap-dialog.type-success .modal-header{background-color:#5cb85c}.bootstrap-dialog.type-warning .modal-header{background-color:#f0ad4e}.bootstrap-dialog.type-danger .modal-header{background-color:#d9534f}.bootstrap-dialog.size-large .bootstrap-dialog-title{font-size:24px}.bootstrap-dialog.size-large .bootstrap-dialog-close-button{font-size:30px}.bootstrap-dialog.size-large .bootstrap-dialog-message{font-size:18px}.bootstrap-dialog .icon-spin{display:inline-block;-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@-ms-keyframes spin{0%{-ms-transform:rotate(0deg)}100%{-ms-transform:rotate(359deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,8 +1,8 @@
/*! /*!
* Bootstrap Reboot v4.0.0 (https://getbootstrap.com) * Bootstrap Reboot v4.6.1 (https://getbootstrap.com/)
* Copyright 2011-2018 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/ */
*, *,
@ -15,22 +15,16 @@ html {
font-family: sans-serif; font-family: sans-serif;
line-height: 1.15; line-height: 1.15;
-webkit-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-ms-overflow-style: scrollbar;
-webkit-tap-highlight-color: transparent;
} }
@-ms-viewport { article, aside, figcaption, figure, footer, header, hgroup, main, nav, section {
width: device-width;
}
article, aside, dialog, figcaption, figure, footer, header, hgroup, main, nav, section {
display: block; display: block;
} }
body { body {
margin: 0; margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1rem; font-size: 1rem;
font-weight: 400; font-weight: 400;
line-height: 1.5; line-height: 1.5;
@ -39,7 +33,7 @@ body {
background-color: #fff; background-color: #fff;
} }
[tabindex="-1"]:focus { [tabindex="-1"]:focus:not(:focus-visible) {
outline: 0 !important; outline: 0 !important;
} }
@ -66,6 +60,8 @@ abbr[data-original-title] {
text-decoration: underline dotted; text-decoration: underline dotted;
cursor: help; cursor: help;
border-bottom: 0; border-bottom: 0;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
} }
address { address {
@ -101,10 +97,6 @@ blockquote {
margin: 0 0 1rem; margin: 0 0 1rem;
} }
dfn {
font-style: italic;
}
b, b,
strong { strong {
font-weight: bolder; font-weight: bolder;
@ -134,7 +126,6 @@ a {
color: #007bff; color: #007bff;
text-decoration: none; text-decoration: none;
background-color: transparent; background-color: transparent;
-webkit-text-decoration-skip: objects;
} }
a:hover { a:hover {
@ -142,25 +133,21 @@ a:hover {
text-decoration: underline; text-decoration: underline;
} }
a:not([href]):not([tabindex]) { a:not([href]):not([class]) {
color: inherit; color: inherit;
text-decoration: none; text-decoration: none;
} }
a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus { a:not([href]):not([class]):hover {
color: inherit; color: inherit;
text-decoration: none; text-decoration: none;
} }
a:not([href]):not([tabindex]):focus {
outline: 0;
}
pre, pre,
code, code,
kbd, kbd,
samp { samp {
font-family: monospace, monospace; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em; font-size: 1em;
} }
@ -180,8 +167,9 @@ img {
border-style: none; border-style: none;
} }
svg:not(:root) { svg {
overflow: hidden; overflow: hidden;
vertical-align: middle;
} }
table { table {
@ -198,20 +186,20 @@ caption {
th { th {
text-align: inherit; text-align: inherit;
text-align: -webkit-match-parent;
} }
label { label {
display: inline-block; display: inline-block;
margin-bottom: .5rem; margin-bottom: 0.5rem;
} }
button { button {
border-radius: 0; border-radius: 0;
} }
button:focus { button:focus:not(:focus-visible) {
outline: 1px dotted; outline: 0;
outline: 5px auto -webkit-focus-ring-color;
} }
input, input,
@ -235,13 +223,28 @@ select {
text-transform: none; text-transform: none;
} }
[role="button"] {
cursor: pointer;
}
select {
word-wrap: normal;
}
button, button,
html [type="button"], [type="button"],
[type="reset"], [type="reset"],
[type="submit"] { [type="submit"] {
-webkit-appearance: button; -webkit-appearance: button;
} }
button:not(:disabled),
[type="button"]:not(:disabled),
[type="reset"]:not(:disabled),
[type="submit"]:not(:disabled) {
cursor: pointer;
}
button::-moz-focus-inner, button::-moz-focus-inner,
[type="button"]::-moz-focus-inner, [type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner, [type="reset"]::-moz-focus-inner,
@ -256,13 +259,6 @@ input[type="checkbox"] {
padding: 0; padding: 0;
} }
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
-webkit-appearance: listbox;
}
textarea { textarea {
overflow: auto; overflow: auto;
resize: vertical; resize: vertical;
@ -301,7 +297,6 @@ progress {
-webkit-appearance: none; -webkit-appearance: none;
} }
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration { [type="search"]::-webkit-search-decoration {
-webkit-appearance: none; -webkit-appearance: none;
} }

File diff suppressed because one or more lines are too long

View file

@ -1,8 +1,8 @@
/*! /*!
* Bootstrap Reboot v4.0.0 (https://getbootstrap.com) * Bootstrap Reboot v4.6.1 (https://getbootstrap.com/)
* Copyright 2011-2018 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent;-webkit-text-decoration-skip:objects}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg:not(:root){overflow:hidden}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important} */*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus:not(:focus-visible){outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([class]){color:inherit;text-decoration:none}a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit;text-align:-webkit-match-parent}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.min.css.map */ /*# sourceMappingURL=bootstrap-reboot.min.css.map */

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,72 @@
Bootstrap4Dialog
================
## Description
Create <a href="https://getbootstrap.com/" target="_blank">Bootstrap 4 / Bootstrap 5</a> Dialog Modals Easily.
[![Latest release](https://img.shields.io/github/release/SUXUMI/bootstrap4dialog.svg)](https://github.com/SUXUMI/bootstrap4dialog/releases/latest)
================
### Installation
``npm i gr-bootstrap4dialog``
### Usage
Simple sample:
```
Bootstrap4Dialog.show({
title: 'Title'
})
```
Sample without title:
```
Bootstrap4Dialog.show({
message: 'Message',
duration: 5
})
```
Sample with multiple options:
```
Bootstrap4Dialog.show({
title: 'Title',
message: 'Message text goes here',
backdrop: Bootstrap4Dialog.BACKDROP_STATIC,
type: Bootstrap4Dialog.TYPE_DANGER,
centered: true,
scrollable: true,
duration: 5, // display seconds
open: function() {
Bootstrap4Dialog.show({
title: 'Dialog displayed',
size: Bootstrap4Dialog.SIZE_SMALL,
type: Bootstrap4Dialog.TYPE_LIGHT,
duration: 0.5
})
$('#btn-cancel').focus();
},
close: function() {
Bootstrap4Dialog.show({
message: 'Dialog closed',
size: Bootstrap4Dialog.SIZE_SMALL,
type: Bootstrap4Dialog.TYPE_LIGHT,
backdrop: Bootstrap4Dialog.BACKDROP_NO,
duration: 0.5
})
},
buttons: [
{
id: 'btn-cancel',
label: 'Cancel',
cssClass: 'btn btn-light',
action: function(dialog) {
dialog.modal('hide');
}
}
]
})
```

View file

@ -0,0 +1,322 @@
/**
* Bootstrap Modal for Bootstrap 4.*
*
* @author GR <admin@admin.ge>, https://github.com/SUXUMI
* @source https://github.com/SUXUMI/bootstrab4dialog
* @description Bootstrap Modal for Bootstrap 4.*
* @license MIT
*/
(function (root, factory) {
"use strict";
// https://github.com/umdjs/umd
if (typeof module !== "undefined" && module.exports) {
module.exports = factory(require("jquery"), require("bootstrap"));
}
else if (typeof define === "function" && define.amd) {
define("bootstrap4dialog", ["jquery", "bootstrap"], function ($) {
return factory($);
});
} else {
root.Bootstrap4Dialog = factory(root.jQuery);
}
})(this ? this : window, function ($) {
/**
* Set default global options
*
* @param {} options
*/
var Bootstrap4Dialog = function (options) {
$.extend(true, this.defaultOptions, options);
};
/**
* Constants
*/
Bootstrap4Dialog.TYPE_PRIMARY = "primary";
Bootstrap4Dialog.TYPE_SECONDARY = "secondary";
Bootstrap4Dialog.TYPE_SUCCESS = "success";
Bootstrap4Dialog.TYPE_DANGER = "danger";
Bootstrap4Dialog.TYPE_WARNING = "warning";
Bootstrap4Dialog.TYPE_INFO = "info";
Bootstrap4Dialog.TYPE_LIGHT = "light";
Bootstrap4Dialog.TYPE_DARK = "dark";
Bootstrap4Dialog.SIZE_SMALL = "modal-sm";
Bootstrap4Dialog.SIZE_MEDIUM = "";
Bootstrap4Dialog.SIZE_LARGE = "modal-lg";
Bootstrap4Dialog.SIZE_EXTRA_LARGE = "modal-xl";
Bootstrap4Dialog.BACKDROP_YES = "true";
Bootstrap4Dialog.BACKDROP_NO = "";
Bootstrap4Dialog.BACKDROP_STATIC = "static";
/**
* Default options
*/
Bootstrap4Dialog.defaultOptions = {
title: '',
message: '',
type: Bootstrap4Dialog.TYPE_PRIMARY,
size: Bootstrap4Dialog.SIZE_MEDIUM,
keyboard: true,
focus: true,
scrollable: false, // modal-dialog-scrollable
centered: false, // modal-dialog-centered
backdrop: Bootstrap4Dialog.BACKDROP_YES,
duration: 0, // SECONDS - how long the dialog should be displayed
autodestroy: true,
open: null,
close: null,
buttons: [],
// draggable: false,
// animate: true,
// tabindex: -1,
};
/**
* Prepares the dialog
*
* @param {type} options
* @returns the created dialog instance
*/
Bootstrap4Dialog.dialog = function(options) {
var dialog;
var _options = $.extend(false, this.defaultOptions, options);
_options['show'] = false;
try {
if (!_options['title'] && !_options['message'] && (!_options['buttons'] || !_options['buttons'].length)) {
return false;
}
var id = _options['id'] || 'modalWindow_' + uniqid();
var html =
'<div id="' + id + '" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">'
+ '<div class="modal-dialog" role="document">'
+ '<div class="modal-content">';
if (_options['title']) {
html +=
'<div class="modal-header rounded">'
+ '<h6 class="modal-title"></h6>'
+ '<button type="button" class="close" data-dismiss="modal" aria-label="Close">'
+ '<span aria-hidden="true">&times;</span>'
+ '</button>'
+ '</div>'
}
if (_options['message']) {
html +=
'<div class="modal-body">'
+ '</div>'
}
if (_options['buttons'] && _options['buttons'].length) {
html +=
'<div class="modal-footer text-center">'
//+ '<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>'
//+ '<button type="button" class="btn btn-primary">Save changes</button>'
+ '</div>'
}
+ '</div>'
+ '</div>'
+ '</div>'
;
$('body').append( html );
var _modal_container = $('#' + id);
// append title
if (_options['title'] && _options['title'].length) {
_modal_container.find('.modal-title').html( _options['title'] );
}
// append message
if (_options['message'] && _options['message'].length) {
_modal_container.find('.modal-body').html( _options['message'] );
}
if (_options['title'] && !_options['message'] && (!_options['buttons'] || !_options['buttons'].length)) {
_modal_container.find('.modal-header').css({'border-bottom':'0px'});
}
if (!_options['title'] && !_options['message'] && _options['buttons'] && _options['buttons'].length) {
_modal_container.find('.modal-footer').css({'border-top':'0px'});
}
if (_options['size'] && _options['size'].length) {
_modal_container.find('.modal-dialog').addClass(_options.size);
}
if (_options['centered']) {
_modal_container.find('.modal-dialog').addClass('modal-dialog-centered');
}
if (_options['scrollable']) {
_modal_container.find('.modal-dialog').addClass('modal-dialog-scrollable');
}
switch(true) {
case _options['type'] == 'primary':
_modal_container.find('.modal-header').addClass('bg-primary').find('.modal-title').addClass('text-white');
_modal_container.find('.modal-body').addClass('text-primary');
break;
case _options['type'] == 'secondary':
_modal_container.find('.modal-header').addClass('bg-secondary').find('.modal-title').addClass('text-white');
_modal_container.find('.modal-body').addClass('text-secondary');
break;
case _options['type'] == 'success':
_modal_container.find('.modal-header').addClass('bg-success').find('.modal-title').addClass('text-white');
_modal_container.find('.modal-body').addClass('text-success');
break;
case _options['type'] == 'danger':
_modal_container.find('.modal-header').addClass('bg-danger').find('.modal-title').addClass('text-white');
_modal_container.find('.modal-body').addClass('text-danger');
break;
case _options['type'] == 'warning':
_modal_container.find('.modal-header').addClass('bg-warning');
_modal_container.find('.modal-body').addClass('text-warning');
break;
case _options['type'] == 'info':
_modal_container.find('.modal-header').addClass('bg-info').find('.modal-title').addClass('text-white');
_modal_container.find('.modal-body').addClass('text-info');
break;
case _options['type'] == 'light':
_modal_container.find('.modal-header').addClass('bg-light').find('.modal-title').addClass('text-black');
_modal_container.find('.modal-body').addClass('text-black');
break;
case _options['type'] == 'dark':
_modal_container.find('.modal-header').addClass('bg-dark').find('.modal-title').addClass('text-white');
_modal_container.find('.modal-body').addClass('text-dark');
break;
}
dialog = _modal_container.modal(_options);
// try set buttons
try {
// fooder
var _footer = _modal_container.find('.modal-footer');
for(i in _options['buttons']) {
var _button = _options['buttons'][i];
// append the button
_footer.append('<button class="btn" />');
var _element_button = _footer.find('button').eq(i);
if (_button['id']) { _element_button.attr('id', _button['id']); }
if (_button['label']) { _element_button.html(_button['label']); }
if (_button['cssClass']) { _element_button.addClass(_button['cssClass']); }
// https://dzone.com/articles/why-does-javascript-loop-only-use-last-value
// https://stackoverflow.com/a/17750253/1565790
if (typeof(_button['action']) == 'function') {
(function(button, f, dialog) {
button.bind('click', function() { f(dialog, button); });
})(_element_button, _button['action'], dialog);
}
}
}
catch(e) {console.log(e.message);}
// set handlers
if (typeof(_options['open']) == 'function') {
dialog.on('shown.bs.modal', _options['open']);
}
if (typeof(_options['close']) == 'function') {
dialog.on('hidden.bs.modal', _options['close']);
}
if (_options['autodestroy']) {
dialog.on('hidden.bs.modal', function() { destroy(dialog) });
}
if (_options['duration']) {
dialog.on('shown.bs.modal', function() {
setTimeout(function() {
dialog.modal('hide');
}, parseFloat(_options['duration']) * 1000);
});
}
return dialog;
}
catch(e) {
console.warn(e.message);
}
}
/**
* Displays prepared dialog
*
* @param {type} options
* @returns the created dialog instance
*/
Bootstrap4Dialog.show = function(options) {
try {
return this.dialog(options).modal('show');
}
catch(e) {
console.warn(e.message);
}
}
/**
* Removes dialog DOM instance
*
* @param object dialog
*/
destroy = function(dialog) {
try {
setTimeout(function() {
dialog.remove();
}, 200);
}
catch(e) {
console.warn(e.message);
}
};
/**
* Generates uniqid
*
* @source - https://github.com/makeable/uuid-v4.js/blob/master/uuid-v4.js
*/
var uniqid = function () {
var dec2hex = [];
for (var i = 0; i <= 15; i++) {
dec2hex[i] = i.toString(16);
}
var uuid = "";
for (var i = 1; i <= 36; i++) {
if (i === 9 || i === 14 || i === 19 || i === 24) {
uuid += "-";
} else if (i === 15) {
uuid += 4;
} else if (i === 20) {
uuid += dec2hex[(Math.random() * 4) | (0 + 8)];
} else {
uuid += dec2hex[(Math.random() * 16) | 0];
}
}
return uuid;
};
return Bootstrap4Dialog;
});

View file

@ -0,0 +1 @@
!function(a,d){"use strict";"undefined"!=typeof module&&module.exports?module.exports=d(require("jquery"),require("bootstrap")):"function"==typeof define&&define.amd?define("bootstrap4dialog",["jquery","bootstrap"],function(a){return d(a)}):a.Bootstrap4Dialog=d(a.jQuery)}(this?this:window,function(a){var d=function(d){a.extend(!0,this.defaultOptions,d)};d.TYPE_PRIMARY="primary",d.TYPE_SECONDARY="secondary",d.TYPE_SUCCESS="success",d.TYPE_DANGER="danger",d.TYPE_WARNING="warning",d.TYPE_INFO="info",d.TYPE_LIGHT="light",d.TYPE_DARK="dark",d.SIZE_SMALL="modal-sm",d.SIZE_MEDIUM="",d.SIZE_LARGE="modal-lg",d.SIZE_EXTRA_LARGE="modal-xl",d.BACKDROP_YES="true",d.BACKDROP_NO="",d.BACKDROP_STATIC="static",d.defaultOptions={title:"",message:"",type:d.TYPE_PRIMARY,size:d.SIZE_MEDIUM,keyboard:!0,focus:!0,scrollable:!1,centered:!1,backdrop:d.BACKDROP_YES,duration:0,autodestroy:!0,open:null,close:null,buttons:[]},d.dialog=function(d){var t,o=a.extend(!1,this.defaultOptions,d);o.show=!1;try{if(!(o.title||o.message||o.buttons&&o.buttons.length))return!1;var s=o.id||"modalWindow_"+e(),n='<div id="'+s+'" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true"><div class="modal-dialog" role="document"><div class="modal-content">';o.title&&(n+='<div class="modal-header rounded"><h6 class="modal-title"></h6><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>'),o.message&&(n+='<div class="modal-body"></div>'),o.buttons&&o.buttons.length&&(n+='<div class="modal-footer text-center"></div>'),a("body").append(n);var l=a("#"+s);switch(o.title&&o.title.length&&l.find(".modal-title").html(o.title),o.message&&o.message.length&&l.find(".modal-body").html(o.message),!o.title||o.message||o.buttons&&o.buttons.length||l.find(".modal-header").css({"border-bottom":"0px"}),!o.title&&!o.message&&o.buttons&&o.buttons.length&&l.find(".modal-footer").css({"border-top":"0px"}),o.size&&o.size.length&&l.find(".modal-dialog").addClass(o.size),o.centered&&l.find(".modal-dialog").addClass("modal-dialog-centered"),o.scrollable&&l.find(".modal-dialog").addClass("modal-dialog-scrollable"),!0){case"primary"==o.type:l.find(".modal-header").addClass("bg-primary").find(".modal-title").addClass("text-white"),l.find(".modal-body").addClass("text-primary");break;case"secondary"==o.type:l.find(".modal-header").addClass("bg-secondary").find(".modal-title").addClass("text-white"),l.find(".modal-body").addClass("text-secondary");break;case"success"==o.type:l.find(".modal-header").addClass("bg-success").find(".modal-title").addClass("text-white"),l.find(".modal-body").addClass("text-success");break;case"danger"==o.type:l.find(".modal-header").addClass("bg-danger").find(".modal-title").addClass("text-white"),l.find(".modal-body").addClass("text-danger");break;case"warning"==o.type:l.find(".modal-header").addClass("bg-warning"),l.find(".modal-body").addClass("text-warning");break;case"info"==o.type:l.find(".modal-header").addClass("bg-info").find(".modal-title").addClass("text-white"),l.find(".modal-body").addClass("text-info");break;case"light"==o.type:l.find(".modal-header").addClass("bg-light").find(".modal-title").addClass("text-black"),l.find(".modal-body").addClass("text-black");break;case"dark"==o.type:l.find(".modal-header").addClass("bg-dark").find(".modal-title").addClass("text-white"),l.find(".modal-body").addClass("text-dark")}t=l.modal(o);try{var r=l.find(".modal-footer");for(i in o.buttons){var c=o.buttons[i];r.append('<button class="btn" />');var m=r.find("button").eq(i);c.id&&m.attr("id",c.id),c.label&&m.html(c.label),c.cssClass&&m.addClass(c.cssClass),"function"==typeof c.action&&function(a,d,e){a.bind("click",function(){d(e,a)})}(m,c.action,t)}}catch(a){console.log(a.message)}return"function"==typeof o.open&&t.on("shown.bs.modal",o.open),"function"==typeof o.close&&t.on("hidden.bs.modal",o.close),o.autodestroy&&t.on("hidden.bs.modal",function(){destroy(t)}),o.duration&&t.on("shown.bs.modal",function(){setTimeout(function(){t.modal("hide")},1e3*parseFloat(o.duration))}),t}catch(a){console.warn(a.message)}},d.show=function(a){try{return this.dialog(a).modal("show")}catch(a){console.warn(a.message)}},destroy=function(a){try{setTimeout(function(){a.remove()},200)}catch(a){console.warn(a.message)}};var e=function(){for(var a=[],d=0;d<=15;d++)a[d]=d.toString(16);var e="";for(d=1;d<=36;d++)e+=9===d||14===d||19===d||24===d?"-":15===d?4:20===d?a[4*Math.random()|8]:a[16*Math.random()|0];return e};return d});

View file

@ -0,0 +1,219 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Bootstrap4Dialog Examples</title>
<!-- CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" integrity="sha512-+4zCK9k+qNFUR5X+cKL9EIR+ZOhtIloNl9GIKS57V1MyNsYpYcUrUeQc9vNfzsWfV28IaLL3i96P9sdNyeRssA==" crossorigin="anonymous" />
<!-- jQuery and JS bundle w/ Popper.js -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
<script src="../src/js/bootstrap4dialog.js?<?=time()?>"></script>
<style>
html, body {min-height: 150vh;}
body {font-size: 0.9rem;}
pre {font-size: 0.8rem ; max-height: 200px; overflow: auto;}
.code-sample {border-bottom: 1px solid #dee2e6!important; margin-bottom: 1rem !important;}
</style>
<!-- php -S localhost:8080 -->
</head>
<body class="py-3">
<div class="container">
<div class="row">
<div class="col col-lg-8 offset-lg-2">
<div class="code-sample">
<h3>Dialog with Title & Message</h3>
<div><a class="btn btn-primary run-code">Run code</a></div>
<pre>
<code>
Bootstrap4Dialog.show({
title: 'Sample Title 1',
message: 'Message text goes here'
})
</code>
</pre>
</div>
<div class="code-sample">
<h3>Static Danger Dialog with Title only</h3>
<div><a class="btn btn-primary run-code">Run code</a></div>
<pre>
<code>
Bootstrap4Dialog.show({
title: 'Sample Title 2',
type: Bootstrap4Dialog.TYPE_DANGER,
backdrop: Bootstrap4Dialog.BACKDROP_STATIC
})
</code>
</pre>
</div>
<div class="code-sample">
<h3>Warning Centered Dialog Message only, with 2 seconds duration</h3>
<div><a class="btn btn-primary run-code">Run code</a></div>
<pre>
<code>
Bootstrap4Dialog.show({
message: 'Sample message will be hidden in 2 seconds',
type: Bootstrap4Dialog.TYPE_WARNING,
centered: true,
duration: 2
})
</code>
</pre>
</div>
<div class="code-sample">
<h3>Long Message Dialog without Backdrop</h3>
<div><a class="btn btn-primary run-code">Run code</a></div>
<pre>
<code>
Bootstrap4Dialog.show({
title: 'Long message without backdrop',
type: Bootstrap4Dialog.TYPE_DANGER,
centered: true,
backdrop: Bootstrap4Dialog.BACKDROP_NO,
message: 'Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>'
})
</code>
</pre>
</div>
<div class="code-sample">
<h3>Long Scrollable Message Dialog</h3>
<div><a class="btn btn-primary run-code">Run code</a></div>
<pre>
<code>
Bootstrap4Dialog.show({
title: 'Long message text will disappears in 2 seconds',
type: Bootstrap4Dialog.TYPE_DANGER,
scrollable: true,
message: 'Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>Lorem Ipsum dolor..<br>',
})
</code>
</pre>
</div>
<div class="code-sample">
<h3>Multiple overlapping Dialogs</h3>
<div><a class="btn btn-primary run-code">Run code</a></div>
<pre>
<code>
Bootstrap4Dialog.show({
title: 'Title 1',
centered: true,
type: Bootstrap4Dialog.TYPE_SUCCESS,
});
Bootstrap4Dialog.show({
message: 'Message 2',
type: Bootstrap4Dialog.TYPE_INFO,
duration: 2
})
</code>
</pre>
</div>
<div class="code-sample">
<h3>Large Message Dialog with callbacks</h3>
<div><a class="btn btn-primary run-code">Run code</a></div>
<pre>
<code>
Bootstrap4Dialog.show({
title: 'Title 1',
message: $('<div></div>').load('message.html'),
centered: true,
size: Bootstrap4Dialog.SIZE_LARGE,
type: Bootstrap4Dialog.TYPE_DARK,
open: function() {
Bootstrap4Dialog.show({
title: 'Dialog displayed',
size: Bootstrap4Dialog.SIZE_SMALL,
type: Bootstrap4Dialog.TYPE_LIGHT,
duration: 0.5
})
},
close: function() {
Bootstrap4Dialog.show({
message: 'Dialog closed',
size: Bootstrap4Dialog.SIZE_SMALL,
type: Bootstrap4Dialog.TYPE_LIGHT,
backdrop: Bootstrap4Dialog.BACKDROP_NO,
duration: 0.5
})
}
});
</code>
</pre>
</div>
<div class="code-sample">
<h3>Dialog with Buttons</h3>
<div><a class="btn btn-primary run-code">Run code</a></div>
<pre>
<code>
Bootstrap4Dialog.show({
title: 'Sample Title',
message: 'Message text goes here',
backdrop: Bootstrap4Dialog.BACKDROP_STATIC,
open: function() {
$('#btn-cancel-2').focus();
},
buttons: [
{
id: 'btn-cancel-2',
label: 'Cancel',
cssClass: 'btn btn-light',
action: function(dialog) {
dialog.modal('hide');
}
},
{
id: 'btn-submit-2',
label: '<i class="fas fa-check"></i> Submit',
cssClass: 'btn btn-sm btn-danger',
action: function(dialog) {
alert('fake form submittion..');
dialog.modal('hide');
}
}
]
})
</code>
</pre>
</div>
<div class="code-sample">
<h3>Close the dialog manually from JavaScript</h3>
<div><a class="btn btn-primary run-code">Run code</a></div>
<pre>
<code>
var dialogForManualClose = Bootstrap4Dialog.show({
title: 'Sample Title 1',
message: 'Message text goes here'
})
setTimeout(function() {
dialogForManualClose.modal('hide');
}, 3000)
</code>
</pre>
</div>
</div>
</div>
</div>
<script>
$('.run-code').click(function() {
eval( $(this).parent().parent().find('code').html() )
})
</script>
</body>
</html>

View file

@ -0,0 +1,102 @@
<pre>
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
Lorem Ipsum dolor..
</pre>

View file

@ -0,0 +1,19 @@
"use strict";
const gulp = require("gulp");
const clean = require("gulp-clean");
const minify = require("gulp-minify");
gulp.task("clean", function() {
return gulp.src(["dist/**"]).pipe(clean({ allowEmpty: true }));
});
gulp.task("dist", gulp.series("clean", function() {
return gulp
.src(["src/js/bootstrap4dialog.js"])
.pipe(gulp.dest("dist/js"))
.pipe(minify({ noSource: true, ext: ".min.js" }))
.pipe(gulp.dest("dist/js"));
}));
gulp.task("default", gulp.series("dist"));

View file

@ -0,0 +1,18 @@
{
"name": "bootstrap4dialog",
"version": "1.0.0",
"description": "Bootstrap Modal for Bootstrap 4.*",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "GR <admin@admin.ge>",
"license": "MIT",
"dependencies": {
"g": "^2.0.1",
"gulp": "^4.0.2",
"gulp-clean": "^0.4.0",
"gulp-minify": "^3.1.0",
"gulp-rename": "^2.0.0"
}
}

View file

@ -0,0 +1,322 @@
/**
* Bootstrap Modal for Bootstrap 4.*
*
* @author GR <admin@admin.ge>, https://github.com/SUXUMI
* @source https://github.com/SUXUMI/bootstrab4dialog
* @description Bootstrap Modal for Bootstrap 4.*
* @license MIT
*/
(function (root, factory) {
"use strict";
// https://github.com/umdjs/umd
if (typeof module !== "undefined" && module.exports) {
module.exports = factory(require("jquery"), require("bootstrap"));
}
else if (typeof define === "function" && define.amd) {
define("bootstrap4dialog", ["jquery", "bootstrap"], function ($) {
return factory($);
});
} else {
root.Bootstrap4Dialog = factory(root.jQuery);
}
})(this ? this : window, function ($) {
/**
* Set default global options
*
* @param {} options
*/
var Bootstrap4Dialog = function (options) {
$.extend(true, this.defaultOptions, options);
};
/**
* Constants
*/
Bootstrap4Dialog.TYPE_PRIMARY = "primary";
Bootstrap4Dialog.TYPE_SECONDARY = "secondary";
Bootstrap4Dialog.TYPE_SUCCESS = "success";
Bootstrap4Dialog.TYPE_DANGER = "danger";
Bootstrap4Dialog.TYPE_WARNING = "warning";
Bootstrap4Dialog.TYPE_INFO = "info";
Bootstrap4Dialog.TYPE_LIGHT = "light";
Bootstrap4Dialog.TYPE_DARK = "dark";
Bootstrap4Dialog.SIZE_SMALL = "modal-sm";
Bootstrap4Dialog.SIZE_MEDIUM = "";
Bootstrap4Dialog.SIZE_LARGE = "modal-lg";
Bootstrap4Dialog.SIZE_EXTRA_LARGE = "modal-xl";
Bootstrap4Dialog.BACKDROP_YES = "true";
Bootstrap4Dialog.BACKDROP_NO = "";
Bootstrap4Dialog.BACKDROP_STATIC = "static";
/**
* Default options
*/
Bootstrap4Dialog.defaultOptions = {
title: '',
message: '',
type: Bootstrap4Dialog.TYPE_PRIMARY,
size: Bootstrap4Dialog.SIZE_MEDIUM,
keyboard: true,
focus: true,
scrollable: false, // modal-dialog-scrollable
centered: false, // modal-dialog-centered
backdrop: Bootstrap4Dialog.BACKDROP_YES,
duration: 0, // SECONDS - how long the dialog should be displayed
autodestroy: true,
open: null,
close: null,
buttons: [],
// draggable: false,
// animate: true,
// tabindex: -1,
};
/**
* Prepares the dialog
*
* @param {type} options
* @returns the created dialog instance
*/
Bootstrap4Dialog.dialog = function(options) {
var dialog;
var _options = $.extend(false, this.defaultOptions, options);
_options['show'] = false;
try {
if (!_options['title'] && !_options['message'] && (!_options['buttons'] || !_options['buttons'].length)) {
return false;
}
var id = _options['id'] || 'modalWindow_' + uniqid();
var html =
'<div id="' + id + '" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">'
+ '<div class="modal-dialog" role="document">'
+ '<div class="modal-content">';
if (_options['title']) {
html +=
'<div class="modal-header rounded">'
+ '<h6 class="modal-title"></h6>'
+ '<button type="button" class="close" data-dismiss="modal" aria-label="Close">'
+ '<span aria-hidden="true">&times;</span>'
+ '</button>'
+ '</div>'
}
if (_options['message']) {
html +=
'<div class="modal-body">'
+ '</div>'
}
if (_options['buttons'] && _options['buttons'].length) {
html +=
'<div class="modal-footer text-center">'
//+ '<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>'
//+ '<button type="button" class="btn btn-primary">Save changes</button>'
+ '</div>'
}
+ '</div>'
+ '</div>'
+ '</div>'
;
$('body').append( html );
var _modal_container = $('#' + id);
// append title
if (_options['title'] && _options['title'].length) {
_modal_container.find('.modal-title').html( _options['title'] );
}
// append message
if (_options['message'] && _options['message'].length) {
_modal_container.find('.modal-body').html( _options['message'] );
}
if (_options['title'] && !_options['message'] && (!_options['buttons'] || !_options['buttons'].length)) {
_modal_container.find('.modal-header').css({'border-bottom':'0px'});
}
if (!_options['title'] && !_options['message'] && _options['buttons'] && _options['buttons'].length) {
_modal_container.find('.modal-footer').css({'border-top':'0px'});
}
if (_options['size'] && _options['size'].length) {
_modal_container.find('.modal-dialog').addClass(_options.size);
}
if (_options['centered']) {
_modal_container.find('.modal-dialog').addClass('modal-dialog-centered');
}
if (_options['scrollable']) {
_modal_container.find('.modal-dialog').addClass('modal-dialog-scrollable');
}
switch(true) {
case _options['type'] == 'primary':
_modal_container.find('.modal-header').addClass('bg-primary').find('.modal-title').addClass('text-white');
_modal_container.find('.modal-body').addClass('text-primary');
break;
case _options['type'] == 'secondary':
_modal_container.find('.modal-header').addClass('bg-secondary').find('.modal-title').addClass('text-white');
_modal_container.find('.modal-body').addClass('text-secondary');
break;
case _options['type'] == 'success':
_modal_container.find('.modal-header').addClass('bg-success').find('.modal-title').addClass('text-white');
_modal_container.find('.modal-body').addClass('text-success');
break;
case _options['type'] == 'danger':
_modal_container.find('.modal-header').addClass('bg-danger').find('.modal-title').addClass('text-white');
_modal_container.find('.modal-body').addClass('text-danger');
break;
case _options['type'] == 'warning':
_modal_container.find('.modal-header').addClass('bg-warning');
_modal_container.find('.modal-body').addClass('text-warning');
break;
case _options['type'] == 'info':
_modal_container.find('.modal-header').addClass('bg-info').find('.modal-title').addClass('text-white');
_modal_container.find('.modal-body').addClass('text-info');
break;
case _options['type'] == 'light':
_modal_container.find('.modal-header').addClass('bg-light').find('.modal-title').addClass('text-black');
_modal_container.find('.modal-body').addClass('text-black');
break;
case _options['type'] == 'dark':
_modal_container.find('.modal-header').addClass('bg-dark').find('.modal-title').addClass('text-white');
_modal_container.find('.modal-body').addClass('text-dark');
break;
}
dialog = _modal_container.modal(_options);
// try set buttons
try {
// fooder
var _footer = _modal_container.find('.modal-footer');
for(i in _options['buttons']) {
var _button = _options['buttons'][i];
// append the button
_footer.append('<button class="btn" />');
var _element_button = _footer.find('button').eq(i);
if (_button['id']) { _element_button.attr('id', _button['id']); }
if (_button['label']) { _element_button.html(_button['label']); }
if (_button['cssClass']) { _element_button.addClass(_button['cssClass']); }
// https://dzone.com/articles/why-does-javascript-loop-only-use-last-value
// https://stackoverflow.com/a/17750253/1565790
if (typeof(_button['action']) == 'function') {
(function(button, f, dialog) {
button.bind('click', function() { f(dialog, button); });
})(_element_button, _button['action'], dialog);
}
}
}
catch(e) {console.log(e.message);}
// set handlers
if (typeof(_options['open']) == 'function') {
dialog.on('shown.bs.modal', _options['open']);
}
if (typeof(_options['close']) == 'function') {
dialog.on('hidden.bs.modal', _options['close']);
}
if (_options['autodestroy']) {
dialog.on('hidden.bs.modal', function() { destroy(dialog) });
}
if (_options['duration']) {
dialog.on('shown.bs.modal', function() {
setTimeout(function() {
dialog.modal('hide');
}, parseFloat(_options['duration']) * 1000);
});
}
return dialog;
}
catch(e) {
console.warn(e.message);
}
}
/**
* Displays prepared dialog
*
* @param {type} options
* @returns the created dialog instance
*/
Bootstrap4Dialog.show = function(options) {
try {
return this.dialog(options).modal('show');
}
catch(e) {
console.warn(e.message);
}
}
/**
* Removes dialog DOM instance
*
* @param object dialog
*/
var destroy = function(dialog) {
try {
setTimeout(function() {
dialog.remove();
}, 200);
}
catch(e) {
console.warn(e.message);
}
};
/**
* Generates uniqid
*
* @source - https://github.com/makeable/uuid-v4.js/blob/master/uuid-v4.js
*/
var uniqid = function () {
var dec2hex = [];
for (var i = 0; i <= 15; i++) {
dec2hex[i] = i.toString(16);
}
var uuid = "";
for (var i = 1; i <= 36; i++) {
if (i === 9 || i === 14 || i === 19 || i === 24) {
uuid += "-";
} else if (i === 15) {
uuid += 4;
} else if (i === 20) {
uuid += dec2hex[(Math.random() * 4) | (0 + 8)];
} else {
uuid += dec2hex[(Math.random() * 16) | 0];
}
}
return uuid;
};
return Bootstrap4Dialog;
});

View file

@ -1,194 +0,0 @@
var myconfirm=function(opts) {
BootstrapDialog.show({
title: opts.title || 'Confirmation',
message: opts.question || 'Confirmez-vous ?',
autodestroy: true,
cssClass: opts.css_class || 'modal-warning',
type: opts.type || 'type-default',
data: {
oncancel: opts.oncancel,
onconfirm: opts.onconfirm,
data: opts.data,
confirm: false,
},
buttons: [
{
label: opts.cancel_label || 'Annuler',
action: function(dialog) {
dialog.close();
}
},
{
label: opts.confirm_label || 'Valider',
cssClass: 'btn-danger',
action: function(dialog) {
dialog.setData('confirm',true);
dialog.close();
}
}
],
onhidden: function(dialog) {
if (dialog.getData('confirm')) {
if (jQuery.type(dialog.getData('onconfirm')) == 'function') {
dialog.getData('onconfirm')(dialog.getData('data'));
}
}
else {
if (jQuery.type(dialog.getData('oncancel')) == 'function') {
dialog.getData('oncancel')(dialog.getData('data'));
}
}
}
});
}
var myalert=function(title,msg,opts) {
if ($.type(opts) != "object") {
opts={};
}
BootstrapDialog.show({
title: title || opts.title || 'Erreur',
message: msg,
autodestroy: true,
type: opts.type || 'type-danger',
size: opts.size || 'size-normal',
data: {
data: opts.data,
onclose: opts.onclose,
},
buttons: [
{
label: opts.btnLabel || 'OK',
cssClass: opts.btnCssClass ||'btn-primary',
action: function(dialog) {
dialog.close();
}
},
],
onhidden: function(dialog) {
if ($.type(dialog.getData('onclose')) == 'function') {
dialog.getData('onclose')(dialog.getData('data'));
}
}
});
}
var myprompt=function(opts) {
if ($.type(opts) != "object") {
opts={};
}
var onSubmitBtnClick = function(dialog) {
dialog.setData('submited',true);
var val = dialog.getModalBody().find('input').val();
if (jQuery.type(dialog.getData('onsubmit')) == 'function') {
if (!dialog.getData('onsubmit')(val, dialog.getData('data'))) {
if (jQuery.type(dialog.getData('onerror')) == 'function') {
dialog.getData('onerror')(val, dialog.getData('data'));
}
if (!dialog.getData('closeonerror')) {
return false;
}
}
}
dialog.close();
};
BootstrapDialog.show({
title: opts.title || 'Question',
message: "<label for='myprompt_input'>"+(opts.label || "Merci de saisir votre réponse ci-dessous :")+"</label><input type='text' class='form-control' id='myprompt_input'/>",
autodestroy: true,
type: opts.type || 'type-info',
size: opts.size || 'size-normal',
data: {
oncancel: opts.oncancel,
onsubmit: opts.onsubmit,
onerror: opts.onerror,
closeonerror: opts.closeonerror || false,
default_answer: opts.default_answer,
onSubmitBtnClick: onSubmitBtnClick,
data: opts.data,
submited: false,
},
buttons: [
{
label: opts.cancel_label || 'Annuler',
action: function(dialog) {
dialog.close();
}
},
{
label: opts.submit_label || 'Valider',
cssClass: 'btn-danger',
action: onSubmitBtnClick
}
],
onshow: function(dialog) {
var input = dialog.getModalBody().find('input');
input.on('keyup', function (e) {
if (e.keyCode == 13) {
dialog.getData('onSubmitBtnClick')(dialog);
}
});
if (dialog.getData('default_answer')) {
input.val(dialog.getData('default_answer'));
}
},
onhidden: function(dialog) {
if (!dialog.getData('submited') && jQuery.type(dialog.getData('oncancel')) == 'function') {
dialog.getData('oncancel')(dialog.getData('data'));
}
}
});
}
var myloadingalert=function(msg,opts) {
if ($.type(opts) != "object") {
opts={};
}
BootstrapDialog.show({
title: opts.title || 'Merci de patienter',
message: msg,
autodestroy: true,
type: opts.type || 'type-info',
size: opts.size || 'size-normal',
closable: opts.closable || false,
});
};
$( document ).ready(function () {
// Manage .myconfirm-link
$('.myconfirm-link').click(function(event) {
event.preventDefault();
myconfirm({
title: $(this).data("myconfirm-title") || "Confirmation",
question: "<p><strong>"+($(this).data("myconfirm-question") || "&Ecirc;tes-vous sûre ?")+"</strong></p>",
onconfirm: function(data) {
window.location = data.confirm_url;
},
data: {
confirm_url: $(this).data('myconfirm-url')
}
});
});
// Manage .myconfirm-btn
$('.myconfirm-btn').click(function(event) {
if ($(this).data('myconfirm-btn-confirmed') == '1') {
$(this).data('myconfirm-btn-confirmed', '');
return true;
}
event.preventDefault();
myconfirm({
title: $(this).data("myconfirm-title") || "Confirmation",
question: "<p><strong>"+($(this).data("myconfirm-question") || "&Ecirc;tes-vous sûre ?")+"</strong></p>",
onconfirm: function(data) {
data.btn.data('myconfirm-btn-confirmed', 1);
data.btn.click();
},
data: {
btn: $(this)
}
});
});
});

View file

@ -0,0 +1 @@
fr_FR.UTF8.js

View file

@ -0,0 +1 @@
fr_FR.UTF8.js

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
fr_FR.UTF8.js

View file

@ -0,0 +1 @@
fr_FR.UTF8.js

View file

@ -0,0 +1 @@
fr_FR.UTF8.js

View file

@ -88,14 +88,14 @@
{/block} {/block}
<!-- Bootstrap --> <!-- Jquery & Bootstrap -->
<script src="lib/jquery-3.4.1.min.js"></script>
<script src="lib/bootstrap4/js/bootstrap.bundle.min.js"></script>
<script src="lib/jquery-3.4.1.min.js"></script> <!-- Other libs & JavaScript scripts -->
<script src="lib/bootstrap4/js/bootstrap.bundle.min.js"></script> {foreach $js as $file}
<script language="javascript" src="{$file}"></script>
{foreach $js as $file} {/foreach}
<script language="javascript" src="{$file}"></script>
{/foreach}
</body> </body>
</html> </html>

View file

@ -1,4 +0,0 @@
{extends file='empty.tpl'}
{block name="content"}
<p class="center">{t}The requested page can not be found.{/t}</p>
{/block}

4
templates/error_page.tpl Normal file
View file

@ -0,0 +1,4 @@
{extends file='empty.tpl'}
{block name="content"}
<p class="center">{$message}</p>
{/block}

View file

@ -65,7 +65,7 @@
<div class="row"> <div class="row">
{if $result.count>1} {if $result.count>1}
<div class="col-lg-3"> <div class="col-lg-3">
<div role="status">{t 1=$result.first 2=$result.last 3=$result.count}Element(s) %1 to %2 on %3{/t}</div> <div role="status">{t count=$result.count 1=$result.first 2=$result.last 3=$result.count plural="Elements %1 to %2 on %3"}%3 element{/t}</div>
</div> </div>
{/if} {/if}
{if $result.nb_pages > 1} {if $result.nb_pages > 1}