Changeset 10203
- Timestamp:
- 08/01/10 10:31:24 (3 years ago)
- Files:
-
- contributed_modules/modules/amportalsettings/amportalsettings.css (modified) (1 diff)
- contributed_modules/modules/amportalsettings/amportalsettings.js (modified) (1 diff)
- contributed_modules/modules/amportalsettings/functions.inc.php (modified) (1 diff)
- contributed_modules/modules/amportalsettings/images/spinner.gif (added)
- contributed_modules/modules/amportalsettings/install.php (modified) (1 diff)
- contributed_modules/modules/amportalsettings/module.xml (modified) (1 diff)
- contributed_modules/modules/amportalsettings/page.amportalsettings.php (modified) (3 diffs)
- contributed_modules/modules/uninstall.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
contributed_modules/modules/amportalsettings/amportalsettings.css
r10195 r10203 1 #set_table tr:nth-child(even){ 2 background-color: #FCE7CE; 3 } 4 1 #set_table tr:nth-child(even){background-color: #FCE7CE;} 5 2 .save, .edit, .delete, .default{border-style: none;} 3 #page{ height: 100%;} 4 .savetd{display:none;} contributed_modules/modules/amportalsettings/amportalsettings.js
r10195 r10203 2 2 //hope this isnt to much to ask for... Not sure why this doent happen automaticaly, but this kludge works! 3 3 $('#footer').remove().appendTo($('#wrapper')); 4 //save settings 5 function savebinder(e) { 6 mythis = $(this); 7 mykey = $(this).attr('data-key'); 8 $.ajax({ 9 type: 'POST', 10 url: location.href, 11 data: { 12 quietmode: 1, 13 skip_astman:1, 14 restrictmods: gup('display'), 15 action: 'setkey', 16 key: mykey, 17 value: $('#'+mykey).val() 18 }, 19 beforeSend: function(XMLHttpRequest) { 20 mythis.attr({src: 'images/spinner.gif'}) 21 }, 22 success: function(data, textStatus, XMLHttpRequest) { 23 mythis.attr({src: 'images/accept.png'}); 24 if (data != 'ok') { 25 alert('ERROR: When saving key '+mykey); 26 } else { 27 mythis.parent().delay(500).fadeOut(); 28 } 29 }, 30 error: function(data, textStatus, XMLHttpRequest) { 31 alert('ERROR: When saving key '+mykey+': '+textStatus); 32 } 33 34 }) 35 } 36 //set defualt values 37 $('.default').click(function(){ 38 $('#'+$(this).attr('data-key')).val($(this).attr('data-default')) 39 }); 40 $('.valueinput').bind('blur click change keypress', function(){ 41 if($(this).val() != $(this).attr('data-valueinput-orig')){ 42 43 console.log($(this).val(), $(this).attr('data-valueinput-orig')) 44 $(this).parent().next().next().stop(true, true).delay(1000).fadeIn(); 45 $(this).parent().next().next().children('.save').bind('click', savebinder); 46 } else { 47 $(this).parent().next().next().stop(true, true).delay(1000).fadeOut(); 48 $(this).parent().next().next().children('.save').unbind('click', savebinder); 49 } 50 }) 51 /* 52 //delete key 53 $('.delete').click(function(){ 54 mykey = $(this).attr('data-key'); 55 $.ajax({ 56 type: 'POST', 57 url: location.href, 58 data: { 59 quietmode: 1, 60 skip_astman:1, 61 restrictmods: gup('display'), 62 action: 'delkey', 63 key: mykey 64 }, 65 beforeSend: function(XMLHttpRequest) { 66 $('#'+mykey).parent().next().find('.save').attr({src: 'images/spinner.gif'}) 67 }, 68 success: function(data, textStatus, XMLHttpRequest) { 69 $('#'+mykey).parent().next().find('.save').attr({src: 'images/accept.png'}) 70 }, 71 error: function(data, textStatus, XMLHttpRequest) { 72 alert('ERROR: When deleteing key '+mykey+': '+textStatus); 73 } 74 75 }) 76 })*/ 4 77 }); 78 79 //get a specifc vairable from the url 80 function gup( name ){ 81 name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); 82 var regexS = "[\\?&]"+name+"=([^&#]*)"; 83 var regex = new RegExp( regexS ); 84 var results = regex.exec( window.location.href ); 85 if( results == null ) 86 return ""; 87 else 88 return results[1]; 89 } contributed_modules/modules/amportalsettings/functions.inc.php
r10195 r10203 7 7 return $conf; 8 8 } 9 10 function amportalsettings_set_keys($key, $value){ 11 global $db; 12 $sql = 'UPDATE freepbx_settings set value = ? where `key` = ?'; 13 $res = $db->query($sql, array($value, $key)); 14 if(DB::IsError($res)){ 15 return false; 16 } else { 17 return true; 18 } 19 } 9 20 ?> contributed_modules/modules/amportalsettings/install.php
r10195 r10203 2 2 global $db, $amp_conf; 3 3 4 $sql[] = "CREATE TABLE IF NOT EXISTS `freepbx_settings` ( 5 `key` varchar(25) default NULL, 6 `value` varchar(100) default NULL, 7 `level` int(11) default '0', 8 `description` varchar(150) default NULL, 9 `type` varchar(25) default NULL, 10 `options` varchar(500) default NULL, 11 `defaultval` varchar(100) default NULL, 12 `readonly` varchar(15) default NULL, 13 `hidden` varchar(15) default NULL, 14 UNIQUE KEY `key` (`key`) 15 )"; 16 17 foreach ($sql as $q) { 18 $result = $db->query($q); 4 $sql = 'SELECT count(*) FROM freepbx_settings'; 5 $result = $db->query($sql); 6 if(DB::IsError($result)){ 7 $sql = " 8 CREATE TABLE `freepbx_settings` ( 9 `key` varchar(25) default NULL, 10 `value` varchar(100) default NULL, 11 `level` int(11) default '0', 12 `description` varchar(150) default NULL, 13 `type` varchar(25) default NULL, 14 `options` varchar(500) default NULL, 15 `defaultval` varchar(100) default NULL, 16 `readonly` varchar(15) default NULL, 17 `hidden` varchar(15) default NULL, 18 UNIQUE KEY `key` (`key`) 19 ) ENGINE=MyISAM DEFAULT CHARSET=latin1; 20 21 LOCK TABLES `freepbx_settings` WRITE; 22 INSERT INTO `freepbx_settings` VALUES ('AMPADMINLOGO','logo.png',0,'Defines the logo that is to be displayed at the TOP RIGHT of the admin screen. This enables you to customize the look of the administration screen. NO','text',NULL,NULL,NULL,NULL),('AMPBADNUMBER','TRUE',0,'Generate the bad-number context which traps any bogus number or feature code and plays a message to the effect. If you use the Early Dial feature on s','select','TRUE,FALSE','TRUE',NULL,NULL),('AMPBIN','/var/lib/asterisk/bin',0,'Location of the FreePBX command line scripts<br>Default = /var/lib/asterisk/bin','text',NULL,'/var/lib/asterisk/bin',NULL,NULL),('AMPCGIBIN','/var/www/cgi-bin ',0,'The path to Apache cgi-bin dir (leave off trailing slash)<br>Default = var/www/cgi-bin','text',NULL,'/var/www/cgi-bin',NULL,NULL),('AMPDBENGINE','mysql',0,'Database engine used<br>Mostly used = mysql','text',NULL,'mysql',NULL,NULL),('AMPDBHOST','localhost',0,'Hostname where the database asterisk is located<br>Default = localhost','text',NULL,'localhost',NULL,NULL),('AMPDBNAME','asterisk',0,'Name of the FreePBX database<br>Default = asterisk','text',NULL,'asterisk',NULL,NULL),('AMPDBPASS','fpbx',0,'Password for accessing the database asterisk. Used in combination with AMPDBUSER<br>Default = amp109','text',NULL,NULL,NULL,NULL),('AMPDBUSER','freepbx',0,'Username for accessing the database asterisk<br>Default = asteriskuser','text',NULL,NULL,NULL,NULL),('AMPDISABLELOG','TRUE',0,'Whether or not to invoke the FreePBX log facility<br>Default = true','select','TRUE,FALSE','TRUE',NULL,NULL),('AMPENABLEDEVELDEBUG','FALSE',0,'Whether or not to include log messages marked as <b>devel-debug</b> in the log system<br>Default = false','select','TRUE,FALSE','FALSE',NULL,NULL),('AMPENGINE','asterisk',0,'The telephony backend engine to use<br>Default = asterisk','text',NULL,'asterisk',NULL,NULL),('AMPEXTENSIONS','extensions',0,'Sets the extension behavior in FreePBX. If set to <b>extensions</b>, Devices and Users are administered together as a unified Extension, and appear o','text',NULL,'extensions',NULL,NULL),('AMPMGRPASS','amp111',0,'Password for accessing the Asterisk Manager Interface (AMI)<br>Default = amp111','text',NULL,'amp111',NULL,NULL),('AMPMGRUSER','admin',0,'Username for accessing the Asterisk Manager Interface (AMI)<br>Default = admin','text',NULL,'admin',NULL,NULL),('AMPMPG123','TRUE',0,'When set to false, the old MoH behavior is adopted where MP3 files can be loaded and WAV files converted to MP3. The new default behavior assumes you ','select','TRUE,FALSE','TRUE',NULL,NULL),('AMPSBIN','/usr/sbin',0,'Where (root) command line scripts are located<br>Default = /usr/local/sbin','text',NULL,'/usr/sbin',NULL,NULL),('AMPSYSLOGLEVEL','',0,'Where to log if enabled, SQL, LOG_SQL logs to old MySQL table, others are passed to syslog system to determine where to log. Values are: LOG_EMERG, LO','text',NULL,NULL,NULL,NULL),('AMPVMUMASK','007',0,'Defaults to 077 allowing only the asterisk user to have any permission on VM files. If set to something like 007, it would allow the group to have per','text',NULL,NULL,NULL,NULL),('AMPWEBADDRESS','',0,'The IP address or host name used to access the CDR<br>Default = not used','text',NULL,NULL,NULL,NULL),('AMPWEBROOT','/var/www/html',0,'The path to Apache webroot (leave off trailing slash)<br>Default = /var/www/html','text',NULL,'/var/www/html',NULL,NULL),('ARI_ADMIN_PASSWORD','ari_password',0,'This is the default admin password to allow an administrator to login to ARI bypassing all security. Change this to a secure password.Default = not se','text',NULL,'ari_password',NULL,NULL),('ARI_ADMIN_USERNAME','',0,'This is the default admin name used to allow an administrator to login to ARI bypassing all security. Change this to whatever you want, dont forget to','text',NULL,'admin',NULL,NULL),('ASTMANAGER','',0,'Port for the Asterisk Manager<br>Default = 5028','text',NULL,'5038',NULL,NULL),('ASTMANAGERHOST','localhost',0,'Hostname for the Asterisk Manager<br>Default = localhost','text',NULL,'localhost',NULL,NULL),('AUTHTYPE','database',0,'Authentication type to use for web admin. If type set to <b>database</b>, the primary AMP admin credentials will be the AMPDBUSER/AMPDBPASS above. Val','select','none,database','none',NULL,NULL),('BADDESTABORT','FALSE',0,'Setting either of these to true will result in retrieve_conf aborting during a reload if an extension conflict is detected or a destination is detecte','select','TRUE,FALSE','FALSE',NULL,NULL),('CDRDBHOST','',0,'Only used if you dont use the default values provided by FreePBX.<br>Hostname of db server if not the same as AMPDBHOST.','text',NULL,NULL,NULL,NULL),('CDRDBNAME','',0,'Only used if you dont use the default values provided by FreePBX.<br>Name of database used for cdr records','text',NULL,NULL,NULL,NULL),('CDRDBPASS','',0,'Only used if you dont use the default values provided by FreePBX.<br>Password for connecting to db if its not the same as AMPDBPASS','text',NULL,NULL,NULL,NULL),('CDRDBPORT','',0,'Only used if you dont use the default values provided by FreePBX.<br>Port number for db host','text',NULL,NULL,NULL,NULL),('CDRDBTABLENAME','',0,'Only used if you dont use the default values provided by FreePBX. Name of the table in the db where the cdr is stored. cdr is default','text',NULL,NULL,NULL,NULL),('CDRDBTYPE','',0,'Only used if you dont use the default values provided by FreePBX. mysql or postgres mysql is default','text',NULL,NULL,NULL,NULL),('CDRDBUSER','',0,'Only used if you dont use the default values provided by FreePBX. Username to connect to db with if its not the same as AMPDBUSER','text',NULL,NULL,NULL,NULL),('CHECKREFERER','TRUE',0,'When set to the default value of true, all requests into FreePBX that might possibly add/edit/delete settings will be validated to assure the request ','select','TRUE,FALSE','TRUE',NULL,NULL),('CUSTOMASERROR','TRUE',0,'If false, then the Destination Registry will not report unknown destinations as errors. This should be left to the default true and custom destination','select','TRUE,FALSE','TRUE',NULL,NULL),('CWINUSEBUSY','TRUE',0,'For extensions that have CW enabled, report unanswered CW calls as <b>busy</b> (resulting in busy voicemail greeting). If set to no, unanswered CW cal','select','TRUE,FALSE','TRUE',NULL,NULL),('DASHBOARD_INFO_UPDATE_TIM','',0,'These can be used to change the refresh rate of the System Status Panel. Most of the stats are updated based on the STATS interval but a few items are','text',NULL,NULL,NULL,NULL),('DASHBOARD_STATS_UPDATE_TI','',0,'These can be used to change the refresh rate of the System Status Panel. Most of the stats are updated based on the STATS interval but a few items are','text',NULL,NULL,NULL,NULL),('DEVEL','FALSE',0,'Needs to be documented<br>Default = false','select','TRUE,FALSE','FALSE',NULL,NULL),('DEVELRELOAD','FALSE',0,'Needs to be documented<br>Default = false','select','TRUE,FALSE','FALSE',NULL,NULL),('DISABLECUSTOMCONTEXTS','FALSE',0,'Normally FreePBX auto-generates a custom context that may be usable for adding custom dialplan to modify the normal behavior of FreePBX. It takes a go','select','TRUE,FALSE','FALSE',NULL,NULL),('DYNAMICHINTS','FALSE',0,'If true, Core will not statically generate hints, but instead make a call to the AMPBIN php script, and generate_hints.php through an Asterisk #exec c','select','TRUE,FALSE','TRUE',NULL,NULL),('ENABLECW','TRUE',0,'Enable call waiting by default when an extension is created (Default is yes). Set to <b>no</b> to if you dont want phones to be commissioned with call','select','TRUE,FALSE','TRUE',NULL,NULL),('FCBEEPONLY','',0,'When set to true, a beep is played instead of confirmation message when activating/de-activating: CallForward, CallWaiting, DayNight, DoNotDisturb and','select','TRUE,FALSE','FALSE',NULL,NULL),('FOPDISABLE','FALSE',0,'Set to true to disable FOP in interface and retrieve_conf. Useful for sqlite3 or if you dont want FOP<br>Default = not set','select','TRUE,FALSE','TRUE',NULL,NULL),('FOPPASSWORD','passw0rd',0,'Password for performing transfers and hangups in the Flash Operator Panel (FOP)<br>Default = passw0rd','text',NULL,'passw0rd',NULL,NULL),('FOPRUN','TRUE',0,'Set to true if you want FOP started by freepbx_engine (amportal_start), false otherwise<br>Default = true','select','TRUE,FALSE','FALSE',NULL,NULL),('FOPSORT','extension',0,'How FOP sort extensions. By Last Name [lastname] or by Extension [extension]<br>Default = extension','select','extension,lastname','extension',NULL,NULL),('FOPWEBROOT','/var/www/html/panel',0,'Path to the Flash Operator Panel webroot (leave off trailing slash)<br>Default = /var/www/html/panel','text',NULL,'/var/www/html/panel',NULL,NULL),('FPBXDBUGFILE','/tmp/freepbx_debug.log',0,'Location and name of the FreePBX debug file. Used by developers<br>Default = /tmp/freepbx_debug.log','text',NULL,'/tmp/freepbx_debug.log',NULL,NULL),('MODULEADMINWGET','FALSE',0,'Module Admin normally tries to get its online information through direct file open type calls to URLs that go back to the freepbx.org server. If it fa','select','TRUE,FALSE','FALSE',NULL,NULL),('MOHDIR','moh',0,'This is the subdirectory for the MoH files/directories which is located in ASTVARLIBDIR if not specified it will default to mohmp3 for backward compat','text',NULL,'moh',NULL,NULL),('POST_RELOAD','',0,'Automatically execute a script after applying changes in the AMP admin. Set POST_RELOAD to the script you wish to execute after applying changes. If P','text',NULL,NULL,NULL,NULL),('POST_RELOAD_DEBUG','',0,'Display debug output for script used if POST_RELOAD is used<br>Default = not set','text',NULL,NULL,NULL,NULL),('RELOADCONFIRM','TRUE',0,'When set to false, will bypass the confirm on Reload Box<br>Default = true','select','TRUE,FALSE','TRUE',NULL,NULL),('SERVERINTITLE','FALSE',0,'Precede browser title with the server name<br>Default = false','select','TRUE,FALSE','TRUE',NULL,NULL),('USECATEGORIES','TRUE',0,'Controls if the menu items in the admin interface are sorted by category (true) or sorted alphebetically with no categories shown (false). Defaults = ','select','TRUE,FALSE','TRUE',NULL,NULL),('USEDEVSTATE','TRUE',0,'If this is set, it assumes that you are running Asterisk 1.4 or higher and want to take advantage of the func_devstate.c backport available from Aster','select','TRUE,FALSE','TRUE',NULL,NULL),('USEGOOGLEDNSFORENUM','',0,'Setting this flag will generate the required global variable so that enumlookup.agi will use Google DNS 8.8.8.8 when performing an ENUM lookup. Not al','select','TRUE,FALSE','FALSE',NULL,NULL),('USEQUEUESTATE','FALSE',0,'Setting this flag will generate the required dialplan to integrate with the following Asterisk patch: <b>https://issues.asterisk.org/view.php?id=15168','select','TRUE,FALSE','FALSE',NULL,NULL),('XTNCONFLICTABORT','FALSE',0,'Setting either of these to true will result in retrieve_conf aborting during a reload if an extension conflict is detected or a destination is detecte','select','TRUE,FALSE','FALSE',NULL,NULL),('ZAP2DAHDICOMPAT','TRUE',0,'If set to true, FreePBX will check if you have chan_dadhi installed. If so, it will automatically use all your ZAP configuration settings (devices and','select','TRUE,FALSE','TRUE',NULL,NULL),('AMPBACKUPSUDO','',0,'This option allows you to use sudo when backing up files. Useful ONLY when using AMPPROVROOT. Allows backup and restore of files specified in AMPPROVR','select','TRUE,FALSE',NULL,NULL,NULL); 23 UNLOCK TABLES; 24 "; 25 $result = $db->query($sql); 26 if(DB::IsError($result)){ 27 die_freepbx($result->getDebugInfo()); 28 } 29 30 //migrate legacy options 31 foreach ($amp_conf as $key => $val) { 32 switch ($val) { 33 case 'true': 34 case 'yes': 35 case '1': 36 $val = 'TRUE'; 37 break; 38 case 'false': 39 case 'no': 40 case '0': 41 $val = 'FALSE'; 42 break; 43 } 44 $settings[] = array('key' => $key, 'value' => $val); 45 } 46 47 $query = $db->prepare("REPLACE INTO freepbx_settings (`key`, value) VALUES (?, ?)"); 48 $result = $db->executeMultiple($query,$settings); 19 49 if(DB::IsError($result)){ 20 50 die_freepbx($result->getDebugInfo()); 21 51 } 22 52 } 23 24 $ampconfigarray = array(25 'AMPADMINLOGO' => 'Defines the logo that is to be displayed at the TOP RIGHT of the admin screen. This enables you to customize the look of the administration screen. NOTE: images need to be saved in the ..../admin/images directory of your AMP install. This image should be 55px in height<br>Default = logo.png',26 'AMPBACKUPSUDO' => 'This option allows you to use sudo when backing up files. Useful ONLY when using AMPPROVROOT. Allows backup and restore of files specified in AMPPROVROOT, based on permissions in /etc/sudoers for example, adding the following to sudoers would allow the user asterisk to run tar on ANY file on the system:<br>asterisk localhost=(root)NOPASSWD: /bin/tar<br>Defaults:asterisk !requiretty<br>PLEASE KEEP IN MIND THE SECURITY RISKS INVOLVED IN ALLOWING THE ASTERISK USER TO TAR/UNTAR ANY FILE<br>Default = false',27 'AMPBADNUMBER' => 'Generate the bad-number context which traps any bogus number or feature code and plays a message to the effect. If you use the Early Dial feature on some Grandstream phones, you will want to set this to false<br>Default = true',28 'AMPBIN' => 'Location of the FreePBX command line scripts<br>Default = /var/lib/asterisk/bin',29 'AMPCGIBIN' => 'The path to Apache cgi-bin dir (leave off trailing slash)<br>Default = var/www/cgi-bin',30 'AMPDBENGINE' => 'Database engine used<br>Mostly used = mysql',31 'AMPDBHOST' => 'Hostname where the database asterisk is located<br>Default = localhost',32 'AMPDBNAME' => 'Name of the FreePBX database<br>Default = asterisk',33 'AMPDBPASS' => 'Password for accessing the database asterisk. Used in combination with AMPDBUSER<br>Default = amp109',34 'AMPDBUSER' => 'Username for accessing the database asterisk<br>Default = asteriskuser',35 'AMPDISABLELOG' => 'Whether or not to invoke the FreePBX log facility<br>Default = true',36 'AMPENABLEDEVELDEBUG' => 'Whether or not to include log messages marked as <b>devel-debug</b> in the log system<br>Default = false',37 'AMPENGINE' => 'The telephony backend engine to use<br>Default = asterisk',38 'AMPEXTENSIONS' => 'Sets the extension behavior in FreePBX. If set to <b>extensions</b>, Devices and Users are administered together as a unified Extension, and appear on a single page. If set to <b>deviceanduser</b>, Devices and Users will be administered seperately. Devices (e.g. each individual line on a SIP phone) and Users (e.g. <b>101</b>) will be configured independent of each other, allowing association of one User to many Devices, or allowing Users to login and logout of Devices<br>Default = extensions',39 'AMPMGRPASS' => 'Password for accessing the Asterisk Manager Interface (AMI)<br>Default = amp111',40 'AMPMGRUSER' => 'Username for accessing the Asterisk Manager Interface (AMI)<br>Default = admin',41 'AMPMPG123' => 'When set to false, the old MoH behavior is adopted where MP3 files can be loaded and WAV files converted to MP3. The new default behavior assumes you have mpg123 loaded as well as sox and will convert MP3 files to WAV. This is highly recommended as MP3 files heavily tax the system and can cause instability on a busy phone system<br>Default = true',42 'AMPSBIN' => 'Where (root) command line scripts are located<br>Default = /usr/local/sbin',43 'AMPSYSLOGLEVEL' => 'Where to log if enabled, SQL, LOG_SQL logs to old MySQL table, others are passed to syslog system to determine where to log. Values are: LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG, LOG_SQL,SQL<br>Default = LOG_ERR',44 'AMPVMUMASK' => 'Defaults to 077 allowing only the asterisk user to have any permission on VM files. If set to something like 007, it would allow the group to have permissions. This can be used if setting apache to a different user then asterisk, so that the apache user (and thus ARI) can have access to read/write/delete the voicemail files. If changed, some of the voicemail directory structures may have to be manually changed<br>Default = 077',45 'AMPWEBADDRESS' => 'The IP address or host name used to access the CDR<br>Default = not used',46 'AMPWEBROOT' => 'The path to Apache webroot (leave off trailing slash)<br>Default = /var/www/html',47 'ARI_ADMIN_PASSWORD' => 'This is the default admin password to allow an administrator to login to ARI bypassing all security. Change this to a secure password.Default = not set',48 'ARI_ADMIN_USERNAME' => 'This is the default admin name used to allow an administrator to login to ARI bypassing all security. Change this to whatever you want, dont forget to change the ARI_ADMIN_PASSWORD as well.Default = not set',49 'ASTMANAGER' => 'Port for the Asterisk Manager<br>Default = 5028',50 'ASTMANAGERHOST' => 'Hostname for the Asterisk Manager<br>Default = localhost',51 'AUTHTYPE' => 'Authentication type to use for web admin. If type set to <b>database</b>, the primary AMP admin credentials will be the AMPDBUSER/AMPDBPASS above. Valid settings are: none, database<br>Default = none',52 'BADDESTABORT' => 'Setting either of these to true will result in retrieve_conf aborting during a reload if an extension conflict is detected or a destination is detected. It is usually better to allow the reload to go through and then correct the problem but these can be set if a more strict behavior is desired<br>Default = false',53 'CDRDBHOST' => 'Only used if you dont use the default values provided by FreePBX.<br>Hostname of db server if not the same as AMPDBHOST.',54 'CDRDBNAME' => 'Only used if you dont use the default values provided by FreePBX.<br>Name of database used for cdr records',55 'CDRDBPASS' => 'Only used if you dont use the default values provided by FreePBX.<br>Password for connecting to db if its not the same as AMPDBPASS',56 'CDRDBPORT' => 'Only used if you dont use the default values provided by FreePBX.<br>Port number for db host',57 'CDRDBTABLENAME' => 'Only used if you dont use the default values provided by FreePBX. Name of the table in the db where the cdr is stored. cdr is default',58 'CDRDBTYPE' => 'Only used if you dont use the default values provided by FreePBX. mysql or postgres mysql is default',59 'CDRDBUSER' => 'Only used if you dont use the default values provided by FreePBX. Username to connect to db with if its not the same as AMPDBUSER',60 'CHECKREFERER' => 'When set to the default value of true, all requests into FreePBX that might possibly add/edit/delete settings will be validated to assure the request is coming from the server. This will protect the system from CSRF (cross site request forgery) attacks. It will have the effect of preventing legitimately entering URLs that could modify settings which can be allowed by changing this field to false<br>Default = false',61 'CUSTOMASERROR' => 'If false, then the Destination Registry will not report unknown destinations as errors. This should be left to the default true and custom destinations should be moved into the new custom apps registry<br>Default = true',62 'CWINUSEBUSY' => 'For extensions that have CW enabled, report unanswered CW calls as <b>busy</b> (resulting in busy voicemail greeting). If set to no, unanswered CW calls simply report as <b>no-answer</b><br>Default = true',63 'DASHBOARD_INFO_UPDATE_TIME' => 'These can be used to change the refresh rate of the System Status Panel. Most of the stats are updated based on the STATS interval but a few items are checked less frequently (such as Asterisk Uptime) based on the INFO value. Default value = 20',64 'DASHBOARD_STATS_UPDATE_TIME' => 'These can be used to change the refresh rate of the System Status Panel. Most of the stats are updated based on the STATS interval but a few items are checked less frequently (such as Asterisk Uptime) based on the INFO value. Default value = 6',65 'DEVEL' => 'Needs to be documented<br>Default = false',66 'DEVELRELOAD' => 'Needs to be documented<br>Default = false',67 'DISABLECUSTOMCONTEXTS' => 'Normally FreePBX auto-generates a custom context that may be usable for adding custom dialplan to modify the normal behavior of FreePBX. It takes a good understanding of how Asterisk processes these includes to use this and in many of the cases, there is no useful application. All includes will result in a WARNING in the Asterisk log if there is no context found to include though it results in no errors. If you know that you want the includes, you can set this to true. If you comment it out FreePBX will revert to legacy behavior and include the contexts<br>Default = false',68 'DYNAMICHINTS' => 'If true, Core will not statically generate hints, but instead make a call to the AMPBIN php script, and generate_hints.php through an Asterisk #exec call. This requires Asterisk.conf to be configured with <b>execincludes=yes<b> set in the [options] section<br>Default = false',69 'ENABLECW' => 'Enable call waiting by default when an extension is created (Default is yes). Set to <b>no</b> to if you dont want phones to be commissioned with call waiting already enabled. The user would then be required to dial the CW feature code (*70 default) to enable their phone. Most installations should leave this alone. It allows multi-line phones to receive multiple calls on their line appearances<br>Default = yes',70 'FCBEEPONLY' => 'When set to true, a beep is played instead of confirmation message when activating/de-activating: CallForward, CallWaiting, DayNight, DoNotDisturb and FindMeFollow<br>Default = false',71 'FOPDISABLE' => 'Set to true to disable FOP in interface and retrieve_conf. Useful for sqlite3 or if you dont want FOP<br>Default = not set',72 'FOPPASSWORD' => 'Password for performing transfers and hangups in the Flash Operator Panel (FOP)<br>Default = passw0rd',73 'FOPRUN' => 'Set to true if you want FOP started by freepbx_engine (amportal_start), false otherwise<br>Default = true',74 'FOPSORT' => 'How FOP sort extensions. By Last Name [lastname] or by Extension [extension]<br>Default = extension',75 'FOPWEBROOT' => 'Path to the Flash Operator Panel webroot (leave off trailing slash)<br>Default = /var/www/html/panel',76 'FPBXDBUGFILE' => 'Location and name of the FreePBX debug file. Used by developers<br>Default = /tmp/freepbx_debug.log',77 'MODULEADMINWGET' => 'Module Admin normally tries to get its online information through direct file open type calls to URLs that go back to the freepbx.org server. If it fails, typically because of content filters in firewalls that dont like the way PHP formats the requests, the code will fall back and try a wget to pull the information. This will often solve the problem. However, in such environment there can be a significant timeout before the failed file open calls to the URLs return and there are often 2-3 of these that occur. Setting this value will force FreePBX to avoid the attempt to open the URL and go straight to the wget calls<br>Default = false',78 'MOHDIR' => 'This is the subdirectory for the MoH files/directories which is located in ASTVARLIBDIR if not specified it will default to mohmp3 for backward compatibility<br>Default = not set',79 'POST_RELOAD' => 'Automatically execute a script after applying changes in the AMP admin. Set POST_RELOAD to the script you wish to execute after applying changes. If POST_RELOAD_DEBUG=true, you will see the output of the script in the web page<br>Default = not set',80 'POST_RELOAD_DEBUG' => 'Display debug output for script used if POST_RELOAD is used<br>Default = not set',81 'RELOADCONFIRM' => 'When set to false, will bypass the confirm on Reload Box<br>Default = true',82 'SERVERINTITLE' => 'Precede browser title with the server name<br>Default = false',83 'USECATEGORIES' => 'Controls if the menu items in the admin interface are sorted by category (true) or sorted alphebetically with no categories shown (false). Defaults = true',84 'USEDEVSTATE' => 'If this is set, it assumes that you are running Asterisk 1.4 or higher and want to take advantage of the func_devstate.c backport available from Asterisk 1.6. This allows custom hints to be created to support BLF for server side feature codes such as daynight, followme, etc<br>Default = false',85 'USEDIALONE' => 'New setting, needs to be documented<br>Default = false',86 'USEGOOGLEDNSFORENUM' => 'Setting this flag will generate the required global variable so that enumlookup.agi will use Google DNS 8.8.8.8 when performing an ENUM lookup. Not all DNS deals with NAPTR record, but Google does. There is a drawback to this as Google tracks every lookup. If you are not comfortable with this, do not enable this setting. Please read Google FAQ about this: <b>http://code.google.com/speed/public-dns/faq.html#privacy</b><br>Default = false',87 'USEQUEUESTATE' => 'Setting this flag will generate the required dialplan to integrate with the following Asterisk patch: <b>https://issues.asterisk.org/view.php?id=15168</b>. This feature is planned for a future 1.6 release but given the existence of the patch can be used prior. Once the release version is known, code will be added to automatically enable this format in versions of Asterisk that support it<br>Default = false',88 'XTNCONFLICTABORT' => 'Setting either of these to true will result in retrieve_conf aborting during a reload if an extension conflict is detected or a destination is detected. It is usually better to allow the reload to go through and then correct the problem but these can be set if a more strict behavior is desired<br>Default = false',89 'ZAP2DAHDICOMPAT' => 'If set to true, FreePBX will check if you have chan_dadhi installed. If so, it will automatically use all your ZAP configuration settings (devices and trunks) and silently convert them, under the covers, to DAHDI so no changes are needed. The GUI will continue to refer to these as ZAP but it will use the proper DAHDI channels. This will also keep Zap Channel DIDs working<br>Default = false',90 );91 92 foreach ($ampconfigarray as $key => $desc) {93 $val = (isset($amp_conf[$key])) ? $amp_conf[$key] : '';94 $settings[] = array('key' => $key, 'value' => $val, 'description' => $desc, 'level' => 0, 'type' => 'text');95 }96 97 $query = $db->prepare("INSERT INTO freepbx_settings (`key`, value, description, level, type) VALUES (?, ?, ?, ?, ?)");98 $result = $db->executeMultiple($query,$settings);99 if(DB::IsError($result)){100 die_freepbx($result->getDebugInfo());101 }102 103 //TODO: set correct type and level104 //TODO: propogate with options105 //TODO: set defualts106 53 //TODO: set crucial options to readonly 107 54 ?> contributed_modules/modules/amportalsettings/module.xml
r10194 r10203 2 2 <rawname>amportalsettings</rawname> 3 3 <name>Amportal Settings</name> 4 <version>2.8.0. 1</version>4 <version>2.8.0.0</version> 5 5 <publisher>Mikael Carlsson</publisher> 6 6 <license>GPLv2</license> contributed_modules/modules/amportalsettings/page.amportalsettings.php
r10195 r10203 1 1 <?php /* $Id */ 2 // Copyright (C) 2010 Mikael Carlsson, mickecamino@gmail.com3 //4 // This program is free software; you can redistribute it and/or5 // modify it under the terms of the GNU General Public License6 // as published by the Free Software Foundation, version 27 // of the License.8 //9 // This program is distributed in the hope that it will be useful,10 // but WITHOUT ANY WARRANTY; without even the implied warranty of11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12 // GNU General Public License for more details.13 2 14 $dispnum = 'amportalsettings';15 $printvalue = "";16 17 // This is not nice, but it is a way to display the help text the FreePBX18 3 // TODO: localize if needed 19 4 // TODO: Get rid of undefined in http log. Sigh 20 5 21 $getvars = array('level' );6 $getvars = array('level', 'action', 'key', 'value'); 22 7 23 8 foreach ($getvars as $v){ … … 25 10 } 26 11 27 echo "<br><h2>"._("FreePBX Advanced Settings")."</h2>";28 //echo "This module display all settings that can be set in <b>amportal.conf</b> and the value currently in use<br>";29 //echo "Amportal keys in <b>bold black</b> are currently defined, either in <b>amportal.conf</b> or in the default globals defined in the framework<br>";30 //echo "Amportal key in <font color=\"GREY\">grey color</font> are keys that can be set but are currently undefined";31 32 //echo "<h3>Amportal key</h3></td><td><h3>Amportal value</td></tr>";33 12 34 // Go trough all above key and check them against the global amp_conf. For each key that exists in amp_conf set the font to bold 35 /* 36 foreach($ampconfigarray as $ampkey => $ampvalue) {37 if(array_key_exists($ampkey, $amp_conf)){38 $html_text = "<b><font color = \"BLACK\">".$ampkey."</b></font>";13 if($var['action'] === 'setkey') { 14 if (amportalsettings_set_keys($var['key'], $var['value'])) { 15 echo 'ok'; 16 } else { 17 echo 'error'; 39 18 } 40 else { 41 $html_text = "<font color = \"GREY\">".$ampkey."</font>"; 42 } 43 // Print true or false instead of 1 or nothing 44 switch ($amp_conf[$ampkey]) { 45 case "1": 46 $printvalue = "true"; 47 break; 48 case false: 49 $printvalue = "false or not set"; 50 break; 51 default: 52 $printvalue = $amp_conf[$ampkey]; 53 } 54 ?> 55 <tr> 56 <td><a href="#" class="info"><?php echo $html_text?>:<span><?php echo $ampvalue?></span></a></td> 57 <?php echo "<td>".$printvalue."</tr>"?> 58 <?php 59 } 60 echo "</table>"; 61 */ 19 exit; 20 } 21 echo '<div id="page">'; 22 echo "<h2>"._("FreePBX Advanced Settings")."</h2>"; 23 echo "Use extreme caution! Changes here can render your system inoperable. You are urged to backup before making any changes.<br /><br />"; 24 25 26 //TODO: build table properly witl all required tags 62 27 $conf = amportalsettings_get_keys($var['level']); 63 28 echo '<input type="image" src="images/spinner.gif" style="display:none">'; 64 29 echo '<table id="set_table">'; 65 30 foreach ($conf as $c){ … … 68 33 switch ($c['type']) { 69 34 case 'text': 70 echo '<input type="text" value="'.$c['value'].'" />'; 35 echo '<input class="valueinput" id="'.$c['key'].'" type="text" value="'.$c['value'].'" data-valueinput-orig="'.$c['value'].'"/>'; 36 break; 37 case 'select': 38 echo '<select class="valueinput" id="'.$c['key'].'" data-valueinput-orig="'.$c['value'].'">'; 39 $opt = explode(',',$c['options']); 40 foreach($opt as $o) { 41 $selected = ($c['value'] == $o) ? ' selected ' : ''; 42 echo '<option value="'.$o.'"'.$selected.'>'.$o.'</option>'; 43 } 44 echo '</select>'; 71 45 break; 72 46 } 73 47 echo '</td>'; 74 48 if($c['readonly'] != 'true'){ 75 echo '<td><input type="image" class="save" id="'.$c['key'].'" src="images/accept.png" name="save" title="'._('Save').'"></td>'; 76 echo '<td><input type="image" class="default" id="'.$c['key'].'" src="images/default-option.png" name="defualt" title="'._('Revert to Default').'"></td>'; 77 echo '<td><input type="image" class="edit" id="'.$c['key'].'" src="images/edit.png" name="edit" title="'._('Edit').'"></td>'; 78 echo '<td><input type="image" class="delete" id="'.$c['key'].'" src="images/trash.png" name="delete" title="'._('Delete').'"></td>'; 49 echo '<td><input type="image" class="default" src="images/default-option.png" data-key="'.$c['key'].'" data-default="'.$c['defaultval'].'" name="default" title="'._('Revert to Default').'"></td>'; 50 echo '<td class="savetd"><input type="image" class="save" src="images/accept.png" name="save" data-key="'.$c['key'].'" title="'._('Save').'"></td>'; 51 //echo '<td><input type="image" class="delete" src="images/trash.png" name="delete" data-key="'.$c['key'].'" title="'._('Delete').'"></td>'; 79 52 } 80 53 echo '</tr>'; 81 54 } 82 55 echo '</table'; 83 56 84 57 // Ugly, but I need to display the whole help text within the page 85 echo "<br><br><br><br>"; 58 echo "<br><br><br><br></div>"; 59 86 60 ?>
