| [ Index ] |
|
Code source de e107 0.7.8 |
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_admin/notify.php,v $ 14 | $Revision: 1.13 $ 15 | $Date: 2006/09/16 18:18:04 $ 16 | $Author: e107coders $ 17 +----------------------------------------------------------------------------+ 18 */ 19 require_once ('../class2.php'); 20 if (!getperms('O')) { 21 header('location:'.e_BASE.'index.php'); 22 exit; 23 } 24 25 $e_sub_cat = 'notify'; 26 27 require_once ('auth.php'); 28 require_once(e_HANDLER.'userclass_class.php'); 29 require_once(e_HANDLER.'form_handler.php'); 30 $rs = new form; 31 $nc = new notify_config; 32 if (isset($_POST['update'])) { 33 $nc -> update(); 34 } 35 $nc -> config(); 36 37 class notify_config { 38 39 var $notify_prefs; 40 41 function notify_config() { 42 global $sysprefs, $eArrayStorage, $tp, $sql,$pref; 43 $this -> notify_prefs = $sysprefs -> get('notify_prefs'); 44 $this -> notify_prefs = $eArrayStorage -> ReadArray($this -> notify_prefs); 45 46 // load every e_notify.php file. 47 foreach($pref['e_notify_list'] as $val) 48 { 49 if (!isset($this -> notify_prefs['plugins'][$val])) 50 { 51 $this -> notify_prefs['plugins'][$val] = TRUE; 52 if (is_readable(e_PLUGIN.$val."/e_notify.php")) 53 { 54 require_once(e_PLUGIN.$val.'/e_notify.php'); 55 foreach ($config_events as $event_id => $event_text) 56 { 57 $this -> notify_prefs['event'][$event_id] = array('type' => 'off', 'class' => '254', 'email' => ''); 58 } 59 $recalibrate = true; 60 } 61 } 62 } 63 64 65 if ($recalibrate) { 66 $s_prefs = $tp -> toDB($this -> notify_prefs); 67 $s_prefs = $eArrayStorage -> WriteArray($s_prefs); 68 $sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'"); 69 } 70 } 71 72 function config() { 73 global $ns, $rs; 74 75 $text = "<div style='text-align: center'> 76 <form action='".e_SELF."?results' method='post' id='scanform'> 77 <table style='".ADMIN_WIDTH."' class='fborder'> 78 <tr> 79 <td class='fcaption' colspan='2'>".NT_LAN_2.":</td> 80 </tr>"; 81 82 $text .= "<tr> 83 <td colspan='2' class='forumheader'>".NU_LAN_1."</td> 84 </tr>"; 85 86 $text .= $this -> render_event('usersup', NU_LAN_2); 87 $text .= $this -> render_event('userveri', NU_LAN_3); 88 $text .= $this -> render_event('login', NU_LAN_4); 89 $text .= $this -> render_event('logout', NU_LAN_5); 90 91 $text .= "<tr> 92 <td colspan='2' class='forumheader'>".NS_LAN_1."</td> 93 </tr>"; 94 95 $text .= $this -> render_event('flood', NS_LAN_2); 96 97 98 $text .= "<tr> 99 <td colspan='2' class='forumheader'>".NN_LAN_1."</td> 100 </tr>"; 101 102 $text .= $this -> render_event('subnews', NN_LAN_2); 103 $text .= $this -> render_event('newspost', NN_LAN_3); 104 $text .= $this -> render_event('newsupd', NN_LAN_4); 105 $text .= $this -> render_event('newsdel', NN_LAN_5); 106 107 $text .= "<tr> 108 <td colspan='2' class='forumheader'>".NF_LAN_1."</td> 109 </tr>"; 110 111 $text .= $this -> render_event('fileupload', NF_LAN_2); 112 113 foreach ($this -> notify_prefs['plugins'] as $plugin_id => $plugin_settings) { 114 if(is_readable(e_PLUGIN.$plugin_id.'/e_notify.php')) 115 { 116 require(e_PLUGIN.$plugin_id.'/e_notify.php'); 117 $text .= "<tr> 118 <td colspan='2' class='forumheader'>".$config_category."</td> 119 </tr>"; 120 foreach ($config_events as $event_id => $event_text) { 121 $text .= $this -> render_event($event_id, $event_text); 122 } 123 } 124 } 125 126 $text .= "<tr> 127 <td colspan='2' style='text-align:center' class='forumheader'>".$rs -> form_button('submit', 'update', LAN_UPDATE)."</td> 128 </tr> 129 </table> 130 </form> 131 </div>"; 132 133 $ns -> tablerender(NT_LAN_1, $text); 134 } 135 136 function render_event($id, $description) { 137 global $rs, $tp; 138 $text .= "<tr> 139 <td class='forumheader3' style='width: 30%'> 140 ".$description.": 141 </td> 142 <td class='forumheader3' style='width: 70%; white-space: nowrap'> 143 <input type='radio' name='event[".$id."][type]' value='off' ".(($this -> notify_prefs['event'][$id]['type'] == 'off' || !$this -> notify_prefs['event'][$id]['type']) ? " checked='checked'" : "")." /> ".NT_LAN_3." 144 <input type='radio' name='event[".$id."][type]' value='main' ".($this -> notify_prefs['event'][$id]['type'] == 'main' ? " checked='checked'" : "")." /> ".NT_LAN_4." 145 <input type='radio' name='event[".$id."][type]' value='class' ".($this -> notify_prefs['event'][$id]['type'] == 'class' ? " checked='checked'" : "")." /> ".NT_LAN_5.": 146 ".r_userclass('event['.$id.'][class]', $this -> notify_prefs['event'][$id]['class'], 'off', 'member,admin,classes')." 147 <input type='radio' name='event[".$id."][type]' value='email' ".($this -> notify_prefs['event'][$id]['type'] == 'email' ? " checked='checked'" : "")." /> ".NT_LAN_6.": 148 ".$rs -> form_text('event['.$id.'][email]', 17, $tp -> toForm($this -> notify_prefs['event'][$id]['email']))." 149 </td> 150 </tr>"; 151 return $text; 152 } 153 154 function update() { 155 global $sql, $pref, $tp, $eArrayStorage; 156 foreach ($_POST['event'] as $key => $value) { 157 if ($this -> update_event($key)) { 158 $active = TRUE; 159 } 160 } 161 162 $s_prefs = $tp -> toDB($this -> notify_prefs); 163 $s_prefs = $eArrayStorage -> WriteArray($s_prefs); 164 $sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'"); 165 if ($active) { 166 $pref['notify'] = TRUE; 167 } else { 168 $pref['notify'] = FALSE; 169 } 170 save_prefs(); 171 } 172 173 function update_event($id) { 174 $this -> notify_prefs['event'][$id]['type'] = $_POST['event'][$id]['type']; 175 $this -> notify_prefs['event'][$id]['class'] = $_POST['event'][$id]['class']; 176 $this -> notify_prefs['event'][$id]['email'] = $_POST['event'][$id]['email']; 177 if ($this -> notify_prefs['event'][$id]['type'] != 'off') { 178 return TRUE; 179 } else { 180 return FALSE; 181 } 182 } 183 } 184 185 require_once ('footer.php'); 186 187 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |