Merge with master

This commit is contained in:
Romain Neutron
2012-01-06 17:42:11 +01:00
14 changed files with 91 additions and 77 deletions

View File

@@ -872,11 +872,15 @@ class ACL implements cache_cacheableInterface
if ($row['order_master'] == '1') if ($row['order_master'] == '1')
$this->_global_rights['order_master'] = true; $this->_global_rights['order_master'] = true;
if ($row['time_limited'] == '1') $row['limited_from'] = $row['limited_from'] == '0000-00-00 00:00:00' ? '' : trim($row['limited_from']);
$row['limited_to'] = $row['limited_to'] == '0000-00-00 00:00:00' ? '' : trim($row['limited_to']);
if ($row['time_limited'] == '1'
&& ($row['limited_from'] !== '' || $row['limited_to'] !== ''))
{ {
$this->_limited[$row['base_id']] = array( $this->_limited[$row['base_id']] = array(
'dmin' => new DateTime($row['limited_from']) 'dmin' => $row['limited_from'] ? new DateTime($row['limited_from']) : null
, 'dmax' => new DateTime($row['limited_to']) , 'dmax' => $row['limited_to'] ? new DateTime($row['limited_to']) : null
); );
} }
@@ -1444,11 +1448,12 @@ class ACL implements cache_cacheableInterface
{ {
return false; return false;
} }
$lim_min = $this->_limited[$base_id]['dmin'] && $this->_limited[$base_id]['dmin'] > $datetime;
$ret = ($this->_limited[$base_id]['dmin'] > $datetime $lim_max = $this->_limited[$base_id]['dmax'] && $this->_limited[$base_id]['dmax'] < $datetime;
|| $this->_limited[$base_id]['dmax'] < $datetime);
return $ret; return $lim_max || $lim_min;
} }
public function get_limits($base_id) public function get_limits($base_id)

View File

@@ -23,96 +23,115 @@ class User_Query implements User_QueryInterface
* @var appbox * @var appbox
*/ */
protected $appbox; protected $appbox;
/** /**
* *
* @var Array * @var Array
*/ */
protected $results = array(); protected $results = array();
/** /**
* *
* @var Array * @var Array
*/ */
protected $sort = array(); protected $sort = array();
/** /**
* *
* @var Array * @var Array
*/ */
protected $like_field = array(); protected $like_field = array();
/** /**
* *
* @var Array * @var Array
*/ */
protected $have_rights; protected $have_rights;
/** /**
* *
* @var Array * @var Array
*/ */
protected $have_not_rights; protected $have_not_rights;
/** /**
* *
* @var string * @var string
*/ */
protected $like_match = 'OR'; protected $like_match = 'OR';
/** /**
* *
* @var string * @var string
*/ */
protected $get_inactives = ''; protected $get_inactives = '';
/** /**
* *
* @var int * @var int
*/ */
protected $total = 0; protected $total = 0;
/** /**
* *
* @var Array * @var Array
*/ */
protected $active_bases = array(); protected $active_bases = array();
/** /**
* *
* @var Array * @var Array
*/ */
protected $active_sbas = array(); protected $active_sbas = array();
/** /**
* *
* @var boolean * @var boolean
*/ */
protected $bases_restrictions = false; protected $bases_restrictions = false;
/** /**
* *
* @var boolean * @var boolean
*/ */
protected $sbas_restrictions = false; protected $sbas_restrictions = false;
/** /**
* *
* @var boolean * @var boolean
*/ */
protected $include_templates = false; protected $include_templates = false;
/** /**
* *
* @var boolean * @var boolean
*/ */
protected $only_templates = false; protected $only_templates = false;
/** /**
* *
* @var Array * @var Array
*/ */
protected $base_ids = array(); protected $base_ids = array();
/** /**
* *
* @var Array * @var Array
*/ */
protected $sbas_ids = array(); protected $sbas_ids = array();
/** /**
* *
* @var int * @var int
*/ */
protected $page; protected $page;
/** /**
* *
* @var int * @var int
*/ */
protected $offset_start; protected $offset_start;
/** /**
* *
* @var int * @var int
@@ -124,9 +143,8 @@ class User_Query implements User_QueryInterface
const ORD_ASC = 'asc'; const ORD_ASC = 'asc';
const ORD_DESC = 'desc'; const ORD_DESC = 'desc';
const SORT_FIRSTNAME = 'usr_prenom';
const SORT_FIRSTNAME= 'usr_prenom'; const SORT_LASTNAME = 'usr_nom';
const SORT_LASTNAME= 'usr_nom';
const SORT_COMPANY = 'societe'; const SORT_COMPANY = 'societe';
const SORT_LOGIN = 'usr_login'; const SORT_LOGIN = 'usr_login';
const SORT_EMAIL = 'usr_mail'; const SORT_EMAIL = 'usr_mail';
@@ -134,15 +152,13 @@ class User_Query implements User_QueryInterface
const SORT_CREATIONDATE = 'usr_creationdate'; const SORT_CREATIONDATE = 'usr_creationdate';
const SORT_COUNTRY = 'pays'; const SORT_COUNTRY = 'pays';
const SORT_LASTMODEL = 'lastModel'; const SORT_LASTMODEL = 'lastModel';
const LIKE_FIRSTNAME = 'usr_prenom';
const LIKE_FIRSTNAME= 'usr_prenom'; const LIKE_LASTNAME = 'usr_nom';
const LIKE_LASTNAME= 'usr_nom'; const LIKE_NAME = 'name';
const LIKE_NAME= 'name';
const LIKE_COMPANY = 'societe'; const LIKE_COMPANY = 'societe';
const LIKE_LOGIN = 'usr_login'; const LIKE_LOGIN = 'usr_login';
const LIKE_EMAIL = 'usr_mail'; const LIKE_EMAIL = 'usr_mail';
const LIKE_COUNTRY = 'pays'; const LIKE_COUNTRY = 'pays';
const LIKE_MATCH_AND = 'AND'; const LIKE_MATCH_AND = 'AND';
const LIKE_MATCH_OR = 'OR'; const LIKE_MATCH_OR = 'OR';
@@ -225,16 +241,13 @@ class User_Query implements User_QueryInterface
else else
{ {
$extra = $this->include_phantoms ? ' OR base_id IS NULL ' : ''; $extra = $this->include_phantoms ? ' OR base_id IS NULL ' : '';
if (count($this->active_bases) > count($this->base_ids))
$not_base_id = array_diff($this->active_bases, $this->base_ids);
if (count($not_base_id) > 0 && count($not_base_id) < count($this->base_ids))
{ {
$sql .= sprintf(' AND ((base_id != %s ) ' . $extra . ')' $sql .= sprintf(' AND ((base_id != %s ) ' . $extra . ')'
, implode( , implode(' AND base_id != ', $not_base_id)
' AND base_id != '
, array_diff(
$this->active_bases
, $this->base_ids
)
)
); );
} }
else else
@@ -246,7 +259,6 @@ class User_Query implements User_QueryInterface
} }
if (count($this->sbas_ids) == 0) if (count($this->sbas_ids) == 0)
{ {
if ($this->sbas_restrictions) if ($this->sbas_restrictions)
@@ -255,16 +267,13 @@ class User_Query implements User_QueryInterface
else else
{ {
$extra = $this->include_phantoms ? ' OR sbas_id IS NULL ' : ''; $extra = $this->include_phantoms ? ' OR sbas_id IS NULL ' : '';
if (count($this->active_sbas) > count($this->sbas_ids))
$not_sbas_id = array_diff($this->active_sbas, $this->sbas_ids);
if (count($not_sbas_id) > 0 && count($not_sbas_id) < count($this->sbas_ids))
{ {
$sql .= sprintf(' AND ((sbas_id != %s ) ' . $extra . ')' $sql .= sprintf(' AND ((sbas_id != %s ) ' . $extra . ')'
, implode( , implode(' AND sbas_id != ', $not_sbas_id)
' AND sbas_id != '
, array_diff(
$this->active_sbas
, $this->sbas_ids
)
)
); );
} }
else else
@@ -293,7 +302,7 @@ class User_Query implements User_QueryInterface
} }
$sql_like = array(); $sql_like = array();
foreach ($this->like_field as $like_field => $like_value) foreach ($this->like_field as $like_field => $like_value)
{ {
switch ($like_field) switch ($like_field)
@@ -366,6 +375,7 @@ class User_Query implements User_QueryInterface
return $this; return $this;
} }
/** /**
* *
* @param boolean $boolean * @param boolean $boolean
@@ -479,7 +489,6 @@ class User_Query implements User_QueryInterface
public function get_total() public function get_total()
{ {
if ($this->total) if ($this->total)
return $this->total; return $this->total;
$conn = $this->appbox->get_connection(); $conn = $this->appbox->get_connection();
@@ -581,8 +590,8 @@ class User_Query implements User_QueryInterface
*/ */
public function like($like_field, $like_value) public function like($like_field, $like_value)
{ {
if($like_field == self::LIKE_NAME) if ($like_field == self::LIKE_NAME)
{ {
$this->like_field[self::LIKE_FIRSTNAME] = trim($like_value); $this->like_field[self::LIKE_FIRSTNAME] = trim($like_value);
$this->like_field[self::LIKE_LASTNAME] = trim($like_value); $this->like_field[self::LIKE_LASTNAME] = trim($like_value);
@@ -591,7 +600,7 @@ class User_Query implements User_QueryInterface
{ {
$this->like_field[trim($like_field)] = trim($like_value); $this->like_field[trim($like_field)] = trim($like_value);
} }
$this->total = $this->page = null; $this->total = $this->page = null;
return $this; return $this;
@@ -628,11 +637,12 @@ class User_Query implements User_QueryInterface
public function on_base_ids(Array $base_ids = null) public function on_base_ids(Array $base_ids = null)
{ {
if (!$base_ids) if (!$base_ids)
return $this; return $this;
$this->bases_restrictions = true; $this->bases_restrictions = true;
$this->include_phantoms(false);
if (count($this->base_ids) > 0) if (count($this->base_ids) > 0)
$this->base_ids = array_intersect($this->base_ids, $base_ids); $this->base_ids = array_intersect($this->base_ids, $base_ids);
else else
@@ -651,11 +661,12 @@ class User_Query implements User_QueryInterface
public function on_sbas_ids(Array $sbas_ids = null) public function on_sbas_ids(Array $sbas_ids = null)
{ {
if (!$sbas_ids) if (!$sbas_ids)
return $this; return $this;
$this->sbas_restrictions = true; $this->sbas_restrictions = true;
$this->include_phantoms(false);
if (count($this->sbas_ids) > 0) if (count($this->sbas_ids) > 0)
$this->sbas_ids = array_intersect($this->sbas_ids, $sbas_ids); $this->sbas_ids = array_intersect($this->sbas_ids, $sbas_ids);
else else
@@ -664,23 +675,6 @@ class User_Query implements User_QueryInterface
$this->total = $this->page = null; $this->total = $this->page = null;
return $this; return $this;
// $base_ids = array();
// foreach ($sbas_ids as $sbas_id)
// {
// try
// {
// foreach ($this->appbox->get_databox($sbas_id)->get_collections() as $collection)
// $base_ids[] = $collection->get_base_id();
// if(count($base_ids) > 0)
// $this->bases_restrictions;
// }
// catch (Exception $e)
// {
//
// }
// }
//
// return $this->on_base_ids($base_ids);
} }
/** /**

View File

@@ -94,12 +94,16 @@ class databox_cgu
$terms = array(); $terms = array();
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
$session = $appbox->get_session(); $session = $appbox->get_session();
if(!$home)
{
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
}
foreach ($appbox->get_databoxes() as $databox) foreach ($appbox->get_databoxes() as $databox)
{ {
try try
{ {
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
$cgus = $databox->get_cgus(); $cgus = $databox->get_cgus();
if (!isset($cgus[Session_Handler::get_locale()])) if (!isset($cgus[Session_Handler::get_locale()]))
@@ -112,6 +116,10 @@ class databox_cgu
if (!$home) if (!$home)
{ {
if(!$user->ACL()->has_access_to_sbas($databox->get_sbas_id()));
{
continue;
}
$userValidation = ($user->getPrefs('terms_of_use_' . $databox->get_sbas_id()) !== $update && trim($value) !== ''); $userValidation = ($user->getPrefs('terms_of_use_' . $databox->get_sbas_id()) !== $update && trim($value) !== '');
} }

View File

@@ -93,6 +93,13 @@ class http_request
return true; return true;
return false; return false;
} }
public function is_secure()
{
return (
isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on' || $_SERVER['HTTPS'] == 1)
);
}
public function comes_from_flash() public function comes_from_flash()
{ {

View File

@@ -1747,14 +1747,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
echo $e->getMessage() . "\n"; echo $e->getMessage() . "\n";
} }
if (!array_key_exists($subdefname, $record_subdefs)) if (array_key_exists($subdefname, $record_subdefs))
{ {
continue; $record_subdefs[$subdefname]->delete_data_from_cache();
} }
$record_subdefs[$subdefname]->delete_data_from_cache();
$this->delete_data_from_cache(self::CACHE_SUBDEFS);
try try
{ {
$subdef = $this->get_subdef($subdefname); $subdef = $this->get_subdef($subdefname);

View File

@@ -353,7 +353,7 @@ class searchEngine_options implements Serializable
{ {
if (!is_null($min_date) && trim($min_date) !== '') if (!is_null($min_date) && trim($min_date) !== '')
{ {
$this->date_min = new DateTime($min_date); $this->date_min = DateTime::createFromFormat('d/m/Y h:i:s', $min_date.' 00:00:00');
} }
return $this; return $this;
@@ -377,7 +377,7 @@ class searchEngine_options implements Serializable
{ {
if (!is_null($max_date) && trim($max_date) !== '') if (!is_null($max_date) && trim($max_date) !== '')
{ {
$this->date_max = new DateTime($max_date); $this->date_max = DateTime::createFromFormat('d/m/Y h:i:s', $max_date.' 23:59:59');
} }
return $this; return $this;

View File

@@ -66,7 +66,7 @@
<p>Phraseanet Version {{core.getVersion().getName()}} - {{core.getVersion().getNumber()}}</p> <p>Phraseanet Version {{core.getVersion().getName()}} - {{core.getVersion().getNumber()}}</p>
<p> <p>
<a href='http://www.gnu.org/licenses/gpl.html' target='_blank'> <a href='http://www.gnu.org/licenses/gpl.html' target='_blank'>
<img src='http://www.gnu.org/graphics/gplv3-88x31.png' style='vertical-align:middle;'/> <img src='http{{ request.is_secure() ? 's' : '' }}://www.gnu.org/graphics/gplv3-88x31.png' style='vertical-align:middle;'/>
</a> </a>
</p> </p>
<p>License <a href="http://www.gnu.org/licenses/gpl.html" target="_blank">GNU GPL v3</a></p> <p>License <a href="http://www.gnu.org/licenses/gpl.html" target="_blank">GNU GPL v3</a></p>

View File

@@ -26,7 +26,7 @@
dmax : '{{ dashboard_array.dmax_req }}' dmax : '{{ dashboard_array.dmax_req }}'
}; };
</script> </script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript" src="http{{ request.is_secure() ? 's' : '' }}://www.google.com/jsapi"></script>
<script type="text/javascript" src="/include/jslibs/jquery-1.5.2.js"></script> <script type="text/javascript" src="/include/jslibs/jquery-1.5.2.js"></script>
<script type="text/javascript" src="/include/jslibs/jquery-ui-1.8.12/js/jquery-ui-1.8.12.custom.min.js"></script> <script type="text/javascript" src="/include/jslibs/jquery-ui-1.8.12/js/jquery-ui-1.8.12.custom.min.js"></script>
<script type="text/javascript" src="/include/minify/g=reportmobile"></script> <script type="text/javascript" src="/include/minify/g=reportmobile"></script>

View File

@@ -220,8 +220,12 @@
<input name="srt" value="{{parm['srt']}}" type="hidden" /> <input name="srt" value="{{parm['srt']}}" type="hidden" />
<input name="ord" value="{{parm.ord}}" type="hidden" /> <input name="ord" value="{{parm.ord}}" type="hidden" />
<input name="act" value="{{parm.act}}" type="hidden" /> <input name="act" value="{{parm.act}}" type="hidden" />
<input name="sbas_id" value="{{parm.sbas_id}}" type="hidden" /> {% for sbas_id in parm.sbas_id %}
<input name="base_id" value="{{parm.base_id}}" type="hidden" /> <input name="sbas_id[]" value="{{sbas_id}}" type="hidden" />
{% endfor %}
{% for base_id in parm.base_id %}
<input name="base_id[]" value="{{base_id}}" type="hidden" />
{% endfor %}
<input name="usr_ids" value="{{parm.usr_ids}}" type="hidden" /> <input name="usr_ids" value="{{parm.usr_ids}}" type="hidden" />
<input name="like_value" value="{{parm.like_value}}" type="hidden" /> <input name="like_value" value="{{parm.like_value}}" type="hidden" />
<input name="like_field" value="{{parm.like_field}}" type="hidden" /> <input name="like_field" value="{{parm.like_field}}" type="hidden" />

View File

@@ -46,8 +46,8 @@
{% endif %} {% endif %}
{% if display_chrome_frame and session.get_cookie('gfc_box') == false %} {% if display_chrome_frame and session.get_cookie('gfc_box') == false %}
<!--[if IE]> <!--[if IE]>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js"></script> <script type="text/javascript" src="http{{ request.is_secure() ? 's' : '' }}://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js"></script>
<link href="http://www.google.com/css/modules/buttons/g-button.css" type="text/css" rel="stylesheet"> <link href="http{{ request.is_secure() ? 's' : '' }}://www.google.com/css/modules/buttons/g-button.css" type="text/css" rel="stylesheet">
<style type="text/css"> <style type="text/css">
#gfc_prompt{ #gfc_prompt{
width: 950px; width: 950px;
@@ -59,7 +59,7 @@
<div> <div>
<span> <span>
<span> <span>
<a target="_blank" href="http://www.google.com/chromeframe/eula.html">Get Google Chrome Frame (Beta)</a> <a target="_blank" href="http{{ request.is_secure() ? 's' : '' }}://www.google.com/chromeframe/eula.html">Get Google Chrome Frame (Beta)</a>
</span> </span>
</span> </span>
</div> </div>

View File

@@ -51,13 +51,13 @@
height="360"> height="360">
<param name="wmode" value="transparent"> <param name="wmode" value="transparent">
<param name="movie" <param name="movie"
value="http://apps.cooliris.com/embed/cooliris.swf" /> value="http{{ request.is_secure() ? 's' : '' }}://apps.cooliris.com/embed/cooliris.swf" />
<param name="allowFullScreen" value="true" /> <param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" /> <param name="allowScriptAccess" value="always" />
<param name="flashvars" <param name="flashvars"
value="feed=/feeds/cooliris/&glowColor=#0077BC&style=dark&backgroundColor=#000000&showChrome=false&showEMbed=false&showSearch=false" /> value="feed=/feeds/cooliris/&glowColor=#0077BC&style=dark&backgroundColor=#000000&showChrome=false&showEMbed=false&showSearch=false" />
<embed wmode="transparent" type="application/x-shockwave-flash" <embed wmode="transparent" type="application/x-shockwave-flash"
src="http://apps.cooliris.com/embed/cooliris.swf" src="http{{ request.is_secure() ? 's' : '' }}://apps.cooliris.com/embed/cooliris.swf"
flashvars="feed=/feeds/cooliris/&glowColor=#0077BC&style=dark&backgroundColor=#000000&showChrome=false&showEMbed=false&showSearch=false" flashvars="feed=/feeds/cooliris/&glowColor=#0077BC&style=dark&backgroundColor=#000000&showChrome=false&showEMbed=false&showSearch=false"
width="930" width="930"
height="360" height="360"

View File

@@ -1238,7 +1238,7 @@ function setCss(color)
{% if GV_bitly_user is not empty and GV_bitly_key is not empty %} {% if GV_bitly_user is not empty and GV_bitly_key is not empty %}
$(document).ready(function(){ $(document).ready(function(){
$("#bitly_loader").attr("src","http://bit.ly/javascript-api.js?version=latest&login={{GV_bitly_user}}&apiKey={{GV_bitly_key}}"); $("#bitly_loader").attr("src","http{{ request.is_secure() ? 's' : '' }}://bit.ly/javascript-api.js?version=latest&login={{GV_bitly_user}}&apiKey={{GV_bitly_key}}");
}); });
{% endif %} {% endif %}
</script> </script>

View File

@@ -1,5 +1,5 @@
{% block ajax_data_content %} {% block ajax_data_content %}
<script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript" src="http{{ request.is_secure() ? 's' : '' }}://www.google.com/jsapi"></script>
<script type="text/javascript"> <script type="text/javascript">
$("input[type=button]").button(); $("input[type=button]").button();

View File

@@ -10,7 +10,6 @@
{% endblock icon%} {% endblock icon%}
{% block javascript %} {% block javascript %}
{#<script type="text/javascript" src="http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js"></script>#}
<script type="text/javascript" > <script type="text/javascript" >
var usrId = '{{ dashboard.usr.get_id() }}' ; var usrId = '{{ dashboard.usr.get_id() }}' ;
@@ -38,7 +37,7 @@
} }
</script> </script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript" src="http{{ request.is_secure() ? 's' : '' }}://www.google.com/jsapi"></script>
<script type="text/javascript" src="/include/jslibs/jquery-1.5.2.js"></script> <script type="text/javascript" src="/include/jslibs/jquery-1.5.2.js"></script>
<script type="text/javascript" src="/include/jslibs/jquery-ui-1.8.12/js/jquery-ui-1.8.12.custom.min.js"></script> <script type="text/javascript" src="/include/jslibs/jquery-ui-1.8.12/js/jquery-ui-1.8.12.custom.min.js"></script>
<script type="text/javascript" src="/include/minify/g=report"></script> <script type="text/javascript" src="/include/minify/g=report"></script>