]> git.agnieray.net Git - galette.git/commitdiff
Adaptations for Slim3 (WIP)
authorJohan Cwiklinski <johan@x-tnd.be>
Mon, 15 Feb 2016 19:07:48 +0000 (20:07 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Mon, 17 Oct 2016 20:38:57 +0000 (22:38 +0200)
23 files changed:
.gitignore
galette/composer.json [new file with mode: 0644]
galette/composer.lock [new file with mode: 0644]
galette/config/paths.inc.php
galette/includes/dependencies.php [new file with mode: 0644]
galette/includes/galette.inc.php
galette/includes/main.inc.php
galette/includes/routes/authentication.routes.php
galette/includes/routes/contributions.routes.php
galette/includes/routes/groups.routes.php
galette/includes/routes/main.routes.php
galette/includes/routes/management.routes.php
galette/includes/routes/members.routes.php
galette/includes/routes/plugins.routes.php
galette/includes/routes/public_pages.routes.php
galette/lib/Galette/Core/Plugins.php
galette/lib/Galette/Core/SysInfos.php
galette/templates/default/desktop.tpl
galette/templates/default/footer.tpl
galette/templates/default/index.tpl
galette/templates/default/page.tpl
galette/templates/default/preferences.tpl
galette/templates/default/public_page.tpl

index d09259d2191647108c87d95dfd947bb98c3ce40a..faf30e1b84d02257c61bc237e5420aede0af26c0 100644 (file)
@@ -75,6 +75,7 @@ galette/includes/tcpdf_*
 galette/includes/Zend*
 galette/includes/Analog*
 galette/password_compat*
+galette/vendor/
 
 # API documentation
 apidocs/
diff --git a/galette/composer.json b/galette/composer.json
new file mode 100644 (file)
index 0000000..fa8531e
--- /dev/null
@@ -0,0 +1,31 @@
+{
+    "name": "galette/galette",
+    "description": "Galette webapp.",
+    "license": "GPLv3",
+    "type": "project",
+    "keywords": ["membership"],
+    "authors": [
+        {
+            "name": "Johan Cwiklinski",
+            "email": "trasher@x-tnd.be",
+            "homepage": "http://galette.eu"
+        }
+    ],
+    "autoload": {
+        "psr-4": {
+            "Galette\\": "lib/Galette"
+        }
+    },
+    "require": {
+        "slim/slim": "^3.0",
+        "slim/twig-view": "^2.0",
+        "slim/flash": "^0.1.0",
+        "monolog/monolog": "^1.13",
+        "mathmarques/smarty-view": "^1.0",
+        "zendframework/zend-db": "^2.6",
+        "analog/analog": "^1.0",
+        "ircmaxell/password-compat": "^1.0",
+        "phpmailer/phpmailer": "^5.2",
+        "tecnickcom/tcpdf": "^6.2"
+    }
+}
diff --git a/galette/composer.lock b/galette/composer.lock
new file mode 100644 (file)
index 0000000..4ecc4b1
--- /dev/null
@@ -0,0 +1,1009 @@
+{
+    "_readme": [
+        "This file locks the dependencies of your project to a known state",
+        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+        "This file is @generated automatically"
+    ],
+    "hash": "471a0a768868b1d1fa826bf96b2efc58",
+    "content-hash": "97b39980252882bbdbba3a96b708c9e3",
+    "packages": [
+        {
+            "name": "analog/analog",
+            "version": "1.0.7-stable",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/jbroadway/analog.git",
+                "reference": "69615c0e8b4033169b45d58f778fd3ba638d1d52"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/jbroadway/analog/zipball/69615c0e8b4033169b45d58f778fd3ba638d1d52",
+                "reference": "69615c0e8b4033169b45d58f778fd3ba638d1d52",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.2",
+                "psr/log": "1.*"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-0": {
+                    "Analog": "lib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Johnny Broadway",
+                    "email": "johnny@johnnybroadway.com",
+                    "homepage": "http://www.johnnybroadway.com/"
+                }
+            ],
+            "description": "PHP 5.3+ micro logging class that can be extended via closures. Includes several pre-built handlers including file, mail, syslog, HTTP post, and MongoDB.",
+            "homepage": "https://github.com/jbroadway/analog",
+            "keywords": [
+                "alerts",
+                "debug",
+                "debugging",
+                "error",
+                "log",
+                "logger",
+                "logging",
+                "syslog"
+            ],
+            "time": "2015-05-25 15:23:49"
+        },
+        {
+            "name": "container-interop/container-interop",
+            "version": "1.1.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/container-interop/container-interop.git",
+                "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e",
+                "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e",
+                "shasum": ""
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Interop\\Container\\": "src/Interop/Container/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
+            "time": "2014-12-30 15:22:37"
+        },
+        {
+            "name": "ircmaxell/password-compat",
+            "version": "v1.0.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/ircmaxell/password_compat.git",
+                "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c",
+                "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c",
+                "shasum": ""
+            },
+            "require-dev": {
+                "phpunit/phpunit": "4.*"
+            },
+            "type": "library",
+            "autoload": {
+                "files": [
+                    "lib/password.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Anthony Ferrara",
+                    "email": "ircmaxell@php.net",
+                    "homepage": "http://blog.ircmaxell.com"
+                }
+            ],
+            "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash",
+            "homepage": "https://github.com/ircmaxell/password_compat",
+            "keywords": [
+                "hashing",
+                "password"
+            ],
+            "time": "2014-11-20 16:49:30"
+        },
+        {
+            "name": "mathmarques/smarty-view",
+            "version": "1.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/mathmarques/Smarty-View.git",
+                "reference": "0e7e34611d78183efbf748fa351be3faf09bcbce"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/mathmarques/Smarty-View/zipball/0e7e34611d78183efbf748fa351be3faf09bcbce",
+                "reference": "0e7e34611d78183efbf748fa351be3faf09bcbce",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5.0",
+                "slim/slim": "^3.0",
+                "smarty/smarty": "~3.1"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.8.0"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Slim\\Views\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Matheus Marques",
+                    "email": "matheusocmarques@gmail.com",
+                    "homepage": "http://matheusmarques.com"
+                }
+            ],
+            "description": "Slim Framework 3 view helper built on top of the Smarty templating component",
+            "keywords": [
+                "framework",
+                "slim",
+                "smarty",
+                "template",
+                "view"
+            ],
+            "time": "2015-12-07 21:31:37"
+        },
+        {
+            "name": "monolog/monolog",
+            "version": "1.17.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/Seldaek/monolog.git",
+                "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bee7f0dc9c3e0b69a6039697533dca1e845c8c24",
+                "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.0",
+                "psr/log": "~1.0"
+            },
+            "provide": {
+                "psr/log-implementation": "1.0.0"
+            },
+            "require-dev": {
+                "aws/aws-sdk-php": "^2.4.9",
+                "doctrine/couchdb": "~1.0@dev",
+                "graylog2/gelf-php": "~1.0",
+                "jakub-onderka/php-parallel-lint": "0.9",
+                "php-console/php-console": "^3.1.3",
+                "phpunit/phpunit": "~4.5",
+                "phpunit/phpunit-mock-objects": "2.3.0",
+                "raven/raven": "^0.13",
+                "ruflin/elastica": ">=0.90 <3.0",
+                "swiftmailer/swiftmailer": "~5.3",
+                "videlalvaro/php-amqplib": "~2.4"
+            },
+            "suggest": {
+                "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
+                "doctrine/couchdb": "Allow sending log messages to a CouchDB server",
+                "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
+                "ext-mongo": "Allow sending log messages to a MongoDB server",
+                "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
+                "php-console/php-console": "Allow sending log messages to Google Chrome",
+                "raven/raven": "Allow sending log messages to a Sentry server",
+                "rollbar/rollbar": "Allow sending log messages to Rollbar",
+                "ruflin/elastica": "Allow sending log messages to an Elastic Search server",
+                "videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.16.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Monolog\\": "src/Monolog"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jordi Boggiano",
+                    "email": "j.boggiano@seld.be",
+                    "homepage": "http://seld.be"
+                }
+            ],
+            "description": "Sends your logs to files, sockets, inboxes, databases and various web services",
+            "homepage": "http://github.com/Seldaek/monolog",
+            "keywords": [
+                "log",
+                "logging",
+                "psr-3"
+            ],
+            "time": "2015-10-14 12:51:02"
+        },
+        {
+            "name": "nikic/fast-route",
+            "version": "v0.6.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/nikic/FastRoute.git",
+                "reference": "31fa86924556b80735f98b294a7ffdfb26789f22"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/nikic/FastRoute/zipball/31fa86924556b80735f98b294a7ffdfb26789f22",
+                "reference": "31fa86924556b80735f98b294a7ffdfb26789f22",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.4.0"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "FastRoute\\": "src/"
+                },
+                "files": [
+                    "src/functions.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Nikita Popov",
+                    "email": "nikic@php.net"
+                }
+            ],
+            "description": "Fast request router for PHP",
+            "keywords": [
+                "router",
+                "routing"
+            ],
+            "time": "2015-06-18 19:15:47"
+        },
+        {
+            "name": "phpmailer/phpmailer",
+            "version": "v5.2.14",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/PHPMailer/PHPMailer.git",
+                "reference": "e774bc9152de85547336e22b8926189e582ece95"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e774bc9152de85547336e22b8926189e582ece95",
+                "reference": "e774bc9152de85547336e22b8926189e582ece95",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.0.0"
+            },
+            "require-dev": {
+                "phpdocumentor/phpdocumentor": "*",
+                "phpunit/phpunit": "4.7.*"
+            },
+            "suggest": {
+                "league/oauth2-client": "Needed for XOAUTH2 authentication",
+                "league/oauth2-google": "Needed for Gmail XOAUTH2"
+            },
+            "type": "library",
+            "autoload": {
+                "classmap": [
+                    "class.phpmailer.php",
+                    "class.phpmaileroauth.php",
+                    "class.phpmaileroauthgoogle.php",
+                    "class.smtp.php",
+                    "class.pop3.php",
+                    "extras/EasyPeasyICS.php",
+                    "extras/ntlm_sasl_client.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "LGPL-2.1"
+            ],
+            "authors": [
+                {
+                    "name": "Jim Jagielski",
+                    "email": "jimjag@gmail.com"
+                },
+                {
+                    "name": "Marcus Bointon",
+                    "email": "phpmailer@synchromedia.co.uk"
+                },
+                {
+                    "name": "Andy Prevost",
+                    "email": "codeworxtech@users.sourceforge.net"
+                },
+                {
+                    "name": "Brent R. Matzelle"
+                }
+            ],
+            "description": "PHPMailer is a full-featured email creation and transfer class for PHP",
+            "time": "2015-11-01 10:15:28"
+        },
+        {
+            "name": "pimple/pimple",
+            "version": "v3.0.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/silexphp/Pimple.git",
+                "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/silexphp/Pimple/zipball/a30f7d6e57565a2e1a316e1baf2a483f788b258a",
+                "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.0.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Pimple": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                }
+            ],
+            "description": "Pimple, a simple Dependency Injection Container",
+            "homepage": "http://pimple.sensiolabs.org",
+            "keywords": [
+                "container",
+                "dependency injection"
+            ],
+            "time": "2015-09-11 15:10:35"
+        },
+        {
+            "name": "psr/http-message",
+            "version": "1.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/php-fig/http-message.git",
+                "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
+                "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.0.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Psr\\Http\\Message\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "PHP-FIG",
+                    "homepage": "http://www.php-fig.org/"
+                }
+            ],
+            "description": "Common interface for HTTP messages",
+            "keywords": [
+                "http",
+                "http-message",
+                "psr",
+                "psr-7",
+                "request",
+                "response"
+            ],
+            "time": "2015-05-04 20:22:00"
+        },
+        {
+            "name": "psr/log",
+            "version": "1.0.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/php-fig/log.git",
+                "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
+                "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
+                "shasum": ""
+            },
+            "type": "library",
+            "autoload": {
+                "psr-0": {
+                    "Psr\\Log\\": ""
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "PHP-FIG",
+                    "homepage": "http://www.php-fig.org/"
+                }
+            ],
+            "description": "Common interface for logging libraries",
+            "keywords": [
+                "log",
+                "psr",
+                "psr-3"
+            ],
+            "time": "2012-12-21 11:40:51"
+        },
+        {
+            "name": "slim/flash",
+            "version": "0.1.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/slimphp/Slim-Flash.git",
+                "reference": "1995ed53b77b8eeb67adf032de93c319f76aa5cd"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/slimphp/Slim-Flash/zipball/1995ed53b77b8eeb67adf032de93c319f76aa5cd",
+                "reference": "1995ed53b77b8eeb67adf032de93c319f76aa5cd",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5.0"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Slim\\Flash\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Josh Lockhart",
+                    "email": "hello@joshlockhart.com",
+                    "homepage": "http://joshlockhart.com"
+                }
+            ],
+            "description": "Slim Framework Flash message service provider",
+            "homepage": "http://slimframework.com",
+            "keywords": [
+                "flash",
+                "framework",
+                "message",
+                "provider",
+                "slim"
+            ],
+            "time": "2015-08-16 22:49:06"
+        },
+        {
+            "name": "slim/slim",
+            "version": "3.1.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/slimphp/Slim.git",
+                "reference": "03b44a4b41896ba42c78bbd5fa172cd79e650496"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/slimphp/Slim/zipball/03b44a4b41896ba42c78bbd5fa172cd79e650496",
+                "reference": "03b44a4b41896ba42c78bbd5fa172cd79e650496",
+                "shasum": ""
+            },
+            "require": {
+                "container-interop/container-interop": "^1.1",
+                "nikic/fast-route": "^0.6",
+                "php": ">=5.5.0",
+                "pimple/pimple": "^3.0",
+                "psr/http-message": "^1.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.0",
+                "squizlabs/php_codesniffer": "^2.5"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Slim\\": "Slim"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Rob Allen",
+                    "email": "rob@akrabat.com",
+                    "homepage": "http://akrabat.com"
+                },
+                {
+                    "name": "Josh Lockhart",
+                    "email": "hello@joshlockhart.com",
+                    "homepage": "https://joshlockhart.com"
+                },
+                {
+                    "name": "Gabriel Manricks",
+                    "email": "gmanricks@me.com",
+                    "homepage": "http://gabrielmanricks.com"
+                },
+                {
+                    "name": "Andrew Smith",
+                    "email": "a.smith@silentworks.co.uk",
+                    "homepage": "http://silentworks.co.uk"
+                }
+            ],
+            "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs",
+            "homepage": "http://slimframework.com",
+            "keywords": [
+                "api",
+                "framework",
+                "micro",
+                "router"
+            ],
+            "time": "2016-01-08 15:37:50"
+        },
+        {
+            "name": "slim/twig-view",
+            "version": "2.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/slimphp/Twig-View.git",
+                "reference": "fe98eab8daee498cc2821f1ad2ff7123bc327844"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/slimphp/Twig-View/zipball/fe98eab8daee498cc2821f1ad2ff7123bc327844",
+                "reference": "fe98eab8daee498cc2821f1ad2ff7123bc327844",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5.0",
+                "psr/http-message": "^1.0",
+                "twig/twig": "^1.18"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.8.0"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Slim\\Views\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Josh Lockhart",
+                    "email": "hello@joshlockhart.com",
+                    "homepage": "http://joshlockhart.com"
+                }
+            ],
+            "description": "Slim Framework view helper built on top of the Twig templating component",
+            "homepage": "http://slimframework.com",
+            "keywords": [
+                "framework",
+                "slim",
+                "template",
+                "twig",
+                "view"
+            ],
+            "time": "2015-08-17 08:45:48"
+        },
+        {
+            "name": "smarty/smarty",
+            "version": "v3.1.29",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/smarty-php/smarty.git",
+                "reference": "35480f10e7ce9b0fdaf23d3799d7b79463919b1e"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/smarty-php/smarty/zipball/35480f10e7ce9b0fdaf23d3799d7b79463919b1e",
+                "reference": "35480f10e7ce9b0fdaf23d3799d7b79463919b1e",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.2"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.1.x-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "libs/Smarty.class.php",
+                    "libs/SmartyBC.class.php",
+                    "libs/sysplugins/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "LGPL-3.0"
+            ],
+            "authors": [
+                {
+                    "name": "Monte Ohrt",
+                    "email": "monte@ohrt.com"
+                },
+                {
+                    "name": "Uwe Tews",
+                    "email": "uwe.tews@googlemail.com"
+                },
+                {
+                    "name": "Rodney Rehm",
+                    "email": "rodney.rehm@medialize.de"
+                }
+            ],
+            "description": "Smarty - the compiling PHP template engine",
+            "homepage": "http://www.smarty.net",
+            "keywords": [
+                "templating"
+            ],
+            "time": "2015-12-21 01:57:06"
+        },
+        {
+            "name": "tecnickcom/tcpdf",
+            "version": "6.2.12",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/tecnickcom/TCPDF.git",
+                "reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/2f732eaa91b5665274689b1d40b285a7bacdc37f",
+                "reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "type": "library",
+            "autoload": {
+                "classmap": [
+                    "fonts",
+                    "config",
+                    "include",
+                    "tcpdf.php",
+                    "tcpdf_parser.php",
+                    "tcpdf_import.php",
+                    "tcpdf_barcodes_1d.php",
+                    "tcpdf_barcodes_2d.php",
+                    "include/tcpdf_colors.php",
+                    "include/tcpdf_filters.php",
+                    "include/tcpdf_font_data.php",
+                    "include/tcpdf_fonts.php",
+                    "include/tcpdf_images.php",
+                    "include/tcpdf_static.php",
+                    "include/barcodes/datamatrix.php",
+                    "include/barcodes/pdf417.php",
+                    "include/barcodes/qrcode.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "LGPLv3"
+            ],
+            "authors": [
+                {
+                    "name": "Nicola Asuni",
+                    "email": "info@tecnick.com",
+                    "homepage": "http://nicolaasuni.tecnick.com"
+                }
+            ],
+            "description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
+            "homepage": "http://www.tcpdf.org/",
+            "keywords": [
+                "PDFD32000-2008",
+                "TCPDF",
+                "barcodes",
+                "datamatrix",
+                "pdf",
+                "pdf417",
+                "qrcode"
+            ],
+            "time": "2015-09-12 10:08:34"
+        },
+        {
+            "name": "twig/twig",
+            "version": "v1.24.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/twigphp/Twig.git",
+                "reference": "3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/twigphp/Twig/zipball/3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8",
+                "reference": "3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.2.7"
+            },
+            "require-dev": {
+                "symfony/debug": "~2.7",
+                "symfony/phpunit-bridge": "~2.7"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.24-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Twig_": "lib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com",
+                    "homepage": "http://fabien.potencier.org",
+                    "role": "Lead Developer"
+                },
+                {
+                    "name": "Armin Ronacher",
+                    "email": "armin.ronacher@active-4.com",
+                    "role": "Project Founder"
+                },
+                {
+                    "name": "Twig Team",
+                    "homepage": "http://twig.sensiolabs.org/contributors",
+                    "role": "Contributors"
+                }
+            ],
+            "description": "Twig, the flexible, fast, and secure template language for PHP",
+            "homepage": "http://twig.sensiolabs.org",
+            "keywords": [
+                "templating"
+            ],
+            "time": "2016-01-25 21:22:18"
+        },
+        {
+            "name": "zendframework/zend-db",
+            "version": "2.6.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/zendframework/zend-db.git",
+                "reference": "8bda58293d6baa3e1d8316300fce0fed55df8ea0"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/zendframework/zend-db/zipball/8bda58293d6baa3e1d8316300fce0fed55df8ea0",
+                "reference": "8bda58293d6baa3e1d8316300fce0fed55df8ea0",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5",
+                "zendframework/zend-stdlib": "~2.7"
+            },
+            "require-dev": {
+                "fabpot/php-cs-fixer": "1.7.*",
+                "phpunit/phpunit": "~4.0",
+                "zendframework/zend-eventmanager": "~2.5",
+                "zendframework/zend-hydrator": "~1.0",
+                "zendframework/zend-mvc": "~2.5",
+                "zendframework/zend-servicemanager": "~2.5"
+            },
+            "suggest": {
+                "zendframework/zend-eventmanager": "Zend\\EventManager component",
+                "zendframework/zend-hydrator": "Zend\\Hydrator component for using HydratingResultSets",
+                "zendframework/zend-servicemanager": "Zend\\ServiceManager component"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.6-dev",
+                    "dev-develop": "2.7-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Zend\\Db\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "homepage": "https://github.com/zendframework/zend-db",
+            "keywords": [
+                "db",
+                "zf2"
+            ],
+            "time": "2015-12-09 21:17:32"
+        },
+        {
+            "name": "zendframework/zend-hydrator",
+            "version": "1.0.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/zendframework/zend-hydrator.git",
+                "reference": "f3ed8b833355140350bbed98d8a7b8b66875903f"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/zendframework/zend-hydrator/zipball/f3ed8b833355140350bbed98d8a7b8b66875903f",
+                "reference": "f3ed8b833355140350bbed98d8a7b8b66875903f",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5",
+                "zendframework/zend-stdlib": "^2.5.1"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.0",
+                "squizlabs/php_codesniffer": "^2.0@dev",
+                "zendframework/zend-eventmanager": "^2.5.1",
+                "zendframework/zend-filter": "^2.5.1",
+                "zendframework/zend-inputfilter": "^2.5.1",
+                "zendframework/zend-serializer": "^2.5.1",
+                "zendframework/zend-servicemanager": "^2.5.1"
+            },
+            "suggest": {
+                "zendframework/zend-eventmanager": "^2.5.1, to support aggregate hydrator usage",
+                "zendframework/zend-filter": "^2.5.1, to support naming strategy hydrator usage",
+                "zendframework/zend-serializer": "^2.5.1, to use the SerializableStrategy",
+                "zendframework/zend-servicemanager": "^2.5.1, to support hydrator plugin manager usage"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.0-dev",
+                    "dev-develop": "1.1-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Zend\\Hydrator\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "homepage": "https://github.com/zendframework/zend-hydrator",
+            "keywords": [
+                "hydrator",
+                "zf2"
+            ],
+            "time": "2015-09-17 14:06:43"
+        },
+        {
+            "name": "zendframework/zend-stdlib",
+            "version": "2.7.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/zendframework/zend-stdlib.git",
+                "reference": "cae029346a33663b998507f94962eb27de060683"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/cae029346a33663b998507f94962eb27de060683",
+                "reference": "cae029346a33663b998507f94962eb27de060683",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5",
+                "zendframework/zend-hydrator": "~1.0"
+            },
+            "require-dev": {
+                "athletic/athletic": "~0.1",
+                "fabpot/php-cs-fixer": "1.7.*",
+                "phpunit/phpunit": "~4.0",
+                "zendframework/zend-config": "~2.5",
+                "zendframework/zend-eventmanager": "~2.5",
+                "zendframework/zend-filter": "~2.5",
+                "zendframework/zend-inputfilter": "~2.5",
+                "zendframework/zend-serializer": "~2.5",
+                "zendframework/zend-servicemanager": "~2.5"
+            },
+            "suggest": {
+                "zendframework/zend-eventmanager": "To support aggregate hydrator usage",
+                "zendframework/zend-filter": "To support naming strategy hydrator usage",
+                "zendframework/zend-serializer": "Zend\\Serializer component",
+                "zendframework/zend-servicemanager": "To support hydrator plugin manager usage"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.7-dev",
+                    "dev-develop": "2.8-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Zend\\Stdlib\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "homepage": "https://github.com/zendframework/zend-stdlib",
+            "keywords": [
+                "stdlib",
+                "zf2"
+            ],
+            "time": "2015-10-15 15:57:32"
+        }
+    ],
+    "packages-dev": [],
+    "aliases": [],
+    "minimum-stability": "stable",
+    "stability-flags": [],
+    "prefer-stable": false,
+    "prefer-lowest": false,
+    "platform": [],
+    "platform-dev": []
+}
index 40c08a025ba44841f6fa23f106f3f52acfbab143..74fcb2abc9634eb61452cbf25b3c2e931110c947 100644 (file)
@@ -74,12 +74,12 @@ if ( !defined('GALETTE_TCPDF_PATH') ) {
         GALETTE_ROOT . 'includes/tcpdf_' . TCPDF_VERSION
     );
 }
-if ( !defined('GALETTE_SLIM_PATH') ) {
+/*if ( !defined('GALETTE_SLIM_PATH') ) {
     define('GALETTE_SLIM_PATH', GALETTE_ROOT . 'lib/Slim-' . SLIM_VERSION);
 }
 if ( !defined('GALETTE_SLIM_VIEWS_PATH') ) {
-    define('GALETTE_SLIM_VIEWS_PATH', GALETTE_ROOT . 'lib/Slim-Views' . SLIM_VIEWS_VERSION);
-}
+    define('GALETTE_SLIM_VIEWS_PATH', GALETTE_ROOT . 'lib/Slim-Views');
+}*/
 /*if ( !defined('GALETTE_XHPROF_PATH') ) {
     define('GALETTE_XHPROF_PATH', '/usr/share/xhprof/');
 }*/
diff --git a/galette/includes/dependencies.php b/galette/includes/dependencies.php
new file mode 100644 (file)
index 0000000..c45acdc
--- /dev/null
@@ -0,0 +1,211 @@
+<?php
+// DIC configuration
+
+$container = $app->getContainer();
+
+// -----------------------------------------------------------------------------
+// Service providers
+// -----------------------------------------------------------------------------
+
+// Register Smarty View helper
+$container['view'] = function ($c) {
+    $view = new \Slim\Views\Smarty(
+        rtrim(GALETTE_ROOT . GALETTE_TPL_SUBDIR, DIRECTORY_SEPARATOR),
+        [
+            'cacheDir' => rtrim(GALETTE_CACHE_DIR, DIRECTORY_SEPARATOR),
+            'compileDir' => rtrim(GALETTE_COMPILE_DIR, DIRECTORY_SEPARATOR),
+            'pluginsDir' => [
+                GALETTE_ROOT . 'includes/smarty_plugins'
+            ]
+        ]
+    );
+
+    // Add Slim specific plugins
+    $view->addSlimPlugins($c['router'], $c['request']->getUri());
+
+
+    $smarty = $view->getSmarty();
+    $smarty->inheritance_merge_compiled_includes = false;
+
+    $smarty->assign('login', $c->login);
+    $smarty->assign('logo', $c->logo);
+    $smarty->assign('tpl', $smarty);
+    $smarty->assign('headers', $c->plugins->getTplHeaders());
+    $smarty->assign('plugin_actions', $c->plugins->getTplAdhActions());
+    $smarty->assign(
+        'plugin_batch_actions',
+        $c->plugins->getTplAdhBatchActions()
+    );
+    $smarty->assign(
+        'plugin_detailled_actions',
+        $c->plugins->getTplAdhDetailledActions()
+    );
+    $smarty->assign('jquery_dir', 'js/jquery/');
+    $smarty->assign('jquery_version', JQUERY_VERSION);
+    $smarty->assign('jquery_migrate_version', JQUERY_MIGRATE_VERSION);
+    $smarty->assign('jquery_ui_version', JQUERY_UI_VERSION);
+    $smarty->assign('jquery_markitup_version', JQUERY_MARKITUP_VERSION);
+    $smarty->assign('jquery_jqplot_version', JQUERY_JQPLOT_VERSION);
+    $smarty->assign('scripts_dir', 'js/');
+    $smarty->assign('PAGENAME', basename($_SERVER['SCRIPT_NAME']));
+    $smarty->assign('galette_base_path', './');
+    $smarty->assign('GALETTE_VERSION', GALETTE_VERSION);
+    $smarty->assign('GALETTE_MODE', GALETTE_MODE);
+
+    /*if ($this->parserConfigDir) {
+        $instance->setConfigDir($this->parserConfigDir);
+    }*/
+
+    $smarty->assign('template_subdir', GALETTE_THEME);
+    foreach ($c->plugins->getTplAssignments() as $k => $v) {
+        $smarty->assign($k, $v);
+    }
+    /** galette_lang should be removed and languages used instead */
+    $smarty->assign('galette_lang', $c->i18n->getAbbrev());
+    $smarty->assign('languages', $c->i18n->getList());
+    $smarty->assign('plugins', $c->plugins);
+    $smarty->assign('preferences', $c->preferences);
+    $smarty->assign('pref_slogan', $c->preferences->pref_slogan);
+    $smarty->assign('pref_theme', $c->preferences->pref_theme);
+    $smarty->assign(
+        'pref_editor_enabled',
+        $c->preferences->pref_editor_enabled
+    );
+    $smarty->assign('pref_mail_method', $c->preferences->pref_mail_method);
+    /*$instance->assign('existing_mailing', isset($this->_session['mailing']));*/
+    $smarty->assign('require_tabs', null);
+    $smarty->assign('require_cookie', null);
+    $smarty->assign('contentcls', null);
+    $smarty->assign('require_tabs', null);
+    $smarty->assign('require_cookie', false);
+    $smarty->assign('additionnal_html_class', null);
+    $smarty->assign('require_calendar', null);
+    $smarty->assign('head_redirect', null);
+    $smarty->assign('error_detected', null);
+    $smarty->assign('warning_detected', null);
+    $smarty->assign('success_detected', null);
+    $smarty->assign('color_picker', null);
+    $smarty->assign('require_sorter', null);
+    $smarty->assign('require_dialog', null);
+    $smarty->assign('require_tree', null);
+    $smarty->assign('html_editor', null);
+    $smarty->assign('require_charts', null);
+
+    return $view;
+};
+
+// Flash messages
+$container['flash'] = function ($c) {
+    return new \Slim\Flash\Messages;
+};
+
+$container['plugins'] = function ($c) use ($app) {
+    $plugins = new Galette\Core\Plugins();
+    $i18n = $c->get('i18n');
+    $plugins->setApp($app);
+    $plugins->loadModules(GALETTE_PLUGINS_PATH, $i18n->getFileName());
+    return $plugins;
+};
+
+$container['i18n'] = function ($c) {
+    return new Galette\Core\I18n();
+};
+
+$container['zdb'] = function ($c) {
+    $zdb = new Galette\Core\Db();
+    return $zdb;
+};
+
+$container['preferences'] = function ($c) {
+    return new Galette\Core\Preferences($c->zdb);
+};
+
+$container['login'] = function ($c) use($session_name) {
+    $session = &$_SESSION['galette'][$session_name];
+    if (isset($session['login'])) {
+        $login = unserialize(
+            $session['login']
+        );
+        $login->setDb($c->get('zdb'));
+    } else {
+        $login = new Galette\Core\Login(
+            $c->get('zdb'),
+            $c->get('i18n'),
+            $session
+        );
+    }
+
+    if (PHP_SAPI === 'cli') {
+        $login->logCron(basename($argv[0], '.php'));
+    }
+
+    return $login;
+};
+
+$container['logo'] = function ($c) {
+    return new Galette\Core\Logo();
+};
+
+$container['history'] = function ($c) {
+    return new Galette\Core\History();
+};
+
+$container['acls'] = function ($c) {
+    $acls = [
+        'preferences'       => 'admin',
+        'store-preferences' => 'admin',
+        'dashboard'         => 'groupmanager',
+        'sysinfos'          => 'staff',
+        'charts'            => 'staff',
+        'plugins'           => 'admin',
+        'history'           => 'staff',
+        'members'           => 'groupmanager',
+        'filter-memberslist'=> 'groupmanager',
+        'advanced-search'   => 'groupmanager',
+        'batch-memberslist' => 'groupmanager',
+        'mailing'           => 'staff',
+        'csv-memberslist'   => 'staff',
+        'groups'            => 'groupmanager',
+        'me'                => 'member',
+        'member'            => 'member',
+        'pdf-members-cards' => 'member',
+        'pdf-members-labels'=> 'groupmanager',
+        'mailings'          => 'staff',
+        'contributions'     => 'staff',
+        'transactions'      => 'staff',
+        'payments_filter'   => 'member',
+        'editmember'        => 'member',
+        'storemembers'      => 'member',
+        'impersonate'       => 'superadmin',
+        'unimpersonate'     => 'member'
+    ];
+
+    //load user defined ACLs
+    if (file_exists(GALETTE_CONFIG_PATH  . 'local_acls.inc.php')) {
+        $acls = array_merge($acls, $local_acls);
+    }
+
+    return $acls;
+};
+
+
+// -----------------------------------------------------------------------------
+// Service factories
+// -----------------------------------------------------------------------------
+
+// monolog
+$container['logger'] = function ($c) {
+    $settings = $c->get('settings');
+    $logger = new \Monolog\Logger($settings['logger']['name']);
+    $logger->pushProcessor(new \Monolog\Processor\UidProcessor());
+    $logger->pushHandler(new \Monolog\Handler\StreamHandler($settings['logger']['path'], \Monolog\Logger::DEBUG));
+    return $logger;
+};
+
+// -----------------------------------------------------------------------------
+// Action factories
+// -----------------------------------------------------------------------------
+
+$container['App\Action\HomeAction'] = function ($c) {
+    return new App\Action\HomeAction($c->get('view'), $c->get('logger'));
+};
index b22635284c64de6ae95991f2642afbc19e464b14..c7c4c71ea1059cb3914952d270772e059b160e03 100644 (file)
  * @since     Available since 0.7-dev - 2007-10-07
  */
 
-if ( !defined('GALETTE_PHP_MIN') ) {
+if (!defined('GALETTE_PHP_MIN')) {
     define('GALETTE_PHP_MIN', '5.4');
 }
 
 // check required PHP version...
-if ( version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<') ) {
+if (version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<')) {
     echo 'Galette is NOT compliant with your current PHP version. ' .
         'Galette requires PHP ' . GALETTE_PHP_MIN  .
         ' minimum and current version is ' . phpversion();
@@ -51,12 +51,12 @@ $time_start = microtime(true);
 $cron = (PHP_SAPI === 'cli');
 
 //define galette's root directory
-if ( !defined('GALETTE_ROOT') ) {
+if (!defined('GALETTE_ROOT')) {
     define('GALETTE_ROOT', __DIR__ . '/../');
 }
 
 // define relative base path templating can use
-if ( !defined('GALETTE_BASE_PATH') ) {
+if (!defined('GALETTE_BASE_PATH')) {
     define('GALETTE_BASE_PATH', './');
 }
 
@@ -64,36 +64,37 @@ require_once GALETTE_ROOT . 'config/versions.inc.php';
 require_once GALETTE_ROOT . 'config/paths.inc.php';
 
 //we'll only include relevant parts if we work from installer
-if ( !isset($installer) ) {
+if (!isset($installer)) {
     $installer = false;
 }
 // test if galette is already installed or if we're form installer
 // and redirect to install page if not
 $installed = file_exists(GALETTE_CONFIG_PATH . 'config.inc.php');
-if ( !$installed && !$installer ) {
+if (!$installed && !$installer) {
     header('location: install/index.php');
     die();
 }
 
-if ( file_exists(GALETTE_CONFIG_PATH . 'behavior.inc.php')
+if (file_exists(GALETTE_CONFIG_PATH . 'behavior.inc.php')
     && !defined('GALETTE_TESTS') && !$cron
 ) {
     include_once GALETTE_CONFIG_PATH . 'behavior.inc.php';
 }
 
-if ( isset($installer) && $installer !== true ) {
+if (isset($installer) && $installer !== true) {
     //If we're not working from installer
     include_once GALETTE_CONFIG_PATH . 'config.inc.php';
 }
 
-if ( !function_exists('password_hash') ) {
+if (!function_exists('password_hash')) {
     include_once GALETTE_PASSWORD_COMPAT_PATH . '/password.php';
 }
 
 use Galette\Common\ClassLoader;
 use Analog\Analog;
 use Galette\Core;
-require_once GALETTE_ROOT . 'lib/Galette/Common/ClassLoader.php';
+
+/*require_once GALETTE_ROOT . 'lib/Galette/Common/ClassLoader.php';
 require_once GALETTE_SLIM_PATH . 'Slim/Slim.php';
 
 $galetteLoader = new ClassLoader('Galette', GALETTE_ROOT . 'lib');
@@ -108,7 +109,15 @@ $analogLoader->register();
 $smartyLoader->register();
 
 \Slim\Slim::registerAutoloader();
-require_once GALETTE_SLIM_VIEWS_PATH . 'Smarty.php';
+require_once GALETTE_SLIM_VIEWS_PATH . 'Smarty.php';*/
+
+// To help the built-in PHP dev server, check if the request was actually for
+// something which should probably be served as a static file
+if (PHP_SAPI === 'cli-server' && $_SERVER['SCRIPT_FILENAME'] !== __FILE__) {
+    return false;
+}
+
+require GALETTE_ROOT . '/vendor/autoload.php';
 
 //start profiling
 if (defined('GALETTE_XHPROF_PATH')
@@ -125,11 +134,11 @@ session_start();
 define('GALETTE_VERSION', 'v0.9dev');
 define('GALETTE_COMPAT_VERSION', '0.9');
 define('GALETTE_DB_VERSION', '0.820');
-if ( !defined('GALETTE_MODE') ) {
+if (!defined('GALETTE_MODE')) {
     define('GALETTE_MODE', 'PROD'); //DEV, PROD, MAINT or DEMO
 }
 
-if ( !isset($_COOKIE['show_galette_dashboard']) ) {
+if (!isset($_COOKIE['show_galette_dashboard'])) {
     setcookie(
         'show_galette_dashboard',
         true,
@@ -137,7 +146,7 @@ if ( !isset($_COOKIE['show_galette_dashboard']) ) {
     );
 }
 
-if ( !defined('GALETTE_DISPLAY_ERRORS') ) {
+if (!defined('GALETTE_DISPLAY_ERRORS')) {
     define('GALETTE_DISPLAY_ERRORS', 0);
 }
 ini_set('display_errors', GALETTE_DISPLAY_ERRORS);
@@ -152,7 +161,7 @@ set_include_path(
 /*------------------------------------------------------------------------------
 Logger stuff
 ------------------------------------------------------------------------------*/
-if ( !$cron && (!defined('GALETTE_HANDLE_ERRORS')
+if (!$cron && (!defined('GALETTE_HANDLE_ERRORS')
     || GALETTE_HANDLE_ERRORS === true)
 ) {
     //set custom error handler
@@ -169,19 +178,19 @@ $galette_null_log = \Analog\Handler\Ignore::init();
 $galette_debug_log = $galette_null_log;
 
 //Log level cannot be <= 3, would be ignored.
-if ( !defined('GALETTE_LOG_LVL') ) {
-    if ( GALETTE_MODE === 'DEV' ) {
+if (!defined('GALETTE_LOG_LVL')) {
+    if (GALETTE_MODE === 'DEV') {
         define('GALETTE_LOG_LVL', 10);
     } else {
         define('GALETTE_LOG_LVL', 5);
     }
 }
 
-if ( defined('GALETTE_TESTS') ) {
+if (defined('GALETTE_TESTS')) {
     $galette_run_log = \Analog\Handler\Ignore::init();
 
 } else {
-    if ( !$installer && !$cron ) {
+    if (!$installer && !$cron) {
         $now = new \DateTime();
         $dbg_log_path = GALETTE_LOGS_PATH . 'galette_debug_' .
             $now->format('Y-m-d')  . '.log';
@@ -190,15 +199,15 @@ if ( defined('GALETTE_TESTS') ) {
     $galette_run_log = null;
     $galette_log_var = null;
 
-    if ( GALETTE_MODE === 'DEV' || $cron
+    if (GALETTE_MODE === 'DEV' || $cron
         || ( defined('GALETTE_SYS_LOG') && GALETTE_SYS_LOG === true )
     ) {
         //logs everything in PHP logs (per chance /var/log/http/error_log)
         $galette_run_log = \Analog\Handler\Stderr::init();
     } else {
-        if ( !$installer || ($installer && defined('GALETTE_LOGGER_CHECKED')) ) {
+        if (!$installer || ($installer && defined('GALETTE_LOGGER_CHECKED'))) {
             //logs everything in galette log file
-            if ( !isset($logfile) ) {
+            if (!isset($logfile)) {
                 //if no filename has been setetd (ie. from install), set default one
                 $logfile = 'galette_run';
             }
@@ -236,7 +245,7 @@ require_once GALETTE_ROOT . 'includes/functions.inc.php';
 $session_name = null;
 //since PREFIX_DB and NAME_DB are required to properly instanciate sessions,
 // we have to check here if they're assigned
-if ( $installer || !defined('PREFIX_DB') || !defined('NAME_DB') ) {
+if ($installer || !defined('PREFIX_DB') || !defined('NAME_DB')) {
     $session_name = 'galette_install';
 } else {
     $session_name = PREFIX_DB . '_' . NAME_DB;
@@ -246,19 +255,19 @@ $session = &$_SESSION['galette'][$session_name];
 /**
  * Language instantiation
  */
-if ( isset($session['lang']) ) {
+if (isset($session['lang'])) {
     $i18n = unserialize($session['lang']);
 } else {
     $i18n = new Core\I18n();
 }
 
-if ( isset($_POST['pref_lang'])
+if (isset($_POST['pref_lang'])
     && (strpos($_SERVER['PHP_SELF'], 'self_adherent.php') !== false
     || strpos($_SERVER['PHP_SELF'], 'install/index.php') !== false)
 ) {
     $_GET['pref_lang'] = $_POST['pref_lang'];
 }
-if ( isset($_GET['pref_lang']) ) {
+if (isset($_GET['pref_lang'])) {
     $i18n->changeLanguage($_GET['pref_lang']);
 }
 $session['lang'] = serialize($i18n);
@@ -271,20 +280,20 @@ $success_detected = array();
 /**
  * "Flash" messages management
  */
-if ( isset($session['error_detected']) ) {
+if (isset($session['error_detected'])) {
     $error_detected = unserialize($session['error_detected']);
     unset($session['error_detected']);
 }
-if ( isset($session['warning_detected']) ) {
+if (isset($session['warning_detected'])) {
     $warning_detected = unserialize($session['warning_detected']);
     unset($session['warning_detected']);
 }
-if ( isset($session['success_detected']) ) {
+if (isset($session['success_detected'])) {
     $success_detected = unserialize($session['success_detected']);
     unset($session['success_detected']);
 }
 
-if ( !$installer and !defined('GALETTE_TESTS') ) {
+if (!$installer and !defined('GALETTE_TESTS')) {
     //If we're not working from installer nor from tests
     include_once GALETTE_CONFIG_PATH . 'config.inc.php';
 
@@ -293,7 +302,7 @@ if ( !$installer and !defined('GALETTE_TESTS') ) {
      */
     $zdb = new Core\Db();
 
-    if ( $zdb->checkDbVersion()
+    if ($zdb->checkDbVersion()
         || strpos($_SERVER['PHP_SELF'], 'picture.php') !== false
     ) {
 
@@ -310,14 +319,14 @@ if ( !$installer and !defined('GALETTE_TESTS') ) {
             GALETTE_TEMPLATES_PATH . $preferences->pref_theme . '/'
         );
 
-        if ( !defined('GALETTE_TPL_SUBDIR') ) {
+        if (!defined('GALETTE_TPL_SUBDIR')) {
             define(
                 'GALETTE_TPL_SUBDIR',
                 'templates/' . $preferences->pref_theme . '/'
             );
         }
 
-        if ( !defined('GALETTE_THEME') ) {
+        if (!defined('GALETTE_THEME')) {
             define(
                 'GALETTE_THEME',
                 'themes/' . $preferences->pref_theme . '/'
@@ -327,7 +336,7 @@ if ( !$installer and !defined('GALETTE_TESTS') ) {
         /**
          * Authentication
          */
-        if ( isset($session['login']) ) {
+        if (isset($session['login'])) {
             $login = unserialize(
                 $session['login']
             );
@@ -336,14 +345,14 @@ if ( !$installer and !defined('GALETTE_TESTS') ) {
             $login = new Core\Login($zdb, $i18n, $session);
         }
 
-        if ( $cron ) {
+        if ($cron) {
             $login->logCron(basename($argv[0], '.php'));
         }
 
         /**
          * Plugins
          */
-        $plugins = new Core\Plugins($preferences);
+        /*$plugins = new Core\Plugins($preferences);*/
 
         /**
          * Instanciate history object
index 610e6f017dba990f21e0453976b746638faf7be6..27e282ee5a9e6c6b06a07d35df542cb89dc17f21 100644 (file)
@@ -59,7 +59,7 @@ require_once GALETTE_ROOT . 'includes/galette.inc.php';
 
 //Galette needs database update!
 if ($needs_update) {
-    $app = new Slim(
+    $app = new \Slim\App(
         array(
             'templates.path'    => GALETTE_ROOT . 'templates/default/',
             'mode'              => 'NEED_UPDATE'
@@ -81,8 +81,8 @@ if ($needs_update) {
     $app->run();
     die();
 } else {
-    $app = new Slim(
-        array(
+    $app = new \Slim\App(
+        /*array(
             'view'              => new Smarty(
                 $plugins,
                 $i18n,
@@ -93,11 +93,43 @@ if ($needs_update) {
             ),
             'templates.path'    => GALETTE_ROOT . GALETTE_TPL_SUBDIR,
             'mode'              => GALETTE_MODE
-        )
+        )*/
+        [
+            'settings' => [
+                'determineRouteBeforeAppMiddleware' => true,
+                'displayErrorDetails' => true,
+
+                // View settings
+                /*'view' => [
+                    'template_path' => __DIR__ . '/templates',
+                    'twig' => [
+                        'cache' => __DIR__ . '/../cache/twig',
+                        'debug' => true,
+                        'auto_reload' => true,
+                    ],
+                ],*/
+
+                // monolog settings
+                'logger' => [
+                    'name' => 'app',
+                    'path' => __DIR__ . '/../log/app.log',
+                ]
+            ]
+        ]
     );
 }
 
-$app->configureMode(
+// Set up dependencies
+require GALETTE_ROOT . '/includes/dependencies.php';
+
+// Register middleware
+/*require __DIR__ . '/../app/middleware.php';
+
+// Register routes
+require __DIR__ . '/../app/routes.php';*/
+
+
+/*$app->configureMode(
     'DEV',
     function () use ($app) {
         $app->config(
@@ -106,32 +138,32 @@ $app->configureMode(
             )
         );
     }
-);
+);*/
 
-$app->configureMode(
+/*$app->configureMode(
     'MAINT',
     function () use ($app, $i18n, $login) {
         $app->add(new Galette\Core\Middleware($i18n, $login));
     }
-);
+);*/
 
 //set default conditions
-Route::setDefaultConditions(
+/*Route::setDefaultConditions(
     array(
         'id' => '\d+'
     )
-);
+);*/
 
-$smarty = $app->view()->getInstance();
+$smarty = $app->getContainer()->get('view')->getSmarty();
 require_once GALETTE_ROOT . 'includes/smarty.inc.php';
 
 /**
  * Load plugins
  */
-$plugins->setApp($app);
-$plugins->loadModules(GALETTE_PLUGINS_PATH, $i18n->getFileName());
+/*$plugins->setApp($app);
+$plugins->loadModules(GALETTE_PLUGINS_PATH, $i18n->getFileName());*/
 
-$acls = [
+/*$acls = [
     'preferences'       => 'admin',
     'store-preferences' => 'admin',
     'dashboard'         => 'groupmanager',
@@ -163,9 +195,98 @@ $acls = [
 //load user defined ACLs
 if (file_exists(GALETTE_CONFIG_PATH  . 'local_acls.inc.php')) {
     $acls = array_merge($acls, $local_acls);
-}
+}*/
+
 
-$authenticate = function () use ($zdb, $i18n, &$session, $acls, $app, $plugins) {
+$authenticate = function ($request, $response, $next) use ($container, &$session) {
+    $login = $container->login;
+
+    if (!$login->isLogged()) {
+        $session['urlRedirect'] = $request->getPathInfo();
+        $this->flash->addMessage('error', _T("Login required"));
+        return $response
+            ->withStatus(403)
+            ->withHeader('Location', $this->router->pathFor('slash'));
+    } else {
+        //check for ACLs
+        $cur_route = $request->getAttribute('route')->getName();
+
+        //ACLs for plugins
+        $acls = array_merge($container->acls, $container->plugins->getAcls());
+        if (isset($acls[$cur_route])) {
+            $acl = $acls[$cur_route];
+            $go = false;
+            switch ($acl) {
+                case 'superadmin':
+                    if ($login->isSuperAdmin()) {
+                        $go = true;
+                    }
+                    break;
+                case 'admin':
+                    if ($login->isSuperAdmin()
+                        || $login->isAdmin()
+                    ) {
+                        $go = true;
+                    }
+                    break;
+                case 'staff':
+                    if ($login->isSuperAdmin()
+                        || $login->isAdmin()
+                        || $login->isStaff()
+                    ) {
+                        $go = true;
+                    }
+                    break;
+                case 'groupmanager':
+                    if ($login->isSuperAdmin()
+                        || $login->isAdmin()
+                        || $login->isStaff()
+                        || $login->isGroupManager()
+                    ) {
+                        $go = true;
+                    }
+                    break;
+                case 'member':
+                    if ($login->isLogged()) {
+                        $go = true;
+                    }
+                    break;
+                default:
+                    throw new \RuntimeException(
+                        str_replace(
+                            '%acl',
+                            $acl,
+                            _T("Unknown ACL rule '%acl'!")
+                        )
+                    );
+                    break;
+            }
+            if (!$go) {
+                $this->flash->addMessage(
+                    'error_detected',
+                    [
+                        _T("You do not have permission for requested URL.")
+                    ]
+                );
+                return $response
+                    ->withStatus(403)
+                    ->withHeader('Location', $this->router->pathFor('slash'));
+            }
+        } else {
+            throw new \RuntimeException(
+                str_replace(
+                    '%name',
+                    $cur_route,
+                    _T("Route '%name' is not registered in ACLs!")
+                )
+            );
+        }
+    }
+
+    return $next($request, $response);
+};
+
+/*$authenticate = function () use ($zdb, $i18n, &$session, $acls, $app, $plugins) {
     return function () use ($app, $zdb, &$session, $acls, $plugins, $i18n) {
         $app->flashKeep();
         if (isset($session['login'])) {
@@ -176,8 +297,8 @@ $authenticate = function () use ($zdb, $i18n, &$session, $acls, $app, $plugins)
         }
         if (!$login->isLogged()) {
             $session['urlRedirect'] = $app->request()->getPathInfo();
-            $app->flash('error', _T("Login required"));
-            $app->redirect($app->urlFor('slash'), 403);
+            $this->flash->addMessage('error', _T("Login required"));
+            $app->redirect($app->pathFor('slash'), 403);
         } else {
             //check for ACLs
             $cur_route = getCurrentRoute($app);
@@ -232,13 +353,13 @@ $authenticate = function () use ($zdb, $i18n, &$session, $acls, $app, $plugins)
                         break;
                 }
                 if (!$go) {
-                    $app->flash(
+                    $this->flash->addMessage(
                         'error_detected',
                         [
                             _T("You do not have permission for requested URL.")
                         ]
                     );
-                    $app->redirect($app->urlFor('slash'), 403);
+                    $app->redirect($app->pathFor('slash'), 403);
                 }
             } else {
                 throw new \RuntimeException(
@@ -251,44 +372,58 @@ $authenticate = function () use ($zdb, $i18n, &$session, $acls, $app, $plugins)
             }
         }
     };
-};
+};*/
 
 //dependency injection
 $app->zdb           = $zdb;
 $app->i18n          = $i18n;
-$app->plugins       = $plugins;
+//$app->plugins       = $plugins;
 $app->preferences   = $preferences;
 $app->login         = $login;
 
-$baseRedirect = function ($app) use ($login, &$session) {
-    $app->flashKeep();
-    if ( $login->isLogged() ) {
+$baseRedirect = function ($request, $response, $args = []) use ($app, $container, &$session) {
+    $login = $container->get('login');
+    $router = $container->get('router');
+
+    //$app->flashKeep();
+    if ($login->isLogged()) {
         $urlRedirect = null;
         if (isset($session['urlRedirect'])) {
             $urlRedirect = $app->request()->getRootUri() . $session['urlRedirect'];
             unset($session['urlRedirect']);
         }
 
-        if ( $urlRedirect !== null ) {
-            $app->redirect($urlRedirect);
+        if ($urlRedirect !== null) {
+            return $response
+                ->withStatus(301)
+                ->withHeader('Location', $urlRedirect);
         } else {
-            if ( $login->isSuperAdmin()
+            if ($login->isSuperAdmin()
                 || $login->isAdmin()
                 || $login->isStaff()
             ) {
-                if ( !isset($_COOKIE['show_galette_dashboard'])
+                if (!isset($_COOKIE['show_galette_dashboard'])
                     || $_COOKIE['show_galette_dashboard'] == 1
                 ) {
-                    $app->redirect($app->urlFor('dashboard'));
+
+                    return $response
+                        ->withStatus(301)
+                        ->withHeader('Location', $router->pathFor('dashboard'));
                 } else {
-                    $app->redirect($app->urlFor('members'));
+                    return $response
+                        ->withStatus(301)
+                        ->withHeader('Location', $router->pathFor('members'));
                 }
             } else {
-                $app->redirect($app->urlFor('me'));
+                return $response
+                    ->withStatus(301)
+                    ->withHeader('Location', $router->pathFor('me'));
             }
         }
     } else {
-        $app->redirect($app->urlFor('login'));
+        return $response
+            ->withStatus(301)
+            ->withHeader('Location', $router->pathFor('login'));
     }
 };
 
@@ -333,7 +468,73 @@ function getCurrentRoute($app)
     return $cur_route;
 }
 
-$app->hook(
+$app->add(function ($request, $response, $next) {
+    $route = $request->getAttribute('route');
+    /*$name = $route->getName();
+    $group = $route->getGroup();
+    $methods = $route->getMethods();
+    $arguments = $route->getArguments();*/
+
+    /*var_dump($this->get('router')->getRoutes());
+    throw new \RuntimeException('STOP');*/
+    /*if ($request->getAttribute('route')->getArgument('auth', true)) {
+        $response->write('Authed: ');
+    }*/
+    return $next($request, $response);
+});
+
+/**
+ * This is important this one to be the last, so it'll be executed first.
+ */
+$app->add(function ($request, $response, $next) {
+    $route = $request->getAttribute('route');
+
+    //$this->view->getSmarty()->assign('cur_route', $route->getName());
+    $this->view->getSmarty()->assign('cur_route', 'dashboard');
+
+    $acls = array_merge($this->get('acls'), $this->get('plugins')->getAcls());
+
+    if (GALETTE_MODE === 'DEV') {
+        //check for routes that are not in ACLs
+        $routes = $this->get('router')->getRoutes();
+
+        $missing_acls = [];
+        $excluded_names = [
+            'public_members',
+            'public_trombinoscope'
+        ];
+        foreach ($routes as $route) {
+            $name = $route->getName();
+            //check if route has $authenticate middleware
+            $middlewares = $route->getMiddleware();
+            if (count($middlewares) > 0) {
+                foreach ($middlewares as $middleware) {
+                    if (!in_array($name, array_keys($acls))
+                        && !in_array($name, $excluded_names)
+                        && !in_array($name, $missing_acls)
+                    ) {
+                        $missing_acls[] = $name;
+                    }
+                }
+            }
+        }
+        if (count($missing_acls) > 0) {
+            $msg = str_replace(
+                '%routes',
+                implode(', ', $missing_acls),
+                _T("Routes '%routes' are missing in ACLs!")
+            );
+            Analog::log($msg, Analog::ERROR);
+            //FIXME: with flash(), message is only shown on the seconde round,
+            //with flashNow(), thas just does not work :(
+            $this->flash->addMessage('error_detected', [$msg]);
+        }
+    }
+
+    return $next($request, $response);
+});
+
+/*$app->hook(
     'slim.before.dispatch',
     function () use ($app, $error_detected, $warning_detected, $success_detected,
         $authenticate, $acls, $plugins
@@ -370,7 +571,7 @@ $app->hook(
                 Analog::log($msg, Analog::ERROR);
                 //FIXME: with flash(), message is only shown on the seconde round,
                 //with flashNow(), thas just does not work :(
-                $app->flash('error_detected', [$msg]);
+                $this->flash->addMessage('error_detected', [$msg]);
             }
         }
 
@@ -409,7 +610,7 @@ $app->hook(
             $v->setData('success_detected', $success_detected);
         }
     }
-);
+);*/
 
 require_once GALETTE_ROOT . 'includes/routes/main.routes.php';
 require_once GALETTE_ROOT . 'includes/routes/authentication.routes.php';
@@ -423,7 +624,7 @@ require_once GALETTE_ROOT . 'includes/routes/plugins.routes.php';
 
 //custom error handler
 //will not be used if mode is DEV.
-$app->error(
+/*$app->error(
     function (\Exception $e) use ($app) {
         //ensure error is logged
         $etype = get_class($e);
@@ -443,10 +644,10 @@ $app->error(
             )
         );
     }
-);
+);*/
 
 //custom 404 handler
-$app->notFound(
+/*$app->notFound(
     function () use ($app) {
         $app->render(
             '404.tpl',
@@ -457,10 +658,10 @@ $app->notFound(
             )
         );
     }
-);
+);*/
 
 $app->run();
 
-if ( isset($profiler) ) {
+if (isset($profiler)) {
     $profiler->stop();
 }
index 4e4c0db2be1f346647e3c3adc47505e3fc604dd7..6d774fa24000ee7b0858ba70e5663189f8e69707 100644 (file)
@@ -40,110 +40,118 @@ use Galette\Core\GaletteMail;
 //login page
 $app->get(
     '/login',
-    function () use ($app, $login, $baseRedirect, &$session) {
+    function ($request, $response, $args = []) use ($baseRedirect) {
         //store redirect path if any
-        if ($app->request()->get('r')
-            && $app->request()->get('r') != '/logout'
-            && $app->request()->get('r') != '/login'
+        if (isset($args['r'])
+            && $args['r'] != '/logout'
+            && $args['r'] != '/login'
         ) {
-            $session['urlRedirect'] = $app->request()->get('r');
+            $this->session['urlRedirect'] = $args['r'];
         }
 
-        if ( !$login->isLogged() ) {
+        if (!$this->login->isLogged()) {
             // display page
-            $app->render(
+            $this->view->render(
+                $response,
                 'index.tpl',
                 array(
                     'page_title'    => _T("Login"),
                 )
             );
+            return $response;
         } else {
-            $baseRedirect($app);
+            return $baseRedirect($request, $response, $args);
         }
     }
-)->name('login');
+)->setName('login');
 
 //Authentication procedure
 $app->post(
     '/login',
-    function () use ($app, &$session, $hist, $preferences, $login, $baseRedirect) {
-        $nick = $app->request()->post('login');
-        $password = $app->request()->post('password');
+    function ($request, $response) use ($app, $baseRedirect) {
+        $nick = $request->getParsedBody()['login'];
+        $password = $request->getParsedBody()['password'];
 
-        if ( trim($nick) == '' || trim($password) == '' ) {
-            $app->flash(
+        if (trim($nick) == '' || trim($password) == '') {
+            $this->flash->addMessage(
                 'loginfault',
                 _T("You must provide both login and password.")
             );
-            $app->redirect($app->urlFor('login'));
+            return $response
+                ->withStatus(301)
+                ->withHeader('Location', $this->router->pathFor('login'));
         }
 
-        if ( $nick === $preferences->pref_admin_login ) {
+        if ($nick === $this->preferences->pref_admin_login) {
             $pw_superadmin = password_verify(
                 $password,
-                $preferences->pref_admin_pass
+                $this->preferences->pref_admin_pass
             );
-            if ( !$pw_superadmin ) {
+            if (!$pw_superadmin) {
                 $pw_superadmin = (
-                    md5($password) === $preferences->pref_admin_pass
+                    md5($password) === $this->preferences->pref_admin_pass
                 );
             }
-            if ( $pw_superadmin ) {
-                $login->logAdmin($nick, $preferences);
+            if ($pw_superadmin) {
+                $this->login->logAdmin($nick, $this->preferences);
             }
         } else {
-            $login->logIn($nick, $password);
+            $this->login->logIn($nick, $password);
         }
 
-        if ( $login->isLogged() ) {
-            $session['login'] = serialize($login);
-            $hist->add(_T("Login"));
-            $baseRedirect($app);
+        if ($this->login->isLogged()) {
+            $this->session['login'] = serialize($this->login);
+            $this->history->add(_T("Login"));
+            return $baseRedirect($request, $response, $args);
         } else {
-            $app->flash('loginfault', _T("Login failed."));
-            $hist->add(_T("Authentication failed"), $nick);
-            $app->redirect($app->urlFor('login'));
+            $this->flash->addMessage('loginfault', _T("Login failed."));
+            $this->history->add(_T("Authentication failed"), $nick);
+            return $response->withStatus(301)->withHeader('Location', $this->router->pathFor('login'));
         }
     }
-)->name('dologin');
+)->setName('dologin');
 
 //logout procedure
 $app->get(
     '/logout',
-    function () use ($app, $login, &$session) {
-        $login->logOut();
+    function ($request, $response) use ($app, $login, &$session) {
+        $this->login->logOut();
         $session['login'] = null;
-        unset($session['login']);
-        $session['history'] = null;
-        unset($session['history']);
-        $app->redirect($app->urlFor('slash'));
+        unset($this->session['login']);
+        return $response
+            ->withStatus(301)
+            ->withHeader('Location', $this->router->pathFor('slash'));
     }
-)->name('logout');
+)->setName('logout');
 
 //password lost page
 $app->get(
     '/password-lost',
-    function () use ($app) {
-        $app->render(
+    function ($request, $response) {
+        // display page
+        $this->view->render(
+            $response,
             'lostpasswd.tpl',
             array(
-                'page_title' => _T("Password recovery")
+                'page_title'    => _T("Password recovery")
             )
         );
+        return $response;
     }
-)->name('password-lost');
+)->setName('password-lost');
 
 //retrieve password procedure
 $app->post(
     '/retrieve-pass',
-    function () use ($app, $login, $preferences) {
-        if ( ($login->isLogged()
-            || $preferences->pref_mail_method == GaletteMail::METHOD_DISABLED)
+    function ($request, $response) {
+        if (($this->login->isLogged()
+            || $this->preferences->pref_mail_method == GaletteMail::METHOD_DISABLED)
             && !$from_admin
         ) {
-            $app->redirect($app->urlFor('slash'));
+            return $response
+                ->withStatus(301)
+                ->withHeader('Location', $this->router->pathFor('slash'));
         }
-        $app->redirect($app->urlFor('slash'));
+        $app->redirect($app->pathFor('slash'));
     }
-)->name('retrieve-pass');
-
+)->setName('retrieve-pass');
index 8fd698690ddaa29d9e2433da303523ea6eac18e8..8694be8d9bdb8602b196b0ab58ba8794f4ca4cb6 100644 (file)
@@ -40,7 +40,7 @@ use Galette\Repository\Contributions;
 
 $app->get(
     '/contributions(/:id)(/:option/:value)',
-    $authenticate(),
+    $authenticate,
     function ($id = null, $option = null, $value = null) use ($app, $login, &$session) {
         if (isset($session['contributions'])) {
             $contribs = unserialize($session['contributions']);
@@ -121,18 +121,18 @@ $app->get(
             )
         );
     }
-)->name(
+)->setName(
     'contributions'
-)->conditions(
+)/*->conditions(
     array(
         'option'    => '(page|order)',
         'value'     => '\d+'
     )
-);
+)*/;
 
 $app->get(
     '/transactions',
-    $authenticate(),
+    $authenticate,
     function () use ($app, $login, &$session) {
         if (!$login->isAdmin() && !$login->isStaff()) {
             $id_adh = $login->id;
@@ -220,11 +220,11 @@ $app->get(
         );
 
     }
-)->name('transactions');
+)->setName('transactions');
 
 $app->post(
     '/:type/filter',
-    $authenticate(),
+    $authenticate,
     function ($type) use ($app, $login, &$session) {
         $request = $app->request();
 
@@ -311,14 +311,14 @@ $app->post(
 
         $session[$type] = serialize($contribs);
 
-        $app->redirect(
-            $app->urlFor($type)
-        );
+        return $response
+            ->withStatus(301)
+            ->withHeader('Location', $this->router->pathFor($type));
     }
-)->name(
+)->setName(
     'payments_filter'
-)->conditions(
+)/*->conditions(
     array(
         'type' => '(contributions|transactions)',
     )
-);
+)*/;
index f18dc1a6ff8deec6a5cec15704eaa3ff6b33e975..fb639321b12d04e9569fb901fb68250057d393ff 100644 (file)
@@ -40,7 +40,7 @@ use Galette\Repository\Groups;
 
 $app->get(
     '/groups',
-    $authenticate(),
+    $authenticate,
     function () use ($app, $login, &$session) {
 
         $groups = new Groups();
@@ -76,5 +76,5 @@ $app->get(
             )
         );
     }
-)->name('groups');
+)->setName('groups');
 
index 76a5019d1243e864bdb73b6aa1e668dbbad0d66e..820d8226d806befd8a263f68b8ddb276f3258450 100644 (file)
@@ -42,23 +42,24 @@ use Galette\Entity\Adherent;
 //main route
 $app->get(
     '/',
-    function () use ($app, $baseRedirect) {
-        $baseRedirect($app);
+    function ($request, $response, $args) use ($baseRedirect) {
+        return $baseRedirect($request, $response, $args);
     }
-)->name('slash');
+)->setName('slash');
 
 //logo route
 $app->get(
     '/logo',
-    function () use ($logo) {
-        $logo->display();
+    function ($request, $response, $args) {
+        $this->logo->display();
     }
-)->name('logo');
+)->setName('logo');
 
 //photo route
 $app->get(
-    '/photo/:id',
-    function ($id) use ($app, $login) {
+    '/photo/{id:\d+}',
+    function ($request, $response, $args) {
+        $id = $args['id'];
         /** FIXME: we load entire member here... No need to do so! */
         $deps = array(
             'groups'    => false,
@@ -67,10 +68,10 @@ $app->get(
         $adh = new Adherent((int)$id, $deps);
 
         $picture = null;
-        if ( $login->isAdmin()
-            || $login->isStaff()
+        if ($this->login->isAdmin()
+            || $this->login->isStaff()
             || $adh->appearsInMembersList()
-            || $login->login == $adh->login
+            || $this->login->login == $adh->login
         ) {
             $picture = $adh->picture;
         } else {
@@ -78,43 +79,45 @@ $app->get(
         }
         $picture->display();
     }
-)->name('photo');
+)->setName('photo');
 
 //system informations
 $app->get(
     '/sysinfos',
-    $authenticate(),
-    function () use ($app) {
+    function ($request, $response, $args = []) {
         $sysinfos = new SysInfos();
         $sysinfos->grab();
 
-        $app->render(
+        // display page
+        $this->view->render(
+            $response,
             'sysinfos.tpl',
             array(
                 'page_title'    => _T("System informations"),
-                'rawinfos'      => $sysinfos->getRawData()
+                'rawinfos'      => $sysinfos->getRawData($this->plugins)
             )
         );
+        return $response;
     }
-)->name('sysinfos');
+)->setName('sysinfos')->add($authenticate);
 
 //impersonating
 $app->get(
-    '/impersonate/:id',
-    $authenticate(),
-    function ($id) use ($app, $login, &$session, $hist) {
+    '/impersonate/{id:\d+}',
+    function ($request, $response, $args) {
         $success = $login->impersonate($id);
 
         if ($success === true) {
-            $session['login'] = serialize($login);
+            $this->session['login'] = serialize($login);
+            $this->login = $login;
             $msg = str_replace(
                 '%login',
                 $login->login,
                 _T("Impersonating as %login")
             );
 
-            $hist->add($msg);
-            $app->flash(
+            $this->history->add($msg);
+            $this->flash->addMessage(
                 'success_detected',
                 [$msg]
             );
@@ -124,29 +127,33 @@ $app->get(
                 $id,
                 _T("Unable to impersonate as %id")
             );
-            $app->flash(
+            $this->flash->addMessage(
                 'error_detected',
                 [$msg]
             );
-            $hist->add($msg);
+            $this->history->add($msg);
         }
 
-        $app->redirect($app->urlFor('slash'));
+        return $response
+            ->withStatus(301)
+            ->withHeader('Location', $this->router->pathFor('slash'));
     }
-)->name('impersonate');
+)->setName('impersonate')->add($authenticate);
 
 $app->get(
     '/unimpersonate',
-    $authenticate(),
-    function () use ($app, $zdb, $i18n, $login, &$session, $preferences, $hist) {
-        $login = new \Galette\Core\Login($zdb, $i18n, $session);
-        $login->logAdmin($preferences->pref_admin_login, $preferences);
-        $hist->add(_T("Impersonating ended"));
-        $session['login'] = serialize($login);
-        $app->flash(
+    function ($request, $response, $args) {
+        $login = new \Galette\Core\Login($this->zdb, $this->i18n, $this->session);
+        $login->logAdmin($this->preferences->pref_admin_login, $this->preferences);
+        $this->history->add(_T("Impersonating ended"));
+        $this->session['login'] = serialize($login);
+        $this->login = $login;
+        $this->flash->addMessage(
             'success_detected',
             [_T("Impersonating ended")]
         );
-        $app->redirect($app->urlFor('slash'));
+        return $response
+            ->withStatus(301)
+            ->withHeader('Location', $this->router->pathFor('slash'));
     }
-)->name('unimpersonate');
+)->setName('unimpersonate')->add($authenticate);
index eeb49a1dd9103b33d508624d05b8482e3ba265a0..851ca1e096012bd9e9f46735c50108503ea82ee0 100644 (file)
@@ -49,11 +49,12 @@ use \Analog\Analog;
 //galette's dashboard
 $app->get(
     '/dashboard',
-    $authenticate(),
-    function () use ($app, $preferences) {
-        $news = new News($preferences->pref_rss_url);
+    function ($request, $response, $args = []) {
+        $news = new News($this->preferences->pref_rss_url);
 
-        $app->render(
+        // display page
+        $this->view->render(
+            $response,
             'desktop.tpl',
             array(
                 'page_title'        => _T("Dashboard"),
@@ -63,15 +64,14 @@ $app->get(
                 'require_cookie'    => true
             )
         );
+        return $response;
     }
-)->name('dashboard');
+)->setName('dashboard')->add($authenticate);
 
 //preferences page
 $app->get(
     '/preferences',
-    $authenticate(),
-    function () use ($app, $login, $preferences, $i18n, &$session) {
-
+    function ($request, $response) {
         $print_logo = new PrintLogo();
 
         // flagging required fields
@@ -97,21 +97,21 @@ $app->get(
             'pref_card_vspace'      => 1
         );
 
-        if ( $login->isSuperAdmin() && GALETTE_MODE !== 'DEMO' ) {
+        if ($this->login->isSuperAdmin() && GALETTE_MODE !== 'DEMO') {
             $required['pref_admin_login'] = 1;
         }
 
-        $prefs_fields = $preferences->getFieldsNames();
+        $prefs_fields = $this->preferences->getFieldsNames();
 
         // collect data
-        foreach ( $prefs_fields as $fieldname ) {
-            $pref[$fieldname] = $preferences->$fieldname;
+        foreach ($prefs_fields as $fieldname) {
+            $pref[$fieldname] = $this->preferences->$fieldname;
         }
 
         //List available themes
         $themes = array();
         $d = dir(GALETTE_TEMPLATES_PATH);
-        while ( ($entry = $d->read()) !== false ) {
+        while (($entry = $d->read()) !== false) {
             $full_entry = GALETTE_TEMPLATES_PATH . $entry;
             if ($entry != '.'
                 && $entry != '..'
@@ -125,7 +125,9 @@ $app->get(
 
         $m = new Members();
 
-        $app->render(
+        // display page
+        $this->view->render(
+            $response,
             'preferences.tpl',
             array(
                 'page_title'            => _T("Settings"),
@@ -140,29 +142,26 @@ $app->get(
                 ),
                 'print_logo'            => $print_logo,
                 'required'              => $required,
-                'languages'             => $i18n->getList(),
+                'languages'             => $this->i18n->getList(),
                 'themes'                => $themes,
-                /*'error_detected'        => $error_detected,
-                'warning_detected'      => $warning_detected,
-                'success_detected'      => $success_detected,*/
                 'require_tabs'          => true,
                 'color_picker'          => true,
             )
         );
+        return $response;
     }
-)->name('preferences');
+)->setName('preferences')->add($authenticate);
 
 //preferences procedure
 $app->post(
     '/preferences',
-    $authenticate(),
-    function () use ($app, $preferences, $login, $logo, &$session) {
+    function ($request, $response) use ($app, &$session) {
         // Validation
-        if ( isset($_POST['valid']) && $_POST['valid'] == '1' ) {
+        if (isset($_POST['valid']) && $_POST['valid'] == '1') {
             // verification de champs
             $insert_values = array();
 
-            $prefs_fields = $preferences->getFieldsNames();
+            $prefs_fields = $this->preferences->getFieldsNames();
 
             // flagging required fields
             $required = array(
@@ -187,7 +186,7 @@ $app->post(
                 'pref_card_vspace'      => 1
             );
 
-            if ( $login->isSuperAdmin() && GALETTE_MODE !== 'DEMO' ) {
+            if ($this->login->isSuperAdmin() && GALETTE_MODE !== 'DEMO') {
                 $required['pref_admin_login'] = 1;
             }
 
@@ -228,7 +227,7 @@ $app->post(
                                 $error_detected[] = _T("- The username must be composed of at least 4 characters!");
                             } else {
                                 //check if login is already taken
-                                if ( $login->loginExists($value) ) {
+                                if ($this->login->loginExists($value)) {
                                     $error_detected[] = _T("- This username is already used by another member !");
                                 }
                             }
@@ -394,55 +393,55 @@ $app->post(
             if ( count($error_detected) == 0 ) {
                 // update preferences
                 while ( list($champ,$valeur) = each($insert_values) ) {
-                    if ( $login->isSuperAdmin()
-                        || (!$login->isSuperAdmin()
+                    if ($this->login->isSuperAdmin()
+                        || (!$this->login->isSuperAdmin()
                         && ($champ != 'pref_admin_pass' && $champ != 'pref_admin_login'))
                     ) {
                         if ( ($champ == "pref_admin_pass" && $_POST['pref_admin_pass'] !=  '')
                             || ($champ != "pref_admin_pass")
                         ) {
-                            $preferences->$champ = $valeur;
+                            $this->preferences->$champ = $valeur;
                         }
                     }
                 }
                 //once all values has been updated, we can store them
-                if ( !$preferences->store() ) {
+                if (!$this->preferences->store()) {
                     $error_detected[] = _T("An SQL error has occured while storing preferences. Please try again, and contact the administrator if the problem persists.");
                 } else {
                     $success_detected[] = _T("Preferences has been saved.");
                 }
 
                 // picture upload
-                if ( GALETTE_MODE !== 'DEMO' &&  isset($_FILES['logo']) ) {
-                    if ( $_FILES['logo']['error'] === UPLOAD_ERR_OK ) {
-                        if ( $_FILES['logo']['tmp_name'] !='' ) {
-                            if ( is_uploaded_file($_FILES['logo']['tmp_name']) ) {
-                                $res = $logo->store($_FILES['logo']);
-                                if ( $res < 0 ) {
-                                    $error_detected[] = $logo->getErrorMessage($res);
+                if (GALETTE_MODE !== 'DEMO' &&  isset($_FILES['logo'])) {
+                    if ($_FILES['logo']['error'] === UPLOAD_ERR_OK) {
+                        if ($_FILES['logo']['tmp_name'] !='') {
+                            if (is_uploaded_file($_FILES['logo']['tmp_name'])) {
+                                $res = $this->logo->store($_FILES['logo']);
+                                if ($res < 0) {
+                                    $error_detected[] = $this->logo->getErrorMessage($res);
                                 } else {
-                                    $logo = new Logo();
+                                    $this->logo = new Logo();
                                 }
-                                $session['logo'] = serialize($logo);
+                                $this->session['logo'] = serialize($this->logo);
                             }
                         }
-                    } else if ($_FILES['logo']['error'] !== UPLOAD_ERR_NO_FILE) {
+                    } elseif ($_FILES['logo']['error'] !== UPLOAD_ERR_NO_FILE) {
                         Analog::log(
-                            $logo->getPhpErrorMessage($_FILES['logo']['error']),
+                            $this->logo->getPhpErrorMessage($_FILES['logo']['error']),
                             Analog::WARNING
                         );
-                        $error_detected[] = $logo->getPhpErrorMessage(
+                        $error_detected[] = $this->logo->getPhpErrorMessage(
                             $_FILES['logo']['error']
                         );
                     }
                 }
 
-                if ( GALETTE_MODE !== 'DEMO' && isset($_POST['del_logo']) ) {
-                    if ( !$logo->delete() ) {
+                if (GALETTE_MODE !== 'DEMO' && isset($_POST['del_logo'])) {
+                    if (!$this->logo->delete()) {
                         $error_detected[] = _T("Delete failed");
                     } else {
-                        $logo = new Logo(); //get default Logo
-                        $session['logo'] = serialize($logo);
+                        $this->logo = new Logo(); //get default Logo
+                        $this->session['logo'] = serialize($this->logo);
                     }
                 }
 
@@ -480,28 +479,30 @@ $app->post(
             }
 
             if ( count($error_detected) > 0 ) {
-                $app->flash(
+                $this->flash->addMessage(
                     'error_detected',
                     $error_detected
                 );
             }
 
             if ( count($success_detected) > 0 ) {
-                $app->flash(
+                $this->flash->addMessage(
                     'success_detected',
                     $success_detected
                 );
             }
 
-            $app->redirect($app->urlFor('preferences'));
+
+            return $response
+                ->withStatus(301)
+                ->withHeader('Location', $this->router->pathFor('preferences'));
         }
     }
-)->name('store-preferences');
+)->setName('store-preferences')->add($authenticate);
 
 //charts
 $app->get(
     '/charts',
-    $authenticate(),
     function () use ($app) {
         $charts = new Charts(
             array(
@@ -522,13 +523,13 @@ $app->get(
             )
         );
     }
-)->name('charts');
+)->setName('charts')->add($authenticate);
 
 //plugins
 $app->get(
     '/plugins',
-    $authenticate(),
-    function () use ($app, $plugins) {
+    function () use ($app) {
+        $plugins = $this->get('plugins');
         if ( GALETTE_MODE !== 'DEMO' ) {
             $reload_plugins = false;
             if ( isset($_GET['activate']) ) {
@@ -578,38 +579,35 @@ $app->get(
             )
         );
     }
-)->name('plugins');
+)->setName('plugins')->add($authenticate);
 
 //galette logs
 $app->get(
-    '/logs(/:option/:value)',
-    $authenticate(),
+    '/logs[/{option:page|order|reset}/{value}]',
     function ($option = null, $value = null) use ($app, $hist) {
-        if ( $option !== null ) {
-            switch ( $option ) {
-            case 'page':
-                $hist->current_page = (int)$value;
-                break;
-            case 'order':
-                $hist->tri = $value;
-                break;
-            case 'reset':
-                $hist->clean();
-                //reinitialize object after flush
-                $hist = new History();
-                break;
+        if ($option !== null) {
+            switch ($option) {
+                case 'page':
+                    $hist->current_page = (int)$value;
+                    break;
+                case 'order':
+                    $hist->tri = $value;
+                    break;
+                case 'reset':
+                    $hist->clean();
+                    //reinitialize object after flush
+                    $hist = new History();
+                    break;
             }
         }
 
-        if ( $app->request()->get('nbshow') !== null ) {
+        if ($app->request()->get('nbshow') !== null) {
             $hist->show = $app->request()->get('nbshow');
         }
 
         $logs = array();
 
         $logs = $hist->getHistory();
-        $session['history'] = serialize($hist);
-
         $view = $app->view();
 
         //assign pagination variables to the template and add pagination links
@@ -625,18 +623,17 @@ $app->get(
             )
         );
     }
-)->name(
+)->setName(
     'history'
-)->conditions(
+)->add($authenticate)/*->conditions(
     array(
         'option'    => '(page|order|reset)'
     )
-);
+)*/;
 
 //mailings management
 $app->get(
     '/mailings(/:option/:value)',
-    $authenticate(),
     function ($option = null, $value = null) use ($app) {
         $request = $app->request();
 
@@ -697,10 +694,10 @@ $app->get(
             )
         );
     }
-)->name(
+)->setName(
     'mailings'
-)->conditions(
+)->add($authenticate)/*->conditions(
     array(
         'option'    => '(page|order)'
     )
-);
+)*/;
index 36ddfac5abbb899593f1c262317f4ec65f8fb5f9..8e9194bf37f27a8443dbde2b84bea58a91765221 100644 (file)
@@ -61,7 +61,10 @@ $app->get(
         $members_fields, $members_fields_cats
     ) {
         if ( !$preferences->pref_bool_selfsubscribe || $login->isLogged() ) {
-            $app->redirect($app->urlFor('slash'));
+
+            return $response
+                ->withStatus(301)
+                ->withHeader('Location', $this->router->pathFor('slash'));
         }
 
         $dyn_fields = new DynamicFields();
@@ -138,12 +141,12 @@ $app->get(
         );
 
     }
-)->name('subscribe');
+)->setName('subscribe');
 
 //members list
 $app->get(
     '/members(/:option/:value)',
-    $authenticate(),
+    $authenticate,
     function ($option = null, $value = null) use (
         $app, $login, &$session, $preferences
     ) {
@@ -198,19 +201,19 @@ $app->get(
             )
         );
     }
-)->name(
+)->setName(
     'members'
-)->conditions(
+)/*->conditions(
     array(
         'option'    => '(page|order)',
         'value'     => '\d+'
     )
-);
+)*/;
 
 //members list filtering
 $app->post(
     '/members/filter',
-    $authenticate(),
+    $authenticate,
     function ($from = 'members') use ($app, &$session) {
         $request = $app->request();
 
@@ -231,13 +234,15 @@ $app->post(
         } else if ( $request->post('clear_adv_filter') ) {
             $session['filters']['members'] = null;
             unset($session['filters']['members']);
-            $app->redirect(
-                $app->urlFor('advanced-search')
-            );
+
+            return $response
+                ->withStatus(301)
+                ->withHeader('Location', $this->router->pathFor('advanced-search'));
         } else if ( $request->post('adv_criterias') ) {
-            $app->redirect(
-                $app->urlFor('advanced-search')
-            );
+
+            return $response
+                ->withStatus(301)
+                ->withHeader('Location', $this->router->pathFor('advanced-search'));
         } else {
             //string to filter
             if ( $request->post('filter_str') !== null ) { //filter search string
@@ -343,21 +348,22 @@ $app->post(
 
         $session['filters']['members'] = serialize($filters);
 
-        $app->redirect(
-            $app->urlFor($from)
-        );
+        return $response
+            ->withStatus(301)
+            ->withHeader('Location', $this->router->pathFor($from));
     }
-)->name('filter-memberslist');
+)->setName('filter-memberslist');
 
 //members self card
 $app->get(
     '/member/me',
-    $authenticate(),
+    $authenticate,
     function () use ($app, $login) {
         if ($login->isSuperAdmin()) {
-            $app->redirect(
-                $app->urlFor('slash')
-            );
+
+            return $response
+                ->withStatus(301)
+                ->withHeader('Location', $this->router->pathFor('slash'));
         }
         $deps = array(
             'picture'   => false,
@@ -365,16 +371,17 @@ $app->get(
             'dues'      => false
         );
         $member = new Adherent($login->login, $deps);
-        $app->redirect(
-            $app->urlFor('member', ['id' => $member->id])
-        );
+
+        return $response
+            ->withStatus(301)
+            ->withHeader('Location', $this->router->pathFor('member'), ['id' => $member->id]);
     }
-)->name('me');
+)->setName('me');
 
 //members card
 $app->get(
     '/member/:id',
-    $authenticate(),
+    $authenticate,
     function ($id) use ($app, $login, $session, $i18n, $preferences,
         $members_fields, $members_fields_cats
     ) {
@@ -490,11 +497,11 @@ $app->get(
         );
 
     }
-)->name('member');
+)->setName('member');
 
 $app->get(
     '/member/:action(/:id)',
-    $authenticate(),
+    $authenticate,
     function (
         $action,
         $id = null
@@ -706,17 +713,17 @@ $app->get(
         );
 
     }
-)->name(
+)->setName(
     'editmember'
-)->conditions(
+)/*->conditions(
     array(
         'action' => '(edit|add)',
     )
-);
+)*/;
 
 $app->post(
     '/member/store',
-    $authenticate(),
+    $authenticate,
     function () use (
         $app,
         $login,
@@ -873,7 +880,7 @@ $app->post(
                                         $member->surname
                                     ),
                                     'lastname_adh'  => custom_html_entity_decode(
-                                        $member->name
+                                        $member->setName
                                     ),
                                     'mail_adh'      => custom_html_entity_decode(
                                         $member->email
@@ -937,7 +944,7 @@ $app->post(
                                             $member->surname
                                         ),
                                         'lastname_adh'  => custom_html_entity_decode(
-                                            $member->name
+                                            $member->setName
                                         ),
                                         'mail_adh'      => custom_html_entity_decode(
                                             $member->email
@@ -1078,13 +1085,13 @@ $app->post(
             if ( count($error_detected) == 0 ) {
                 $session['account_success'] = serialize($success_detected);
                 if (count($warning_detected) > 0) {
-                    $app->flash(
+                    $this->flash->addMessage(
                         'warning_detected',
                         $warning_detected
                     );
                 }
                 if (count($success_detected) > 0) {
-                    $app->flash(
+                    $this->flash->addMessage(
                         'success_detected',
                         $success_detected
                     );
@@ -1096,29 +1103,25 @@ $app->post(
                     );
                     die();
                 } elseif ( count($error_detected) == 0 ) {
-                    $app->redirect(
-                        $app->urlFor(
-                            'member',
-                            array(
-                                'id' => $member->id
-                            )
-                        )
-                    );
+
+                    return $response
+                        ->withStatus(301)
+                        ->withHeader('Location', $this->router->pathFor('member', ['id' => $member->id]));
                 }
             } else {
-                $app->flash(
+                $this->flash->addMessage(
                     'error_detected',
                     $error_detected
                 );
             }
         }
     }
-)->name('storemembers');
+)->setName('storemembers');
 
 //advanced search page
 $app->get(
     '/advanced-search',
-    $authenticate(),
+    $authenticate,
     function () use ($app, &$session, $members_fields, $members_fields_cats, $preferences) {
         if ( isset($session['filters']['members']) ) {
             $filters = unserialize($session['filters']['members']);
@@ -1200,12 +1203,12 @@ $app->get(
             )
         );
     }
-)->name('advanced-search');
+)->setName('advanced-search');
 
 //Batch actions on members list
 $app->post(
     '/members/batch',
-    $authenticate(),
+    $authenticate,
     function () use ($app, &$session) {
         $request = $app->request();
 
@@ -1220,15 +1223,15 @@ $app->post(
             $session['filters']['members'] = serialize($filters);
 
             if ( $request->post('cards') ) {
-                $app->redirect(
-                    $app->urlFor('pdf-members-cards')
-                );
+                return $response
+                    ->withStatus(301)
+                    ->withHeader('Location', $this->router->pathFor('pdf-members-cards'));
             }
 
             if ( $request->post('labels') ) {
-                $app->redirect(
-                    $app->urlFor('pdf-members-labels')
-                );
+                return $response
+                    ->withStatus(301)
+                    ->withHeader('Location', $this->router->pathFor('pdf-members-labels'));
             }
 
             if ( $request->post('mailing') ) {
@@ -1236,12 +1239,10 @@ $app->post(
                 if ( $request->post() ) {
                     $options['new'] = 'new';
                 }
-                $app->redirect(
-                    $app->urlFor(
-                        'mailing',
-                        $options
-                    )
-                );
+
+                return $response
+                    ->withStatus(301)
+                    ->withHeader('Location', $this->router->pathFor('mailing', $options));
             }
 
             if ( $request->post('attendance_sheet') ) {
@@ -1249,29 +1250,30 @@ $app->post(
             }
 
             if ( $request->post('csv') ) {
-                $app->redirect(
-                    $app->urlFor('csv-memberslist')
-                );
+                return $response
+                    ->withStatus(301)
+                    ->withHeader('Location', $this->router->pathFor('csv-memberslist'));
             }
 
         } else {
-            $app->flash(
+            $this->flash->addMessage(
                 'error_detected',
                 array(
                     _T("No member was selected, please check at least one name.")
                 )
             );
-            $app->redirect(
-                $app->urlFor('members')
-            );
+
+            return $response
+                ->withStatus(301)
+                ->withHeader('Location', $this->router->pathFor('members'));
         }
     }
-)->name('batch-memberslist');
+)->setName('batch-memberslist');
 
 //PDF members cards
 $app->get(
     '/members/cards',
-    $authenticate(),
+    $authenticate,
     function () use ($app, $preferences, $session) {
         if ( isset($session['filters']['members']) ) {
             $filters =  unserialize($session['filters']['members']);
@@ -1291,15 +1293,16 @@ $app->get(
                     'No member selected to generate members cards',
                     Analog::INFO
                 );
-                $app->flash(
+                $this->flash->addMessage(
                     'error_detected',
                     array(
                         _T("No member was selected, please check at least one name.")
                     )
                 );
-                $app->redirect(
-                    $app->urlFor('members')
-                );
+
+                return $response
+                    ->withStatus(301)
+                    ->withHeader('Location', $this->router->pathFor('members'));
             }
         }
 
@@ -1324,27 +1327,28 @@ $app->get(
                 Analog::ERROR
             );
 
-            $app->flash(
+            $this->flash->addMessage(
                 'error_detected',
                 array(
                     _T("Unable to get members list.")
                 )
             );
-            $app->redirect(
-                $app->urlFor('members')
-            );
+
+            return $response
+                ->withStatus(301)
+                ->withHeader('Location', $this->router->pathFor('members'));
         }
 
         $pdf = new PdfMembersCards($preferences);
         $pdf->drawCards($members);
         $pdf->Output(_T("Cards") . '.pdf', 'D');
     }
-)->name('pdf-members-cards');
+)->setName('pdf-members-cards');
 
 //PDF members labels
 $app->get(
     '/members/labels',
-    $authenticate(),
+    $authenticate,
     function () use ($app, $preferences, $session) {
 
         if ( isset ($session['filters']['reminders_labels']) ) {
@@ -1369,15 +1373,16 @@ $app->get(
         } else {
             if ( count($filters->selected) == 0 ) {
                 Analog::log('No member selected to generate labels', Analog::INFO);
-                $app->flash(
+                $this->flash->addMessage(
                     'error_detected',
                     array(
                         _T("No member was selected, please check at least one name.")
                     )
                 );
-                $app->redirect(
-                    $app->urlFor('members')
-                );
+
+                return $response
+                    ->withStatus(301)
+                    ->withHeader('Location', $this->router->pathFor('members'));
             }
 
             $m = new Members();
@@ -1393,27 +1398,28 @@ $app->get(
                 Analog::ERROR
             );
 
-            $app->flash(
+            $this->flash->addMessage(
                 'error_detected',
                 array(
                     _T("Unable to get members list.")
                 )
             );
-            $app->redirect(
-                $app->urlFor('members')
-            );
+
+            return $response
+                ->withStatus(301)
+                ->withHeader('Location', $this->router->pathFor('members'));
         }
 
         $pdf = new PdfMembersLabels($preferences);
         $pdf->drawLabels($members);
         $pdf->Output(_T("labels_print_filename") . '.pdf', 'D');
     }
-)->name('pdf-members-labels');
+)->setName('pdf-members-labels');
 
 //mailing
 $app->get(
     '/mailing',
-    $authenticate(),
+    $authenticate,
     function () use ($app, $preferences, &$session,
         &$success_detected, &$warning_detected, &$error_detected
     ) {
@@ -1639,12 +1645,12 @@ $app->get(
         );
 
     }
-)->name('mailing');
+)->setName('mailing');
 
 //members list CSV export
 $app->get(
     '/members/export/csv',
-    $authenticate(),
+    $authenticate,
     function () use ($app, $session, $login, $zdb,
         $members_fields, $members_fields_cats
     ) {
@@ -1834,4 +1840,4 @@ $app->get(
             $response->setStatus(404);
         }
     }
-)->name('csv-memberslist');
+)->setName('csv-memberslist');
index 2a3bdc9349021c46a4e0f74bda55d1d28de1c3fd..3aa2a0761bf045464852fa2208d831fb360a3472 100644 (file)
 
 $app->group(
     '/plugins',
-    function () use ($app, $authenticate) {
-        $modules = $app->plugins->getModules();
+    function () use ($container, $app, $authenticate) {
+        $modules = $container->plugins->getModules();
 
         //Declare configured routes for each plugin
         foreach ($modules as $module_id => $module) {
-            $app->group(
+            $this->group(
                 '/' . $module['route'],
                 function () use ($app, $module, $module_id, $authenticate) {
                     $f = $module['root'] . '/_routes.php';
@@ -52,10 +52,10 @@ $app->group(
         }
 
         //Global route to access plugin resources (CSS, JS, images, ...)
-        $app->get(
+        $this->get(
             '/:plugin/res/:path+',
-            function ($plugin, $path) use ($app) {
-                $ext = pathinfo($path)['extension'];
+            function ($request, $response, $args, $plugin, $path) use ($app) {
+                $ext = pathinfo($args['path'])['extension'];
                 $auth_ext = [
                     'js'    => 'text/javascript',
                     'css'   => 'text/css',
@@ -65,7 +65,7 @@ $app->group(
                     'gif'   => 'image/gif'
                 ];
                 if (strpos($path, '../') === false && isset($auth_ext[$ext])) {
-                    $file = $app->plugins->getFile(
+                    $file = $this->plugins->getFile(
                         $plugin,
                         $path
                     );
@@ -78,6 +78,6 @@ $app->group(
                     );
                 }
             }
-        )->name('plugin_res')->conditions(array('path' => '.*'));
+        )->setName('plugin_res')/*->conditions(array('path' => '.*'))*/;
     }
 );
index 8bde4fb13b8ab3011fbc030f9103d65df70e1f98..05e1725a997c5af0caf2bb95f6643dbe48ad794f 100644 (file)
@@ -48,8 +48,11 @@ use \Analog\Analog;
 $showPublicPages = function () use ($preferences, $login) {
     return function () use ($preferences, $login) {
         if ( !$preferences->showPublicPages($login) ) {
-            $app->flash('error', _T("Unauthorized"));
-            $app->redirect($app->urlFor('slash'), 403);
+            $this->flash->addMessage('error', _T("Unauthorized"));
+
+            return $response
+                ->withStatus(403)
+                ->withHeader('Location', $this->router->pathFor('slash'));
         }
     };
 };
@@ -105,7 +108,7 @@ $app->get(
             )
         );
     }
-)->name('public_members');
+)->setName('public_members');
 
 //public trombinoscope
 $app->get(
@@ -125,4 +128,4 @@ $app->get(
             )
         );
     }
-)->name('public_trombinoscope');
+)->setName('public_trombinoscope');
index 5c076b736104df12630457ab436ffadf26e15344..2631b2aa36a02f6caea899a1d7ed84111cb84ecc 100644 (file)
@@ -78,11 +78,11 @@ class Plugins
     /**
      * Set Slim instance
      *
-     * @param Slim $app Slim app instance
+     * @param \Slim\App $app Slim app instance
      *
      * @return void
      */
-    public function setApp(\Slim\Slim $app)
+    public function setApp(\Slim\App $app)
     {
         $this->app = $app;
     }
index a865769200e172b79a514216c44d0016f9afded2..b29aa7d7a5a945b4d6ab368cc65ba13f6d6eab00 100644 (file)
@@ -79,12 +79,12 @@ class SysInfos
     /**
      * Get data as RAW (to send by mail)
      *
+     * @param Plugins $plugins Plugins
+     *
      * @return string
      */
-    public function getRawData()
+    public function getRawData(Plugins $plugins)
     {
-        global $plugins;
-
         $str =  'Galette version: ' . $this->_galette_version . "\n";
         $str .= 'PHP version:     ' . $this->_php_version . "\n";
         $str .= 'PHP/Web:         ' . php_sapi_name() . "\n";
@@ -96,33 +96,33 @@ class SysInfos
         $mods = new CheckModules();
 
         $str .= '  OK:' . "\n";
-        foreach ( $mods->getGoods() as $g ) {
+        foreach ($mods->getGoods() as $g) {
             $str .= '    ' . stripslashes($g) . "\n";
         }
 
         $str .= '  May:' . "\n";
-        foreach ( $mods->getMays() as $m ) {
+        foreach ($mods->getMays() as $m) {
             $str .= '    ' . stripslashes($m) . "\n";
         }
 
         $str .= '  Should:' . "\n";
-        foreach ( $mods->getShoulds() as $s ) {
+        foreach ($mods->getShoulds() as $s) {
             $str .= '    ' . stripslashes($s) . "\n";
         }
 
         $str .= '  Missing:' . "\n";
-        foreach ( $mods->getMissings() as $m ) {
+        foreach ($mods->getMissings() as $m) {
             $str .= '    ' . stripslashes($m) . "\n";
         }
 
         $str .= "\n" . 'Plugins:' . "\n";
-        foreach ( $plugins->getModules() as $p ) {
+        foreach ($plugins->getModules() as $p) {
             $str .= '  ' . $p['name'] .  ' ' . $p['version'] .
                 ' (' . $p['author'] . ")\n";
         }
 
         $str .= "\n" . 'PHP loaded modules:' . "\n";
-        foreach ( get_loaded_extensions() as $e ) {
+        foreach (get_loaded_extensions() as $e) {
             $str .= '  ' . $e . "\n";
         }
 
index 2e5ac8d06c56bc36c93e1af651bbd006920db03a..28e1fe853e099f2469051b6092d94d323c0efd4a 100644 (file)
@@ -5,17 +5,17 @@
                 {_T string="Activities"}
             </header>
             <div>
-                <a id="members" href="{urlFor name="members"}" title="{_T string="View, search into and filter member's list"}">{_T string="Members"}</a>
-                <a id="groups" href="{urlFor name="groups"}" title="{_T string="View and manage groups"}">{_T string="Groups"}</a>
+                <a id="members" href="{path_for name="members"}" title="{_T string="View, search into and filter member's list"}">{_T string="Members"}</a>
+                <a id="groups" href="{path_for name="groups"}" title="{_T string="View and manage groups"}">{_T string="Groups"}</a>
 {if $login->isAdmin() or $login->isStaff()}
-                <a id="contribs" href="{urlFor name="contributions"}" title="{_T string="View and filter contributions"}">{_T string="Contributions"}</a><br/>
+                <a id="contribs" href="{path_for name="contributions"}" title="{_T string="View and filter contributions"}">{_T string="Contributions"}</a><br/>
                 <a id="transactions" href="{$galette_base_path}gestion_transactions.php" title="{_T string="View and filter transactions"}">{_T string="Transactions"}</a>
                 <a id="mailings" href="{$galette_base_path}gestion_mailings.php" title="{_T string="Manage mailings that has been sent"}">{_T string="Mailings"}</a>
                 <a id="reminder" href="{$galette_base_path}reminder.php" title="{_T string="Send reminders to late members"}">{_T string="Reminders"}</a>
 {/if}
 {if $login->isAdmin()}
-                <a id="prefs" href="{urlFor name="preferences"}" title="{_T string="Set applications preferences (adress, website, member's cards configuration, ...)"}">{_T string="Settings"}</a>
-                <a id="plugins" href="{urlFor name="plugins"}" title="{_T string="Informations about available plugins"}">{_T string="Plugins"}</a>
+                <a id="prefs" href="{path_for name="preferences"}" title="{_T string="Set applications preferences (adress, website, member's cards configuration, ...)"}">{_T string="Settings"}</a>
+                <a id="plugins" href="{path_for name="plugins"}" title="{_T string="Informations about available plugins"}">{_T string="Plugins"}</a>
 {/if}
             </div>
         </section>
index fbfafea1790739e6813ba4b033b06c711e364084..a33fee773d519249ec62cc87b0b95cc4eed3280f 100644 (file)
@@ -1,7 +1,7 @@
         <footer>
             <a id="copyright" href="http://galette.eu/">Galette {$GALETTE_VERSION}</a>
 {if $login->isLogged() &&  ($login->isAdmin() or $login->isStaff())}
-            <br/><a id="sysinfos" href="{urlFor name="sysinfos"}">{_T string="System informations"}</a>
+            <br/><a id="sysinfos" href="{path_for name="sysinfos"}">{_T string="System informations"}</a>
 {/if}
             <nav>
                 <ul>
index e8d8687eaed8aca0bffcf30354bc0af265e1a9a1..c032dfe89d3e1eff6c8e546f2cf4280e7af0e786 100644 (file)
@@ -3,7 +3,7 @@
     {if isset($smarty.session['slim.flash']['loginfault'])}
                 <div id="errorbox">{$smarty.session['slim.flash']['loginfault']}</div>
     {/if}
-                <form action="{urlFor name="dologin"}" method="post">
+                <form action="{path_for name="dologin"}" method="post">
                 <section>
                     <table>
                         <tr>
index 672fa3b70a1b5020d73231f21ffdf6e488d97c3c..385730b90a10eac4d8d7a982c8c4c550870eaa35 100644 (file)
@@ -92,7 +92,7 @@ We have to use a template file, so Smarty will do its work (like replacing varia
         <![endif]-->
     <div id="menu">
         <div id="logo">
-            <img src="{urlFor name="logo"}" width="{$logo->getOptimalWidth()}" height="{$logo->getOptimalHeight()}" alt="[ Galette ]" />
+            <img src="{path_for name="logo"}" width="{$logo->getOptimalWidth()}" height="{$logo->getOptimalHeight()}" alt="[ Galette ]" />
         </div>
 {if $login->isSuperAdmin()}
         <div id="superadmin" title="{_T string="You are actually logged-in as superadmin. Some functionnalities may not be available since this is *not* a regular member."}">
@@ -108,37 +108,37 @@ We have to use a template file, so Smarty will do its work (like replacing varia
         <h1 class="nojs">{_T string="Navigation"}</h1>
         <ul>
   {if $login->isAdmin() or $login->isStaff() or $login->isGroupManager()}
-            <li{if $cur_route eq "dashboard"} class="selected"{/if}><a href="{urlFor name="dashboard"}" title="{_T string="Go to Galette's dashboard"}">{_T string="Dashboard"}</a></li>
-            <li{if $cur_route eq "members"} class="selected"{/if}><a href="{urlFor name="members"}" title="{_T string="View, search into and filter member's list"}">{_T string="List of members"}</a></li>
-            <li{if $cur_route eq "advanced-search"} class="selected"{/if}><a href="{urlFor name="advanced-search"}" title="{_T string="Perform advanced search into members list"}">{_T string="Advanced search"}</a></li>
-            <li{if $cur_route eq "groups"} class="selected"{/if}><a href="{urlFor name="groups"}" title="{_T string="View and manage groups"}">{_T string="Manage groups"}</a></li>
+            <li{if $cur_route eq "dashboard"} class="selected"{/if}><a href="{path_for name="dashboard"}" title="{_T string="Go to Galette's dashboard"}">{_T string="Dashboard"}</a></li>
+            <li{if $cur_route eq "members"} class="selected"{/if}><a href="{path_for name="members"}" title="{_T string="View, search into and filter member's list"}">{_T string="List of members"}</a></li>
+            <li{if $cur_route eq "advanced-search"} class="selected"{/if}><a href="{path_for name="advanced-search"}" title="{_T string="Perform advanced search into members list"}">{_T string="Advanced search"}</a></li>
+            <li{if $cur_route eq "groups"} class="selected"{/if}><a href="{path_for name="groups"}" title="{_T string="View and manage groups"}">{_T string="Manage groups"}</a></li>
   {/if}
   {if $login->isAdmin() or $login->isStaff()}
-            <li{if $cur_route eq "contributions"} class="selected"{/if}><a href="{urlFor name="contributions"}" title="{_T string="View and filter contributions"}">{_T string="List of contributions"}</a></li>
+            <li{if $cur_route eq "contributions"} class="selected"{/if}><a href="{path_for name="contributions"}" title="{_T string="View and filter contributions"}">{_T string="List of contributions"}</a></li>
             <li{if $PAGENAME eq "gestion_transactions.php"} class="selected"{/if}><a href="{$galette_base_path}gestion_transactions.php" title="{_T string="View and filter transactions"}">{_T string="List of transactions"}</a></li>
             <li{if $PAGENAME eq "ajouter_adherent.php"} class="selected"{/if}><a href="{$galette_base_path}ajouter_adherent.php" title="{_T string="Add new member in database"}">{_T string="Add a member"}</a></li>
             <li{if $PAGENAME eq "ajouter_contribution.php"} class="selected"{/if}><a href="{$galette_base_path}ajouter_contribution.php" title="{_T string="Add new contribution in database"}">{_T string="Add a contribution"}</a></li>
             <li{if $PAGENAME eq "ajouter_transaction.php"} class="selected"{/if}><a href="{$galette_base_path}ajouter_transaction.php" title="{_T string="Add new transaction in database"}">{_T string="Add a transaction"}</a></li>
             <li{if $PAGENAME eq "reminder.php"} class="selected"{/if}><a href="{$galette_base_path}reminder.php" title="{_T string="Send reminders to late members"}">{_T string="Reminders"}</a></li>
-            <li{if $cur_route eq "history"} class="selected"{/if}><a href="{urlFor name="history"}" title="{_T string="View application's logs"}">{_T string="Logs"}</a></li>
-            <li{if $cur_route eq "mailings"} class="selected"{/if}><a href="{urlFor name="mailings"}" title="{_T string="Manage mailings that has been sent"}">{_T string="Manage mailings"}</a></li>
+            <li{if $cur_route eq "history"} class="selected"{/if}><a href="{path_for name="history"}" title="{_T string="View application's logs"}">{_T string="Logs"}</a></li>
+            <li{if $cur_route eq "mailings"} class="selected"{/if}><a href="{path_for name="mailings"}" title="{_T string="Manage mailings that has been sent"}">{_T string="Manage mailings"}</a></li>
             <li{if $PAGENAME eq "export.php"} class="selected"{/if}><a href="{$galette_base_path}export.php" title="{_T string="Export some data in various formats"}">{_T string="Exports"}</a></li>
             <li{if $PAGENAME eq "import.php" or $PAGENAME eq "import_model.php"} class="selected"{/if}><a href="{$galette_base_path}import.php" title="{_T string="Import members from CSV files"}">{_T string="Imports"}</a></li>
-            <li class="mnu_last{if $cur_route eq "charts"} selected{/if}"><a href="{urlFor name="charts"}" title="{_T string="Various charts"}">{_T string="Charts"}</a></li>
+            <li class="mnu_last{if $cur_route eq "charts"} selected{/if}"><a href="{path_for name="charts"}" title="{_T string="Various charts"}">{_T string="Charts"}</a></li>
   {else}
-            <li{if $cur_route eq "contributions"} class="selected"{/if}><a href="{urlFor name="contributions"}" title="{_T string="View and filter all my contributions"}">{_T string="My contributions"}</a></li>
+            <li{if $cur_route eq "contributions"} class="selected"{/if}><a href="{path_for name="contributions"}" title="{_T string="View and filter all my contributions"}">{_T string="My contributions"}</a></li>
             <li{if $PAGENAME eq "gestion_transactions.php"} class="selected"{/if}><a href="{$galette_base_path}gestion_transactions.php" title="{_T string="View and filter all my transactions"}">{_T string="My transactions"}</a></li>
   {/if}
   {if !$login->isSuperAdmin()}
-            <li{if $cur_route eq "me" or $cur_route eq "member"} class="selected"{/if}><a href="{urlFor name="me"}" title="{_T string="View my member card"}">{_T string="My information"}</a></li>
+            <li{if $cur_route eq "me" or $cur_route eq "member"} class="selected"{/if}><a href="{path_for name="me"}" title="{_T string="View my member card"}">{_T string="My information"}</a></li>
   {/if}
         </ul>
 {/if}
 {if $preferences->showPublicPages($login) eq true}
         <h1 class="nojs">{_T string="Public pages"}</h1>
         <ul>
-            <li><a href="{urlFor name="public_members"}" title="{_T string="Members list"}">{_T string="Members list"}</a></li>
-            <li><a href="{urlFor name="public_trombinoscope"}" title="{_T string="Trombinoscope"}">{_T string="Trombinoscope"}</a></li>
+            <li><a href="{path_for name="public_members"}" title="{_T string="Members list"}">{_T string="Members list"}</a></li>
+            <li><a href="{path_for name="public_trombinoscope"}" title="{_T string="Trombinoscope"}">{_T string="Trombinoscope"}</a></li>
             {* Include plugins menu entries *}
             {$plugins->getPublicMenus($tpl, $preferences)}
         </ul>
@@ -146,8 +146,8 @@ We have to use a template file, so Smarty will do its work (like replacing varia
 {if $login->isAdmin()}
         <h1 class="nojs">{_T string="Configuration"}</h1>
         <ul>
-            <li{if $cur_route eq "preferences"} class="selected"{/if}><a href="{urlFor name="preferences"}" title="{_T string="Set applications preferences (address, website, member's cards configuration, ...)"}">{_T string="Settings"}</a></li>
-            <li{if $cur_route eq "plugins"} class="selected"{/if}><a href="{urlFor name="plugins"}" title="{_T string="Informations about available plugins"}">{_T string="Plugins"}</a></li>
+            <li{if $cur_route eq "preferences"} class="selected"{/if}><a href="{path_for name="preferences"}" title="{_T string="Set applications preferences (address, website, member's cards configuration, ...)"}">{_T string="Settings"}</a></li>
+            <li{if $cur_route eq "plugins"} class="selected"{/if}><a href="{path_for name="plugins"}" title="{_T string="Informations about available plugins"}">{_T string="Plugins"}</a></li>
             <li{if $PAGENAME eq "config_fields.php"} class="selected"{/if}><a href="{$galette_base_path}config_fields.php" title="{_T string="Customize fields order, set which are required, and for who they're visibles"}">{_T string="Customize fields"}</a></li>
             <li{if $PAGENAME eq "configurer_fiches.php" or $PAGENAME eq "editer_champ.php"} class="selected"{/if}><a href="{$galette_base_path}configurer_fiches.php" title="{_T string="Manage additional fields for various forms"}">{_T string="Configure member forms"}</a></li>
             <li{if $PAGENAME eq "traduire_libelles.php"} class="selected"{/if}><a href="{$galette_base_path}traduire_libelles.php" title="{_T string="Translate additionnals fields labels"}">{_T string="Translate labels"}</a></li>
@@ -170,7 +170,7 @@ We have to use a template file, so Smarty will do its work (like replacing varia
         </ul>
 {if $login->isLogged()}
         <div>{$login->loggedInAs()}</div>
-        <a id="{if $login->isImpersonated()}unimpersonate{else}logout{/if}" class="button" href="{if $login->isImpersonated()}{urlFor name="unimpersonate"}{else}{urlFor name="logout"}{/if}">{_T string="Log off"}</a>
+        <a id="{if $login->isImpersonated()}unimpersonate{else}logout{/if}" class="button" href="{if $login->isImpersonated()}{path_for name="unimpersonate"}{else}{path_for name="logout"}{/if}">{_T string="Log off"}</a>
 {/if}
     </div>
     <div id="content"{if $contentcls} class="{$contentcls}"{/if}>
index 45e0deb27d468c31f8dcb7afe3d8f2eb982371d6..30eb6237b8245541ec9d36d224e2b56214a0fbfd 100644 (file)
@@ -1,6 +1,6 @@
 {extends file="page.tpl"}
 {block name="content"}
-        <form action="{urlFor name="store-preferences"}" method="post" enctype="multipart/form-data" class="tabbed">
+        <form action="{path_for name="store-preferences"}" method="post" enctype="multipart/form-data" class="tabbed">
         <div id="prefs_tabs">
             <ul>
                 <li><a href="#general">{_T string="General"}</a></li>
@@ -27,7 +27,7 @@
                 <p>
                     <label for="logo_picture" class="bline">{_T string="Logo:"}</label>
 {if $logo->isCustom()}
-                    <img src="{urlFor name="logo"}" class="picture" width="{$logo->getOptimalWidth()}" height="{$logo->getOptimalHeight()}" alt="{_T string="Current logo"}"/><br/>
+                    <img src="{path_for name="logo"}" class="picture" width="{$logo->getOptimalWidth()}" height="{$logo->getOptimalHeight()}" alt="{_T string="Current logo"}"/><br/>
                     <label for="del_logo">{_T string="Delete image"}</label><input type="checkbox" name="del_logo" id="del_logo" value="1" /><br />
 {/if}
                     <input type="file" name="logo" id="logo_picture"{if $GALETTE_MODE eq 'DEMO'} disabled="disabled"{/if}/>
                 <p>
                     <label for="pref_numrows" class="bline">{_T string="Lines / Page:"}</label>
                     <select name="pref_numrows" id="pref_numrows">
-                        {html_options options=$pref_numrows_options selected=$pref.pref_numrows}
+                        {*html_options options=$pref_numrows_options selected=$pref.pref_numrows*}
                     </select>
                 </p>
                 <p>
index a52217802925b7fed66f9d80d8aee13aa0f5b2ff..1b5aaf6e1f570d4a1d99c35d7db99b919bc20990 100644 (file)
@@ -36,7 +36,7 @@ We have to use a template file, so Smarty will do its work (like replacing varia
         </div>
         <![endif]-->
         <header>
-            <img src="{urlFor name="logo"}" width="{$logo->getOptimalWidth()}" height="{$logo->getOptimalHeight()}" alt="[ Galette ]" />
+            <img src="{path_for name="logo"}" width="{$logo->getOptimalWidth()}" height="{$logo->getOptimalHeight()}" alt="[ Galette ]" />
             <ul id="langs">
 {foreach item=langue from=$languages}
                 <li><a href="?pref_lang={$langue->getID()}"><img src="{$galette_base_path}{$langue->getFlag()}" alt="{$langue->getName()}" lang="{$langue->getAbbrev()}" class="flag"/></a></li>
@@ -44,7 +44,7 @@ We have to use a template file, so Smarty will do its work (like replacing varia
             </ul>
 {if $login->isLogged()}
             <div id="user">
-                <a id="userlink" title="{_T string="View your member card"}" href="{if $login->isSuperAdmin()}{urlFor name="slash"}{else}{urlFor name="me"}{/if}">{$login->loggedInAs(true)}</a>
+                <a id="userlink" title="{_T string="View your member card"}" href="{if $login->isSuperAdmin()}{path_for name="slash"}{else}{path_for name="me"}{/if}">{$login->loggedInAs(true)}</a>
                 <a id="logout" title="{_T string="Log off"}" href="{$galette_base_path}index.php?logout=1">{_T string="Log off"}</a>
             </div>
 {/if}
@@ -57,18 +57,18 @@ We have to use a template file, so Smarty will do its work (like replacing varia
         <h1 id="titre">{$page_title}</h1>
         <p id="asso_name">{$preferences->pref_nom}{if $preferences->pref_slogan}&nbsp;: {$preferences->pref_slogan}{/if}</p>
         <nav>
-            <a id="backhome" class="button{if $cur_route eq "slash" or $cur_route eq 'login'} selected{/if}" href="{urlFor name="slash"}">{_T string="Home"}</a>
+            <a id="backhome" class="button{if $cur_route eq "slash" or $cur_route eq 'login'} selected{/if}" href="{path_for name="slash"}">{_T string="Home"}</a>
     {if !$login->isLogged()}
         {if $preferences->pref_bool_selfsubscribe eq true}
-            <a id="subscribe" class="button{if $cur_route eq "/subscribe"} selected{/if}" href="{urlFor name="subscribe"}">{_T string="Subscribe"}</a>
+            <a id="subscribe" class="button{if $cur_route eq "/subscribe"} selected{/if}" href="{path_for name="subscribe"}">{_T string="Subscribe"}</a>
         {/if}
         {if $pref_mail_method neq constant('Galette\Core\GaletteMail::METHOD_DISABLED')}
-            <a id="lostpassword" class="button{if $cur_route eq "password-lost"} selected{/if}" href="{urlFor name="password-lost"}">{_T string="Lost your password?"}</a>
+            <a id="lostpassword" class="button{if $cur_route eq "password-lost"} selected{/if}" href="{path_for name="password-lost"}">{_T string="Lost your password?"}</a>
         {/if}
     {/if}
     {if $preferences->showPublicPages($login) eq true}
-            <a id="memberslist" class="button{if $cur_route eq "public_members"} selected{/if}" href="{urlFor name="public_members"}" title="{_T string="Members list"}">{_T string="Members list"}</a>
-            <a id="trombino" class="button{if $cur_route eq "public_trombinoscope"} selected{/if}" href="{urlFor name="public_trombinoscope"}" title="{_T string="Trombinoscope"}">{_T string="Trombinoscope"}</a>
+            <a id="memberslist" class="button{if $cur_route eq "public_members"} selected{/if}" href="{path_for name="public_members"}" title="{_T string="Members list"}">{_T string="Members list"}</a>
+            <a id="trombino" class="button{if $cur_route eq "public_trombinoscope"} selected{/if}" href="{path_for name="public_trombinoscope"}" title="{_T string="Trombinoscope"}">{_T string="Trombinoscope"}</a>
             {* Include plugins menu entries *}
             {$plugins->getPublicMenus($tpl, $preferences, true)}
     {/if}