[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/e107_handlers/ -> notify_class.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     ©Steve Dunstan 2001-2002
   7  |     http://e107.org
   8  |     jalist@e107.org
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/notify_class.php,v $
  14  |     $Revision: 1.14 $
  15  |     $Date: 2006/11/17 20:23:13 $
  16  |     $Author: lisa_ $
  17  +----------------------------------------------------------------------------+
  18  */
  19  
  20  if (!defined('e107_INIT')) { exit; }
  21  
  22  class notify {
  23  
  24      var $notify_prefs;
  25  
  26  	function notify() {
  27          global $sysprefs, $e_event, $eArrayStorage;
  28          $this -> notify_prefs = $sysprefs -> get('notify_prefs');
  29          $this -> notify_prefs = $eArrayStorage -> ReadArray($this -> notify_prefs);
  30          foreach ($this -> notify_prefs['event'] as $id => $status) {
  31              if ($status['type'] != 'off') {
  32                  $e_event -> register($id, 'notify_'.$id);
  33              }
  34          }
  35  
  36          if(defined("e_LANGUAGE") && is_readable(e_LANGUAGEDIR.e_LANGUAGE.'/lan_notify.php')) {
  37              include_once(e_LANGUAGEDIR.e_LANGUAGE.'/lan_notify.php');
  38          } else {
  39              include_once(e_LANGUAGEDIR.'English/lan_notify.php');
  40          }
  41      }
  42  
  43  	function send($id, $subject, $message) {
  44          global $sql,$tp;
  45          e107_require_once(e_HANDLER.'mail.php');
  46          $subject = SITENAME.': '.$subject;
  47          if ($this -> notify_prefs['event'][$id]['type'] == 'main') {
  48              sendemail(SITEADMINEMAIL, $tp->toEmail($subject), $tp->toEmail($message));
  49          } else if ($this -> notify_prefs['event'][$id]['type'] == 'class') {
  50              if ($this -> notify_prefs['event'][$id]['class'] == '254') {
  51                  $sql -> db_Select('user', 'user_email', "user_admin = 1");
  52              } else if ($this -> notify_prefs['event'][$id]['class'] == '253') {
  53                  $sql -> db_Select('user', 'user_email');
  54              } else {
  55                  $sql -> db_Select('user', 'user_email', "user_class REGEXP '(^|,)(".$this -> notify_prefs['event'][$id]['class'].")(,|$)'");
  56              }
  57              while ($email = $sql -> db_Fetch()) {
  58                  sendemail($email['user_email'], $tp->toEmail($subject), $tp->toEmail($message));
  59              }
  60          } else if ($this -> notify_prefs['event'][$id]['type'] == 'email') {
  61              sendemail($this -> notify_prefs['event'][$id]['email'], $tp->toEmail($subject), $tp->toEmail($message));
  62          }
  63      }
  64  }
  65  
  66  global $nt;
  67  $nt = new notify;
  68  
  69  function notify_usersup($data) {
  70      global $nt;
  71      foreach ($data as $key => $value)
  72      {
  73          if($key != "password1" && $key != "password2" && $key != "email_confirm" && $key != "register")
  74          {
  75              if(is_array($value))  // show user-extended values.
  76              {
  77                  foreach($value as $k => $v)
  78                  {
  79                      $message .= str_replace("user_","",$k).': '.$v.'<br />';
  80                  }
  81              }
  82              else
  83              {
  84                  $message .=  $key.': '.$value.'<br />';
  85              }
  86          }
  87      }
  88      $nt -> send('usersup', NT_LAN_US_1, $message);
  89  }
  90  
  91  function notify_userveri($data) {
  92      global $nt, $e107;
  93      $msgtext = NT_LAN_UV_2.$data['user_id']."\n";
  94      $msgtext .= NT_LAN_UV_3.$data['user_loginname']."\n";
  95      $msgtext .= NT_LAN_UV_2.$e107->getip();
  96      $nt -> send('userveri', NT_LAN_UV_1, $msgtext);
  97  }
  98  
  99  function notify_login($data) {
 100      global $nt;
 101      foreach ($data as $key => $value) {
 102          $message .= $key.': '.$value.'<br />';
 103      }
 104      $nt -> send('login', NT_LAN_LI_1, $message);
 105  }
 106  
 107  function notify_logout() {
 108      global $nt;
 109      $nt -> send('logout', NT_LAN_LO_1, USERID.'. '.USERNAME.' '.NT_LAN_LO_2);
 110  }
 111  
 112  function notify_flood($data) {
 113      global $nt;
 114      $nt -> send('flood', NT_LAN_FL_1, NT_LAN_FL_2.': '.$data);
 115  }
 116  
 117  function notify_subnews($data) {
 118      global $nt,$tp;
 119      foreach ($data as $key => $value) {
 120          $message .= $key.': '.$value.'<br />';
 121      }
 122      $nt -> send('subnews', NT_LAN_SN_1, $message);
 123  }
 124  
 125  function notify_newspost($data) {
 126      global $nt;
 127      $message = '<b>'.$data['news_title'].'</b><br /><br />'.$data['news_summary'].'<br /><br />'.$data['data'].'<br /><br />'.$data['news_extended'];
 128      $nt -> send('newspost', $data['news_title'], $message);
 129  }
 130  
 131  function notify_newsupd($data) {
 132      global $nt;
 133      $message = '<b>'.$data['news_title'].'</b><br /><br />'.$data['news_summary'].'<br /><br />'.$data['data'].'<br /><br />'.$data['news_extended'];
 134      $nt -> send('newsupd', NT_LAN_NU_1.': '.$data['news_title'], $message);
 135  }
 136  
 137  function notify_newsdel($data) {
 138      global $nt;
 139      $nt -> send('newsdel', NT_LAN_ND_1, NT_LAN_ND_2.': '.$data);
 140  }
 141  
 142  
 143  function notify_fileupload($data) {
 144      global $nt;
 145      $message = '<b>'.$data['upload_name'].'</b><br /><br />'.$data['upload_description'].'<br /><br />'.$data['upload_size'].'<br /><br />'.$data['upload_user'];
 146      $nt -> send('fileupload', $data['upload_name'], $message);
 147  }
 148  
 149  if (isset($nt -> notify_prefs['plugins'])) {
 150      foreach ($nt -> notify_prefs['plugins'] as $plugin_id => $plugin_settings) {
 151          if(is_readable(e_PLUGIN.$plugin_id.'/e_notify.php'))
 152          {
 153              require_once(e_PLUGIN.$plugin_id.'/e_notify.php');
 154          }
 155      }
 156  }
 157  
 158  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7