mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 04:23:19 +00:00
Fix tests on PHP 5.4
This commit is contained in:
@@ -270,10 +270,11 @@ class Application extends SilexApplication
|
||||
|
||||
|
||||
$this->before(function(Request $request) {
|
||||
$contentTypes = $request->getAcceptableContentTypes();
|
||||
$request->setRequestFormat(
|
||||
$request->getFormat(
|
||||
array_shift(
|
||||
$request->getAcceptableContentTypes()
|
||||
$contentTypes
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@@ -263,9 +263,11 @@ class Lightbox implements ControllerProviderInterface
|
||||
$template = 'lightbox/IE6/feed.html.twig';
|
||||
}
|
||||
|
||||
$content = $feed_entry->get_content();
|
||||
|
||||
$output = $app['twig']->render($template, array(
|
||||
'feed_entry' => $feed_entry,
|
||||
'first_item' => array_shift($feed_entry->get_content()),
|
||||
'first_item' => array_shift($content),
|
||||
'local_title' => $feed_entry->get_title(),
|
||||
'module' => 'lightbox',
|
||||
'module_name' => _('admin::monitor: module validation')
|
||||
|
@@ -54,7 +54,8 @@ class Edit implements ControllerProviderInterface
|
||||
$multipleDataboxes = count($records->databoxes()) > 1;
|
||||
|
||||
if (!$multipleDataboxes) {
|
||||
$databox = array_pop($records->databoxes());
|
||||
$databoxes = $records->databoxes();
|
||||
$databox = array_pop($databoxes);
|
||||
|
||||
/**
|
||||
* generate javascript fields
|
||||
@@ -311,7 +312,8 @@ class Edit implements ControllerProviderInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$databox = array_pop($records->databoxes());
|
||||
$databoxes = $records->databoxes();
|
||||
$databox = array_pop($databoxes);
|
||||
|
||||
$meta_struct = $databox->get_meta_structure();
|
||||
$write_edit_el = false;
|
||||
@@ -360,7 +362,8 @@ class Edit implements ControllerProviderInterface
|
||||
$meta_id = null;
|
||||
|
||||
if ($field && !$field->is_multi()) {
|
||||
$meta_id = array_pop($field->get_values())->getId();
|
||||
$values = $field->get_values();
|
||||
$meta_id = array_pop($values)->getId();
|
||||
}
|
||||
|
||||
$metas = array(
|
||||
|
@@ -435,7 +435,8 @@ class Login implements ControllerProviderInterface
|
||||
*/
|
||||
public function displayRegisterForm(Application $app, Request $request)
|
||||
{
|
||||
if (false === \login::register_enabled($app)) {
|
||||
$login = new \login();
|
||||
if (false === $login->register_enabled($app)) {
|
||||
return $app->redirect('/login/?notice=no-register-available');
|
||||
}
|
||||
|
||||
|
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Used as a temporary fix for https://github.com/fabpot/Silex/issues/438
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class API_V1_Response extends Response
|
||||
{
|
||||
private $originalStatusCode;
|
||||
|
||||
public function setOriginalStatusCode($code)
|
||||
{
|
||||
$this->originalStatusCode = $code;
|
||||
}
|
||||
|
||||
public function getOriginalStatusCode()
|
||||
{
|
||||
return $this->originalStatusCode;
|
||||
}
|
||||
}
|
@@ -9,6 +9,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
@@ -358,12 +360,14 @@ class API_V1_result
|
||||
*/
|
||||
public function get_response()
|
||||
{
|
||||
$response = new \API_V1_Response(
|
||||
$response = new Response(
|
||||
$this->format()
|
||||
, $this->get_http_code()
|
||||
, array('Content-Type' => $this->get_content_type())
|
||||
, array(
|
||||
'Content-Type' => $this->get_content_type(),
|
||||
'X-Status-Code'=> $this->get_http_code(),
|
||||
)
|
||||
);
|
||||
$response->setOriginalStatusCode($this->get_http_code());
|
||||
$response->setCharset('UTF-8');
|
||||
|
||||
return $response;
|
||||
|
@@ -314,7 +314,8 @@ class Bridge_Api_Dailymotion extends Bridge_Api_Abstract implements Bridge_Api_I
|
||||
foreach ($result['list'] as $entry) {
|
||||
//get 1st image
|
||||
$list_element = $this->list_containers_content($object, $entry['id'], array('thumbnail_medium_url'), 1);
|
||||
$first_element = array_shift($list_element->get_elements());
|
||||
$elements = $list_element->get_elements();
|
||||
$first_element = array_shift($elements);
|
||||
$thumbnail = $first_element instanceof Bridge_Api_Dailymotion_Element ? $first_element->get_thumbnail() : '';
|
||||
|
||||
$url = $this->get_url_playlist($entry['id'], $entry['name'], $username);
|
||||
|
@@ -218,7 +218,7 @@ abstract class Feed_XML_Abstract
|
||||
* @param Feed_Entry_Item $content
|
||||
* @return Feed_XML_Interface
|
||||
*/
|
||||
protected function addContent(DOMDocument $document, DOMNode $item, Feed_Entry_Item $content)
|
||||
protected function addContent(DOMDocument $document, DOMNode $item, Feed_Entry_Adapter $entry, Feed_Entry_Item $content)
|
||||
{
|
||||
$preview_sd = $content->get_record()->get_subdef('preview');
|
||||
$preview_permalink = $preview_sd->get_permalink();
|
||||
|
@@ -145,7 +145,7 @@ class Feed_XML_Atom extends Feed_XML_Abstract implements Feed_XML_Interface
|
||||
$this->addTag($document, $entry_node, 'content', $entry->get_subtitle());
|
||||
|
||||
foreach ($entry->get_content() as $content) {
|
||||
$this->addContent($document, $entry_node, $content);
|
||||
$this->addContent($document, $entry_node, $entry, $content);
|
||||
}
|
||||
|
||||
return $entry_node;
|
||||
|
@@ -361,7 +361,7 @@ class Feed_XML_RSS extends Feed_XML_Abstract implements Feed_XML_Interface
|
||||
*
|
||||
*/
|
||||
foreach ($entry->get_content() as $content) {
|
||||
$this->addContent($document, $item, $content);
|
||||
$this->addContent($document, $item, $entry, $content);
|
||||
}
|
||||
|
||||
return $item;
|
||||
|
@@ -372,7 +372,8 @@ class caption_Field_Value implements cache_cacheableInterface
|
||||
if ( ! $databox_field->is_multi()) {
|
||||
try {
|
||||
$field = $record->get_caption()->get_field($databox_field->get_name());
|
||||
$caption_field_value = array_pop($field->get_values());
|
||||
$values = $field->get_values();
|
||||
$caption_field_value = array_pop($values);
|
||||
/* @var $value \caption_Field_Value */
|
||||
$caption_field_value->set_value($value);
|
||||
|
||||
|
@@ -878,7 +878,8 @@ class module_report
|
||||
public static function getHost($url)
|
||||
{
|
||||
$parse_url = parse_url(trim($url));
|
||||
$result = isset($parse_url['host']) ? $parse_url['host'] : array_shift(explode('/', $parse_url['path'], 2));
|
||||
$paths = explode('/', $parse_url['path'], 2);
|
||||
$result = isset($parse_url['host']) ? $parse_url['host'] : array_shift($paths);
|
||||
|
||||
return trim($result);
|
||||
}
|
||||
|
@@ -86,7 +86,8 @@ class patch_320f implements patchInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
$entry = Feed_Entry_Adapter::create($app, $feed, array_shift($feed->get_publishers()), $row['name'], $row['descript'], $user->get_display_name(), $user->get_email());
|
||||
$publishers = $feed->get_publishers();
|
||||
$entry = Feed_Entry_Adapter::create($app, $feed, array_shift($publishers), $row['name'], $row['descript'], $user->get_display_name(), $user->get_email());
|
||||
$date_create = new DateTime($row['pub_date']);
|
||||
if ($date_create < $date_ref) {
|
||||
$date_ref = $date_create;
|
||||
@@ -159,7 +160,8 @@ class patch_320f implements patchInterface
|
||||
if ($homelink) {
|
||||
$feed->set_public(true);
|
||||
} elseif ($pub_restrict == 1) {
|
||||
$collection = array_shift($user->ACL()->get_granted_base());
|
||||
$collections = $user->ACL()->get_granted_base();
|
||||
$collection = array_shift($collections);
|
||||
if ( ! ($collection instanceof collection)) {
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
foreach ($databox->get_collections() as $coll) {
|
||||
|
@@ -905,7 +905,8 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
||||
|
||||
try {
|
||||
$field = $this->get_caption()->get_field($data_field->get_name())->get_meta_id();
|
||||
$value = array_pop($field->get_values());
|
||||
$values = $field->get_values();
|
||||
$value = array_pop($values);
|
||||
$meta_id = $value->getId();
|
||||
} catch (\Exception $e) {
|
||||
$meta_id = null;
|
||||
|
@@ -146,7 +146,7 @@ class setup
|
||||
return;
|
||||
}
|
||||
|
||||
public function create_global_values(Application $app, $datas = array())
|
||||
public static function create_global_values(Application $app, $datas = array())
|
||||
{
|
||||
require(__DIR__ . "/../../lib/conf.d/_GV_template.inc");
|
||||
|
||||
|
Reference in New Issue
Block a user