This commit is contained in:
Romain Neutron
2013-05-29 21:21:02 +02:00
parent e36e7ad085
commit 38f38290c8
35 changed files with 1577 additions and 1592 deletions

View File

@@ -133,7 +133,6 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGenerator;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\Form\FormBuilderInterface;
@@ -246,12 +245,12 @@ class Application extends SilexApplication
$this->register(new ReCaptchaServiceProvider());
$this['recaptcha.public-key'] = $this->share(function (Application $app) {
if($app['phraseanet.registry']->get('GV_captchas')) {
if ($app['phraseanet.registry']->get('GV_captchas')) {
return $app['phraseanet.registry']->get('GV_captcha_public_key');
}
});
$this['recaptcha.private-key'] = $this->share(function (Application $app) {
if($app['phraseanet.registry']->get('GV_captchas')) {
if ($app['phraseanet.registry']->get('GV_captchas')) {
return $app['phraseanet.registry']->get('GV_captcha_private_key');
}
});

View File

@@ -12,8 +12,6 @@
namespace Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Authentication\Context;
use Alchemy\Phrasea\Core\Event\PreAuthenticate;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Controller\Api\Oauth2;
use Alchemy\Phrasea\Controller\Api\V1;
@@ -63,7 +61,6 @@ return call_user_func(function($environment = 'prod') {
$app->mount('/api/oauthv2', new Oauth2());
$app->mount('/api/v1', new V1());
/**
* Route Errors
*/

View File

@@ -123,7 +123,7 @@ return call_user_func(function($environment = null) {
} elseif ($e instanceof \Exception_NotFound) {
$code = 404;
$message = 'Not Found';
} elseif($e instanceof \Exception_UnauthorizedAction) {
} elseif ($e instanceof \Exception_UnauthorizedAction) {
$code = 403;
$message = 'Forbidden';
} else {

View File

@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Authentication\Exception;;
namespace Alchemy\Phrasea\Authentication\Exception;
use Alchemy\Phrasea\Exception\RuntimeException;
use Symfony\Component\HttpFoundation\Response;

View File

@@ -11,8 +11,6 @@
namespace Alchemy\Phrasea\Authentication\Provider;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Exception\RuntimeException;
use Alchemy\Phrasea\Authentication\Provider\Token\Token;
use Alchemy\Phrasea\Authentication\Provider\Token\Identity;
use Alchemy\Phrasea\Authentication\Exception\NotAuthenticatedException;

View File

@@ -15,7 +15,6 @@ use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Authentication\Provider\Token\Token;
use Alchemy\Phrasea\Authentication\Provider\Token\Identity;
use Alchemy\Phrasea\Authentication\Exception\NotAuthenticatedException;
use Alchemy\Phrasea\Exception\RuntimeException;
use Guzzle\Http\Client as Guzzle;
use Guzzle\Http\ClientInterface;
use Guzzle\Common\Exception\GuzzleException;

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Authentication\Provider;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Authentication\Provider\Token\Token;
use Alchemy\Phrasea\Authentication\Provider\Token\Identity;
use Alchemy\Phrasea\Authentication\Exception\NotAuthenticatedException;
@@ -230,7 +229,7 @@ class GooglePlus extends AbstractProvider
throw new NotAuthenticatedException('Error while retrieving user info');
}
try{
try {
$plusData = $this->plus->people->get('me');
} catch (\Google_Exception $e) {
throw new NotAuthenticatedException('Error while retrieving user info', $e->getCode(), $e);

View File

@@ -11,11 +11,9 @@
namespace Alchemy\Phrasea\Authentication\Provider;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Authentication\Provider\Token\Token;
use Alchemy\Phrasea\Authentication\Provider\Token\Identity;
use Alchemy\Phrasea\Authentication\Exception\NotAuthenticatedException;
use Alchemy\Phrasea\Exception\RuntimeException;
use Guzzle\Http\Client as Guzzle;
use Guzzle\Http\ClientInterface;
use Guzzle\Common\Exception\GuzzleException;

View File

@@ -11,11 +11,9 @@
namespace Alchemy\Phrasea\Authentication\Provider;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Authentication\Provider\Token\Token;
use Alchemy\Phrasea\Authentication\Provider\Token\Identity;
use Alchemy\Phrasea\Authentication\Exception\NotAuthenticatedException;
use Alchemy\Phrasea\Exception\RuntimeException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Generator\UrlGenerator;

View File

@@ -61,6 +61,7 @@ class LessCompile extends Command
if (0 === $failures) {
$output->writeln('<info>Build done !</info>');
return 0;
}

View File

@@ -220,7 +220,8 @@ class Fields implements ControllerProviderInterface
return new Response($json, 200, array('Content-Type' => 'application/json'));
}
public function createField(Application $app, Request $request, $sbas_id) {
public function createField(Application $app, Request $request, $sbas_id)
{
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
$data = $this->getFieldJsonFromRequest($app, $request);
@@ -243,7 +244,8 @@ class Fields implements ControllerProviderInterface
))));
}
public function listFields(Application $app, $sbas_id) {
public function listFields(Application $app, $sbas_id)
{
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
return $app->json($databox->get_meta_structure()->toArray());
@@ -303,7 +305,7 @@ class Fields implements ControllerProviderInterface
$data = $this->requestBodyToJson($request);
$required = $this->getMandatoryFieldProperties();
foreach($data as $field) {
foreach ($data as $field) {
foreach ($required as $key) {
if (false === array_key_exists($key, $field)) {
$app->abort(400, sprintf('The entity must contain a key `%s`', $key));
@@ -374,7 +376,7 @@ class Fields implements ControllerProviderInterface
{
try {
\databox_field::loadClassFromTagName($field['tag']);
} catch(\Exception_Databox_metadataDescriptionNotFound $e) {
} catch (\Exception_Databox_metadataDescriptionNotFound $e) {
throw new BadRequestHttpException(_(sprintf('Provided tag %s is unknown.', $field['tag'])));
}
}

View File

@@ -12,7 +12,6 @@
namespace Alchemy\Phrasea\Controller\Api;
use Alchemy\Phrasea\Authentication\Context;
use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Authentication\Exception\AccountLockedException;
use Alchemy\Phrasea\Authentication\Exception\RequireCaptchaException;
use Alchemy\Phrasea\Core\Event\PreAuthenticate;

View File

@@ -1607,7 +1607,7 @@ class ACL implements cache_cacheableInterface
$collections = array();
foreach($rs as $row) {
foreach ($rs as $row) {
$collections[] = \collection::get_from_base_id($this->app, $row['base_id']);
}

View File

@@ -25,7 +25,7 @@ class API_V1_Timer implements ServiceProviderInterface
$callback = function (Event $event) use ($app) {
$name = $event->getName();
$n = 1;
while(isset($app['api.timers']->{$name})) {
while (isset($app['api.timers']->{$name})) {
$n++;
$name = $event->getName() . '#' . $n;
}

View File

@@ -373,7 +373,7 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
*/
public function get_publisher()
{
if ( ! $this->publisher instanceof Feed_Publisher_Adapter) {
if (! $this->publisher instanceof Feed_Publisher_Adapter) {
try {
$this->publisher = new Feed_Publisher_Adapter($this->app, $this->publisher_id);
} catch (\Exception_Feed_PublisherNotFound $e) {

View File

@@ -112,6 +112,7 @@ class caption_record implements caption_interface, cache_cacheableInterface
$buffer[$field->get_name()] = ctype_digit($val) ? (int) $val : $val;
}
}
return array('record' => array('description' => $buffer));
}

View File

@@ -147,4 +147,3 @@ class databox_descriptionStructure implements IteratorAggregate, Countable
return count($this->elements);
}
}

View File

@@ -61,4 +61,3 @@ class patch_379 implements patchInterface
return true;
}
}

View File

@@ -114,7 +114,6 @@ class patch_380a3 implements patchInterface
$stmt->closeCursor();
unset($stmt);
$sql = "CALL explode_log_table(',')";
$stmt = $conn->prepare($sql);
$stmt->execute();

View File

@@ -10,8 +10,6 @@
*/
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
use Alchemy\Phrasea\Exception\RuntimeException;
class phrasea
{

View File

@@ -20,7 +20,7 @@ class unicode
const CONVERT_TO_ND = 'nd'; // no-diacritics
const CONVERT_TO_LCND = 'lcnd'; // lowercase no-diacritics
static protected $map = array(
protected static $map = array(
self::CONVERT_TO_LC => array(
"\x41" => "\x61" , /* U+0041: LATIN CAPITAL LETTER A -> U+0061: LATIN SMALL LETTER A */
"\x42" => "\x62" , /* U+0042: LATIN CAPITAL LETTER B -> U+0062: LATIN SMALL LETTER B */
@@ -1558,7 +1558,6 @@ class unicode
return mb_strpos($this->endCharacters_utf8, $string);
}
/**
* Converts a string
*