space vs tabs

This commit is contained in:
Sándor 2021-01-31 21:10:13 +01:00
parent a38d02a0f7
commit 64792c630f

View File

@ -3,41 +3,41 @@
class ninjaMail
{
private $host;
private $key;
public $data;
private $host;
private $key;
public $data;
public function __construct($host, $key = false)
{
$this->host = $host;
if ($key) $this->key = $key;
}
public function __construct($host, $key = false)
{
$this->host = $host;
if ($key) $this->key = $key;
}
public function check()
{
if (!$this->host || !$this->key)
return false;
return true;
}
public function check()
{
if (!$this->host || !$this->key)
return false;
return true;
}
public function process($f, $data, $post_method = true)
{
$ch = curl_init($this->host.'/a/'.$f.'/?key='.$this->key);
public function process($f, $data, $post_method = true)
{
$ch = curl_init($this->host.'/a/'.$f.'/?key='.$this->key);
curl_setopt($ch, CURLOPT_ENCODING, 'UTF-8');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$data = curl_exec($ch);
curl_close($ch);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$data = curl_exec($ch);
curl_close($ch);
$data = @(object)json_decode($data);
$this->data = $data;
return $data;
}
$data = @(object)json_decode($data);
$this->data = $data;
return $data;
}
public function login()
{
return $this->process('login', ['rkey' => md5(time().rand(0,65500).rand(0,10))]);
}
public function login()
{
return $this->process('login', ['rkey' => md5(time().rand(0,65500).rand(0,10))]);
}
}
@ -53,33 +53,33 @@ class ninjaMailSend extends ninjaMail
public function to($to)
{
$this->to = $to;
return true;
$this->to = $to;
return true;
}
public function subject($s)
{
$this->subject = $s;
return true;
$this->subject = $s;
return true;
}
public function message($m, $t = false)
{
$this->message = $m;
if (!$t) $this->message_text = trim(strip_tags($m));
else $this->message_text = $t;
return true;
$this->message = $m;
if (!$t) $this->message_text = trim(strip_tags($m));
else $this->message_text = $t;
return true;
}
public function send()
{
$post = [
'to' => $this->to,
'subject' => $this->subject,
'message' => $this->message,
'message_text' => $this->message_text
];
return $this->process('send', $post, true)->status == 'message_queued' ? true : false;
$post = [
'to' => $this->to,
'subject' => $this->subject,
'message' => $this->message,
'message_text' => $this->message_text
];
return $this->process('send', $post, true)->status == 'message_queued' ? true : false;
}
}
@ -93,45 +93,45 @@ class ninjaMailSubscription extends ninjaMail
public function list($id)
{
if (is_numeric($id))
{
$this->list = $id;
return true;
}
return false;
if (is_numeric($id))
{
$this->list = $id;
return true;
}
return false;
}
public function activated($s)
{
if ($s) $this->activated = 1;
else $this->activated = 0;
return true;
if ($s) $this->activated = 1;
else $this->activated = 0;
return true;
}
public function subscribe($email, $name = '')
{
if (!$this->list || !is_numeric($this->activated))
return false;
if (!$this->list || !is_numeric($this->activated))
return false;
$post = [
'list' => $this->list,
'name' => $name,
'email' => $email,
'activated' => $this->activated
];
return $this->process('subscribe', $post, true)->status == 'success' ? true : false;
$post = [
'list' => $this->list,
'name' => $name,
'email' => $email,
'activated' => $this->activated
];
return $this->process('subscribe', $post, true)->status == 'success' ? true : false;
}
public function unsubscribe($email)
{
if (!$this->list)
return false;
if (!$this->list)
return false;
$post = [
'list' => $this->list,
'email' => $email
];
return $this->process('unsubscribe', $post, true)->status == 'success' ? true : false;
$post = [
'list' => $this->list,
'email' => $email
];
return $this->process('unsubscribe', $post, true)->status == 'success' ? true : false;
}
}
@ -158,16 +158,16 @@ class ninjaMailNewsletter extends ninjaMail
public function subject($s)
{
$this->subject = $s;
return true;
$this->subject = $s;
return true;
}
public function message($m, $t = false)
{
$this->message = $m;
if (!$t) $this->message_text = trim(strip_tags($m));
else $this->message_text = $t;
return true;
$this->message = $m;
if (!$t) $this->message_text = trim(strip_tags($m));
else $this->message_text = $t;
return true;
}
public function query($update = false)
@ -176,8 +176,8 @@ class ninjaMailNewsletter extends ninjaMail
return false;
$post = [
'new' => true,
'id' => $update ? $this->newsletter : false,
'new' => true,
'id' => $update ? $this->newsletter : false,
'subject' => $this->subject,
'message' => $this->message,
'message_text' => $this->message_text
@ -211,7 +211,7 @@ class ninjaMailNewsletter extends ninjaMail
$post = [
'send' => true,
'id' => $this->newsletter,
'id' => $this->newsletter,
'start' => $time ? $time : 0
];
$data = $this->process('newsletter', $post, true);
@ -291,7 +291,7 @@ class ninjaMailCampaign extends ninjaMail
$post = [
'relations' => true,
'id' => $this->campaign,
'id' => $this->campaign,
'newsletter' => $newsletter
];
return $this->process('campaign', $post, true)->status == 'success' ? true : false;