[ Index ]
 

Code source de Phorum 5.1.25

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/include/controlcenter/ -> users.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  
  20  if(!defined("PHORUM_CONTROL_CENTER")) return;
  21  
  22  if (!$PHORUM["DATA"]["USER_MODERATOR"]) {
  23      phorum_redirect_by_url(phorum_get_url(PHORUM_CONTROLCENTER_URL));
  24      exit();
  25  } 
  26  
  27  $users=phorum_db_user_get_unapproved();
  28  
  29  if(!empty($_POST["user_ids"])){
  30  
  31      foreach($_POST["user_ids"] as $user_id){
  32          
  33          // initialize it
  34          $userdata=array();
  35          
  36          $user=phorum_user_get($user_id);
  37  
  38          if(!isset($_POST["approve"]) && $user['active'] != PHORUM_USER_ACTIVE){
  39              
  40              $userdata["active"]=PHORUM_USER_INACTIVE;
  41              
  42          } else {
  43              
  44              if($user["active"]==PHORUM_USER_PENDING_BOTH){
  45                  
  46                  $userdata["active"]=PHORUM_USER_PENDING_EMAIL;
  47                  
  48              } elseif($user["active"]==PHORUM_USER_PENDING_MOD) {
  49                  
  50                  $userdata["active"]=PHORUM_USER_ACTIVE;
  51                  // send reg approved message
  52                  $maildata["mailsubject"]=$PHORUM["DATA"]["LANG"]["RegApprovedSubject"];
  53                  $maildata["mailmessage"]=wordwrap($PHORUM["DATA"]["LANG"]["RegApprovedEmailBody"], 72);
  54                  phorum_email_user(array($user["email"]), $maildata);
  55                  
  56              }
  57          }
  58  
  59          $userdata["user_id"]=$user_id;
  60  
  61          // only save it if something was changed 
  62          if(isset($userdata['active'])) {
  63              phorum_user_save($userdata);
  64          }
  65      }
  66  }
  67  
  68  if(empty($users)){
  69      $PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["NoUnapprovedUsers"];
  70  } else {
  71  
  72      // get a fresh list to update any changes
  73      $users=phorum_db_user_get_unapproved();
  74  
  75      // XSS prevention.
  76      foreach ($users as $id => $user) {
  77          $users[$id]["username"] = htmlspecialchars($user["username"]);
  78          $users[$id]["email"] = htmlspecialchars($user["email"]);
  79      }
  80  
  81      $PHORUM["DATA"]["USERS"]=$users;
  82  
  83      $PHORUM["DATA"]["ACTION"]=phorum_get_url( PHORUM_CONTROLCENTER_ACTION_URL );
  84      $PHORUM["DATA"]["FORUM_ID"]=$PHORUM["forum_id"];
  85  
  86      $template = "cc_users";
  87  }
  88  
  89  ?>


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