GRAYBYTE WORDPRESS FILE MANAGER9253

Server IP : 198.54.121.189 / Your IP : 216.73.216.34
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/giriqfky/public_html/Barga/application/libraries/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/giriqfky/public_html/Barga/application/libraries//Fcmpushnotifications.php
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Fcmpushnotifications
{
	
		var $API_key;
		var $url;
		var $app_icon;

		public function __construct()
		{
			$this->API_key = FCM_API_KEY;
			$this->url = FCM_URL;
			$this->app_icon = FCM_APP_ICON;
		}
		
		public function send($tokens = array(), $message, $title = 'FLYNGENER', $picture_path = '', $platform = 'A', $noti_id = 0)
		{
			if(count($tokens) > 0)
			{
				$data = array(
							"title" => $title, 
							'message' => $message,//text
							'image' => $this->app_icon,	//not worked in MI
							"soundname" => "default",
							"style"=> ($picture_path != '')?'picture':'inbox',	//inbox
	    					"summaryText"=> "There are %n% notifications",
	    					"vibrationPattern"=> array(2000),
	    					'picture' => ($picture_path != '')?$picture_path:'',
	    					'summaryText'=> $message,//text
	    					'msg' => $message,	//text
	    					'type'=> $picture_path != '' ? 'picture' : 'inbox',
	    					'body' => $message,
	    					'notId' => time()
	    					);

			    //$data = array('title' => $title, 'body' => $message);
				$fields['data'] = $data;
				//$fields['notification'] = $data;
				//print_r($tokens);
				if($platform == 'I')
				{
					$fields['notification'] = array('body' => $message,
											'title' => $title,
											'sound' => "default",
											'badge' => '1'
										  );
				}
				else
				{
					$fields["content_available"] = true;
				}
				
				if(is_array($tokens)){
					$fields['registration_ids'] = $tokens;
				}else{
					$fields['to'] = $tokens;
				}
				// $fields['image'] = 'https://s-media-cache-ak0.pinimg.com/originals/ba/3c/dd/ba3cddc6ceb40f932d52d258c23b1f4f.png';
				$fields['priority'] = 2;
				$fields["time_to_live"] = 60*60*10;
				
				
				return $this->curlRequest($fields, $noti_id);
			}
		}
	
		private function curlRequest($fields, $noti_id)
		{
			$headers = array(
				'Content-Type:application/json',
				'Authorization:key='.$this->API_key
			);

			$ch = curl_init();
			curl_setopt($ch, CURLOPT_URL, $this->url);
			curl_setopt($ch, CURLOPT_POST, true);
			curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
			
			$result = curl_exec($ch);
			insertNotificationResponse($noti_id, $fields, $result);
			if ($result === FALSE) {
				die('Oops! FCM Send Error: ' . curl_error($ch));
			}
			curl_close($ch);
			return $result;
		}
	
}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 27 2024 00:19:25
giriqfky / giriqfky
0755
thumb
--
July 27 2024 00:19:25
giriqfky / giriqfky
0755
Ajax_pagination.php
7.739 KB
July 27 2024 00:19:25
giriqfky / giriqfky
0644
Fcmpushnotifications.php
2.551 KB
July 27 2024 00:19:25
giriqfky / giriqfky
0644
Firebase.php
4.967 KB
July 27 2024 00:19:25
giriqfky / giriqfky
0644
Format.php
7.437 KB
July 27 2024 00:19:25
giriqfky / giriqfky
0644
Pagination.php
16.826 KB
July 27 2024 00:19:25
giriqfky / giriqfky
0644
REST_Controller.php
53.801 KB
July 27 2024 00:19:25
giriqfky / giriqfky
0644
Supertronmailer.php
2.464 KB
July 27 2024 00:19:25
giriqfky / giriqfky
0644
Template.php
0.827 KB
July 27 2024 00:19:25
giriqfky / giriqfky
0644
index.html
0.128 KB
July 27 2024 00:19:25
giriqfky / giriqfky
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF