This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".
The branch, master has been updated
via a5c5600584c65c94b45e5374b421b1a1df9157b7 (commit)
via 7c51524df8604a208956d0b9e3e594658fc5e664 (commit)
from 0276ebca1b9150b051f2b80426ee8a31dbe9ecc8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=a5c5600584c65c94b45e5374b421b1a1df9157b7
commit a5c5600584c65c94b45e5374b421b1a1df9157b7
Author: Marc-Etienne Vargenau <[email protected]>
Date: Wed Sep 13 18:37:22 2017 +0200
Use __construct
diff --git a/src/plugins/contribtracker/common/ContribTrackerPlugin.class.php
b/src/plugins/contribtracker/common/ContribTrackerPlugin.class.php
index e0b4915..e37e297 100644
--- a/src/plugins/contribtracker/common/ContribTrackerPlugin.class.php
+++ b/src/plugins/contribtracker/common/ContribTrackerPlugin.class.php
@@ -50,7 +50,7 @@ contributions, along with their authors.");
if ( $project->usesPlugin ( $this->name ) ) {
$params['TITLES'][] = _('Contribution tracker');
$params['TOOLTIPS'][] = _('Follow the
contributions by contributors to this project');
-
$params['DIRS'][]='/plugins/'.$this->name.'/?group_id=' . $group_id ;
+
$params['DIRS'][]='/plugins/'.$this->name.'/?group_id=' . $group_id;
$params['ADMIN'][]='';
}
(($params['toptab'] == $this->name) ?
$params['selected']=(count($params['TITLES'])-1) : '' );
@@ -60,7 +60,7 @@ contributions, along with their authors.");
$group = group_get_object($group_id);
if ( $group->usesPlugin ( $this->name ) ) {
echo util_make_link
("/plugins/".$this->name."/project_admin.php?group_id=".$group->getID(),
- _('Contribution tracker
administration')) ;
+ _('Contribution tracker
administration'));
echo '</p>';
}
}
@@ -70,7 +70,7 @@ contributions, along with their authors.");
$group = group_get_object($group_id);
if ($group->usesPlugin($this->name)) {
- global $HTML ;
+ global $HTML;
echo '<div id="major-contributions">';
echo $HTML->boxTop(_('Latest Major
Contributions'), 'Latest_Major_Contributions');
@@ -83,50 +83,50 @@ contributions, along with their authors.");
<th style="text-align:left">'._('Role').'</th>
</tr>';
- $contribs = $this->getContributionsByGroup
($group) ;
+ $contribs = $this->getContributionsByGroup
($group);
if (count ($contribs) == 0) {
echo '<tr><td
colspan="5"><strong>'._('No contributions have been recorded for this project
yet.').'</strong></td></tr>';
} else {
- $max_displayed_contribs = 3 ;
- $i = 1 ;
+ $max_displayed_contribs = 3;
+ $i = 1;
foreach ($contribs as $c) {
- $parts = $c->getParticipations
() ;
+ $parts =
$c->getParticipations();
if (count ($parts) != 0) {
- $f = 1 ;
+ $f = 1;
foreach ($parts as $p) {
- echo '<tr>' ;
+ echo '<tr>';
if ($f == 1) {
- $f = 0 ;
+ $f = 0;
//
Contribution
- echo
'<td rowspan="'.count ($parts).'">' ;
- echo
strftime (_('%Y-%m-%d'), $c->getDate ()) ;
- echo
'</td>' ;
- echo
'<td rowspan="'.count ($parts).'">' ;
- echo
util_make_link
('/plugins/'.$this->name.'/?group_id='.$group_id.'&contrib_id='.$c->getId(),htmlspecialchars($c->getName()))
;
- echo
'</td>' ;
+ echo
'<td rowspan="'.count ($parts).'">';
+ echo
strftime (_('%Y-%m-%d'), $c->getDate());
+ echo
'</td>';
+ echo
'<td rowspan="'.count ($parts).'">';
+ echo
util_make_link
('/plugins/'.$this->name.'/?group_id='.$group_id.'&contrib_id='.$c->getId(),htmlspecialchars($c->getName()));
+ echo
'</td>';
}
// Actors
involved
- echo '<td>' ;
+ echo '<td>';
if
($p->getActor()->getLogo() != '') {
print '
';
- print
util_make_link ('/plugins/'.$this->name.'/?actor_id='.$p->getActor()->getId (),
-
'<img type="image/png" src="'.util_make_url
('/plugins/'.$this->name.'/actor_logo.php?actor_id='.$p->getActor()->getId
()).'" />') ;
+ print
util_make_link ('/plugins/'.$this->name.'/?actor_id='.$p->getActor()->getId(),
+
'<img type="image/png" src="'.util_make_url
('/plugins/'.$this->name.'/actor_logo.php?actor_id='.$p->getActor()->getId()).'"
/>');
}
- echo
'</td><td>' ;
+ echo
'</td><td>';
printf (_('%s
(%s)'),
-
util_make_link ('/plugins/'.$this->name.'/?actor_id='.$p->getActor()->getId (),
+
util_make_link ('/plugins/'.$this->name.'/?actor_id='.$p->getActor()->getId(),
htmlspecialchars ($p->getActor()->getName())),
-
htmlspecialchars ($p->getActor()->getLegalStructure()->getName())) ;
- echo
'</td><td>' ;
- echo
htmlspecialchars ($p->getRole()->getName()) ;
- echo '</td>' ;
- echo '</tr>' ;
+
htmlspecialchars ($p->getActor()->getLegalStructure()->getName()));
+ echo
'</td><td>';
+ echo
htmlspecialchars ($p->getRole()->getName());
+ echo '</td>';
+ echo '</tr>';
}
- $i++ ;
+ $i++;
}
if ($i >
$max_displayed_contribs) {
- break ;
+ break;
}
}
}
@@ -144,375 +144,375 @@ contributions, along with their authors.");
}
}
- function getActors () {
+ function getActors() {
$res = db_query_params ('SELECT actor_id FROM
plugin_contribtracker_actor',
- array ()) ;
- $ids = util_result_column_to_array ($res, 0) ;
+ array());
+ $ids = util_result_column_to_array ($res, 0);
- $results = array () ;
+ $results = array();
foreach ($ids as $id) {
- $results[] = new ContribTrackerActor ($id) ;
+ $results[] = new ContribTrackerActor ($id);
}
- return $results ;
+ return $results;
}
- function getLegalStructures () {
+ function getLegalStructures() {
$res = db_query_params ('SELECT struct_id FROM
plugin_contribtracker_legal_structure',
- array ()) ;
- $ids = util_result_column_to_array ($res, 0) ;
+ array());
+ $ids = util_result_column_to_array ($res, 0);
- $results = array () ;
+ $results = array();
foreach ($ids as $id) {
- $results[] = new ContribTrackerLegalStructure ($id) ;
+ $results[] = new ContribTrackerLegalStructure ($id);
}
- return $results ;
+ return $results;
}
- function getRoles () {
+ function getRoles() {
$res = db_query_params ('SELECT role_id FROM
plugin_contribtracker_role',
- array ()) ;
- $ids = util_result_column_to_array ($res, 0) ;
+ array());
+ $ids = util_result_column_to_array ($res, 0);
- $results = array () ;
+ $results = array();
foreach ($ids as $id) {
- $results[] = new ContribTrackerRole ($id) ;
+ $results[] = new ContribTrackerRole ($id);
}
- return $results ;
+ return $results;
}
- function getContributions () {
+ function getContributions() {
$res = db_query_params ('SELECT contrib_id FROM
plugin_contribtracker_contribution',
- array ()) ;
- $ids = util_result_column_to_array ($res, 0) ;
+ array());
+ $ids = util_result_column_to_array ($res, 0);
- $results = array () ;
+ $results = array();
foreach ($ids as $id) {
- $results[] = new ContribTrackerContribution ($id) ;
+ $results[] = new ContribTrackerContribution ($id);
}
- $plugin = plugin_get_object ('contribtracker') ;
- usort ($results, array ($plugin, "ContribComparator")) ;
- return $results ;
+ $plugin = plugin_get_object ('contribtracker');
+ usort ($results, array ($plugin, "ContribComparator"));
+ return $results;
}
function getContributionsByGroup ($group) {
$res = db_query_params ('SELECT contrib_id FROM
plugin_contribtracker_contribution WHERE group_id = $1',
- array ($group->getId())) ;
- $ids = util_result_column_to_array ($res, 0) ;
+ array ($group->getId()));
+ $ids = util_result_column_to_array ($res, 0);
- $results = array () ;
+ $results = array();
foreach ($ids as $id) {
- $results[] = new ContribTrackerContribution ($id) ;
+ $results[] = new ContribTrackerContribution ($id);
}
- $plugin = plugin_get_object ('contribtracker') ;
- usort ($results, array ($plugin, "ContribComparator")) ;
- return $results ;
+ $plugin = plugin_get_object ('contribtracker');
+ usort ($results, array ($plugin, "ContribComparator"));
+ return $results;
}
function ContribComparator ($a, $b) {
if ($a->getDate() != $b->getDate()) {
- return ($a->getDate() < $b->getDate()) ? -1 : 1 ;
+ return ($a->getDate() < $b->getDate()) ? -1 : 1;
} elseif ($a->getName() != $b->getName()) {
- return ($a->getName() < $b->getName()) ? -1 : 1 ;
+ return ($a->getName() < $b->getName()) ? -1 : 1;
} else {
- return 0 ;
+ return 0;
}
}
function ParticipationComparator ($a, $b) {
if ($a->getContribution()->getDate() !=
$b->getContribution()->getDate()) {
- return ($a->getContribution()->getDate() <
$b->getContribution()->getDate()) ? -1 : 1 ;
+ return ($a->getContribution()->getDate() <
$b->getContribution()->getDate()) ? -1 : 1;
} elseif ($a->getContribution() != $b->getContribution()) {
- return ($a->getContribution() < $b->getContribution())
? -1 : 1 ;
+ return ($a->getContribution() < $b->getContribution())
? -1 : 1;
} elseif ($a->getIndex() != $b->getIndex()) {
- return ($a->getIndex() < $b->getIndex()) ? -1 : 1 ;
+ return ($a->getIndex() < $b->getIndex()) ? -1 : 1;
} else {
- return 0 ;
+ return 0;
}
}
}
class ContribTrackerRole extends FFError {
- var $data_array ;
+ var $data_array;
- function ContribTrackerRole ($id=false) {
+ function __construct($id=false) {
parent::__construct();
if (!$id) {
- return true ;
+ return true;
}
- return $this->fetchData ($id) ;
+ return $this->fetchData ($id);
}
function fetchData ($id) {
$res = db_query_params ('SELECT * FROM
plugin_contribtracker_role WHERE role_id=$1',
- array ($id)) ;
+ array ($id));
if (!$res || db_numrows($res) < 1) {
$this->setError(sprintf('ContribTrackerRole():
%s',db_error()));
return false;
}
- $this->data_array = db_fetch_array ($res) ;
- return true ;
+ $this->data_array = db_fetch_array ($res);
+ return true;
}
function create ($name, $description) {
- if ($this->getId ()) {
- $this->setError(_('Object already exists')) ;
- return false ;
+ if ($this->getId()) {
+ $this->setError(_('Object already exists'));
+ return false;
}
- db_begin () ;
+ db_begin();
$res = db_query_params ('INSERT INTO plugin_contribtracker_role
(name, description) VALUES ($1,$2)',
array ($name,
- $description)) ;
+ $description));
if (!$res || db_affected_rows ($res) < 1) {
$this->setError (sprintf(_('Could not create object in
database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- $id = db_insertid ($res, 'plugin_contribtracker_role',
'role_id') ;
+ $id = db_insertid ($res, 'plugin_contribtracker_role',
'role_id');
if (!$id) {
$this->setError (sprintf(_('Could not get ID from
object in database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- db_commit () ;
- return $this->fetchData ($id) ;
+ db_commit();
+ return $this->fetchData ($id);
}
function update ($name, $description) {
- if (! $this->getId ()) {
- $this->setError(_('Object does not exist')) ;
- return false ;
+ if (! $this->getId()) {
+ $this->setError(_('Object does not exist'));
+ return false;
}
- $id = $this->getId () ;
+ $id = $this->getId();
- db_begin () ;
+ db_begin();
$res = db_query_params ('UPDATE plugin_contribtracker_role SET
(name, description) = ($1,$2) WHERE role_id = $3',
array ($name,
$description,
- $id)) ;
+ $id));
if (!$res || db_affected_rows ($res) < 1) {
$this->setError (sprintf(_('Could not update object in
database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- db_commit () ;
- return $this->fetchData ($id) ;
+ db_commit();
+ return $this->fetchData ($id);
}
- function delete () {
- $id = $this->getId () ;
+ function delete() {
+ $id = $this->getId();
if (!$id) {
- $this->setError (_('Cannot delete a non-existing
object.')) ;
- return false ;
+ $this->setError (_('Cannot delete a non-existing
object.'));
+ return false;
}
$res = db_query_params ('DELETE FROM plugin_contribtracker_role
WHERE role_id = $1',
- array ($id)) ;
+ array ($id));
if (!$res) {
$this->setError (sprintf(_('Could not delete object in
database: %s.'),
- db_error ())) ;
- return false ;
+ db_error()));
+ return false;
}
- $this->data_array = array () ;
+ $this->data_array = array();
- return true ;
+ return true;
}
- function getId () {
+ function getId() {
if (isset ($this->data_array['role_id'])) {
- return $this->data_array['role_id'] ;
+ return $this->data_array['role_id'];
} else {
- return false ;
+ return false;
}
}
- function getName () { return $this->data_array['name'] ; }
- function getDescription () { return $this->data_array['description'] ; }
+ function getName() { return $this->data_array['name']; }
+ function getDescription() { return $this->data_array['description']; }
}
class ContribTrackerLegalStructure extends FFError {
- var $data_array ;
+ var $data_array;
- function ContribTrackerLegalStructure ($id=false) {
- $this->FFError () ;
+ function __construct($id=false) {
+ parent::__construct();
if (!$id) {
- return true ;
+ return true;
}
- return $this->fetchData ($id) ;
+ return $this->fetchData ($id);
}
function fetchData ($id) {
$res = db_query_params ('SELECT * FROM
plugin_contribtracker_legal_structure WHERE struct_id=$1',
- array ($id)) ;
+ array ($id));
if (!$res || db_numrows($res) < 1) {
$this->setError(sprintf('ContribTrackerLegalStructure(): %s',db_error()));
return false;
}
- $this->data_array = db_fetch_array ($res) ;
- return true ;
+ $this->data_array = db_fetch_array ($res);
+ return true;
}
function create ($name) {
- if ($this->getId ()) {
- $this->setError(_('Object already exists')) ;
- return false ;
+ if ($this->getId()) {
+ $this->setError(_('Object already exists'));
+ return false;
}
- db_begin () ;
+ db_begin();
$res = db_query_params ('INSERT INTO
plugin_contribtracker_legal_structure (name) VALUES ($1)',
- array ($name)) ;
+ array ($name));
if (!$res || db_affected_rows ($res) < 1) {
$this->setError (sprintf(_('Could not create object in
database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- $id = db_insertid ($res,
'plugin_contribtracker_legal_structure', 'struct_id') ;
+ $id = db_insertid ($res,
'plugin_contribtracker_legal_structure', 'struct_id');
if (!$id) {
$this->setError (sprintf(_('Could not get ID from
object in database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- db_commit () ;
- return $this->fetchData ($id) ;
+ db_commit();
+ return $this->fetchData ($id);
}
function update ($name) {
- if (! $this->getId ()) {
- $this->setError(_('Object does not exist')) ;
- return false ;
+ if (! $this->getId()) {
+ $this->setError(_('Object does not exist'));
+ return false;
}
- $id = $this->getId () ;
+ $id = $this->getId();
- db_begin () ;
+ db_begin();
$res = db_query_params ('UPDATE
plugin_contribtracker_legal_structure SET (name) = ($1) WHERE struct_id = $2',
array ($name,
- $id)) ;
+ $id));
if (!$res || db_affected_rows ($res) < 1) {
$this->setError (sprintf(_('Could not update object in
database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- db_commit () ;
- return $this->fetchData ($id) ;
+ db_commit();
+ return $this->fetchData ($id);
}
- function delete () {
- $id = $this->getId () ;
+ function delete() {
+ $id = $this->getId();
if (!$id) {
- $this->setError (_('Cannot delete a non-existing
object.')) ;
- return false ;
+ $this->setError (_('Cannot delete a non-existing
object.'));
+ return false;
}
$res = db_query_params ('DELETE FROM
plugin_contribtracker_legal_structure WHERE struct_id = $1',
- array ($id)) ;
+ array ($id));
if (!$res) {
$this->setError (sprintf(_('Could not delete object in
database: %s.'),
- db_error ())) ;
- return false ;
+ db_error()));
+ return false;
}
- $this->data_array = array () ;
+ $this->data_array = array();
- return true ;
+ return true;
}
- function getId () {
+ function getId() {
if (isset ($this->data_array['struct_id'])) {
- return $this->data_array['struct_id'] ;
+ return $this->data_array['struct_id'];
} else {
- return false ;
+ return false;
}
}
- function getName () { return $this->data_array['name'] ; }
+ function getName() { return $this->data_array['name']; }
}
class ContribTrackerActor extends FFError {
- var $data_array ;
+ var $data_array;
- function ContribTrackerActor ($id=false) {
- $this->FFError () ;
+ function __construct($id=false) {
+ parent::__construct();
if (!$id) {
- return true ;
+ return true;
}
- return $this->fetchData ($id) ;
+ return $this->fetchData ($id);
}
function fetchData ($id) {
$res = db_query_params ('SELECT * FROM
plugin_contribtracker_actor WHERE actor_id=$1',
- array ($id)) ;
+ array ($id));
if (!$res || db_numrows($res) < 1) {
$this->setError(sprintf('ContribTrackerActor():
%s',db_error()));
return false;
}
- $this->data_array = db_fetch_array ($res) ;
- return true ;
+ $this->data_array = db_fetch_array ($res);
+ return true;
}
function create ($name, $url, $email, $description, $logo, $structure) {
- if ($this->getId ()) {
- $this->setError(_('Object already exists')) ;
- return false ;
+ if ($this->getId()) {
+ $this->setError(_('Object already exists'));
+ return false;
}
- db_begin () ;
+ db_begin();
$res = db_query_params ('INSERT INTO
plugin_contribtracker_actor (name,url,email,description,logo,struct_id) VALUES
($1,$2,$3,$4,$5,$6)',
array ($name,
$url,
$email,
$description,
base64_encode ($logo),
- $structure->getID())) ;
+ $structure->getID()));
if (!$res || db_affected_rows ($res) < 1) {
$this->setError (sprintf(_('Could not create object in
database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- $id = db_insertid ($res, 'plugin_contribtracker_actor',
'actor_id') ;
+ $id = db_insertid ($res, 'plugin_contribtracker_actor',
'actor_id');
if (!$id) {
$this->setError (sprintf(_('Could not get ID from
object in database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- db_commit () ;
- return $this->fetchData ($id) ;
+ db_commit();
+ return $this->fetchData ($id);
}
function update ($name, $url, $email, $description, $logo, $structure) {
- if (! $this->getId ()) {
- $this->setError(_('Object does not exist')) ;
- return false ;
+ if (! $this->getId()) {
+ $this->setError(_('Object does not exist'));
+ return false;
}
- $id = $this->getId () ;
+ $id = $this->getId();
- db_begin () ;
+ db_begin();
$res = db_query_params ('UPDATE plugin_contribtracker_actor SET
(name,url,email,description,logo,struct_id) = ($1,$2,$3,$4,$5,$6) WHERE
actor_id = $7',
array ($name,
$url,
@@ -520,405 +520,405 @@ class ContribTrackerActor extends FFError {
$description,
base64_encode ($logo),
$structure->getID(),
- $id)) ;
+ $id));
if (!$res || db_affected_rows ($res) < 1) {
$this->setError (sprintf(_('Could not update object in
database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- db_commit () ;
- return $this->fetchData ($id) ;
+ db_commit();
+ return $this->fetchData ($id);
}
- function delete () {
- $id = $this->getId () ;
+ function delete() {
+ $id = $this->getId();
if (!$id) {
- $this->setError (_('Cannot delete a non-existing
object.')) ;
- return false ;
+ $this->setError (_('Cannot delete a non-existing
object.'));
+ return false;
}
$res = db_query_params ('DELETE FROM
plugin_contribtracker_actor WHERE actor_id = $1',
- array ($id)) ;
+ array ($id));
if (!$res) {
$this->setError (sprintf(_('Could not delete object in
database: %s.'),
- db_error ())) ;
- return false ;
+ db_error()));
+ return false;
}
- $this->data_array = array () ;
+ $this->data_array = array();
- return true ;
+ return true;
}
- function getId () {
+ function getId() {
if (isset ($this->data_array['actor_id'])) {
- return $this->data_array['actor_id'] ;
+ return $this->data_array['actor_id'];
} else {
- return false ;
+ return false;
}
}
- function getName () { return $this->data_array['name'] ; }
- function getUrl () { return $this->data_array['url'] ; }
- function getEmail () { return $this->data_array['email'] ; }
- function getDescription () { return $this->data_array['description'] ; }
- function getLegalStructure () {
- return new ContribTrackerLegalStructure
($this->data_array['struct_id']) ;
+ function getName() { return $this->data_array['name']; }
+ function getUrl() { return $this->data_array['url']; }
+ function getEmail() { return $this->data_array['email']; }
+ function getDescription() { return $this->data_array['description']; }
+ function getLegalStructure() {
+ return new ContribTrackerLegalStructure
($this->data_array['struct_id']);
}
- function getLogo () { return base64_decode ($this->data_array['logo'])
; }
+ function getLogo() { return base64_decode ($this->data_array['logo']); }
- function getParticipations () {
+ function getParticipations() {
$res = db_query_params ('SELECT participation_id FROM
plugin_contribtracker_participation WHERE actor_id = $1',
- array ($this->getId())) ;
- $ids = util_result_column_to_array ($res, 0) ;
+ array ($this->getId()));
+ $ids = util_result_column_to_array ($res, 0);
- $results = array () ;
+ $results = array();
foreach ($ids as $id) {
- $results[] = new ContribTrackerParticipation ($id) ;
+ $results[] = new ContribTrackerParticipation ($id);
}
- $plugin = plugin_get_object ('contribtracker') ;
- usort ($results, array ($plugin, "ParticipationComparator")) ;
- return $results ;
+ $plugin = plugin_get_object ('contribtracker');
+ usort ($results, array ($plugin, "ParticipationComparator"));
+ return $results;
}
}
class ContribTrackerContribution extends FFError {
- var $data_array ;
+ var $data_array;
- function ContribTrackerContribution ($id=false) {
- $this->FFError () ;
+ function __construct($id=false) {
+ parent::__construct();
if (!$id) {
- return true ;
+ return true;
}
- return $this->fetchData ($id) ;
+ return $this->fetchData ($id);
}
function fetchData ($id) {
$res = db_query_params ('SELECT * FROM
plugin_contribtracker_contribution WHERE contrib_id=$1',
- array ($id)) ;
+ array ($id));
if (!$res || db_numrows($res) < 1) {
$this->setError(sprintf('ContribTrackerContribution():
%s',db_error()));
return false;
}
- $this->data_array = db_fetch_array ($res) ;
- return true ;
+ $this->data_array = db_fetch_array ($res);
+ return true;
}
function create ($name, $date, $description, $group) {
- if ($this->getId ()) {
- $this->setError(_('Object already exists')) ;
- return false ;
+ if ($this->getId()) {
+ $this->setError(_('Object already exists'));
+ return false;
}
- db_begin () ;
+ db_begin();
$res = db_query_params ('INSERT INTO
plugin_contribtracker_contribution (name,date,description,group_id) VALUES
($1,$2,$3,$4)',
array ($name,
$date,
$description,
- $group->getID())) ;
+ $group->getID()));
if (!$res || db_affected_rows ($res) < 1) {
$this->setError (sprintf(_('Could not create object in
database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- $id = db_insertid ($res, 'plugin_contribtracker_contribution',
'contrib_id') ;
+ $id = db_insertid ($res, 'plugin_contribtracker_contribution',
'contrib_id');
if (!$id) {
$this->setError (sprintf(_('Could not get ID from
object in database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- db_commit () ;
- return $this->fetchData ($id) ;
+ db_commit();
+ return $this->fetchData ($id);
}
function update ($name, $date, $description, $group) {
- if (! $this->getId ()) {
- $this->setError(_('Object does not exist')) ;
- return false ;
+ if (! $this->getId()) {
+ $this->setError(_('Object does not exist'));
+ return false;
}
- $id = $this->getId () ;
+ $id = $this->getId();
- db_begin () ;
+ db_begin();
$res = db_query_params ('UPDATE
plugin_contribtracker_contribution SET (name,date,description,group_id) =
($1,$2,$3,$4) WHERE contrib_id = $5',
array ($name,
$date,
$description,
$group->getID(),
- $id)) ;
+ $id));
if (!$res || db_affected_rows ($res) < 1) {
$this->setError (sprintf(_('Could not update object in
database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- db_commit () ;
- return $this->fetchData ($id) ;
+ db_commit();
+ return $this->fetchData ($id);
}
- function delete () {
- $id = $this->getId () ;
+ function delete() {
+ $id = $this->getId();
if (!$id) {
- $this->setError (_('Cannot delete a non-existing
object.')) ;
- return false ;
+ $this->setError (_('Cannot delete a non-existing
object.'));
+ return false;
}
$res = db_query_params ('DELETE FROM
plugin_contribtracker_contribution WHERE contrib_id = $1',
- array ($id)) ;
+ array ($id));
if (!$res) {
$this->setError (sprintf(_('Could not delete object in
database: %s.'),
- db_error ())) ;
- return false ;
+ db_error()));
+ return false;
}
- $this->data_array = array () ;
+ $this->data_array = array();
- return true ;
+ return true;
}
- function getId () {
+ function getId() {
if (isset ($this->data_array['contrib_id'])) {
- return $this->data_array['contrib_id'] ;
+ return $this->data_array['contrib_id'];
} else {
- return false ;
+ return false;
}
}
- function getName () { return $this->data_array['name'] ; }
- function getDate () { return $this->data_array['date'] ; }
- function getDescription () { return $this->data_array['description'] ; }
- function getGroup () {
- return group_get_object($this->data_array['group_id']) ;
+ function getName() { return $this->data_array['name']; }
+ function getDate() { return $this->data_array['date']; }
+ function getDescription() { return $this->data_array['description']; }
+ function getGroup() {
+ return group_get_object($this->data_array['group_id']);
}
- function getParticipations () {
+ function getParticipations() {
$res = db_query_params ('SELECT participation_id FROM
plugin_contribtracker_participation WHERE contrib_id = $1',
- array ($this->getId())) ;
- $ids = util_result_column_to_array ($res, 0) ;
+ array ($this->getId()));
+ $ids = util_result_column_to_array ($res, 0);
- $results = array () ;
+ $results = array();
foreach ($ids as $id) {
- $results[] = new ContribTrackerParticipation ($id) ;
+ $results[] = new ContribTrackerParticipation ($id);
}
- $plugin = plugin_get_object ('contribtracker') ;
- usort ($results, array ($plugin, "ParticipationComparator")) ;
- return $results ;
+ $plugin = plugin_get_object ('contribtracker');
+ usort ($results, array ($plugin, "ParticipationComparator"));
+ return $results;
}
- function getLastPartIndex () {
+ function getLastPartIndex() {
$res = db_query_params ('SELECT COUNT(*) AS c FROM
plugin_contribtracker_participation WHERE contrib_id = $1',
- array ($this->getId())) ;
- $curindex = db_result ($res,0,'c') ;
- return $curindex ;
+ array ($this->getId()));
+ $curindex = db_result ($res,0,'c');
+ return $curindex;
}
}
class ContribTrackerParticipation extends FFError {
- var $data_array ;
+ var $data_array;
- function ContribTrackerParticipation ($id=false) {
- $this->FFError () ;
+ function __construct($id=false) {
+ parent::__construct();
if (!$id) {
- return true ;
+ return true;
}
- return $this->fetchData ($id) ;
+ return $this->fetchData ($id);
}
function fetchData ($id) {
$res = db_query_params ('SELECT * FROM
plugin_contribtracker_participation WHERE participation_id=$1',
- array ($id)) ;
+ array ($id));
if (!$res || db_numrows($res) < 1) {
$this->setError(sprintf('ContribTrackerParticipation():
%s',db_error()));
return false;
}
- $this->data_array = db_fetch_array ($res) ;
- return true ;
+ $this->data_array = db_fetch_array ($res);
+ return true;
}
function create ($contrib, $actor, $role) {
- if ($this->getId ()) {
- $this->setError(_('Object already exists')) ;
- return false ;
+ if ($this->getId()) {
+ $this->setError(_('Object already exists'));
+ return false;
}
- db_begin () ;
- $index = $contrib->getLastPartIndex () + 1;
+ db_begin();
+ $index = $contrib->getLastPartIndex() + 1;
$res = db_query_params ('INSERT INTO
plugin_contribtracker_participation (contrib_id,actor_id,role_id,index) VALUES
($1,$2,$3,$4)',
array ($contrib->getID(),
$actor->getID(),
$role->getID(),
- $index)) ;
+ $index));
if (!$res || db_affected_rows ($res) < 1) {
$this->setError (sprintf(_('Could not create object in
database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- $id = db_insertid ($res, 'plugin_contribtracker_participation',
'participation_id') ;
+ $id = db_insertid ($res, 'plugin_contribtracker_participation',
'participation_id');
if (!$id) {
$this->setError (sprintf(_('Could not get ID from
object in database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- db_commit () ;
- return $this->fetchData ($id) ;
+ db_commit();
+ return $this->fetchData ($id);
}
function update ($contrib, $actor, $role) {
- if (! $this->getId ()) {
- $this->setError(_('Object does not exist')) ;
- return false ;
+ if (! $this->getId()) {
+ $this->setError(_('Object does not exist'));
+ return false;
}
- $id = $this->getId () ;
+ $id = $this->getId();
if ($contrib->getID() != $this->getContribution()->getID()) {
- $this->setError (_('Cannot currently move a
participation across contributions.')) ;
- return false ;
+ $this->setError (_('Cannot currently move a
participation across contributions.'));
+ return false;
}
- db_begin () ;
+ db_begin();
$res = db_query_params ('UPDATE
plugin_contribtracker_participation SET (contrib_id,actor_id,role_id) =
($1,$2,$3) WHERE participation_id = $4',
array ($contrib->getID(),
$actor->getID(),
$role->getID(),
- $id)) ;
+ $id));
if (!$res || db_affected_rows ($res) < 1) {
$this->setError (sprintf(_('Could not update object in
database: %s.'),
- db_error ()));
- db_rollback () ;
- return false ;
+ db_error()));
+ db_rollback();
+ return false;
}
- db_commit () ;
- return $this->fetchData ($id) ;
+ db_commit();
+ return $this->fetchData ($id);
}
- function delete () {
- $id = $this->getId () ;
+ function delete() {
+ $id = $this->getId();
if (!$id) {
- $this->setError (_('Cannot delete a non-existing
object.')) ;
- return false ;
+ $this->setError (_('Cannot delete a non-existing
object.'));
+ return false;
}
- db_begin () ;
- $curindex = $this->getIndex() ;
+ db_begin();
+ $curindex = $this->getIndex();
$res = db_query_params ('DELETE FROM
plugin_contribtracker_participation WHERE participation_id = $1',
- array ($id)) ;
+ array ($id));
if (!$res) {
$this->setError (sprintf(_('Could not delete object in
database: %s.'),
- db_error ())) ;
- return false ;
+ db_error()));
+ return false;
}
$res = db_query_params ('UPDATE
plugin_contribtracker_participation SET index = -index WHERE contrib_id = $1
and index > $2',
array
($this->getContribution()->getId(),
- $curindex)) ;
+ $curindex));
if (!$res) {
$this->setError (sprintf(_('Could not update indices in
database: %s.'),
- db_error ())) ;
- return false ;
+ db_error()));
+ return false;
}
$res = db_query_params ('UPDATE
plugin_contribtracker_participation SET index = -index -1 WHERE contrib_id = $1
and index < 0',
- array
($this->getContribution()->getId())) ;
+ array
($this->getContribution()->getId()));
if (!$res) {
$this->setError (sprintf(_('Could not update indices in
database: %s.'),
- db_error ())) ;
- return false ;
+ db_error()));
+ return false;
}
- db_commit () ;
+ db_commit();
- $this->data_array = array () ;
+ $this->data_array = array();
- return true ;
+ return true;
}
- function moveUp () {
- $id = $this->getId () ;
+ function moveUp() {
+ $id = $this->getId();
if (!$id) {
- $this->setError (_('Cannot update a non-existing
object.')) ;
- return false ;
+ $this->setError (_('Cannot update a non-existing
object.'));
+ return false;
}
- $cur = $this->getIndex() ;
+ $cur = $this->getIndex();
if ($cur == 1) {
- return ;
+ return;
}
- $contrib_id = $this->getContribution()->getId() ;
+ $contrib_id = $this->getContribution()->getId();
- db_begin () ;
+ db_begin();
$res = db_query_params ('UPDATE
plugin_contribtracker_participation SET index = 0 WHERE participation_id = $1',
- array ($id)) ;
+ array ($id));
$res = db_query_params ('UPDATE
plugin_contribtracker_participation SET index = index+1 WHERE contrib_id = $1
AND index = $2',
array ($contrib_id,
- $cur-1)) ;
+ $cur-1));
$res = db_query_params ('UPDATE
plugin_contribtracker_participation SET index = $1 WHERE contrib_id = $2 AND
index = 0',
array ($cur - 1,
- $contrib_id)) ;
- db_commit () ;
+ $contrib_id));
+ db_commit();
}
- function moveDown () {
- $id = $this->getId () ;
+ function moveDown() {
+ $id = $this->getId();
if (!$id) {
- $this->setError (_('Cannot update a non-existing
object.')) ;
- return false ;
+ $this->setError (_('Cannot update a non-existing
object.'));
+ return false;
}
- $lastid = $this->getContribution()->getLastPartIndex() ;
+ $lastid = $this->getContribution()->getLastPartIndex();
- $cur = $this->getIndex() ;
+ $cur = $this->getIndex();
if ($cur == $lastid) {
- return ;
+ return;
}
- $contrib_id = $this->getContribution()->getId() ;
+ $contrib_id = $this->getContribution()->getId();
- db_begin () ;
+ db_begin();
$res = db_query_params ('UPDATE
plugin_contribtracker_participation SET index = 0 WHERE participation_id = $1',
- array ($id)) ;
+ array ($id));
$res = db_query_params ('UPDATE
plugin_contribtracker_participation SET index = index-1 WHERE contrib_id = $1
AND index = $2',
array ($contrib_id,
- $cur+1)) ;
+ $cur+1));
$res = db_query_params ('UPDATE
plugin_contribtracker_participation SET index = $1 WHERE contrib_id = $2 AND
index = 0',
array ($cur + 1,
- $contrib_id)) ;
- db_commit () ;
+ $contrib_id));
+ db_commit();
}
- function getId () {
+ function getId() {
if (isset ($this->data_array['participation_id'])) {
- return $this->data_array['participation_id'] ;
+ return $this->data_array['participation_id'];
} else {
- return false ;
+ return false;
}
}
- function getIndex () {
+ function getIndex() {
if (isset ($this->data_array['index'])) {
- return $this->data_array['index'] ;
+ return $this->data_array['index'];
} else {
- return false ;
+ return false;
}
}
- function getActor () {
- return new ContribTrackerActor ($this->data_array['actor_id']) ;
+ function getActor() {
+ return new ContribTrackerActor ($this->data_array['actor_id']);
}
- function getRole () {
- return new ContribTrackerRole ($this->data_array['role_id']) ;
+ function getRole() {
+ return new ContribTrackerRole ($this->data_array['role_id']);
}
- function getContribution () {
- return new ContribTrackerContribution
($this->data_array['contrib_id']) ;
+ function getContribution() {
+ return new ContribTrackerContribution
($this->data_array['contrib_id']);
}
}
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=7c51524df8604a208956d0b9e3e594658fc5e664
commit 7c51524df8604a208956d0b9e3e594658fc5e664
Author: Marc-Etienne Vargenau <[email protected]>
Date: Wed Sep 13 18:28:47 2017 +0200
Use __construct
diff --git a/src/plugins/aselectextauth/common/Aselect.class.php
b/src/plugins/aselectextauth/common/Aselect.class.php
index 868dc40..b5b39b0 100644
--- a/src/plugins/aselectextauth/common/Aselect.class.php
+++ b/src/plugins/aselectextauth/common/Aselect.class.php
@@ -23,18 +23,19 @@ class ASelect {
var $organization;
var $attributes=array();
var $ticket;
- function ASelect () {
+
+ function __construct() {
if(isset($_COOKIE['aselectuid'])){
- $this->username = $_COOKIE['aselectuid'];
+ $this->username = $_COOKIE['aselectuid'];
} else {
- $this->username = '';
+ $this->username = '';
}
if(isset($_COOKIE['aselectorganization'])){
$this->organization = $_COOKIE['aselectorganization'];
} else {
- $this->organization = '';
+ $this->organization = '';
}
if(isset($_COOKIE['aselectattributes'])){
-----------------------------------------------------------------------
Summary of changes:
.../aselectextauth/common/Aselect.class.php | 9 +-
.../common/ContribTrackerPlugin.class.php | 746 ++++++++++-----------
2 files changed, 378 insertions(+), 377 deletions(-)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits