mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +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) {
|
$this->before(function(Request $request) {
|
||||||
|
$contentTypes = $request->getAcceptableContentTypes();
|
||||||
$request->setRequestFormat(
|
$request->setRequestFormat(
|
||||||
$request->getFormat(
|
$request->getFormat(
|
||||||
array_shift(
|
array_shift(
|
||||||
$request->getAcceptableContentTypes()
|
$contentTypes
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@@ -263,9 +263,11 @@ class Lightbox implements ControllerProviderInterface
|
|||||||
$template = 'lightbox/IE6/feed.html.twig';
|
$template = 'lightbox/IE6/feed.html.twig';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$content = $feed_entry->get_content();
|
||||||
|
|
||||||
$output = $app['twig']->render($template, array(
|
$output = $app['twig']->render($template, array(
|
||||||
'feed_entry' => $feed_entry,
|
'feed_entry' => $feed_entry,
|
||||||
'first_item' => array_shift($feed_entry->get_content()),
|
'first_item' => array_shift($content),
|
||||||
'local_title' => $feed_entry->get_title(),
|
'local_title' => $feed_entry->get_title(),
|
||||||
'module' => 'lightbox',
|
'module' => 'lightbox',
|
||||||
'module_name' => _('admin::monitor: module validation')
|
'module_name' => _('admin::monitor: module validation')
|
||||||
|
@@ -54,7 +54,8 @@ class Edit implements ControllerProviderInterface
|
|||||||
$multipleDataboxes = count($records->databoxes()) > 1;
|
$multipleDataboxes = count($records->databoxes()) > 1;
|
||||||
|
|
||||||
if (!$multipleDataboxes) {
|
if (!$multipleDataboxes) {
|
||||||
$databox = array_pop($records->databoxes());
|
$databoxes = $records->databoxes();
|
||||||
|
$databox = array_pop($databoxes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generate javascript fields
|
* generate javascript fields
|
||||||
@@ -311,7 +312,8 @@ class Edit implements ControllerProviderInterface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$databox = array_pop($records->databoxes());
|
$databoxes = $records->databoxes();
|
||||||
|
$databox = array_pop($databoxes);
|
||||||
|
|
||||||
$meta_struct = $databox->get_meta_structure();
|
$meta_struct = $databox->get_meta_structure();
|
||||||
$write_edit_el = false;
|
$write_edit_el = false;
|
||||||
@@ -360,7 +362,8 @@ class Edit implements ControllerProviderInterface
|
|||||||
$meta_id = null;
|
$meta_id = null;
|
||||||
|
|
||||||
if ($field && !$field->is_multi()) {
|
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(
|
$metas = array(
|
||||||
|
@@ -435,7 +435,8 @@ class Login implements ControllerProviderInterface
|
|||||||
*/
|
*/
|
||||||
public function displayRegisterForm(Application $app, Request $request)
|
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');
|
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.
|
* 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()
|
public function get_response()
|
||||||
{
|
{
|
||||||
$response = new \API_V1_Response(
|
$response = new Response(
|
||||||
$this->format()
|
$this->format()
|
||||||
, $this->get_http_code()
|
, $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');
|
$response->setCharset('UTF-8');
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
@@ -314,7 +314,8 @@ class Bridge_Api_Dailymotion extends Bridge_Api_Abstract implements Bridge_Api_I
|
|||||||
foreach ($result['list'] as $entry) {
|
foreach ($result['list'] as $entry) {
|
||||||
//get 1st image
|
//get 1st image
|
||||||
$list_element = $this->list_containers_content($object, $entry['id'], array('thumbnail_medium_url'), 1);
|
$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() : '';
|
$thumbnail = $first_element instanceof Bridge_Api_Dailymotion_Element ? $first_element->get_thumbnail() : '';
|
||||||
|
|
||||||
$url = $this->get_url_playlist($entry['id'], $entry['name'], $username);
|
$url = $this->get_url_playlist($entry['id'], $entry['name'], $username);
|
||||||
|
@@ -218,7 +218,7 @@ abstract class Feed_XML_Abstract
|
|||||||
* @param Feed_Entry_Item $content
|
* @param Feed_Entry_Item $content
|
||||||
* @return Feed_XML_Interface
|
* @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_sd = $content->get_record()->get_subdef('preview');
|
||||||
$preview_permalink = $preview_sd->get_permalink();
|
$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());
|
$this->addTag($document, $entry_node, 'content', $entry->get_subtitle());
|
||||||
|
|
||||||
foreach ($entry->get_content() as $content) {
|
foreach ($entry->get_content() as $content) {
|
||||||
$this->addContent($document, $entry_node, $content);
|
$this->addContent($document, $entry_node, $entry, $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $entry_node;
|
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) {
|
foreach ($entry->get_content() as $content) {
|
||||||
$this->addContent($document, $item, $content);
|
$this->addContent($document, $item, $entry, $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
|
@@ -372,7 +372,8 @@ class caption_Field_Value implements cache_cacheableInterface
|
|||||||
if ( ! $databox_field->is_multi()) {
|
if ( ! $databox_field->is_multi()) {
|
||||||
try {
|
try {
|
||||||
$field = $record->get_caption()->get_field($databox_field->get_name());
|
$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 */
|
/* @var $value \caption_Field_Value */
|
||||||
$caption_field_value->set_value($value);
|
$caption_field_value->set_value($value);
|
||||||
|
|
||||||
|
@@ -878,7 +878,8 @@ class module_report
|
|||||||
public static function getHost($url)
|
public static function getHost($url)
|
||||||
{
|
{
|
||||||
$parse_url = parse_url(trim($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);
|
return trim($result);
|
||||||
}
|
}
|
||||||
|
@@ -86,7 +86,8 @@ class patch_320f implements patchInterface
|
|||||||
continue;
|
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']);
|
$date_create = new DateTime($row['pub_date']);
|
||||||
if ($date_create < $date_ref) {
|
if ($date_create < $date_ref) {
|
||||||
$date_ref = $date_create;
|
$date_ref = $date_create;
|
||||||
@@ -159,7 +160,8 @@ class patch_320f implements patchInterface
|
|||||||
if ($homelink) {
|
if ($homelink) {
|
||||||
$feed->set_public(true);
|
$feed->set_public(true);
|
||||||
} elseif ($pub_restrict == 1) {
|
} 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)) {
|
if ( ! ($collection instanceof collection)) {
|
||||||
foreach ($appbox->get_databoxes() as $databox) {
|
foreach ($appbox->get_databoxes() as $databox) {
|
||||||
foreach ($databox->get_collections() as $coll) {
|
foreach ($databox->get_collections() as $coll) {
|
||||||
|
@@ -905,7 +905,8 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$field = $this->get_caption()->get_field($data_field->get_name())->get_meta_id();
|
$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();
|
$meta_id = $value->getId();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$meta_id = null;
|
$meta_id = null;
|
||||||
|
@@ -146,7 +146,7 @@ class setup
|
|||||||
return;
|
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");
|
require(__DIR__ . "/../../lib/conf.d/_GV_template.inc");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user