Ejemplo n.º 1
0
 public function __construct(BasePDO $_pdo, \bool $is_dev = null)
 {
     $this->_phpmailer = new PHPMailer();
     $this->_phpmailer->isSendmail();
     $this->is_dev = $is_dev ?? Utility::isDevServer();
     $this->_pdo = $_pdo;
 }
Ejemplo n.º 2
0
 public function startWorker()
 {
     $this->_queue->watch($this->tube);
     $this->_pdo->disconnect();
     while ($job = $this->_queue->reserve()) {
         $this->_pdo->connect();
         $data = json_decode($job->getData(), true);
         $this->performActions($data);
         unset($data);
         $this->_queue->delete($job);
         $this->_pdo->disconnect();
         if (Utility::isDevServer()) {
             exit;
         }
     }
 }
Ejemplo n.º 3
0
<?php

require_once __DIR__ . "/../../FMA/autoload.php";
header("Content-Type: application/json");
$_pdo = new \FMA\PDO\MySQL_PDO();
$router = new AltoRouter([], "/api");
if (!\FMA\Utility::isDevServer()) {
    $router->map("GET", "[*]", function () use($_pdo) {
        return ["err" => true, "msg" => "API is still under development."];
    });
} else {
    $router->map("GET", "/organization/", function () use($_pdo) {
        return \FMA\Organization\GreekOrganization::allAsArray($_pdo);
    });
    $router->map("GET", "/organization/[i:id]/", function ($id) use($_pdo) {
        $org = \FMA\Organization\GreekOrganization::find($_pdo, $id);
        if (is_null($org)) {
            return ["err" => true, "msg" => "No organization by that id."];
        }
        return $org->toArray();
    });
    $router->map("GET", "/organization/[i:id]/chapter/", function ($id) use($_pdo) {
        $org = \FMA\Organization\GreekOrganization::find($_pdo, $id);
        if (is_null($org)) {
            return ["err" => true, "msg" => "No organization by that id."];
        }
        return \FMA\Organization\Chapter::findAllForGreekOrganizationAsArray($_pdo, $org);
    });
    $router->map("GET", "/organization/[i:id]/chapter/[i:cid]/", function ($id, $cid) use($_pdo) {
        $org = \FMA\Organization\GreekOrganization::find($_pdo, $id);
        if (is_null($org)) {
Ejemplo n.º 4
0
 private function setVars()
 {
     date_default_timezone_set("America/Chicago");
     error_reporting(Utility::isDevServer() ? E_ALL & ~E_NOTICE : 0);
     ini_set("display_errors", Utility::isDevServer());
 }