Changeset 6539

Show
Ignore:
Timestamp:
09/02/08 18:41:54 (3 years ago)
Author:
p_lindheimer
Message:

Merged revisions 6492-6538 via svnmerge from
http://svn.freepbx.org/freepbx/branches/2.5

........

r6504 | p_lindheimer | 2008-08-29 11:13:55 -0700 (Fri, 29 Aug 2008) | 1 line


don't define WEBROOT if AMPWEBADDRESS is not defined, it breaks the graphing libraries (which seem to otherwise function fine without it defined)

........

r6505 | p_lindheimer | 2008-08-29 14:55:13 -0700 (Fri, 29 Aug 2008) | 1 line


make max files for call monitor configurable within main.conf.php, default remains the same

........

r6506 | p_lindheimer | 2008-08-29 15:16:05 -0700 (Fri, 29 Aug 2008) | 1 line


return the raw Asterisk version info obtained from checking the version info re #2750 and re #3128

........

r6513 | p_lindheimer | 2008-08-30 20:53:16 -0700 (Sat, 30 Aug 2008) | 1 line


re #3124 put url in auto-generated warnings to reference further help, still need to update all the fixed files with similar warnings but they should consider including some custom instructions such as sip.conf can suggest what sort of sip settings go in which includes files, etc.

........

r6515 | p_lindheimer | 2008-08-31 07:35:02 -0700 (Sun, 31 Aug 2008) | 1 line


re #3134 makes ajax refresh rates for dashboard configurable

........

r6519 | p_lindheimer | 2008-08-31 15:40:00 -0700 (Sun, 31 Aug 2008) | 1 line


re #3131 add Mixmonitor and Stopmonitor to extension class

........

r6525 | p_lindheimer | 2008-08-31 16:36:33 -0700 (Sun, 31 Aug 2008) | 49 lines


closes #3137


db_connect.php:

  • removed all checks for notification panel when in quietmode since
    it's usually used for ajax calls and other light weight calls
    that can do without the overhead.

config.php:

  • added restrictmods parameter, populated with '/' separted module
    names. If passed, only these modules will have their functions.inc.php
    files included. Used for light weight ajax and similar calls, to
    avoid the overhead if we know we don't need those.

  • removed all checks for notification panel when in quietmode. Removed
    the inclusion of hooks when in quietmode.

functions.inc.php:

  • added modulelist class, used to cache the module xml structure which
    is now serialized and saved to the db to avoid the heavy xml processing
    overhead of reading all the module.xml files. (should probably move
    most of module_getinfo() into the class but for starters just did minimal
    changes to avoid introducing bugs since this is pretty sensitive).
  • fixed several instances of using " instead of ' in sql satements which
    breaks sqlite3 queries often.
  • replaced all instances of addslashes() with $db->escapeSimple() since
    sqlite3 is not compatible with addslashes() and this makes it db
    independent through pear.
  • added third argument to module_getinfo() defaulting in false. Setting to
    true forces a read of all the module.xml files. Module Admin and
    module_admin should always set this to true.

header.php

  • removed all checks for notification panel when in quietmode

page.modules.php

  • added third true paramter to module_getinfo

........

r6526 | p_lindheimer | 2008-08-31 17:16:27 -0700 (Sun, 31 Aug 2008) | 49 lines


closes #3137


module_admin

  • added third true paramter to module_getinfo

........

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk

    • Property svnmerge-integrated changed from /freepbx/branches/2.4:1-5944 /freepbx/branches/2.5:1-6491 to /freepbx/branches/2.4:1-5944 /freepbx/branches/2.5:1-6538
  • freepbx/trunk/CHANGES

    r6492 r6539  
    112.5.0 Added in rc2 
     2 
    23- Add queue weights setting and autfill setting per queue. Set persistentmember=yes 
    34  in queues general section to apply to all queues. 
     
    9293 CDRDBTYPE: mysql or postgres mysql is default 
    9394 CDRDBTABLENAME: Name of the table in the db where the cdr is stored cdr is default  
     95 
     96 DASHBOARD_STATS_UPDATE_TIME=integer_seconds 
     97 DEFAULT VALUE: 6 
     98 DASHBOARD_INFO_UPDATE_TIME=integer_seconds 
     99 DEFAULT VALUE: 20 
     100 These can be used to change the refresh rate of the System Status Panel. Most of 
     101 the stats are updated based on the STATS interval but a few items are checked 
     102 less frequently (such as Astersisk Uptime) based on the INFO value 
    94103 
    95104 
  • freepbx/trunk/amp_conf/bin/module_admin

    r5107 r6539  
    136136 
    137137function showList($online = false) { 
    138   $modules_local = module_getinfo(); 
     138  $modules_local = module_getinfo(false,false,true); 
    139139  $modules = $modules_local; 
    140140  if ($online) { 
  • freepbx/trunk/amp_conf/bin/retrieve_conf

    r6492 r6539  
    1515 
    1616//define("ASTERISK_CONF", "/etc/asterisk/asterisk.conf"); 
    17 define("WARNING_BANNER", "; "._("do not edit this file, this is an auto-generated file by freepbx\n")."; "._("all modifications must be done from the web gui")."\n\n\n"); 
     17define("WARNING_BANNER", _(";--------------------------------------------------------------------------------;\n; Do NOT edit this file as it is auto-generated by FreePBX. All modifications to ;\n; this file must be done via the web gui. There are alternative files to make    ;\n; custom modifications, details at: http://freepbx.org/configuration_files       ;\n;--------------------------------------------------------------------------------;\n;\n\n")); 
    1818 
    1919// Emulate gettext extension functions if gettext is not available 
  • freepbx/trunk/amp_conf/htdocs/admin/cdr/lib/defines.php

    r6272 r6539  
    1616 
    1717 
    18 define ("WEBROOT", "http://".$amp_conf["AMPWEBADDRESS"]."/admin/cdr/"); 
     18if (isset($amp_conf["AMPWEBADDRESS"])) { 
     19  define ("WEBROOT", "http://".$amp_conf["AMPWEBADDRESS"]."/admin/cdr/"); 
     20
    1921define ("FSROOT", $amp_conf["AMPWEBROOT"]."/admin/cdr/"); 
    2022 
  • freepbx/trunk/amp_conf/htdocs/admin/common/db_connect.php

    r6492 r6539  
    7272// Now send or delete warning wrt to default passwords: 
    7373// 
    74 $nt = notifications::create($db); 
     74if (!$quietmode) { 
     75  $nt = notifications::create($db); 
    7576 
    76 if ($amp_conf['AMPDBPASS'] == $amp_conf_defaults['AMPDBPASS'][1]) { 
    77   $nt->add_warning('core', 'AMPDBPASS', _("Default SQL Password Used"), _("You are using the default SQL password that is widely known, you should set a secure password")); 
    78 } else { 
    79   $nt->delete('core', 'AMPDBPASS'); 
     77  if ($amp_conf['AMPDBPASS'] == $amp_conf_defaults['AMPDBPASS'][1]) { 
     78    $nt->add_warning('core', 'AMPDBPASS', _("Default SQL Password Used"), _("You are using the default SQL password that is widely known, you should set a secure password")); 
     79  } else { 
     80    $nt->delete('core', 'AMPDBPASS'); 
     81  } 
     82 
     83  // Check and increase php memory_limit if needed and if allowed on the system 
     84  // 
     85  $current_memory_limit = rtrim(ini_get('memory_limit'),'M'); 
     86  $proper_memory_limit = '100'; 
     87  if ($current_memory_limit < $proper_memory_limit) { 
     88    if (ini_set('memory_limit',$proper_memory_limit.'M') !== false) { 
     89      $nt->add_notice('core', 'MEMLIMIT', _("Memory Limit Changed"), sprintf(_("Your memory_limit, %sM, is set too low and has been increased to %sM. You may want to change this in you php.ini config file"),$current_memory_limit,$proper_memory_limit)); 
     90    } else { 
     91      $nt->add_warning('core', 'MEMERR', _("Low Memory Limit"), sprintf(_("Your memory_limit, %sM, is set too low and may cause problems. FreePBX is not able to change this on your system. You should increase this to %sM in you php.ini config file"),$current_memory_limit,$proper_memory_limit)); 
     92    } 
     93  } else { 
     94    $nt->delete('core', 'MEMLIMIT'); 
     95  } 
     96 
     97  // send error if magic_quotes_gpc is enabled on this system as much of the code base assumes not 
     98  // 
     99  if(get_magic_quotes_gpc()) { 
     100    $nt->add_error('core', 'MQGPC', _("Magic Quotes GPC"), _("You have magic_quotes_gpc enabled in your php.ini, http or .htaccess file which will cause errors in some modules. FreePBX expects this to be off and runs under that assumption")); 
     101  } else { 
     102    $nt->delete('core', 'MQGPC'); 
     103  } 
    80104} 
    81  
    82 // Check and increase php memory_limit if needed and if allowed on the system 
    83 // 
    84 $current_memory_limit = rtrim(ini_get('memory_limit'),'M'); 
    85 $proper_memory_limit = '100'; 
    86 if ($current_memory_limit < $proper_memory_limit) { 
    87   if (ini_set('memory_limit',$proper_memory_limit.'M') !== false) { 
    88     $nt->add_notice('core', 'MEMLIMIT', _("Memory Limit Changed"), sprintf(_("Your memory_limit, %sM, is set too low and has been increased to %sM. You may want to change this in you php.ini config file"),$current_memory_limit,$proper_memory_limit)); 
    89   } else { 
    90     $nt->add_warning('core', 'MEMERR', _("Low Memory Limit"), sprintf(_("Your memory_limit, %sM, is set too low and may cause problems. FreePBX is not able to change this on your system. You should increase this to %sM in you php.ini config file"),$current_memory_limit,$proper_memory_limit)); 
    91   } 
    92 } else { 
    93   $nt->delete('core', 'MEMLIMIT'); 
    94 } 
    95  
    96 // send error if magic_quotes_gpc is enabled on this system as much of the code base assumes not 
    97 // 
    98 if(get_magic_quotes_gpc()) { 
    99   $nt->add_error('core', 'MQGPC', _("Magic Quotes GPC"), _("You have magic_quotes_gpc enabled in your php.ini, http or .htaccess file which will cause errors in some modules. FreePBX expects this to be off and runs under that assumption")); 
    100 } else { 
    101   $nt->delete('core', 'MQGPC'); 
    102 } 
  • freepbx/trunk/amp_conf/htdocs/admin/config.php

    r5773 r6539  
    2323$action = isset($_REQUEST['action'])?$_REQUEST['action']:null; 
    2424$quietmode = isset($_REQUEST['quietmode'])?$_REQUEST['quietmode']:''; 
     25if (isset($_REQUEST['restrictmods'])) { 
     26  $restrict_mods = explode('/',$_REQUEST['restrictmods']); 
     27  $restrict_mods = array_flip($restrict_mods); 
     28} else { 
     29  $restrict_mods = false; 
     30} 
    2531 
    2632// determine module type to show, default to 'setup' 
     
    96102} 
    97103 
    98  
    99 module_run_notification_checks(); 
     104if (!$quietmode) { 
     105  module_run_notification_checks(); 
     106
    100107 
    101108$framework_asterisk_running =  checkAstMan(); 
     
    116123  foreach($active_modules as $key => $module) { 
    117124    //include module functions 
    118     if (is_file("modules/{$key}/functions.inc.php")) { 
     125    if ((!$restrict_mods || isset($restrict_mods[$key])) && is_file("modules/{$key}/functions.inc.php")) { 
    119126      require_once("modules/{$key}/functions.inc.php"); 
    120127    } 
     
    122129    //create an array of module sections to display 
    123130    // stored as [items][$type][$category][$name] = $displayvalue 
    124     if (isset($module['items']) && is_array($module['items'])) { 
     131    if (!$quitemode && isset($module['items']) && is_array($module['items'])) { 
    125132      // loop through the types 
    126133      foreach($module['items'] as $itemKey => $item) { 
     
    175182 
    176183// new gui hooks 
    177 if(is_array($active_modules)){ 
     184if(!$quietmode && is_array($active_modules)){ 
    178185  foreach($active_modules as $key => $module) { 
     186 
    179187    if (isset($module['items']) && is_array($module['items'])) { 
    180188      foreach($module['items'] as $itemKey => $itemName) { 
     
    195203 
    196204// extensions vs device/users ... this is a bad design, but hey, it works 
    197 if (isset($amp_conf["AMPEXTENSIONS"]) && ($amp_conf["AMPEXTENSIONS"] == "deviceanduser")) { 
    198   unset($fpbx_menu["extensions"]); 
    199 } else { 
    200   unset($fpbx_menu["devices"]); 
    201   unset($fpbx_menu["users"]); 
     205if (!$quietmode) { 
     206  if (isset($amp_conf["AMPEXTENSIONS"]) && ($amp_conf["AMPEXTENSIONS"] == "deviceanduser")) { 
     207    unset($fpbx_menu["extensions"]); 
     208  } else { 
     209    unset($fpbx_menu["devices"]); 
     210    unset($fpbx_menu["users"]); 
     211  } 
    202212} 
    203213 
  • freepbx/trunk/amp_conf/htdocs/admin/extensions.class.php

    r6314 r6539  
    11831183} 
    11841184 
     1185class ext_mixmonitor extends extension { 
     1186  var $file; 
     1187  var $options; 
     1188  var $postcommand; 
     1189   
     1190  function ext_mixmonitor($file, $options = "", $postcommand = "") { 
     1191    $this->file = $file; 
     1192    $this->options = $options; 
     1193    $this->postcommand = $postcommand; 
     1194  } 
     1195   
     1196  function output() { 
     1197    return "MixMonitor(".$this->file.",".$this->options.",".$this->postcommand.")"; 
     1198  } 
     1199} 
     1200 
     1201class ext_stopmonitor extends extension { 
     1202  function output() { 
     1203    return "StopMonitor(".$this->data.")"; 
     1204  } 
     1205} 
     1206 
     1207 
    11851208 
    11861209/* example usage 
  • freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php

    r6492 r6539  
    169169define("NOTIFICATION_TYPE_WARNING" , 500); 
    170170define("NOTIFICATION_TYPE_NOTICE",   600); 
     171 
     172class modulelist { 
     173  var $_loaded = false; 
     174  var $module_array = array(); 
     175  var $_db; 
     176 
     177  function &create(&$db) { 
     178    static $obj; 
     179    if (!isset($obj)) { 
     180      $obj = new modulelist($db); 
     181    } 
     182    return $obj; 
     183  } 
     184  function modulelist(&$db) { 
     185    $this->_db =& $db; 
     186    $module_serialized = sql("SELECT `data` FROM `module_xml` WHERE `id` = 'mod_serialized'","getOne"); 
     187    if (isset($module_serialized) && $module_serialized) { 
     188      $this->module_array = (unserialize($module_serialized)); 
     189      $this->_loaded = true; 
     190    } 
     191  } 
     192  function is_loaded() { 
     193    return $this->_loaded; 
     194  } 
     195  function initialize(&$module_list) { 
     196    $this->module_array = $module_list; 
     197    $module_serialized = $this->_db->escapeSimple(serialize($this->module_array)); 
     198    sql("DELETE FROM `module_xml` WHERE `id` = 'mod_serialized'"); 
     199    sql("INSERT INTO `module_xml` (`id`, `time`, `data`) VALUES ('mod_serialized', '".time()."','".$module_serialized."')"); 
     200    $this->_loaded = true; 
     201  } 
     202  function invalidate() { 
     203    unset($this->module_array); 
     204    sql("DELETE FROM `module_xml` WHERE `id` = 'mod_serialized'"); 
     205    $this->_loaded = false; 
     206  } 
     207} 
     208 
     209 
    171210 
    172211class notifications { 
     
    921960  global $db; 
    922961   
    923   $sql = "SELECT username, password, extension_low, extension_high, deptname, sections FROM ampusers WHERE username = '".addslashes($username)."'"; 
     962  $sql = "SELECT username, password, extension_low, extension_high, deptname, sections FROM ampusers WHERE username = '".$db->escapeSimple($username)."'"; 
    924963  $results = $db->getAll($sql); 
    925964  if(DB::IsError($results)) { 
     
    10281067       
    10291068      if (preg_match('/Asterisk (\d+(\.\d+)*)(-?(\S*))/', $verinfo, $matches)) { 
    1030         return array('engine'=>'asterisk', 'version' => $matches[1], 'additional' => $matches[4]); 
     1069        return array('engine'=>'asterisk', 'version' => $matches[1], 'additional' => $matches[4], 'raw' => $verinfo); 
    10311070      } elseif (preg_match('/Asterisk SVN-(\d+(\.\d+)*)(-?(\S*))/', $verinfo, $matches)) { 
    1032         return array('engine'=>'asterisk', 'version' => $matches[1], 'additional' => $matches[4]); 
     1071        return array('engine'=>'asterisk', 'version' => $matches[1], 'additional' => $matches[4], 'raw' => $verinfo); 
    10331072      } elseif (preg_match('/Asterisk SVN-branch-(\d+(\.\d+)*)-r(-?(\S*))/', $verinfo, $matches)) { 
    1034         return array('engine'=>'asterisk', 'version' => $matches[1].'.'.$matches[4], 'additional' => $matches[4]); 
     1073        return array('engine'=>'asterisk', 'version' => $matches[1].'.'.$matches[4], 'additional' => $matches[4], 'raw' => $verinfo); 
    10351074      } elseif (preg_match('/Asterisk SVN-trunk-r(-?(\S*))/', $verinfo, $matches)) { 
    1036         return array('engine'=>'asterisk', 'version' => '1.6', 'additional' => $matches[1]); 
     1075        return array('engine'=>'asterisk', 'version' => '1.6', 'additional' => $matches[1], 'raw' => $verinfo); 
    10371076      } elseif (preg_match('/Asterisk SVN-.+-(\d+(\.\d+)*)-r(-?(\S*))-(.+)/', $verinfo, $matches)) { 
    1038         return array('engine'=>'asterisk', 'version' => $matches[1], 'additional' => $matches[3]); 
    1039       } 
    1040  
    1041       return array('engine'=>'ERROR-UNABLE-TO-CONNECT', 'version'=>'0', 'additional' => '0'); 
     1077        return array('engine'=>'asterisk', 'version' => $matches[1], 'additional' => $matches[3], 'raw' => $verinfo); 
     1078      } 
     1079 
     1080      return array('engine'=>'ERROR-UNABLE-TO-CONNECT', 'version'=>'0', 'additional' => '0', 'raw' => $verinfo); 
    10421081    break; 
    10431082  } 
    1044   return array('engine'=>'ERROR-UNSUPPORTED-ENGINE-'.$amp_conf['AMPENGINE'], 'version'=>'0', 'additional' => '0'); 
     1083  return array('engine'=>'ERROR-UNSUPPORTED-ENGINE-'.$amp_conf['AMPENGINE'], 'version'=>'0', 'additional' => '0', 'raw' => $verinfo); 
    10451084} 
    10461085 
     
    17571796  function legacy_extensions_del($context,$exten) { 
    17581797    global $db; 
    1759     $sql = "DELETE FROM extensions WHERE context = '".addslashes($context)."' AND `extension` = '".addslashes($exten)."'"; 
     1798    $sql = "DELETE FROM extensions WHERE context = '".$db->escapeSimple($context)."' AND `extension` = '".$db->escapeSimple($exten)."'"; 
    17601799    $result = $db->query($sql); 
    17611800    if(DB::IsError($result)) { 
     
    17691808  function legacy_args_get($exten,$priority,$context) { 
    17701809    global $db; 
    1771     $sql = "SELECT args FROM extensions WHERE extension = '".addslashes($exten)."' AND priority = '".addslashes($priority)."' AND context = '".addslashes($context)."'"; 
     1810    $sql = "SELECT args FROM extensions WHERE extension = '".$db->escapeSimple($exten)."' AND priority = '".$db->escapeSimple($priority)."' AND context = '".$db->escapeSimple($context)."'"; 
    17721811    list($args) = $db->getRow($sql); 
    17731812    return $args; 
     
    21132152function module_getonlinexml($module = false, $override_xml = false) { // was getModuleXml() 
    21142153  global $amp_conf; 
     2154  global $db; 
    21152155   
    21162156  global $module_getonlinexml_error;  // okay, yeah, this sucks, but there's no other good way to do it without breaking BC 
     
    21232163  */ 
    21242164   
    2125   $result = sql('SELECT * FROM module_xml WHERE id = "xml"','getRow',DB_FETCHMODE_ASSOC); 
     2165  $result = sql("SELECT * FROM module_xml WHERE id = 'xml'",'getRow',DB_FETCHMODE_ASSOC); 
    21262166  $data = $result['data']; 
    21272167   
     
    21602200      // Compare the download to our current XML to see if anything changed for the notification system. 
    21612201      // 
    2162       $sql = 'SELECT data FROM module_xml WHERE id = "xml"'
     2202      $sql = "SELECT data FROM module_xml WHERE id = 'xml'"
    21632203      $old_xml = sql($sql, "getOne"); 
    21642204      $got_new = true; 
    21652205      // remove the old xml 
    2166       sql('DELETE FROM module_xml WHERE id = "xml"'); 
     2206      sql("DELETE FROM module_xml WHERE id = 'xml'"); 
    21672207      // update the db with the new xml 
    2168       $data4sql = addslashes($data); 
    2169       sql('INSERT INTO module_xml (id,time,data) VALUES ("xml",'.time().',"'.$data4sql.'")'); 
     2208      $data4sql = $db->escapeSimple($data); 
     2209      sql("INSERT INTO module_xml (id,time,data) VALUES ('xml',".time().",'".$data4sql."')"); 
    21702210    } 
    21712211  } 
     
    23052345 *                either be one value, or an array of values. 
    23062346 */ 
    2307 function module_getinfo($module = false, $status = false) { 
     2347function module_getinfo($module = false, $status = false, $forceload = false) { 
     2348 
    23082349  global $amp_conf, $db; 
    23092350  $modules = array(); 
     
    23212362    $sql = 'SELECT * FROM modules WHERE modulename = "'.$module.'"'; 
    23222363  } else { 
    2323     // initialize list with "builtin" module 
    2324     $module_list = array('builtin'); 
    2325  
    2326     // read modules dir for module names 
    2327     $dir = opendir($amp_conf['AMPWEBROOT'].'/admin/modules'); 
    2328     while ($file = readdir($dir)) { 
    2329       if (($file != ".") && ($file != "..") && ($file != "CVS") &&  
    2330           ($file != ".svn") && ($file != "_cache") &&  
    2331           is_dir($amp_conf['AMPWEBROOT'].'/admin/modules/'.$file)) { 
    2332         $module_list[] = $file; 
    2333       } 
    2334     } 
    2335  
    2336     // read the xml for each 
    2337     foreach ($module_list as $file) { 
    2338       $xml = _module_readxml($file); 
    2339       if (!is_null($xml)) { 
    2340         $modules[$file] = $xml; 
    2341         // if status is anything else, it will be updated below when we read the db 
    2342         $modules[$file]['status'] = MODULE_STATUS_NOTINSTALLED; 
    2343       } 
    2344     } 
    2345     closedir($dir); 
    2346  
    2347     // query to get everything 
    2348     $sql = 'SELECT * FROM modules'; 
     2364    // create the modulelist so it is static and does not need to be recreated 
     2365    // in subsequent calls 
     2366    // 
     2367    $modulelist =& modulelist::create($db); 
     2368    if ($forceload) { 
     2369      $modulelist->invalidate(); 
     2370    } 
     2371    if (!$modulelist->is_loaded()) { 
     2372      // initialize list with "builtin" module 
     2373      $module_list = array('builtin'); 
     2374 
     2375      // read modules dir for module names 
     2376      $dir = opendir($amp_conf['AMPWEBROOT'].'/admin/modules'); 
     2377      while ($file = readdir($dir)) { 
     2378        if (($file != ".") && ($file != "..") && ($file != "CVS") &&  
     2379            ($file != ".svn") && ($file != "_cache") &&  
     2380            is_dir($amp_conf['AMPWEBROOT'].'/admin/modules/'.$file)) { 
     2381          $module_list[] = $file; 
     2382        } 
     2383      } 
     2384 
     2385      // read the xml for each 
     2386      foreach ($module_list as $file) { 
     2387        $xml = _module_readxml($file); 
     2388        if (!is_null($xml)) { 
     2389          $modules[$file] = $xml; 
     2390          // if status is anything else, it will be updated below when we read the db 
     2391          $modules[$file]['status'] = MODULE_STATUS_NOTINSTALLED; 
     2392        } 
     2393      } 
     2394      closedir($dir); 
     2395 
     2396      // query to get everything 
     2397      $sql = 'SELECT * FROM modules'; 
     2398    } 
    23492399  } 
    23502400  // determine details about this module from database 
    23512401  // modulename should match the directory name 
    23522402   
    2353   $results = $db->getAll($sql,DB_FETCHMODE_ASSOC); 
    2354   if(DB::IsError($results)) { 
    2355     die_freepbx($results->getMessage()); 
    2356   } 
    2357    
    2358   if (is_array($results)) { 
    2359     foreach($results as $row) { 
    2360       if (isset($modules[ $row['modulename'] ])) { 
    2361         if ($row['enabled'] != 0) { 
     2403  if ($module || !$modulelist->is_loaded()) { 
     2404    $results = $db->getAll($sql,DB_FETCHMODE_ASSOC); 
     2405    if(DB::IsError($results)) { 
     2406      die_freepbx($results->getMessage()); 
     2407    } 
     2408   
     2409    if (is_array($results)) { 
     2410      foreach($results as $row) { 
     2411        if (isset($modules[ $row['modulename'] ])) { 
     2412          if ($row['enabled'] != 0) { 
    23622413           
    2363           // check if file and registered versions are the same 
    2364           // version_compare returns 0 if no difference 
    2365           if (version_compare_freepbx($row['version'], $modules[ $row['modulename'] ]['version']) == 0) { 
    2366             $modules[ $row['modulename'] ]['status'] = MODULE_STATUS_ENABLED; 
     2414            // check if file and registered versions are the same 
     2415            // version_compare returns 0 if no difference 
     2416            if (version_compare_freepbx($row['version'], $modules[ $row['modulename'] ]['version']) == 0) { 
     2417              $modules[ $row['modulename'] ]['status'] = MODULE_STATUS_ENABLED; 
     2418            } else { 
     2419              $modules[ $row['modulename'] ]['status'] = MODULE_STATUS_NEEDUPGRADE; 
     2420            } 
     2421           
    23672422          } else { 
    2368             $modules[ $row['modulename'] ]['status'] = MODULE_STATUS_NEEDUPGRADE
     2423            $modules[ $row['modulename'] ]['status'] = MODULE_STATUS_DISABLED
    23692424          } 
    2370            
    23712425        } else { 
    2372           $modules[ $row['modulename'] ]['status'] = MODULE_STATUS_DISABLED; 
     2426          // no directory for this db entry 
     2427          $modules[ $row['modulename'] ]['status'] = MODULE_STATUS_BROKEN; 
    23732428        } 
    2374       } else { 
    2375         // no directory for this db entry 
    2376         $modules[ $row['modulename'] ]['status'] = MODULE_STATUS_BROKEN; 
    2377       } 
    2378       $modules[ $row['modulename'] ]['dbversion'] = $row['version']; 
    2379     } 
    2380   } 
    2381  
    2382   // "builtin" module is always enabled 
    2383   $modules['builtin']['status'] = MODULE_STATUS_ENABLED; 
    2384    
    2385   if ($status !== false) { 
     2429        $modules[ $row['modulename'] ]['dbversion'] = $row['version']; 
     2430      } 
     2431    } 
     2432 
     2433    // "builtin" module is always enabled 
     2434    $modules['builtin']['status'] = MODULE_STATUS_ENABLED; 
     2435  }  
     2436  if (!$module && !$modulelist->is_loaded()) { 
     2437    $modulelist->initialize($modules); 
     2438  } 
     2439 
     2440  if ($status === false) { 
     2441    if (!$module) { 
     2442      return $modulelist->module_array; 
     2443    } else { 
     2444      return $modules; 
     2445    } 
     2446  } else { 
     2447    if (!$module) { 
     2448      $modules =  $modulelist->module_array; 
     2449    } 
    23862450    if (!is_array($status)) { 
    23872451      // make a one element array so we can use in_array below 
    23882452      $status = array($status); 
    23892453    } 
    2390      
    23912454    foreach (array_keys($modules) as $name) { 
    23922455      if (!in_array($modules[$name]['status'], $status)) { 
     
    23952458      } 
    23962459    } 
    2397   } 
    2398    
    2399   return $modules; 
     2460    return $modules; 
     2461  } 
    24002462} 
    24012463 
     
    29853047        $new_id = $results[0]; 
    29863048        $new_id ++; 
    2987         $sql = "INSERT INTO modules (id,modulename, version,enabled) values ('".$new_id."','".addslashes($modules[$modulename]['rawname'])."','".addslashes($modules[$modulename]['version'])."','0' );"; 
     3049        $sql = "INSERT INTO modules (id,modulename, version,enabled) values ('".$new_id."','".$db->escapeSimple($modules[$modulename]['rawname'])."','".$db->escapeSimple($modules[$modulename]['version'])."','0' );"; 
    29883050        break; 
    29893051       
    29903052      default: 
    2991         $sql = "INSERT INTO modules (modulename, version, enabled) values ('".addslashes($modules[$modulename]['rawname'])."','".addslashes($modules[$modulename]['version'])."', 1);"; 
     3053        $sql = "INSERT INTO modules (modulename, version, enabled) values ('".$db->escapeSimple($modules[$modulename]['rawname'])."','".$db->escapeSimple($modules[$modulename]['version'])."', 1);"; 
    29923054      break; 
    29933055    } 
    29943056  } else { 
    29953057    // just need to update the version 
    2996     $sql = "UPDATE modules SET version='".addslashes($modules[$modulename]['version'])."' WHERE modulename = '".addslashes($modules[$modulename]['rawname'])."'"; 
     3058    $sql = "UPDATE modules SET version='".$db->escapeSimple($modules[$modulename]['version'])."' WHERE modulename = '".$db->escapeSimple($modules[$modulename]['rawname'])."'"; 
    29973059  } 
    29983060   
     
    30033065  } 
    30043066   
    3005   // module is now installed & enabled 
     3067  // module is now installed & enabled, invalidate the modulelist class since it is now stale 
     3068  $modulelist =& modulelist::create($db); 
     3069  $modulelist->invalidate(); 
    30063070 
    30073071  // edit the notification table to list any remaining upgrades available or clear 
     
    30733137  } 
    30743138   
    3075   $sql = "DELETE FROM modules WHERE modulename = '".addslashes($modulename)."'"; 
     3139  $sql = "DELETE FROM modules WHERE modulename = '".$db->escapeSimple($modulename)."'"; 
    30763140  $results = $db->query($sql); 
    30773141  if(DB::IsError($results)) { 
     
    31283192function _module_setenabled($modulename, $enabled) { 
    31293193  global $db; 
    3130   $sql = 'UPDATE modules SET enabled = '.($enabled ? '1' : '0').' WHERE modulename = "'.addslashes($modulename).'"'; 
     3194  $sql = 'UPDATE modules SET enabled = '.($enabled ? '1' : '0').' WHERE modulename = "'.$db->escapeSimple($modulename).'"'; 
    31313195  $results = $db->query($sql); 
    31323196  if(DB::IsError($results)) { 
    31333197    die_freepbx($results->getMessage()); 
    31343198  } 
     3199  $modulelist =& modulelist::create($db); 
     3200  $modulelist->invalidate(); 
    31353201} 
    31363202 
     
    32373303  global $db; 
    32383304 
    3239   $sql = "SELECT version FROM modules WHERE modulename = '".addslashes($modname)."'"; 
     3305  $sql = "SELECT version FROM modules WHERE modulename = '".$db->escapeSimple($modname)."'"; 
    32403306  $results = $db->getRow($sql,DB_FETCHMODE_ASSOC); 
    32413307  if (isset($results['version']))  
     
    33233389*/ 
    33243390function module_get_annoucements() { 
     3391  global $db; 
    33253392  $firstinstall=false; 
    33263393  $type=null; 
     
    33413408    // save the hash so we remeber this is a first time install 
    33423409    // 
    3343     $data4sql = addslashes($installid); 
    3344     sql('INSERT INTO module_xml (id,time,data) VALUES ("installid",'.time().',"'.$data4sql.'")'); 
    3345     $data4sql = addslashes($type); 
    3346     sql('INSERT INTO module_xml (id,time,data) VALUES ("type",'.time().',"'.$data4sql.'")'); 
     3410    $data4sql = $db->escapeSimple($installid); 
     3411    sql("INSERT INTO module_xml (id,time,data) VALUES ('installid',".time().",'".$data4sql."')"); 
     3412    $data4sql = $db->escapeSimple($type); 
     3413    sql("INSERT INTO module_xml (id,time,data) VALUES ('type',".time().",'".$data4sql."')"); 
    33473414 
    33483415  // Not a first time so save the queried hash and check if there is a type set 
  • freepbx/trunk/amp_conf/htdocs/admin/header.php

    r5912 r6539  
    129129 
    130130// default password check 
    131 $nt = notifications::create($db); 
    132 if ($amp_conf['AMPMGRPASS'] == $amp_conf_defaults['AMPMGRPASS'][1]) { 
    133   $nt->add_warning('core', 'AMPMGRPASS', _("Default Asterisk Manager Password Used"), _("You are using the default Asterisk Manager password that is widely known, you should set a secure password")); 
    134 } else { 
    135   $nt->delete('core', 'AMPMGRPASS'); 
     131if (!$quietmode) { 
     132  $nt = notifications::create($db); 
     133  if ($amp_conf['AMPMGRPASS'] == $amp_conf_defaults['AMPMGRPASS'][1]) { 
     134    $nt->add_warning('core', 'AMPMGRPASS', _("Default Asterisk Manager Password Used"), _("You are using the default Asterisk Manager password that is widely known, you should set a secure password")); 
     135  } else { 
     136    $nt->delete('core', 'AMPMGRPASS'); 
     137  } 
    136138} 
    137139 
  • freepbx/trunk/amp_conf/htdocs/admin/page.modules.php

    r6341 r6539  
    157157 
    158158 
    159 $modules_local = module_getinfo(); 
     159$modules_local = module_getinfo(false,false,true); 
    160160 
    161161if ($online) { 
  • freepbx/trunk/amp_conf/htdocs/recordings/includes/bootstrap.php

    r4993 r6539  
    9898 */ 
    9999function getFiles($path,$filter,$recursive_max,$recursive_count) { 
     100  global $SETTINGS_MAX_FILES; 
     101  $SETTINGS_MAX_FILES = isset($SETTINGS_MAX_FILES) ? $SETTINGS_MAX_FILES : 3000; 
    100102 
    101103  $files = array(); 
     
    110112 
    111113        $fileCount++; 
    112         if ($fileCount>3000) { 
     114        if ($fileCount>$SETTINGS_MAX_FILES) { 
    113115          $_SESSION['ari_error']  
    114116            .= _("To many files in $msg_path Not all files processed") . "<br>"; 
  • freepbx/trunk/amp_conf/htdocs/recordings/includes/main.conf.php

    r4993 r6539  
    326326$SETTINGS_ALLOW_PHONE_SETTINGS = 1; 
    327327 
    328  
     328
     329# Maximum number of sound files that will be read before an error is generated indicating issues since 
     330# too many files can be create problems but on some systems this may need to be increased. 
     331
     332$SETTINGS_MAX_FILES=3000; 
    329333 
    330334?> 
  • freepbx/trunk/amportal.conf

    r6250 r6539  
    192192#             voicemail files. If changed, some of the voicemail directory strucuters may have to be manually changed. 
    193193 
     194# DASHBOARD_STATS_UPDATE_TIME=integer_seconds 
     195# DEFAULT VALUE: 6 
     196# DASHBOARD_INFO_UPDATE_TIME=integer_seconds 
     197# DEFAULT VALUE: 20 
     198# These can be used to change the refresh rate of the System Status Panel. Most of 
     199# the stats are updated based on the STATS interval but a few items are checked 
     200# less frequently (such as Astersisk Uptime) based on the INFO value