[ 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/frontpage.php,v $ 14 | $Revision: 1.23 $ 15 | $Date: 2006/07/08 03:57:35 $ 16 | $Author: e107coders $ 17 +----------------------------------------------------------------------------+ 18 */ 19 20 require_once ('../class2.php'); 21 if (!getperms('G')) { 22 header('location:'.e_BASE.'index.php'); 23 exit; 24 } 25 $e_sub_cat = 'frontpage'; 26 require_once ('auth.php'); 27 require_once(e_HANDLER.'form_handler.php'); 28 $rs = new form; 29 require_once(e_HANDLER.'userclass_class.php'); 30 31 $front_page['news'] = array('page' => 'news.php', 'title' => ADLAN_0); 32 $front_page['download'] = array('page' => 'download.php', 'title' => ADLAN_24); 33 $front_page['wmessage'] = array('page' => 'index.php', 'title' => ADLAN_28); 34 35 if ($sql -> db_Select("page", "*", "page_theme=''")) { 36 $front_page['custom']['title'] = 'Custom Page'; 37 while ($row = $sql -> db_Fetch()) { 38 $front_page['custom']['page'][] = array('page' => 'page.php?'.$row['page_id'], 'title' => $row['page_title']); 39 } 40 } 41 42 43 foreach($pref['e_frontpage_list'] as $val) 44 { 45 if (is_readable(e_PLUGIN.$val."/e_frontpage.php")) 46 { 47 require_once(e_PLUGIN.$val."/e_frontpage.php"); 48 } 49 } 50 51 52 53 if (isset($_POST['edit'])) { 54 $_POST['type'] = (isset($_POST['edit']['all'])) ? 'all_users' : 'user_class'; 55 $_POST['class'] = key($_POST['edit']); 56 } 57 58 if (isset($_POST['updatesettings'])) { 59 if ($_POST['frontpage'] == 'other') { 60 $_POST['other_page'] = $tp -> toForm($_POST['other_page']); 61 $frontpage_value = $_POST['other_page'] ? $_POST['other_page'] : 'news.php'; 62 } else { 63 if (is_array($front_page[$_POST['frontpage']]['page'])) { 64 $frontpage_value = $front_page[$_POST['frontpage']]['page'][$_POST['multipage'][$_POST['frontpage']]]['page']; 65 } else { 66 $frontpage_value = $front_page[$_POST['frontpage']]['page']; 67 } 68 } 69 70 if ($_POST['type'] == 'all_users') { 71 unset($pref['frontpage']); 72 $pref['frontpage']['all'] = $frontpage_value; 73 } else { 74 if (isset($pref['frontpage']['all'])) { 75 $pref['frontpage']['252'] = ($_POST['class'] == '252') ? $frontpage_value : $pref['frontpage']['all']; 76 $pref['frontpage']['253'] = ($_POST['class'] == '253') ? $frontpage_value : $pref['frontpage']['all']; 77 $pref['frontpage']['254'] = ($_POST['class'] == '254') ? $frontpage_value : $pref['frontpage']['all']; 78 $class_list = get_userclass_list(); 79 foreach ($class_list as $fp_class) { 80 $pref['frontpage'][$fp_class['userclass_id']] = ($_POST['class'] == $fp_class['userclass_id']) ? $frontpage_value : $pref['frontpage']['all']; 81 } 82 unset($pref['frontpage']['all']); 83 } 84 $pref['frontpage'][$_POST['class']] = $frontpage_value; 85 } 86 87 save_prefs(); 88 $ns -> tablerender(LAN_UPDATED, "<div style='text-align:center'><b>".FRTLAN_1."</b></div>"); 89 } 90 91 $fp = new frontpage; 92 93 if (isset($_POST['select']) || isset($_POST['edit'])) { 94 $fp -> select_page(); 95 } else { 96 $fp -> select_class(); 97 } 98 99 class frontpage { 100 function select_class() { 101 global $rs, $pref, $ns, $front_page; 102 $text = "<div style='text-align:center'> 103 <form method='post' action='".e_SELF."'> 104 <table style='".ADMIN_WIDTH."' class='fborder'>"; 105 106 $text .= "<tr> 107 <td style='width: 50%' class='forumheader3'>".FRTLAN_2.":</td> 108 <td style='width: 50%' class='forumheader3'> 109 ".$rs -> form_radio('type', 'all_users', (isset($pref['frontpage']['all']) ? TRUE : FALSE))." ".FRTLAN_31." 110 ".$rs -> form_radio('type', 'user_class', (isset($pref['frontpage']['all']) ? FALSE : TRUE))." ".FRTLAN_32.": 111 ".r_userclass('class', '', 'off', 'guest,member,admin,classes')."</td> 112 </tr>"; 113 114 $text .= "<tr style='vertical-align:top'> 115 <td colspan='2' style='text-align: center' class='forumheader'> 116 ".$rs -> form_button('submit', 'select', LAN_SELECT)." 117 </td> 118 </tr> 119 </table> 120 </form> 121 </div>"; 122 123 $ns -> tablerender(FRTLAN_13, $text); 124 125 $text = "<div style='text-align:center'> 126 <form method='post' action='".e_SELF."'> 127 <table style='".ADMIN_WIDTH."' class='fborder'><tr> 128 <td style='width: 25%' class='fcaption'>".FRTLAN_32."</td> 129 <td style='width: 65%' class='fcaption'>".FRTLAN_34."</td> 130 <td style='width: 10%' class='fcaption'>".LAN_EDIT."</td> 131 </tr>"; 132 133 if (isset($pref['frontpage']['all'])) { 134 $text .= "<tr> 135 <td class='forumheader3'>All Users</td> 136 <td class='forumheader3'>".$pref['frontpage']['all']."</td> 137 <td class='forumheader3' style='text-align:center'> 138 <input type='image' title='".LAN_EDIT."' name='edit[all]' src='".ADMIN_EDIT_ICON_PATH."' /> 139 </td> 140 </tr>"; 141 } else { 142 foreach ($pref['frontpage'] as $current_key => $current_value) { 143 if ($current_key == 252) { 144 $title = FRTLAN_27; 145 } else if ($current_key == 253) { 146 $title = FRTLAN_28; 147 } else if ($current_key == 254) { 148 $title = FRTLAN_29; 149 } else { 150 $class_list = get_userclass_list(); 151 foreach ($class_list as $fp_class) { 152 if ($current_key == $fp_class['userclass_id']) { 153 $title = $fp_class['userclass_name']; 154 } 155 } 156 } 157 $text .= "<tr> 158 <td class='forumheader3'>".$title."</td> 159 <td class='forumheader3'>".$current_value."</td> 160 <td class='forumheader3' style='text-align:center'> 161 <input type='image' title='".LAN_EDIT."' name='edit[".$current_key."]' src='".ADMIN_EDIT_ICON_PATH."' /> 162 </td> 163 </tr>"; 164 } 165 } 166 $text .= "</table> 167 </form> 168 </div>"; 169 170 $ns -> tablerender(FRTLAN_33, $text); 171 172 } 173 174 function select_page() { 175 global $rs, $pref, $ns, $front_page; 176 177 if ($_POST['type'] == 'all_users') { 178 $title = FRTLAN_26; 179 } else { 180 if ($_POST['class'] == 252) { 181 $title = FRTLAN_27; 182 } else if ($_POST['class'] == 253) { 183 $title = FRTLAN_28; 184 } else if ($_POST['class'] == 254) { 185 $title = FRTLAN_29; 186 } else { 187 $class_list = get_userclass_list(); 188 foreach ($class_list as $fp_class) { 189 if ($_POST['class'] == $fp_class['userclass_id']) { 190 $title = $fp_class['userclass_name']; 191 } 192 } 193 } 194 } 195 196 $text = "<div style='text-align:center'> 197 <form method='post' action='".e_SELF."'> 198 <table style='".ADMIN_WIDTH."' class='fborder'> 199 <tr> 200 <td colspan='3' class='fcaption'>".FRTLAN_2." ".$title.": </td> 201 </tr>"; 202 203 foreach ($front_page as $front_key => $front_value) { 204 $type_selected = FALSE; 205 $current_setting = (isset($pref['frontpage']['all'])) ? $pref['frontpage']['all'] : $pref['frontpage'][$_POST['class']]; 206 if (is_array($front_value['page'])) { 207 foreach ($front_value['page'] as $multipage) { 208 if ($current_setting == $multipage['page']) { 209 $type_selected = TRUE; 210 $not_other = TRUE; 211 } 212 } 213 } else { 214 if ($current_setting == $front_value['page']) { 215 $type_selected = TRUE; 216 $not_other = TRUE; 217 } 218 } 219 220 $text .= "<tr><td class='forumheader3'>"; 221 $text .= $rs -> form_radio('frontpage', $front_key, $type_selected); 222 $text .= "</td>"; 223 224 if (is_array($front_value['page'])) { 225 $text .= "<td style='width: 50%' class='forumheader3'>".$front_value['title']."</td>"; 226 $text .= "<td style='width: 50%' class='forumheader3'>"; 227 $text .= $rs -> form_select_open('multipage['.$front_key.']'); 228 $type = isset($pref['frontpage']['all']) ? 'all' : $_POST['class']; 229 foreach ($front_value['page'] as $multipage_key => $multipage_value) { 230 $sub_selected = ($pref['frontpage'][$type] == $multipage_value['page']) ? TRUE : FALSE; 231 $text .= $rs -> form_option($multipage_value['title'], $sub_selected, $multipage_key); 232 } 233 $text .= $rs -> form_select_close(); 234 $text .= "</td>"; 235 } else { 236 $text .= "<td style='width: 100%' colspan='2' class='forumheader3'>".$front_value['title']."</td>"; 237 } 238 $text .= "</tr>"; 239 } 240 241 $text .= "<tr> 242 <td class='forumheader3'>".$rs -> form_radio('frontpage', 'other', (!$not_other ? TRUE : FALSE))."</td> 243 <td style='width: 50%' class='forumheader3'>".FRTLAN_15."</td> 244 <td style='width: 50%' class='forumheader3'> 245 ".$rs -> form_text('other_page', 50, (!$not_other ? $current_setting : ''))." 246 </td> 247 </tr>"; 248 249 $text .= "<tr style='vertical-align:top'> 250 <td colspan='3' style='text-align: center' class='forumheader'>"; 251 $text .= $rs -> form_hidden('type', $_POST['type']); 252 $text .= $rs -> form_hidden('class', $_POST['class']); 253 $text .= $rs -> form_button('submit', 'updatesettings', FRTLAN_12); 254 $text .= "</td> 255 </tr> 256 </table> 257 </form> 258 </div>"; 259 260 $ns -> tablerender(FRTLAN_13, $text); 261 } 262 } 263 264 require_once ('footer.php'); 265 266 ?>
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 |