From 6aabe1eca7363098f8831a4f47cc943e0f1d7f4c Mon Sep 17 00:00:00 2001 From: Davy Rolink Date: Wed, 1 Oct 2014 20:50:37 +0200 Subject: [PATCH 01/13] save log_users in a separate table, so that we can add additional data to each log_user in the near future --- src/includes/functions.inc.php | 26 +++++- src/psm/Util/Install/Installer.class.php | 6 +- .../Server/Updater/StatusNotifier.class.php | 89 +++++++++++-------- 3 files changed, 81 insertions(+), 40 deletions(-) diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index e888a940..7b7a9ff3 100644 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -199,22 +199,42 @@ function psm_update_conf($key, $value) { * everything should have been handled when calling this function * * @param string $server_id + * @param string $type * @param string $message + * + * @return int log_id */ -function psm_add_log($server_id, $type, $message, $user_id = null) { +function psm_add_log($server_id, $type, $message) { global $db; - $db->save( + return $db->save( PSM_DB_PREFIX.'log', array( 'server_id' => $server_id, 'type' => $type, 'message' => $message, - 'user_id' => ($user_id === null) ? '' : $user_id, ) ); } +/** + * This function just adds a user to the log_users table. + * + * @param $log_id + * @param $user_id + */ +function psm_add_log_user($log_id, $user_id) { + global $db; + + $db->save( + PSM_DB_PREFIX . 'log_users', + array( + 'log_id' => $log_id, + 'user_id' => $user_id, + ) + ); +} + /** * This function adds the result of a check to the uptime table for logging purposes. * diff --git a/src/psm/Util/Install/Installer.class.php b/src/psm/Util/Install/Installer.class.php index 30e3ad25..7fb96507 100644 --- a/src/psm/Util/Install/Installer.class.php +++ b/src/psm/Util/Install/Installer.class.php @@ -204,9 +204,13 @@ class Installer { `type` enum('status','email','sms','pushover') NOT NULL, `message` varchar(255) NOT NULL, `datetime` timestamp NOT NULL default CURRENT_TIMESTAMP, - `user_id` varchar(255) NOT NULL, PRIMARY KEY (`log_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;", + PSM_DB_PREFIX . 'log_users' => "CREATE TABLE `" . PSM_DB_PREFIX . "log_users` ( + `log_id` int(11) UNSIGNED NOT NULL , + `user_id` int(11) UNSIGNED NOT NULL , + PRIMARY KEY (`log_id`, `user_id`), + ) ENGINE=MyISAM DEFAULT CHARSET=utf8;", PSM_DB_PREFIX . 'servers' => "CREATE TABLE `" . PSM_DB_PREFIX . "servers` ( `server_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `ip` varchar(100) NOT NULL, diff --git a/src/psm/Util/Server/Updater/StatusNotifier.class.php b/src/psm/Util/Server/Updater/StatusNotifier.class.php index 154b4c3e..1460b907 100644 --- a/src/psm/Util/Server/Updater/StatusNotifier.class.php +++ b/src/psm/Util/Server/Updater/StatusNotifier.class.php @@ -198,8 +198,6 @@ class StatusNotifier { * @return boolean */ protected function notifyByEmail($users) { - $userlist = array(); - // build mail object with some default values $mail = psm_build_mail(); $mail->Subject = psm_parse_msg($this->status_new, 'email_subject', $this->server); @@ -209,19 +207,23 @@ class StatusNotifier { $mail->Body = $body; $mail->AltBody = str_replace('
', "\n", $body); + // Log + if(psm_get_conf('log_email')) { + $log_id = psm_add_log($this->server_id, 'email', $body); + } + // go through empl foreach ($users as $user) { + // Log + if(!empty($log_id)) { + psm_add_log_user($log_id, $user['user_id']); + } + // we sent a seperate email to every single user. - $userlist[] = $user['user_id']; $mail->AddAddress($user['email'], $user['name']); $mail->Send(); $mail->ClearAddresses(); } - - if(psm_get_conf('log_email')) { - // save to log - psm_add_log($this->server_id, 'email', $body, implode(',', $userlist)); - } } /** @@ -231,38 +233,51 @@ class StatusNotifier { * @return boolean */ protected function notifyByPushover($users) { - $userlist = array(); - $pushover = psm_build_pushover(); + // Clean-up users + foreach($users as $k => $user) { + if (trim($user['pushover_key']) == '') { + unset($users[$k]); + } + } - if($this->status_new === true) { - $pushover->setPriority(0); - } else { - $pushover->setPriority(2); - $pushover->setRetry(300); //Used with Priority = 2; Pushover will resend the notification every 60 seconds until the user accepts. - $pushover->setExpire(3600); //Used with Priority = 2; Pushover will resend the notification every 60 seconds for 3600 seconds. After that point, it stops sending notifications. - } - $message = psm_parse_msg($this->status_new, 'pushover_message', $this->server); + // Validation + if (empty($users)) { + return; + } + // Pushover + $message = psm_parse_msg($this->status_new, 'pushover_message', $this->server); + $pushover = psm_build_pushover(); + if($this->status_new === true) { + $pushover->setPriority(0); + } else { + $pushover->setPriority(2); + $pushover->setRetry(300); //Used with Priority = 2; Pushover will resend the notification every 60 seconds until the user accepts. + $pushover->setExpire(3600); //Used with Priority = 2; Pushover will resend the notification every 60 seconds for 3600 seconds. After that point, it stops sending notifications. + } $pushover->setTitle(psm_parse_msg($this->status_new, 'pushover_title', $this->server)); $pushover->setMessage(str_replace('
', "\n", $message)); $pushover->setUrl(psm_build_url()); $pushover->setUrlTitle(psm_get_lang('system', 'title')); + // Log + if(psm_get_conf('log_pushover')) { + $log_id = psm_add_log($this->server_id, 'pushover', $message); + } + foreach($users as $user) { - if(trim($user['pushover_key']) == '') { - continue; - } - $userlist[] = $user['user_id']; + // Log + if(!empty($log_id)) { + psm_add_log_user($log_id, $user['user_id']); + } + + // Set recipient + send $pushover->setUser($user['pushover_key']); if($user['pushover_device'] != '') { $pushover->setDevice($user['pushover_device']); } $pushover->send(); - } - - if(psm_get_conf('log_pushover')) { - psm_add_log($this->server_id, 'pushover', $message, implode(',', $userlist)); - } + } } /** @@ -277,24 +292,26 @@ class StatusNotifier { return false; } - // we have to build an userlist for the log table.. - $userlist = array(); + $message = psm_parse_msg($this->status_new, 'sms', $this->server); + + // Log + if(psm_get_conf('log_sms')) { + psm_add_log($this->server_id, 'sms', $message); + } // add all users to the recipients list foreach ($users as $user) { - $userlist[] = $user['user_id']; + // Log + if(!empty($log_id)) { + psm_add_log_user($log_id, $user['user_id']); + } + $sms->addRecipients($user['mobile']); } - $message = psm_parse_msg($this->status_new, 'sms', $this->server); - // Send sms $result = $sms->sendSMS($message); - if(psm_get_conf('log_sms')) { - // save to log - psm_add_log($this->server_id, 'sms', $message, implode(',', $userlist)); - } return $result; } From aaa073d9fd70aa98217b8bad5e8de207d2c6e33e Mon Sep 17 00:00:00 2001 From: Davy Rolink Date: Thu, 2 Oct 2014 20:55:22 +0200 Subject: [PATCH 02/13] 3.1.1 upgrade --- src/includes/psmconfig.inc.php | 2 +- src/psm/Util/Install/Installer.class.php | 37 ++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/includes/psmconfig.inc.php b/src/includes/psmconfig.inc.php index 9876bc88..45d09266 100644 --- a/src/includes/psmconfig.inc.php +++ b/src/includes/psmconfig.inc.php @@ -29,7 +29,7 @@ /** * Current PSM version */ -define('PSM_VERSION', '3.1.0'); +define('PSM_VERSION', '3.1.1'); /** * URL to check for updates. Will not be checked if turned off on config page. diff --git a/src/psm/Util/Install/Installer.class.php b/src/psm/Util/Install/Installer.class.php index 7fb96507..da82f765 100644 --- a/src/psm/Util/Install/Installer.class.php +++ b/src/psm/Util/Install/Installer.class.php @@ -78,7 +78,7 @@ class Installer { // different DB version, check if the version requires any changes // @todo this is currently a manual check for each version, similar to upgrade().. not a clean way - if(version_compare($version_db, '3.1.0', '<')) { + if(version_compare($version_db, '3.1.1', '<')) { return true; } else { // change database version to current version so this check won't be required next time @@ -209,7 +209,7 @@ class Installer { PSM_DB_PREFIX . 'log_users' => "CREATE TABLE `" . PSM_DB_PREFIX . "log_users` ( `log_id` int(11) UNSIGNED NOT NULL , `user_id` int(11) UNSIGNED NOT NULL , - PRIMARY KEY (`log_id`, `user_id`), + PRIMARY KEY (`log_id`, `user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;", PSM_DB_PREFIX . 'servers' => "CREATE TABLE `" . PSM_DB_PREFIX . "servers` ( `server_id` int(11) unsigned NOT NULL AUTO_INCREMENT, @@ -286,6 +286,10 @@ class Installer { // upgrade to 3.1.0 $this->upgrade310(); } + if(version_compare($version_from, '3.1.1', '<')) { + // upgrade to 3.1.1 + $this->upgrade311(); + } psm_update_conf('version', $version_to); } @@ -425,4 +429,33 @@ class Installer { $this->execSQL($queries); } + + /** + * Upgrade for v3.1.1 release (all log-users relations are in a separate table) + */ + protected function upgrade311() { + // Create log_users table + $this->execSQL("CREATE TABLE `" . PSM_DB_PREFIX . "log_users` ( + `log_id` int(11) UNSIGNED NOT NULL , + `user_id` int(11) UNSIGNED NOT NULL , + PRIMARY KEY (`log_id`, `user_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"); + + // Migrate the data + $logs = $this->db->select(PSM_DB_PREFIX . 'log', null, array('log_id', 'user_id')); + foreach ($logs as $log) { + // Validation + if (empty($log['user_id']) || trim($log['user_id']) == '') { + continue; + } + + // Insert into new table + foreach (explode(',', $log['user_id']) as $user_id) { + psm_add_log_user($log['log_id'], $user_id); + } + } + + // Drop old user_id('s) column + $this->execSQL("ALTER TABLE `" . PSM_DB_PREFIX . "log` DROP COLUMN `user_id`;"); + } } From 58b104c1fb315b9aefd211ca41b187ed6666bcae Mon Sep 17 00:00:00 2001 From: Davy Rolink Date: Thu, 2 Oct 2014 21:33:51 +0200 Subject: [PATCH 03/13] log users displaying for the new log-users data structure --- .../Server/Controller/LogController.class.php | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/psm/Module/Server/Controller/LogController.class.php b/src/psm/Module/Server/Controller/LogController.class.php index 2b6e465f..c63d980c 100644 --- a/src/psm/Module/Server/Controller/LogController.class.php +++ b/src/psm/Module/Server/Controller/LogController.class.php @@ -60,14 +60,6 @@ class LogController extends AbstractServerController { ); $log_types = array('status', 'email', 'sms', 'pushover'); - // get users - $users = $this->db->select(PSM_DB_PREFIX.'users', null, array('user_id','name')); - - $users_labels = array(); - foreach ($users as $user) { - $users_labels[$user['user_id']] = $user['name']; - } - foreach($log_types as $key) { $records = $this->getEntries($key); $log_count = count($records); @@ -95,15 +87,12 @@ class LogController extends AbstractServerController { $record['datetime_format'] = psm_date($record['datetime']); // fix up user list - if(!empty($record['user_id'])) { + $users = $this->getLogUsers($record['log_id']); + if(!empty($users)) { $names = array(); - $users = explode(',', $record['user_id']); - foreach($users as $user_id) { - if(isset($users_labels[$user_id])) { - $names[] = $users_labels[$user_id]; - } + foreach($users as $user) { + $names[] = $user['name']; } - sort($names); $record['users'] = implode('
', $names); $record['user_list'] = implode(' • ', $names); } @@ -135,10 +124,10 @@ class LogController extends AbstractServerController { '`servers`.`ip`, '. '`servers`.`port`, '. '`servers`.`type` AS server_type, '. + '`log`.`log_id`, '. '`log`.`type`, '. '`log`.`message`, '. - '`log`.`datetime`, '. - '`log`.`user_id` '. + '`log`.`datetime` '. 'FROM `'.PSM_DB_PREFIX.'log` AS `log` '. 'JOIN `'.PSM_DB_PREFIX.'servers` AS `servers` ON (`servers`.`server_id`=`log`.`server_id`) '. $sql_join . @@ -148,4 +137,22 @@ class LogController extends AbstractServerController { ); return $entries; } + + /** + * Get all the user entries for a specific $log_id + * + * @param $log_id + * @return array + */ + protected function getLogUsers($log_id) { + return $this->db->query( + "SELECT + u.`user_id`, + u.`name` + FROM `" . PSM_DB_PREFIX . "log_users` AS lu + LEFT JOIN `" . PSM_DB_PREFIX . "users` AS u ON lu.`user_id` = u.`user_id` + WHERE lu.`log_id` = " . (int)$log_id . " + ORDER BY u.`name` ASC" + ); + } } From 3cc48dff2de8c9090147bd1fff19001ada8ec922 Mon Sep 17 00:00:00 2001 From: Davy Rolink Date: Thu, 2 Oct 2014 22:00:08 +0200 Subject: [PATCH 04/13] bugfix, missing $log_id --- src/psm/Util/Server/Updater/StatusNotifier.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/psm/Util/Server/Updater/StatusNotifier.class.php b/src/psm/Util/Server/Updater/StatusNotifier.class.php index 1460b907..67cdf561 100644 --- a/src/psm/Util/Server/Updater/StatusNotifier.class.php +++ b/src/psm/Util/Server/Updater/StatusNotifier.class.php @@ -296,7 +296,7 @@ class StatusNotifier { // Log if(psm_get_conf('log_sms')) { - psm_add_log($this->server_id, 'sms', $message); + $log_id = psm_add_log($this->server_id, 'sms', $message); } // add all users to the recipients list From 953a7ddf57d6396f2027ec50fae8db043d25786d Mon Sep 17 00:00:00 2001 From: Samuel Denis-D'Ortun Date: Sat, 21 May 2016 20:34:03 -0400 Subject: [PATCH 05/13] Mute error when fsockopen fail to connect to host --- src/psm/Util/Server/Updater/StatusUpdater.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/psm/Util/Server/Updater/StatusUpdater.php b/src/psm/Util/Server/Updater/StatusUpdater.php index 0ff33a69..84b147e1 100644 --- a/src/psm/Util/Server/Updater/StatusUpdater.php +++ b/src/psm/Util/Server/Updater/StatusUpdater.php @@ -145,7 +145,7 @@ class StatusUpdater { // save response time $starttime = microtime(true); - $fp = fsockopen ($this->server['ip'], $this->server['port'], $errno, $this->error, 10); + $fp = @fsockopen ($this->server['ip'], $this->server['port'], $errno, $this->error, 10); $status = ($fp === false) ? false : true; $this->rtime = (microtime(true) - $starttime); From aee4eb030654054ed3d1518fcdc09e6e366fbdb3 Mon Sep 17 00:00:00 2001 From: lploi91 Date: Sun, 22 May 2016 15:33:01 +0700 Subject: [PATCH 06/13] Create vi_VN.lang.php --- src/lang/vi_VN.lang.php | 299 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 src/lang/vi_VN.lang.php diff --git a/src/lang/vi_VN.lang.php b/src/lang/vi_VN.lang.php new file mode 100644 index 00000000..29d745fd --- /dev/null +++ b/src/lang/vi_VN.lang.php @@ -0,0 +1,299 @@ +. + * + * @package phpservermon + * @author Loi Le + * @copyright Copyright (c) 2008-2014 Pepijn Over + * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 + * @version Release: v3.1.1 + * @link http://www.phpservermonitor.org/ + **/ + +$sm_lang = array( + 'name' => 'Tiếng Việt', + 'locale' => array('vi_VN.UTF-8', 'vi_VN', 'Việt Nam'), + 'system' => array( + 'title' => 'Server Monitor', + 'install' => 'Cài đặt', + 'action' => 'Hành động', + 'save' => 'Lưu', + 'edit' => 'Sửa', + 'delete' => 'Xóa', + 'date' => 'Ngày', + 'message' => 'Message', + 'yes' => 'Yes', + 'no' => 'No', + 'insert' => 'Thêm mới', + 'add_new' => 'Thêm mới', + 'update_available' => 'Phiên bản mới ({version}) có săn trên http://www.phpservermonitor.org.', + 'back_to_top' => 'Lên đầu trang', + 'go_back' => 'Quay lại', + 'ok' => 'OK', + 'cancel' => 'Cancel', + // date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php + 'short_day_format' => '%B %e', + 'long_day_format' => '%B %e, %Y', + 'yesterday_format' => 'Yesterday at %k:%M', + 'other_day_format' => '%A at %k:%M', + 'never' => 'Never', + 'hours_ago' => '%d giờ trước', + 'an_hour_ago' => 'khoảng một giờ trước', + 'minutes_ago' => '%d phút trước', + 'a_minute_ago' => 'khoảng một phút trước', + 'seconds_ago' => '%d giây trước', + 'a_second_ago' => 'một giây trước', + ), + 'menu' => array( + 'config' => 'Cấu hình', + 'server' => 'Servers', + 'server_log' => 'Log', + 'server_status' => 'Trạng thái', + 'server_update' => 'Cập nhật', + 'user' => 'Người dùng', + 'help' => 'Giúp đỡ', + ), + 'users' => array( + 'user' => 'Người dùng', + 'name' => 'Tên', + 'user_name' => 'Tên đăng nhập', + 'password' => 'Mật khẩu', + 'password_repeat' => 'Nhập lại mật khẩu', + 'password_leave_blank' => 'Leave blank to keep unchanged', + 'level' => 'Cấp độ', + 'level_10' => 'Administrator', + 'level_20' => 'User', + 'level_description' => 'Administrators có toàn quyền: họ có thể quản lý server, người dùng và chỉnh sửa cấu hình.
Users chỉ xem và chạy cập nhật cho servers được giao cho họ.', + 'mobile' => 'Di động', + 'email' => 'Email', + 'pushover' => 'Pushover', + 'pushover_description' => 'Pushover là một dịch vụ dễ dàng nhận các thông báo theo thời gian thực. Xem website của họ để biết thêm thông tin.', + 'pushover_key' => 'Pushover Key', + 'pushover_device' => 'Pushover Device', + 'pushover_device_description' => 'Tên thiết bị để gửi tin nhắn đến. Để trống để gửi cho tất cả các thiết bị.', + 'delete_title' => 'Xóa Người dùng', + 'delete_message' => 'Bạn có chắc chắn xóa người dùng \'%1\'?', + 'deleted' => 'Đã xóa người dùng.', + 'updated' => 'Đã cập nhật người dùng.', + 'inserted' => 'Đã thêm người dùng.', + 'profile' => 'Hồ sơ', + 'profile_updated' => 'Hồ sơ của bạn đã được cập nhật.', + 'error_user_name_bad_length' => 'Tên người dùng phải có từ 2 và 64 ký tự.', + 'error_user_name_invalid' => 'Tên người dùng chỉ có thể chứa các chữ cái(a-z, A-Z), số (0-9) và dấu gạch dưới (_).', + 'error_user_name_exists' => 'Tên người dùng đã tồn tại trong cơ sở dữ liệu.', + 'error_user_email_bad_length' => 'Địa chỉ email phải từ 5 đến 255 ký tự.', + 'error_user_email_invalid' => 'Địa chỉ email không hợp lệ.', + 'error_user_level_invalid' => 'Cấp độ người dùng không hợp lệ.', + 'error_user_no_match' => 'Người dùng không tìm thấy trong cơ sở dữ liệu.', + 'error_user_password_invalid' => 'Đặt mật khẩu không hợp lệ.', + 'error_user_password_no_match' => 'Các mật khẩu không khớp.', + ), + 'log' => array( + 'title' => 'Log entries', + 'type' => 'Loại', + 'status' => 'Trạng thái', + 'email' => 'Email', + 'sms' => 'SMS', + 'pushover' => 'Pushover', + 'no_logs' => 'No logs', + ), + 'servers' => array( + 'server' => 'Server', + 'status' => 'Trạng thái', + 'label' => 'Nhãn', + 'domain' => 'Domain/IP', + 'timeout' => 'Timeout', + 'timeout_description' => 'Số giây để đợi máy chủ phản hồi.', + 'port' => 'Cổng', + 'type' => 'Loại', + 'type_website' => 'Website', + 'type_service' => 'Dịch vụ', + 'pattern' => 'Tìm kiếm chuỗi/mẫu', + 'pattern_description' => 'Nếu mẫu không tìm thấy trên website, server sẽ được đánh dấu là offline. Biểu thức chính quy (Regular expressions) được cho phép.', + 'last_check' => 'Kiểm tra lần cuối', + 'last_online' => 'Trực tuyến lần cuối', + 'monitoring' => 'Giám sát', + 'no_monitoring' => 'Không giám sát', + 'email' => 'Email', + 'send_email' => 'Gửi Email', + 'sms' => 'SMS', + 'send_sms' => 'Gửi SMS', + 'pushover' => 'Pushover', + 'users' => 'Người dùng', + 'delete_title' => 'Xóa server', + 'delete_message' => 'Bạn có chắt chắn xóa server \'%1\'?', + 'deleted' => 'Đã xóa server.', + 'updated' => 'Đã cập nhật server.', + 'inserted' => 'Đã thêm server.', + 'latency' => 'Độ trễ', + 'latency_max' => 'Độ trễ (cao nhất)', + 'latency_min' => 'Độ trễ (thấp nhất)', + 'latency_avg' => 'Độ trễ (trung bình)', + 'uptime' => 'Thời gian hoạt động', + 'year' => 'Năm', + 'month' => 'Tháng', + 'week' => 'Tuần', + 'day' => 'Ngày', + 'hour' => 'Giờ', + 'warning_threshold' => 'Ngưỡng cảnh báo', + 'warning_threshold_description' => 'Số lần kiểm tra thất bại trước khi đánh đấu là offline.', + 'chart_last_week' => 'Tuần trước', + 'chart_history' => 'Lịch sử', + // Charts date format according jqPlot date format http://www.jqplot.com/docs/files/plugins/jqplot-dateAxisRenderer-js.html + 'chart_day_format' => '%Y-%m-%d', + 'chart_long_date_format' => '%Y-%m-%d %H:%M:%S', + 'chart_short_date_format' => '%m/%d %H:%M', + 'chart_short_time_format' => '%H:%M', + 'warning_notifications_disabled_sms' => 'SMS thông báo bị vô hiệu hóa.', + 'warning_notifications_disabled_email' => 'Email thông báo bị vô hiệu hóa.', + 'warning_notifications_disabled_pushover' => 'Pushover thông báo bị vô hiệu hóa.', + 'error_server_no_match' => 'Không tìm thấy server.', + 'error_server_label_bad_length' => 'Nhãn phải có từ 1 đến 255 ký tự.', + 'error_server_ip_bad_length' => 'The domain / IP Nhãn phải có từ 1 đến 255 ký tự.', + 'error_server_ip_bad_service' => 'Địa chỉ IP không hợp lệ.', + 'error_server_ip_bad_website' => 'URL website không hợp lệ.', + 'error_server_type_invalid' => 'Chọn loại server không hợp lệ.', + 'error_server_warning_threshold_invalid' => 'Ngưỡng cảnh báo phải là một số nguyên có giá trị lớn hơn 0.', + ), + 'config' => array( + 'general' => 'Tổng quát', + 'language' => 'Ngôn ngữ', + 'show_update' => 'Kiểm tra cập nhật?', + 'email_status' => 'Cho phép gửi email', + 'email_from_email' => 'Gửi email từ địa chỉ', + 'email_from_name' => 'Tên địa chỉ mail', + 'email_smtp' => 'Enable SMTP', + 'email_smtp_host' => 'SMTP host', + 'email_smtp_port' => 'SMTP port', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', + 'email_smtp_username' => 'SMTP username', + 'email_smtp_password' => 'SMTP password', + 'email_smtp_noauth' => 'Để trống nếu không có chứng thực', + 'sms_status' => 'Cho phép gửi tin nhắn văn bản', + 'sms_gateway' => 'Gateway sử dụng để gửi tin nhắn', + 'sms_gateway_mosms' => 'Mosms', + 'sms_gateway_mollie' => 'Mollie', + 'sms_gateway_spryng' => 'Spryng', + 'sms_gateway_inetworx' => 'Inetworx', + 'sms_gateway_clickatell' => 'Clickatell', + 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_smsit' => 'Smsit', + 'sms_gateway_username' => 'Gateway username', + 'sms_gateway_password' => 'Gateway password', + 'sms_from' => 'Số điện thoại của người gửi', + 'pushover_status' => 'Cho phép gửi tin nhắn bằng Pushover', + 'pushover_description' => 'Pushover là một dịch vụ dễ dàng nhận các thông báo theo thời gian thực. Xem website của họ để biết thêm thông tin.', + 'pushover_clone_app' => 'Nhấn vào đây để tạo ứng dụng Pushover của bạn', + 'pushover_api_token' => 'Pushover App API Token', + 'pushover_api_token_description' => 'Trước khi bạn có thể sử dụng Pushover, bạn cần phải đăng ký một ứng dụng tại trang web của họ và nhập Token App API ở đây.', + 'alert_type' => 'Chọn khi bạn muốn được thông báo.', + 'alert_type_description' => 'Thay đổi trạng thái: '. + 'Bạn sẽ nhận được thông báo khi một máy chủ có một sự thay đổi trạng thái. Từ online -> offline hoặc offline -> online.
'. + '
Offline: '. + 'Bạn sẽ nhận được thông báo khi một máy chủ offline *MỘT LẦN DUY NHẤT*. Ví dụ, '. + 'cronjob của bạn hoạt động mỗi 15 phút và server của bạn down tại 01h00 cho đến 6h00. '. + 'Bạn sẽ nhận được 1 thông báo lúc 01h00 và đó là nó.
'. + '
Always: '. + 'Bạn sẽ nhận được thông báo mỗi khi chạy đoạn script và một trang web tắt, ngay cả khi trang web đã được offline trong nhiều giờ.', + 'alert_type_status' => 'Thay đổi trạng thái', + 'alert_type_offline' => 'Offline', + 'alert_type_always' => 'Always', + 'log_status' => 'Log status', + 'log_status_description' => 'Nếu log status được đặt là TRUE, màn hình sẽ đăng sự kiện này bất cứ khi nào các thiết lập thông báo được truyền.', + 'log_email' => 'Log emails gửi bởi script', + 'log_sms' => 'Log Tin nhăn văn bản gửi bởi script', + 'log_pushover' => 'Log tin nhắn pushover gửi bởi script', + 'updated' => 'Cấu hình đã được cập nhật.', + 'tab_email' => 'Email', + 'tab_sms' => 'SMS', + 'tab_pushover' => 'Pushover', + 'settings_email' => 'Thiết lặp email', + 'settings_sms' => 'Thiết lập tin nhăn văn bản', + 'settings_pushover' => 'Thiết lặp Pushover', + 'settings_notification' => 'Thiết lặp thông báo', + 'settings_log' => 'Thiết lặp Log', + 'auto_refresh' => 'Tự động làm mới', + 'auto_refresh_servers' => + 'Tự động làm mới servers page.
'. + ''. + 'Trong vài giây, nếu 0 trang sẽ không làm mới.'. + '', + 'seconds' => 'giây', + 'test' => 'Thử', + 'test_email' => 'Một email sẽ được gửi đến địa chỉ được xác định trong hồ sơ người dùng của bạn.', + 'test_sms' => 'Một SMS sẽ được gửi đến địa chỉ được xác định trong hồ sơ người dùng của bạn.', + 'test_pushover' => 'Một thông báo Pushover sẽ được gửi đến địa chỉ được xác định trong hồ sơ người dùng của bạn.', + 'send' => 'Gửi', + 'test_subject' => 'Thử nghiệm', + 'test_message' => 'tin nhắn thử nghiệm', + 'email_sent' => 'Gửi email', + 'email_error' => 'Lỗi trong khi gửi mail', + 'sms_sent' => 'Gửi SMS', + 'sms_error' => 'Lỗi trong khi gửi sms', + 'sms_error_nomobile' => 'Không thể gửi thử SMS: không có số điện thoại hợp lệ được tìm thấy trong hồ sơ của bạn.', + 'pushover_sent' => 'Gửi thông báo Pushover', + 'pushover_error' => 'Một lỗi đã xảy ra trong khi gửi thông báo Pushover: %s', + 'pushover_error_noapp' => 'Không thể gửi thử thông báo: không tìm thấy Pushover App API token trong cấu hình.', + 'pushover_error_nokey' => 'Không thể gửi thử thông báo: không tìm thấy Pushover key trong hồ sơ của bạn.', + 'log_retention_period' => 'Thời gian lưu giữ log', + 'log_retention_period_description' => 'Số ngày để giữ các bản ghi của các thông báo và tài liệu lưu trữ của thời gian hoạt động máy chủ. Nhập 0 để vô hiệu hóa dọn dẹp log.', + 'log_retention_days' => 'ngày', + ), + // for newlines in the email messages use
+ 'notifications' => array( + 'off_sms' => 'Server \'%LABEL%\' is DOWN: ip=%IP%, cổng=%PORT%. Lỗi=%ERROR%', + 'off_email_subject' => 'IMPORTANT: Server \'%LABEL%\' is DOWN', + 'off_email_body' => "Không thể kết nối đến máy chủ sau:

Server: %LABEL%
IP: %IP%
Cổng: %PORT%
Lỗi: %ERROR%
Thời gian: %DATE%", + 'off_pushover_title' => 'Server \'%LABEL%\' is DOWN', + 'off_pushover_message' => "Không thể kết nối đến máy chủ:

Server: %LABEL%
IP: %IP%
Cổng: %PORT%
Lỗi: %ERROR%
Thời gian: %DATE%", + 'on_sms' => 'Server \'%LABEL%\' is RUNNING: ip=%IP%, port=%PORT%', + 'on_email_subject' => 'IMPORTANT: Server \'%LABEL%\' hoạt động', + 'on_email_body' => "Server '%LABEL%' hoạt động lại:

Server: %LABEL%
IP: %IP%
Cổng: %PORT%
Thời gian: %DATE%", + 'on_pushover_title' => 'Server \'%LABEL%\' hoạt động', + 'on_pushover_message' => 'Server \'%LABEL%\' hoạt động lại:

Server: %LABEL%
IP: %IP%
Cổng: %PORT%
Thời gian: %DATE%', + ), + 'login' => array( + 'welcome_usermenu' => 'Chào mừng, %user_name%', + 'title_sign_in' => 'Vui lòng đăng nhập', + 'title_forgot' => 'Quên mật khẩu?', + 'title_reset' => 'Khôi phục mật khẩu', + 'submit' => 'Gửi', + 'remember_me' => 'Ghi nhớ tôi', + 'login' => 'Đăng nhập', + 'logout' => 'Đăng xuất', + 'username' => 'Tên đăng nhập', + 'password' => 'Mật khẩu', + 'password_repeat' => 'Nhập lại mật khẩu', + 'password_forgot' => 'Quên mật khẩu?', + 'password_reset' => 'Khôi phục mật khẩu', + 'password_reset_email_subject' => 'Khôi phục lại mật khẩu của bạn cho PHP Server Monitor', + 'password_reset_email_body' => 'Vui lòng sử dụng liên kết sau đây để thiết lập lại mật khẩu của bạn. Xin lưu ý nó hết hạn trong 1 giờ.

%link%', + 'error_user_incorrect' => 'Tên người dùng cung cấp không thể tìm thấy.', + 'error_login_incorrect' => 'Thông tin không đúng.', + 'error_login_passwords_nomatch' => 'Mật khẩu được cung cấp không phù hợp.', + 'error_reset_invalid_link' => 'Liên kết đặt lại mà bạn cung cấp không hợp lệ.', + 'success_password_forgot' => 'Một email đã được gửi đến bạn với thông tin làm thế nào để khôi phục lại mật khẩu của bạn.', + 'success_password_reset' => 'Mật khẩu bạn được khôi phục thành công. Vui lòng đăng nhập.', + ), + 'error' => array( + '401_unauthorized' => 'Không được phép', + '401_unauthorized_description' => 'Bạn không có quyền xem trang này.', + ), +); From 5a85eeff3627f7ff0d89c9e74795104c2d20f3ee Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 26 May 2016 19:01:33 +0200 Subject: [PATCH 07/13] Changed some wrong translations --- src/lang/nl_NL.lang.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lang/nl_NL.lang.php b/src/lang/nl_NL.lang.php index 647403a4..f73bbdd4 100644 --- a/src/lang/nl_NL.lang.php +++ b/src/lang/nl_NL.lang.php @@ -130,7 +130,7 @@ $sm_lang = array( 'last_check' => 'Laatst gecontroleerd', 'last_online' => 'Laatst online', 'monitoring' => 'Monitoring', - 'no_monitoring' => 'No monitoring', + 'no_monitoring' => 'Geen monitoring', 'email' => 'Email', 'send_email' => 'Stuur email', 'sms' => 'SMS', @@ -209,7 +209,7 @@ $sm_lang = array( 'pushover_api_token' => 'Pushover App API Token', 'pushover_api_token_description' => 'Voordat je Pushover kunt gebruiken moet je een App registreren via hun website, en daarvan de App API Token hier invullen.', 'alert_type' => 'Selecteer wanneer je een notificatie wilt', - 'alert_type_description' => 'Status change: '. + 'alert_type_description' => 'Status verandert: '. 'Je ontvangt alleen bericht wanneer een server van status verandert. Dus van online -> offline of offline -> online.
'. '
Offline: '. 'Je ontvangt bericht wanneer een server offline gaat voor de *EERSTE KEER*. Bijvoorbeeld, '. @@ -236,7 +236,7 @@ $sm_lang = array( 'settings_log' => 'Log instellingen', 'auto_refresh' => 'Auto-refresh', 'auto_refresh_servers' => - 'Auto-refresh servers pagina.
'. + 'Auto-herladen servers pagina.
'. ''. 'Tijd in seconden, als de tijd 0 is wordt de pagina niet ververst.'. '', From 02e24c53efff5b1fe47cd60c51deb56866f82b63 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 26 May 2016 19:50:37 +0200 Subject: [PATCH 08/13] Add explanation how to make the cronjob on cPanel --- docs/install.rst | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/install.rst b/docs/install.rst index 6393d334..1c9be318 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -103,6 +103,22 @@ To specify the base url to your monitor installation, use the "--uri" argument, php status.cron.php --uri="http://www.phpservermonitor.org/mymonitor/" +If you're work with cPanel you can follow these steps: + + Log into your cPanel account + + Go to cron jobs + + Add a new cronjob + + Type `*/15` in the minute field + + Type `*` in the other field + + Type `php /home2//public_html/phpservermon/cron/status.cron.php` in the command field + + Submit + Troubleshooting +++++++++++++++ @@ -110,4 +126,4 @@ Troubleshooting If you have problems setting up or accessing your monitor and do not know why, enable debug mode to turn on error reporting. To enable debug mode, add the following line to your config.php file:: - define('PSM_DEBUG', true); \ No newline at end of file + define('PSM_DEBUG', true); From 945226eb169291ee6f3e0a25d05f511a7778879b Mon Sep 17 00:00:00 2001 From: Samuel Denis-D'Ortun Date: Fri, 27 May 2016 00:01:45 -0400 Subject: [PATCH 09/13] Update install.rst --- docs/install.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/install.rst b/docs/install.rst index 1c9be318..891adb25 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -103,6 +103,9 @@ To specify the base url to your monitor installation, use the "--uri" argument, php status.cron.php --uri="http://www.phpservermonitor.org/mymonitor/" +CPanel +------- + If you're work with cPanel you can follow these steps: Log into your cPanel account From a615303db1852111b717434a2877150d5d433e0d Mon Sep 17 00:00:00 2001 From: Samuel Denis-D'Ortun Date: Fri, 27 May 2016 00:05:18 -0400 Subject: [PATCH 10/13] Update install.rst --- docs/install.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/install.rst b/docs/install.rst index 891adb25..f8e0efa2 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -108,19 +108,19 @@ CPanel If you're work with cPanel you can follow these steps: - Log into your cPanel account +1. Log into your cPanel account - Go to cron jobs +2. Go to cron jobs - Add a new cronjob +3. Add a new cronjob - Type `*/15` in the minute field +- Type `*/15` in the minute field - Type `*` in the other field +- Type `*` in the other field - Type `php /home2//public_html/phpservermon/cron/status.cron.php` in the command field +- Type `php /home2//public_html/phpservermon/cron/status.cron.php` in the command field - Submit +4. Submit Troubleshooting From f4037d2aaa4ea66174765cacefea4c5f310a2652 Mon Sep 17 00:00:00 2001 From: shaundma Date: Fri, 27 May 2016 19:09:42 +0200 Subject: [PATCH 11/13] Initial Commit --- .../default/module/server/server/update.tpl.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/templates/default/module/server/server/update.tpl.html b/src/templates/default/module/server/server/update.tpl.html index 7af848a4..4464a9a3 100644 --- a/src/templates/default/module/server/server/update.tpl.html +++ b/src/templates/default/module/server/server/update.tpl.html @@ -1,5 +1,5 @@ {% import 'main/macros.tpl.html' as macro %} -
+ {{ macro.csrf_input() }}
{{ titlemode }} @@ -82,13 +82,13 @@
- +
- +
@@ -156,4 +156,4 @@ {{ label_go_back }} -
\ No newline at end of file + From dc5b7a0cfc150235f727a728b800ac780789fd8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Dvo=C5=99=C3=A1k?= Date: Fri, 17 Jun 2016 00:42:42 +0200 Subject: [PATCH 12/13] Fix Issue #318 - delete class types, typeWebsite in warning_threshold --- src/templates/default/module/server/server/update.tpl.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates/default/module/server/server/update.tpl.html b/src/templates/default/module/server/server/update.tpl.html index 7af848a4..26a51c31 100644 --- a/src/templates/default/module/server/server/update.tpl.html +++ b/src/templates/default/module/server/server/update.tpl.html @@ -63,7 +63,7 @@ -
+
From d9557b41155544171f4156549ced81c4e46c5bde Mon Sep 17 00:00:00 2001 From: Valentin Deville Date: Mon, 4 Jul 2016 14:31:42 +0200 Subject: [PATCH 13/13] Add FreeMobile SMS --- src/includes/functions.inc.php | 3 ++ src/lang/en_US.lang.php | 1 + src/lang/fr_FR.lang.php | 1 + .../Config/Controller/ConfigController.php | 1 + src/psm/Txtmsg/FreeMobileSMS.php | 52 +++++++++++++++++++ .../default/module/config/config.tpl.html | 1 + 6 files changed, 59 insertions(+) create mode 100755 src/psm/Txtmsg/FreeMobileSMS.php diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index 7b6e4345..5346012f 100644 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -523,6 +523,9 @@ function psm_build_sms() { case 'nexmo': $sms = new \psm\Txtmsg\Nexmo(); break; + case 'freemobilesms': + $sms = new \psm\Txtmsg\FreeMobileSMS(); + break; case 'octopush': $sms = new \psm\Txtmsg\Octopush(); break; } diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php index 23a3f4ac..eb2f77c0 100644 --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -211,6 +211,7 @@ $sm_lang = array( 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', + 'sms_gateway_freemobilesms' => 'FreeMobileSMS', 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Gateway username', 'sms_gateway_password' => 'Gateway password', diff --git a/src/lang/fr_FR.lang.php b/src/lang/fr_FR.lang.php index 776a1e3b..6c7edbdf 100644 --- a/src/lang/fr_FR.lang.php +++ b/src/lang/fr_FR.lang.php @@ -201,6 +201,7 @@ $sm_lang = array( 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_nexmo' => 'Nexmo', + 'sms_gateway_freemobilesms' => 'FreeMobileSMS', 'sms_gateway_username' => 'Nom utilisateur de la passerelle', 'sms_gateway_password' => 'Mot de passe de la passerelle', 'sms_from' => 'SMS de l\'expéditeur', diff --git a/src/psm/Module/Config/Controller/ConfigController.php b/src/psm/Module/Config/Controller/ConfigController.php index 6dcc295e..35d9d7e3 100644 --- a/src/psm/Module/Config/Controller/ConfigController.php +++ b/src/psm/Module/Config/Controller/ConfigController.php @@ -322,6 +322,7 @@ class ConfigController extends AbstractController { 'label_sms_gateway_smsglobal' => psm_get_lang('config', 'sms_gateway_smsglobal'), 'label_sms_gateway_nexmo' => psm_get_lang('config', 'sms_gateway_nexmo'), 'label_sms_gateway_octopush' => psm_get_lang('config', 'sms_gateway_octopush'), + 'label_sms_gateway_freemobilesms' => psm_get_lang('config', 'sms_gateway_freemobilesms'), 'label_sms_gateway_username' => psm_get_lang('config', 'sms_gateway_username'), 'label_sms_gateway_password' => psm_get_lang('config', 'sms_gateway_password'), 'label_sms_from' => psm_get_lang('config', 'sms_from'), diff --git a/src/psm/Txtmsg/FreeMobileSMS.php b/src/psm/Txtmsg/FreeMobileSMS.php new file mode 100755 index 00000000..9269d2c3 --- /dev/null +++ b/src/psm/Txtmsg/FreeMobileSMS.php @@ -0,0 +1,52 @@ +. + * + * @package phpservermon + * @author Michiel van der Wulp + * @copyright Copyright (c) 2008-2015 Pepijn Over + * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 + * @version Release: @package_version@ + * @link http://www.phpservermonitor.org/ + **/ + +namespace psm\Txtmsg; + +class FreeMobileSMS extends Core { + // ========================================================================= + // [ Fields ] + // ========================================================================= + public $gateway = 1; + public $resultcode = null; + public $resultmessage = null; + public $success = false; + public $successcount = 0; + +public function sendSMS($message) { + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, "https://smsapi.free-mobile.fr/sendmsg?user=$this->username&pass=$this->password&msg=$message"); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_TIMEOUT, 10); + $result = curl_exec($ch); + curl_close($ch); + + return true; + } +} diff --git a/src/templates/default/module/config/config.tpl.html b/src/templates/default/module/config/config.tpl.html index d7d55ca2..08fc0fc1 100644 --- a/src/templates/default/module/config/config.tpl.html +++ b/src/templates/default/module/config/config.tpl.html @@ -171,6 +171,7 @@ +