Code Duplication    Length = 15-16 lines in 4 locations

modules/bataille/app/controller/Faction.php 2 locations

@@ 401-415 (lines=15) @@
398
		 * @return bool
399
		 * fonction qui permet de supprimer une invitation a rejoindre la faction
400
		 */
401
		public function setSupprimerInvitation($id_identite) {
402
			$dbc = App::getDb();
403
			$permissions_membre = $this->getPermissionsMembre($this->id_faction);
404
			
405
			if ($permissions_membre == "chef" || in_array("INVITER_MEMBRE", $permissions_membre)) {
406
				$dbc->delete()->from("_bataille_faction_invitation")->where("ID_faction", "=", $this->id_faction, "AND")
407
					->where("ID_identite", "=", $id_identite)->del();
408
				
409
				FlashMessage::setFlash("L'invitation a bien été supprimée", "success");
410
				return true;
411
			}
412
			
413
			FlashMessage::setFlash("Vous n'avez pas l'autorisation de supprimer une invitation");
414
			return false;
415
		}
416
		
417
		/**
418
		 * @return bool
@@ 481-495 (lines=15) @@
478
		 * @return bool
479
		 * permet de definir le rang d'un joueur au sein de la faction (juste le nom pas les permissions
480
		 */
481
		public function setRang($id_identite, $rang) {
482
			$dbc = App::getDb();
483
			$permissions_membre = $this->getPermissionsMembre($this->id_faction);
484
			
485
			if ($permissions_membre == "chef" || in_array("GERER_RANG_MEMBRE", $permissions_membre)) {
486
				$dbc->update("rang_faction", $rang)->from("_bataille_infos_player")->where("ID_identite", "=", $id_identite, "AND")
487
					->where("ID_faction", "=", $this->id_faction)->set();
488
				
489
				FlashMessage::setFlash("Le rang du joueur a bien été mis à jour", "success");
490
				return true;
491
			}
492
			
493
			FlashMessage::setFlash("Vous n'avez pas l'autorisation de définir le rang des joueurs");
494
			return false;
495
		}
496
		//-------------------------- END SETTER ----------------------------------------------------------------------------//    
497
	}

modules/bataille/app/controller/ForumFaction.php 1 location

@@ 201-216 (lines=16) @@
198
		 * @return bool
199
		 * fonction qui permet de supprimer un commentaire sur un forum
200
		 */
201
		public function setSupprimerCommentaire($id_commentaire) {
202
			$dbc = App::getDb();
203
			$permissions_membre = $this->getPermissionsMembre($this->id_faction);
204
			
205
			if ($permissions_membre == "chef" || in_array("GERER_POST_FORUM", $permissions_membre)) {
206
				$dbc->delete()->from("_bataille_faction_forum_commentaire")
207
					->where("ID_faction_forum_commentaire", "=", $id_commentaire, "AND")
208
					->where("ID_faction_forum", "=", $this->id_faction)
209
					->del();
210
				
211
				return true;
212
			}
213
			
214
			FlashMessage::setFlash("Vous n'avez pas la permission de supprimer un commentaire");
215
			return false;
216
		}
217
		//-------------------------- END SETTER ----------------------------------------------------------------------------//    
218
	}

modules/bataille/app/controller/RelationFaction.php 1 location

@@ 109-124 (lines=16) @@
106
		 * @return bool
107
		 * fonction qui permet de supprimer une relation
108
		 */
109
		public function setSupprimerRelation($id_relation) {
110
			$dbc = App::getDb();
111
			$permissions_membre = $this->getPermissionsMembre($this->id_faction);
112
			
113
			if ($permissions_membre == "chef" || in_array("GERER_RELATIONS", $permissions_membre)) {
114
				$dbc->delete()->from("_bataille_faction_relation")
115
					->where("ID_faction_relation", "=", $id_relation, "AND")
116
					->where("ID_faction", "=", $this->id_faction)->del();
117
				
118
				FlashMessage::setFlash("La relation a été supprimée avec succès".$id_relation, "success");
119
				return true;
120
			}
121
			
122
			FlashMessage::setFlash("Vous n'avez pas l'autorisation de gérer les relations de votre faction");
123
			return false;
124
		}
125
		
126
		//-------------------------- END SETTER ----------------------------------------------------------------------------//    
127
	}