From a9f0f64c78ea9cc6442b2c784a53d7a59663cc96 Mon Sep 17 00:00:00 2001 From: TimZ99 Date: Thu, 12 Dec 2019 22:00:31 +0100 Subject: [PATCH 01/22] Public server page --- public.php | 35 +++++++++++++++++++++++++++ src/bootstrap.php | 13 ++++++++++ src/lang/en_US.lang.php | 1 + src/psm/Module/AbstractController.php | 2 +- src/psm/Service/User.php | 11 +++++++++ src/psm/Util/User/UserValidator.php | 2 +- 6 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 public.php diff --git a/public.php b/public.php new file mode 100644 index 00000000..35299784 --- /dev/null +++ b/public.php @@ -0,0 +1,35 @@ +. + * + * @package phpservermon + * @author Pepijn Over + * @copyright Copyright (c) 2008-2017 Pepijn Over + * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 + * @version Release: @package_version@ + * @link http://www.phpservermonitor.org/ + **/ + +namespace { + define('PSM_PUBLIC_PAGE', true); + + require __DIR__ . '/src/bootstrap.php'; + + $router->run('server'); +} diff --git a/src/bootstrap.php b/src/bootstrap.php index 9037beef..e6dd3338 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -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); } diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php index 621a6aed..c836511f 100644 --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -106,6 +106,7 @@ $sm_lang = array( 'level' => 'Level', 'level_10' => 'Administrator', 'level_20' => 'User', + 'level_30' => 'Anonymous', 'level_description' => 'Administrators have full access: they can manage servers, users and edit the global configuration.
Users can only view and run the updater for the servers that have been assigned to them.', diff --git a/src/psm/Module/AbstractController.php b/src/psm/Module/AbstractController.php index 260543e6..2fe2209b 100644 --- a/src/psm/Module/AbstractController.php +++ b/src/psm/Module/AbstractController.php @@ -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 diff --git a/src/psm/Service/User.php b/src/psm/Service/User.php index fb50e475..fce6213b 100644 --- a/src/psm/Service/User.php +++ b/src/psm/Service/User.php @@ -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 diff --git a/src/psm/Util/User/UserValidator.php b/src/psm/Util/User/UserValidator.php index 65f322e0..b7277ce8 100644 --- a/src/psm/Util/User/UserValidator.php +++ b/src/psm/Util/User/UserValidator.php @@ -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 From ae6367b2a003b08d45c89d2d53e112431d947390 Mon Sep 17 00:00:00 2001 From: TimZ99 Date: Fri, 13 Dec 2019 14:13:15 +0100 Subject: [PATCH 02/22] Changed page to status page --- public.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public.php b/public.php index 35299784..28f21a7e 100644 --- a/public.php +++ b/public.php @@ -31,5 +31,5 @@ namespace { require __DIR__ . '/src/bootstrap.php'; - $router->run('server'); + $router->run('server_status'); } From 7745c752d1e39d1b9f8365111c86582e00f135b2 Mon Sep 17 00:00:00 2001 From: TimZ99 Date: Tue, 18 Aug 2020 17:49:44 +0200 Subject: [PATCH 03/22] Updated docs --- public.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public.php b/public.php index 28f21a7e..03c035b0 100644 --- a/public.php +++ b/public.php @@ -19,11 +19,12 @@ * along with PHP Server Monitor. If not, see . * * @package phpservermon - * @author Pepijn Over + * @author Tim Zandbergen * @copyright Copyright (c) 2008-2017 Pepijn Over * @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 { From 7d11f7bd1f8a0bad06da3bd62137c2f7bf7fa380 Mon Sep 17 00:00:00 2001 From: TimZ99 Date: Tue, 18 Aug 2020 17:50:06 +0200 Subject: [PATCH 04/22] Prevent unautorized warning --- public.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public.php b/public.php index 03c035b0..9848ffbd 100644 --- a/public.php +++ b/public.php @@ -33,4 +33,8 @@ namespace { require __DIR__ . '/src/bootstrap.php'; $router->run('server_status'); + + // By destroying the session the login will show when going to another page + session_destroy(); + } From b94d66bfc02131467db846ebab9722047be9df85 Mon Sep 17 00:00:00 2001 From: TimZ99 Date: Tue, 18 Aug 2020 17:50:22 +0200 Subject: [PATCH 05/22] Added user on upgrade --- src/psm/Util/Install/Installer.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/psm/Util/Install/Installer.php b/src/psm/Util/Install/Installer.php index 010b9fbf..114eba65 100644 --- a/src/psm/Util/Install/Installer.php +++ b/src/psm/Util/Install/Installer.php @@ -341,6 +341,9 @@ class Installer if (version_compare($version_from, '3.4.2', '<')) { $this->upgrade342(); } + if (version_compare($version_from, '3.6.0', '<')) { + $this->upgrade360(); + } psm_update_conf('version', $version_to); } @@ -655,4 +658,14 @@ class Installer $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `last_output` `last_output` TEXT;"; $this->execSQL($queries); } + + protected function upgrade360() + { + $queries = array(); + $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('Added user \'__PUBLIC__\'.'); + } } From 27d9bd6a70658b27313922a0060621a2f8bd6f1d Mon Sep 17 00:00:00 2001 From: TimZ99 Date: Tue, 18 Aug 2020 17:53:18 +0200 Subject: [PATCH 06/22] Only __public__ can be anonymous --- src/lang/en_US.lang.php | 1 + src/psm/Module/User/Controller/UserController.php | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php index c836511f..21dabb9e 100644 --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -152,6 +152,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', diff --git a/src/psm/Module/User/Controller/UserController.php b/src/psm/Module/User/Controller/UserController.php index cbc3ff64..a45f24a7 100644 --- a/src/psm/Module/User/Controller/UserController.php +++ b/src/psm/Module/User/Controller/UserController.php @@ -274,6 +274,14 @@ 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; + } + + // Won't allow removing the last admin if ( count($this->db->select(PSM_DB_PREFIX . 'users', array('level' => PSM_USER_ADMIN))) == 1 && $this->getUser()->getUserLevel() == PSM_USER_ADMIN From 8cbf2dd7bf008f759aff47e88a1d5d80a9576bac Mon Sep 17 00:00:00 2001 From: TimZ99 Date: Tue, 18 Aug 2020 17:53:26 +0200 Subject: [PATCH 07/22] Bumped version --- README.rst | 2 +- src/includes/psmconfig.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index d0a633ee..1940063c 100755 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ PHP Server Monitor :alt: Join the chat at https://gitter.im/erickrf/nlpnet :target: https://gitter.im/phpservermon/phpservermon -Version 3.4.5 +Version 3.6.0 PHP Server Monitor is a script that checks whether your websites and servers are up and running. It comes with a web based user interface where you can manage your services and websites, diff --git a/src/includes/psmconfig.inc.php b/src/includes/psmconfig.inc.php index 530753c8..c70d24e5 100644 --- a/src/includes/psmconfig.inc.php +++ b/src/includes/psmconfig.inc.php @@ -30,7 +30,7 @@ /** * Current PSM version */ -define('PSM_VERSION', '3.4.5'); +define('PSM_VERSION', '3.6.0'); /** * URL to check for updates. Will not be checked if turned off on config page. From 56b122471b82607f6d4cb290fa688c66ca6a127e Mon Sep 17 00:00:00 2001 From: TimZ99 Date: Mon, 24 Aug 2020 22:11:09 +0200 Subject: [PATCH 08/22] Added documentation --- docs/faq.rst | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/faq.rst b/docs/faq.rst index 0fdfb03c..a2f88ecb 100644 --- a/docs/faq.rst +++ b/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 +++++++++++++ From 57e53d77c4d30d84378395602ea3752cc63fb041 Mon Sep 17 00:00:00 2001 From: TimZ99 Date: Mon, 24 Aug 2020 22:11:32 +0200 Subject: [PATCH 09/22] Added PSM_PUBLIC --- config.php.sample | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config.php.sample b/config.php.sample index 31d490d7..a892215c 100755 --- a/config.php.sample +++ b/config.php.sample @@ -5,4 +5,5 @@ define('PSM_DB_PASS', 'db_pass'); define('PSM_DB_NAME', 'db_name'); 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', ''); \ No newline at end of file +define('PSM_BASE_URL', ''); +define('PSM_PUBLIC', true); \ No newline at end of file From 36e33b32154c1e803b2a00cc9533822fbcf52a09 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 26 Aug 2020 15:17:23 +0200 Subject: [PATCH 10/22] Removed old check Removal of last admin has been fixed with 3568a570. --- src/psm/Module/User/Controller/UserController.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/psm/Module/User/Controller/UserController.php b/src/psm/Module/User/Controller/UserController.php index 0704cc39..cd667a29 100644 --- a/src/psm/Module/User/Controller/UserController.php +++ b/src/psm/Module/User/Controller/UserController.php @@ -289,15 +289,6 @@ class UserController extends AbstractController $clean['level'] = PSM_USER_USER; } - // Won't allow removing the last admin - if ( - count($this->db->select(PSM_DB_PREFIX . 'users', array('level' => PSM_USER_ADMIN))) == 1 && - $this->getUser()->getUserLevel() == PSM_USER_ADMIN - ) { - $this->addMessage(psm_get_lang('users', 'error_user_admin_cant_be_deleted'), 'warning'); - $clean['level'] = PSM_USER_ADMIN; - } - // 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'] != '')) { From 99bcc90c0325e9f261c80cb3589cfa115211af81 Mon Sep 17 00:00:00 2001 From: TimZ99 Date: Wed, 26 Aug 2020 15:58:58 +0200 Subject: [PATCH 11/22] Auto gen password for __PUBLIC__ and hide fields --- .../Module/User/Controller/UserController.php | 9 ++++++++- src/templates/default/static/js/scripts.js | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/psm/Module/User/Controller/UserController.php b/src/psm/Module/User/Controller/UserController.php index cd667a29..ba55a0e2 100644 --- a/src/psm/Module/User/Controller/UserController.php +++ b/src/psm/Module/User/Controller/UserController.php @@ -291,9 +291,16 @@ class UserController extends AbstractController // 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); } diff --git a/src/templates/default/static/js/scripts.js b/src/templates/default/static/js/scripts.js index acd8b2ca..5184e3fb 100644 --- a/src/templates/default/static/js/scripts.js +++ b/src/templates/default/static/js/scripts.js @@ -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; From f1df99c5ae70587f5623966c25a7b429ae04a051 Mon Sep 17 00:00:00 2001 From: TimZ99 Date: Wed, 26 Aug 2020 15:59:46 +0200 Subject: [PATCH 12/22] Moved update script to 3.6.0 --- src/psm/Util/Install/Installer.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/psm/Util/Install/Installer.php b/src/psm/Util/Install/Installer.php index b36d13a1..ab9e5fef 100644 --- a/src/psm/Util/Install/Installer.php +++ b/src/psm/Util/Install/Installer.php @@ -724,12 +724,7 @@ class Installer ('jabber_username', ''), ('jabber_domain', ''), ('jabber_password', '');"; - - $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('Added user \'__PUBLIC__\'.'); } /** @@ -758,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.'); } } From 3cf9a6e444c6bcd3f2d6d9dfec726306942573d5 Mon Sep 17 00:00:00 2001 From: Samuel Denis-D'Ortun Date: Sun, 1 Nov 2020 11:08:53 -0500 Subject: [PATCH 13/22] Set public to false by default. --- config.php.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.php.sample b/config.php.sample index fd0775f4..a9537ed0 100644 --- a/config.php.sample +++ b/config.php.sample @@ -7,4 +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', true); \ No newline at end of file +define('PSM_PUBLIC', false); From 31e987a1d55563b91cc77930f818ae0dae07e144 Mon Sep 17 00:00:00 2001 From: Mario Rothauer Date: Tue, 15 Dec 2020 23:48:01 +0100 Subject: [PATCH 14/22] Improved german translation (#1071) --- src/lang/de_DE.lang.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lang/de_DE.lang.php b/src/lang/de_DE.lang.php index 9f0473de..9777fec2 100644 --- a/src/lang/de_DE.lang.php +++ b/src/lang/de_DE.lang.php @@ -125,10 +125,10 @@ $sm_lang = array( 'email' => 'E-Mail', 'sms' => 'SMS', 'pushover' => 'Pushover', - 'no_logs' => 'Keine Logs vorhanden.', - 'clear' => 'Protokoll Logs', - 'delete_title' => 'Protokoll Logs', - 'delete_message' => 'Bist du sicher, dass du alle 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 alle Protokolle löschen möchtest?', ), 'servers' => array( 'server' => 'Server', From 0d44af0ee0abd0c4f332b3920a91680be8dad867 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Dec 2020 22:48:38 +0000 Subject: [PATCH 15/22] Bump symfony/event-dispatcher from 3.4.44 to 3.4.47 (#1058) --- composer.lock | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/composer.lock b/composer.lock index 3b8d7122..f1a95b6c 100644 --- a/composer.lock +++ b/composer.lock @@ -440,16 +440,16 @@ }, { "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 +461,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 +471,6 @@ "symfony/http-kernel": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" @@ -513,7 +509,7 @@ "type": "tidelift" } ], - "time": "2020-08-12T14:55:37+00:00" + "time": "2020-10-24T10:57:07+00:00" }, { "name": "symfony/filesystem", From 0a7844536f5d48136b56edb37448a48329d0d8a7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Dec 2020 22:48:52 +0000 Subject: [PATCH 16/22] Bump symfony/dependency-injection from 3.4.44 to 3.4.47 (#1059) --- composer.lock | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/composer.lock b/composer.lock index f1a95b6c..bdb58390 100644 --- a/composer.lock +++ b/composer.lock @@ -355,16 +355,16 @@ }, { "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 +393,6 @@ "symfony/yaml": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\DependencyInjection\\": "" @@ -436,7 +431,7 @@ "type": "tidelift" } ], - "time": "2020-08-10T07:13:15+00:00" + "time": "2020-10-24T10:57:07+00:00" }, { "name": "symfony/event-dispatcher", From d406f69231f95ede8fd5f9c67ee723ad5c0ffca3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Dec 2020 22:50:33 +0000 Subject: [PATCH 17/22] Bump symfony/http-foundation from 3.4.44 to 3.4.47 (#1060) --- composer.lock | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/composer.lock b/composer.lock index bdb58390..37134931 100644 --- a/composer.lock +++ b/composer.lock @@ -572,16 +572,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": { @@ -593,11 +593,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\\": "" @@ -636,7 +631,7 @@ "type": "tidelift" } ], - "time": "2020-08-12T14:55:37+00:00" + "time": "2020-10-24T10:57:07+00:00" }, { "name": "symfony/polyfill-ctype", @@ -716,16 +711,16 @@ }, { "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": { @@ -737,7 +732,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-main": "1.19-dev" }, "thanks": { "name": "symfony/polyfill", @@ -789,20 +784,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": { @@ -812,7 +807,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-main": "1.19-dev" }, "thanks": { "name": "symfony/polyfill", @@ -866,7 +861,7 @@ "type": "tidelift" } ], - "time": "2020-07-14T12:35:20+00:00" + "time": "2020-10-23T09:01:57+00:00" }, { "name": "twig/twig", From 3a58a562dd96984f0d8bf0ea329744b970316302 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Dec 2020 22:50:59 +0000 Subject: [PATCH 18/22] Bump symfony/config from 3.4.44 to 3.4.47 (#1061) --- composer.lock | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/composer.lock b/composer.lock index 37134931..a391f5a2 100644 --- a/composer.lock +++ b/composer.lock @@ -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,7 +346,7 @@ "type": "tidelift" } ], - "time": "2020-08-10T07:13:15+00:00" + "time": "2020-10-24T10:57:07+00:00" }, { "name": "symfony/dependency-injection", @@ -635,16 +630,16 @@ }, { "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": { @@ -656,7 +651,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-main": "1.19-dev" }, "thanks": { "name": "symfony/polyfill", @@ -707,7 +702,7 @@ "type": "tidelift" } ], - "time": "2020-07-14T12:35:20+00:00" + "time": "2020-10-23T09:01:57+00:00" }, { "name": "symfony/polyfill-mbstring", From 10f111c8300633daa609112a0f2b1b7fe5bd7070 Mon Sep 17 00:00:00 2001 From: Lukas <35193662+NixNotCastey@users.noreply.github.com> Date: Tue, 15 Dec 2020 23:52:16 +0100 Subject: [PATCH 19/22] PromoSMS Gateway (#1064) --- docs/credits.rst | 4 ++ src/includes/functions.inc.php | 3 ++ src/psm/Txtmsg/PromoSMS.php | 93 ++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 src/psm/Txtmsg/PromoSMS.php diff --git a/docs/credits.rst b/docs/credits.rst index 83ee5bf7..e34fee17 100644 --- a/docs/credits.rst +++ b/docs/credits.rst @@ -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 +++++++++++ diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index 59717599..6a70408f 100644 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -799,6 +799,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 diff --git a/src/psm/Txtmsg/PromoSMS.php b/src/psm/Txtmsg/PromoSMS.php new file mode 100644 index 00000000..ccb024bb --- /dev/null +++ b/src/psm/Txtmsg/PromoSMS.php @@ -0,0 +1,93 @@ +. + * + * @package phpservermon + * @author Łukasz Szczepański + * @copyright Copyright (c) 2008-2017 Pepijn Over + * @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; + } +} \ No newline at end of file From 59f4f44107e0ae01716a031cebe2bd985dfe9b91 Mon Sep 17 00:00:00 2001 From: jamgames2 <73676126+jamgames2@users.noreply.github.com> Date: Wed, 16 Dec 2020 05:54:21 +0700 Subject: [PATCH 20/22] Update profile.tpl.html (#1050) - ADD ' type="button" ' for prevent ' Enter Button ' from keyboard that open telegram activation page. --- src/templates/default/module/user/profile.tpl.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates/default/module/user/profile.tpl.html b/src/templates/default/module/user/profile.tpl.html index 3cb8f315..57051839 100644 --- a/src/templates/default/module/user/profile.tpl.html +++ b/src/templates/default/module/user/profile.tpl.html @@ -37,7 +37,7 @@ {{ label_telegram_get_chat_id }} {{ 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) }} - + {{ macro.input_hidden("activate_telegram", "0") }} From 54a5e2801c0c410bcdae52d1562e9880739f3874 Mon Sep 17 00:00:00 2001 From: Joseph Helela Date: Wed, 16 Dec 2020 02:01:10 +0300 Subject: [PATCH 21/22] Adding Infobip SMS Gateway (#1012) --- README.rst | 2 +- src/includes/functions.inc.php | 3 ++ src/psm/Txtmsg/Infobip.php | 91 ++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 src/psm/Txtmsg/Infobip.php diff --git a/README.rst b/README.rst index 26e51041..189d326d 100644 --- a/README.rst +++ b/README.rst @@ -62,7 +62,7 @@ The following SMS gateways are currently available: * Callr - * SMSAPI - * OVH SMS PRO - - +* Infobip - Please note: for these gateways you will need an account with sufficient credits. diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index 6a70408f..44b6d129 100644 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -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; diff --git a/src/psm/Txtmsg/Infobip.php b/src/psm/Txtmsg/Infobip.php new file mode 100644 index 00000000..b5edc89d --- /dev/null +++ b/src/psm/Txtmsg/Infobip.php @@ -0,0 +1,91 @@ +. + * + * @package phpservermon + * @author Victor Macko + * @copyright Copyright (c) 2008-2017 Pepijn Over + * @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; + } +} + From 15edba0f1abc53ff3f782f35e05439654e7a7155 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 16 Dec 2020 00:04:35 +0100 Subject: [PATCH 22/22] Added PromoSMS See #1064. --- README.rst | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/README.rst b/README.rst index 189d326d..45b1685f 100644 --- a/README.rst +++ b/README.rst @@ -46,23 +46,24 @@ The following SMS gateways are currently available: * Inetworx - * Messagebird - * Mosms - -* Smsglobal - -* SMSit - +* Smsglobal - +* SMSit - * Spryng - * Textmarketer - * FreeVoipDeal - -* Nexmo - -* OctoPush - -* FreeMobile (FR) - +* Nexmo - +* OctoPush - +* FreeMobile (FR) - * Twilio - -* CM Telecom - -* GatewayAPI - -* SolutionsInfini - -* Plivo - -* Callr - +* CM Telecom - +* GatewayAPI - +* SolutionsInfini - +* Plivo - +* Callr - * SMSAPI - -* OVH SMS PRO - -* Infobip - +* OVH SMS PRO - +* PromoSMS - +* Infobip - Please note: for these gateways you will need an account with sufficient credits.