mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Fix neutron's comment
This commit is contained in:
@@ -406,7 +406,7 @@ class collection implements cache_cacheableInterface
|
||||
$stmt->execute([':base_id' => $this->get_base_id()]);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$this->app['registration-manager']->getRepository()->deleteDemandsOnCollection($this->get_base_id());
|
||||
$this->app['registration-manager']->deleteRegistrationsOnCollection($this->get_base_id());
|
||||
|
||||
$this->get_databox()->delete_data_from_cache(databox::CACHE_COLLECTIONS);
|
||||
|
||||
@@ -534,7 +534,7 @@ class collection implements cache_cacheableInterface
|
||||
$stmt->execute($params);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$this->app['registration-manager']->getRepository()->deleteDemandsOnCollection($this->get_base_id());
|
||||
$this->app['registration-manager']->deleteRegistrationsOnCollection($this->get_base_id());
|
||||
|
||||
phrasea::reset_baseDatas($app['phraseanet.appbox']);
|
||||
|
||||
@@ -740,4 +740,46 @@ class collection implements cache_cacheableInterface
|
||||
{
|
||||
self::$_collections = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether registration is activated for provided collection or not.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isRegistrationEnabled()
|
||||
{
|
||||
if ($xml = simplexml_load_string($this->get_prefs())) {
|
||||
$element = $xml->xpath('/baseprefs/caninscript');
|
||||
|
||||
if (count($element) === 0) {
|
||||
return $this->databox->isRegistrationEnabled();
|
||||
}
|
||||
|
||||
foreach ($element as $caninscript) {
|
||||
if (false !== (Boolean) (string) $caninscript) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets terms of use.
|
||||
*
|
||||
* @param \collection $collection
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getTermsOfUse()
|
||||
{
|
||||
if ($xml = simplexml_load_string($this->get_prefs())) {
|
||||
foreach ($xml->xpath('/baseprefs/cgu') as $sbpcgu) {
|
||||
return $sbpcgu->saveXML();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -1482,4 +1482,22 @@ class databox extends base
|
||||
{
|
||||
self::$_xpath_thesaurus = self::$_dom_thesaurus = self::$_thesaurus = self::$_sxml_thesaurus = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether the registration is enable for provided databox or not.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isRegistrationEnabled()
|
||||
{
|
||||
if (false !== $xml = $this->get_sxml_structure()) {
|
||||
foreach ($xml->xpath('/record/caninscript') as $canRegister) {
|
||||
if (false !== (Boolean) (string) $canRegister) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user