示例#1
0
文件: index.php 项目: nbtetreault/igo
     $app->response->send();
     die(json_encode($error));
 }
 if ($encoding === "json") {
     $app->response->setContentType('application/json; charset=UTF-8')->sendHeaders();
     if (file_exists($xmlPath)) {
         $element = simplexml_load_file($xmlPath, 'SimpleXMLElement', LIBXML_NOCDATA);
     } else {
         $element = simplexml_load_string(curl_file_get_contents($xmlPath), 'SimpleXMLElement', LIBXML_NOCDATA);
     }
     if ($element->getName() === "navigateur") {
         //Gerer le cas des couches seulement avec un Id
         //Retourner l'info pour creer correctement la couche cote client
         $result = $element->xpath('//couche[boolean(@idbd)]');
         $avertissement = null;
         $debug = $app->getDI()->get("config")->application->debug;
         foreach ($result as $couche) {
             $coucheId = $couche->attributes()->idbd->__toString();
             if (is_numeric($coucheId)) {
                 $coucheBd = IgoVueCouche::findFirst("id=" . $coucheId);
             } else {
                 $coucheBd = IgoVueCouche::findFirst("mf_layer_name='" . $coucheId . "'");
             }
             if ($coucheBd === false) {
                 if (is_numeric($coucheId)) {
                     $avertissement[] = "La couche avec id:« {$coucheId} » n'existe pas!";
                     $dom = dom_import_simplexml($couche);
                     $dom->parentNode->removeChild($dom);
                     continue;
                 } else {
                     $avertissement[] = "La couche avec mf_layer_name:« {$coucheId} » n'existe pas!";
示例#2
0
use app\controllers\AuthController, app\models\feeds, app\models\feedcomments, app\models\friends, app\models\feedfollows, app\models\metafriends, app\models\notifications, app\models\profiles, app\models\users, app\models\privacy, app\models\embeds, app\models\photos, app\models\photoalbums, app\models\photocomments, app\models\phototaggroups, app\controllers\NotificationController, app\library\session\userSessions, app\library\fs\fileStorage as fs;
/*
 * Micro doesn't support any headers (ex: cookies and redirection)
 */
$app = new \Phalcon\Mvc\Micro($di);
$app->get('/ajax/test', function () {
    return 'Powered By Phalcon API';
});
$app->post('/ajax/test', function () {
    return 'Powered By Phalcon API';
});
$app->delete('/ajax/test', function () {
    return 'Powered By Phalcon API';
});
$app->post('/ajax/recover', function () use($app) {
    $mongo = $app->getDI()->getShared('mongo');
    $json = $app->request->getJsonRawBody();
    $user = $mongo->users->find(array('email' => $json->email), array('email' => 1));
    $user = iterator_to_array($user, false);
    if (count($user) > 0) {
        $app->response->setJsonContent(array('success' => true));
    } else {
        $app->response->setJsonContent(array('success' => false, 'message' => "Email doesn't exist."));
    }
    $app->response->send();
});
$app->put('/ajax/recover/change', function () use($app) {
    $mongo = $app->getDI()->getShared('mongo');
});
/* Embedly */
$app->get('/ajax/token', function () use($app) {