Ejemplo n.º 1
0
 protected function __construct($params)
 {
     $this->params = $params;
     $this->fb = Services\FacebookAPI::getInstance();
     $this->db = Services\DataBase::getInstance();
     $this->db->connectOrCreate();
 }
Ejemplo n.º 2
0
 protected function __construct($params)
 {
     if (!isset($params["action"])) {
         throw new \Exception('param Action missing');
     }
     $this->db = Services\DataBase::getInstance();
     $this->db->connectOrCreate();
     $user = Services\FacebookAPI::getInstance()->getUser();
     if (preg_match("#^admin\\_#", $params["action"])) {
         if ($user && $user->isAdmin()) {
             $this->adminAction($params);
             return;
         } else {
             echo json_encode(["html" => ""]);
             return;
         }
     }
     if (is_callable([$this, $params["action"]])) {
         $this->{$params}["action"]($params);
     }
 }
Ejemplo n.º 3
0
 static function getAll($limit = null)
 {
     $db = Services\DataBase::getInstance();
     $table = $db->getPrefix() . strtolower((new \ReflectionClass(get_called_class()))->getShortName());
     return $db->exec('SELECT * FROM ' . $table . ($limit ? " LIMIT {$limit}" : ""));
 }