mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Merge branch 'templates' into 3.6
This commit is contained in:
@@ -408,9 +408,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
|
||||
$test_user = User_Adapter::get_usr_id_from_email($email);
|
||||
|
||||
if($test_user && $test_user != $this->get_id())
|
||||
if ($test_user && $test_user != $this->get_id())
|
||||
{
|
||||
throw new Exception_InvalidArgument (sprintf(_('A user already exists with email addres %s'), $email));
|
||||
throw new Exception_InvalidArgument(sprintf(_('A user already exists with email addres %s'), $email));
|
||||
}
|
||||
|
||||
$sql = 'UPDATE usr SET usr_mail = :new_email WHERE usr_id = :usr_id';
|
||||
@@ -593,7 +593,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
*
|
||||
* @param boolean $boolean
|
||||
* @return User_Adapter
|
||||
@@ -906,7 +906,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
|
||||
public static function get_usr_id_from_email($email)
|
||||
{
|
||||
if(is_null($email))
|
||||
if (is_null($email))
|
||||
return false;
|
||||
|
||||
$conn = connection::getPDOConnection();
|
||||
@@ -1117,8 +1117,14 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
public function set_last_template(User_Interface $template)
|
||||
{
|
||||
$sql = 'UPDATE usr SET lastModel = :template_id WHERE usr_id = :usr_id';
|
||||
|
||||
$params = array(
|
||||
':usr_id' => $this->get_id()
|
||||
, ':template_id' => $template->get_login()
|
||||
);
|
||||
|
||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':usr_id' => $this->get_id(), ':template_id' => $template->get_id()));
|
||||
$stmt->execute($params);
|
||||
$stmt->closeCursor();
|
||||
$this->delete_data_from_cache();
|
||||
|
||||
@@ -1249,18 +1255,8 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
|
||||
public function get_applied_template()
|
||||
{
|
||||
$template = '';
|
||||
if ($this->applied_template)
|
||||
{
|
||||
$sql = 'SELECT usr_login FROM usr WHERE usr_login = :login';
|
||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':login' => $this->applied_template));
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$template = $row['usr_login'];
|
||||
}
|
||||
|
||||
return $template;
|
||||
return $this->applied_template;
|
||||
}
|
||||
|
||||
public function get_creation_date()
|
||||
@@ -1281,7 +1277,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
protected function load_preferences()
|
||||
{
|
||||
if ($this->_prefs)
|
||||
|
||||
return $this;
|
||||
$sql = 'SELECT prop, value FROM usr_settings WHERE usr_id= :id';
|
||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||
@@ -1382,26 +1377,26 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function get_cache_key($option=null)
|
||||
public function get_cache_key($option = null)
|
||||
{
|
||||
return '_user_' . $this->get_id() . ($option ? '_' . $option : '');
|
||||
}
|
||||
|
||||
public function delete_data_from_cache($option=null)
|
||||
public function delete_data_from_cache($option = null)
|
||||
{
|
||||
$this->appbox->delete_data_from_cache($this->get_cache_key($option));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function get_data_from_cache($option=null)
|
||||
public function get_data_from_cache($option = null)
|
||||
{
|
||||
$this->appbox->get_data_from_cache($this->get_cache_key($option));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function set_data_to_cache($value, $option=null, $duration = 0)
|
||||
public function set_data_to_cache($value, $option = null, $duration = 0)
|
||||
{
|
||||
$this->appbox->set_data_to_cache($value, $this->get_cache_key($option), $duration);
|
||||
|
||||
@@ -1519,7 +1514,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
$appbox = appbox::get_instance();
|
||||
$session = $appbox->get_session();
|
||||
if (!$session->is_authenticated())
|
||||
|
||||
return;
|
||||
|
||||
$ses_id = $session->get_ses_id();
|
||||
@@ -1794,7 +1788,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
public function get_nonce()
|
||||
{
|
||||
if ($this->nonce)
|
||||
|
||||
return $this->nonce;
|
||||
$nonce = false;
|
||||
|
||||
@@ -1812,7 +1805,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
return $this->nonce;
|
||||
}
|
||||
|
||||
|
||||
public function __sleep()
|
||||
{
|
||||
$vars = array();
|
||||
|
@@ -151,10 +151,14 @@
|
||||
{% for usr in users.get_results %}
|
||||
<tr class="{% if loop.index is odd %}odd{% else %}even{% endif %}" id="user_{{usr.get_id()}}">
|
||||
<td style="text-align: center;">
|
||||
{% if usr.ACL().is_phantom() %}
|
||||
<img src="/skins/admin/ghost.png"/>
|
||||
{% if usr.is_template() %}
|
||||
<img title="{% trans 'This is a template' %}" src="/skins/icons/template.png"/>
|
||||
{% else %}
|
||||
{% if usr.ACL().is_phantom() %}
|
||||
<img title="{% trans 'This user has no rights' %}" src="/skins/admin/ghost.png"/>
|
||||
{% endif %}
|
||||
{{usr.get_id()}}
|
||||
{% endif %}
|
||||
{{usr.get_id()}}
|
||||
</td>
|
||||
<td>
|
||||
{{usr.get_login()}}
|
||||
|
BIN
www/skins/icons/template.png
Normal file
BIN
www/skins/icons/template.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
Reference in New Issue
Block a user