Exemplo n.º 1
0
 public function __construct()
 {
     parent::init();
     $this->setProviderName();
     $this->providerModel = ModelFactory::build(self::MODULE_NAME, 'Lastfm');
     $providerConfig = ConfigHelper::loadConfigs($this->providerName);
     $this->providerModel->setProviderConfigs($providerConfig);
     $this->providerModel->setParams($this->router->getParams());
     $jsonResponse = $this->providerModel->call($this->router->getActionName());
     $this->sendResponse($jsonResponse);
 }
Exemplo n.º 2
0
 public static function connect()
 {
     $host = ConfigHelper::getConfig("DB_HOST") or "localhost";
     $database = ConfigHelper::getConfig("DB_NAME") or "suket";
     $username = ConfigHelper::getConfig("DB_USERNAME") or "root";
     $password = ConfigHelper::getConfig("DB_PASSWORD") or "";
     // One connection through whole application
     if (null == self::$cont) {
         try {
             self::$cont = new PDO("mysql:host=" . $host . ";" . "dbname=" . $database, $username, $password);
         } catch (PDOException $e) {
             die($e->getMessage());
         }
     }
     return self::$cont;
 }