Initial installer support

This commit is contained in:
Matteo Gheza 2020-05-19 23:09:11 +02:00
parent 5e1e069818
commit 29f8c3bfdb
11 changed files with 1536 additions and 4 deletions

1
.gitignore vendored
View File

@ -498,6 +498,7 @@ composer.phar
!/server/error-log/index.html
config.php
config.old.php
*password*

868
server/composer.lock generated Normal file
View File

@ -0,0 +1,868 @@
{
"_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#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "3a88776c721ec93849edd65021b59aef",
"packages": [
{
"name": "cmfcmf/openweathermap-php-api",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/cmfcmf/OpenWeatherMap-PHP-API.git",
"reference": "08b83a829936718ecb73f237dfc4be9c8f492d7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cmfcmf/OpenWeatherMap-PHP-API/zipball/08b83a829936718ecb73f237dfc4be9c8f492d7e",
"reference": "08b83a829936718ecb73f237dfc4be9c8f492d7e",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-libxml": "*",
"ext-simplexml": "*",
"php": ">=7.0.0",
"psr/cache": "^1.0",
"psr/http-client": "^1.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"cache/array-adapter": "^1.0",
"http-interop/http-factory-guzzle": "^1.0",
"php-http/guzzle6-adapter": "^2.0 || ^1.0",
"phpunit/phpunit": "^5.0.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Cmfcmf\\": "Cmfcmf"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Flach (cmfcmf)",
"email": "cmfcmf.flach@gmail.com",
"homepage": "http://cmfcmf.github.io",
"role": "Developer"
}
],
"description": "A PHP API to parse weather data from OpenWeatherMap.org. This wrapper tries to normalise and abstract the data and remove inconsistencies.",
"homepage": "https://github.com/cmfcmf/OpenWeatherMap-PHP-API",
"keywords": [
"OpenWeatherMap",
"api",
"free",
"owm",
"weather"
],
"time": "2020-02-14T13:06:05+00:00"
},
{
"name": "doctrine/lexer",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/doctrine/lexer.git",
"reference": "ec953a1b157db060fc9576a6f6b6b1865a09aac9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/lexer/zipball/ec953a1b157db060fc9576a6f6b6b1865a09aac9",
"reference": "ec953a1b157db060fc9576a6f6b6b1865a09aac9",
"shasum": ""
},
"require": {
"php": "^7.2"
},
"require-dev": {
"doctrine/coding-standard": "^7.0.2",
"phpstan/phpstan": "^0.11.8",
"phpunit/phpunit": "^8.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.",
"homepage": "https://www.doctrine-project.org/projects/lexer.html",
"keywords": [
"annotations",
"docblock",
"lexer",
"parser",
"php"
],
"time": "2020-02-06T21:05:57+00:00"
},
{
"name": "egulias/email-validator",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "ade6887fd9bd74177769645ab5c474824f8a418a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ade6887fd9bd74177769645ab5c474824f8a418a",
"reference": "ade6887fd9bd74177769645ab5c474824f8a418a",
"shasum": ""
},
"require": {
"doctrine/lexer": "^1.0.1",
"php": ">=5.5",
"symfony/polyfill-intl-idn": "^1.10"
},
"require-dev": {
"dominicsayers/isemail": "^3.0.7",
"phpunit/phpunit": "^4.8.36|^7.5.15",
"satooshi/php-coveralls": "^1.0.1"
},
"suggest": {
"ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1.x-dev"
}
},
"autoload": {
"psr-4": {
"Egulias\\EmailValidator\\": "EmailValidator"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eduardo Gulias Davis"
}
],
"description": "A library for validating emails against several RFCs",
"homepage": "https://github.com/egulias/EmailValidator",
"keywords": [
"email",
"emailvalidation",
"emailvalidator",
"validation",
"validator"
],
"time": "2020-02-13T22:36:52+00:00"
},
{
"name": "fzaninotto/faker",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/fzaninotto/Faker.git",
"reference": "04c47e38dbc68d7261c88446598bbf509d37c77a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fzaninotto/Faker/zipball/04c47e38dbc68d7261c88446598bbf509d37c77a",
"reference": "04c47e38dbc68d7261c88446598bbf509d37c77a",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"ext-intl": "*",
"phpunit/phpunit": "^4.8.35 || ^5.7",
"squizlabs/php_codesniffer": "^2.9.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
}
},
"autoload": {
"psr-4": {
"Faker\\": "src/Faker/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "François Zaninotto"
}
],
"description": "Faker is a PHP library that generates fake data for you.",
"keywords": [
"data",
"faker",
"fixtures"
],
"time": "2019-12-31T10:44:52+00:00"
},
{
"name": "psr/cache",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/php-fig/cache.git",
"reference": "b9aa2cd4dd36cec02779bee07ee9dab8bd2d07d7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/b9aa2cd4dd36cec02779bee07ee9dab8bd2d07d7",
"reference": "b9aa2cd4dd36cec02779bee07ee9dab8bd2d07d7",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for caching libraries",
"keywords": [
"cache",
"psr",
"psr-6"
],
"time": "2019-10-04T14:04:41+00:00"
},
{
"name": "psr/http-client",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "fd5d37ae5a76ee3c5301a762faf66bf9519132ef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/fd5d37ae5a76ee3c5301a762faf66bf9519132ef",
"reference": "fd5d37ae5a76ee3c5301a762faf66bf9519132ef",
"shasum": ""
},
"require": {
"php": "^7.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP clients",
"homepage": "https://github.com/php-fig/http-client",
"keywords": [
"http",
"http-client",
"psr",
"psr-18"
],
"time": "2019-09-04T06:46:09+00:00"
},
{
"name": "psr/http-message",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "efd67d1dc14a7ef4fc4e518e7dee91c271d524e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/efd67d1dc14a7ef4fc4e518e7dee91c271d524e4",
"reference": "efd67d1dc14a7ef4fc4e518e7dee91c271d524e4",
"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": "2019-08-29T13:16:46+00:00"
},
{
"name": "shieldon/messenger",
"version": "1.5.1",
"source": {
"type": "git",
"url": "https://github.com/terrylinooo/messenger.git",
"reference": "c9c8eb05a3c5d37fc9357180b044d3ee66aea139"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/terrylinooo/messenger/zipball/c9c8eb05a3c5d37fc9357180b044d3ee66aea139",
"reference": "c9c8eb05a3c5d37fc9357180b044d3ee66aea139",
"shasum": ""
},
"require": {
"php": ">=7.1.0"
},
"require-dev": {
"phpunit/phpunit": "^7"
},
"type": "library",
"autoload": {
"psr-4": {
"Messenger\\": "src/Messenger"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Terry Lin",
"email": "contact@terryl.in",
"homepage": "https://terryl.in",
"role": "Developer"
}
],
"description": "Sending messages to the third-party services made easy for PHP.",
"homepage": "https://github.com/terrylinooo/messenger",
"keywords": [
"Messenger",
"mailer",
"message",
"smtp"
],
"time": "2020-02-13T08:04:05+00:00"
},
{
"name": "shieldon/shieldon",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/terrylinooo/shieldon.git",
"reference": "1205c056141a1e4c2d75fa08adff1b3ae05a6ff5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/terrylinooo/shieldon/zipball/1205c056141a1e4c2d75fa08adff1b3ae05a6ff5",
"reference": "1205c056141a1e4c2d75fa08adff1b3ae05a6ff5",
"shasum": ""
},
"require": {
"php": ">=7.1.0",
"shieldon/messenger": "^1"
},
"require-dev": {
"phpunit/phpunit": "^7",
"shieldon/messenger": "^1"
},
"type": "library",
"autoload": {
"psr-4": {
"Shieldon\\": "src/Shieldon"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Terry Lin",
"email": "contact@terryl.in",
"homepage": "https://terryl.in",
"role": "Developer"
}
],
"description": "Web application firewall for PHP.",
"homepage": "https://github.com/terrylinooo/shieldon",
"keywords": [
"anti-scraping",
"firewall",
"web-application-firewall",
"web-security",
"www-authenticate",
"xss-filter",
"xss-protection"
],
"time": "2020-02-18T10:02:33+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14",
"reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.15-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"time": "2020-02-27T09:26:54+00:00"
},
{
"name": "symfony/polyfill-intl-idn",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "f45ed1f94de3574e834832208d36fe61867d2210"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/f45ed1f94de3574e834832208d36fe61867d2210",
"reference": "f45ed1f94de3574e834832208d36fe61867d2210",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/polyfill-mbstring": "^1.3",
"symfony/polyfill-php72": "^1.10"
},
"suggest": {
"ext-intl": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.15-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Idn\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Laurent Bassin",
"email": "laurent@bassin.info"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"idn",
"intl",
"polyfill",
"portable",
"shim"
],
"time": "2020-02-27T09:26:54+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "766ee47e656529b352da69c0ff29da928a9629e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/766ee47e656529b352da69c0ff29da928a9629e7",
"reference": "766ee47e656529b352da69c0ff29da928a9629e7",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.15-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": "2020-02-27T09:26:54+00:00"
},
{
"name": "symfony/polyfill-php72",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "37b0976c78b94856543260ce09b460a7bc852747"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/37b0976c78b94856543260ce09b460a7bc852747",
"reference": "37b0976c78b94856543260ce09b460a7bc852747",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.15-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": "2020-02-27T09:26:54+00:00"
},
{
"name": "tracy/tracy",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/nette/tracy.git",
"reference": "344c77293038173f49678d9a95c27da6cbdbccd0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/tracy/zipball/344c77293038173f49678d9a95c27da6cbdbccd0",
"reference": "344c77293038173f49678d9a95c27da6cbdbccd0",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-session": "*",
"php": ">=7.1"
},
"conflict": {
"nette/di": "<3.0"
},
"require-dev": {
"latte/latte": "^2.5",
"nette/di": "^3.0",
"nette/mail": "^3.0",
"nette/tester": "^2.2",
"nette/utils": "^3.0",
"phpstan/phpstan": "^0.12",
"psr/log": "^1.0"
},
"suggest": {
"https://nette.org/donate": "Please support Tracy via a donation"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
}
},
"autoload": {
"classmap": [
"src"
],
"files": [
"src/Tracy/shortcuts.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.",
"homepage": "https://tracy.nette.org",
"keywords": [
"Xdebug",
"debug",
"debugger",
"nette",
"profiler"
],
"time": "2020-02-23T18:40:15+00:00"
},
{
"name": "twig/twig",
"version": "3.x-dev",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "6384ba6c3ca7695ef0aec93bdf3b55c9bb18b5de"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/6384ba6c3ca7695ef0aec93bdf3b55c9bb18b5de",
"reference": "6384ba6c3ca7695ef0aec93bdf3b55c9bb18b5de",
"shasum": ""
},
"require": {
"php": "^7.2.5",
"symfony/polyfill-ctype": "^1.8",
"symfony/polyfill-mbstring": "^1.3"
},
"require-dev": {
"psr/container": "^1.0",
"symfony/phpunit-bridge": "^4.4|^5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Twig\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Twig Team",
"role": "Contributors"
},
{
"name": "Armin Ronacher",
"email": "armin.ronacher@active-4.com",
"role": "Project Founder"
}
],
"description": "Twig, the flexible, fast, and secure template language for PHP",
"homepage": "https://twig.symfony.com",
"keywords": [
"templating"
],
"time": "2020-02-23T08:42:33+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": {
"cmfcmf/openweathermap-php-api": 20,
"doctrine/lexer": 20,
"egulias/email-validator": 20,
"fzaninotto/faker": 20,
"twig/twig": 20,
"tracy/tracy": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}

View File

@ -1,16 +1,19 @@
<?php
// ** Database settings ** //
/* The name of the database for Allerta-vvf */
define( 'DB_NAME', 'allerta' );
define( 'DB_NAME', '@@db@@' );
/* Database username */
define( 'DB_USER', 'root' );
define( 'DB_USER', '@@user@@' );
/* Database password */
define( 'DB_PASSWORD', '' );
define( 'DB_PASSWORD', '@@password@@' );
/* Database hostname */
define( 'DB_HOST', 'localhost' );
define( 'DB_HOST', '@@host@@' );
/* Database hostname */
define( 'DB_PREFIX', '@@prefix@@' );
// ** Url settings ** //
/* The url that you use to reach Allerta */

2
server/install/buttons.min.css vendored Normal file

File diff suppressed because one or more lines are too long

2
server/install/dashicons.min.css vendored Normal file

File diff suppressed because one or more lines are too long

2
server/install/forms.min.css vendored Normal file

File diff suppressed because one or more lines are too long

2
server/install/install.min.css vendored Normal file

File diff suppressed because one or more lines are too long

239
server/install/install.php Normal file
View File

@ -0,0 +1,239 @@
<?php
if (file_exists("installHelper.php")) {
try {
require('installHelper.php');
} catch (Exception $e) {
die("Please re-download Allerta. Installation corrupted (".$e);
}
} else {
die("Please re-download Allerta. Installation corrupted");
}
if (file_exists("../config.php")) {
$runInstallation = false;
} else {
$runInstallation = true;
}
if($runInstallation){
?>
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta name="viewport" content="width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex,nofollow">
<title>Allerta installazione</title>
<link rel="stylesheet" id="dashicons-css" href="dashicons.min.css?installation" type="text/css" media="all">
<link rel="stylesheet" id="buttons-css" href="buttons.min.css?installation" type="text/css" media="all">
<link rel="stylesheet" id="forms-css" href="forms.min.css?installation" type="text/css" media="all">
<link rel="stylesheet" id="install-css" href="install.min.css?installation" type="text/css" media="all">
<?php if(isset($_POST["step"])){ if($_POST["step"] == "4"){ ?><script async src="zxcvbn.js"></script><?php } } ?>
</head>
<body class="wp-core-ui">
<p id="logo"><a href="javascript:alert('TODO: add docs');">Allerta</a></p>
<?php if(!isset($_POST["step"])){ ?>
<h1 class="screen-reader-text">Prima di iniziare</h1>
<p>Benvenuto in Allerta. Prima di iniziare abbiamo bisogno di alcune informazioni sul database. Devi conoscere i seguenti dati prima di procedere.</p>
<ol>
<li>Nome del database</li>
<li>Nome utente del database</li>
<li>Password del database</li>
<li>Host del database</li>
<li>Prefisso tabelle (se desideri eseguire più Allerta con un solo database)</li>
</ol>
<p>
Utilizzeremo queste informazioni per creare un file <code>config.php</code>. <strong>
Se per qualsiasi motivo la creazione automatica dei file non funziona, non ti preoccupare. Tutto questo non fa altro che inserire le informazioni nel database e in un file di configurazione. Puoi aprire <code>config-sample.php</code> in un editor di testo, inserire i tuoi dati, e salvarlo come <code>config.php</code>. </strong>
<p>Con ogni probabilità, queste informazioni ti sono state già fornite dal tuo fornitore di hosting. Se non disponi di queste informazioni, dovrai contattare il tuo fornitore prima di poter proseguire. Se invece è tutto pronto…</p>
<p class="step">
<form method="POST">
<input type="hidden" name="step" value="2">
<input type="submit" class="button button-large">
</form>
</p>
<?php
} else if ($_POST["step"] == "2") {
if (file_exists("../config.php")) {
try {
require('../config.php');
$dbnameValue = DB_NAME;
$unameValue = DB_USER;
$pwdValue = DB_PASSWORD;
$dbhostValue = DB_HOST;
$prefixValue = DB_PREFIX;
} catch (Exception $e) {
$dbnameValue = "allerta";
$unameValue = "utente";
$pwdValue = "password";
$dbhostValue = "localhost";
$prefixValue = "allerta01";
}
} else {
$dbnameValue = "allerta";
$unameValue = "utente";
$pwdValue = "password";
$dbhostValue = "localhost";
$prefixValue = "allerta01";
}
?>
<h1 class="screen-reader-text">Configura la connessione al database</h1>
<form method="post">
<p>Di seguito puoi inserire i dettagli di connessione al database. Se non sei sicuro dei dati da inserire contatta il tuo fornitore di hosting.</p>
<table class="form-table" role="presentation">
<tbody>
<tr>
<th scope="row"><label for="dbname">Nome database</label></th>
<td><input name="dbname" id="dbname" type="text" aria-describedby="dbname-desc" size="25" value="<?php echo $dbnameValue; ?>" autofocus=""></td>
<td id="dbname-desc">Il nome del database che vuoi utilizzare con Allerta.</td>
</tr>
<tr>
<th scope="row"><label for="uname">Nome utente</label></th>
<td><input name="uname" id="uname" type="text" aria-describedby="uname-desc" size="25" value="<?php echo $unameValue; ?>"></td>
<td id="uname-desc">Il tuo nome utente del database.</td>
</tr>
<tr>
<th scope="row"><label for="pwd">Password</label></th>
<td><input name="pwd" id="pwd" type="text" aria-describedby="pwd-desc" size="25" value="<?php echo $pwdValue; ?>" autocomplete="off"></td>
<td id="pwd-desc">La tua password del database.</td>
</tr>
<tr>
<th scope="row"><label for="dbhost">Host del database</label></th>
<td><input name="dbhost" id="dbhost" type="text" aria-describedby="dbhost-desc" size="25" value="<?php echo $dbhostValue; ?>"></td>
<td id="dbhost-desc">
Se <code>localhost</code> non funziona, puoi ottenere queste informazioni dal tuo provider di hosting.
</td>
</tr>
<tr>
<th scope="row"><label for="prefix">Prefisso tabella</label></th>
<td><input name="prefix" id="prefix" type="text" aria-describedby="prefix-desc" value="<?php echo $prefixValue; ?>" size="25"></td>
<td id="prefix-desc">Modifica questa voce se desideri eseguire più installazioni di Allerta su un singolo database.</td>
</tr>
</tbody>
</table>
<input type="hidden" name="step" value="3">
<p class="step"><input name="submit" type="submit" value="Invia" class="button button-large"></p>
</form>
<?php
} else if ($_POST["step"] == "3") {
checkConnection($_POST["dbhost"],$_POST["uname"],$_POST["pwd"],$_POST["dbname"]);
generateConfig($_POST["dbhost"],$_POST["uname"],$_POST["pwd"],$_POST["dbname"],$_POST["prefix"]);
?>
<h1 class="screen-reader-text">File di configurazione creato con successo!</h1>
<p>Ottimo lavoro, amico! Hai completato questa parte dell'installazione. Ora WordPress può comunicare con il database. Se sei pronto, ora è il momento di…</p>
<p class="step">
<form method="POST">
<input type="hidden" name="step" value="4">
<input type="submit" class="button button-large" value="Popolare il database">
</form>
</p>
<?php
} else if ($_POST["step"] == "4") {
initDB();
?>
<h1 class="screen-reader-text">Evviva!</h1>
<p>Hai <b>quasi terminato</b> l'installazione di Allerta, devi solo inserire alcune informazioni.</p>
<h2>Informazioni necessarie</h2>
<p class="step">
<form id="setup" method="post">
<script>
function validatePwd(){
var pwd = document.getElementById("pass1").value;
result = zxcvbn(pwd);
switch(result.score) {
case 1:
document.getElementById("pass1").className = "short";
document.getElementById("pass-strength-result").className = "short";
document.getElementById("pass-strength-result").innerHTML = "Molto debole";
break;
case 2:
document.getElementById("pass1").className = "bad";
document.getElementById("pass-strength-result").className = "bad";
document.getElementById("pass-strength-result").innerHTML = "Debole";
break;
case 3:
document.getElementById("pass1").className = "good";
document.getElementById("pass-strength-result").className = "good";
document.getElementById("pass-strength-result").innerHTML = "Media";
break;
case 4:
document.getElementById("pass1").className = "strong";
document.getElementById("pass-strength-result").className = "strong";
document.getElementById("pass-strength-result").innerHTML = "Forte";
break;
case 5:
document.getElementById("pass1").className = "strong";
document.getElementById("pass-strength-result").className = "strong";
document.getElementById("pass-strength-result").innerHTML = "Forte";
break;
default:
// code block
}
}
</script>
<table class="form-table" role="presentation">
<tbody>
<tr>
<th scope="row"><label for="user_login">Nome utente admin</label></th>
<td>
<input name="user_name" type="text" id="user_login" size="75" value="">
<p>I nomi utente possono essere composti soltanto da caratteri alfanumerici, spazi, trattini bassi, trattini, punti e il simbolo @.</p>
</td>
</tr>
<tr class="form-field form-required user-pass1-wrap">
<th scope="row">
<label for="pass1">
Password</label>
</th>
<td>
<div class="wp-pwd">
<input type="text" name="admin_password" id="pass1" class="regular-text short" autocomplete="off" aria-describedby="pass-strength-result" onkeyup="validatePwd()">
<div id="pass-strength-result" aria-live="polite" class="short">Molto debole</div>
</div>
<p><span class="description important">
<strong>Importante:</strong>
Avrai bisogno di questa password per accedere. Conservala in un posto sicuro.</span></p>
</td>
</tr>
<tr>
<th scope="row">Rendi utente admin visibile</th>
<td>
<fieldset>
<legend class="screen-reader-text"><span>Rendi utente admin visibile </span></legend>
<label for="admin_visible"><input name="admin_visible" type="checkbox" id="admin_visible" value="0">
Rendi l'utente admin visibile agli altri utente</label>
<p class="description">Attivando questa opzione, l'utente che verrà creato sarà visibile negli elenchi e nelle procedure.</p>
</fieldset>
</td>
</tr>
<tr>
<th scope="row"><label for="admin_email">La tua email</label></th>
<td><input name="admin_email" type="email" id="admin_email" size="50" value="">
<p>Controlla attentamente il tuo indirizzo email prima di continuare.</p></td>
</tr>
<tr>
<th scope="row"><label for="distaccamento">Distaccamento</label></th>
<td><input name="distaccamento" type="text" id="distaccamento" size="100" value="">
<p>Verrà utilizzato nei report.</p></td>
</tr>
</tbody></table>
<p class="step"><input type="submit" name="Submit" id="submit" class="button button-large" value="Installa Allerta"></p>
<input type="hidden" name="step" value="5">
</form>
</p>
<?php
} else if ($_POST["step"] == "5") {
initOptions($_POST["user_name"], $_POST["admin_visible"], $_POST["admin_password"], $_POST["admin_email"], $_POST["distaccamento"]);
?>
<h1 class="screen-reader-text">Installazione terminata con successo.</h1>
<p>Ottimo lavoro, amico! Hai completato l'installazione. Ora Allerta può funzionare correttamente. Adesso è il momento di…</p>
<p class="step">
<a href="../index.php">Eseguire il login</a>
</p>
<?php
}
?>
</div>
</body>
</html>
<?php
}
?>

View File

@ -0,0 +1,282 @@
<?php
if (file_exists('../vendor/autoload.php')) {
try {
require '../vendor/autoload.php';
} catch (Exception $e) {
die("Please install composer and run composer install (".$e);
}
} else {
die("Please install composer and run composer install");
}
function checkConnection($host, $user, $password, $database){
try{
$connection = new PDO("mysql:host=$host", $user, $password,[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$connectionOk = true;
} catch (PDOException $e){
$connectionOk = false;
?>
<div class="wp-die-message"><h1>Errore nello stabilire una connessione al database</h1>
<p>Questo potrebbe voler dire che nome utente e password nel file <code>config.php</code> sono sbagliate o che non possiamo contattare il database <code><?php echo $database; ?></code>. Potrebbe voler dire che il tuo database è irraggiungibile.</p>
<ul>
<li>Sei sicuro di avere nome utente e password corretti?</li>
<li>Sei sicuro di aver scritto l'hostname corretto?</li>
<li>Sei sicuro che il server del database sia attivo?</li>
</ul>
<p>Se non sei sicuro di cosa vogliano dire questi termini prova a contattare il tuo fornitore di hosting. Prova a fornire le seguenti informazioni:</p>
<details>
<summary>Informazioni avanzate</summary>
<pre><?php echo($e); ?></pre>
</details>
<p class="step"><a href="#" onclick="javascript:history.go(-1);return false;" class="button button-large">Riprova</a></p>
</div>
<?php
exit();
}
if($connectionOk){
try{
try{
$connection->exec("CREATE DATABASE IF NOT EXISTS " . preg_replace('/[^a-zA-Z0-9]/', '', trim($database)));
} catch(Exception $e) {
//nothing
}
$connection->exec("use " . preg_replace('/[^a-zA-Z0-9]/', '', trim($database)));
} catch (PDOException $e){
?>
<div class="wp-die-message"><h1>Impossibile selezionare il database</h1>
<p>Siamo riusciti a connetterci al server del database (il che significa che il tuo nome utente e password sono ok), ma non siamo riusciti a selezionare il database <code><?php echo $database; ?></code>.</p>
<ul>
<li>Sei sicuro che esista?</li>
<li>L'utente <code><?php echo $user; ?></code> ha i permessi per usare il database <code><?php echo $database; ?></code>?</li>
<li>In alcuni sistemi il nome del tuo database ha il tuo nome utente come prefisso, ovvero <code><?php echo $user; ?>_<?php echo $database; ?></code>. Potrebbe essere questo il problema?</li>
</ul>
<p>Se non sei sicuro di cosa vogliano dire questi termini prova a contattare il tuo fornitore di hosting. Prova a fornire le seguenti informazioni:</p>
<details>
<summary>Informazioni avanzate</summary>
<pre><?php echo($e); ?></pre>
</details>
<p class="step"><a href="#" onclick="javascript:history.go(-1);return false;" class="button button-large">Riprova</a></p>
</div>
<?php
exit();
}
}
}
function replaceInFile($edits,$file){
$content = file_get_contents($file);
foreach($edits as $edit){
$content = str_replace($edit[0],$edit[1],$content);
}
file_put_contents($file,$content);
}
function generateConfig($host,$user,$password,$db,$prefix){
try{
if (file_exists('../config.php')) {
rename("../config.php", "../config.old.php");
}
copy("../config-sample.php", "../config.php");
replaceInFile([["@@db@@", $db],["@@user@@",$user],["@@password@@",$password],["@@host@@",$host],["@@prefix@@",$prefix]],"../config.php");
} catch (Exception $e) {
?>
<div class="wp-die-message"><h1>Impossibile modificare il file di configurazioni</h1>
<p>Non siamo riusciti a scrivere il file di configurazione <code>config.php</code>, richiesto per il funzionamento del programma.<br>E' tuttavia possibile modificarlo manualmente, seguentdo le seguenti istruzioni:</p>
<ul>
<li>Accedere alla cartella di installazione di allerta (connettersi via FTP in caso di server sul cloud).</li>
<li>Rinominare il file <code>config-sample.php</code> in <code>config.php</code>.</li>
<li>Modificare le prime 16 righe del file con il seguente testo:</li>
<code>
&lt;?php<br>
// ** Database settings ** //<br>
/* The name of the database for Allerta-vvf */<br>
define( 'DB_NAME', '<?php echo $db; ?>' );<br>
<br>
/* Database username */<br>
define( 'DB_USER', '<?php echo $user; ?>' );<br>
<br>
/* Database password */<br>
define( 'DB_PASSWORD', '<?php echo $password; ?>' );<br>
<br>
/* Database hostname */<br>
define( 'DB_HOST', '<?php echo $host; ?>' );<br>
<br>
/* Database hostname */<br>
define( 'DB_PREFIX', '<?php echo $prefix; ?>' );<br>
</code>
</ul>
<p>Se non sei sicuro di cosa vogliano dire questi termini prova a contattare il tuo fornitore di hosting. Prova a fornire le seguenti informazioni:</p>
<details>
<summary>Informazioni avanzate</summary>
<pre><?php echo($e); ?></pre>
</details>
<p class="step"><a href="#" onclick="javascript:history.go(-1);return false;" class="button button-large">Riprova</a></p>
</div>
<?php
exit();
}
}
function initDB(){
try{
require "../config.php";
$connection = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME, DB_USER, DB_PASSWORD,[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$prefix = DB_PREFIX;
$connection->exec("
CREATE TABLE IF NOT EXISTS `".$prefix."_certificati` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`codice` text NOT NULL,
`nome` text NOT NULL,
`interventi` text NOT NULL,
`url` text NOT NULL,
`file` text NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `".$prefix."_esercitazioni` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`data` date NOT NULL,
`nome` varchar(999) NOT NULL,
`inizio` time NOT NULL,
`fine` time NOT NULL,
`personale` text NOT NULL,
`capo` text NOT NULL,
`luogo` text NOT NULL,
`note` text NOT NULL,
`dec` varchar(999) NOT NULL DEFAULT 'test',
`inseritoda` varchar(200) NOT NULL DEFAULT 'test',
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `".$prefix."_interventi` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`data` date NOT NULL,
`codice` text NOT NULL,
`uscita` time NOT NULL,
`rientro` time NOT NULL,
`capo` varchar(999) NOT NULL DEFAULT 'test',
`autisti` varchar(999) NOT NULL DEFAULT 'test',
`personale` varchar(999) NOT NULL DEFAULT 'test',
`luogo` varchar(999) NOT NULL DEFAULT 'test',
`note` varchar(999) NOT NULL DEFAULT 'test',
`tipo` text NOT NULL,
`incrementa` varchar(999) NOT NULL,
`inseritoda` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `".$prefix."_intrusioni` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pagina` varchar(999) COLLATE utf8mb4_unicode_ci NOT NULL,
`data` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`ora` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`ip` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`servervar` varchar(9999) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `".$prefix."_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`azione` varchar(100) NOT NULL,
`subisce` varchar(100) NOT NULL,
`agisce` varchar(100) NOT NULL,
`data` varchar(100) NOT NULL,
`ora` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `".$prefix."_minuti` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`mese` enum('gennaio','febbraio','marzo','aprile','maggio','giugno','luglio','agosto','settembre','ottobre','novembre','dicembre') NOT NULL,
`anno` varchar(4) NOT NULL,
`list` mediumtext NOT NULL,
`a1` mediumtext NOT NULL,
`a2` mediumtext NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `".$prefix."_tipo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` text NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `nometipologia` (`nome`(99))
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `".$prefix."_vigili` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role` INT(50) NOT NULL DEFAULT '0',
`hidden` BOOLEAN NOT NULL DEFAULT FALSE,
`disabled` BOOLEAN NOT NULL DEFAULT FALSE,
`nome` text CHARACTER SET utf8 NOT NULL,
`disponibile` tinyint(1) NOT NULL DEFAULT 0,
`caposquadra` tinyint(1) NOT NULL DEFAULT 0,
`autista` tinyint(1) NOT NULL DEFAULT 0,
`telefono` varchar(25) DEFAULT NULL,
`password` varchar(200) NOT NULL,
`password_hash` varchar(2000) NOT NULL,
`interventi` int(11) NOT NULL DEFAULT 0,
`esercitazioni` int(11) NOT NULL,
`online` tinyint(1) NOT NULL DEFAULT 0,
`online_time` int(11) NOT NULL,
`minuti_dispo` int(11) NOT NULL,
`immagine` varchar(1000) NOT NULL,
PRIMARY KEY (`id`),
KEY `Id` (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `".$prefix."_options` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` TEXT NOT NULL, `value` MEDIUMTEXT NOT NULL,
`enabled` BOOLEAN NOT NULL DEFAULT TRUE,
`created_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`last_edit` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`user_id` INT NOT NULL,
PRIMARY KEY (`id`),
KEY `Id` (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `".$prefix."_dbversion` (
`id` INT NOT NULL AUTO_INCREMENT,
`version` INT NOT NULL,
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `Id` (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `".$prefix."_dbversion` (`id`, `version`, `timestamp`) VALUES (NULL, '1', current_timestamp());");
} catch (Exception $e) {
?>
<div class="wp-die-message"><h1>Impossibile creare le tabelle</h1>
<p>Siamo riusciti a connetterci al server del database (il che significa che il tuo nome utente e password sono ok), ma non siamo riusciti a creare le tabelle.</p>
<p>Se non sei sicuro di cosa vogliano dire questi termini prova a contattare il tuo fornitore di hosting. Prova a fornire le seguenti informazioni:</p>
<details>
<summary>Informazioni avanzate</summary>
<pre><?php echo($e); ?></pre>
</details>
<p class="step"><a href="#" onclick="javascript:history.go(-1);return false;" class="button button-large">Riprova</a></p>
</div>
<?php
exit();
}
}
function initOptions($name, $visible, $password, $report_email, $distaccamento){
try{
require_once "../config.php";
$connection = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME, DB_USER, DB_PASSWORD,[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$prefix = DB_PREFIX;
$prep = $connection->prepare("
INSERT INTO `".$prefix."_vigili` (`id`, `role`, `hidden`, `disabled`, `nome`, `disponibile`, `caposquadra`, `autista`, `telefono`, `password`, `password_hash`, `interventi`, `esercitazioni`, `online`, `online_time`, `minuti_dispo`, `immagine`) VALUES ('1', '5', :hidden, '0', :name, '0', '1', '0', NULL, MD5(:password), '', '0', '0', '0', '0', '0', '');
INSERT INTO `".$prefix."_options` (`id`, `name`, `value`, `enabled`, `created_time`, `last_edit`, `user_id`) VALUES ('1', 'report_email', :report_email, '1', current_timestamp(), current_timestamp(), '1');
INSERT INTO `".$prefix."_options` (`id`, `name`, `value`, `enabled`, `created_time`, `last_edit`, `user_id`) VALUES ('2', 'distaccamento', :distaccamento, '1', current_timestamp(), current_timestamp(), '1');");
$prep->bindParam(':name', $name, PDO::PARAM_STR);
$prep->bindParam(':hidden', $visible, PDO::PARAM_INT);
$prep->bindParam(':password', $password, PDO::PARAM_STR);
$prep->bindParam(':report_email', $report_email, PDO::PARAM_STR);
$prep->bindParam(':distaccamento', $distaccamento, PDO::PARAM_STR);
$prep->execute();
} catch (Exception $e) {
?>
<div class="wp-die-message"><h1>Impossibile riempire le tabelle</h1>
<p>Siamo riusciti a connetterci al server del database (il che significa che il tuo nome utente e password sono ok), ma non siamo riusciti a riempire le tabelle.</p>
<p>Se non sei sicuro di cosa vogliano dire questi termini prova a contattare il tuo fornitore di hosting. Prova a fornire le seguenti informazioni:</p>
<details>
<summary>Informazioni avanzate</summary>
<pre><?php echo($e); ?></pre>
</details>
<p class="step"><a href="#" onclick="javascript:history.go(-1);return false;" class="button button-large">Riprova</a></p>
</div>
<?php
exit();
}
}

103
server/install/prova.php Normal file
View File

@ -0,0 +1,103 @@
<?php
require "../config.php";
$connection = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME, DB_USER, DB_PASSWORD,[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$connection->exec(
<<<EOL
CREATE TABLE IF NOT EXISTS `certificati` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`codice` text NOT NULL,
`nome` text NOT NULL,
`interventi` text NOT NULL,
`url` text NOT NULL,
`file` text NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `esercitazioni` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`data` date NOT NULL,
`nome` varchar(999) NOT NULL,
`inizio` time NOT NULL,
`fine` time NOT NULL,
`personale` text NOT NULL,
`capo` text NOT NULL,
`luogo` text NOT NULL,
`note` text NOT NULL,
`dec` varchar(999) NOT NULL DEFAULT 'test',
`inseritoda` varchar(200) NOT NULL DEFAULT 'test',
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `interventi` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`data` date NOT NULL,
`codice` text NOT NULL,
`uscita` time NOT NULL,
`rientro` time NOT NULL,
`capo` varchar(999) NOT NULL DEFAULT 'test',
`autisti` varchar(999) NOT NULL DEFAULT 'test',
`personale` varchar(999) NOT NULL DEFAULT 'test',
`luogo` varchar(999) NOT NULL DEFAULT 'test',
`note` varchar(999) NOT NULL DEFAULT 'test',
`tipo` text NOT NULL,
`incrementa` varchar(999) NOT NULL,
`inseritoda` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `intrusioni` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pagina` varchar(999) COLLATE utf8mb4_unicode_ci NOT NULL,
`data` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`ora` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`ip` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`servervar` varchar(9999) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`azione` varchar(100) NOT NULL,
`subisce` varchar(100) NOT NULL,
`agisce` varchar(100) NOT NULL,
`data` varchar(100) NOT NULL,
`ora` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `minuti` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`mese` enum('gennaio','febbraio','marzo','aprile','maggio','giugno','luglio','agosto','settembre','ottobre','novembre','dicembre') NOT NULL,
`anno` varchar(4) NOT NULL,
`list` mediumtext NOT NULL,
`a1` mediumtext NOT NULL,
`a2` mediumtext NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `tipo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` text NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `nometipologia` (`nome`(99))
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `vigili` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` text CHARACTER SET utf8 NOT NULL,
`disponibile` tinyint(1) NOT NULL DEFAULT 0,
`caposquadra` tinyint(1) NOT NULL DEFAULT 0,
`autista` tinyint(1) NOT NULL DEFAULT 0,
`telefono` varchar(25) DEFAULT NULL,
`password` varchar(200) NOT NULL,
`password_hash` varchar(2000) NOT NULL,
`interventi` int(11) NOT NULL DEFAULT 0,
`esercitazioni` int(11) NOT NULL,
`online` tinyint(1) NOT NULL DEFAULT 0,
`online_time` int(11) NOT NULL,
`minuti_dispo` int(11) NOT NULL,
`immagine` varchar(1000) NOT NULL,
PRIMARY KEY (`id`),
KEY `Id` (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `dbversion` (
`id` INT NOT NULL AUTO_INCREMENT,
`version` INT NOT NULL,
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `Id` (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
EOL);

28
server/install/zxcvbn.js Normal file

File diff suppressed because one or more lines are too long