commit 6ff6cc9563cc22e8f8eb2b107989c9f432f10028 Author: Wilfried Trinkl Date: Fri Jul 6 07:31:22 2018 +0200 Initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7061901 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +; This file is for unifying the coding style for different editors and IDEs. +; More information at http://editorconfig.org + +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.bat] +end_of_line = crlf + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..e16b4b4 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,42 @@ +# Define the line ending behavior of the different file extensions +# Set default behaviour, in case users don't have core.autocrlf set. +* text=auto +* text eol=lf + +# Explicitly declare text files we want to always be normalized and converted +# to native line endings on checkout. +*.php text +*.default text +*.ctp text +*.sql text +*.md text +*.po text +*.js text +*.css text +*.ini text +*.properties text +*.txt text +*.xml text +*.svg text +*.yml text +.htaccess text + +# Declare files that will always have CRLF line endings on checkout. +*.bat eol=crlf + +# Declare files that will always have LF line endings on checkout. +*.pem eol=lf + +# Denote all files that are truly binary and should not be modified. +*.png binary +*.jpg binary +*.gif binary +*.ico binary +*.mo binary +*.pdf binary +*.phar binary +*.woff binary +*.woff2 binary +*.ttf binary +*.otf binary +*.eot binary diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..92c77d6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,23 @@ +This is a (multiple allowed): + +* [x] bug +* [ ] enhancement +* [ ] feature-discussion (RFC) + +* CakePHP Application Skeleton Version: EXACT RELEASE VERSION OR COMMIT HASH, HERE. +* Platform and Target: YOUR WEB-SERVER, DATABASE AND OTHER RELEVANT INFO AND HOW THE REQUEST IS BEING MADE, HERE. + +### What you did +EXPLAIN WHAT YOU DID, PREFERABLY WITH CODE EXAMPLES, HERE. + +### What happened +EXPLAIN WHAT IS ACTUALLY HAPPENING, HERE. + +### What you expected to happen +EXPLAIN WHAT IS TO BE EXPECTED, HERE. + +P.S. Remember, an issue is not the place to ask questions. You can use [Stack Overflow](http://stackoverflow.com/questions/tagged/cakephp) +for that or join the #cakephp channel on irc.freenode.net, where we will be more +than happy to help answer your questions. + +Before you open an issue, please check if a similar issue already exists or has been closed before. \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..05ca9eb --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,10 @@ +**PLEASE NOTE:** + +This is only a issue tracker for issues related to the CakePHP Application Skeleton. +For CakePHP Framework issues please use this [issue tracker](https://github.com/cakephp/cakephp/issues). + +Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue. + +The best way to propose a feature is to open an issue first and discuss your ideas there before implementing them. + +Always follow the [contribution guidelines](https://github.com/cakephp/cakephp/blob/master/.github/CONTRIBUTING.md) guidelines when submitting a pull request. In particular, make sure existing tests still pass, and add tests for all new behavior. When fixing a bug, you may want to add a test to verify the fix. \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e2e825d --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/vendor/* +/config/app.php +/tmp/* +/logs/* diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..bc1dd9c --- /dev/null +++ b/.htaccess @@ -0,0 +1,11 @@ +# Uncomment the following to prevent the httpoxy vulnerability +# See: https://httpoxy.org/ +# +# RequestHeader unset Proxy +# + + + RewriteEngine on + RewriteRule ^$ webroot/ [L] + RewriteRule (.*) webroot/$1 [L] + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f10c98d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,30 @@ +language: php + +dist: trusty + +sudo: false + +php: + - 5.5 + - 5.6 + - 7.0 + - 7.1 + +matrix: + fast_finish: true + + include: + - php: 7.0 + env: PHPCS=1 + +before_script: + - if [[ $PHPCS = 1 ]]; then composer require cakephp/cakephp-codesniffer:~2.1; fi + - if [[ $PHPCS != 1 ]]; then composer install; fi + - if [[ $PHPCS != 1 ]]; then composer run-script post-install-cmd --no-interaction; fi + +script: + - if [[ $PHPCS != 1 ]]; then phpunit; fi + - if [[ $PHPCS = 1 ]]; then vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests ./config ./webroot; fi + +notifications: + email: false diff --git a/README.md b/README.md new file mode 100644 index 0000000..f200169 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# CakePHP Application Skeleton + +[![Build Status](https://img.shields.io/travis/cakephp/app/master.svg?style=flat-square)](https://travis-ci.org/cakephp/app) +[![License](https://img.shields.io/packagist/l/cakephp/app.svg?style=flat-square)](https://packagist.org/packages/cakephp/app) + +A skeleton for creating applications with [CakePHP](http://cakephp.org) 3.x. + +The framework source code can be found here: [cakephp/cakephp](https://github.com/cakephp/cakephp). + +## Installation + +1. Download [Composer](http://getcomposer.org/doc/00-intro.md) or update `composer self-update`. +2. Run `php composer.phar create-project --prefer-dist cakephp/app [app_name]`. + +If Composer is installed globally, run +```bash +composer create-project --prefer-dist cakephp/app [app_name] +``` + +You should now be able to visit the path to where you installed the app and see the default home page. + +## Update + +Since this skeleton is a starting point for your application and various files would have been modified as per your needs, there isn't a way to provide automated upgrades, so you have to do any updates manually. + +## Configuration + +Read and edit `config/app.php` and setup the `'Datasources'` and any other +configuration relevant for your application. + +## Layout +The app skeleton uses a subset of [Foundation](http://foundation.zurb.com/) CSS framework by default. You can, however, replace it with any other library or custom styles. diff --git a/bin/cake b/bin/cake new file mode 100755 index 0000000..6801c45 --- /dev/null +++ b/bin/cake @@ -0,0 +1,46 @@ +#!/usr/bin/env sh +################################################################################ +# +# Cake is a shell script for invoking CakePHP shell commands +# +# CakePHP(tm) : Rapid Development Framework (http://cakephp.org) +# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) +# +# Licensed under The MIT License +# For full copyright and license information, please see the LICENSE.txt +# Redistributions of files must retain the above copyright notice. +# +# @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) +# @link http://cakephp.org CakePHP(tm) Project +# @since 1.2.0 +# @license http://www.opensource.org/licenses/mit-license.php MIT License +# +################################################################################ + +# Canonicalize by following every symlink of the given name recursively +canonicalize() { + NAME="$1" + if [ -f "$NAME" ] + then + DIR=$(dirname -- "$NAME") + NAME=$(cd -P "$DIR" > /dev/null && pwd -P)/$(basename -- "$NAME") + fi + while [ -h "$NAME" ]; do + DIR=$(dirname -- "$NAME") + SYM=$(readlink "$NAME") + NAME=$(cd "$DIR" > /dev/null && cd $(dirname -- "$SYM") > /dev/null && pwd)/$(basename -- "$SYM") + done + echo "$NAME" +} + +CONSOLE=$(dirname -- "$(canonicalize "$0")") +APP=$(dirname "$CONSOLE") + +if [ $(basename $0) != 'cake' ] +then + exec php "$CONSOLE"/cake.php $(basename $0) "$@" +else + exec php "$CONSOLE"/cake.php "$@" +fi + +exit diff --git a/bin/cake.bat b/bin/cake.bat new file mode 100644 index 0000000..d4512db --- /dev/null +++ b/bin/cake.bat @@ -0,0 +1,27 @@ +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: +:: Cake is a Windows batch script for invoking CakePHP shell commands +:: +:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org) +:: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) +:: +:: Licensed under The MIT License +:: Redistributions of files must retain the above copyright notice. +:: +:: @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) +:: @link http://cakephp.org CakePHP(tm) Project +:: @since 2.0.0 +:: @license http://www.opensource.org/licenses/mit-license.php MIT License +:: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +@echo off + +SET app=%0 +SET lib=%~dp0 + +php "%lib%cake.php" %* + +echo. + +exit /B %ERRORLEVEL% diff --git a/bin/cake.php b/bin/cake.php new file mode 100644 index 0000000..74b7934 --- /dev/null +++ b/bin/cake.php @@ -0,0 +1,34 @@ +#!/usr/bin/php -q +require->php)) { + $minVersion = preg_replace('/([^0-9\.])/', '', $composer->require->php); + } +} +if (version_compare(phpversion(), $minVersion, '<')) { + fwrite(STDERR, sprintf("Minimum PHP version: %s. You are using: %s.\n", $minVersion, phpversion())); + exit(-1); +} + +require dirname(__DIR__) . '/vendor/autoload.php'; +include dirname(__DIR__) . '/config/bootstrap.php'; + +exit(Cake\Console\ShellDispatcher::run($argv)); diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..0efa579 --- /dev/null +++ b/composer.json @@ -0,0 +1,50 @@ +{ + "name": "cakephp/app", + "description": "CakePHP skeleton app", + "homepage": "http://cakephp.org", + "type": "project", + "license": "MIT", + "require": { + "php": ">=5.5.9", + "cakephp/cakephp": "3.3.*", + "mobiledetect/mobiledetectlib": "2.*", + "cakephp/migrations": "~1.0", + "cakephp/plugin-installer": "*", + "sunra/php-simple-html-dom-parser": "^1.5", + "microweber/screen": "^1.0", + "spatie/array-to-xml": "^2.7" + }, + "require-dev": { + "psy/psysh": "@stable", + "cakephp/debug_kit": "~3.2", + "cakephp/bake": "~1.1" + }, + "suggest": { + "markstory/asset_compress": "An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.", + "phpunit/phpunit": "Allows automated tests to be run without system-wide install.", + "cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP." + }, + "autoload": { + "psr-4": { + "App\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "App\\Test\\": "tests", + "Cake\\Test\\": "./vendor/cakephp/cakephp/tests" + } + }, + "scripts": { + "post-install-cmd": "App\\Console\\Installer::postInstall", + "post-create-project-cmd": "App\\Console\\Installer::postInstall", + "post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump", + "check": [ + "@test", + "@cs-check" + ], + "cs-check": "phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests", + "cs-fix": "phpcbf --colors --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests", + "test": "phpunit --colors=always" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..31bf340 --- /dev/null +++ b/composer.lock @@ -0,0 +1,2221 @@ +{ + "_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": "79fd1d043d7eab2b06b0d2048bb23b4b", + "content-hash": "03aef8e54d6317ce26f0dbe72aff1ebb", + "packages": [ + { + "name": "aura/installer-default", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/auraphp/installer-default.git", + "reference": "52f8de3670cc1ef45a916f40f732937436d028c8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/auraphp/installer-default/zipball/52f8de3670cc1ef45a916f40f732937436d028c8", + "reference": "52f8de3670cc1ef45a916f40f732937436d028c8", + "shasum": "" + }, + "type": "composer-installer", + "extra": { + "class": "Aura\\Composer\\DefaultInstaller" + }, + "autoload": { + "psr-0": { + "Aura\\Composer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Paul M. Jones", + "email": "pmjones88@gmail.com", + "homepage": "http://paul-m-jones.com" + } + ], + "description": "Installs Aura packages using the Composer defaults.", + "keywords": [ + "aura", + "installer" + ], + "time": "2012-11-26 21:35:57" + }, + { + "name": "aura/intl", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/auraphp/Aura.Intl.git", + "reference": "c5fe620167550ad6fa77dd3570fba2efc77a2a21" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/auraphp/Aura.Intl/zipball/c5fe620167550ad6fa77dd3570fba2efc77a2a21", + "reference": "c5fe620167550ad6fa77dd3570fba2efc77a2a21", + "shasum": "" + }, + "require": { + "aura/installer-default": "1.0.*", + "php": ">=5.4.0" + }, + "type": "aura-package", + "extra": { + "aura": { + "type": "library", + "config": { + "common": "Aura\\Intl\\_Config\\Common" + } + }, + "branch-alias": { + "dev-develop": "1.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Aura\\Intl": "src/" + }, + "psr-4": { + "Aura\\Intl\\_Config\\": "config/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Paul M. Jones", + "email": "pmjones88@gmail.com", + "homepage": "http://paul-m-jones.com" + }, + { + "name": "Aura.Intl Contributors", + "homepage": "https://github.com/auraphp/Aura.Intl/contributors" + }, + { + "name": "Pascal Borreli", + "email": "pascal@borreli.com" + }, + { + "name": "Mapthegod", + "email": "mapthegod@gmail.com" + }, + { + "name": "Jose Lorenzo Rodriguez", + "email": "jose.zap@gmail.com" + } + ], + "description": "The Aura.Intl package provides internationalization (I18N) tools, specifically\npackage-oriented per-locale message translation.", + "homepage": "http://auraphp.com/Aura.Intl", + "keywords": [ + "g11n", + "globalization", + "i18n", + "internationalization", + "intl", + "l10n", + "localization" + ], + "time": "2014-08-24 00:00:00" + }, + { + "name": "cakephp/cakephp", + "version": "3.3.16", + "source": { + "type": "git", + "url": "https://github.com/cakephp/cakephp.git", + "reference": "11a5ae91ef03e3ff8a9c6d410fdb1cc98e0f57f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/cakephp/zipball/11a5ae91ef03e3ff8a9c6d410fdb1cc98e0f57f3", + "reference": "11a5ae91ef03e3ff8a9c6d410fdb1cc98e0f57f3", + "shasum": "" + }, + "require": { + "aura/intl": "1.1.*", + "cakephp/chronos": "~1.0", + "ext-intl": "*", + "ext-mbstring": "*", + "php": ">=5.5.9", + "psr/log": "^1.0", + "zendframework/zend-diactoros": "^1.4" + }, + "replace": { + "cakephp/cache": "self.version", + "cakephp/collection": "self.version", + "cakephp/core": "self.version", + "cakephp/database": "self.version", + "cakephp/datasource": "self.version", + "cakephp/event": "self.version", + "cakephp/filesystem": "self.version", + "cakephp/form": "self.version", + "cakephp/i18n": "self.version", + "cakephp/log": "self.version", + "cakephp/orm": "self.version", + "cakephp/utility": "self.version", + "cakephp/validation": "self.version" + }, + "require-dev": { + "cakephp/cakephp-codesniffer": "~2.1", + "phpunit/phpunit": "<6.0" + }, + "suggest": { + "ext-openssl": "To use Security::encrypt() or have secure CSRF token generation." + }, + "type": "library", + "autoload": { + "psr-4": { + "Cake\\": "src" + }, + "files": [ + "src/Core/functions.php", + "src/Collection/functions.php", + "src/I18n/functions.php", + "src/Utility/bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/cakephp/graphs/contributors" + } + ], + "description": "The CakePHP framework", + "homepage": "http://cakephp.org", + "keywords": [ + "framework" + ], + "time": "2017-04-07 02:04:27" + }, + { + "name": "cakephp/chronos", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/cakephp/chronos.git", + "reference": "85bcaea6a832684b32ef54b2487b0c14a172e9e6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/chronos/zipball/85bcaea6a832684b32ef54b2487b0c14a172e9e6", + "reference": "85bcaea6a832684b32ef54b2487b0c14a172e9e6", + "shasum": "" + }, + "require": { + "php": "^5.5.9|^7" + }, + "require-dev": { + "athletic/athletic": "~0.1", + "cakephp/cakephp-codesniffer": "~2.3", + "phpbench/phpbench": "@dev", + "phpstan/phpstan": "^0.6.4", + "phpunit/phpunit": "<6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Cake\\Chronos\\": "src" + }, + "files": [ + "src/carbon_compat.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "http://nesbot.com" + }, + { + "name": "The CakePHP Team", + "homepage": "http://cakephp.org" + } + ], + "description": "A simple API extension for DateTime.", + "homepage": "http://cakephp.org", + "keywords": [ + "date", + "datetime", + "time" + ], + "time": "2018-01-13 12:19:50" + }, + { + "name": "cakephp/migrations", + "version": "1.7.2", + "source": { + "type": "git", + "url": "https://github.com/cakephp/migrations.git", + "reference": "a5612adfd2efa8c90d29cb3b0c969de872a99eda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/migrations/zipball/a5612adfd2efa8c90d29cb3b0c969de872a99eda", + "reference": "a5612adfd2efa8c90d29cb3b0c969de872a99eda", + "shasum": "" + }, + "require": { + "cakephp/cache": "~3.2", + "cakephp/orm": "~3.2", + "php": ">=5.5.9", + "robmorgan/phinx": "0.8.1" + }, + "require-dev": { + "cakephp/bake": "@stable", + "cakephp/cakephp": "~3.2", + "cakephp/cakephp-codesniffer": "^3.0", + "phpunit/phpunit": "~4.1" + }, + "suggest": { + "cakephp/bake": "Required if you want to generate migrations." + }, + "type": "cakephp-plugin", + "autoload": { + "psr-4": { + "Migrations\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/migrations/graphs/contributors" + } + ], + "description": "Database Migration plugin for CakePHP 3.0 based on Phinx", + "homepage": "https://github.com/cakephp/migrations", + "keywords": [ + "cakephp", + "migrations" + ], + "time": "2017-12-12 21:01:38" + }, + { + "name": "cakephp/plugin-installer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/cakephp/plugin-installer.git", + "reference": "41373d0678490502f45adc7be88aa22d24ac1843" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/plugin-installer/zipball/41373d0678490502f45adc7be88aa22d24ac1843", + "reference": "41373d0678490502f45adc7be88aa22d24ac1843", + "shasum": "" + }, + "require-dev": { + "cakephp/cakephp-codesniffer": "dev-master", + "composer/composer": "1.0.*@dev", + "phpunit/phpunit": "^4.8|^5.7|^6.0" + }, + "type": "composer-installer", + "extra": { + "class": "Cake\\Composer\\Installer\\PluginInstaller" + }, + "autoload": { + "psr-4": { + "Cake\\Composer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "http://cakephp.org" + } + ], + "description": "A composer installer for CakePHP 3.0+ plugins.", + "time": "2017-12-24 21:09:29" + }, + { + "name": "microweber/screen", + "version": "v1.0.6", + "source": { + "type": "git", + "url": "https://github.com/microweber/screen.git", + "reference": "a7865099d2fbb8960052cfb408b4cbe463b31774" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/microweber/screen/zipball/a7865099d2fbb8960052cfb408b4cbe463b31774", + "reference": "a7865099d2fbb8960052cfb408b4cbe463b31774", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "symfony/var-dumper": "~3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Screen\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Peter Ivanov", + "email": "peter@microweber.com", + "homepage": "http://microweber.com" + }, + { + "name": "AndrĂ© Filipe", + "email": "andre.r.flip@gmail.com", + "homepage": "http://masnathan.com" + } + ], + "description": "A PHP Class to interact with PhantomJs and capture screenshot of a webpage", + "keywords": [ + "capture", + "phantomjs", + "print-screen", + "screen" + ], + "time": "2017-01-20 15:21:43" + }, + { + "name": "mobiledetect/mobiledetectlib", + "version": "2.8.31", + "source": { + "type": "git", + "url": "https://github.com/serbanghita/Mobile-Detect.git", + "reference": "adb882ea3b9d154f087ecb2c333180dad6f4dd37" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/adb882ea3b9d154f087ecb2c333180dad6f4dd37", + "reference": "adb882ea3b9d154f087ecb2c333180dad6f4dd37", + "shasum": "" + }, + "require": { + "php": ">=5.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.35||~5.7" + }, + "type": "library", + "autoload": { + "classmap": [ + "Mobile_Detect.php" + ], + "psr-0": { + "Detection": "namespaced/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Serban Ghita", + "email": "serbanghita@gmail.com", + "homepage": "http://mobiledetect.net", + "role": "Developer" + } + ], + "description": "Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.", + "homepage": "https://github.com/serbanghita/Mobile-Detect", + "keywords": [ + "detect mobile devices", + "mobile", + "mobile detect", + "mobile detector", + "php mobile detect" + ], + "time": "2018-02-26 19:39:55" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "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", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06 14:39:51" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "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", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10 12:19:37" + }, + { + "name": "robmorgan/phinx", + "version": "v0.8.1", + "source": { + "type": "git", + "url": "https://github.com/cakephp/phinx.git", + "reference": "7a19de5bebc59321edd9613bc2a667e7f96224ec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/phinx/zipball/7a19de5bebc59321edd9613bc2a667e7f96224ec", + "reference": "7a19de5bebc59321edd9613bc2a667e7f96224ec", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "symfony/config": "~2.8|~3.0", + "symfony/console": "~2.8|~3.0", + "symfony/yaml": "~2.8|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.26|^5.0" + }, + "bin": [ + "bin/phinx" + ], + "type": "library", + "autoload": { + "psr-4": { + "Phinx\\": "src/Phinx" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Woody Gilk", + "email": "woody.gilk@gmail.com", + "homepage": "http://shadowhand.me", + "role": "Developer" + }, + { + "name": "Rob Morgan", + "email": "robbym@gmail.com", + "homepage": "https://robmorgan.id.au", + "role": "Lead Developer" + }, + { + "name": "Richard Quadling", + "email": "rquadling@gmail.com", + "role": "Developer" + } + ], + "description": "Phinx makes it ridiculously easy to manage the database migrations for your PHP app.", + "homepage": "https://phinx.org", + "keywords": [ + "database", + "database migrations", + "db", + "migrations", + "phinx" + ], + "time": "2017-06-05 13:30:19" + }, + { + "name": "spatie/array-to-xml", + "version": "2.7.1", + "source": { + "type": "git", + "url": "https://github.com/spatie/array-to-xml.git", + "reference": "cb8befcd0c58ccf8baa5491e61a5c1d02a3acbba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/cb8befcd0c58ccf8baa5491e61a5c1d02a3acbba", + "reference": "cb8befcd0c58ccf8baa5491e61a5c1d02a3acbba", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.3", + "spatie/phpunit-snapshot-assertions": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\ArrayToXml\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://murze.be", + "role": "Developer" + } + ], + "description": "Convert an array to xml", + "homepage": "https://github.com/spatie/array-to-xml", + "keywords": [ + "array", + "convert", + "xml" + ], + "time": "2018-02-20 15:21:24" + }, + { + "name": "sunra/php-simple-html-dom-parser", + "version": "v1.5.2", + "source": { + "type": "git", + "url": "https://github.com/sunra/php-simple-html-dom-parser.git", + "reference": "75b9b1cb64502d8f8c04dc11b5906b969af247c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sunra/php-simple-html-dom-parser/zipball/75b9b1cb64502d8f8c04dc11b5906b969af247c6", + "reference": "75b9b1cb64502d8f8c04dc11b5906b969af247c6", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "Sunra\\PhpSimple\\HtmlDomParser": "Src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sunra", + "email": "sunra@yandex.ru", + "homepage": "https://github.com/sunra" + }, + { + "name": "S.C. Chen", + "homepage": "http://sourceforge.net/projects/simplehtmldom/" + } + ], + "description": "Composer adaptation of: A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way! Require PHP 5+. Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.", + "homepage": "https://github.com/sunra/php-simple-html-dom-parser", + "keywords": [ + "dom", + "html", + "parser" + ], + "time": "2016-11-22 22:57:47" + }, + { + "name": "symfony/config", + "version": "v3.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "7c2a9d44f4433863e9bca682e7f03609234657f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/7c2a9d44f4433863e9bca682e7f03609234657f9", + "reference": "7c2a9d44f4433863e9bca682e7f03609234657f9", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/filesystem": "~2.8|~3.0|~4.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.3", + "symfony/finder": "<3.3" + }, + "require-dev": { + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/event-dispatcher": "~3.3|~4.0", + "symfony/finder": "~3.3|~4.0", + "symfony/yaml": "~3.0|~4.0" + }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "https://symfony.com", + "time": "2018-03-19 22:32:39" + }, + { + "name": "symfony/console", + "version": "v3.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "d4bb70fa24d540c309d88a9d6e43fb2d339b1fbf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/d4bb70fa24d540c309d88a9d6e43fb2d339b1fbf", + "reference": "d4bb70fa24d540c309d88a9d6e43fb2d339b1fbf", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2018-04-03 05:22:50" + }, + { + "name": "symfony/debug", + "version": "v4.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "5961d02d48828671f5d8a7805e06579d692f6ede" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/5961d02d48828671f5d8a7805e06579d692f6ede", + "reference": "5961d02d48828671f5d8a7805e06579d692f6ede", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": "<3.4" + }, + "require-dev": { + "symfony/http-kernel": "~3.4|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2018-04-03 05:24:00" + }, + { + "name": "symfony/filesystem", + "version": "v4.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "5d2d655b2c72fc4d9bf7e9bf14f72a447b940f21" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/5d2d655b2c72fc4d9bf7e9bf14f72a447b940f21", + "reference": "5d2d655b2c72fc4d9bf7e9bf14f72a447b940f21", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2018-02-22 10:50:29" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-01-30 19:27:44" + }, + { + "name": "symfony/yaml", + "version": "v3.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "a42f9da85c7c38d59f5e53f076fe81a091f894d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a42f9da85c7c38d59f5e53f076fe81a091f894d0", + "reference": "a42f9da85c7c38d59f5e53f076fe81a091f894d0", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2018-04-03 05:14:20" + }, + { + "name": "zendframework/zend-diactoros", + "version": "1.7.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-diactoros.git", + "reference": "bf26aff803a11c5cc8eb7c4878a702c403ec67f1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/bf26aff803a11c5cc8eb7c4878a702c403ec67f1", + "reference": "bf26aff803a11c5cc8eb7c4878a702c403ec67f1", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "psr/http-message": "^1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-dom": "*", + "ext-libxml": "*", + "phpunit/phpunit": "^5.7.16 || ^6.0.8", + "zendframework/zend-coding-standard": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.x-dev", + "dev-develop": "1.8.x-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Diactoros\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "description": "PSR HTTP Message implementations", + "homepage": "https://github.com/zendframework/zend-diactoros", + "keywords": [ + "http", + "psr", + "psr-7" + ], + "time": "2018-02-26 15:44:50" + } + ], + "packages-dev": [ + { + "name": "cakephp/bake", + "version": "1.2.14", + "source": { + "type": "git", + "url": "https://github.com/cakephp/bake.git", + "reference": "24ef0cc781b529a8566cce4ecaf3aeaa1f08efd4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/bake/zipball/24ef0cc781b529a8566cce4ecaf3aeaa1f08efd4", + "reference": "24ef0cc781b529a8566cce4ecaf3aeaa1f08efd4", + "shasum": "" + }, + "require": { + "cakephp/cakephp": ">=3.2.0 <4.0.0", + "cakephp/plugin-installer": "*", + "php": ">=5.5.9" + }, + "require-dev": { + "cakephp/cakephp-codesniffer": "^2.1", + "phpunit/phpunit": "*" + }, + "type": "cakephp-plugin", + "autoload": { + "psr-4": { + "Bake\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/bake/graphs/contributors" + } + ], + "description": "Bake plugin for CakePHP 3.0", + "homepage": "https://github.com/cakephp/bake", + "keywords": [ + "bake", + "cakephp" + ], + "time": "2017-01-31 00:59:03" + }, + { + "name": "cakephp/debug_kit", + "version": "3.9.5", + "source": { + "type": "git", + "url": "https://github.com/cakephp/debug_kit.git", + "reference": "edc44b92260ebb6881c01fc40d271a9074b01a94" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/debug_kit/zipball/edc44b92260ebb6881c01fc40d271a9074b01a94", + "reference": "edc44b92260ebb6881c01fc40d271a9074b01a94", + "shasum": "" + }, + "require": { + "cakephp/cakephp": "^3.2.7", + "cakephp/chronos": "^1.0.0", + "cakephp/plugin-installer": "^1.0.0", + "composer/composer": "^1.3.0", + "jdorn/sql-formatter": "^1.2.0" + }, + "require-dev": { + "cakephp/cakephp-codesniffer": "^2.1.0", + "phpunit/phpunit": "<6.0" + }, + "suggest": { + "ext-sqlite": "DebugKit needs to store panel data in a database. SQLite is simple and easy to use." + }, + "type": "cakephp-plugin", + "autoload": { + "psr-4": { + "DebugKit\\": "src", + "DebugKit\\Test\\Fixture\\": "tests\\Fixture" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Story", + "homepage": "http://mark-story.com", + "role": "Author" + }, + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/debug_kit/graphs/contributors" + } + ], + "description": "CakePHP Debug Kit", + "homepage": "https://github.com/cakephp/debug_kit", + "keywords": [ + "cakephp", + "debug", + "kit" + ], + "time": "2017-05-02 01:12:10" + }, + { + "name": "composer/ca-bundle", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/composer/ca-bundle.git", + "reference": "d2c0a83b7533d6912e8d516756ebd34f893e9169" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/d2c0a83b7533d6912e8d516756ebd34f893e9169", + "reference": "d2c0a83b7533d6912e8d516756ebd34f893e9169", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "ext-pcre": "*", + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5", + "psr/log": "^1.0", + "symfony/process": "^2.5 || ^3.0 || ^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\CaBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", + "keywords": [ + "cabundle", + "cacert", + "certificate", + "ssl", + "tls" + ], + "time": "2018-03-29 19:57:20" + }, + { + "name": "composer/composer", + "version": "1.6.3", + "source": { + "type": "git", + "url": "https://github.com/composer/composer.git", + "reference": "88a69fda0f2187ad8714cedffd7a8872dceaa4c2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/composer/zipball/88a69fda0f2187ad8714cedffd7a8872dceaa4c2", + "reference": "88a69fda0f2187ad8714cedffd7a8872dceaa4c2", + "shasum": "" + }, + "require": { + "composer/ca-bundle": "^1.0", + "composer/semver": "^1.0", + "composer/spdx-licenses": "^1.2", + "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", + "php": "^5.3.2 || ^7.0", + "psr/log": "^1.0", + "seld/cli-prompt": "^1.0", + "seld/jsonlint": "^1.4", + "seld/phar-utils": "^1.0", + "symfony/console": "^2.7 || ^3.0 || ^4.0", + "symfony/filesystem": "^2.7 || ^3.0 || ^4.0", + "symfony/finder": "^2.7 || ^3.0 || ^4.0", + "symfony/process": "^2.7 || ^3.0 || ^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7", + "phpunit/phpunit-mock-objects": "^2.3 || ^3.0" + }, + "suggest": { + "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", + "ext-zip": "Enabling the zip extension allows you to unzip archives", + "ext-zlib": "Allow gzip compression of HTTP requests" + }, + "bin": [ + "bin/composer" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\": "src/Composer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.", + "homepage": "https://getcomposer.org/", + "keywords": [ + "autoload", + "dependency", + "package" + ], + "time": "2018-01-31 15:28:18" + }, + { + "name": "composer/semver", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2016-08-30 16:08:34" + }, + { + "name": "composer/spdx-licenses", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/composer/spdx-licenses.git", + "reference": "7e111c50db92fa2ced140f5ba23b4e261bc77a30" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/7e111c50db92fa2ced140f5ba23b4e261bc77a30", + "reference": "7e111c50db92fa2ced140f5ba23b4e261bc77a30", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Spdx\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "SPDX licenses list and validation library.", + "keywords": [ + "license", + "spdx", + "validator" + ], + "time": "2018-01-31 13:17:27" + }, + { + "name": "dnoegel/php-xdg-base-dir", + "version": "0.1", + "source": { + "type": "git", + "url": "https://github.com/dnoegel/php-xdg-base-dir.git", + "reference": "265b8593498b997dc2d31e75b89f053b5cc9621a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/265b8593498b997dc2d31e75b89f053b5cc9621a", + "reference": "265b8593498b997dc2d31e75b89f053b5cc9621a", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "@stable" + }, + "type": "project", + "autoload": { + "psr-4": { + "XdgBaseDir\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "implementation of xdg base directory specification for php", + "time": "2014-10-24 07:27:01" + }, + { + "name": "jakub-onderka/php-console-color", + "version": "0.1", + "source": { + "type": "git", + "url": "https://github.com/JakubOnderka/PHP-Console-Color.git", + "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1", + "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "jakub-onderka/php-code-style": "1.0", + "jakub-onderka/php-parallel-lint": "0.*", + "jakub-onderka/php-var-dump-check": "0.*", + "phpunit/phpunit": "3.7.*", + "squizlabs/php_codesniffer": "1.*" + }, + "type": "library", + "autoload": { + "psr-0": { + "JakubOnderka\\PhpConsoleColor": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "jakub.onderka@gmail.com", + "homepage": "http://www.acci.cz" + } + ], + "time": "2014-04-08 15:00:19" + }, + { + "name": "jakub-onderka/php-console-highlighter", + "version": "v0.3.2", + "source": { + "type": "git", + "url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git", + "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/7daa75df45242c8d5b75a22c00a201e7954e4fb5", + "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5", + "shasum": "" + }, + "require": { + "jakub-onderka/php-console-color": "~0.1", + "php": ">=5.3.0" + }, + "require-dev": { + "jakub-onderka/php-code-style": "~1.0", + "jakub-onderka/php-parallel-lint": "~0.5", + "jakub-onderka/php-var-dump-check": "~0.1", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~1.5" + }, + "type": "library", + "autoload": { + "psr-0": { + "JakubOnderka\\PhpConsoleHighlighter": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "acci@acci.cz", + "homepage": "http://www.acci.cz/" + } + ], + "time": "2015-04-20 18:58:01" + }, + { + "name": "jdorn/sql-formatter", + "version": "v1.2.17", + "source": { + "type": "git", + "url": "https://github.com/jdorn/sql-formatter.git", + "reference": "64990d96e0959dff8e059dfcdc1af130728d92bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jdorn/sql-formatter/zipball/64990d96e0959dff8e059dfcdc1af130728d92bc", + "reference": "64990d96e0959dff8e059dfcdc1af130728d92bc", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "lib" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeremy Dorn", + "email": "jeremy@jeremydorn.com", + "homepage": "http://jeremydorn.com/" + } + ], + "description": "a PHP SQL highlighting library", + "homepage": "https://github.com/jdorn/sql-formatter/", + "keywords": [ + "highlight", + "sql" + ], + "time": "2014-01-12 16:20:24" + }, + { + "name": "justinrainbow/json-schema", + "version": "5.2.7", + "source": { + "type": "git", + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "8560d4314577199ba51bf2032f02cd1315587c23" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/8560d4314577199ba51bf2032f02cd1315587c23", + "reference": "8560d4314577199ba51bf2032f02cd1315587c23", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.1", + "json-schema/json-schema-test-suite": "1.2.0", + "phpunit/phpunit": "^4.8.35" + }, + "bin": [ + "bin/validate-json" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" + }, + { + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" + } + ], + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", + "keywords": [ + "json", + "schema" + ], + "time": "2018-02-14 22:26:30" + }, + { + "name": "nikic/php-parser", + "version": "v3.1.5", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2018-02-28 20:30:58" + }, + { + "name": "psy/psysh", + "version": "v0.8.18", + "source": { + "type": "git", + "url": "https://github.com/bobthecow/psysh.git", + "reference": "5357b1cffc8fb375d6a9e3c86d5c82dd38a40834" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/5357b1cffc8fb375d6a9e3c86d5c82dd38a40834", + "reference": "5357b1cffc8fb375d6a9e3c86d5c82dd38a40834", + "shasum": "" + }, + "require": { + "dnoegel/php-xdg-base-dir": "0.1", + "jakub-onderka/php-console-highlighter": "0.3.*", + "nikic/php-parser": "~1.3|~2.0|~3.0", + "php": ">=5.3.9", + "symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0", + "symfony/var-dumper": "~2.7|~3.0|~4.0" + }, + "require-dev": { + "hoa/console": "~3.16|~1.14", + "phpunit/phpunit": "^4.8.35|^5.4.3", + "symfony/finder": "~2.1|~3.0|~4.0" + }, + "suggest": { + "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", + "ext-pdo-sqlite": "The doc command requires SQLite to work.", + "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", + "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.", + "hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit." + }, + "bin": [ + "bin/psysh" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.8.x-dev" + } + }, + "autoload": { + "files": [ + "src/Psy/functions.php" + ], + "psr-4": { + "Psy\\": "src/Psy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Hileman", + "email": "justin@justinhileman.info", + "homepage": "http://justinhileman.com" + } + ], + "description": "An interactive shell for modern PHP.", + "homepage": "http://psysh.org", + "keywords": [ + "REPL", + "console", + "interactive", + "shell" + ], + "time": "2018-04-02 05:41:44" + }, + { + "name": "seld/cli-prompt", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/cli-prompt.git", + "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/a19a7376a4689d4d94cab66ab4f3c816019ba8dd", + "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Seld\\CliPrompt\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type", + "keywords": [ + "cli", + "console", + "hidden", + "input", + "prompt" + ], + "time": "2017-03-18 11:32:45" + }, + { + "name": "seld/jsonlint", + "version": "1.7.1", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/jsonlint.git", + "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/d15f59a67ff805a44c50ea0516d2341740f81a38", + "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "bin": [ + "bin/jsonlint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Seld\\JsonLint\\": "src/Seld/JsonLint/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "JSON Linter", + "keywords": [ + "json", + "linter", + "parser", + "validator" + ], + "time": "2018-01-24 12:46:19" + }, + { + "name": "seld/phar-utils", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/phar-utils.git", + "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/7009b5139491975ef6486545a39f3e6dad5ac30a", + "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Seld\\PharUtils\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "PHAR file format utilities, for when PHP phars you up", + "keywords": [ + "phra" + ], + "time": "2015-10-13 18:44:15" + }, + { + "name": "symfony/finder", + "version": "v4.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "ca27c02b7a3fef4828c998c2ff9ba7aae1641c49" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/ca27c02b7a3fef4828c998c2ff9ba7aae1641c49", + "reference": "ca27c02b7a3fef4828c998c2ff9ba7aae1641c49", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2018-04-04 05:10:37" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "8eca20c8a369e069d4f4c2ac9895144112867422" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/8eca20c8a369e069d4f4c2ac9895144112867422", + "reference": "8eca20c8a369e069d4f4c2ac9895144112867422", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2018-01-31 17:43:24" + }, + { + "name": "symfony/process", + "version": "v4.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "d7dc1ee5dfe9f732cb1bba7310f5b99f2b7a6d25" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/d7dc1ee5dfe9f732cb1bba7310f5b99f2b7a6d25", + "reference": "d7dc1ee5dfe9f732cb1bba7310f5b99f2b7a6d25", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2018-04-03 05:24:00" + }, + { + "name": "symfony/var-dumper", + "version": "v4.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "e1b4d008100f4d203cc38b0d793ad6252d8d8af0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/e1b4d008100f4d203cc38b0d793ad6252d8d8af0", + "reference": "e1b4d008100f4d203cc38b0d793ad6252d8d8af0", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.5" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" + }, + "require-dev": { + "ext-iconv": "*", + "twig/twig": "~1.34|~2.4" + }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony mechanism for exploring and dumping PHP variables", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "time": "2018-04-04 05:10:37" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "psy/psysh": 0 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.5.9" + }, + "platform-dev": [] +} diff --git a/config/app.default.php b/config/app.default.php new file mode 100644 index 0000000..c06599e --- /dev/null +++ b/config/app.default.php @@ -0,0 +1,346 @@ + filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN), + + /** + * Configure basic information about the application. + * + * - namespace - The namespace to find app classes under. + * - defaultLocale - The default locale for translation, formatting currencies and numbers, date and time. + * - encoding - The encoding used for HTML + database connections. + * - base - The base directory the app resides in. If false this + * will be auto detected. + * - dir - Name of app directory. + * - webroot - The webroot directory. + * - wwwRoot - The file path to webroot. + * - baseUrl - To configure CakePHP to *not* use mod_rewrite and to + * use CakePHP pretty URLs, remove these .htaccess + * files: + * /.htaccess + * /webroot/.htaccess + * And uncomment the baseUrl key below. + * - fullBaseUrl - A base URL to use for absolute links. + * - imageBaseUrl - Web path to the public images directory under webroot. + * - cssBaseUrl - Web path to the public css directory under webroot. + * - jsBaseUrl - Web path to the public js directory under webroot. + * - paths - Configure paths for non class based resources. Supports the + * `plugins`, `templates`, `locales` subkeys, which allow the definition of + * paths for plugins, view templates and locale files respectively. + */ + 'App' => [ + 'namespace' => 'App', + 'encoding' => env('APP_ENCODING', 'UTF-8'), + 'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_US'), + 'base' => false, + 'dir' => 'src', + 'webroot' => 'webroot', + 'wwwRoot' => WWW_ROOT, + // 'baseUrl' => env('SCRIPT_NAME'), + 'fullBaseUrl' => false, + 'imageBaseUrl' => 'img/', + 'cssBaseUrl' => 'css/', + 'jsBaseUrl' => 'js/', + 'paths' => [ + 'plugins' => [ROOT . DS . 'plugins' . DS], + 'templates' => [APP . 'Template' . DS], + 'locales' => [APP . 'Locale' . DS], + ], + ], + + /** + * Security and encryption configuration + * + * - salt - A random string used in security hashing methods. + * The salt value is also used as the encryption key. + * You should treat it as extremely sensitive data. + */ + 'Security' => [ + 'salt' => env('SECURITY_SALT', '__SALT__'), + ], + + /** + * Apply timestamps with the last modified time to static assets (js, css, images). + * Will append a querystring parameter containing the time the file was modified. + * This is useful for busting browser caches. + * + * Set to true to apply timestamps when debug is true. Set to 'force' to always + * enable timestamping regardless of debug value. + */ + 'Asset' => [ + // 'timestamp' => true, + ], + + /** + * Configure the cache adapters. + */ + 'Cache' => [ + 'default' => [ + 'className' => 'File', + 'path' => CACHE, + 'url' => env('CACHE_DEFAULT_URL', null), + ], + + /** + * Configure the cache used for general framework caching. + * Translation cache files are stored with this configuration. + * Duration will be set to '+2 minutes' in bootstrap.php when debug = true + * If you set 'className' => 'Null' core cache will be disabled. + */ + '_cake_core_' => [ + 'className' => 'File', + 'prefix' => 'myapp_cake_core_', + 'path' => CACHE . 'persistent/', + 'serialize' => true, + 'duration' => '+1 years', + 'url' => env('CACHE_CAKECORE_URL', null), + ], + + /** + * Configure the cache for model and datasource caches. This cache + * configuration is used to store schema descriptions, and table listings + * in connections. + * Duration will be set to '+2 minutes' in bootstrap.php when debug = true + */ + '_cake_model_' => [ + 'className' => 'File', + 'prefix' => 'myapp_cake_model_', + 'path' => CACHE . 'models/', + 'serialize' => true, + 'duration' => '+1 years', + 'url' => env('CACHE_CAKEMODEL_URL', null), + ], + ], + + /** + * Configure the Error and Exception handlers used by your application. + * + * By default errors are displayed using Debugger, when debug is true and logged + * by Cake\Log\Log when debug is false. + * + * In CLI environments exceptions will be printed to stderr with a backtrace. + * In web environments an HTML page will be displayed for the exception. + * With debug true, framework errors like Missing Controller will be displayed. + * When debug is false, framework errors will be coerced into generic HTTP errors. + * + * Options: + * + * - `errorLevel` - int - The level of errors you are interested in capturing. + * - `trace` - boolean - Whether or not backtraces should be included in + * logged errors/exceptions. + * - `log` - boolean - Whether or not you want exceptions logged. + * - `exceptionRenderer` - string - The class responsible for rendering + * uncaught exceptions. If you choose a custom class you should place + * the file for that class in src/Error. This class needs to implement a + * render method. + * - `skipLog` - array - List of exceptions to skip for logging. Exceptions that + * extend one of the listed exceptions will also be skipped for logging. + * E.g.: + * `'skipLog' => ['Cake\Network\Exception\NotFoundException', 'Cake\Network\Exception\UnauthorizedException']` + * - `extraFatalErrorMemory` - int - The number of megabytes to increase + * the memory limit by when a fatal error is encountered. This allows + * breathing room to complete logging or error handling. + */ + 'Error' => [ + 'errorLevel' => E_ALL, + 'exceptionRenderer' => 'Cake\Error\ExceptionRenderer', + 'skipLog' => [], + 'log' => true, + 'trace' => true, + ], + + /** + * Email configuration. + * + * By defining transports separately from delivery profiles you can easily + * re-use transport configuration across multiple profiles. + * + * You can specify multiple configurations for production, development and + * testing. + * + * Each transport needs a `className`. Valid options are as follows: + * + * Mail - Send using PHP mail function + * Smtp - Send using SMTP + * Debug - Do not send the email, just return the result + * + * You can add custom transports (or override existing transports) by adding the + * appropriate file to src/Mailer/Transport. Transports should be named + * 'YourTransport.php', where 'Your' is the name of the transport. + */ + 'EmailTransport' => [ + 'default' => [ + 'className' => 'Mail', + // The following keys are used in SMTP transports + 'host' => 'localhost', + 'port' => 25, + 'timeout' => 30, + 'username' => 'user', + 'password' => 'secret', + 'client' => null, + 'tls' => null, + 'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null), + ], + ], + + /** + * Email delivery profiles + * + * Delivery profiles allow you to predefine various properties about email + * messages from your application and give the settings a name. This saves + * duplication across your application and makes maintenance and development + * easier. Each profile accepts a number of keys. See `Cake\Mailer\Email` + * for more information. + */ + 'Email' => [ + 'default' => [ + 'transport' => 'default', + 'from' => 'you@localhost', + //'charset' => 'utf-8', + //'headerCharset' => 'utf-8', + ], + ], + + /** + * Connection information used by the ORM to connect + * to your application's datastores. + * Do not use periods in database name - it may lead to error. + * See https://github.com/cakephp/cakephp/issues/6471 for details. + * Drivers include Mysql Postgres Sqlite Sqlserver + * See vendor\cakephp\cakephp\src\Database\Driver for complete list + */ + 'Datasources' => [ + 'default' => [ + 'className' => 'Cake\Database\Connection', + 'driver' => 'Cake\Database\Driver\Mysql', + 'persistent' => false, + 'host' => 'localhost', + /** + * CakePHP will use the default DB port based on the driver selected + * MySQL on MAMP uses port 8889, MAMP users will want to uncomment + * the following line and set the port accordingly + */ + //'port' => 'non_standard_port_number', + 'username' => 'my_app', + 'password' => 'secret', + 'database' => 'my_app', + 'encoding' => 'utf8', + 'timezone' => 'UTC', + 'flags' => [], + 'cacheMetadata' => true, + 'log' => false, + + /** + * Set identifier quoting to true if you are using reserved words or + * special characters in your table or column names. Enabling this + * setting will result in queries built using the Query Builder having + * identifiers quoted when creating SQL. It should be noted that this + * decreases performance because each query needs to be traversed and + * manipulated before being executed. + */ + 'quoteIdentifiers' => false, + + /** + * During development, if using MySQL < 5.6, uncommenting the + * following line could boost the speed at which schema metadata is + * fetched from the database. It can also be set directly with the + * mysql configuration directive 'innodb_stats_on_metadata = 0' + * which is the recommended value in production environments + */ + //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], + + 'url' => env('DATABASE_URL', null), + ], + + /** + * The test connection is used during the test suite. + */ + 'test' => [ + 'className' => 'Cake\Database\Connection', + 'driver' => 'Cake\Database\Driver\Mysql', + 'persistent' => false, + 'host' => 'localhost', + //'port' => 'non_standard_port_number', + 'username' => 'my_app', + 'password' => 'secret', + 'database' => 'test_myapp', + 'encoding' => 'utf8', + 'timezone' => 'UTC', + 'cacheMetadata' => true, + 'quoteIdentifiers' => false, + 'log' => false, + //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], + 'url' => env('DATABASE_TEST_URL', null), + ], + ], + + /** + * Configures logging options + */ + 'Log' => [ + 'debug' => [ + 'className' => 'Cake\Log\Engine\FileLog', + 'path' => LOGS, + 'file' => 'debug', + 'levels' => ['notice', 'info', 'debug'], + 'url' => env('LOG_DEBUG_URL', null), + ], + 'error' => [ + 'className' => 'Cake\Log\Engine\FileLog', + 'path' => LOGS, + 'file' => 'error', + 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'], + 'url' => env('LOG_ERROR_URL', null), + ], + ], + + /** + * Session configuration. + * + * Contains an array of settings to use for session configuration. The + * `defaults` key is used to define a default preset to use for sessions, any + * settings declared here will override the settings of the default config. + * + * ## Options + * + * - `cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'. + * - `cookiePath` - The url path for which session cookie is set. Maps to the + * `session.cookie_path` php.ini config. Defaults to base path of app. + * - `timeout` - The time in minutes the session should be valid for. + * Pass 0 to disable checking timeout. + * Please note that php.ini's session.gc_maxlifetime must be equal to or greater + * than the largest Session['timeout'] in all served websites for it to have the + * desired effect. + * - `defaults` - The default configuration set to use as a basis for your session. + * There are four built-in options: php, cake, cache, database. + * - `handler` - Can be used to enable a custom session handler. Expects an + * array with at least the `engine` key, being the name of the Session engine + * class to use for managing the session. CakePHP bundles the `CacheSession` + * and `DatabaseSession` engines. + * - `ini` - An associative array of additional ini values to set. + * + * The built-in `defaults` options are: + * + * - 'php' - Uses settings defined in your php.ini. + * - 'cake' - Saves session files in CakePHP's /tmp directory. + * - 'database' - Uses CakePHP's database sessions. + * - 'cache' - Use the Cache class to save sessions. + * + * To define a custom session handler, save it at src/Network/Session/.php. + * Make sure the class implements PHP's `SessionHandlerInterface` and set + * Session.handler to + * + * To use database sessions, load the SQL file located at config/Schema/sessions.sql + */ + 'Session' => [ + 'defaults' => 'php', + ], +]; diff --git a/config/bootstrap.php b/config/bootstrap.php new file mode 100644 index 0000000..c2b8b5d --- /dev/null +++ b/config/bootstrap.php @@ -0,0 +1,227 @@ +getMessage() . "\n"); +} + +/* + * Load an environment local configuration file. + * You can use a file like app_local.php to provide local overrides to your + * shared configuration. + */ +//Configure::load('app_local', 'default'); + +/* + * When debug = true the metadata cache should only last + * for a short time. + */ +if (Configure::read('debug')) { + Configure::write('Cache._cake_model_.duration', '+2 minutes'); + Configure::write('Cache._cake_core_.duration', '+2 minutes'); +} + +/* + * Set server timezone to UTC. You can change it to another timezone of your + * choice but using UTC makes time calculations / conversions easier. + */ +date_default_timezone_set('UTC'); + +/* + * Configure the mbstring extension to use the correct encoding. + */ +mb_internal_encoding(Configure::read('App.encoding')); + +/* + * Set the default locale. This controls how dates, number and currency is + * formatted and sets the default language to use for translations. + */ +ini_set('intl.default_locale', Configure::read('App.defaultLocale')); + +/* + * Register application error and exception handlers. + */ +$isCli = PHP_SAPI === 'cli'; +if ($isCli) { + (new ConsoleErrorHandler(Configure::read('Error')))->register(); +} else { + (new ErrorHandler(Configure::read('Error')))->register(); +} + +/* + * Include the CLI bootstrap overrides. + */ +if ($isCli) { + require __DIR__ . '/bootstrap_cli.php'; +} + +/* + * Set the full base URL. + * This URL is used as the base of all absolute links. + * + * If you define fullBaseUrl in your config file you can remove this. + */ +if (!Configure::read('App.fullBaseUrl')) { + $s = null; + if (env('HTTPS')) { + $s = 's'; + } + + $httpHost = env('HTTP_HOST'); + if (isset($httpHost)) { + Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost); + } + unset($httpHost, $s); +} + +Cache::config(Configure::consume('Cache')); +ConnectionManager::config(Configure::consume('Datasources')); +Email::configTransport(Configure::consume('EmailTransport')); +Email::config(Configure::consume('Email')); +Log::config(Configure::consume('Log')); +Security::salt(Configure::consume('Security.salt')); + +/* + * The default crypto extension in 3.0 is OpenSSL. + * If you are migrating from 2.x uncomment this code to + * use a more compatible Mcrypt based implementation + */ +//Security::engine(new \Cake\Utility\Crypto\Mcrypt()); + +/* + * Setup detectors for mobile and tablet. + */ +Request::addDetector('mobile', function ($request) { + $detector = new \Detection\MobileDetect(); + + return $detector->isMobile(); +}); +Request::addDetector('tablet', function ($request) { + $detector = new \Detection\MobileDetect(); + + return $detector->isTablet(); +}); + +/* + * Enable immutable time objects in the ORM. + * + * You can enable default locale format parsing by adding calls + * to `useLocaleParser()`. This enables the automatic conversion of + * locale specific date formats. For details see + * @link http://book.cakephp.org/3.0/en/core-libraries/internationalization-and-localization.html#parsing-localized-datetime-data + */ +Type::build('time') + ->useImmutable(); +Type::build('date') + ->useImmutable(); +Type::build('datetime') + ->useImmutable(); +Type::build('timestamp') + ->useImmutable(); + +/* + * Custom Inflector rules, can be set to correctly pluralize or singularize + * table, model, controller names or whatever other string is passed to the + * inflection functions. + */ +//Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']); +//Inflector::rules('irregular', ['red' => 'redlings']); +//Inflector::rules('uninflected', ['dontinflectme']); +//Inflector::rules('transliteration', ['/Ă¥/' => 'aa']); + +/* + * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call + * Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more + * advanced ways of loading plugins + * + * Plugin::loadAll(); // Loads all plugins at once + * Plugin::load('Migrations'); //Loads a single plugin named Migrations + * + */ + +/* + * Only try to load DebugKit in development mode + * Debug Kit should not be installed on a production system + */ +if (Configure::read('debug')) { + Plugin::load('DebugKit', ['bootstrap' => true]); +} + +//Plugin::load('AsdCurl', ['autoload' => true]); +Plugin::load('AsdCurl', ['autoload' => true, 'bootstrap' => true, 'routes' => true]); diff --git a/config/bootstrap_cli.php b/config/bootstrap_cli.php new file mode 100644 index 0000000..f822a55 --- /dev/null +++ b/config/bootstrap_cli.php @@ -0,0 +1,38 @@ +connect('/', ['controller' => 'curls', 'action' => 'usStatistik']); + //$routes->connect('/', ['controller' => 'examinations', 'action' => 'index']); + + /** + * ...and connect the rest of 'Pages' controller's URLs. + */ + $routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']); + + /** + * Connect catchall routes for all controllers. + * + * Using the argument `DashedRoute`, the `fallbacks` method is a shortcut for + * `$routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'DashedRoute']);` + * `$routes->connect('/:controller/:action/*', [], ['routeClass' => 'DashedRoute']);` + * + * Any route class can be used with this method, such as: + * - DashedRoute + * - InflectedRoute + * - Route + * - Or your own route class + * + * You can remove these routes once you've connected the + * routes you want in your application. + */ + $routes->fallbacks(DashedRoute::class); +}); + +/** + * Load all plugin routes. See the Plugin documentation on + * how to customize the loading of plugin routes. + */ +Plugin::routes(); diff --git a/config/schema/i18n.sql b/config/schema/i18n.sql new file mode 100644 index 0000000..47cf171 --- /dev/null +++ b/config/schema/i18n.sql @@ -0,0 +1,18 @@ +# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) +# +# Licensed under The MIT License +# For full copyright and license information, please see the LICENSE.txt +# Redistributions of files must retain the above copyright notice. +# MIT License (http://www.opensource.org/licenses/mit-license.php) + +CREATE TABLE i18n ( + id int NOT NULL auto_increment, + locale varchar(6) NOT NULL, + model varchar(255) NOT NULL, + foreign_key int(10) NOT NULL, + field varchar(255) NOT NULL, + content text, + PRIMARY KEY (id), + UNIQUE INDEX I18N_LOCALE_FIELD(locale, model, foreign_key, field), + INDEX I18N_FIELD(model, foreign_key, field) +); diff --git a/config/schema/sessions.sql b/config/schema/sessions.sql new file mode 100644 index 0000000..b5a5276 --- /dev/null +++ b/config/schema/sessions.sql @@ -0,0 +1,13 @@ +# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) +# +# Licensed under The MIT License +# For full copyright and license information, please see the LICENSE.txt +# Redistributions of files must retain the above copyright notice. +# MIT License (http://www.opensource.org/licenses/mit-license.php) + +CREATE TABLE sessions ( + id char(40) NOT NULL, + data text, + expires INT(11) NOT NULL, + PRIMARY KEY (id) +); diff --git a/index.php b/index.php new file mode 100644 index 0000000..fc5e39c --- /dev/null +++ b/index.php @@ -0,0 +1,16 @@ + + + + + + file:/W:/asd-control/src/Template/Monitorings/viva.ctp + file:/W:/asd-control/src/Controller/Component/ToolsComponent.php + file:/W:/asd-control/src/Controller/MonitoringsController.php + + + diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..81af1ee --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,7 @@ +include.path=${php.global.include.path} +php.version=PHP_70 +source.encoding=UTF-8 +src.dir=. +tags.asp=false +tags.short=false +web.root=webroot diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..ad96a5c --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,9 @@ + + + org.netbeans.modules.php.project + + + asd-control + + + diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..77c784b --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,40 @@ + + + + + + + + + + + ./tests/TestCase + + + + + + + + + + + + + + + + + ./src/ + ./plugins/*/src/ + + + diff --git a/plugins/AsdCurl/README.md b/plugins/AsdCurl/README.md new file mode 100644 index 0000000..7eeedb4 --- /dev/null +++ b/plugins/AsdCurl/README.md @@ -0,0 +1,11 @@ +# AsdCurl plugin for CakePHP + +## Installation + +You can install this plugin into your CakePHP application using [composer](http://getcomposer.org). + +The recommended way to install composer packages is: + +``` +composer require your-name-here/AsdCurl +``` diff --git a/plugins/AsdCurl/composer.json b/plugins/AsdCurl/composer.json new file mode 100644 index 0000000..6fcb743 --- /dev/null +++ b/plugins/AsdCurl/composer.json @@ -0,0 +1,23 @@ +{ + "name": "your-name-here/AsdCurl", + "description": "AsdCurl plugin for CakePHP", + "type": "cakephp-plugin", + "require": { + "php": ">=5.5.9", + "cakephp/cakephp": ">=3.3.2 <4.0.0" + }, + "require-dev": { + "phpunit/phpunit": "*" + }, + "autoload": { + "psr-4": { + "AsdCurl\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "AsdCurl\\Test\\": "tests", + "Cake\\Test\\": "./vendor/cakephp/cakephp/tests" + } + } +} diff --git a/plugins/AsdCurl/config/bootstrap.php b/plugins/AsdCurl/config/bootstrap.php new file mode 100644 index 0000000..266b8cc --- /dev/null +++ b/plugins/AsdCurl/config/bootstrap.php @@ -0,0 +1,32 @@ +getMessage() . "\n"); +} + +define('SCHULPORTAL_BASE0_URL', "https://portal.schulen.bayern.de"); +define('SCHULPORTAL_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig2d1dfad4a11c25e42c462e53b4721e48/uniquesig0'); +define('SCHULPORTAL_ASD_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesigc3ba1685059aaf325d44099df697a0a635e79a4ec36ec614a98f3bf4b79d7c043ac3880605b7751df91d11233380ad86/uniquesig0/asd'); +//define('SCHULPORTAL_MSTR_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig9adaec6129c81dbeb2f42638bc9f27ac0c442a10891f0c915c9d7f0c371a00b3/uniquesig1/asd'); +define('SCHULPORTAL_MSTR_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig182e937bef9540ecffb7e0ba167caaea052491068bd93a46e70dbd73bf9f8963/uniquesig1/asd'); + + +Configure::write('AsdCurl.proxy','10.1.248.1:82'); +Configure::write('AsdCurl.cookiejar', '/tmp/cookies.txt'); +Configure::write('AsdCurl.cookiefile', '/tmp/cookies.txt'); +Configure::write('AsdCurl.cookie', 'cookiename=cookievalue'); +Configure::write('AsdCurl.useragent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0'); +Configure::write('AsdCurl.cert','/var/www/html/ssl_KM_Z2016_asd.trinkl.pem'); +Configure::write('AsdCurl.schulbase0url',SCHULPORTAL_BASE0_URL); +Configure::write('AsdCurl.schulbaseurl',SCHULPORTAL_BASE_URL); +Configure::write('AsdCurl.asdbaseurl',SCHULPORTAL_ASD_BASE_URL); +Configure::write('AsdCurl.mstrbaseurl',SCHULPORTAL_MSTR_BASE_URL); + +?> + diff --git a/plugins/AsdCurl/config/routes.php b/plugins/AsdCurl/config/routes.php new file mode 100644 index 0000000..eb1c262 --- /dev/null +++ b/plugins/AsdCurl/config/routes.php @@ -0,0 +1,12 @@ + '/asd-curl'], + function (RouteBuilder $routes) { + $routes->fallbacks(DashedRoute::class); + } +); diff --git a/plugins/AsdCurl/phpunit.xml.dist b/plugins/AsdCurl/phpunit.xml.dist new file mode 100644 index 0000000..a50c2eb --- /dev/null +++ b/plugins/AsdCurl/phpunit.xml.dist @@ -0,0 +1,43 @@ + + + + + + + + + + + ./tests/TestCase + + + + + + + + + + + + + + + + ./vendor/ + ./vendor/ + + ./tests/ + ./tests/ + + + + diff --git a/plugins/AsdCurl/src/AsdCurl.php b/plugins/AsdCurl/src/AsdCurl.php new file mode 100644 index 0000000..6848477 --- /dev/null +++ b/plugins/AsdCurl/src/AsdCurl.php @@ -0,0 +1,193 @@ +status = false; + $this->error = false; + $this->html = ''; + $this->message = ''; + } + + public function init_curl_params() + { + $ch = curl_init(); + curl_setopt($ch, CURLOPT_PROXY, Configure::read('AsdCurl.proxy')); + curl_setopt($ch, CURLOPT_USERAGENT, Configure::read('AsdCurl.useragent')); + curl_setopt($ch, CURLOPT_HEADER, false); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_COOKIESESSION, true); + curl_setopt($ch, CURLOPT_COOKIEJAR, Configure::read('AsdCurl.cookiejar')); + curl_setopt($ch, CURLOPT_COOKIEFILE, Configure::read('AsdCurl.cookiefile')); + curl_setopt($ch, CURLOPT_COOKIE, Configure::read('AsdCurl.cookie')); + curl_setopt($ch, CURLOPT_SSLCERT, Configure::read('AsdCurl.cert')); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + return ($ch); + } + + public function get_string_between($string, $start, $end) + { + //debug($start); + //debug($end); + $string = " " . $string; + $ini = strpos($string, $start); + //debug($ini); + //debug($string);die; + if ($ini == 0) { + return ""; + } + + $ini += strlen($start); + $len = strpos($string, $end, $ini) - $ini; + $sub = substr($string, $ini, $len); + $elem = explode(' ', $sub)[0]; + return str_replace('"', '', $elem); + } + + public function exec_curl($ch, $url, $post) + { + if ($post == false) { + curl_setopt($ch, CURLOPT_POST, 0); + curl_setopt($ch, CURLOPT_HTTPHEADER, array()); + } else { + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded')); + } + curl_setopt($ch, CURLOPT_URL, $url); + $this->html = curl_exec($ch); + //debug(curl_errno($ch)); + //debug(curl_getinfo($ch, CURLINFO_HTTP_CODE)); + if (curl_errno($ch)) { + $this->status = false; + $this->error = 'Couldn\'t send request: ' . curl_error($ch); + } else { + $resultStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); + if ($resultStatus != 200) { + $this->status = false; + $this->error = 'Request failed: HTTP status code: ' . $resultStatus; + } + } + } + + public function login_asd($ch) + { + $SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl'); + $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asddv/dv_xy_00.jsf', false); + if(!($this->status)) { + die($this->error); + } + $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + + $login_data = [ + 'asd_username' => 'A005_TrinklW', + 'asd_password' => 'HiegTzs!12', + ]; + $post = [ + 'login:username' => $login_data['asd_username'], + 'login:password' => $login_data['asd_password'], + 'login' => 'login', + 'javax.faces.ViewState' => $viewstate, + 'login:loginButton' => 'login:loginButton', + ]; + $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/login/login.jsf', $post); + if(!($this->status)) { + die($this->error); + } + $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + Configure::write('Session', ['viewstate' => $viewstate]); + } + + public function login_mstr($ch) { + $SCHULPORTAL_MSTR_BASE_URL = Configure::read('AsdCurl.mstrbaseurl'); + $url = '/asp'; + //debug($SCHULPORTAL_MSTR_BASE_URL . $url);die; + $this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, false); + + //debug($this->html);die; + + $post = [ + 'Uid' => 'A005_TrinklW', + 'Pwd' => 'HiegTzs!12', + ]; + $pvar['ConnMode'] = $this->get_string_between($this->html, ''); + $pvar['3054'] = $this->get_string_between($this->html, ''); + $mstr_login_vars = array('evt', 'src', 'target', 'key', 'Port', 'Project', 'Server', 'login', 'smartBanner', 'lb'); + foreach ($mstr_login_vars as $var) { + $value = $this->get_string_between($this->html, 'name="' . $var . '" type="hidden" class="mstrHiddenInput" value="', '"/>'); + //$value = $this->get_string_between($this->html, 'name="' . $var . '" value=', 'type="hidden"'); + $pvar[$var] = $value; + } + + $post = array_merge($post, $pvar); + //debug($post);die; + $this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . '/asp/Main.aspx', $post); + if(strpos($this->html,'Login failure')) { + $this->status = false; + } + //debug($this->html);die; + } + + public function logout_mstr($ch) { + $SCHULPORTAL_MSTR_BASE_URL = Configure::read('AsdCurl.mstrbaseurl'); + $url = '/asp/Main.aspx'; + $post = [ + 'evt' => '3008', + 'src' => 'mstrWeb.3008', + 'xts' => exec('date +%s%3N'), + ]; + $this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, $post); + curl_close($ch); + } + + public function login_school($ch) + { + $SCHULPORTAL_BASE0_URL = Configure::read('AsdCurl.schulbase0url'); + $SCHULPORTAL_BASE_URL = Configure::read('AsdCurl.schulbaseurl'); + //$login_data = $this->request->session()->read('data'); + + $this->exec_curl($ch, $SCHULPORTAL_BASE_URL, false); + if(!($this->status)) { + die($this->error); + } + $login_data = [ + 'portal_username' => 'asd.trinkl', + 'portal_password' => 'HiegTzs!182', + ]; + + $post = [ + 'user_name' => $login_data['portal_username'], + 'password' => $login_data['portal_password'], + 'repository' => 'schulen.bayern.de', + 'site_name' => 'schulportal', + 'secure' => '1', + 'resource_id' => '2', + 'login_type' => '2', + ]; + // Anmeldeformular fuer das Schulportal abschicken - Step 2 + + $this->exec_curl($ch, $SCHULPORTAL_BASE_URL . '/InternalSite/Validate.asp', $post); + if(!($this->status)) { + die($this->error); + } + } + + public function exec_mstr($ch, $url, $post) + { + $SCHULPORTAL_MSTR_BASE_URL = Configure::read('AsdCurl.mstrbaseurl'); + $html = $this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, $post); + return ($html); + } +} diff --git a/plugins/AsdCurl/src/AsdMstr.php b/plugins/AsdCurl/src/AsdMstr.php new file mode 100644 index 0000000..12ae8b0 --- /dev/null +++ b/plugins/AsdCurl/src/AsdMstr.php @@ -0,0 +1,120 @@ +status = true; + $this->error = false; + } + + public function send_mail($ch,$status,$message,$lastsuccess) { + date_default_timezone_set("Europe/Berlin"); + $datestring = date('d.m.Y H:i'); + $url = 'http://www.dr-trinkl.de/index.php'; +// 'to' => 'wilfried.trinkl@stmbw.bayern.de;philipp.knollmueller@stmbw.bayern.de;johannes.moesl@stmbw.bayern.de', + + $email_params=[ + 'to' => 'wilfried.trinkl@stmbw.bayern.de;philipp.knollmueller@stmbw.bayern.de;johannes.moesl@stmbw.bayern.de', + 'bcc' => 'wilfried.trinkl@mail-wt.de', + 'from_name' => 'MSTR Monitoring', + 'from' => 'wilfried.trinkl@mail-wt.de', + 'secret' => 'QuaTe4tbchwFx9mxptEr' + ]; + if($status == 'Fail') { + $email_content = [ + 'subject' => 'MSTR Failing ' . $datestring, + 'body' => '

MSTR geht WIEDER nicht! Bitte umgehend tätig werden

' . $message .'

', + ]; + } + else { + $email_content = [ + 'subject' => 'MSTR Up Again '. $datestring, + 'body' => '

MSTR geht WIEDER!

'. + '

MSTR Monitoring auf JIRA: http://lfstad-sv-kmjira.rz-sued.bayern.de:8080/browse/AS-2112

' . + '

|Prod|' . $lastsuccess . '|'. $datestring . ' |WiTr| Die Verbindung zum Server ist fehlgeschlagen. |unbekannt |

', + 'bodyplain' => 'MSTR geht WIEDER!', + ]; + } + $this->exec_curl($ch, $url, array_merge($email_params,$email_content)); + //debug($this->html); + } + + public function monit_mstr($ch) + { + $SCHULPORTAL_MSTR_BASE_URL = Configure::read('AsdCurl.mstrbaseurl'); + $reportID = '3F1FE53C4583613BABF14EA6242BACBE'; + // MSTR Bericht ausfĂ¼hren - Step 5 + + $htmlParser = new \DOMDocument(); //to parse html using DOMDocument + libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal + $htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml + $htmlParser->preserveWhiteSpace = false; + + $links = $htmlParser->getElementsByTagName('a'); + foreach ($links as $link) { + if ($link->nodeValue == 'Amtliche Schulstatistik') { + $params = explode('&', $link->getAttribute('href')); + foreach ($params as $param) { + $parts = explode('=', $param); + $lp[$parts[0]] = $parts[1]; + } + } + } + //debug($this->html); + //debug($lp); + if (!isset($lp)) { + $this->status = false; + $this->error = 'Project missing'; + } else { + $url = '/asp/Main.aspx?evt=3010&src=' . $lp['src'] . '&ServerAlias=' . $lp['ServerAlias'] . '&Port=' . $lp['Port'] . '&Project=' . $lp['Project'] . '&Server=' . $lp['Server'] . '&loginReq=true'; + //debug($SCHULPORTAL_MSTR_BASE_URL . $url);die; + $this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, false); + + //$url = '/asp/Main.aspx?evt=4001&src=Main.aspx.4001&visMode=0&reportViewMode=1&reportID=' . $reportID . '&Server=' . $lp['ServerAlias'] . '&Project=PROD-1.46.1&Port=0&share=1'; + //debug($url);die; + $url = '/asp/Main.aspx?evt=3067&src=Main.aspx.3067&reportViewMode=1&reportID=' . $reportID; + $this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, false); + + //debug($this->html); + + sleep(20); + + $post = array(); + $pvar = array(); + $mstr_result_vars = array('evt', 'src', 'reportViewMode', 'reportID', 'fastExport', 'rsfb', 'rb', 'directExport'); + foreach ($mstr_result_vars as $var) { + $value = $this->get_string_between($this->html, 'name="' . $var . '" type="hidden" class="mstrHiddenInput" value=', '"/>'); + $pvar[$var] = $value; + } + $post = array_merge($post, $pvar); + $action = $this->get_string_between($this->html, 'FORM ACTION="Main.aspx', '" ID="printForm"'); + $url = '/asp/Main.aspx' . $action; + //debug($post); + //debug($url);die; + $this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, $post); + + //debug($this->html); + + $post = array(); + $pvar = array(); + $mstr_down_vars = array('evt', 'src', 'SaveReportProperties', 'rb'); + foreach ($mstr_down_vars as $var) { + $value = $this->get_string_between($this->html, 'name="' . $var . '" type="hidden" class="mstrHiddenInput" value=', '"/>'); + $pvar[$var] = $value; + } + $post = array_merge($post, $pvar); + $action = $this->get_string_between($this->html, 'FORM ACTION="', '" ID="printForm"'); + $url = '/asp/' . $action; + //debug($post); + //debug($url); + $this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, $post); + //debug($this->html); + } + } +} diff --git a/plugins/AsdCurl/src/AsdUs.php b/plugins/AsdCurl/src/AsdUs.php new file mode 100644 index 0000000..65b572b --- /dev/null +++ b/plugins/AsdCurl/src/AsdUs.php @@ -0,0 +1,480 @@ +status = true; + $this->error = false; + } + + public function save_us_data($ch) { + $SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl'); + // Maske US 01 01 vom linken MenĂ¼ aufrufen + $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); + $post = [ + 'sideMenu' => 'sideMenu', + 'javax.faces.ViewState' => $viewstate, + 'sideMenu:j_idt51:0:j_idt57:1:j_idt59' => 'sideMenu:j_idt51:0:j_idt57:1:j_idt59', + ]; + $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_00_00.jsf?cid=' . $conversationId, $post); + if(!($this->status)) { + die($this->error); + } + // In Maske US 01 01 alle Felder leer lassen und "Suchen" ausfĂ¼hren + $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); + $post = [ + 'mainForm' => 'mainForm', + 'referenzBaumAnzeigen' => 'false', + 'conversationId' => $conversationId, + 'changeNotification' => 'false', + 'mainForm:hasChanged' => 'false', + 'mainForm:hasNotReleased' => 'false', + 'mainForm:hasPopUpChanged' => 'false', + 'mainForm:hasAdresseChanged' => 'false', + 'mainForm:confirmedOverride' => 'false', + 'mainForm:zuordnungNotification' => 'false', + 'skipvalidation' => 'false', + 'mainForm:istAnzeigeMaske' => 'false', + 'mainForm:dienststelle_schluessel' => '', + 'mainForm:dienststelle_nameoffiziell' => '', + 'mainForm:dienststelle_dst_wl_dsttyp_id_uebe' => 'EMPTY:0', + 'mainForm:dienststelle_plzstrasse' => '', + 'mainForm:dienststelle_ort' => '', + 'mainForm:dienststelle_sat_kurz_bezeichnung' => 'EMPTY:0', + 'mainForm:dienststelle_bdg_kurz_bezeichnung' => 'EMPTY:0', + 'mainForm:dienststelle_wl_kurz_bezeichnung' => 'EMPTY:0', + 'mainForm:dienststelle_dst_wl_regierung_id_u' => 'EMPTY:0', + 'mainForm:dienststelle_dst_wl_schulamt_id' => 'EMPTY:0', + 'mainForm:dienststelle_referent' => '', + 'mainForm:dienststelle_dst_wl_mb_bezirk_id_u' => 'EMPTY:0', + 'mainForm:dienststelle_status' => 'EMPTY:0', + 'mainForm:dienststelle_sortierung' => 'com.hp.asd.domain.tech.PersProperty:7', + 'mainForm:action_suchen' => 'Suchen', + 'javax.faces.ViewState' => $viewstate, + ]; + $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_01.jsf?cid=' . $conversationId, $post); + if(!($this->status)) { + die($this->error); + } + // Auf der Ergebnisseite auf "Alle" Klicken + $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); + //$mainform = $this->get_string_between($this->html, '\\\':\\\'', '\\\'},\\\'\\\')\');return false\" class=\"ignoreChangeNotification notBold\">ALLE'); + //debug($mainform);die; + $post = [ + 'mainForm' => 'mainForm', + 'referenzBaumAnzeigen' => 'false', + 'conversationId' => $conversationId, + 'changeNotification' => 'false', + 'mainForm:hasChanged' => 'false', + 'mainForm:hasNotReleased' => 'false', + 'mainForm:hasPopUpChanged' => 'false', + 'mainForm:hasAdresseChanged' => 'false', + 'mainForm:confirmedOverride' => 'false', + 'mainForm:zuordnungNotification' => 'false', + 'skipvalidation' => 'true', + 'mainForm:istAnzeigeMaske' => 'false', + 'javax.faces.ViewState' => $viewstate, + 'mainForm:j_idt189' => 'mainForm:j_idt189', + ]; + $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_02.jsf?cid=' . $conversationId, $post); + if(!($this->status)) { + die($this->error); + } + // Ergebnisse parsen und in die MySQL - Datenbank schreiben + $htmlParser = new \DOMDocument(); //to parse html using DOMDocument + libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal + $htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml + $htmlParser->preserveWhiteSpace = false; + + $table = $htmlParser->getElementById('mainForm:resultTable'); + //debug($table); + $rel = [ + 'sname' => 0, + 'snr' => 1, + 'commune' => 2, + 'state' => 5, + 'delivery' => 6 + ]; + $rows = $table->getElementsByTagName('tr'); + $i = 0; + foreach ($rows as $row) { + //debug('Hallo'); + if ($i > 0) { + $cols = $row->getElementsByTagName('td'); + foreach($rel as $key => $value) { + if ($key == 'delivery') { + $time = Time::createFromFormat('d.m.Y, H:i:s', $cols->item($value)->nodeValue, 'UTC'); + $data[$i][$key] = $time; + } + else { + $data[$i][$key] = $cols->item($value)->nodeValue; + } + } + } + $i++; + } + + //debug($data); + $usdates = TableRegistry::get('Usdates'); + $usdates->deleteAll('id' > 0); + $entities = $usdates->newEntities($data); + $result = $usdates->saveMany($entities); + if(!($result)) { + debug($entities);die; + } + + } + + public function save_up_data($ch) { + $SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl'); + // Maske US 01 01 vom linken MenĂ¼ aufrufen + $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); + $post = [ + 'sideMenu' => 'sideMenu', + 'javax.faces.ViewState' => $viewstate, + 'sideMenu:j_idt52:0:j_idt58:1:j_idt60' => 'sideMenu:j_idt52:0:j_idt58:1:j_idt60', + ]; + $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdup/up_18_01.jsf?cid=' . $conversationId, $post); + if(!($this->status)) { + die($this->error); + } + // In Maske US 01 01 alle Felder leer lassen und "Suchen" ausfĂ¼hren + $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); + $post = [ + 'mainForm' => 'mainForm', + 'referenzBaumAnzeigen' => 'false', + 'conversationId' => $conversationId, + 'changeNotification' => 'false', + 'mainForm:hasChanged' => 'false', + 'mainForm:hasNotReleased' => 'false', + 'mainForm:hasPopUpChanged' => 'false', + 'mainForm:hasAdresseChanged' => 'false', + 'mainForm:confirmedOverride' => 'false', + 'mainForm:zuordnungNotification' => 'false', + 'skipvalidation' => 'false', + 'mainForm:istAnzeigeMaske' => 'false', + 'mainForm:dienststelle_schluessel' => '', + 'mainForm:dienststelle_nameoffiziell' => '', + 'mainForm:dienststelle_dst_wl_dsttyp_id_uebe' => 'EMPTY:0', + 'mainForm:dienststelle_plzstrasse' => '', + 'mainForm:dienststelle_ort' => '', + 'mainForm:dienststelle_sat_kurz_bezeichnung' => 'EMPTY:0', + 'mainForm:dienststelle_bdg_kurz_bezeichnung' => 'EMPTY:0', + 'mainForm:dienststelle_wl_kurz_bezeichnung' => 'EMPTY:0', + 'mainForm:dienststelle_dst_wl_regierung_id_u' => 'EMPTY:0', + 'mainForm:dienststelle_dst_wl_schulamt_id' => 'EMPTY:0', + 'mainForm:dienststelle_referent' => '', + 'mainForm:dienststelle_dst_wl_mb_bezirk_id_u' => 'EMPTY:0', + 'mainForm:dienststelle_status' => 'EMPTY:0', + 'mainForm:dienststelle_sortierung' => 'com.hp.asd.domain.tech.PersProperty:7', + 'mainForm:action_suchen' => 'Suchen', + 'javax.faces.ViewState' => $viewstate, + ]; + $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdup/up_03_01.jsf?cid=' . $conversationId, $post); + if(!($this->status)) { + die($this->error); + } + // Auf der Ergebnisseite auf "Alle" Klicken + $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); + //$mainform = $this->get_string_between($this->html, '\\\':\\\'', '\\\'},\\\'\\\')\');return false\" class=\"ignoreChangeNotification notBold\">ALLE'); + //debug($mainform);die; + $post = [ + 'mainForm' => 'mainForm', + 'referenzBaumAnzeigen' => 'false', + 'conversationId' => $conversationId, + 'changeNotification' => 'false', + 'mainForm:hasChanged' => 'false', + 'mainForm:hasNotReleased' => 'false', + 'mainForm:hasPopUpChanged' => 'false', + 'mainForm:hasAdresseChanged' => 'false', + 'mainForm:confirmedOverride' => 'false', + 'mainForm:zuordnungNotification' => 'false', + 'skipvalidation' => 'true', + 'mainForm:istAnzeigeMaske' => 'false', + 'javax.faces.ViewState' => $viewstate, + 'mainForm:j_idt189' => 'mainForm:j_idt189', + ]; + $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdup/up_03_02.jsf?cid=' . $conversationId, $post); + if(!($this->status)) { + die($this->error); + } + //echo $this->html;die; + // Ergebnisse parsen und in die MySQL - Datenbank schreiben + $htmlParser = new \DOMDocument(); //to parse html using DOMDocument + libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal + $htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml + $htmlParser->preserveWhiteSpace = false; + + $table = $htmlParser->getElementById('mainForm:resultTable'); + //debug($table); + $rel = [ + 'sname' => 1, + 'snr' => 2, + 'commune' => 3, + 'state' => 6, + 'delivery' => 7 + ]; + $rows = $table->getElementsByTagName('tr'); + $i = 0; + foreach ($rows as $row) { + //debug('Hallo'); + //debug($row); + if ($i > 0) { + $cols = $row->getElementsByTagName('td'); + foreach($rel as $key => $value) { + //debug($key); + //debug($value); + if ($key == 'delivery') { + //debug($cols->item($value)->nodeValue); + $time = Time::createFromFormat('d.m.Y, H:i:s', $cols->item($value)->nodeValue, 'UTC'); + $data[$i][$key] = $time; + } + else { + $data[$i][$key] = $cols->item($value)->nodeValue; + } + } + } + $i++; + } + + //debug($data); + $usdates = TableRegistry::get('Usdates'); + $usdates->deleteAll('id' > 0); + $entities = $usdates->newEntities($data); + $result = $usdates->saveMany($entities); + if(!($result)) { + debug($entities);die; + } + + } + + public function get_us_statistic($ch) + { + $SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl'); + $viewstate = Configure::read('Session.viewstate'); + //debug($viewstate);die; + $schularten = array( + 'Gymnasium' => '747', + 'Grundsch.sow.Mittelschule' => '742', + 'Realschule' => '745', + 'Abendrealschule' => '752', + 'Realschule z. sp. F.' => '746', + 'Schulartunabhängige Orientierungsstufe' => '749', + 'Integrierte Gesamtschule' => '750', + ); + $output = array(); + foreach ($schularten as $sakey => $savalue) { + $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_03_01.jsf', false); + if(!($this->status)) { + die($this->error); + } + $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); + $post = [ + 'mainForm' => 'mainForm', + 'referenzBaumAnzeigen' => 'false', + 'conversationId' => $conversationId, + 'changeNotification' => 'false', + 'mainForm:hasChanged' => 'false', + 'mainForm:hasNotReleased' => 'false', + 'mainForm:hasPopUpChanged' => 'false', + 'mainForm:hasAdresseChanged' => 'false', + 'mainForm:confirmedOverride' => 'false', + 'mainForm:zuordnungNotification' => 'false', + 'skipvalidation' => 'false', + 'mainForm:istAnzeigMaske' => 'false', + 'mainForm:dienststellenName' => '', + 'mainForm:schulart' => '', + 'mainForm:teilnehmendeGesamt' => '', + 'mainForm:nichtAbgegebenKeinLv' => '', + 'mainForm:nichtAbgegebenLv' => '', + 'mainForm:vollstaendigMitPlFehler' => '', + 'mainForm:vollstaendigOhnePlFehler' => '', + 'mainForm:abgegeben=&' => '', + 'mainForm:abgelehnt' => '', + 'mainForm:freigegeben' => '', + 'mainForm:us_03_01_popup_selectSchulart' => 'com.hp.asd.wl.domain.standard.SchulartRechtlich:' . $savalue, + 'mainForm:popup_ok' => 'Ok', + 'javax.faces.ViewState' => $viewstate, + ]; + + $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_03_01.jsf?cid=' . $conversationId, $post); + if(!($this->status)) { + die($this->error); + } + $htmlParser = new \DOMDocument(); //to parse html using DOMDocument + libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal + //debug($this->html);die; + $htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml + $htmlParser->preserveWhiteSpace = false; + $fields = array( + 'Teilnehmende Schulen insgesamt' => 'mainForm:teilnehmendeGesamt', + 'Schulen nicht Ă¼bermittelt (kein Lieferversuch)' => 'mainForm:nichtAbgegebenKeinLv', + 'Schulen nicht Ă¼bermittelt (Lieferversuch)' => 'mainForm:nichtAbgegebenLv', + 'Schulen Ă¼bermittelt (PL-Fehler)' => 'mainForm:vollstaendigMitPlFehler', + 'Schulen Ă¼bermittelt (keine PL-Fehler)' => 'mainForm:vollstaendigOhnePlFehler', + 'Schulen abgegeben' => 'mainForm:abgegeben', + 'Schulen von Schulaufsicht abgelehnt' => 'mainForm:abgelehnt', + 'Schulen von Schulaufsicht freigegeben' => 'mainForm:freigegeben'); + + foreach ($fields as $key => $field) { + $output[$sakey][$key] = $htmlParser->getElementById($field)->getAttribute('value'); + } + } + + // staatliche Gymnasien + $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); + $post = [ + 'sideMenu' => 'sideMenu', + 'javax.faces.ViewState' => $viewstate, + 'sideMenu:j_idt51:0:j_idt57:1:j_idt59' => 'sideMenu:j_idt51:0:j_idt57:1:j_idt59', + ]; + $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_03_01.jsf?cid=' . $conversationId, $post); + if(!($this->status)) { + die($this->error); + } + $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); + $post = [ + 'mainForm' => 'mainForm', + 'referenzBaumAnzeigen' => 'false', + 'conversationId' => $conversationId, + 'changeNotification' => 'false', + 'mainForm:hasChanged' => 'false', + 'mainForm:hasNotReleased' => 'false', + 'mainForm:hasPopUpChanged' => 'false', + 'mainForm:hasAdresseChanged' => 'false', + 'mainForm:confirmedOverride' => 'false', + 'mainForm:zuordnungNotification' => 'false', + 'skipvalidation' => 'false', + 'mainForm:istAnzeigeMaske' => 'false', + 'mainForm:dienststelle_schluessel' => '', + 'mainForm:dienststelle_nameoffiziell' => '', + 'mainForm:dienststelle_dst_wl_dsttyp_id_uebe' => 'com.hp.asd.wl.domain.standard.Dienststellentyp:1671', + 'mainForm:dienststelle_plzstrasse' => '', + 'mainForm:dienststelle_ort' => '', + 'mainForm:dienststelle_sat_kurz_bezeichnung' => 'com.hp.asd.wl.domain.standard.SchulartRechtlich:747', + 'mainForm:dienststelle_bdg_kurz_bezeichnung' => 'EMPTY:0', + 'mainForm:dienststelle_wl_kurz_bezeichnung' => 'EMPTY:0', + 'mainForm:dienststelle_dst_wl_regierung_id_u' => 'EMPTY:0', + 'mainForm:dienststelle_dst_wl_schulamt_id' => 'EMPTY:0', + 'mainForm:dienststelle_referent' => '', + 'mainForm:dienststelle_dst_wl_mb_bezirk_id_u' => 'EMPTY:0', + 'mainForm:dienststelle_status' => 'EMPTY:0', + 'mainForm:dienststelle_sortierung' => 'com.hp.asd.domain.tech.PersProperty:7', + 'mainForm:action_suchen' => 'Suchen', + 'javax.faces.ViewState' => $viewstate, + ]; + $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_01.jsf?cid=' . $conversationId, $post); + if(!($this->status)) { + die($this->error); + } + $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); + $post = [ + 'mainForm' => 'mainForm', + 'referenzBaumAnzeigen' => 'false', + 'conversationId' => $conversationId, + 'changeNotification' => 'false', + 'mainForm:hasChanged' => 'false', + 'mainForm:hasNotReleased' => 'false', + 'mainForm:hasPopUpChanged' => 'false', + 'mainForm:hasAdresseChanged' => 'false', + 'mainForm:confirmedOverride' => 'false', + 'mainForm:zuordnungNotification' => 'false', + 'skipvalidation' => 'true', + 'mainForm:istAnzeigeMaske' => 'false', + 'mainForm:resultTable:0:email' => '0252@schulen.bayern.de', + 'mainForm:resultTable:0:j_idt112' => 'on', + 'mainForm:resultTable:1:email' => '0282@schulen.bayern.de', + 'mainForm:resultTable:1:j_idt112' => 'on', + 'mainForm:resultTable:2:email' => '0180@schulen.bayern.de', + 'mainForm:resultTable:2:j_idt112' => 'on', + 'mainForm:resultTable:3:email' => '0072@schulen.bayern.de', + 'mainForm:resultTable:3:j_idt112' => 'on', + 'mainForm:resultTable:4:email' => '0151@schulen.bayern.de', + 'mainForm:resultTable:4:j_idt112' => 'on', + 'javax.faces.ViewState' => $viewstate, + 'mainForm:j_idt183' => 'mainForm:j_idt183', + ]; + $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_02.jsf?cid=' . $conversationId, $post); + if(!($this->status)) { + die($this->error); + } + $htmlParser = new \DOMDocument(); //to parse html using DOMDocument + libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal + $htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml + $htmlParser->preserveWhiteSpace = false; + + $table = $htmlParser->getElementById('mainForm:resultTable'); + //debug($table); + + $rows = $table->getElementsByTagName('tr'); + $i = 0; + foreach ($rows as $row) { + //debug('Hallo'); + if ($i > 0) { + $cols = $row->getElementsByTagName('td'); + $status[$i] = $cols->item(5)->nodeValue; + } + $i++; + } + $result = array_count_values($status); + + $output2['Staatliche Gymnasien']['Teilmende Schulen insgesamt'] = sizeof($status); + if (!isset($result['n. Ă¼berm. (kein Liefervers.)'])) { + $output2['Staatliche Gymnasien']['Schulen nicht Ă¼bermittelt (kein Lieferversuch)'] = 0; + } else { + $output2['Staatliche Gymnasien']['Schulen nicht Ă¼bermittelt (kein Lieferversuch)'] = $result['n. Ă¼berm. (kein Liefervers.)']; + } + if (!isset($result['n. Ă¼berm. (Lieferversuch)'])) { + $output2['Staatliche Gymnasien']['Schulen nicht Ă¼bermittelt (Lieferversuch)'] = 0; + } else { + $output2['Staatliche Gymnasien']['Schulen nicht Ă¼bermittelt (Lieferversuch)'] = $result['n. Ă¼berm. (Lieferversuch)']; + } + if (!isset($result['Ă¼bermittelt (PL-Fehler)'])) { + $output2['Staatliche Gymnasien']['Schulen Ă¼bermittelt (PL-Fehler)'] = 0; + } else { + $output2['Staatliche Gymnasien']['Schulen Ă¼bermittelt (PL-Fehler)'] = $result['Ă¼bermittelt (PL-Fehler)']; + } + if (!isset($result['Ă¼bermittelt (keine PL-Fehler)'])) { + $output2['Staatliche Gymnasien']['Schulen Ă¼bermittelt (keine PL-Fehler)'] = 0; + } else { + $output2['Staatliche Gymnasien']['Schulen Ă¼bermittelt (keine PL-Fehler)'] = $result['Ă¼bermittelt (keine PL-Fehler)']; + } + if (!isset($result['abgegeben'])) { + $output2['Staatliche Gymnasien']['Schulen abgegeben'] = 0; + } else { + $output2['Staatliche Gymnasien']['Schulen abgegeben'] = $result['abgegeben']; + } + if (!isset($result['Schulaufs. abgelehnt'])) { + $output2['Staatliche Gymnasien']['Schulen von Schulaufsicht abgelehnt'] = 0; + } else { + $output2['Staatliche Gymnasien']['Schulen von Schulaufsicht abgelehnt'] = $result['Schulaufs. abgelehnt']; + } + if (!isset($result['freigegeben'])) { + $output2['Staatliche Gymnasien']['Schulen von Schulaufsicht freigegeben'] = 0; + } else { + $output2['Staatliche Gymnasien']['Schulen von Schulaufsicht freigegeben'] = $result['freigegeben']; + } + + $output = array_merge($output2, $output); + return ($output); + } +} diff --git a/plugins/AsdCurl/src/Controller/AppController.php b/plugins/AsdCurl/src/Controller/AppController.php new file mode 100644 index 0000000..1f83865 --- /dev/null +++ b/plugins/AsdCurl/src/Controller/AppController.php @@ -0,0 +1,10 @@ +src = $url; + } + + public function __toString() + { + return $this->src; + } +} diff --git a/plugins/AsdCurl/webroot/empty b/plugins/AsdCurl/webroot/empty new file mode 100644 index 0000000..e69de29 diff --git a/src/Application.php b/src/Application.php new file mode 100644 index 0000000..3770fb6 --- /dev/null +++ b/src/Application.php @@ -0,0 +1,52 @@ +add(new ErrorHandlerMiddleware(Configure::read('Error.exceptionRenderer'))) + + // Handle plugin/theme assets like CakePHP normally does. + ->add(new AssetMiddleware()) + + // Apply routing + ->add(new RoutingMiddleware()); + + return $middleware; + } +} diff --git a/src/Console/Installer.php b/src/Console/Installer.php new file mode 100644 index 0000000..0756096 --- /dev/null +++ b/src/Console/Installer.php @@ -0,0 +1,195 @@ +getIO(); + + $rootDir = dirname(dirname(__DIR__)); + + static::createAppConfig($rootDir, $io); + static::createWritableDirectories($rootDir, $io); + + // ask if the permissions should be changed + if ($io->isInteractive()) { + $validator = function ($arg) { + if (in_array($arg, ['Y', 'y', 'N', 'n'])) { + return $arg; + } + throw new Exception('This is not a valid answer. Please choose Y or n.'); + }; + $setFolderPermissions = $io->askAndValidate( + 'Set Folder Permissions ? (Default to Y) [Y,n]? ', + $validator, + 10, + 'Y' + ); + + if (in_array($setFolderPermissions, ['Y', 'y'])) { + static::setFolderPermissions($rootDir, $io); + } + } else { + static::setFolderPermissions($rootDir, $io); + } + + static::setSecuritySalt($rootDir, $io); + + if (class_exists('\Cake\Codeception\Console\Installer')) { + \Cake\Codeception\Console\Installer::customizeCodeceptionBinary($event); + } + } + + /** + * Create the config/app.php file if it does not exist. + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @return void + */ + public static function createAppConfig($dir, $io) + { + $appConfig = $dir . '/config/app.php'; + $defaultConfig = $dir . '/config/app.default.php'; + if (!file_exists($appConfig)) { + copy($defaultConfig, $appConfig); + $io->write('Created `config/app.php` file'); + } + } + + /** + * Create the `logs` and `tmp` directories. + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @return void + */ + public static function createWritableDirectories($dir, $io) + { + $paths = [ + 'logs', + 'tmp', + 'tmp/cache', + 'tmp/cache/models', + 'tmp/cache/persistent', + 'tmp/cache/views', + 'tmp/sessions', + 'tmp/tests' + ]; + + foreach ($paths as $path) { + $path = $dir . '/' . $path; + if (!file_exists($path)) { + mkdir($path); + $io->write('Created `' . $path . '` directory'); + } + } + } + + /** + * Set globally writable permissions on the "tmp" and "logs" directory. + * + * This is not the most secure default, but it gets people up and running quickly. + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @return void + */ + public static function setFolderPermissions($dir, $io) + { + // Change the permissions on a path and output the results. + $changePerms = function ($path, $perms, $io) { + // Get permission bits from stat(2) result. + $currentPerms = fileperms($path) & 0777; + if (($currentPerms & $perms) == $perms) { + return; + } + + $res = chmod($path, $currentPerms | $perms); + if ($res) { + $io->write('Permissions set on ' . $path); + } else { + $io->write('Failed to set permissions on ' . $path); + } + }; + + $walker = function ($dir, $perms, $io) use (&$walker, $changePerms) { + $files = array_diff(scandir($dir), ['.', '..']); + foreach ($files as $file) { + $path = $dir . '/' . $file; + + if (!is_dir($path)) { + continue; + } + + $changePerms($path, $perms, $io); + $walker($path, $perms, $io); + } + }; + + $worldWritable = bindec('0000000111'); + $walker($dir . '/tmp', $worldWritable, $io); + $changePerms($dir . '/tmp', $worldWritable, $io); + $changePerms($dir . '/logs', $worldWritable, $io); + } + + /** + * Set the security.salt value in the application's config file. + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @return void + */ + public static function setSecuritySalt($dir, $io) + { + $config = $dir . '/config/app.php'; + $content = file_get_contents($config); + + $newKey = hash('sha256', Security::randomBytes(64)); + $content = str_replace('__SALT__', $newKey, $content, $count); + + if ($count == 0) { + $io->write('No Security.salt placeholder to replace.'); + + return; + } + + $result = file_put_contents($config, $content); + if ($result) { + $io->write('Updated Security.salt value in config/app.php'); + + return; + } + $io->write('Unable to update Security.salt value.'); + } +} diff --git a/src/Controller/ApimportsController.php b/src/Controller/ApimportsController.php new file mode 100644 index 0000000..c6e3c72 --- /dev/null +++ b/src/Controller/ApimportsController.php @@ -0,0 +1,109 @@ +paginate($this->Apimports); + + $this->set(compact('apimports')); + $this->set('_serialize', ['apimports']); + } + + /** + * View method + * + * @param string|null $id Apimport id. + * @return \Cake\Network\Response|null + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function view($id = null) + { + $apimport = $this->Apimports->get($id, [ + 'contain' => [] + ]); + + $this->set('apimport', $apimport); + $this->set('_serialize', ['apimport']); + } + + /** + * Add method + * + * @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise. + */ + public function add() + { + $apimport = $this->Apimports->newEntity(); + if ($this->request->is('post')) { + $apimport = $this->Apimports->patchEntity($apimport, $this->request->data); + if ($this->Apimports->save($apimport)) { + $this->Flash->success(__('The apimport has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The apimport could not be saved. Please, try again.')); + } + $this->set(compact('apimport')); + $this->set('_serialize', ['apimport']); + } + + /** + * Edit method + * + * @param string|null $id Apimport id. + * @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise. + * @throws \Cake\Network\Exception\NotFoundException When record not found. + */ + public function edit($id = null) + { + $apimport = $this->Apimports->get($id, [ + 'contain' => [] + ]); + if ($this->request->is(['patch', 'post', 'put'])) { + $apimport = $this->Apimports->patchEntity($apimport, $this->request->data); + if ($this->Apimports->save($apimport)) { + $this->Flash->success(__('The apimport has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The apimport could not be saved. Please, try again.')); + } + $this->set(compact('apimport')); + $this->set('_serialize', ['apimport']); + } + + /** + * Delete method + * + * @param string|null $id Apimport id. + * @return \Cake\Network\Response|null Redirects to index. + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function delete($id = null) + { + $this->request->allowMethod(['post', 'delete']); + $apimport = $this->Apimports->get($id); + if ($this->Apimports->delete($apimport)) { + $this->Flash->success(__('The apimport has been deleted.')); + } else { + $this->Flash->error(__('The apimport could not be deleted. Please, try again.')); + } + + return $this->redirect(['action' => 'index']); + } +} diff --git a/src/Controller/AppController.php b/src/Controller/AppController.php new file mode 100644 index 0000000..afd65cd --- /dev/null +++ b/src/Controller/AppController.php @@ -0,0 +1,69 @@ +loadComponent('Security');` + * + * @return void + */ + public function initialize() + { + parent::initialize(); + + $this->loadComponent('RequestHandler'); + $this->loadComponent('Flash'); + + /* + * Enable the following components for recommended CakePHP security settings. + * see http://book.cakephp.org/3.0/en/controllers/components/security.html + */ + //$this->loadComponent('Security'); + //$this->loadComponent('Csrf'); + } + + /** + * Before render callback. + * + * @param \Cake\Event\Event $event The beforeRender event. + * @return \Cake\Network\Response|null|void + */ + public function beforeRender(Event $event) + { + if (!array_key_exists('_serialize', $this->viewVars) && + in_array($this->response->type(), ['application/json', 'application/xml']) + ) { + $this->set('_serialize', true); + } + } +} diff --git a/src/Controller/ApresultsController.php b/src/Controller/ApresultsController.php new file mode 100644 index 0000000..7810ad9 --- /dev/null +++ b/src/Controller/ApresultsController.php @@ -0,0 +1,162 @@ +Apresults->find('all',array('fields' => $fields)); + $schools_array = json_decode(json_encode($schools), true); + $path = WWW_ROOT.'files/ap/export.csv'; + //debug($path); + + $file = fopen($path,"w"); + $title = true; + $columns = array(); + foreach($schools_array as $school) { + //debug(explode(',',$school)); + //die; + if ($title) { + foreach ($school as $key => $column) { + array_push($columns,$key); + } + fputcsv($file,$columns,';',' '); + $title = false; + } + //debug(date('Y-m-d H:i:s',strtotime($school['erzeugungsdatum']))); + //debug($school['erzeugungsdatum']); + if(!is_null($school['erzeugungsdatum'])) { + $school['erzeugungsdatum'] = date('Y-m-d H:i:s',strtotime($school['erzeugungsdatum'])); + //debug($school['erzeugungsdatum']); + } + //debug($school['erzeugungsdatum']); + //die; + fputcsv($file,$school,';',' '); + } + + fclose($file); + + $ftp_server = "10.190.22.35"; + $ftp_port = "2587"; + $ftp_user = "LfStaD-Log"; + $ftp_pass = "135!Log!086"; + $local_folder = '/test'; + + $conn_id = ftp_connect($ftp_server, $ftp_port) or die("Couldn't connect to $ftp_server"); + + if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) { + echo "Angemeldet als $ftp_user@$ftp_server\n"; + } else { + echo "Anmeldung als $ftp_user nicht möglich\n"; + } + + ftp_chdir($conn_id, 'ap-csv'); + + ftp_put($conn_id, 'export.csv', $path, FTP_BINARY); + + ftp_close($conn_id); + + } + + /** + * Index method + * + * @return \Cake\Network\Response|null + */ + public function index() + { + $apresults = $this->Apresults->find('all',array('conditions' => array('lieferstatus' => '1'))); + $this->set('apresults',$apresults); + } + + /** + * View method + * + * @param string|null $id Apresult id. + * @return \Cake\Network\Response|null + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function view($id = null) + { + $apresult = $this->Apresults->get($id, [ + 'contain' => [] + ]); + + $this->set('apresult', $apresult); + $this->set('_serialize', ['apresult']); + } + + /** + * Add method + * + * @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise. + */ + public function add() + { + $apresult = $this->Apresults->newEntity(); + if ($this->request->is('post')) { + $apresult = $this->Apresults->patchEntity($apresult, $this->request->data); + if ($this->Apresults->save($apresult)) { + $this->Flash->success(__('The apresult has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The apresult could not be saved. Please, try again.')); + } + $this->set(compact('apresult')); + $this->set('_serialize', ['apresult']); + } + + /** + * Edit method + * + * @param string|null $id Apresult id. + * @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise. + * @throws \Cake\Network\Exception\NotFoundException When record not found. + */ + public function edit($id = null) + { + $apresult = $this->Apresults->get($id, [ + 'contain' => [] + ]); + if ($this->request->is(['patch', 'post', 'put'])) { + $apresult = $this->Apresults->patchEntity($apresult, $this->request->data); + if ($this->Apresults->save($apresult)) { + $this->Flash->success(__('The apresult has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The apresult could not be saved. Please, try again.')); + } + $this->set(compact('apresult')); + $this->set('_serialize', ['apresult']); + } + + /** + * Delete method + * + * @param string|null $id Apresult id. + * @return \Cake\Network\Response|null Redirects to index. + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function delete($id = null) + { + $this->request->allowMethod(['post', 'delete']); + $apresult = $this->Apresults->get($id); + if ($this->Apresults->delete($apresult)) { + $this->Flash->success(__('The apresult has been deleted.')); + } else { + $this->Flash->error(__('The apresult could not be deleted. Please, try again.')); + } + + return $this->redirect(['action' => 'index']); + } +} diff --git a/src/Controller/Component/ToolsComponent.php b/src/Controller/Component/ToolsComponent.php new file mode 100644 index 0000000..0b3d352 --- /dev/null +++ b/src/Controller/Component/ToolsComponent.php @@ -0,0 +1,202 @@ +setClipWidth(1200); + $screenCapture->setClipHeight(800); + $screenCapture->setUserAgentString('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0'); + //$screenCapture->setOptions(array('proxy' => '10.1.248.1:82')); + $screenCapture->setOptions(array('proxy' => '10.1.248.1:82', + 'cookies-file' => '/tmp/cookies.txt', + 'ssl-client-certificate-file' => '/home/wilfried/phantomjs-2.1.1-linux-x86_64/clientcert.key', + 'ssl-certificates-path' => '/home/wilfried/phantomjs-2.1.1-linux-x86_64/certs/', + 'ignore-ssl-errors' => true, + 'ssl-client-key-passphrase' => '2pRaTkCSrw')); + $screenCapture->setImageType('png'); + $path = 'files/screen/test.' . $screenCapture->getImageType()->getFormat(); + $fileLocation = WWW_ROOT . $path; + debug($fileLocation); + $screenCapture->save($fileLocation); + return ($path); + } + + public function init_curl_params() + { + $cert_file = '/var/www/html/ssl_KM_Z2016_asd.trinkl.pem'; + $proxy = '10.1.248.1:82'; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_PROXY, $proxy); + curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0'); + curl_setopt($ch, CURLOPT_HEADER, false); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + //curl_setopt($ch, CURLOPT_NOBODY, TRUE); // remove body + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_COOKIESESSION, true); + curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt'); + curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt'); + curl_setopt($ch, CURLOPT_COOKIE, 'cookiename=cookievalue'); + curl_setopt($ch, CURLOPT_SSLCERT, $cert_file); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + + return ($ch); + } + + public function asd_curl($ch, $post, $header, $url) + { + + $SCHULPORTAL_ASD_BASE_URL = SCHULPORTAL_BASE0_URL . "/uniquesigc3ba1685059aaf325d44099df697a0a635e79a4ec36ec614a98f3bf4b79d7c043ac3880605b7751df91d11233380ad86/uniquesig0/asd"; + if (!empty($post)) { + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); + } else { + curl_setopt($ch, CURLOPT_POST, 0); + } + + curl_setopt($ch, CURLOPT_HTTPHEADER, $header); + + curl_setopt($ch, CURLOPT_URL, $SCHULPORTAL_ASD_BASE_URL . $url); + //debug($SCHULPORTAL_ASD_BASE_URL . $url); + $text = curl_exec($ch); + return ($text); + } + + public function asd_basic($text) + { + + $htmlParser = new \DOMDocument(); //to parse html using DOMDocument + libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal + $htmlParser->loadHTML($text); //Loaded the html string we took from simple xml + $htmlParser->preserveWhiteSpace = false; + + //$dienststellentable = $htmlParser->getElementById('mainForm:dienststellenTable'); + + $fields = array( + 'schulnummer' => 'mainForm:schulnummer', + 'schule' => 'mainForm:schule', + 'schulart' => 'mainForm:schulstellePlzStrasse'); + + foreach ($fields as $key => $field) { + $output['dienststellentable'][$key] = $htmlParser->getElementById($field)->getAttribute('value'); + } + $output['bemerkung'] = $htmlParser->getElementById('mainForm:erhebungsinformationskommentar')->textContent; + return ($output); + } + + public function asd_lk($text, $schooltype) + { + + $htmlParser = new \DOMDocument(); //to parse html using DOMDocument + libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal + $htmlParser->loadHTML($text); //Loaded the html string we took from simple xml + $htmlParser->preserveWhiteSpace = false; + + //debug($schooltype); + + if ($schooltype == 'gms') { + + //$lk_table = $htmlParser->getElementById('mainForm:resultTable:cfhf'); + $lk_table = $htmlParser->getElementById('mainForm:resultTable:tbtf'); + } else { + + $lk_table = $htmlParser->getElementById('mainForm:resultTable:tbtf'); + } + $rows = $lk_table->getElementsByTagName('tr'); + $t_heads1 = array('Name', 'LBef', 'AbwDst', 'UPZber', 'UPZSoll', 'StdIst', 'StdSoll', 'Diff'); + + $i = 0; + $teachers = ''; + foreach ($rows as $row) { + $cols = $row->getElementsByTagName('td'); + $j = 0; + foreach ($cols as $col) { + $spans = $col->getElementsByTagName('span'); + if ($spans->length > 1) { + $teachers[$i][$t_heads1[$j]] = $spans->item(0)->getAttribute('title'); + } else { + $teachers[$i][$t_heads1[$j]] = $spans->item(0)->nodeValue; + } + $j++; + } + $i++; + } + + $lk_table = $htmlParser->getElementById('mainForm:resultTable:tbtn'); + $rows = $lk_table->getElementsByTagName('tr'); + $t_heads2 = array('MM', 'MA', 'AZK', 'NT', 'RES', 'PF', 'ABO', 'AN', 'ER', 'ABW', 'FR', 'UNTwiss', 'UNTNwiss', 'EASwiss', 'EASnwiss', 'EASwiss', 'EASNwiss', 'Leer'); + + $i = 0; + foreach ($rows as $row) { + $cols = $row->getElementsByTagName('td'); + $j = 0; + foreach ($cols as $col) { + $spans = $col->getElementsByTagName('span'); + if ($spans->length > 1) { + $teachers[$i][$t_heads2[$j]] = $spans->item(0)->getAttribute('title'); + } elseif ($spans->length == 0) { + + } else { + $teachers[$i][$t_heads2[$j]] = $spans->item(0)->nodeValue; + } + $j++; + } + $i++; + } + $data['t_heads'] = array_merge($t_heads1, $t_heads2); + $data['teachers'] = $teachers; + //debug($data); + return ($data); + } + + public function asd_lf($text) + { + $htmlParser = new \DOMDocument(); //to parse html using DOMDocument + libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal + $htmlParser->loadHTML($text); //Loaded the html string we took from simple xml + $htmlParser->preserveWhiteSpace = false; + + $lf_table = $htmlParser->getElementById('leftTable'); + $rows = $lf_table->getElementsByTagName('tr'); + + $i = 0; + $lehrfach = ''; + foreach ($rows as $row) { + $atags = $row->getElementsByTagName('a'); + $lehrfach[$i]['Name'] = str_replace(array("\n", "\t", "\r"), '', $atags->item(0)->nodeValue); + $i++; + } + + $lf_table = $htmlParser->getElementById('lehrkapazitaetFach'); + + $rows = $lf_table->getElementsByTagName('tr'); + + $t_headslf = array('PKZ', 'ADB', 'RV', 'LB', 'UPZInd', 'UStdSoll', 'UStdIst', 'EinsatzBes', 'Fach1', 'Std1', 'Fach2', 'Std2', 'Fach3', 'Std3', 'Fach4', 'Std4', 'Weitere'); + + $i = 0; + + foreach ($rows as $row) { + $cols = $row->getElementsByTagName('td'); + $j = 0; + foreach ($cols as $col) { + $divs = $col->getElementsByTagName('div'); + $lehrfach[$i][$t_headslf[$j]] = $divs->item(0)->nodeValue; + $j++; + } + $i++; + } + $data['t_headslf'] = $t_headslf; + $data['lehrfach'] = $lehrfach; + return ($data); + } + +} diff --git a/src/Controller/Component/empty b/src/Controller/Component/empty new file mode 100644 index 0000000..e69de29 diff --git a/src/Controller/ConfigsController.php b/src/Controller/ConfigsController.php new file mode 100644 index 0000000..75aa597 --- /dev/null +++ b/src/Controller/ConfigsController.php @@ -0,0 +1,109 @@ +paginate($this->Configs); + + $this->set(compact('configs')); + $this->set('_serialize', ['configs']); + } + + /** + * View method + * + * @param string|null $id Config id. + * @return \Cake\Network\Response|null + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function view($id = null) + { + $config = $this->Configs->get($id, [ + 'contain' => [] + ]); + + $this->set('config', $config); + $this->set('_serialize', ['config']); + } + + /** + * Add method + * + * @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise. + */ + public function add() + { + $config = $this->Configs->newEntity(); + if ($this->request->is('post')) { + $config = $this->Configs->patchEntity($config, $this->request->data); + if ($this->Configs->save($config)) { + $this->Flash->success(__('The config has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The config could not be saved. Please, try again.')); + } + $this->set(compact('config')); + $this->set('_serialize', ['config']); + } + + /** + * Edit method + * + * @param string|null $id Config id. + * @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise. + * @throws \Cake\Network\Exception\NotFoundException When record not found. + */ + public function edit($id = null) + { + $config = $this->Configs->get($id, [ + 'contain' => [] + ]); + if ($this->request->is(['patch', 'post', 'put'])) { + $config = $this->Configs->patchEntity($config, $this->request->data); + if ($this->Configs->save($config)) { + $this->Flash->success(__('The config has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The config could not be saved. Please, try again.')); + } + $this->set(compact('config')); + $this->set('_serialize', ['config']); + } + + /** + * Delete method + * + * @param string|null $id Config id. + * @return \Cake\Network\Response|null Redirects to index. + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function delete($id = null) + { + $this->request->allowMethod(['post', 'delete']); + $config = $this->Configs->get($id); + if ($this->Configs->delete($config)) { + $this->Flash->success(__('The config has been deleted.')); + } else { + $this->Flash->error(__('The config could not be deleted. Please, try again.')); + } + + return $this->redirect(['action' => 'index']); + } +} diff --git a/src/Controller/CurlsController.php b/src/Controller/CurlsController.php new file mode 100644 index 0000000..896d672 --- /dev/null +++ b/src/Controller/CurlsController.php @@ -0,0 +1,189 @@ +loadModel('Monitorings'); + $curl = new AsdMstr(); + $ch = $curl->init_curl_params(); + $curl->login_school($ch); + $curl->login_mstr($ch); + $data['data'] = ''; + $result = ''; + if(!($curl->status)) { + $curl->message .= 'Login failed! ' . $curl->error; + } + else { + $curl->monit_mstr($ch); + if(!($curl->status)) { + $curl->message .= 'Report failed: ' . $curl->error; + } + else { + $data['data'] = json_encode($result); + $result = iconv($in_charset = 'UTF-16LE', $out_charset = 'UTF-8', $curl->html); + } + } + $curl->logout_mstr($ch); + + //Ergebnis in Datenbank speichern + $data['action'] = 'mstr'; + $data['school'] = ''; + $data['data'] = json_encode($result); + $now = Time::parse(); + $now->timezone = "Europe/Berlin"; + $data['date'] = $now; + if (strpos($result, 'MMIHG') !== false) { + $data['comment'] = 'Success'; + } else { + $data['comment'] = 'Fail'; + } + $data['message'] = $curl->message; + + $all = $this->Monitorings->find('all', array('conditions' => array('action' => 'mstr'), 'order' => array('id' => 'DESC'))); + $last = $all->first(); + + $monitoring = $this->Monitorings->newEntity(); + $monitoring = $this->Monitorings->patchEntity($monitoring, $data); + + if($last['comment'] != $monitoring['comment']) { + if($last['comment'] == 'Success') { + + $curl->send_mail($ch,'Fail',$curl->message, ''); + } + else { + $allsuccess = $this->Monitorings->find('all', array('conditions' => array('action' => 'mstr','comment' => 'Success'), 'order' => array('id' => 'DESC'))); + $lastsuccess = $allsuccess->first(); + $datestring = $lastsuccess['date']->i18nFormat('dd.MM.yyyy HH:mm'); + $curl->send_mail($ch,'Success',$curl->message, $datestring); + } + } + + $result_save = $this->Monitorings->save($monitoring); + + //$curl->send_mail($ch); + + $this->set('html', $result); + $this->viewBuilder()->layout('ajax'); + } + + public function saveus() { + $curl = new AsdUs(); + //debug($curl->status); + $ch = $curl->init_curl_params(); + $curl->login_school($ch); + $curl->login_asd($ch); + $curl->save_us_data($ch); + $this->set('html',$curl->html); + $this->redirect(['action' => 'getjsonus']); + } + + public function saveup() { + $curl = new AsdUs(); + //debug($curl->status); + $ch = $curl->init_curl_params(); + $curl->login_school($ch); + $curl->login_asd($ch); + $curl->save_up_data($ch); + $this->set('html',$curl->html); + $this->redirect(['action' => 'getjsonup']); + } + + + public function showus() { + $this->loadModel('Results'); + $results = $this->Results->find('all'); + $this->set('results',$results); + } + + public function getjsonus() { + echo 'Write Json data to file'; + $this->loadModel('Results'); + $results = $this->Results->find('all'); + $this->set('results',$results); + $file = new File('/var/www/html/asd-control/webroot/files/data-us.json', true, 0644); + $file->create(); + $status = $file->write(json_encode($results), 'w', true); + echo $status; + $file->close(); + $this->viewBuilder()->layout('getjson'); + } + + public function getjsonup() { + echo 'Write Json data to file'; + $this->loadModel('Results'); + $results = $this->Results->find('all'); + $this->set('results',$results); + $file = new File('/var/www/html/asd-control/webroot/files/data-up.json', true, 0644); + $file->create(); + $status = $file->write(json_encode($results), 'w', true); + echo $status; + $file->close(); + $this->viewBuilder()->layout('getjson'); + } + + public function usStatistik() { + $file = new File('/var/www/html/asd-control/webroot/files/data-us.json', true, 0644); + $ts = $file->lastChange(); + $time = Time::createFromTimestamp($ts); + $time->timezone = 'Europe/Paris'; + $this->set('time', $time); + $this->viewBuilder()->layout('pivot'); + } + + public function upStatistik() { + $file = new File('/var/www/html/asd-control/webroot/files/data-up.json', true, 0644); + $ts = $file->lastChange(); + $time = Time::createFromTimestamp($ts); + $time->timezone = 'Europe/Paris'; + $this->set('time', $time); + $this->viewBuilder()->layout('pivot'); + } + + public function asdus() + { + $curl = new AsdUs(); + //debug($curl->status); + $ch = $curl->init_curl_params(); + $curl->login_school($ch); + $curl->login_asd($ch); + + $output = $curl->get_us_statistic($ch); + + $this->loadModel('Monitorings'); + if (!empty($this->request['pass'])) { + $command = $this->request['pass']['0']; + if ($command == 'save') { + $data['action'] = 'asdus'; + $data['school'] = ''; + $data['data'] = json_encode($output); + $now = Time::parse(); + $now->timezone = "Europe/Berlin"; + $data['date'] = $now; + $data['comment'] = ''; + $monitoring = $this->Monitorings->newEntity(); + $monitoring = $this->Monitorings->patchEntity($monitoring, $data); + $result = $this->Monitorings->save($monitoring); + } + } + + $all = $this->Monitorings->find('all', array('conditions' => array('action' => 'asdus'), 'order' => array('id' => 'DESC'))); + $old = $all->first(); + $now = Time::parse(); + $now->timezone = "Europe/Berlin"; + $this->set('now', $now); + $this->set('old', $old); + $this->set('output', $output); + $this->set('html', $this->html); + } +} diff --git a/src/Controller/DepartmentsController.php b/src/Controller/DepartmentsController.php new file mode 100644 index 0000000..96aab2c --- /dev/null +++ b/src/Controller/DepartmentsController.php @@ -0,0 +1,245 @@ +loadModel('Examinations'); + $examinations = $this->Examinations->find('all'); + if(isset($examination_id)) { + $actual = $this->Examinations->get($examination_id); + $this->set('actual',$actual); + } + //debug($examinations);die; + $this->set('examinations', $examinations); + //$this->loadModel('Supervisings'); + //$supervisings = $this->Supervisings->find('all', array('conditions' => array('schooltype_id' => $school_type))); + + $supervisings = $this->Departments->find('all', array('fields' => array('super_school_code'), 'conditions' => array('examination_id' => $examination_id), 'group' => array('super_school_code'))); + + foreach ($supervisings as $supervising) { + //debug($supervising); + if (!empty($supervising['super_school_code'])) { + $aufsicht[$supervising['super_school_code']]['super_school_code'] = $supervising['super_school_code']; + $delivered_query = $this->Departments->find('all', array('conditions' => array('examination_id' => $examination_id,'super_school_code' => $supervising['super_school_code'], 'delivery_date is not null'))); + $aufsicht[$supervising['super_school_code']]['delivered'] = $delivered_query->count(); + $all_query = $this->Departments->find('all', array('conditions' => array('examination_id' => $examination_id,'super_school_code' => $supervising['super_school_code']))); + $aufsicht[$supervising['super_school_code']]['all'] = $all_query->count(); + //debug($supervising); + } + } + if(isset($examination_id)) { + $sum_all_query = $this->Departments->find('all', array('conditions' => array('examination_id' => $examination_id))); + $this->set('all',$sum_all_query->count()); + $sum_del_query = $this->Departments->find('all', array('conditions' => array('examination_id' => $examination_id, 'delivery_date is not null'))); + $this->set('del',$sum_del_query->count()); + } + + //debug($aufsicht); + //die; + + $status = $this->Departments->find('all', array('fields' => array('status'), 'conditions' => array('examination_id' => $examination_id),'group' => array('status'))); + $status_arr = ''; + $i = 0; + foreach ($status as $s) { + //debug($s); + $status_arr[$i] = $s->status; + $i++; + } + //debug($status_arr);die; + $this->set('status', $status); + $this->set('examination_id', $examination_id); + //$this->set('schooltype', $schooltype->name); + //$this->set('school_type',$school_type); + if(isset($aufsicht)) { + $this->set('aufsicht', $aufsicht); + } + $this->render(null, 'asd'); + } + + public function listDepAjax($examination_id) { + //debug($school_type); + $list = ''; + $conditions = array('examination_id' => $examination_id); + //debug($conditions); + //debug($this->request->data); + if (isset($this->request->data['delivery_date_on']) AND isset($this->request->data['delivery_date_off'])) { + unset($this->request->data['delivery_date_on']); + unset($this->request->data['delivery_date_off']); + } elseif (isset($this->request->data['delivery_date_on'])) { + unset($this->request->data['delivery_date_on']); + $conditions[0] = 'delivery_date is not null'; + } else { + unset($this->request->data['delivery_date_off']); + $conditions[0] = 'delivery_date is null'; + } + //debug($this->request->data); + //debug($conditions); + if (!empty($this->request->data)) { + foreach ($this->request->data as $key => $d) { + //debug($key); + $key_ex = explode('--', $key); + $list[$key_ex[0]][$key_ex[1]] = $key_ex[1]; + } + $j = 1; + foreach ($list as $key => $l) { + $i = 0; + foreach ($l as $item) { + $item_arr[$i] = '"' . $item . '"'; + $i++; + } + //debug($item_arr); + $string[$key] = rtrim(implode(',', $item_arr), ','); + $conditions[$j] = $key . ' IN (' . $string[$key] . ')'; + $j++; + } + } else { + $string = ''; + } + //debug($conditions); + //die; + //$this->loadModel('Schooltypes'); + //$schooltype = $this->Schooltypes->get($school_type); + //$this->loadModel('Supervisings'); + //$supervisings = $this->Supervisings->find('all'); + //$aufsicht = ''; + //foreach ($supervisings as $s) { + // $aufsicht[$s->id] = $s->code; + //} + //debug($conditions); + if (isset($this->request->query['delivered']) && $this->request->query['delivered'] == 'no') { + //debug('Hallo1'); + $departments = $this->Departments->find('all', array('conditions' => array('schooltype_id' => $school_type, 'delivery_date is null'), 'fields' => array('supervising_id', 'title', 'status', 'code', 'delivery_date', 'delivered'))); + } else { + //debug('Hallo2'); + //$departments = $this->Departments->find('all', array('fields' => array('supervising_id', 'title', 'status', 'code', 'delivery_date', 'delivered'))); + $departments = $this->Departments->find('all', array('conditions' => $conditions, 'fields' => array('super_school_code', 'super_school_code_2', 'title', 'status', 'code', 'delivery_date', 'delivered', 'checkedin'))); + //debug($departments); + } + + foreach ($departments as $department) { + //debug($department); + //$department->supervising_id = $aufsicht[$department->supervising_id]; + //debug($department->delivery_date); + $time = $department->delivery_date; + //debug($time->i18nFormat('yyyy-MM-dd')); die; + if (!empty($department->delivery_date)) { + $department->delivery_date = $time->i18nFormat('yyyy-MM-dd'); + } + //debug($department); + } + + //debug(json_encode($departments)); + //die; + //$this->set('schooltype', $schooltype->name); + $this->set('departments', $departments); + $this->render(null, 'ajax'); + } + + /** + * Index method + * + * @return \Cake\Network\Response|null + */ + public function index() { + $this->paginate = [ + 'contain' => ['Schooltypes', 'Supervisings'] + ]; + $departments = $this->paginate($this->Departments); + + $this->set(compact('departments')); + $this->set('_serialize', ['departments']); + } + + /** + * View method + * + * @param string|null $id Department id. + * @return \Cake\Network\Response|null + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function view($id = null) { + $department = $this->Departments->get($id, [ + 'contain' => ['Schooltypes', 'Supervisings'] + ]); + + $this->set('department', $department); + $this->set('_serialize', ['department']); + } + + /** + * Add method + * + * @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise. + */ + public function add() { + $department = $this->Departments->newEntity(); + if ($this->request->is('post')) { + $department = $this->Departments->patchEntity($department, $this->request->data); + if ($this->Departments->save($department)) { + $this->Flash->success(__('The department has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The department could not be saved. Please, try again.')); + } + $schooltypes = $this->Departments->Schooltypes->find('list', ['limit' => 200]); + $supervisings = $this->Departments->Supervisings->find('list', ['limit' => 200]); + $this->set(compact('department', 'schooltypes', 'supervisings')); + $this->set('_serialize', ['department']); + } + + /** + * Edit method + * + * @param string|null $id Department id. + * @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise. + * @throws \Cake\Network\Exception\NotFoundException When record not found. + */ + public function edit($id = null) { + $department = $this->Departments->get($id, [ + 'contain' => [] + ]); + if ($this->request->is(['patch', 'post', 'put'])) { + $department = $this->Departments->patchEntity($department, $this->request->data); + if ($this->Departments->save($department)) { + $this->Flash->success(__('The department has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The department could not be saved. Please, try again.')); + } + $schooltypes = $this->Departments->Schooltypes->find('list', ['limit' => 200]); + $supervisings = $this->Departments->Supervisings->find('list', ['limit' => 200]); + $this->set(compact('department', 'schooltypes', 'supervisings')); + $this->set('_serialize', ['department']); + } + + /** + * Delete method + * + * @param string|null $id Department id. + * @return \Cake\Network\Response|null Redirects to index. + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function delete($id = null) { + $this->request->allowMethod(['post', 'delete']); + $department = $this->Departments->get($id); + if ($this->Departments->delete($department)) { + $this->Flash->success(__('The department has been deleted.')); + } else { + $this->Flash->error(__('The department could not be deleted. Please, try again.')); + } + + return $this->redirect(['action' => 'index']); + } + +} diff --git a/src/Controller/EmailsController.php b/src/Controller/EmailsController.php new file mode 100644 index 0000000..f92b7dd --- /dev/null +++ b/src/Controller/EmailsController.php @@ -0,0 +1,253 @@ +Emails->connection()->transactional(function ($conn) { + $sqls = $this->Emails->schema()->truncateSql($this->Emails->connection()); + foreach ($sqls as $sql) { + $this->Emails->connection()->execute($sql)->execute(); + } + }); + } + + public function sendresult() { + $this->loadModel('Offices'); + + $emails = $this->Emails->find('all', [ + 'conditions' => ['sent' => 0] + ]); + foreach($emails as $mail) { + + $query = $this->Offices->find('all', [ + 'conditions' => ['dst_schluessel' => $mail->snr] + ]); + //debug($mail->snr);die; + $office = $query->first(); + //debug($office->dst_name); + //die; + $email = new Email(); + $email->viewVars(['content' => $mail->text]); + $email + ->emailFormat('html') + ->from(['abschlusspruefung@schulen.bayern.de' => 'Abschlusspruefung']) + ->to($mail->snr . '@schulen.bayern.de') + ->cc('abschlusspruefung@schulen.bayern.de') + ->template('abschluss') + ->subject($mail->subject . ' ' . $office->dst_name . ' - Ăœbermittlung AbschlussprĂ¼fung Typ ' . $mail->examinationtype) + ->send(); + + $mail['sent'] = 1; + //$line = $this->Apimports->patchEntity($line, (array) $data); + $result = $this->Emails->save($mail); + } + return $this->redirect(['controller' => 'Apresults', 'action' => 'export']); + } + + public function create() { + $query = $this->Emails->find('all',[ + 'order' => ['lieferung DESC'] + ]); + $lastmail = $query->first(); + if(!empty($lastmail)) { + $lastsent = $lastmail->lieferung; + } + else { + $lastsent = 0; + } + //debug($lastsent); + $this->loadModel('Apimports'); + $deliveries = $this->Apimports->find('all', [ + 'conditions' => ["lieferung > $lastsent"], + 'order' => 'lieferung ASC' + ]); + $deliveries->select(['lieferung']) + ->distinct(['lieferung']); + //debug($deliveries); + foreach ($deliveries as $delivery) { + //debug($delivery->lieferung); + $items = $this->Apimports->find('all',[ + 'conditions' => ['lieferung' => $delivery->lieferung ] + ])->toArray(); + $data = (object) []; + $data->examinationtype = $items[0]['pruefungsart']; + $data->snr = $items[0]['schule']; + $data->createdate = $items[0]['erzeugungsdatum']; + $data->date = Time::now(); + $data->lieferung = $delivery->lieferung; + $data->sent = 0; + $data->subject = $items[0]['schule']; + $data->text = '

Ăœbermittlung der Ergebnisse der AbschlussprĂ¼fung Typ ' . $items[0]['pruefungsart'] . '

'; + $data->text .= '

FĂ¼r die Schule ' . $items[0]['schule'] . ' wurden am ' . $items[0]['erzeugungsdatum']->i18nFormat('dd.MM.yyyy') . ' um ' . $items[0]['erzeugungsdatum']->i18nFormat('HH:mm') . ' Uhr folgende Ergebnisse Ă¼bermittelt:

'; + $data->text .= ''; + foreach ($items as $item) { + //debug($item); + $data->text .= ''; + } + $data->text .= '
AnzahlSchĂ¼lerstatus
'. $item->anzahl . '' . $item->schuelerstatus .'
'; + $data->text .= '

Bitte Ă¼berprĂ¼fen Sie diese Ergebnisse sorgfältig und wenden Sie sich umgehend an den ASV Support, falls Unstimmigkeiten auftreten sollten.

'; + $data->text .= '

Ihr ASD-Team

'; + + //debug($data); + $email = $this->Emails->newEntity(); + + $email = $this->Emails->patchEntity($email, (array) $data); + $this->Emails->save($email); + } + //die; + return $this->redirect(['action' => 'sendresult']); + } + + public function import() { + $options = [ + 'length' => 0, + 'delimiter' => '|', + 'enclosure' => ' ', + 'escape' => '\\', + 'headers' => false, + 'text' => false, + 'excel_bom' => false, + ]; + $this->loadModel('Apimports'); + // Tabelle leeren + $this->Apimports->connection()->transactional(function ($conn) { + $sqls = $this->Apimports->schema()->truncateSql($this->Apimports->connection()); + foreach ($sqls as $sql) { + $this->Apimports->connection()->execute($sql)->execute(); + } + }); + + $filepath = '/var/www/html/asd-control/webroot/files/ap/results.csv'; + $handle = fopen($filepath, "r"); + //$i = 1; + //$header = fgetcsv($handle, $options['length'], $options['delimiter']); + while ($row = fgetcsv($handle, $options['length'], $options['delimiter'])) { + //debug($row); + $data = (object) []; + $data->schule = trim($row[0]); + $data->pruefungsart = trim($row[1]); + $data->anzahl = trim($row[2]); + $data->schuelerstatus = trim($row[3]); + $data->erzeugungsdatum = date('Y-m-d H:i:s', strtotime(str_replace('-', '/', trim($row[4])))); + $data->lieferung = trim($row[5]); + $line = $this->Apimports->newEntity(); + $line = $this->Apimports->patchEntity($line, (array) $data); + $result = $this->Apimports->save($line); + //$i++; + } + //die; + return $this->redirect(['action' => 'create']); + } + + + /** + * Index method + * + * @return \Cake\Network\Response|null + */ + public function index() + { + $this->paginate = [ + 'contain' => ['Examinations'] + ]; + $emails = $this->paginate($this->Emails); + + $this->set(compact('emails')); + $this->set('_serialize', ['emails']); + } + + /** + * View method + * + * @param string|null $id Email id. + * @return \Cake\Network\Response|null + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function view($id = null) + { + $email = $this->Emails->get($id, [ + 'contain' => ['Examinations'] + ]); + + $this->set('email', $email); + $this->set('_serialize', ['email']); + } + + /** + * Add method + * + * @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise. + */ + public function add() + { + $email = $this->Emails->newEntity(); + if ($this->request->is('post')) { + $email = $this->Emails->patchEntity($email, $this->request->data); + if ($this->Emails->save($email)) { + $this->Flash->success(__('The email has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The email could not be saved. Please, try again.')); + } + $examinations = $this->Emails->Examinations->find('list', ['limit' => 200]); + $this->set(compact('email', 'examinations')); + $this->set('_serialize', ['email']); + } + + /** + * Edit method + * + * @param string|null $id Email id. + * @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise. + * @throws \Cake\Network\Exception\NotFoundException When record not found. + */ + public function edit($id = null) + { + $email = $this->Emails->get($id, [ + 'contain' => [] + ]); + if ($this->request->is(['patch', 'post', 'put'])) { + $email = $this->Emails->patchEntity($email, $this->request->data); + if ($this->Emails->save($email)) { + $this->Flash->success(__('The email has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The email could not be saved. Please, try again.')); + } + $examinations = $this->Emails->Examinations->find('list', ['limit' => 200]); + $this->set(compact('email', 'examinations')); + $this->set('_serialize', ['email']); + } + + /** + * Delete method + * + * @param string|null $id Email id. + * @return \Cake\Network\Response|null Redirects to index. + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function delete($id = null) + { + $this->request->allowMethod(['post', 'delete']); + $email = $this->Emails->get($id); + if ($this->Emails->delete($email)) { + $this->Flash->success(__('The email has been deleted.')); + } else { + $this->Flash->error(__('The email could not be deleted. Please, try again.')); + } + + return $this->redirect(['action' => 'index']); + } +} diff --git a/src/Controller/ErrorController.php b/src/Controller/ErrorController.php new file mode 100644 index 0000000..631a516 --- /dev/null +++ b/src/Controller/ErrorController.php @@ -0,0 +1,68 @@ +loadComponent('RequestHandler'); + } + + /** + * beforeFilter callback. + * + * @param \Cake\Event\Event $event Event. + * @return \Cake\Network\Response|null|void + */ + public function beforeFilter(Event $event) + { + } + + /** + * beforeRender callback. + * + * @param \Cake\Event\Event $event Event. + * @return \Cake\Network\Response|null|void + */ + public function beforeRender(Event $event) + { + parent::beforeRender($event); + + $this->viewBuilder()->templatePath('Error'); + } + + /** + * afterFilter callback. + * + * @param \Cake\Event\Event $event Event. + * @return \Cake\Network\Response|null|void + */ + public function afterFilter(Event $event) + { + } +} diff --git a/src/Controller/ExaminationsController.php b/src/Controller/ExaminationsController.php new file mode 100644 index 0000000..2de0f8c --- /dev/null +++ b/src/Controller/ExaminationsController.php @@ -0,0 +1,135 @@ +from(['asd.trinkl@schulen.bayern.de' => 'ASD Trinkl']) + ->to('asd.kraupner@schulen.bayern.de') + ->subject('Test') + ->send('Hallo Martina!'); + } + + public function listImports() { + $this->loadModel('Imports'); + //$import = $this->Imports->newEntity(); + $list = $this->Examinations->find('all', [ + 'contain' => ['Schooltypes','Imports'] + ]); + //$this->set('import',$import); + $this->set('list', $list); + //foreach($list as $item) { + // debug($item); + //} + //die; + } + + /** + * Index method + * + * @return \Cake\Network\Response|null + */ + public function index() { + $this->paginate = [ + 'contain' => ['Schooltypes'] + ]; + $examinations = $this->paginate($this->Examinations); + + //debug($examinations);die; + + $this->set(compact('examinations')); + $this->set('_serialize', ['examinations']); + } + + /** + * View method + * + * @param string|null $id Examination id. + * @return \Cake\Network\Response|null + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function view($id = null) { + $examination = $this->Examinations->get($id, [ + 'contain' => ['Schooltypes', 'Imports'] + ]); + + $this->set('examination', $examination); + $this->set('_serialize', ['examination']); + } + + /** + * Add method + * + * @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise. + */ + public function add() { + $examination = $this->Examinations->newEntity(); + if ($this->request->is('post')) { + $examination = $this->Examinations->patchEntity($examination, $this->request->data); + if ($this->Examinations->save($examination)) { + $this->Flash->success(__('The examination has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The examination could not be saved. Please, try again.')); + } + $schooltypes = $this->Examinations->Schooltypes->find('list', ['limit' => 200]); + $this->set(compact('examination', 'schooltypes')); + $this->set('_serialize', ['examination']); + } + + /** + * Edit method + * + * @param string|null $id Examination id. + * @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise. + * @throws \Cake\Network\Exception\NotFoundException When record not found. + */ + public function edit($id = null) { + $examination = $this->Examinations->get($id, [ + 'contain' => [] + ]); + if ($this->request->is(['patch', 'post', 'put'])) { + $examination = $this->Examinations->patchEntity($examination, $this->request->data); + if ($this->Examinations->save($examination)) { + $this->Flash->success(__('The examination has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The examination could not be saved. Please, try again.')); + } + $schooltypes = $this->Examinations->Schooltypes->find('list', ['limit' => 200]); + $this->set(compact('examination', 'schooltypes')); + $this->set('_serialize', ['examination']); + } + + /** + * Delete method + * + * @param string|null $id Examination id. + * @return \Cake\Network\Response|null Redirects to index. + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function delete($id = null) { + $this->request->allowMethod(['post', 'delete']); + $examination = $this->Examinations->get($id); + if ($this->Examinations->delete($examination)) { + $this->Flash->success(__('The examination has been deleted.')); + } else { + $this->Flash->error(__('The examination could not be deleted. Please, try again.')); + } + + return $this->redirect(['action' => 'index']); + } + +} diff --git a/src/Controller/ExtractsController.php b/src/Controller/ExtractsController.php new file mode 100644 index 0000000..ba9d818 --- /dev/null +++ b/src/Controller/ExtractsController.php @@ -0,0 +1,243 @@ +html = curl_exec($ch); + } + + public function getElementsByClass(&$parentNode, $tagName, $className) { + $nodes=array(); + + $childNodeList = $parentNode->getElementsByTagName($tagName); + for ($i = 0; $i < $childNodeList->length; $i++) { + $temp = $childNodeList->item($i); + if (stripos($temp->getAttribute('class'), $className) !== false) { + $nodes[]=$temp; + } + } + return $nodes; + } + + public function readxml() { + $path = WWW_ROOT . 'files'; + $filename = '20180118_101716_2377078511295.xml'; + $file = $path . DS . $filename; + + $xml = file_get_contents($file, true); + //debug($xml); + $dom = new \DOMDocument(); //to parse html using DOMDocument + $dom->preserveWhiteSpace = false; + $dom->formatOutput = true; + libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal + $dom->loadXML($xml); //Loaded the html string we took from simple xml + + + $nodes = $dom->getElementsByTagName('KOPPLUNG_LANG_BEZEICHNUNG'); + //debug($nodes->length); + foreach ($nodes as $node) { + $node->textContent = 'Anonym'; + //foreach($node->childNodes as $child ) { + // debug($child->nodeName); + // debug($child->nodeValue); + //} + //$node->getElementsByTagName('KOPPLUNG_LANG_BEZEICHNUNG')->item(0)->textContent = 'Anonym'; + + + } + + //die; + + $dom->saveXML(); // This will return the XML as a string + $newfile = $file . '.new'; + $dom->save($newfile); // This saves the XML to a file + + $newcontent = file_get_contents($newfile, true); + $this->viewBuilder()->layout('ajax'); + $this->set('content',$newcontent); + + + } + + public function generate() { + $snr = '9310'; + $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; + $random_string_length = 4; + $string = ''; + $max = strlen($characters) - 1; + for ($i = 0; $i < $random_string_length; $i++) { + $string .= $characters[mt_rand(0, $max)]; + } + $millis = round(microtime(true) * 1000); + + $string_ohne = $snr . $string . $millis; + //debug($string_ohne); + $good = '9310QEKU15162667399540879'; + debug($good); + + $string_ohne = '9310QEKU1516266739954'; + debug($string_ohne); + $hash = str_pad(hexdec(hash('adler32',$string_ohne)) % 9857, 4, '0', STR_PAD_LEFT); + debug($hash); + $string_mit = $string_ohne . $hash; + debug($string_mit); + die; + + } + + public function import() + { + $ch = $this->init_curl_params(); + echo 'Hallo'; + $types = array('weibliche-vornamen','maennliche-vornamen','nachnamen','strassen'); + $alphas = range('a', 'z'); + debug($alphas); + + foreach($types as $type) { + foreach($alphas as $alpha) { + $url = 'http://www.namen-liste.de/' . $type . '-' .$alpha .'/'; + echo '

' . $url . '

'; + $this->exec_curl($ch, $url); + $htmlParser = new \DOMDocument(); //to parse html using DOMDocument + libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal + $htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml + $htmlParser->preserveWhiteSpace = false; + + $nodes = $this->getElementsByClass($htmlParser, 'span' , 't4'); + foreach($nodes as $node) { + debug($node->nodeValue); + $extract = $this->Extracts->newEntity(); + $extract->type = $type; + $extract->value = $node->nodeValue; + $this->Extracts->save($extract); + } + } + } + + + + } + + /** + * Index method + * + * @return \Cake\Network\Response|null + */ + public function index() + { + $extracts = $this->paginate($this->Extracts); + + $this->set(compact('extracts')); + $this->set('_serialize', ['extracts']); + } + + /** + * View method + * + * @param string|null $id Extract id. + * @return \Cake\Network\Response|null + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function view($id = null) + { + $extract = $this->Extracts->get($id, [ + 'contain' => [] + ]); + + $this->set('extract', $extract); + $this->set('_serialize', ['extract']); + } + + /** + * Add method + * + * @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise. + */ + public function add() + { + $extract = $this->Extracts->newEntity(); + if ($this->request->is('post')) { + $extract = $this->Extracts->patchEntity($extract, $this->request->data); + if ($this->Extracts->save($extract)) { + $this->Flash->success(__('The extract has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The extract could not be saved. Please, try again.')); + } + $this->set(compact('extract')); + $this->set('_serialize', ['extract']); + } + + /** + * Edit method + * + * @param string|null $id Extract id. + * @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise. + * @throws \Cake\Network\Exception\NotFoundException When record not found. + */ + public function edit($id = null) + { + $extract = $this->Extracts->get($id, [ + 'contain' => [] + ]); + if ($this->request->is(['patch', 'post', 'put'])) { + $extract = $this->Extracts->patchEntity($extract, $this->request->data); + if ($this->Extracts->save($extract)) { + $this->Flash->success(__('The extract has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The extract could not be saved. Please, try again.')); + } + $this->set(compact('extract')); + $this->set('_serialize', ['extract']); + } + + /** + * Delete method + * + * @param string|null $id Extract id. + * @return \Cake\Network\Response|null Redirects to index. + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function delete($id = null) + { + $this->request->allowMethod(['post', 'delete']); + $extract = $this->Extracts->get($id); + if ($this->Extracts->delete($extract)) { + $this->Flash->success(__('The extract has been deleted.')); + } else { + $this->Flash->error(__('The extract could not be deleted. Please, try again.')); + } + + return $this->redirect(['action' => 'index']); + } +} diff --git a/src/Controller/ImportsController.php b/src/Controller/ImportsController.php new file mode 100644 index 0000000..74ec16b --- /dev/null +++ b/src/Controller/ImportsController.php @@ -0,0 +1,325 @@ +open($local_file); + + if ($zip_status === true) { + if ($zip->setPassword($zip_pass)) { + if (!$zip->extractTo('/test/results/')) + echo "Extraction failed (wrong password?)"; + } + //debug($zip->statIndex(0)); + $file = $zip->statIndex(0)['name']; + //debug($file); + //debug($file); + $zip->close(); + } + else { + die("Failed opening archive: " . @$zip->getStatusString() . " (code: " . $zip_status . ")"); + } + rename('/test/results/'.$file,'/var/www/html/asd-control/webroot/files/ap/results.csv'); + exec('/usr/bin/smbclient -U \'BAYKM/km-tri-wil%HiegTzs!182\' //KM-Svr-Daten/Projektshare -c \'cd /14_Materialien/Austausch/WiTr/ap; put /var/www/html/asd-control/webroot/files/ap/results.csv results-ap.csv\''); + //die; + //debug($contents);die; + + /* $this->loadModel('Imports'); + $imports = $this->Imports->find('all'); + + foreach ($imports as $import) { + //debug($import); + $file = glob($local_folder . '/results/' . explode('.', $import->filename)['0'] . '_*'); + copy($file['0'], '/var/www/html/asd-control/webroot/files/' . $import->filename); + $parts = explode('/', $file['0']); + $filename = end($parts); + rename($file['0'], $local_folder . '/old/' . $filename); + } + $this->loadModel('Examinations'); + $examinations = $this->Examinations->find('all', [ + 'contain' => ['Imports']]); + foreach ($examinations as $examination) { + //debug($examination); + $job['examination_id'] = $examination->id; + $i = 1; + foreach ($examination->imports as $import) { + $job['files']['file-' . $i]['filename'] = $import->filename; + $i++; + } + //debug($job); + $this->csv2db($job); + } */ + ftp_close($conn_id); + return $this->redirect(['controller' => 'Emails', 'action' => 'import']); + } + + + + function addModels($importtype) { + //debug($importtype->mapping); + //debug(json_decode($importtype->mapping)); + foreach (json_decode($importtype->mapping) as $map_key => $map_value) { + if (substr($map_key, -3) == '_id') { + $map_key_array = explode('_', $map_key); + //debug(ucfirst($map_key_array[0] . 's')); + //debug($map_key_array[0]); + $this->loadModel(ucfirst($map_key_array[0] . 's')); + } + } + } + + function csv2db($import) { + $options = [ + 'length' => 0, + 'delimiter' => ';', + 'enclosure' => ' ', + 'escape' => '\\', + 'headers' => false, + 'text' => false, + 'excel_bom' => false, + ]; + $this->loadModel('Configs'); + $config = $this->Configs->find('all', array('conditions' => array('title' => 'path')))->first(); + $path = $config->value; + $examination_id = $import['examination_id']; + //debug($examination_id); + foreach ($import['files'] as $key => $file) { + //$file_name = (object) []; + $import_id = explode('-', $key)[1]; + //debug($file); + $importtype = $this->Imports->find('all', array('conditions' => array('filename' => $file['filename'])))->first(); + //debug($importtype); + //if (!empty($file['filename'])) { + // $file_name->filename = $file['filename']; + // $importtype = $this->Imports->patchEntity($importtype, (array) $file_name); + // $this->Imports->save($importtype); + + // $filepath = $path . DS . $file['filename']; + //} else { + // if ($file['csv']['error'] == 0) { + // if (!empty($file['csv']['name'])) { + // $importtype->filename = $file['csv']['name']; + // $this->Imports->save($importtype); + // } + // $filepath = $import[$key]['csv']['tmp_name']; + // } + //} + $filepath = $path . DS . $file['filename']; + //debug($file); + //debug($filepath); + //die; + if (!empty($filepath)) { + $this->loadModel($importtype->tablename); + + if ($importtype->clear) { + $dtable = $importtype->tablename; + $conn = $this->$dtable->connection(); + $conn->query('DELETE FROM ' . strtolower($dtable) . ' WHERE examination_id = ' . $examination_id); + } + $this->addModels($importtype); /* Zusaetzliche Models laden */ + + $table = $importtype->tablename; + $columns = $this->$table->schema()->columns(); + $schema = (object) []; + foreach ($columns as $column) { + $schema->$column = $this->$table->schema()->columnType($column); + } + //debug($schema);die; + $options['delimiter'] = $importtype['field_separator']; + if (!empty($importtype['enclosure'])) { + $options['enclosure'] = $importtype['enclosure']; + } + $filepath = glob($filepath)[0]; + $handle = fopen($filepath, "r"); + $i = 1; + + while ($row = fgetcsv($handle, $options['length'], $options['delimiter'])) { + $data = (object) []; + if ($i > $importtype->skip) { + foreach (json_decode($importtype->mapping) as $key => $value) { + if (substr($key, -3) == '_id') { + $key_array = explode('_', $key); + $ftable = ucfirst($key_array[0] . 's'); + $field = $key_array[0] . '_id'; + $data->$field = $this->$ftable->find('all', array('conditions' => array($key_array[1] => $row[$value]), 'fields' => array('id')))->first()->id; + } else { + if ($schema->$key == 'datetime') { + $date = date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $row[$value]))); + $data->$key = $date; + } elseif ($schema->$key == 'integer') { + $data->$key = str_replace(".", "", $row[$value]); + } else { + $data->$key = $row[$value]; + } + } + } + if ($importtype->update_table) { + $value = current((Array) $data); + $table_key = array_keys((Array) $data)[0]; + $line = $this->$table->find('all', array('conditions' => array('examination_id' => $examination_id, $table_key => $value)))->first(); + $line = $this->$table->patchEntity($line, (array) $data); + } else { + $line = $this->$table->newEntity(); + $data->examination_id = $examination_id; + $line = $this->$table->patchEntity($line, (array) $data); + } + $result = $this->$table->save($line); + } + $i++; + } + $filepath = ''; + } else { + + } + } + } + + public function listImports() { + if ($this->request->is('post')) { + + $import = $this->request->data(); + $examination_id = $import['examination_id']; + $this->csv2db($import); + return $this->redirect(['controller' => 'Departments', 'action' => 'list_dep/' . $examination_id]); + } + $list = $this->Imports->find('all', [ + 'contain' => ['Schooltypes', 'Examinations'] + ]); + $this->set('list', $list); + } + + /** + * Index method + * + * @return \Cake\Network\Response|null + */ + public function index() { + $this->paginate = [ + 'contain' => ['Schooltypes', 'Examinations'] + ]; + $imports = $this->paginate($this->Imports); + + $this->set(compact('imports')); + $this->set('_serialize', ['imports']); + } + + /** + * View method + * + * @param string|null $id Import id. + * @return \Cake\Network\Response|null + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function view($id = null) { + $import = $this->Imports->get($id, [ + 'contain' => ['Schooltypes'] + ]); + + $this->set('import', $import); + $this->set('_serialize', ['import']); + } + + /** + * Add method + * + * @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise. + */ + public function add() { + $import = $this->Imports->newEntity(); + if ($this->request->is('post')) { + //debug($this->request->data); die; + $import = $this->Imports->patchEntity($import, $this->request->data); + if ($this->Imports->save($import)) { + $this->Flash->success(__('The import has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The import could not be saved. Please, try again.')); + } + $schooltypes = $this->Imports->Schooltypes->find('list', ['limit' => 200]); + $examinations = $this->Imports->Examinations->find('list', ['limit' => 200]); + $this->set(compact('import', 'schooltypes', 'examinations')); + $this->set('_serialize', ['import']); + } + + /** + * Edit method + * + * @param string|null $id Import id. + * @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise. + * @throws \Cake\Network\Exception\NotFoundException When record not found. + */ + public function edit($id = null) { + $import = $this->Imports->get($id, [ + 'contain' => [] + ]); + if ($this->request->is(['patch', 'post', 'put'])) { + $import = $this->Imports->patchEntity($import, $this->request->data); + if ($this->Imports->save($import)) { + $this->Flash->success(__('The import has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The import could not be saved. Please, try again.')); + } + $schooltypes = $this->Imports->Schooltypes->find('list', ['limit' => 200]); + $examinations = $this->Imports->Examinations->find('list', ['limit' => 200]); + $this->set(compact('import', 'schooltypes', 'examinations')); + $this->set('_serialize', ['import']); + } + + /** + * Delete method + * + * @param string|null $id Import id. + * @return \Cake\Network\Response|null Redirects to index. + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function delete($id = null) { + $this->request->allowMethod(['post', 'delete']); + $import = $this->Imports->get($id); + if ($this->Imports->delete($import)) { + $this->Flash->success(__('The import has been deleted.')); + } else { + $this->Flash->error(__('The import could not be deleted. Please, try again.')); + } + + return $this->redirect(['action' => 'index']); + } + +} diff --git a/src/Controller/MonitoringsController.php b/src/Controller/MonitoringsController.php new file mode 100644 index 0000000..c590bf0 --- /dev/null +++ b/src/Controller/MonitoringsController.php @@ -0,0 +1,725 @@ +loadComponent('Tools'); + } + + private function query_to_var($string) + { + $arr = array(); + $pairs = explode('&', $string); + //debug($pairs); + foreach ($pairs as $pair) { + $parts = explode('=', $pair); + $arr[urldecode($parts[0])] = urldecode($parts[1]); + } + return $arr; + } + + private function get_string_between($string, $start, $end) + { + $string = " " . $string; + $ini = strpos($string, $start); + if ($ini == 0) { + return ""; + } + + $ini += strlen($start); + $len = strpos($string, $end, $ini) - $ini; + $sub = substr($string, $ini, $len); + $elem = explode(' ', $sub)[0]; + return str_replace('"', '', $elem); + } + + private function login_school($ch) + { + + //$login_data = $this->request->session()->read('data'); + + $login_data = [ + 'portal_username' => 'asd.trinkl', + 'portal_password' => 'HiegTzs!182', + ]; + curl_setopt($ch, CURLOPT_URL, SCHULPORTAL_BASE_URL); + $text = curl_exec($ch); + + + $post = [ + 'user_name' => $login_data['portal_username'], + 'password' => $login_data['portal_password'], + 'repository' => 'schulen.bayern.de', + 'site_name' => 'schulportal', + 'secure' => '1', + 'resource_id' => '2', + 'login_type' => '2', + ]; + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded')); + + // Anmeldeformular fuer das Schulportal abschicken - Step 2 + + curl_setopt($ch, CURLOPT_URL, SCHULPORTAL_BASE_URL . '/InternalSite/Validate.asp'); + $text = curl_exec($ch); + } + + public function screen() + { + $this->set('path', $this->Tools->screen()); + } + + public function trans() + { + if ($this->request->is('post')) { + //debug($this->request); + $string = $this->request['data']['string']; + $arr = $this->query_to_var($string); + $this->set('arr', $arr); + } + } + + public function showxml() + { + if ($this->request->is('post')) { + //debug($this->request); + $string = $this->request['data']['string']; + echo($string); + //$arr = $p = xml_parser_create(); + //xml_parse_into_struct($p, $string, $vals, $index); + //xml_parser_free($p); + $vals = Xml::toArray(Xml::build($string)); + //debug($vals); + //debug($index); + $this->set('arr', $vals); + } + } + + public function login() + { + if ($this->request->is('post')) { + $post = $this->request['data']; + $this->request->session()->write('data', $this->request['data']); + debug($post); + return $this->redirect(['action' => 'examine']); + } + } + + public function viva() + { + $schools = $this->Monitorings->find('all', array('conditions' => array('action' => 'lehrkap'))); + $schools->select(['school']) + ->distinct(['school']); + + foreach ($schools as $school) { + $snr = $school->school; + $vdata = $this->Monitorings->find('all', array('conditions' => array('action' => 'lehrkap', 'school' => $snr, 'comment' => 'vor Viva'))); + $vdata->select(['data']); + //debug($vdata->first()->data); + $ndata = $this->Monitorings->find('all', array('conditions' => array('action' => 'lehrkap', 'school' => $snr, 'comment' => 'nach Viva'))); + //debug($ndata->first()->data); + $ndata->select(['data']); + $data[$snr]['vor'] = $vdata->first()->data; + $data[$snr]['nach'] = $ndata->first()->data; + //debug($data); + } + $this->set('data', $data); + } + + public function examine() + { + //$login_data = $this->request->session()->read('data'); + + if ($this->request->is('post')) { + + //debug($this->request->data['school_nr']);die; + + $login_data = [ + 'asd_username' => 'A005_TrinklW', + 'asd_password' => 'HiegTzs!12', + ]; + $school_nr = $this->request->data['school_nr']; + //$school_nr = '0181'; + + $ch = $this->Tools->init_curl_params(); + $this->login_school($ch); + + $text = $this->Tools->asd_curl($ch, '', array(), '/asddv/dv_xy_00.jsf'); + + $viewstate = $this->get_string_between($text, 'id="javax.faces.ViewState" value="', '" autocomplete'); + + $post = [ + 'login:username' => $login_data['asd_username'], + 'login:password' => $login_data['asd_password'], + 'login' => 'login', + 'javax.faces.ViewState' => $viewstate, + 'login:loginButton' => 'login:loginButton', + ]; + $text = $this->Tools->asd_curl($ch, $post, array('Content-Type: application/x-www-form-urlencoded'), '/login/login.jsf'); + + $text = $this->Tools->asd_curl($ch, '', array(), '/asdus/us_01_01.jsf'); + + $viewstate = $this->get_string_between($text, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $conversationId = $this->get_string_between($text, 'name="conversationId" value="', '" />'); + + $post_basic = [ + 'mainForm' => 'mainForm', + 'referenzBaumAnzeigen' => 'false', + 'mainForm:hasChanged' => 'false', + 'mainForm:hasNotReleased' => 'false', + 'mainForm:hasPopUpChanged' => 'false', + 'mainForm:hasAdresseChanged' => 'false', + 'mainForm:confirmedOverride' => 'false', + 'mainForm:zuordnungNotification' => 'false', + 'skipvalidation' => 'false', + 'mainForm:istAnzeigeMaske' => 'false', + ]; + + $post = [ + 'changeNotification' => 'false', + 'conversationId' => $conversationId, + 'mainForm:dienststelle_schluessel' => $school_nr, + 'mainForm:dienststelle_nameoffiziell' => '', + 'mainForm:dienststelle_dst_wl_dsttyp_id_uebe' => 'EMPTY:0', + 'mainForm:dienststelle_plzstrasse' => '', + 'mainForm:dienststelle_ort' => '', + 'mainForm:dienststelle_sat_kurz_bezeichnung' => 'EMPTY:0', + 'mainForm:dienststelle_bdg_kurz_bezeichnung' => 'EMPTY:0', + 'mainForm:dienststelle_wl_kurz_bezeichnung' => 'EMPTY:0', + 'mainForm:dienststelle_dst_wl_regierung_id_u' => 'EMPTY:0', + 'mainForm:dienststelle_dst_wl_schulamt_id' => 'EMPTY:0', + 'mainForm:dienststelle_referent' => '', + 'mainForm:dienststelle_dst_wl_mb_bezirk_id_u' => 'EMPTY:0', + 'mainForm:dienststelle_status' => 'EMPTY:0', + 'mainForm:dienststelle_sortierung' => 'com.hp.asd.domain.tech.PersProperty:7', + 'mainForm:action_suchen' => 'Suchen', + 'javax.faces.ViewState' => $viewstate, + ]; + + $text = $this->Tools->asd_curl($ch, array_merge($post_basic, $post), array('Content-Type: application/x-www-form-urlencoded'), '/asdus/us_01_01.jsf?cid=' . $conversationId); + + $viewstate = $this->get_string_between($text, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $conversationId = $this->get_string_between($text, 'name="conversationId" value="', '" />'); + + $post = [ + 'changeNotification' => 'false', + 'conversationId' => $conversationId, + 'mainForm:resultTable:0:email' => '0001@schulen.bayern.de', + 'mainForm:resultTable:0:j_idt112' => 'on', + 'javax.faces.ViewState' => $viewstate, + 'mainForm:resultTable:0:dienststelle_nameoffiziell' => 'mainForm:resultTable:0:dienststelle_nameoffiziell', + ]; + + $text = $this->Tools->asd_curl($ch, array_merge($post_basic, $post), array('Content-Type: application/x-www-form-urlencoded'), '/asdus/us_01_02.jsf?cid=' . $conversationId); + + //debug($text);die; + //$output = $this->Tools->asd_basic($text); + //$this->set('output', $output); + + $viewstate = $this->get_string_between($text, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $conversationId = $this->get_string_between($text, 'name="conversationId" value="', '" />'); + $mask = $this->get_string_between($text, '/uniquesig0/asd/asdus/', '.jsf?cid='); + //debug($mask); + //debug($text);die; + $post = [ + 'conversationId' => $conversationId, + 'changeNotification' => 'true', + 'mainForm:schulnummer' => $school_nr, + 'mainForm:schule' => 'Leibniz-Gymnasium+Altdorf', + 'mainForm:schulstellePlzStrasse' => 'Gymnasium', + 'mainForm:lehrkapazitaet' => 'Lehrkapazit%C3%A4t', + 'mainForm:erhebungsinformationskommentar' => '', + 'mainForm:statusaenderungen_kommentar' => '', + 'javax.faces.ViewState' => $viewstate, + ]; + + if ($mask == 'us_01_10') { + $schooltype = 'gms'; + $schuleSelect = $this->get_string_between($text, 'name="mainForm:schuleSelect" class="w100p" size="1" onchange="submit()">