root/freepbx/trunk/libfreepbx.install.php

Revision 11113, 65.1 kB (checked in by p_lindheimer, 2 years ago)

add notification system message to log file re #4937, #4760, and typo fix

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2 //This file is part of FreePBX.
3 //
4 //    FreePBX is free software: you can redistribute it and/or modify
5 //    it under the terms of the GNU General Public License as published by
6 //    the Free Software Foundation, either version 2 of the License, or
7 //    (at your option) any later version.
8 //
9 //    FreePBX is distributed in the hope that it will be useful,
10 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //    GNU General Public License for more details.
13 //
14 //    You should have received a copy of the GNU General Public License
15 //    along with FreePBX.  If not, see <http://www.gnu.org/licenses/>.
16 //
17 //    Copyright 2007, Philippe Lindheimer
18 //
19
20 /********************************************************************************************************************/
21 /* freepbxlib.install.php
22  *
23  * These are used by install_amp and the framework install script to run updates
24  *
25  * These variables are required to be defined outside of this library. The purpose
26  * of this is to allow the library to be used by both install_amp as well as the
27  * framework which would potentially be accessing these from different locations.
28  *
29  * Examples:
30  *
31  * UPGRADE_DIR     dirname(__FILE__)."/upgrades"
32  * MODULE_DIR      dirname(__FILE__)."/amp_conf/htdocs/admin/modules/"
33  *
34  * or (in framework for instance)
35  *
36  * MODULE_DIR      dirname(__FILE__)."/htdocs/admin/modules/"
37  *
38  * $debug = false;
39  * $dryrun = false;
40  */
41
42 function upgrade_all($version) {
43
44   // **** Read upgrades/ directory
45
46   outn("Checking for upgrades..");
47
48   // read versions list from upgrades/
49   $versions = array();
50   $dir = opendir(UPGRADE_DIR);
51   while ($file = readdir($dir)) {
52     if (($file[0] != ".") && is_dir(UPGRADE_DIR."/".$file)) {
53       $versions[] = $file;
54     }
55   }
56   closedir($dir);
57
58   // callback to use php's version_compare() to sort
59   usort($versions, "version_compare_freepbx");
60
61
62   // find versions that are higher than the current version
63   $starting_version = false;
64   foreach ($versions as $check_version) {
65     if (version_compare_freepbx($check_version, $version) > 0) { // if check_version < version
66       $starting_version = $check_version;
67       break;
68     }
69   }
70
71   // run all upgrades from the list of higher versions
72   if ($starting_version) {
73     $pos = array_search($starting_version, $versions);
74     $upgrades = array_slice($versions, $pos); // grab the list of versions, starting at $starting_version
75     out(count($upgrades)." found");
76     run_upgrade($upgrades);
77
78     /* Set the base version of key modules, currently core and framework, to the
79      * Version packaged with this tarball, if any. The expectation is that the
80      * packaging scripts will make these module version numbers the same as the
81      * release plus a '.0' which can be incremented for bug fixes delivered through
82      * the online system between main releases.
83      *
84      * added if function_exists because if this is being run from framework there is no
85      * need to reset the base version.
86      */
87     if (function_exists('set_base_version')) {
88       set_base_version();
89     }
90
91   } else {
92     out("No upgrades found");
93   }
94
95 }
96
97 //----------------------------------
98 // dependencies for upgrade_all
99
100
101 /** Invoke upgrades
102  * @param $versions array The version upgrade scripts to run
103  */
104 function run_upgrade($versions) {
105   global $dryrun;
106  
107   foreach ($versions as $version) {
108     out("Upgrading to ".$version."..");
109     install_upgrade($version);
110     if (!$dryrun) {
111       setversion($version);
112     }
113     out("Upgrading to ".$version."..OK");
114   }
115 }
116
117 //get the version number
118 function install_getversion() {
119   global $db;
120   $sql = "SELECT value FROM admin WHERE variable = 'version'";
121   $results = $db->getAll($sql);
122   if(DB::IsError($results)) {
123     return false;
124   }
125   return $results[0][0];
126 }
127
128 //set the version number
129 function setversion($version) {
130   global $db;
131   $sql = "UPDATE admin SET value = '".$version."' WHERE variable = 'version'";
132   debug($sql);
133   $result = $db->query($sql);
134   if(DB::IsError($result)) {     
135     die($result->getMessage());
136   }
137 }
138
139 /** Install a particular version
140  */
141 function install_upgrade($version) {
142   global $db;
143   global $dryrun;
144   global $amp_conf;
145  
146   $db_engine = $amp_conf["AMPDBENGINE"];
147  
148   if (is_dir(UPGRADE_DIR."/".$version)) {
149     // sql scripts first
150     $dir = opendir(UPGRADE_DIR."/".$version);
151     while ($file = readdir($dir)) {
152       if (($file[0] != ".") && is_file(UPGRADE_DIR."/".$version."/".$file)) {
153         if ( (strtolower(substr($file,-4)) == ".sqlite") && ($db_engine == "sqlite") ) {
154           install_sqlupdate( $version, $file );
155         }
156         elseif ((strtolower(substr($file,-4)) == ".sql") &&
157             ( ($db_engine  == "mysql")  ||  ($db_engine  == "pgsql") || ($db_engine == "sqlite3") ) ) {
158           install_sqlupdate( $version, $file );
159         }
160       }
161     }
162
163                 // now non sql scripts
164                 $dir = opendir(UPGRADE_DIR."/".$version);
165                 while ($file = readdir($dir)) {
166                         if (($file[0] != ".") && is_file(UPGRADE_DIR."/".$version."/".$file)) {
167                                 if ((strtolower(substr($file,-4)) == ".sql") || (strtolower(substr($file,-7)) == ".sqlite")) {
168                                         // sql scripts were dealt with first
169                                 } else if (strtolower(substr($file,-4)) == ".php") {
170                                         out("-> Running PHP script ".UPGRADE_DIR."/".$version."/".$file);
171                                         if (!$dryrun) {
172                                                 run_included(UPGRADE_DIR."/".$version."/".$file);
173                                         }
174
175                                 } else if (is_executable(UPGRADE_DIR."/".$version."/".$file)) {
176                                         out("-> Executing ".UPGRADE_DIR."/".$version."/".$file);
177                                         if (!$dryrun) {
178                                                 exec(UPGRADE_DIR."/".$version."/".$file);
179                                         }
180                                 } else {
181                                         error("-> Don't know what to do with ".UPGRADE_DIR."/".$version."/".$file);
182                                 }
183                         }
184                 }
185
186   }
187 }
188
189
190 function checkDiff($file1, $file2) {
191   // diff, ignore whitespace and be quiet
192   exec("diff -wq ".escapeshellarg($file2)." ".escapeshellarg($file1), $output, $retVal);
193   return ($retVal != 0);
194 }
195
196 function amp_mkdir($directory, $mode = "0755", $recursive = false) {
197   debug("mkdir ".$directory.", ".$mode);
198   $ntmp = sscanf($mode,"%o",$modenum); //assumes all inputs are octal
199   if (version_compare(phpversion(), '5.0') < 0) {
200     // php <5 can't recursively create directories
201     if ($recursive) {
202       $output = false;
203       $return_value = false;
204       exec("mkdir -m ".$mode." -p ".$directory,  $output, $return_value);
205       return ($return_value == 0);
206     } else {
207       return mkdir($directory, $modenum);
208     }
209   } else {
210     return mkdir($directory, $modenum, $recursive);
211   }
212 }
213
214 /** Recursively copy a directory
215  */
216 function recursive_copy($dirsourceparent, $dirdest, &$md5sums, $dirsource = "") {
217   global $dryrun;
218   global $check_md5s;
219   global $amp_conf;
220   global $asterisk_conf;
221   global $install_moh;
222   global $make_links;
223
224   $moh_subdir = isset($amp_conf['MOHDIR']) ? trim(trim($amp_conf['MOHDIR']),'/') : 'mohmp3';
225
226   // total # files, # actually copied
227   $num_files = $num_copied = 0;
228  
229   if ($dirsource && ($dirsource[0] != "/")) $dirsource = "/".$dirsource;
230  
231   if (is_dir($dirsourceparent.$dirsource)) $dir_handle = opendir($dirsourceparent.$dirsource);
232  
233   /*
234   echo "dirsourceparent: "; var_dump($dirsourceparent);
235   echo "dirsource: "; var_dump($dirsource);
236   echo "dirdest: "; var_dump($dirdest);
237   */
238  
239   while (isset($dir_handle) && ($file = readdir($dir_handle))) {
240     if (($file!=".") && ($file!="..") && ($file != "CVS") && ($file != ".svn")) {
241       $source = $dirsourceparent.$dirsource."/".$file;
242       $destination =  $dirdest.$dirsource."/".$file;
243      
244       if ($dirsource == "" && $file == "moh" && !$install_moh) {
245         // skip to the next dir
246         continue;
247       }
248
249      
250       // configurable in amportal.conf
251       if (strpos($destination,"htdocs_panel")) {
252         $destination=str_replace("/htdocs_panel",trim($amp_conf["FOPWEBROOT"]),$destination);
253       } else {
254         $destination=str_replace("/htdocs",trim($amp_conf["AMPWEBROOT"]),$destination);
255       }
256       $destination=str_replace("/htdocs_panel",trim($amp_conf["FOPWEBROOT"]),$destination);
257 //      $destination=str_replace("/cgi-bin",trim($amp_conf["AMPCGIBIN"]),$destination);
258       if(strpos($dirsource, 'modules') === false) $destination=str_replace("/bin",trim($amp_conf["AMPBIN"]),$destination);
259       $destination=str_replace("/sbin",trim($amp_conf["AMPSBIN"]),$destination);
260      
261       // the following are configurable in asterisk.conf
262       $destination=str_replace("/astetc",trim($asterisk_conf["astetcdir"]),$destination);
263       $destination=str_replace("/moh",trim($asterisk_conf["astvarlibdir"])."/$moh_subdir",$destination);
264       $destination=str_replace("/astvarlib",trim($asterisk_conf["astvarlibdir"]),$destination);
265       if(strpos($dirsource, 'modules') === false) $destination=str_replace("/agi-bin",trim($asterisk_conf["astagidir"]),$destination);
266       if(strpos($dirsource, 'modules') === false) $destination=str_replace("/sounds",trim($asterisk_conf["astvarlibdir"])."/sounds",$destination);
267
268       // if this is a directory, ensure destination exists
269       if (is_dir($source)) {
270         if (!file_exists($destination)) {
271           if ((!$dryrun) && ($destination != "")) {
272             amp_mkdir($destination, "0750", true);
273           }
274         }
275       }
276      
277       //var_dump($md5sums);
278       if (!is_dir($source)) {
279         $md5_source = preg_replace("|^/?amp_conf/|", "/", $source);
280
281         if ($check_md5s && file_exists($destination) && isset($md5sums[$md5_source]) && (md5_file($destination) != $md5sums[$md5_source])) {
282           // double check using diff utility (and ignoring whitespace)
283           // This is a somewhat edge case (eg, the file doesn't match
284           // it's md5 sum from the previous version, but no substantial
285           // changes exist compared to the current version), but it
286           // prevents a useless prompt to the user.
287           if (checkDiff($source, $destination)) {
288             $overwrite = ask_overwrite($source, $destination);
289           } else {
290             debug("NOTE: MD5 for ".$destination." was different, but `diff` did not detect any (non-whitespace) changes: overwriting");
291             $overwrite = true;
292           }
293         } else {
294           $overwrite = true;
295         }
296        
297         // These are modified by apply_conf.sh, there may be others that fit in this category also. This keeps these from
298         // being symlinked and then developers inadvertently checking in the changes when they should not have.
299         //
300         $never_symlink = array("cdr_mysql.conf", "manager.conf", "vm_email.inc");
301
302         $num_files++;
303         if ($overwrite) {
304           debug(($make_links ? "link" : "copy")." ".$source." -> ".$destination);
305           if (!$dryrun) {
306             if ($make_links && !in_array(basename($source),$never_symlink)) {
307               // symlink, unlike copy, doesn't overwrite - have to delete first
308               if (is_link($destination) || file_exists($destination)) {
309                 unlink($destination);
310               }
311               symlink($_ENV["PWD"]."/".$source, $destination);
312             } else {
313               copy($source, $destination);
314             }
315             $num_copied++;
316           }
317         } else {
318           debug("not overwriting ".$destination);
319         }
320       } else {
321         //echo "recursive_copy($dirsourceparent, $dirdest, $md5sums, $dirsource/$file)";
322         list($tmp_num_files, $tmp_num_copied) = recursive_copy($dirsourceparent, $dirdest, $md5sums, $dirsource."/".$file);
323         $num_files += $tmp_num_files;
324         $num_copied += $tmp_num_copied;
325       }
326     }
327   }
328  
329   if (isset($dir_handle)) closedir($dir_handle);
330  
331   return array($num_files, $num_copied);
332 }
333
334 function read_md5_file($filename) {
335   $md5 = array();
336   if (file_exists($filename)) {
337     foreach (file($filename) as $line) {
338       if (preg_match("/^([a-f0-9]{32})\s+(.*)$/", $line, $matches)) {
339         $md5[ "/".$matches[2] ] = $matches[1];
340       }
341     }
342   }
343   return $md5;
344 }
345
346 /** Include a .php file
347  * This is a function just to keep a separate context
348  */
349 function run_included($file) {
350   global $db;
351   global $amp_conf;
352  
353   include($file);
354 }
355
356 function install_sqlupdate( $version, $file )
357 {
358   global $db;
359   global $dryrun;
360
361   out("-> Running SQL script ".UPGRADE_DIR."/".$version."/".$file);
362   // run sql script
363   $fd = fopen(UPGRADE_DIR."/".$version."/".$file, "r");
364   $data = "";
365   while (!feof($fd)) {
366     $data .= fread($fd, 1024);
367   }
368   fclose($fd);
369
370   preg_match_all("/((SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER).*);\s*\n/Us", $data, $matches);
371  
372   foreach ($matches[1] as $sql) {
373     debug($sql);
374     if (!$dryrun) {
375       $result = $db->query($sql);
376       if(DB::IsError($result)) {     
377         fatal($result->getDebugInfo()."\" while running ".$file."\n");
378       }
379     }
380   }
381 }
382
383 /********************************************************************************************************************/
384 /*                          FREEPBX SETTINGS (AMPORTAL.CONF) DEFINED HERE                                           */
385 /********************************************************************************************************************/
386 //
387 // TODO: find a good way to extract the required localization strings for the tools to pickup
388 //
389 // freepbx_settings_init()
390 // this is where we initialize all the freepbx_settings (amportal.conf). This will be run with install_amp and every
391 // time we run the framework installer, so new settings can be added here that are framework wide. It may make send to
392 // break this out separately but for now we'll keep it here since this is already part of the infrastructure that is
393 // used by both install_amp and the framework install/upgrade script.
394 //
395 function freepbx_settings_init($commit_to_db = false) {
396   global $amp_conf;
397
398   include_once ($amp_conf['AMPWEBROOT'].'/admin/libraries/freepbx_conf.class.php');
399
400   $freepbx_conf =& freepbx_conf::create();
401
402   $set['value'] = '';
403   $set['defaultval'] =& $set['value'];
404   $set['readonly'] = 0;
405   $set['hidden'] = 0;
406   $set['level'] = 0;
407   $set['module'] = '';
408   $set['emptyok'] = 0;
409
410
411   //
412   // CATEGORY: Advanced Settings Display
413   //
414   $set['category'] = 'Advanced Settings Details';
415
416   // AS_DISPLAY_DETAIL_LEVEL
417   $set['value'] = '0';
418   $set['options'] = '0,1,2,3,4,5,6,7,8,9,10';
419   $set['name'] = 'Display Detail Level';
420   $set['description'] = 'This will filter which settings that are displayed on this Advanced Settings page. The higher the level, the more obscure settings will be shown. Settings at higher levels are unlikely to be of interest to most users and could be more volatile to breaking your system if set wrong.';
421   $set['emptyok'] = 0;
422   $set['level'] = 0;
423   $set['readonly'] = 0;
424   $set['type'] = CONF_TYPE_SELECT;
425   $freepbx_conf->define_conf_setting('AS_DISPLAY_DETAIL_LEVEL',$set);
426   $set['readonly'] = 0;
427   $set['level'] = 0;
428
429   // AS_DISPLAY_HIDDEN_SETTINGS
430   $set['value'] = false;
431   $set['options'] = '';
432   $set['name'] = 'Display Hidden Settings';
433   $set['description'] = 'This will display settings that are normally hidden by the system. These settings are often internally used settings that are not of interest to most users.';
434   $set['emptyok'] = 0;
435   $set['level'] = 0;
436   $set['readonly'] = 0;
437   $set['type'] = CONF_TYPE_BOOL;
438   $freepbx_conf->define_conf_setting('AS_DISPLAY_HIDDEN_SETTINGS',$set);
439   $set['readonly'] = 0;
440   $set['level'] = 0;
441
442   // AS_DISPLAY_READONLY_SETTINGS
443   $set['value'] = false;
444   $set['options'] = '';
445   $set['name'] = 'Display Readonly Settings';
446   $set['description'] = 'This will display settings that are readonly. These settings are often internally used settings that are not of interest to most users. Since they are readonly they can only be viewed.';
447   $set['emptyok'] = 0;
448   $set['level'] = 0;
449   $set['readonly'] = 0;
450   $set['type'] = CONF_TYPE_BOOL;
451   $freepbx_conf->define_conf_setting('AS_DISPLAY_READONLY_SETTINGS',$set);
452   $set['readonly'] = 0;
453   $set['level'] = 0;
454
455   // AS_DISPLAY_FRIENDLY_NAME
456   $set['value'] = true;
457   $set['options'] = '';
458   $set['name'] = 'Display Friendly Name';
459   $set['description'] = 'Normally the friendly names will be displayed on this page and the internal freepbx_conf configuration names are shown in the tooltip. If you prefer to view the configuration variables, and the friendly name in the tooltip, set this to false..';
460   $set['emptyok'] = 0;
461   $set['level'] = 0;
462   $set['readonly'] = 0;
463   $set['type'] = CONF_TYPE_BOOL;
464   $freepbx_conf->define_conf_setting('AS_DISPLAY_FRIENDLY_NAME',$set);
465   $set['readonly'] = 0;
466   $set['level'] = 0;
467
468   //
469   // CATEGORY: System Setup
470   //
471   $set['category'] = 'System Setup';
472
473   // AMPENGINE
474   $set['value'] = 'asterisk';
475   $set['options'] = 'asterisk';
476   $set['name'] = 'Telephony Engine';
477   $set['description'] = 'The telephony backend engine being used, asterisk is the only option currently.';
478   $set['emptyok'] = 0;
479   $set['level'] = 3;
480   $set['readonly'] = 1;
481   $set['type'] = CONF_TYPE_SELECT;
482   $freepbx_conf->define_conf_setting('AMPENGINE',$set);
483   $set['readonly'] = 0;
484   $set['level'] = 0;
485
486   // AUTHTYPE
487   $set['value'] = 'database';
488   $set['options'] = 'database,none,webserver';
489   $set['name'] = 'Authorization Type';
490   $set['description'] = '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. When using database you can create users that are restricted to only certain module pages. When set to none, you should make sure you have provided security at the apache level. When set to webserver, FreePBX will expect authentication to happen at the apache level, but will take the user credentials and apply any restrictions as if it were in database mode.';
491   $set['emptyok'] = 0;
492   $set['level'] = 3;
493   $set['type'] = CONF_TYPE_SELECT;
494   $freepbx_conf->define_conf_setting('AUTHTYPE',$set);
495   $set['level'] = 0;
496
497   // AMPEXTENSIONS
498   $set['value'] = 'extensions';
499   $set['options'] = 'extensions,deviceanduser';
500   $set['name'] = 'User & Devices Mode';
501   $set['description'] = '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 separately. 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.';
502   $set['emptyok'] = 0;
503   $set['type'] = CONF_TYPE_SELECT;
504   $freepbx_conf->define_conf_setting('AMPEXTENSIONS',$set);
505
506   // AMPVMUMASK
507   $set['value'] = '007';
508   $set['options'] = '';
509   $set['name'] = 'Asterisk VMU Mask';
510   $set['description'] = '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 separately. 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.';
511   $set['description'] = '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.';
512   $set['emptyok'] = 0;
513   $set['type'] = CONF_TYPE_TEXT;
514   $set['level'] = 4;
515   $freepbx_conf->define_conf_setting('AMPVMUMASK',$set);
516   $set['level'] = 0;
517
518   // AMPWEBADDRESS
519   $set['value'] = '';
520   $set['options'] = '';
521   $set['name'] = 'FreePBX Web Address';
522   $set['description'] = 'This is the address of your Web Server. It is mostly obsolete and derived when not supplied and will be phased out, but there are still some areas expecting a variable to be set and if you are using it this will migrate your value.';
523   $set['emptyok'] = 1;
524   $set['type'] = CONF_TYPE_TEXT;
525   $set['level'] = 4;
526   $freepbx_conf->define_conf_setting('AMPWEBADDRESS',$set);
527   $set['level'] = 0;
528
529   // ARI_ADMIN_USERNAME
530   $set['value'] = '';
531   $set['options'] = '';
532   $set['name'] = 'User Portal Admin Username';
533   $set['description'] = '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 User Portal Admin Password as well. Default = not set';
534   $set['emptyok'] = 1;
535   $set['type'] = CONF_TYPE_TEXT;
536   $freepbx_conf->define_conf_setting('ARI_ADMIN_USERNAME',$set);
537
538   // ARI_ADMIN_PASSWORD
539   $set['value'] = 'ari_password';
540   $set['options'] = '';
541   $set['name'] = 'User Portal Admin Password';
542   $set['description'] = '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';
543   $set['emptyok'] = 0;
544   $set['type'] = CONF_TYPE_TEXT;
545   $freepbx_conf->define_conf_setting('ARI_ADMIN_PASSWORD',$set);
546
547   // AMPASTERISKUSER
548   $set['value'] = 'asterisk';
549   $set['options'] = '';
550   $set['name'] = 'System Asterisk User';
551   $set['description'] = 'The user Asterisk should be running as, used by freepbx_engine. Most systems should not change this.';
552   $set['emptyok'] = 0;
553   $set['type'] = CONF_TYPE_TEXT;
554   $set['level'] = 4;
555   $freepbx_conf->define_conf_setting('AMPASTERISKUSER',$set);
556   $set['level'] = 0;
557
558   // AMPASTERISKGROUP
559   $set['value'] = 'asterisk';
560   $set['options'] = '';
561   $set['name'] = 'System Asterisk Group';
562   $set['description'] = 'The user group Asterisk should be running as, used by freepbx_engine. Most systems should not change this.';
563   $set['emptyok'] = 0;
564   $set['type'] = CONF_TYPE_TEXT;
565   $set['level'] = 4;
566   $freepbx_conf->define_conf_setting('AMPASTERISKGROUP',$set);
567   $set['level'] = 0;
568
569   // AMPASTERISKWEBUSER
570   $set['value'] = 'asterisk';
571   $set['options'] = '';
572   $set['name'] = 'System Web User';
573   $set['description'] = 'The user your httpd should be running as, used by freepbx_engine. Most systems should not change this.';
574   $set['emptyok'] = 0;
575   $set['type'] = CONF_TYPE_TEXT;
576   $set['level'] = 4;
577   $freepbx_conf->define_conf_setting('AMPASTERISKWEBUSER',$set);
578   $set['level'] = 0;
579
580   // AMPASTERISKWEBGROUP
581   $set['value'] = 'asterisk';
582   $set['options'] = '';
583   $set['name'] = 'System Web Group';
584   $set['description'] = 'The user group your httpd should be running as, used by freepbx_engine. Most systems should not change this.';
585   $set['emptyok'] = 0;
586   $set['type'] = CONF_TYPE_TEXT;
587   $set['level'] = 4;
588   $freepbx_conf->define_conf_setting('AMPASTERISKWEBGROUP',$set);
589   $set['level'] = 0;
590
591   // AMPDEVUSER
592   $set['value'] = 'asterisk';
593   $set['options'] = '';
594   $set['name'] = 'System Device User';
595   $set['description'] = 'The user that various device directories should be set to, used by freepbx_engine. Examples include /dev/zap, /dev/dahdi, /dev/misdn, /dev/mISDN and /dev/dsp. Most systems should not change this.';
596   $set['emptyok'] = 0;
597   $set['type'] = CONF_TYPE_TEXT;
598   $set['level'] = 4;
599   $freepbx_conf->define_conf_setting('AMPDEVUSER',$set);
600   $set['level'] = 0;
601
602   // AMPDEVGROUP
603   $set['value'] = 'asterisk';
604   $set['options'] = '';
605   $set['name'] = 'System Device Group';
606   $set['description'] = 'The user group that various device directories should be set to, used by freepbx_engine. Examples include /dev/zap, /dev/dahdi, /dev/misdn, /dev/mISDN and /dev/dsp. Most systems should not change this.';
607   $set['emptyok'] = 0;
608   $set['type'] = CONF_TYPE_TEXT;
609   $set['level'] = 4;
610   $freepbx_conf->define_conf_setting('AMPDEVGROUP',$set);
611   $set['level'] = 0;
612
613   // AMPDISABLELOG
614   $set['value'] = true;
615   $set['options'] = '';
616   $set['name'] = 'Disable FreePBX Log';
617   $set['description'] = 'Whether or not to invoke the FreePBX log facility.';
618   $set['emptyok'] = 0;
619   $set['type'] = CONF_TYPE_BOOL;
620   $freepbx_conf->define_conf_setting('AMPDISABLELOG',$set);
621
622   // LOG_OUT_MESSAGES
623   $set['value'] = true;
624   $set['options'] = '';
625   $set['name'] = 'Log Verbose Messages';
626   $set['description'] = 'FreePBX has many verbose and useful messages displayed to users during module installation, system installations, loading configurations and other places. In order to accumulate these messages in the log files as well as the on screen display, set this to true.';
627   $set['emptyok'] = 0;
628   $set['type'] = CONF_TYPE_BOOL;
629   $freepbx_conf->define_conf_setting('LOG_OUT_MESSAGES',$set);
630
631   // AMPSYSLOGLEVEL
632   $set['value'] = 'FILE';
633   $set['options'] = 'FILE, LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG';
634   // LOG_SQL, SQL are discontinued, they are removed during migration if the slipped in and in core if it were to persist because amportal.conf was not
635   // writeable for a while.
636   //
637   if (isset($amp_conf['AMPSYSLOGLEVEL']) && (strtoupper($amp_conf['AMPSYSLOGLEVEL']) == 'SQL' || strtoupper($amp_conf['AMPSYSLOGLEVEL']) == 'LOG_SQL')) {
638     $set['options'] .= ', LOG_SQL, SQL';
639   }
640   $set['name'] = 'Syslog Location';
641   $set['description'] = "Determine where to send log information if the log is enabled: 'Disable Freepbx Log' is false (AMPDISABLELOG). FILE will send all log messages to the defined 'FreePBX Log File' (FPBX_LOG_FILE). The other settings will send the logs to your System Logging system using the specified log level that can be configured on most systems to determine which system log file to write to.";
642   $set['emptyok'] = 0;
643   $set['type'] = CONF_TYPE_SELECT;
644   $freepbx_conf->define_conf_setting('AMPSYSLOGLEVEL',$set);
645
646   // FPBX_LOG_FILE
647   $set['value'] = '/tmp/freepbx.log';
648   $set['options'] = '';
649   $set['name'] = 'FreePBX Log File';
650   $set['description'] = 'Full path and name of the FreePBX Log File used in conjunction with the Syslog Level (AMPSYSLOGLEVEL) being set to FILE, not used otherwise. Initial installs may have some early logging sent to /tmp/freepbx_pre_install.log when it is first bootstrapping the installer.';
651   $set['emptyok'] = 0;
652   $set['type'] = CONF_TYPE_TEXT;
653   $freepbx_conf->define_conf_setting('FPBX_LOG_FILE',$set);
654
655   // LOG_NOTIFICATIONS
656   $set['value'] = true;
657   $set['options'] = '';
658   $set['name'] = 'Send Dashboard Notifications to Log';
659   $set['description'] = 'When enabled all notification updates to the Dashboard notification panel will also be logged into the specified log file when enabled.';
660   $set['emptyok'] = 0;
661   $set['type'] = CONF_TYPE_BOOL;
662   $freepbx_conf->define_conf_setting('LOG_NOTIFICATIONS',$set);
663
664
665   //
666   // CATEGORY: Dialplan and Operational
667   //
668   $set['category'] = 'Dialplan and Operational';
669
670   // AMPBADNUMBER
671   $set['value'] = true;
672   $set['options'] = '';
673   $set['name'] = 'Use bad-number Context';
674   $set['description'] = '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.';
675   $set['emptyok'] = 0;
676   $set['type'] = CONF_TYPE_BOOL;
677   $set['level'] = 2;
678   $freepbx_conf->define_conf_setting('AMPBADNUMBER',$set);
679   $set['level'] = 0;
680
681   // CWINUSEBUSY
682   $set['value'] = true;
683   $set['options'] = '';
684   $set['name'] = 'Occupied Lines CW Busy';
685   $set['description'] = '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>.';
686   $set['emptyok'] = 0;
687   $set['type'] = CONF_TYPE_BOOL;
688   $freepbx_conf->define_conf_setting('CWINUSEBUSY',$set);
689
690   // ZAP2DAHDICOMPAT
691   $set['value'] = false;
692   $set['options'] = '';
693   $set['name'] = 'Convert ZAP Settings to DAHDi';
694   $set['description'] = 'If set to true, FreePBX will check if you have chan_dahdi 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.';
695   $set['emptyok'] = 0;
696   $set['type'] = CONF_TYPE_BOOL;
697   $freepbx_conf->define_conf_setting('ZAP2DAHDICOMPAT',$set);
698
699   // DYNAMICHINTS
700   $set['value'] = false;
701   $set['options'] = '';
702   $set['name'] = 'Dynamically Generate Hints';
703   $set['description'] = '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.';
704   $set['emptyok'] = 0;
705   $set['type'] = CONF_TYPE_BOOL;
706   $freepbx_conf->define_conf_setting('DYNAMICHINTS',$set);
707
708   // ENABLECW
709   $set['value'] = true;
710   $set['options'] = '';
711   $set['name'] = 'CW Enabled by Default';
712   $set['description'] = '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.';
713   $set['emptyok'] = 0;
714   $set['type'] = CONF_TYPE_BOOL;
715   $freepbx_conf->define_conf_setting('ENABLECW',$set);
716
717   // FCBEEPONLY
718   $set['value'] = false;
719   $set['options'] = '';
720   $set['name'] = 'Feature Codes Beep Only';
721   $set['description'] = 'When set to true, a beep is played instead of confirmation message when activating/de-activating: CallForward, CallWaiting, DayNight, DoNotDisturb and FindMeFollow.';
722   $set['emptyok'] = 0;
723   $set['type'] = CONF_TYPE_BOOL;
724   $freepbx_conf->define_conf_setting('FCBEEPONLY',$set);
725
726   // USEDEVSTATE
727   $set['value'] = false;
728   $set['options'] = '';
729   $set['name'] = 'Enable Custom Device States';
730   $set['description'] = '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';
731   $set['emptyok'] = 0;
732   $set['type'] = CONF_TYPE_BOOL;
733   $freepbx_conf->define_conf_setting('USEDEVSTATE',$set);
734
735   // USEGOOGLEDNSFORENUM
736   $set['value'] = false;
737   $set['options'] = '';
738   $set['name'] = 'Use Google DNS for Enum';
739   $set['description'] = '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>.';
740   $set['emptyok'] = 0;
741   $set['type'] = CONF_TYPE_BOOL;
742   $set['level'] = 2;
743   $freepbx_conf->define_conf_setting('USEGOOGLEDNSFORENUM',$set);
744   $set['level'] = 0;
745
746   // DISABLECUSTOMCONTEXTS
747   $set['value'] = false;
748   $set['options'] = '';
749   $set['name'] = 'Disable -custom Context Includes';
750   $set['description'] = '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.';
751   $set['emptyok'] = 0;
752   $set['type'] = CONF_TYPE_BOOL;
753   $set['level'] = 2;
754   $freepbx_conf->define_conf_setting('DISABLECUSTOMCONTEXTS',$set);
755   $set['level'] = 0;
756
757
758   // NOOPTRACE
759   $set['value'] = '0';
760   $set['options'] = '0,1,2,3,4,5,6,7,8,9,10';
761   $set['name'] = 'Noop Traces in Dialplan';
762   $set['description'] = 'Some modules will generate lots of Noop() commands proceeded by a [TRACE](trace_level) that can be used during development or while trying to trace call flows. These NoOp() commands serve no other purpose so if you do not want to see excessive NoOp()s in your dialplan you can set this to 0. The higher the number the more detailed level of trace NoOp()s will be generated';
763   $set['emptyok'] = 0;
764   $set['type'] = CONF_TYPE_SELECT;
765   $freepbx_conf->define_conf_setting('NOOPTRACE',$set);
766
767   // DIVERSIONHEADER
768   $set['value'] = false;
769   $set['options'] = '';
770   $set['name'] = 'Generate Diversion Headers';
771   $set['description'] = 'If this value is set to true, then calls going out your outbound routes that originate from outside your PBX and were subsequently forwarded through a call forward, ring group, follow-me or other means, will have a SIP diversion header added to the call with the original incoming DID assuming there is a DID available. This is useful with some carriers that may require this under certain circumstances.';
772   $set['emptyok'] = 0;
773   $set['type'] = CONF_TYPE_BOOL;
774   $freepbx_conf->define_conf_setting('DIVERSIONHEADER',$set);
775
776   // CFRINGTIMERDEFAULT
777   $opts = array();
778   for ($i=-1;$i<=120;$i++) {
779       $opts[]=$i;
780   }
781   $set['value'] = '0';
782   $set['options'] = $opts;
783   $set['name'] = 'Call Forward Ringtimer Default';
784   $set['description'] = 'This is the default time in seconds to try and connect a call that has been call forwarded by the server side CF, CFU and CFB options. (If your phones use client side CF such as SIP redirects, this will not have any affect) If set to the default of 0, it will use the standard ring timer. If set to -1 it will ring the forwarded number with no limit which is consistent with the behavior of some existing PBX systems. If set to any other value, it will ring for that duration before diverting the call to the users voicemail if they have one. This can be overridden for each extension.';
785   $set['emptyok'] = 0;
786   $set['type'] = CONF_TYPE_SELECT;
787   $freepbx_conf->define_conf_setting('CFRINGTIMERDEFAULT',$set);
788   unset($opts); 
789  
790   // DEFAULT_INTERNAL_AUTO_ANSWER
791   $set['value'] = 'disabled';
792   $set['options'] = array('disabled','intercom');
793   $set['name'] = 'Internal Auto Answer Default';
794   $set['description'] = "Default setting for new extensions. When set to Intercom, calls to new extensions/users from other internal users act as if they were intercom calls meaning they will be auto-answered if the endpoint supports this feature and the system is configured to operate in this mode. All the normal white list and black list settings will be honored if they are set. External calls will still ring as normal, as will certain other circumstances such as blind transfers and when a Follow Me is configured and enabled. If Disabled, the phone rings as a normal phone.";
795   $set['emptyok'] = 0;
796   $set['type'] = CONF_TYPE_SELECT;
797   $freepbx_conf->define_conf_setting('DEFAULT_INTERNAL_AUTO_ANSWER',$set);
798
799   // FORCE_INTERNAL_AUTO_ANSWER_ALL
800   $set['value'] = false;
801   $set['options'] = '';
802   $set['name'] = 'Force All Internal Auto Answer';
803   $set['description'] = "Force all extensions to operate in the Internal Auto Answer mode regardless of their individual settings. See 'Internal Auto Answer Default' for more information.";
804   $set['emptyok'] = 0;
805   $set['type'] = CONF_TYPE_BOOL;
806   $freepbx_conf->define_conf_setting('FORCE_INTERNAL_AUTO_ANSWER_ALL',$set);
807
808   // CONCURRENCYLIMITDEFAULT
809   $opts = array();
810   for ($i=0;$i<=120;$i++) {
811       $opts[]=$i;
812   }
813   $set['value'] = '0';
814   $set['options'] = $opts;
815   $set['name'] = 'Extension Concurrency Limit';
816   $set['description'] = 'Default maximum number of outbound simultaneous calls that an extension can make. This is also very useful as a Security Protection against a system that has been compromised. It will limit the number of simultaneous calls that can be made on the compromised extension. This default is used when an extension is created. A default of 0 means no limit.';
817   $set['emptyok'] = 0;
818   $set['type'] = CONF_TYPE_SELECT;
819   $freepbx_conf->define_conf_setting('CONCURRENCYLIMITDEFAULT',$set);
820   unset($opts); 
821
822   // BLOCK_OUTBOUND_TRUNK_CNAM
823   $set['value'] = false;
824   $set['options'] = '';
825   $set['name'] = 'Block CNAM on External Trunks';
826   $set['description'] = 'Some carriers will reject a call if a CallerID Name (CNAM) is presented. This occurs in several areas when configuring CID on the PBX using the format of "CNAM" <CNUM>. To remove the CNAM part of CID on all external trunks, set this value to true. This WILL NOT remove CNAM when a trunk is called from an Intra-Company route. This can be done on each individual trunk in addition to globally if there are trunks where it is desirable to keep CNAM information, though most carriers ignore CNAM.';
827   $set['emptyok'] = 0;
828   $set['type'] = CONF_TYPE_BOOL;
829   $freepbx_conf->define_conf_setting('BLOCK_OUTBOUND_TRUNK_CNAM',$set);
830
831   //
832   // CATEGORY: Directory Layout
833   //
834   $set['category'] = 'Directory Layout';
835
836   // AMPBIN
837   $set['value'] = '/var/lib/asterisk/bin';
838   $set['options'] = '';
839   $set['name'] = 'FreePBX bin Dir';
840   $set['description'] = 'Location of the FreePBX command line scripts.';
841   $set['emptyok'] = 0;
842   $set['type'] = CONF_TYPE_DIR;
843   $set['level'] = 4;
844   $freepbx_conf->define_conf_setting('AMPBIN',$set);
845
846   // AMPSBIN
847   $set['value'] = '/usr/sbin';
848   $set['options'] = '';
849   $set['name'] = 'FreePBX sbin Dir';
850   $set['description'] = 'Where (root) command line scripts are located.';
851   $set['emptyok'] = 0;
852   $set['type'] = CONF_TYPE_DIR;
853   $set['level'] = 4;
854   $freepbx_conf->define_conf_setting('AMPSBIN',$set);
855    
856   // AMPWEBROOT
857   $set['value'] = '/var/www/html';
858   $set['options'] = '';
859   $set['name'] = 'FreePBX Web Root Dir';
860   $set['description'] = 'The path to Apache webroot (leave off trailing slash).';
861   $set['emptyok'] = 0;
862   $set['type'] = CONF_TYPE_DIR;
863   $set['level'] = 4;
864   $freepbx_conf->define_conf_setting('AMPWEBROOT',$set);
865
866   // ASTAGIDIR
867   $set['value'] = '/var/lib/asterisk/agi-bin';
868   $set['options'] = '';
869   $set['name'] = 'Asterisk AGI Dir';
870   $set['description'] = 'This is the default directory for Asterisks agi files.';
871   $set['emptyok'] = 0;
872   $set['type'] = CONF_TYPE_DIR;
873   $set['level'] = 4;
874   $freepbx_conf->define_conf_setting('ASTAGIDIR',$set);
875
876   // ASTETCDIR
877   $set['value'] = '/etc/asterisk';
878   $set['options'] = '';
879   $set['name'] = 'Asterisk etc Dir';
880   $set['description'] = 'This is the default directory for Asterisks configuration files.';
881   $set['emptyok'] = 0;
882   $set['type'] = CONF_TYPE_DIR;
883   $set['level'] = 4;
884   $freepbx_conf->define_conf_setting('ASTETCDIR',$set);
885
886   // ASTLOGDIR
887   $set['value'] = '/var/log/asterisk';
888   $set['options'] = '';
889   $set['name'] = 'Asterisk Log Dir';
890   $set['description'] = 'This is the default directory for Asterisks log files.';
891   $set['emptyok'] = 0;
892   $set['type'] = CONF_TYPE_DIR;
893   $set['level'] = 4;
894   $freepbx_conf->define_conf_setting('ASTLOGDIR',$set);
895
896   // ASTMODDIR
897   $set['value'] = '/usr/lib/asterisk/modules';
898   $set['options'] = '';
899   $set['name'] = 'Asterisk Modules Dir';
900   $set['description'] = 'This is the default directory for Asterisks modules.';
901   $set['emptyok'] = 0;
902   $set['type'] = CONF_TYPE_DIR;
903   $set['level'] = 4;
904   $freepbx_conf->define_conf_setting('ASTMODDIR',$set);
905
906   // ASTSPOOLDIR
907   $set['value'] = '/var/spool/asterisk';
908   $set['options'] = '';
909   $set['name'] = 'Asterisk Spool Dir';
910   $set['description'] = 'This is the default directory for Asterisks spool directory.';
911   $set['emptyok'] = 0;
912   $set['type'] = CONF_TYPE_DIR;
913   $set['level'] = 4;
914   $freepbx_conf->define_conf_setting('ASTSPOOLDIR',$set);
915
916   // ASTRUNDIR
917   $set['value'] = '/var/run/asterisk';
918   $set['options'] = '';
919   $set['name'] = 'Asterisk Run Dir';
920   $set['description'] = 'This is the default directory for Asterisks run files.';
921   $set['emptyok'] = 0;
922   $set['type'] = CONF_TYPE_DIR;
923   $set['level'] = 4;
924   $freepbx_conf->define_conf_setting('ASTRUNDIR',$set);
925
926   // ASTVARLIBDIR
927   $set['value'] = '/var/lib/asterisk';
928   $set['options'] = '';
929   $set['name'] = 'Asterisk bin Dir';
930   $set['description'] = 'This is the default directory for Asterisks lib files.';
931   $set['emptyok'] = 0;
932   $set['type'] = CONF_TYPE_DIR;
933   $set['level'] = 4;
934   $freepbx_conf->define_conf_setting('ASTVARLIBDIR',$set);
935
936   // AMPCGIBIN
937   $set['value'] = '/var/www/cgi-bin ';
938   $set['options'] = '';
939   $set['name'] = 'CGI Dir';
940   $set['description'] = 'The path to Apache cgi-bin dir (leave off trailing slash).';
941   $set['emptyok'] = 0;
942   $set['type'] = CONF_TYPE_DIR;
943   $set['level'] = 4;
944   $freepbx_conf->define_conf_setting('AMPCGIBIN',$set);
945
946   // MOHDIR
947   $set['value'] = 'moh';
948   $set['options'] = array('moh','mohmp3');
949   $set['name'] = 'MoH Subdirectory';
950   $set['description'] = 'This is the subdirectory for the MoH files/directories which is located in ASTVARLIBDIR. Older installation may be using mohmp3 which was the old Asterisk default and should be set to that value if the music files are located there relative to the ASTVARLIBDIR.';
951   $set['emptyok'] = 0;
952   $set['type'] = CONF_TYPE_SELECT;
953   $set['level'] = 4;
954   $freepbx_conf->define_conf_setting('MOHDIR',$set);
955   $set['level'] = 0;
956
957
958   //
959   // CATEGORY: GUI Behavior
960   //
961   $set['category'] = 'GUI Behavior';
962
963   // CHECKREFERER
964   $set['value'] = true;
965   $set['options'] = '';
966   $set['name'] = 'Check Server Referrer';
967   $set['description'] = '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.';
968   $set['emptyok'] = 0;
969   $set['type'] = CONF_TYPE_BOOL;
970   $freepbx_conf->define_conf_setting('CHECKREFERER',$set);
971
972   // MODULEADMINWGET
973   $set['value'] = false;
974   $set['options'] = '';
975   $set['name'] = 'Use wget For Module Admin';
976   $set['description'] = '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.';
977   $set['emptyok'] = 0;
978   $set['type'] = CONF_TYPE_BOOL;
979   $freepbx_conf->define_conf_setting('MODULEADMINWGET',$set);
980
981   // USECATEGORIES
982   $set['value'] = true;
983   $set['options'] = '';
984   $set['name'] = 'Show Categories in Nav Menu';
985   $set['description'] = 'Controls if the menu items in the admin interface are sorted by category (true) or sorted alphabetically with no categories shown (false). Defaults = true';
986   $set['emptyok'] = 0;
987   $set['type'] = CONF_TYPE_BOOL;
988   $freepbx_conf->define_conf_setting('USECATEGORIES',$set);
989
990   // SERVERINTITLE
991   $set['value'] = false;
992   $set['options'] = '';
993   $set['name'] = 'Include Server Name in Browser';
994   $set['description'] = 'Precede browser title with the server name.';
995   $set['emptyok'] = 0;
996   $set['type'] = CONF_TYPE_BOOL;
997   $freepbx_conf->define_conf_setting('SERVERINTITLE',$set);
998
999   // RELOADCONFIRM
1000   $set['value'] = true;
1001   $set['options'] = '';
1002   $set['name'] = 'Require Confirm with Apply Changes';
1003   $set['description'] = 'When set to false, will bypass the confirm on Reload Box.';
1004   $set['emptyok'] = 0;
1005   $set['type'] = CONF_TYPE_BOOL;
1006   $freepbx_conf->define_conf_setting('RELOADCONFIRM',$set);
1007
1008   // BADDESTABORT
1009   $set['value'] = false;
1010   $set['options'] = '';
1011   $set['name'] = 'Abort Config Gen on Bad Dest';
1012   $set['description'] = '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.';
1013   $set['emptyok'] = 0;
1014   $set['level'] = 3;
1015   $set['type'] = CONF_TYPE_BOOL;
1016   $freepbx_conf->define_conf_setting('BADDESTABORT',$set);
1017   $set['level'] = 0;
1018
1019   // XTNCONFLICTABORT
1020   $set['value'] = false;
1021   $set['options'] = '';
1022   $set['name'] = 'Abort Config Gen on Exten Conflict';
1023   $set['description'] = '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.';
1024   $set['emptyok'] = 0;
1025   $set['level'] = 3;
1026   $set['type'] = CONF_TYPE_BOOL;
1027   $freepbx_conf->define_conf_setting('XTNCONFLICTABORT',$set);
1028   $set['level'] = 0;
1029
1030   // CUSTOMASERROR
1031   $set['value'] = true;
1032   $set['options'] = '';
1033   $set['name'] = 'Report Unknown Dest as Error';
1034   $set['description'] = '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.';
1035   $set['emptyok'] = 0;
1036   $set['level'] = 2;
1037   $set['type'] = CONF_TYPE_BOOL;
1038   $freepbx_conf->define_conf_setting('CUSTOMASERROR',$set);
1039   $set['level'] = 0;
1040
1041
1042   //
1043   // CATEGORY: Asterisk Manager
1044   //
1045   $set['category'] = 'Asterisk Manager';
1046
1047   // AMPMGRPASS
1048   $set['value'] = 'amp111';
1049   $set['options'] = '';
1050   $set['name'] = 'Asterisk Manager Password';
1051   $set['description'] = 'Password for accessing the Asterisk Manager Interface (AMI), you must change this in manager.conf if changed here.';
1052   $set['emptyok'] = 0;
1053   $set['type'] = CONF_TYPE_TEXT;
1054   $set['level'] = 2;
1055   $freepbx_conf->define_conf_setting('AMPMGRPASS',$set);
1056   $set['level'] = 0;
1057
1058   // AMPMGRUSER
1059   $set['value'] = 'admin';
1060   $set['options'] = '';
1061   $set['name'] = 'Asterisk Manager User';
1062   $set['description'] = 'Username for accessing the Asterisk Manager Interface (AMI), you must change this in manager.conf if changed here.';
1063   $set['emptyok'] = 0;
1064   $set['type'] = CONF_TYPE_TEXT;
1065   $set['level'] = 2;
1066   $freepbx_conf->define_conf_setting('AMPMGRUSER',$set);
1067   $set['level'] = 0;
1068
1069   // ASTMANAGERHOST
1070   $set['value'] = 'localhost';
1071   $set['options'] = '';
1072   $set['name'] = 'Asterisk Manager Host';
1073   $set['description'] = 'Hostname for the Asterisk Manager';
1074   $set['emptyok'] = 0;
1075   $set['type'] = CONF_TYPE_TEXT;
1076   $set['level'] = 2;
1077   $freepbx_conf->define_conf_setting('ASTMANAGERHOST',$set);
1078   $set['level'] = 0;
1079
1080   // ASTMANAGERPORT
1081   $set['value'] = '5038';
1082   $set['name'] = 'Asterisk Manager Port';
1083   $set['description'] = 'Port for the Asterisk Manager';
1084   $set['emptyok'] = 0;
1085   $set['type'] = CONF_TYPE_INT;
1086   $set['options'] = array(1024,65535);
1087   $set['level'] = 2;
1088   $freepbx_conf->define_conf_setting('ASTMANAGERPORT',$set);
1089   $set['level'] = 0;
1090
1091   // ASTMANAGERPROXYPORT
1092   $set['value'] = '';
1093   $set['name'] = 'Asterisk Manager Proxy Port';
1094   $set['description'] = 'Optional port for an Asterisk Manager Proxy';
1095   $set['type'] = CONF_TYPE_INT;
1096   $set['emptyok'] = 1;
1097   $set['options'] = array(1024,65535);
1098   $set['level'] = 2;
1099   $freepbx_conf->define_conf_setting('ASTMANAGERPROXYPORT',$set);
1100   $set['level'] = 0;
1101
1102
1103   //
1104   // CATEGORY: Developer and Customization
1105   //
1106   $set['category'] = 'Developer and Customization';
1107   $set['level'] = 2;
1108
1109   // FPBXDBUGFILE
1110   $set['value'] = '/tmp/freepbx_debug.log';
1111   $set['options'] = '';
1112   $set['name'] = 'Debug File';
1113   $set['description'] = 'Full path and name of FreePBX debug file. Used by the dbug() function by developers.';
1114   $set['emptyok'] = 0;
1115   $set['type'] = CONF_TYPE_TEXT;
1116   $freepbx_conf->define_conf_setting('FPBXDBUGFILE',$set);
1117
1118   // FPBXDBUGDISABLE
1119   $set['value'] = true;
1120   $set['options'] = '';
1121   $set['name'] = 'Disable FreePBX dbug Logging';
1122   $set['description'] = 'Set to true to stop all dbug() calls from writing to the Debug File (FPBXDBUGFILE)';
1123   $set['emptyok'] = 0;
1124   $set['type'] = CONF_TYPE_BOOL;
1125   $freepbx_conf->define_conf_setting('FPBXDBUGDISABLE',$set);
1126
1127   // DEVEL
1128   $set['value'] = false;
1129   $set['options'] = '';
1130   $set['name'] = 'Developer Mode';
1131   $set['description'] = 'This enables several debug features geared towards developers, including some page load timing information, some debug information in Module Admin, use of original CSS files and other future capabilities will be enabled.';
1132   $set['emptyok'] = 0;
1133   $set['type'] = CONF_TYPE_BOOL;
1134   $freepbx_conf->define_conf_setting('DEVEL',$set);
1135
1136   // USE_PACKAGED_JS
1137   $set['value'] = true;
1138   $set['options'] = '';
1139   $set['name'] = 'Use Packaged Javascript Library ';
1140   $set['description'] = 'FreePBX packages several javascript libraries and components into a compressed file called libfreepbx.javascript.js. By default this will be loaded instead of the individual uncompressed libraries. Setting this to false will force FreePBX to load all the libraries as individual uncompressed files. This is useful during development and debugging.';
1141   $set['emptyok'] = 0;
1142   $set['type'] = CONF_TYPE_BOOL;
1143   $freepbx_conf->define_conf_setting('USE_PACKAGED_JS',$set);
1144
1145   // FORCE_JS_CSS_IMG_DOWNLOAD
1146   $set['value'] = false;
1147   $set['options'] = '';
1148   $set['name'] = 'Always Download Web Assets';
1149   $set['description'] = 'FreePBX appends versioning tags on the CSS and javascript files and some of the main logo images. The versioning will help force browsers to load new versions of the files when module versions are upgraded. Setting this value to true will try to force these to be loaded to the browser every page load by appending an additional timestamp in the version information. This is useful during development and debugging where changes are being made to javascript and CSS files.';
1150   $set['emptyok'] = 0;
1151   $set['type'] = CONF_TYPE_BOOL;
1152   $freepbx_conf->define_conf_setting('FORCE_JS_CSS_IMG_DOWNLOAD',$set);
1153
1154   // DEVELRELOAD
1155   $set['value'] = false;
1156   $set['options'] = '';
1157   $set['name'] = 'Leave Reload Bar Up';
1158   $set['description'] = 'Forces the "Apply Configuration Changes" reload bar to always be present even when not necessary.';
1159   $set['emptyok'] = 0;
1160   $set['type'] = CONF_TYPE_BOOL;
1161   $freepbx_conf->define_conf_setting('DEVELRELOAD',$set);
1162
1163   // PRE_RELOAD
1164   $set['value'] = '';
1165   $set['options'] = '';
1166   $set['name'] = 'PRE_RELOAD Script';
1167   $set['description'] = 'Optional script to run just prior to doing an extension reload to Asterisk through the manager after pressing Apply Configuration Changes in the GUI.';
1168   $set['emptyok'] = 1;
1169   $set['type'] = CONF_TYPE_TEXT;
1170   $freepbx_conf->define_conf_setting('PRE_RELOAD',$set);
1171
1172   // POST_RELOAD
1173   $set['value'] = '';
1174   $set['options'] = '';
1175   $set['name'] = 'POST_RELOAD Script';
1176   $set['description'] = '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.';
1177   $set['emptyok'] = 1;
1178   $set['type'] = CONF_TYPE_TEXT;
1179   $freepbx_conf->define_conf_setting('POST_RELOAD',$set);
1180
1181   // POST_RELOAD_DEBUG
1182   $set['value'] = false;
1183   $set['options'] = '';
1184   $set['name'] = 'POST_RELOAD Debug Mode';
1185   $set['description'] = 'Display debug output for script used if POST_RELOAD is used.';
1186   $set['emptyok'] = 0;
1187   $set['type'] = CONF_TYPE_BOOL;
1188   $freepbx_conf->define_conf_setting('POST_RELOAD_DEBUG',$set);
1189
1190   // AMPLOCALBIN
1191   $set['value'] = '';
1192   $set['options'] = '';
1193   $set['name'] = 'AMPLOCALBIN Dir for retrieve_conf';
1194   $set['description'] = 'If this directory is defined, retrieve_conf will check for a file called <i>retrieve_conf_post_custom</i> and if that file exists, it will be included after other processing thus having full access to the current environment for additional customization.';
1195   $set['emptyok'] = 1;
1196   $set['type'] = CONF_TYPE_DIR;
1197   $freepbx_conf->define_conf_setting('AMPLOCALBIN',$set);
1198
1199  
1200   // DISABLE_CSS_AUTOGEN
1201   $set['value'] = false;
1202   $set['options'] = '';
1203   $set['name'] = 'Disable Mainstyle CSS Compression';
1204   $set['description'] = 'Stops the automatic generation of a stripped CSS file that replaces the primary sheet, usually mainstyle.css.';
1205   $set['emptyok'] = 0;
1206   $set['type'] = CONF_TYPE_BOOL;
1207   $freepbx_conf->define_conf_setting('DISABLE_CSS_AUTOGEN',$set);
1208
1209
1210   //
1211   // CATEGORY: Flash Operator Panel
1212   //
1213   $set['category'] = 'Flash Operator Panel';
1214   $set['level'] = 0;
1215
1216   // FOPSORT
1217   $set['value'] = 'extension';
1218   $set['options'] = 'extension,lastname';
1219   $set['name'] = 'FOP Sort Mode';
1220   $set['description'] = 'How FOP sort extensions. By Last Name [lastname] or by Extension [extension].';
1221   $set['emptyok'] = 0;
1222   $set['type'] = CONF_TYPE_SELECT;
1223   $freepbx_conf->define_conf_setting('FOPSORT',$set);
1224
1225   // FOPWEBROOT
1226   $set['value'] = '/var/www/html/panel';
1227   $set['options'] = '';
1228   $set['name'] = 'FOP Web Root Dir';
1229   $set['description'] = 'Path to the Flash Operator Panel webroot (leave off trailing slash).';
1230   $set['emptyok'] = 0;
1231   $set['type'] = CONF_TYPE_DIR;
1232   $set['level'] = 4;
1233   $freepbx_conf->define_conf_setting('FOPWEBROOT',$set);
1234   $set['level'] = 0;
1235
1236   // FOPPASSWORD
1237   $set['value'] = 'passw0rd';
1238   $set['options'] = '';
1239   $set['name'] = 'FOP Password';
1240   $set['description'] = 'Password for performing transfers and hangups in the Flash Operator Panel (FOP).';
1241   $set['emptyok'] = 0;
1242   $set['type'] = CONF_TYPE_TEXT;
1243   $freepbx_conf->define_conf_setting('FOPPASSWORD',$set);
1244
1245   // FOPDISABLE
1246   $set['value'] = false;
1247   $set['options'] = '';
1248   $set['name'] = 'Disable FOP';
1249   $set['description'] = 'Set to true to disable FOP in interface and retrieve_conf.  Useful for sqlite3 or if you do not want FOP.';
1250   $set['emptyok'] = 0;
1251   $set['type'] = CONF_TYPE_BOOL;
1252   $freepbx_conf->define_conf_setting('FOPDISABLE',$set);
1253
1254   // FOPRUN
1255   $set['value'] = true;
1256   $set['options'] = '';
1257   $set['name'] = 'Start FOP with amportal';
1258   $set['description'] = 'Set to true if you want FOP started by freepbx_engine (amportal_start), false otherwise.';
1259   $set['emptyok'] = 0;
1260   $set['type'] = CONF_TYPE_BOOL;
1261   $freepbx_conf->define_conf_setting('FOPRUN',$set);
1262
1263
1264   //
1265   // CATEGORY: Remote CDR Database
1266   //
1267   $set['category'] = 'Remote CDR Database';
1268   $set['level'] = 3;
1269
1270   // CDRDBHOST
1271   $set['value'] = '';
1272   $set['options'] = '';
1273   $set['name'] = 'Remote CDR DB Host';
1274   $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you dont use the default values provided by FreePBX.<br>Hostname of db server if not the same as AMPDBHOST.';
1275   $set['emptyok'] = 1;
1276   $set['type'] = CONF_TYPE_TEXT;
1277   $freepbx_conf->define_conf_setting('CDRDBHOST',$set);
1278
1279   // CDRDBNAME
1280   $set['value'] = '';
1281   $set['options'] = '';
1282   $set['name'] = 'Remote CDR DB Name';
1283   $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you dont use the default values provided by FreePBX.<br>Name of database used for cdr records.';
1284   $set['emptyok'] = 1;
1285   $set['type'] = CONF_TYPE_TEXT;
1286   $freepbx_conf->define_conf_setting('CDRDBNAME',$set);
1287
1288   // CDRDBPASS
1289   $set['value'] = '';
1290   $set['options'] = '';
1291   $set['name'] = 'Remote CDR DB Password';
1292   $set['description'] = 'DO NOT set this unless you know what you are doing. 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.';
1293   $set['emptyok'] = 1;
1294   $set['type'] = CONF_TYPE_TEXT;
1295   $freepbx_conf->define_conf_setting('CDRDBPASS',$set);
1296
1297   // CDRDBPORT
1298   $set['value'] = '';
1299   $set['options'] = array(1024,65536);
1300   $set['name'] = 'Remote CDR DB Password';
1301   $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you dont use the default values provided by FreePBX.<br>Port number for db host.';
1302   $set['emptyok'] = 1;
1303   $set['type'] = CONF_TYPE_INT;
1304   $freepbx_conf->define_conf_setting('CDRDBPORT',$set);
1305
1306   // CDRDBTABLENAME
1307   $set['value'] = '';
1308   $set['options'] = '';
1309   $set['name'] = 'Remote CDR DB Table';
1310   $set['description'] = 'DO NOT set this unless you know what you are doing. 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.';
1311   $set['emptyok'] = 1;
1312   $set['type'] = CONF_TYPE_TEXT;
1313   $freepbx_conf->define_conf_setting('CDRDBTABLENAME',$set);
1314
1315   // CDRDBTYPE
1316   $set['value'] = '';
1317   $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you dont use the default values provided by FreePBX. Defaults to your configured AMDBENGINE.';
1318   $set['name'] = 'Remote CDR DB Type';
1319   $set['emptyok'] = 1;
1320   $set['options'] = ',mysql,postgres';
1321   $set['type'] = CONF_TYPE_SELECT;
1322   $freepbx_conf->define_conf_setting('CDRDBTYPE',$set);
1323
1324   // CDRDBUSER
1325   $set['value'] = '';
1326   $set['options'] = '';
1327   $set['name'] = 'Remote CDR DB User';
1328   $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you dont use the default values provided by FreePBX. Username to connect to db with if it is not the same as AMPDBUSER.';
1329   $set['emptyok'] = 1;
1330   $set['type'] = CONF_TYPE_TEXT;
1331   $freepbx_conf->define_conf_setting('CDRDBUSER',$set);
1332
1333
1334   //
1335   // CATEGORY: Remote CDR Database
1336   //
1337   $set['category'] = 'Styling and Logos';
1338   $set['level'] = 1;
1339
1340   // AMPADMINLOGO
1341   $set['value'] = '';
1342   $set['options'] = '';
1343   $set['name'] = 'Legacy Right Logo';
1344   $set['description'] = 'Legacy setting, use BRAND_IMAGE_FREEPBX_RIGHT in the future. If set, this will override BRAND_IMAGE_FREEPBX_RIGHT. Overrides the standard 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.';
1345   $set['type'] = CONF_TYPE_TEXT;
1346   $set['emptyok'] = 1;
1347   $freepbx_conf->define_conf_setting('AMPADMINLOGO',$set);
1348
1349   // BRAND_IMAGE_HIDE_NAV_BACKGROUND
1350   $set['value'] = false;
1351   $set['options'] = '';
1352   $set['name'] = 'Hide Nav Background';
1353   $set['description'] = 'Hide the configured left navigation bar background.';
1354   $set['type'] = CONF_TYPE_BOOL;
1355   $set['emptyok'] = 0;
1356   $freepbx_conf->define_conf_setting('BRAND_IMAGE_HIDE_NAV_BACKGROUND',$set);
1357
1358   // BRAND_IMAGE_SHADOW_SIDE_BACKGROUND
1359   $set['value'] = 'images/shadow-side-background.png';
1360   $set['options'] = '';
1361   $set['name'] = 'Image: shadow-side-background.png';
1362   $set['description'] = 'Styling image.';
1363   $set['emptyok'] = 1;
1364   $set['type'] = CONF_TYPE_TEXT;
1365   $freepbx_conf->define_conf_setting('BRAND_IMAGE_SHADOW_SIDE_BACKGROUND',$set);
1366
1367   // BRAND_IMAGE_FREEPBX_RIGHT
1368   $set['value'] = 'images/logo.png';
1369   $set['options'] = '';
1370   $set['name'] = 'Image: Right Upper';
1371   $set['description'] = 'Right upper logo. Use this setting instead of AMPADMINLOGO. Path is relative to admin.';
1372   $set['type'] = CONF_TYPE_TEXT;
1373   $set['emptyok'] = 0;
1374   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_RIGHT',$set);
1375
1376   // BRAND_IMAGE_FREEPBX_LEFT
1377   $set['value'] = 'images/freepbx_large.png';
1378   $set['options'] = '';
1379   $set['name'] = 'Image: Left Upper';
1380   $set['description'] = 'Left upper logo.  Path is relative to admin.';
1381   $set['type'] = CONF_TYPE_TEXT;
1382   $set['emptyok'] = 0;
1383   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_LEFT',$set);
1384
1385   // BRAND_IMAGE_FREEPBX_FOOT
1386   $set['value'] = 'images/freepbx_small.png';
1387   $set['options'] = '';
1388   $set['name'] = 'Image: Footer';
1389   $set['description'] = 'Logo in footer.  Path is relative to admin.';
1390   $set['type'] = CONF_TYPE_TEXT;
1391   $set['emptyok'] = 1;
1392   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_FOOT',$set);
1393
1394   // BRAND_IMAGE_RELOAD_LOADING
1395   $set['value'] = 'images/loading.gif';
1396   $set['options'] = '';
1397   $set['name'] = 'Image: Reload Screen';
1398   $set['description'] = 'Image used during a reload, default is animated GIF eating the * (asterisk).  Path is relative to admin.';
1399   $set['type'] = CONF_TYPE_TEXT;
1400   $set['emptyok'] = 1;
1401   $freepbx_conf->define_conf_setting('BRAND_IMAGE_RELOAD_LOADING',$set);
1402
1403   // BRAND_FREEPBX_ALT_LEFT
1404   $set['value'] = '';
1405   $set['options'] = '';
1406   $set['name'] = 'Alt for Left Logo';
1407   $set['description'] = 'alt attribute to use in place of image and title hover value. Defaults to FreePBX';
1408   $set['type'] = CONF_TYPE_TEXT;
1409   $set['emptyok'] = 1;
1410   $freepbx_conf->define_conf_setting('BRAND_FREEPBX_ALT_LEFT',$set);
1411
1412   // BRAND_FREEPBX_ALT_RIGHT
1413   $set['value'] = '';
1414   $set['options'] = '';
1415   $set['name'] = 'Alt for Right Logo';
1416   $set['description'] = 'alt attribute to use in place of image and title hover value. Defaults to FreePBX';
1417   $set['type'] = CONF_TYPE_TEXT;
1418   $set['emptyok'] = 1;
1419   $freepbx_conf->define_conf_setting('BRAND_FREEPBX_ALT_RIGHT',$set);
1420
1421   // BRAND_FREEPBX_ALT_FOOT
1422   $set['value'] = '';
1423   $set['options'] = '';
1424   $set['name'] = 'Alt for Footer Logo';
1425   $set['description'] = 'alt attribute to use in place of image and title hover value. Defaults to FreePBX';
1426   $set['type'] = CONF_TYPE_TEXT;
1427   $set['emptyok'] = 1;
1428   $freepbx_conf->define_conf_setting('BRAND_FREEPBX_ALT_FOOT',$set);
1429
1430   // BRAND_IMAGE_FREEPBX_LINK_LEFT
1431   $set['value'] = '';
1432   $set['options'] = '';
1433   $set['name'] = 'Link for Left Logo';
1434   $set['description'] = 'link to follow when clicking on logo, defaults to http://www.freepbx.org';
1435   $set['type'] = CONF_TYPE_TEXT;
1436   $set['emptyok'] = 1;
1437   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_LINK_LEFT',$set);
1438
1439   // BRAND_IMAGE_FREEPBX_LINK_RIGHT
1440   $set['value'] = '';
1441   $set['options'] = '';
1442   $set['name'] = 'Link for Right Logo';
1443   $set['description'] = 'link to follow when clicking on logo, defaults to http://www.freepbx.org';
1444   $set['type'] = CONF_TYPE_TEXT;
1445   $set['emptyok'] = 1;
1446   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_LINK_RIGHT',$set);
1447
1448   // BRAND_IMAGE_FREEPBX_LINK_FOOT
1449   $set['value'] = '';
1450   $set['options'] = '';
1451   $set['name'] = 'Link for Footer Logo';
1452   $set['description'] = 'link to follow when clicking on logo, defaults to http://www.freepbx.org';
1453   $set['type'] = CONF_TYPE_TEXT;
1454   $set['emptyok'] = 1;
1455   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_LINK_FOOT',$set);
1456
1457   // BRAND_HIDE_LOGO_RIGHT
1458   $set['value'] = false;
1459   $set['options'] = '';
1460   $set['name'] = 'Hide Right Logo';
1461   $set['description'] = 'Setting to true will hide the upper right logo.';
1462   $set['type'] = CONF_TYPE_BOOL;
1463   $set['emptyok'] = 0;
1464   $freepbx_conf->define_conf_setting('BRAND_HIDE_LOGO_RIGHT',$set);
1465
1466   // BRAND_HIDE_HEADER_VERSION
1467   $set['value'] = false;
1468   $set['options'] = '';
1469   $set['name'] = 'Hide Right FreePBX Version';
1470   $set['description'] = 'Setting to true will hide the FreePBX version information below the left upper header.';
1471   $set['type'] = CONF_TYPE_BOOL;
1472   $set['emptyok'] = 0;
1473   $freepbx_conf->define_conf_setting('BRAND_HIDE_HEADER_VERSION',$set);
1474
1475   // BRAND_HIDE_HEADER_MENUS
1476   $set['value'] = false;
1477   $set['options'] = '';
1478   $set['name'] = 'Hide Header Menus';
1479   $set['description'] = 'Setting to true will hide the complete horizontal menu bar in the header.';
1480   $set['type'] = CONF_TYPE_BOOL;
1481   $set['emptyok'] = 0;
1482   $freepbx_conf->define_conf_setting('BRAND_HIDE_HEADER_MENUS',$set);
1483
1484   // BRAND_CSS_ALT_MAINSTYLE
1485   $set['value'] = '';
1486   $set['options'] = '';
1487   $set['name'] = 'Primary CSS Stylesheet';
1488   $set['description'] = 'Set this to replace the default mainstyle.css style sheet with your own, relative to admin.';
1489   $set['type'] = CONF_TYPE_TEXT;
1490   $set['emptyok'] = 1;
1491   $freepbx_conf->define_conf_setting('BRAND_CSS_ALT_MAINSTYLE',$set);
1492
1493   // BRAND_CSS_CUSTOM
1494   $set['value'] = '';
1495   $set['options'] = '';
1496   $set['name'] = 'Optional Additional CSS Stylesheet';
1497   $set['description'] = 'Optional custom CSS style sheet included after the primary one and any module specific ones are loaded, relative to admin.';
1498   $set['type'] = CONF_TYPE_TEXT;
1499   $set['emptyok'] = 1;
1500   $freepbx_conf->define_conf_setting('BRAND_CSS_CUSTOM',$set);
1501
1502
1503   // The following settings are used in various modules prior to 2.9. If they are found in amportal.conf then we
1504   // retain their values until the individual modules are updated and their install scripts run where a full
1505   // configuration (descriptions, defaults, etc.) will be provided and maintained. This provides just enough to
1506   // carry the setting through the migration since most upgrades will run framework or install_amp followed by the
1507   // module install scripts.
1508   //
1509   $module_migrate['AMPPLAYKEY'] = CONF_TYPE_TEXT;
1510   $module_migrate['AMPBACKUPEMAILFROM'] = CONF_TYPE_TEXT;
1511   $module_migrate['AMPBACKUPSUDO'] = CONF_TYPE_BOOL;
1512   $module_migrate['USEQUEUESTATE'] = CONF_TYPE_BOOL;
1513   $module_migrate['DASHBOARD_INFO_UPDATE_TIME'] = CONF_TYPE_INT;
1514   $module_migrate['DASHBOARD_STATS_UPDATE_TIME'] = CONF_TYPE_INT;
1515   $module_migrate['SSHPORT'] = CONF_TYPE_INT;
1516   $module_migrate['MAXCALLS'] = CONF_TYPE_INT;
1517   $module_migrate['AMPMPG123'] = CONF_TYPE_BOOL;
1518   $module_migrate['PARKINGPATCH'] = CONF_TYPE_BOOL;
1519
1520   $mod_set['value'] = '';
1521   $mod_set['defaultval'] = '';
1522   $mod_set['readonly'] = 0;
1523   $mod_set['hidden'] = 1;
1524   $mod_set['level'] = 10;
1525   $mod_set['module'] = '';
1526   $mod_set['category'] = 'Under Migration';
1527   $mod_set['emptyok'] = 1;
1528   $mod_set['description'] = 'This setting is being migrated and will be initialized by its module install script on upgrade.';
1529   foreach ($module_migrate as $setting => $type) {
1530     if (isset($amp_conf[$setting])  && !$freepbx_conf->conf_setting_exists($setting)) {
1531       $val = $amp_conf[$setting];
1532
1533       // since this came from a conf file, change any 'false' that will otherwise turn to true
1534       //
1535       if ($type == CONF_TYPE_BOOL) switch (strtolower($val)) {
1536       case 'false':
1537       case 'no':
1538       case 'off':
1539         $val = false;
1540       break;
1541       }
1542       $mod_set['value'] = $val;
1543       $mod_set['type'] = $type;
1544       $freepbx_conf->define_conf_setting($setting,$mod_set);
1545     }
1546   }
1547
1548   if ($commit_to_db) {
1549     $freepbx_conf->commit_conf_settings();
1550   }
1551 }
Note: See TracBrowser for help on using the browser.