root/freepbx/trunk/libfreepbx.install.php

Revision 10975, 45.5 kB (checked in by p_lindheimer, 2 years ago)

convert falses from conf file and provide optional to not commit re #4740

  • 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 ugprades/
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           // pervents 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         $num_files++;
298         if ($overwrite) {
299           debug(($make_links ? "link" : "copy")." ".$source." -> ".$destination);
300           if (!$dryrun) {
301             if ($make_links) {
302               // symlink, unlike copy, doesn't overwrite - have to delete first
303               if (is_link($destination) || file_exists($destination)) {
304                 unlink($destination);
305               }
306               symlink($_ENV["PWD"]."/".$source, $destination);
307             } else {
308               copy($source, $destination);
309             }
310             $num_copied++;
311           }
312         } else {
313           debug("not overwriting ".$destination);
314         }
315       } else {
316         //echo "recursive_copy($dirsourceparent, $dirdest, $md5sums, $dirsource/$file)";
317         list($tmp_num_files, $tmp_num_copied) = recursive_copy($dirsourceparent, $dirdest, $md5sums, $dirsource."/".$file);
318         $num_files += $tmp_num_files;
319         $num_copied += $tmp_num_copied;
320       }
321     }
322   }
323  
324   if (isset($dir_handle)) closedir($dir_handle);
325  
326   return array($num_files, $num_copied);
327 }
328
329 function read_md5_file($filename) {
330   $md5 = array();
331   if (file_exists($filename)) {
332     foreach (file($filename) as $line) {
333       if (preg_match("/^([a-f0-9]{32})\s+(.*)$/", $line, $matches)) {
334         $md5[ "/".$matches[2] ] = $matches[1];
335       }
336     }
337   }
338   return $md5;
339 }
340
341 /** Include a .php file
342  * This is a function just to keep a seperate context
343  */
344 function run_included($file) {
345   global $db;
346   global $amp_conf;
347  
348   include($file);
349 }
350
351 function install_sqlupdate( $version, $file )
352 {
353   global $db;
354   global $dryrun;
355
356   out("-> Running SQL script ".UPGRADE_DIR."/".$version."/".$file);
357   // run sql script
358   $fd = fopen(UPGRADE_DIR."/".$version."/".$file, "r");
359   $data = "";
360   while (!feof($fd)) {
361     $data .= fread($fd, 1024);
362   }
363   fclose($fd);
364
365   preg_match_all("/((SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER).*);\s*\n/Us", $data, $matches);
366  
367   foreach ($matches[1] as $sql) {
368     debug($sql);
369     if (!$dryrun) {
370       $result = $db->query($sql);
371       if(DB::IsError($result)) {     
372         fatal($result->getDebugInfo()."\" while running ".$file."\n");
373       }
374     }
375   }
376 }
377
378 /********************************************************************************************************************/
379 /*                          FREEPBX SETTINGS (AMPORTAL.CONF) DEFINED HERE                                           */
380 /********************************************************************************************************************/
381 //
382 // TODO: find a good way to extract the required localization strings for the tools to pickup
383 //
384 // freepbx_settings_init()
385 // this is where we initialize all the freepbx_settings (amportal.conf). This will be run with install_amp and every
386 // time we run the framework installer, so new settings can be added here that are framework wide. It may make send to
387 // break this out separtely but for now we'll keep it here since this is already part of the ifrastructure that is
388 // used by both install_amp and the framework install/upgrade script.
389 //
390 function freepbx_settings_init($commit_to_db = false) {
391   global $amp_conf;
392
393   //TODO will probably change to freepbx_settings.class.php
394   //
395   require_once ($amp_conf['AMPWEBROOT'].'/admin/libraries/freepbx_conf.class.php');
396
397   $freepbx_conf =& freepbx_conf::create();
398
399   $set['value'] = '';
400   $set['defaultval'] =& $set['value'];
401   $set['readonly'] = 0;
402   $set['hidden'] = 0;
403   $set['level'] = 0;
404   $set['module'] = '';
405   $set['emptyok'] = 0;
406
407   //
408   // CATEGORY: System Setup
409   //
410   $set['category'] = 'System Setup';
411
412   // AMPENGINE
413   $set['value'] = 'asterisk';
414   $set['options'] = 'asterisk';
415   $set['description'] = 'The telephony backend engine being used, asterisk is the only option currently.';
416   $set['level'] = 3;
417   $set['readonly'] = 1;
418   $set['type'] = CONF_TYPE_SELECT;
419   $freepbx_conf->define_conf_setting('AMPENGINE',$set);
420   $set['readonly'] = 0;
421   $set['level'] = 0;
422
423   // AUTHTYPE
424   $set['value'] = 'database';
425   $set['options'] = 'database,none,webserver';
426   $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.';
427   $set['level'] = 3;
428   $set['type'] = CONF_TYPE_SELECT;
429   $freepbx_conf->define_conf_setting('AUTHTYPE',$set);
430   $set['level'] = 0;
431
432   // AMPEXTENSIONS
433   $set['value'] = 'extensions';
434   $set['options'] = 'extensions,deviceanduser';
435   $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 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.';
436   $set['type'] = CONF_TYPE_SELECT;
437   $freepbx_conf->define_conf_setting('AMPEXTENSIONS',$set);
438
439   // AMPVMUMASK
440   $set['value'] = '007';
441   $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.';
442   $set['type'] = CONF_TYPE_TEXT;
443   $freepbx_conf->define_conf_setting('AMPVMUMASK',$set);
444
445   // ARI_ADMIN_USERNAME
446   $set['value'] = '';
447   $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 ARI_ADMIN_PASSWORD as well.Default = not set';
448   $set['emptyok'] = 1;
449   $set['type'] = CONF_TYPE_TEXT;
450   $freepbx_conf->define_conf_setting('ARI_ADMIN_USERNAME',$set);
451   $set['emptyok'] = 0;
452
453   // ARI_ADMIN_PASSWORD
454   $set['value'] = 'ari_password';
455   $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';
456   $set['type'] = CONF_TYPE_TEXT;
457   $freepbx_conf->define_conf_setting('ARI_ADMIN_PASSWORD',$set);
458
459   // AMPASTERISKUSER
460   $set['value'] = 'asterisk';
461   $set['description'] = 'The user Asterisk should be running as, used by freepbx_engine. Most systems should not change this.';
462   $set['type'] = CONF_TYPE_TEXT;
463   $set['level'] = 4;
464   $freepbx_conf->define_conf_setting('AMPASTERISKUSER',$set);
465   $set['level'] = 0;
466
467   // AMPASTERISKGROUP
468   $set['value'] = 'asterisk';
469   $set['description'] = 'The user group Asterisk should be running as, used by freepbx_engine. Most systems should not change this.';
470   $set['type'] = CONF_TYPE_TEXT;
471   $set['level'] = 4;
472   $freepbx_conf->define_conf_setting('AMPASTERISKGROUP',$set);
473   $set['level'] = 0;
474
475   // AMPASTERISKWEBUSER
476   $set['value'] = 'asterisk';
477   $set['description'] = 'The user your httpd should be running as, used by freepbx_engine. Most systems should not change this.';
478   $set['type'] = CONF_TYPE_TEXT;
479   $set['level'] = 4;
480   $freepbx_conf->define_conf_setting('AMPASTERISKWEBUSER',$set);
481   $set['level'] = 0;
482
483   // AMPASTERISKWEBGROUP
484   $set['value'] = 'asterisk';
485   $set['description'] = 'The user group your httpd should be running as, used by freepbx_engine. Most systems should not change this.';
486   $set['type'] = CONF_TYPE_TEXT;
487   $set['level'] = 4;
488   $freepbx_conf->define_conf_setting('AMPASTERISKWEBGROUP',$set);
489   $set['level'] = 0;
490
491   // AMPDEVUSER
492   $set['value'] = 'asterisk';
493   $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.';
494   $set['type'] = CONF_TYPE_TEXT;
495   $set['level'] = 4;
496   $freepbx_conf->define_conf_setting('AMPDEVUSER',$set);
497   $set['level'] = 0;
498
499   // AMPDEVGROUP
500   $set['value'] = 'asterisk';
501   $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.';
502   $set['type'] = CONF_TYPE_TEXT;
503   $set['level'] = 4;
504   $freepbx_conf->define_conf_setting('AMPDEVGROUP',$set);
505   $set['level'] = 0;
506
507
508   //
509   // CATEGORY: Dialplan and Operational
510   //
511   $set['category'] = 'Dialplan and Operational';
512
513   // AMPBADNUMBER
514   $set['value'] = true;
515   $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.';
516   $set['type'] = CONF_TYPE_BOOL;
517   $freepbx_conf->define_conf_setting('AMPBADNUMBER',$set);
518
519   // CWINUSEBUSY
520   $set['value'] = true;
521   $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>.';
522   $set['type'] = CONF_TYPE_BOOL;
523   $freepbx_conf->define_conf_setting('CWINUSEBUSY',$set);
524
525   // ZAP2DAHDICOMPAT
526   $set['value'] = false;
527   $set['description'] = '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.';
528   $set['type'] = CONF_TYPE_BOOL;
529   $freepbx_conf->define_conf_setting('ZAP2DAHDICOMPAT',$set);
530
531   // DYNAMICHINTS
532   $set['value'] = false;
533   $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.';
534   $set['type'] = CONF_TYPE_BOOL;
535   $freepbx_conf->define_conf_setting('DYNAMICHINTS',$set);
536
537   // ENABLECW
538   $set['value'] = true;
539   $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.';
540   $set['type'] = CONF_TYPE_BOOL;
541   $freepbx_conf->define_conf_setting('ENABLECW',$set);
542
543   // FCBEEPONLY
544   $set['value'] = false;
545   $set['description'] = 'When set to true, a beep is played instead of confirmation message when activating/de-activating: CallForward, CallWaiting, DayNight, DoNotDisturb and FindMeFollow.';
546   $set['type'] = CONF_TYPE_BOOL;
547   $freepbx_conf->define_conf_setting('FCBEEPONLY',$set);
548
549   // USEDEVSTATE
550   $set['value'] = false;
551   $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';
552   $set['type'] = CONF_TYPE_BOOL;
553   $freepbx_conf->define_conf_setting('USEDEVSTATE',$set);
554
555   // USEGOOGLEDNSFORENUM
556   $set['value'] = false;
557   $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>.';
558   $set['type'] = CONF_TYPE_BOOL;
559   $freepbx_conf->define_conf_setting('USEGOOGLEDNSFORENUM',$set);
560
561   // DISABLECUSTOMCONTEXTS
562   $set['value'] = false;
563   $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.';
564   $set['type'] = CONF_TYPE_BOOL;
565   $freepbx_conf->define_conf_setting('DISABLECUSTOMCONTEXTS',$set);
566
567
568   //
569   // CATEGORY: Directory Layout
570   //
571   $set['category'] = 'Directory Layout';
572
573   // AMPBIN
574   $set['value'] = '/var/lib/asterisk/bin';
575   $set['description'] = 'Location of the FreePBX command line scripts.';
576   $set['type'] = CONF_TYPE_DIR;
577   $freepbx_conf->define_conf_setting('AMPBIN',$set);
578
579   // AMPSBIN
580   $set['value'] = '/usr/sbin';
581   $set['description'] = 'Where (root) command line scripts are located.';
582   $set['type'] = CONF_TYPE_DIR;
583   $freepbx_conf->define_conf_setting('AMPSBIN',$set);
584    
585   // AMPWEBROOT
586   $set['value'] = '/var/www/html';
587   $set['description'] = 'The path to Apache webroot (leave off trailing slash).';
588   $set['type'] = CONF_TYPE_DIR;
589   $freepbx_conf->define_conf_setting('AMPWEBROOT',$set);
590
591   // ASTAGIDIR
592   $set['value'] = '/var/lib/asterisk/agi-bin';
593   $set['description'] = 'This is the default directory for Asterisks agi files.';
594   $set['type'] = CONF_TYPE_DIR;
595   $freepbx_conf->define_conf_setting('ASTAGIDIR',$set);
596
597   // ASTETCDIR
598   $set['value'] = '/etc/asterisk';
599   $set['description'] = 'This is the default directory for Asterisks configuration files.';
600   $set['type'] = CONF_TYPE_DIR;
601   $freepbx_conf->define_conf_setting('ASTETCDIR',$set);
602
603   // ASTLOGDIR
604   $set['value'] = '/var/log/asterisk';
605   $set['description'] = 'This is the default directory for Asterisks log files.';
606   $set['type'] = CONF_TYPE_DIR;
607   $freepbx_conf->define_conf_setting('ASTLOGDIR',$set);
608
609   // ASTMODDIR
610   $set['value'] = '/usr/lib/asterisk/modules';
611   $set['description'] = 'This is the default directory for Asterisks modules.';
612   $set['type'] = CONF_TYPE_DIR;
613   $freepbx_conf->define_conf_setting('ASTMODDIR',$set);
614
615   // ASTSPOOLDIR
616   $set['value'] = '/var/spool/asterisk';
617   $set['description'] = 'This is the default directory for Asterisks spool directory.';
618   $set['type'] = CONF_TYPE_DIR;
619   $freepbx_conf->define_conf_setting('ASTSPOOLDIR',$set);
620
621   // ASTRUNDIR
622   $set['value'] = '/var/run/asterisk';
623   $set['description'] = 'This is the default directory for Asterisks run files.';
624   $set['type'] = CONF_TYPE_DIR;
625   $freepbx_conf->define_conf_setting('ASTRUNDIR',$set);
626
627   // ASTVARLIBDIR
628   $set['value'] = '/var/lib/asterisk';
629   $set['description'] = 'This is the default directory for Asterisks lib files.';
630   $set['type'] = CONF_TYPE_DIR;
631   $freepbx_conf->define_conf_setting('ASTVARLIBDIR',$set);
632
633   // AMPCGIBIN
634   $set['value'] = '/var/www/cgi-bin ';
635   $set['description'] = 'The path to Apache cgi-bin dir (leave off trailing slash).';
636   $set['type'] = CONF_TYPE_DIR;
637   $freepbx_conf->define_conf_setting('AMPCGIBIN',$set);
638
639   // MOHDIR
640   $set['value'] = 'moh';
641   $set['description'] = '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.';
642   $set['type'] = CONF_TYPE_DIR;
643   $freepbx_conf->define_conf_setting('MOHDIR',$set);
644
645
646   //
647   // CATEGORY: GUI Behavior
648   //
649   $set['category'] = 'GUI Behavior';
650
651   // CHECKREFERER
652   $set['value'] = true;
653   $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.';
654   $set['type'] = CONF_TYPE_BOOL;
655   $freepbx_conf->define_conf_setting('CHECKREFERER',$set);
656
657   // MODULEADMINWGET
658   $set['value'] = false;
659   $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.';
660   $set['type'] = CONF_TYPE_BOOL;
661   $freepbx_conf->define_conf_setting('MODULEADMINWGET',$set);
662
663   // USECATEGORIES
664   $set['value'] = true;
665   $set['description'] = 'Controls if the menu items in the admin interface are sorted by category (true) or sorted alphebetically with no categories shown (false). Defaults = true';
666   $set['type'] = CONF_TYPE_BOOL;
667   $freepbx_conf->define_conf_setting('USECATEGORIES',$set);
668
669   // SERVERINTITLE
670   $set['value'] = false;
671   $set['description'] = 'Precede browser title with the server name.';
672   $set['type'] = CONF_TYPE_BOOL;
673   $freepbx_conf->define_conf_setting('SERVERINTITLE',$set);
674
675   // RELOADCONFIRM
676   $set['value'] = true;
677   $set['description'] = 'When set to false, will bypass the confirm on Reload Box.';
678   $set['type'] = CONF_TYPE_BOOL;
679   $freepbx_conf->define_conf_setting('RELOADCONFIRM',$set);
680
681   // BADDESTABORT
682   $set['value'] = false;
683   $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.';
684   $set['level'] = 3;
685   $set['type'] = CONF_TYPE_BOOL;
686   $freepbx_conf->define_conf_setting('BADDESTABORT',$set);
687   $set['level'] = 0;
688
689   // XTNCONFLICTABORT
690   $set['value'] = false;
691   $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.';
692   $set['level'] = 3;
693   $set['type'] = CONF_TYPE_BOOL;
694   $freepbx_conf->define_conf_setting('XTNCONFLICTABORT',$set);
695   $set['level'] = 0;
696
697   // CUSTOMASERROR
698   $set['value'] = true;
699   $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.';
700   $set['level'] = 2;
701   $set['type'] = CONF_TYPE_BOOL;
702   $freepbx_conf->define_conf_setting('CUSTOMASERROR',$set);
703   $set['level'] = 0;
704
705
706   //
707   // CATEGORY: Asterisk Manager
708   //
709   $set['category'] = 'Asterisk Manager';
710
711   // AMPMGRPASS
712   $set['value'] = 'amp111';
713   $set['description'] = 'Password for accessing the Asterisk Manager Interface (AMI), you must change this in manager.conf if changed here.';
714   $set['type'] = CONF_TYPE_TEXT;
715   $freepbx_conf->define_conf_setting('AMPMGRPASS',$set);
716
717   // AMPMGRUSER
718   $set['value'] = 'admin';
719   $set['description'] = 'Username for accessing the Asterisk Manager Interface (AMI), you must change this in manager.conf if changed here.';
720   $set['type'] = CONF_TYPE_TEXT;
721   $freepbx_conf->define_conf_setting('AMPMGRUSER',$set);
722
723   // ASTMANAGERHOST
724   $set['value'] = 'localhost';
725   $set['description'] = 'Hostname for the Asterisk Manager';
726   $set['type'] = CONF_TYPE_TEXT;
727   $freepbx_conf->define_conf_setting('ASTMANAGERHOST',$set);
728
729   $set['type'] = CONF_TYPE_UINT;
730
731   // ASTMANAGERPORT
732   $set['value'] = '5038';
733   $set['description'] = 'Port for the Asterisk Manager';
734   $set['type'] = CONF_TYPE_UINT;
735   $freepbx_conf->define_conf_setting('ASTMANAGERPORT',$set);
736
737   // ASTMANAGERPROXYPORT
738   $set['value'] = '';
739   $set['description'] = 'Optional port for an Asterisk Manager Proxy';
740   $set['type'] = CONF_TYPE_UINT;
741   $set['emptyok'] = 1;
742   $freepbx_conf->define_conf_setting('ASTMANAGERPROXYPORT',$set);
743   $set['emptyok'] = 0;
744
745
746   //
747   // CATEGORY: Developer and Customization
748   //
749   $set['category'] = 'Developer and Customization';
750   $set['level'] = 2;
751
752   // FPBXDBUGFILE
753   $set['value'] = '/tmp/freepbx_debug.log';
754   $set['description'] = 'Full path and name of FreePBX debug file. Used by the dbug() funciton by developers.';
755   $set['type'] = CONF_TYPE_TEXT;
756   $freepbx_conf->define_conf_setting('FPBXDBUGFILE',$set);
757
758   // DEVEL
759   $set['value'] = false;
760   $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.';
761   $set['type'] = CONF_TYPE_BOOL;
762   $freepbx_conf->define_conf_setting('DEVEL',$set);
763
764   // DEVELRELOAD
765   $set['value'] = false;
766   $set['description'] = 'Forces the "Apply Configuration Changes" reload bar to always be present even when not necessary.';
767   $set['type'] = CONF_TYPE_BOOL;
768   $freepbx_conf->define_conf_setting('DEVELRELOAD',$set);
769
770   // PRE_RELOAD
771   $set['value'] = '';
772   $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.';
773   $set['emptyok'] = 1;
774   $set['type'] = CONF_TYPE_TEXT;
775   $freepbx_conf->define_conf_setting('PRE_RELOAD',$set);
776   $set['emptyok'] = 0;
777
778   // POST_RELOAD
779   $set['value'] = '';
780   $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.';
781   $set['emptyok'] = 1;
782   $set['type'] = CONF_TYPE_TEXT;
783   $freepbx_conf->define_conf_setting('POST_RELOAD',$set);
784   $set['emptyok'] = 0;
785
786   // POST_RELOAD_DEBUG
787   $set['value'] = false;
788   $set['description'] = 'Display debug output for script used if POST_RELOAD is used.';
789   $set['type'] = CONF_TYPE_BOOL;
790   $freepbx_conf->define_conf_setting('POST_RELOAD_DEBUG',$set);
791
792   // AMPLOCALBIN
793   $set['value'] = '';
794   $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 addtional customization.';
795   $set['type'] = CONF_TYPE_DIR;
796   $freepbx_conf->define_conf_setting('AMPLOCALBIN',$set);
797
798   // AMPDISABLELOG
799   $set['value'] = true;
800   $set['description'] = 'Whether or not to invoke the FreePBX log facility.';
801   $set['type'] = CONF_TYPE_BOOL;
802   $freepbx_conf->define_conf_setting('AMPDISABLELOG',$set);
803
804   // AMPENABLEDEVELDEBUG
805   $set['value'] = false;
806   $set['description'] = 'Whether or not to include log messages marked as <b>devel-debug</b> in the log system.';
807   $set['type'] = CONF_TYPE_BOOL;
808   $freepbx_conf->define_conf_setting('AMPENABLEDEVELDEBUG',$set);
809
810   // AMPSYSLOGLEVEL
811   $set['value'] = 'LOG_ERR';
812   $set['options'] = 'LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG, LOG_SQL,SQL';
813   $set['description'] = 'Where to log if enabled, SQL, LOG_SQL logs to old MySQL table, others are passed to syslog system to determine where to log.';
814   $set['type'] = CONF_TYPE_SELECT;
815   $freepbx_conf->define_conf_setting('AMPSYSLOGLEVEL',$set);
816  
817   // DISABLE_CSS_AUTOGEN
818   $set['value'] = false;
819   $set['description'] = 'Stops the automatic generation of a stripped CSS file that replaces the primary sheet, usually mainstyle.css.';
820   $set['type'] = CONF_TYPE_BOOL;
821   $freepbx_conf->define_conf_setting('DISABLE_CSS_AUTOGEN',$set);
822
823
824   //
825   // CATEGORY: Flash Operator Panel
826   //
827   $set['category'] = 'Flash Operator Panel';
828   $set['level'] = 0;
829
830   // FOPSORT
831   $set['value'] = 'extension';
832   $set['options'] = 'extension,lastname';
833   $set['description'] = 'How FOP sort extensions. By Last Name [lastname] or by Extension [extension].';
834   $set['type'] = CONF_TYPE_SELECT;
835   $freepbx_conf->define_conf_setting('FOPSORT',$set);
836
837   // FOPWEBROOT
838   $set['value'] = '/var/www/html/panel';
839   $set['description'] = 'Path to the Flash Operator Panel webroot (leave off trailing slash).';
840   $set['type'] = CONF_TYPE_DIR;
841   $freepbx_conf->define_conf_setting('FOPWEBROOT',$set);
842
843   // FOPPASSWORD
844   $set['value'] = 'passw0rd';
845   $set['description'] = 'Password for performing transfers and hangups in the Flash Operator Panel (FOP).';
846   $set['type'] = CONF_TYPE_TEXT;
847   $freepbx_conf->define_conf_setting('FOPPASSWORD',$set);
848
849   // FOPDISABLE
850   $set['value'] = false;
851   $set['description'] = 'Set to true to disable FOP in interface and retrieve_conf.  Useful for sqlite3 or if you do not want FOP.';
852   $set['type'] = CONF_TYPE_BOOL;
853   $freepbx_conf->define_conf_setting('FOPDISABLE',$set);
854
855   // FOPRUN
856   $set['value'] = true;
857   $set['description'] = 'Set to true if you want FOP started by freepbx_engine (amportal_start), false otherwise.';
858   $set['type'] = CONF_TYPE_BOOL;
859   $freepbx_conf->define_conf_setting('FOPRUN',$set);
860
861
862   //
863   // CATEGORY: Remote CDR Database
864   //
865   $set['category'] = 'Remote CDR Database';
866   $set['level'] = 3;
867   $set['emptyok'] = 1;
868
869   // CDRDBHOST
870   $set['value'] = '';
871   $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.';
872   $set['type'] = CONF_TYPE_TEXT;
873   $freepbx_conf->define_conf_setting('CDRDBHOST',$set);
874
875   // CDRDBNAME
876   $set['value'] = '';
877   $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.';
878   $set['type'] = CONF_TYPE_TEXT;
879   $freepbx_conf->define_conf_setting('CDRDBNAME',$set);
880
881   // CDRDBPASS
882   $set['value'] = '';
883   $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.';
884   $set['type'] = CONF_TYPE_TEXT;
885   $freepbx_conf->define_conf_setting('CDRDBPASS',$set);
886
887   // CDRDBPORT
888   $set['value'] = '';
889   $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.';
890   $set['type'] = CONF_TYPE_TEXT;
891   $freepbx_conf->define_conf_setting('CDRDBPORT',$set);
892
893   // CDRDBTABLENAME
894   $set['value'] = '';
895   $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.';
896   $set['type'] = CONF_TYPE_TEXT;
897   $freepbx_conf->define_conf_setting('CDRDBTABLENAME',$set);
898
899   // CDRDBTYPE
900   $set['value'] = '';
901   $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.';
902   $set['options'] = ',mysql,postgres';
903   $set['type'] = CONF_TYPE_SELECT;
904   $freepbx_conf->define_conf_setting('CDRDBTYPE',$set);
905
906   // CDRDBUSER
907   $set['value'] = '';
908   $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.';
909   $set['type'] = CONF_TYPE_TEXT;
910   $freepbx_conf->define_conf_setting('CDRDBUSER',$set);
911
912
913   //
914   // CATEGORY: Remote CDR Database
915   //
916   $set['category'] = 'Styling and Logos';
917   $set['level'] = 1;
918   $set['emptyok'] = 0;
919
920   // AMPADMINLOGO
921   $set['value'] = '';
922   $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.';
923   $set['type'] = CONF_TYPE_TEXT;
924   $set['emptyok'] = 1;
925   $freepbx_conf->define_conf_setting('AMPADMINLOGO',$set);
926
927   // BRAND_IMAGE_HIDE_NAV_BACKGROUND
928   $set['value'] = false;
929   $set['description'] = 'Hide the configured left navigation bar background.';
930   $set['type'] = CONF_TYPE_BOOL;
931   $set['emptyok'] = 0;
932   $freepbx_conf->define_conf_setting('BRAND_IMAGE_HIDE_NAV_BACKGROUND',$set);
933
934   // BRAND_IMAGE_SHADOW_SIDE_BACKGROUND
935   $set['value'] = 'images/shadow-side-background.png';
936   $set['description'] = 'Styling image.';
937   $set['emptyok'] = 1;
938   $set['type'] = CONF_TYPE_TEXT;
939   $freepbx_conf->define_conf_setting('BRAND_IMAGE_HIDE_NAV_BACKGROUND',$set);
940
941   // BRAND_IMAGE_FREEPBX_RIGHT
942   $set['value'] = 'images/logo.png';
943   $set['description'] = 'Right upper logo. Use this setting instead of AMPADMINLOGO. Path is relative to admin.';
944   $set['type'] = CONF_TYPE_TEXT;
945   $set['emptyok'] = 0;
946   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_RIGHT',$set);
947
948   // BRAND_IMAGE_FREEPBX_LEFT
949   $set['value'] = 'images/freepbx_large.png';
950   $set['description'] = 'Left upper logo.  Path is relative to admin.';
951   $set['type'] = CONF_TYPE_TEXT;
952   $set['emptyok'] = 0;
953   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_LEFT',$set);
954
955   // BRAND_IMAGE_FREEPBX_FOOT
956   $set['value'] = 'images/freepbx_small.png';
957   $set['description'] = 'Logo in footer.  Path is relative to admin.';
958   $set['type'] = CONF_TYPE_TEXT;
959   $set['emptyok'] = 1;
960   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_FOOT',$set);
961
962   // BRAND_IMAGE_RELOAD_LOADING
963   $set['value'] = 'images/loading.gif';
964   $set['description'] = 'Image used during a reload, default is animated GIF eating the * (asterisk).  Path is relative to admin.';
965   $set['type'] = CONF_TYPE_TEXT;
966   $set['emptyok'] = 1;
967   $freepbx_conf->define_conf_setting('BRAND_IMAGE_RELOAD_LOADING',$set);
968
969   // BRAND_FREEPBX_ALT_LEFT
970   $set['value'] = '';
971   $set['description'] = 'alt attribute to use in place of image and title hover value. Defaults to FreePBX';
972   $set['type'] = CONF_TYPE_TEXT;
973   $set['emptyok'] = 1;
974   $freepbx_conf->define_conf_setting('BRAND_FREEPBX_ALT_LEFT',$set);
975
976   // BRAND_FREEPBX_ALT_RIGHT
977   $set['value'] = '';
978   $set['description'] = 'alt attribute to use in place of image and title hover value. Defaults to FreePBX';
979   $set['type'] = CONF_TYPE_TEXT;
980   $set['emptyok'] = 1;
981   $freepbx_conf->define_conf_setting('BRAND_FREEPBX_ALT_RIGHT',$set);
982
983   // BRAND_FREEPBX_ALT_FOOT
984   $set['value'] = '';
985   $set['description'] = 'alt attribute to use in place of image and title hover value. Defaults to FreePBX';
986   $set['type'] = CONF_TYPE_TEXT;
987   $set['emptyok'] = 1;
988   $freepbx_conf->define_conf_setting('BRAND_FREEPBX_ALT_FOOT',$set);
989
990   // BRAND_IMAGE_FREEPBX_LINK_LEFT
991   $set['value'] = '';
992   $set['description'] = 'link to follow when clicking on logo, defaults to http://www.freepbx.org';
993   $set['type'] = CONF_TYPE_TEXT;
994   $set['emptyok'] = 1;
995   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_LINK_LEFT',$set);
996
997   // BRAND_IMAGE_FREEPBX_LINK_RIGHT
998   $set['value'] = '';
999   $set['description'] = 'link to follow when clicking on logo, defaults to http://www.freepbx.org';
1000   $set['type'] = CONF_TYPE_TEXT;
1001   $set['emptyok'] = 1;
1002   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_LINK_RIGHT',$set);
1003
1004   // BRAND_IMAGE_FREEPBX_LINK_FOOT
1005   $set['value'] = '';
1006   $set['description'] = 'link to follow when clicking on logo, defaults to http://www.freepbx.org';
1007   $set['type'] = CONF_TYPE_TEXT;
1008   $set['emptyok'] = 1;
1009   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_LINK_FOOT',$set);
1010
1011   // BRAND_HIDE_LOGO_RIGHT
1012   $set['value'] = false;
1013   $set['description'] = 'Setting to true will hide the upper right logo.';
1014   $set['type'] = CONF_TYPE_BOOL;
1015   $set['emptyok'] = 0;
1016   $freepbx_conf->define_conf_setting('BRAND_HIDE_LOGO_RIGHT',$set);
1017
1018   // BRAND_HIDE_HEADER_VERSION
1019   $set['value'] = false;
1020   $set['description'] = 'Setting to true will hide the FreePBX version information below the left upper header.';
1021   $set['type'] = CONF_TYPE_BOOL;
1022   $set['emptyok'] = 0;
1023   $freepbx_conf->define_conf_setting('BRAND_HIDE_HEADER_VERSION',$set);
1024
1025   // BRAND_HIDE_HEADER_MENUS
1026   $set['value'] = false;
1027   $set['description'] = 'Setting to true will hide the complete horizontal menu bar in the header.';
1028   $set['type'] = CONF_TYPE_BOOL;
1029   $set['emptyok'] = 0;
1030   $freepbx_conf->define_conf_setting('BRAND_HIDE_HEADER_MENUS',$set);
1031
1032   // BRAND_CSS_ALT_MAINSTYLE
1033   $set['value'] = '';
1034   $set['description'] = 'Set this to replace the default mainstyle.css style sheet with your own, relative to admin.';
1035   $set['type'] = CONF_TYPE_TEXT;
1036   $set['emptyok'] = 1;
1037   $freepbx_conf->define_conf_setting('BRAND_CSS_ALT_MAINSTYLE',$set);
1038
1039   // BRAND_CSS_CUSTOM
1040   $set['value'] = '';
1041   $set['description'] = 'Optional custom CSS style sheet included after the primary one and any module specific ones are loaded, relative to admin.';
1042   $set['type'] = CONF_TYPE_TEXT;
1043   $set['emptyok'] = 1;
1044   $freepbx_conf->define_conf_setting('BRAND_CSS_CUSTOM',$set);
1045
1046
1047   // The following settings are used in various modules prior to 2.9. If they are found in amportal.conf then we
1048   // retain their values until the individual modules are updated and their install scripts run where a full
1049   // configuration (descriptions, defaults, etc.) will be provided and maintained. This provides just enough to
1050   // carry the setting through the migration since most upgrades will run framework or install_amp followed by the
1051   // module install scripts.
1052   //
1053   $module_migrate['AMPPLAYKEY'] = CONF_TYPE_TEXT;
1054   $module_migrate['AMPBACKUPEMAILFROM'] = CONF_TYPE_TEXT;
1055   $module_migrate['AMPBACKUPSUDO'] = CONF_TYPE_BOOL;
1056   $module_migrate['USEQUEUESTATE'] = CONF_TYPE_BOOL;
1057   $module_migrate['DASHBOARD_INFO_UPDATE_TIME'] = CONF_TYPE_UINT;
1058   $module_migrate['DASHBOARD_STATS_UPDATE_TIME'] = CONF_TYPE_UINT;
1059   $module_migrate['SSHPORT'] = CONF_TYPE_UINT;
1060   $module_migrate['MAXCALLS'] = CONF_TYPE_UINT;
1061   $module_migrate['AMPMPG123'] = CONF_TYPE_BOOL;
1062   $module_migrate['PARKINGPATCH'] = CONF_TYPE_BOOL;
1063
1064   $mod_set['value'] = '';
1065   $mod_set['defaultval'] = '';
1066   $mod_set['readonly'] = 0;
1067   $mod_set['hidden'] = 1;
1068   $mod_set['level'] = 10;
1069   $mod_set['module'] = '';
1070   $mod_set['category'] = 'Under Migration';
1071   $mod_set['emptyok'] = 1;
1072   $mod_set['description'] = 'This setting is being migrated and will be initialized by its module install script on upgrad.';
1073   foreach ($module_migrate as $setting => $type) {
1074     if (isset($amp_conf[$setting])  && !$freepbx_conf->conf_setting_exists($setting)) {
1075       $val = $amp_conf[$setting];
1076
1077       // since this came from a conf file, change any 'false' that will otherwise turn to true
1078       //
1079       if ($type == CONF_TYPE_BOOL) switch (strtolower($val)) {
1080       case 'false':
1081       case 'no':
1082       case 'off':
1083         $val = false;
1084       break;
1085       }
1086       $mod_set['value'] = $val;
1087       $mod_set['type'] = $type;
1088       $freepbx_conf->define_conf_setting($setting,$mod_set);
1089     }
1090   }
1091
1092   if ($commit_to_db) {
1093     $freepbx_conf->commit_conf_settings();
1094   }
1095 }
Note: See TracBrowser for help on using the browser.