diff --git a/cron/status.cron.php b/cron/status.cron.php
index a1ee428f..a42e4e04 100644
--- a/cron/status.cron.php
+++ b/cron/status.cron.php
@@ -26,11 +26,11 @@
**/
// include main configuration and functionality
-require_once __DIR__ . '/../src/bootstrap.php';
+require_once __DIR__.'/../src/bootstrap.php';
-if(!psm_is_cli()) {
+if (!psm_is_cli()) {
// check if it's an allowed host
- if(!isset($_SERVER["HTTP_X_FORWARDED_FOR"])){
+ if (!isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$_SERVER["HTTP_X_FORWARDED_FOR"] = "";
}
@@ -39,7 +39,7 @@ if(!psm_is_cli()) {
$data = @unserialize(PSM_CRON_ALLOW);
$allow = $data === false ? PSM_CRON_ALLOW : $data;
- if(!in_array($_SERVER['REMOTE_ADDR'], $allow) && !in_array($_SERVER["HTTP_X_FORWARDED_FOR"], $allow)) {
+ if (!in_array($_SERVER['REMOTE_ADDR'], $allow) && !in_array($_SERVER["HTTP_X_FORWARDED_FOR"], $allow)) {
header('HTTP/1.0 403 Forbidden');
die('
403 ForbiddenForbidden
IP address not allowed. See the documentation for more info.
');
}
@@ -48,15 +48,15 @@ if(!psm_is_cli()) {
$cron_timeout = PSM_CRON_TIMEOUT;
// parse a couple of arguments
-if(!empty($_SERVER['argv'])) {
- foreach ($_SERVER['argv'] as $argv) {
+if (!empty($_SERVER['argv'])) {
+ foreach ($_SERVER['argv'] as $argv) {
$argi = explode('=', ltrim($argv, '--'));
- if(count($argi) !== 2) {
+ if (count($argi) !== 2) {
continue;
}
- switch($argi[0]) {
+ switch ($argi[0]) {
case 'uri':
- if(!defined('PSM_BASE_URL')){
+ if (!defined('PSM_BASE_URL')) {
define('PSM_BASE_URL', $argi[1]);
}
break;
@@ -72,14 +72,14 @@ if(!empty($_SERVER['argv'])) {
// if you want to change PSM_CRON_TIMEOUT, have a look in src/includes/psmconfig.inc.php.
// or you can provide the --timeout=x argument
$time = time();
-if(
+if (
psm_get_conf('cron_running') == 1
&& $cron_timeout > 0
&& ($time - psm_get_conf('cron_running_time') < $cron_timeout)
) {
die('Cron is already running. Exiting.');
}
-if(!defined('PSM_DEBUG') || !PSM_DEBUG) {
+if (!defined('PSM_DEBUG') || !PSM_DEBUG) {
psm_update_conf('cron_running', 1);
}
psm_update_conf('cron_running_time', $time);
diff --git a/index.php b/index.php
index ed223c87..668e21f1 100644
--- a/index.php
+++ b/index.php
@@ -25,14 +25,14 @@
* @link http://www.phpservermonitor.org/
**/
-require __DIR__ . '/src/bootstrap.php';
+require __DIR__.'/src/bootstrap.php';
psm_no_cache();
-if(isset($_GET["logout"])) {
+if (isset($_GET["logout"])) {
$router->getService('user')->doLogout();
// logged out, redirect to login
- header('Location: ' . psm_build_url());
+ header('Location: '.psm_build_url());
die();
}
@@ -40,7 +40,7 @@ $mod = psm_GET('mod', PSM_MODULE_DEFAULT);
try {
$router->run($mod);
-} catch(\InvalidArgumentException $e) {
+} catch (\InvalidArgumentException $e) {
// invalid module, try the default one
// it that somehow also doesnt exist, we have a bit of an issue
// and we really have no reason catch it
diff --git a/install.php b/install.php
index 97a21476..f5434bd2 100644
--- a/install.php
+++ b/install.php
@@ -27,6 +27,6 @@
define('PSM_INSTALL', true);
-require __DIR__ . '/src/bootstrap.php';
+require __DIR__.'/src/bootstrap.php';
$router->run('install');
diff --git a/src/bootstrap.php b/src/bootstrap.php
index 4c071af8..6f374c6f 100644
--- a/src/bootstrap.php
+++ b/src/bootstrap.php
@@ -27,27 +27,27 @@
**/
// Include paths
-define('PSM_PATH_SRC', __DIR__ . DIRECTORY_SEPARATOR);
-define('PSM_PATH_CONFIG', PSM_PATH_SRC . 'config' . DIRECTORY_SEPARATOR);
-define('PSM_PATH_LANG', PSM_PATH_SRC . 'lang' . DIRECTORY_SEPARATOR);
-define('PSM_PATH_SMS_GATEWAY', PSM_PATH_SRC . 'psm' . DIRECTORY_SEPARATOR . 'Txtmsg' . DIRECTORY_SEPARATOR);
+define('PSM_PATH_SRC', __DIR__.DIRECTORY_SEPARATOR);
+define('PSM_PATH_CONFIG', PSM_PATH_SRC.'config'.DIRECTORY_SEPARATOR);
+define('PSM_PATH_LANG', PSM_PATH_SRC.'lang'.DIRECTORY_SEPARATOR);
+define('PSM_PATH_SMS_GATEWAY', PSM_PATH_SRC.'psm'.DIRECTORY_SEPARATOR.'Txtmsg'.DIRECTORY_SEPARATOR);
// user levels
define('PSM_USER_ADMIN', 10);
define('PSM_USER_USER', 20);
define('PSM_USER_ANONYMOUS', 30);
-if(function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
+if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
date_default_timezone_set(@date_default_timezone_get());
}
// find config file
-$path_conf = PSM_PATH_SRC . '../config.php';
-if(file_exists($path_conf)) {
+$path_conf = PSM_PATH_SRC.'../config.php';
+if (file_exists($path_conf)) {
include_once $path_conf;
}
// check for a debug var
-if(!defined('PSM_DEBUG')) {
+if (!defined('PSM_DEBUG')) {
define('PSM_DEBUG', false);
}
@@ -57,13 +57,13 @@ ini_set('display_errors', 1);
PSM_DEBUG ? error_reporting(E_ALL) : error_reporting(E_USER_ERROR);
// check for a cron allowed ip array
-if(!defined('PSM_CRON_ALLOW')) {
+if (!defined('PSM_CRON_ALLOW')) {
//serialize for php version lower than 7.0.0
define('PSM_CRON_ALLOW', serialize(array()));
}
-$vendor_autoload = PSM_PATH_SRC . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
-if(!file_exists($vendor_autoload)) {
+$vendor_autoload = PSM_PATH_SRC.'..'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php';
+if (!file_exists($vendor_autoload)) {
trigger_error("No dependencies found in vendor dir. Did you install the dependencies? Please run \"php composer.phar install\".", E_USER_ERROR);
}
require_once $vendor_autoload;
@@ -73,25 +73,25 @@ $router = new psm\Router();
$db = $router->getService('db');
// sanity check!
-if(!defined('PSM_INSTALL') || !PSM_INSTALL) {
- if($db->getDbHost() === null) {
+if (!defined('PSM_INSTALL') || !PSM_INSTALL) {
+ if ($db->getDbHost() === null) {
// no config file has been loaded, redirect the user to the install
header('Location: install.php');
trigger_error("Could not load config file. Redirect to install failed, click here.", E_USER_ERROR);
}
// config file has been loaded, check if we have a connection
- if(!$db->status()) {
+ if (!$db->status()) {
trigger_error("Unable to establish database connection...", E_USER_ERROR);
}
// attempt to load configuration from database
- if(!psm_load_conf()) {
+ if (!psm_load_conf()) {
// unable to load from config table
header('Location: install.php');
trigger_error("Could not load config table. Redirect to install failed, click here.", E_USER_ERROR);
}
// config load OK, make sure database version is up to date
$installer = new \psm\Util\Install\Installer($db);
- if($installer->isUpgradeRequired()) {
+ if ($installer->isUpgradeRequired()) {
trigger_error("Your database is for an older version and requires an upgrade, please click here to update your database to the latest version.", E_USER_ERROR);
}
}
diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php
index f99cbbd6..2157ccdc 100644
--- a/src/includes/functions.inc.php
+++ b/src/includes/functions.inc.php
@@ -40,25 +40,28 @@
function psm_get_lang() {
$args = func_get_args();
- if (empty($args))
+ if (empty($args)) {
return isset($GLOBALS['sm_lang']) ? $GLOBALS['sm_lang'] : $GLOBALS['sm_lang_default'];
+ }
- if(isset($GLOBALS['sm_lang'])) {
+ if (isset($GLOBALS['sm_lang'])) {
$lang = $GLOBALS['sm_lang'];
$not_found = false;
- foreach($args as $translation) {
+ foreach ($args as $translation) {
// if translation does not exist, use default translation
- if(!isset($lang[$translation])) {
+ if (!isset($lang[$translation])) {
$not_found = true;
break;
}
$lang = $lang[$translation];
}
- if(!$not_found) return $lang;
+ if (!$not_found) {
+ return $lang;
+ }
}
$lang = $GLOBALS['sm_lang_default'];
- foreach($args as $translation) {
+ foreach ($args as $translation) {
$lang = $lang[$translation];
}
return $lang;
@@ -74,14 +77,14 @@ function psm_get_lang() {
function psm_load_lang($lang) {
// load default language - English (en_US)
// this will also fill in every part that is not translated in other translation files
- $default_lang_file = PSM_PATH_LANG . 'en_US.lang.php';
+ $default_lang_file = PSM_PATH_LANG.'en_US.lang.php';
file_exists($default_lang_file) ? require $default_lang_file : trigger_error("English translation needs to be installed at all time!", E_USER_ERROR);
isset($sm_lang) ? $GLOBALS['sm_lang_default'] = $sm_lang : trigger_error("\$sm_lang not found in English translation!", E_USER_ERROR);
unset($sm_lang);
// load translation is the selected language is not English (en_US)
- if($lang != "en_US"){
- $lang_file = PSM_PATH_LANG . $lang . '.lang.php';
+ if ($lang != "en_US") {
+ $lang_file = PSM_PATH_LANG.$lang.'.lang.php';
file_exists($lang_file) ? require $lang_file : trigger_error("Translation file could not be found! Default language will be used.", E_USER_WARNING);
isset($sm_lang) ? $GLOBALS['sm_lang'] = $sm_lang : trigger_error("\$sm_lang not found in translation file! Default language will be used.", E_USER_WARNING);
@@ -97,16 +100,16 @@ function psm_load_lang($lang) {
*/
function psm_get_langs() {
$fn_ext = '.lang.php';
- $lang_files = glob(PSM_PATH_LANG . '*' . $fn_ext);
+ $lang_files = glob(PSM_PATH_LANG.'*'.$fn_ext);
$langs = array();
- foreach($lang_files as $file) {
+ foreach ($lang_files as $file) {
$key = str_replace($fn_ext, '', basename($file));
$sm_lang = array();
- if(file_exists($file)) {
+ if (file_exists($file)) {
require $file;
}
- if(isset($sm_lang['name'])) {
+ if (isset($sm_lang['name'])) {
$name = $sm_lang['name'];
} else {
$name = $key;
@@ -124,13 +127,13 @@ function psm_get_langs() {
* @return array
*/
function psm_get_sms_gateways() {
- $sms_gateway_files = glob(PSM_PATH_SMS_GATEWAY . '*.php');
+ $sms_gateway_files = glob(PSM_PATH_SMS_GATEWAY.'*.php');
$sms_gateways = array();
- foreach($sms_gateway_files as $file) {
+ foreach ($sms_gateway_files as $file) {
$name = basename($file, ".php");
// filter system files out
- if($name != "Core" && $name != "TxtmsgInterface"){
+ if ($name != "Core" && $name != "TxtmsgInterface") {
$sms_gateways[strtolower($name)] = $name;
}
}
@@ -148,7 +151,7 @@ function psm_get_sms_gateways() {
* @see psm_load_conf()
*/
function psm_get_conf($key, $alt = null) {
- if(!isset($GLOBALS['sm_config'])) {
+ if (!isset($GLOBALS['sm_config'])) {
psm_load_conf();
}
$result = (isset($GLOBALS['sm_config'][$key])) ? $GLOBALS['sm_config'][$key] : $alt;
@@ -168,16 +171,16 @@ function psm_load_conf() {
$GLOBALS['sm_config'] = array();
- if(!defined('PSM_DB_PREFIX') || !$db->status()) {
+ if (!defined('PSM_DB_PREFIX') || !$db->status()) {
return false;
}
- if(!$db->ifTableExists(PSM_DB_PREFIX.'config')) {
+ if (!$db->ifTableExists(PSM_DB_PREFIX.'config')) {
return false;
}
- $config_db = $db->select(PSM_DB_PREFIX . 'config', null, array('key', 'value'));
+ $config_db = $db->select(PSM_DB_PREFIX.'config', null, array('key', 'value'));
- if(is_array($config_db) && !empty($config_db)) {
- foreach($config_db as $setting) {
+ if (is_array($config_db) && !empty($config_db)) {
+ foreach ($config_db as $setting) {
$GLOBALS['sm_config'][$setting['key']] = $setting['value'];
}
return true;
@@ -199,10 +202,10 @@ function psm_update_conf($key, $value) {
// check if key exists
$exists = psm_get_conf($key, false);
- if($exists === false) {
+ if ($exists === false) {
// add new config record
$db->save(
- PSM_DB_PREFIX . 'config',
+ PSM_DB_PREFIX.'config',
array(
'key' => $key,
'value' => $value,
@@ -256,13 +259,13 @@ function psm_add_log($server_id, $type, $message) {
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,
- )
- );
+ $db->save(
+ PSM_DB_PREFIX.'log_users',
+ array(
+ 'log_id' => $log_id,
+ 'user_id' => $user_id,
+ )
+ );
}
/**
@@ -293,16 +296,16 @@ function psm_log_uptime($server_id, $status, $latency) {
* @return string
*/
function psm_format_interval(DateInterval $interval) {
- $result = "";
+ $result = "";
- if ($interval->y) { $result .= $interval->format("%y ") . ( ($interval->y == 1) ? psm_get_lang('system', 'year') : psm_get_lang('system', 'years') ) . " "; }
- if ($interval->m) { $result .= $interval->format("%m ") . ( ($interval->m == 1) ? psm_get_lang('system', 'month') : psm_get_lang('system', 'months') ) . " "; }
- if ($interval->d) { $result .= $interval->format("%d ") . ( ($interval->d == 1) ? psm_get_lang('system', 'day') : psm_get_lang('system', 'days') ) . " "; }
- if ($interval->h) { $result .= $interval->format("%h ") . ( ($interval->h == 1) ? psm_get_lang('system', 'hour') : psm_get_lang('system', 'hours') ) . " "; }
- if ($interval->i) { $result .= $interval->format("%i ") . ( ($interval->i == 1) ? psm_get_lang('system', 'minute') : psm_get_lang('system', 'minutes') ) . " "; }
- if ($interval->s) { $result .= $interval->format("%s ") . ( ($interval->s == 1) ? psm_get_lang('system', 'second') : psm_get_lang('system', 'seconds') ) . " "; }
+ if ($interval->y) { $result .= $interval->format("%y ").(($interval->y == 1) ? psm_get_lang('system', 'year') : psm_get_lang('system', 'years'))." "; }
+ if ($interval->m) { $result .= $interval->format("%m ").(($interval->m == 1) ? psm_get_lang('system', 'month') : psm_get_lang('system', 'months'))." "; }
+ if ($interval->d) { $result .= $interval->format("%d ").(($interval->d == 1) ? psm_get_lang('system', 'day') : psm_get_lang('system', 'days'))." "; }
+ if ($interval->h) { $result .= $interval->format("%h ").(($interval->h == 1) ? psm_get_lang('system', 'hour') : psm_get_lang('system', 'hours'))." "; }
+ if ($interval->i) { $result .= $interval->format("%i ").(($interval->i == 1) ? psm_get_lang('system', 'minute') : psm_get_lang('system', 'minutes'))." "; }
+ if ($interval->s) { $result .= $interval->format("%s ").(($interval->s == 1) ? psm_get_lang('system', 'second') : psm_get_lang('system', 'seconds'))." "; }
- return $result;
+ return $result;
}
/**
@@ -316,15 +319,15 @@ function psm_log_uptime($server_id, $status, $latency) {
function psm_parse_msg($status, $type, $vars) {
$status = ($status == true) ? 'on' : 'off';
- $message = psm_get_lang('notifications', $status . '_' . $type);
+ $message = psm_get_lang('notifications', $status.'_'.$type);
- if(!$message) {
+ if (!$message) {
return $message;
}
$vars['date'] = date('Y-m-d H:i:s');
- foreach($vars as $k => $v) {
- $message = str_replace('%' . strtoupper($k) . '%', $v, $message);
+ foreach ($vars as $k => $v) {
+ $message = str_replace('%'.strtoupper($k).'%', $v, $message);
}
return $message;
@@ -356,24 +359,24 @@ function psm_curl_get($href, $header = false, $body = true, $timeout = null, $ad
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_ENCODING, '');
- if($website_username !== false && $website_password !== false && !empty($website_username) && !empty($website_password)) {
- curl_setopt($ch, CURLOPT_USERPWD, $website_username . ":" . $website_password);
- }
+ if ($website_username !== false && $website_password !== false && !empty($website_username) && !empty($website_password)) {
+ curl_setopt($ch, CURLOPT_USERPWD, $website_username.":".$website_password);
+ }
curl_setopt($ch, CURLOPT_URL, $href);
- $proxy_url = psm_get_conf('proxy_url','');
- if (psm_get_conf('proxy','0') === '1') {
+ $proxy_url = psm_get_conf('proxy_url', '');
+ if (psm_get_conf('proxy', '0') === '1') {
curl_setopt($ch, CURLOPT_PROXY, $proxy_url);
- $proxy_user = psm_get_conf('proxy_user','');
- $proxy_password = psm_get_conf('proxy_password','');
+ $proxy_user = psm_get_conf('proxy_user', '');
+ $proxy_password = psm_get_conf('proxy_password', '');
if (!empty($proxy_user) && !empty($proxy_password)) {
- curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_user . ':' . $proxy_password);
+ curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_user.':'.$proxy_password);
}
}
- if($add_agent) {
- curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; phpservermon/'.PSM_VERSION.'; +http://www.phpservermonitor.org)');
+ if ($add_agent) {
+ curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; phpservermon/'.PSM_VERSION.'; +http://www.phpservermonitor.org)');
}
$result = curl_exec($ch);
@@ -390,11 +393,11 @@ function psm_curl_get($href, $header = false, $body = true, $timeout = null, $ad
* @return string
*/
function psm_timespan($time) {
- if(empty($time) || $time == '0000-00-00 00:00:00') {
+ if (empty($time) || $time == '0000-00-00 00:00:00') {
return psm_get_lang('system', 'never');
}
if ($time !== intval($time)) { $time = strtotime($time); }
- if ($time < strtotime(date('Y-m-d 00:00:00')) - 60*60*24*3) {
+ if ($time < strtotime(date('Y-m-d 00:00:00')) - 60 * 60 * 24 * 3) {
$format = psm_get_lang('system', (date('Y') !== date('Y', $time)) ? 'long_day_format' : 'short_day_format');
// Check for Windows to find and replace the %e
// modifier correctly
@@ -404,13 +407,13 @@ function psm_timespan($time) {
return strftime($format, $time);
}
$d = time() - $time;
- if ($d >= 60*60*24) {
- $format = psm_get_lang('system', (date('l', time() - 60*60*24) == date('l', $time)) ? 'yesterday_format' : 'other_day_format');
+ if ($d >= 60 * 60 * 24) {
+ $format = psm_get_lang('system', (date('l', time() - 60 * 60 * 24) == date('l', $time)) ? 'yesterday_format' : 'other_day_format');
return strftime($format, $time);
}
- if ($d >= 60*60*2) { return sprintf(psm_get_lang('system', 'hours_ago'), intval($d / (60*60))); }
- if ($d >= 60*60) { return psm_get_lang('system', 'an_hour_ago'); }
- if ($d >= 60*2) { return sprintf(psm_get_lang('system', 'minutes_ago'), intval($d / 60)); }
+ if ($d >= 60 * 60 * 2) { return sprintf(psm_get_lang('system', 'hours_ago'), intval($d / (60 * 60))); }
+ if ($d >= 60 * 60) { return psm_get_lang('system', 'an_hour_ago'); }
+ if ($d >= 60 * 2) { return sprintf(psm_get_lang('system', 'minutes_ago'), intval($d / 60)); }
if ($d >= 60) { return psm_get_lang('system', 'a_minute_ago'); }
if ($d >= 2) { return sprintf(psm_get_lang('system', 'seconds_ago'), intval($d)); }
@@ -423,7 +426,7 @@ function psm_timespan($time) {
* @return string
*/
function psm_date($time) {
- if(empty($time) || $time == '0000-00-00 00:00:00') {
+ if (empty($time) || $time == '0000-00-00 00:00:00') {
return psm_get_lang('system', 'never');
}
return strftime('%x %X', strtotime($time));
@@ -436,27 +439,27 @@ function psm_date($time) {
* @return boolean
*/
function psm_update_available() {
- if(!psm_get_conf('show_update')) {
+ if (!psm_get_conf('show_update')) {
// user does not want updates, fair enough.
return false;
}
$last_update = psm_get_conf('last_update_check');
- if((time() - PSM_UPDATE_INTERVAL) > $last_update) {
+ if ((time() - PSM_UPDATE_INTERVAL) > $last_update) {
// been more than a week since update, lets go
// update last check date
psm_update_conf('last_update_check', time());
$latest = psm_curl_get(PSM_UPDATE_URL);
// add latest version to database
- if($latest !== false && strlen($latest) < 15) {
+ if ($latest !== false && strlen($latest) < 15) {
psm_update_conf('version_update_check', $latest);
}
} else {
$latest = psm_get_conf('version_update_check');
}
- if($latest != false) {
+ if ($latest != false) {
$current = psm_get_conf('version');
return version_compare($latest, $current, '>');
} else {
@@ -478,7 +481,7 @@ function psm_build_mail($from_name = null, $from_email = null) {
$phpmailer->CharSet = 'UTF-8';
$phpmailer->SMTPDebug = false;
- if(psm_get_conf('email_smtp') == '1') {
+ if (psm_get_conf('email_smtp') == '1') {
$phpmailer->IsSMTP();
$phpmailer->Host = psm_get_conf('email_smtp_host');
$phpmailer->Port = psm_get_conf('email_smtp_port');
@@ -487,7 +490,7 @@ function psm_build_mail($from_name = null, $from_email = null) {
$smtp_user = psm_get_conf('email_smtp_username');
$smtp_pass = psm_get_conf('email_smtp_password');
- if($smtp_user != '' && $smtp_pass != '') {
+ if ($smtp_user != '' && $smtp_pass != '') {
$phpmailer->SMTPAuth = true;
$phpmailer->Username = $smtp_user;
$phpmailer->Password = $smtp_pass;
@@ -495,10 +498,10 @@ function psm_build_mail($from_name = null, $from_email = null) {
} else {
$phpmailer->IsMail();
}
- if($from_name == null) {
+ if ($from_name == null) {
$from_name = psm_get_conf('email_from_name');
}
- if($from_email == null) {
+ if ($from_email == null) {
$from_email = psm_get_conf('email_from_email');
}
$phpmailer->SetFrom($from_email, $from_name);
@@ -539,7 +542,7 @@ function psm_build_sms() {
// open the right class
// not making this any more dynamic, because perhaps some gateways need custom settings
- switch(strtolower(psm_get_conf('sms_gateway'))) {
+ switch (strtolower(psm_get_conf('sms_gateway'))) {
case 'mosms':
$sms = new \psm\Txtmsg\Mosms();
break;
@@ -603,7 +606,7 @@ function psm_build_sms() {
}
// copy login information from the config file
- if($sms) {
+ if ($sms) {
$sms->setLogin(psm_get_conf('sms_gateway_username'), psm_get_conf('sms_gateway_password'));
$sms->setOriginator(psm_get_conf('sms_from'));
}
@@ -619,27 +622,27 @@ function psm_build_sms() {
* @return string
*/
function psm_build_url($params = array(), $urlencode = true, $htmlentities = true) {
- if(defined('PSM_BASE_URL') && PSM_BASE_URL !== null) {
+ if (defined('PSM_BASE_URL') && PSM_BASE_URL !== null) {
$url = PSM_BASE_URL;
} else {
- $url = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443 ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
+ $url = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443 ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'];
// on Windows, dirname() adds both back- and forward slashes (http://php.net/dirname).
// for urls, we only want the forward slashes.
$url .= dirname($_SERVER['SCRIPT_NAME']);
$url = str_replace('\\', '', $url);
}
- $url = rtrim($url, '/') . '/';
+ $url = rtrim($url, '/').'/';
- if($params != null) {
+ if ($params != null) {
$url .= '?';
- if(is_array($params)) {
+ if (is_array($params)) {
$delim = ($htmlentities) ? '&' : '&';
- foreach($params as $k => $v) {
- if($urlencode) {
+ foreach ($params as $k => $v) {
+ if ($urlencode) {
$v = urlencode($v);
}
- $url .= $delim . $k . '=' . $v;
+ $url .= $delim.$k.'='.$v;
}
} else {
$url .= $params;
@@ -656,7 +659,7 @@ function psm_build_url($params = array(), $urlencode = true, $htmlentities = tru
* @return mixed
*/
function psm_GET($key, $alt = null) {
- if(isset($_GET[$key])) {
+ if (isset($_GET[$key])) {
return $_GET[$key];
} else {
return $alt;
@@ -670,7 +673,7 @@ function psm_GET($key, $alt = null) {
* @return mixed
*/
function psm_POST($key, $alt = null) {
- if(isset($_POST[$key])) {
+ if (isset($_POST[$key])) {
return $_POST[$key];
} else {
return $alt;
@@ -712,7 +715,7 @@ function pre($arr = null) {
*/
function psm_no_cache() {
header("Expires: Mon, 20 Dec 1998 01:00:00 GMT");
- header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+ header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
}
@@ -727,22 +730,24 @@ function psm_no_cache() {
*/
function psm_password_encrypt($key, $password)
{
- if(empty($password))
- return '';
+ if (empty($password)) {
+ return '';
+ }
- if (empty($key))
- throw new \InvalidArgumentException('invalid_encryption_key');
+ if (empty($key)) {
+ throw new \InvalidArgumentException('invalid_encryption_key');
+ }
- $iv = mcrypt_create_iv(
+ $iv = mcrypt_create_iv(
mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC),
MCRYPT_DEV_URANDOM
);
$encrypted = base64_encode(
- $iv .
+ $iv.
mcrypt_encrypt(
MCRYPT_RIJNDAEL_128,
- hash('sha256', $key, true),
+ hash('sha256', $key, true),
$password,
MCRYPT_MODE_CBC,
$iv
@@ -762,11 +767,13 @@ function psm_password_encrypt($key, $password)
*/
function psm_password_decrypt($key, $encryptedString)
{
- if(empty($encryptedString))
+ if (empty($encryptedString)) {
return '';
+ }
- if (empty($key))
- throw new \InvalidArgumentException('invalid_encryption_key');
+ if (empty($key)) {
+ throw new \InvalidArgumentException('invalid_encryption_key');
+ }
$data = base64_decode($encryptedString);
$iv = substr($data, 0, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC));
@@ -774,7 +781,7 @@ function psm_password_decrypt($key, $encryptedString)
$decrypted = rtrim(
mcrypt_decrypt(
MCRYPT_RIJNDAEL_128,
- hash('sha256', $key, true),
+ hash('sha256', $key, true),
substr($data, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)),
MCRYPT_MODE_CBC,
$iv
@@ -798,16 +805,16 @@ class telegram
private $_message;
private $_url;
- public function setToken ($token) {
- $this->_token = (string)$token;
+ public function setToken($token) {
+ $this->_token = (string) $token;
}
- public function setUser ($user) {
- $this->_user = (string)$user;
+ public function setUser($user) {
+ $this->_user = (string) $user;
}
- public function setMessage ($message) {
- $this->_message = (string)$message;
+ public function setMessage($message) {
+ $this->_message = (string) $message;
}
- public function sendurl () {
+ public function sendurl() {
$con = curl_init($this->_url);
curl_setopt($con, CURLOPT_RETURNTRANSFER, true);
curl_setopt($con, CURLOPT_CONNECTTIMEOUT, 5);
@@ -816,16 +823,16 @@ class telegram
$response = json_decode($response, true);
return $response;
}
- public function send () {
- if(!Empty($this->_token) && !Empty($this->_user) && !Empty($this->_message)) {
- $this->_url = 'https://api.telegram.org/bot' . urlencode($this->_token) . '/sendMessage?chat_id=' . urlencode($this->_user) . '&text=' . urlencode($this->_message);
+ public function send() {
+ if (!Empty($this->_token) && !Empty($this->_user) && !Empty($this->_message)) {
+ $this->_url = 'https://api.telegram.org/bot'.urlencode($this->_token).'/sendMessage?chat_id='.urlencode($this->_user).'&text='.urlencode($this->_message);
}
return $this->sendurl();
}
// Get the bots username
- public function getBotUsername () {
- if(!Empty($this->_token)) {
- $this->_url = 'https://api.telegram.org/bot' . urlencode($this->_token) . '/getMe';
+ public function getBotUsername() {
+ if (!Empty($this->_token)) {
+ $this->_url = 'https://api.telegram.org/bot'.urlencode($this->_token).'/getMe';
}
return $this->sendurl();
}
diff --git a/src/includes/password_compatibility_library.inc.php b/src/includes/password_compatibility_library.inc.php
index d68f15f9..641e7550 100644
--- a/src/includes/password_compatibility_library.inc.php
+++ b/src/includes/password_compatibility_library.inc.php
@@ -36,211 +36,211 @@
if (!defined('PASSWORD_DEFAULT')) {
- define('PASSWORD_BCRYPT', 1);
- define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);
+ define('PASSWORD_BCRYPT', 1);
+ define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);
- /**
- * Hash the password using the specified algorithm
- *
- * @param string $password The password to hash
- * @param int $algo The algorithm to use (Defined by PASSWORD_* constants)
- * @param array $options The options for the algorithm to use
- *
- * @return string|false The hashed password, or false on error.
- */
- function password_hash($password, $algo, array $options = array()) {
- if (!function_exists('crypt')) {
- trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING);
- return null;
- }
- if (!is_string($password)) {
- trigger_error("password_hash(): Password must be a string", E_USER_WARNING);
- return null;
- }
- if (!is_int($algo)) {
- trigger_error("password_hash() expects parameter 2 to be long, " . gettype($algo) . " given", E_USER_WARNING);
- return null;
- }
- switch ($algo) {
- case PASSWORD_BCRYPT:
- // Note that this is a C constant, but not exposed to PHP, so we don't define it here.
- $cost = 10;
- if (isset($options['cost'])) {
- $cost = $options['cost'];
- if ($cost < 4 || $cost > 31) {
- trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
- return null;
- }
- }
- // The length of salt to generate
- $raw_salt_len = 16;
- // The length required in the final serialization
- $required_salt_len = 22;
- $hash_format = sprintf("$2y$%02d$", $cost);
- break;
- default:
- trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING);
- return null;
- }
- if (isset($options['salt'])) {
- switch (gettype($options['salt'])) {
- case 'NULL':
- case 'boolean':
- case 'integer':
- case 'double':
- case 'string':
- $salt = (string) $options['salt'];
- break;
- case 'object':
- if (method_exists($options['salt'], '__tostring')) {
- $salt = (string) $options['salt'];
- break;
- }
- case 'array':
- case 'resource':
- default:
- trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING);
- return null;
- }
- if (strlen($salt) < $required_salt_len) {
- trigger_error(sprintf("password_hash(): Provided salt is too short: %d expecting %d", strlen($salt), $required_salt_len), E_USER_WARNING);
- return null;
- } elseif (0 == preg_match('#^[a-zA-Z0-9./]+$#D', $salt)) {
- $salt = str_replace('+', '.', base64_encode($salt));
- }
- } else {
- $buffer = '';
- $buffer_valid = false;
- if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- $buffer = mcrypt_create_iv($raw_salt_len, MCRYPT_DEV_URANDOM);
- if ($buffer) {
- $buffer_valid = true;
- }
- }
- if (!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) {
- $buffer = openssl_random_pseudo_bytes($raw_salt_len);
- if ($buffer) {
- $buffer_valid = true;
- }
- }
- if (!$buffer_valid && is_readable('/dev/urandom')) {
- $f = fopen('/dev/urandom', 'r');
- $read = strlen($buffer);
- while ($read < $raw_salt_len) {
- $buffer .= fread($f, $raw_salt_len - $read);
- $read = strlen($buffer);
- }
- fclose($f);
- if ($read >= $raw_salt_len) {
- $buffer_valid = true;
- }
- }
- if (!$buffer_valid || strlen($buffer) < $raw_salt_len) {
- $bl = strlen($buffer);
- for ($i = 0; $i < $raw_salt_len; $i++) {
- if ($i < $bl) {
- $buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255));
- } else {
- $buffer .= chr(mt_rand(0, 255));
- }
- }
- }
- $salt = str_replace('+', '.', base64_encode($buffer));
- }
- $salt = substr($salt, 0, $required_salt_len);
+ /**
+ * Hash the password using the specified algorithm
+ *
+ * @param string $password The password to hash
+ * @param int $algo The algorithm to use (Defined by PASSWORD_* constants)
+ * @param array $options The options for the algorithm to use
+ *
+ * @return string|false The hashed password, or false on error.
+ */
+ function password_hash($password, $algo, array $options = array()) {
+ if (!function_exists('crypt')) {
+ trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING);
+ return null;
+ }
+ if (!is_string($password)) {
+ trigger_error("password_hash(): Password must be a string", E_USER_WARNING);
+ return null;
+ }
+ if (!is_int($algo)) {
+ trigger_error("password_hash() expects parameter 2 to be long, ".gettype($algo)." given", E_USER_WARNING);
+ return null;
+ }
+ switch ($algo) {
+ case PASSWORD_BCRYPT:
+ // Note that this is a C constant, but not exposed to PHP, so we don't define it here.
+ $cost = 10;
+ if (isset($options['cost'])) {
+ $cost = $options['cost'];
+ if ($cost < 4 || $cost > 31) {
+ trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
+ return null;
+ }
+ }
+ // The length of salt to generate
+ $raw_salt_len = 16;
+ // The length required in the final serialization
+ $required_salt_len = 22;
+ $hash_format = sprintf("$2y$%02d$", $cost);
+ break;
+ default:
+ trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING);
+ return null;
+ }
+ if (isset($options['salt'])) {
+ switch (gettype($options['salt'])) {
+ case 'NULL':
+ case 'boolean':
+ case 'integer':
+ case 'double':
+ case 'string':
+ $salt = (string) $options['salt'];
+ break;
+ case 'object':
+ if (method_exists($options['salt'], '__tostring')) {
+ $salt = (string) $options['salt'];
+ break;
+ }
+ case 'array':
+ case 'resource':
+ default:
+ trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING);
+ return null;
+ }
+ if (strlen($salt) < $required_salt_len) {
+ trigger_error(sprintf("password_hash(): Provided salt is too short: %d expecting %d", strlen($salt), $required_salt_len), E_USER_WARNING);
+ return null;
+ } elseif (0 == preg_match('#^[a-zA-Z0-9./]+$#D', $salt)) {
+ $salt = str_replace('+', '.', base64_encode($salt));
+ }
+ } else {
+ $buffer = '';
+ $buffer_valid = false;
+ if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
+ $buffer = mcrypt_create_iv($raw_salt_len, MCRYPT_DEV_URANDOM);
+ if ($buffer) {
+ $buffer_valid = true;
+ }
+ }
+ if (!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) {
+ $buffer = openssl_random_pseudo_bytes($raw_salt_len);
+ if ($buffer) {
+ $buffer_valid = true;
+ }
+ }
+ if (!$buffer_valid && is_readable('/dev/urandom')) {
+ $f = fopen('/dev/urandom', 'r');
+ $read = strlen($buffer);
+ while ($read < $raw_salt_len) {
+ $buffer .= fread($f, $raw_salt_len - $read);
+ $read = strlen($buffer);
+ }
+ fclose($f);
+ if ($read >= $raw_salt_len) {
+ $buffer_valid = true;
+ }
+ }
+ if (!$buffer_valid || strlen($buffer) < $raw_salt_len) {
+ $bl = strlen($buffer);
+ for ($i = 0; $i < $raw_salt_len; $i++) {
+ if ($i < $bl) {
+ $buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255));
+ } else {
+ $buffer .= chr(mt_rand(0, 255));
+ }
+ }
+ }
+ $salt = str_replace('+', '.', base64_encode($buffer));
+ }
+ $salt = substr($salt, 0, $required_salt_len);
- $hash = $hash_format . $salt;
+ $hash = $hash_format.$salt;
- $ret = crypt($password, $hash);
+ $ret = crypt($password, $hash);
- if (!is_string($ret) || strlen($ret) <= 13) {
- return false;
- }
+ if (!is_string($ret) || strlen($ret) <= 13) {
+ return false;
+ }
- return $ret;
- }
+ return $ret;
+ }
- /**
- * Get information about the password hash. Returns an array of the information
- * that was used to generate the password hash.
- *
- * array(
- * 'algo' => 1,
- * 'algoName' => 'bcrypt',
- * 'options' => array(
- * 'cost' => 10,
- * ),
- * )
- *
- * @param string $hash The password hash to extract info from
- *
- * @return array The array of information about the hash.
- */
- function password_get_info($hash) {
- $return = array(
- 'algo' => 0,
- 'algoName' => 'unknown',
- 'options' => array(),
- );
- if (substr($hash, 0, 4) == '$2y$' && strlen($hash) == 60) {
- $return['algo'] = PASSWORD_BCRYPT;
- $return['algoName'] = 'bcrypt';
- list($cost) = sscanf($hash, "$2y$%d$");
- $return['options']['cost'] = $cost;
- }
- return $return;
- }
+ /**
+ * Get information about the password hash. Returns an array of the information
+ * that was used to generate the password hash.
+ *
+ * array(
+ * 'algo' => 1,
+ * 'algoName' => 'bcrypt',
+ * 'options' => array(
+ * 'cost' => 10,
+ * ),
+ * )
+ *
+ * @param string $hash The password hash to extract info from
+ *
+ * @return array The array of information about the hash.
+ */
+ function password_get_info($hash) {
+ $return = array(
+ 'algo' => 0,
+ 'algoName' => 'unknown',
+ 'options' => array(),
+ );
+ if (substr($hash, 0, 4) == '$2y$' && strlen($hash) == 60) {
+ $return['algo'] = PASSWORD_BCRYPT;
+ $return['algoName'] = 'bcrypt';
+ list($cost) = sscanf($hash, "$2y$%d$");
+ $return['options']['cost'] = $cost;
+ }
+ return $return;
+ }
- /**
- * Determine if the password hash needs to be rehashed according to the options provided
- *
- * If the answer is true, after validating the password using password_verify, rehash it.
- *
- * @param string $hash The hash to test
- * @param int $algo The algorithm used for new password hashes
- * @param array $options The options array passed to password_hash
- *
- * @return boolean True if the password needs to be rehashed.
- */
- function password_needs_rehash($hash, $algo, array $options = array()) {
- $info = password_get_info($hash);
- if ($info['algo'] != $algo) {
- return true;
- }
- switch ($algo) {
- case PASSWORD_BCRYPT:
- $cost = isset($options['cost']) ? $options['cost'] : 10;
- if ($cost != $info['options']['cost']) {
- return true;
- }
- break;
- }
- return false;
- }
+ /**
+ * Determine if the password hash needs to be rehashed according to the options provided
+ *
+ * If the answer is true, after validating the password using password_verify, rehash it.
+ *
+ * @param string $hash The hash to test
+ * @param int $algo The algorithm used for new password hashes
+ * @param array $options The options array passed to password_hash
+ *
+ * @return boolean True if the password needs to be rehashed.
+ */
+ function password_needs_rehash($hash, $algo, array $options = array()) {
+ $info = password_get_info($hash);
+ if ($info['algo'] != $algo) {
+ return true;
+ }
+ switch ($algo) {
+ case PASSWORD_BCRYPT:
+ $cost = isset($options['cost']) ? $options['cost'] : 10;
+ if ($cost != $info['options']['cost']) {
+ return true;
+ }
+ break;
+ }
+ return false;
+ }
- /**
- * Verify a password against a hash using a timing attack resistant approach
- *
- * @param string $password The password to verify
- * @param string $hash The hash to verify against
- *
- * @return boolean If the password matches the hash
- */
- function password_verify($password, $hash) {
- if (!function_exists('crypt')) {
- trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING);
- return false;
- }
- $ret = crypt($password, $hash);
- if (!is_string($ret) || strlen($ret) != strlen($hash) || strlen($ret) <= 13) {
- return false;
- }
+ /**
+ * Verify a password against a hash using a timing attack resistant approach
+ *
+ * @param string $password The password to verify
+ * @param string $hash The hash to verify against
+ *
+ * @return boolean If the password matches the hash
+ */
+ function password_verify($password, $hash) {
+ if (!function_exists('crypt')) {
+ trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING);
+ return false;
+ }
+ $ret = crypt($password, $hash);
+ if (!is_string($ret) || strlen($ret) != strlen($hash) || strlen($ret) <= 13) {
+ return false;
+ }
- $status = 0;
- for ($i = 0; $i < strlen($ret); $i++) {
- $status |= (ord($ret[$i]) ^ ord($hash[$i]));
- }
+ $status = 0;
+ for ($i = 0; $i < strlen($ret); $i++) {
+ $status |= (ord($ret[$i]) ^ ord($hash[$i]));
+ }
- return $status === 0;
- }
+ return $status === 0;
+ }
}
diff --git a/src/includes/psmconfig.inc.php b/src/includes/psmconfig.inc.php
index de474bf3..3bd5ff2f 100644
--- a/src/includes/psmconfig.inc.php
+++ b/src/includes/psmconfig.inc.php
@@ -118,7 +118,7 @@ define('PSM_TELEGRAM_GET_ID_URL', 'https://telegram.me/cid_bot');
*/
//define('PSM_BASE_URL', null);
-if(!defined('PSM_MODULE_DEFAULT')) {
+if (!defined('PSM_MODULE_DEFAULT')) {
/**
* Default theme
*/
diff --git a/src/lang/cs_CZ.lang.php b/src/lang/cs_CZ.lang.php
index 606086b8..063a9c52 100644
--- a/src/lang/cs_CZ.lang.php
+++ b/src/lang/cs_CZ.lang.php
@@ -227,12 +227,12 @@ $sm_lang = array(
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Pře použitím Pushoveru se musíte registrovat a získat API Token.',
'alert_type' => 'Zvolte kdy si přejete být upozorněni.',
- 'alert_type_description' => 'Změna stavu: '.
- 'Obdržíte upozornění při změně stavu, tedy:online -> offline nebo offline -> online.
'.
- '
Offline: '.
- 'Obdržíte upozornění, kdy server přejde poprvé do offline stavu. Například, pokud je cron nastaven na 15 minut a sledovaný server bude offline mezi 01:00 a 06:00. Obdržíte upozornění pouze v 01:00.
'.
- '
Vždy: '.
- 'Obdržíte upozornění při každém spuštění kontroly, tedy i pokud bude server offline několik hodin.',
+ 'alert_type_description' => 'Změna stavu: '.
+ 'Obdržíte upozornění při změně stavu, tedy:online -> offline nebo offline -> online.
'.
+ '
Offline: '.
+ 'Obdržíte upozornění, kdy server přejde poprvé do offline stavu. Například, pokud je cron nastaven na 15 minut a sledovaný server bude offline mezi 01:00 a 06:00. Obdržíte upozornění pouze v 01:00.
'.
+ '
Vždy: '.
+ 'Obdržíte upozornění při každém spuštění kontroly, tedy i pokud bude server offline několik hodin.',
'alert_type_status' => 'Změna stavu',
'alert_type_offline' => 'Offline',
'alert_type_always' => 'Vždy',
diff --git a/src/lang/da_DK.lang.php b/src/lang/da_DK.lang.php
index 1663a852..89eefee2 100644
--- a/src/lang/da_DK.lang.php
+++ b/src/lang/da_DK.lang.php
@@ -213,13 +213,13 @@ $sm_lang = array(
'pushover_api_token_description' => 'Før du kan benytte Pushover, skal du registrere en app på deres website og indtaste en App API Token her.',
'alert_type' => 'Vælg hvornår du vil modtage beskeden',
'alert_type_description' => 'Status ændring: '.
- 'Du vil modtage en notifkation når en server har en ændring i status. Fra online -> offline eller offline -> online.
'.
- '
Offline: '.
- 'Du vil modtage en meddelelse, når en server går offline for første gang. Eksempelvis '.
- 'hvis dit cronjob kører hvert kvarter, og din server går ned kl 01 og kommer først op kl 06, '.
- ' vil du kun modtage en mail kl 01.
'.
- '
Altid: '.
- 'Du vil modtage en besked, hver gang scriptet kører og et websted er nede, selvom site har været offline i flere timer.',
+ 'Du vil modtage en notifkation når en server har en ændring i status. Fra online -> offline eller offline -> online.
'.
+ '
Offline: '.
+ 'Du vil modtage en meddelelse, når en server går offline for første gang. Eksempelvis '.
+ 'hvis dit cronjob kører hvert kvarter, og din server går ned kl 01 og kommer først op kl 06, '.
+ ' vil du kun modtage en mail kl 01.
'.
+ '
Altid: '.
+ 'Du vil modtage en besked, hver gang scriptet kører og et websted er nede, selvom site har været offline i flere timer.',
'alert_type_status' => 'Status ændret',
'alert_type_offline' => 'Offline',
'alert_type_always' => 'Altid',
diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php
index 8ad2c959..6c031519 100644
--- a/src/lang/en_US.lang.php
+++ b/src/lang/en_US.lang.php
@@ -258,14 +258,14 @@ $sm_lang = array(
'telegram_api_token' => 'Telegram API Token',
'telegram_api_token_description' => 'Before you can use Telegram, you need to get a API token. Visit the documentation for help.',
'alert_type' => 'Select when you\'d like to be notified.',
- 'alert_type_description' => 'Status change: '.
- 'You will receive a notifcation when a server has a change in status. So from online -> offline or offline -> online.
'.
- '
Offline: '.
- 'You will receive a notification when a server goes offline for the *FIRST TIME ONLY*. For example, '.
- 'your cronjob is every 15 mins and your server goes down at 1 am and stays down till 6 am. '.
- 'You will get 1 notification at 1 am and thats it.
'.
- '
Always: '.
- 'You will receive a notification every time the script runs and a site is down, even if the site has been offline for hours.',
+ 'alert_type_description' => 'Status change: '.
+ 'You will receive a notifcation when a server has a change in status. So from online -> offline or offline -> online.
'.
+ '
Offline: '.
+ 'You will receive a notification when a server goes offline for the *FIRST TIME ONLY*. For example, '.
+ 'your cronjob is every 15 mins and your server goes down at 1 am and stays down till 6 am. '.
+ 'You will get 1 notification at 1 am and thats it.
'.
+ '
Always: '.
+ 'You will receive a notification every time the script runs and a site is down, even if the site has been offline for hours.',
'alert_type_status' => 'Status change',
'alert_type_offline' => 'Offline',
'alert_type_always' => 'Always',
diff --git a/src/lang/es_ES.lang.php b/src/lang/es_ES.lang.php
index 25af90f0..9b4c42c7 100644
--- a/src/lang/es_ES.lang.php
+++ b/src/lang/es_ES.lang.php
@@ -216,14 +216,14 @@ $sm_lang = array(
'pushover_api_token' => 'Token API de Pushover',
'pushover_api_token_description' => 'Antes de poder utilizar Pushover, necesita registrar su aplicación en la página web e ingresar el token API.',
'alert_type' => '¿Cuándo desea recibir notificaciones ?',
- 'alert_type_description' => '... Al cambiar el estado: '.
- 'p.ej. en línea -> fuera de línea o fuera de línea -> en línea.
'.
- '
Fuera de Línea: '.
- 'Recibirá una notificación cuando el servidor esté fuera de línea.'.
- 'Se envia un sólo mensaje cuando se detecte la caída por primera vez.
'.
- '
Siempre: '.
- 'Se le enviará una notificación cada vez que se ejecuta el script '.
- 'aunqué el servicio puede haber estado fuera de línea por varias horas.',
+ 'alert_type_description' => '... Al cambiar el estado: '.
+ 'p.ej. en línea -> fuera de línea o fuera de línea -> en línea.
'.
+ '
Fuera de Línea: '.
+ 'Recibirá una notificación cuando el servidor esté fuera de línea.'.
+ 'Se envia un sólo mensaje cuando se detecte la caída por primera vez.
'.
+ '
Siempre: '.
+ 'Se le enviará una notificación cada vez que se ejecuta el script '.
+ 'aunqué el servicio puede haber estado fuera de línea por varias horas.',
'alert_type_status' => 'Cambio de estado',
'alert_type_offline' => 'Fuera de Línea',
'alert_type_always' => 'Siempre',
diff --git a/src/lang/et_ET.lang.php b/src/lang/et_ET.lang.php
index 83e17d44..0576d007 100644
--- a/src/lang/et_ET.lang.php
+++ b/src/lang/et_ET.lang.php
@@ -201,14 +201,14 @@ $sm_lang = array(
'pushover_api_token' => 'Pushover Äppi API Žetoon',
'pushover_api_token_description' => 'Enne, kui saad Pushoverida pead sa regristreerima äpi nende kodulehel ja sisestama API žetooni siia.',
'alert_type' => 'Vali, millal sa sooviksid olla teavitatud.',
- 'alert_type_description' => 'Staatuse muutus: '.
- 'Saate teavituse kui serveri staatuses toimub muudatusi. Seega kättesaadav -> võrgust väljas või võrgust väljas -> kättesaadav.
'.
- '
Võrgust väljas: '.
- 'Saate teavituse kui server läheb võrgust välja *ESIMEST KORDA*. Näiteks, '.
- 'sinu cronjob on iga 15 minuti tagant ja sulgub kell 1 öösel kuni kella 6ni hommikul. '.
- 'Saate 1 teavituse kell 1 öösel ja see on kõik.
'.
- '
Alati: '.
- 'Saate teavituse iga kord kui staatust uuendatakse, isegi kui leht on olnud maas juba tunde.',
+ 'alert_type_description' => 'Staatuse muutus: '.
+ 'Saate teavituse kui serveri staatuses toimub muudatusi. Seega kättesaadav -> võrgust väljas või võrgust väljas -> kättesaadav.
'.
+ '
Võrgust väljas: '.
+ 'Saate teavituse kui server läheb võrgust välja *ESIMEST KORDA*. Näiteks, '.
+ 'sinu cronjob on iga 15 minuti tagant ja sulgub kell 1 öösel kuni kella 6ni hommikul. '.
+ 'Saate 1 teavituse kell 1 öösel ja see on kõik.
'.
+ '
Alati: '.
+ 'Saate teavituse iga kord kui staatust uuendatakse, isegi kui leht on olnud maas juba tunde.',
'alert_type_status' => 'Staatuse muutus',
'alert_type_offline' => 'Võrgust väljas',
'alert_type_always' => 'Alati',
diff --git a/src/lang/fa_IR.lang.php b/src/lang/fa_IR.lang.php
index f50d0ae6..efea7b9f 100644
--- a/src/lang/fa_IR.lang.php
+++ b/src/lang/fa_IR.lang.php
@@ -201,14 +201,14 @@ $sm_lang = array(
'pushover_api_token' => 'رمز API برنامه پوش آور',
'pushover_api_token_description' => 'قبل از استفاده از پوش آور، شما باید در سایت آن ها یک برنامه ثبت نام کنید و رمز API برنامه پوش آور را اینجا وارد کنید.',
'alert_type' => 'زمان دلخواه خورد برای دریافت اطلاعیه ها را انتخاب کنید.',
- 'alert_type_description' => 'تغییر وضعیت: '.
- 'زمانی که وضعیت سرور تغییر کرد شما یک اطلاعیته دریافت خواهید کرد. از آنلاین -> آفلاین یا آفلاین -> آنلاین.
'.
- '
آفلاین: '.
- 'زمانی که یک سرور *فقط برای اولین بار* آفلاین شد شما یک اطلاعیه دریافت خواهید کرد. به عنوان مثال،'.
- 'cronjob شما هر 15 دقیقه است و سرور شما در ساعت 1 صبح دان می شود و تا ساعت 6 صبح دان می ماند.'.
- 'شما 1 اطلاعیه در ساعت 1 صبح دریافت خواهید کرد. همین و بس!'.
- '
همیشه: '.
- 'هر بار که اسکریپت اجرا شود و یک سایت دان شود شما یک اطلاعیه دریافت خواهید کرد، حتی اگر سایت چند ساعت آفلاین باشد.',
+ 'alert_type_description' => 'تغییر وضعیت: '.
+ 'زمانی که وضعیت سرور تغییر کرد شما یک اطلاعیته دریافت خواهید کرد. از آنلاین -> آفلاین یا آفلاین -> آنلاین.
'.
+ '
آفلاین: '.
+ 'زمانی که یک سرور *فقط برای اولین بار* آفلاین شد شما یک اطلاعیه دریافت خواهید کرد. به عنوان مثال،'.
+ 'cronjob شما هر 15 دقیقه است و سرور شما در ساعت 1 صبح دان می شود و تا ساعت 6 صبح دان می ماند.'.
+ 'شما 1 اطلاعیه در ساعت 1 صبح دریافت خواهید کرد. همین و بس!'.
+ '
همیشه: '.
+ 'هر بار که اسکریپت اجرا شود و یک سایت دان شود شما یک اطلاعیه دریافت خواهید کرد، حتی اگر سایت چند ساعت آفلاین باشد.',
'alert_type_status' => 'تغییر وضعیت',
'alert_type_offline' => 'آفلاین',
'alert_type_always' => 'همیشه',
diff --git a/src/lang/fi_FI.lang.php b/src/lang/fi_FI.lang.php
index ee7f5a74..f165280a 100644
--- a/src/lang/fi_FI.lang.php
+++ b/src/lang/fi_FI.lang.php
@@ -201,14 +201,14 @@ $sm_lang = array(
'pushover_api_token' => 'Pushover API-avain',
'pushover_api_token_description' => 'Ennen kuin voit käyttää Pushoveria, sinun täytyy rekisteröidä sovellus heidän nettisivuillaan, ja kopioida API-avain tänne.',
'alert_type' => 'Valitse milloin haluat ilmoituksia.',
- 'alert_type_description' => 'Tilan muutos: '.
- 'Saat ilmoituksen kun palvelimen tila vaihtuu. Eli tilasta päällä -> sammunut tai sammunut -> päällä.
'.
- '
Sammunut: '.
- 'Saat yhden ilmoituksen kun palvelimen tila vaihtuu sammuneeksi, mutta *VAIN ENSIMMÄISEN KERRAN*. Esimerkiksi, '.
- 'jos tarkistus tehdään joka 15 minuutti, ja palvelin sammuu klo 1 ja pysyy sammuneena klo 6 asti. '.
- 'Saat vain yhden ilmoituksen klo 1, ei muuta.
'.
- '
Aina: '.
- 'Saat ilmoituksen joka kerta kun palvelin tarkistetaan, vaikka palvelin olisi ollut sammuneena tunteja.',
+ 'alert_type_description' => 'Tilan muutos: '.
+ 'Saat ilmoituksen kun palvelimen tila vaihtuu. Eli tilasta päällä -> sammunut tai sammunut -> päällä.
'.
+ '
Sammunut: '.
+ 'Saat yhden ilmoituksen kun palvelimen tila vaihtuu sammuneeksi, mutta *VAIN ENSIMMÄISEN KERRAN*. Esimerkiksi, '.
+ 'jos tarkistus tehdään joka 15 minuutti, ja palvelin sammuu klo 1 ja pysyy sammuneena klo 6 asti. '.
+ 'Saat vain yhden ilmoituksen klo 1, ei muuta.
'.
+ '
Aina: '.
+ 'Saat ilmoituksen joka kerta kun palvelin tarkistetaan, vaikka palvelin olisi ollut sammuneena tunteja.',
'alert_type_status' => 'Tilan muutos',
'alert_type_offline' => 'Sammunut',
'alert_type_always' => 'Aina',
diff --git a/src/lang/it_IT.lang.php b/src/lang/it_IT.lang.php
index 387dafde..b4964c76 100644
--- a/src/lang/it_IT.lang.php
+++ b/src/lang/it_IT.lang.php
@@ -214,14 +214,14 @@ $sm_lang = array(
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Prima di poter usare Pushover, devi registrare un\'App nel loro sito web ed inserire la \'App API Token\' qui.',
'alert_type' => 'Seleziona quando vuoi essere notificato',
- 'alert_type_description' => 'Cambio di Stato: '.
- 'Riceverai una notifica solo quando un server cambierà stato. Quindi da online -> offline oppure da offline -> online.
'.
- '
Fuori linea: '.
- 'Riceverai una notifica solo quando un server andrà offline *SOLO LA PRIMA VOLTA*. Per esempio, '.
- 'Se il tuo cronjob è impostato per controllare ogni 15 min e il tuo server andrà offline dalle 2AM alle 6AM. '.
- 'Riceverai una sola notifica alle 2AM e nient\'altro.
'.
- '
Sempre: '.
- 'Riceverai una notifica ogni volta che lo script troverà un server down anche se è stato offline per ore.',
+ 'alert_type_description' => 'Cambio di Stato: '.
+ 'Riceverai una notifica solo quando un server cambierà stato. Quindi da online -> offline oppure da offline -> online.
'.
+ '
Fuori linea: '.
+ 'Riceverai una notifica solo quando un server andrà offline *SOLO LA PRIMA VOLTA*. Per esempio, '.
+ 'Se il tuo cronjob è impostato per controllare ogni 15 min e il tuo server andrà offline dalle 2AM alle 6AM. '.
+ 'Riceverai una sola notifica alle 2AM e nient\'altro.
'.
+ '
Sempre: '.
+ 'Riceverai una notifica ogni volta che lo script troverà un server down anche se è stato offline per ore.',
'alert_type_status' => 'Cambio di Stato',
'alert_type_offline' => 'Fuori linea',
'alert_type_always' => 'Sempre',
diff --git a/src/lang/ja_JP.lang.php b/src/lang/ja_JP.lang.php
index f368440d..d3b8877b 100644
--- a/src/lang/ja_JP.lang.php
+++ b/src/lang/ja_JP.lang.php
@@ -218,14 +218,14 @@ $sm_lang = array(
'pushover_api_token' => 'プッシュオーバーアプリケーションのAPIトークン',
'pushover_api_token_description' => 'プッシュオーバーを使用するには、事前にウェブサイトでアプリを登録してApp APIトークンを入力する必要があります。',
'alert_type' => '通知するタイミングを選択',
- 'alert_type_description' => '状態の変化: '.
- 'サーバーのステータスが変更されたときに通知を受け取ります。 だからオンライン -> オフラインまたはオフライン -> オンライン。
'.
- '
オフライン: '.
- 'サーバーが*初めての間*オフラインになったときに通知を受け取ります。 例えば、'.
- 'あなたのcronの仕事は15分ごとです。あなたのサーバーは午前1時にダウンし、午前6時まで停止します。 '.
- '午前1時に1つの通知が届きます。
'.
- '
常に: '.
- 'サイトが数時間にわたってオフラインになっていても、スクリプトが実行され、サイトが停止するたびに通知を受け取ります。',
+ 'alert_type_description' => '状態の変化: '.
+ 'サーバーのステータスが変更されたときに通知を受け取ります。 だからオンライン -> オフラインまたはオフライン -> オンライン。
'.
+ '
オフライン: '.
+ 'サーバーが*初めての間*オフラインになったときに通知を受け取ります。 例えば、'.
+ 'あなたのcronの仕事は15分ごとです。あなたのサーバーは午前1時にダウンし、午前6時まで停止します。 '.
+ '午前1時に1つの通知が届きます。
'.
+ '
常に: '.
+ 'サイトが数時間にわたってオフラインになっていても、スクリプトが実行され、サイトが停止するたびに通知を受け取ります。',
'alert_type_status' => '状況の変化',
'alert_type_offline' => 'オフライン',
'alert_type_always' => '常に',
diff --git a/src/lang/ko_KR.lang.php b/src/lang/ko_KR.lang.php
index 19adc2d5..3c6e9d2e 100644
--- a/src/lang/ko_KR.lang.php
+++ b/src/lang/ko_KR.lang.php
@@ -218,7 +218,7 @@ $sm_lang = array(
'서버 상태가 변경이되면 알림을 받습니다. online -> offline -> online.
'.
'
오프라인:
'.
'서버가 첫번째로 오프라인이 되었을 때 알림을 받습니다. 예를들어, '.
- 'cron이 매 15분이고 오전1시 부터 오전6시까지 다운되었을때 오전1시에 한번 알림을 받습니다.
' .
+ 'cron이 매 15분이고 오전1시 부터 오전6시까지 다운되었을때 오전1시에 한번 알림을 받습니다.
'.
'
항상:
'.
'사이트가 다운되었을 때 매시간 알림을 받습니다.',
diff --git a/src/lang/pl_PL.lang.php b/src/lang/pl_PL.lang.php
index 6fd7447c..18ac4d41 100644
--- a/src/lang/pl_PL.lang.php
+++ b/src/lang/pl_PL.lang.php
@@ -214,14 +214,14 @@ $sm_lang = array(
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Zanim zaczniesz używać Pushover, musisz zarejestrować aplikację na ich stronie internetowej i wpisać tutaj App API Token.',
'alert_type' => 'Wybierz kiedy chcesz być powiadomiony.',
- 'alert_type_description' => 'Zmiana statusu: '.
- 'Otrzymasz powiadomienie gdy serwer zmieni status. Z online -> offline lub offline -> online.
'.
- '
Offline: '.
- 'Otrzymasz powiadomienie gdy serwer zmieni status na offline po raz pierwszy. Na przykład, '.
- 'Twój cronjob uruchamia się co 15 minut, a Twój serwer przestaje odpowiadać o 13 i nie działa do 18. '.
- 'Otrzymasz *TYLKO* jedno powiadomienie o 13.
'.
- '
Zawsze: '.
- 'Otrzymasz powiadomienie za każdym razem gdy skrypt zostanie uruchomiony a strona będzie niedostępna.',
+ 'alert_type_description' => 'Zmiana statusu: '.
+ 'Otrzymasz powiadomienie gdy serwer zmieni status. Z online -> offline lub offline -> online.
'.
+ '
Offline: '.
+ 'Otrzymasz powiadomienie gdy serwer zmieni status na offline po raz pierwszy. Na przykład, '.
+ 'Twój cronjob uruchamia się co 15 minut, a Twój serwer przestaje odpowiadać o 13 i nie działa do 18. '.
+ 'Otrzymasz *TYLKO* jedno powiadomienie o 13.
'.
+ '
Zawsze: '.
+ 'Otrzymasz powiadomienie za każdym razem gdy skrypt zostanie uruchomiony a strona będzie niedostępna.',
'alert_type_status' => 'Zmiana statusu',
'alert_type_offline' => 'Offline',
'alert_type_always' => 'Zawsze',
diff --git a/src/lang/pt_BR.lang.php b/src/lang/pt_BR.lang.php
index 2d4a2e51..7efc41d5 100644
--- a/src/lang/pt_BR.lang.php
+++ b/src/lang/pt_BR.lang.php
@@ -30,21 +30,21 @@ $sm_lang = array(
'locale' => array('pt_BR.UTF-8', 'pt_BR', 'portuguese-brazilian'),
'locale_tag' => 'BR',
'locale_dir' => 'ltr',
- 'system' => array(
- 'title' => 'Server Monitor',
+ 'system' => array(
+ 'title' => 'Server Monitor',
'install' => 'Instalar',
- 'action' => 'Ação',
- 'save' => 'Salvar',
- 'edit' => 'Editar',
- 'delete' => 'Excluir',
- 'date' => 'Data',
- 'message' => 'Mensagem',
- 'yes' => 'Sim',
- 'no' => 'Não',
- 'insert' => 'Inserir',
- 'add_new' => 'Adicionar novo',
- 'update_available' => 'Uma atualização ({version}) disponível em http://www.phpservermonitor.org.',
- 'back_to_top' => 'Voltar ao topo',
+ 'action' => 'Ação',
+ 'save' => 'Salvar',
+ 'edit' => 'Editar',
+ 'delete' => 'Excluir',
+ 'date' => 'Data',
+ 'message' => 'Mensagem',
+ 'yes' => 'Sim',
+ 'no' => 'Não',
+ 'insert' => 'Inserir',
+ 'add_new' => 'Adicionar novo',
+ 'update_available' => 'Uma atualização ({version}) disponível em http://www.phpservermonitor.org.',
+ 'back_to_top' => 'Voltar ao topo',
'go_back' => 'Voltar',
'ok' => 'OK',
'cancel' => 'Cancel',
@@ -72,7 +72,7 @@ $sm_lang = array(
'minutes' => 'minutes',
'second' => 'second',
'seconds' => 'seconds',
- ),
+ ),
'menu' => array(
'config' => 'Configuração',
'server' => 'Servidores',
@@ -82,9 +82,9 @@ $sm_lang = array(
'user' => 'Usuários',
'help' => 'Ajuda',
),
- 'users' => array(
- 'user' => 'Usuário',
- 'name' => 'Nome',
+ 'users' => array(
+ 'user' => 'Usuário',
+ 'name' => 'Nome',
'user_name' => 'Username',
'password' => 'Senha',
'password_repeat' => 'Repetir senha',
@@ -93,8 +93,8 @@ $sm_lang = array(
'level_10' => 'Administrador',
'level_20' => 'Usuário',
'level_description' => 'Administradores Tem total acesso: podem gerenciar servidores, usuários e configurações globais.
Usuários só podem executar atualizações para servidores que lhe foram atribuídos.',
- 'mobile' => 'Celular',
- 'email' => 'Email',
+ 'mobile' => 'Celular',
+ 'email' => 'Email',
'pushover' => 'Pushover',
'pushover_description' => 'Pushover para enviar notificações em real-tome. Veja o website para mais informações.',
'pushover_key' => 'Pushover Key',
@@ -103,8 +103,8 @@ $sm_lang = array(
'delete_title' => 'Excluir Usuário',
'delete_message' => 'Tem certeza que deseja excluir o usuário \'%1\'?',
'deleted' => 'Usuário excluído.',
- 'updated' => 'Usuário atualizado.',
- 'inserted' => 'Usuário adicionado.',
+ 'updated' => 'Usuário atualizado.',
+ 'inserted' => 'Usuário adicionado.',
'profile' => 'Perfil',
'profile_updated' => 'Seu perfil foi atualizado.',
'error_user_name_bad_length' => 'Usernames deve conter entre 2 e 64 caracteres.',
@@ -116,49 +116,49 @@ $sm_lang = array(
'error_user_no_match' => 'O usuário não pode ser encontrado no banco de dados.',
'error_user_password_invalid' => 'A senha informada é inválida.',
'error_user_password_no_match' => 'A senha informada não combina.',
- ),
- 'log' => array(
- 'title' => 'Entradas do Log',
- 'type' => 'Tipo',
- 'status' => 'Status',
- 'email' => 'Email',
- 'sms' => 'SMS',
+ ),
+ 'log' => array(
+ 'title' => 'Entradas do Log',
+ 'type' => 'Tipo',
+ 'status' => 'Status',
+ 'email' => 'Email',
+ 'sms' => 'SMS',
'pushover' => 'Pushover',
'no_logs' => 'Sem logs',
'clear' => 'Log clara',
'delete_title' => 'Log clara',
'delete_message' => 'Tem certeza de que deseja excluir todos os logs?',
- ),
- 'servers' => array(
- 'server' => 'Servidor',
+ ),
+ 'servers' => array(
+ 'server' => 'Servidor',
'status' => 'Status',
- 'label' => 'Etiqueta',
- 'domain' => 'Domínio/IP',
+ 'label' => 'Etiqueta',
+ 'domain' => 'Domínio/IP',
'timeout' => 'Timeout',
'timeout_description' => 'Segundos para aguardar a resposta do servidor.',
- 'port' => 'Porta',
- 'type' => 'Tipo',
+ 'port' => 'Porta',
+ 'type' => 'Tipo',
'type_website' => 'Website',
'type_service' => 'Service',
'pattern' => 'Pesquisa palavra/padrão',
'pattern_description' => 'Se esse padrão não for encontrado no site, o servidor será marcado offline. As expressões regulares são permitidas.',
- 'last_check' => 'Última verificação',
- 'last_online' => 'Última vez online',
+ 'last_check' => 'Última verificação',
+ 'last_online' => 'Última vez online',
'last_offline' => 'Última vez offline',
- 'monitoring' => 'Monitoramento',
+ 'monitoring' => 'Monitoramento',
'no_monitoring' => 'Sem monitoring',
- 'email' => 'Email',
- 'send_email' => 'Enviar Email',
- 'sms' => 'SMS',
- 'send_sms' => 'Enviar SMS',
+ 'email' => 'Email',
+ 'send_email' => 'Enviar Email',
+ 'sms' => 'SMS',
+ 'send_sms' => 'Enviar SMS',
'pushover' => 'Pushover',
'users' => 'Usuários',
'delete_title' => 'Exluir Servidor',
'delete_message' => 'Tem certeza que deseja excluir o servidor \'%1\'?',
'deleted' => 'Servidor excluído.',
- 'updated' => 'Servidor atualizado.',
- 'inserted' => 'Servidor adicionar.',
- 'latency' => 'Tempo de resposta',
+ 'updated' => 'Servidor atualizado.',
+ 'inserted' => 'Servidor adicionar.',
+ 'latency' => 'Tempo de resposta',
'latency_max' => 'Latência (máxima)',
'latency_min' => 'Latência (minima)',
'latency_avg' => 'Latência (média)',
@@ -187,14 +187,14 @@ $sm_lang = array(
'error_server_ip_bad_website' => 'A URL não é válida.',
'error_server_type_invalid' => 'O tipo de servidor selecionado não é valido.',
'error_server_warning_threshold_invalid' => 'O limite de aviso deve ser um número inteiro maior que 0.',
- ),
- 'config' => array(
- 'general' => 'Geral',
- 'language' => 'Idioma',
- 'show_update' => 'verificar atualizações semanalmente?',
- 'email_status' => 'Habilitar envio de email?',
- 'email_from_email' => 'Endereço do envio de email',
- 'email_from_name' => 'Nome do envio de email',
+ ),
+ 'config' => array(
+ 'general' => 'Geral',
+ 'language' => 'Idioma',
+ 'show_update' => 'verificar atualizações semanalmente?',
+ 'email_status' => 'Habilitar envio de email?',
+ 'email_from_email' => 'Endereço do envio de email',
+ 'email_from_name' => 'Nome do envio de email',
'email_smtp' => 'Enable SMTP',
'email_smtp_host' => 'SMTP host',
'email_smtp_port' => 'SMTP port',
@@ -203,48 +203,48 @@ $sm_lang = array(
'email_smtp_username' => 'SMTP username',
'email_smtp_password' => 'SMTP password',
'email_smtp_noauth' => 'Deixe em branco para nenhuma autenticação',
- 'sms_status' => 'Habilitar o envio de mensagem de texto?',
- 'sms_gateway' => 'Gateway para o uso de envio de mensagens',
- 'sms_gateway_username' => 'Usuário do Gateway',
- 'sms_gateway_password' => 'Senha do Gateway',
- 'sms_from' => 'Número de telefone de envio',
+ 'sms_status' => 'Habilitar o envio de mensagem de texto?',
+ 'sms_gateway' => 'Gateway para o uso de envio de mensagens',
+ 'sms_gateway_username' => 'Usuário do Gateway',
+ 'sms_gateway_password' => 'Senha do Gateway',
+ 'sms_from' => 'Número de telefone de envio',
'pushover_status' => 'Habilitar envio de mensagens Pushover',
'pushover_description' => 'Pushover é um serviço de notificações em tempo real. Veja o website para mais informações.',
'pushover_clone_app' => 'Clique aqui para criar sua app Pushover',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API Token here.',
- 'alert_type' => 'Selecione como você gostaria de ser notificado.',
- 'alert_type_description' => 'Mudança de Status: '.
- 'Você receberá uma notificação quando o seridor tive uma mudança de status. De online -> offline ou offline -> online.
'.
- '
Offline: '.
- 'Você receberá uma notificação quando o servidor fica OFFLINE (Pela primeira vez). Por exemplo, '.
- 'A cronjob é a cada 15 minutos e seu servidor caiu em 1:00 e permanece offline até 6 am. '.
- 'Você receberá uma notificação a 1:00 apenas
'.
- '
Sempre: '.
- 'Você receberá uma notificação toda vez que o script é executado e um site esta offline, mesmo se o site tenha ficado offline por horas.',
- 'alert_type_status' => 'Mudança de Status',
- 'alert_type_offline' => 'Offline',
- 'alert_type_always' => 'Sempre',
- 'log_status' => 'Log status',
- 'log_status_description' => 'Se o status de registro é definido como TRUE, o monitor irá registrar o evento sempre que as configurações de notificação forem passadas.',
- 'log_email' => 'Registrar no Log os envios de email feitos pelo script?',
- 'log_sms' => 'Registrar no Log os envios de mensagens de texto feitos pelo script?',
+ 'alert_type' => 'Selecione como você gostaria de ser notificado.',
+ 'alert_type_description' => 'Mudança de Status: '.
+ 'Você receberá uma notificação quando o seridor tive uma mudança de status. De online -> offline ou offline -> online.
'.
+ '
Offline: '.
+ 'Você receberá uma notificação quando o servidor fica OFFLINE (Pela primeira vez). Por exemplo, '.
+ 'A cronjob é a cada 15 minutos e seu servidor caiu em 1:00 e permanece offline até 6 am. '.
+ 'Você receberá uma notificação a 1:00 apenas
'.
+ '
Sempre: '.
+ 'Você receberá uma notificação toda vez que o script é executado e um site esta offline, mesmo se o site tenha ficado offline por horas.',
+ 'alert_type_status' => 'Mudança de Status',
+ 'alert_type_offline' => 'Offline',
+ 'alert_type_always' => 'Sempre',
+ 'log_status' => 'Log status',
+ 'log_status_description' => 'Se o status de registro é definido como TRUE, o monitor irá registrar o evento sempre que as configurações de notificação forem passadas.',
+ 'log_email' => 'Registrar no Log os envios de email feitos pelo script?',
+ 'log_sms' => 'Registrar no Log os envios de mensagens de texto feitos pelo script?',
'log_pushover' => 'Log pushover messages sent by the script',
- 'updated' => 'A configuração foi atualizada.',
- 'tab_email' => 'Email',
- 'tab_sms' => 'Texto',
+ 'updated' => 'A configuração foi atualizada.',
+ 'tab_email' => 'Email',
+ 'tab_sms' => 'Texto',
'tab_pushover' => 'Pushover',
- 'settings_email' => 'Configuração de email',
- 'settings_sms' => 'Configuração de mensagens de texto',
+ 'settings_email' => 'Configuração de email',
+ 'settings_sms' => 'Configuração de mensagens de texto',
'settings_pushover' => 'Pushover settings',
- 'settings_notification' => 'Configuração de notificações',
- 'settings_log' => 'Configuração de Logs',
- 'auto_refresh' => 'Atualizar automaticamente',
- 'auto_refresh_servers' =>
- 'Atualizar automaticamente a página de servidores.
'.
- ''.
- 'Tempo em segundos, Se 0 a página não será atualizada.'.
- '',
+ 'settings_notification' => 'Configuração de notificações',
+ 'settings_log' => 'Configuração de Logs',
+ 'auto_refresh' => 'Atualizar automaticamente',
+ 'auto_refresh_servers' =>
+ 'Atualizar automaticamente a página de servidores.
'.
+ ''.
+ 'Tempo em segundos, Se 0 a página não será atualizada.'.
+ '',
'seconds' => 'segundos',
'test' => 'Teste',
'test_email' => 'Um e-mail será enviado para o endereço especificado em seu perfil de usuário.',
@@ -265,20 +265,20 @@ $sm_lang = array(
'log_retention_period' => 'Período de retenção do Log',
'log_retention_period_description' => 'Número de dias para manter os registros de notificações e arquivos de tempo de atividade do servidor. Digite 0 para desativar a limpeza de registro.',
'log_retention_days' => 'dias',
- ),
- // for newlines in the email messages use
- 'notifications' => array(
- 'off_sms' => 'Servidor \'%LABEL%\' está OFFLINE: ip=%IP%, porta=%PORT%. Erro=%ERROR%',
- 'off_email_subject' => 'IMPORTANTE: Servidor \'%LABEL%\' está OFFLINE',
- 'off_email_body' => "Falha ao conectar ao servidor:
Servidor: %LABEL%
IP: %IP%
Porta: %PORT%
Erro: %ERROR%
Data: %DATE%",
- 'off_pushover_title' => 'Servidor \'%LABEL%\' está OFFLINE',
- 'off_pushover_message' => "Falha ao conectar ao servidor:
Servidor: %LABEL%
IP: %IP%
Porta: %PORT%
Erro: %ERROR%
Data: %DATE%",
- 'on_sms' => 'Servidor \'%LABEL%\' esta ONLINE: ip=%IP%, porta=%PORT%',
- 'on_email_subject' => 'IMPORTANTE: Servidor \'%LABEL%\' esta ONLINE',
- 'on_email_body' => "Servidor '%LABEL%' esta ONLINE novamente:
Servidor: %LABEL%
IP: %IP%
Porta: %PORT%
Data: %DATE%",
- 'on_pushover_title' => 'Servidor \'%LABEL%\' esta ONLINE',
- 'on_pushover_message' => "Servidor '%LABEL%' esta ONLINE novamente:
Servidor: %LABEL%
IP: %IP%
Porta: %PORT%
Data: %DATE%",
- ),
+ ),
+ // for newlines in the email messages use
+ 'notifications' => array(
+ 'off_sms' => 'Servidor \'%LABEL%\' está OFFLINE: ip=%IP%, porta=%PORT%. Erro=%ERROR%',
+ 'off_email_subject' => 'IMPORTANTE: Servidor \'%LABEL%\' está OFFLINE',
+ 'off_email_body' => "Falha ao conectar ao servidor:
Servidor: %LABEL%
IP: %IP%
Porta: %PORT%
Erro: %ERROR%
Data: %DATE%",
+ 'off_pushover_title' => 'Servidor \'%LABEL%\' está OFFLINE',
+ 'off_pushover_message' => "Falha ao conectar ao servidor:
Servidor: %LABEL%
IP: %IP%
Porta: %PORT%
Erro: %ERROR%
Data: %DATE%",
+ 'on_sms' => 'Servidor \'%LABEL%\' esta ONLINE: ip=%IP%, porta=%PORT%',
+ 'on_email_subject' => 'IMPORTANTE: Servidor \'%LABEL%\' esta ONLINE',
+ 'on_email_body' => "Servidor '%LABEL%' esta ONLINE novamente:
Servidor: %LABEL%
IP: %IP%
Porta: %PORT%
Data: %DATE%",
+ 'on_pushover_title' => 'Servidor \'%LABEL%\' esta ONLINE',
+ 'on_pushover_message' => "Servidor '%LABEL%' esta ONLINE novamente:
Servidor: %LABEL%
IP: %IP%
Porta: %PORT%
Data: %DATE%",
+ ),
'login' => array(
'welcome_usermenu' => 'Bem vindo, %user_name%',
'title_sign_in' => 'Por favor efetue login',
diff --git a/src/lang/ru_RU.lang.php b/src/lang/ru_RU.lang.php
index bb271c68..09dda367 100644
--- a/src/lang/ru_RU.lang.php
+++ b/src/lang/ru_RU.lang.php
@@ -214,14 +214,14 @@ $sm_lang = array(
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Прежде чем вы сможете начать пользоваться Pushover, вам необходимо зарегестрировать "App" на их веб-сайте и ввести "App API Token" сюда.',
'alert_type' => 'Выбeрите, какие вы хотите получать уведомления',
- 'alert_type_description' => 'Изменение статуса : '.
- 'Вы получите уведомление об изменение статуса. Для онлайн -> оффлайн или офлайн -> онлайн.
'.
- '
Оффлайн: '.
- 'Вы получите уведомление только когда сервер перейдет в статус оффлайн. Например, '.
- 'Задание Cron выставлено на каждые 15 минут. Сервер перейдет в статус оффлайн в 1:00 и не измениться до 6:00. '.
- 'Вы получите 1 уведомление только в 1:00
'.
- '
Всегда: '.
- 'Вы будете получать уведомление при каждом запуске скрипта проверки, как только сервер перейдет в статус оффлайн, даже если сервер находится в этом статусе несколько часов',
+ 'alert_type_description' => 'Изменение статуса : '.
+ 'Вы получите уведомление об изменение статуса. Для онлайн -> оффлайн или офлайн -> онлайн.
'.
+ '
Оффлайн: '.
+ 'Вы получите уведомление только когда сервер перейдет в статус оффлайн. Например, '.
+ 'Задание Cron выставлено на каждые 15 минут. Сервер перейдет в статус оффлайн в 1:00 и не измениться до 6:00. '.
+ 'Вы получите 1 уведомление только в 1:00
'.
+ '
Всегда: '.
+ 'Вы будете получать уведомление при каждом запуске скрипта проверки, как только сервер перейдет в статус оффлайн, даже если сервер находится в этом статусе несколько часов',
'alert_type_status' => 'Изменение статуса',
'alert_type_offline' => 'Оффлайн',
'alert_type_always' => 'Всегда',
diff --git a/src/lang/sk_SK.lang.php b/src/lang/sk_SK.lang.php
index 59c14a65..e3154273 100644
--- a/src/lang/sk_SK.lang.php
+++ b/src/lang/sk_SK.lang.php
@@ -213,14 +213,14 @@ $sm_lang = array(
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Pred použitím Pushoveru sa musíte registrovať a získať API Token.',
'alert_type' => 'Zvoľte kedy si prajete byť upozornení.',
- 'alert_type_description' => 'Zmena stavu: '.
- 'Obdržíte upozornenie pri zmene stavu, teda: online -> offline alebo offline -> online.
'.
- '
Offline: '.
- 'Obdržíte upozornenie, keď server prejde *PO PRVÝ KRÁT* do offline stavu. Napríklad, '.
- 'pokiaľ je cron nastavený na 15 minút a sledovaný server bude offline mezi 01:00 a 06:00, '.
- 'tak obdržíte upozornenie iba o 01:00.
'.
- '
Vždy: '.
- 'Obdržíte upozornenie pri každom spustení kontroly, teda aj pokiaľ bude server offline niekoľko hodín.',
+ 'alert_type_description' => 'Zmena stavu: '.
+ 'Obdržíte upozornenie pri zmene stavu, teda: online -> offline alebo offline -> online.
'.
+ '
Offline: '.
+ 'Obdržíte upozornenie, keď server prejde *PO PRVÝ KRÁT* do offline stavu. Napríklad, '.
+ 'pokiaľ je cron nastavený na 15 minút a sledovaný server bude offline mezi 01:00 a 06:00, '.
+ 'tak obdržíte upozornenie iba o 01:00.
'.
+ '
Vždy: '.
+ 'Obdržíte upozornenie pri každom spustení kontroly, teda aj pokiaľ bude server offline niekoľko hodín.',
'alert_type_status' => 'Zmena stavu',
'alert_type_offline' => 'Offline',
'alert_type_always' => 'Vždy',
diff --git a/src/lang/sl_SI.lang.php b/src/lang/sl_SI.lang.php
index ec753c41..565dc6cb 100644
--- a/src/lang/sl_SI.lang.php
+++ b/src/lang/sl_SI.lang.php
@@ -26,269 +26,269 @@
**/
$sm_lang = array(
- 'name' => 'Slovenščina - Slovenian',
- 'locale' => array('sl_SI.UTF-8', 'sl_SI', 'slovenščina', 'slovenščina'),
- 'system' => array(
- 'title' => 'Server Monitor',
- 'install' => 'Install',
- 'action' => 'Action',
- 'save' => 'Shrani',
- 'edit' => 'Uredi',
- 'delete' => 'Izbriši',
- 'date' => 'Datum',
- 'message' => 'Sporočilo',
- 'yes' => 'da',
- 'no' => 'ne',
- 'insert' => 'Vstavi',
- 'add_new' => 'Dodaj novega',
- 'update_available' => 'Na voljo je nova različica ({version}); prenesti jo je mogoče iz http://www.phpservermonitor.org.',
- 'back_to_top' => 'Nazaj na vrh',
- 'go_back' => 'Nazaj',
- 'ok' => 'OK',
- 'cancel' => 'Prekini',
- // 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' => 'včeraj ob %k:%M',
- 'other_day_format' => '%A at %k:%M',
- 'never' => 'nikoli',
- 'hours_ago' => 'pred %d urami',
- 'an_hour_ago' => 'pred približno uro',
- 'minutes_ago' => 'pred %d minutami',
- 'a_minute_ago' => 'pred približno minuto',
- 'seconds_ago' => 'pred %d sekundami',
- 'a_second_ago' => 'pred sekundo',
- ),
- 'menu' => array(
- 'config' => 'Nastavitve',
- 'server' => 'Strežniki',
- 'server_log' => 'Dnevnik',
- 'server_status' => 'Status',
- 'server_update' => 'Posodobitev statusa',
- 'user' => 'Uporabniki',
- 'help' => 'Pomoč',
- ),
- 'users' => array(
- 'user' => 'Uporabnik',
- 'name' => 'Ime',
- 'user_name' => 'Uporabniško ime',
- 'password' => 'Geslo',
- 'password_repeat' => 'Geslo (ponovno)',
- 'password_leave_blank' => 'Če ne želite spremeniti pustite prazno',
- 'level' => 'Nivo dostopa',
- 'level_10' => 'Administrator',
- 'level_20' => 'Uporabnik',
- 'level_description' => 'Administratorji imajo poln dostop: lahko upravljajo strežnike, uporabnike in urejajo globalne nastavitve.
Uporabniki lahko samo vidijo status in poganjajo posodobitev statusa za strežnike, ki so jim bili dodeljeni.',
- 'mobile' => 'Mobilni telefon',
- 'email' => 'E-pošta',
- 'pushover' => 'Pushover',
- 'pushover_description' => 'Pushover je storitev, ki omogoča enostavno prejemanje obvestil v realnem času. Več informacij je na voljo na njihovi spletni strani.',
- 'pushover_key' => 'Pushover ključ',
- 'pushover_device' => 'Pushover naprava',
- 'pushover_device_description' => 'Ime naprave na katero naj se pošlje obvestilo. Če želite obvestilo poslati na vse naprave, pustite prazno.',
- 'delete_title' => 'Izbriši uporabnika',
- 'delete_message' => 'Ste prepričani, da želite izbrisati uporabnika \'%1\'?',
- 'deleted' => 'Uporabnik izbrisan.',
- 'updated' => 'Podatki uporabnika posodobljeni.',
- 'inserted' => 'Uporabnik dodan.',
- 'profile' => 'Profil',
- 'profile_updated' => 'Vaš profil je bil posodobljen.',
- 'error_user_name_bad_length' => 'Uporabniško ime mora biti dolgo med 2 in 64 znakov.',
- 'error_user_name_invalid' => 'Uporabniško ime lahko vsebuje samo črke (a-z, A-Z), številke (0-9), pike (.) in podčrtaje (_).',
- 'error_user_name_exists' => 'Uporabniško ime v bazi podatkov že obstaja.',
- 'error_user_email_bad_length' => 'E-naslov mora biti med 5 in 255 znaki.',
- 'error_user_email_invalid' => 'E-naslov ni veljaven.',
- 'error_user_level_invalid' => 'Izbrani nivo dostopa za uporabnika ni veljaven.',
- 'error_user_no_match' => 'Uporabnika ne najdem v bazi podatkov.',
- 'error_user_password_invalid' => 'Vneseno geslo ni veljavno.',
- 'error_user_password_no_match' => 'Gesli se ne ujemata.',
- ),
- 'log' => array(
- 'title' => 'Dnevniški zapisi',
- 'type' => 'Tip',
- 'status' => 'Status',
- 'email' => 'E-pošta',
- 'sms' => 'SMS',
- 'pushover' => 'Pushover',
- 'no_logs' => 'ni dnevniških zapisov',
- 'clear' => 'Počisti dnevnik',
- 'delete_title' => 'Brisanje dnevnika',
- 'delete_message' => 'Ali ste prepričani, da želite izbrisati vse dnevnike?',
- ),
- 'servers' => array(
- 'server' => 'Strežnik',
- 'status' => 'Status',
- 'label' => 'Ime',
- 'domain' => 'Domena / IP naslov',
- 'timeout' => 'Časovna omejitev',
- 'timeout_description' => 'Koliko sekund naj čakam na odgovor strežnika.',
- 'port' => 'Vrata',
- 'type' => 'Tip',
- 'type_website' => 'Spletna stran (website)',
- 'type_service' => 'Storitev (service)',
- 'pattern' => 'Iskani niz oz. vzorec',
- 'pattern_description' => 'Če ta vzorec ne bo najden na spletni strani, bo strežnik označen kot nedelujoč. Dovoljeni so regularni izrazi.',
- 'last_check' => 'Zadnje preverjanje',
- 'last_online' => 'Nazadnje dostopen',
- 'monitoring' => 'Spremljanje',
- 'no_monitoring' => 'Se ne spremlja',
- 'email' => 'E-pošta',
- 'send_email' => 'Pošlji e-pošto',
- 'sms' => 'SMS',
- 'send_sms' => 'Pošlji SMS',
- 'pushover' => 'Pushover',
- 'users' => 'Uporabniki',
- 'delete_title' => 'Izbriši strežnik',
- 'delete_message' => 'Ste prepričani, da želite izbrisati strežnik \'%1\'?',
- 'deleted' => 'Strežnik izbrisan.',
- 'updated' => 'Podatki o strežniku posodobljeni.',
- 'inserted' => 'Strežnik dodan.',
- 'latency' => 'Zakasnitev',
- 'latency_max' => 'Zakasnitev (največja)',
- 'latency_min' => 'Zakasnitev (najmanjša)',
- 'latency_avg' => 'Zakasnitev (povprečna)',
- 'uptime' => 'Neprekinjeno delovanje',
- 'year' => 'leto',
- 'month' => 'mesec',
- 'week' => 'teden',
- 'day' => 'dan',
- 'hour' => 'ura',
- 'warning_threshold' => 'Prag za opozorilo',
- 'warning_threshold_description' => 'Število neuspešnih preverjanj preden je strežnik označen kot nedelujoč.',
- 'chart_last_week' => 'prejšnji teden',
- 'chart_history' => 'Zgodovina',
- // Charts date format according jqPlot date format http://www.jqplot.com/docs/files/plugins/jqplot-dateAxisRenderer-js.html
- 'chart_day_format' => '%m. %d. %Y',
- 'chart_long_date_format' => '%m. %d. %Y %H:%M:%S',
- 'chart_short_date_format' => '%m/%d %H:%M',
- 'chart_short_time_format' => '%H:%M',
- 'warning_notifications_disabled_sms' => 'SMS obvestila so onemogočena.',
- 'warning_notifications_disabled_email' => 'Obvestila po e-pošti so onemogočena.',
- 'warning_notifications_disabled_pushover' => 'Pushover obvestila so onemogočena.',
- 'error_server_no_match' => 'Strežnik ni najden.',
- 'error_server_label_bad_length' => 'Ime mora biti med 1 in 255 znaki.',
- 'error_server_ip_bad_length' => 'Domena / IP naslov mora biti med 1 in 255 znaki.',
- 'error_server_ip_bad_service' => 'IP naslov ni veljaven.',
- 'error_server_ip_bad_website' => 'URL naslov spletne strani ni veljaven.',
- 'error_server_type_invalid' => 'Izbrani tip strežnika ni veljaven.',
- 'error_server_warning_threshold_invalid' => 'Prag za opozorilo mora biti število večje od 0.',
- ),
- 'config' => array(
- 'general' => 'Splošno',
- 'language' => 'Jezik',
- 'show_update' => 'Preverim za posodobitve?',
- 'email_status' => 'Dovolim pošiljanje e-pošte',
- 'email_from_email' => 'E-poštni naslov pošiljatelja',
- 'email_from_name' => 'Ime pošiljatelja',
- 'email_smtp' => 'Enable SMTP',
- 'email_smtp_host' => 'SMTP strežnik',
- 'email_smtp_port' => 'SMTP vrata',
- 'email_smtp_security' => 'SMTP varnost',
- 'email_smtp_security_none' => 'brez',
- 'email_smtp_username' => 'SMTP uporabniško ime',
- 'email_smtp_password' => 'SMTP geslo',
- 'email_smtp_noauth' => 'Če ni potrebna overovitev, pustite prazno',
- 'sms_status' => 'Dovolim pošiljanje SMS sporočil?',
- 'sms_gateway' => 'Prehod za pošiljanje SMS sporočil',
- 'sms_gateway_username' => 'Uporabniško ime SMS prehoda',
- 'sms_gateway_password' => 'Geslo SMS prehoda',
- 'sms_from' => 'Telefonska številka pošiljatelja',
- 'pushover_status' => 'Dovolim pošiljanje Pushover sporočil',
- 'pushover_description' => 'Pushover je storitev, ki omogoča enostavno prejemanje obvestil v realnem času. Več informacij je na voljo na njihovi spletni strani.',
- 'pushover_clone_app' => 'Kliknite za ustvarjanje vaše Pushover aplikacije',
- 'pushover_api_token' => 'Pushover API žeton',
- 'pushover_api_token_description' => 'Pred uporabo storitve Pushover, morate na njihovi spletni strani registrirati aplikacijo, tukaj pa vnesti API žeton.',
- 'alert_type' => 'Izberite kdaj naj se vam pošljejo obvestila.',
- 'alert_type_description' => 'Sprememba statusa: ' .
- 'Obvestilo boste dobili ob vsaki spremembi statusa, torej iz delujoč -> nedelujoč ter nedelujoč -> delujoč.
' .
- '
Nedelujoč: ' .
- 'Obvestilo boste dobili samo, ko se bo strežnik PRVIKRAT prenehal odzivati. Na primer:' .
- 'nastavljeno imate preverjanje strežnikov vsakih 15 minut. Strežnik preneha delovati ob 13h in ostane nedelujoč do 18h. ' .
- 'Dobili boste obvestilo samo ob 13h.
' .
- '
Vedno: ' .
- 'Obvestilo boste dobili vedno, ko se izvede skripta za preverjanje in strežnik ne deluje, pa čeprav bo strežnik nedelujoč več ur.',
- 'alert_type_status' => 'Sprememba statusa',
- 'alert_type_offline' => 'Nedelujoč',
- 'alert_type_always' => 'Vedno',
- 'log_status' => 'Beleženje statusa',
- 'log_status_description' => 'Če je beleženje statusa vključeno, se bodo beležili vsi dogodki povezani s pošiljanjem obvestil.',
- 'log_email' => 'Beleži e-pošto, ki jo pošilja aplikacija',
- 'log_sms' => 'Beleži SMS sporočila, ki jih pošilja aplikacija',
- 'log_pushover' => 'Beleži Pushover sporočila, ki jih pošilja aplikacija',
- 'updated' => 'Nastavitve so bile posodobljene.',
- 'tab_email' => 'E-pošta',
- 'tab_sms' => 'SMS',
- 'tab_pushover' => 'Pushover',
- 'settings_email' => 'Nastavitve e-pošte',
- 'settings_sms' => 'Nastavitve SMS sporočil',
- 'settings_pushover' => 'Nastavitve Pushover sporočil',
- 'settings_notification' => 'Nastavitve obvestil',
- 'settings_log' => 'Hramba dnevniških zapisov',
- 'auto_refresh' => 'Samodejno posodabljanje',
- 'auto_refresh_servers' =>
- 'Samodejno posodabljanje pregleda statusa strežnikov.
' .
- '' .
- 'Čas v sekundah. Če je vrednost 0 se stran ne bo samodejno posodabljala.' .
- '',
- 'seconds' => 'sekund',
- 'test' => 'Test',
- 'test_email' => 'Na naslov, ki ste ga določili v vašem profilu, bo poslano e-sporočilo.',
- 'test_sms' => 'Na telefonsko številko, ki ste jo določili v vašem profilu, bo poslan SMS.',
- 'test_pushover' => 'Na uporabniški ključ/napravo, ki ste ju določili v vašem profilu, bo poslano Pushover sporočilo.',
- 'send' => 'Pošlji',
- 'test_subject' => 'Test',
- 'test_message' => 'Testno sporočilo',
- 'email_sent' => 'E-pošta poslana',
- 'email_error' => 'Napaka pri pošiljanju e-pošte',
- 'sms_sent' => 'SMS sporočilo poslano',
- 'sms_error' => 'Napaka pri pošiljanju SMS sporočila. %s',
- 'sms_error_nomobile' => 'Ni mogoče poslati testnega SMS sporočila: v vašem profilu ni vpisana veljavna telefonska številka.',
- 'pushover_sent' => 'Pushover obvestilo poslano',
- 'pushover_error' => 'Napaka pri pošiljanju Pushover sporočila: %s',
- 'pushover_error_noapp' => 'Ni mogoče poslati testnega sporočila: med globalnimi nastavitvami ne najdem Pushover API žetona.',
- 'pushover_error_nokey' => 'Ni mogoče poslati testnega sporočila: med vašimi nastavitvami ne najdem Pushover ključa.',
- 'log_retention_period' => 'Čas hrambe podatov',
- 'log_retention_period_description' => 'Število dni, ko naj se hranijo podatki o obvestilih in statusu strežnikov. Če želite podatke hraniti trajno, vnesite 0.',
- 'log_retention_days' => 'dni',
- ),
- // for newlines in the email messages use
- 'notifications' => array(
- 'off_sms' => 'Streznik \'%LABEL%\' NE deluje: IP=%IP%, vrata=%PORT%. Napaka=%ERROR%',
- 'off_email_subject' => 'POMEMBNO: Strežnik \'%LABEL%\' NE deluje',
- 'off_email_body' => "Pri povezovanju na streznik je prislo do napake:
Streznik: %LABEL%
IP: %IP%
vrata: %PORT%
Napaka: %ERROR%
Datum: %DATE%",
- 'off_pushover_title' => 'Streznik \'%LABEL%\' NE deluje',
- 'off_pushover_message' => "Ni se mogoče povezati na naslednji streznik:
Streznik: %LABEL%
IP: %IP%
Vrata: %PORT%
Error: %ERROR%
Datum: %DATE%",
- 'on_sms' => 'Streznik \'%LABEL%\' deluje: IP=%IP%, vrata=%PORT%',
- 'on_email_subject' => 'OBVESTILO: Streznik \'%LABEL%\' ponovno deluje',
- 'on_email_body' => "Streznik '%LABEL%' ponovno deluje:
Strežnik: %LABEL%
IP: %IP%
Vrata: %PORT%
Datum: %DATE%",
- 'on_pushover_title' => 'Streznik \'%LABEL%\' deluje',
- 'on_pushover_message' => 'Streznik \'%LABEL%\' ponovno deluje:
Server: %LABEL%
IP: %IP%
Vrata: %PORT%
Datum: %DATE%',
- ),
- 'login' => array(
- 'welcome_usermenu' => 'Pozdravljeni, %user_name%',
- 'title_sign_in' => 'Prosimo, prijavite se',
- 'title_forgot' => 'Ali ste pozabili geslo?',
- 'title_reset' => 'Ponastavitev gesla',
- 'submit' => 'Pošlji',
- 'remember_me' => 'Zapomni si me',
- 'login' => 'Prijava',
- 'logout' => 'Odjava',
- 'username' => 'Uporabniško ime',
- 'password' => 'Geslo',
- 'password_repeat' => 'Geslo (ponovno)',
- 'password_forgot' => 'Pozabljeno geslo?',
- 'password_reset' => 'Ponastavitev gesla',
- 'password_reset_email_subject' => 'Ponastavite svoje geslo za PHP Server Monitor',
- 'password_reset_email_body' => 'Za ponastavitev gesla uporabite spodnjo povezavo. Pomembno: povezava poteče v 1 uri.
%link%',
- 'error_user_incorrect' => 'Vpisanega uporabniškega imena ne najdem.',
- 'error_login_incorrect' => 'Podatki so napačni.',
- 'error_login_passwords_nomatch' => 'Vneseno geslo ni pravilno.',
- 'error_reset_invalid_link' => 'Povezava za ponastavitev gesla, ki ste jo vnesli, ni pravilna.',
- 'success_password_forgot' => 'Poslano vam je bilo sporočilo z navodili za ponastavitev vašega gesla.',
- 'success_password_reset' => 'Vaše geslo je bilo uspešno ponastavljeno. Prijavite se prosim.',
- ),
- 'error' => array(
- '401_unauthorized' => 'Nepooblaščen dostop',
- '401_unauthorized_description' => 'Nimate dovoljenja za ogled te strani.',
- ),
+ 'name' => 'Slovenščina - Slovenian',
+ 'locale' => array('sl_SI.UTF-8', 'sl_SI', 'slovenščina', 'slovenščina'),
+ 'system' => array(
+ 'title' => 'Server Monitor',
+ 'install' => 'Install',
+ 'action' => 'Action',
+ 'save' => 'Shrani',
+ 'edit' => 'Uredi',
+ 'delete' => 'Izbriši',
+ 'date' => 'Datum',
+ 'message' => 'Sporočilo',
+ 'yes' => 'da',
+ 'no' => 'ne',
+ 'insert' => 'Vstavi',
+ 'add_new' => 'Dodaj novega',
+ 'update_available' => 'Na voljo je nova različica ({version}); prenesti jo je mogoče iz http://www.phpservermonitor.org.',
+ 'back_to_top' => 'Nazaj na vrh',
+ 'go_back' => 'Nazaj',
+ 'ok' => 'OK',
+ 'cancel' => 'Prekini',
+ // 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' => 'včeraj ob %k:%M',
+ 'other_day_format' => '%A at %k:%M',
+ 'never' => 'nikoli',
+ 'hours_ago' => 'pred %d urami',
+ 'an_hour_ago' => 'pred približno uro',
+ 'minutes_ago' => 'pred %d minutami',
+ 'a_minute_ago' => 'pred približno minuto',
+ 'seconds_ago' => 'pred %d sekundami',
+ 'a_second_ago' => 'pred sekundo',
+ ),
+ 'menu' => array(
+ 'config' => 'Nastavitve',
+ 'server' => 'Strežniki',
+ 'server_log' => 'Dnevnik',
+ 'server_status' => 'Status',
+ 'server_update' => 'Posodobitev statusa',
+ 'user' => 'Uporabniki',
+ 'help' => 'Pomoč',
+ ),
+ 'users' => array(
+ 'user' => 'Uporabnik',
+ 'name' => 'Ime',
+ 'user_name' => 'Uporabniško ime',
+ 'password' => 'Geslo',
+ 'password_repeat' => 'Geslo (ponovno)',
+ 'password_leave_blank' => 'Če ne želite spremeniti pustite prazno',
+ 'level' => 'Nivo dostopa',
+ 'level_10' => 'Administrator',
+ 'level_20' => 'Uporabnik',
+ 'level_description' => 'Administratorji imajo poln dostop: lahko upravljajo strežnike, uporabnike in urejajo globalne nastavitve.
Uporabniki lahko samo vidijo status in poganjajo posodobitev statusa za strežnike, ki so jim bili dodeljeni.',
+ 'mobile' => 'Mobilni telefon',
+ 'email' => 'E-pošta',
+ 'pushover' => 'Pushover',
+ 'pushover_description' => 'Pushover je storitev, ki omogoča enostavno prejemanje obvestil v realnem času. Več informacij je na voljo na njihovi spletni strani.',
+ 'pushover_key' => 'Pushover ključ',
+ 'pushover_device' => 'Pushover naprava',
+ 'pushover_device_description' => 'Ime naprave na katero naj se pošlje obvestilo. Če želite obvestilo poslati na vse naprave, pustite prazno.',
+ 'delete_title' => 'Izbriši uporabnika',
+ 'delete_message' => 'Ste prepričani, da želite izbrisati uporabnika \'%1\'?',
+ 'deleted' => 'Uporabnik izbrisan.',
+ 'updated' => 'Podatki uporabnika posodobljeni.',
+ 'inserted' => 'Uporabnik dodan.',
+ 'profile' => 'Profil',
+ 'profile_updated' => 'Vaš profil je bil posodobljen.',
+ 'error_user_name_bad_length' => 'Uporabniško ime mora biti dolgo med 2 in 64 znakov.',
+ 'error_user_name_invalid' => 'Uporabniško ime lahko vsebuje samo črke (a-z, A-Z), številke (0-9), pike (.) in podčrtaje (_).',
+ 'error_user_name_exists' => 'Uporabniško ime v bazi podatkov že obstaja.',
+ 'error_user_email_bad_length' => 'E-naslov mora biti med 5 in 255 znaki.',
+ 'error_user_email_invalid' => 'E-naslov ni veljaven.',
+ 'error_user_level_invalid' => 'Izbrani nivo dostopa za uporabnika ni veljaven.',
+ 'error_user_no_match' => 'Uporabnika ne najdem v bazi podatkov.',
+ 'error_user_password_invalid' => 'Vneseno geslo ni veljavno.',
+ 'error_user_password_no_match' => 'Gesli se ne ujemata.',
+ ),
+ 'log' => array(
+ 'title' => 'Dnevniški zapisi',
+ 'type' => 'Tip',
+ 'status' => 'Status',
+ 'email' => 'E-pošta',
+ 'sms' => 'SMS',
+ 'pushover' => 'Pushover',
+ 'no_logs' => 'ni dnevniških zapisov',
+ 'clear' => 'Počisti dnevnik',
+ 'delete_title' => 'Brisanje dnevnika',
+ 'delete_message' => 'Ali ste prepričani, da želite izbrisati vse dnevnike?',
+ ),
+ 'servers' => array(
+ 'server' => 'Strežnik',
+ 'status' => 'Status',
+ 'label' => 'Ime',
+ 'domain' => 'Domena / IP naslov',
+ 'timeout' => 'Časovna omejitev',
+ 'timeout_description' => 'Koliko sekund naj čakam na odgovor strežnika.',
+ 'port' => 'Vrata',
+ 'type' => 'Tip',
+ 'type_website' => 'Spletna stran (website)',
+ 'type_service' => 'Storitev (service)',
+ 'pattern' => 'Iskani niz oz. vzorec',
+ 'pattern_description' => 'Če ta vzorec ne bo najden na spletni strani, bo strežnik označen kot nedelujoč. Dovoljeni so regularni izrazi.',
+ 'last_check' => 'Zadnje preverjanje',
+ 'last_online' => 'Nazadnje dostopen',
+ 'monitoring' => 'Spremljanje',
+ 'no_monitoring' => 'Se ne spremlja',
+ 'email' => 'E-pošta',
+ 'send_email' => 'Pošlji e-pošto',
+ 'sms' => 'SMS',
+ 'send_sms' => 'Pošlji SMS',
+ 'pushover' => 'Pushover',
+ 'users' => 'Uporabniki',
+ 'delete_title' => 'Izbriši strežnik',
+ 'delete_message' => 'Ste prepričani, da želite izbrisati strežnik \'%1\'?',
+ 'deleted' => 'Strežnik izbrisan.',
+ 'updated' => 'Podatki o strežniku posodobljeni.',
+ 'inserted' => 'Strežnik dodan.',
+ 'latency' => 'Zakasnitev',
+ 'latency_max' => 'Zakasnitev (največja)',
+ 'latency_min' => 'Zakasnitev (najmanjša)',
+ 'latency_avg' => 'Zakasnitev (povprečna)',
+ 'uptime' => 'Neprekinjeno delovanje',
+ 'year' => 'leto',
+ 'month' => 'mesec',
+ 'week' => 'teden',
+ 'day' => 'dan',
+ 'hour' => 'ura',
+ 'warning_threshold' => 'Prag za opozorilo',
+ 'warning_threshold_description' => 'Število neuspešnih preverjanj preden je strežnik označen kot nedelujoč.',
+ 'chart_last_week' => 'prejšnji teden',
+ 'chart_history' => 'Zgodovina',
+ // Charts date format according jqPlot date format http://www.jqplot.com/docs/files/plugins/jqplot-dateAxisRenderer-js.html
+ 'chart_day_format' => '%m. %d. %Y',
+ 'chart_long_date_format' => '%m. %d. %Y %H:%M:%S',
+ 'chart_short_date_format' => '%m/%d %H:%M',
+ 'chart_short_time_format' => '%H:%M',
+ 'warning_notifications_disabled_sms' => 'SMS obvestila so onemogočena.',
+ 'warning_notifications_disabled_email' => 'Obvestila po e-pošti so onemogočena.',
+ 'warning_notifications_disabled_pushover' => 'Pushover obvestila so onemogočena.',
+ 'error_server_no_match' => 'Strežnik ni najden.',
+ 'error_server_label_bad_length' => 'Ime mora biti med 1 in 255 znaki.',
+ 'error_server_ip_bad_length' => 'Domena / IP naslov mora biti med 1 in 255 znaki.',
+ 'error_server_ip_bad_service' => 'IP naslov ni veljaven.',
+ 'error_server_ip_bad_website' => 'URL naslov spletne strani ni veljaven.',
+ 'error_server_type_invalid' => 'Izbrani tip strežnika ni veljaven.',
+ 'error_server_warning_threshold_invalid' => 'Prag za opozorilo mora biti število večje od 0.',
+ ),
+ 'config' => array(
+ 'general' => 'Splošno',
+ 'language' => 'Jezik',
+ 'show_update' => 'Preverim za posodobitve?',
+ 'email_status' => 'Dovolim pošiljanje e-pošte',
+ 'email_from_email' => 'E-poštni naslov pošiljatelja',
+ 'email_from_name' => 'Ime pošiljatelja',
+ 'email_smtp' => 'Enable SMTP',
+ 'email_smtp_host' => 'SMTP strežnik',
+ 'email_smtp_port' => 'SMTP vrata',
+ 'email_smtp_security' => 'SMTP varnost',
+ 'email_smtp_security_none' => 'brez',
+ 'email_smtp_username' => 'SMTP uporabniško ime',
+ 'email_smtp_password' => 'SMTP geslo',
+ 'email_smtp_noauth' => 'Če ni potrebna overovitev, pustite prazno',
+ 'sms_status' => 'Dovolim pošiljanje SMS sporočil?',
+ 'sms_gateway' => 'Prehod za pošiljanje SMS sporočil',
+ 'sms_gateway_username' => 'Uporabniško ime SMS prehoda',
+ 'sms_gateway_password' => 'Geslo SMS prehoda',
+ 'sms_from' => 'Telefonska številka pošiljatelja',
+ 'pushover_status' => 'Dovolim pošiljanje Pushover sporočil',
+ 'pushover_description' => 'Pushover je storitev, ki omogoča enostavno prejemanje obvestil v realnem času. Več informacij je na voljo na njihovi spletni strani.',
+ 'pushover_clone_app' => 'Kliknite za ustvarjanje vaše Pushover aplikacije',
+ 'pushover_api_token' => 'Pushover API žeton',
+ 'pushover_api_token_description' => 'Pred uporabo storitve Pushover, morate na njihovi spletni strani registrirati aplikacijo, tukaj pa vnesti API žeton.',
+ 'alert_type' => 'Izberite kdaj naj se vam pošljejo obvestila.',
+ 'alert_type_description' => 'Sprememba statusa: '.
+ 'Obvestilo boste dobili ob vsaki spremembi statusa, torej iz delujoč -> nedelujoč ter nedelujoč -> delujoč.
'.
+ '
Nedelujoč: '.
+ 'Obvestilo boste dobili samo, ko se bo strežnik PRVIKRAT prenehal odzivati. Na primer:'.
+ 'nastavljeno imate preverjanje strežnikov vsakih 15 minut. Strežnik preneha delovati ob 13h in ostane nedelujoč do 18h. '.
+ 'Dobili boste obvestilo samo ob 13h.
'.
+ '
Vedno: '.
+ 'Obvestilo boste dobili vedno, ko se izvede skripta za preverjanje in strežnik ne deluje, pa čeprav bo strežnik nedelujoč več ur.',
+ 'alert_type_status' => 'Sprememba statusa',
+ 'alert_type_offline' => 'Nedelujoč',
+ 'alert_type_always' => 'Vedno',
+ 'log_status' => 'Beleženje statusa',
+ 'log_status_description' => 'Če je beleženje statusa vključeno, se bodo beležili vsi dogodki povezani s pošiljanjem obvestil.',
+ 'log_email' => 'Beleži e-pošto, ki jo pošilja aplikacija',
+ 'log_sms' => 'Beleži SMS sporočila, ki jih pošilja aplikacija',
+ 'log_pushover' => 'Beleži Pushover sporočila, ki jih pošilja aplikacija',
+ 'updated' => 'Nastavitve so bile posodobljene.',
+ 'tab_email' => 'E-pošta',
+ 'tab_sms' => 'SMS',
+ 'tab_pushover' => 'Pushover',
+ 'settings_email' => 'Nastavitve e-pošte',
+ 'settings_sms' => 'Nastavitve SMS sporočil',
+ 'settings_pushover' => 'Nastavitve Pushover sporočil',
+ 'settings_notification' => 'Nastavitve obvestil',
+ 'settings_log' => 'Hramba dnevniških zapisov',
+ 'auto_refresh' => 'Samodejno posodabljanje',
+ 'auto_refresh_servers' =>
+ 'Samodejno posodabljanje pregleda statusa strežnikov.
'.
+ ''.
+ 'Čas v sekundah. Če je vrednost 0 se stran ne bo samodejno posodabljala.'.
+ '',
+ 'seconds' => 'sekund',
+ 'test' => 'Test',
+ 'test_email' => 'Na naslov, ki ste ga določili v vašem profilu, bo poslano e-sporočilo.',
+ 'test_sms' => 'Na telefonsko številko, ki ste jo določili v vašem profilu, bo poslan SMS.',
+ 'test_pushover' => 'Na uporabniški ključ/napravo, ki ste ju določili v vašem profilu, bo poslano Pushover sporočilo.',
+ 'send' => 'Pošlji',
+ 'test_subject' => 'Test',
+ 'test_message' => 'Testno sporočilo',
+ 'email_sent' => 'E-pošta poslana',
+ 'email_error' => 'Napaka pri pošiljanju e-pošte',
+ 'sms_sent' => 'SMS sporočilo poslano',
+ 'sms_error' => 'Napaka pri pošiljanju SMS sporočila. %s',
+ 'sms_error_nomobile' => 'Ni mogoče poslati testnega SMS sporočila: v vašem profilu ni vpisana veljavna telefonska številka.',
+ 'pushover_sent' => 'Pushover obvestilo poslano',
+ 'pushover_error' => 'Napaka pri pošiljanju Pushover sporočila: %s',
+ 'pushover_error_noapp' => 'Ni mogoče poslati testnega sporočila: med globalnimi nastavitvami ne najdem Pushover API žetona.',
+ 'pushover_error_nokey' => 'Ni mogoče poslati testnega sporočila: med vašimi nastavitvami ne najdem Pushover ključa.',
+ 'log_retention_period' => 'Čas hrambe podatov',
+ 'log_retention_period_description' => 'Število dni, ko naj se hranijo podatki o obvestilih in statusu strežnikov. Če želite podatke hraniti trajno, vnesite 0.',
+ 'log_retention_days' => 'dni',
+ ),
+ // for newlines in the email messages use
+ 'notifications' => array(
+ 'off_sms' => 'Streznik \'%LABEL%\' NE deluje: IP=%IP%, vrata=%PORT%. Napaka=%ERROR%',
+ 'off_email_subject' => 'POMEMBNO: Strežnik \'%LABEL%\' NE deluje',
+ 'off_email_body' => "Pri povezovanju na streznik je prislo do napake:
Streznik: %LABEL%
IP: %IP%
vrata: %PORT%
Napaka: %ERROR%
Datum: %DATE%",
+ 'off_pushover_title' => 'Streznik \'%LABEL%\' NE deluje',
+ 'off_pushover_message' => "Ni se mogoče povezati na naslednji streznik:
Streznik: %LABEL%
IP: %IP%
Vrata: %PORT%
Error: %ERROR%
Datum: %DATE%",
+ 'on_sms' => 'Streznik \'%LABEL%\' deluje: IP=%IP%, vrata=%PORT%',
+ 'on_email_subject' => 'OBVESTILO: Streznik \'%LABEL%\' ponovno deluje',
+ 'on_email_body' => "Streznik '%LABEL%' ponovno deluje:
Strežnik: %LABEL%
IP: %IP%
Vrata: %PORT%
Datum: %DATE%",
+ 'on_pushover_title' => 'Streznik \'%LABEL%\' deluje',
+ 'on_pushover_message' => 'Streznik \'%LABEL%\' ponovno deluje:
Server: %LABEL%
IP: %IP%
Vrata: %PORT%
Datum: %DATE%',
+ ),
+ 'login' => array(
+ 'welcome_usermenu' => 'Pozdravljeni, %user_name%',
+ 'title_sign_in' => 'Prosimo, prijavite se',
+ 'title_forgot' => 'Ali ste pozabili geslo?',
+ 'title_reset' => 'Ponastavitev gesla',
+ 'submit' => 'Pošlji',
+ 'remember_me' => 'Zapomni si me',
+ 'login' => 'Prijava',
+ 'logout' => 'Odjava',
+ 'username' => 'Uporabniško ime',
+ 'password' => 'Geslo',
+ 'password_repeat' => 'Geslo (ponovno)',
+ 'password_forgot' => 'Pozabljeno geslo?',
+ 'password_reset' => 'Ponastavitev gesla',
+ 'password_reset_email_subject' => 'Ponastavite svoje geslo za PHP Server Monitor',
+ 'password_reset_email_body' => 'Za ponastavitev gesla uporabite spodnjo povezavo. Pomembno: povezava poteče v 1 uri.
%link%',
+ 'error_user_incorrect' => 'Vpisanega uporabniškega imena ne najdem.',
+ 'error_login_incorrect' => 'Podatki so napačni.',
+ 'error_login_passwords_nomatch' => 'Vneseno geslo ni pravilno.',
+ 'error_reset_invalid_link' => 'Povezava za ponastavitev gesla, ki ste jo vnesli, ni pravilna.',
+ 'success_password_forgot' => 'Poslano vam je bilo sporočilo z navodili za ponastavitev vašega gesla.',
+ 'success_password_reset' => 'Vaše geslo je bilo uspešno ponastavljeno. Prijavite se prosim.',
+ ),
+ 'error' => array(
+ '401_unauthorized' => 'Nepooblaščen dostop',
+ '401_unauthorized_description' => 'Nimate dovoljenja za ogled te strani.',
+ ),
);
diff --git a/src/lang/sv_SE.lang.php b/src/lang/sv_SE.lang.php
index 420d4a0e..753d7dce 100644
--- a/src/lang/sv_SE.lang.php
+++ b/src/lang/sv_SE.lang.php
@@ -214,14 +214,14 @@ $sm_lang = array(
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Innan du kan använda Pushover behöver du registrera en App på deras webbsida och skriva in App API Token här.',
'alert_type' => 'Välj när du vill bli meddelad.',
- 'alert_type_description' => 'Statusförändring: '.
- 'Du får ett meddelande när status ändras. Så från online -> offline eller offline -> online.
'.
- '
Offline: '.
- 'Du får ett meddelande när en server går offline *FÖR FÖRSTA GÅNGEN* Exempelvis, '.
- 'ditt cronjob körs var 15 minut och din server går ned kl 1 och är nere till kl 6. '.
- 'Du kommer få 1 meddelande kl 1 och inga mer.
'.
- '
Alltid: '.
- 'Du kommer få ett meddelande varje gång kontrollen görs, även om servern har varit offline under en längre tid.',
+ 'alert_type_description' => 'Statusförändring: '.
+ 'Du får ett meddelande när status ändras. Så från online -> offline eller offline -> online.
'.
+ '
Offline: '.
+ 'Du får ett meddelande när en server går offline *FÖR FÖRSTA GÅNGEN* Exempelvis, '.
+ 'ditt cronjob körs var 15 minut och din server går ned kl 1 och är nere till kl 6. '.
+ 'Du kommer få 1 meddelande kl 1 och inga mer.
'.
+ '
Alltid: '.
+ 'Du kommer få ett meddelande varje gång kontrollen görs, även om servern har varit offline under en längre tid.',
'alert_type_status' => 'Statusförändring',
'alert_type_offline' => 'Offline',
'alert_type_always' => 'Alltid',
diff --git a/src/lang/tr_TR.lang.php b/src/lang/tr_TR.lang.php
index e0e39a84..83058baf 100644
--- a/src/lang/tr_TR.lang.php
+++ b/src/lang/tr_TR.lang.php
@@ -26,40 +26,40 @@
**/
$sm_lang = array(
- 'name' => 'Türkçe - Turkish',
- 'locale' => array('tr_TR.UTF-8', 'tr_TR', 'turkish', 'turkish-tr'),
+ 'name' => 'Türkçe - Turkish',
+ 'locale' => array('tr_TR.UTF-8', 'tr_TR', 'turkish', 'turkish-tr'),
'locale_tag' => 'tr',
'locale_dir' => 'ltr',
- 'system' => array(
- 'title' => 'Server Monitor',
- 'install' => 'Yükle',
- 'action' => 'Aksiyon',
- 'save' => 'Kaydet',
- 'edit' => 'Düzenle',
- 'delete' => 'Sil',
- 'date' => 'Tarih',
- 'message' => 'Mesaj',
- 'yes' => 'Evet',
- 'no' => 'Hayır',
- 'insert' => 'Ekle',
- 'add_new' => 'Yeni ekle',
- 'update_available' => '({version}) sürümü şu anda http://www.phpservermonitor.org adresindedir.',
- 'back_to_top' => 'Başa Dön',
- 'go_back' => 'Geri Git',
- 'ok' => 'Tamam',
- 'cancel' => 'İptal',
- // 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' => 'Hiç',
- 'hours_ago' => '%d saat önce',
- 'an_hour_ago' => 'yaklaşık bir saat önce',
- 'minutes_ago' => '%d dakika önce',
- 'a_minute_ago' => 'yaklaşık bir dakika önce',
- 'seconds_ago' => '%d saniye önce',
- 'a_second_ago' => 'bir saniye önce',
+ 'system' => array(
+ 'title' => 'Server Monitor',
+ 'install' => 'Yükle',
+ 'action' => 'Aksiyon',
+ 'save' => 'Kaydet',
+ 'edit' => 'Düzenle',
+ 'delete' => 'Sil',
+ 'date' => 'Tarih',
+ 'message' => 'Mesaj',
+ 'yes' => 'Evet',
+ 'no' => 'Hayır',
+ 'insert' => 'Ekle',
+ 'add_new' => 'Yeni ekle',
+ 'update_available' => '({version}) sürümü şu anda http://www.phpservermonitor.org adresindedir.',
+ 'back_to_top' => 'Başa Dön',
+ 'go_back' => 'Geri Git',
+ 'ok' => 'Tamam',
+ 'cancel' => 'İptal',
+ // 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' => 'Hiç',
+ 'hours_ago' => '%d saat önce',
+ 'an_hour_ago' => 'yaklaşık bir saat önce',
+ 'minutes_ago' => '%d dakika önce',
+ 'a_minute_ago' => 'yaklaşık bir dakika önce',
+ 'seconds_ago' => '%d saniye önce',
+ 'a_second_ago' => 'bir saniye önce',
'year' => 'year',
'years' => 'years',
'month' => 'month',
@@ -72,238 +72,238 @@ $sm_lang = array(
'minutes' => 'minutes',
'second' => 'second',
'seconds' => 'seconds',
- ),
- 'menu' => array(
- 'config' => 'Ayarlar',
- 'server' => 'Sunucular',
- 'server_log' => 'Log',
- 'server_status' => 'Durum',
- 'server_update' => 'Güncelle',
- 'user' => 'Kullanıcılar',
- 'help' => 'Yardım',
- ),
- 'users' => array(
- 'user' => 'Kullanıcı',
- 'name' => 'İsim',
- 'user_name' => 'Kullanıcı adı',
- 'password' => 'Şifre',
- 'password_repeat' => 'Şifre tekrarı',
- 'password_leave_blank' => 'Değiştirmemek için boş bırakın',
- 'level' => 'Seviye',
- 'level_10' => 'Yönetici',
- 'level_20' => 'Kullanıcı',
- 'level_description' => 'Yöneticiler tüm yetkilere sahiptir: Onlar sunucuları, kullanıcıları yönetebilir genel ayarlamaları düzenleyebilirler.
Kullanıcılar sadece görüntüleyebilir ve onlara atanmış sunucu güncelleyicileri çalıştırabilirler.',
- 'mobile' => 'Mobil',
- 'email' => 'E-posta',
- 'pushover' => 'Pushover',
- 'pushover_description' => 'Pushover gerçek zamanlı bildirim alabilmek için bir servistir. Daha fazla bilgi için sitesine bakabilirsiniz.',
- 'pushover_key' => 'Pushover Anahtarı',
- 'pushover_device' => 'Pushover Aracı',
- 'pushover_device_description' => 'Mesajın gönderileceği cihazın adı. Tüm cihazlara göndermek için boş bırakın.',
- 'delete_title' => 'Kullanıcıyı Sil',
- 'delete_message' => '\'%1\' kullanıcısını silmek istediğinize emin misiniz?',
- 'deleted' => 'Kullanıcı silindi.',
- 'updated' => 'Kullanıcı güncellendi.',
- 'inserted' => 'Kullanıcı eklendi.',
- 'profile' => 'Profil',
- 'profile_updated' => 'Profiliniz güncellendi.',
- 'error_user_name_bad_length' => 'Kullanıcı adları en az 2 ve en fazla 64 karakter uzunluğunda olmalıdır.',
- 'error_user_name_invalid' => 'Kullanıcı adları sadece harf (a-z, A-Z), sayı (0-9), noktalar (.) and alttan çizgi (_) karakterlerini içerebilir.',
- 'error_user_name_exists' => 'Bu kullanıcı adı daha önce alınmış.',
- 'error_user_email_bad_length' => 'E-posta adresi en az 5 ve en fazla 255 karakter uzunluğunda olmalıdır.',
- 'error_user_email_invalid' => 'Geçersiz e-posta adresi.',
- 'error_user_level_invalid' => 'Verilen kullanıcı seviyesi geçersiz.',
- 'error_user_no_match' => 'Kullanıcı veritabanında bulunamadı.',
- 'error_user_password_invalid' => 'Geçersiz bir şifre girdiniz.',
- 'error_user_password_no_match' => 'Şifreler birbiri ile eşleşmedi.',
- ),
- 'log' => array(
- 'title' => 'Log Girdileri',
- 'type' => 'Tip',
- 'status' => 'Durum',
- 'email' => 'E-posta',
- 'sms' => 'SMS',
- 'pushover' => 'Pushover',
- 'no_logs' => 'Kayıt yok.',
- 'clear' => 'Günlüğü temizle',
- 'delete_title' => 'Günlüğü temizle',
- 'delete_message' => 'Tüm günlükleri silmek istediğinizden emin misiniz?',
- ),
- 'servers' => array(
- 'server' => 'Sunucu',
- 'status' => 'Durum',
- 'label' => 'Etiket',
- 'domain' => 'Domain/IP',
- 'timeout' => 'Zaman Aşımı',
- 'timeout_description' => 'Sunucunun cevap vermesini beklenecek saniye.',
- 'port' => 'Port',
- 'type' => 'Tip',
- 'type_website' => 'Website',
- 'type_service' => 'Servis',
- 'pattern' => 'String/Pattern ara',
- 'pattern_description' => 'Bu pattern web sitenizde bulunamaz ise, sunucu offline olarak işaretlenecek. Regular expression\'a izin verilmiştir.',
- 'last_check' => 'Son kontrol',
- 'last_online' => 'Son çevrimiçi zamanı',
- 'last_offline' => 'Last offline',
- 'monitoring' => 'Monitoring',
- 'no_monitoring' => 'No monitoring',
- 'email' => 'E-posta',
- 'send_email' => 'E-posta Gönder',
- 'sms' => 'SMS',
- 'send_sms' => 'SMS Gönder',
- 'pushover' => 'Pushover',
- 'users' => 'Kullanıcılar',
- 'delete_title' => 'Sunucu Sil',
- 'delete_message' => '\'%1\' sunucusunu silmek istediğinize emin misiniz?',
- 'deleted' => 'Sunucu silindi.',
- 'updated' => 'Sunucu güncellendi.',
- 'inserted' => 'Sunucu eklendi.',
- 'latency' => 'Gecikme',
- 'latency_max' => 'Gecikme (Azami)',
- 'latency_min' => 'Gecikme (Asgari)',
- 'latency_avg' => 'Gecikme (Ortalama)',
- 'uptime' => 'Uptime',
- 'year' => 'Yıl',
- 'month' => 'Ay',
- 'week' => 'Hafta',
- 'day' => 'Gün',
- 'hour' => 'Saat',
- 'warning_threshold' => 'Uyarı Eşiği',
- 'warning_threshold_description' => 'Number of failed checks required before it is marked offline.',
- 'chart_last_week' => 'Geçen Hafta',
- 'chart_history' => 'Geçmiş',
- // 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 bildirimi devre dışı.',
- 'warning_notifications_disabled_email' => 'E-posta bildirimi devre dışı.',
- 'warning_notifications_disabled_pushover' => 'Pushover bildirimi devre dışı.',
- 'error_server_no_match' => 'Sunucu bulunamadı.',
- 'error_server_label_bad_length' => 'Etiken en az 1 ve en çok 255 karakter olmalıdır.',
- 'error_server_ip_bad_length' => 'Alan adı / IP en az 1 ve en fazla 255 karakter olmalıdır.',
- 'error_server_ip_bad_service' => 'IP adresi geçerli değil.',
- 'error_server_ip_bad_website' => 'Site adresi geçerli değil.',
- 'error_server_type_invalid' => 'Seçilen sunucu tipi geçerli değil.',
- 'error_server_warning_threshold_invalid' => 'Hata eşiği 0\'dan büyük bir tam sayı olmalıdır.',
- ),
- 'config' => array(
- 'general' => 'Genel',
- 'language' => 'Dil',
- 'show_update' => 'Güncellemeleri kontrol et?',
- 'email_status' => 'E-posta gönderimine izin ver',
- 'email_from_email' => 'Gönderilen e-posta adresi',
- 'email_from_name' => 'E-posta adresinde görünecek isim',
- 'email_smtp' => 'SMTP\'yi aktif et',
- 'email_smtp_host' => 'SMTP sunucusu',
- 'email_smtp_port' => 'SMTP port',
+ ),
+ 'menu' => array(
+ 'config' => 'Ayarlar',
+ 'server' => 'Sunucular',
+ 'server_log' => 'Log',
+ 'server_status' => 'Durum',
+ 'server_update' => 'Güncelle',
+ 'user' => 'Kullanıcılar',
+ 'help' => 'Yardım',
+ ),
+ 'users' => array(
+ 'user' => 'Kullanıcı',
+ 'name' => 'İsim',
+ 'user_name' => 'Kullanıcı adı',
+ 'password' => 'Şifre',
+ 'password_repeat' => 'Şifre tekrarı',
+ 'password_leave_blank' => 'Değiştirmemek için boş bırakın',
+ 'level' => 'Seviye',
+ 'level_10' => 'Yönetici',
+ 'level_20' => 'Kullanıcı',
+ 'level_description' => 'Yöneticiler tüm yetkilere sahiptir: Onlar sunucuları, kullanıcıları yönetebilir genel ayarlamaları düzenleyebilirler.
Kullanıcılar sadece görüntüleyebilir ve onlara atanmış sunucu güncelleyicileri çalıştırabilirler.',
+ 'mobile' => 'Mobil',
+ 'email' => 'E-posta',
+ 'pushover' => 'Pushover',
+ 'pushover_description' => 'Pushover gerçek zamanlı bildirim alabilmek için bir servistir. Daha fazla bilgi için sitesine bakabilirsiniz.',
+ 'pushover_key' => 'Pushover Anahtarı',
+ 'pushover_device' => 'Pushover Aracı',
+ 'pushover_device_description' => 'Mesajın gönderileceği cihazın adı. Tüm cihazlara göndermek için boş bırakın.',
+ 'delete_title' => 'Kullanıcıyı Sil',
+ 'delete_message' => '\'%1\' kullanıcısını silmek istediğinize emin misiniz?',
+ 'deleted' => 'Kullanıcı silindi.',
+ 'updated' => 'Kullanıcı güncellendi.',
+ 'inserted' => 'Kullanıcı eklendi.',
+ 'profile' => 'Profil',
+ 'profile_updated' => 'Profiliniz güncellendi.',
+ 'error_user_name_bad_length' => 'Kullanıcı adları en az 2 ve en fazla 64 karakter uzunluğunda olmalıdır.',
+ 'error_user_name_invalid' => 'Kullanıcı adları sadece harf (a-z, A-Z), sayı (0-9), noktalar (.) and alttan çizgi (_) karakterlerini içerebilir.',
+ 'error_user_name_exists' => 'Bu kullanıcı adı daha önce alınmış.',
+ 'error_user_email_bad_length' => 'E-posta adresi en az 5 ve en fazla 255 karakter uzunluğunda olmalıdır.',
+ 'error_user_email_invalid' => 'Geçersiz e-posta adresi.',
+ 'error_user_level_invalid' => 'Verilen kullanıcı seviyesi geçersiz.',
+ 'error_user_no_match' => 'Kullanıcı veritabanında bulunamadı.',
+ 'error_user_password_invalid' => 'Geçersiz bir şifre girdiniz.',
+ 'error_user_password_no_match' => 'Şifreler birbiri ile eşleşmedi.',
+ ),
+ 'log' => array(
+ 'title' => 'Log Girdileri',
+ 'type' => 'Tip',
+ 'status' => 'Durum',
+ 'email' => 'E-posta',
+ 'sms' => 'SMS',
+ 'pushover' => 'Pushover',
+ 'no_logs' => 'Kayıt yok.',
+ 'clear' => 'Günlüğü temizle',
+ 'delete_title' => 'Günlüğü temizle',
+ 'delete_message' => 'Tüm günlükleri silmek istediğinizden emin misiniz?',
+ ),
+ 'servers' => array(
+ 'server' => 'Sunucu',
+ 'status' => 'Durum',
+ 'label' => 'Etiket',
+ 'domain' => 'Domain/IP',
+ 'timeout' => 'Zaman Aşımı',
+ 'timeout_description' => 'Sunucunun cevap vermesini beklenecek saniye.',
+ 'port' => 'Port',
+ 'type' => 'Tip',
+ 'type_website' => 'Website',
+ 'type_service' => 'Servis',
+ 'pattern' => 'String/Pattern ara',
+ 'pattern_description' => 'Bu pattern web sitenizde bulunamaz ise, sunucu offline olarak işaretlenecek. Regular expression\'a izin verilmiştir.',
+ 'last_check' => 'Son kontrol',
+ 'last_online' => 'Son çevrimiçi zamanı',
+ 'last_offline' => 'Last offline',
+ 'monitoring' => 'Monitoring',
+ 'no_monitoring' => 'No monitoring',
+ 'email' => 'E-posta',
+ 'send_email' => 'E-posta Gönder',
+ 'sms' => 'SMS',
+ 'send_sms' => 'SMS Gönder',
+ 'pushover' => 'Pushover',
+ 'users' => 'Kullanıcılar',
+ 'delete_title' => 'Sunucu Sil',
+ 'delete_message' => '\'%1\' sunucusunu silmek istediğinize emin misiniz?',
+ 'deleted' => 'Sunucu silindi.',
+ 'updated' => 'Sunucu güncellendi.',
+ 'inserted' => 'Sunucu eklendi.',
+ 'latency' => 'Gecikme',
+ 'latency_max' => 'Gecikme (Azami)',
+ 'latency_min' => 'Gecikme (Asgari)',
+ 'latency_avg' => 'Gecikme (Ortalama)',
+ 'uptime' => 'Uptime',
+ 'year' => 'Yıl',
+ 'month' => 'Ay',
+ 'week' => 'Hafta',
+ 'day' => 'Gün',
+ 'hour' => 'Saat',
+ 'warning_threshold' => 'Uyarı Eşiği',
+ 'warning_threshold_description' => 'Number of failed checks required before it is marked offline.',
+ 'chart_last_week' => 'Geçen Hafta',
+ 'chart_history' => 'Geçmiş',
+ // 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 bildirimi devre dışı.',
+ 'warning_notifications_disabled_email' => 'E-posta bildirimi devre dışı.',
+ 'warning_notifications_disabled_pushover' => 'Pushover bildirimi devre dışı.',
+ 'error_server_no_match' => 'Sunucu bulunamadı.',
+ 'error_server_label_bad_length' => 'Etiken en az 1 ve en çok 255 karakter olmalıdır.',
+ 'error_server_ip_bad_length' => 'Alan adı / IP en az 1 ve en fazla 255 karakter olmalıdır.',
+ 'error_server_ip_bad_service' => 'IP adresi geçerli değil.',
+ 'error_server_ip_bad_website' => 'Site adresi geçerli değil.',
+ 'error_server_type_invalid' => 'Seçilen sunucu tipi geçerli değil.',
+ 'error_server_warning_threshold_invalid' => 'Hata eşiği 0\'dan büyük bir tam sayı olmalıdır.',
+ ),
+ 'config' => array(
+ 'general' => 'Genel',
+ 'language' => 'Dil',
+ 'show_update' => 'Güncellemeleri kontrol et?',
+ 'email_status' => 'E-posta gönderimine izin ver',
+ 'email_from_email' => 'Gönderilen e-posta adresi',
+ 'email_from_name' => 'E-posta adresinde görünecek isim',
+ 'email_smtp' => 'SMTP\'yi aktif et',
+ 'email_smtp_host' => 'SMTP sunucusu',
+ 'email_smtp_port' => 'SMTP port',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
- 'email_smtp_username' => 'SMTP kullanıcı adı',
- 'email_smtp_password' => 'SMTP şifre',
- 'email_smtp_noauth' => 'Doğrulama yapmamak için boş bırakın',
- 'sms_status' => 'SMS mesaj göndermeye izin ver',
- 'sms_gateway' => 'Mesaj göndermek için servisi seçin',
- 'sms_gateway_username' => 'Servis kullanıcı adı',
- 'sms_gateway_password' => 'Servis şifresi',
- 'sms_from' => 'Gönderen numarası',
- 'pushover_status' => 'Pushover mesaj gönderimine izin ver',
- 'pushover_description' => 'Pushover gerçek zamanlı bildirim alabilmek için bir servistir. Daha fazla bilgi için sitesine bakabilirsiniz.',
- 'pushover_clone_app' => 'Pushover uygulaması oluşturmak için buraya tıklayınız.',
- 'pushover_api_token' => 'Pushover Uygulaması API Token Bilgisi',
- 'pushover_api_token_description' => 'Pushover kullanmadan önce, Pushover sitesi üzerinden bir uygulama oluşturmalısınız ve API Token bilgilerini buraya yazmalısınız.',
- 'alert_type' => 'Ne zaman uyarılmak istediğinizi seçin.',
- 'alert_type_description' => 'Durum değişikliği: '.
- 'Sunucu durumu değişiklik durumunda bildirim alacaksınız. Sunucu çevrimiçi durumundan çevrimdışı durumuna veya çevrimdışı durumundan çevrim için durumuna geçtiğinde.
'.
- '
Çevrimdışı: '.
- 'Sunucu çevrim dışı duruma geçtiğinde bildirim alırsınız. *SADECE İLK GEÇTİĞİNDE*. Örneğin, '.
- 'Cronjob her 15 dakikada bir çalışıyorsa ve sunucu 1\'de gidip 6\'ya kadar kapalı kalırsa. '.
- 'Sadece size saat 1\'de bildirim gönderilecektir.
'.
- '
Daima: '.
- 'Site çevrimdışı olduğu her zaman size bildirim gönderilecektir, site saatler boyunca kapalı kalse bile.',
- 'alert_type_status' => 'Durum değişikliği',
- 'alert_type_offline' => 'Çevrimdışı',
- 'alert_type_always' => 'Daima',
- 'log_status' => 'Log durumu',
- 'log_status_description' => 'Eğer log durumu TRUE olarak işaretlenirse, bildirim ayarlarından geçen her olay log olarak tutulacaktır.',
- 'log_email' => 'Log e-posta mesajı otomatik gönderilmiştir.',
- 'log_sms' => 'Log sms mesajı otomatik gönderilmiştir.',
- 'log_pushover' => 'Log pushover mesajı otomatik gönderilmiştir.',
- 'updated' => 'Ayarlar güncellendi.',
- 'tab_email' => 'E-posta',
- 'tab_sms' => 'SMS',
- 'tab_pushover' => 'Pushover',
- 'settings_email' => 'E-posta ayarları',
- 'settings_sms' => 'Sms mesaj ayarları',
- 'settings_pushover' => 'Pushover ayarları',
- 'settings_notification' => 'Bildirim ayarları',
- 'settings_log' => 'Log ayarları',
- 'auto_refresh' => 'Otomatik Yenileme',
- 'auto_refresh_servers' =>
- 'Otomatik yenileme sunucu sayfası
'.
- ''.
- 'Eğer sayfa yenilenmez ise.'.
- '',
- 'seconds' => 'saniye',
- 'test' => 'Test',
- 'test_email' => 'Profilinizde tanımladığınız e-posta adresinize bir e-posta gönderilecek.',
- 'test_sms' => 'Profilinizde tanımladığınız numaranıza bir SMS mesajı gönderilecek.',
- 'test_pushover' => 'Profilinizde tanımladığını bilgiler üzerinden bir pushover bildirimi gönderilecek.',
- 'send' => 'Gönder',
- 'test_subject' => 'Test',
- 'test_message' => 'Test mesaj',
- 'email_sent' => 'E-posta gönderildi',
- 'email_error' => 'E-posta gönderiminde hata.',
- 'sms_sent' => 'Sms gönderildi',
- 'sms_error' => 'SMS gönderiminde hata. %s',
- 'sms_error_nomobile' => 'SMS gönderilemiyor: profilinizde geçerli bir telefon numarası yok.',
- 'pushover_sent' => 'Pushover bildirimi gönderildi',
- 'pushover_error' => 'Pushover bildirimi gönderilirken bir hata meydana geldi: %s',
- 'pushover_error_noapp' => 'Test için bildirim gönderilemiyor: Pushover Uygulaması API token bilgisi bulunamadı.',
- 'pushover_error_nokey' => 'Test için bildirim gönderilemiyor: Pushover key bilgisi profilinizde bulunamadı.',
- 'log_retention_period' => 'Log tutma süresi',
- 'log_retention_period_description' => 'Bildirim loglarının ve sunucunun çalışma zamanlarının arşivinin saklanması için gün sayısı. Logların temizlenmesini kapatmak için 0 giriniz.',
- 'log_retention_days' => 'gün',
- ),
- // for newlines in the email messages use
- 'notifications' => array(
- 'off_sms' => '\'%LABEL%\' isimli sunucu KAPANDI: ip=%IP%, port=%PORT%. Error=%ERROR%',
- 'off_email_subject' => 'ÖNEMLİ: \'%LABEL%\' isimli sunucu KAPANDI.',
- 'off_email_body' => "Aşağıdaki sunuculara erişim sağlanamıyor:
Sunucu: %LABEL%
IP: %IP%
Port: %PORT%
Hata: %ERROR%
Tarih: %DATE%",
- 'off_pushover_title' => '\'%LABEL%\' isimli sunucu KAPANDI.',
- 'off_pushover_message' => "Aşağıdaki nuculara erişim sağlanamıyor:
Sunucu: %LABEL%
IP: %IP%
Port: %PORT%
Hata: %ERROR%
Tarih: %DATE%",
- 'on_sms' => '\'%LABEL%\' isimli sunucu YAYINDA: ip=%IP%, port=%PORT%',
- 'on_email_subject' => 'ÖNEMLİ:\'%LABEL%\' isimli sunucu YAYINDA.',
- 'on_email_body' => "'%LABEL%' isimli sunucu tekrar yayında:
Sunucu: %LABEL%
IP: %IP%
Port: %PORT%
Tarih: %DATE%",
- 'on_pushover_title' => '\'%LABEL%\' isimli sunucu YAYINDA',
- 'on_pushover_message' => '\'%LABEL%\' isimli sunucu tekrar yayında:
Sunucu: %LABEL%
IP: %IP%
Port: %PORT%
Tarih: %DATE%',
- ),
- 'login' => array(
- 'welcome_usermenu' => 'Hoşgeldin, %user_name%',
- 'title_sign_in' => 'Lütfen giriş yapın',
- 'title_forgot' => 'Şifreni mi unuttun?',
- 'title_reset' => 'Şifreni yenile',
- 'submit' => 'Gönder',
- 'remember_me' => 'Beni hatırla',
- 'login' => 'Giriş yap',
- 'logout' => 'Çıkış yap',
- 'username' => 'Kullanıcı adı',
- 'password' => 'Şifre',
- 'password_repeat' => 'Şifre tekrarı',
- 'password_forgot' => 'Şifreni mi unuttun?',
- 'password_reset' => 'Şifreni yenile',
- 'password_reset_email_subject' => 'PHP Server Monitor için şifreni yenile',
- 'password_reset_email_body' => 'Aşağıdaki bağlantıyı kullanarak şifrenizi güncelleyiniz. Bağlantı 1 saat sonra geçerliliğini kaybedecektir.
%link%',
- 'error_user_incorrect' => 'Kullanıcı adı bulunamadı.',
- 'error_login_incorrect' => 'Bilgi yanlış.',
- 'error_login_passwords_nomatch' => 'Şifreleriniz uyuşmuyor.',
- 'error_reset_invalid_link' => 'Sağladığını sıfırlama bağlantısı geçersiz.',
- 'success_password_forgot' => 'Şifrenizi yenilemeniz için gerekli bilgileri içeren bir e-posta gönderildi.',
- 'success_password_reset' => 'Şifreniz başarıyla yenilendi. Şimdi giriş yapın.',
- ),
- 'error' => array(
- '401_unauthorized' => 'Yetkisiz',
- '401_unauthorized_description' => 'Bu sayfayı görüntülemek için yetkin yok.',
- ),
+ 'email_smtp_username' => 'SMTP kullanıcı adı',
+ 'email_smtp_password' => 'SMTP şifre',
+ 'email_smtp_noauth' => 'Doğrulama yapmamak için boş bırakın',
+ 'sms_status' => 'SMS mesaj göndermeye izin ver',
+ 'sms_gateway' => 'Mesaj göndermek için servisi seçin',
+ 'sms_gateway_username' => 'Servis kullanıcı adı',
+ 'sms_gateway_password' => 'Servis şifresi',
+ 'sms_from' => 'Gönderen numarası',
+ 'pushover_status' => 'Pushover mesaj gönderimine izin ver',
+ 'pushover_description' => 'Pushover gerçek zamanlı bildirim alabilmek için bir servistir. Daha fazla bilgi için sitesine bakabilirsiniz.',
+ 'pushover_clone_app' => 'Pushover uygulaması oluşturmak için buraya tıklayınız.',
+ 'pushover_api_token' => 'Pushover Uygulaması API Token Bilgisi',
+ 'pushover_api_token_description' => 'Pushover kullanmadan önce, Pushover sitesi üzerinden bir uygulama oluşturmalısınız ve API Token bilgilerini buraya yazmalısınız.',
+ 'alert_type' => 'Ne zaman uyarılmak istediğinizi seçin.',
+ 'alert_type_description' => 'Durum değişikliği: '.
+ 'Sunucu durumu değişiklik durumunda bildirim alacaksınız. Sunucu çevrimiçi durumundan çevrimdışı durumuna veya çevrimdışı durumundan çevrim için durumuna geçtiğinde.
'.
+ '
Çevrimdışı: '.
+ 'Sunucu çevrim dışı duruma geçtiğinde bildirim alırsınız. *SADECE İLK GEÇTİĞİNDE*. Örneğin, '.
+ 'Cronjob her 15 dakikada bir çalışıyorsa ve sunucu 1\'de gidip 6\'ya kadar kapalı kalırsa. '.
+ 'Sadece size saat 1\'de bildirim gönderilecektir.
'.
+ '
Daima: '.
+ 'Site çevrimdışı olduğu her zaman size bildirim gönderilecektir, site saatler boyunca kapalı kalse bile.',
+ 'alert_type_status' => 'Durum değişikliği',
+ 'alert_type_offline' => 'Çevrimdışı',
+ 'alert_type_always' => 'Daima',
+ 'log_status' => 'Log durumu',
+ 'log_status_description' => 'Eğer log durumu TRUE olarak işaretlenirse, bildirim ayarlarından geçen her olay log olarak tutulacaktır.',
+ 'log_email' => 'Log e-posta mesajı otomatik gönderilmiştir.',
+ 'log_sms' => 'Log sms mesajı otomatik gönderilmiştir.',
+ 'log_pushover' => 'Log pushover mesajı otomatik gönderilmiştir.',
+ 'updated' => 'Ayarlar güncellendi.',
+ 'tab_email' => 'E-posta',
+ 'tab_sms' => 'SMS',
+ 'tab_pushover' => 'Pushover',
+ 'settings_email' => 'E-posta ayarları',
+ 'settings_sms' => 'Sms mesaj ayarları',
+ 'settings_pushover' => 'Pushover ayarları',
+ 'settings_notification' => 'Bildirim ayarları',
+ 'settings_log' => 'Log ayarları',
+ 'auto_refresh' => 'Otomatik Yenileme',
+ 'auto_refresh_servers' =>
+ 'Otomatik yenileme sunucu sayfası
'.
+ ''.
+ 'Eğer sayfa yenilenmez ise.'.
+ '',
+ 'seconds' => 'saniye',
+ 'test' => 'Test',
+ 'test_email' => 'Profilinizde tanımladığınız e-posta adresinize bir e-posta gönderilecek.',
+ 'test_sms' => 'Profilinizde tanımladığınız numaranıza bir SMS mesajı gönderilecek.',
+ 'test_pushover' => 'Profilinizde tanımladığını bilgiler üzerinden bir pushover bildirimi gönderilecek.',
+ 'send' => 'Gönder',
+ 'test_subject' => 'Test',
+ 'test_message' => 'Test mesaj',
+ 'email_sent' => 'E-posta gönderildi',
+ 'email_error' => 'E-posta gönderiminde hata.',
+ 'sms_sent' => 'Sms gönderildi',
+ 'sms_error' => 'SMS gönderiminde hata. %s',
+ 'sms_error_nomobile' => 'SMS gönderilemiyor: profilinizde geçerli bir telefon numarası yok.',
+ 'pushover_sent' => 'Pushover bildirimi gönderildi',
+ 'pushover_error' => 'Pushover bildirimi gönderilirken bir hata meydana geldi: %s',
+ 'pushover_error_noapp' => 'Test için bildirim gönderilemiyor: Pushover Uygulaması API token bilgisi bulunamadı.',
+ 'pushover_error_nokey' => 'Test için bildirim gönderilemiyor: Pushover key bilgisi profilinizde bulunamadı.',
+ 'log_retention_period' => 'Log tutma süresi',
+ 'log_retention_period_description' => 'Bildirim loglarının ve sunucunun çalışma zamanlarının arşivinin saklanması için gün sayısı. Logların temizlenmesini kapatmak için 0 giriniz.',
+ 'log_retention_days' => 'gün',
+ ),
+ // for newlines in the email messages use
+ 'notifications' => array(
+ 'off_sms' => '\'%LABEL%\' isimli sunucu KAPANDI: ip=%IP%, port=%PORT%. Error=%ERROR%',
+ 'off_email_subject' => 'ÖNEMLİ: \'%LABEL%\' isimli sunucu KAPANDI.',
+ 'off_email_body' => "Aşağıdaki sunuculara erişim sağlanamıyor:
Sunucu: %LABEL%
IP: %IP%
Port: %PORT%
Hata: %ERROR%
Tarih: %DATE%",
+ 'off_pushover_title' => '\'%LABEL%\' isimli sunucu KAPANDI.',
+ 'off_pushover_message' => "Aşağıdaki nuculara erişim sağlanamıyor:
Sunucu: %LABEL%
IP: %IP%
Port: %PORT%
Hata: %ERROR%
Tarih: %DATE%",
+ 'on_sms' => '\'%LABEL%\' isimli sunucu YAYINDA: ip=%IP%, port=%PORT%',
+ 'on_email_subject' => 'ÖNEMLİ:\'%LABEL%\' isimli sunucu YAYINDA.',
+ 'on_email_body' => "'%LABEL%' isimli sunucu tekrar yayında:
Sunucu: %LABEL%
IP: %IP%
Port: %PORT%
Tarih: %DATE%",
+ 'on_pushover_title' => '\'%LABEL%\' isimli sunucu YAYINDA',
+ 'on_pushover_message' => '\'%LABEL%\' isimli sunucu tekrar yayında:
Sunucu: %LABEL%
IP: %IP%
Port: %PORT%
Tarih: %DATE%',
+ ),
+ 'login' => array(
+ 'welcome_usermenu' => 'Hoşgeldin, %user_name%',
+ 'title_sign_in' => 'Lütfen giriş yapın',
+ 'title_forgot' => 'Şifreni mi unuttun?',
+ 'title_reset' => 'Şifreni yenile',
+ 'submit' => 'Gönder',
+ 'remember_me' => 'Beni hatırla',
+ 'login' => 'Giriş yap',
+ 'logout' => 'Çıkış yap',
+ 'username' => 'Kullanıcı adı',
+ 'password' => 'Şifre',
+ 'password_repeat' => 'Şifre tekrarı',
+ 'password_forgot' => 'Şifreni mi unuttun?',
+ 'password_reset' => 'Şifreni yenile',
+ 'password_reset_email_subject' => 'PHP Server Monitor için şifreni yenile',
+ 'password_reset_email_body' => 'Aşağıdaki bağlantıyı kullanarak şifrenizi güncelleyiniz. Bağlantı 1 saat sonra geçerliliğini kaybedecektir.
%link%',
+ 'error_user_incorrect' => 'Kullanıcı adı bulunamadı.',
+ 'error_login_incorrect' => 'Bilgi yanlış.',
+ 'error_login_passwords_nomatch' => 'Şifreleriniz uyuşmuyor.',
+ 'error_reset_invalid_link' => 'Sağladığını sıfırlama bağlantısı geçersiz.',
+ 'success_password_forgot' => 'Şifrenizi yenilemeniz için gerekli bilgileri içeren bir e-posta gönderildi.',
+ 'success_password_reset' => 'Şifreniz başarıyla yenilendi. Şimdi giriş yapın.',
+ ),
+ 'error' => array(
+ '401_unauthorized' => 'Yetkisiz',
+ '401_unauthorized_description' => 'Bu sayfayı görüntülemek için yetkin yok.',
+ ),
);
diff --git a/src/lang/vi_VN.lang.php b/src/lang/vi_VN.lang.php
index 004f2dd0..667b44b0 100644
--- a/src/lang/vi_VN.lang.php
+++ b/src/lang/vi_VN.lang.php
@@ -199,14 +199,14 @@ $sm_lang = array(
'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_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',
diff --git a/src/lang/zh_CN.lang.php b/src/lang/zh_CN.lang.php
index b8eee2eb..7c0edb9e 100644
--- a/src/lang/zh_CN.lang.php
+++ b/src/lang/zh_CN.lang.php
@@ -230,14 +230,14 @@ $sm_lang = array(
'pushover_api_token' => 'Pushover API Token',
'pushover_api_token_description' => '请先 注册Pushover 并获取 Api Token.',
'alert_type' => '如果想要收到提醒请选中此项.',
- 'alert_type_description' => '状态变化: '.
- '业务 online -> offline 或 offline -> online 的状态变化将会收到提醒.
'.
- '
离线状态: '.
- '服务器首次发生离线状态将会收到提醒 ,如:'.
- 'cronjob 设定为15分钟执行一次, 服务器从1:00-6:00一直处于当状态'.
- '那么你将于1:00首次发现脱机时收到一条提醒,之后不会重复提醒.
'.
- '
总是提醒: '.
- '每次脚本执行或站点离线(即使站点离线很久已提醒过)均发送提醒.',
+ 'alert_type_description' => '状态变化: '.
+ '业务 online -> offline 或 offline -> online 的状态变化将会收到提醒.
'.
+ '
离线状态: '.
+ '服务器首次发生离线状态将会收到提醒 ,如:'.
+ 'cronjob 设定为15分钟执行一次, 服务器从1:00-6:00一直处于当状态'.
+ '那么你将于1:00首次发现脱机时收到一条提醒,之后不会重复提醒.
'.
+ '
总是提醒: '.
+ '每次脚本执行或站点离线(即使站点离线很久已提醒过)均发送提醒.',
'alert_type_status' => '状态变化',
'alert_type_offline' => '离线状态',
'alert_type_always' => '总是提醒',
diff --git a/src/psm/Module/AbstractController.php b/src/psm/Module/AbstractController.php
index 7cc70d9d..156c646a 100644
--- a/src/psm/Module/AbstractController.php
+++ b/src/psm/Module/AbstractController.php
@@ -156,16 +156,16 @@ abstract class AbstractController implements ControllerInterface {
* @return \Symfony\Component\HttpFoundation\Response
*/
public function run($action = null) {
- if($action === null) {
+ if ($action === null) {
$action = psm_GET('action', psm_POST('action', $this->action_default));
}
$this->xhr = (bool) psm_GET('xhr', psm_POST('xhr', false));
- if(!in_array($action, $this->actions) || !($result = $this->runAction($action))) {
+ if (!in_array($action, $this->actions) || !($result = $this->runAction($action))) {
$result = $this->runAction($this->action_default);
}
- if($result instanceof Response) {
+ if ($result instanceof Response) {
return $result;
}
@@ -181,14 +181,14 @@ abstract class AbstractController implements ControllerInterface {
* @return mixed FALSE when action couldnt be initialized, response otherwise
*/
protected function runAction($action) {
- if(isset($this->user_level_required_actions[$action])) {
- if($this->getUser()->getUserLevel() > $this->user_level_required_actions[$action]) {
+ if (isset($this->user_level_required_actions[$action])) {
+ if ($this->getUser()->getUserLevel() > $this->user_level_required_actions[$action]) {
// user is not allowed to access this action..
return false;
}
}
- $method = 'execute' . ucfirst($action);
- if(method_exists($this, $method)) {
+ $method = 'execute'.ucfirst($action);
+ if (method_exists($this, $method)) {
$this->action = $action;
$result = $this->$method();
// if result from execute is null, no return value given so return true to indicate a successful execute
@@ -206,43 +206,43 @@ abstract class AbstractController implements ControllerInterface {
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function createHTML($html = null) {
- if(!$this->xhr) {
+ if (!$this->xhr) {
// in XHR mode, we will not add the main template
$tpl_data = array(
'title' => strtoupper(psm_get_lang('system', 'title')),
'label_back_to_top' => psm_get_lang('system', 'back_to_top'),
'add_footer' => $this->add_footer,
- 'version' => 'v' . PSM_VERSION,
+ 'version' => 'v'.PSM_VERSION,
'messages' => $this->getMessages(),
'html_content' => $html,
);
// add menu to page?
- if($this->add_menu) {
+ if ($this->add_menu) {
$tpl_data['html_menu'] = $this->createHTMLMenu();
}
// add header accessories to page ?
- if($this->header_accessories) {
+ if ($this->header_accessories) {
$tpl_data['header_accessories'] = $this->header_accessories;
}
// add modal dialog to page ?
- if(sizeof($this->modal)) {
+ if (sizeof($this->modal)) {
$html_modal = '';
- foreach($this->modal as $modal) {
+ foreach ($this->modal as $modal) {
$html_modal .= $modal->createHTML();
}
$tpl_data['html_modal'] = $html_modal;
}
// add sidebar to page?
- if($this->sidebar !== null) {
+ if ($this->sidebar !== null) {
$tpl_data['html_sidebar'] = $this->sidebar->createHTML();
}
- if(psm_update_available()) {
+ if (psm_update_available()) {
$tpl_data['update_available'] = str_replace('{version}', 'v'.psm_get_conf('version_update_check'), psm_get_lang('system', 'update_available'));
}
- if($this->black_background) {
+ if ($this->black_background) {
$tpl_data['body_class'] = 'black_background';
}
$html = $this->twig->render('main/body.tpl.html', $tpl_data);
@@ -268,7 +268,7 @@ abstract class AbstractController implements ControllerInterface {
'url_logout' => psm_build_url(array('logout' => 1)),
);
- switch($ulvl) {
+ switch ($ulvl) {
case PSM_USER_ADMIN:
$items = array('server_status', 'server', 'server_log', 'user', 'config', 'server_update');
break;
@@ -280,7 +280,7 @@ abstract class AbstractController implements ControllerInterface {
break;
}
$tpl_data['menu'] = array();
- foreach($items as $key) {
+ foreach ($items as $key) {
$tpl_data['menu'][] = array(
'active' => ($key == psm_GET('mod')) ? 'active' : '',
'url' => psm_build_url(array('mod' => $key)),
@@ -288,7 +288,7 @@ abstract class AbstractController implements ControllerInterface {
);
}
- if($ulvl != PSM_USER_ANONYMOUS) {
+ if ($ulvl != PSM_USER_ANONYMOUS) {
$user = $this->getUser()->getUser();
$tpl_data['label_usermenu'] = str_replace(
'%user_name%',
@@ -324,15 +324,15 @@ abstract class AbstractController implements ControllerInterface {
* @see getAction()
*/
protected function setActions($actions, $default = null, $append = true) {
- if(!is_array($actions)) {
+ if (!is_array($actions)) {
$actions = array($actions);
}
- if($append) {
+ if ($append) {
$this->actions = array_merge($actions);
} else {
$this->actions = $actions;
}
- if($default !== null) {
+ if ($default !== null) {
$this->action_default = $default;
}
return $this;
@@ -355,10 +355,10 @@ abstract class AbstractController implements ControllerInterface {
* @see getMessages()
*/
public function addMessage($msg, $shortcode = 'info') {
- if(!is_array($msg)) {
+ if (!is_array($msg)) {
$msg = array($msg);
}
- switch($shortcode) {
+ switch ($shortcode) {
case 'error':
$icon = 'exclamation-sign';
break;
@@ -373,7 +373,7 @@ abstract class AbstractController implements ControllerInterface {
break;
}
- foreach($msg as $m) {
+ foreach ($msg as $m) {
$this->messages[] = array(
'message' => $m,
'shortcode' => $shortcode,
@@ -391,7 +391,7 @@ abstract class AbstractController implements ControllerInterface {
*/
public function getMessages($clear = true) {
$msgs = $this->messages;
- if($clear) {
+ if ($clear) {
$this->messages = array();
}
return $msgs;
@@ -425,10 +425,10 @@ abstract class AbstractController implements ControllerInterface {
* @see setMinUserLevelRequired()
*/
public function setMinUserLevelRequiredForAction($level, $actions) {
- if(!is_array($actions)) {
+ if (!is_array($actions)) {
$actions = array($actions);
}
- foreach($actions as $action) {
+ foreach ($actions as $action) {
$this->user_level_required_actions[$action] = intval($level);
}
return $this;
diff --git a/src/psm/Module/Config/ConfigModule.php b/src/psm/Module/Config/ConfigModule.php
index 678b32d8..3e33ceb3 100644
--- a/src/psm/Module/Config/ConfigModule.php
+++ b/src/psm/Module/Config/ConfigModule.php
@@ -39,7 +39,7 @@ class ConfigModule implements ModuleInterface {
public function getControllers() {
return array(
- 'config' => __NAMESPACE__ . '\Controller\ConfigController',
+ 'config' => __NAMESPACE__.'\Controller\ConfigController',
);
}
diff --git a/src/psm/Module/Config/Controller/ConfigController.php b/src/psm/Module/Config/Controller/ConfigController.php
index ff910c28..b6faa983 100644
--- a/src/psm/Module/Config/Controller/ConfigController.php
+++ b/src/psm/Module/Config/Controller/ConfigController.php
@@ -94,13 +94,13 @@ class ConfigController extends AbstractController {
$tpl_data = $this->getLabels();
$config_db = $this->db->select(
- PSM_DB_PREFIX . 'config',
+ PSM_DB_PREFIX.'config',
null,
array('key', 'value')
);
$config = array();
- foreach($config_db as $entry) {
+ foreach ($config_db as $entry) {
$config[$entry['key']] = $entry['value'];
}
@@ -110,7 +110,7 @@ class ConfigController extends AbstractController {
? $config['language']
: 'en_US';
$tpl_data['languages'] = array();
- foreach($lang_keys as $key => $label) {
+ foreach ($lang_keys as $key => $label) {
$tpl_data['languages'][] = array(
'value' => $key,
'label' => $label,
@@ -123,38 +123,38 @@ class ConfigController extends AbstractController {
? $config['sms_gateway']
: current($sms_gateways);
$tpl_data['sms_gateways'] = array();
- foreach($sms_gateways as $sms_gateway => $label) {
+ foreach ($sms_gateways as $sms_gateway => $label) {
$tpl_data['sms_gateways'][] = array(
'value' => $sms_gateway,
'label' => $label,
);
}
// @todo these selected values can easily be rewritten in the template using twig
- $tpl_data['alert_type_selected_' . $config['alert_type']] = 'selected="selected"';
+ $tpl_data['alert_type_selected_'.$config['alert_type']] = 'selected="selected"';
$smtp_sec = isset($config['email_smtp_security']) ? $config['email_smtp_security'] : '';
- $tpl_data['email_smtp_security_selected_' . $smtp_sec] = 'selected="selected"';
+ $tpl_data['email_smtp_security_selected_'.$smtp_sec] = 'selected="selected"';
$tpl_data['auto_refresh_servers'] = (isset($config['auto_refresh_servers'])) ? $config['auto_refresh_servers'] : '0';
$tpl_data['log_retention_period'] = (isset($config['log_retention_period'])) ? $config['log_retention_period'] : '365';
$tpl_data['password_encrypt_key'] = (isset($config['password_encrypt_key'])) ? $config['password_encrypt_key'] : sha1(microtime());
- foreach($this->checkboxes as $input_key) {
- $tpl_data[$input_key . '_checked'] =
+ foreach ($this->checkboxes as $input_key) {
+ $tpl_data[$input_key.'_checked'] =
(isset($config[$input_key]) && (int) $config[$input_key] == 1)
? 'checked="checked"'
: '';
}
- foreach($this->fields as $input_key) {
+ foreach ($this->fields as $input_key) {
$tpl_data[$input_key] = (isset($config[$input_key])) ? $config[$input_key] : '';
}
- $tpl_data[$this->default_tab . '_active'] = 'active';
+ $tpl_data[$this->default_tab.'_active'] = 'active';
$testmodals = array('email', 'sms', 'pushover', 'telegram');
- foreach($testmodals as $modal_id) {
- $modal = new \psm\Util\Module\Modal($this->twig, 'test' . ucfirst($modal_id), \psm\Util\Module\Modal::MODAL_TYPE_OKCANCEL);
+ foreach ($testmodals as $modal_id) {
+ $modal = new \psm\Util\Module\Modal($this->twig, 'test'.ucfirst($modal_id), \psm\Util\Module\Modal::MODAL_TYPE_OKCANCEL);
$this->addModal($modal);
- $modal->setTitle(psm_get_lang('servers', 'send_' . $modal_id));
- $modal->setMessage(psm_get_lang('config', 'test_' . $modal_id));
+ $modal->setTitle(psm_get_lang('servers', 'send_'.$modal_id));
+ $modal->setMessage(psm_get_lang('config', 'test_'.$modal_id));
$modal->setOKButtonLabel(psm_get_lang('config', 'send'));
}
@@ -166,7 +166,7 @@ class ConfigController extends AbstractController {
* and save it to the database
*/
protected function executeSave() {
- if(!empty($_POST)) {
+ if (!empty($_POST)) {
// save new config
$clean = array(
'language' => $_POST['language'],
@@ -180,44 +180,44 @@ class ConfigController extends AbstractController {
'log_retention_period' => intval(psm_POST('log_retention_period', 365)),
'password_encrypt_key' => psm_POST('password_encrypt_key', sha1(microtime())),
);
- foreach($this->checkboxes as $input_key) {
- $clean[$input_key] = (isset($_POST[$input_key])) ? '1': '0';
+ foreach ($this->checkboxes as $input_key) {
+ $clean[$input_key] = (isset($_POST[$input_key])) ? '1' : '0';
}
- foreach($this->fields as $input_key) {
- if(isset($_POST[$input_key])) {
+ foreach ($this->fields as $input_key) {
+ if (isset($_POST[$input_key])) {
$clean[$input_key] = $_POST[$input_key];
}
}
$language_refresh = ($clean['language'] != psm_get_conf('language'));
- foreach($clean as $key => $value) {
+ foreach ($clean as $key => $value) {
psm_update_conf($key, $value);
}
$this->addMessage(psm_get_lang('config', 'updated'), 'success');
- if(!empty($_POST['test_email'])) {
+ if (!empty($_POST['test_email'])) {
$this->testEmail();
- } elseif(!empty($_POST['test_sms'])) {
+ } elseif (!empty($_POST['test_sms'])) {
$this->testSMS();
- } elseif(!empty($_POST['test_pushover'])) {
+ } elseif (!empty($_POST['test_pushover'])) {
$this->testPushover();
- } elseif(!empty($_POST['test_telegram'])) {
+ } elseif (!empty($_POST['test_telegram'])) {
$this->testTelegram();
}
- if($language_refresh) {
- header('Location: ' . psm_build_url(array('mod' => 'config'), true, false));
+ if ($language_refresh) {
+ header('Location: '.psm_build_url(array('mod' => 'config'), true, false));
trigger_error("Redirect failed.", E_USER_ERROR);
}
- if(isset($_POST['general_submit'])) {
+ if (isset($_POST['general_submit'])) {
$this->default_tab = 'general';
- } elseif(isset($_POST['email_submit']) || !empty($_POST['test_email'])) {
+ } elseif (isset($_POST['email_submit']) || !empty($_POST['test_email'])) {
$this->default_tab = 'email';
- } elseif(isset($_POST['sms_submit']) || !empty($_POST['test_sms'])) {
+ } elseif (isset($_POST['sms_submit']) || !empty($_POST['test_sms'])) {
$this->default_tab = 'sms';
- } elseif(isset($_POST['pushover_submit']) || !empty($_POST['test_pushover'])) {
+ } elseif (isset($_POST['pushover_submit']) || !empty($_POST['test_pushover'])) {
$this->default_tab = 'pushover';
- } elseif(isset($_POST['telegram_submit']) || !empty($_POST['test_telegram'])) {
+ } elseif (isset($_POST['telegram_submit']) || !empty($_POST['test_telegram'])) {
$this->default_tab = 'telegram';
}
}
@@ -233,15 +233,15 @@ class ConfigController extends AbstractController {
$mail = psm_build_mail();
$message = psm_get_lang('config', 'test_message');
$mail->Subject = psm_get_lang('config', 'test_subject');
- $mail->Priority = 1;
- $mail->Body = $message;
+ $mail->Priority = 1;
+ $mail->Body = $message;
$mail->AltBody = str_replace('
', "\n", $message);
$user = $this->getUser()->getUser();
$mail->AddAddress($user->email, $user->name);
- if($mail->Send()) {
+ if ($mail->Send()) {
$this->addMessage(psm_get_lang('config', 'email_sent'), 'success');
} else {
- $this->addMessage(psm_get_lang('config', 'email_error') . ': ' . $mail->ErrorInfo, 'error');
+ $this->addMessage(psm_get_lang('config', 'email_error').': '.$mail->ErrorInfo, 'error');
}
}
@@ -252,14 +252,14 @@ class ConfigController extends AbstractController {
*/
protected function testSMS() {
$sms = psm_build_sms();
- if($sms) {
+ if ($sms) {
$user = $this->getUser()->getUser();
- if(empty($user->mobile)) {
+ if (empty($user->mobile)) {
$this->addMessage(psm_get_lang('config', 'sms_error_nomobile'), 'error');
} else {
$sms->addRecipients($user->mobile);
$result = $sms->sendSMS(psm_get_lang('config', 'test_message'));
- if($result === 1) {
+ if ($result === 1) {
$this->addMessage(psm_get_lang('config', 'sms_sent'), 'success');
} else {
$this->addMessage(sprintf(psm_get_lang('config', 'sms_error'), $result), 'error');
@@ -279,24 +279,24 @@ class ConfigController extends AbstractController {
$user = $this->getUser()->getUser();
$apiToken = psm_get_conf('pushover_api_token');
- if(empty($apiToken)) {
+ if (empty($apiToken)) {
$this->addMessage(psm_get_lang('config', 'pushover_error_noapp'), 'error');
- } elseif(empty($user->pushover_key)) {
+ } elseif (empty($user->pushover_key)) {
$this->addMessage(psm_get_lang('config', 'pushover_error_nokey'), 'error');
} else {
$pushover->setPriority(0);
$pushover->setTitle(psm_get_lang('config', 'test_subject'));
$pushover->setMessage(psm_get_lang('config', 'test_message'));
$pushover->setUser($user->pushover_key);
- if($user->pushover_device != '') {
+ if ($user->pushover_device != '') {
$pushover->setDevice($user->pushover_device);
}
$result = $pushover->send();
- if(isset($result['output']->status) && $result['output']->status == 1) {
+ if (isset($result['output']->status) && $result['output']->status == 1) {
$this->addMessage(psm_get_lang('config', 'pushover_sent'), 'success');
} else {
- if(isset($result['output']->errors->error)) {
+ if (isset($result['output']->errors->error)) {
$error = $result['output']->errors->error;
} else {
$error = 'Unknown';
@@ -307,18 +307,18 @@ class ConfigController extends AbstractController {
}
/**
- * Execute telegram test
- *
- * @todo move test to separate class
- */
+ * Execute telegram test
+ *
+ * @todo move test to separate class
+ */
protected function testTelegram() {
$telegram = psm_build_telegram();
$user = $this->getUser()->getUser();
$apiToken = psm_get_conf('telegram_api_token');
- if(empty($apiToken)) {
+ if (empty($apiToken)) {
$this->addMessage(psm_get_lang('config', 'telegram_error_notoken'), 'error');
- } elseif(empty($user->telegram_id)) {
+ } elseif (empty($user->telegram_id)) {
$this->addMessage(psm_get_lang('config', 'telegram_error_noid'), 'error');
} else {
$telegram->setMessage(psm_get_lang('config', 'test_message'));
@@ -326,10 +326,10 @@ class ConfigController extends AbstractController {
$result = $telegram->send();
- if(isset($result['ok']) && $result['ok'] != false) {
+ if (isset($result['ok']) && $result['ok'] != false) {
$this->addMessage(psm_get_lang('config', 'telegram_sent'), 'success');
} else {
- if(isset($result['description'])) {
+ if (isset($result['description'])) {
$error = $result['description'];
} else {
$error = 'Unknown';
diff --git a/src/psm/Module/Error/ErrorModule.php b/src/psm/Module/Error/ErrorModule.php
index 434831d5..52496e22 100644
--- a/src/psm/Module/Error/ErrorModule.php
+++ b/src/psm/Module/Error/ErrorModule.php
@@ -39,7 +39,7 @@ class ErrorModule implements ModuleInterface {
public function getControllers() {
return array(
- 'error' => __NAMESPACE__ . '\Controller\ErrorController',
+ 'error' => __NAMESPACE__.'\Controller\ErrorController',
);
}
diff --git a/src/psm/Module/Install/Controller/InstallController.php b/src/psm/Module/Install/Controller/InstallController.php
index b9a9c0eb..09b5c606 100644
--- a/src/psm/Module/Install/Controller/InstallController.php
+++ b/src/psm/Module/Install/Controller/InstallController.php
@@ -51,8 +51,8 @@ class InstallController extends AbstractController {
$this->setCSRFKey('install');
$this->addMenu(false);
- $this->path_config = PSM_PATH_SRC . '../config.php';
- $this->path_config_old = PSM_PATH_SRC . '../config.inc.php';
+ $this->path_config = PSM_PATH_SRC.'../config.php';
+ $this->path_config_old = PSM_PATH_SRC.'../config.inc.php';
$this->setActions(array(
'index', 'config', 'install'
@@ -69,27 +69,27 @@ class InstallController extends AbstractController {
$errors = 0;
$phpv = phpversion();
- if(version_compare($phpv, '5.3.7', '<')) {
+ if (version_compare($phpv, '5.3.7', '<')) {
$errors++;
$this->addMessage('PHP 5.3.7+ is required to run PHP Server Monitor.', 'error');
} else {
- $this->addMessage('PHP version: ' . $phpv, 'success');
+ $this->addMessage('PHP version: '.$phpv, 'success');
}
- if(!function_exists('curl_init')) {
+ if (!function_exists('curl_init')) {
$this->addMessage('PHP is installed without the cURL module. Please install cURL.', 'warning');
} else {
$this->addMessage('PHP cURL module found', 'success');
}
- if(!in_array('mysql', \PDO::getAvailableDrivers())) {
+ if (!in_array('mysql', \PDO::getAvailableDrivers())) {
$errors++;
$this->addMessage('The PDO MySQL driver needs to be installed.', 'error');
}
- if(!ini_get('date.timezone')) {
+ if (!ini_get('date.timezone')) {
$this->addMessage('You should set a timezone in your php.ini file (e.g. \'date.timezone = UTC\'). See this page for more info.', 'warning');
}
- if($errors > 0) {
- $this->addMessage($errors . ' error(s) have been encountered. Please fix them and refresh this page.', 'error');
+ if ($errors > 0) {
+ $this->addMessage($errors.' error(s) have been encountered. Please fix them and refresh this page.', 'error');
}
return $this->twig->render('module/install/index.tpl.html', array(
@@ -104,13 +104,13 @@ class InstallController extends AbstractController {
$tpl_name = 'module/install/config_new.tpl.html';
$tpl_data = array();
- if(!defined('PSM_DB_PREFIX')) {
+ if (!defined('PSM_DB_PREFIX')) {
// first detect "old" config file (2.0)
- if(file_exists($this->path_config_old)) {
+ if (file_exists($this->path_config_old)) {
// oldtimer huh
$this->addMessage('Configuration file for v2.0 found.', 'success');
$this->addMessage(
- 'The location of the config file has been changed since v2.0.
' .
+ 'The location of the config file has been changed since v2.0.
'.
'We will attempt to create a new config file for you.'
, 'warning');
$values = $this->parseConfig20();
@@ -130,8 +130,8 @@ class InstallController extends AbstractController {
);
$changed = false;
- foreach($config as $ckey => &$cvalue) {
- if(isset($values[$ckey])) {
+ foreach ($config as $ckey => &$cvalue) {
+ if (isset($values[$ckey])) {
$changed = true;
$cvalue = $values[$ckey];
}
@@ -139,20 +139,20 @@ class InstallController extends AbstractController {
// add config to template data for prefilling the form
$tpl_data = $config;
- if($changed) {
+ if ($changed) {
// test db connection
$this->db = new \psm\Service\Database(
$config['db_host'],
$config['db_user'],
$config['db_pass'],
$config['db_name'],
- $config['db_port']
+ $config['db_port']
);
- if($this->db->status()) {
+ if ($this->db->status()) {
$this->addMessage('Connection to MySQL successful.', 'success');
$config_php = $this->writeConfigFile($config);
- if($config_php === true) {
+ if ($config_php === true) {
$this->addMessage('Configuration file written successfully.', 'success');
} else {
$this->addMessage('Config file is not writable, we cannot save it for you.', 'error');
@@ -165,11 +165,11 @@ class InstallController extends AbstractController {
}
}
- if(defined('PSM_DB_PREFIX')) {
- if($this->db->status()) {
- if($this->isUpgrade()) {
+ if (defined('PSM_DB_PREFIX')) {
+ if ($this->db->status()) {
+ if ($this->isUpgrade()) {
// upgrade
- if(version_compare($this->getPreviousVersion(), '3.0.0', '<')) {
+ if (version_compare($this->getPreviousVersion(), '3.0.0', '<')) {
// upgrade from before 3.0, does not have passwords yet.. create new user first
$this->addMessage('Your current version does not have an authentication system, but since v3.0 access to the monitor is restricted by user accounts. Please set up a new account to be able to login after the upgrade, and which you can use to change the passwords for your other accounts.', 'info');
$tpl_name = 'module/install/config_new_user.tpl.html';
@@ -196,7 +196,7 @@ class InstallController extends AbstractController {
* Execute the install and upgrade process to a newer version
*/
protected function executeInstall() {
- if(!defined('PSM_DB_PREFIX') || !$this->db->status()) {
+ if (!defined('PSM_DB_PREFIX') || !$this->db->status()) {
return $this->executeConfig();
}
$add_user = false;
@@ -222,23 +222,23 @@ class InstallController extends AbstractController {
$logger = array($this, 'addMessage');
$installer = new \psm\Util\Install\Installer($this->db, $logger);
- if($this->isUpgrade()) {
+ if ($this->isUpgrade()) {
$this->addMessage('Upgrade process started.', 'info');
$version_from = $this->getPreviousVersion();
- if($version_from === false) {
+ if ($version_from === false) {
$this->addMessage('Unable to locate your previous version. Please run a fresh install.', 'error');
} else {
- if(version_compare($version_from, PSM_VERSION, '=')) {
+ if (version_compare($version_from, PSM_VERSION, '=')) {
$this->addMessage('Your installation is already at the latest version.', 'success');
- } elseif(version_compare($version_from, PSM_VERSION, '>')) {
+ } elseif (version_compare($version_from, PSM_VERSION, '>')) {
$this->addMessage('This installer does not support downgrading, sorry.', 'error');
} else {
- $this->addMessage('Upgrading from ' . $version_from . ' to ' . PSM_VERSION, 'info');
+ $this->addMessage('Upgrading from '.$version_from.' to '.PSM_VERSION, 'info');
$installer->upgrade($version_from, PSM_VERSION);
}
- if(version_compare($version_from, '3.0.0', '<')) {
+ if (version_compare($version_from, '3.0.0', '<')) {
$add_user = true;
}
}
@@ -248,8 +248,8 @@ class InstallController extends AbstractController {
$validator->username_new($new_user['user_name']);
$validator->email($new_user['email']);
$validator->password($new_user['password'], $new_user['password_repeat']);
- } catch(\InvalidArgumentException $e) {
- $this->addMessage(psm_get_lang('users', 'error_' . $e->getMessage()), 'error');
+ } catch (\InvalidArgumentException $e) {
+ $this->addMessage(psm_get_lang('users', 'error_'.$e->getMessage()), 'error');
return $this->executeConfig();
}
@@ -259,10 +259,10 @@ class InstallController extends AbstractController {
$add_user = true;
}
- if($add_user) {
+ if ($add_user) {
unset($new_user['password_repeat']);
$user_id = $this->db->save(PSM_DB_PREFIX.'users', $new_user);
- if(intval($user_id) > 0) {
+ if (intval($user_id) > 0) {
$this->getUser()->changePassword($user_id, $new_user['password']);
$this->addMessage('User account has been created successfully.', 'success');
} else {
@@ -283,7 +283,7 @@ class InstallController extends AbstractController {
protected function writeConfigFile($array_config) {
$config = " $value) {
+ foreach ($array_config as $key => $value) {
$line = "define('PSM_{key}', '{value}');".PHP_EOL;
$line = str_replace(
array('{key}', '{value}'),
@@ -292,7 +292,7 @@ class InstallController extends AbstractController {
);
$config .= $line;
}
- if(is_writeable($this->path_config)) {
+ if (is_writeable($this->path_config)) {
file_put_contents($this->path_config, $config);
return true;
} else {
@@ -316,7 +316,7 @@ class InstallController extends AbstractController {
);
$pattern = "/define\('SM_{key}', '(.*?)'/u";
- foreach($vars as $key => $value) {
+ foreach ($vars as $key => $value) {
$pattern_key = str_replace('{key}', strtoupper($key), $pattern);
preg_match($pattern_key, $config_old, $value_matches);
$vars[$key] = (isset($value_matches[1])) ? $value_matches[1] : '';
@@ -329,7 +329,7 @@ class InstallController extends AbstractController {
* Is it an upgrade or install?
*/
protected function isUpgrade() {
- if(!$this->db->status()) {
+ if (!$this->db->status()) {
return false;
}
return $this->db->ifTableExists(PSM_DB_PREFIX.'config');
@@ -340,15 +340,15 @@ class InstallController extends AbstractController {
* @return boolean|string FALSE on failure, string otherwise
*/
protected function getPreviousVersion() {
- if(!$this->isUpgrade()) {
+ if (!$this->isUpgrade()) {
return false;
}
- $version_conf = $this->db->selectRow(PSM_DB_PREFIX . 'config', array('key' => 'version'), array('value'));
- if(empty($version_conf)) {
+ $version_conf = $this->db->selectRow(PSM_DB_PREFIX.'config', array('key' => 'version'), array('value'));
+ if (empty($version_conf)) {
return false;
} else {
$version_from = $version_conf['value'];
- if(strpos($version_from, '.') === false) {
+ if (strpos($version_from, '.') === false) {
// yeah, my bad.. previous version did not follow proper naming scheme
$version_from = rtrim(chunk_split($version_from, 1, '.'), '.');
}
@@ -363,6 +363,6 @@ class InstallController extends AbstractController {
protected function getBaseUrl() {
$sym_request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
- return $sym_request->getSchemeAndHttpHost() . $sym_request->getBasePath();
+ return $sym_request->getSchemeAndHttpHost().$sym_request->getBasePath();
}
}
diff --git a/src/psm/Module/Install/InstallModule.php b/src/psm/Module/Install/InstallModule.php
index 795f5498..cfd6c067 100644
--- a/src/psm/Module/Install/InstallModule.php
+++ b/src/psm/Module/Install/InstallModule.php
@@ -39,7 +39,7 @@ class InstallModule implements ModuleInterface {
public function getControllers() {
return array(
- 'install' => __NAMESPACE__ . '\Controller\InstallController',
+ 'install' => __NAMESPACE__.'\Controller\InstallController',
);
}
diff --git a/src/psm/Module/Server/Controller/AbstractServerController.php b/src/psm/Module/Server/Controller/AbstractServerController.php
index cc7a95a9..39dc3be8 100644
--- a/src/psm/Module/Server/Controller/AbstractServerController.php
+++ b/src/psm/Module/Server/Controller/AbstractServerController.php
@@ -45,16 +45,16 @@ abstract class AbstractServerController extends AbstractController {
$sql_join = '';
$sql_where = '';
- if($this->getUser()->getUserLevel() > PSM_USER_ADMIN) {
+ if ($this->getUser()->getUserLevel() > PSM_USER_ADMIN) {
// restrict by user_id
$sql_join = "JOIN `".PSM_DB_PREFIX."users_servers` AS `us` ON (
`us`.`user_id`={$this->getUser()->getUserId()}
AND `us`.`server_id`=`s`.`server_id`
)";
}
- if($server_id !== null) {
+ if ($server_id !== null) {
$server_id = intval($server_id);
- $sql_where ="WHERE `s`.`server_id`={$server_id} ";
+ $sql_where = "WHERE `s`.`server_id`={$server_id} ";
}
$sql = "SELECT
@@ -90,7 +90,7 @@ abstract class AbstractServerController extends AbstractController {
ORDER BY `active` ASC, `status` DESC, `label` ASC";
$servers = $this->db->query($sql);
- if($server_id !== null && count($servers) == 1) {
+ if ($server_id !== null && count($servers) == 1) {
$servers = $servers[0];
}
@@ -104,30 +104,30 @@ abstract class AbstractServerController extends AbstractController {
*/
protected function formatServer($server) {
$server['rtime'] = round((float) $server['rtime'], 4);
- $server['last_online'] = psm_timespan($server['last_online']);
- $server['last_offline'] = psm_timespan($server['last_offline']);
+ $server['last_online'] = psm_timespan($server['last_online']);
+ $server['last_offline'] = psm_timespan($server['last_offline']);
$server['last_offline_duration'] = "";
if ($server['last_offline'] != psm_get_lang('system', 'never')) {
$server['last_offline_duration'] = "(".$server['last_offline_duration'].")";
}
- $server['last_check'] = psm_timespan($server['last_check']);
+ $server['last_check'] = psm_timespan($server['last_check']);
$server['active'] = psm_get_lang('system', $server['active']);
$server['email'] = psm_get_lang('system', $server['email']);
$server['sms'] = psm_get_lang('system', $server['sms']);
$server['pushover'] = psm_get_lang('system', $server['pushover']);
$server['telegram'] = psm_get_lang('system', $server['telegram']);
- if($server['status'] == 'on' && $server['warning_threshold_counter'] > 0) {
+ if ($server['status'] == 'on' && $server['warning_threshold_counter'] > 0) {
$server['status'] = 'warning';
}
$server['error'] = htmlentities($server['error']);
- $server['type'] = psm_get_lang('servers', 'type_' . $server['type']);
+ $server['type'] = psm_get_lang('servers', 'type_'.$server['type']);
$server['timeout'] = ($server['timeout'] > 0) ? $server['timeout'] : PSM_CURL_TIMEOUT;
$url_actions = array('delete', 'edit', 'view');
- foreach($url_actions as $action) {
- $server['url_' . $action] = psm_build_url(array(
+ foreach ($url_actions as $action) {
+ $server['url_'.$action] = psm_build_url(array(
'mod' => 'server',
'action' => $action,
'id' => $server['server_id'],
diff --git a/src/psm/Module/Server/Controller/LogController.php b/src/psm/Module/Server/Controller/LogController.php
index d790b122..49bbff81 100644
--- a/src/psm/Module/Server/Controller/LogController.php
+++ b/src/psm/Module/Server/Controller/LogController.php
@@ -63,7 +63,7 @@ class LogController extends AbstractServerController {
'tabs' => array(),
);
- if($this->getUser()->getUserLevel() == PSM_USER_ADMIN) {
+ if ($this->getUser()->getUserLevel() == PSM_USER_ADMIN) {
$modal = new \psm\Util\Module\Modal($this->twig, 'delete', \psm\Util\Module\Modal::MODAL_TYPE_DANGER);
$this->addModal($modal);
$modal->setTitle(psm_get_lang('log', 'delete_title'));
@@ -74,7 +74,7 @@ class LogController extends AbstractServerController {
$log_types = array('status', 'email', 'sms', 'pushover', 'telegram');
- foreach($log_types as $key) {
+ foreach ($log_types as $key) {
$records = $this->getEntries($key);
$log_count = count($records);
@@ -91,21 +91,21 @@ class LogController extends AbstractServerController {
$record['users'] = '';
$record['server'] = $record['label'];
$record['type_icon'] = ($record['server_type'] == 'website') ? 'icon-globe' : 'icon-cog';
- $record['type_title'] = psm_get_lang('servers', 'type_' . $record['server_type']);
- $ip = '(' . $record['ip'];
- if(!empty($record['port']) && (($record['server_type'] != 'website') || ($record['port'] != 80))) {
- $ip .= ':' . $record['port'];
+ $record['type_title'] = psm_get_lang('servers', 'type_'.$record['server_type']);
+ $ip = '('.$record['ip'];
+ if (!empty($record['port']) && (($record['server_type'] != 'website') || ($record['port'] != 80))) {
+ $ip .= ':'.$record['port'];
}
$ip .= ')';
$record['ip'] = $ip;
$record['datetime_format'] = psm_date($record['datetime']);
// fix up user list
- $users = $this->getLogUsers($record['log_id']);
- if(!empty($users)) {
+ $users = $this->getLogUsers($record['log_id']);
+ if (!empty($users)) {
$names = array();
- foreach($users as $user) {
- $names[] = $user['name'];
+ foreach ($users as $user) {
+ $names[] = $user['name'];
}
$record['users'] = implode('
', $names);
$record['user_list'] = implode(' • ', $names);
@@ -126,7 +126,7 @@ class LogController extends AbstractServerController {
* Empty table log and log_users.
* Only when user is admin.
*/
- if($this->getUser()->getUserLevel() == PSM_USER_ADMIN) {
+ if ($this->getUser()->getUserLevel() == PSM_USER_ADMIN) {
$archiver = new \psm\Util\Server\Archiver\LogsArchiver($this->db);
$archiver->cleanupall();
}
@@ -141,7 +141,7 @@ class LogController extends AbstractServerController {
*/
public function getEntries($type) {
$sql_join = '';
- if($this->getUser()->getUserLevel() > PSM_USER_ADMIN) {
+ if ($this->getUser()->getUserLevel() > PSM_USER_ADMIN) {
// restrict by user_id
$sql_join = "JOIN `".PSM_DB_PREFIX."users_servers` AS `us` ON (
`us`.`user_id`={$this->getUser()->getUserId()}
@@ -160,7 +160,7 @@ class LogController extends AbstractServerController {
'`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 .
+ $sql_join.
'WHERE `log`.`type`=\''.$type.'\' '.
'ORDER BY `datetime` DESC '.
'LIMIT 0,20'
@@ -168,21 +168,21 @@ 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
+ /**
+ * 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 . "
+ 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"
- );
- }
+ );
+ }
}
diff --git a/src/psm/Module/Server/Controller/ServerController.php b/src/psm/Module/Server/Controller/ServerController.php
index c7e25b5c..fd2aa8c1 100644
--- a/src/psm/Module/Server/Controller/ServerController.php
+++ b/src/psm/Module/Server/Controller/ServerController.php
@@ -66,7 +66,7 @@ class ServerController extends AbstractServerController {
$this->setSidebar($sidebar);
// check if user is admin, in that case we add the buttons
- if($this->getUser()->getUserLevel() == PSM_USER_ADMIN) {
+ if ($this->getUser()->getUserLevel() == PSM_USER_ADMIN) {
$modal = new \psm\Util\Module\Modal($this->twig, 'delete', \psm\Util\Module\Modal::MODAL_TYPE_DANGER);
$this->addModal($modal);
$modal->setTitle(psm_get_lang('servers', 'delete_title'));
@@ -101,26 +101,26 @@ class ServerController extends AbstractServerController {
for ($x = 0; $x < $server_count; $x++) {
$servers[$x]['class'] = ($x & 1) ? 'odd' : 'even';
- if($servers[$x]['type'] == 'website') {
+ if ($servers[$x]['type'] == 'website') {
$servers[$x]['type_icon'] = 'icon-globe';
// add link to label
$ip = $servers[$x]['ip'];
- if(!empty($servers[$x]['port']) && ($servers[$x]['port'] != 80)) {
- $ip .= ' : ' . $servers[$x]['port'];
+ if (!empty($servers[$x]['port']) && ($servers[$x]['port'] != 80)) {
+ $ip .= ' : '.$servers[$x]['port'];
}
$servers[$x]['ip'] = ''.$ip.'';
$servers[$x]['ip_short'] = $ip;
} else {
$servers[$x]['type_icon'] = 'icon-cog';
- $servers[$x]['ip_short'] = $servers[$x]['ip'] . ' : ' . $servers[$x]['port'];
+ $servers[$x]['ip_short'] = $servers[$x]['ip'].' : '.$servers[$x]['port'];
}
- if(($servers[$x]['active'] == 'yes')) {
+ if (($servers[$x]['active'] == 'yes')) {
$servers[$x]['active_icon'] = 'icon-eye-open';
$servers[$x]['active_title'] = psm_get_lang('servers', 'monitoring');
- foreach($icons as $i_id => $i_icon) {
- if(psm_get_conf($i_id . '_status') && $servers[$x][$i_id] == 'yes') {
- $servers[$x][$i_id . '_icon'] = $i_icon;
+ foreach ($icons as $i_id => $i_icon) {
+ if (psm_get_conf($i_id.'_status') && $servers[$x][$i_id] == 'yes') {
+ $servers[$x][$i_id.'_icon'] = $i_icon;
}
}
} else {
@@ -150,7 +150,7 @@ class ServerController extends AbstractServerController {
));
// depending on where the user came from, add the go back url:
- if($back_to == 'view' && $this->server_id > 0) {
+ if ($back_to == 'view' && $this->server_id > 0) {
$tpl_data['url_go_back'] = psm_build_url(array('mod' => 'server', 'action' => 'view', 'id' => $this->server_id));
} else {
$tpl_data['url_go_back'] = psm_build_url(array('mod' => 'server'));
@@ -158,7 +158,7 @@ class ServerController extends AbstractServerController {
$tpl_data['users'] = $this->db->select(PSM_DB_PREFIX.'users', null, array('user_id', 'name'), '', 'name');
- switch($this->server_id) {
+ switch ($this->server_id) {
case 0:
// insert mode
$tpl_data['titlemode'] = psm_get_lang('system', 'insert');
@@ -170,15 +170,15 @@ class ServerController extends AbstractServerController {
// edit mode
// get server entry
$edit_server = $this->getServers($this->server_id);
- if(empty($edit_server)) {
+ if (empty($edit_server)) {
$this->addMessage(psm_get_lang('servers', 'error_server_no_match'), 'error');
return $this->runAction('index');
}
- $tpl_data['titlemode'] = psm_get_lang('system', 'edit') . ' ' . $edit_server['label'];
+ $tpl_data['titlemode'] = psm_get_lang('system', 'edit').' '.$edit_server['label'];
$user_idc_selected = $this->getServerUsers($this->server_id);
- foreach($tpl_data['users'] as &$user) {
- if(in_array($user['user_id'], $user_idc_selected)) {
+ foreach ($tpl_data['users'] as &$user) {
+ if (in_array($user['user_id'], $user_idc_selected)) {
$user['edit_selected'] = 'selected="selected"';
}
}
@@ -186,9 +186,9 @@ class ServerController extends AbstractServerController {
break;
}
- if(!empty($edit_server)) {
+ if (!empty($edit_server)) {
// attempt to prefill previously posted fields
- foreach($edit_server as $key => $value) {
+ foreach ($edit_server as $key => $value) {
$edit_server[$key] = psm_POST($key, $value);
}
@@ -199,31 +199,31 @@ class ServerController extends AbstractServerController {
'edit_value_timeout' => $edit_server['timeout'],
'default_value_timeout' => PSM_CURL_TIMEOUT,
'edit_value_pattern' => $edit_server['pattern'],
- 'edit_pattern_selected_' . $edit_server['pattern_online'] => 'selected="selected"',
+ 'edit_pattern_selected_'.$edit_server['pattern_online'] => 'selected="selected"',
'edit_value_header_name' => $edit_server['header_name'],
'edit_value_header_value' => $edit_server['header_value'],
'edit_value_warning_threshold' => $edit_server['warning_threshold'],
'edit_website_username' => $edit_server['website_username'],
'edit_website_password' => empty($edit_server['website_password']) ? '' : sha1($edit_server['website_password']),
- 'edit_type_selected_' . $edit_server['type'] => 'selected="selected"',
- 'edit_active_selected_' . $edit_server['active'] => 'selected="selected"',
- 'edit_email_selected_' . $edit_server['email'] => 'selected="selected"',
- 'edit_sms_selected_' . $edit_server['sms'] => 'selected="selected"',
- 'edit_pushover_selected_' . $edit_server['pushover'] => 'selected="selected"',
- 'edit_telegram_selected_' . $edit_server['telegram'] => 'selected="selected"',
+ 'edit_type_selected_'.$edit_server['type'] => 'selected="selected"',
+ 'edit_active_selected_'.$edit_server['active'] => 'selected="selected"',
+ 'edit_email_selected_'.$edit_server['email'] => 'selected="selected"',
+ 'edit_sms_selected_'.$edit_server['sms'] => 'selected="selected"',
+ 'edit_pushover_selected_'.$edit_server['pushover'] => 'selected="selected"',
+ 'edit_telegram_selected_'.$edit_server['telegram'] => 'selected="selected"',
));
}
$notifications = array('email', 'sms', 'pushover', 'telegram');
- foreach($notifications as $notification) {
- if(psm_get_conf($notification . '_status') == 0) {
- $tpl_data['warning_' . $notification] = true;
- $tpl_data['control_class_' . $notification] = 'warning';
- $tpl_data['label_warning_' . $notification] = psm_get_lang(
- 'servers', 'warning_notifications_disabled_' . $notification
+ foreach ($notifications as $notification) {
+ if (psm_get_conf($notification.'_status') == 0) {
+ $tpl_data['warning_'.$notification] = true;
+ $tpl_data['control_class_'.$notification] = 'warning';
+ $tpl_data['label_warning_'.$notification] = psm_get_lang(
+ 'servers', 'warning_notifications_disabled_'.$notification
);
} else {
- $tpl_data['warning_' . $notification] = false;
+ $tpl_data['warning_'.$notification] = false;
}
}
@@ -239,25 +239,25 @@ class ServerController extends AbstractServerController {
return $this->executeIndex();
}
- $encrypted_password = '';
+ $encrypted_password = '';
- if ( !empty( $_POST['website_password'] )) {
- $new_password = psm_POST('website_password');
+ if (!empty($_POST['website_password'])) {
+ $new_password = psm_POST('website_password');
- if ($this->server_id > 0) {
- $edit_server = $this->getServers($this->server_id);
- $hash = sha1($edit_server['website_password']);
+ if ($this->server_id > 0) {
+ $edit_server = $this->getServers($this->server_id);
+ $hash = sha1($edit_server['website_password']);
- if ($new_password == $hash) {
- $encrypted_password = $edit_server['website_password'];
- } else {
- $encrypted_password = psm_password_encrypt($this->server_id . psm_get_conf('password_encrypt_key'), $new_password);
- }
- } else {
- // We need the server id to encrypt the password. Encryption will be done after the server is added
- $encrypted_password = '';
- }
- }
+ if ($new_password == $hash) {
+ $encrypted_password = $edit_server['website_password'];
+ } else {
+ $encrypted_password = psm_password_encrypt($this->server_id.psm_get_conf('password_encrypt_key'), $new_password);
+ }
+ } else {
+ // We need the server id to encrypt the password. Encryption will be done after the server is added
+ $encrypted_password = '';
+ }
+ }
$clean = array(
'label' => trim(strip_tags(psm_POST('label', ''))),
@@ -280,42 +280,42 @@ class ServerController extends AbstractServerController {
'telegram' => in_array($_POST['telegram'], array('yes', 'no')) ? $_POST['telegram'] : 'no',
);
// make sure websites start with http://
- if($clean['type'] == 'website' && substr($clean['ip'], 0, 4) != 'http') {
- $clean['ip'] = 'http://' . $clean['ip'];
+ if ($clean['type'] == 'website' && substr($clean['ip'], 0, 4) != 'http') {
+ $clean['ip'] = 'http://'.$clean['ip'];
}
// validate the lot
$server_validator = new \psm\Util\Server\ServerValidator($this->db);
// format port from http/s url
- if($clean['type'] == 'website' && empty($clean['port'])) {
- $tmp = parse_url($clean["ip"]);
- if(isset($tmp["port"])) {
- $clean["port"] = $tmp["port"];
- } elseif ($tmp["scheme"] === "https") {
- $clean["port"] = 443;
- } elseif ($tmp["scheme"] === "http") {
- $clean["port"] = 80;
- } elseif ($tmp["scheme"] === "rdp") {
- $clean["port"] = 3389;
- }
+ if ($clean['type'] == 'website' && empty($clean['port'])) {
+ $tmp = parse_url($clean["ip"]);
+ if (isset($tmp["port"])) {
+ $clean["port"] = $tmp["port"];
+ } elseif ($tmp["scheme"] === "https") {
+ $clean["port"] = 443;
+ } elseif ($tmp["scheme"] === "http") {
+ $clean["port"] = 80;
+ } elseif ($tmp["scheme"] === "rdp") {
+ $clean["port"] = 3389;
+ }
}
try {
- if($this->server_id > 0) {
+ if ($this->server_id > 0) {
$server_validator->serverId($this->server_id);
}
$server_validator->label($clean['label']);
$server_validator->type($clean['type']);
$server_validator->ip($clean['ip'], $clean['type']);
$server_validator->warningThreshold($clean['warning_threshold']);
- } catch(\InvalidArgumentException $ex) {
- $this->addMessage(psm_get_lang('servers', 'error_' . $ex->getMessage()), 'error');
+ } catch (\InvalidArgumentException $ex) {
+ $this->addMessage(psm_get_lang('servers', 'error_'.$ex->getMessage()), 'error');
return $this->executeEdit();
}
// check for edit or add
- if($this->server_id > 0) {
+ if ($this->server_id > 0) {
// edit
$this->db->save(
PSM_DB_PREFIX.'servers',
@@ -332,13 +332,13 @@ class ServerController extends AbstractServerController {
if (!empty($_POST['website_password'])) {
$cleanWebsitePassword = array(
'website_password' => psm_password_encrypt(
- $this->server_id . psm_get_conf('password_encrypt_key'),
+ $this->server_id.psm_get_conf('password_encrypt_key'),
psm_POST('website_password')
),
);
$this->db->save(
- PSM_DB_PREFIX . 'servers',
+ PSM_DB_PREFIX.'servers',
$cleanWebsitePassword,
array('server_id' => $this->server_id)
);
@@ -351,20 +351,20 @@ class ServerController extends AbstractServerController {
$user_idc = psm_POST('user_id', array());
$user_idc_save = array();
- foreach($user_idc as $user_id) {
+ foreach ($user_idc as $user_id) {
$user_idc_save[] = array(
'user_id' => intval($user_id),
'server_id' => intval($this->server_id),
);
}
$this->db->delete(PSM_DB_PREFIX.'users_servers', array('server_id' => $this->server_id));
- if(!empty($user_idc_save)) {
+ if (!empty($user_idc_save)) {
// add all new users
$this->db->insertMultiple(PSM_DB_PREFIX.'users_servers', $user_idc_save);
}
$back_to = isset($_GET['back_to']) ? $_GET['back_to'] : 'index';
- if($back_to == 'view') {
+ if ($back_to == 'view') {
return $this->runAction('view');
} else {
return $this->runAction('index');
@@ -375,12 +375,12 @@ class ServerController extends AbstractServerController {
* Executes the deletion of one of the servers
*/
protected function executeDelete() {
- if(isset($_GET['id'])) {
+ if (isset($_GET['id'])) {
$id = intval($_GET['id']);
// do delete
- $res = $this->db->delete(PSM_DB_PREFIX . 'servers', array('server_id' => $id));
+ $res = $this->db->delete(PSM_DB_PREFIX.'servers', array('server_id' => $id));
- if($res === 1) {
+ if ($res === 1) {
$this->db->delete(PSM_DB_PREFIX.'log', array('server_id' => $id));
$this->db->delete(PSM_DB_PREFIX.'users_servers', array('server_id' => $id));
$this->db->delete(PSM_DB_PREFIX.'servers_uptime', array('server_id' => $id));
@@ -395,12 +395,12 @@ class ServerController extends AbstractServerController {
* Prepare the view template
*/
protected function executeView() {
- if($this->server_id == 0) {
+ if ($this->server_id == 0) {
return $this->runAction('index');
}
$server = $this->getServers($this->server_id);
- if(empty($server)) {
+ if (empty($server)) {
return $this->runAction('index');
}
@@ -412,7 +412,7 @@ class ServerController extends AbstractServerController {
$tpl_data['html_history'] = $history->createHTML($this->server_id);
// add edit/delete buttons for admins
- if($this->getUser()->getUserLevel() == PSM_USER_ADMIN) {
+ if ($this->getUser()->getUserLevel() == PSM_USER_ADMIN) {
$tpl_data['has_admin_actions'] = true;
$tpl_data['url_edit'] = psm_build_url(array('mod' => 'server', 'action' => 'edit', 'id' => $this->server_id, 'back_to' => 'view'));
@@ -426,7 +426,7 @@ class ServerController extends AbstractServerController {
// add all available servers to the menu
$servers = $this->getServers();
$tpl_data['options'] = array();
- foreach($servers as $i => $server_available) {
+ foreach ($servers as $i => $server_available) {
$tpl_data['options'][] = array(
'class_active' => ($server_available['server_id'] == $this->server_id) ? 'active' : '',
'url' => psm_build_url(array('mod' => 'server', 'action' => 'view', 'id' => $server_available['server_id'])),
@@ -517,7 +517,7 @@ class ServerController extends AbstractServerController {
array('user_id')
);
$result = array();
- foreach($users as $user) {
+ foreach ($users as $user) {
$result[] = $user['user_id'];
}
return $result;
diff --git a/src/psm/Module/Server/Controller/StatusController.php b/src/psm/Module/Server/Controller/StatusController.php
index 12c3ba2f..e4a124bf 100644
--- a/src/psm/Module/Server/Controller/StatusController.php
+++ b/src/psm/Module/Server/Controller/StatusController.php
@@ -71,7 +71,7 @@ class StatusController extends AbstractServerController {
$layout_data['servers_online'] = array();
foreach ($servers as $server) {
- if($server['active'] == 'no') {
+ if ($server['active'] == 'no') {
continue;
}
$server['last_checked_nice'] = psm_timespan($server['last_check']);
@@ -85,7 +85,7 @@ class StatusController extends AbstractServerController {
if ($server['status'] == "off") {
$layout_data['servers_offline'][] = $server;
- } elseif($server['warning_threshold_counter'] > 0) {
+ } elseif ($server['warning_threshold_counter'] > 0) {
$server['class_warning'] = 'warning';
$layout_data['servers_offline'][] = $server;
} else {
@@ -94,12 +94,12 @@ class StatusController extends AbstractServerController {
}
$auto_refresh_seconds = psm_get_conf('auto_refresh_servers');
- if(intval($auto_refresh_seconds) > 0) {
+ if (intval($auto_refresh_seconds) > 0) {
$this->twig->addGlobal('auto_refresh', true);
$this->twig->addGlobal('auto_refresh_seconds', $auto_refresh_seconds);
}
- if($this->isXHR() || isset($_SERVER["HTTP_X_REQUESTED_WITH"])) {
+ if ($this->isXHR() || isset($_SERVER["HTTP_X_REQUESTED_WITH"])) {
$this->xhr = true;
//disable auto refresh in ajax return html
$layout_data["auto_refresh"] = 0;
@@ -109,7 +109,7 @@ class StatusController extends AbstractServerController {
}
protected function executeSaveLayout() {
- if($this->isXHR()) {
+ if ($this->isXHR()) {
$layout = psm_POST('layout', 0);
$this->getUser()->setUserPref('status_layout', $layout);
diff --git a/src/psm/Module/Server/Controller/UpdateController.php b/src/psm/Module/Server/Controller/UpdateController.php
index 8162d5c6..4080f5d1 100644
--- a/src/psm/Module/Server/Controller/UpdateController.php
+++ b/src/psm/Module/Server/Controller/UpdateController.php
@@ -43,7 +43,7 @@ class UpdateController extends AbstractController {
$autorun = $this->container->get('util.server.updatemanager');
$autorun->run();
- header('Location: ' . psm_build_url(array(
+ header('Location: '.psm_build_url(array(
'mod' => 'server_status'
), true, false));
trigger_error("Redirect failed.", E_USER_ERROR);
diff --git a/src/psm/Module/Server/ServerModule.php b/src/psm/Module/Server/ServerModule.php
index ef1ded99..44a5b06e 100644
--- a/src/psm/Module/Server/ServerModule.php
+++ b/src/psm/Module/Server/ServerModule.php
@@ -39,10 +39,10 @@ class ServerModule implements ModuleInterface {
public function getControllers() {
return array(
- 'server' => __NAMESPACE__ . '\Controller\ServerController',
- 'log' => __NAMESPACE__ . '\Controller\LogController',
- 'status' => __NAMESPACE__ . '\Controller\StatusController',
- 'update' => __NAMESPACE__ . '\Controller\UpdateController',
+ 'server' => __NAMESPACE__.'\Controller\ServerController',
+ 'log' => __NAMESPACE__.'\Controller\LogController',
+ 'status' => __NAMESPACE__.'\Controller\StatusController',
+ 'update' => __NAMESPACE__.'\Controller\UpdateController',
);
}
diff --git a/src/psm/Module/User/Controller/LoginController.php b/src/psm/Module/User/Controller/LoginController.php
index 25487c87..a4fad4b5 100644
--- a/src/psm/Module/User/Controller/LoginController.php
+++ b/src/psm/Module/User/Controller/LoginController.php
@@ -45,7 +45,7 @@ class LoginController extends AbstractController {
}
protected function executeLogin() {
- if(isset($_POST['user_name']) && isset($_POST['user_password'])) {
+ if (isset($_POST['user_name']) && isset($_POST['user_password'])) {
$rememberme = (isset($_POST['user_rememberme'])) ? true : false;
$result = $this->getUser()->loginWithPostData(
$_POST['user_name'],
@@ -53,9 +53,9 @@ class LoginController extends AbstractController {
$rememberme
);
- if($result) {
+ if ($result) {
// success login, redirect
- header('Location: ' . psm_build_url($_SERVER['QUERY_STRING']));
+ header('Location: '.psm_build_url($_SERVER['QUERY_STRING']));
trigger_error("Redirect failed.", E_USER_ERROR);
} else {
$this->addMessage(psm_get_lang('login', 'error_login_incorrect'), 'error');
@@ -82,10 +82,10 @@ class LoginController extends AbstractController {
* @return string
*/
protected function executeForgot() {
- if(isset($_POST['user_name'])) {
+ if (isset($_POST['user_name'])) {
$user = $this->getUser()->getUserByUsername($_POST['user_name']);
- if(!empty($user)) {
+ if (!empty($user)) {
$token = $this->getUser()->generatePasswordResetToken($user->user_id);
// we have a token, send it along
$this->sendPasswordForgotMail(
@@ -118,18 +118,18 @@ class LoginController extends AbstractController {
$user_id = (isset($_GET['user_id'])) ? intval($_GET['user_id']) : 0;
$token = (isset($_GET['token'])) ? $_GET['token'] : '';
- if(!$service_user->verifyPasswordResetToken($user_id, $token)) {
+ if (!$service_user->verifyPasswordResetToken($user_id, $token)) {
$this->addMessage(psm_get_lang('login', 'error_reset_invalid_link'), 'error');
return $this->executeLogin();
}
- if(!empty($_POST['user_password_new']) && !empty($_POST['user_password_repeat'])) {
- if($_POST['user_password_new'] !== $_POST['user_password_repeat']) {
+ if (!empty($_POST['user_password_new']) && !empty($_POST['user_password_repeat'])) {
+ if ($_POST['user_password_new'] !== $_POST['user_password_repeat']) {
$this->addMessage(psm_get_lang('login', 'error_login_passwords_nomatch'), 'error');
} else {
$result = $service_user->changePassword($user_id, $_POST['user_password_new']);
- if($result) {
+ if ($result) {
$this->addMessage(psm_get_lang('login', 'success_password_reset'), 'success');
return $this->executeLogin();
} else {
@@ -151,15 +151,15 @@ class LoginController extends AbstractController {
return $this->twig->render('module/user/login/reset.tpl.html', $tpl_data);
}
- /**
- * Sends the password-reset-email.
+ /**
+ * Sends the password-reset-email.
* @param int $user_id
* @param string $user_email
* @param string $user_password_reset_hash
- */
- protected function sendPasswordForgotMail($user_id, $user_email, $user_password_reset_hash) {
+ */
+ protected function sendPasswordForgotMail($user_id, $user_email, $user_password_reset_hash) {
$mail = psm_build_mail();
- $mail->Subject = psm_get_lang('login' ,'password_reset_email_subject');
+ $mail->Subject = psm_get_lang('login', 'password_reset_email_subject');
$url = psm_build_url(array(
'action' => 'reset',
@@ -171,7 +171,7 @@ class LoginController extends AbstractController {
$mail->Body = $body;
$mail->AltBody = str_replace('
', "\n", $body);
- $mail->AddAddress($user_email);
- $mail->Send();
- }
+ $mail->AddAddress($user_email);
+ $mail->Send();
+ }
}
diff --git a/src/psm/Module/User/Controller/ProfileController.php b/src/psm/Module/User/Controller/ProfileController.php
index 03c6cf49..7570c72c 100644
--- a/src/psm/Module/User/Controller/ProfileController.php
+++ b/src/psm/Module/User/Controller/ProfileController.php
@@ -54,7 +54,7 @@ class ProfileController extends AbstractController {
$this->twig->addGlobal('subtitle', psm_get_lang('users', 'profile'));
$user = $this->getUser()->getUser(null, true);
- $modal = new \psm\Util\Module\Modal($this->twig, 'activate' . ucfirst('telegram'), \psm\Util\Module\Modal::MODAL_TYPE_OKCANCEL);
+ $modal = new \psm\Util\Module\Modal($this->twig, 'activate'.ucfirst('telegram'), \psm\Util\Module\Modal::MODAL_TYPE_OKCANCEL);
$this->addModal($modal);
$modal->setTitle(psm_get_lang('users', 'activate_telegram'));
$modal->setMessage(psm_get_lang('users', 'activate_telegram_description'));
@@ -85,10 +85,10 @@ class ProfileController extends AbstractController {
'mod' => 'user_profile',
'action' => 'save',
)),
- 'level' => psm_get_lang('users', 'level_' . $user->level),
+ 'level' => psm_get_lang('users', 'level_'.$user->level),
'placeholder_password' => psm_get_lang('users', 'password_leave_blank'),
);
- foreach($this->profile_fields as $field) {
+ foreach ($this->profile_fields as $field) {
$tpl_data[$field] = (isset($user->$field)) ? $user->$field : '';
}
return $this->twig->render('module/user/profile.tpl.html', $tpl_data);
@@ -98,7 +98,7 @@ class ProfileController extends AbstractController {
* Save the profile
*/
protected function executeSave() {
- if(empty($_POST)) {
+ if (empty($_POST)) {
// dont process anything if no data has been posted
return $this->executeIndex();
}
@@ -108,8 +108,8 @@ class ProfileController extends AbstractController {
$fields[] = 'password_repeat';
$clean = array();
- foreach($fields as $field) {
- if(isset($_POST[$field])) {
+ foreach ($fields as $field) {
+ if (isset($_POST[$field])) {
$clean[$field] = trim(strip_tags($_POST[$field]));
} else {
$clean[$field] = '';
@@ -123,14 +123,14 @@ class ProfileController extends AbstractController {
// always validate password for new users,
// but only validate it for existing users when they change it.
- if($clean['password'] != '') {
+ if ($clean['password'] != '') {
$validator->password($clean['password'], $clean['password_repeat']);
}
- } catch(\InvalidArgumentException $e) {
- $this->addMessage(psm_get_lang('users', 'error_' . $e->getMessage()), 'error');
+ } catch (\InvalidArgumentException $e) {
+ $this->addMessage(psm_get_lang('users', 'error_'.$e->getMessage()), 'error');
return $this->executeIndex();
}
- if(!empty($clean['password'])) {
+ if (!empty($clean['password'])) {
$password = $clean['password'];
}
unset($clean['password']);
@@ -141,11 +141,11 @@ class ProfileController extends AbstractController {
\psm\Module\User\UserEvents::USER_EDIT,
new \psm\Module\User\Event\UserEvent($this->getUser()->getUserId())
);
- if(isset($password)) {
+ if (isset($password)) {
$this->getUser()->changePassword($this->getUser()->getUserId(), $password);
}
$this->addMessage(psm_get_lang('users', 'profile_updated'), 'success');
- if(!empty($_POST['activate_telegram'])) {
+ if (!empty($_POST['activate_telegram'])) {
$this->activateTelegram();
}
return $this->executeIndex();
@@ -159,16 +159,16 @@ class ProfileController extends AbstractController {
$telegram = psm_build_telegram();
$apiToken = psm_get_conf('telegram_api_token');
- if(empty($apiToken)) {
+ if (empty($apiToken)) {
$this->addMessage(psm_get_lang('config', 'telegram_error_notoken'), 'error');
} else {
$result = $telegram->getBotUsername();
- if(isset($result['ok']) && $result['ok'] != false) {
+ if (isset($result['ok']) && $result['ok'] != false) {
$url = "https://t.me/".$result["result"]["username"];
$this->addMessage(sprintf(psm_get_lang('users', 'telegram_bot_username_found'), $url), 'success');
} else {
- if(isset($result['error_code']) && $result['error_code'] == 401) {
+ if (isset($result['error_code']) && $result['error_code'] == 401) {
$error = psm_get_lang('users', 'telegram_bot_username_error_token');
} elseif (isset($result['description'])) {
$error = $result['description'];
diff --git a/src/psm/Module/User/Controller/UserController.php b/src/psm/Module/User/Controller/UserController.php
index c44a9887..5c32cf5b 100644
--- a/src/psm/Module/User/Controller/UserController.php
+++ b/src/psm/Module/User/Controller/UserController.php
@@ -51,7 +51,7 @@ class UserController extends AbstractController {
public function run($action = NULL) {
$servers = $this->db->select(PSM_DB_PREFIX.'servers', null, array('server_id', 'label'), '', "ORDER BY `active` ASC, `status` DESC, `label` ASC");
// change the indexes to reflect their server ids
- foreach($servers as $server) {
+ foreach ($servers as $server) {
$this->servers[$server['server_id']] = $server;
}
@@ -94,16 +94,18 @@ class UserController extends AbstractController {
array('name')
);
- foreach($users as $x => &$user) {
+ foreach ($users as $x => &$user) {
$user_servers = $this->getUserServers($user['user_id']);
$user['class'] = ($x & 1) ? 'odd' : 'even';
- $user['level_text'] = psm_get_lang('users', 'level_' . $user['level']);
+ $user['level_text'] = psm_get_lang('users', 'level_'.$user['level']);
$user['emp_servers'] = array();
// fix server list
- foreach($user_servers as $server_id) {
- if (!isset($servers_labels[$server_id])) continue;
+ foreach ($user_servers as $server_id) {
+ if (!isset($servers_labels[$server_id])) {
+ continue;
+ }
$user['emp_servers'][] = array(
'label' => $servers_labels[$server_id]
);
@@ -135,7 +137,7 @@ class UserController extends AbstractController {
$user_id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$fields_prefill = array('name', 'user_name', 'mobile', 'pushover_key', 'pushover_device', 'telegram_id', 'email');
- if($user_id == 0) {
+ if ($user_id == 0) {
// insert mode
$title = psm_get_lang('system', 'insert');
$placeholder_password = '';
@@ -143,32 +145,32 @@ class UserController extends AbstractController {
// attempt to prefill previously posted fields
$edit_user = new \stdClass();
- foreach($fields_prefill as $field) {
+ foreach ($fields_prefill as $field) {
$edit_user->$field = (isset($_POST[$field])) ? $_POST[$field] : '';
}
// add inactive class to all servers
- foreach($this->servers as &$server) {
+ foreach ($this->servers as &$server) {
$server['class'] = 'inactive';
}
} else {
// edit mode
try {
$this->container->get('util.user.validator')->userId($user_id);
- } catch(\InvalidArgumentException $e) {
- $this->addMessage(psm_get_lang('users', 'error_' . $e->getMessage()), 'error');
+ } catch (\InvalidArgumentException $e) {
+ $this->addMessage(psm_get_lang('users', 'error_'.$e->getMessage()), 'error');
return $this->executeIndex();
}
$edit_user = $this->getUser()->getUser($user_id);
- $title = psm_get_lang('system', 'edit') . ' ' . $edit_user->name;
+ $title = psm_get_lang('system', 'edit').' '.$edit_user->name;
$placeholder_password = psm_get_lang('users', 'password_leave_blank');
$lvl_selected = $edit_user->level;
// select servers for this user
$user_servers = $this->getUserServers($user_id);
- foreach($this->servers as &$server) {
- if(in_array($server['server_id'], $user_servers)) {
+ foreach ($this->servers as &$server) {
+ if (in_array($server['server_id'], $user_servers)) {
$server['edit_selected'] = 'selected="selected"';
$server['class'] = 'active';
}
@@ -186,17 +188,17 @@ class UserController extends AbstractController {
'servers' => $this->servers,
'user_level' => $lvl_selected,
);
- foreach($fields_prefill as $field) {
- if(isset($edit_user->$field)) {
- $tpl_data['edit_value_' . $field] = $edit_user->$field;
+ foreach ($fields_prefill as $field) {
+ if (isset($edit_user->$field)) {
+ $tpl_data['edit_value_'.$field] = $edit_user->$field;
}
}
$tpl_data['levels'] = array();
- foreach($this->container->get('util.user.validator')->getUserLevels() as $lvl) {
+ foreach ($this->container->get('util.user.validator')->getUserLevels() as $lvl) {
$tpl_data['levels'][] = array(
'value' => $lvl,
- 'label' => psm_get_lang('users', 'level_' . $lvl),
+ 'label' => psm_get_lang('users', 'level_'.$lvl),
);
}
@@ -209,7 +211,7 @@ class UserController extends AbstractController {
* Executes the saving of a user
*/
protected function executeSave() {
- if(empty($_POST)) {
+ if (empty($_POST)) {
// dont process anything if no data has been posted
return $this->executeIndex();
}
@@ -217,8 +219,8 @@ class UserController extends AbstractController {
$fields = array('name', 'user_name', 'password', 'password_repeat', 'level', 'mobile', 'pushover_key', 'pushover_device', 'telegram_id', 'email');
$clean = array();
- foreach($fields as $field) {
- if(isset($_POST[$field])) {
+ foreach ($fields as $field) {
+ if (isset($_POST[$field])) {
$clean[$field] = trim(strip_tags($_POST[$field]));
} else {
$clean[$field] = '';
@@ -234,22 +236,22 @@ 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'] != '')) {
$user_validator->password($clean['password'], $clean['password_repeat']);
}
- if($user_id > 0) {
+ if ($user_id > 0) {
$user_validator->userId($user_id);
}
- } catch(\InvalidArgumentException $e) {
- $this->addMessage(psm_get_lang('users', 'error_' . $e->getMessage()), 'error');
+ } catch (\InvalidArgumentException $e) {
+ $this->addMessage(psm_get_lang('users', 'error_'.$e->getMessage()), 'error');
return $this->executeEdit();
}
- if(!empty($clean['password'])) {
+ if (!empty($clean['password'])) {
$password = $clean['password'];
}
unset($clean['password_repeat']);
- if($user_id > 0) {
+ if ($user_id > 0) {
// edit user
unset($clean['password']); // password update is executed separately
$this->db->save(PSM_DB_PREFIX.'users', $clean, array('user_id' => $user_id));
@@ -268,7 +270,7 @@ class UserController extends AbstractController {
$event,
new \psm\Module\User\Event\UserEvent($user_id, $this->getUser()->getUserId())
);
- if(isset($password)) {
+ if (isset($password)) {
$this->getUser()->changePassword($user_id, $password);
}
@@ -276,7 +278,7 @@ class UserController extends AbstractController {
$server_idc = psm_POST('server_id', array());
$server_idc_save = array();
- foreach($server_idc as $server_id) {
+ foreach ($server_idc as $server_id) {
$server_idc_save[] = array(
'user_id' => $user_id,
'server_id' => intval($server_id),
@@ -284,7 +286,7 @@ class UserController extends AbstractController {
}
// delete all existing records
$this->db->delete(PSM_DB_PREFIX.'users_servers', array('user_id' => $user_id));
- if(!empty($server_idc_save)) {
+ if (!empty($server_idc_save)) {
// add all new servers
$this->db->insertMultiple(PSM_DB_PREFIX.'users_servers', $server_idc_save);
}
@@ -301,7 +303,7 @@ class UserController extends AbstractController {
try {
$this->container->get('util.user.validator')->userId($id);
- $this->db->delete(PSM_DB_PREFIX . 'users', array('user_id' => $id,));
+ $this->db->delete(PSM_DB_PREFIX.'users', array('user_id' => $id,));
$this->db->delete(PSM_DB_PREFIX.'users_servers', array('user_id' => $id));
$this->container->get('event')->dispatch(
@@ -310,8 +312,8 @@ class UserController extends AbstractController {
);
$this->addMessage(psm_get_lang('users', 'deleted'), 'success');
- } catch(\InvalidArgumentException $e) {
- $this->addMessage(psm_get_lang('users', 'error_' . $e->getMessage()), 'error');
+ } catch (\InvalidArgumentException $e) {
+ $this->addMessage(psm_get_lang('users', 'error_'.$e->getMessage()), 'error');
}
return $this->executeIndex();
@@ -361,7 +363,7 @@ class UserController extends AbstractController {
array('server_id')
);
$result = array();
- foreach($servers as $server) {
+ foreach ($servers as $server) {
$result[] = $server['server_id'];
}
return $result;
diff --git a/src/psm/Module/User/Event/UserEvent.php b/src/psm/Module/User/Event/UserEvent.php
index 6783dd7e..44cdfee0 100644
--- a/src/psm/Module/User/Event/UserEvent.php
+++ b/src/psm/Module/User/Event/UserEvent.php
@@ -36,16 +36,16 @@ class UserEvent extends Event {
protected $user_id_by;
- public function __construct($user_id, $user_id_by = null) {
- $this->user_id = $user_id;
- $this->user_id_by = $user_id_by;
- }
+ public function __construct($user_id, $user_id_by = null) {
+ $this->user_id = $user_id;
+ $this->user_id_by = $user_id_by;
+ }
- public function getUserId() {
- return $this->user_id;
- }
+ public function getUserId() {
+ return $this->user_id;
+ }
- public function getUserIdBy() {
- return $this->user_id_by;
- }
+ public function getUserIdBy() {
+ return $this->user_id_by;
+ }
}
\ No newline at end of file
diff --git a/src/psm/Module/User/UserModule.php b/src/psm/Module/User/UserModule.php
index 5e3f8f90..23f7fc25 100644
--- a/src/psm/Module/User/UserModule.php
+++ b/src/psm/Module/User/UserModule.php
@@ -40,9 +40,9 @@ class UserModule implements ModuleInterface {
public function getControllers() {
return array(
- 'user' => __NAMESPACE__ . '\Controller\UserController',
- 'login' => __NAMESPACE__ . '\Controller\LoginController',
- 'profile' => __NAMESPACE__ . '\Controller\ProfileController',
+ 'user' => __NAMESPACE__.'\Controller\UserController',
+ 'login' => __NAMESPACE__.'\Controller\LoginController',
+ 'profile' => __NAMESPACE__.'\Controller\ProfileController',
);
}
diff --git a/src/psm/Router.php b/src/psm/Router.php
index 6743609a..782a9a88 100644
--- a/src/psm/Router.php
+++ b/src/psm/Router.php
@@ -55,7 +55,7 @@ class Router {
$mods = $this->container->getParameter('modules');
- foreach($mods as $mod) {
+ foreach ($mods as $mod) {
$mod_loader = $this->container->get($mod);
$mod_loader->load($this->container);
}
@@ -73,7 +73,7 @@ class Router {
* @throws \LogicException
*/
public function run($mod) {
- if(strpos($mod, '_') !== false) {
+ if (strpos($mod, '_') !== false) {
list($mod, $controller) = explode('_', $mod);
} else {
$controller = $mod;
@@ -86,7 +86,7 @@ class Router {
try {
$this->validateRequest($controller);
} catch (\InvalidArgumentException $ex) {
- switch($ex->getMessage()) {
+ switch ($ex->getMessage()) {
case 'login_required':
$controller = $this->getController('user', 'login');
break;
@@ -101,7 +101,7 @@ class Router {
$response = $controller->run($action);
- if(!($response instanceof Response)) {
+ if (!($response instanceof Response)) {
throw new \LogicException('Controller did not return a Response object.');
}
$response->send();
@@ -115,22 +115,22 @@ class Router {
* @throws \InvalidArgumentException
*/
public function getController($module_id, $controller_id = null) {
- if($controller_id === null) {
+ if ($controller_id === null) {
// by default, we use the controller with the same id as the module.
$controller_id = $module_id;
}
- $module = $this->container->get('module.' . $module_id);
+ $module = $this->container->get('module.'.$module_id);
$controllers = $module->getControllers();
- if(!isset($controllers[$controller_id]) || !class_exists($controllers[$controller_id])) {
- throw new \InvalidArgumentException('Controller "' . $controller_id . '" is not registered or does not exist.');
+ if (!isset($controllers[$controller_id]) || !class_exists($controllers[$controller_id])) {
+ throw new \InvalidArgumentException('Controller "'.$controller_id.'" is not registered or does not exist.');
}
$controller = new $controllers[$controller_id](
$this->container->get('db'),
$this->container->get('twig')
);
- if(!$controller instanceof \psm\Module\ControllerInterface) {
+ if (!$controller instanceof \psm\Module\ControllerInterface) {
throw new \Exception('Controller does not implement ControllerInterface');
}
$controller->setContainer($this->container);
@@ -156,18 +156,18 @@ class Router {
protected function validateRequest(\psm\Module\ControllerInterface $controller) {
$request = Request::createFromGlobals();
- if($request->getMethod() == 'POST') {
+ if ($request->getMethod() == 'POST') {
// require CSRF token for all POST calls
$session = $this->container->get('user')->getSession();
$token_in = $request->request->get('csrf', '');
$csrf_key = $controller->getCSRFKey();
- if(empty($csrf_key)) {
- if(!hash_equals($session->get('csrf_token'), $token_in)) {
+ if (empty($csrf_key)) {
+ if (!hash_equals($session->get('csrf_token'), $token_in)) {
throw new \InvalidArgumentException('invalid_csrf_token');
}
} else {
- if(!hash_equals(
+ if (!hash_equals(
hash_hmac('sha256', $csrf_key, $session->get('csrf_token2')),
$token_in
)) {
@@ -179,11 +179,11 @@ class Router {
// get min required level for this controller and make sure the user matches
$min_lvl = $controller->getMinUserLevelRequired();
- if($min_lvl < PSM_USER_ANONYMOUS) {
+ if ($min_lvl < PSM_USER_ANONYMOUS) {
// if user is not logged in, load login module
- if(!$this->container->get('user')->isUserLoggedIn()) {
+ if (!$this->container->get('user')->isUserLoggedIn()) {
throw new \InvalidArgumentException('login_required');
- } elseif($this->container->get('user')->getUserLevel() > $min_lvl) {
+ } elseif ($this->container->get('user')->getUserLevel() > $min_lvl) {
throw new \InvalidArgumentException('invalid_user_level');
}
}
@@ -210,10 +210,10 @@ class Router {
protected function buildTwigEnvironment() {
$twig = $this->container->get('twig');
$session = $this->container->get('user')->getSession();
- if(!$session->has('csrf_token')) {
+ if (!$session->has('csrf_token')) {
$session->set('csrf_token', bin2hex(random_bytes(32)));
}
- if(!$session->has('csrf_token2')) {
+ if (!$session->has('csrf_token2')) {
$session->set('csrf_token2', random_bytes(32));
}
@@ -221,7 +221,7 @@ class Router {
new \Twig_SimpleFunction(
'csrf_token',
function($lock_to = null) use ($session) {
- if(empty($lock_to)) {
+ if (empty($lock_to)) {
return $session->get('csrf_token');
}
return hash_hmac('sha256', $lock_to, $session->get('csrf_token2'));
diff --git a/src/psm/Service/Database.php b/src/psm/Service/Database.php
index 57467f4a..c16dc87d 100644
--- a/src/psm/Service/Database.php
+++ b/src/psm/Service/Database.php
@@ -88,7 +88,7 @@ class Database {
* @param string $db
*/
function __construct($host = null, $user = null, $pass = null, $db = null, $port = null) {
- if($host != null && $user != null && $pass !== null && $db != null) {
+ if ($host != null && $user != null && $pass !== null && $db != null) {
$this->db_host = $host;
$this->db_port = (!empty($port)) ? $port : 3306;
$this->db_name = $db;
@@ -114,10 +114,10 @@ class Database {
$this->error($e);
}
- if($fetch && $this->last != false) {
+ if ($fetch && $this->last != false) {
$cmd = strtolower(substr($query, 0, 6));
- switch($cmd) {
+ switch ($cmd) {
case 'insert':
// insert query, return insert id
$result = $this->getLastInsertedId();
@@ -167,7 +167,7 @@ class Database {
$this->error($e);
}
- if($fetch && $this->last != false) {
+ if ($fetch && $this->last != false) {
$result = $this->last->fetchAll(\PDO::FETCH_ASSOC);
} else {
$result = $this->last;
@@ -185,7 +185,7 @@ class Database {
* @param string $direction ASC or DESC. Defaults to ASC
* @return array multi dimensional array with results
*/
- public function select($table, $where = null, $fields = null, $limit = '', $orderby = null, $direction = 'ASC'){
+ public function select($table, $where = null, $fields = null, $limit = '', $orderby = null, $direction = 'ASC') {
// build query
$query_parts = array();
$query_parts[] = 'SELECT SQL_CALC_FOUND_ROWS';
@@ -204,13 +204,13 @@ class Database {
$query_parts[] = $this->buildSQLClauseWhere($table, $where);
// Order by
- if($orderby) {
+ if ($orderby) {
$query_parts[] = $this->buildSQLClauseOrderBy($orderby, $direction);
}
// Limit
if ($limit != '') {
- $query_parts[] = 'LIMIT ' . $limit;
+ $query_parts[] = 'LIMIT '.$limit;
}
$query = implode(' ', $query_parts);
@@ -230,7 +230,7 @@ class Database {
public function selectRow($table, $where = null, $fields = null, $orderby = null, $direction = 'ASC') {
$result = $this->select($table, $where, $fields, '1', $orderby, $direction);
- if(isset($result[0])) {
+ if (isset($result[0])) {
$result = $result[0];
}
@@ -243,8 +243,8 @@ class Database {
* @param mixed $where Where clause array or primary Id (string) or where clause (string)
* @return int number of affected rows
*/
- public function delete($table, $where = null){
- $sql = 'DELETE FROM `'.$table.'` ' . $this->buildSQLClauseWhere($table, $where);
+ public function delete($table, $where = null) {
+ $sql = 'DELETE FROM `'.$table.'` '.$this->buildSQLClauseWhere($table, $where);
return $this->exec($sql);
}
@@ -267,8 +267,8 @@ class Database {
$query .= "`{$table}` SET ";
- foreach($data as $field => $value) {
- if(is_null($value)) {
+ foreach ($data as $field => $value) {
+ if (is_null($value)) {
$value = 'NULL';
} else {
$value = $this->quote($value);
@@ -276,9 +276,9 @@ class Database {
$query .= "`{$table}`.`{$field}`={$value}, ";
}
- $query = substr($query, 0, -2) . ' ' . $this->buildSQLClauseWhere($table, $where);
+ $query = substr($query, 0, -2).' '.$this->buildSQLClauseWhere($table, $where);
- if($exec) {
+ if ($exec) {
return $this->exec($query);
} else {
return $this->query($query);
@@ -300,7 +300,9 @@ class Database {
* @see insert()
*/
public function insertMultiple($table, array $data) {
- if(empty($data)) return false;
+ if (empty($data)) {
+ return false;
+ }
// prepare first part
$query = "INSERT INTO `{$table}` ";
@@ -317,14 +319,14 @@ class Database {
$pst = $this->pdo()->prepare($query);
$i = 1;
- foreach($data as $row) {
+ foreach ($data as $row) {
// make sure the fields of this row are identical to first row
$diff_keys = array_diff_key($fields, array_keys($row));
- if(!empty($diff_keys)) {
+ if (!empty($diff_keys)) {
continue;
}
- foreach($fields as $field) {
+ foreach ($fields as $field) {
$pst->bindParam($i++, $row[$field]);
}
}
@@ -353,7 +355,7 @@ class Database {
";
$if_exists = $this->query($if_exists);
- if(isset($if_exists[0]['cnt']) && $if_exists[0]['cnt'] == 1) {
+ if (isset($if_exists[0]['cnt']) && $if_exists[0]['cnt'] == 1) {
return true;
} else {
false;
@@ -408,7 +410,7 @@ class Database {
if (is_array($where)) {
$query .= " WHERE ";
- foreach($where as $field => $value) {
+ foreach ($where as $field => $value) {
$query .= "`{$table}`.`{$field}`={$this->quote($value)} AND ";
}
$query = substr($query, 0, -5);
@@ -428,12 +430,12 @@ class Database {
}
/**
- * Build ORDER BY clause for a query
- * @param mixed $order_by can be string (with or without order by) or array
- * @param string $direction
- * @return string sql order by clause
+ * Build ORDER BY clause for a query
+ * @param mixed $order_by can be string (with or without order by) or array
+ * @param string $direction
+ * @return string sql order by clause
* @see buildSQLClauseWhere()
- */
+ */
public function buildSQLClauseOrderBy($order_by, $direction) {
$query = '';
@@ -441,7 +443,7 @@ class Database {
if (is_array($order_by)) {
$query .= " ORDER BY ";
- foreach($order_by as $field) {
+ foreach ($order_by as $field) {
$query .= "`{$field}`, ";
}
// remove trailing ", "
@@ -454,9 +456,9 @@ class Database {
}
}
}
- if(strlen($query) > 0) {
+ if (strlen($query) > 0) {
// check if "ASC" or "DESC" is already in the order by clause
- if(strpos(strtolower(trim($query)), 'asc') === false && strpos(strtolower(trim($query)), 'desc') === false) {
+ if (strpos(strtolower(trim($query)), 'asc') === false && strpos(strtolower(trim($query)), 'desc') === false) {
$query .= ' '.$direction;
}
}
@@ -538,6 +540,6 @@ class Database {
* @param \PDOException $e
*/
protected function error(\PDOException $e) {
- trigger_error('SQL error: ' . $e->getMessage(), E_USER_WARNING);
+ trigger_error('SQL error: '.$e->getMessage(), E_USER_WARNING);
}
}
diff --git a/src/psm/Service/User.php b/src/psm/Service/User.php
index be53ecf5..7d983c48 100644
--- a/src/psm/Service/User.php
+++ b/src/psm/Service/User.php
@@ -44,11 +44,11 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
*/
class User {
- /**
+ /**
* The database connection
- * @var \PDO $db_connection
- */
- protected $db_connection = null;
+ * @var \PDO $db_connection
+ */
+ protected $db_connection = null;
/**
* Local cache of user data
@@ -62,11 +62,11 @@ class User {
*/
protected $session;
- /**
+ /**
* Current user id
- * @var int $user_id
- */
- protected $user_id;
+ * @var int $user_id
+ */
+ protected $user_id;
/**
*Current user preferences
@@ -76,55 +76,55 @@ class User {
/**
* The user's login status
- * @var boolean $user_is_logged_in
- */
- protected $user_is_logged_in = false;
+ * @var boolean $user_is_logged_in
+ */
+ protected $user_is_logged_in = false;
- /**
- * Open a new user service
+ /**
+ * Open a new user service
*
* @param \psm\Service\Database $db
* @param \Symfony\Component\HttpFoundation\Session\SessionInterface $session if NULL, one will be created
- */
- public function __construct(Database $db, SessionInterface $session = null) {
+ */
+ public function __construct(Database $db, SessionInterface $session = null) {
$this->db_connection = $db->pdo();
- if(!psm_is_cli()) {
- if($session == null) {
+ if (!psm_is_cli()) {
+ if ($session == null) {
$session = new Session();
$session->start();
}
$this->session = $session;
- if((!defined('PSM_INSTALL') || !PSM_INSTALL)) {
+ 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 he has successfully logged in via the login form)
// 2. login via cookie
// if user has an active session on the server
- if(!$this->loginWithSessionData()) {
+ if (!$this->loginWithSessionData()) {
$this->loginWithCookieData();
}
}
}
- }
+ }
- /**
- * Get user by id, or get current user.
+ /**
+ * Get user by id, or get current user.
* @param int $user_id if null it will attempt current user id
* @param boolean $flush if TRUE it will query db regardless of whether we already have the data
- * @return object|boolean FALSE if user not found, object otherwise
- */
- public function getUser($user_id = null, $flush = false) {
- if($user_id == null) {
- if(!$this->isUserLoggedIn()) {
+ * @return object|boolean FALSE if user not found, object otherwise
+ */
+ public function getUser($user_id = null, $flush = false) {
+ if ($user_id == null) {
+ if (!$this->isUserLoggedIn()) {
return false;
} else {
$user_id = $this->getUserId();
}
}
- if(!isset($this->user_data[$user_id]) || $flush) {
+ if (!isset($this->user_data[$user_id]) || $flush) {
$query_user = $this->db_connection->prepare('SELECT * FROM '.PSM_DB_PREFIX.'users WHERE user_id = :user_id');
$query_user->bindValue(':user_id', $user_id, \PDO::PARAM_INT);
$query_user->execute();
@@ -134,31 +134,31 @@ class User {
return $this->user_data[$user_id];
}
- /**
- * Search into database for the user data of user_name specified as parameter
- * @return object|boolean user data as an object if existing user
- */
- public function getUserByUsername($user_name) {
+ /**
+ * Search into database for the user data of user_name specified as parameter
+ * @return object|boolean user data as an object if existing user
+ */
+ public function getUserByUsername($user_name) {
// database query, getting all the info of the selected user
$query_user = $this->db_connection->prepare('SELECT * FROM '.PSM_DB_PREFIX.'users WHERE user_name = :user_name');
$query_user->bindValue(':user_name', $user_name, \PDO::PARAM_STR);
$query_user->execute();
// get result row (as an object)
return $query_user->fetchObject();
- }
+ }
- /**
- * Logs in with SESSION data.
+ /**
+ * Logs in with SESSION data.
*
* @return boolean
- */
- protected function loginWithSessionData() {
- if(!$this->session->has('user_id')) {
+ */
+ protected function loginWithSessionData() {
+ if (!$this->session->has('user_id')) {
return false;
}
$user = $this->getUser($this->session->get('user_id'));
- if(!empty($user)) {
+ if (!empty($user)) {
$this->setUserLoggedIn($user->user_id);
return true;
} else {
@@ -167,64 +167,64 @@ class User {
$this->doLogout();
return false;
}
- }
+ }
- /**
- * Logs in via the Cookie
- * @return bool success state of cookie login
- */
- private function loginWithCookieData() {
- if (isset($_COOKIE['rememberme'])) {
- // extract data from the cookie
- list ($user_id, $token, $hash) = explode(':', $_COOKIE['rememberme']);
- // check cookie hash validity
- if($hash == hash('sha256', $user_id . ':' . $token . PSM_LOGIN_COOKIE_SECRET_KEY) && !empty($token)) {
- // cookie looks good, try to select corresponding user
+ /**
+ * Logs in via the Cookie
+ * @return bool success state of cookie login
+ */
+ private function loginWithCookieData() {
+ if (isset($_COOKIE['rememberme'])) {
+ // extract data from the cookie
+ list ($user_id, $token, $hash) = explode(':', $_COOKIE['rememberme']);
+ // check cookie hash validity
+ if ($hash == hash('sha256', $user_id.':'.$token.PSM_LOGIN_COOKIE_SECRET_KEY) && !empty($token)) {
+ // cookie looks good, try to select corresponding user
// get real token from database (and all other data)
$user = $this->getUser($user_id);
- if(!empty($user) && $token === $user->rememberme_token) {
+ if (!empty($user) && $token === $user->rememberme_token) {
$this->setUserLoggedIn($user->user_id, true);
// Cookie token usable only once
$this->newRememberMeCookie();
return true;
}
- }
+ }
// call logout to remove invalid cookie
$this->doLogout();
- }
- return false;
- }
+ }
+ return false;
+ }
- /**
- * Logs in with the data provided in $_POST, coming from the login form
- * @param string $user_name
- * @param string $user_password
- * @param boolean $user_rememberme
+ /**
+ * Logs in with the data provided in $_POST, coming from the login form
+ * @param string $user_name
+ * @param string $user_password
+ * @param boolean $user_rememberme
* @return boolean
- */
- public function loginWithPostData($user_name, $user_password, $user_rememberme = false) {
+ */
+ public function loginWithPostData($user_name, $user_password, $user_rememberme = false) {
$user_name = trim($user_name);
$user_password = trim($user_password);
- if(empty($user_name) && empty($user_password)) {
+ if (empty($user_name) && empty($user_password)) {
return false;
}
$user = $this->getUserByUsername($user_name);
// using PHP 5.5's password_verify() function to check if the provided passwords fits to the hash of that user's password
- if(!isset($user->user_id)) {
+ if (!isset($user->user_id)) {
password_verify($user_password, 'dummy_call_against_timing');
return false;
- } else if(!password_verify($user_password, $user->password)) {
+ } else if (!password_verify($user_password, $user->password)) {
return false;
}
$this->setUserLoggedIn($user->user_id, true);
// if user has check the "remember me" checkbox, then generate token and write cookie
- if($user_rememberme) {
+ if ($user_rememberme) {
$this->newRememberMeCookie();
}
@@ -232,14 +232,14 @@ class User {
// DELETE this if-block if you like, it only exists to recalculate users's hashes when you provide a cost factor,
// by default the script will use a cost factor of 10 and never change it.
// check if the have defined a cost factor in config/hashing.php
- if(defined('PSM_LOGIN_HASH_COST_FACTOR')) {
+ if (defined('PSM_LOGIN_HASH_COST_FACTOR')) {
// check if the hash needs to be rehashed
- if(password_needs_rehash($user->password, PASSWORD_DEFAULT, array('cost' => PSM_LOGIN_HASH_COST_FACTOR))) {
+ if (password_needs_rehash($user->password, PASSWORD_DEFAULT, array('cost' => PSM_LOGIN_HASH_COST_FACTOR))) {
$this->changePassword($user->user_id, $user_password);
}
}
return true;
- }
+ }
/**
* Set the user logged in
@@ -247,7 +247,7 @@ class User {
* @param boolean $regenerate regenerate session id against session fixation?
*/
protected function setUserLoggedIn($user_id, $regenerate = false) {
- if($regenerate) {
+ if ($regenerate) {
$this->session->invalidate();
}
$this->session->set('user_id', $user_id);
@@ -258,72 +258,72 @@ class User {
$this->user_is_logged_in = true;
}
- /**
- * Create all data needed for remember me cookie connection on client and server side
- */
- protected function newRememberMeCookie() {
+ /**
+ * Create all data needed for remember me cookie connection on client and server side
+ */
+ protected function newRememberMeCookie() {
// generate 64 char random string and store it in current user data
$random_token_string = hash('sha256', mt_rand());
$sth = $this->db_connection->prepare('UPDATE '.PSM_DB_PREFIX.'users SET rememberme_token = :user_rememberme_token WHERE user_id = :user_id');
$sth->execute(array(':user_rememberme_token' => $random_token_string, ':user_id' => $this->getUserId()));
// generate cookie string that consists of userid, randomstring and combined hash of both
- $cookie_string_first_part = $this->getUserId() . ':' . $random_token_string;
- $cookie_string_hash = hash('sha256', $cookie_string_first_part . PSM_LOGIN_COOKIE_SECRET_KEY);
- $cookie_string = $cookie_string_first_part . ':' . $cookie_string_hash;
+ $cookie_string_first_part = $this->getUserId().':'.$random_token_string;
+ $cookie_string_hash = hash('sha256', $cookie_string_first_part.PSM_LOGIN_COOKIE_SECRET_KEY);
+ $cookie_string = $cookie_string_first_part.':'.$cookie_string_hash;
// set cookie
setcookie('rememberme', $cookie_string, time() + PSM_LOGIN_COOKIE_RUNTIME, "/", PSM_LOGIN_COOKIE_DOMAIN);
- }
+ }
- /**
- * Delete all data needed for remember me cookie connection on client and server side
- */
- protected function deleteRememberMeCookie() {
+ /**
+ * Delete all data needed for remember me cookie connection on client and server side
+ */
+ protected function deleteRememberMeCookie() {
// Reset rememberme token
- if($this->session->has('user_id')) {
+ if ($this->session->has('user_id')) {
$sth = $this->db_connection->prepare('UPDATE '.PSM_DB_PREFIX.'users SET rememberme_token = NULL WHERE user_id = :user_id');
$sth->execute(array(':user_id' => $this->session->get('user_id')));
}
- // set the rememberme-cookie to ten years ago (3600sec * 365 days * 10).
- // that's obivously the best practice to kill a cookie via php
- // @see http://stackoverflow.com/a/686166/1114320
- setcookie('rememberme', false, time() - (3600 * 3650), '/', PSM_LOGIN_COOKIE_DOMAIN);
- }
+ // set the rememberme-cookie to ten years ago (3600sec * 365 days * 10).
+ // that's obivously the best practice to kill a cookie via php
+ // @see http://stackoverflow.com/a/686166/1114320
+ setcookie('rememberme', false, time() - (3600 * 3650), '/', PSM_LOGIN_COOKIE_DOMAIN);
+ }
- /**
- * Perform the logout, resetting the session
- */
- public function doLogout() {
- $this->deleteRememberMeCookie();
+ /**
+ * Perform the logout, resetting the session
+ */
+ public function doLogout() {
+ $this->deleteRememberMeCookie();
$this->session->clear();
$this->session->invalidate();
- $this->user_is_logged_in = false;
- }
+ $this->user_is_logged_in = false;
+ }
- /**
- * Simply return the current state of the user's login
- * @return bool user's login status
- */
- public function isUserLoggedIn() {
- return $this->user_is_logged_in;
- }
+ /**
+ * Simply return the current state of the user's login
+ * @return bool user's login status
+ */
+ public function isUserLoggedIn() {
+ return $this->user_is_logged_in;
+ }
- /**
- * Sets a random token into the database (that will verify the user when he/she comes back via the link
- * in the email) and returns it
+ /**
+ * Sets a random token into the database (that will verify the user when he/she comes back via the link
+ * in the email) and returns it
* @param int $user_id
* @return string|boolean FALSE on error, string otherwise
- */
- public function generatePasswordResetToken($user_id) {
- $user_id = intval($user_id);
+ */
+ public function generatePasswordResetToken($user_id) {
+ $user_id = intval($user_id);
- if($user_id == 0) {
- return false;
- }
+ if ($user_id == 0) {
+ return false;
+ }
// generate timestamp (to see when exactly the user (or an attacker) requested the password reset mail)
$temporary_timestamp = time();
// generate random hash for email password reset verification (40 char string)
@@ -343,47 +343,47 @@ class User {
} else {
return false;
}
- }
+ }
- /**
- * Checks if the verification string in the account verification mail is valid and matches to the user.
+ /**
+ * Checks if the verification string in the account verification mail is valid and matches to the user.
*
* Please note it is valid for 1 hour.
* @param int $user_id
* @param string $token
* @return boolean
- */
- public function verifyPasswordResetToken($user_id, $token) {
- $user_id = intval($user_id);
+ */
+ public function verifyPasswordResetToken($user_id, $token) {
+ $user_id = intval($user_id);
- if(empty($user_id) || empty($token)) {
- return false;
- }
+ if (empty($user_id) || empty($token)) {
+ return false;
+ }
$user = $this->getUser($user_id);
- if(isset($user->user_id) && $user->password_reset_hash == $token) {
+ if (isset($user->user_id) && $user->password_reset_hash == $token) {
$runtime = (defined('PSM_LOGIN_RESET_RUNTIME')) ? PSM_LOGIN_RESET_RUNTIME : 3600;
$timestamp_max_interval = time() - $runtime;
- if($user->password_reset_timestamp > $timestamp_max_interval) {
+ if ($user->password_reset_timestamp > $timestamp_max_interval) {
return true;
}
}
return false;
- }
+ }
- /**
- * Change the password of a user
+ /**
+ * Change the password of a user
* @param int $user_id
* @param string $password
* @return boolean TRUE on success, FALSE on failure
- */
- public function changePassword($user_id, $password) {
- $user_id = intval($user_id);
+ */
+ public function changePassword($user_id, $password) {
+ $user_id = intval($user_id);
- if(empty($user_id) || empty($password)) {
- return false;
- }
+ if (empty($user_id) || empty($password)) {
+ return false;
+ }
// now it gets a little bit crazy: check if we have a constant PSM_LOGIN_HASH_COST_FACTOR defined (in src/includes/psmconfig.inc.php),
// if so: put the value into $hash_cost_factor, if not, make $hash_cost_factor = null
$hash_cost_factor = (defined('PSM_LOGIN_HASH_COST_FACTOR') ? PSM_LOGIN_HASH_COST_FACTOR : null);
@@ -408,7 +408,7 @@ class User {
} else {
return false;
}
- }
+ }
/**
* Gets the user id
@@ -418,14 +418,14 @@ class User {
return $this->user_id;
}
- /**
- * Gets the username
- * @return string
- */
- public function getUsername() {
- $user = $this->getUser();
+ /**
+ * Gets the username
+ * @return string
+ */
+ public function getUsername() {
+ $user = $this->getUser();
return (isset($user->user_name) ? $user->user_name : null);
- }
+ }
/**
* Gets the user level
@@ -434,7 +434,7 @@ class User {
public function getUserLevel() {
$user = $this->getUser();
- if(isset($user->level)) {
+ if (isset($user->level)) {
return $user->level;
} else {
return PSM_USER_ANONYMOUS;
@@ -446,13 +446,13 @@ class User {
* @return boolean return false is user not connected
*/
protected function loadPreferences() {
- if($this->user_preferences === null) {
- if(!$this->getUser()) {
+ if ($this->user_preferences === null) {
+ if (!$this->getUser()) {
return false;
}
$this->user_preferences = array();
- foreach($this->db_connection->query('SELECT `key`,`value` FROM `' . PSM_DB_PREFIX . 'users_preferences` WHERE `user_id` = ' . $this->user_id) as $row) {
+ foreach ($this->db_connection->query('SELECT `key`,`value` FROM `'.PSM_DB_PREFIX.'users_preferences` WHERE `user_id` = '.$this->user_id) as $row) {
$this->user_preferences[$row['key']] = $row['value'];
}
}
@@ -466,7 +466,7 @@ class User {
* @return mixed
*/
public function getUserPref($key, $default = '') {
- if(!$this->loadPreferences() || !isset($this->user_preferences[$key])) {
+ if (!$this->loadPreferences() || !isset($this->user_preferences[$key])) {
return $default;
}
@@ -481,14 +481,14 @@ class User {
* @param mixed $value
*/
public function setUserPref($key, $value) {
- if($this->loadPreferences()) {
- if(isset($this->user_preferences[$key])) {
- if($this->user_preferences[$key] == $value) {
- return; // no change
+ if ($this->loadPreferences()) {
+ if (isset($this->user_preferences[$key])) {
+ if ($this->user_preferences[$key] == $value) {
+ return; // no change
}
- $sql = 'UPDATE `' . PSM_DB_PREFIX . 'users_preferences` SET `key` = ?, `value` = ? WHERE `user_id` = ?';
- } else{
- $sql = 'INSERT INTO `' . PSM_DB_PREFIX . 'users_preferences` SET `key` = ?, `value` = ?, `user_id` = ?';
+ $sql = 'UPDATE `'.PSM_DB_PREFIX.'users_preferences` SET `key` = ?, `value` = ? WHERE `user_id` = ?';
+ } else {
+ $sql = 'INSERT INTO `'.PSM_DB_PREFIX.'users_preferences` SET `key` = ?, `value` = ?, `user_id` = ?';
}
$sth = $this->db_connection->prepare($sql);
$sth->execute(array($key, $value, $this->user_id));
diff --git a/src/psm/Txtmsg/CMBulkSMS.php b/src/psm/Txtmsg/CMBulkSMS.php
index 977d94ad..b9a665c5 100644
--- a/src/psm/Txtmsg/CMBulkSMS.php
+++ b/src/psm/Txtmsg/CMBulkSMS.php
@@ -37,194 +37,194 @@ namespace psm\Txtmsg;
* Requirements: cURL v7.18.1+ and OpenSSL 0.9.8j+
*/
class CMBulkSMS extends Core {
- /** @var bool|null True when cURL request succeeded */
- public $result;
+ /** @var bool|null True when cURL request succeeded */
+ public $result;
- /** @var string|null Contains error message if cURL request failed */
- public $error;
+ /** @var string|null Contains error message if cURL request failed */
+ public $error;
- /** @var bool Set to true for debug output/logging */
- protected $debug = false;
+ /** @var bool Set to true for debug output/logging */
+ protected $debug = false;
- /** @var bool Set to false if your operator isn't able to handle multipart messages */
- protected $multipartMessage = true;
+ /** @var bool Set to false if your operator isn't able to handle multipart messages */
+ protected $multipartMessage = true;
- /** @var string|null Gateway API URL uses const GATEWAY_URL_XML or GATEWAY_URL_JSON */
- protected $apiUrl;
+ /** @var string|null Gateway API URL uses const GATEWAY_URL_XML or GATEWAY_URL_JSON */
+ protected $apiUrl;
- /** @var string Gateway API Type: Use 'json' (default) or 'xml' */
- protected $apiType = 'json';
+ /** @var string Gateway API Type: Use 'json' (default) or 'xml' */
+ protected $apiType = 'json';
- /** @var string|null JSON or XML message for cURL request */
- protected $request;
+ /** @var string|null JSON or XML message for cURL request */
+ protected $request;
- /** @var string|null HTTP Content-Type for cURL request */
- protected $contentType;
+ /** @var string|null HTTP Content-Type for cURL request */
+ protected $contentType;
- /** @var string|null Raw sms text message */
- protected $messageBody;
+ /** @var string|null Raw sms text message */
+ protected $messageBody;
- /** @var string JSON Gateway API URL */
- const GATEWAY_URL_JSON = "https://gw.cmtelecom.com/v1.0/message";
+ /** @var string JSON Gateway API URL */
+ const GATEWAY_URL_JSON = "https://gw.cmtelecom.com/v1.0/message";
- /** @var string XML Gateway API URL */
- const GATEWAY_URL_XML = "https://sgw01.cm.nl/gateway.ashx";
+ /** @var string XML Gateway API URL */
+ const GATEWAY_URL_XML = "https://sgw01.cm.nl/gateway.ashx";
- /**
- * Build the message and send cURL request to the sms gateway
- *
- * @see https://docs.cmtelecom.com/bulk-sms/v1.0#/send_a_message%7Csample_requests
- * @param string $message Your text message
- * @return boolean True when cURL request was successful
- */
- public function sendSMS($message) {
- // Check if recipient and text message are available
- if(count($this->recipients) < 1 || empty($message)) {
- return false;
- }
+ /**
+ * Build the message and send cURL request to the sms gateway
+ *
+ * @see https://docs.cmtelecom.com/bulk-sms/v1.0#/send_a_message%7Csample_requests
+ * @param string $message Your text message
+ * @return boolean True when cURL request was successful
+ */
+ public function sendSMS($message) {
+ // Check if recipient and text message are available
+ if (count($this->recipients) < 1 || empty($message)) {
+ return false;
+ }
- // Prepare the message in CM's XML or JSON format
- switch($this->apiType) {
- case 'xml':
- $this->request = $this->buildMessageXml();
- $this->contentType = 'Content-Type: application/xml';
- $this->apiUrl = self::GATEWAY_URL_XML;
- break;
+ // Prepare the message in CM's XML or JSON format
+ switch ($this->apiType) {
+ case 'xml':
+ $this->request = $this->buildMessageXml();
+ $this->contentType = 'Content-Type: application/xml';
+ $this->apiUrl = self::GATEWAY_URL_XML;
+ break;
- case 'json':
- default:
- $this->request = $this->buildMessageJson();
- $this->contentType = 'Content-Type: application/json';
- $this->apiUrl = self::GATEWAY_URL_JSON;
- break;
- }
+ case 'json':
+ default:
+ $this->request = $this->buildMessageJson();
+ $this->contentType = 'Content-Type: application/json';
+ $this->apiUrl = self::GATEWAY_URL_JSON;
+ break;
+ }
- $request = $this->executeCurlRequest();
+ $request = $this->executeCurlRequest();
- return $request;
- }
+ return $request;
+ }
- /**
- * Create a JSON batch sms message using CM's format
- *
- * @see https://docs.cmtelecom.com/bulk-sms/v1.0#/send_a_message%7Cbatch_messages
- * @see https://docs.cmtelecom.com/bulk-sms/v1.0#/send_a_message%7Csample_requests
- * @see https://docs.cmtelecom.com/bulk-sms/v1.0#/send_a_message%7Cmultipart
- * @return string JSON message object
- */
- protected function buildMessageJson() {
- // Prepare recipient array for batch message
- $recipients = array();
- foreach($this->recipients as $recipient) {
- $recipients[] = array('number' => $recipient);
- }
+ /**
+ * Create a JSON batch sms message using CM's format
+ *
+ * @see https://docs.cmtelecom.com/bulk-sms/v1.0#/send_a_message%7Cbatch_messages
+ * @see https://docs.cmtelecom.com/bulk-sms/v1.0#/send_a_message%7Csample_requests
+ * @see https://docs.cmtelecom.com/bulk-sms/v1.0#/send_a_message%7Cmultipart
+ * @return string JSON message object
+ */
+ protected function buildMessageJson() {
+ // Prepare recipient array for batch message
+ $recipients = array();
+ foreach ($this->recipients as $recipient) {
+ $recipients[] = array('number' => $recipient);
+ }
- // Build message array in CM's Bulk SMS format
- $msgArray = array(
- 'messages' => array(
- 'authentication' => array(
- 'producttoken' => $this->password
- ),
- 'msg' => array(
- array(
- 'from' => substr($this->originator, 0, 11),
- 'to' => $recipients,
- 'body' => array(
- 'content' => $message
- )
- )
- )
- )
- );
+ // Build message array in CM's Bulk SMS format
+ $msgArray = array(
+ 'messages' => array(
+ 'authentication' => array(
+ 'producttoken' => $this->password
+ ),
+ 'msg' => array(
+ array(
+ 'from' => substr($this->originator, 0, 11),
+ 'to' => $recipients,
+ 'body' => array(
+ 'content' => $message
+ )
+ )
+ )
+ )
+ );
- // Multipart message
- if($this->multipartMessage) {
- $msgArray['messages']['msg'][0]['minimumNumberOfMessageParts'] = 1;
- $msgArray['messages']['msg'][0]['maximumNumberOfMessageParts'] = 8;
- }
+ // Multipart message
+ if ($this->multipartMessage) {
+ $msgArray['messages']['msg'][0]['minimumNumberOfMessageParts'] = 1;
+ $msgArray['messages']['msg'][0]['maximumNumberOfMessageParts'] = 8;
+ }
- // Convert array in JSON object
- return json_encode($msgArray);
- }
+ // Convert array in JSON object
+ return json_encode($msgArray);
+ }
- /**
- * Create a XML batch sms message in CM's format
- *
- * @see https://docs.cmtelecom.com/bulk-sms/v1.0#/send_a_message%7Cbatch_messages
- * @see https://docs.cmtelecom.com/bulk-sms/v1.0#/send_a_message%7Csample_requests
- * @see https://docs.cmtelecom.com/bulk-sms/v1.0#/send_a_message%7Cmultipart
- * @return string XML message
- */
- protected function buildMessageXml() {
- // Create XML string
- $xml = new \SimpleXMLElement('');
+ /**
+ * Create a XML batch sms message in CM's format
+ *
+ * @see https://docs.cmtelecom.com/bulk-sms/v1.0#/send_a_message%7Cbatch_messages
+ * @see https://docs.cmtelecom.com/bulk-sms/v1.0#/send_a_message%7Csample_requests
+ * @see https://docs.cmtelecom.com/bulk-sms/v1.0#/send_a_message%7Cmultipart
+ * @return string XML message
+ */
+ protected function buildMessageXml() {
+ // Create XML string
+ $xml = new \SimpleXMLElement('');
- // API-Token
- $auth = $xml->addChild('AUTHENTICATION');
- $auth->addChild('PRODUCTTOKEN', $this->password);
+ // API-Token
+ $auth = $xml->addChild('AUTHENTICATION');
+ $auth->addChild('PRODUCTTOKEN', $this->password);
- // Message
- $msg = $xml->addChild('MSG');
+ // Message
+ $msg = $xml->addChild('MSG');
- // From
- $msg->addChild('FROM', substr($this->originator, 0, 11));
+ // From
+ $msg->addChild('FROM', substr($this->originator, 0, 11));
- // Recipients
- foreach($this->recipients as $recipient) {
- $msg->addChild('TO', $recipient);
- }
+ // Recipients
+ foreach ($this->recipients as $recipient) {
+ $msg->addChild('TO', $recipient);
+ }
- // Multipart message
- if($this->multipartMessage) {
- $msg->addChild('MINIMUMNUMBEROFMESSAGEPARTS', 1);
- $msg->addChild('MAXIMUMNUMBEROFMESSAGEPARTS', 8);
- }
+ // Multipart message
+ if ($this->multipartMessage) {
+ $msg->addChild('MINIMUMNUMBEROFMESSAGEPARTS', 1);
+ $msg->addChild('MAXIMUMNUMBEROFMESSAGEPARTS', 8);
+ }
- // Add body text
- $msg->addChild('BODY', $message);
+ // Add body text
+ $msg->addChild('BODY', $message);
- return $xml->asXML();
- }
+ return $xml->asXML();
+ }
- /**
- * Create and execute the curl request
- *
- * @return boolean True if message is sent
- */
- protected function executeCurlRequest() {
- $cr = curl_init();
- curl_setopt_array($cr, array(
- CURLOPT_URL => $this->apiUrl,
- CURLOPT_HTTPHEADER => array($this->contentType),
- CURLOPT_POST => true,
- CURLOPT_POSTFIELDS => $this->request,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_FAILONERROR => true
- )
- );
+ /**
+ * Create and execute the curl request
+ *
+ * @return boolean True if message is sent
+ */
+ protected function executeCurlRequest() {
+ $cr = curl_init();
+ curl_setopt_array($cr, array(
+ CURLOPT_URL => $this->apiUrl,
+ CURLOPT_HTTPHEADER => array($this->contentType),
+ CURLOPT_POST => true,
+ CURLOPT_POSTFIELDS => $this->request,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_FAILONERROR => true
+ )
+ );
- // execute curl request and fetch the response/error
- $cResponse = curl_exec($cr);
- $cError = curl_error($cr);
- $cErrorCode = curl_errno($cr);
- curl_close($cr);
+ // execute curl request and fetch the response/error
+ $cResponse = curl_exec($cr);
+ $cError = curl_error($cr);
+ $cErrorCode = curl_errno($cr);
+ curl_close($cr);
- $this->result = 1;
- // set result and log error if needed
- if($cError) {
- $this->error = 'Response: CM SMS API:' . $cResponse . ' cURL Error Code: ' . $cErrorCode . '"' . $cError . '"';
- error_log($this->error, E_USER_ERROR);
- $this->result = $this->error;
- }
+ $this->result = 1;
+ // set result and log error if needed
+ if ($cError) {
+ $this->error = 'Response: CM SMS API:'.$cResponse.' cURL Error Code: '.$cErrorCode.'"'.$cError.'"';
+ error_log($this->error, E_USER_ERROR);
+ $this->result = $this->error;
+ }
- // Debug output
- // Note: CM's XML gateway gives no response when message is sent successfully :/
- if($this->debug || PSM_DEBUG) {
- $debug = 'Request: '. $this->request . '
Response: ' . $cResponse.'
';
- error_log("Request: $this->request\r\nResponse: $cResponse", E_USER_NOTICE);
- echo $debug;
- }
+ // Debug output
+ // Note: CM's XML gateway gives no response when message is sent successfully :/
+ if ($this->debug || PSM_DEBUG) {
+ $debug = 'Request: '.$this->request.'
Response: '.$cResponse.'
';
+ error_log("Request: $this->request\r\nResponse: $cResponse", E_USER_NOTICE);
+ echo $debug;
+ }
- return $this->result;
- }
+ return $this->result;
+ }
}
diff --git a/src/psm/Txtmsg/Callr.php b/src/psm/Txtmsg/Callr.php
index 927ef4bd..c4764b14 100644
--- a/src/psm/Txtmsg/Callr.php
+++ b/src/psm/Txtmsg/Callr.php
@@ -32,31 +32,31 @@ namespace psm\Txtmsg;
class Callr extends Core {
/**
- * Send sms using the Callr API
- *
- * @var string $message
- * @var string $this->password
- * @var array $this->recipients
- * @var array $this->originator
- * @var string $recipient
- *
- * @var mixed $result
- * @var array $headers
- *
- * @var resource $curl
- * @var string $err
- *
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the Callr API
+ *
+ * @var string $message
+ * @var string $this->password
+ * @var array $this->recipients
+ * @var array $this->originator
+ * @var string $recipient
+ *
+ * @var mixed $result
+ * @var array $headers
+ *
+ * @var resource $curl
+ * @var string $err
+ *
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$error = "";
$success = 1;
- foreach($this->recipients as $recipient) {
+ foreach ($this->recipients as $recipient) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.callr.com/rest/v1.1/sms",
@@ -74,7 +74,7 @@ class Callr extends Core {
)
),
CURLOPT_HTTPHEADER => array(
- "authorization: Basic " . base64_encode($this->username . ":" . $this->password),
+ "authorization: Basic ".base64_encode($this->username.":".$this->password),
"content-type: application/json"
),
));
@@ -82,13 +82,15 @@ class Callr extends Core {
$result = json_decode(curl_exec($curl), true);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- if($err = curl_errno($curl) || $httpcode != 200 || $result['status'] == "error") {
+ if ($err = curl_errno($curl) || $httpcode != 200 || $result['status'] == "error") {
$success = 0;
- $error = "HTTP_code: ".$httpcode.".\ncURL error (".$err."): ".curl_strerror($err).". Result: ".$result['data']['code']." - ".$result['data']['message'];
+ $error = "HTTP_code: ".$httpcode.".\ncURL error (".$err."): ".curl_strerror($err).". Result: ".$result['data']['code']." - ".$result['data']['message'];
}
curl_close($curl);
}
- if($success) return 1;
+ if ($success) {
+ return 1;
+ }
return $error;
}
-}
+}
\ No newline at end of file
diff --git a/src/psm/Txtmsg/ClickSend.php b/src/psm/Txtmsg/ClickSend.php
index 869fea43..b0408ddb 100644
--- a/src/psm/Txtmsg/ClickSend.php
+++ b/src/psm/Txtmsg/ClickSend.php
@@ -31,35 +31,37 @@ namespace psm\Txtmsg;
class ClickSend extends Core {
/**
- * Send sms using the SMSgw.NET 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 int or string
- */
+ * Send sms using the SMSgw.NET 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 int or string
+ */
public function sendSMS($message) {
$error = "";
$success = 1;
- if(empty($this->recipients)) return false;
+ if (empty($this->recipients)) {
+ return false;
+ }
$data = array('messages' => array());
- foreach($this->recipients as $recipient) {
+ foreach ($this->recipients as $recipient) {
$data['messages'][] = array(
'source' => 'phpservermon',
- 'from' => substr($this->originator,0,11),
+ 'from' => substr($this->originator, 0, 11),
'to' => $recipient,
'body' => $message,
);
@@ -76,21 +78,23 @@ class ClickSend extends Core {
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => array(
- "authorization: Basic " . base64_encode($this->username . ":" . $this->password),
+ "authorization: Basic ".base64_encode($this->username.":".$this->password),
"content-type: application/json"
),
));
- $result = json_decode(curl_exec($curl),true);
+ $result = json_decode(curl_exec($curl), true);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- if($err = curl_errno($curl) || ($httpcode != '200' && $httpcode != '201' && $httpcode != '202' && $result['response_code'] != "SUCCESS")) {
+ if ($err = curl_errno($curl) || ($httpcode != '200' && $httpcode != '201' && $httpcode != '202' && $result['response_code'] != "SUCCESS")) {
$success = 0;
$error = "HTTP_code: ".$httpcode.".\ncURL error (".$err."): ".curl_strerror($err).". Result: ".$result."";
}
curl_close($curl);
- if($success) return 1;
+ if ($success) {
+ return 1;
+ }
return $error;
}
}
\ No newline at end of file
diff --git a/src/psm/Txtmsg/Clickatell.php b/src/psm/Txtmsg/Clickatell.php
index a4a3487c..6eeab218 100644
--- a/src/psm/Txtmsg/Clickatell.php
+++ b/src/psm/Txtmsg/Clickatell.php
@@ -31,23 +31,23 @@ namespace psm\Txtmsg;
class Clickatell extends Core {
/**
- * Send sms using the Clickatell API
- * @var string $message
- * @var array $this->recipients
- * @var string $recipient
- * @var string $this->password
- * @var string $this->originator
- *
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the Clickatell API
+ * @var string $message
+ * @var array $this->recipients
+ * @var string $recipient
+ * @var string $this->password
+ * @var string $this->originator
+ *
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$success = 1;
$error = '';
- foreach($this->recipients as $recipient) {
+ foreach ($this->recipients as $recipient) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://platform.clickatell.com/messages/http/send?apiKey=".urlencode($this->password)."&to=".urlencode($recipient)."&content=".urlencode($message));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@@ -63,7 +63,7 @@ class Clickatell extends Core {
$success = 0;
}
}
- if($success == 1){
+ if ($success) {
return 1;
}
return $error;
diff --git a/src/psm/Txtmsg/FreeMobileSMS.php b/src/psm/Txtmsg/FreeMobileSMS.php
index 16acd9ff..892df76c 100644
--- a/src/psm/Txtmsg/FreeMobileSMS.php
+++ b/src/psm/Txtmsg/FreeMobileSMS.php
@@ -30,28 +30,28 @@ namespace psm\Txtmsg;
class FreeMobileSMS extends Core {
/**
- * Send sms using the FreeMobileSMS API
- *
- * @var string $message
- * @var string $this->password
- * @var string $this->username
- *
- * @var resource $curl
- * @var string $err
- * @var int $success
- * @var string $error
- * @var string $http_code
- *
- * @return int or string
- */
+ * Send sms using the FreeMobileSMS API
+ *
+ * @var string $message
+ * @var string $this->password
+ * @var string $this->username
+ *
+ * @var resource $curl
+ * @var string $err
+ * @var int $success
+ * @var string $error
+ * @var string $http_code
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$success = 1;
$error = "";
$curl = curl_init();
- curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl,CURLOPT_URL, "https://smsapi.free-mobile.fr/sendmsg?" . http_build_query(
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_URL, "https://smsapi.free-mobile.fr/sendmsg?".http_build_query(
array(
"user" => $this->username,
"pass" => $this->password,
@@ -63,13 +63,15 @@ class FreeMobileSMS extends Core {
$result = curl_exec($curl);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- if($err = curl_errno($curl) || $httpcode != 200) {
+ if ($err = curl_errno($curl) || $httpcode != 200) {
$success = 0;
- $error = "HTTP_code: ".$httpcode.".\ncURL error (".$err."): ".curl_strerror($err);
+ $error = "HTTP_code: ".$httpcode.".\ncURL error (".$err."): ".curl_strerror($err);
}
curl_close($curl);
- if($success) return 1;
+ if ($success) {
+ return 1;
+ }
return $error;
}
}
diff --git a/src/psm/Txtmsg/FreeVoipDeal.php b/src/psm/Txtmsg/FreeVoipDeal.php
index 76d02fb4..371a6a6b 100755
--- a/src/psm/Txtmsg/FreeVoipDeal.php
+++ b/src/psm/Txtmsg/FreeVoipDeal.php
@@ -31,22 +31,22 @@ namespace psm\Txtmsg;
class FreeVoipDeal extends Core {
/**
- * Send sms using the FreeVoipDeal API
- * @var string $message
- * @var string $this->password
- * @var array $this->recipients
- * @var array $this->originator
- *
- * @var resource $curl
- * @var string $err
- * @var string $recipient
- * @var string $from
- * @var mixed $result
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the FreeVoipDeal API
+ * @var string $message
+ * @var string $this->password
+ * @var array $this->recipients
+ * @var array $this->originator
+ *
+ * @var resource $curl
+ * @var string $err
+ * @var string $recipient
+ * @var string $from
+ * @var mixed $result
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$error = "";
@@ -54,10 +54,10 @@ class FreeVoipDeal extends Core {
$message = rawurlencode($message);
- foreach($this->recipients as $recipient) {
+ foreach ($this->recipients as $recipient) {
$curl = curl_init();
- curl_setopt($curl,CURLOPT_URL, "https://www.freevoipdeal.com/myaccount/sendsms.php?" . http_build_query(
+ curl_setopt($curl, CURLOPT_URL, "https://www.freevoipdeal.com/myaccount/sendsms.php?".http_build_query(
array(
"username" => $this->username,
"password" => $this->password,
@@ -67,19 +67,21 @@ class FreeVoipDeal extends Core {
)
)
);
- curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
- if($err || is_numeric(strpos($result, "failure"))) {
+ if ($err || is_numeric(strpos($result, "failure"))) {
$success = 0;
$error = $result;
}
}
- if($success) return 1;
+ if ($success) {
+ return 1;
+ }
return $error;
}
}
diff --git a/src/psm/Txtmsg/GatewayAPI.php b/src/psm/Txtmsg/GatewayAPI.php
index 6fc80e01..7229ff6e 100644
--- a/src/psm/Txtmsg/GatewayAPI.php
+++ b/src/psm/Txtmsg/GatewayAPI.php
@@ -32,28 +32,30 @@ namespace psm\Txtmsg;
class GatewayAPI extends Core {
/**
- * Send sms using the GatewayAPI API
- *
- * @var string $message
- * @var string $this->password
- * @var array $this->recipients
- * @var array $this->originator
- * @var string $recipient
- * @var mixed $result
- *
- * @var resource $curl
- * @var string $err
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the GatewayAPI API
+ *
+ * @var string $message
+ * @var string $this->password
+ * @var array $this->recipients
+ * @var array $this->originator
+ * @var string $recipient
+ * @var mixed $result
+ *
+ * @var resource $curl
+ * @var string $err
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$error = "";
$success = 1;
- if(empty($this->recipients)) return false;
+ if (empty($this->recipients)) {
+ return false;
+ }
$json = [
'sender' => isset($this->originator) ? $this->originator : "PHPServerMon",
@@ -61,28 +63,30 @@ class GatewayAPI extends Core {
'recipients' => [],
];
- foreach($this->recipients as $recipient) {
+ foreach ($this->recipients as $recipient) {
$json['recipients'][] = ['msisdn' => $recipient];
}
$curl = curl_init();
- curl_setopt($curl,CURLOPT_URL, "https://gatewayapi.com/rest/mtsms");
- curl_setopt($curl,CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
- curl_setopt($curl,CURLOPT_USERPWD, $this->password . ":");
- curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($json));
- curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_URL, "https://gatewayapi.com/rest/mtsms");
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
+ curl_setopt($curl, CURLOPT_USERPWD, $this->password.":");
+ curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($json));
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- $result = json_decode(curl_exec($curl),true);
+ $result = json_decode(curl_exec($curl), true);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$err = curl_error($curl);
curl_close($curl);
- if($err || $httpcode != 200) {
+ if ($err || $httpcode != 200) {
$success = 0;
$error = $result['code']." - ".$result['message'];
}
- if($success) return 1;
+ if ($success) {
+ return 1;
+ }
return $error;
}
-}
+}
\ No newline at end of file
diff --git a/src/psm/Txtmsg/Inetworx.php b/src/psm/Txtmsg/Inetworx.php
index 1710cd0e..dbb3427d 100644
--- a/src/psm/Txtmsg/Inetworx.php
+++ b/src/psm/Txtmsg/Inetworx.php
@@ -31,29 +31,29 @@ namespace psm\Txtmsg;
class Inetworx extends Core {
/**
- * Send sms using the Inetworx API
- *
- * @var string $message
- * @var string $this->password
- * @var array $this->recipients
- * @var array $this->originator
- *
- * @var resource $curl
- * @var string $err
- * @var string $recipient
- * @var mixed $result
- *
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the Inetworx API
+ *
+ * @var string $message
+ * @var string $this->password
+ * @var array $this->recipients
+ * @var array $this->originator
+ *
+ * @var resource $curl
+ * @var string $err
+ * @var string $recipient
+ * @var mixed $result
+ *
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$error = "";
$success = 1;
- foreach($this->recipients as $recipient) {
+ foreach ($this->recipients as $recipient) {
$curl = curl_init();
curl_setopt_array($curl, array(
@@ -74,7 +74,7 @@ class Inetworx extends Core {
)
),
CURLOPT_HTTPHEADER => array(
- "authorization: Basic " . base64_encode("inetworxag:conn2smsapp"),
+ "authorization: Basic ".base64_encode("inetworxag:conn2smsapp"),
"content-type: application/x-www-form-urlencoded"
),
));
@@ -82,14 +82,16 @@ class Inetworx extends Core {
$result = curl_exec($curl);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- if($err = curl_errno($curl) || $httpcode != 200 || strpos($result, "200") === false) {
+ if ($err = curl_errno($curl) || $httpcode != 200 || strpos($result, "200") === false) {
$success = 0;
- $error = "HTTP_code: ".$httpcode.".\ncURL error (".$err."): ".curl_strerror($err).". \nResult: ".$result;
+ $error = "HTTP_code: ".$httpcode.".\ncURL error (".$err."): ".curl_strerror($err).". \nResult: ".$result;
}
curl_close($curl);
}
- if($success) return 1;
+ if ($success) {
+ return 1;
+ }
return $error;
}
-}
+}
\ No newline at end of file
diff --git a/src/psm/Txtmsg/Messagebird.php b/src/psm/Txtmsg/Messagebird.php
index 8e93c921..33415b5a 100644
--- a/src/psm/Txtmsg/Messagebird.php
+++ b/src/psm/Txtmsg/Messagebird.php
@@ -32,23 +32,23 @@ namespace psm\Txtmsg;
class Messagebird extends Core {
/**
- * Send sms using the Messagebird API
- * @var string $message
- * @var array $this->recipients
- * @var array $this->originator (Max 11 characters)
- * @var array $recipients_chunk
- * @var string $this->password
- *
- * @var mixed $result
- * @var array $headers
- *
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
- public function sendSMS($message) {
- $success = 1;
+ * Send sms using the Messagebird API
+ * @var string $message
+ * @var array $this->recipients
+ * @var array $this->originator (Max 11 characters)
+ * @var array $recipients_chunk
+ * @var string $this->password
+ *
+ * @var mixed $result
+ * @var array $headers
+ *
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
+ public function sendSMS($message) {
+ $success = 1;
$error = '';
// Maximum of 50 users a time.
@@ -76,9 +76,9 @@ class Messagebird extends Core {
$success = 0;
}
}
- if($success == 1){
+ if ($success) {
return 1;
}
return $error;
}
-}
+}
\ No newline at end of file
diff --git a/src/psm/Txtmsg/Mosms.php b/src/psm/Txtmsg/Mosms.php
index 49861d46..7b093567 100644
--- a/src/psm/Txtmsg/Mosms.php
+++ b/src/psm/Txtmsg/Mosms.php
@@ -31,32 +31,32 @@ namespace psm\Txtmsg;
class Mosms extends Core {
/**
- * Send sms using the Mosms API
- *
- * @var string $message
- * @var array $this->username
- * @var string $this->password
- * @var array $this->recipients
- * @var string $recipient
- * @var array $this->originator (Max 11 characters)
- *
- * @var resource $curl
- * @var string $err
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the Mosms API
+ *
+ * @var string $message
+ * @var array $this->username
+ * @var string $this->password
+ * @var array $this->recipients
+ * @var string $recipient
+ * @var array $this->originator (Max 11 characters)
+ *
+ * @var resource $curl
+ * @var string $err
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$error = "";
$success = 1;
$message = rawurlencode($message);
- foreach($this->recipients as $recipient) {
+ foreach ($this->recipients as $recipient) {
$curl = curl_init();
- curl_setopt($curl,CURLOPT_URL, "https://www.mosms.com/se/sms-send.php?" . http_build_query(
+ curl_setopt($curl, CURLOPT_URL, "https://www.mosms.com/se/sms-send.php?".http_build_query(
array(
"username" => $this->username,
"password" => $this->password,
@@ -67,13 +67,13 @@ class Mosms extends Core {
)
)
);
- curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$result = curl_exec($curl);
$err = curl_error($curl);
- if($err = curl_errno($curl) || $httpcode != 200 || $result == 2 || $result == 5) {
+ if ($err = curl_errno($curl) || $httpcode != 200 || $result == 2 || $result == 5) {
$success = 0;
$error = "HTTP_code: ".$httpcode.".\ncURL error (".$err."): ".curl_strerror($err).". \nResult: ".$result;
}
@@ -81,7 +81,9 @@ class Mosms extends Core {
}
- if($success) return 1;
+ if ($success) {
+ return 1;
+ }
return $error;
}
-}
+}
\ No newline at end of file
diff --git a/src/psm/Txtmsg/Nexmo.php b/src/psm/Txtmsg/Nexmo.php
index a10c0e69..efe4dba5 100644
--- a/src/psm/Txtmsg/Nexmo.php
+++ b/src/psm/Txtmsg/Nexmo.php
@@ -32,23 +32,23 @@ class Nexmo extends Core {
/**
- * Send sms using the GatewayAPI API
- *
- * @var string $message
- * @var string $this->password
- * @var array $this->recipients
- * @var array $this->originator
- * @var string $recipient
- *
- * @var resource $curl
- * @var string $err
- * @var mixed $result
- *
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the GatewayAPI API
+ *
+ * @var string $message
+ * @var string $this->password
+ * @var array $this->recipients
+ * @var array $this->originator
+ * @var string $recipient
+ *
+ * @var resource $curl
+ * @var string $err
+ * @var mixed $result
+ *
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$success = 1;
@@ -56,11 +56,11 @@ class Nexmo extends Core {
$message = rawurlencode($message);
- foreach($this->recipients as $recipient) {
+ foreach ($this->recipients as $recipient) {
$curl = curl_init();
- curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl,CURLOPT_URL, "https://rest.nexmo.com/sms/json?" . http_build_query(
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_URL, "https://rest.nexmo.com/sms/json?".http_build_query(
array(
"api_key" => $this->username,
"api_secret" => $this->password,
@@ -71,12 +71,12 @@ class Nexmo extends Core {
)
);
- $result = json_decode(curl_exec($curl),true);
+ $result = json_decode(curl_exec($curl), true);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$err = curl_error($curl);
- if($err = curl_errno($curl) || $httpcode != 200 || $result['messages'][0]['status'] != "0") {
+ if ($err = curl_errno($curl) || $httpcode != 200 || $result['messages'][0]['status'] != "0") {
$success = 0;
$error = "HTTP_code: ".$httpcode.".\ncURL error (".$err."): ".curl_strerror($err).". \nResult: ".$result['messages'][0]['error-text'];
}
@@ -84,7 +84,9 @@ class Nexmo extends Core {
}
- if($success) return 1;
+ if ($success) {
+ return 1;
+ }
return $error;
}
-}
+}
\ No newline at end of file
diff --git a/src/psm/Txtmsg/Octopush.php b/src/psm/Txtmsg/Octopush.php
index 099b7287..32b01750 100644
--- a/src/psm/Txtmsg/Octopush.php
+++ b/src/psm/Txtmsg/Octopush.php
@@ -33,25 +33,25 @@ namespace psm\Txtmsg;
class Octopush extends Core {
/**
- * Send sms using the Octopush API
- * @var string $message
- * @var string $this->username
- * @var string $this->password
- * @var array $this->recipients
- * @var array $this->originator
- *
- * @var resource $curl
- * @var SimpleXMLElement $xmlResults
- * @var string $err
- * @var string $recipient
- * @var string $smsType
- * @var mixed $result
- *
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the Octopush API
+ * @var string $message
+ * @var string $this->username
+ * @var string $this->password
+ * @var array $this->recipients
+ * @var array $this->originator
+ *
+ * @var resource $curl
+ * @var SimpleXMLElement $xmlResults
+ * @var string $err
+ * @var string $recipient
+ * @var string $smsType
+ * @var mixed $result
+ *
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$error = "";
@@ -60,10 +60,10 @@ class Octopush extends Core {
$recipients = join(',', $this->recipients);
- $message = ($smsType == "FR") ? urlencode($message . " STOP au XXXX") : urlencode($message);
+ $message = ($smsType == "FR") ? urlencode($message." STOP au XXXX") : urlencode($message);
$curl = curl_init();
- curl_setopt($curl,CURLOPT_URL, "http://www.octopush-dm.com/api/sms/?" . http_build_query(
+ curl_setopt($curl, CURLOPT_URL, "http://www.octopush-dm.com/api/sms/?".http_build_query(
array(
"user_login" => $this->username,
"api_key" => $this->password,
@@ -74,19 +74,21 @@ class Octopush extends Core {
)
)
);
- curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$xmlResults = simplexml_load_string($result);
- if($err = curl_errno($curl) || $httpcode != 200 || $xmlResults === false || $xmlResults->error_code != '000') {
+ if ($err = curl_errno($curl) || $httpcode != 200 || $xmlResults === false || $xmlResults->error_code != '000') {
$success = 0;
$error = "HTTP_code: ".$httpcode.".\ncURL error (".$err."): ".curl_strerror($err).". \nResult: ".$xmlResults->error_code.". Look at http://www.octopush-dm.com/en/errors for the error description.";
}
curl_close($curl);
- if($success) return 1;
+ if ($success) {
+ return 1;
+ }
return $error;
}
-}
+}
\ No newline at end of file
diff --git a/src/psm/Txtmsg/Plivo.php b/src/psm/Txtmsg/Plivo.php
index 9591e167..267ca804 100644
--- a/src/psm/Txtmsg/Plivo.php
+++ b/src/psm/Txtmsg/Plivo.php
@@ -32,33 +32,35 @@ namespace psm\Txtmsg;
class Plivo extends Core {
/**
- * Send sms using the Plivo 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 int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the Plivo 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 int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$error = "";
$success = 1;
- if(empty($this->recipients)) return false;
+ if (empty($this->recipients)) {
+ return false;
+ }
$recipients = join('<', $this->recipients);
$curl = curl_init();
curl_setopt_array($curl, array(
- CURLOPT_URL => "https://api.plivo.com/v1/Account/" . $this->username . "/Message/",
+ CURLOPT_URL => "https://api.plivo.com/v1/Account/".$this->username."/Message/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
@@ -73,20 +75,22 @@ class Plivo extends Core {
)
),
CURLOPT_HTTPHEADER => array(
- "authorization: Basic " . base64_encode($this->username . ":" . $this->password),
+ "authorization: Basic ".base64_encode($this->username.":".$this->password),
"content-type: application/json"
),
));
$result = curl_exec($curl);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- if($err = curl_errno($curl) || ($httpcode != '200' && $httpcode != '201' && $httpcode != '202')) {
+ if ($err = curl_errno($curl) || ($httpcode != '200' && $httpcode != '201' && $httpcode != '202')) {
$success = 0;
$error = "HTTP_code: ".$httpcode.".\ncURL error (".$err."): ".curl_strerror($err).". Result: ".$result."";
}
curl_close($curl);
- if($success) return 1;
+ if ($success) {
+ return 1;
+ }
return $error;
}
-}
+}
\ No newline at end of file
diff --git a/src/psm/Txtmsg/Smsglobal.php b/src/psm/Txtmsg/Smsglobal.php
index fcfa7fc6..e234e47b 100644
--- a/src/psm/Txtmsg/Smsglobal.php
+++ b/src/psm/Txtmsg/Smsglobal.php
@@ -31,23 +31,23 @@ namespace psm\Txtmsg;
class Smsglobal extends Core {
/**
- * Send sms using the Smsglobal API
- * @var string $message
- * @var string $this->password
- * @var array $this->recipients
- * @var array $this->originator
- *
- * @var resource $curl
- * @var string $err
- * @var string $recipient
- * @var string $from
- * @var mixed $result
- *
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the Smsglobal API
+ * @var string $message
+ * @var string $this->password
+ * @var array $this->recipients
+ * @var array $this->originator
+ *
+ * @var resource $curl
+ * @var string $err
+ * @var string $recipient
+ * @var string $from
+ * @var mixed $result
+ *
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$error = "";
@@ -55,13 +55,13 @@ class Smsglobal extends Core {
$recipients = join(',', $this->recipients);
- $from = substr($this->originator,0 , 11); // Max 11 Characters
+ $from = substr($this->originator, 0, 11); // Max 11 Characters
$message = substr(rawurlencode($message), 0, 153);
$curl = curl_init();
- curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl,CURLOPT_TIMEOUT, 30);
- curl_setopt($curl,CURLOPT_URL, "https://www.smsglobal.com/http-api.php?" . http_build_query(
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
+ curl_setopt($curl, CURLOPT_URL, "https://www.smsglobal.com/http-api.php?".http_build_query(
array(
"action" => "sendsms",
"user" => $this->username,
@@ -79,14 +79,16 @@ class Smsglobal extends Core {
$result = curl_exec($curl);
$err = curl_error($curl);
- if($err = curl_errno($curl) || substr($result, 0, 5) != "OK: 0") {
+ if ($err = curl_errno($curl) || substr($result, 0, 5) != "OK: 0") {
$success = 0;
$result = ($result == '') ? 'Wrong input, please check if all values are correct!' : $result;
$error = "HTTP_code: ".$httpcode.".\ncURL error (".$err."): ".curl_strerror($err).". \nResult: ".$result;
}
curl_close($curl);
- if($success) return 1;
+ if ($success) {
+ return 1;
+ }
return $error;
}
-}
+}
\ No newline at end of file
diff --git a/src/psm/Txtmsg/Smsgw.php b/src/psm/Txtmsg/Smsgw.php
index 8c7b145d..8abb9f33 100644
--- a/src/psm/Txtmsg/Smsgw.php
+++ b/src/psm/Txtmsg/Smsgw.php
@@ -32,21 +32,21 @@ namespace psm\Txtmsg;
class Smsgw extends Core {
/**
- * Send sms using the SMSgw.NET 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 int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the SMSgw.NET 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 int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$error = "";
@@ -74,13 +74,15 @@ class Smsgw extends Core {
$result = curl_exec($curl);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- if($err = curl_errno($curl) || ($httpcode != '200' && $httpcode != '201' && $httpcode != '202' && $result != "1")) {
+ if ($err = curl_errno($curl) || ($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;
+ if ($success) {
+ return 1;
+ }
return $error;
}
-}
+}
\ No newline at end of file
diff --git a/src/psm/Txtmsg/Smsit.php b/src/psm/Txtmsg/Smsit.php
index 4dbf7dbe..7f199f88 100644
--- a/src/psm/Txtmsg/Smsit.php
+++ b/src/psm/Txtmsg/Smsit.php
@@ -31,53 +31,55 @@ namespace psm\Txtmsg;
class Smsit extends Core {
/**
- * Send sms using the Smsit API
- *
- * @var string $message
- * @var string $this->password
- * @var array $this->recipients
- * @var array $this->originator
- *
- * @var resource $curl
- * @var string $err
- * @var String $recipient
- * @var mixed $result
- *
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the Smsit API
+ *
+ * @var string $message
+ * @var string $this->password
+ * @var array $this->recipients
+ * @var array $this->originator
+ *
+ * @var resource $curl
+ * @var string $err
+ * @var String $recipient
+ * @var mixed $result
+ *
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$success = 1;
$error = "";
- foreach( $this->recipients as $recipient ){
+ foreach ($this->recipients as $recipient) {
$curl = curl_init();
- curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl,CURLOPT_URL, "https://www.smsit.dk/api/v2?" . http_build_query(
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_URL, "https://www.smsit.dk/api/v2?".http_build_query(
array(
"apiKey" => $this->password,
"mobile" => $recipient,
"message" => urlencode($message),
- "senderId" => substr($this->originator,0,11),
+ "senderId" => substr($this->originator, 0, 11),
)
)
);
$result = curl_exec($curl);
- $err =curl_error($curl);
+ $err = curl_error($curl);
curl_close($curl);
- if($err || is_numeric(strpos($result, "{\"errors\":[{\"code\":"))) {
+ if ($err || is_numeric(strpos($result, "{\"errors\":[{\"code\":"))) {
$success = 0;
$error = $result;
}
}
- if($success) return 1;
+ if ($success) {
+ return 1;
+ }
return $error;
}
-}
+}
\ No newline at end of file
diff --git a/src/psm/Txtmsg/SolutionsInfini.php b/src/psm/Txtmsg/SolutionsInfini.php
index 10a5fb2a..96a38f99 100644
--- a/src/psm/Txtmsg/SolutionsInfini.php
+++ b/src/psm/Txtmsg/SolutionsInfini.php
@@ -32,22 +32,22 @@ namespace psm\Txtmsg;
class SolutionsInfini extends Core {
/**
- * Send sms using the SolutionsInfini API
- *
- * @var string $message
- * @var string $this->password
- * @var array $this->recipients
- * @var string $recipients
- * @var array $this->originator (Max 11 characters)
- *
- * @var resource $curl
- * @var string $err
- *
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the SolutionsInfini API
+ *
+ * @var string $message
+ * @var string $this->password
+ * @var array $this->recipients
+ * @var string $recipients
+ * @var array $this->originator (Max 11 characters)
+ *
+ * @var resource $curl
+ * @var string $err
+ *
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$error = "";
@@ -58,7 +58,7 @@ class SolutionsInfini extends Core {
$recipients = join(',', $this->recipients);
$curl = curl_init();
- curl_setopt($curl,CURLOPT_URL, "https://api-alerts.solutionsinfini.com/v4/?" . http_build_query(
+ curl_setopt($curl, CURLOPT_URL, "https://api-alerts.solutionsinfini.com/v4/?".http_build_query(
array(
"api_key" => $this->password,
"method" => "sms",
@@ -68,18 +68,20 @@ class SolutionsInfini extends Core {
)
)
);
- curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$result = json_decode(curl_exec($curl), true);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- if($err = curl_errno($curl) || $httpcode != 200 || $result['status'] != "OK") {
+ if ($err = curl_errno($curl) || $httpcode != 200 || $result['status'] != "OK") {
$success = 0;
$error = "HTTP_code: ".$httpcode.".\ncURL error (".$err."): ".curl_strerror($err).". Result: ".$result['status']." - ".$result['message'].".";
}
curl_close($curl);
- if($success) return 1;
+ if ($success) {
+ return 1;
+ }
return $error;
}
-}
+}
\ No newline at end of file
diff --git a/src/psm/Txtmsg/Spryng.php b/src/psm/Txtmsg/Spryng.php
index c85abf46..bfea1470 100644
--- a/src/psm/Txtmsg/Spryng.php
+++ b/src/psm/Txtmsg/Spryng.php
@@ -30,23 +30,22 @@ namespace psm\Txtmsg;
class Spryng extends Core {
/**
- * Send sms using the Spryngsms API
- * @var string $message
- * @var array $this->recipients
- * @var string $this->username
- * @var string $this->password
- * @var string $this->originator
-
- * @var mixed $result
- * @var array $headers
- *
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the Spryngsms API
+ * @var string $message
+ * @var array $this->recipients
+ * @var string $this->username
+ * @var string $this->password
+ * @var string $this->originator
+ * @var mixed $result
+ * @var array $headers
+ *
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
- public function sendSMS($message) {
+ public function sendSMS($message) {
$recipients = implode(",", $this->recipients);
$ch = curl_init();
diff --git a/src/psm/Txtmsg/Textmarketer.php b/src/psm/Txtmsg/Textmarketer.php
index ac8f9cf9..f91415f3 100644
--- a/src/psm/Txtmsg/Textmarketer.php
+++ b/src/psm/Txtmsg/Textmarketer.php
@@ -32,27 +32,27 @@ namespace psm\Txtmsg;
class Textmarketer extends Core {
/**
- * Send sms using the Textmarketer API
- * @var string $message
- * @var array $this->recipients
- * @var string $recipient
- * @var string $this->username
- * @var string $this->password
- * @var mixed $result
- * @var array $headers
- *
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the Textmarketer API
+ * @var string $message
+ * @var array $this->recipients
+ * @var string $recipient
+ * @var string $this->username
+ * @var string $this->password
+ * @var mixed $result
+ * @var array $headers
+ *
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
- public function sendSMS($message) {
- $success = 1;
+ public function sendSMS($message) {
+ $success = 1;
$error = '';
- foreach( $this->recipients as $recipient ){
+ foreach ($this->recipients as $recipient) {
- $ch = curl_init();
+ $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.textmarketer.co.uk/gateway/?username=".$this->username."&password=".$this->password."&to=".$recipient."&message=".urlencode($message)."&orig=SERVERALERT");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$headers = array();
@@ -61,15 +61,15 @@ class Textmarketer extends Core {
$result = curl_exec($ch);
curl_close($ch);
- // Check on error
- if (is_numeric(strpos($result, "FAILED"))) {
- $error = $result;
- $success = 0;
- }
- }
- if($success == 1){
- return 1;
- }
- return $error;
- }
+ // Check on error
+ if (is_numeric(strpos($result, "FAILED"))) {
+ $error = $result;
+ $success = 0;
+ }
+ }
+ if ($success == 1) {
+ return 1;
+ }
+ return $error;
+ }
}
diff --git a/src/psm/Txtmsg/Twilio.php b/src/psm/Txtmsg/Twilio.php
index 6133f362..54d5cf74 100644
--- a/src/psm/Txtmsg/Twilio.php
+++ b/src/psm/Txtmsg/Twilio.php
@@ -30,34 +30,34 @@ namespace psm\Txtmsg;
class Twilio extends Core {
/**
- * Send sms using the Twilio API
- * https://www.twilio.com/docs/sms/api#send-an-sms-with-the-sms-api
- * @var string $message
- * @var array $this->recipients
- * @var string $recipient
- * @var string $this->username
- * @var string $this->password
- * @var string $this->originator
- * @var mixed $result
- * @var array $headers
- *
- * @var int $success
- * @var string $error
- *
- * @return int or string
- */
+ * Send sms using the Twilio API
+ * https://www.twilio.com/docs/sms/api#send-an-sms-with-the-sms-api
+ * @var string $message
+ * @var array $this->recipients
+ * @var string $recipient
+ * @var string $this->username
+ * @var string $this->password
+ * @var string $this->originator
+ * @var mixed $result
+ * @var array $headers
+ *
+ * @var int $success
+ * @var string $error
+ *
+ * @return int or string
+ */
public function sendSMS($message) {
$success = 1;
$error = '';
- foreach($this->recipients as $recipient) {
+ foreach ($this->recipients as $recipient) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.twilio.com/2010-04-01/Accounts/".$this->username."/Messages.json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "From=".urlencode($this->originator)."&Body=".urlencode($message)."&To=".urlencode($recipient));
curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_USERPWD, $this->username . ":" . $this->password);
+ curl_setopt($ch, CURLOPT_USERPWD, $this->username.":".$this->password);
$headers = array();
$headers[] = "Content-Type: application/x-www-form-urlencoded";
@@ -72,9 +72,9 @@ class Twilio extends Core {
$success = 0;
}
}
- if($success == 1){
+ if ($success) {
return 1;
}
return $error;
}
-}
+}
\ No newline at end of file
diff --git a/src/psm/Util/Install/Installer.php b/src/psm/Util/Install/Installer.php
index 184e559a..cfc328dc 100644
--- a/src/psm/Util/Install/Installer.php
+++ b/src/psm/Util/Install/Installer.php
@@ -71,14 +71,14 @@ class Installer {
public function isUpgradeRequired() {
$version_db = psm_get_conf('version');
- if(version_compare(PSM_VERSION, $version_db, '==')) {
+ if (version_compare(PSM_VERSION, $version_db, '==')) {
// version is up to date
return false;
}
// 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, PSM_VERSION, '<')) {
+ if (version_compare($version_db, PSM_VERSION, '<')) {
return true;
} else {
// change database version to current version so this check won't be required next time
@@ -93,10 +93,10 @@ class Installer {
* @return \psm\Util\Install\Installer
*/
protected function log($msg) {
- if(is_callable($this->logger)) {
+ if (is_callable($this->logger)) {
$msg = (!is_array($msg)) ? array($msg) : $msg;
- foreach($msg as $m) {
+ foreach ($msg as $m) {
call_user_func($this->logger, $m);
}
}
@@ -111,7 +111,7 @@ class Installer {
protected function execSQL($query) {
$query = (!is_array($query)) ? array($query) : $query;
- foreach($query as $q) {
+ foreach ($query as $q) {
$this->queries[] = $q;
$this->db->exec($q);
}
@@ -126,9 +126,9 @@ class Installer {
$this->log('Populating database...');
$queries = array();
- $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "servers` (`ip`, `port`, `label`, `type`, `pattern`, `pattern_online`, `status`, `rtime`, `active`, `email`, `sms`, `pushover`, `telegram`) VALUES ('http://sourceforge.net/index.php', 80, 'SourceForge', 'website', '', 'yes','on', '0.0000000', 'yes', 'yes', 'yes', 'yes', 'yes'), ('smtp.gmail.com', 465, 'Gmail SMTP', 'service', '', 'yes', 'on', '0.0000000', 'yes', 'yes', 'yes', 'yes', 'yes')";
- $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "users_servers` (`user_id`,`server_id`) VALUES (1, 1), (1, 2);";
- $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUE
+ $queries[] = "INSERT INTO `".PSM_DB_PREFIX."servers` (`ip`, `port`, `label`, `type`, `pattern`, `pattern_online`, `status`, `rtime`, `active`, `email`, `sms`, `pushover`, `telegram`) VALUES ('http://sourceforge.net/index.php', 80, 'SourceForge', 'website', '', 'yes','on', '0.0000000', 'yes', 'yes', 'yes', 'yes', 'yes'), ('smtp.gmail.com', 465, 'Gmail SMTP', 'service', '', 'yes', 'on', '0.0000000', 'yes', 'yes', 'yes', 'yes', 'yes')";
+ $queries[] = "INSERT INTO `".PSM_DB_PREFIX."users_servers` (`user_id`,`server_id`) VALUES (1, 1), (1, 2);";
+ $queries[] = "INSERT INTO `".PSM_DB_PREFIX."config` (`key`, `value`) VALUE
('language', 'en_US'),
('proxy', '0'),
('proxy_url', ''),
@@ -152,7 +152,7 @@ class Installer {
('pushover_api_token', ''),
('telegram_status', '0'),
('telegram_api_token', ''),
- ('password_encrypt_key', '" . sha1(microtime()) . "'),
+ ('password_encrypt_key', '".sha1(microtime())."'),
('alert_type', 'status'),
('log_status', '1'),
('log_email', '1'),
@@ -160,8 +160,8 @@ class Installer {
('log_pushover', '1'),
('log_telegram', '1'),
('log_retention_period', '365'),
- ('version', '" . PSM_VERSION . "'),
- ('version_update_check', '" . PSM_VERSION . "'),
+ ('version', '".PSM_VERSION."'),
+ ('version_update_check', '".PSM_VERSION."'),
('auto_refresh_servers', '0'),
('show_update', '1'),
('last_update_check', '0'),
@@ -175,12 +175,12 @@ class Installer {
*/
protected function installTables() {
$tables = array(
- PSM_DB_PREFIX . 'config' => "CREATE TABLE `" . PSM_DB_PREFIX . "config` (
+ PSM_DB_PREFIX.'config' => "CREATE TABLE `".PSM_DB_PREFIX."config` (
`key` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
- PSM_DB_PREFIX . 'users' => "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "users` (
+ PSM_DB_PREFIX.'users' => "CREATE TABLE IF NOT EXISTS `".PSM_DB_PREFIX."users` (
`user_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_name` varchar(64) NOT NULL COMMENT 'user''s name, unique',
`password` varchar(255) NOT NULL COMMENT 'user''s password in salted and hashed format',
@@ -197,18 +197,18 @@ class Installer {
PRIMARY KEY (`user_id`),
UNIQUE KEY `unique_username` (`user_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
- PSM_DB_PREFIX . 'users_preferences' => "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "users_preferences` (
+ PSM_DB_PREFIX.'users_preferences' => "CREATE TABLE IF NOT EXISTS `".PSM_DB_PREFIX."users_preferences` (
`user_id` int(11) unsigned NOT NULL,
`key` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`user_id`, `key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
- PSM_DB_PREFIX . 'users_servers' => "CREATE TABLE `" . PSM_DB_PREFIX . "users_servers` (
+ PSM_DB_PREFIX.'users_servers' => "CREATE TABLE `".PSM_DB_PREFIX."users_servers` (
`user_id` INT( 11 ) UNSIGNED NOT NULL ,
`server_id` INT( 11 ) UNSIGNED NOT NULL ,
PRIMARY KEY ( `user_id` , `server_id` )
) ENGINE = MYISAM ;",
- PSM_DB_PREFIX . 'log' => "CREATE TABLE `" . PSM_DB_PREFIX . "log` (
+ PSM_DB_PREFIX.'log' => "CREATE TABLE `".PSM_DB_PREFIX."log` (
`log_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL,
`type` enum('status','email','sms','pushover','telegram') NOT NULL,
@@ -216,12 +216,12 @@ class Installer {
`datetime` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`log_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
- PSM_DB_PREFIX . 'log_users' => "CREATE TABLE `" . PSM_DB_PREFIX . "log_users` (
+ 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` (
+ PSM_DB_PREFIX.'servers' => "CREATE TABLE `".PSM_DB_PREFIX."servers` (
`server_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ip` varchar(500) NOT NULL,
`port` int(5) unsigned NOT NULL,
@@ -250,7 +250,7 @@ class Installer {
`website_password` varchar(255) DEFAULT NULL,
PRIMARY KEY (`server_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
- PSM_DB_PREFIX . 'servers_uptime' => "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "servers_uptime` (
+ PSM_DB_PREFIX.'servers_uptime' => "CREATE TABLE IF NOT EXISTS `".PSM_DB_PREFIX."servers_uptime` (
`servers_uptime_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL,
`date` datetime NOT NULL,
@@ -259,7 +259,7 @@ class Installer {
PRIMARY KEY (`servers_uptime_id`),
KEY `server_id` (`server_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
- PSM_DB_PREFIX . 'servers_history' => "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "servers_history` (
+ PSM_DB_PREFIX.'servers_history' => "CREATE TABLE IF NOT EXISTS `".PSM_DB_PREFIX."servers_history` (
`servers_history_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL,
`date` date NOT NULL,
@@ -273,14 +273,14 @@ class Installer {
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
);
- foreach($tables as $name => $sql) {
+ foreach ($tables as $name => $sql) {
$if_table_exists = $this->db->query("SHOW TABLES LIKE '{$name}'");
- if(!empty($if_table_exists)) {
- $this->log('Table ' . $name . ' already exists in your database!');
+ if (!empty($if_table_exists)) {
+ $this->log('Table '.$name.' already exists in your database!');
} else {
$this->execSQL($sql);
- $this->log('Table ' . $name . ' added.');
+ $this->log('Table '.$name.' added.');
}
}
}
@@ -292,25 +292,25 @@ class Installer {
* @see isUpgradeRequired()
*/
public function upgrade($version_from, $version_to) {
- if(version_compare($version_from, '2.1.0', '<')) {
+ if (version_compare($version_from, '2.1.0', '<')) {
$this->upgrade210();
}
- if(version_compare($version_from, '3.0.0', '<')) {
+ if (version_compare($version_from, '3.0.0', '<')) {
$this->upgrade300();
}
- if(version_compare($version_from, '3.1.0', '<')) {
+ if (version_compare($version_from, '3.1.0', '<')) {
$this->upgrade310();
}
- if(version_compare($version_from, '3.2.0', '<')) {
+ if (version_compare($version_from, '3.2.0', '<')) {
$this->upgrade320();
}
- if(version_compare($version_from, '3.2.1', '<')) {
+ if (version_compare($version_from, '3.2.1', '<')) {
$this->upgrade321();
}
- if(version_compare($version_from, '3.2.2', '<')) {
+ if (version_compare($version_from, '3.2.2', '<')) {
$this->upgrade322();
}
- if(version_compare($version_from, '3.3.0', '<')) {
+ if (version_compare($version_from, '3.3.0', '<')) {
$this->upgrade330();
}
psm_update_conf('version', $version_to);
@@ -321,19 +321,19 @@ class Installer {
*/
protected function upgrade210() {
$queries = array();
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "config` DROP `config_id`;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "config` ADD PRIMARY KEY ( `key` );";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "config` DROP INDEX `key`;";
- $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUES ('cron_running', '0');";
- $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUES ('cron_running_time', '0');";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."config` DROP `config_id`;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."config` ADD PRIMARY KEY ( `key` );";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."config` DROP INDEX `key`;";
+ $queries[] = "INSERT INTO `".PSM_DB_PREFIX."config` (`key`, `value`) VALUES ('cron_running', '0');";
+ $queries[] = "INSERT INTO `".PSM_DB_PREFIX."config` (`key`, `value`) VALUES ('cron_running_time', '0');";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `error` `error` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `rtime` `rtime` FLOAT( 9, 7 ) NULL;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `last_online` `last_online` DATETIME NULL;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `last_check` `last_check` DATETIME NULL;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `pattern` VARCHAR( 255 ) NOT NULL AFTER `type`;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline` DATETIME NULL;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline_duration` varchar(255) NULL;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` CHANGE `error` `error` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` CHANGE `rtime` `rtime` FLOAT( 9, 7 ) NULL;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` CHANGE `last_online` `last_online` DATETIME NULL;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` CHANGE `last_check` `last_check` DATETIME NULL;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD `pattern` VARCHAR( 255 ) NOT NULL AFTER `type`;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD `last_offline` DATETIME NULL;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD `last_offline_duration` varchar(255) NULL;";
$this->execSQL($queries);
}
@@ -344,32 +344,32 @@ class Installer {
protected function upgrade300() {
$queries = array();
// language is now stored as language code (ISO 639-1) + country code (ISO 3166-1)
- $queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='bg_BG' WHERE `key`='language' AND `value`='bg';";
- $queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='de_DE' WHERE `key`='language' AND `value`='de';";
- $queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='en_US' WHERE `key`='language' AND `value`='en';";
- $queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='fr_FR' WHERE `key`='language' AND `value`='fr';";
- $queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='ko_KR' WHERE `key`='language' AND `value`='kr';";
- $queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='nl_NL' WHERE `key`='language' AND `value`='nl';";
- $queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='pt_BR' WHERE `key`='language' AND `value`='br';";
+ $queries[] = "UPDATE `".PSM_DB_PREFIX."config` SET `value`='bg_BG' WHERE `key`='language' AND `value`='bg';";
+ $queries[] = "UPDATE `".PSM_DB_PREFIX."config` SET `value`='de_DE' WHERE `key`='language' AND `value`='de';";
+ $queries[] = "UPDATE `".PSM_DB_PREFIX."config` SET `value`='en_US' WHERE `key`='language' AND `value`='en';";
+ $queries[] = "UPDATE `".PSM_DB_PREFIX."config` SET `value`='fr_FR' WHERE `key`='language' AND `value`='fr';";
+ $queries[] = "UPDATE `".PSM_DB_PREFIX."config` SET `value`='ko_KR' WHERE `key`='language' AND `value`='kr';";
+ $queries[] = "UPDATE `".PSM_DB_PREFIX."config` SET `value`='nl_NL' WHERE `key`='language' AND `value`='nl';";
+ $queries[] = "UPDATE `".PSM_DB_PREFIX."config` SET `value`='pt_BR' WHERE `key`='language' AND `value`='br';";
- $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUES ('version_update_check', '" . PSM_VERSION . "');";
- $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUES ('email_smtp', '');";
- $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUES ('email_smtp_host', '');";
- $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUES ('email_smtp_port', '');";
- $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUES ('email_smtp_username', '');";
- $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUES ('email_smtp_password', '');";
+ $queries[] = "INSERT INTO `".PSM_DB_PREFIX."config` (`key`, `value`) VALUES ('version_update_check', '".PSM_VERSION."');";
+ $queries[] = "INSERT INTO `".PSM_DB_PREFIX."config` (`key`, `value`) VALUES ('email_smtp', '');";
+ $queries[] = "INSERT INTO `".PSM_DB_PREFIX."config` (`key`, `value`) VALUES ('email_smtp_host', '');";
+ $queries[] = "INSERT INTO `".PSM_DB_PREFIX."config` (`key`, `value`) VALUES ('email_smtp_port', '');";
+ $queries[] = "INSERT INTO `".PSM_DB_PREFIX."config` (`key`, `value`) VALUES ('email_smtp_username', '');";
+ $queries[] = "INSERT INTO `".PSM_DB_PREFIX."config` (`key`, `value`) VALUES ('email_smtp_password', '');";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "log` CHANGE `log_id` `log_id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "log` CHANGE `server_id` `server_id` INT( 11 ) UNSIGNED NOT NULL;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."log` CHANGE `log_id` `log_id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."log` CHANGE `server_id` `server_id` INT( 11 ) UNSIGNED NOT NULL;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `server_id` `server_id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `warning_threshold` MEDIUMINT( 1 ) UNSIGNED NOT NULL DEFAULT '1';";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `warning_threshold_counter` MEDIUMINT( 1 ) UNSIGNED NOT NULL DEFAULT '0';";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline` DATETIME NULL;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline_duration` varchar(255) NULL;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` CHANGE `server_id` `server_id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD `warning_threshold` MEDIUMINT( 1 ) UNSIGNED NOT NULL DEFAULT '1';";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD `warning_threshold_counter` MEDIUMINT( 1 ) UNSIGNED NOT NULL DEFAULT '0';";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD `last_offline` DATETIME NULL;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD `last_offline_duration` varchar(255) NULL;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` CHANGE `user_id` `user_id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users`
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."users` CHANGE `user_id` `user_id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."users`
ADD `user_name` varchar(64) COLLATE utf8_general_ci NOT NULL COMMENT 'user\'s name, unique' AFTER `user_id`,
ADD `password` varchar(255) COLLATE utf8_general_ci NOT NULL COMMENT 'user\'s password in salted and hashed format' AFTER `user_name`,
ADD `password_reset_hash` char(40) COLLATE utf8_general_ci DEFAULT NULL COMMENT 'user\'s password reset code' AFTER `password`,
@@ -377,10 +377,10 @@ class Installer {
ADD `rememberme_token` varchar(64) COLLATE utf8_general_ci DEFAULT NULL COMMENT 'user\'s remember-me cookie token' AFTER `password_reset_timestamp`,
ADD `level` TINYINT( 2 ) UNSIGNED NOT NULL DEFAULT '20' AFTER `rememberme_token`;";
// make sure all current users are admins (previously we didnt have non-admins):
- $queries[] = "UPDATE `" . PSM_DB_PREFIX . "users` SET `user_name`=`email`, `level`=10;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` ADD UNIQUE `unique_username` ( `user_name` );";
+ $queries[] = "UPDATE `".PSM_DB_PREFIX."users` SET `user_name`=`email`, `level`=10;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."users` ADD UNIQUE `unique_username` ( `user_name` );";
- $queries[] = "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "servers_uptime` (
+ $queries[] = "CREATE TABLE IF NOT EXISTS `".PSM_DB_PREFIX."servers_uptime` (
`servers_uptime_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL,
`date` datetime NOT NULL,
@@ -390,7 +390,7 @@ class Installer {
KEY `server_id` (`server_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
- $queries[] = "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "servers_history` (
+ $queries[] = "CREATE TABLE IF NOT EXISTS `".PSM_DB_PREFIX."servers_history` (
`servers_history_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL,
`date` date NOT NULL,
@@ -403,7 +403,7 @@ class Installer {
UNIQUE KEY `server_id_date` (`server_id`,`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
- $queries[] = "CREATE TABLE `" . PSM_DB_PREFIX . "users_servers` (
+ $queries[] = "CREATE TABLE `".PSM_DB_PREFIX."users_servers` (
`user_id` INT( 11 ) UNSIGNED NOT NULL ,
`server_id` INT( 11 ) UNSIGNED NOT NULL ,
PRIMARY KEY ( `user_id` , `server_id` )
@@ -411,19 +411,19 @@ class Installer {
$this->execSQL($queries);
// from 3.0 all user-server relations are in a separate table
- $users = $this->db->select(PSM_DB_PREFIX . 'users', null, array('user_id', 'server_id'));
- foreach($users as $user) {
+ $users = $this->db->select(PSM_DB_PREFIX.'users', null, array('user_id', 'server_id'));
+ foreach ($users as $user) {
$idc = array();
- if($user['server_id'] == '') {
+ if ($user['server_id'] == '') {
continue;
}
- if(strpos($user['server_id'], ',') === false) {
+ if (strpos($user['server_id'], ',') === false) {
$idc[] = $user['server_id'];
} else {
$idc = explode(',', $user['server_id']);
}
- foreach($idc as $id) {
- $this->db->save(PSM_DB_PREFIX . 'users_servers', array(
+ foreach ($idc as $id) {
+ $this->db->save(PSM_DB_PREFIX.'users_servers', array(
'user_id' => $user['user_id'],
'server_id' => $id,
));
@@ -442,17 +442,17 @@ class Installer {
psm_update_conf('pushover_status', 0);
psm_update_conf('log_pushover', 1);
psm_update_conf('pushover_api_token', '');
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` ADD `pushover_key` VARCHAR( 255 ) NOT NULL AFTER `mobile`;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` ADD `pushover_device` VARCHAR( 255 ) NOT NULL AFTER `pushover_key`;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."users` ADD `pushover_key` VARCHAR( 255 ) NOT NULL AFTER `mobile`;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."users` ADD `pushover_device` VARCHAR( 255 ) NOT NULL AFTER `pushover_key`;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `pushover` ENUM( 'yes','no' ) NOT NULL DEFAULT 'yes' AFTER `sms`;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "log` CHANGE `type` `type` ENUM( 'status', 'email', 'sms', 'pushover' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD `pushover` ENUM( 'yes','no' ) NOT NULL DEFAULT 'yes' AFTER `sms`;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."log` CHANGE `type` `type` ENUM( 'status', 'email', 'sms', 'pushover' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `timeout` smallint(1) unsigned NULL DEFAULT NULL;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline` DATETIME NULL;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline_duration` varchar(255) NULL;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD `timeout` smallint(1) unsigned NULL DEFAULT NULL;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD `last_offline` DATETIME NULL;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD `last_offline_duration` varchar(255) NULL;";
- $queries[] = "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "users_preferences` (
+ $queries[] = "CREATE TABLE IF NOT EXISTS `".PSM_DB_PREFIX."users_preferences` (
`user_id` int(11) unsigned NOT NULL,
`key` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
@@ -469,9 +469,9 @@ class Installer {
$queries = array();
psm_update_conf('password_encrypt_key', sha1(microtime()));
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `ip` `ip` VARCHAR(500) NOT NULL;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `website_username` varchar(255) NULL, ADD `website_password` varchar(255) NULL AFTER `website_username`;";
- $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUE
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` CHANGE `ip` `ip` VARCHAR(500) NOT NULL;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD `website_username` varchar(255) NULL, ADD `website_password` varchar(255) NULL AFTER `website_username`;";
+ $queries[] = "INSERT INTO `".PSM_DB_PREFIX."config` (`key`, `value`) VALUE
('proxy', '0'),
('proxy_url', ''),
('proxy_user', ''),
@@ -479,29 +479,29 @@ class Installer {
$this->execSQL($queries);
- // Create log_users table
- $this->execSQL("CREATE TABLE `" . PSM_DB_PREFIX . "log_users` (
+ // 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;
- }
+ // 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);
- }
- }
+ // 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`;");
+ // Drop old user_id('s) column
+ $this->execSQL("ALTER TABLE `".PSM_DB_PREFIX."log` DROP COLUMN `user_id`;");
}
/**
@@ -509,7 +509,7 @@ class Installer {
*/
protected function upgrade321() {
$queries = array();
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD COLUMN `header_name` VARCHAR(255) AFTER `pattern`, ADD COLUMN `header_value` VARCHAR(255) AFTER `header_name`";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD COLUMN `header_name` VARCHAR(255) AFTER `pattern`, ADD COLUMN `header_value` VARCHAR(255) AFTER `header_name`";
$this->execSQL($queries);
}
@@ -518,10 +518,10 @@ class Installer {
*/
protected function upgrade322() {
$queries = array();
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` ADD `telegram_id` VARCHAR( 255 ) NOT NULL AFTER `pushover_device`;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `telegram` ENUM( 'yes','no' ) NOT NULL DEFAULT 'yes' AFTER `pushover`;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "log` CHANGE `type` `type` ENUM( 'status', 'email', 'sms', 'pushover', 'telegram' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;";
- $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUE
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."users` ADD `telegram_id` VARCHAR( 255 ) NOT NULL AFTER `pushover_device`;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD `telegram` ENUM( 'yes','no' ) NOT NULL DEFAULT 'yes' AFTER `pushover`;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."log` CHANGE `type` `type` ENUM( 'status', 'email', 'sms', 'pushover', 'telegram' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;";
+ $queries[] = "INSERT INTO `".PSM_DB_PREFIX."config` (`key`, `value`) VALUE
('telegram_status', '0'),
('log_telegram', '1'),
('telegram_api_token', '');";
@@ -533,10 +533,10 @@ class Installer {
*/
protected function upgrade330() {
$queries = array();
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD COLUMN `last_offline` DATETIME NULL AFTER `last_online`, ADD COLUMN `last_offline_duration` varchar(255) NULL AFTER `last_offline`;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `pattern_online` ENUM( 'yes','no' ) NOT NULL DEFAULT 'yes' AFTER `pattern`;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD COLUMN `last_offline` DATETIME NULL AFTER `last_online`, ADD COLUMN `last_offline_duration` varchar(255) NULL AFTER `last_offline`;";
+ $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD `pattern_online` ENUM( 'yes','no' ) NOT NULL DEFAULT 'yes' AFTER `pattern`;";
$this->execSQL($queries);
- if(psm_get_conf('sms_gateway') == 'mollie'){
+ if (psm_get_conf('sms_gateway') == 'mollie') {
psm_update_conf('sms_gateway', 'messagebird');
}
diff --git a/src/psm/Util/Module/Modal.php b/src/psm/Util/Module/Modal.php
index 7cce8d48..014b6325 100644
--- a/src/psm/Util/Module/Modal.php
+++ b/src/psm/Util/Module/Modal.php
@@ -69,7 +69,7 @@ class Modal implements ModalInterface {
*/
protected $twig;
- public function __construct(\Twig_Environment $twig, $modal_id = 'main', $type = self::MODAL_TYPE_OK ) {
+ public function __construct(\Twig_Environment $twig, $modal_id = 'main', $type = self::MODAL_TYPE_OK) {
$this->modal_id = $modal_id;
$this->twig = $twig;
$this->type = $type;
@@ -89,7 +89,7 @@ class Modal implements ModalInterface {
* @return \psm\Util\Module\Modal
*/
public function setType($type) {
- if(in_array($type, array(self::MODAL_TYPE_OK, self::MODAL_TYPE_OKCANCEL, self::MODAL_TYPE_DANGER))) {
+ if (in_array($type, array(self::MODAL_TYPE_OK, self::MODAL_TYPE_OKCANCEL, self::MODAL_TYPE_DANGER))) {
$this->type = $type;
}
return $this;
@@ -127,19 +127,19 @@ class Modal implements ModalInterface {
$message = !empty($this->message) ? $this->message : '';
$matches = array();
- if(preg_match_all('/%(\d)/', $message, $matches, PREG_SET_ORDER)) {
- foreach($matches as $match) {
- $message = str_replace($match[0], '', $message);
+ if (preg_match_all('/%(\d)/', $message, $matches, PREG_SET_ORDER)) {
+ foreach ($matches as $match) {
+ $message = str_replace($match[0], '', $message);
}
}
$tpl = $this->twig->loadTemplate('util/module/modal.tpl.html');
$html = $tpl->render(array(
- 'modal_id' => $this->modal_id,
- 'modal_title' => !empty($this->title) ? $this->title : psm_get_lang('system', 'title'),
- 'modal_body' => $message,
- 'has_cancel' => $has_cancel,
- 'label_cancel' => psm_get_lang('system', 'cancel'),
+ 'modal_id' => $this->modal_id,
+ 'modal_title' => !empty($this->title) ? $this->title : psm_get_lang('system', 'title'),
+ 'modal_body' => $message,
+ 'has_cancel' => $has_cancel,
+ 'label_cancel' => psm_get_lang('system', 'cancel'),
'modal_button_type' => $button_type,
'modal_button_label'=> $button_label,
));
diff --git a/src/psm/Util/Module/Sidebar.php b/src/psm/Util/Module/Sidebar.php
index 4985044d..41246ad5 100644
--- a/src/psm/Util/Module/Sidebar.php
+++ b/src/psm/Util/Module/Sidebar.php
@@ -88,7 +88,7 @@ class Sidebar implements SidebarInterface {
* @return \psm\Util\Module\Sidebar
*/
public function addLink($id, $label, $url, $icon = null) {
- if(!isset($this->items['link'])) {
+ if (!isset($this->items['link'])) {
$this->items['link'] = array();
}
@@ -112,11 +112,11 @@ class Sidebar implements SidebarInterface {
* @return \psm\Util\Module\Sidebar
*/
public function addButton($id, $label, $url, $icon = null, $btn_class = null, $url_is_onclick = false) {
- if(!isset($this->items['button'])) {
+ if (!isset($this->items['button'])) {
$this->items['button'] = array();
}
- if(!$url_is_onclick) {
- $url = "psm_goTo('" . $url . "');";
+ if (!$url_is_onclick) {
+ $url = "psm_goTo('".$url."');";
}
$this->items['button'][$id] = array(
@@ -139,7 +139,7 @@ class Sidebar implements SidebarInterface {
* @return \psm\Util\Module\Sidebar
*/
public function addDropdown($id, $label, $options, $icon = null, $btn_class = null) {
- if(!isset($this->items['dropdown'])) {
+ if (!isset($this->items['dropdown'])) {
$this->items['dropdown'] = array();
}
$this->items['dropdown'][$id] = array(
@@ -160,14 +160,14 @@ class Sidebar implements SidebarInterface {
$tpl_data['items'] = array();
// loop through all types and build their html
- foreach($types as $type) {
- if(empty($this->items[$type])) {
+ foreach ($types as $type) {
+ if (empty($this->items[$type])) {
// no items for this type
continue;
}
// build html for each individual item
- foreach($this->items[$type] as $id => $item) {
+ foreach ($this->items[$type] as $id => $item) {
$item['type'] = $type;
$item['class_active'] = ($id === $this->active_id) ? 'active' : '';
$tpl_data['items'][] = $item;
diff --git a/src/psm/Util/Server/ArchiveManager.php b/src/psm/Util/Server/ArchiveManager.php
index 94dbc54a..debe9c11 100644
--- a/src/psm/Util/Server/ArchiveManager.php
+++ b/src/psm/Util/Server/ArchiveManager.php
@@ -68,8 +68,8 @@ class ArchiveManager {
*/
public function archive($server_id = null) {
$result = true;
- foreach($this->archivers as $archiver) {
- if(!$archiver->archive($server_id)) {
+ foreach ($this->archivers as $archiver) {
+ if (!$archiver->archive($server_id)) {
$result = false;
}
}
@@ -83,15 +83,15 @@ class ArchiveManager {
*/
public function cleanup($server_id = null) {
$result = true;
- if(!$this->retention_period) {
+ if (!$this->retention_period) {
// cleanup is disabled
return $result;
}
$retdate = new \DateTime();
$retdate->sub($this->retention_period);
- foreach($this->archivers as $archiver) {
- if(!$archiver->cleanup($retdate, $server_id)) {
+ foreach ($this->archivers as $archiver) {
+ if (!$archiver->cleanup($retdate, $server_id)) {
$result = false;
}
}
@@ -106,13 +106,13 @@ class ArchiveManager {
* @return \psm\Util\Server\ArchiveManager
*/
public function setRetentionPeriod($period) {
- if(is_object($period) && $period instanceof \DateInterval) {
+ if (is_object($period) && $period instanceof \DateInterval) {
$this->retention_period = $period;
- } elseif(intval($period) == 0) {
+ } elseif (intval($period) == 0) {
// cleanup disabled
$this->retention_period = false;
} else {
- $this->retention_period = new \DateInterval('P' . intval($period) . 'D');
+ $this->retention_period = new \DateInterval('P'.intval($period).'D');
}
return $this;
}
diff --git a/src/psm/Util/Server/Archiver/LogsArchiver.php b/src/psm/Util/Server/Archiver/LogsArchiver.php
index 78e053d5..91ad2885 100644
--- a/src/psm/Util/Server/Archiver/LogsArchiver.php
+++ b/src/psm/Util/Server/Archiver/LogsArchiver.php
@@ -57,7 +57,7 @@ class LogsArchiver implements ArchiverInterface {
public function cleanup(\DateTime $retention_date, $server_id = null) {
$sql_where_server = ($server_id !== null)
// this is obviously not the cleanest way to implement this when using paramter binding.. sorry.
- ? ' `server_id` = ' . intval($server_id) . ' AND '
+ ? ' `server_id` = '.intval($server_id).' AND '
: '';
$this->db->execute(
@@ -72,8 +72,8 @@ class LogsArchiver implements ArchiverInterface {
* Empty tables log and log_users
*/
public function cleanupall() {
- $this->db->delete(PSM_DB_PREFIX . "log");
- $this->db->delete(PSM_DB_PREFIX . "log_users");
+ $this->db->delete(PSM_DB_PREFIX."log");
+ $this->db->delete(PSM_DB_PREFIX."log_users");
return true;
}
}
diff --git a/src/psm/Util/Server/Archiver/UptimeArchiver.php b/src/psm/Util/Server/Archiver/UptimeArchiver.php
index 8b40bec9..d8ee9e2c 100644
--- a/src/psm/Util/Server/Archiver/UptimeArchiver.php
+++ b/src/psm/Util/Server/Archiver/UptimeArchiver.php
@@ -65,7 +65,7 @@ class UptimeArchiver implements ArchiverInterface {
// Lock tables to prevent simultaneous archiving (by other sessions or the cron job)
try {
- $this->db->pdo()->exec('LOCK TABLES ' . PSM_DB_PREFIX . 'servers_uptime WRITE, ' . PSM_DB_PREFIX . 'servers_history WRITE');
+ $this->db->pdo()->exec('LOCK TABLES '.PSM_DB_PREFIX.'servers_uptime WRITE, '.PSM_DB_PREFIX.'servers_history WRITE');
$locked = true;
} catch (\PDOException $e) {
// user does not have lock rights, ignore
@@ -78,17 +78,17 @@ class UptimeArchiver implements ArchiverInterface {
$records = $this->db->execute(
"SELECT `server_id`,`date`,`status`,`latency`
- FROM `" . PSM_DB_PREFIX."servers_uptime`
+ FROM `".PSM_DB_PREFIX."servers_uptime`
WHERE {$sql_where_server} `date` < :latest_date",
array('latest_date' => $latest_date_str));
- if(!empty($records)) {
+ if (!empty($records)) {
// first group all records by day and server_id
$data_by_day = array();
- foreach($records as $record) {
- $server_id = (int)$record['server_id'];
+ foreach ($records as $record) {
+ $server_id = (int) $record['server_id'];
$day = date('Y-m-d', strtotime($record['date']));
- if(!isset($data_by_day[$day][$server_id])) {
+ if (!isset($data_by_day[$day][$server_id])) {
$data_by_day[$day][$server_id] = array();
}
$data_by_day[$day][$server_id][] = $record;
@@ -96,7 +96,7 @@ class UptimeArchiver implements ArchiverInterface {
// now get history data day by day
$histories = array();
- foreach($data_by_day as $day => $day_records) {
+ foreach ($data_by_day as $day => $day_records) {
foreach ($day_records as $server_id => $server_day_records) {
$histories[] = $this->getHistoryForDay($day, $server_id, $server_day_records);
}
@@ -113,7 +113,7 @@ class UptimeArchiver implements ArchiverInterface {
);
}
- if($locked) {
+ if ($locked) {
$this->db->exec('UNLOCK TABLES');
}
@@ -141,10 +141,10 @@ class UptimeArchiver implements ArchiverInterface {
$latencies = array();
$checks_failed = 0;
- foreach($day_records as $day_record) {
+ foreach ($day_records as $day_record) {
$latencies[] = $day_record['latency'];
- if($day_record['status'] == 0) {
+ if ($day_record['status'] == 0) {
$checks_failed++;
}
}
@@ -165,7 +165,7 @@ class UptimeArchiver implements ArchiverInterface {
protected function createSQLWhereServer($server_id) {
$sql_where_server = ($server_id !== null)
// this is obviously not the cleanest way to implement this when using paramter binding.. sorry.
- ? ' `server_id` = ' . intval($server_id) . ' AND '
+ ? ' `server_id` = '.intval($server_id).' AND '
: '';
return $sql_where_server;
diff --git a/src/psm/Util/Server/HistoryGraph.php b/src/psm/Util/Server/HistoryGraph.php
index dc03fdf6..605e4912 100644
--- a/src/psm/Util/Server/HistoryGraph.php
+++ b/src/psm/Util/Server/HistoryGraph.php
@@ -73,12 +73,12 @@ class HistoryGraph {
'uptime' => '%01.3f%%',
);
- foreach($graphs as $i => &$graph) {
+ foreach ($graphs as $i => &$graph) {
// add subarray for info fields
$graph['info'] = array();
- foreach($info_fields as $field => $format) {
- if(!isset($graph[$field])) {
+ foreach ($info_fields as $field => $format) {
+ if (!isset($graph[$field])) {
continue;
}
$graph['info'][] = array(
@@ -125,7 +125,7 @@ class HistoryGraph {
$data['buttons'][] = array('mode' => 'day', 'label' => psm_get_lang('servers', 'day'));
$data['buttons'][] = array('mode' => 'week', 'label' => psm_get_lang('servers', 'week'));
// make sure to add chart id after buttons so its added to those tmeplates as well
- $data['chart_id'] = $server_id . '_uptime';
+ $data['chart_id'] = $server_id.'_uptime';
return $data;
}
@@ -160,7 +160,7 @@ class HistoryGraph {
$data['buttons'][] = array('mode' => 'month', 'label' => psm_get_lang('servers', 'month'), 'class_active' => 'btn-info');
$data['buttons'][] = array('mode' => 'year', 'label' => psm_get_lang('servers', 'year'));
// make sure to add chart id after buttons so its added to those tmeplates as well
- $data['chart_id'] = $server_id . '_history';
+ $data['chart_id'] = $server_id.'_history';
return $data;
}
@@ -174,13 +174,13 @@ class HistoryGraph {
* @return array
*/
protected function getRecords($type, $server_id, $start_time, $end_time) {
- if(!in_array($type, array('history', 'uptime'))) {
+ if (!in_array($type, array('history', 'uptime'))) {
return array();
}
$records = $this->db->execute(
'SELECT *
- FROM `' . PSM_DB_PREFIX . "servers_$type`
+ FROM `'.PSM_DB_PREFIX."servers_$type`
WHERE `server_id` = :server_id AND `date` BETWEEN :start_time AND :end_time ORDER BY `date` ASC",
array(
'server_id' => $server_id,
@@ -220,52 +220,52 @@ class HistoryGraph {
// use the first line to calculate average latency
$latency_avg += (float) $uptime[$latency_avg_key];
- if($cb_if_up($uptime)) {
+ if ($cb_if_up($uptime)) {
// The server is up
- foreach($lines as $key => $value) {
+ foreach ($lines as $key => $value) {
// add the value for each of the different lines
- if(isset($uptime[$key])) {
- $lines[$key][] = '[' . number_format($time, 0, '', '') . ',' . round((float) $uptime[$key], 4) . ']';
+ if (isset($uptime[$key])) {
+ $lines[$key][] = '['.number_format($time, 0, '', '').','.round((float) $uptime[$key], 4).']';
}
}
- if($last_date) {
+ if ($last_date) {
// Was down before.
// Record the first and last date as a string in the down array
- $down[] = '[' . number_format($last_date, 0, '', '') . ',' . number_format($time, 0, '', '') . ']';
+ $down[] = '['.number_format($last_date, 0, '', '').','.number_format($time, 0, '', '').']';
// add the number of microseconds of downtime to counter for %
$time_down += ($time - $last_date);
$last_date = 0;
}
} else {
// The server is down
- if(!$last_date) {
+ if (!$last_date) {
$last_date = $time;
}
}
}
$lines_merged = array();
- foreach($lines as $line_key => $line_value) {
- if(empty($line_value)) {
+ foreach ($lines as $line_key => $line_value) {
+ if (empty($line_value)) {
continue;
}
- $lines_merged[] = '[' . implode(',', $line_value) . ']';
+ $lines_merged[] = '['.implode(',', $line_value).']';
$series[] = "{label: '".psm_get_lang('servers', $line_key)."'}";
}
- if($last_date) {
+ if ($last_date) {
// if last_date is still set, the last check was "down" and we are still in down mode
- $down[] = '[' . number_format($last_date, 0, '', '') . ',0]';
+ $down[] = '['.number_format($last_date, 0, '', '').',0]';
$time_down += (($end_time->getTimestamp() * 1000) - $last_date);
}
- if($add_uptime) {
+ if ($add_uptime) {
$data['uptime'] = 100 - (($time_down / ($end_time->getTimestamp() - $start_time->getTimestamp())) / 10);
}
$data['latency_avg'] = count($records) > 0 ? ($latency_avg / count($records)) : 0;
- $data['server_lines'] = sizeof($lines_merged) ? '[' . implode(',', $lines_merged) . ']' : '';
- $data['server_down'] = sizeof($down) ? '[' . implode(',', $down) . ']' : '';
- $data['series'] = sizeof($series) ? '[' . implode(',', $series) . ']' : '';
+ $data['server_lines'] = sizeof($lines_merged) ? '['.implode(',', $lines_merged).']' : '';
+ $data['server_down'] = sizeof($down) ? '['.implode(',', $down).']' : '';
+ $data['series'] = sizeof($series) ? '['.implode(',', $series).']' : '';
$data['end_timestamp'] = number_format($end_time->getTimestamp() * 1000, 0, '', '');
return $data;
diff --git a/src/psm/Util/Server/ServerValidator.php b/src/psm/Util/Server/ServerValidator.php
index 088c493a..cabf8829 100644
--- a/src/psm/Util/Server/ServerValidator.php
+++ b/src/psm/Util/Server/ServerValidator.php
@@ -50,9 +50,9 @@ class ServerValidator {
* @throws \InvalidArgumentException
*/
public function serverId($server_id) {
- $server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array('server_id' => $server_id), array('server_id'));
+ $server = $this->db->selectRow(PSM_DB_PREFIX.'servers', array('server_id' => $server_id), array('server_id'));
- if(empty($server)) {
+ if (empty($server)) {
throw new \InvalidArgumentException('server_no_match');
}
return true;
@@ -66,7 +66,7 @@ class ServerValidator {
*/
public function label($label) {
$label = trim($label);
- if(empty($label) || strlen($label) > 255) {
+ if (empty($label) || strlen($label) > 255) {
throw new \InvalidArgumentException('server_label_bad_length');
}
return true;
@@ -82,22 +82,22 @@ class ServerValidator {
public function ip($value, $type = null) {
$value = trim($value);
- if(empty($value) || strlen($value) > 255) {
+ if (empty($value) || strlen($value) > 255) {
throw new \InvalidArgumentException('server_ip_bad_length');
}
- switch($type) {
+ switch ($type) {
case 'website':
- if(!filter_var($value, FILTER_VALIDATE_URL)) {
+ if (!filter_var($value, FILTER_VALIDATE_URL)) {
throw new \InvalidArgumentException('server_ip_bad_website');
}
break;
case 'service':
case 'ping':
- if(!filter_var($value, FILTER_VALIDATE_IP)
+ if (!filter_var($value, FILTER_VALIDATE_IP)
// domain regex as per http://stackoverflow.com/questions/106179/regular-expression-to-match-hostname-or-ip-address :
&& !preg_match("/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])/", $value)
- ){throw new \InvalidArgumentException('server_ip_bad_service');}
+ ) {throw new \InvalidArgumentException('server_ip_bad_service'); }
break;
}
@@ -111,7 +111,7 @@ class ServerValidator {
* @throws \InvalidArgumentException
*/
public function type($type) {
- if(!in_array($type, array('ping', 'service', 'website'))) {
+ if (!in_array($type, array('ping', 'service', 'website'))) {
throw new \InvalidArgumentException('server_type_invalid');
}
return true;
@@ -124,7 +124,7 @@ class ServerValidator {
* @throws \InvalidArgumentException
*/
public function warningThreshold($value) {
- if(!is_numeric($value) || intval($value) == 0) {
+ if (!is_numeric($value) || intval($value) == 0) {
throw new \InvalidArgumentException('server_warning_threshold_invalid');
}
return true;
diff --git a/src/psm/Util/Server/UpdateManager.php b/src/psm/Util/Server/UpdateManager.php
index babfecae..0e8ad262 100644
--- a/src/psm/Util/Server/UpdateManager.php
+++ b/src/psm/Util/Server/UpdateManager.php
@@ -51,7 +51,7 @@ class UpdateManager implements ContainerAwareInterface {
// check if we need to restrict the servers to a certain user
$sql_join = '';
- if(!$skip_perms && $this->container->get('user')->getUserLevel() > PSM_USER_ADMIN) {
+ if (!$skip_perms && $this->container->get('user')->getUserLevel() > PSM_USER_ADMIN) {
// restrict by user_id
$sql_join = "JOIN `".PSM_DB_PREFIX."users_servers` AS `us` ON (
`us`.`user_id`={$this->container->get('user')->getUserId()}
@@ -69,7 +69,7 @@ class UpdateManager implements ContainerAwareInterface {
$updater = new Updater\StatusUpdater($this->container->get('db'));
$notifier = new Updater\StatusNotifier($this->container->get('db'));
- foreach($servers as $server) {
+ foreach ($servers as $server) {
$status_old = ($server['status'] == 'on') ? true : false;
$status_new = $updater->update($server['server_id']);
// notify the nerds if applicable
diff --git a/src/psm/Util/Server/Updater/StatusNotifier.php b/src/psm/Util/Server/Updater/StatusNotifier.php
index 33fe8129..b07942b0 100644
--- a/src/psm/Util/Server/Updater/StatusNotifier.php
+++ b/src/psm/Util/Server/Updater/StatusNotifier.php
@@ -115,7 +115,7 @@ class StatusNotifier {
* @return boolean
*/
public function notify($server_id, $status_old, $status_new) {
- if(!$this->send_emails && !$this->send_sms && !$this->save_logs) {
+ if (!$this->send_emails && !$this->send_sms && !$this->save_logs) {
// seems like we have nothing to do. skip the rest
return false;
}
@@ -125,45 +125,45 @@ class StatusNotifier {
$this->status_new = $status_new;
// get server info from db
- $this->server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array(
+ $this->server = $this->db->selectRow(PSM_DB_PREFIX.'servers', array(
'server_id' => $server_id,
), array(
'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'header_name', 'header_value', 'error', 'active', 'email', 'sms', 'pushover', 'telegram', 'last_online', 'last_offline', 'last_offline_duration',
));
- if(empty($this->server)) {
+ if (empty($this->server)) {
return false;
}
$notify = false;
// check which type of alert the user wants
- switch(psm_get_conf('alert_type')) {
+ switch (psm_get_conf('alert_type')) {
case 'always':
- if($status_new == false) {
+ if ($status_new == false) {
// server is offline. we are in error state.
$notify = true;
}
break;
case 'offline':
// only send a notification if the server goes down for the first time!
- if($status_new == false && $status_old == true) {
+ if ($status_new == false && $status_old == true) {
$notify = true;
}
break;
case 'status':
- if($status_new != $status_old) {
+ if ($status_new != $status_old) {
// status has been changed!
$notify = true;
}
break;
}
- if(!$notify) {
+ if (!$notify) {
return false;
}
// first add to log (we use the same text as the SMS message because its short..)
- if($this->save_logs) {
+ if ($this->save_logs) {
psm_add_log(
$this->server_id,
'status',
@@ -173,30 +173,30 @@ class StatusNotifier {
$users = $this->getUsers($this->server_id);
- if(empty($users)) {
+ if (empty($users)) {
return $notify;
}
// check if email is enabled for this server
- if($this->send_emails && $this->server['email'] == 'yes') {
+ if ($this->send_emails && $this->server['email'] == 'yes') {
// send email
$this->notifyByEmail($users);
}
// check if sms is enabled for this server
- if($this->send_sms && $this->server['sms'] == 'yes') {
+ if ($this->send_sms && $this->server['sms'] == 'yes') {
// yay lets wake those nerds up!
$this->notifyByTxtMsg($users);
}
// check if pushover is enabled for this server
- if($this->send_pushover && $this->server['pushover'] == 'yes') {
+ if ($this->send_pushover && $this->server['pushover'] == 'yes') {
// yay lets wake those nerds up!
$this->notifyByPushover($users);
}
// check if telegram is enabled for this server
- if($this->send_telegram && $this->server['telegram'] == 'yes') {
+ if ($this->send_telegram && $this->server['telegram'] == 'yes') {
// yay lets wake those nerds up!
$this->notifyByTelegram($users);
}
@@ -214,27 +214,27 @@ class StatusNotifier {
// build mail object with some default values
$mail = psm_build_mail();
$mail->Subject = psm_parse_msg($this->status_new, 'email_subject', $this->server);
- $mail->Priority = 1;
+ $mail->Priority = 1;
$body = psm_parse_msg($this->status_new, 'email_body', $this->server);
$mail->Body = $body;
$mail->AltBody = str_replace('
', "\n", $body);
- if(psm_get_conf('log_email')) {
- $log_id = psm_add_log($this->server_id, 'email', $body);
- }
+ if (psm_get_conf('log_email')) {
+ $log_id = psm_add_log($this->server_id, 'email', $body);
+ }
// go through empl
- foreach ($users as $user) {
- if(!empty($log_id)) {
- psm_add_log_user($log_id, $user['user_id']);
- }
+ foreach ($users as $user) {
+ if (!empty($log_id)) {
+ psm_add_log_user($log_id, $user['user_id']);
+ }
- // we sent a seperate email to every single user.
- $mail->AddAddress($user['email'], $user['name']);
- $mail->Send();
- $mail->ClearAddresses();
- }
+ // we sent a seperate email to every single user.
+ $mail->AddAddress($user['email'], $user['name']);
+ $mail->Send();
+ $mail->ClearAddresses();
+ }
}
/**
@@ -244,51 +244,51 @@ class StatusNotifier {
* @return boolean
*/
protected function notifyByPushover($users) {
- // Remove users that have no pushover_key
- foreach($users as $k => $user) {
- if (trim($user['pushover_key']) == '') {
- unset($users[$k]);
- }
- }
+ // Remove users that have no pushover_key
+ foreach ($users as $k => $user) {
+ if (trim($user['pushover_key']) == '') {
+ unset($users[$k]);
+ }
+ }
- // Validation
- if (empty($users)) {
- return;
- }
+ // 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
+ $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);
- }
+ // Log
+ if (psm_get_conf('log_pushover')) {
+ $log_id = psm_add_log($this->server_id, 'pushover', $message);
+ }
- foreach($users as $user) {
- // Log
- if(!empty($log_id)) {
- psm_add_log_user($log_id, $user['user_id']);
- }
+ foreach ($users as $user) {
+ // Log
+ if (!empty($log_id)) {
+ psm_add_log_user($log_id, $user['user_id']);
+ }
- // Set recipient + send
+ // Set recipient + send
$pushover->setUser($user['pushover_key']);
- if($user['pushover_device'] != '') {
+ if ($user['pushover_device'] != '') {
$pushover->setDevice($user['pushover_device']);
}
$pushover->send();
- }
+ }
}
/**
@@ -299,23 +299,23 @@ class StatusNotifier {
*/
protected function notifyByTxtMsg($users) {
$sms = psm_build_sms();
- if(!$sms) {
+ if (!$sms) {
return false;
}
- $message = psm_parse_msg($this->status_new, 'sms', $this->server);
+ $message = psm_parse_msg($this->status_new, 'sms', $this->server);
- // Log
- if(psm_get_conf('log_sms')) {
- $log_id = psm_add_log($this->server_id, 'sms', $message);
+ // Log
+ if (psm_get_conf('log_sms')) {
+ $log_id = psm_add_log($this->server_id, 'sms', $message);
}
// add all users to the recipients list
foreach ($users as $user) {
- // Log
- if(!empty($log_id)) {
- psm_add_log_user($log_id, $user['user_id']);
- }
+ // Log
+ if (!empty($log_id)) {
+ psm_add_log_user($log_id, $user['user_id']);
+ }
$sms->addRecipients($user['mobile']);
}
@@ -334,15 +334,15 @@ class StatusNotifier {
*/
protected function notifyByTelegram($users) {
// Remove users that have no telegram_id
- foreach($users as $k => $user) {
- if (trim($user['telegram_id']) == '') {
- unset($users[$k]);
- }
+ foreach ($users as $k => $user) {
+ if (trim($user['telegram_id']) == '') {
+ unset($users[$k]);
+ }
}
// Validation
if (empty($users)) {
- return;
+ return;
}
// Telegram
@@ -350,16 +350,16 @@ class StatusNotifier {
$telegram = psm_build_telegram();
$telegram->setMessage(str_replace('
', "\n", $message));
// Log
- if(psm_get_conf('log_telegram')) {
- $log_id = psm_add_log($this->server_id, 'telegram', $message);
+ if (psm_get_conf('log_telegram')) {
+ $log_id = psm_add_log($this->server_id, 'telegram', $message);
}
- foreach($users as $user) {
- // Log
- if(!empty($log_id)) {
- psm_add_log_user($log_id, $user['user_id']);
- }
- $telegram->setUser($user['telegram_id']);
- $telegram->send();
+ foreach ($users as $user) {
+ // Log
+ if (!empty($log_id)) {
+ psm_add_log_user($log_id, $user['user_id']);
+ }
+ $telegram->setUser($user['telegram_id']);
+ $telegram->send();
}
}
diff --git a/src/psm/Util/Server/Updater/StatusUpdater.php b/src/psm/Util/Server/Updater/StatusUpdater.php
index 320b0d6c..9a395052 100644
--- a/src/psm/Util/Server/Updater/StatusUpdater.php
+++ b/src/psm/Util/Server/Updater/StatusUpdater.php
@@ -79,17 +79,17 @@ class StatusUpdater {
$this->rtime = '';
// get server info from db
- $this->server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array(
+ $this->server = $this->db->selectRow(PSM_DB_PREFIX.'servers', array(
'server_id' => $server_id,
), array(
'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'pattern_online', 'header_name', 'header_value', 'status', 'active', 'warning_threshold',
'warning_threshold_counter', 'timeout', 'website_username', 'website_password', 'last_offline'
));
- if(empty($this->server)) {
+ if (empty($this->server)) {
return false;
}
- switch($this->server['type']) {
+ switch ($this->server['type']) {
case 'ping':
$this->status_new = $this->updatePing($max_runs);
break;
@@ -112,7 +112,7 @@ class StatusUpdater {
// so that the warnings can still be reviewed in the server history.
psm_log_uptime($this->server_id, (int) $this->status_new, $this->rtime);
- if($this->status_new == true) {
+ if ($this->status_new == true) {
// if the server is on, add the last_online value and reset the error threshold counter
$save['status'] = 'on';
$save['last_online'] = date('Y-m-d H:i:s');
@@ -127,7 +127,7 @@ class StatusUpdater {
// server is offline, increase the error counter
$save['warning_threshold_counter'] = $this->server['warning_threshold_counter'] + 1;
- if($save['warning_threshold_counter'] < $this->server['warning_threshold']) {
+ if ($save['warning_threshold_counter'] < $this->server['warning_threshold']) {
// the server is offline but the error threshold has not been met yet.
// so we are going to leave the status "on" for now while we are in a sort of warning state..
$save['status'] = 'on';
@@ -140,7 +140,7 @@ class StatusUpdater {
}
}
- $this->db->save(PSM_DB_PREFIX . 'servers', $save, array('server_id' => $this->server_id));
+ $this->db->save(PSM_DB_PREFIX.'servers', $save, array('server_id' => $this->server_id));
return $this->status_new;
@@ -159,7 +159,7 @@ class StatusUpdater {
// set ping payload
$package = "\x08\x00\x7d\x4b\x00\x00\x00\x00PingHost";
- $socket = socket_create(AF_INET, SOCK_RAW, 1);
+ $socket = socket_create(AF_INET, SOCK_RAW, 1);
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 10, 'usec' => 0));
socket_connect($socket, $this->server['ip'], null);
@@ -173,11 +173,11 @@ class StatusUpdater {
$errorcode = socket_last_error();
$this->error = "Couldn't create socket [".$errorcode."]: ".socket_strerror($errorcode);
}
- $this->rtime = microtime(true) - $starttime;
+ $this->rtime = microtime(true) - $starttime;
socket_close($socket);
// check if server is available and rerun if asked.
- if(!$status && $run < $max_runs) {
+ if (!$status && $run < $max_runs) {
return $this->updatePing($max_runs, $run + 1);
}
@@ -195,17 +195,17 @@ 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);
- if(is_resource($fp)) {
+ if (is_resource($fp)) {
fclose($fp);
}
// check if server is available and rerun if asked.
- if(!$status && $run < $max_runs) {
+ if (!$status && $run < $max_runs) {
return $this->updateService($max_runs, $run + 1);
}
@@ -230,7 +230,7 @@ class StatusUpdater {
$this->server['timeout'],
true,
$this->server['website_username'],
- psm_password_decrypt($this->server['server_id'] . psm_get_conf('password_encrypt_key'), $this->server['website_password'])
+ psm_password_decrypt($this->server['server_id'].psm_get_conf('password_encrypt_key'), $this->server['website_password'])
);
$this->rtime = (microtime(true) - $starttime);
@@ -243,7 +243,7 @@ class StatusUpdater {
$code_matches = array();
preg_match_all("/[A-Z]{2,5}\/\d\.\d\s(\d{3})\s(.*)/", $status_code, $code_matches);
- if(empty($code_matches[0])) {
+ if (empty($code_matches[0])) {
// somehow we dont have a proper response.
$this->error = 'TIMEOUT ERROR: no response from server';
$result = false;
@@ -252,26 +252,26 @@ class StatusUpdater {
$msg = $code_matches[2][0];
// All status codes starting with a 4 or higher mean trouble!
- if(substr($code, 0, 1) >= '4') {
- $this->error = "HTTP STATUS ERROR: ".$code . ' ' . $msg;
+ if (substr($code, 0, 1) >= '4') {
+ $this->error = "HTTP STATUS ERROR: ".$code.' '.$msg;
$result = false;
} else {
$result = true;
//Okay, the HTTP status is good : 2xx or 3xx. Now we have to test the pattern if it's set up
- if($this->server['pattern'] != '') {
+ if ($this->server['pattern'] != '') {
// Check to see if the body should not contain specified pattern
// Check to see if the pattern was [not] found.
- if(($this->server['pattern_online'] == 'yes') == !preg_match("/{$this->server['pattern']}/i", $curl_result)){
- $this->error = "TEXT ERROR : Pattern '{$this->server['pattern']}' " .
- ($this->server['pattern_online'] == 'yes' ? 'not' : 'was') .
+ if (($this->server['pattern_online'] == 'yes') == !preg_match("/{$this->server['pattern']}/i", $curl_result)) {
+ $this->error = "TEXT ERROR : Pattern '{$this->server['pattern']}' ".
+ ($this->server['pattern_online'] == 'yes' ? 'not' : 'was').
' found.';
$result = false;
}
}
// Should we check a header ?
- if($this->server['header_name'] != '' && $this->server['header_value'] != '') {
+ if ($this->server['header_name'] != '' && $this->server['header_value'] != '') {
$header_flag = false;
$header_text = substr($curl_result, 0, strpos($curl_result, "\r\n\r\n")); // Only get the header text if the result also includes the body
foreach (explode("\r\n", $header_text) as $i => $line) {
@@ -280,7 +280,7 @@ class StatusUpdater {
} else {
list ($key, $value) = explode(': ', $line);
if (strcasecmp($key, $this->server['header_name']) == 0) { // Header found (case-insensitive)
- if(!preg_match("/{$this->server['header_value']}/i", $value)) { // The value doesn't match what we needed
+ if (!preg_match("/{$this->server['header_value']}/i", $value)) { // The value doesn't match what we needed
$result = false;
} else {
$header_flag = true;
@@ -290,13 +290,16 @@ class StatusUpdater {
}
}
- if(!$header_flag) $result = false; // Header was not present
+ if (!$header_flag) {
+ // Header was not present
+ $result = false;
+ }
}
}
}
// check if server is available and rerun if asked.
- if(!$result && $run < $max_runs) {
+ if (!$result && $run < $max_runs) {
return $this->updateWebsite($max_runs, $run + 1);
}
diff --git a/src/psm/Util/User/UserValidator.php b/src/psm/Util/User/UserValidator.php
index 33243745..67c12ac0 100644
--- a/src/psm/Util/User/UserValidator.php
+++ b/src/psm/Util/User/UserValidator.php
@@ -57,7 +57,7 @@ class UserValidator {
*/
public function userId($user_id) {
$user = $this->user->getUser($user_id);
- if(empty($user)) {
+ if (empty($user)) {
throw new \InvalidArgumentException('user_no_match');
}
return true;
@@ -75,15 +75,15 @@ class UserValidator {
* @throws \InvalidArgumentException
*/
public function username($username, $user_id = 0) {
- if(strlen($username) > 64 || strlen($username) < 2) {
- throw new \InvalidArgumentException('user_name_bad_length');
- }
+ if (strlen($username) > 64 || strlen($username) < 2) {
+ throw new \InvalidArgumentException('user_name_bad_length');
+ }
if (!preg_match('/^[a-zA-Z\d_\.]{2,64}$/i', $username)) {
- throw new \InvalidArgumentException('user_name_invalid');
+ throw new \InvalidArgumentException('user_name_invalid');
}
$user_exists = $this->user->getUserByUsername($username);
- if(!empty($user_exists) && ($user_id == 0 || $user_id != $user_exists->user_id)) {
+ if (!empty($user_exists) && ($user_id == 0 || $user_id != $user_exists->user_id)) {
throw new \InvalidArgumentException('user_name_exists');
}
return true;
@@ -97,26 +97,26 @@ class UserValidator {
* @throws \InvalidArgumentException
*/
public function password($password, $password_repeat) {
- if(empty($password) || empty($password_repeat)) {
+ if (empty($password) || empty($password_repeat)) {
throw new \InvalidArgumentException('user_password_invalid');
}
- if($password !== $password_repeat) {
+ if ($password !== $password_repeat) {
throw new \InvalidArgumentException('user_password_no_match');
}
return true;
}
/**
- * Install only; Check username on:
- *
- * - Length (2-64 chars)
- * - Contents (alphabetic chars and digits only)
- * @param string $username
- * @return boolean
- * @throws \InvalidArgumentException
- */
+ * Install only; Check username on:
+ *
+ * - Length (2-64 chars)
+ * - Contents (alphabetic chars and digits only)
+ * @param string $username
+ * @return boolean
+ * @throws \InvalidArgumentException
+ */
public function username_new($username) {
- if(strlen($username) > 64 || strlen($username) < 2) {
+ if (strlen($username) > 64 || strlen($username) < 2) {
throw new \InvalidArgumentException('user_name_bad_length');
}
if (!preg_match('/^[a-zA-Z\d_\.]{2,64}$/i', $username)) {
@@ -126,16 +126,16 @@ class UserValidator {
}
/**
- * Check email
- * @param string $email
- * @return boolean
- * @throws \InvalidArgumentException
- */
+ * Check email
+ * @param string $email
+ * @return boolean
+ * @throws \InvalidArgumentException
+ */
public function email($email) {
- if(strlen($email) > 255 || strlen($email) < 5) {
+ if (strlen($email) > 255 || strlen($email) < 5) {
throw new \InvalidArgumentException('user_email_bad_length');
}
- if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
+ if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
throw new \InvalidArgumentException('user_email_invalid');
}
return true;
@@ -148,7 +148,7 @@ class UserValidator {
* @throws \InvalidArgumentException
*/
public function level($level) {
- if(!in_array($level, $this->user_levels)) {
+ if (!in_array($level, $this->user_levels)) {
throw new \InvalidArgumentException('user_level_invalid');
}
return true;
diff --git a/src/templates/default/module/server/status/index.tpl.html b/src/templates/default/module/server/status/index.tpl.html
index 3d31ac69..902b7ba8 100644
--- a/src/templates/default/module/server/status/index.tpl.html
+++ b/src/templates/default/module/server/status/index.tpl.html
@@ -67,10 +67,10 @@
{% if auto_refresh %}