[ Index ] |
|
Code source de Phorum 5.1.25 |
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_ADMIN")) return; 21 22 $error=""; 23 24 if(count($_POST)){ 25 26 foreach($_POST as $key=>$value){ 27 $key = base64_decode($key); 28 if(substr($key, 0, 5)=="mods_") { 29 30 $mod=substr($key, 5); 31 $mods[$mod]=$value; 32 } 33 } 34 35 foreach($_POST as $key=>$value){ 36 $key = base64_decode($key); 37 if(substr($key, 0, 6)=="hooks_"){ 38 $mod=substr($key, 6); 39 if($mods[$mod]==1){ 40 41 $hook_arr=explode(",", $value); 42 foreach($hook_arr as $hk){ 43 $parts=explode("|", $hk); 44 $hooks[$parts[0]]["mods"][]=$mod; 45 $hooks[$parts[0]]["funcs"][]=$parts[1]; 46 } 47 } 48 } 49 } 50 51 $data=array("hooks"=>$hooks, "mods"=>$mods); 52 53 if(phorum_db_update_settings($data)){ 54 phorum_admin_okmsg("Module settings updated successfully"); 55 } else { 56 $error="Database error while updating settings."; 57 } 58 59 } 60 61 if($error){ 62 phorum_admin_error($error); 63 } 64 65 // read plugin info 66 67 $d = dir("./mods"); 68 while (false !== ($entry = $d->read())) { 69 $lines = array(); 70 if(file_exists("./mods/$entry/info.txt")){ 71 $lines=file("./mods/$entry/info.txt"); 72 } elseif(is_file("./mods/$entry") && substr($entry, -4)==".php"){ 73 $entry=str_replace(".php", "", $entry); 74 $data = file_get_contents("./mods/$entry.php"); 75 if($data = stristr($data, "/* phorum module info")){ 76 $data = substr($data, 0, strpos($data, "*/")); 77 $lines = preg_split('!(\r|\n|\r\n)!', $data); 78 } 79 } 80 if(count($lines)){ 81 $plugins[$entry]=array(); 82 foreach($lines as $line){ 83 if(strstr($line, ":")){ 84 $parts=explode(":", trim($line), 2); 85 if($parts[0]=="hook"){ 86 $plugins[$entry]["hooks"][]=trim($parts[1]); 87 } else { 88 $plugins[$entry][$parts[0]]=trim($parts[1]); 89 } 90 } 91 } 92 $plugins[$entry]["hooks"]=implode(",", $plugins[$entry]["hooks"]); 93 94 if(file_exists("./mods/$entry/settings.php")){ 95 $plugins[$entry]["settings"]=true; 96 } else { 97 $plugins[$entry]["settings"]=false; 98 } 99 } 100 } 101 $d->close(); 102 103 include_once "./include/admin/PhorumInputForm.php"; 104 105 $frm =& new PhorumInputForm ("", "post"); 106 107 $frm->addbreak("Phorum Module Settings"); 108 109 $frm->hidden("module", "mods"); 110 111 function plugin_sort($a, $b) { return strcmp($a["title"], $b["title"]); } 112 uasort($plugins, "plugin_sort"); 113 114 foreach($plugins as $name => $plugin){ 115 116 if(isset($mods[$name])){ 117 $thisval=$mods[$name]; 118 } elseif(isset($PHORUM["mods"]["$name"])){ 119 $thisval=$PHORUM["mods"]["$name"]; 120 } else { 121 $thisval=0; 122 } 123 124 if($plugin["settings"]){ 125 if($thisval==0){ 126 $settings_link="<br /><a href=\"javascript:alert('You can not edit settings for a module unless it is turned On.');\">Settings</a>"; 127 } else { 128 $settings_link="<br /><a href=\"{$PHORUM["admin_http_path"]}?module=modsettings&mod=$name\">Settings</a>"; 129 } 130 } else { 131 $settings_link=""; 132 } 133 134 $frm->hidden(base64_encode("hooks_$name"), $plugin["hooks"]); 135 $frm->addrow("$plugin[title]<div class=\"small\">".wordwrap($plugin["desc"], 90, "<br />")."</div>", $frm->select_tag(base64_encode("mods_$name"), array("Off", "On"), $thisval).$settings_link); 136 137 } 138 139 $frm->show(); 140 141 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 12:22:27 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |