Completed
Push — spip-2-stable ( d79e3d )
by cam
30:47 queued 16:59
created

message.php ➔ http_affiche_message()   F

Complexity

Conditions 22
Paths 4608

Size

Total Lines 102
Code Lines 53

Duplication

Lines 6
Ratio 5.88 %

Importance

Changes 0
Metric Value
cc 22
eloc 53
nc 4608
nop 11
dl 6
loc 102
rs 2
c 0
b 0
f 0

How to fix   Long Method    Complexity    Many Parameters   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
/***************************************************************************\
4
 *  SPIP, Systeme de publication pour l'internet                           *
5
 *                                                                         *
6
 *  Copyright (c) 2001-2016                                                *
7
 *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
8
 *                                                                         *
9
 *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
10
 *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11
\***************************************************************************/
12
13
if (!defined('_ECRIRE_INC_VERSION')) return;
14
15
include_spip('inc/presentation');
16
include_spip('inc/mots');
17
18
// http://doc.spip.org/@exec_message_dist
19
function exec_message_dist()
20
{
21
	exec_message_args(intval(_request('id_message')),_request('forcer_dest'),  _request('cherche_auteur'));
22
}
23
24
// http://doc.spip.org/@exec_message_args
25
function exec_message_args($id_message, $forcer_dest, $cherche_auteur)
26
{
27
	global  $connect_id_auteur;
28
29
	$res = sql_getfetsel("type", "spip_messages", "id_message=$id_message");
30
31
	if ($res AND $res != "affich")
32
		$res = sql_fetsel("vu", "spip_auteurs_messages", "id_auteur=$connect_id_auteur AND id_message=$id_message");
33
34
	if (!$res) {
35
		include_spip('inc/minipres');
36
		echo minipres();
37
	} else {
38
	// Marquer le message vu pour le visiteur
39
		if (is_array($res) AND $res['vu'] != 'oui') {
40
			include_spip('inc/headers');
41
			redirige_par_entete(redirige_action_auteur("editer_message","$id_message/:$connect_id_auteur", 'message', "id_message=$id_message", true));
42
		}
43
		exec_affiche_message_dist($id_message, $cherche_auteur, $forcer_dest);
44
	}
45
}
46
47
// http://doc.spip.org/@http_afficher_rendez_vous
48
function http_afficher_rendez_vous($date_heure, $date_fin)
49
{
50
  global $spip_lang_rtl;
51
52
	$dirpuce = _DIR_RACINE . 'dist';
53
	if (jour($date_heure) == jour($date_fin) AND mois($date_heure) == mois($date_fin) AND annee($date_heure) == annee($date_fin)) {		
54
	  echo "<p class='verdana2' style='text-align: center'>"._T('titre_rendez_vous')." ".majuscules(nom_jour($date_heure))." <b>".majuscules(affdate($date_heure))."</b><br />\n<b>".heures($date_heure)." "._T('date_mot_heures')." ".minutes($date_heure)."</b>";
55
	  echo " &nbsp; <img src='$dirpuce/puce$spip_lang_rtl.gif' alt=' ' style='border: 0px;' /> &nbsp;  ".heures($date_fin)." "._T('date_mot_heures')." ".minutes($date_fin)."</p>";
56
	} else {
57
	  echo "<p class='verdana2' style='text-align: center'>"._T('titre_rendez_vous')."<br />\n".majuscules(nom_jour($date_heure))." <b>".majuscules(affdate($date_heure))."</b>, <b>".heures($date_heure)." "._T('date_mot_heures')." ".minutes($date_heure)."</b>";
58
	  echo "<br />\n<img src='$dirpuce/puce$spip_lang_rtl.gif' alt=' ' style='border: 0px;' /> ".majuscules(nom_jour($date_fin))." ".majuscules(affdate($date_fin)).", <b>".heures($date_fin)." "._T('date_mot_heures')." ".minutes($date_fin)."</b></p>";
59
	}
60
}
61
62
// http://doc.spip.org/@http_auteurs_ressemblants
63
function http_auteurs_ressemblants($cherche_auteur, $id_message)
64
{
65
66
  $cherche_auteur = htmlspecialchars($cherche_auteur);
67
68
  global $connect_id_auteur;
69
  $query = sql_select("id_auteur, nom", "spip_auteurs", "messagerie<>'non' AND id_auteur<>'$connect_id_auteur' AND pass<>'' AND login<>''");
70
  $table_auteurs = array();
71
  $table_ids = array();
72 View Code Duplication
  while ($row = sql_fetch($query)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
73
    $table_auteurs[] = $row['nom'];
74
    $table_ids[] = $row['id_auteur'];
75
  }
76
  $resultat =  mots_ressemblants($cherche_auteur, $table_auteurs, $table_ids);
77
  if (!$resultat) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $resultat of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
78
    return '<b>' . _T('info_recherche_auteur_zero', array('cherche_auteur' => $cherche_auteur))."</b><br />";
79
  }
80
  else if (count($resultat) == 1) {
81
    // action/editer_message a du prendre en compte ce cas
82
    list(, $nouv_auteur) = each($resultat);
83
    $row = sql_fetsel("nom", "spip_auteurs", "id_auteur=$nouv_auteur");
84
    $nom_auteur = $row['nom'];
85
    return "<b>"._T('info_ajout_participant')."</b><br />" .
86
      "<ul><li><span class='verdana1 spip_small'><b><span class='spip_medium'>$nom_auteur</span></b></span></li>\n</ul>";
87
  }
88
  else if (count($resultat) < 16) {
89
    $res = '';
90
    $query = sql_select("*", "spip_auteurs", "id_auteur IN (" . join(',', $resultat) . ")", "", "nom");
91
92
    while ($row = sql_fetch($query)) {
93
      $id_auteur = $row['id_auteur'];
94
      $nom_auteur = $row['nom'];
95
      $email_auteur = $row['email'];
96
      $bio_auteur = $row['bio'];
97
      $res .= "\n<li><span class='spip_medium verdana1'><b>$nom_auteur</b></span>" .
98
	($email_auteur ? " ($email_auteur)" : '') .
99
	"\n <a href='" . redirige_action_auteur("editer_message","$id_message/@$id_auteur", 'message', "id_message=$id_message")
100
	. "'>" 
101
	. _T('lien_ajout_destinataire').
102
	"</a>" .
103
	(!trim($bio_auteur) ? '' :
104
	 ("<br />\n<span class='spip_x-small'>".propre(couper($bio_auteur, 100))."</span>\n")) .
105
	"</li>\n";
106
    }
107
    return  "<b>"._T('info_recherche_auteur_ok', array('cherche_auteur' => $cherche_auteur))."</b><br />" .($res ? "<ul>$res</ul>" : '');
108
  }
109
  else {
110
    return "<b>"._T('info_recherche_auteur_a_affiner', array('cherche_auteur' => $cherche_auteur))."</b><br />";
111
  }
112
}
113
114
// http://doc.spip.org/@http_ajouter_participants
115
function http_ajouter_participants($ze_auteurs, $id_message)
116
{	
117
	include_spip('inc/editer_auteurs');
118
	$cond = auteurs_autorises($ze_auteurs, "messagerie<>'non'");
119
	$all = objet_auteur_select($cond);
120
	if (!$all) return '';
121
122
	$res = "<span class='verdana1 spip_small'><b><label for='id_message'>" .
123
	  _T('bouton_ajouter_participant') ."</label> &nbsp; </b></span>\n" .
124
	  "<input type='hidden' name='id_message' id='id_message' value=\"$id_message\" />";
125
126
	if (is_numeric($all)) {
127
		$res .=  "\n<input type='text' name='cherche_auteur' id='cherche_auteur' value='' size='20' />";
128
		$res .=  "\n<input type='submit' value='"._T('bouton_chercher')."' />";
129
	} else {
130
131
		$res .=  "<select name='nouv_auteur' id='nouv_auteur' size='1' style='width: 150px'>"
132
		. $all
133
		.  "</select>"
134
		.  "<input type='submit' value='"._T('bouton_ajouter')."' />";
135
	}
136
	return redirige_action_post('editer_message', "$id_message,", 'message', "id_message=$id_message", "<div style='text-align: left'>\n$res</div>\n");
137
}
138
139
// http://doc.spip.org/@http_message_avec_participants
140
function http_message_avec_participants($id_message, $statut, $forcer_dest, $cherche_auteur, $expediteur='')
141
{
142
	global $connect_id_auteur ;
143
144
	if ($cherche_auteur) {
145
		echo "\n<div style='text-align: left' class='cadre-info'>"
146
		. http_auteurs_ressemblants($cherche_auteur , $id_message)
147
		. "\n</div>";
148
	  }
149
	$bouton = bouton_block_depliable(_T('info_nombre_partcipants'),true,"auteurs,ajouter_auteur");
150
	echo debut_cadre_enfonce("redacteurs-24.gif", true, '', $bouton, 'participants');
151
152
	//
153
	// Liste des participants
154
	//
155
156
	$result = sql_allfetsel("*", "spip_auteurs AS auteurs, spip_auteurs_messages AS lien", "lien.id_message=$id_message AND lien.id_auteur=auteurs.id_auteur");
157
158
	$total_dest = count($result);
159
160
	if ($total_dest > 0) {
161
		$ifond = 0;
162
		$res = '';
163
		$formater_auteur = charger_fonction('formater_auteur', 'inc');
164
		$t = _T('lien_retrait_particpant');
165
		foreach($result as $k => $row) {
166
			$id_auteur = $row["id_auteur"];
167
			list($status, $mail, $nom, $site,) = $formater_auteur($id_auteur, $row);
168
			if ($id_auteur == $expediteur) {
169
170
				$nom = "<span class='arial0' style='margin-left: 10px'>"
171
				.  _T('info_auteur_message')
172
				. "</span> $nom";
173
			}
174
			$class = alterner (++$ifond,'row_even','row_odd');
175
			$res .= "<tr class='$class'>\n<td class='nom'>$status $mail $nom $site$exp</td>"
0 ignored issues
show
Bug introduced by
The variable $exp does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
176
			  . "\n<td align='right' class='lien'>"
177
			  . (($id_auteur == $connect_id_auteur) ?  "&nbsp;" : ("[<a href='" . redirige_action_auteur("editer_message","$id_message/-$id_auteur", 'message', "id_message=$id_message") . "'>$t</a>]")) .  "</td></tr>\n";
178
			$result[$k] = $id_auteur;
179
		
180
		}
181
		echo
182
			debut_block_depliable(true,"auteurs"),
183
			"\n<table class='spip' width='100%'>",
184
			$res,
185
			  "</table>\n",
186
			fin_block();
187
	}
188
189
	if ($statut == 'redac' OR $forcer_dest)
190
		echo http_ajouter_participants($result, $id_message);
191
	else {
192
		echo
193
		  debut_block_depliable(true,"ajouter_auteur"),
194
		  "<br />\n<div style='text-align: right' class='verdana1 spip_small'><a href='" . generer_url_ecrire("message","id_message=$id_message&forcer_dest=oui") . "'>"._T('lien_ajouter_participant')."</a></div>",
195
		  fin_block();
196
	}
197
	echo fin_cadre_enfonce(true);
198
	return $total_dest;
199
}
200
201
// http://doc.spip.org/@http_affiche_message
202
function http_affiche_message($id_message, $expediteur, $statut, $type, $texte, $titre, $rv, $date_heure, $date_fin, $cherche_auteur, $forcer_dest)
203
{
204
  global $connect_id_auteur,$connect_statut, $les_notes; 
205
206
	if ($type == 'normal') {
207
		$le_type = _T('info_message_2').aide ("messut");
208
		$la_couleur = "#02531b";
209
		$fond = "#cffede";
210
	}
211
	else if ($type == 'pb') {
212
		$le_type = _T('info_pense_bete').aide ("messpense");
213
		$la_couleur = "#3874b0";
214
		$fond = "#edf3fe";
215
	}
216
	else if ($type == 'affich') {
217
		$le_type = _T('info_annonce');
218
		$la_couleur = "#ccaa00";
219
		$fond = "#ffffee";
220
	}
221
	
222
	// affichage des caracteristiques du message
223
224
	echo "<div style='border: 1px solid $la_couleur; background-color: $fond; padding: 5px;'>"; // debut cadre de couleur
0 ignored issues
show
Bug introduced by
The variable $la_couleur does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
Bug introduced by
The variable $fond does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
225
	//echo debut_cadre_relief("messagerie-24.gif", true);
226
	echo "\n<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
227
	echo "<tr><td>"; # uniques
228
229
	echo "<span style='color: $la_couleur' class='verdana1 spip_small'><b>$le_type</b></span><br />";
0 ignored issues
show
Bug introduced by
The variable $le_type does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
230
	echo "<span class='verdana1 spip_large'><b>$titre</b></span>";
231
	if ($statut == 'redac') {
232
		echo "<br /><span style='color: red;' class='verdana1 spip_small'><b>"._T('info_redaction_en_cours')."</b></span>";
233
	}
234
	else if ($rv == 'non') {
235
		echo "<br /><span style='color: #666666;' class='verdana1 spip_small'><b>".nom_jour($date_heure).' '.affdate_heure($date_heure)."</b></span>";
236
	}
237
238
239
	//////////////////////////////////////////////////////
240
	// Message avec participants
241
	//
242
	
243
	if ($type == 'normal')
244
	  $total_dest = http_message_avec_participants($id_message, $statut, $forcer_dest, $cherche_auteur, $expediteur);
245
246
	if ($rv != "non") http_afficher_rendez_vous($date_heure, $date_fin);
247
248
249
	//////////////////////////////////////////////////////
250
	// Le message lui-meme
251
	//
252
253
	echo "\n<br />"
254
	  . "<div class='serif'>$texte</div>";
255
256
	if ($les_notes) {
257
		echo debut_cadre_relief('', true);
258
		echo "<div dir=" . lang_dir() ."' class='arial11'>";
259
		echo justifier("<b>"._T('info_notes')."&nbsp;:</b> ".$les_notes);
260
		echo "</div>";
261
		echo fin_cadre_relief(true);
262
	}
263
264
	if ($expediteur == $connect_id_auteur AND $statut == 'redac') {
265
	  if ($type == 'normal' AND $total_dest < 2) {
0 ignored issues
show
Bug introduced by
The variable $total_dest does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
266
	    echo "<p style='color: #666666; text-align: right;' class='verdana1 spip_small'><b>"._T('avis_destinataire_obligatoire')."</b></p>";
267
	  } else {
268
	    echo "\n<div class='centered'>";
269
	    echo icone_inline(_T('icone_envoyer_message'), redirige_action_auteur('editer_message', "$id_message/publie", "message","id_message=$id_message"), "messagerie-24.gif", "creer.gif");
270
	    echo "</div>";
271
	  }
272
	}
273
	echo "</td></tr></table>\n";
274
275
	//	echo "</td></tr></table>\n"; //echo fin_cadre_relief(true);
276
	echo "</div>";			// fin du cadre de couleur
277
	
278
	// Les boutons
279
280
	$aut = ($expediteur == $connect_id_auteur);
281
	$aff = ($type == 'affich' AND $connect_statut == '0minirezo');
282
283
	echo "\n<table width='100%'><tr><td>";
284
285
	// bouton de suppression
286
287 View Code Duplication
	if ($aut AND ($statut == 'redac' OR $type == 'pb') OR $aff) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
288
	  echo icone_inline(_T('icone_supprimer_message'), redirige_action_auteur("editer_message","-$id_message", 'messagerie'), "messagerie-24.gif", "supprimer.gif", 'left');
289
	}
290
291
	// bouton retrait de la discussion
292
293 View Code Duplication
	if ($statut == 'publie' AND $type == 'normal') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
294
	  echo icone_inline(_T('icone_arret_discussion'), redirige_action_auteur("editer_message","$id_message/-$connect_id_auteur", 'messagerie', "id_message=$id_message"), "messagerie-24.gif", "supprimer.gif", 'left');
295
	}
296
297
	// bouton modifier ce message
298
299
	if ($aut OR $aff) {
300
	  echo icone_inline(_T('icone_modifier_message'), (generer_url_ecrire("message_edit","id_message=$id_message")), "messagerie-24.gif", "edit.gif", 'right');
301
	}
302
	echo "</td></tr></table>";
303
}
304
305
// http://doc.spip.org/@exec_affiche_message_dist
306
function exec_affiche_message_dist($id_message, $cherche_auteur, $forcer_dest)
307
{
308
  $row = sql_fetsel("*", "spip_messages", "id_message=$id_message");
309
  if ($row) {
310
	$id_message = $row['id_message'];
311
	$date_heure = $row["date_heure"];
312
	$date_fin = $row["date_fin"];
313
	$titre = typo($row["titre"]);
314
	$texte = propre($row["texte"]);
315
	$type = $row["type"];
316
	$statut = $row["statut"];
317
	$rv = $row["rv"];
318
	$expediteur = $row['id_auteur'];
319
320
	$lejour=journum($row['date_heure']);
321
	$lemois = mois($row['date_heure']);		
322
	$lannee = annee($row['date_heure']);		
323
324
	$commencer_page = charger_fonction('commencer_page', 'inc');
325
	echo $commencer_page($titre, "accueil", "messagerie");
326
327
	echo debut_gauche('', true);
328
	
329
	if ($rv != 'non')
330
	  echo http_calendrier_agenda ($lannee, $lemois, $lejour, $lemois, $lannee,false, generer_url_ecrire('calendrier'));
331
	
332
	echo "<br />";
333
	echo  http_calendrier_rv(quete_calendrier_taches_annonces(),"annonces");
334
	echo  http_calendrier_rv(quete_calendrier_taches_pb(),"pb");
335
	echo  http_calendrier_rv(quete_calendrier_taches_rv(), "rv");
336
337
	if ($rv != "non") {
338
		list ($sh, $ah) = quete_calendrier_interval(quete_calendrier_jour($lannee,$lemois, $lejour));
339
		foreach ($ah as $k => $v)
340
		  {
341
		    foreach ($v as $l => $e)
342
		      {
343
			if (preg_match(",=$id_message$,", $e['URL']))
344
			  {
345
			    $ah[$k][$l]['CATEGORIES'] = "calendrier-nb";
346
			    break;
347
			  }
348
		      }
349
		  }
350
		echo creer_colonne_droite('', true);	
351
352
		echo http_calendrier_ics_titre($lannee,$lemois,$lejour,generer_url_ecrire('calendrier'));
353
		echo http_calendrier_ics($lannee,$lemois, $lejour, '', '', 90, array($sh, $ah),  '', ' calendrier-msg');
354
	}
355
356
	echo debut_droite('', true);
357
358
	http_affiche_message($id_message, $expediteur, $statut, $type, $texte, $titre, $rv, $date_heure, $date_fin, $cherche_auteur, $forcer_dest);
359
360
	// reponses et bouton poster message
361
362
	$discuter = charger_fonction('discuter', 'inc');
363
	echo $discuter($id_message, 'message', 'id_message', "perso");
364
  }
365
366
  echo fin_gauche(), fin_page();
367
}
368
369
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
370