gateway.php 14.6 KB
Newer Older
Ayolo's avatar
Ayolo committed
1 2 3 4 5 6 7 8
<?php
/* Copyright 2006-2007
 * - Julien Etelain < julien at pmad dot net >
 *
 * Ce fichier fait partie du site de l'Association des Étudiants de
 * l'UTBM, http://ae.utbm.fr.
 *
 * This program is free software; you can redistribute it and/or
Ayolo's avatar
Ayolo committed
9
 * modify it under the terms of the GNU General Public License a
Ayolo's avatar
Ayolo committed
10 11 12 13 14 15 16 17 18 19 20 21 22
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 */
23

Ayolo's avatar
Ayolo committed
24 25 26 27 28 29
$topdir = "./";
require_once($topdir. "include/site.inc.php");

$site = new site();

if ( isset($_REQUEST['topdir']) && ($_REQUEST['topdir']=="./" || $_REQUEST['topdir'] =="../" || $_REQUEST['topdir'] =="./../") )
Ayolo's avatar
perdu  
Ayolo committed
30
  $wwwtopdir = $_REQUEST['topdir'];
Ayolo's avatar
Ayolo committed
31 32 33

if ( $_REQUEST['module']=="fsearch" )
{
jlaval's avatar
jlaval committed
34
  header("Content-Type: text/html; charset=UTF-8");
35

jlaval's avatar
jlaval committed
36
  if ($_REQUEST["pattern"] == "")
Ayolo's avatar
perdu  
Ayolo committed
37
    exit();
38

39
  $content = null;
jlaval's avatar
jlaval committed
40
  if ($site->user->is_valid() && $site->user->cotisant) {
41 42 43
      require_once($topdir. "include/lib/predis/Predis.php");
      $redis = new Predis_Client ();
      $content = $redis->get (strtolower ($_REQUEST["pattern"]));
jlaval's avatar
jlaval committed
44
  }
45 46 47 48

  if ($content == null) {
      require_once($topdir. "include/cts/fsearch.inc.php");
      $fsearch = new fsearch ( $site, false );
jlaval's avatar
jlaval committed
49
      $content = $fsearch->buffer;
50 51
  }

jlaval's avatar
jlaval committed
52 53
  echo $content;
  exit ();
Ayolo's avatar
Ayolo committed
54 55 56
}
elseif ( $_REQUEST['module']=="explorer" )
{
Ayolo's avatar
perdu  
Ayolo committed
57
  header("Content-Type: text/html; charset=utf-8");
Ayolo's avatar
Ayolo committed
58 59 60

  require_once($topdir."include/entities/files.inc.php");
  require_once($topdir."include/entities/folder.inc.php");
61

Ayolo's avatar
Ayolo committed
62
  $folder = new dfolder($site->db);
63

Ayolo's avatar
Ayolo committed
64 65 66 67
  if ( !isset($_REQUEST["id_folder"]) || !$_REQUEST["id_folder"] )
    $folder->id = null;
  else
    $folder->load_by_id($_REQUEST["id_folder"]);
68

Ayolo's avatar
Ayolo committed
69
  $field = $_REQUEST["field"];
70

Ayolo's avatar
Ayolo committed
71 72 73 74 75 76
  if ( is_null($folder->id) )
    $sub1 = new requete($this->db,"SELECT `d_folder`.`id_folder`, ".
    "IF(`asso`.`id_asso` IS NULL,`d_folder`.`titre_folder`, `asso`.`nom_asso`) AS `titre_folder` ".
    "FROM `d_folder` ".
    "LEFT JOIN `asso` ON `asso`.`id_asso` = `d_folder`.`id_asso` ".
    "WHERE `d_folder`.`id_folder_parent` IS NULL ".
77 78
    "ORDER BY `asso`.`nom_asso`");
  else
Ayolo's avatar
Ayolo committed
79
    $sub1 = $folder->get_folders ( $site->user );
80

Ayolo's avatar
Ayolo committed
81 82 83 84 85 86
  $fd = new dfolder(null);
  while ( $row = $sub1->get_row() )
  {
    $fd->_load($row);
    echo "<li><a href=\"#\" onclick=\"zd_seldir('$field','".$fd->id."','$wwwtopdir'); return false;\"><img src=\"".$wwwtopdir."images/icons/16/folder.png\" alt=\"dossier\" /> ".htmlentities($fd->titre,ENT_COMPAT,"UTF-8")."</a><ul id=\"".$field."_".$fd->id."_cts\" style=\"display:none;\"></ul></li>";
  }
87

Ayolo's avatar
Ayolo committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101
  if ( !is_null($folder->id) )
  {
    $sub2 = $folder->get_files ( $site->user);
    $fd = new dfile(null);
    while ( $row = $sub2->get_row() )
    {
      $fd->_load($row);
      $img = $wwwtopdir."images/icons/16/".$fd->get_icon_name();
      echo "<li><a href=\"#\" onclick=\"zd_selfile('$field','".$fd->id."','$wwwtopdir'); return false;\"><img src=\"$img\" alt=\"fichier\" /> ".htmlentities($fd->titre,ENT_COMPAT,"UTF-8")."</a></li>";
    }
  }
}
elseif ( $_REQUEST['module']=="usersession" )
{
Ayolo's avatar
perdu  
Ayolo committed
102 103 104 105
  /**** NOTE IMPORTANTE ****
   * En raison de ce module, les valeurs de $_SESSION["usersession"] ne peuvent être
   * considéré comme "sûres"
   */
106

Ayolo's avatar
perdu  
Ayolo committed
107 108 109
  if ( isset($_REQUEST["set"]) )
  {
    $_SESSION["usersession"][$_REQUEST["set"]]   = $_REQUEST["value"];
110 111


Ayolo's avatar
perdu  
Ayolo committed
112
    if ( $site->user->is_valid() ) // mémorise le usersession
113 114
      $site->user->set_param("usersession",$_SESSION["usersession"]);

Ayolo's avatar
Ayolo committed
115

Ayolo's avatar
perdu  
Ayolo committed
116 117
    //echo "alert('".$_REQUEST["set"]."=".$_REQUEST["set"]."');";
  }
118 119

  exit();
Ayolo's avatar
Ayolo committed
120 121 122
}
elseif ( $_REQUEST['module']=="userfield" )
{
123 124 125
  header("Content-Type: text/javascript; charset=UTF-8");
  $buffer="";

Ayolo's avatar
perdu  
Ayolo committed
126
  if ( !$site->user->is_valid() && !count($_SESSION["Comptoirs"])) exit();
Ayolo's avatar
Ayolo committed
127

Ayolo's avatar
perdu  
Ayolo committed
128
  $pattern = mysql_real_escape_string($_REQUEST["pattern"]);
Ayolo's avatar
Ayolo committed
129

Ayolo's avatar
perdu  
Ayolo committed
130 131 132 133
  $pattern = ereg_replace("(e|é|è|ê|ë|É|È|Ê|Ë)","(e|é|è|ê|ë|É|È|Ê|Ë)",$pattern);
  $pattern = ereg_replace("(a|à|â|ä|À|Â|Ä)","(a|à|â|ä|À|Â|Ä)",$pattern);
  $pattern = ereg_replace("(i|ï|î|Ï|Î)","(i|ï|î|Ï|Î)",$pattern);
  $pattern = ereg_replace("(c|ç|Ç)","(c|ç|Ç)",$pattern);
Ayolo's avatar
bleh  
Ayolo committed
134
  $pattern = ereg_replace("(o|O|ò|Ò|ô|Ô)","(o|O|ò|Ò|ô|Ô)",$pattern);
Ayolo's avatar
perdu  
Ayolo committed
135 136
  $pattern = ereg_replace("(u|ù|ü|û|Ü|Û|Ù)","(u|ù|ü|û|Ü|Û|Ù)",$pattern);
  $pattern = ereg_replace("(n|ñ|Ñ)","(n|ñ|Ñ)",$pattern);
137 138

  $req = new requete($site->db,
Ayolo's avatar
perdu  
Ayolo committed
139 140 141 142 143 144 145 146 147 148
    "SELECT `id_utilisateur`,CONCAT(`prenom_utl`,' ',`nom_utl`) " .
    "FROM `utilisateurs` " .
    "WHERE CONCAT(`prenom_utl`,' ',`nom_utl`) REGEXP '^".$pattern."' " .
    "UNION SELECT `id_utilisateur`,CONCAT(`nom_utl`,' ',`prenom_utl`) " .
    "FROM `utilisateurs` " .
    "WHERE CONCAT(`nom_utl`,' ',`prenom_utl`) REGEXP '^".$pattern."' " .
    "UNION SELECT `utilisateurs`.`id_utilisateur`,CONCAT(`surnom_utbm`,' (',`prenom_utl`,' ',`nom_utl`,')') " .
    "FROM `utl_etu_utbm` " .
    "INNER JOIN `utilisateurs` ON `utl_etu_utbm`.`id_utilisateur` = `utilisateurs`.`id_utilisateur` " .
    "WHERE `surnom_utbm`!='' AND `surnom_utbm` REGEXP '^".$pattern."' " .
149 150
    "ORDER BY 2 LIMIT 10");

Ayolo's avatar
perdu  
Ayolo committed
151 152
  if ( !$req || $req->errno != 0) // Si l'expression régulière envoyée par l'utilisateur est invalide, on évite l'erreur mysql
  {
153 154 155
    $buffer .=  "<ul>";
    $buffer .=  "<li>Recherche invalide.</li>";
    $buffer .=  "</ul>";
156
    $buffer .=  "<div class=\"clearboth\"></div>";
157 158 159
    exit();
  }

160
  $buffer .=  "<ul>";
161

Ayolo's avatar
perdu  
Ayolo committed
162 163
  while ( list($id,$email) = $req->get_row() )
  {
164
    $buffer .=  "<li><div class=\"imguser\"><img src=\"";
165

Ayolo's avatar
perdu  
Ayolo committed
166
    if (file_exists($topdir."var/img/matmatronch/".$id.".identity.jpg"))
167
      $buffer .=  $wwwtopdir."var/img/matmatronch/".$id.".identity.jpg";
Ayolo's avatar
perdu  
Ayolo committed
168
    elseif (file_exists($topdir."var/img/matmatronch/".$id.".jpg"))
169
      $buffer .=  $wwwtopdir."var/img/matmatronch/".$id.".jpg";
Ayolo's avatar
Ayolo committed
170
    else
171
      $buffer .=  $wwwtopdir."var/img/matmatronch/na.gif";
172

173
    $buffer .=  "\" /></div><a href=\"#\" onclick=\"userselect_set_user('$wwwtopdir','".$_REQUEST["ref"]."',$id,'".addslashes(htmlspecialchars($email))."'); return false;\">".htmlspecialchars($email)."</a></li>";
Ayolo's avatar
perdu  
Ayolo committed
174
  }
175
  $buffer .=  "</ul>";
176 177 178 179 180 181 182 183
  $buffer .=  "<div class=\"clearboth\"></div>";

  // si la requete a été trop longue on ne l'affiche pas !
  echo "if ( ".$_REQUEST['userselect_sequence']." > userselect_actual_sequence ) {\n";
  echo "  userselect_actual_sequence=".$_REQUEST['userselect_sequence'].";\n";
  echo "  var content = document.getElementById('".$_REQUEST['ref']."_result');\n";
  echo "  content.innerHTML ='".addslashes($buffer)."';\n";
  echo "}\n";
Ayolo's avatar
Ayolo committed
184 185 186
}
elseif ( $_REQUEST['module']=="userinfo" )
{
Ayolo's avatar
perdu  
Ayolo committed
187
  if ( !$site->user->is_valid() && !count($_SESSION["Comptoirs"])) exit();
188

Ayolo's avatar
perdu  
Ayolo committed
189
  $user = new utilisateur($site->db,$site->dbrw);
190
  $user->load_by_id($_REQUEST["id_utilisateur"]);
Ayolo's avatar
perdu  
Ayolo committed
191 192
  if ( $user->id < 0 )
    $user = &$site->user;
193

Ayolo's avatar
perdu  
Ayolo committed
194 195 196 197
  if (file_exists($topdir."var/img/matmatronch/".$user->id.".identity.jpg"))
    echo "<img src=\"".$wwwtopdir."var/img/matmatronch/".$user->id.".jpg\" alt=\"\" />\n";
  else
    echo "<img src=\"".$wwwtopdir."var/img/matmatronch/na.gif"."\" alt=\"\" />\n";
198

Ayolo's avatar
perdu  
Ayolo committed
199 200 201 202 203
  echo "<p class=\"nomprenom\">". $user->prenom . " " . $user->nom . "</p>";
  if ( $user->surnom )
    echo "<p class=\"surnom\">'' ". $user->surnom . " ''</p>";
  echo "<div class=\"clearboth\"></div>";
  exit();
Ayolo's avatar
Ayolo committed
204 205 206 207
}
elseif ( $_REQUEST['module']=="entinfo" )
{
  $class = $_REQUEST['class'];
208

Ayolo's avatar
Ayolo committed
209
  if ( class_exists($class) )
Ayolo's avatar
perdu  
Ayolo committed
210
    $std = new $class($site->db);
211

Ayolo's avatar
Ayolo committed
212 213 214 215
  elseif ( isset($GLOBALS["entitiescatalog"][$class][5]) && $GLOBALS["entitiescatalog"][$class][5] )
  {
    include($topdir."include/entities/".$GLOBALS["entitiescatalog"][$class][5]);
    if ( class_exists($class) )
Ayolo's avatar
perdu  
Ayolo committed
216
      $std = new $class($site->db);
Ayolo's avatar
Ayolo committed
217
  }
218

219 220 221 222
  if ($class=="utilisateur")
    $std->load_all_by_id($_REQUEST['id']);
  else
    $std->load_by_id($_REQUEST['id']);
223

Ayolo's avatar
Ayolo committed
224 225 226
  if ( !$std->is_valid() )
  {
    echo "?";
227
    exit();
Ayolo's avatar
Ayolo committed
228
  }
229

Ayolo's avatar
Ayolo committed
230
  if ( !$std->allow_user_consult($site->user) )
231 232
    exit();

Ayolo's avatar
Ayolo committed
233 234
  if ( $std->can_preview() )
    echo "<p class=\"stdpreview\"><img src=\"".$wwwtopdir.$std->get_preview()."\" alt=\"".htmlentities($std->get_display_name(),ENT_COMPAT,"UTF-8")."\" /></p>";
235

Ayolo's avatar
Ayolo committed
236 237
  echo "<p class=\"stdinfo\">".$std->get_html_extended_info()."</p>";
  echo "<div class=\"clearboth\"></div>";
238
  exit();
Ayolo's avatar
Ayolo committed
239 240

}
Feu's avatar
test  
Feu committed
241 242 243
elseif ( $_REQUEST['module']=="entdesc" )
{
  $class = $_REQUEST['class'];
244

Feu's avatar
test  
Feu committed
245
  if ( class_exists($class) )
Ayolo's avatar
perdu  
Ayolo committed
246
    $std = new $class($site->db);
247

Feu's avatar
test  
Feu committed
248 249 250 251
  elseif ( isset($GLOBALS["entitiescatalog"][$class][5]) && $GLOBALS["entitiescatalog"][$class][5] )
  {
    include($topdir."include/entities/".$GLOBALS["entitiescatalog"][$class][5]);
    if ( class_exists($class) )
Ayolo's avatar
perdu  
Ayolo committed
252
      $std = new $class($site->db);
Feu's avatar
test  
Feu committed
253
  }
254

Feu's avatar
test  
Feu committed
255
  $std->load_by_id($_REQUEST['id']);
256

Feu's avatar
test  
Feu committed
257 258 259
  if ( !$std->is_valid() )
  {
    echo "?";
260
    exit();
Feu's avatar
test  
Feu committed
261
  }
262

Feu's avatar
test  
Feu committed
263
  if ( !$std->allow_user_consult($site->user) )
264 265
    exit();

Feu's avatar
test  
Feu committed
266
  echo htmlentities($std->get_description(),ENT_NOQUOTES,"UTF-8");
267 268

  exit();
Feu's avatar
test  
Feu committed
269
}
Ayolo's avatar
Ayolo committed
270 271 272 273
elseif ( $_REQUEST['module']=="fsfield" )
{
  $class = $_REQUEST['class'];
  $field = $_REQUEST['field'];
274 275


Ayolo's avatar
Ayolo committed
276 277
  if ( !ereg("^([a-z0-9]*)$",$class) )
    exit();
278

Ayolo's avatar
Ayolo committed
279
  $std = null;
280

Ayolo's avatar
Ayolo committed
281
  if ( class_exists($class) )
Ayolo's avatar
perdu  
Ayolo committed
282
    $std = new $class($site->db);
283

Ayolo's avatar
Ayolo committed
284 285 286 287
  elseif ( isset($GLOBALS["entitiescatalog"][$class][5]) && $GLOBALS["entitiescatalog"][$class][5] )
  {
    include($topdir."include/entities/".$GLOBALS["entitiescatalog"][$class][5]);
    if ( class_exists($class) )
Ayolo's avatar
perdu  
Ayolo committed
288
      $std = new $class($site->db);
Ayolo's avatar
Ayolo committed
289 290 291
  }

  if ( is_null($std) )
292 293
    exit();

Ayolo's avatar
Ayolo committed
294
  if ( !$std->can_fsearch() )
295 296
    exit();

Ayolo's avatar
Ayolo committed
297
  if ( !$std->allow_user_consult($site->user) )
298 299
    exit();

Ayolo's avatar
Ayolo committed
300 301
  if ( $_REQUEST['pattern'] != "" )
  {
Ayolo's avatar
bleh  
Ayolo committed
302 303 304
    $conds=array();
    if(isset($_REQUEST['conds']) && !empty($_REQUEST['conds']) && is_array($_REQUEST['conds']))
      $conds=$_REQUEST['conds'];
Ayolo's avatar
bleh  
Ayolo committed
305
    $res = $std->fsearch ( $_REQUEST['pattern'], 6 , $conds);
Ayolo's avatar
Ayolo committed
306 307
    if ( !is_null($res) )
    {
Ayolo's avatar
perdu  
Ayolo committed
308 309 310 311
      $buffer = "<ul class=\"fsfield_list\">";
      foreach ( $res as $id => $name )
      {
        $buffer .= "<li>";
312

Ayolo's avatar
perdu  
Ayolo committed
313 314 315 316 317 318 319
        $std->id = $id;
        if ( $std->can_preview() )
        {
          $img = $std->get_preview();
          if ( !is_null($img) )
            $buffer .= "<div class=\"imguser\"><img src=\"".$wwwtopdir.$img."\" /></div>";
        }
320

Ayolo's avatar
perdu  
Ayolo committed
321 322 323 324 325 326 327
        $buffer .= "<a href=\"#\" onclick=\"fsfield_sel('$wwwtopdir','$field',$id,'".addslashes(htmlspecialchars($name))."','".$GLOBALS["entitiescatalog"][$class][2]."'); return false;\">";
        $buffer .= htmlspecialchars($name);
        $buffer .= "</a>";
        $buffer .= "</li>";
      }
      $buffer .=  "</ul>";
      $buffer .=  "<div class=\"clearboth\"></div>";
Ayolo's avatar
Ayolo committed
328 329 330 331 332 333
    }
    else
      $buffer="<p class=\"error\">Requête invalide</p>";
  }
  else
    $buffer="";
334 335

  echo "if ( ".$_REQUEST['sequence']." > fsfield_current_sequence['".$field."'] )\n{\n";
Ayolo's avatar
Ayolo committed
336
  echo "  fsfield_current_sequence['".$field."']=".$_REQUEST['sequence'].";\n";
Ayolo's avatar
perdu  
Ayolo committed
337 338 339 340 341
  echo "  var content = document.getElementById('".$field."_result');\n";
  echo "  content.style.zIndex = 100000;\n";
  echo "  content.style.display = 'block';\n";
  echo "  content.innerHTML ='".addslashes($buffer)."';\n";
  echo "}\n";
342

Ayolo's avatar
Ayolo committed
343 344 345 346 347 348 349
  exit();
}
elseif ( $_REQUEST['module']=="exfield" )
{
  $class = $_REQUEST['class'];
  $field = $_REQUEST['field'];
  $eclass = $_REQUEST['eclass'];
350

Ayolo's avatar
Ayolo committed
351 352
  if ( !ereg("^([a-z0-9]*)$",$class) || !ereg("^([a-z0-9]*)$",$class) )
    exit();
353

Ayolo's avatar
Ayolo committed
354 355 356
  $std = null;

  if ( class_exists($eclass) )
Ayolo's avatar
perdu  
Ayolo committed
357
    $std = new $eclass($site->db);
358

Ayolo's avatar
Ayolo committed
359 360 361 362
  elseif ( isset($GLOBALS["entitiescatalog"][$eclass][5]) && $GLOBALS["entitiescatalog"][$eclass][5] )
  {
    include($topdir."include/entities/".$GLOBALS["entitiescatalog"][$eclass][5]);
    if ( class_exists($eclass) )
Ayolo's avatar
perdu  
Ayolo committed
363
      $std = new $eclass($site->db);
Ayolo's avatar
Ayolo committed
364
  }
365

Ayolo's avatar
Ayolo committed
366
  if ( is_null($std) )
367 368
    exit();

Ayolo's avatar
Ayolo committed
369 370 371 372
  if ( $_REQUEST['eid'] == "root" )
  {
    $std = $std->get_root_element();
    if ( is_null($std) )
373
      exit();
Ayolo's avatar
Ayolo committed
374 375 376 377 378 379 380 381
  }
  else
    $std->load_by_id($_REQUEST['eid']);

  if ( !$std->is_valid() )
    exit();

  if ( !$std->allow_user_consult($site->user) )
382
    exit();
Ayolo's avatar
Ayolo committed
383 384

  $childs = $std->get_childs($site->user);
385

Ayolo's avatar
Ayolo committed
386
  if ( is_null($childs) || count($childs) == 0 )
387
    exit();
Ayolo's avatar
Ayolo committed
388 389 390 391

  foreach ( $childs as $child )
  {
    $name = $child->get_display_name();
392 393 394

    echo "<li>";

Ayolo's avatar
Ayolo committed
395 396 397 398 399 400
    echo "<a href=\"#\" onclick=\"";
    if ( get_class($child) == $class )
      echo "exfield_select('$wwwtopdir','$field','$class','".$child->id."','".addslashes(htmlspecialchars($name))."','".$GLOBALS["entitiescatalog"][$class][2]."');";
    else
      echo "exfield_explore('$wwwtopdir','$field','$class','".get_class($child)."','".$child->id."');";
    echo "return false;\">";
401

Ayolo's avatar
Ayolo committed
402 403 404
    echo "<img src=\"".$wwwtopdir."images/icons/16/".$GLOBALS["entitiescatalog"][get_class($child)][2]."\" alt=\"\" />";
    echo htmlspecialchars($name);
    echo "</a>";
405

Ayolo's avatar
Ayolo committed
406
    echo "<ul id=\"".$field."_".get_class($child)."_".$child->id."\"></ul>";
407

Ayolo's avatar
Ayolo committed
408 409 410 411 412 413
    echo "</li>";
  }


  exit();
}
gliss's avatar
gliss committed
414
elseif( $_REQUEST['module']=="tinycal" )
gliss's avatar
gliss committed
415
{
Ayolo's avatar
perdu  
Ayolo committed
416 417 418 419 420 421
  $cal = new tinycalendar($site->db);
  $cal->set_target($_REQUEST['target']);
  $cal->set_type($_REQUEST['type']);
  $cal->set_ext_topdir($_REQUEST['topdir']);
  echo $cal->html_render();
  exit();
gliss's avatar
gliss committed
422
}
423 424 425 426 427
elseif ($_REQUEST['module'] == 'eticket-ident' && isset ($_REQUEST['id_utilisateur']) && isset($_REQUEST['secret'])) {
    /* Utilisé par le logiciel de validation des etickets pour récupérer
       des infos utilisateurs si il a un lien internet */
    require_once($topdir. "include/mysql.inc.php");

jlaval's avatar
jlaval committed
428
    $req = new requete ($site->db, 'SELECT id_ticket FROM cpt_etickets WHERE secret=\''.mysql_real_escape_string($_REQUEST['secret']).'\'');
429 430 431 432 433 434
    if ($req->lines > 0) {
        $req = new requete ($site->db, 'SELECT utl.prenom_utl, utl.nom_utl, utl_utbm.surnom_utbm FROM utilisateurs AS utl LEFT JOIN utl_etu_utbm AS utl_utbm ON utl.id_utilisateur = utl_utbm.id_utilisateur WHERE utl.id_utilisateur='.intval(mysql_real_escape_string($_REQUEST['id_utilisateur'])));
        $line = $req->get_row ();
        if ($line != null) {
            echo $line['prenom_utl'] . '|^' . $line['nom_utl'] . '|^' . $line['surnom_utbm'];
        }
jlaval's avatar
jlaval committed
435 436
    } else {
        echo '0';
437
    }
jlaval's avatar
jlaval committed
438
    exit ();
439
}
gliss's avatar
gliss committed
440

Ayolo's avatar
Ayolo committed
441
if ( $_REQUEST['class'] == "calendar" )
Ayolo's avatar
bleh  
Ayolo committed
442 443 444 445 446 447
{
  if(isset($_REQUEST['subclass']) && !empty($_REQUEST['subclass']))
    $subclass=$_REQUEST['subclass'];
  else
    $subclass='';
  if(isset($_REQUEST['id_box']) && !empty($_REQUEST['id_box']))
Ayolo's avatar
bleh  
Ayolo committed
448
    $cts = new calendar($site->db,null,$subclass,$_REQUEST['id_box']);
Ayolo's avatar
bleh  
Ayolo committed
449 450 451
  else
    $cts = new calendar($site->db);
}
Ayolo's avatar
Ayolo committed
452
else
453
  $cts = new contents();
Ayolo's avatar
Ayolo committed
454 455 456

echo $cts->html_render();

gliss's avatar
gliss committed
457 458


Ayolo's avatar
Ayolo committed
459
?>