<?php
/**
* Platon Technologies 2013 - Newsletter
* Vzdialene API pre komunikaciu od newsletter.platon.sk
*
* posledna editacia:
* 2013-07-26 15:00 1.00
*
* Priklad pouzitia:
*
* <?php
* require_once 'PlatonNewsletter.php';
*
* $emails = array('janko@domena.sk', 'marienka@domena.sk', 'jozko@domka.sk');
*
* new PlatonNewsletter('veLmiTazKEheSlo', $emails);
* ? >
*
*
*/
class PlatonNewsletter {
private $password;
private $emails;
public function __construct($password, $emails) {
$this->password = $password;
$this->emails = $emails;
$this->run();
exit(0);
}
public function run() {
if ($_REQUEST['password'] != $this->password) {
die('Error: Incorrect password');
}
$method = strtolower($_REQUEST['method']);
if (strlen($method) <= 0) {
die('Error: Method not defined');
}
if (in_array($method, array('platonnewsletter', '__construct', 'run'))) {
die('Error: Forbidden method');
}
if (!method_exists($this, $_REQUEST['method'])) {
die('Error: Unknown method');
}
call_user_func(array($this, $method));
}
/*
* Definovane metody
*/
public function getEmails() {
echo json_encode($this->emails);
}
}
?>
Platon Group <platon@platon.sk> http://platon.sk/
|