linea21-modules
[ class tree: linea21-modules ] [ index: linea21-modules ] [ all elements ]

Source for file delavatar.php

Documentation is available at delavatar.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage user
  5.  * @author Simon Georget <simon@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. include_once('../config/define.php');
  12.  
  13.  
  14. include_once('../admin/'.SQL.'.inc.php');
  15.  
  16. // admin interface
  17. if(isset($_GET['id'])) {
  18.     $from='admin';
  19.     $id=$_GET['id']// we retrieve given id
  20. // public interface
  21. else {
  22.     // we get current user id from DB
  23.     $from='public';
  24.     $data $GLOBALS['sql_object']->DBSelect(SQL_Get_UserInfo4Auth($_SESSION['userlogin']base64_decode($_SESSION['userwhois'])));
  25.     if ($data != && count($data== 1{
  26.         $id=$data[0]['user_id'];
  27.     else {
  28.         die();
  29.     }
  30. }
  31.  
  32. if(!isset($_GET['mode'])) {
  33.     $mode='plain';
  34. else {
  35.     $mode='ajax';
  36. }
  37.  
  38. //////////// Check Droits utilisateur ////////////
  39. if($from == 'admin'{
  40.     if (!$l21auth->isSuperAdmin()) ReloadIndex('admin');
  41. }
  42. ////////////
  43.  
  44.  
  45.  
  46. include_once('../languages/' U_L '/lang_user.' CHARSET '.php');
  47. // include_once('../languages/' . U_L . '/lang_common.' . CHARSET . '.php');
  48. include_once('../class/class.user.php');
  49.  
  50.  
  51. $user new user;
  52. $r $user->deleteAvatar($id$GLOBALS['sql_object']);
  53.  
  54. if($mode == 'plain'{
  55.     if($from == 'admin'{
  56.         $link_confirm SITE_ROOT_URL."admin/confirm.php?rub=user&todo=delavatar&id=".$id;
  57.         if($rheader("Location: ".$link_confirm);
  58.     else {
  59.         if(!$rsystem_error(__FUNCTION__ . ' : SQL error when deleting avatar for user ' $id);
  60.     }
  61.     // ajax mode
  62. else {
  63.     if($r{
  64.         $status 1;
  65.         $o _t('user''confirm_delavatar');
  66.     }
  67.     /* Return json values */
  68.     echo json_encode(array('status'=> $status,'msg'=> $o));
  69. }
  70. ?>

Documentation generated on Thu, 20 Mar 2014 16:47:18 +0100 by phpDocumentor 1.4.1