Merge branch 'develop' into patch-3
This commit is contained in:
commit
46dd2f14f9
25
README.rst
25
README.rst
|
@ -46,23 +46,24 @@ The following SMS gateways are currently available:
|
|||
* Inetworx - <https://www.inetworx.ch>
|
||||
* Messagebird - <https://www.messagebird.com>
|
||||
* Mosms - <https://www.mosms.com>
|
||||
* Smsglobal - <https://smsglobal.com/>
|
||||
* SMSit - <https://www.smsit.dk/>
|
||||
* Smsglobal - <https://smsglobal.com>
|
||||
* SMSit - <https://www.smsit.dk>
|
||||
* Spryng - <https://www.spryng.nl>
|
||||
* Textmarketer - <https://www.textmarketer.co.uk>
|
||||
* FreeVoipDeal - <https://www.freevoipdeal.com>
|
||||
* Nexmo - <https://www.nexmo.com/>
|
||||
* OctoPush - <https://www.octopush.com/>
|
||||
* FreeMobile (FR) - <https://mobile.free.fr/>
|
||||
* Nexmo - <https://www.nexmo.com>
|
||||
* OctoPush - <https://www.octopush.com>
|
||||
* FreeMobile (FR) - <https://mobile.free.fr>
|
||||
* Twilio - <https://twilio.com>
|
||||
* CM Telecom - <https://www.cm.com/>
|
||||
* GatewayAPI - <https://gatewayapi.com/>
|
||||
* SolutionsInfini - <https://solutionsinfini.com/>
|
||||
* Plivo - <https://www.plivo.com/>
|
||||
* Callr - <https://www.callr.com/>
|
||||
* CM Telecom - <https://www.cm.com>
|
||||
* GatewayAPI - <https://gatewayapi.com>
|
||||
* SolutionsInfini - <https://solutionsinfini.com>
|
||||
* Plivo - <https://www.plivo.com>
|
||||
* Callr - <https://www.callr.com>
|
||||
* SMSAPI - <https://www.smsapi.com/en>
|
||||
* OVH SMS PRO - <https://www.ovhtelecom.fr/sms/>
|
||||
|
||||
* OVH SMS PRO - <https://www.ovhtelecom.fr/sms>
|
||||
* PromoSMS - <https://promosms.com>
|
||||
* Infobip - <https://www.infobip.com>
|
||||
|
||||
|
||||
Please note: for these gateways you will need an account with sufficient credits.
|
||||
|
|
|
@ -277,16 +277,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/config",
|
||||
"version": "v3.4.44",
|
||||
"version": "v3.4.47",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/config.git",
|
||||
"reference": "801a3bbc17fb1ba44b0d7d41a6db7a0b74953595"
|
||||
"reference": "bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/config/zipball/801a3bbc17fb1ba44b0d7d41a6db7a0b74953595",
|
||||
"reference": "801a3bbc17fb1ba44b0d7d41a6db7a0b74953595",
|
||||
"url": "https://api.github.com/repos/symfony/config/zipball/bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f",
|
||||
"reference": "bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -308,11 +308,6 @@
|
|||
"symfony/yaml": "To use the yaml reference dumper"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Config\\": ""
|
||||
|
@ -351,20 +346,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-08-10T07:13:15+00:00"
|
||||
"time": "2020-10-24T10:57:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dependency-injection",
|
||||
"version": "v3.4.44",
|
||||
"version": "v3.4.47",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dependency-injection.git",
|
||||
"reference": "7d15cf4294d4f3610bc741c8fdd54a6baac586d4"
|
||||
"reference": "51d2a2708c6ceadad84393f8581df1dcf9e5e84b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/7d15cf4294d4f3610bc741c8fdd54a6baac586d4",
|
||||
"reference": "7d15cf4294d4f3610bc741c8fdd54a6baac586d4",
|
||||
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/51d2a2708c6ceadad84393f8581df1dcf9e5e84b",
|
||||
"reference": "51d2a2708c6ceadad84393f8581df1dcf9e5e84b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -393,11 +388,6 @@
|
|||
"symfony/yaml": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\DependencyInjection\\": ""
|
||||
|
@ -436,20 +426,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-08-10T07:13:15+00:00"
|
||||
"time": "2020-10-24T10:57:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v3.4.44",
|
||||
"version": "v3.4.47",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||
"reference": "a0f6858fbf7a524747e87a4c336cab7d0b67c802"
|
||||
"reference": "31fde73757b6bad247c54597beef974919ec6860"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a0f6858fbf7a524747e87a4c336cab7d0b67c802",
|
||||
"reference": "a0f6858fbf7a524747e87a4c336cab7d0b67c802",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/31fde73757b6bad247c54597beef974919ec6860",
|
||||
"reference": "31fde73757b6bad247c54597beef974919ec6860",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -461,6 +451,7 @@
|
|||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~2.8|~3.0|~4.0",
|
||||
"symfony/debug": "~3.4|~4.4",
|
||||
"symfony/dependency-injection": "~3.3|~4.0",
|
||||
"symfony/expression-language": "~2.8|~3.0|~4.0",
|
||||
"symfony/stopwatch": "~2.8|~3.0|~4.0"
|
||||
|
@ -470,11 +461,6 @@
|
|||
"symfony/http-kernel": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\EventDispatcher\\": ""
|
||||
|
@ -513,7 +499,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-08-12T14:55:37+00:00"
|
||||
"time": "2020-10-24T10:57:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/filesystem",
|
||||
|
@ -581,16 +567,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
"version": "v3.4.44",
|
||||
"version": "v3.4.47",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-foundation.git",
|
||||
"reference": "e5a42880895b43cd53d1a7b92bdcfb7d80c0af1c"
|
||||
"reference": "b9885fcce6fe494201da4f70a9309770e9d13dc8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/e5a42880895b43cd53d1a7b92bdcfb7d80c0af1c",
|
||||
"reference": "e5a42880895b43cd53d1a7b92bdcfb7d80c0af1c",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/b9885fcce6fe494201da4f70a9309770e9d13dc8",
|
||||
"reference": "b9885fcce6fe494201da4f70a9309770e9d13dc8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -602,11 +588,6 @@
|
|||
"symfony/expression-language": "~2.8|~3.0|~4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\HttpFoundation\\": ""
|
||||
|
@ -645,20 +626,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-08-12T14:55:37+00:00"
|
||||
"time": "2020-10-24T10:57:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.18.1",
|
||||
"version": "v1.19.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "1c302646f6efc070cd46856e600e5e0684d6b454"
|
||||
"reference": "aed596913b70fae57be53d86faa2e9ef85a2297b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454",
|
||||
"reference": "1c302646f6efc070cd46856e600e5e0684d6b454",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b",
|
||||
"reference": "aed596913b70fae57be53d86faa2e9ef85a2297b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -670,7 +651,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.18-dev"
|
||||
"dev-main": "1.19-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
|
@ -721,20 +702,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-07-14T12:35:20+00:00"
|
||||
"time": "2020-10-23T09:01:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.18.1",
|
||||
"version": "v1.19.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a"
|
||||
"reference": "b5f7b932ee6fa802fc792eabd77c4c88084517ce"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a",
|
||||
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b5f7b932ee6fa802fc792eabd77c4c88084517ce",
|
||||
"reference": "b5f7b932ee6fa802fc792eabd77c4c88084517ce",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -746,7 +727,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.18-dev"
|
||||
"dev-main": "1.19-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
|
@ -798,20 +779,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-07-14T12:35:20+00:00"
|
||||
"time": "2020-10-23T09:01:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php70",
|
||||
"version": "v1.18.1",
|
||||
"version": "v1.19.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php70.git",
|
||||
"reference": "0dd93f2c578bdc9c72697eaa5f1dd25644e618d3"
|
||||
"reference": "3fe414077251a81a1b15b1c709faf5c2fbae3d4e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0dd93f2c578bdc9c72697eaa5f1dd25644e618d3",
|
||||
"reference": "0dd93f2c578bdc9c72697eaa5f1dd25644e618d3",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/3fe414077251a81a1b15b1c709faf5c2fbae3d4e",
|
||||
"reference": "3fe414077251a81a1b15b1c709faf5c2fbae3d4e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -821,7 +802,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.18-dev"
|
||||
"dev-main": "1.19-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
|
@ -875,7 +856,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-07-14T12:35:20+00:00"
|
||||
"time": "2020-10-23T09:01:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
|
|
|
@ -7,3 +7,4 @@ define('PSM_DB_HOST', 'localhost');
|
|||
define('PSM_DB_PORT', '3306'); //3306 is the default port for MySQL. If no specfic port is used, leave it empty.
|
||||
define('PSM_BASE_URL', '');
|
||||
define('PSM_WEBCRON_KEY', '');
|
||||
define('PSM_PUBLIC', false);
|
||||
|
|
|
@ -93,6 +93,10 @@ The following people have contributed to the development of PHP Server Monitor:
|
|||
|
||||
* Discord webhook support
|
||||
|
||||
* Łukasz Szczepański - https://github.com/NixNotCastey
|
||||
|
||||
* PromoSMS gateway
|
||||
|
||||
Translators
|
||||
+++++++++++
|
||||
|
||||
|
|
20
docs/faq.rst
20
docs/faq.rst
|
@ -10,7 +10,7 @@ Users
|
|||
What are the differences between the user levels?
|
||||
-------------------------------------------------
|
||||
|
||||
There are 2 user levels available: regular user and administrator.
|
||||
There are 3 user levels available: anonymous, regular user and administrator.
|
||||
|
||||
Administrators:
|
||||
|
||||
|
@ -24,6 +24,16 @@ Regular users:
|
|||
* View the history and logs of their assigned servers.
|
||||
* Run the updater on their assigned servers.
|
||||
|
||||
Anonymous:
|
||||
Only meant for user '__PUBLIC__' and can't be assigned to any other user.
|
||||
|
||||
* View the status of their assigned servers without password.
|
||||
|
||||
I removed user '__PUBLIC__', what now?
|
||||
--------------------------------------
|
||||
|
||||
* Go to users -> create new user.
|
||||
* Set the username to '__PUBLIC__', level to 'anonymous' and the rest is up to you.
|
||||
|
||||
Servers
|
||||
+++++++
|
||||
|
@ -101,6 +111,14 @@ After upgrading, my email stopped working.
|
|||
|
||||
Run 'php composer.phar update' and you should be good to go!
|
||||
|
||||
Setting up a public page.
|
||||
-------------------------
|
||||
|
||||
1. Set PSM_PUBLIC to true in config.php.
|
||||
2. If not yet existing, create a user with username '__PUBLIC__'. See Users -> "I removed user '__PUBLIC__', what now?" for help.
|
||||
3. Add servers to user '__PUBLIC__'.
|
||||
4. Go to /public.php.
|
||||
|
||||
Notifications
|
||||
+++++++++++++
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<?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 Tim Zandbergen <Tim@Xervion.nl>
|
||||
* @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 {
|
||||
define('PSM_PUBLIC_PAGE', true);
|
||||
|
||||
require __DIR__ . '/src/bootstrap.php';
|
||||
|
||||
$router->run('server_status');
|
||||
|
||||
// By destroying the session the login will show when going to another page
|
||||
session_destroy();
|
||||
|
||||
}
|
|
@ -108,6 +108,19 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
// check for a public page var
|
||||
// This should be defined in the config
|
||||
if (!defined('PSM_PUBLIC')) {
|
||||
define('PSM_PUBLIC', false);
|
||||
}
|
||||
|
||||
// check for a public page
|
||||
// This variable is for internal use
|
||||
// and should not be changed by the user manualy
|
||||
if (!defined('PSM_PUBLIC_PAGE')) {
|
||||
define('PSM_PUBLIC_PAGE', false);
|
||||
}
|
||||
|
||||
$lang = psm_get_conf('language', 'en_US');
|
||||
psm_load_lang($lang);
|
||||
}
|
||||
|
|
|
@ -755,6 +755,9 @@ namespace {
|
|||
case 'smsglobal':
|
||||
$sms = new \psm\Txtmsg\Smsglobal();
|
||||
break;
|
||||
case 'infobip':
|
||||
$sms = new \psm\Txtmsg\Infobip();
|
||||
break;
|
||||
case 'freevoipdeal':
|
||||
$sms = new \psm\Txtmsg\FreeVoipDeal();
|
||||
break;
|
||||
|
@ -799,6 +802,9 @@ namespace {
|
|||
case 'smsapi':
|
||||
$sms = new \psm\Txtmsg\SMSAPI();
|
||||
break;
|
||||
case 'promosms':
|
||||
$sms = new \psm\Txtmsg\PromoSMS();
|
||||
break;
|
||||
}
|
||||
|
||||
// copy login information from the config file
|
||||
|
|
|
@ -125,10 +125,10 @@ $sm_lang = array(
|
|||
'email' => 'E-Mail',
|
||||
'sms' => 'SMS',
|
||||
'pushover' => 'Pushover',
|
||||
'no_logs' => 'Keine Logs vorhanden.',
|
||||
'clear' => 'Logs löschen',
|
||||
'delete_title' => 'Logs löschen',
|
||||
'delete_message' => 'Bist du sicher, dass du <b>alle</b> Logs löschen möchtest?',
|
||||
'no_logs' => 'Keine Protokolle vorhanden.',
|
||||
'clear' => 'Protokoll löschen',
|
||||
'delete_title' => 'Protokoll löschen',
|
||||
'delete_message' => 'Bist du sicher, dass du <b>alle</b> Protokolle löschen möchtest?',
|
||||
),
|
||||
'servers' => array(
|
||||
'server' => 'Server',
|
||||
|
|
|
@ -106,7 +106,10 @@ $sm_lang = array(
|
|||
'level' => 'Level',
|
||||
'level_10' => 'Administrator',
|
||||
'level_20' => 'User',
|
||||
'level_description' => '<b>Administrators</b> have full access: they can manage servers, users and edit the global configuration.<br><b>Users</b> can only view and run the updater for the servers that have been assigned to them.',
|
||||
'level_30' => 'Anonymous',
|
||||
'level_description' => '<b>Administrators</b> have full access: they can manage servers, users and edit the
|
||||
global configuration.<br><b>Users</b> can only view and run the updater for the
|
||||
servers that have been assigned to them.',
|
||||
'mobile' => 'Mobile',
|
||||
'email' => 'Email',
|
||||
'pushover' => 'Pushover',
|
||||
|
@ -154,6 +157,7 @@ $sm_lang = array(
|
|||
'error_user_password_invalid' => 'The entered password is invalid.',
|
||||
'error_user_password_no_match' => 'The entered passwords do not match.',
|
||||
'error_user_admin_cant_be_deleted' => 'You can\'t remove the last administrator.',
|
||||
'error_user_cant_be_anonymous' => 'Only user \'__public__\' can have the level anonymous.'
|
||||
),
|
||||
'log' => array(
|
||||
'title' => 'Log entries',
|
||||
|
|
|
@ -124,7 +124,7 @@ abstract class AbstractController implements ControllerInterface
|
|||
* @var int $user_level_required
|
||||
* @see setMinUserLevelRequired()
|
||||
*/
|
||||
protected $user_level_required = PSM_USER_USER;
|
||||
protected $user_level_required = (PSM_PUBLIC && PSM_PUBLIC_PAGE) ? PSM_USER_ANONYMOUS : PSM_USER_USER;
|
||||
|
||||
/**
|
||||
* Required user level for certain actions
|
||||
|
|
|
@ -282,12 +282,25 @@ class UserController extends AbstractController
|
|||
$user_validator->username($clean['user_name'], $user_id);
|
||||
$user_validator->email($clean['email']);
|
||||
$user_validator->level($clean['level']);
|
||||
|
||||
// Won't allow anonymous level for users other than __PUBLIC__
|
||||
if ($clean['user_name'] !== "__PUBLIC__" && (int) $clean['level'] === (int) PSM_USER_ANONYMOUS) {
|
||||
$this->addMessage(psm_get_lang('users', 'error_user_cant_be_anonymous'), 'error');
|
||||
$clean['level'] = PSM_USER_USER;
|
||||
}
|
||||
|
||||
// always validate password for new users,
|
||||
// but only validate it for existing users when they change it.
|
||||
if ($user_id == 0 || ($user_id > 0 && $clean['password'] != '')) {
|
||||
if (($user_id == 0 || ($user_id > 0 && $clean['password'] != '')) && $clean['user_name'] != '__PUBLIC__') {
|
||||
$user_validator->password($clean['password'], $clean['password_repeat']);
|
||||
}
|
||||
|
||||
// Auto generate password for __PUBLIC__ user
|
||||
if ($clean['user_name'] === '__PUBLIC__') {
|
||||
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*_";
|
||||
$clean['password'] = substr(str_shuffle($chars), 0, 24);
|
||||
}
|
||||
|
||||
if ($user_id > 0) {
|
||||
$user_validator->userId($user_id);
|
||||
}
|
||||
|
|
|
@ -100,6 +100,17 @@ class User
|
|||
}
|
||||
$this->session = $session;
|
||||
|
||||
if (PSM_PUBLIC === true && PSM_PUBLIC_PAGE === true) {
|
||||
$query_user = $this->db_connection->prepare('SELECT * FROM ' .
|
||||
PSM_DB_PREFIX . 'users WHERE user_name = :user_name and level = :level');
|
||||
$query_user->bindValue(':user_name', "__PUBLIC__", \PDO::PARAM_STR);
|
||||
$query_user->bindValue(':level', PSM_USER_ANONYMOUS, \PDO::PARAM_STR);
|
||||
$query_user->execute();
|
||||
|
||||
// get result row (as an object)
|
||||
$this->setUserLoggedIn($query_user->fetchObject()->user_id);
|
||||
}
|
||||
|
||||
if ((!defined('PSM_INSTALL') || !PSM_INSTALL)) {
|
||||
// check the possible login actions:
|
||||
// 1. login via session data (happens each time user opens a page on your php project AFTER
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
<?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 Infobip extends Core
|
||||
{
|
||||
|
||||
/**
|
||||
* Send sms using the infobip.com API
|
||||
*
|
||||
* @var string $message
|
||||
* @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 = '';
|
||||
foreach ($this->recipients as $recipient) {
|
||||
$ch = curl_init();
|
||||
curl_setopt(
|
||||
$ch,
|
||||
CURLOPT_URL,
|
||||
"https://api.infobip.com/sms/1/text/query?username=" . $this->username .
|
||||
"&password=" . $this->password .
|
||||
"&to=" . $recipient .
|
||||
"&text=" . urlencode($message) .
|
||||
//add your sender id here
|
||||
"&from="
|
||||
);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$headers = array();
|
||||
$headers[] = "Content-Type: application/x-www-form-urlencoded";
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
// Check for errors
|
||||
if (is_numeric(strpos($result, "FAILED"))) {
|
||||
$error = $result;
|
||||
$success = 0;
|
||||
}
|
||||
}
|
||||
if ($success == 1) {
|
||||
return 1;
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
<?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 Łukasz Szczepański <l.szczepanski@webd.pl>
|
||||
* @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 PromoSMS extends Core
|
||||
{
|
||||
|
||||
/**
|
||||
* Send sms using the PromoSMS API
|
||||
*
|
||||
* @var string $message
|
||||
* @var string $this->password
|
||||
* @var array $this->recipients
|
||||
* @var array $headers
|
||||
*
|
||||
* @var resource $curl
|
||||
* @var string $err
|
||||
* @var int $success
|
||||
* @var string $error
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
|
||||
public function sendSMS($message)
|
||||
{
|
||||
$error = "";
|
||||
$success = 1;
|
||||
|
||||
$headers = array();
|
||||
$headers[] = "Content-Type: application/x-www-form-urlencoded";
|
||||
$headers[] = "Accept: text/json";
|
||||
$headers[] = 'Authorization: Basic ' . base64_encode($this->username . ':' . $this->password);
|
||||
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://promosms.com/api/rest/v3_2/sms",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
CURLOPT_POSTFIELDS => http_build_query(array(
|
||||
'text' => htmlspecialchars($message),
|
||||
'type' => 1,
|
||||
'recipients' => $this->recipients,
|
||||
))
|
||||
));
|
||||
|
||||
$result = curl_exec($curl);
|
||||
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
$err = curl_errno($curl);
|
||||
|
||||
if ($err != 0 || ($httpcode != '200' && $httpcode != '201' && $httpcode != '202' && $result != "1")) {
|
||||
$success = 0;
|
||||
$error = "HTTP_code: " . $httpcode . ".\ncURL error (" . $err . "): " .
|
||||
curl_strerror($err) . ". Result: " . $result . "";
|
||||
}
|
||||
curl_close($curl);
|
||||
|
||||
if ($success) {
|
||||
return 1;
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
}
|
|
@ -724,7 +724,6 @@ class Installer
|
|||
('jabber_username', ''),
|
||||
('jabber_domain', ''),
|
||||
('jabber_password', '');";
|
||||
|
||||
$this->execSQL($queries);
|
||||
}
|
||||
|
||||
|
@ -754,6 +753,11 @@ class Installer
|
|||
ADD `discord` VARCHAR( 255 ) NOT NULL AFTER `mobile`;";
|
||||
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers`
|
||||
ADD `discord` ENUM( 'yes','no' ) NOT NULL DEFAULT 'yes' AFTER `sms`;";
|
||||
$queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "users` (
|
||||
`user_name`, `level`, `name`, `email`)
|
||||
VALUES ('__PUBLIC__', 30, 'Public page', 'publicpage@psm.psm')";
|
||||
$this->execSQL($queries);
|
||||
|
||||
$this->log('Public page is now available. Added user \'__PUBLIC__\'. See documentation for more info.');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class UserValidator
|
|||
* Available editable user levels
|
||||
* @var array $user_levels
|
||||
*/
|
||||
protected $user_levels = array(PSM_USER_ADMIN, PSM_USER_USER);
|
||||
protected $user_levels = array(PSM_USER_ADMIN, PSM_USER_USER, PSM_USER_ANONYMOUS);
|
||||
|
||||
/**
|
||||
* User service
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<a class="btn btn-primary mb-2" href="{{ telegram_get_chat_id_url }}">{{ label_telegram_get_chat_id }}</a>
|
||||
</div>
|
||||
{{ macro.input_field("text", "telegram_id", null, "telegram_id", label_telegram_chat_id, telegram_id, label_telegram_chat_id, "255", "telegram_id_help", label_telegram_id_description) }}
|
||||
<button class="btn btn-primary show-modal" data-toggle="modal" data-modal-id="activateTelegram">{{ label_activate_telegram }}</button>
|
||||
<button type="button" class="btn btn-primary show-modal" data-toggle="modal" data-modal-id="activateTelegram">{{ label_activate_telegram }}</button>
|
||||
{{ macro.input_hidden("activate_telegram", "0") }}
|
||||
</fieldset>
|
||||
<!-- Jabber settings -->
|
||||
|
|
|
@ -51,6 +51,7 @@ $().ready(function () {
|
|||
}
|
||||
$('#label').focus();
|
||||
});
|
||||
|
||||
$("#type").change(function () {
|
||||
switch ($("select#type option:checked").val()) {
|
||||
case "website":
|
||||
|
@ -103,6 +104,21 @@ $("select#popular_ports").change(function () {
|
|||
}
|
||||
}).change();
|
||||
|
||||
$("#user_name").change(function ()
|
||||
{
|
||||
switch ($("#user_name").val()) {
|
||||
case "__PUBLIC__":
|
||||
$('#password').parent().slideUp();
|
||||
$('#password_repeat').parent().slideUp();
|
||||
$("select#level").val('30');
|
||||
$("#name").val('Public page');
|
||||
break;
|
||||
default:
|
||||
$('#password').parent().slideDown();
|
||||
$('#password_repeat').parent().slideDown();
|
||||
}
|
||||
}).change();
|
||||
|
||||
|
||||
function psm_xhr(mod, params, method, on_complete, options) {
|
||||
method = (typeof method === 'undefined') ? 'GET' : method;
|
||||
|
|
Loading…
Reference in New Issue