Exemplo n.º 1
8
 public static function getByQueue($queue)
 {
     $config = Config::getConfig();
     $queueHandlerClass = $config->getParam('queue_handler');
     $queueHandler = $queueHandlerClass::getInstance();
     return $queueHandler->dequeue($queue);
 }
Exemplo n.º 2
0
 /**
  * Method parses requested url and returns an array with Module name and Action name.
  *
  * @param $server
  * @return array
  * @throws \Exception
  */
 public function parseUrl($server)
 {
     $path = parse_url($server['REQUEST_URI'], PHP_URL_PATH);
     $routeConfig = $this->routeConfig->getConfig('route', ROOT . self::ROUTE_CONFIG);
     if (array_key_exists($path, $routeConfig)) {
         return $routeConfig[$path];
     } else {
         throw new \Exception('BAD REQUEST.');
     }
 }
Exemplo n.º 3
0
 /**
  * Method returns an array with instances of requested arguments.
  *
  * @param \ReflectionParameter[] $params
  * @return array
  */
 private function resolveArguments(array $params)
 {
     $result = ['realType' => '', 'args' => ''];
     if ($params) {
         foreach ($params as $param) {
             if ($param->getClass() == null) {
                 $config = $this->config->getConfig('virtualType', ROOT . self::DI_CONFIG);
                 $realType = $param->name;
                 $result['realType'] = $config[$realType];
                 foreach ($config['arguments'] as $argument) {
                     $result['args'][] = $this->create($argument);
                 }
             } elseif ($param->getClass()->isInterface()) {
                 $config = $this->config->getConfig('preference', ROOT . self::DI_CONFIG);
                 $className = $this->getPreference($config, $param->getClass()->name);
                 $result['args'][] = $this->get($className);
             } else {
                 $className = $param->getClass()->name;
                 $result['args'][] = $this->get($className);
             }
         }
     }
     return $result;
 }
Exemplo n.º 4
0
 private function download($url)
 {
     $emageDir = Config::getConfig()->getParam('images_dir');
     $path_parts = pathinfo($url);
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_POST, 0);
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_FAILONERROR, 1);
     $result = curl_exec($ch);
     if ($result) {
         $extension = self::getExtensionByMimeType(curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
         $saveFile = fopen($emageDir . '/' . $path_parts['filename'] . '(' . uniqid() . ')' . '.' . $extension, 'w');
         fwrite($saveFile, $result);
         fclose($saveFile);
     }
     curl_close($ch);
     return $result ? true : false;
 }
Exemplo n.º 5
0
<?php

use App\Config\Config;
use App\Tools\Gravatar;
use App\Tools\Request;
session_start();
include_once "/vendor/autoload.php";
$myid = $_SESSION['me']->id;
$chatlist = Request::perform("chatlist/{$myid}");
$userlist = Request::perform("userlist");
$config = Config::getConfig("kinder");
if (empty($chatlist)) {
    echo "vous n'avez pas encore de conversations";
    die;
}
$old = $chatlist[0]->kinder;
?>
<div id="ex1" style="display:none;">
   <p id="nameadd" style="text-align: center;font-size: 18px; "></p>
    <input type="hidden" name="idadd" id="idadd" value=""/>

    <button id="addToConv" class="btn btn-primary btn-sm m-t-10 send-button" >Ajouter a la conversation</button>
</div>



<div id="chat-section">
    <ul class="tab-nav tn-justified" role="tablist">
        <li role="presentation" class="active"><a href="#chan" role="tab" data-toggle="tab">Channels</a></li>
        <li role="presentation"><a href="#annuaire" role="tab" data-toggle="tab">Annuaire</a></li>
    </ul>
Exemplo n.º 6
0
 public static function getConnect()
 {
     $dbConfig = \App\Config\Config::getConfig()->getParam('db');
     return self::$db ? self::$db : (self::$db = self::setConnect($dbConfig));
 }