Bonjour à tous,

Je vous sollicite aujourd'hui pour vous exposer mon soucis.

J'ai ce code la : function.php

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
<?
function recurse_entity($entity_id){
global $entity,$s,$e,$resp,$resp2;
$query="SELECT entity_title,higher_entity_id FROM entities WHERE entity_id='$entity_id'";
$res=mysql_query($query);
$row=mysql_fetch_array($res);
mysql_free_result($res);
  if($resp==$s."_".$entity_id)$entity[$e]="(Manager) ";
  if($resp2==$s."_".$entity_id)$entity[$e]="(Manager 2) ";
    $entity[$e].=$row[entity_title];
  if($row[higher_entity_id]!=0&&$row[higher_entity_id]!=1){
    $entity_id=$row[higher_entity_id];
    $e++;
    recurse_entity($entity_id);
    }
return $entity;
}
 
function displayEntity($entity_id = 1, $cur_level = 1, $max_level = 10, $links = '')
{
    global $database_organisation, $organisation;
 
    if ($cur_level > $max_level) return;
 
    // lien à faire
    $link_level = '';
    $tabLinks = explode('|', $links);
    for ($iLink=0; $iLink < count($tabLinks); $iLink++) {
        $tabLevel = explode('-', $tabLinks[$iLink]);
        if ($tabLevel[0] == $cur_level) $link_level = $tabLevel[1];
        if ($tabLevel[0] == '*') $link_level = $tabLevel[1];       
    }
 
    $colname_rsEmployees = "1";
    if (isset($entity_id)) {
      $colname_rsEmployees = (get_magic_quotes_gpc()) ? $entity_id : addslashes($entity_id);
    }
    mysql_select_db($database_organisation, $organisation);
    $query_rsEmployees = sprintf("SELECT employee_id, lastname, firstname, login, job_title FROM employees WHERE entity_id = %s ORDER BY sort_order ASC", $colname_rsEmployees);
    $rsEmployees = mysql_query($query_rsEmployees, $organisation) or die(mysql_error());
    $row_rsEmployees = mysql_fetch_assoc($rsEmployees);
    $totalRows_rsEmployees = mysql_num_rows($rsEmployees);
 
    $colname_rsEntity = "1";
    if (isset($entity_id)) {
      $colname_rsEntity = (get_magic_quotes_gpc()) ? $entity_id : addslashes($entity_id);
    }
    mysql_select_db($database_organisation, $organisation);
    $query_rsEntity = sprintf("SELECT en.entity_id, en.entity_title, en.resp_employee_id, en.resp2_employee_id, resp1.firstname as firstname1, resp1.lastname as lastname1, resp1.login as login1, resp1.job_title as job_title1, resp1.email as email1, resp1.phone as phone1, resp1.ext as ext1, resp1.mobile as mobile1, resp2.firstname as firstname2, resp2.lastname as lastname2, resp2.login as login2, resp2.job_title as job_title2, resp2.email as email2, resp2.phone as phone2, resp2.ext as ext2, resp2.mobile as mobile2 FROM entities as en LEFT JOIN employees as resp1 ON en.resp_employee_id = resp1.employee_id LEFT JOIN employees as resp2 ON en.resp2_employee_id = resp2.employee_id WHERE en.entity_id = %s", $colname_rsEntity);
    $rsEntity = mysql_query($query_rsEntity, $organisation) or die(mysql_error());
    $row_rsEntity = mysql_fetch_assoc($rsEntity);
    $totalRows_rsEntity = mysql_num_rows($rsEntity);
 
    $colname_rsSubEntities = "1";
    if (isset($entity_id)) {
      $colname_rsSubEntities = (get_magic_quotes_gpc()) ? $entity_id : addslashes($entity_id);
    }
    mysql_select_db($database_organisation, $organisation);
    $query_rsSubEntities = sprintf("SELECT entity_id, entity_title FROM entities WHERE higher_entity_id = %s ORDER BY sort_order", $colname_rsSubEntities);
    $rsSubEntities = mysql_query($query_rsSubEntities, $organisation) or die(mysql_error());
    $row_rsSubEntities = mysql_fetch_assoc($rsSubEntities);
    $totalRows_rsSubEntities = mysql_num_rows($rsSubEntities);
?>
<?php
    $cardphoto = 'photos/nobody.jpg';
    $cardname = '&nbsp;';
    $cardjob = '&nbsp;';
    $email = '';
    $emailtitle = 'E-mail: not available';
    $emaillink = '';
    $cardphone = 'Phone: not available';
    $cardphoneext = '';
    $cardmobile = '&nbsp;';
    if ($row_rsEntity['resp_employee_id'] != 0) {
        if (file_exists('photos/'.$row_rsEntity['login1'].'.jpg')) {
            $cardphoto = 'photos/'.$row_rsEntity['login1'].'.jpg';
        }
        $cardname = $row_rsEntity['firstname1'].' '.$row_rsEntity['lastname1'];
        if ($row_rsEntity['job_title1'] != '') {
            $cardjob = $row_rsEntity['job_title1'];
        }
        if ($row_rsEntity['email1'] != '') {
            $email = $row_rsEntity['email1'];
            $emailtitle = 'E-mail: ';
            $emaillink = 'mailto:'.$email;
        }
        if ($row_rsEntity['phone1'] != '') {
            $cardphone = "Phone: " . $row_rsEntity['phone1'];
            if ($row_rsEntity['ext1'] != '') {
                $cardphoneext = ' (Ext. ' . $row_rsEntity['ext1'] . ')';
            }
        }
        if ($row_rsEntity['mobile1'] != '') {
            $cardmobile = "Mobile: " . $row_rsEntity['mobile1'];
        }
    } else if ($row_rsEntity['resp2_employee_id'] != 0) {
        if (file_exists('photos/'.$row_rsEntity['login2'].'.jpg')) {
            $cardphoto = 'photos/'.$row_rsEntity['login2'].'.jpg';
        }
        $cardname = $row_rsEntity['firstname2'].' '.$row_rsEntity['lastname2'];
        if ($row_rsEntity['job_title2'] != '') {
            $cardjob = $row_rsEntity['job_title2'];
        }
        if ($row_rsEntity['email2'] != '') {
            $email = $row_rsEntity['email2'];
            $emailtitle = 'E-mail: ';
            $emaillink = 'mailto:'.$email;
        }
        if ($row_rsEntity['phone2'] != '') {
            $cardphone = "Phone: " . $row_rsEntity['phone2'];
            if ($row_rsEntity['ext2'] != '') {
                $cardphoneext = ' (Ext. ' . $row_rsEntity['ext2'] . ')';
            }
        }
        if ($row_rsEntity['mobile2'] != '') {
            $cardmobile = "Mobile: " . $row_rsEntity['mobile2'];
        }
    }
 
?>
<div class="level<?php echo $cur_level; ?>">
    <div class="entity-title">
        <?php if ($link_level != '') { ?>
        <h1><a href="index.php?entity_id=<?php echo $row_rsEntity['entity_id']; ?>&max_level=<?php echo $link_level; ?>&lnk="><?php echo $row_rsEntity['entity_title']; ?></a></h1>
        <?php } else { ?>
        <h1><?php echo "<font color=\"#FFFFFF\">".$row_rsEntity['entity_title']."<font color=\"#FFFFFF\">"; ?></h1>
        <?php } ?>
        <?php if ($row_rsEntity['resp_employee_id'] != 0) { ?>
        <h2><a href="#" onmouseover="xajax_updatecard(<?php echo $row_rsEntity['resp_employee_id']; ?>);"><?php echo $row_rsEntity['firstname1']; ?> <?php echo $row_rsEntity['lastname1']; ?></a><?php if ($row_rsEntity['job_title1'] != '') {?> - <span class="job-title"><?php echo $row_rsEntity['job_title1']; ?></span><?php } ?></h2>
        <?php } ?>
        <?php if ($row_rsEntity['resp2_employee_id'] != 0) { ?>
        <h2><a href="#" onmouseover="xajax_updatecard(<?php echo $row_rsEntity['resp2_employee_id']; ?>);"><?php echo $row_rsEntity['firstname2']; ?> <?php echo $row_rsEntity['lastname2']; ?></a><?php if ($row_rsEntity['job_title2'] != '') {?> - <span class="job-title"><?php echo $row_rsEntity['job_title2']; ?></span><?php } ?></h2>
        <?php } ?>
    </div>
    <?php if ($cur_level != $max_level) { ?>
    <div class="employees">
    <?php if ($totalRows_rsEmployees > 0) { // Show if recordset not empty ?>
    <ul>
        <?php do { ?>
        <li><img src="images/separator.gif"><a href="#" onmouseover="xajax_updatecard(<?php echo $row_rsEmployees['employee_id']; ?>);"><?php echo $row_rsEmployees['firstname']; ?> <?php echo $row_rsEmployees['lastname']; ?></a><?php if ($row_rsEmployees['job_title'] != '') {?> - <span class="job-title"><?php echo $row_rsEmployees['job_title']; ?></span><?php } ?></li>
        <?php } while ($row_rsEmployees = mysql_fetch_assoc($rsEmployees)); ?>
    </ul>
    <?php } // Show if recordset not empty ?>
    </div>
    <?php } ?>
    <?php if ($totalRows_rsSubEntities > 0) { // Show if recordset not empty ?>
    <div class="sub-entities">
    <?php
    do {
        displayEntity($row_rsSubEntities['entity_id'], $cur_level+1, $max_level, $links);
    } while ($row_rsSubEntities = mysql_fetch_assoc($rsSubEntities));
    ?>
    </div>
    <?php } // Show if recordset not empty ?>
</div>
<?php if ($cur_level == 1) { ?>
<!--[if lt IE 7]>
</div>
<![endif]-->
<div id="oFIXED">
  <div id="card"> <img id="cardphoto" src="<?php echo $cardphoto; ?>">
    <div id="carddetail">
      <h1 id="cardname">
        <?php echo "<font color=\"#000000\">".$cardname."</font>"; ?>
      </h1>
      <h2 id="cardjob">
        <?php echo "<font color=\"#000000\">".$cardjob."<font color=\"#000000\">"; ?>
      </h2>
      <p id="cardemail">
        <span id="emailtitle"><?php echo $emailtitle; ?></span><a id="emaillink" href="<?php echo $emaillink; ?>"><?php echo $email; ?></a>
      </p>
      <p id="cardphone">
        <span id="phone"><?php echo $cardphone; ?></span><span id="phoneext" class="phoneext"><?php echo $cardphoneext; ?></span>
      </p>
      <p id="cardmobile">
        <?php echo "<font color=\"#000000\">".$cardmobile."</font>"; ?>
      </p>
    </div>
  </div>
</div>
<?php } ?>
<?php
mysql_free_result($rsEmployees);
 
mysql_free_result($rsEntity);
 
mysql_free_result($rsSubEntities);
}
?>
<?php function displayNavigation($entity_id = 1, $links='')
{
    global $database_organisation, $organisation;
 
    if ($entity_id == 0) return 1;
 
    $colname_rsEntity = "1";
    if (isset($entity_id)) {
      $colname_rsEntity = (get_magic_quotes_gpc()) ? $entity_id : addslashes($entity_id);
    }
    mysql_select_db($database_organisation, $organisation);
    $query_rsEntity = sprintf("SELECT higher_entity_id FROM entities WHERE entity_id = %s", $colname_rsEntity);
    $rsEntity = mysql_query($query_rsEntity, $organisation) or die(mysql_error());
    $row_rsEntity = mysql_fetch_assoc($rsEntity);
    $totalRows_rsEntity = mysql_num_rows($rsEntity);
 
    $colname_rsSiblingEntities = $row_rsEntity['higher_entity_id'];
    mysql_select_db($database_organisation, $organisation);
    $query_rsSiblingEntities = sprintf("SELECT entity_id, entity_title FROM entities WHERE higher_entity_id = %s ORDER BY sort_order", $colname_rsSiblingEntities);
    $rsSiblingEntities = mysql_query($query_rsSiblingEntities, $organisation) or die(mysql_error());
    $row_rsSiblingEntities = mysql_fetch_assoc($rsSiblingEntities);
    $totalRows_rsSiblingEntities = mysql_num_rows($rsSiblingEntities);
 
    $cur_level = displayNavigation($row_rsEntity['higher_entity_id'], $links);
 
    // lien à faire
    $link_level = '';
    $tabLinks = explode('|', $links);
    for ($iLink=0; $iLink < count($tabLinks); $iLink++) {
        $tabLevel = explode('-', $tabLinks[$iLink]);
        if ($tabLevel[0] == $cur_level) $link_level = $tabLevel[1];
        if ($tabLevel[0] == '*') $link_level = $tabLevel[1];       
    }
 
?>
<div class="nav<?php
echo $cur_level;
?>"><ul><?php
    do { ?><?php
        if ($link_level != '') {
        ?><li <?php
            if ($row_rsSiblingEntities['entity_id']==$entity_id) {
            ?>class="selected" <?php
            }
        ?>><a href="index.php?entity_id=<?php
        echo $row_rsSiblingEntities['entity_id'];
        ?>&max_level=<?php
        echo $link_level;
        ?><?php
            if ($row_rsSiblingEntities['entity_id']!=1) {
            ?>&lnk=<?php
            } ?>"><?php
        echo $row_rsSiblingEntities['entity_title'];
        ?></a></li><?php
        } else {
        ?><li <?php
            if ($row_rsSiblingEntities['entity_id']==$entity_id) {
            ?>class="selected" <?php
            } ?>><?php
        echo $row_rsSiblingEntities['entity_title'];
        ?></li><?php
        } ?><?php
    }
    while ($row_rsSiblingEntities = mysql_fetch_assoc($rsSiblingEntities));
    ?></ul></div>
<?php
mysql_free_result($rsEntity);
mysql_free_result($rsSiblingEntities);
return $cur_level + 1;
}
 
function http_post_all($champmoins){
//echo $champmoins;
global $_POST;
$tabchampmoins=explode(",",$champmoins);
  foreach($tabchampmoins as $tcm=>$tabchmp){
  $testchampmoins[$tabchmp]=$tabchmp;
  }
  foreach($_POST as $h=>$post){
    if($h!=$testchampmoins[$h]){
    echo "<INPUT TYPE=\"HIDDEN\" name=\"$h\" value=\"".$_POST[$h]."\">\n";
    }
  }
}
 
function clean($chars){
$chars=ereg_replace("é","é",$chars);
$chars=ereg_replace("’","'",$chars);
$chars=ereg_replace("Ã","à",$chars);
$chars=ereg_replace("à¨","è",$chars);
$chars=ereg_replace("ê","ê",$chars);
$chars=ereg_replace("à«","ë",$chars);
$chars=ereg_replace("à§","ç",$chars);
$chars=ereg_replace("ç","ç",$chars);
$chars=ereg_replace("ù","ù",$chars);
$chars=ereg_replace("à¢","â",$chars);
$chars=ereg_replace("à¼","ü",$chars);
$chars=ereg_replace("à«","ë",$chars);
$chars=ereg_replace("à¯","ï",$chars);
$chars=ereg_replace("à´","ô",$chars);
return $chars;
}
 
function tree_entityId_from_Id($entityId){
global $tree,$_GET;
$query="SELECT entity_id,entity_title FROM entities WHERE higher_entity_id='$entityId'";
/*echo $query;
echo "<br/>";*/
$res=mysql_query($query);
  if($res){
    while($row=mysql_fetch_array($res)){
    $tree[$entityId][$row['entity_id']]=$row['entity_title'];
    tree_entityId_from_Id($row['entity_id']);
    }
    }
return $tree;
}
 
function tree_from_entity($entityId,$stop=""){
global $entitie_tree;
$query="SELECT entity_title,higher_entity_id FROM entities WHERE entity_id='$entityId'";
/*echo $query;
echo "<br/>";*/
$res2=mysql_query($query);
  if($res2){
    $row=mysql_fetch_array($res2);
    $entitie_tree.=$row['entity_title']." / ";
    $entityId=$row['higher_entity_id'];
    mysql_free_result($res2);
      if($entityId&&$stop!=$entityId)tree_from_entity($entityId,$stop);
    }
}
 
function tree_user_from_entity($entityId){
global $tree,$query_user_from_entity;
/*echo $entityId;
echo "<br/>";*/
tree_entityId_from_Id($entityId);
$count=0;
$query_user_from_entity="SELECT DISTINCT entities.entity_id,employee_id,entity_title,lastname,firstname,email,phone,ext,mobile,job_title FROM employees,entities WHERE ";
$query_user_from_entity.="(employees.entity_id=entities.entity_id OR employees.employee_id=entities.resp_employee_id";
$query_user_from_entity.=" OR employees.employee_id=entities.resp2_employee_id) AND ";
  if(is_array($tree)){
    foreach($tree as $t=>$tval){
    $tab_query[$count]=$t;
    $count++;
      if(is_array($tval)){
            foreach($tval as $tv=>$tvval){
            $tab_query[$count]=$tv;
            $count++;
                }
            }
        }
        foreach($tab_query as $tq=>$tqval){
          if($tq===0){
            $query_user_from_entity.="(entities.entity_id='$tqval'";
            }else{
            $query_user_from_entity.=" OR entities.entity_id='$tqval'";
            }
        }
    $query_user_from_entity.=") ORDER BY higher_entity_id,entity_title ASC";
    /*echo "<pre>";
  print_r($tab_query);
  echo "</pre>";*/ 
    }else{
    $query_user_from_entity.=" entities.entity_id='$entityId'";
    }
return $query_user_from_entity;
}
 
function tree_entity($entityId){
global $services;
$query="SELECT entity_id,entity_title FROM entities WHERE higher_entity_id='$entityId'";
/*echo $query;
echo "<br/>";*/
$res=mysql_query($query);
  if($res){
    while($row=mysql_fetch_array($res)){
    $services[$entityId][$row['entity_id']]=$row['entity_title'];
        tree_entity($row['entity_id']);
    }
    }
return $services;
}
 
function users_from_entity_tree($services){
global $query_users_from_entity_tree;
  $query_users_from_entity_tree="SELECT DISTINCT employee_id,firstname,lastname,ext,phone FROM employees,entities ";
    $query_users_from_entity_tree.="WHERE (employees.entity_id=entities.entity_id OR employees.employee_id=resp_employee_id ";
    $query_users_from_entity_tree.="OR employees.employee_id=resp2_employee_id) AND (";
    $q=1;
        foreach($services as $s=>$sval){
        //echo $q."<br/>";
          if($q!=1)$query_users_from_entity_tree.=" OR ";
        $query_users_from_entity_tree.="entities.entity_id=$s";
          if(is_array($sval)){
                foreach($sval as $se=>$seval){
                $query_users_from_entity_tree.=" OR entities.entity_id=$se";
                }
            }
        $q++;
        }
    $query_users_from_entity_tree.=") ORDER BY firstname";
    //echo $query_users_from_entity_tree."<br/>";
return $query_users_from_entity_tree;
}
 
function forum_color($i){
  if(is_int($i/2)){
    return "#FFFFFF";
    }else{
    return "#F5F5F5";
    }
}
?>

et l'erreur :

Parse error: syntax error, unexpected '}' in C:\wamp\www\organization\function.php on line 188
Sauf que je ne comprends pas pourquoi .. Auriez-vous une idée ?

ps: C'est le code d'une application de trombinoscope. On me l'a donnée et je l'ai mis localement sur wamp. J'ai adapter la connexion à la base de données.

Merci pour votre futur aide