Changeset 5068
- Timestamp:
- 09/19/07 21:01:45 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk/amp_conf/htdocs/admin/config.php
r4993 r5068 104 104 $active_modules = module_getinfo(false, MODULE_STATUS_ENABLED); 105 105 106 // initialize menu with module admin 107 $fpbx_menu = array( 108 'modules1' => array('display'=>'modules', 'type'=>'tool', 'category' => 'Admin', 'name' => 'Module Admin', 'sort' => -9), 109 'modules2' => array('display'=>'modules', 'type'=>'setup', 'category' => 'Admin', 'name' => 'Module Admin', 'sort' => -9), 110 ); 106 $fpbx_menu = array(); 107 111 108 112 109 // pointer to current item in $fpbx_menu, if applicable 113 110 $cur_menuitem = null; 114 111 115 // handler just to check hardcoded fpbx_menu items to see whats being displayed116 // For non-hardcoded modules we check this below while looping through $active_modules.117 // These are separate to avoid looping through $active_modules and then $fpbX_menu118 foreach ($fpbx_menu as $itemKey => $item) {119 if ($item['display'] == $display) {120 $cur_menuitem =& $fpbx_menu[$itemKey];121 }122 }123 124 // include any module global functions125 112 // add module sections to $fpbx_menu 126 113 $types = array(); … … 246 233 $module_page = ""; 247 234 $module_file = ""; 235 236 237 238 // hack to have our default display handler show the "welcome" view 239 // Note: this probably isn't REALLY needed if there is no menu item for "Welcome".. 240 // but it doesn't really hurt, and it provides a handler in case some page links 241 // to "?display=index" 242 if (($display == 'index') && ($cur_menuitem['module']['rawname'] == 'builtin')) { 243 $display = ''; 244 } 245 246 248 247 249 248 // show the appropriate page freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php
r5026 r5068 1893 1893 $sql = 'SELECT * FROM modules WHERE modulename = "'.$module.'"'; 1894 1894 } else { 1895 // get info on all modules 1895 // initialize list with "builtin" module 1896 $module_list = array('builtin'); 1897 1898 // read modules dir for module names 1896 1899 $dir = opendir($amp_conf['AMPWEBROOT'].'/admin/modules'); 1897 1900 while ($file = readdir($dir)) { 1898 1901 if (($file != ".") && ($file != "..") && ($file != "CVS") && 1899 1902 ($file != ".svn") && ($file != "_cache") && 1900 is_dir($amp_conf['AMPWEBROOT'].'/admin/modules/'.$file)) { 1901 1902 $xml = _module_readxml($file); 1903 if (!is_null($xml)) { 1904 $modules[$file] = $xml; 1905 // if status is anything else, it will be updated below when we read the db 1906 $modules[$file]['status'] = MODULE_STATUS_NOTINSTALLED; 1907 } 1908 } 1909 } 1910 1903 is_dir($amp_conf['AMPWEBROOT'].'/admin/modules/'.$file)) { 1904 $module_list[] = $file; 1905 } 1906 } 1907 1908 // read the xml for each 1909 foreach ($module_list as $file) { 1910 $xml = _module_readxml($file); 1911 if (!is_null($xml)) { 1912 $modules[$file] = $xml; 1913 // if status is anything else, it will be updated below when we read the db 1914 $modules[$file]['status'] = MODULE_STATUS_NOTINSTALLED; 1915 } 1916 } 1917 closedir($dir); 1918 1911 1919 // query to get everything 1912 1920 $sql = 'SELECT * FROM modules'; … … 1943 1951 } 1944 1952 } 1953 1954 // "builtin" module is always enabled 1955 $modules['builtin']['status'] = MODULE_STATUS_ENABLED; 1945 1956 1946 1957 if ($status !== false) { … … 2247 2258 return array(_("Module not found in repository")); 2248 2259 } 2249 2260 2250 2261 $file = basename($res['location']); 2251 2262 $filename = $amp_conf['AMPWEBROOT']."/admin/modules/_cache/".$file; … … 2680 2691 function _module_readxml($modulename) { 2681 2692 global $amp_conf; 2682 $dir = $amp_conf['AMPWEBROOT'].'/admin/modules/'.$modulename; 2683 if (is_dir($dir) && file_exists($dir.'/module.xml')) { 2684 $data = file_get_contents($dir.'/module.xml'); 2693 switch ($modulename) { 2694 case 'builtin': // special handling 2695 $dir = $amp_conf['AMPWEBROOT']; 2696 $xmlfile = $dir.'/admin/module-builtin.xml'; 2697 break; 2698 default: 2699 $dir = $amp_conf['AMPWEBROOT'].'/admin/modules/'.$modulename; 2700 $xmlfile = $dir.'/module.xml'; 2701 break; 2702 } 2703 2704 if (file_exists($xmlfile)) { 2705 $data = file_get_contents($xmlfile); 2685 2706 //$parser = new xml2ModuleArray($data); 2686 2707 //$xmlarray = $parser->parseModulesXML($data);
