Coding standards

This commit is contained in:
Romain Neutron
2012-02-02 15:43:12 +01:00
parent 879166bbe1
commit a9c7ed23cb
19 changed files with 67 additions and 56 deletions

View File

@@ -339,7 +339,7 @@ return call_user_func(function()
}
catch (Exception $e)
{
}
$Serializer = $app['Core']['Serializer'];
@@ -374,7 +374,7 @@ return call_user_func(function()
}
catch (Exception $e)
{
}
$Serializer = $app['Core']['Serializer'];
@@ -400,7 +400,7 @@ return call_user_func(function()
}
catch (Exception $e)
{
}
$Serializer = $app['Core']['Serializer'];
@@ -424,7 +424,7 @@ return call_user_func(function()
}
catch (\Exception $e)
{
}
$Serializer = $app['Core']['Serializer'];

View File

@@ -92,7 +92,7 @@ class Language implements ControllerProviderInterface
$out['FeedBackName'] = _('Name');
$out['FeedBackMessage'] = _('Message');
$out['FeedBackNoUsersSelected'] = _('No users selected');
$Serializer = $app['Core']['Serializer'];
return new Response(

View File

@@ -334,7 +334,7 @@ class Push implements ControllerProviderInterface
}
catch (\Exception_NotFound $e)
{
}
$Participant = new \Entities\ValidationParticipant();
@@ -507,7 +507,7 @@ class Push implements ControllerProviderInterface
}
catch (\Exception $e)
{
}
if (!$user instanceof \User_Adapter)
@@ -638,10 +638,10 @@ class Push implements ControllerProviderInterface
{
$query->havePositions($request->get('Position'));
}
$sort = $request->get('srt', 'usr_creationdate');
$ord = $request->get('ord', 'desc');
$query->sort_by($sort, $ord);
$results = $query->include_phantoms()

View File

@@ -113,7 +113,7 @@ class UsrLists implements ControllerProviderInterface
}
catch (\Exception $e)
{
}
if ($request->getRequestFormat() == 'json')
@@ -183,7 +183,7 @@ class UsrLists implements ControllerProviderInterface
}
catch (\Exception $e)
{
}
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
@@ -298,7 +298,7 @@ class UsrLists implements ControllerProviderInterface
}
catch (\Exception $e)
{
}
$Json = $app['Core']['Serializer']->serialize($datas, 'json');

View File

@@ -52,7 +52,7 @@ class ConnectionTest implements ControllerProviderInterface
}
catch (\Exception $e)
{
}
if ($dbname && $connection_ok === true)
@@ -85,7 +85,7 @@ class ConnectionTest implements ControllerProviderInterface
}
catch (\Exception $e)
{
}
}

View File

@@ -411,17 +411,17 @@ class API_OAuth2_Adapter extends OAuth2
$scope = $request->get('scope', false);
$state = $request->get('state', false);
if($state)
{
$datas["state"] = $state;
}
if($scope)
{
$datas["scope"] = $scope;
}
$filters = array(
"client_id" => array(
"filter" => FILTER_VALIDATE_REGEXP

View File

@@ -907,6 +907,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public static function get_usr_id_from_email($email)
{
if (is_null($email))
return false;
$conn = connection::getPDOConnection();
@@ -1277,6 +1278,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
protected function load_preferences()
{
if ($this->_prefs)
return $this;
$registry = \registry::get_instance();
@@ -1379,7 +1381,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
return $this;
@@ -1485,6 +1487,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
{
$this->load_preferences();
if (isset($this->_prefs[$prop]) && $this->_prefs[$prop] === $value)
return $value;
$ok = true;
@@ -1522,6 +1525,7 @@ 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();
@@ -1580,7 +1584,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
}
}
@@ -1644,7 +1648,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
return false;
@@ -1730,7 +1734,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
return $locale;
@@ -1796,6 +1800,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public function get_nonce()
{
if ($this->nonce)
return $this->nonce;
$nonce = false;

View File

@@ -542,6 +542,7 @@ class User_Query implements User_QueryInterface
public function get_total()
{
if ($this->total)
return $this->total;
$conn = $this->appbox->get_connection();
@@ -702,6 +703,7 @@ class User_Query implements User_QueryInterface
public function on_base_ids(Array $base_ids = null)
{
if (!$base_ids)
return $this;
$this->bases_restrictions = true;
@@ -726,6 +728,7 @@ class User_Query implements User_QueryInterface
public function on_sbas_ids(Array $sbas_ids = null)
{
if (!$sbas_ids)
return $this;
$this->sbas_restrictions = true;

View File

@@ -43,7 +43,7 @@ class cache_databox
}
catch (\Exception $e)
{
}
if ($last_update)

View File

@@ -192,6 +192,7 @@ class connection
self::$_PDO_instance[$name] = null;
unset(self::$_PDO_instance[$name]);
}
return;
}

View File

@@ -159,13 +159,13 @@ class databox_status
$statuses = array();
$sbas_ids = $user->ACL()->get_granted_sbas();
$see_all = array();
foreach ($sbas_ids as $databox)
{
$see_all[$databox->get_sbas_id()] = false;
foreach($databox->get_collections() as $collection)
{
if($user->ACL()->has_right_on_base($collection->get_base_id(), 'chgstatus'))
@@ -193,7 +193,7 @@ class databox_status
if ($user->ACL()->has_right_on_sbas($sbas_id, 'bas_modify_struct'))
$see_this = true;
foreach ($status as $bit => $props)
{

View File

@@ -1935,16 +1935,16 @@ class record_adapter implements record_Interface, cache_cacheableInterface
public function get_data_from_cache($option = null)
{
\cache_databox::refresh($this->get_sbas_id());
$databox = $this->get_databox();
return $databox->get_data_from_cache($this->get_cache_key($option));
}
public function set_data_to_cache($value, $option = null, $duration = 0)
{
$databox = $this->get_databox();
return $databox->set_data_to_cache($value, $this->get_cache_key($option), $duration);
}
@@ -1962,7 +1962,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
break;
}
$databox = $this->get_databox();
\cache_databox::update($this->get_sbas_id(), 'record', $this->get_record_id());
return $databox->delete_data_from_cache($this->get_cache_key($option));

View File

@@ -829,12 +829,14 @@ class task_period_archive extends task_abstract
{
$magicmethod = strtoupper($sxDotPhrasea->magicfile['method']);
if($magicmethod == 'LOCK' && file_exists($path . '/' . $magicfile))
return;
elseif($magicmethod == 'UNLOCK' && !file_exists($path . '/' . $magicfile))
return;
}
}
while(($file = $listFolder->read()) !== NULL)
{
if ($this->isIgnoredFile($file))

View File

@@ -53,7 +53,7 @@ class ControllerPushTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('UTF-8', $response->getCharset());
}
public function testRoutePOSTValidateSlash()
{
$route = '/push/validateform/';

View File

@@ -38,11 +38,11 @@
<p>
{% trans 'Push::une validation est une demande d\'appreciation a d\'autres personnes' %}
</p>
<input class="search" name="users-search" placeholder="{% trans 'Users' %}" type="text" />
<a href="/prod/push/add-user/" class="user_adder">{% trans 'Add user' %}</a>
<button class="FeedbackSend">{% trans "Send" %}</button>
</div>
@@ -110,8 +110,8 @@
</div>
<div id="FeedbackSendForm">
<form method="post">
</form>
</div>
<script type="text/javascript">

View File

@@ -83,10 +83,10 @@
</tbody>
</table>
<script>
$(document).ready(function(){
var $editor = $('#list-editor-search-results');
$('th.sortable', $editor).bind('click', function(){
var $this = $(this);
@@ -95,7 +95,7 @@
var $form = $this.closest('.editor').find('form[name="list-editor-search"]');
if((sort == $('input[name="srt"]', $form).val())
if((sort == $('input[name="srt"]', $form).val())
&& ($('input[name="ord"]', $form).val() == 'asc'))
{
var ord = 'desc';
@@ -112,19 +112,19 @@
})
.bind('mouseover', function(){$(this).addClass('hover');})
.bind('mouseout', function(){$(this).removeClass('hover');});
$('tbody tr', $editor).bind('click', function(){
var $this = $(this);
var usr_id = $('input[name="usr_id"]', $this).val();
var counters = $('#ListManager .counter.current, #ListManager .lists .list.selected .counter');
if($this.hasClass('selected'))
{
$this.removeClass('selected');
p4.ListManager.getList().removeUser(usr_id);
counters.each(function(i,el){
var n = parseInt($(el).text());
$(el).text(n - 1);
@@ -134,15 +134,15 @@
{
$this.addClass('selected');
p4.ListManager.getList().addUser(usr_id);
counters.each(function(i,el){
var n = parseInt($(el).text());
$(el).text(n + 1);
});
}
});
});
</script>
{% endmacro %}
{% endmacro %}

View File

@@ -1,3 +1,3 @@
{% import 'prod/actions/Feedback/ListsMacros.html.twig' as ListsMacros %}
{{ ListsMacros.ResultTable(results, list, sort, ord) }}
{{ ListsMacros.ResultTable(results, list, sort, ord) }}

View File

@@ -21,7 +21,7 @@
</div>
<form name="list-editor-search" method="POST" action="/prod/push/edit-list/{{ list.getId() }}/">
<div class="PNB" style="top:40px;height:40px;bottom:auto;">
<select name="like_field">
<option value="usr_login">
{% trans 'Push::filter on login' %}
@@ -48,9 +48,9 @@
<button type="submit">
{% trans 'boutton::chercher' %}
</button>
</div>
<div class="PNB" style="top:80px;height:120px;bottom:auto;">
<table style="table-layout:fixed;">
@@ -113,7 +113,7 @@
</tr>
</table>
</div>
<input type="hidden" name="page" value="" />
<input type="hidden" name="srt" value="{{ sort }}" />
<input type="hidden" name="ord" value="{{ ord }}" />

View File

@@ -26,11 +26,11 @@
<p>
{% trans 'Push::unpush permet d\'envoyer un lot d\'image a des destinataires' %}
</p>
<input class="search" name="users-search" placeholder="{% trans 'Users' %}" type="text" />
<a href="/prod/push/add-user/" class="user_adder">{% trans 'Add user' %}</a>
<button class="FeedbackSend">{% trans "Send" %}</button>
</div>
@@ -98,8 +98,8 @@
</div>
<div id="FeedbackSendForm">
<form method="post">
</form>
</div>
<script type="text/javascript">