Rewritten part of the gateway code
This is a first commit in order to close #588. - Removed the names from the translation files. - The dropdown menu will now filled with the names of the gateways in the Txtmsg folder. - Changed Mollie to the proper company name: Messagebird. - Everybody that was using Mollie will on upgrade automatically change to Messagebird (replace old name in DB with new name). - Updated: Clickatell, Twilio, Spryng, Textmarketer and Messagebird (Mollie).pull/590/head
							parent
							
								
									8ca259d524
								
							
						
					
					
						commit
						a496874d9c
					
				|  | @ -45,7 +45,7 @@ The following SMS gateways are currently available: | |||
| 
 | ||||
| * Clickatell - <https://www.clickatell.com> | ||||
| * Inetworx - <https://www.inetworx.ch> | ||||
| * Mollie - <https://www.mollie.nl> | ||||
| * Messagebird - <https://www.messagebird.com> | ||||
| * Mosms - <https://www.mosms.com> | ||||
| * Smsglobal - <https://smsglobal.com/> | ||||
| * SMSit - <https://www.smsit.dk/> | ||||
|  |  | |||
|  | @ -49,7 +49,7 @@ The following SMS gateways are currently available: | |||
| 
 | ||||
| * Clickatell - <https://www.clickatell.com> | ||||
| * Inetworx - <https://www.inetworx.ch> | ||||
| * Mollie - <https://www.mollie.nl> | ||||
| * Messagebird - <https://www.messagebird.com> | ||||
| * Mosms - <https://www.mosms.com> | ||||
| * Smsglobal - <https://smsglobal.com/> | ||||
| * SMSit - <https://www.smsit.dk/> | ||||
|  |  | |||
|  | @ -30,6 +30,7 @@ | |||
| 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); | ||||
|  |  | |||
|  | @ -131,6 +131,27 @@ function psm_get_langs() { | |||
| 	return $langs; | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Retrieve a list with available sms gateways | ||||
|  * | ||||
|  * @return array | ||||
|  */ | ||||
| function psm_get_sms_gateways() { | ||||
| 	$sms_gateway_files = glob(PSM_PATH_SMS_GATEWAY . '*.php'); | ||||
| 	$sms_gateways = array(); | ||||
| 
 | ||||
| 	foreach($sms_gateway_files as $file) { | ||||
| 		$name = basename($file, ".php"); | ||||
| 		// filter system files out
 | ||||
| 		if($name != "Core" && $name != "TxtmsgInterface"){ | ||||
| 			$sms_gateways[strtolower($name)] = $name; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	ksort($sms_gateways); | ||||
| 	return $sms_gateways; | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Get a setting from the config. | ||||
|  * | ||||
|  | @ -530,7 +551,7 @@ function psm_build_sms() { | |||
| 	$sms = null; | ||||
| 
 | ||||
| 	// open the right class
 | ||||
| 	// not making this any more dynamic, because perhaps some gateways need custom settings (like Mollie)
 | ||||
| 	// not making this any more dynamic, because perhaps some gateways need custom settings
 | ||||
| 	switch(strtolower(psm_get_conf('sms_gateway'))) { | ||||
| 		case 'mosms': | ||||
| 			$sms = new \psm\Txtmsg\Mosms(); | ||||
|  | @ -541,9 +562,8 @@ function psm_build_sms() { | |||
| 		case 'inetworx': | ||||
| 			$sms = new \psm\Txtmsg\Inetworx(); | ||||
| 			break; | ||||
| 		case 'mollie': | ||||
| 			$sms = new \psm\Txtmsg\Mollie(); | ||||
| 			$sms->setGateway(1); | ||||
| 		case 'messagebird': | ||||
| 			$sms = new \psm\Txtmsg\Messagebird(); | ||||
| 			break; | ||||
| 		case 'spryng': | ||||
| 			$sms = new \psm\Txtmsg\Spryng(); | ||||
|  | @ -578,6 +598,9 @@ function psm_build_sms() { | |||
| 		case 'twilio': | ||||
| 			$sms = new \psm\Txtmsg\Twilio(); | ||||
| 			break; | ||||
| 		case 'cmbulksms': | ||||
| 			$sms = new \psm\Txtmsg\CMBulkSMS(); | ||||
| 			break; | ||||
| 	} | ||||
| 
 | ||||
| 	// copy login information from the config file
 | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ | |||
| /** | ||||
|  * Current PSM version | ||||
|  */ | ||||
| define('PSM_VERSION', '3.2.2'); | ||||
| define('PSM_VERSION', '3.3.0'); | ||||
| 
 | ||||
| /** | ||||
|  * URL to check for updates. Will not be checked if turned off on config page. | ||||
|  |  | |||
|  | @ -205,17 +205,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Оставете празно за "без аутентикация"', | ||||
| 		'sms_status' => 'Да се изпращат ли SMS-и', | ||||
| 		'sms_gateway' => 'Портал за изпращане на SMS-и', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
| 		'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_username' => 'Потребител', | ||||
| 		'sms_gateway_password' => 'Парола', | ||||
| 		'sms_from' => 'Номер на изпращача', | ||||
|  |  | |||
|  | @ -218,19 +218,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Ponechte prázdné pro použití SMTP bez hesla', | ||||
| 		'sms_status' => 'Povolit odesílání textových zpráv', | ||||
| 		'sms_gateway' => 'Brána použitá pro odesílání zpráv', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         	'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_freemobilesms' => 'FreeMobileSMS', | ||||
| 		'sms_gateway_clicksend' => 'ClickSend', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_username' => 'Uživatelské jméno brány', | ||||
| 		'sms_gateway_password' => 'Heslo brány', | ||||
| 		'sms_from' => 'Telefonní číslo odesilatele', | ||||
|  |  | |||
|  | @ -203,16 +203,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Efterlad blank hvis det ikke er krævet', | ||||
| 		'sms_status' => 'Tillad at sende SMS beskeder', | ||||
| 		'sms_gateway' => 'SMS Gateway', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_username' => 'Gateway brugernavn/apikey', | ||||
| 		'sms_gateway_password' => 'Gateway adgangskode', | ||||
| 		'sms_from' => 'Afsenderens navn.', | ||||
|  |  | |||
|  | @ -206,17 +206,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Feld leer lassen, bei fehlender Authentifizierung', | ||||
| 		'sms_status' => 'SMS-Nachrichtenversand erlauben?', | ||||
| 		'sms_gateway' => 'SMS Gateway', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
|         'sms_gateway_clickatell' => 'Clickatell', | ||||
|         'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_username' => 'Gateway Benutzername', | ||||
| 		'sms_gateway_password' => 'Gateway Passwort', | ||||
| 		'sms_from' => 'SMS-Sendernummer', | ||||
|  |  | |||
|  | @ -239,21 +239,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Leave blank for no authentication', | ||||
| 		'sms_status' => 'Allow sending text messages', | ||||
| 		'sms_gateway' => 'Gateway to use for sending messages', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         	'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_freemobilesms' => 'FreeMobileSMS', | ||||
| 		'sms_gateway_clicksend' => 'ClickSend', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_smsgw' => 'SMSgw', | ||||
| 		'sms_gateway_twilio' => 'Twilio', | ||||
| 		'sms_gateway_username' => 'Gateway username', | ||||
| 		'sms_gateway_password' => 'Gateway password', | ||||
| 		'sms_from' => 'Sender\'s phone number', | ||||
|  |  | |||
|  | @ -207,21 +207,8 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Deja en blanco para ninguna autenticación', | ||||
| 		'sms_status' => '¿Habilitar envio de SMS?', | ||||
| 		'sms_gateway' => 'Proveedor de SMS', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         	'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_username' => 'Usuario', | ||||
| 		'sms_gateway_password' => 'Contraseña', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_username' => 'Gateway username', | ||||
| 		'sms_gateway_password' => 'Gateway password', | ||||
| 		'sms_from' => 'Número origen del SMS', | ||||
| 		'pushover_status' => '¿Habilitar el envío de mensajes Pushover?', | ||||
| 		'pushover_description' => 'Pushover es un servicio que hace que sea fácil de obtener notificaciones en tiempo real. Vea <a href="https://pushover.net/"> su página web </a> para más información.', | ||||
|  |  | |||
|  | @ -192,15 +192,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Jäta tühjaks, et jätkata ilma autentimiseta', | ||||
| 		'sms_status' => 'Luba sõnumite saatmine', | ||||
| 		'sms_gateway' => 'Väravad sõnumite saatmiseks', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_username' => 'Värava kasutajanimi', | ||||
| 		'sms_gateway_password' => 'Värava parool', | ||||
| 		'sms_from' => 'Saatja telefoni number', | ||||
|  |  | |||
|  | @ -192,15 +192,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'برای عدم احراز هویت اینجا را خالی بگذارید.', | ||||
| 		'sms_status' => 'اجازه ارسال پیام های متنی', | ||||
| 		'sms_gateway' => 'گیت وی برای ارسال پیام ها', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_username' => 'نام کاربری Gateway', | ||||
| 		'sms_gateway_password' => 'کلمه عبور Gateway', | ||||
| 		'sms_from' => 'شماره تلفن ارسال کننده', | ||||
|  |  | |||
|  | @ -192,15 +192,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Jätä tyhjäksi jos ei varmennusta', | ||||
| 		'sms_status' => 'Salli tekstiviestien lähetys', | ||||
| 		'sms_gateway' => 'Palvelu jonka kautta tekstiviestit lähetetään', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_username' => 'Palvelun käyttäjänimi', | ||||
| 		'sms_gateway_password' => 'Palvelun salasana', | ||||
| 		'sms_from' => 'Lähettäjän puhelinnumero', | ||||
|  |  | |||
|  | @ -206,18 +206,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Laisser vide si pas d\'authentication', | ||||
| 		'sms_status' => 'Autoriser l\'envoi de SMS', | ||||
| 		'sms_gateway' => 'Passerelle à utiliser pour l\'envoi de SMS', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_freemobilesms' => 'FreeMobileSMS', | ||||
| 		'sms_gateway_username' => 'Nom utilisateur de la passerelle', | ||||
| 		'sms_gateway_password' => 'Mot de passe de la passerelle', | ||||
| 		'sms_from' => 'SMS de l\'expéditeur', | ||||
|  |  | |||
|  | @ -205,17 +205,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Lasciare vuoto per nessuna autentificazione', | ||||
| 		'sms_status' => 'Permetti invio SMS', | ||||
| 		'sms_gateway' => 'Gateway da usare per inviare SMS', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_username' => 'Nome Utente Gateway', | ||||
| 		'sms_gateway_password' => 'Password Gateway', | ||||
| 		'sms_from' => 'Numero di telefono del mittente', | ||||
|  |  | |||
|  | @ -209,20 +209,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => '空白で認証なしになります', | ||||
| 		'sms_status' => 'テキストメッセージの送信を許可する', | ||||
| 		'sms_gateway' => 'このゲートウェイは、メッセージの送信に使用されます。', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         	'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_freemobilesms' => 'FreeMobileSMS', | ||||
| 		'sms_gateway_clicksend' => 'ClickSend', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_smsgw' => 'SMSgw', | ||||
| 		'sms_gateway_username' => 'ゲートウェイのユーザー名', | ||||
| 		'sms_gateway_password' => 'ゲートウェイのパスワード', | ||||
| 		'sms_from' => '送信者の電話番号:', | ||||
|  |  | |||
|  | @ -205,17 +205,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Leave blank for no authentication', | ||||
| 		'sms_status' => 'SMS전송 허용', | ||||
| 		'sms_gateway' => '메세지 전송을 위한 게이트웨이 허용', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
|         'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_username' => 'Gateway username', | ||||
| 		'sms_gateway_password' => 'Gateway password', | ||||
| 		'sms_from' => 'Sender\'s phone number', | ||||
|  |  | |||
|  | @ -205,17 +205,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Laat leeg voor geen authenticatie', | ||||
| 		'sms_status' => 'Sta SMS berichten toe?', | ||||
| 		'sms_gateway' => 'Gateway voor het sturen van SMS', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_username' => 'Gateway gebruikersnaam', | ||||
| 		'sms_gateway_password' => 'Gateway wachtwoord', | ||||
| 		'sms_from' => 'Telefoonnummer afzender', | ||||
|  |  | |||
|  | @ -205,17 +205,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Pozostaw puste dla braku autentykacji', | ||||
| 		'sms_status' => 'Pozwól na wysyłkę SMS', | ||||
| 		'sms_gateway' => 'Bramka SMS', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_username' => 'Login do bramki', | ||||
| 		'sms_gateway_password' => 'Hasło do bramki', | ||||
| 		'sms_from' => 'Numer nadawcy', | ||||
|  |  | |||
|  | @ -203,25 +203,11 @@ $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_mosms' => 'Mosms', | ||||
| 	        'sms_gateway_mollie' => 'Mollie', | ||||
| 	        'sms_gateway_spryng' => 'Spryng', | ||||
| 	        'sms_gateway_inetworx' => 'Inetworx', | ||||
| 	        'sms_gateway_clickatell' => 'Clickatell', | ||||
| 		'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 	    '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_gateway_nexmo' => 'Nexmo', | ||||
| 	        '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 <a href="https://pushover.net/">o website</a> para mais informações.', | ||||
| 		'pushover_clone_app' => 'Clique aqui para criar sua app Pushover', | ||||
|  |  | |||
|  | @ -205,17 +205,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Оставить пустым, если без аутентификации', | ||||
| 		'sms_status' => 'Разрешить отправку SMS', | ||||
| 		'sms_gateway' => 'Шлюз для отправки SMS', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_username' => 'Пользователь', | ||||
| 		'sms_gateway_password' => 'Пароль', | ||||
| 		'sms_from' => 'Номер отправителя', | ||||
|  |  | |||
|  | @ -204,19 +204,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Nechajte prázdne pre použitie SMTP bez hesla', | ||||
| 		'sms_status' => 'Povoliť odosielanie textových správ', | ||||
| 		'sms_gateway' => 'Brána použitá pro odosielanie správ', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         	'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_freemobilesms' => 'FreeMobileSMS', | ||||
| 		'sms_gateway_clicksend' => 'ClickSend', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_username' => 'Užívateľské meno brány', | ||||
| 		'sms_gateway_password' => 'Heslo brány', | ||||
| 		'sms_from' => 'Telefónne číslo odosielateľa', | ||||
|  |  | |||
|  | @ -190,14 +190,6 @@ $sm_lang = array( | |||
|         '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_mosms' => 'Mosms', | ||||
|         'sms_gateway_mollie' => 'Mollie', | ||||
|         'sms_gateway_spryng' => 'Spryng', | ||||
|         'sms_gateway_inetworx' => 'Inetworx', | ||||
|         'sms_gateway_clickatell' => 'Clickatell', | ||||
|         'sms_gateway_textmarketer' => 'Textmarketer', | ||||
|         'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
|         'sms_gateway_smsit' => 'Smsit', | ||||
|         'sms_gateway_username' => 'Uporabniško ime SMS prehoda', | ||||
|         'sms_gateway_password' => 'Geslo SMS prehoda', | ||||
|         'sms_from' => 'Telefonska številka pošiljatelja', | ||||
|  |  | |||
|  | @ -205,16 +205,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Lämna blank för att inte autentisera', | ||||
| 		'sms_status' => 'Tillåt SMS', | ||||
| 		'sms_gateway' => 'Gateway för SMS', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         	'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_username' => 'Gateway användarnamn', | ||||
| 		'sms_gateway_password' => 'Gateway lösenord', | ||||
| 		'sms_from' => 'Avsändarens telefonnummer', | ||||
|  |  | |||
|  | @ -205,17 +205,6 @@ $sm_lang = array( | |||
|         '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_mosms' => 'Mosms', | ||||
|         'sms_gateway_mollie' => 'Mollie', | ||||
|         'sms_gateway_spryng' => 'Spryng', | ||||
|         'sms_gateway_inetworx' => 'Inetworx', | ||||
|         'sms_gateway_clickatell' => 'Clickatell', | ||||
|         'sms_gateway_textmarketer' => 'Textmarketer', | ||||
|         'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
|         'sms_gateway_smsit' => 'Smsit', | ||||
|         'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 	'sms_gateway_nexmo' => 'Nexmo', | ||||
|         'sms_gateway_username' => 'Servis kullanıcı adı', | ||||
|         'sms_gateway_password' => 'Servis şifresi', | ||||
|         'sms_from' => 'Gönderen numarası', | ||||
|  |  | |||
|  | @ -190,14 +190,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => 'Để trống nếu không có chứng thực', | ||||
| 		'sms_status' => 'Cho phép gửi tin nhắn văn bản', | ||||
| 		'sms_gateway' => 'Gateway sử dụng để gửi tin nhắn', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
|         'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_username' => 'Gateway username', | ||||
| 		'sms_gateway_password' => 'Gateway password', | ||||
| 		'sms_from' => 'Số điện thoại của người gửi', | ||||
|  |  | |||
|  | @ -221,17 +221,6 @@ $sm_lang = array( | |||
| 		'email_smtp_noauth' => '留空为无验证', | ||||
| 		'sms_status' => '允许发送短信SMS?', | ||||
| 		'sms_gateway' => '短信SMS发送网关', | ||||
| 		'sms_gateway_mosms' => 'Mosms', | ||||
| 		'sms_gateway_mollie' => 'Mollie', | ||||
| 		'sms_gateway_spryng' => 'Spryng', | ||||
| 		'sms_gateway_inetworx' => 'Inetworx', | ||||
| 		'sms_gateway_clickatell' => 'Clickatell', | ||||
| 		'sms_gateway_textmarketer' => 'Textmarketer', | ||||
| 		'sms_gateway_smsglobal' => 'SMSGlobal', | ||||
| 		'sms_gateway_octopush' => 'Octopush', | ||||
| 		'sms_gateway_smsit' => 'Smsit', | ||||
| 		'sms_gateway_freevoipdeal' => 'FreeVoipDeal', | ||||
| 		'sms_gateway_nexmo' => 'Nexmo', | ||||
| 		'sms_gateway_username' => 'SMS网关用户名', | ||||
| 		'sms_gateway_password' => 'SMS网关密码', | ||||
| 		'sms_from' => '发信人电话号', | ||||
|  |  | |||
|  | @ -117,8 +117,19 @@ class ConfigController extends AbstractController { | |||
| 			); | ||||
| 		} | ||||
| 
 | ||||
| 		// generate sms_gateway array
 | ||||
| 		$sms_gateways = psm_get_sms_gateways(); | ||||
| 		$tpl_data['sms_gateway_current'] = (isset($config['sms_gateway'])) | ||||
| 				? $config['sms_gateway'] | ||||
| 				: current($sms_gateways); | ||||
| 		$tpl_data['sms_gateways'] = array(); | ||||
| 		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['sms_selected_' . $config['sms_gateway']] = '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"'; | ||||
|  | @ -266,9 +277,9 @@ class ConfigController extends AbstractController { | |||
| 		$pushover = psm_build_pushover(); | ||||
| 		$pushover->setDebug(true); | ||||
| 		$user = $this->getUser()->getUser(); | ||||
| 		$api_token = psm_get_conf('pushover_api_token'); | ||||
| 		$apiToken = psm_get_conf('pushover_api_token'); | ||||
| 
 | ||||
| 		if(empty($api_token)) { | ||||
| 		if(empty($apiToken)) { | ||||
| 			$this->addMessage(psm_get_lang('config', 'pushover_error_noapp'), 'error'); | ||||
| 		} elseif(empty($user->pushover_key)) { | ||||
| 			$this->addMessage(psm_get_lang('config', 'pushover_error_nokey'), 'error'); | ||||
|  | @ -303,9 +314,9 @@ class ConfigController extends AbstractController { | |||
| 		protected function testTelegram() { | ||||
| 			$telegram = psm_build_telegram(); | ||||
| 			$user = $this->getUser()->getUser(); | ||||
| 			$api_token = psm_get_conf('telegram_api_token'); | ||||
| 			$apiToken = psm_get_conf('telegram_api_token'); | ||||
| 
 | ||||
| 			if(empty($api_token)) { | ||||
| 			if(empty($apiToken)) { | ||||
| 				$this->addMessage(psm_get_lang('config', 'telegram_error_notoken'), 'error'); | ||||
| 			} elseif(empty($user->telegram_id)) { | ||||
| 				$this->addMessage(psm_get_lang('config', 'telegram_error_noid'), 'error'); | ||||
|  | @ -363,21 +374,6 @@ class ConfigController extends AbstractController { | |||
| 			'label_email_smtp_noauth' => psm_get_lang('config', 'email_smtp_noauth'), | ||||
| 			'label_sms_status' => psm_get_lang('config', 'sms_status'), | ||||
| 			'label_sms_gateway' => psm_get_lang('config', 'sms_gateway'), | ||||
| 			'label_sms_gateway_mosms' => psm_get_lang('config', 'sms_gateway_mosms'), | ||||
| 			'label_sms_gateway_mollie' => psm_get_lang('config', 'sms_gateway_mollie'), | ||||
| 			'label_sms_gateway_spryng' => psm_get_lang('config', 'sms_gateway_spryng'), | ||||
| 			'label_sms_gateway_inetworx' => psm_get_lang('config', 'sms_gateway_inetworx'), | ||||
| 			'label_sms_gateway_clickatell' => psm_get_lang('config', 'sms_gateway_clickatell'), | ||||
| 			'label_sms_gateway_textmarketer' => psm_get_lang('config', 'sms_gateway_textmarketer'), | ||||
| 			'label_sms_gateway_smsit' => psm_get_lang('config', 'sms_gateway_smsit'), | ||||
| 			'label_sms_gateway_freevoipdeal' => psm_get_lang('config', 'sms_gateway_freevoipdeal'), | ||||
| 			'label_sms_gateway_smsglobal' => psm_get_lang('config', 'sms_gateway_smsglobal'), | ||||
| 			'label_sms_gateway_nexmo' => psm_get_lang('config', 'sms_gateway_nexmo'), | ||||
| 			'label_sms_gateway_smsgw' => psm_get_lang('config', 'sms_gateway_smsgw'), | ||||
| 			'label_sms_gateway_octopush' => psm_get_lang('config', 'sms_gateway_octopush'), | ||||
| 			'label_sms_gateway_freemobilesms' => psm_get_lang('config', 'sms_gateway_freemobilesms'), | ||||
| 			'label_sms_gateway_clicksend' => psm_get_lang('config', 'sms_gateway_clicksend'), | ||||
| 			'label_sms_gateway_twilio' => psm_get_lang('config', 'sms_gateway_twilio'), | ||||
| 			'label_sms_gateway_username' => psm_get_lang('config', 'sms_gateway_username'), | ||||
| 			'label_sms_gateway_password' => psm_get_lang('config', 'sms_gateway_password'), | ||||
| 			'label_sms_from' => psm_get_lang('config', 'sms_from'), | ||||
|  |  | |||
|  | @ -105,12 +105,10 @@ abstract class AbstractServerController extends AbstractController { | |||
| 		$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_offline_duration'] = ""; | ||||
| 		if ($server['last_offline'] != psm_get_lang('system', 'never')) { | ||||
| 			$server['last_offline_duration'] = "(".$server['last_offline_duration'].")"; | ||||
| 		} | ||||
| 		else { | ||||
| 			$server['last_offline_duration'] = ""; | ||||
| 		} | ||||
| 		$server['last_check']  = psm_timespan($server['last_check']); | ||||
| 		$server['active'] = psm_get_lang('system', $server['active']); | ||||
| 		$server['email'] = psm_get_lang('system', $server['email']); | ||||
|  |  | |||
|  | @ -157,9 +157,9 @@ class ProfileController extends AbstractController { | |||
| 	 */ | ||||
| 	protected function activateTelegram() { | ||||
| 		$telegram = psm_build_telegram(); | ||||
| 		$api_token = psm_get_conf('telegram_api_token'); | ||||
| 		$apiToken = psm_get_conf('telegram_api_token'); | ||||
| 
 | ||||
| 		if(empty($api_token)) { | ||||
| 		if(empty($apiToken)) { | ||||
| 			$this->addMessage(psm_get_lang('config', 'telegram_error_notoken'), 'error'); | ||||
| 		} else { | ||||
| 			$result = $telegram->getBotUsername(); | ||||
|  | @ -180,4 +180,3 @@ class ProfileController extends AbstractController { | |||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -83,9 +83,6 @@ class CMBulkSMS extends Core { | |||
|             return false; | ||||
|         } | ||||
| 
 | ||||
|         // Set message text
 | ||||
|         $this->messageBody = $message; | ||||
| 
 | ||||
|         // Prepare the message in CM's XML or JSON format
 | ||||
|         switch($this->apiType) { | ||||
|             case 'xml': | ||||
|  | @ -133,7 +130,7 @@ class CMBulkSMS extends Core { | |||
|                         'from'  => substr($this->originator, 0, 11), | ||||
|                         'to'    => $recipients, | ||||
|                         'body'  => array( | ||||
|                             'content' => $this->messageBody | ||||
|                             'content' => $message | ||||
|                         ) | ||||
|                     ) | ||||
|                 ) | ||||
|  | @ -184,7 +181,7 @@ class CMBulkSMS extends Core { | |||
|         } | ||||
| 
 | ||||
|         // Add body text
 | ||||
|         $msg->addChild('BODY', $this->messageBody); | ||||
|         $msg->addChild('BODY', $message); | ||||
| 
 | ||||
|         return $xml->asXML(); | ||||
|     } | ||||
|  |  | |||
|  | @ -19,48 +19,50 @@ | |||
|  * | ||||
|  * @package     phpservermon | ||||
|  * @author      Pepijn Over <pep@mailbox.org> | ||||
|  * @copyright   Copyright (c) 2008-2017 Pepijn Over <pep@mailbox.org> | ||||
|  * @author      Tim Zandbergen <Tim@Xervion.nl> | ||||
|  * @copyright   Copyright (c) 2008-2018 Pepijn Over <pep@mailbox.org> | ||||
|  * @license     http://www.gnu.org/licenses/gpl.txt GNU GPL v3 | ||||
|  * @version     Release: @package_version@ | ||||
|  * @link        http://www.phpservermonitor.org/ | ||||
|  * @link        https://www.phpservermonitor.org/ | ||||
|  **/ | ||||
| 
 | ||||
| namespace psm\Txtmsg; | ||||
| 
 | ||||
| class Clickatell extends Core { | ||||
| 	// =========================================================================
 | ||||
| 	// [ Fields ]
 | ||||
| 	// =========================================================================
 | ||||
| 	public $gateway = 1; | ||||
| 	public $resultcode = null; | ||||
| 	public $resultmessage = null; | ||||
| 	public $success = false; | ||||
| 	public $successcount = 0; | ||||
| 
 | ||||
| 	// =========================================================================
 | ||||
| 	// [ Methods ]
 | ||||
| 	// =========================================================================
 | ||||
| 	public function setGateway($gateway) { | ||||
| 		$this->gateway = $gateway; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	* Send sms using the Clickatell API | ||||
| 	* @var string $message | ||||
| 	* @var array $this->recipients | ||||
| 	* @var string $recipient | ||||
| 	* @var string $this->username | ||||
| 	* @var string $this->originator | ||||
| 	* @var int $success | ||||
| 	* @var string $error | ||||
| 	* @return int or string | ||||
| 	*/ | ||||
| 	public function sendSMS($message) { | ||||
| 		//$message MUST BE urlencode or it will send only part message (first word in most cases)
 | ||||
| 		$recipients = implode(',', $this->recipients); | ||||
| 		//example: https://api.clickatell.com/http/sendmsg?user=XXXXXX&password=PASSWORD&api_id=111111&to=11111111&text=Message
 | ||||
| 		//YOU MUST MANUALLY CHANGE THE VALUE OF 'api_id' EX: '&api_id=' . '1234567'
 | ||||
| 		$result = $this->_auth_https_post('api.clickatell.com', '/http/sendmsg', | ||||
| 			'?user=' . $this->username . | ||||
| 			'&password=' . $this->password . | ||||
| 			'&to=' . $recipients . | ||||
| 			'&api_id=' . 'XXXXXX' . | ||||
| 			'&text=' . substr(urlencode($message), 0, 153) | ||||
| 		); | ||||
| 		return $result; | ||||
| 	} | ||||
| 		$success = 1; | ||||
| 		$error = ''; | ||||
| 		foreach($this->recipients as $recipient) { | ||||
| 			$ch = curl_init(); | ||||
| 			curl_setopt($ch, CURLOPT_URL, "https://platform.clickatell.com/messages/http/send?apiKey=".urlencode($this->username)."&to=".urlencode($recipient)."&content=".urlencode($message)); | ||||
| 			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||||
| 			$headers = array(); | ||||
| 			$headers[] = "Content-Type: application/x-www-form-urlencoded"; | ||||
| 			curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | ||||
| 			$result = curl_exec($ch); | ||||
| 			curl_close($ch); | ||||
| 
 | ||||
| 	protected function _auth_https_post($host, $path, $data) { | ||||
| 		$url = $host . $path . $data; | ||||
| 		return psm_curl_get($url); | ||||
| 		 	// Check on error
 | ||||
| 			if (strpos($result, ",\"errorCode\":null,\"error\":null,\"errorDescription\":null") === False) { | ||||
| 				$error = $result; | ||||
| 				$success = 0; | ||||
| 			} | ||||
| 		} | ||||
| 		if($success == 1){ | ||||
| 			return 1; | ||||
| 		} | ||||
| 		return $error; | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -0,0 +1,79 @@ | |||
| <?php | ||||
| /** | ||||
|  * PHP Server Monitor | ||||
|  * Monitor your servers and websites. | ||||
|  * | ||||
|  * This file is part of PHP Server Monitor. | ||||
|  * PHP Server Monitor is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * PHP Server Monitor is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with PHP Server Monitor.  If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * @package     phpservermon | ||||
|  * @author      Perri Vardy-Mason | ||||
|  * @author      Tim Zandbergen <Tim@Xervion.nl> | ||||
|  * @copyright   Copyright (c) 2008-2017 Pepijn Over <pep@mailbox.org> | ||||
|  * @license     http://www.gnu.org/licenses/gpl.txt GNU GPL v3 | ||||
|  * @version     Release: @package_version@ | ||||
|  * @link        http://www.phpservermonitor.org/ | ||||
|  * @since       phpservermon 2.1 | ||||
|  **/ | ||||
| 
 | ||||
| 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 int $success | ||||
| 	* @var string $error | ||||
| 	* @return int or string | ||||
| 	*/ | ||||
|     public function sendSMS($message) { | ||||
|         $success = 1; | ||||
| 		$error = ''; | ||||
| 
 | ||||
| 		// Maximum of 50 users a time.
 | ||||
| 		$recipients_chunk = array_chunk($this->recipients, ceil(count($this->recipients) / 50));  | ||||
| 
 | ||||
| 		foreach ($recipients_chunk as $recipients) { | ||||
| 			$ch = curl_init(); | ||||
| 			curl_setopt($ch, CURLOPT_URL, "https://rest.messagebird.com/messages"); | ||||
| 			curl_setopt($ch, CURLOPT_POSTFIELDS,  | ||||
| 			"originator=".urlencode($this->originator == '' ? 'PSM' : $this->originator). | ||||
| 			"&body=".urlencode($message). | ||||
| 			"&recipients=".implode(",", $recipients)); | ||||
| 			curl_setopt($ch, CURLOPT_POST, 1); | ||||
| 			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||||
| 			$headers = array(); | ||||
| 			$headers[] = "Authorization: AccessKey ".$this->password; | ||||
| 			$headers[] = "Content-Type: application/x-www-form-urlencoded"; | ||||
| 			curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | ||||
| 			$result = curl_exec($ch); | ||||
| 			curl_close($ch); | ||||
| 
 | ||||
| 			// Check on error
 | ||||
| 			if (is_numeric(strpos($result, "{\"errors\":"))) { | ||||
| 				$error = $result; | ||||
| 				$success = 0; | ||||
| 			} | ||||
| 		} | ||||
| 		if($success == 1){ | ||||
| 			return 1; | ||||
| 		} | ||||
| 		return $error; | ||||
| 	} | ||||
| } | ||||
|  | @ -1,100 +0,0 @@ | |||
| <?php | ||||
| /** | ||||
|  * PHP Server Monitor | ||||
|  * Monitor your servers and websites. | ||||
|  * | ||||
|  * This file is part of PHP Server Monitor. | ||||
|  * PHP Server Monitor is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * PHP Server Monitor is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with PHP Server Monitor.  If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * @package     phpservermon | ||||
|  * @author      Pepijn Over <pep@mailbox.org> | ||||
|  * @copyright   Copyright (c) 2008-2017 Pepijn Over <pep@mailbox.org> | ||||
|  * @license     http://www.gnu.org/licenses/gpl.txt GNU GPL v3 | ||||
|  * @version     Release: @package_version@ | ||||
|  * @link        http://www.phpservermonitor.org/ | ||||
|  **/ | ||||
| 
 | ||||
| namespace psm\Txtmsg; | ||||
| 
 | ||||
| class Mollie extends Core { | ||||
| 	// =========================================================================
 | ||||
| 	// [ Fields ]
 | ||||
| 	// =========================================================================
 | ||||
| 	public $gateway	  	= 1; | ||||
| 	public $success	  	= false; | ||||
| 	public $reference    = ''; | ||||
| 
 | ||||
| 	// =========================================================================
 | ||||
| 	// [ Methods ]
 | ||||
| 	// =========================================================================
 | ||||
| 	/** | ||||
| 	 * Select the gateway to use | ||||
| 	 * | ||||
| 	 * @param unknown_type $gateway | ||||
| 	 */ | ||||
| 	public function setGateway($gateway) { | ||||
| 		$this->gateway = $gateway; | ||||
| 	} | ||||
| 
 | ||||
| 	public function setReference ($reference) { | ||||
| 	  $this->reference = $reference; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Send a text message to one or more recipients | ||||
| 	 * | ||||
| 	 * @param string $subject | ||||
| 	 * @param string $body | ||||
| 	 * @return boolean | ||||
| 	 */ | ||||
| 	public function sendSMS($message) { | ||||
| 		$recipients = implode(',', $this->recipients); | ||||
| 
 | ||||
| 		$result = $this->_auth_https_post('api.messagebird.com', '/xml/sms/', | ||||
| 							 		'gateway='.urlencode($this->gateway). | ||||
| 							 		'&username='.urlencode($this->username). | ||||
| 							 		'&password='.urlencode($this->password). | ||||
| 							 		'&originator='.urlencode($this->originator). | ||||
| 							 		'&recipients='.urlencode($recipients). | ||||
| 							 		'&message='.urlencode($message) . | ||||
| 							 		(($this->reference != '') ? '&reference='.$this->reference : '') | ||||
| 							 		); | ||||
| 
 | ||||
| 		$this->recipients = array(); | ||||
| 
 | ||||
| 		list($headers, $xml) = preg_split("/(\r?\n){2}/", $result, 2); | ||||
| 		$data = simplexml_load_string($xml); | ||||
| 
 | ||||
| 		$this->success = ($data->item->success == 'true'); | ||||
| 		return $this->success; | ||||
| 	} | ||||
| 
 | ||||
| 	protected function _auth_https_post($host, $path, $data) { | ||||
| 		$fp  = @fsockopen($host,80); | ||||
| 		$buf = ''; | ||||
| 		if ($fp) { | ||||
| 			@fputs($fp, "POST $path HTTP/1.0\n"); | ||||
| 			@fputs($fp, "Host: $host\n"); | ||||
| 			@fputs($fp, "Content-type: application/x-www-form-urlencoded\n"); | ||||
| 			@fputs($fp, "Content-length: " . strlen($data) . "\n"); | ||||
| 			@fputs($fp, "Connection: close\n\n"); | ||||
| 			@fputs($fp, $data); | ||||
| 			while (!feof($fp)) { | ||||
| 			  $buf .= fgets($fp,128); | ||||
| 			} | ||||
| 			fclose($fp); | ||||
| 		} | ||||
| 		return $buf; | ||||
| 	} | ||||
| } | ||||
|  | @ -28,49 +28,32 @@ | |||
| namespace psm\Txtmsg; | ||||
| 
 | ||||
| class Spryng extends Core { | ||||
| 	// =========================================================================
 | ||||
| 	// [ Fields ]
 | ||||
| 	// =========================================================================
 | ||||
| 	public $gateway = 1; | ||||
| 	public $resultcode = null; | ||||
| 	public $resultmessage = null; | ||||
| 	public $success = false; | ||||
| 	public $successcount = 0; | ||||
| 
 | ||||
| 	// =========================================================================
 | ||||
| 	// [ Methods ]
 | ||||
| 	// =========================================================================
 | ||||
| 	public function setGateway($gateway) { | ||||
| 		$this->gateway = $gateway; | ||||
| 	} | ||||
| 
 | ||||
| 	public function sendSMS($message) { | ||||
| 		$recipients = implode(',', $this->recipients); | ||||
| 		$message = urlencode($message); | ||||
| 
 | ||||
| 		$result = $this->_auth_https_post('http://www.spryng.nl', '/SyncTextService', | ||||
| 			'?OPERATION=send' . | ||||
| 			'&USERNAME=' . $this->username . | ||||
| 			'&PASSWORD=' . $this->password . | ||||
| 			'&DESTINATION=' . $recipients . | ||||
| 			'&SENDER=' . $this->originator . | ||||
| 			'&BODY=' . $message . | ||||
| 			'&SMSTYPE=' . 'BUSINESS' | ||||
| 		); | ||||
| 		return $result; | ||||
| 	} | ||||
| 
 | ||||
| 	protected function _auth_https_post($host, $path, $data) { | ||||
| 	/** | ||||
| 	* 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 | ||||
| 	* @return int or string | ||||
| 	*/ | ||||
|     public function sendSMS($message) { | ||||
| 		$recipients = implode(",", $this->recipients); | ||||
| 
 | ||||
| 		$ch = curl_init(); | ||||
| 		curl_setopt($ch, CURLOPT_URL, $host . $path . $data); | ||||
| 		//curl_setopt($ch, CURLOPT_HEADER, 1);
 | ||||
| 		//curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
 | ||||
| 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); | ||||
| 		curl_setopt($ch, CURLOPT_URL, "https://api.spryngsms.com/api/send.php?OPERATION=send&USERNAME=".urlencode($this->username)."&PASSWORD=".urlencode($this->password)."&DESTINATION=".urlencode($recipients)."&SENDER=".urlencode($this->originator)."&BODY=".urlencode($message)."&SMSTYPE=BUSINESS"); | ||||
| 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||||
| 
 | ||||
| 		$data = curl_exec($ch); | ||||
| 		$headers = array(); | ||||
| 		$headers[] = "Content-Type: application/x-www-form-urlencoded"; | ||||
| 		curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | ||||
| 		$result = curl_exec($ch); | ||||
| 		curl_close($ch); | ||||
| 		return $data; | ||||
| 
 | ||||
| 		// Check on error
 | ||||
| 		if ($result != 1) { | ||||
| 			return "Error ".$result.": see http://www.spryng.nl/en/developers/http-api/ for the description."; | ||||
| 		} | ||||
| 		return 1; | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -19,6 +19,7 @@ | |||
|  * | ||||
|  * @package     phpservermon | ||||
|  * @author      Perri Vardy-Mason | ||||
|  * @author      Tim Zandbergen <Tim@Xervion.nl> | ||||
|  * @copyright   Copyright (c) 2008-2017 Pepijn Over <pep@mailbox.org> | ||||
|  * @license     http://www.gnu.org/licenses/gpl.txt GNU GPL v3 | ||||
|  * @version     Release: @package_version@ | ||||
|  | @ -29,31 +30,41 @@ | |||
| namespace psm\Txtmsg; | ||||
| 
 | ||||
| class Textmarketer extends Core { | ||||
|     // =========================================================================
 | ||||
|     // [ Fields ]
 | ||||
|     // =========================================================================
 | ||||
|     public $gateway = 1; | ||||
|     public $resultcode = null; | ||||
|     public $resultmessage = null; | ||||
|     public $success = false; | ||||
|     public $successcount = 0; | ||||
| 
 | ||||
| 	/** | ||||
| 	* 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 int $success | ||||
| 	* @var string $error | ||||
| 	* @return int or string | ||||
| 	*/ | ||||
|     public function sendSMS($message) { | ||||
|         $success = 1; | ||||
| 		$error = ''; | ||||
|         foreach( $this->recipients as $recipient ){ | ||||
| 
 | ||||
|         $textmarketer_url = "https://api.textmarketer.co.uk/gateway/"; | ||||
|         $textmarketer_data = urlencode( $message ); | ||||
|         $textmarketer_origin = urlencode( 'SERVERALERT' ); | ||||
| 
 | ||||
| 
 | ||||
|         foreach( $this->recipients as $phone ){ | ||||
| 
 | ||||
|             $URL = $textmarketer_url."?username=" . $this->username . "&password=" . $this->password . "&to=" . $phone . "&message=" . $textmarketer_data . "&orig=" . $textmarketer_origin; | ||||
| 
 | ||||
|             $result = file_get_contents( $URL ); | ||||
|             $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(); | ||||
| 			$headers[] = "Content-Type: application/x-www-form-urlencoded"; | ||||
| 			curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | ||||
| 			$result = curl_exec($ch); | ||||
| 			curl_close($ch); | ||||
| 
 | ||||
|             // Check on error
 | ||||
|             if (is_numeric(strpos($result, "FAILED"))) { | ||||
|                 $error = $result; | ||||
|                 $success = 0; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         return $result; | ||||
|         if($success == 1){ | ||||
|             return 1; | ||||
|         } | ||||
|         return $error; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -70,8 +70,6 @@ class Twilio extends Core { | |||
| 		if($success == 1){ | ||||
| 			return 1; | ||||
| 		} | ||||
| 		else{ | ||||
| 			return $error; | ||||
| 		} | ||||
| 		return $error; | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -144,7 +144,7 @@ class Installer { | |||
| 					('email_smtp_username', ''), | ||||
| 					('email_smtp_password', ''), | ||||
| 					('sms_status', '0'), | ||||
| 					('sms_gateway', 'mollie'), | ||||
| 					('sms_gateway', 'messagebird'), | ||||
| 					('sms_gateway_username', 'username'), | ||||
| 					('sms_gateway_password', 'password'), | ||||
| 					('sms_from', '1234567890'), | ||||
|  | @ -534,5 +534,9 @@ class Installer { | |||
| 		$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`;"; | ||||
| 		$this->execSQL($queries); | ||||
| 		if(psm_get_conf('sms_gateway') == 'mollie'){ | ||||
| 			psm_update_conf('sms_gateway', 'messagebird'); | ||||
| 		} | ||||
| 		 | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -188,21 +188,9 @@ | |||
|                 <label class="control-label" for="sms_gateway">{{ label_sms_gateway }}</label> | ||||
|                 <div class="controls"> | ||||
|                     <select id="sms_gateway" name="sms_gateway"> | ||||
|                         <option value="mosms" {{ sms_selected_mosms|raw }}>{{ label_sms_gateway_mosms }}</option> | ||||
|                         <option value="mollie" {{ sms_selected_mollie|raw }}>{{ label_sms_gateway_mollie }}</option> | ||||
|                         <option value="spryng" {{ sms_selected_spryng|raw }}>{{ label_sms_gateway_spryng }}</option> | ||||
|                         <option value="inetworx" {{ sms_selected_inetworx|raw }}>{{ label_sms_gateway_inetworx }}</option> | ||||
|                         <option value="clickatell" {{ sms_selected_clickatell|raw }}>{{ label_sms_gateway_clickatell }}</option> | ||||
|                         <option value="textmarketer" {{ sms_selected_textmarketer|raw }}>{{ label_sms_gateway_textmarketer }}</option> | ||||
| 						<option value="smsglobal" {{ sms_selected_smsglobal|raw }}>{{ label_sms_gateway_smsglobal }}</option> | ||||
| 						<option value="smsit" {{ sms_selected_smsit|raw }}>{{ label_sms_gateway_smsit }}</option> | ||||
| 						<option value="freevoipdeal" {{ sms_selected_freevoipdeal|raw }}>{{ label_sms_gateway_freevoipdeal }}</option> | ||||
| 						<option value="octopush" {{ sms_selected_octopush|raw }}>{{ label_sms_gateway_octopush }}</option> | ||||
| 						<option value="freemobilesms" {{ sms_selected_freemobilesms|raw }}>{{ label_sms_gateway_freemobilesms }}</option> | ||||
| 						<option value="clicksend" {{ sms_selected_clicksend|raw }}>{{ label_sms_gateway_clicksend }}</option> | ||||
| 						<option value="smsgw" {{ sms_selected_smsgw|raw }}>{{ label_sms_gateway_smsgw }}</option> | ||||
| 						<option value="nexmo" {{ sms_selected_nexmo|raw }}>{{ label_sms_gateway_nexmo }}</option> | ||||
|                         <option value="twilio" {{ sms_selected_twilio|raw }}>{{ label_sms_gateway_twilio }}</option> | ||||
|                         {% for sms_gateway in sms_gateways %} | ||||
|                         <option value="{{ sms_gateway.value }}" {% if sms_gateway.value == sms_gateway_current %} selected="selected" {% endif %}>{{ sms_gateway.label }}</option> | ||||
| 						{% endfor %} | ||||
|                       </select> | ||||
|                 </div> | ||||
|             </div> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 TimZ99
						TimZ99