[ 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/db.php,v $ 14 | $Revision: 1.22 $ 15 | $Date: 2007/02/14 21:17:33 $ 16 | $Author: e107steved $ 17 +----------------------------------------------------------------------------+ 18 */ 19 20 require_once ("../class2.php"); 21 if (!getperms('0')) { 22 header('location:'.e_BASE.'index.php'); 23 exit; 24 } 25 $e_sub_cat = 'database'; 26 27 if (isset($_POST['db_update'])) { 28 header("location: ".e_ADMIN."e107_update.php"); 29 exit; 30 } 31 32 if (isset($_POST['verify_sql'])) { 33 header("location: ".e_ADMIN."db_verify.php"); 34 exit; 35 } 36 37 require_once ("auth.php"); 38 39 40 41 if(isset($_POST['delpref']) || (isset($_POST['delpref_checked']) && isset($_POST['delpref2'])) ) 42 { 43 del_pref_val(); 44 } 45 46 47 if(isset($_POST['pref_editor']) || isset($_POST['delpref']) || isset($_POST['delpref_checked'])) 48 { 49 pref_editor(); 50 require_once ("footer.php"); 51 exit; 52 } 53 54 55 if (isset($_POST['optimize_sql'])) { 56 optimizesql($mySQLdefaultdb); 57 require_once ("footer.php"); 58 exit; 59 } 60 61 62 if (isset($_POST['backup_core'])) { 63 backup_core(); 64 message_handler("MESSAGE", DBLAN_1); 65 } 66 67 if(isset($_POST['delplug'])) 68 { 69 delete_plugin_entry(); 70 71 } 72 73 if (isset($_POST['plugin_scan']) || e_QUERY == "plugin" || $_POST['delplug']) { 74 plugin_viewscan(); 75 require_once ("footer.php"); 76 exit; 77 } 78 79 80 81 82 83 84 85 $text = "<div style='text-align:center'> 86 <form method='post' action='".e_SELF."'>\n 87 <table style='".ADMIN_WIDTH."' class='fborder'> 88 89 <tr> 90 <td style='width:70%' class='forumheader3'>".DBLAN_15."</td> 91 <td class='forumheader3' style='width:30%;text-align:center'><input class='button' style='width: 100%' type='submit' name='db_update' value='".DBLAN_16."' /></td> 92 </tr> 93 94 <tr> 95 <td style='width:70%' class='forumheader3'>".DBLAN_4."</td> 96 <td class='forumheader3' style='width:30%;text-align:center'><input class='button' style='width: 100%' type='submit' name='verify_sql' value='".DBLAN_5."' /></td> 97 </tr> 98 99 <tr> 100 <td style='width:70%' class='forumheader3'>".DBLAN_6."</td> 101 <td class='forumheader3' style='width:30%;text-align:center'><input class='button' style='width: 100%' type='submit' name='optimize_sql' value='".DBLAN_7."' /></td> 102 </tr> 103 104 <tr> 105 <td style='width:70%' class='forumheader3'>".DBLAN_28."</td> 106 <td class='forumheader3' style='width:30%;text-align:center'><input class='button' style='width: 100%' type='submit' name='plugin_scan' value=\"".DBLAN_29."\" /></td> 107 </tr> 108 109 <tr> 110 <td style='width:70%' class='forumheader3'>".DBLAN_19."</td> 111 <td class='forumheader3' style='width:30%;text-align:center'><input class='button' style='width: 100%' type='submit' name='pref_editor' value='".DBLAN_20."' /></td> 112 </tr> 113 114 <tr> 115 <td style='width:70%' class='forumheader3'>".DBLAN_8."</td> 116 <td class='forumheader3' style='width:30%;text-align:center'><input class='button' style='width: 100%' type='submit' name='backup_core' value='".DBLAN_9."' /> 117 <input type='hidden' name='sqltext' value='$sqltext' /> 118 </td></tr> 119 </table> 120 </form> 121 </div>"; 122 123 $ns->tablerender(DBLAN_10, $text); 124 125 function backup_core() { 126 global $pref, $sql; 127 $tmp = base64_encode((serialize($pref))); 128 if (!$sql->db_Insert("core", "'pref_backup', '{$tmp}' ")) { 129 $sql->db_Update("core", "e107_value='{$tmp}' WHERE e107_name='pref_backup'"); 130 } 131 } 132 133 function optimizesql($mySQLdefaultdb) { 134 135 $result = mysql_list_tables($mySQLdefaultdb); 136 while ($row = mysql_fetch_row($result)) { 137 mysql_query("OPTIMIZE TABLE ".$row[0]); 138 } 139 140 $str = " 141 <div style='text-align:center'> 142 <b>".DBLAN_11." $mySQLdefaultdb ".DBLAN_12.".</b> 143 144 <br /><br /> 145 146 <form method='POST' action='".e_SELF."'> 147 <input class='button' type='submit' name='back' value='".DBLAN_13."' /> 148 </form> 149 </div> 150 <br />"; 151 $ns = new e107table; 152 $ns->tablerender(DBLAN_14, $str); 153 154 } 155 156 157 function plugin_viewscan() 158 { 159 $error_messages = array(0 => DBLAN_31, 1 =>"<b>".DBLAN_32."</b>", 2 =>"<strong>".DBLAN_33."</strong>", 3 => DBLAN_34); 160 161 global $sql, $pref, $ns, $tp; 162 require_once(e_HANDLER."plugin_class.php"); 163 $ep = new e107plugin; 164 $ep->update_plugins_table(); // scan for e_xxx changes and save to plugin table. 165 $ep->save_addon_prefs(); // generate global e_xxx_list prefs from plugin table. 166 167 $ns -> tablerender(DBLAN_22, "<div style='text-align:center'>".DBLAN_23."<br /><br /><a href='".e_SELF."'>".DBLAN_13."</a></div>"); 168 169 $text = "<form method='post' action='".e_ADMIN."db.php' id='plug_edit'> 170 <div style='text-align:center'> <table class='fborder' style='".ADMIN_WIDTH."'> 171 <tr><td class='fcaption'>".DBLAN_24."</td> 172 <td class='fcaption'>".DBLAN_25."</td> 173 <td class='fcaption'>".DBLAN_26."<br />".DBLAN_30."</td> 174 <td class='fcaption'>".DBLAN_27."</td>"; 175 176 $sql -> db_Select("plugin", "*", "plugin_id !='' order by plugin_path ASC"); // Must order by path to pick up duplicates. (plugin names may change). 177 while($row = $sql-> db_Fetch()) 178 { 179 $text .= "<tr> 180 <td class='forumheader3'>".$tp->toHtml($row['plugin_name'],FALSE,"defs")."</td> 181 <td class='forumheader3'>".$row['plugin_path']."</td> 182 <td class='forumheader3'>"; 183 184 if (trim($row['plugin_addons'])) 185 { 186 $nl_code = ''; 187 foreach(explode(',',$row['plugin_addons']) as $this_addon) 188 { 189 $ret_code = 3; // Default to 'not checked 190 if (strpos($this_addon,'e_') === 0) 191 { 192 // echo "Checking: ".$row['plugin_path'].":".$this_addon."<br />"; 193 $ret_code = $ep->checkAddon($row['plugin_path'],$this_addon); // See whether spaces before opening tag or after closing tag 194 } 195 $text .= $nl_code.$this_addon." - ".$error_messages[$ret_code]; // $ret_code - 0=OK, 1=content error, 2=access error 196 $nl_code = "<br />"; 197 } 198 } 199 200 $text .= "</td> 201 <td class='forumheader3' style='text-align:center'>"; 202 if($previous == $row['plugin_path']) 203 { 204 $delid = $row['plugin_id']; 205 $delname = $row['plugin_name']; 206 $text .= "<input class='button' type='submit' title='".LAN_DELETE."' value='Delete Duplicate' name='delplug[$delid]' onclick=\"return jsconfirm('".LAN_CONFIRMDEL." ID:$delid [$delname]')\" />\n"; 207 } 208 else 209 { 210 $text .= ($row['plugin_installflag'] == 1) ? DBLAN_27 : " "; // "Installed and not installed"; 211 } 212 $text .= "</td> 213 </tr>"; 214 $previous = $row['plugin_path']; 215 } 216 // $text .= "<tr><td colspan='4' class='forumheader3'>".DBLAN_30."</td></tr>"; 217 $text .= "</table></div></form>"; 218 $ns -> tablerender(ADLAN_CL_7, $text); 219 220 } 221 222 223 function pref_editor() 224 { 225 global $pref,$ns,$tp; 226 ksort($pref); 227 228 $text = "<form method='post' action='".e_ADMIN."db.php' id='pref_edit'> 229 <div style='text-align:center'> 230 <table class='fborder' style='".ADMIN_WIDTH."'> 231 <tr> 232 <td class='fcaption'>".LAN_DELETE."</td> 233 <td class='fcaption'>".DBLAN_17."</td> 234 <td class='fcaption'>".DBLAN_18."</td> 235 <td class='fcaption'>".LAN_OPTIONS."</td> 236 </tr>"; 237 238 foreach($pref as $key=>$val) 239 { 240 $ptext = (is_array($val)) ? "<pre>".print_r($val,TRUE)."</pre>" : htmlspecialchars($val); 241 $ptext = $tp -> textclean($ptext, 80); 242 243 $text .= " 244 <tr> 245 <td class='forumheader3' style='width:40px;text-align:center'><input type='checkbox' name='delpref2[$key]' value='1' /></td> 246 <td class='forumheader3'>".$key."</td> 247 <td class='forumheader3' style='width:50%'>".$ptext."</td> 248 <td class='forumheader3' style='width:20px;text-align:center'> 249 <input type='image' title='".LAN_DELETE."' src='".ADMIN_DELETE_ICON_PATH."' name='delpref[$key]' onclick=\"return jsconfirm('".LAN_CONFIRMDEL." [$key]')\" /> 250 </td> 251 </tr>"; 252 } 253 $text .= "<tr><td class='forumheader' colspan='4' style='text-align:center'> 254 <input class='button' type='submit' title='".LAN_DELETE."' value=\"".DBLAN_21."\" name='delpref_checked' onclick=\"return jsconfirm('".LAN_CONFIRMDEL."')\" /> 255 </tr> 256 </table></div></form>"; 257 $text .= "<div style='text-align:center'><br /><a href='".e_SELF."'>".DBLAN_13."</a></div>\n"; 258 $ns -> tablerender(DBLAN_20, $text); 259 260 return $text; 261 262 } 263 264 265 266 function del_pref_val(){ 267 global $pref,$ns,$e107cache; 268 $del = array_keys($_POST['delpref']); 269 $delpref = $del[0]; 270 271 if($delpref) 272 { 273 unset($pref[$delpref]); 274 $deleted_list .= "<li>".$delpref."</li>"; 275 } 276 if($_POST['delpref2']){ 277 278 foreach($_POST['delpref2'] as $k=>$v) 279 { 280 $deleted_list .= "<li>".$k."</li>"; 281 unset($pref[$k]); 282 } 283 } 284 285 $message = "<div><br /><ul>".$deleted_list."</ul></div> 286 <div style='text-align:center'><br /><a href='".e_SELF."'>".DBLAN_13."</a></div>"; 287 save_prefs(); 288 $e107cache->clear(); 289 $ns -> tablerender(LAN_DELETED,$message); 290 291 } 292 293 function delete_plugin_entry() 294 { 295 global $sql,$ns; 296 $del = array_keys($_POST['delplug']); 297 $message = ($sql -> db_Delete("plugin", "plugin_id='".intval($del[0])."' LIMIT 1")) ? LAN_DELETED : LAN_DELETED_FAILED; 298 $caption = ($message == LAN_DELETED) ? LAN_DELETED : LAN_ERROR; 299 $ns -> tablerender($caption,$message); 300 } 301 302 require_once ("footer.php"); 303 304 ?>
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 |