[ Index ]
 

Code source de Phorum 5.1.25

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> profile.php (source)

   1  <?php
   2  
   3  ////////////////////////////////////////////////////////////////////////////////
   4  //                                                                            //
   5  //   Copyright (C) 2006  Phorum Development Team                              //
   6  //   http://www.phorum.org                                                    //
   7  //                                                                            //
   8  //   This program is free software. You can redistribute it and/or modify     //
   9  //   it under the terms of either the current Phorum License (viewable at     //
  10  //   phorum.org) or the Phorum License that was distributed with this file    //
  11  //                                                                            //
  12  //   This program is distributed in the hope that it will be useful,          //
  13  //   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
  14  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
  15  //                                                                            //
  16  //   You should have received a copy of the Phorum License                    //
  17  //   along with this program.                                                 //
  18  ////////////////////////////////////////////////////////////////////////////////
  19  define('phorum_page','profile');
  20  
  21  include_once ("./common.php");
  22  include_once ("./include/email_functions.php");
  23  include_once ("./include/format_functions.php");
  24  
  25  // set all our URL's
  26  phorum_build_common_urls();
  27  
  28  $template = "profile";
  29  $error = "";
  30  
  31  // redirect if no profile id passed
  32  if(!empty($PHORUM["args"][1])){
  33      $profile_id = (int)$PHORUM["args"][1];
  34  }
  35  
  36  if(empty($PHORUM["args"][1]) || empty($profile_id)){
  37      phorum_redirect_by_url(phorum_get_url(PHORUM_INDEX_URL));
  38      exit();
  39  }
  40  
  41  include_once ("./include/users.php");
  42  
  43  $user = phorum_user_get($profile_id);
  44  
  45  if(!is_array($user) || $user["active"]==0) {
  46      $PHORUM["DATA"]["ERROR"]=$PHORUM["DATA"]["LANG"]["UnknownUser"];
  47      $PHORUM['DATA']["URL"]["REDIRECT"]=phorum_get_url(PHORUM_LIST_URL);
  48      $PHORUM['DATA']["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToList"];
  49  
  50      // have to include the header here for the Redirect
  51      include phorum_get_template("header");
  52      phorum_hook("after_header");
  53      include phorum_get_template("message");
  54      phorum_hook("before_footer");
  55      include phorum_get_template("footer");
  56      return;
  57  }
  58  
  59  // security messures
  60  unset($user["password"]);
  61  unset($user["permissions"]);
  62  
  63  // set any custom profile fields that are not present.
  64  if (!empty($PHORUM["PROFILE_FIELDS"])) {
  65      foreach($PHORUM["PROFILE_FIELDS"] as $id => $field) {
  66          if ($id === 'num_fields') continue;
  67          if (!isset($user[$field['name']])) $user[$field['name']] = "";
  68      }
  69  }
  70  
  71  $PHORUM["DATA"]["PROFILE"] = $user;
  72  $PHORUM["DATA"]["PROFILE"]["forum_id"] = $PHORUM["forum_id"];
  73  
  74  $PHORUM["DATA"]["PROFILE"]["date_added"]=phorum_date( $PHORUM['short_date'], $PHORUM["DATA"]["PROFILE"]["date_added"]);
  75  
  76  if( !empty($PHORUM["user"]["admin"]) ||
  77      (phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES) && PHORUM_MOD_EMAIL_VIEW) ||
  78      (phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_USERS) && PHORUM_MOD_EMAIL_VIEW) ||
  79      !$user["hide_email"]){
  80  
  81      $PHORUM["DATA"]["PROFILE"]["email"]=phorum_html_encode($user["email"]);
  82  } else {
  83      $PHORUM["DATA"]["PROFILE"]["email"] = $PHORUM["DATA"]["LANG"]["Hidden"];
  84  }
  85  
  86  if( $PHORUM["track_user_activity"] && 
  87      (!empty($PHORUM["user"]["admin"]) ||
  88       (phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES)) ||
  89       (phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_USERS)) ||
  90       !$user["hide_activity"])){
  91  
  92      $PHORUM["DATA"]["PROFILE"]["date_last_active"]=phorum_date( $PHORUM['short_date'], $PHORUM["DATA"]["PROFILE"]["date_last_active"]);
  93  } else {
  94      unset($PHORUM["DATA"]["PROFILE"]["date_last_active"]);
  95  }
  96  
  97  $PHORUM["DATA"]["PROFILE"]["posts"]=number_format($PHORUM["DATA"]["PROFILE"]["posts"]);
  98  
  99  $PHORUM["DATA"]["PROFILE"]["pm_url"] = phorum_get_url(PHORUM_PM_URL, "page=send", "to_id=".urlencode($user["user_id"]));
 100  $PHORUM["DATA"]["PROFILE"]["pm_addbuddy_url"] = phorum_get_url(PHORUM_PM_URL, "page=buddies", "action=addbuddy", "addbuddy_id=".urlencode($user["user_id"]));
 101  $PHORUM["DATA"]["PROFILE"]["is_buddy"] = phorum_db_pm_is_buddy($user["user_id"]);
 102  // unset($PHORUM["DATA"]["PROFILE"]["signature"]);
 103  
 104  $PHORUM["DATA"]["PROFILE"]["username"] = htmlspecialchars($PHORUM["DATA"]["PROFILE"]["username"]);
 105  
 106  $PHORUM["DATA"]["PROFILE"] = phorum_hook("profile", $PHORUM["DATA"]["PROFILE"]);
 107  
 108  // set all our URL's
 109  phorum_build_common_urls();
 110  
 111  include phorum_get_template("header");
 112  phorum_hook("after_header");
 113  include phorum_get_template("profile");
 114  phorum_hook("before_footer");
 115  include phorum_get_template("footer");
 116  
 117  ?>


Généré le : Thu Nov 29 12:22:27 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics