Changeset 4063

Show
Ignore:
Timestamp:
06/14/07 11:57:53 (1 year ago)
Author:
p_lindheimer
Message:

add ability to disable 'Disable' and 'Uninstall' of certain modules based on an xml tag or hard coded overides for critical modules like core

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php

    r4058 r4063  
    11591159                if ($override_xml) { 
    11601160                        $fn = $override_xml."modules-".$matches[1].".xml"; 
    1161                 } elseif (isset($amp_conf["AMPMODULEXML"])) { 
    1162                         $fn = $amp_conf["AMPMODULEXML"]."modules-".$matches[1].".xml"; 
    1163                         // echo "(From amportal.conf)"; //debug 
    11641161                } else { 
    11651162                        $fn = "http://mirror.freepbx.org/modules-".$matches[1].".xml"; 
     
    16231620        if ($override_svn) { 
    16241621                $url = $override_svn.$res['location']; 
    1625         } elseif (isset($amp_conf['AMPMODULESVN'])) { 
    1626                 $url = $amp_conf['AMPMODULESVN'].$res['location']; 
    16271622        } else { 
    16281623                $url = "http://mirror.freepbx.org/modules/".$res['location']; 
     
    22612256        // and there is nothing in the array (couldn't find a mac) then we will make it purely random 
    22622257        // 
    2263         if ($chosen_mac != "") { 
     2258  if ($type == "vmware") { 
     2259                //vmware machines will have repeated macs so make random 
     2260                //echo "generating randomly\n"; 
     2261                return _module_generate_random_id($type); 
     2262        } else if ($chosen_mac != "") { 
    22642263                //echo "generating with: $chosen_mac\n"; 
    22652264                return _module_generate_random_id($type, $chosen_mac); 
     
    22712270                return _module_generate_random_id($type); 
    22722271        } 
    2273 } 
     2272}  
    22742273 
    22752274 
     
    23402339                } 
    23412340        } 
    2342         if (isset($amp_conf['AMPMODULESVN'])) { 
    2343                 $url = $amp_conf['AMPMODULESVN'].$res['location']; 
    2344                 // echo "(From amportal.conf)"; // debug 
    2345         } else { 
     2341 
    23462342        $url = "http://mirror.freepbx.org/modules/".$res['location']; 
    2347                 // echo "(From default)"; // debug 
    2348         } 
     2343 
    23492344        $fp = @fopen($filename,"w"); 
    23502345        $filedata = file_get_contents($url); 
  • freepbx/trunk/amp_conf/htdocs/admin/page.modules.php

    r4058 r4063  
    226226} 
    227227 
     228/* enable_option($module_name, $option) 
     229   This function will return false if the particular option, which is a module xml tag, 
     230         is set to 'no'. It also provides for some hardcoded overrides on critical modules to 
     231         keep people from editing the xml themselves and then breaking their the system. 
     232*/ 
     233function enable_option($module_name, $option) { 
     234        global $modules; 
     235 
     236        $enable=true; 
     237        $override = array('core'      => array('candisable' => 'no', 
     238                                               'canuninstall' => 'no', 
     239                                                                      ), 
     240                          'framework' => array('candisable' => 'no', 
     241                                               'canuninstall' => 'no', 
     242                                                                                                                                                          ), 
     243                         ); 
     244 
     245        if (isset($modules[$module_name][$option]) && strtolower(trim($modules[$module_name][$option])) == 'no') { 
     246                $enable=false; 
     247        } 
     248        if (isset($override[$module_name][$option]) && strtolower(trim($override[$module_name][$option])) == 'no') { 
     249                $enable=false; 
     250        } 
     251 
     252        return $enable; 
     253} 
     254 
     255//-------------------------------------------------------------------------------------------------------- 
    228256switch ($extdisplay) {  // process, confirm, or nothing 
    229257        case 'process': 
     
    677705                                                } 
    678706                                        } 
    679                                         echo '<input type="radio" id="disable_'.prep_id($name).'" name="moduleaction['.prep_id($name).']" value="disable" /> '. 
    680                                                  '<label for="disable_'.prep_id($name).'">'._('Disable').'</label> <br />'; 
    681                                         if (!EXTERNAL_PACKAGE_MANAGEMENT) { 
     707                                        if (enable_option($name,'candisable')) { 
     708                                                echo '<input type="radio" id="disable_'.prep_id($name).'" name="moduleaction['.prep_id($name).']" value="disable" /> '. 
     709                                                   '<label for="disable_'.prep_id($name).'">'._('Disable').'</label> <br />'; 
     710                                        } 
     711                                        if (!EXTERNAL_PACKAGE_MANAGEMENT && enable_option($name,'canuninstall')) { 
    682712                                                echo '<input type="radio" id="uninstall_'.prep_id($name).'" name="moduleaction['.prep_id($name).']" value="uninstall" /> '. 
    683713                                                         '<label for="uninstall_'.prep_id($name).'">'._('Uninstall').'</label> <br />'; 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads