Merge with 3.6

This commit is contained in:
Romain Neutron
2012-03-12 18:40:21 +01:00
212 changed files with 18953 additions and 32930 deletions

View File

@@ -307,7 +307,7 @@ return call_user_func(function()
*
*/
$route = '/records/search/';
$app->post(
$app->match(
$route, function() use ($app)
{
$result = $app['api']->search_records($app['request']);
@@ -317,6 +317,19 @@ return call_user_func(function()
);
$route = '/records/{databox_id}/{record_id}/caption/';
$app->get(
$route, function($databox_id, $record_id) use ($app)
{
$result = $app['api']->caption_records($app['request'], $databox_id, $record_id);
return $app['response']($result);
}
)->assert('databox_id', '\d+')->assert('record_id', '\d+');
$app->get('/records/{any_id}/{anyother_id}/caption/', $bad_request_exception);
/**
* Route : /records/DATABOX_ID/RECORD_ID/metadatas/FORMAT/
*

View File

@@ -232,7 +232,7 @@ return call_user_func(
$repository = $em->getRepository('\Entities\Basket');
/* @var $repository \Repositories\BasketRepository */
$basket_collection = $repository->findActiveByUser(
$basket_collection = $repository->findActiveValidationAndBasketByUser(
$app['Core']->getAuthenticatedUser()
);
@@ -290,7 +290,7 @@ return call_user_func(
$repository = $em->getRepository('\Entities\Basket');
/* @var $repository \Repositories\BasketRepository */
$basket_collection = $repository->findActiveByUser(
$basket_collection = $repository->findActiveValidationAndBasketByUser(
$app['Core']->getAuthenticatedUser()
);
@@ -570,7 +570,7 @@ return call_user_func(
$expires = new \DateTime('+10 days');
$url = $appbox->get_registry()->get('GV_ServerName')
. 'lightbox/index.php?LOG=' . \random::getUrlToken(
'validate'
\random::TYPE_VALIDATE
, $basket->getValidation()->getInitiator()->get_id()
, $expires
, $basket->getId()

View File

@@ -207,6 +207,7 @@ return call_user_func(function()
if ($oauth2_adapter->isNativeApp($params['redirect_uri']))
{
$params = $oauth2_adapter->finishNativeClientAuthorization($app_authorized, $params);
$params['user'] = $app['user'];
$html = $twig->render("api/auth/native_app_access_token.twig", $params);
return new Response($html, 200, array("content-type" => "text/html"));
@@ -270,7 +271,7 @@ return call_user_func(function()
*/
$route = "/applications/dev/new";
$app->get($route, function() use ($app)
{
{
$var = array("violations" => null, 'form' => null, 'request' => $app['request']);
return $app['response']('api/auth/application_dev_new.twig', $var);

View File

@@ -67,8 +67,10 @@ return call_user_func(function()
$app->get('/', function() use ($app)
{
if ($app['install'] === true)
return $app->redirect('/setup/installer/');
if ($app['upgrade'] === true)
return $app->redirect('/setup/upgrader/');
});

View File

@@ -47,4 +47,4 @@ class ApcCache extends DoctrineApc implements Cache
return $this;
}
}
}

View File

@@ -34,6 +34,7 @@ class ArrayCache extends DoctrineArray implements Cache
{
throw new Exception(sprintf('Unable to find key %s', $id));
}
return $this->fetch($id);
}
@@ -47,4 +48,4 @@ class ArrayCache extends DoctrineArray implements Cache
return;
}
}
}

View File

@@ -28,4 +28,4 @@ interface Cache extends DoctrineCache
public function deleteMulti(array $array_keys);
}
}

View File

@@ -71,21 +71,23 @@ class Manager
try
{
$configuration = $this->core->getConfiguration()->getService($service_name);
$write = true;
$service = Builder::create($this->core, $service_name, $configuration);
$driver = $service->getDriver();
$write = true;
}
catch (\Exception $e)
{
$configuration = new \Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(
array('type' => 'Cache\\ArrayCache')
array('type' => 'Cache\\ArrayCache')
);
$service = Builder::create($this->core, $service_name, $configuration);
$driver = $service->getDriver();
$write = false;
}
$service = Builder::create($this->core, $service_name, $configuration);
if ($this->hasChange($cacheKey, $service_name))
{
$service->getDriver()->flushAll();
$service->getDriver()->flush();
if ($write)
{
$this->registry[$cacheKey] = $service_name;
@@ -108,7 +110,7 @@ class Manager
$this->registry[$name] = $driver;
$datas = sprintf("#LastUpdate: %s\n", $date->format(DATE_ISO8601))
. $this->parser->dump($this->registry);
. $this->parser->dump($this->registry, 6);
file_put_contents($this->cacheFile->getPathname(), $datas);
}

View File

@@ -47,4 +47,4 @@ class MemcacheCache extends DoctrineMemcache implements Cache
return $this;
}
}
}

View File

@@ -47,4 +47,4 @@ class XcacheCache extends DoctrineXcache implements Cache
return $this;
}
}
}

View File

@@ -99,18 +99,6 @@ class Description implements ControllerProviderInterface
$field->set_dces_element($dces_element);
$field->save();
if ($request->get('regname') == $field->get_id())
{
$field->set_regname();
}
if ($request->get('regdate') == $field->get_id())
{
$field->set_regdate();
}
if ($request->get('regdesc') == $field->get_id())
{
$field->set_regdesc();
}
}
catch (\Exception $e)
{

View File

@@ -413,10 +413,24 @@ class Basket implements ControllerProviderInterface
$basket->addBasketElement($basket_element);
if(null !== $validationSession = $basket->getValidation())
{
$participants = $validationSession->getParticipants();
foreach($participants as $participant)
{
$validationData = new \Entities\ValidationData();
$validationData->setParticipant($participant);
$validationData->setBasketElement($basket_element);
$em->persist($validationData);
}
}
$n++;
}
$em->merge($basket);
$em->flush();
$data = array(

View File

@@ -183,10 +183,12 @@ class Push implements ControllerProviderInterface
$appbox = \appbox::get_instance($app['Core']);
$push_name = $request->get(
'name'
, sprintf(_('Push from %s'), $user->get_display_name())
);
$push_name = $request->get('name');
if (trim($push_name) === '')
{
$push_name = sprintf(_('Push from %s'), $user->get_display_name());
}
$push_description = $request->get('push_description');
@@ -231,6 +233,9 @@ class Push implements ControllerProviderInterface
$BasketElement->setRecord($element);
$BasketElement->setBasket($Basket);
$em->persist($BasketElement);
$Basket->addBasketElement($BasketElement);
if ($receiver['HD'])
{
@@ -248,15 +253,13 @@ class Push implements ControllerProviderInterface
, \ACL::GRANT_ACTION_PUSH
);
}
$em->persist($BasketElement);
}
$em->flush();
$url = $registry->get('GV_ServerName')
. 'lightbox/index.php?LOG='
. \random::getUrlToken('view', $user_receiver->get_id(), null, $Basket->getId());
. \random::getUrlToken(\random::TYPE_VIEW, $user_receiver->get_id(), null, $Basket->getId());
$params = array(
'from' => $user->get_id()
@@ -322,10 +325,12 @@ class Push implements ControllerProviderInterface
$repository = $em->getRepository('\Entities\Basket');
$validation_name = $request->get(
'name'
, sprintf(_('Validation from %s'), $user->get_display_name())
);
$validation_name = $request->get('name');
if (trim($validation_name) === '')
{
$validation_name = sprintf(_('Validation from %s'), $user->get_display_name());
}
$validation_description = $request->get('validation_description');
@@ -362,6 +367,8 @@ class Push implements ControllerProviderInterface
$BasketElement->setBasket($Basket);
$em->persist($BasketElement);
$Basket->addBasketElement($BasketElement);
}
$em->flush();
}
@@ -485,7 +492,7 @@ class Push implements ControllerProviderInterface
$url = $registry->get('GV_ServerName')
. 'lightbox/index.php?LOG='
. \random::getUrlToken('view', $participant_user->get_id(), null, $Basket->getId());
. \random::getUrlToken(\random::TYPE_VIEW, $participant_user->get_id(), null, $Basket->getId());
$params = array(
'from' => $user->get_id()

View File

@@ -205,11 +205,9 @@ class Query implements ControllerProviderInterface
}
}
$json['results'] = $twig->render($template, array(
'results' => $result,
'GV_social_tools' => $registry->get('GV_social_tools'),
'array_selected' => explode(';', $request->get('sel')),
'highlight' => $search_engine->get_query(),
'searchEngine' => $search_engine,
'suggestions' => $prop

View File

@@ -18,6 +18,7 @@ use Symfony\Component\HttpFoundation\Request,
Symfony\Component\HttpFoundation\Response,
Symfony\Component\HttpFoundation\RedirectResponse,
Symfony\Component\HttpKernel\Exception\HttpException,
Symfony\Component\Finder\Finder,
Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Alchemy\Phrasea\Helper;
@@ -40,49 +41,56 @@ class Root implements ControllerProviderInterface
\User_Adapter::updateClientInfos(1);
$appbox = \appbox::get_instance($app['Core']);
$css = array();
$cssfile = false;
$registry = $app['Core']->getRegistry();
$session = $appbox->get_session();
$user = $app['Core']->getAuthenticatedUser();
$cssPath = $registry->get('GV_RootPath') . 'www/skins/prod/';
if ($hdir = opendir($cssPath))
$css = array();
$cssfile = false;
$finder = new Finder();
$iterator = $finder
->directories()
->depth(0)
->filter(function(\SplFileInfo $fileinfo)
{
return ctype_xdigit($fileinfo->getBasename());
})
->in($cssPath);
foreach ($iterator as $dir)
{
while (false !== ($file = readdir($hdir)))
{
if (substr($file, 0, 1) == "." || mb_strtolower($file) == "cvs")
continue;
if (is_dir($cssPath . $file))
{
$css[$file] = $file;
}
}
closedir($hdir);
$baseName = $dir->getBaseName();
$css[$baseName] = $baseName;
}
$cssfile = $user->getPrefs('css');
if (!$cssfile && isset($css['000000']))
{
$cssfile = '000000';
}
$user_feeds = \Feed_Collection::load_all($appbox, $user);
$feeds = array_merge(array($user_feeds->get_aggregate()), $user_feeds->get_feeds());
$srt = 'name asc';
$thjslist = "";
$queries_topics = '';
if ($registry->get('GV_client_render_topics') == 'popups')
$queries_topics = queries::dropdown_topics();
{
$queries_topics = \queries::dropdown_topics();
}
elseif ($registry->get('GV_client_render_topics') == 'tree')
{
$queries_topics = \queries::tree_topics();
}
$sbas = $bas2sbas = array();
foreach ($appbox->get_databoxes() as $databox)
{
$sbas_id = $databox->get_sbas_id();
@@ -131,8 +139,6 @@ class Root implements ControllerProviderInterface
'GV_bitly_key' => $registry->get('GV_bitly_key')
));
return new Response($out);
});

View File

@@ -38,282 +38,311 @@ class Story implements ControllerProviderInterface
$controllers->get('/create/', function(Application $app)
{
/* @var $twig \Twig_Environment */
$twig = $app['Core']->getTwig();
{
/* @var $twig \Twig_Environment */
$twig = $app['Core']->getTwig();
return new Response($twig->render('prod/Story/Create.html.twig', array()));
});
return new Response($twig->render('prod/Story/Create.html.twig', array()));
});
$controllers->post('/', function(Application $app, Request $request)
{
/* @var $request \Symfony\Component\HttpFoundation\Request */
$em = $app['Core']->getEntityManager();
{
/* @var $request \Symfony\Component\HttpFoundation\Request */
$em = $app['Core']->getEntityManager();
$user = $app['Core']->getAuthenticatedUser();
$user = $app['Core']->getAuthenticatedUser();
$collection = \collection::get_from_base_id($request->get('base_id'));
$collection = \collection::get_from_base_id($request->get('base_id'));
if (!$user->ACL()->has_right_on_base($collection->get_base_id(), 'canaddrecord'))
throw new \Exception_Forbidden('You can not create a story on this collection');
if (!$user->ACL()->has_right_on_base($collection->get_base_id(), 'canaddrecord'))
{
throw new \Exception_Forbidden('You can not create a story on this collection');
}
$system_file = new \system_file(
$app['Core']->getRegistry()
->get('GV_RootPath') . 'www/skins/icons/substitution/regroup_doc.png'
);
$system_file = new \system_file(
$app['Core']->getRegistry()
->get('GV_RootPath') . 'www/skins/icons/substitution/regroup_doc.png'
);
$Story = \record_adapter::create($collection, $system_file, false, true);
$Story = \record_adapter::create($collection, $system_file, false, true);
$metadatas = array();
foreach (explode(';', $request->get('lst')) as $sbas_rec)
{
$sbas_rec = explode('_', $sbas_rec);
foreach ($collection->get_databox()->get_meta_structure() as $meta)
{
if ($meta->is_regname())
$value = $request->get('name');
elseif ($meta->is_regdesc())
$value = $request->get('description');
else
continue;
if (count($sbas_rec) !== 2)
{
continue;
}
$metadatas[] = array(
'meta_struct_id' => $meta->get_id()
, 'meta_id' => null
, 'value' => $value
);
}
$record = new \record_adapter($sbas_rec[0], $sbas_rec[1]);
$Story->set_metadatas($metadatas)
->rebuild_subdefs();
if (!$user->ACL()->has_access_to_base($record->get_base_id())
&& !$user->ACL()->has_hd_grant($record)
&& !$user->ACL()->has_preview_grant($record))
{
continue;
}
$StoryWZ = new \Entities\StoryWZ();
$StoryWZ->setUser($user);
$StoryWZ->setRecord($Story);
if ($Story->hasChild($record))
continue;
$em->persist($StoryWZ);
$Story->appendChild($record);
}
$em->flush();
$metadatas = array();
if ($request->getRequestFormat() == 'json')
{
$data = array(
'success' => true
, 'message' => _('Story created')
, 'WorkZone' => $StoryWZ->getId()
, 'story' => array(
'sbas_id' => $Story->get_sbas_id(),
'record_id' => $Story->get_record_id(),
)
);
foreach ($collection->get_databox()->get_meta_structure() as $meta)
{
if ($meta->get_thumbtitle())
{
$value = $request->get('name');
}
else
{
continue;
}
$datas = $app['Core']['Serializer']->serialize($data, 'json');
$metadatas[] = array(
'meta_struct_id' => $meta->get_id()
, 'meta_id' => null
, 'value' => $value
);
return new Response($datas, 200, array('Content-type' => 'application/json'));
}
else
{
return new RedirectResponse(sprintf('/%d/', $StoryWZ->getId()));
}
});
break;
}
$Story->set_metadatas($metadatas)->rebuild_subdefs();
$StoryWZ = new \Entities\StoryWZ();
$StoryWZ->setUser($user);
$StoryWZ->setRecord($Story);
$em->persist($StoryWZ);
$em->flush();
if ($request->getRequestFormat() == 'json')
{
$data = array(
'success' => true
, 'message' => _('Story created')
, 'WorkZone' => $StoryWZ->getId()
, 'story' => array(
'sbas_id' => $Story->get_sbas_id(),
'record_id' => $Story->get_record_id(),
)
);
$datas = $app['Core']['Serializer']->serialize($data, 'json');
return new Response($datas, 200, array('Content-type' => 'application/json'));
}
else
{
return new RedirectResponse(sprintf('/%d/', $StoryWZ->getId()));
}
});
$controllers->get('/{sbas_id}/{record_id}/', function(Application $app, $sbas_id, $record_id)
{
$Story = new \record_adapter($sbas_id, $record_id);
{
$Story = new \record_adapter($sbas_id, $record_id);
/* @var $twig \Twig_Environment */
$twig = $app['Core']->getTwig();
/* @var $twig \Twig_Environment */
$twig = $app['Core']->getTwig();
$html = $twig->render('prod/WorkZone/Story.html.twig', array('Story' => $Story));
$html = $twig->render('prod/WorkZone/Story.html.twig', array('Story' => $Story));
return new Response($html);
})->assert('sbas_id', '\d+')->assert('record_id', '\d+');
return new Response($html);
})->assert('sbas_id', '\d+')->assert('record_id', '\d+');
$controllers->post(
'/{sbas_id}/{record_id}/addElements/'
, function(Application $app, Request $request, $sbas_id, $record_id)
{
$Story = new \record_adapter($sbas_id, $record_id);
'/{sbas_id}/{record_id}/addElements/'
, function(Application $app, Request $request, $sbas_id, $record_id)
{
$Story = new \record_adapter($sbas_id, $record_id);
$user = $app['Core']->getAuthenticatedUser();
$user = $app['Core']->getAuthenticatedUser();
if (!$user->ACL()->has_right_on_base($Story->get_base_id(), 'canmodifrecord'))
throw new \Exception_Forbidden('You can not add document to this Story');
if (!$user->ACL()->has_right_on_base($Story->get_base_id(), 'canmodifrecord'))
throw new \Exception_Forbidden('You can not add document to this Story');
/* @var $user \User_Adapter */
/* @var $user \User_Adapter */
$n = 0;
$n = 0;
foreach (explode(';', $request->get('lst')) as $sbas_rec)
{
$sbas_rec = explode('_', $sbas_rec);
foreach (explode(';', $request->get('lst')) as $sbas_rec)
{
$sbas_rec = explode('_', $sbas_rec);
if (count($sbas_rec) !== 2)
continue;
if (count($sbas_rec) !== 2)
continue;
$record = new \record_adapter($sbas_rec[0], $sbas_rec[1]);
$record = new \record_adapter($sbas_rec[0], $sbas_rec[1]);
if (!$user->ACL()->has_access_to_base($record->get_base_id())
&& !$user->ACL()->has_hd_grant($record)
&& !$user->ACL()->has_preview_grant($record))
{
continue;
}
if (!$user->ACL()->has_access_to_base($record->get_base_id())
&& !$user->ACL()->has_hd_grant($record)
&& !$user->ACL()->has_preview_grant($record))
{
continue;
}
if ($Story->hasChild($record))
continue;
if ($Story->hasChild($record))
continue;
$Story->appendChild($record);
$Story->appendChild($record);
$n++;
}
$n++;
}
$data = array(
'success' => true
, 'message' => sprintf(_('%d records added'), $n)
);
$data = array(
'success' => true
, 'message' => sprintf(_('%d records added'), $n)
);
if ($request->getRequestFormat() == 'json')
{
if ($request->getRequestFormat() == 'json')
{
$datas = $app['Core']['Serializer']->serialize($data, 'json');
$datas = $app['Core']['Serializer']->serialize($data, 'json');
return new Response($datas, 200, array('Content-type' => 'application/json'));
}
else
{
return new RedirectResponse('/');
}
})->assert('sbas_id', '\d+')->assert('record_id', '\d+');
return new Response($datas, 200, array('Content-type' => 'application/json'));
}
else
{
return new RedirectResponse('/');
}
})->assert('sbas_id', '\d+')->assert('record_id', '\d+');
$controllers->post(
'/{sbas_id}/{record_id}/delete/{child_sbas_id}/{child_record_id}/'
, function(Application $app, Request $request, $sbas_id, $record_id, $child_sbas_id, $child_record_id)
{
$Story = new \record_adapter($sbas_id, $record_id);
'/{sbas_id}/{record_id}/delete/{child_sbas_id}/{child_record_id}/'
, function(Application $app, Request $request, $sbas_id, $record_id, $child_sbas_id, $child_record_id)
{
$Story = new \record_adapter($sbas_id, $record_id);
$record = new \record_adapter($child_sbas_id, $child_record_id);
$record = new \record_adapter($child_sbas_id, $child_record_id);
$user = $app['Core']->getAuthenticatedUser();
$user = $app['Core']->getAuthenticatedUser();
if (!$user->ACL()->has_right_on_base($Story->get_base_id(), 'canmodifrecord'))
throw new \Exception_Forbidden('You can not add document to this Story');
if (!$user->ACL()->has_right_on_base($Story->get_base_id(), 'canmodifrecord'))
throw new \Exception_Forbidden('You can not add document to this Story');
/* @var $user \User_Adapter */
/* @var $user \User_Adapter */
$Story->removeChild($record);
$Story->removeChild($record);
$data = array(
'success' => true
, 'message' => _('Record removed from story')
);
$data = array(
'success' => true
, 'message' => _('Record removed from story')
);
if ($request->getRequestFormat() == 'json')
{
$datas = $app['Core']['Serializer']->serialize($data, 'json');
if ($request->getRequestFormat() == 'json')
{
$datas = $app['Core']['Serializer']->serialize($data, 'json');
return new Response($datas, 200, array('Content-type' => 'application/json'));
}
else
{
return new RedirectResponse('/');
}
})
->assert('sbas_id', '\d+')
->assert('record_id', '\d+')
->assert('child_sbas_id', '\d+')
->assert('child_record_id', '\d+');
return new Response($datas, 200, array('Content-type' => 'application/json'));
}
else
{
return new RedirectResponse('/');
}
})
->assert('sbas_id', '\d+')
->assert('record_id', '\d+')
->assert('child_sbas_id', '\d+')
->assert('child_record_id', '\d+');
/**
* Get the Basket reorder form
*/
$controllers->get(
'/{sbas_id}/{record_id}/reorder/'
, function(Application $app, $sbas_id, $record_id)
{
/* @var $em \Doctrine\ORM\EntityManager */
$em = $app['Core']->getEntityManager();
'/{sbas_id}/{record_id}/reorder/'
, function(Application $app, $sbas_id, $record_id)
{
/* @var $em \Doctrine\ORM\EntityManager */
$em = $app['Core']->getEntityManager();
$story = new \record_adapter($sbas_id, $record_id);
$story = new \record_adapter($sbas_id, $record_id);
if (!$story->is_grouping())
{
throw new \Exception('This is not a story');
}
if (!$story->is_grouping())
{
throw new \Exception('This is not a story');
}
/* @var $twig \Twig_Environment */
$twig = $app['Core']->getTwig();
/* @var $twig \Twig_Environment */
$twig = $app['Core']->getTwig();
return new Response(
$twig->render(
'prod/Story/Reorder.html.twig'
, array('story' => $story)
)
);
})
->assert('sbas_id', '\d+')
->assert('record_id', '\d+');
return new Response(
$twig->render(
'prod/Story/Reorder.html.twig'
, array('story' => $story)
)
);
})
->assert('sbas_id', '\d+')
->assert('record_id', '\d+');
$controllers->post(
'/{sbas_id}/{record_id}/reorder/'
, function(Application $app, $sbas_id, $record_id)
{
$ret = array('success' => false, 'message' => _('An error occured'));
try
{
$user = $app['Core']->getAuthenticatedUser();
/* @var $user \User_Adapter */
'/{sbas_id}/{record_id}/reorder/'
, function(Application $app, $sbas_id, $record_id)
{
$ret = array('success' => false, 'message' => _('An error occured'));
try
{
$user = $app['Core']->getAuthenticatedUser();
/* @var $user \User_Adapter */
$story = new \record_adapter($sbas_id, $record_id);
$story = new \record_adapter($sbas_id, $record_id);
if (!$story->is_grouping())
{
throw new \Exception('This is not a story');
}
if (!$story->is_grouping())
{
throw new \Exception('This is not a story');
}
if (!$user->ACL()->has_right_on_base($story->get_base_id(), 'canmodifrecord'))
{
throw new ControllerException(_('You can not edit this story'));
}
if (!$user->ACL()->has_right_on_base($story->get_base_id(), 'canmodifrecord'))
{
throw new ControllerException(_('You can not edit this story'));
}
$sql = 'UPDATE regroup SET ord = :ord
$sql = 'UPDATE regroup SET ord = :ord
WHERE rid_parent = :parent_id AND rid_child = :children_id';
$stmt = $story->get_databox()->get_connection()->prepare($sql);
$stmt = $story->get_databox()->get_connection()->prepare($sql);
foreach ($app['request']->get('element') as $record_id => $ord)
{
$params = array(
':ord' => $ord,
':parent_id' => $story->get_record_id(),
':children_id' => $record_id
);
$stmt->execute($params);
}
foreach ($app['request']->get('element') as $record_id => $ord)
{
$params = array(
':ord' => $ord,
':parent_id' => $story->get_record_id(),
':children_id' => $record_id
);
$stmt->execute($params);
}
$stmt->closeCursor();
$stmt->closeCursor();
$ret = array('success' => true, 'message' => _('Story updated'));
}
catch (ControllerException $e)
{
$ret = array('success' => false, 'message' => $e->getMessage());
}
catch (\Exception $e)
{
$ret = array('success' => true, 'message' => _('Story updated'));
}
catch (ControllerException $e)
{
$ret = array('success' => false, 'message' => $e->getMessage());
}
catch (\Exception $e)
{
}
}
$Serializer = $app['Core']['Serializer'];
$Serializer = $app['Core']['Serializer'];
return new Response($Serializer->serialize($ret, 'json'), 200, array('Content-type' => 'application/json'));
})
->assert('sbas_id', '\d+')
->assert('record_id', '\d+');
return new Response($Serializer->serialize($ret, 'json'), 200, array('Content-type' => 'application/json'));
})
->assert('sbas_id', '\d+')
->assert('record_id', '\d+');
return $controllers;

View File

@@ -286,7 +286,6 @@ class UsrLists implements ControllerProviderInterface
$list->setName($list_name);
$em->merge($list);
$em->flush();
$datas = array(
@@ -459,7 +458,7 @@ class UsrLists implements ControllerProviderInterface
$list->addUsrListEntry($entry);
$em->persist($entry);
$em->merge($list);
$inserted_usr_ids[] = $user_entry->get_id();
}
@@ -585,14 +584,12 @@ class UsrLists implements ControllerProviderInterface
$list->addUsrListOwner($owner);
$em->persist($owner);
$em->merge($list);
}
$role = $app['request']->get('role');
$owner->setRole($role);
$em->merge($owner);
$em->flush();
$datas = array(

View File

@@ -33,293 +33,323 @@ class Installer implements ControllerProviderInterface
$controllers = new ControllerCollection();
$controllers->get('/', function() use ($app)
{
$request = $app['request'];
$php_constraint = \setup::check_php_version();
$writability_constraints = \setup::check_writability(new \Setup_Registry());
$extension_constraints = \setup::check_php_extension();
$opcode_constraints = \setup::check_cache_opcode();
$php_conf_constraints = \setup::check_php_configuration();
$locales_constraints = \setup::check_system_locales();
$constraints_coll = array(
'php_constraint' => $php_constraint
, 'writability_constraints' => $writability_constraints
, 'extension_constraints' => $extension_constraints
, 'opcode_constraints' => $opcode_constraints
, 'php_conf_constraints' => $php_conf_constraints
, 'locales_constraints' => $locales_constraints
);
$redirect = true;
foreach ($constraints_coll as $key => $constraints)
{
$unset = true;
foreach ($constraints as $constraint)
{
if (!$constraint->is_ok() && $constraint->is_blocker())
$redirect = $unset = false;
}
if ($unset === true)
{
unset($constraints_coll[$key]);
}
}
if ($redirect)
{
return $app->redirect('/setup/installer/step2/');
}
$ld_path = array(__DIR__ . '/../../../../../templates/web');
$loader = new \Twig_Loader_Filesystem($ld_path);
$twig = new \Twig_Environment($loader);
$html = $twig->render(
'/setup/index.html.twig'
, array_merge($constraints_coll, array(
'locale' => \Session_Handler::get_locale()
, 'available_locales' => $app['Core']::getAvailableLanguages()
, 'version_number' => $app['Core']['Version']->getNumber()
, 'version_name' => $app['Core']['Version']->getName()
, 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/'
))
);
return new Response($html);
});
$controllers->get('/step2/', function() use ($app)
{
\phrasea::use_i18n(\Session_Handler::get_locale());
$ld_path = array(__DIR__ . '/../../../../../templates/web');
$loader = new \Twig_Loader_Filesystem($ld_path);
$twig = new \Twig_Environment($loader);
$twig->addExtension(new \Twig_Extensions_Extension_I18n());
$request = $app['request'];
$warnings = array();
if ($request->getScheme() == 'http')
{
$warnings[] = _('It is not recommended to install Phraseanet without HTTPS support');
}
$html = $twig->render(
'/setup/step2.html.twig'
, array(
'locale' => \Session_Handler::get_locale()
, 'available_locales' => $app['Core']::getAvailableLanguages()
, 'available_templates' => \appbox::list_databox_templates()
, 'version_number' => $app['Core']['Version']->getNumber()
, 'version_name' => $app['Core']['Version']->getName()
, 'warnings' => $warnings
, 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/'
, 'discovered_binaries' => \setup::discover_binaries()
, 'rootpath' => dirname(dirname(dirname(dirname(__DIR__)))) . '/'
)
);
return new Response($html);
});
$controllers->post('/install/', function() use ($app)
{
set_time_limit(360);
\phrasea::use_i18n(\Session_Handler::get_locale());
$request = $app['request'];
$servername = $request->getScheme() . '://' . $request->getHttpHost() . '/';
$setupRegistry = new \Setup_Registry();
$setupRegistry->set('GV_ServerName', $servername, \registry::TYPE_STRING);
$conn = $connbas = null;
$hostname = $request->get('ab_hostname');
$port = $request->get('ab_port');
$user_ab = $request->get('ab_user');
$password = $request->get('ab_password');
$appbox_name = $request->get('ab_name');
$databox_name = $request->get('db_name');
try
{
$conn = new \connection_pdo('appbox', $hostname, $port, $user_ab, $password, $appbox_name, array(), $setupRegistry);
}
catch (\Exception $e)
{
return $app->redirect('/setup/installer/step2/?error=' . _('Appbox is unreachable'));
}
try
{
if ($databox_name)
{
$connbas = new \connection_pdo('databox', $hostname, $port, $user_ab, $password, $databox_name, array(), $setupRegistry);
}
}
catch (\Exception $e)
{
return $app->redirect('/setup/installer/step2/?error=' . _('Databox is unreachable'));
}
\setup::rollback($conn, $connbas);
try
{
$setupRegistry = new \Setup_Registry();
$setupRegistry->set('GV_ServerName', $servername, \registry::TYPE_STRING);
$appbox = \appbox::create($app['Core'], $setupRegistry, $conn, $appbox_name, true);
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
if ($configuration->isInstalled())
{
$serviceName = $configuration->getOrm();
$confService = $configuration->getService($serviceName);
$ormService = \Alchemy\Phrasea\Core\Service\Builder::create(
$app['Core']
, $serviceName
, $confService
);
if ($ormService->getType() === 'doctrine')
{
/* @var $em \Doctrine\ORM\EntityManager */
$request = $app['request'];
$em = $ormService->getDriver();
$php_constraint = \setup::check_php_version();
$writability_constraints = \setup::check_writability(new \Setup_Registry());
$extension_constraints = \setup::check_php_extension();
$opcode_constraints = \setup::check_cache_opcode();
$php_conf_constraints = \setup::check_php_configuration();
$locales_constraints = \setup::check_system_locales();
$metadatas = $em->getMetadataFactory()->getAllMetadata();
if (!empty($metadatas))
{
// Create SchemaTool
$tool = new \Doctrine\ORM\Tools\SchemaTool($em);
// Create schema
$tool->dropSchema($metadatas);
$tool->createSchema($metadatas);
}
}
}
$registry = \registry::get_instance();
\setup::create_global_values($registry);
$appbox->set_registry($registry);
$registry->set('GV_base_datapath_noweb', \p4string::addEndSlash($request->get('datapath_noweb')), \registry::TYPE_STRING);
$registry->set('GV_base_datapath_web', \p4string::addEndSlash($request->get('datapath_web')), \registry::TYPE_STRING);
$registry->set('GV_base_dataurl', \p4string::addEndSlash($request->get('mount_point_web')), \registry::TYPE_STRING);
$registry->set('GV_ServerName', $servername, \registry::TYPE_STRING);
$registry->set('GV_cli', $request->get('binary_php'), \registry::TYPE_STRING);
$registry->set('GV_imagick', $request->get('binary_convert'), \registry::TYPE_STRING);
$registry->set('GV_pathcomposite', $request->get('binary_composite'), \registry::TYPE_STRING);
$registry->set('GV_exiftool', $request->get('binary_exiftool'), \registry::TYPE_STRING);
$registry->set('GV_swf_extract', $request->get('binary_swfextract'), \registry::TYPE_STRING);
$registry->set('GV_pdf2swf', $request->get('binary_pdf2swf'), \registry::TYPE_STRING);
$registry->set('GV_swf_render', $request->get('binary_swfrender'), \registry::TYPE_STRING);
$registry->set('GV_unoconv', $request->get('binary_unoconv'), \registry::TYPE_STRING);
$registry->set('GV_ffmpeg', $request->get('binary_ffmpeg'), \registry::TYPE_STRING);
$registry->set('GV_mp4box', $request->get('binary_MP4Box'), \registry::TYPE_STRING);
$registry->set('GV_mplayer', $request->get('binary_mplayer'), \registry::TYPE_STRING);
$registry->set('GV_pdftotext', $request->get('binary_xpdf'), \registry::TYPE_STRING);
$user = \User_Adapter::create($appbox, $request->get('email'), $request->get('password'), $request->get('email'), true);
if (!\p4string::hasAccent($databox_name))
{
if ($databox_name)
{
$template = new \system_file(__DIR__ . '/../../../../conf.d/data_templates/' . $request->get('db_template') . '.xml');
$databox = \databox::create($appbox, $connbas, $template, $registry);
$user->ACL()
->give_access_to_sbas(array($databox->get_sbas_id()))
->update_rights_to_sbas(
$databox->get_sbas_id(), array(
'bas_manage' => 1, 'bas_modify_struct' => 1,
'bas_modif_th' => 1, 'bas_chupub' => 1
)
$constraints_coll = array(
'php_constraint' => $php_constraint
, 'writability_constraints' => $writability_constraints
, 'extension_constraints' => $extension_constraints
, 'opcode_constraints' => $opcode_constraints
, 'php_conf_constraints' => $php_conf_constraints
, 'locales_constraints' => $locales_constraints
);
$redirect = true;
$a = \collection::create($databox, $appbox, 'test', $user);
$user->ACL()->give_access_to_base(array($a->get_base_id()));
$user->ACL()->update_rights_to_base($a->get_base_id(), array(
'canpush' => 1, 'cancmd' => 1
, 'canputinalbum' => 1, 'candwnldhd' => 1, 'candwnldpreview' => 1, 'canadmin' => 1
, 'actif' => 1, 'canreport' => 1, 'canaddrecord' => 1, 'canmodifrecord' => 1
, 'candeleterecord' => 1, 'chgstatus' => 1, 'imgtools' => 1, 'manage' => 1
, 'modify_struct' => 1, 'nowatermark' => 1
)
);
$tasks = $request->get('create_task', array());
foreach ($tasks as $task)
foreach ($constraints_coll as $key => $constraints)
{
switch ($task)
$unset = true;
foreach ($constraints as $constraint)
{
case 'cindexer';
case 'subdef';
case 'writemeta';
$class_name = sprintf('task_period_%s', $task);
if ($task === 'cindexer')
{
$credentials = $databox->get_connection()->get_credentials();
$host = $credentials['hostname'];
$port = $credentials['port'];
$user_ab = $credentials['user'];
$password = $credentials['password'];
$settings = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tasksettings>\n<binpath>"
. str_replace('/phraseanet_indexer', '', $request->get('binary_phraseanet_indexer'))
. "</binpath><host>" . $host . "</host><port>"
. $port . "</port><base>"
. $appbox_name . "</base><user>"
. $user_ab . "</user><password>"
. $password . "</password><socket>25200</socket>"
. "<use_sbas>1</use_sbas><nolog>0</nolog><clng></clng>"
. "<winsvc_run>0</winsvc_run><charset>utf8</charset></tasksettings>";
}
else
{
$settings = null;
}
\task_abstract::create($appbox, $class_name, $settings);
break;
default:
break;
if (!$constraint->is_ok() && $constraint->is_blocker())
$redirect = $unset = false;
}
if ($unset === true)
{
unset($constraints_coll[$key]);
}
}
}
}
\phrasea::start($app['Core']);
if ($redirect)
{
return $app->redirect('/setup/installer/step2/');
}
$auth = new \Session_Authentication_None($user);
$appbox->get_session()->authenticate($auth);
$ld_path = array(__DIR__ . '/../../../../../templates/web');
$loader = new \Twig_Loader_Filesystem($ld_path);
$twig = new \Twig_Environment($loader);
$redirection = '/admin/?section=taskmanager&notice=install_success';
$html = $twig->render(
'/setup/index.html.twig'
, array_merge($constraints_coll, array(
'locale' => \Session_Handler::get_locale()
, 'available_locales' => $app['Core']::getAvailableLanguages()
, 'version_number' => $app['Core']['Version']->getNumber()
, 'version_name' => $app['Core']['Version']->getName()
, 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/'
))
);
return $app->redirect($redirection);
}
catch (\Exception $e)
{
\setup::rollback($conn, $connbas);
}
return new Response($html);
});
return $app->redirect('/setup/installer/step2/?error=' . sprintf(_('an error occured : %s'), $e->getMessage()));
});
$controllers->get('/step2/', function() use ($app)
{
\phrasea::use_i18n(\Session_Handler::get_locale());
$ld_path = array(__DIR__ . '/../../../../../templates/web');
$loader = new \Twig_Loader_Filesystem($ld_path);
$twig = new \Twig_Environment($loader);
$twig->addExtension(new \Twig_Extensions_Extension_I18n());
$request = $app['request'];
$warnings = array();
$php_constraint = \setup::check_php_version();
$writability_constraints = \setup::check_writability(new \Setup_Registry());
$extension_constraints = \setup::check_php_extension();
$opcode_constraints = \setup::check_cache_opcode();
$php_conf_constraints = \setup::check_php_configuration();
$locales_constraints = \setup::check_system_locales();
$constraints_coll = array(
'php_constraint' => $php_constraint
, 'writability_constraints' => $writability_constraints
, 'extension_constraints' => $extension_constraints
, 'opcode_constraints' => $opcode_constraints
, 'php_conf_constraints' => $php_conf_constraints
, 'locales_constraints' => $locales_constraints
);
foreach ($constraints_coll as $key => $constraints)
{
$unset = true;
foreach ($constraints as $constraint)
{
if (!$constraint->is_ok() && !$constraint->is_blocker())
{
$warnings[] = $constraint->get_message();
}
}
}
if ($request->getScheme() == 'http')
{
$warnings[] = _('It is not recommended to install Phraseanet without HTTPS support');
}
$html = $twig->render(
'/setup/step2.html.twig'
, array(
'locale' => \Session_Handler::get_locale()
, 'available_locales' => $app['Core']::getAvailableLanguages()
, 'available_templates' => \appbox::list_databox_templates()
, 'version_number' => $app['Core']['Version']->getNumber()
, 'version_name' => $app['Core']['Version']->getName()
, 'warnings' => $warnings
, 'error' => $request->get('error')
, 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/'
, 'discovered_binaries' => \setup::discover_binaries()
, 'rootpath' => dirname(dirname(dirname(dirname(__DIR__)))) . '/'
)
);
return new Response($html);
});
$controllers->post('/install/', function() use ($app)
{
set_time_limit(360);
\phrasea::use_i18n(\Session_Handler::get_locale());
$request = $app['request'];
$servername = $request->getScheme() . '://' . $request->getHttpHost() . '/';
$setupRegistry = new \Setup_Registry();
$setupRegistry->set('GV_ServerName', $servername, \registry::TYPE_STRING);
$conn = $connbas = null;
$hostname = $request->get('ab_hostname');
$port = $request->get('ab_port');
$user_ab = $request->get('ab_user');
$password = $request->get('ab_password');
$appbox_name = $request->get('ab_name');
$databox_name = $request->get('db_name');
try
{
$conn = new \connection_pdo('appbox', $hostname, $port, $user_ab, $password, $appbox_name, array(), $setupRegistry);
}
catch (\Exception $e)
{
return $app->redirect('/setup/installer/step2/?error=' . _('Appbox is unreachable'));
}
try
{
if ($databox_name)
{
$connbas = new \connection_pdo('databox', $hostname, $port, $user_ab, $password, $databox_name, array(), $setupRegistry);
}
}
catch (\Exception $e)
{
return $app->redirect('/setup/installer/step2/?error=' . _('Databox is unreachable'));
}
\setup::rollback($conn, $connbas);
try
{
$setupRegistry = new \Setup_Registry();
$setupRegistry->set('GV_ServerName', $servername, \registry::TYPE_STRING);
$appbox = \appbox::create($app['Core'], $setupRegistry, $conn, $appbox_name, true);
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
if ($configuration->isInstalled())
{
$serviceName = $configuration->getOrm();
$confService = $configuration->getService($serviceName);
$ormService = \Alchemy\Phrasea\Core\Service\Builder::create(
$app['Core']
, $serviceName
, $confService
);
if ($ormService->getType() === 'doctrine')
{
/* @var $em \Doctrine\ORM\EntityManager */
$em = $ormService->getDriver();
$metadatas = $em->getMetadataFactory()->getAllMetadata();
if (!empty($metadatas))
{
// Create SchemaTool
$tool = new \Doctrine\ORM\Tools\SchemaTool($em);
// Create schema
$tool->dropSchema($metadatas);
$tool->createSchema($metadatas);
}
}
}
$registry = \registry::get_instance();
\setup::create_global_values($registry);
$appbox->set_registry($registry);
$registry->set('GV_base_datapath_noweb', \p4string::addEndSlash($request->get('datapath_noweb')), \registry::TYPE_STRING);
$registry->set('GV_base_datapath_web', \p4string::addEndSlash($request->get('datapath_web')), \registry::TYPE_STRING);
$registry->set('GV_base_dataurl', \p4string::addEndSlash($request->get('mount_point_web')), \registry::TYPE_STRING);
$registry->set('GV_ServerName', $servername, \registry::TYPE_STRING);
$registry->set('GV_cli', $request->get('binary_php'), \registry::TYPE_STRING);
$registry->set('GV_imagick', $request->get('binary_convert'), \registry::TYPE_STRING);
$registry->set('GV_pathcomposite', $request->get('binary_composite'), \registry::TYPE_STRING);
$registry->set('GV_exiftool', $request->get('binary_exiftool'), \registry::TYPE_STRING);
$registry->set('GV_swf_extract', $request->get('binary_swfextract'), \registry::TYPE_STRING);
$registry->set('GV_pdf2swf', $request->get('binary_pdf2swf'), \registry::TYPE_STRING);
$registry->set('GV_swf_render', $request->get('binary_swfrender'), \registry::TYPE_STRING);
$registry->set('GV_unoconv', $request->get('binary_unoconv'), \registry::TYPE_STRING);
$registry->set('GV_ffmpeg', $request->get('binary_ffmpeg'), \registry::TYPE_STRING);
$registry->set('GV_mp4box', $request->get('binary_MP4Box'), \registry::TYPE_STRING);
$registry->set('GV_mplayer', $request->get('binary_mplayer'), \registry::TYPE_STRING);
$registry->set('GV_pdftotext', $request->get('binary_xpdf'), \registry::TYPE_STRING);
$user = \User_Adapter::create($appbox, $request->get('email'), $request->get('password'), $request->get('email'), true);
if (!\p4string::hasAccent($databox_name))
{
if ($databox_name)
{
$template = new \system_file(__DIR__ . '/../../../../conf.d/data_templates/' . $request->get('db_template') . '.xml');
$databox = \databox::create($appbox, $connbas, $template, $registry);
$user->ACL()
->give_access_to_sbas(array($databox->get_sbas_id()))
->update_rights_to_sbas(
$databox->get_sbas_id(), array(
'bas_manage' => 1, 'bas_modify_struct' => 1,
'bas_modif_th' => 1, 'bas_chupub' => 1
)
);
$a = \collection::create($databox, $appbox, 'test', $user);
$user->ACL()->give_access_to_base(array($a->get_base_id()));
$user->ACL()->update_rights_to_base($a->get_base_id(), array(
'canpush' => 1, 'cancmd' => 1
, 'canputinalbum' => 1, 'candwnldhd' => 1, 'candwnldpreview' => 1, 'canadmin' => 1
, 'actif' => 1, 'canreport' => 1, 'canaddrecord' => 1, 'canmodifrecord' => 1
, 'candeleterecord' => 1, 'chgstatus' => 1, 'imgtools' => 1, 'manage' => 1
, 'modify_struct' => 1, 'nowatermark' => 1
)
);
$tasks = $request->get('create_task', array());
foreach ($tasks as $task)
{
switch ($task)
{
case 'cindexer';
case 'subdef';
case 'writemeta';
$class_name = sprintf('task_period_%s', $task);
if ($task === 'cindexer')
{
$credentials = $databox->get_connection()->get_credentials();
$host = $credentials['hostname'];
$port = $credentials['port'];
$user_ab = $credentials['user'];
$password = $credentials['password'];
$settings = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tasksettings>\n<binpath>"
. str_replace('/phraseanet_indexer', '', $request->get('binary_phraseanet_indexer'))
. "</binpath><host>" . $host . "</host><port>"
. $port . "</port><base>"
. $appbox_name . "</base><user>"
. $user_ab . "</user><password>"
. $password . "</password><socket>25200</socket>"
. "<use_sbas>1</use_sbas><nolog>0</nolog><clng></clng>"
. "<winsvc_run>0</winsvc_run><charset>utf8</charset></tasksettings>";
}
else
{
$settings = null;
}
\task_abstract::create($appbox, $class_name, $settings);
break;
default:
break;
}
}
}
}
\phrasea::start($app['Core']);
$auth = new \Session_Authentication_None($user);
$appbox->get_session()->authenticate($auth);
$redirection = '/admin/?section=taskmanager&notice=install_success';
return $app->redirect($redirection);
}
catch (\Exception $e)
{
\setup::rollback($conn, $connbas);
}
return $app->redirect('/setup/installer/step2/?error=' . sprintf(_('an error occured : %s'), $e->getMessage()));
});
return $controllers;
}

View File

@@ -275,7 +275,12 @@ class Core extends \Pimple
$appbox = \appbox::get_instance($this);
$session = \Session_Handler::getInstance($appbox);
return \User_Adapter::getInstance($session->get_usr_id(), $appbox);
if($session->get_usr_id())
{
return \User_Adapter::getInstance($session->get_usr_id(), $appbox);
}
return null;
}
/**

View File

@@ -49,6 +49,7 @@ class Configuration
{
$specifications = new Configuration\ApplicationSpecification();
}
return new self($specifications, $environment);
}
@@ -83,15 +84,6 @@ class Configuration
$cacheService = "array_cache";
if (extension_loaded('apc'))
{
$cacheService = "apc_cache";
}
elseif (extension_loaded('xcache'))
{
$cacheService = "xcache_cache";
}
$retrieve_old_credentials = function(\SplFileObject $connexionInc)
{
require $connexionInc->getPathname();

View File

@@ -31,21 +31,21 @@ class ApplicationSpecification implements Specification
public function setConfigurations($configurations)
{
return file_put_contents(
$this->getConfigurationsPathFile(), $this->parser->dump($configurations, 5)
$this->getConfigurationsPathFile(), $this->parser->dump($configurations, 7)
);
}
public function setConnexions($connexions)
{
return file_put_contents(
$this->getConnexionsPathFile(), $this->parser->dump($connexions, 5)
$this->getConnexionsPathFile(), $this->parser->dump($connexions, 7)
);
}
public function setServices($services)
{
return file_put_contents(
$this->getServicesPathFile(), $this->parser->dump($services, 5)
$this->getServicesPathFile(), $this->parser->dump($services, 7)
);
}
@@ -134,12 +134,14 @@ class ApplicationSpecification implements Specification
$this->getConfigurationsFile();
$this->getConnexionsFile();
$this->getServicesFile();
return true;
}
catch (\Exception $e)
{
}
return false;
}

View File

@@ -67,16 +67,15 @@ class MemcacheCache extends ServiceAbstract implements ServiceInterface
if (isset($stats[$key]))
{
$service = new CacheDriver\MemcacheCache();
$service->setMemcache($memcache);
$this->cache = new CacheDriver\MemcacheCache();
$this->cache->setMemcache($memcache);
$this->cache->setNamespace(md5(realpath(__DIR__.'/../../../../../../')));
}
else
{
throw new \Exception(sprintf("Memcache instance with host '%s' and port '%s' is not reachable", $this->host, $this->port));
}
$this->cache = $service;
$this->cache->setNamespace(md5(realpath(__DIR__.'/../../../../../../')));
}
return $this->cache;

View File

@@ -71,16 +71,15 @@ class RedisCache extends ServiceAbstract implements ServiceInterface
if ($redis->connect($this->host, $this->port))
{
$service = new CacheDriver\RedisCache();
$service->setRedis($redis);
$this->cache = new CacheDriver\RedisCache();
$this->cache->setRedis($redis);
$this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../')));
}
else
{
throw new \Exception(sprintf("Redis instance with host '%s' and port '%s' is not reachable", $this->host, $this->port));
}
$this->cache = $service;
$this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../')));
}
return $this->cache;

View File

@@ -42,9 +42,9 @@ class XcacheCache extends ServiceAbstract implements ServiceInterface
if (!$this->cache)
{
$service = new CacheDriver\XcacheCache();
$this->cache = new CacheDriver\XcacheCache();
$service->setNamespace(md5(realpath(__DIR__ . '/../../../../../../')));
$this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../')));
}
return $this->cache;

View File

@@ -19,4 +19,4 @@ namespace Alchemy\Phrasea\Core\Service\Exception;
class ServiceNotFound extends \Exception
{
}
}

View File

@@ -36,7 +36,7 @@ class FirePHP extends ServiceAbstract implements ServiceInterface
$this->logger = new Logger('FirePHP');
$this->logger->pushHandler(new FirePHPHandler());
return $this;
}
@@ -60,4 +60,4 @@ class FirePHP extends ServiceAbstract implements ServiceInterface
return array();
}
}
}

View File

@@ -66,7 +66,7 @@ class Monolog extends ServiceAbstract implements ServiceInterface
, $handler
, $this->name
, $this->getScope()
, implode(", ", $this->handler)
, implode(", ", $this->handlers)
)
);
}

View File

@@ -20,7 +20,7 @@ namespace Alchemy\Phrasea\Core;
class Version
{
protected static $number = '3.6.0.0a2';
protected static $number = '3.6.0.0RC1';
protected static $name = 'Brachiosaure';
public static function getNumber()

View File

@@ -32,10 +32,13 @@ class Prod extends Helper
);
$bases = $fields = $dates = array();
$appbox = \appbox::get_instance($this->core);
$session = $appbox->get_session();
$user = $this->getCore()->getAuthenticatedUser();
if(!$user instanceof \User_Adapter)
{
return $search_datas;
}
$searchSet = $user->getPrefs('search');
foreach ($user->ACL()->get_granted_sbas() as $databox)

View File

@@ -422,27 +422,6 @@ class Edit extends RecordHelper
{
$i = count($this->javascript_fields);
switch ($meta->get_type())
{
case 'datetime':
$format = _('phraseanet::technique::datetime-edit-format');
$explain = _('phraseanet::technique::datetime-edit-explain');
break;
case 'date':
$format = _('phraseanet::technique::date-edit-format');
$explain = _('phraseanet::technique::date-edit-explain');
break;
case 'time':
$format = _('phraseanet::technique::time-edit-format');
$explain = _('phraseanet::technique::time-edit-explain');
break;
default:
$format = $explain = "";
break;
}
$regfield = ($meta->is_regname() || $meta->is_regdesc() || $meta->is_regdate());
$source = $meta->get_source();
$separator = $meta->get_separator();
@@ -455,12 +434,11 @@ class Edit extends RecordHelper
, 'required' => $meta->is_required()
, 'readonly' => $meta->is_readonly()
, 'type' => $meta->get_type()
, 'format' => $format
, 'explain' => $explain
, 'format' => ''
, 'explain' => ''
, 'tbranch' => $meta->get_tbranch()
, 'maxLength' => $source ? $source->maxlength() : 0
, 'minLength' => $source ? $source->minLength() : 0
, 'regfield' => $regfield
, 'multi' => $meta->is_multi()
, 'separator' => $separator
, 'vocabularyControl' => $meta->getVocabularyControl() ? $meta->getVocabularyControl()->getType() : null
@@ -615,55 +593,6 @@ class Edit extends RecordHelper
}
return $this;
// foreach ($trecchanges as $fname => $fchange)
// {
// $bool = false;
// if ($regfields && $parm['act_option'] == 'SAVEGRP'
// && $fname == $regfields['regname'])
// {
// try
// {
// $basket = basket_adapter::getInstance($parm['ssel']);
// $basket->name = implode(' ', $fchange['values']);
// $basket->save();
// $bool = true;
// }
// catch (Exception $e)
// {
// echo $e->getMessage();
// }
// }
// if ($regfields && $parm['act_option'] == 'SAVEGRP'
// && $fname == $regfields['regdesc'])
// {
// try
// {
// $basket = basket_adapter::getInstance($parm['ssel']);
// $basket->desc = implode(' ', $fchange['values']);
// $basket->save();
// $bool = true;
// }
// catch (Exception $e)
// {
// echo $e->getMessage();
// }
// }
// if ($bool)
// {
// try
// {
// $basket = basket_adapter::getInstance($parm['ssel']);
// $basket->delete_cache();
// }
// catch (Exception $e)
// {
//
// }
// }
// }
//
// return $this;
}
}

View File

@@ -131,10 +131,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
sum(remain_dwnld) as remain_dwnld,
sum(month_dwnld_max) as month_dwnld_max,
mask_xor as maskxordec,
bin(mask_xor) as maskxorbin,
mask_and as maskanddec,
bin(mask_and) as maskandbin
sum(mask_and + mask_xor) as masks
FROM (usr u, bas b, sbas s)
LEFT JOIN (basusr bu)
@@ -206,8 +203,6 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
{
$this->base_id = (int) $this->request->get('base_id');
// $this->base_id = (int) $parm['base_id'];
$sql = "SELECT u.usr_id, restrict_dwnld, remain_dwnld, month_dwnld_max
FROM (usr u INNER JOIN basusr bu ON u.usr_id = bu.usr_id)
WHERE u.usr_id = " . implode(' OR u.usr_id = ', $this->users) . "

View File

@@ -184,8 +184,10 @@ class PDF
$fimg = $subdef->get_pathfile();
if (!$user->ACL()->has_right_on_base($rec->get_base_id(), "nowatermark")
&& $subdef->get_type() == media_subdef::TYPE_IMAGE)
$fimg = recordutils_image::watermark($rec->get_base_id(), $rec->get_record_id());
&& $subdef->get_type() == \media_subdef::TYPE_IMAGE)
{
$fimg = \recordutils_image::watermark($rec->get_base_id(), $rec->get_record_id());
}
$wimg = $himg = $ImgSize;
if ($subdef->get_height() > 0 && $subdef->get_width() > 0)
@@ -479,8 +481,8 @@ class PDF
$f = $subdef->get_pathfile();
if (!$user->ACL()->has_right_on_base($rec->get_base_id(), "nowatermark")
&& $subdef->get_type() == media_subdef::TYPE_IMAGE)
$f = recordutils_image::watermark($rec->get_base_id(), $rec->get_record_id());
&& $subdef->get_type() == \media_subdef::TYPE_IMAGE)
$f = \recordutils_image::watermark($rec->get_base_id(), $rec->get_record_id());
$wimg = $himg = 150; // preview dans un carre de 150 mm
if ($subdef->get_width() > 0 && $subdef->get_height() > 0)

View File

@@ -121,7 +121,7 @@ class UserProvider implements ControlProviderInterface
public function getRessource($id)
{
$Core = \bootstrap::getCore();
return \User_Adapter::getInstance($id, \appbox::get_instance($Core));
}