Merge remote-tracking branch 'upstream/Dev' into Dev

This commit is contained in:
Romain Neutron
2012-04-25 17:07:22 +02:00
6 changed files with 730 additions and 643 deletions

View File

@@ -47,6 +47,7 @@ rewrite ^/feeds/.*$ /index.php last;
rewrite ^/lightbox/.*$ /lightbox/index.php last;
rewrite ^/api/v1/.*$ /api/v1/index.php last;
rewrite ^/api/oauthv2/.*$ /api/oauthv2/index.php last;
rewrite ^/api/.*$ /api/index.php last;
rewrite ^/permalink/.*$ /include/overview.php last;
rewrite ^/datafiles/.*$ /include/overview.php last;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,65 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Application;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception;
/**
*
* @package APIv1
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
return call_user_func(function()
{
$app = new \Silex\Application();
$app["Core"] = \bootstrap::getCore();
$app["appbox"] = \appbox::get_instance($app['Core']);
$app->get(
'/', function() use ($app)
{
$registry = $app["Core"]->getRegistry();
$apiAdapter = new \API_V1_adapter(false, $app["appbox"], $app["Core"]);
$versionNumber = (float) \Alchemy\Phrasea\Core\Version::getNumber();
$ret = array(
'install_name' => $registry->get('GV_homeTitle'),
'description' => $registry->get('GV_metaDescription'),
'documentation' => 'https://docs.phraseanet.com/Devel',
'versions' => array(
'1' => array(
'number' => $apiAdapter->get_version(),
'uri' => '/api/v1/',
'authenticationProtocol' => 'OAuth2',
'authenticationVersion' => 'draft#v9',
'authenticationEndPoints' => array(
'authorization_token' => '/api/oauthv2/authorize',
'access_token' => '/api/oauthv2/token'
)
)
)
);
$json = $app["Core"]['Serializer']->serialize($ret, 'json');
return new Response($json, 200, array('content-type' => 'application/json'));
});
return $app;
});

View File

@@ -55,6 +55,8 @@
RewriteRule ^api/v1/.*$ /api/v1/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^api/oauthv2/.*$ /api/oauthv2/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^api/.*$ /api/index.php [L]
RewriteRule ^permalink/.*$ /include/overview.php [L]
RewriteRule ^datafiles/.*$ /include/overview.php [L]

23
www/api/index.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . '/../../lib/bootstrap.php';
$app = require __DIR__ . '/../../lib/Alchemy/Phrasea/Application/ApiVersion.php';
$app->run();

View File

@@ -16,6 +16,8 @@
* @link www.phraseanet.com
*/
require_once __DIR__ . '/../../../lib/bootstrap.php';
$app = require __DIR__ . '/../../../lib/Alchemy/Phrasea/Application/Api.php';
$app->run();