Merge branch 'phpservermon:develop' into develop

pull/1111/head
ivnilv 2021-10-05 19:57:08 +03:00 committed by GitHub
commit 5ba1a41f78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 567 additions and 103 deletions

2
.github/FUNDING.yml vendored
View File

@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl
liberapay: # Replace with a single Liberapay username liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username otechie: # Replace with a single Otechie username
custom: ["https://www.paypal.me/TimZandbergen99", "https://bunq.me/t"] custom: ["https://www.paypal.me/TimZandbergen99", "https://bunq.me/timz99"]

View File

@ -4,7 +4,9 @@ PHP Server Monitor
.. image:: https://badges.gitter.im/Join%20Chat.svg .. image:: https://badges.gitter.im/Join%20Chat.svg
:alt: Join the chat at https://gitter.im/erickrf/nlpnet :alt: Join the chat at https://gitter.im/erickrf/nlpnet
:target: https://gitter.im/phpservermon/phpservermon :target: https://gitter.im/phpservermon/phpservermon
.. image:: https://cdn.huntr.dev/huntr_security_badge_mono.svg
:alt: huntr
:target: https://huntr.dev
Version 3.6.0.beta2 Version 3.6.0.beta2
PHP Server Monitor is a script that checks whether your websites and servers are up and running. PHP Server Monitor is a script that checks whether your websites and servers are up and running.
@ -64,7 +66,8 @@ The following SMS gateways are currently available:
* OVH SMS PRO - <https://www.ovhtelecom.fr/sms> * OVH SMS PRO - <https://www.ovhtelecom.fr/sms>
* PromoSMS - <https://promosms.com> * PromoSMS - <https://promosms.com>
* Infobip - <https://www.infobip.com> * Infobip - <https://www.infobip.com>
* LabsMobile - <https://www.labsmobile.com>
* Tele2 Messaging - <https://portal.tele2messaging.com>
Please note: for these gateways you will need an account with sufficient credits. Please note: for these gateways you will need an account with sufficient credits.

View File

@ -9,7 +9,7 @@
"ext-json": "*", "ext-json": "*",
"ext-pdo": "*", "ext-pdo": "*",
"ext-xml": "*", "ext-xml": "*",
"phpmailer/phpmailer": ">=6.0.6 ~6.0", "phpmailer/phpmailer": ">=6.5.0 ~6.0",
"symfony/config": "~3.4", "symfony/config": "~3.4",
"symfony/dependency-injection": "~3.4", "symfony/dependency-injection": "~3.4",
"symfony/event-dispatcher": "~3.4", "symfony/event-dispatcher": "~3.4",
@ -30,4 +30,4 @@
"psm\\": "src/psm/" "psm\\": "src/psm/"
} }
} }
} }

253
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "984f0f8f41cf0e1d0b08397e6bb565a0", "content-hash": "c967e1466fd2a2effd7f76650bba60d7",
"packages": [ "packages": [
{ {
"name": "jaxl/jaxl", "name": "jaxl/jaxl",
@ -77,6 +77,11 @@
"php", "php",
"xmpp" "xmpp"
], ],
"support": {
"forum": "https://groups.google.com/forum/#!forum/jaxl",
"issues": "https://github.com/jaxl/JAXL/issues",
"source": "https://github.com/jaxl/JAXL"
},
"time": "2016-09-13T01:59:35+00:00" "time": "2016-09-13T01:59:35+00:00"
}, },
{ {
@ -129,20 +134,24 @@
"composer-installer", "composer-installer",
"composer-plugin" "composer-plugin"
], ],
"support": {
"issues": "https://github.com/mnsami/composer-custom-directory-installer/issues",
"source": "https://github.com/mnsami/composer-custom-directory-installer/tree/master"
},
"time": "2016-05-25T08:26:02+00:00" "time": "2016-05-25T08:26:02+00:00"
}, },
{ {
"name": "paragonie/random_compat", "name": "paragonie/random_compat",
"version": "v2.0.19", "version": "v2.0.20",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/paragonie/random_compat.git", "url": "https://github.com/paragonie/random_compat.git",
"reference": "446fc9faa5c2a9ddf65eb7121c0af7e857295241" "reference": "0f1f60250fccffeaf5dda91eea1c018aed1adc2a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/446fc9faa5c2a9ddf65eb7121c0af7e857295241", "url": "https://api.github.com/repos/paragonie/random_compat/zipball/0f1f60250fccffeaf5dda91eea1c018aed1adc2a",
"reference": "446fc9faa5c2a9ddf65eb7121c0af7e857295241", "reference": "0f1f60250fccffeaf5dda91eea1c018aed1adc2a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -178,7 +187,12 @@
"pseudorandom", "pseudorandom",
"random" "random"
], ],
"time": "2020-10-15T10:06:57+00:00" "support": {
"email": "info@paragonie.com",
"issues": "https://github.com/paragonie/random_compat/issues",
"source": "https://github.com/paragonie/random_compat"
},
"time": "2021-04-17T09:33:01+00:00"
}, },
{ {
"name": "php-pushover/php-pushover", "name": "php-pushover/php-pushover",
@ -194,6 +208,7 @@
"reference": "ef1df985bf3acb17b1f1f8fe2df2c3c9a16bef32", "reference": "ef1df985bf3acb17b1f1f8fe2df2c3c9a16bef32",
"shasum": "" "shasum": ""
}, },
"default-branch": true,
"type": "library", "type": "library",
"autoload": { "autoload": {
"files": [ "files": [
@ -208,20 +223,24 @@
} }
], ],
"description": "PHP class for the Pushover.net project", "description": "PHP class for the Pushover.net project",
"support": {
"issues": "https://github.com/cschalenborgh/php-pushover/issues",
"source": "https://github.com/cschalenborgh/php-pushover/tree/master"
},
"time": "2021-01-12T12:43:39+00:00" "time": "2021-01-12T12:43:39+00:00"
}, },
{ {
"name": "phpmailer/phpmailer", "name": "phpmailer/phpmailer",
"version": "v6.4.0", "version": "v6.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git", "url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "050d430203105c27c30efd1dce7aa421ad882d01" "reference": "a5b5c43e50b7fba655f793ad27303cd74c57363c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/050d430203105c27c30efd1dce7aa421ad882d01", "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/a5b5c43e50b7fba655f793ad27303cd74c57363c",
"reference": "050d430203105c27c30efd1dce7aa421ad882d01", "reference": "a5b5c43e50b7fba655f793ad27303cd74c57363c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -274,7 +293,17 @@
} }
], ],
"description": "PHPMailer is a full-featured email creation and transfer class for PHP", "description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"time": "2021-03-31T20:06:42+00:00" "support": {
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.5.0"
},
"funding": [
{
"url": "https://github.com/Synchro",
"type": "github"
}
],
"time": "2021-06-16T14:33:43+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",
@ -318,6 +347,10 @@
"container-interop", "container-interop",
"psr" "psr"
], ],
"support": {
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/1.1.1"
},
"time": "2021-03-05T17:36:06+00:00" "time": "2021-03-05T17:36:06+00:00"
}, },
{ {
@ -377,6 +410,23 @@
], ],
"description": "Symfony Config Component", "description": "Symfony Config Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/config/tree/v3.4.47"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-24T10:57:07+00:00" "time": "2020-10-24T10:57:07+00:00"
}, },
{ {
@ -443,6 +493,23 @@
], ],
"description": "Symfony DependencyInjection Component", "description": "Symfony DependencyInjection Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/dependency-injection/tree/v3.4.47"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-24T10:57:07+00:00" "time": "2020-10-24T10:57:07+00:00"
}, },
{ {
@ -502,6 +569,23 @@
], ],
"description": "Symfony EventDispatcher Component", "description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/event-dispatcher/tree/v3.4.47"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-24T10:57:07+00:00" "time": "2020-10-24T10:57:07+00:00"
}, },
{ {
@ -547,6 +631,23 @@
], ],
"description": "Symfony Filesystem Component", "description": "Symfony Filesystem Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v3.4.47"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-24T10:57:07+00:00" "time": "2020-10-24T10:57:07+00:00"
}, },
{ {
@ -596,20 +697,37 @@
], ],
"description": "Symfony HttpFoundation Component", "description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-foundation/tree/v3.4.47"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-24T10:57:07+00:00" "time": "2020-10-24T10:57:07+00:00"
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
"version": "v1.22.1", "version": "v1.23.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git", "url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "c6c942b1ac76c82448322025e084cadc56048b4e" "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"reference": "c6c942b1ac76c82448322025e084cadc56048b4e", "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -621,7 +739,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-main": "1.22-dev" "dev-main": "1.23-dev"
}, },
"thanks": { "thanks": {
"name": "symfony/polyfill", "name": "symfony/polyfill",
@ -658,20 +776,37 @@
"polyfill", "polyfill",
"portable" "portable"
], ],
"time": "2021-01-07T16:49:33+00:00" "support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-02-19T12:13:01+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.22.1", "version": "v1.23.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "5232de97ee3b75b0360528dae24e73db49566ab1" "reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/5232de97ee3b75b0360528dae24e73db49566ab1", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2df51500adbaebdc4c38dea4c89a2e131c45c8a1",
"reference": "5232de97ee3b75b0360528dae24e73db49566ab1", "reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -683,7 +818,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-main": "1.22-dev" "dev-main": "1.23-dev"
}, },
"thanks": { "thanks": {
"name": "symfony/polyfill", "name": "symfony/polyfill",
@ -721,7 +856,24 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2021-01-22T09:19:47+00:00" "support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-05-27T09:27:20+00:00"
}, },
{ {
"name": "symfony/polyfill-php70", "name": "symfony/polyfill-php70",
@ -772,20 +924,37 @@
"portable", "portable",
"shim" "shim"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-php70/tree/v1.20.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-23T14:02:19+00:00" "time": "2020-10-23T14:02:19+00:00"
}, },
{ {
"name": "twig/twig", "name": "twig/twig",
"version": "v1.44.2", "version": "v1.44.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/twigphp/Twig.git", "url": "https://github.com/twigphp/Twig.git",
"reference": "138c493c5b8ee7cff3821f80b8896d371366b5fe" "reference": "4d400421528e9fa40caaffcf7824c172526dd99d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/138c493c5b8ee7cff3821f80b8896d371366b5fe", "url": "https://api.github.com/repos/twigphp/Twig/zipball/4d400421528e9fa40caaffcf7824c172526dd99d",
"reference": "138c493c5b8ee7cff3821f80b8896d371366b5fe", "reference": "4d400421528e9fa40caaffcf7824c172526dd99d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -836,7 +1005,21 @@
"keywords": [ "keywords": [
"templating" "templating"
], ],
"time": "2021-01-05T10:10:05+00:00" "support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v1.44.4"
},
"funding": [
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/twig/twig",
"type": "tidelift"
}
],
"time": "2021-05-16T12:11:20+00:00"
}, },
{ {
"name": "viharm/php-db-auth", "name": "viharm/php-db-auth",
@ -884,6 +1067,10 @@
"database", "database",
"php" "php"
], ],
"support": {
"issues": "https://bitbucket.org/viharm/phpdbauth/issues",
"source": "https://bitbucket.org/viharm/phpdbauth/src/60c1b0a28d26178d5e4960d49185af85734643c6/?at=master"
},
"time": "2020-01-05T11:48:12+00:00" "time": "2020-01-05T11:48:12+00:00"
}, },
{ {
@ -973,6 +1160,10 @@
"openldap", "openldap",
"php" "php"
], ],
"support": {
"issues": "https://bitbucket.org/viharm/phpldapauth/issues",
"source": "https://bitbucket.org/viharm/phpldapauth/src/3a60e626bfb63eda786dad30f09bd75fd5172cb1/?at=v2.5.1"
},
"time": "2020-11-24T21:56:47+00:00" "time": "2020-11-24T21:56:47+00:00"
}, },
{ {
@ -1018,6 +1209,9 @@
"php server monitor", "php server monitor",
"psm" "psm"
], ],
"support": {
"issues": "https://gitlab.com/viharm/PsmLDAPauth/issues"
},
"time": "2020-11-24T22:57:57+00:00" "time": "2020-11-24T22:57:57+00:00"
} }
], ],
@ -1036,5 +1230,6 @@
"ext-pdo": "*", "ext-pdo": "*",
"ext-xml": "*" "ext-xml": "*"
}, },
"platform-dev": [] "platform-dev": [],
"plugin-api-version": "2.0.0"
} }

View File

@ -603,7 +603,9 @@ namespace {
$phpmailer->Host = psm_get_conf('email_smtp_host'); $phpmailer->Host = psm_get_conf('email_smtp_host');
$phpmailer->Port = (int)psm_get_conf('email_smtp_port'); $phpmailer->Port = (int)psm_get_conf('email_smtp_port');
$phpmailer->SMTPSecure = psm_get_conf('email_smtp_security'); $phpmailer->SMTPSecure = psm_get_conf('email_smtp_security');
if (psm_get_conf('email_smtp_security') == ''){
$phpmailer->SMTPAutoTLS = false;
}
$smtp_user = psm_get_conf('email_smtp_username'); $smtp_user = psm_get_conf('email_smtp_username');
$smtp_pass = psm_password_decrypt( $smtp_pass = psm_password_decrypt(
psm_get_conf('password_encrypt_key'), psm_get_conf('password_encrypt_key'),
@ -805,6 +807,11 @@ namespace {
break; break;
case 'promosms': case 'promosms':
$sms = new \psm\Txtmsg\PromoSMS(); $sms = new \psm\Txtmsg\PromoSMS();
case 'labsmobile':
$sms = new \psm\Txtmsg\LabsMobile();
break;
case 'tele2':
$sms = new \psm\Txtmsg\Tele2();
break; break;
} }

View File

@ -30,7 +30,7 @@
/** /**
* Current PSM version * Current PSM version
*/ */
define('PSM_VERSION', '3.6.0.beta2'); define('PSM_VERSION', '3.6.0');
/** /**
* URL to check for updates. Will not be checked if turned off on config page. * URL to check for updates. Will not be checked if turned off on config page.

View File

@ -136,7 +136,7 @@ $sm_lang = array(
rel="noopener"><button class="btn btn-primary">Étape suivante</button></a> rel="noopener"><button class="btn btn-primary">Étape suivante</button></a>
<br>Cela va ouvrir une conversation avec le BOT. Vous devez appuyer sur <br>Cela va ouvrir une conversation avec le BOT. Vous devez appuyer sur
\'/start\' ou le saisir.', \'/start\' ou le saisir.',
'telegram_bot_username_error_token' => '<b>401 - Unauthorized</b>. Assuez-vous que le Token API soit valide.', 'telegram_bot_username_error_token' => '<b>401 - Unauthorized</b>. Assurez-vous que le Token API soit valide.',
'telegram_bot_error' => 'Une erreur s\'est produite en tentant d\'activer les notifications Telegram&nbsp;: %s', 'telegram_bot_error' => 'Une erreur s\'est produite en tentant d\'activer les notifications Telegram&nbsp;: %s',
'delete_title' => 'Supprimer un utilisateur', 'delete_title' => 'Supprimer un utilisateur',
'delete_message' => 'Êtes-vous sûr de vouloir supprimer l\'utilisateur \'%1\'&nbsp;?', 'delete_message' => 'Êtes-vous sûr de vouloir supprimer l\'utilisateur \'%1\'&nbsp;?',
@ -194,7 +194,7 @@ $sm_lang = array(
'custom_request_method' => 'Type de requête personalisée', 'custom_request_method' => 'Type de requête personalisée',
'popular_request_methods' => 'Type de requête prédéfinie', 'popular_request_methods' => 'Type de requête prédéfinie',
'post_field' => 'Champ POST', 'post_field' => 'Champ POST',
'post_field_description' => 'Les données qui seront envoyés en utilisant le type de requête choisi.', 'post_field_description' => 'Les données qui seront envoyées en utilisant le type de requête choisi.',
'please_select' => 'Veuillez choisir', 'please_select' => 'Veuillez choisir',
'type' => 'Type', 'type' => 'Type',
'type_website' => 'Site Web', 'type_website' => 'Site Web',
@ -209,14 +209,14 @@ $sm_lang = array(
site, le serveur sera considéré hors-ligne.', site, le serveur sera considéré hors-ligne.',
'redirect_check' => 'La redirection vers un autre domaine est', 'redirect_check' => 'La redirection vers un autre domaine est',
'redirect_check_description' => 'Une redirection vers un autre domaine est généralement mauvais signe.', 'redirect_check_description' => 'Une redirection vers un autre domaine est généralement mauvais signe.',
'allow_http_status' => 'Autoriser les codes de status HTTP', 'allow_http_status' => 'Autoriser Les codes de statuts HTTP',
'allow_http_status_description' => 'Marquer le serveur en ligne. Les codes de status HTTP inférieur à 400 'allow_http_status_description' => 'Marquer le serveur en ligne. Les codes de statuts HTTP inférieur à 400
sont considérés comme en ligne par défaut. Séparés les valeurs avec sont considérés comme en ligne par défaut. Séparer les valeurs avec
|.', |.',
'header_name' => 'Nom d\'en-têtes', 'header_name' => 'Nom d\'en-têtes',
'header_value' => 'Valeur d\'en-tête', 'header_value' => 'Valeur d\'en-tête',
'header_name_description' => 'Sensible à la casse.', 'header_name_description' => 'Sensible à la casse.',
'header_value_description' => 'Les expréssions régulières sont autorisées.', 'header_value_description' => 'Les expressions régulières sont autorisées.',
'last_check' => 'Dernière vérification', 'last_check' => 'Dernière vérification',
'last_online' => 'Dernière fois OK', 'last_online' => 'Dernière fois OK',
'last_offline' => 'Dernière fois hors-ligne', 'last_offline' => 'Dernière fois hors-ligne',
@ -277,11 +277,10 @@ $sm_lang = array(
'general' => 'Général', 'general' => 'Général',
'language' => 'Langue', 'language' => 'Langue',
'show_update' => 'Vérifier les nouvelles mises à jour chaque semaine', 'show_update' => 'Vérifier les nouvelles mises à jour chaque semaine',
'password_encrypt_key' => 'Clée de cryptage des mots de passe', 'password_encrypt_key' => 'Clé de chiffrement des mots de passe',
'password_encrypt_key_note' => 'Cette clée est utilisée pour crypter les mots de passe qui sont enregistrés 'password_encrypt_key_note' => 'Cette clé est utilisée pour chiffrer les mots
dans la base de donnée pour les serveurs qui requiert une authentification. de passe qui sont enregistrés dans la base de données pour les serveurs qui requierent une authentification. Si la clé
Si la clé est modifié, les mots de passe enregistré ne seront plus est modifiée, les mots de passe enregistrés ne seront plus valide&nbsp;!',
valide&nbsp;!',
'proxy' => 'Activer le proxy', 'proxy' => 'Activer le proxy',
'proxy_url' => 'URL du proxy', 'proxy_url' => 'URL du proxy',
'proxy_user' => 'Nom d\'utilisateur du proxy', 'proxy_user' => 'Nom d\'utilisateur du proxy',
@ -358,8 +357,8 @@ $sm_lang = array(
'settings_notification' => 'Configuration des notifications', 'settings_notification' => 'Configuration des notifications',
'settings_log' => 'Configuration des événements', 'settings_log' => 'Configuration des événements',
'settings_proxy' => 'Configuration du proxy', 'settings_proxy' => 'Configuration du proxy',
'auto_refresh' => 'Auto-rachaîchissement', 'auto_refresh' => 'Auto-rafraîchissement',
'auto_refresh_description' => 'Auto-rachaîchissement de la page serveurs.<br><span class="small">Temps en 'auto_refresh_description' => 'Auto-rafraîchissement de la page serveurs.<br><span class="small">Temps en
secondes. Si 0, la page n\'est pas rafraîchie.</span>', secondes. Si 0, la page n\'est pas rafraîchie.</span>',
'test' => 'Tester', 'test' => 'Tester',
'test_email' => 'Un email va vous être envoyé à l\'adresse définie dans votre profil utilisateur.', 'test_email' => 'Un email va vous être envoyé à l\'adresse définie dans votre profil utilisateur.',
@ -385,9 +384,9 @@ $sm_lang = array(
définie dans votre profil.', définie dans votre profil.',
'telegram_sent' => 'Notification Telegram envoyée', 'telegram_sent' => 'Notification Telegram envoyée',
'telegram_error' => 'Une erreur s\'est produite lors de l\'envoi de la notification&nbsp;: %s', 'telegram_error' => 'Une erreur s\'est produite lors de l\'envoi de la notification&nbsp;: %s',
'telegram_error_notoken' => 'Impossible d\'envoyé la notification de test&nbsp;: aucun token APII token 'telegram_error_notoken' => 'Impossible d\'envoyer la notification de test&nbsp;: aucun token APII token
trouvé dans la configuration.', trouvé dans la configuration.',
'telegram_error_noid' => 'Impossible d\'envoyé la notification de test&nbsp;: aucun ID de conversation 'telegram_error_noid' => 'Impossible d\'envoyer la notification de test&nbsp;: aucun ID de conversation
trouvé dans votre profil utilisateur.', trouvé dans votre profil utilisateur.',
'log_retention_period' => 'Durée de conservation', 'log_retention_period' => 'Durée de conservation',
'log_retention_period_description' => 'Nombre de jours de conservation des événements envoyés et des temps 'log_retention_period_description' => 'Nombre de jours de conservation des événements envoyés et des temps
@ -416,7 +415,7 @@ $sm_lang = array(
'on_pushover_message' => 'Le Serveur \'%LABEL%\' est de nouveau OK, il était hors-ligne pendant 'on_pushover_message' => 'Le Serveur \'%LABEL%\' est de nouveau OK, il était hors-ligne pendant
%LAST_OFFLINE_DURATION%:<br><br>Serveur: %LABEL%<br>IP: %IP%<br>Port: %LAST_OFFLINE_DURATION%:<br><br>Serveur: %LABEL%<br>IP: %IP%<br>Port:
%PORT%<br>Date: %DATE%', %PORT%<br>Date: %DATE%',
'on_telegram_message' => 'Server \'%LABEL%\' is running again, it was down for: 'on_telegram_message' => 'Server \'%LABEL%\' est de nouveau OK, il était hors-ligne pendant:
%LAST_OFFLINE_DURATION%<br><br>Server: %LABEL%<br>IP: %IP%<br>Port: %PORT%<br>Date: %LAST_OFFLINE_DURATION%<br><br>Server: %LABEL%<br>IP: %IP%<br>Port: %PORT%<br>Date:
%DATE%', %DATE%',
'combi_off_email_message' => '<ul><li>Serveur&nbsp;: %LABEL%</li><li>IP&nbsp;: %IP%</li><li>Port&nbsp;: 'combi_off_email_message' => '<ul><li>Serveur&nbsp;: %LABEL%</li><li>IP&nbsp;: %IP%</li><li>Port&nbsp;:
@ -433,15 +432,15 @@ $sm_lang = array(
%DATE%</li></ul>', %DATE%</li></ul>',
'combi_on_telegram_message' => '- Serveur&nbsp;: %LABEL%<br>- IP: %IP%<br>- Port&nbsp;: %PORT%<br>- 'combi_on_telegram_message' => '- Serveur&nbsp;: %LABEL%<br>- IP: %IP%<br>- Port&nbsp;: %PORT%<br>-
Durée&nbsp;: %LAST_OFFLINE_DURATION%<br>- Date&nbsp;: %DATE%<br><br>', Durée&nbsp;: %LAST_OFFLINE_DURATION%<br>- Date&nbsp;: %DATE%<br><br>',
'combi_email_subject' => 'IMPORTANT&nbsp;: \'%UP%\' serveurs de nouveaux en ligne, \'%DOWN%\' serveurs 'combi_email_subject' => 'IMPORTANT&nbsp;: \'%UP%\' serveur(s) de nouveau en ligne, \'%DOWN%\'
hors-ligne', hors-ligne',
'combi_pushover_subject' => '\'%UP%\' serveurs de nouveaux en ligne, \'%DOWN%\' serveurs hors-ligne', 'combi_pushover_subject' => '\'%UP%\' serveur(s) de nouveaux en ligne, \'%DOWN%\' serveur(s) hors-ligne',
'combi_email_message' => '<b>Les serveurs suivants sont hors-ligne&nbsp;:</b><br>%DOWN_SERVERS%<br><b>Les 'combi_email_message' => '<b>Le(s) serveur(s) suivant(s) hors-ligne&nbsp;:</b><br>%DOWN_SERVERS%<br><b>Le(s)
serveurs suivants sont en ligne&nbsp;:</b><br>%UP_SERVERS%', serveur(s) suivant(s) en ligne&nbsp;:</b><br>%UP_SERVERS%',
'combi_pushover_message' => '<b>Les serveurs suivants sont hors-ligne&nbsp;:</b><br>%DOWN_SERVERS%<br><b>Les 'combi_pushover_message' => '<b>Le(s) serveur(s) suivant(s) hors-ligne&nbsp;:</b><br>%DOWN_SERVERS%<br><b>Le(s)
serveurs suivants sont en ligne&nbsp;:</b><br>%UP_SERVERS%', serveur(s) suivant(s) en ligne&nbsp;:</b><br>%UP_SERVERS%',
'combi_telegram_message' => '<b>Les serveurs suivants sont hors-ligne&nbsp;:</b><br>%DOWN_SERVERS%<br><b>Les 'combi_telegram_message' => '<b>Le(s) serveur(s) suivant(s) hors-ligne&nbsp;:</b><br>%DOWN_SERVERS%<br><b>Le(s)
serveurs suivants sont en ligne&nbsp;:</b><br>%UP_SERVERS%', serveur(s) suivant(s) en ligne&nbsp;:</b><br>%UP_SERVERS%',
), ),
'login' => array( 'login' => array(
'welcome_usermenu' => 'Bonjour %user_name%', 'welcome_usermenu' => 'Bonjour %user_name%',

View File

@ -72,7 +72,7 @@ class User
protected $user_id; protected $user_id;
/** /**
*Current user preferences * Current user preferences
* @var array $user_preferences * @var array $user_preferences
*/ */
protected $user_preferences; protected $user_preferences;
@ -198,9 +198,9 @@ class User
{ {
if (isset($_COOKIE['rememberme'])) { if (isset($_COOKIE['rememberme'])) {
// extract data from the cookie // extract data from the cookie
list ($user_id, $token, $hash) = explode(':', $_COOKIE['rememberme']); list($user_id, $token, $hash) = explode('_', $_COOKIE['rememberme']);
// check cookie hash validity // check cookie hash validity
if ($hash == hash('sha256', $user_id . ':' . $token . PSM_LOGIN_COOKIE_SECRET_KEY) && !empty($token)) { if ($hash == hash('sha256', $user_id . '_' . $token . PSM_LOGIN_COOKIE_SECRET_KEY) && !empty($token)) {
// cookie looks good, try to select corresponding user // cookie looks good, try to select corresponding user
// get real token from database (and all other data) // get real token from database (and all other data)
$user = $this->getUser($user_id); $user = $this->getUser($user_id);
@ -237,15 +237,15 @@ class User
} }
$dirauthconfig = psm_get_conf('dirauth_status'); $dirauthconfig = psm_get_conf('dirauth_status');
// LDAP auth enabled // LDAP auth enabled
if ($dirauthconfig === '1') { if ($dirauthconfig === '1') {
$ldaplibpath = realpath( $ldaplibpath = realpath(
PSM_PATH_SRC . '..' . DIRECTORY_SEPARATOR . PSM_PATH_SRC . '..' . DIRECTORY_SEPARATOR .
'vendor' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR .
'viharm' . DIRECTORY_SEPARATOR . 'viharm' . DIRECTORY_SEPARATOR .
'psm-ldap-auth' . DIRECTORY_SEPARATOR . 'psm-ldap-auth' . DIRECTORY_SEPARATOR .
'psmldapauth.php' 'psmldapauth.php'
); );
// If the library is found // If the library is found
if ($ldaplibpath) { if ($ldaplibpath) {
@ -260,20 +260,20 @@ class User
// Authenticated // Authenticated
if ($ldapauthstatus === true) { if ($ldapauthstatus === true) {
// Remove password to prevent it from being saved in the DB. // Remove password to prevent it from being saved in the DB.
// Otherwise, user may still be authenticated if LDAP is disabled later. // Otherwise, user may still be authenticated if LDAP is disabled later.
$user_password = null; $user_password = null;
@fn_Debug('Authenticated', $user); @fn_Debug('Authenticated', $user);
} else { } else {
// using PHP 5.5's password_verify() function to check if the provided passwords // using PHP 5.5's password_verify() function to check if the provided passwords
// fits to the hash of that user's password // fits to the hash of that user's password
if (!isset($user->user_id)) { if (!isset($user->user_id)) {
password_verify($user_password, 'dummy_call_against_timing'); password_verify($user_password, 'dummy_call_against_timing');
return false; return false;
} elseif (!password_verify($user_password, $user->password)) { } elseif (!password_verify($user_password, $user->password)) {
return false; return false;
} }
} // not authenticated } // not authenticated
$this->setUserLoggedIn($user->user_id, true); $this->setUserLoggedIn($user->user_id, true);
@ -321,18 +321,18 @@ class User
protected function newRememberMeCookie() protected function newRememberMeCookie()
{ {
// generate 64 char random string and store it in current user data // generate 64 char random string and store it in current user data
$random_token_string = hash('sha256', mt_rand()); $random_token_string = hash('sha256', random_bytes(64));
$sth = $this->db_connection->prepare('UPDATE ' . $sth = $this->db_connection->prepare('UPDATE ' .
PSM_DB_PREFIX . 'users SET rememberme_token = :user_rememberme_token WHERE user_id = :user_id'); PSM_DB_PREFIX . 'users SET rememberme_token = :user_rememberme_token WHERE user_id = :user_id');
$sth->execute(array(':user_rememberme_token' => $random_token_string, ':user_id' => $this->getUserId())); $sth->execute(array(':user_rememberme_token' => $random_token_string, ':user_id' => $this->getUserId()));
// generate cookie string that consists of userid, randomstring and combined hash of both // generate cookie string that consists of userid, randomstring and combined hash of both
$cookie_string_first_part = $this->getUserId() . ':' . $random_token_string; $cookie_string_first_part = $this->getUserId() . '_' . $random_token_string;
$cookie_string_hash = hash('sha256', $cookie_string_first_part . PSM_LOGIN_COOKIE_SECRET_KEY); $cookie_string_hash = hash('sha256', $cookie_string_first_part . PSM_LOGIN_COOKIE_SECRET_KEY);
$cookie_string = $cookie_string_first_part . ':' . $cookie_string_hash; $cookie_string = $cookie_string_first_part . '_' . $cookie_string_hash;
// set cookie // set cookie
setcookie('rememberme', $cookie_string, time() + PSM_LOGIN_COOKIE_RUNTIME, "/", PSM_LOGIN_COOKIE_DOMAIN); setcookie('rememberme', $cookie_string, time() + PSM_LOGIN_COOKIE_RUNTIME, "/", PSM_LOGIN_COOKIE_DOMAIN, TRUE);
} }
/** /**
@ -390,8 +390,8 @@ class User
} }
// generate timestamp (to see when exactly the user (or an attacker) requested the password reset mail) // generate timestamp (to see when exactly the user (or an attacker) requested the password reset mail)
$temporary_timestamp = time(); $temporary_timestamp = time();
// generate random hash for email password reset verification (40 char string) // generate random hash for email password reset verification (64 char string)
$user_password_reset_hash = sha1(uniqid(mt_rand(), true)); $user_password_reset_hash = hash('sha256', uniqid(random_bytes(64), true));
$query_update = $this->db_connection->prepare('UPDATE ' . $query_update = $this->db_connection->prepare('UPDATE ' .
PSM_DB_PREFIX . 'users SET password_reset_hash = :user_password_reset_hash, PSM_DB_PREFIX . 'users SET password_reset_hash = :user_password_reset_hash,
@ -526,10 +526,8 @@ class User
} }
$this->user_preferences = array(); $this->user_preferences = array();
foreach ( foreach ($this->db_connection->query('SELECT `key`,`value` FROM `' .
$this->db_connection->query('SELECT `key`,`value` FROM `' . PSM_DB_PREFIX . 'users_preferences` WHERE `user_id` = ' . $this->user_id) as $row) {
PSM_DB_PREFIX . 'users_preferences` WHERE `user_id` = ' . $this->user_id) as $row
) {
$this->user_preferences[$row['key']] = $row['value']; $this->user_preferences[$row['key']] = $row['value'];
} }
} }

View File

@ -58,7 +58,7 @@ class FreeMobileSMS extends Core
array( array(
"user" => $this->username, "user" => $this->username,
"pass" => $this->password, "pass" => $this->password,
"msg" => urlencode($message), "msg" => rawurlencode($message),
) )
)); ));

View File

@ -0,0 +1,115 @@
<?php
/**
* PHP Server Monitor
* Monitor your servers and websites.
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PHP Server Monitor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*
* @package phpservermon
* @author Erik Shupingahua <erikrs92@gmail.com>
* @copyright Copyright (c) 2008-2017 Pepijn Over <pep@mailbox.org>
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 3.5
**/
namespace psm\Txtmsg;
class LabsMobile extends Core
{
/**
* Send sms using the Smsglobal API
* @var string $message
* @var string $this->password
* @var array $this->recipients
* @var array $this->originator
*
* @var resource $curl
* @var string $err
* @var string $recipient
* @var string $from
* @var mixed $result
*
* @var int $success
* @var string $error
*
* @return bool|string
*/
public function sendSMS($message)
{
$error = "";
$success = 1;
//$recipients = join(',', $this->recipients); Remove this
$from = substr($this->originator, 0, 15); // Max 15 Characters
$message = substr(rawurlencode($message), 0, 153);
$curl = curl_init();
//PREPARE RECIPIENTS:
$recipients=$this->recipients;
$recipentsWorked;
foreach ($recipients as & $row){
$recipentsWorked.='{"msisdn":"'.$row.'"}';
}
$auth_basic = base64_encode($this->username.":".$this->password);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.labsmobile.com/json/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => '{"message":"'.$message.'", "tpoa":"Sender","recipient":['.$recipentsWorked.']}',
CURLOPT_HTTPHEADER => array(
"Authorization: Basic ".$auth_basic,
"Cache-Control: no-cache",
"Content-Type: application/json"
),
));
$result = curl_exec($curl);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$err = curl_error($curl);
curl_close($curl);
//Error code: https://apidocs.labsmobile.com/#results-and-errors
$jsonresponse=(json_decode($result, true));
$msgjson =$jsonresponse["message"];
$codejson=$jsonresponse["code"];
if ( in_array($codejson, range(21,41)) || $codejson==52 || $codejson==400 || $codejson==401 || $codejson==403 || $codejson==500 ) {
$success = 0;
$result =$codejson.':'. $msgjson;
$error = "HTTP_code: " . $httpcode . ".\ncURL error (" . $result . "): " .
curl_strerror($err) . ". \nResult: " . $result;
}
if ($err) {
$success = 0;
$result = ($result == '') ? 'Wrong input, please check if all values are correct!' : $result;
$error = "HTTP_code: " . $httpcode . ".\ncURL error (" . $err . "): " .
curl_strerror($err) . ". \nResult: " . $result;
} if ( $codejson==0) {
return 1;
}
return $error;
}
}

143
src/psm/Txtmsg/Tele2.php Normal file
View File

@ -0,0 +1,143 @@
<?php
/**
* PHP Server Monitor
* Monitor your servers and websites.
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PHP Server Monitor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*
* @package phpservermon
* @author Victor Macko
* @copyright Copyright (c) 2008-2017 Pepijn Over <pep@mailbox.org>
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 3.6.0
**/
namespace psm\Txtmsg;
class Tele2 extends Core
{
/**
* Formats the number to e.g. 45701234567 instead of +45701234567/00451234567
* Error if the number begins with a single 0, indicates no country code has been provided.
* Will still attempt to send to this and other numbers, but return an error message.
* Also remove spaces, braces and other special characters
*/
private function formatNumber( $number ) : string
{
$number = str_replace(['-', ' ', '(', ')'], '', $number);
if (substr($number, 0, 1) === '+') {
return substr($number, 1);
}
elseif (substr($number, 0, 2) === '00') {
return substr($number, 2);
}
elseif (substr($number, 0, 1) === '0') {
return null;
}
else return $number;
}
/**
* Send sms using the Tele2 Messaging API based on Infobip
* The username can be blank, password is the API key
*
*
* @var string $message
* @var string $this->baseurl
* @var string $this->password
* @var array $this->recipients
* @var array $this->originator
* @var string $recipients
*
* @var resource $curl
* @var string $err
* @var mixed $result
*
* @var int $success
* @var string $error
*
* @return bool|string
*/
public function sendSMS($message)
{
$success = 1;
$error = '';
/**
* Creates a curl object, loops through participants to add them to the same message and makes a single API call to send to all
*/
$ch = curl_init("https://api.tele2messaging.com/sms/2/text/advanced");
$recipients = [];
foreach ($this->recipients as $recipient) {
$format = $this->formatNumber($recipient);
if (!$format) {
$error = "ERROR: Incorrect format, needs to include country code (e.g. 45123456789 instead of 0123456789/450123456789/+45123456789/0045123456789)";
}
$recipients[] = [
'to' => $format ?? $recipient
];
}
$postfields = [
'messages' => [
[
'from' => $this->originator,
'destinations' => $recipients,
'text' => "$message"
]
]
];
curl_setopt_array($ch, [
CURLOPT_POST => 1,
CURLOPT_RETURNTRANSFER => false,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($postfields),
CURLOPT_HTTPHEADER => [
'AUTHORIZATION: App '.$this->password,
'Content-Type: application/json',
'Accept: application/json'
],
]);
$result = curl_exec($ch);
$returncode = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($returncode !== 200 || $error !== '') {
$success = 0;
$error .= $result;
}
return ($success === 1 ? 1 : $error);
}
}

View File

@ -212,7 +212,7 @@ class Installer
`user_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_name` varchar(64) NOT NULL COMMENT 'user''s name, unique', `user_name` varchar(64) NOT NULL COMMENT 'user''s name, unique',
`password` varchar(255) NOT NULL COMMENT 'user''s password in salted and hashed format', `password` varchar(255) NOT NULL COMMENT 'user''s password in salted and hashed format',
`password_reset_hash` char(40) DEFAULT NULL COMMENT 'user''s password reset code', `password_reset_hash` varchar(64) DEFAULT NULL COMMENT 'user''s password reset code',
`password_reset_timestamp` bigint(20) DEFAULT NULL COMMENT 'timestamp of the password reset request', `password_reset_timestamp` bigint(20) DEFAULT NULL COMMENT 'timestamp of the password reset request',
`rememberme_token` varchar(64) DEFAULT NULL COMMENT 'user''s remember-me cookie token', `rememberme_token` varchar(64) DEFAULT NULL COMMENT 'user''s remember-me cookie token',
`level` tinyint(2) unsigned NOT NULL DEFAULT '20', `level` tinyint(2) unsigned NOT NULL DEFAULT '20',
@ -230,7 +230,7 @@ class Installer
UNIQUE KEY `unique_username` (`user_name`) UNIQUE KEY `unique_username` (`user_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;", ) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
PSM_DB_PREFIX . PSM_DB_PREFIX .
'users_preferences' => "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "users_preferences` ( 'users_preferences' => "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "users_preferences` (
`user_id` int(11) unsigned NOT NULL, `user_id` int(11) unsigned NOT NULL,
`key` varchar(255) NOT NULL, `key` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL, `value` varchar(255) NOT NULL,
@ -732,6 +732,7 @@ class Installer
/** /**
* Patch for v3.6.0 release * Patch for v3.6.0 release
* Added support for Discord and webhooks * Added support for Discord and webhooks
* Password_reset_hash varchar 40 -> 64 to allow for SHA256 hash
*/ */
protected function upgrade360() protected function upgrade360()
{ {
@ -758,6 +759,8 @@ class Installer
$queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "users` ( $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "users` (
`user_name`, `level`, `name`, `email`) `user_name`, `level`, `name`, `email`)
VALUES ('__PUBLIC__', 30, 'Public page', 'publicpage@psm.psm')"; VALUES ('__PUBLIC__', 30, 'Public page', 'publicpage@psm.psm')";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users`
CHANGE `password_reset_hash` `password_reset_hash` VARCHAR( 64 ) DEFAULT NULL COMMENT 'user''s password reset code';";
$this->execSQL($queries); $this->execSQL($queries);
$this->log('Public page is now available. Added user \'__PUBLIC__\'. See documentation for more info.'); $this->log('Public page is now available. Added user \'__PUBLIC__\'. See documentation for more info.');

View File

@ -331,19 +331,19 @@ class StatusUpdater
list ($key, $value) = explode(': ', $line); list ($key, $value) = explode(': ', $line);
// Header found (case-insensitive) // Header found (case-insensitive)
if (strcasecmp($key, $this->server['header_name']) == 0) { if (strcasecmp($key, $this->server['header_name']) == 0) {
// The value doesn't match what we needed // The value matches what we need, everything is fine
if (!preg_match("/{$this->server['header_value']}/i", $value)) { if (preg_match("/{$this->server['header_value']}/i", $value)) {
$result = false;
} else {
$header_flag = true; $header_flag = true;
break; // No need to go further break; // The correct header is found, we leave the loop
} }
} }
} }
} }
if (!$header_flag) { if (!$header_flag) {
// Header was not present // Header was not present, set error message and $result variable
$this->error = 'HEADER ERROR : Header "' . $this->server['header_name'] .
'" not found or does not match "/' . $this->server['header_value'] . '/i".';
$result = false; $result = false;
} }
} }
@ -447,7 +447,7 @@ class StatusUpdater
socket_send($socket, $package, strLen($package), 0); socket_send($socket, $package, strLen($package), 0);
// socket_read returns a string or false // socket_read returns a string or false
$status = socket_read($socket, 255) !== false ? true : false; $status = socket_read($socket, 255) !== false ? true : false;
if ($status) { if ($status) {
$this->header = "Success."; $this->header = "Success.";
} else { } else {

View File

@ -43,14 +43,15 @@ else
fi fi
# get latest version # get latest version
version=$(curl -s https://api.github.com/repos/phpservermon/phpservermon/releases/latest | grep browser_download_url | cut -d '/' -f 8) version=$(curl -s https://api.github.com/repos/phpservermon/phpservermon/releases/latest | grep tag_name | cut -d ':' -f 2 | cut -d ',' -f 1 | cut -d '"' -f 2)
echo Downloading latest Version of PHPServerMonitor \($version\) echo Downloading latest Version of PHPServerMonitor \($version\)
# get download URL # get download URL
downloadfile=$(curl -s https://api.github.com/repos/phpservermon/phpservermon/releases/latest | grep "zipball" | cut -d '"' -f 4) downloadfile=$(curl -s https://api.github.com/repos/phpservermon/phpservermon/releases/latest | grep "browser_download_url" | grep "zip\"" | cut -d ' ' -f 8 | cut -d '"' -f 2)
echo Using url $downloadfile
# download latest release # download latest release
curl -Lso update.zip.keep $downloadfile curl -sLo update.zip.keep $downloadfile
echo Save config.php echo Save config.php
mv config.php config.php.keep mv config.php config.php.keep