Changeset 10865 for freepbx/trunk
- Timestamp:
- 01/09/11 12:01:44 (2 years ago)
- Files:
-
- freepbx/trunk (modified) (1 prop)
- freepbx/trunk/amp_conf/agi-bin/phpagi.php (modified) (1 diff)
- freepbx/trunk/amp_conf/bin/archive_recordings (modified) (4 diffs)
- freepbx/trunk/amp_conf/bin/freepbx-cron-scheduler.php (modified) (1 diff)
- freepbx/trunk/amp_conf/bin/freepbx_engine (modified) (10 diffs)
- freepbx/trunk/amp_conf/bin/gen_amp_conf.php (copied) (copied from freepbx/branches/bootstrap/amp_conf/bin/gen_amp_conf.php)
- freepbx/trunk/amp_conf/bin/generate_hints.php (modified) (1 diff)
- freepbx/trunk/amp_conf/bin/module_admin (modified) (5 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/bootstrap.php (copied) (copied from freepbx/branches/bootstrap/amp_conf/htdocs/admin/bootstrap.php) (2 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/call-comp.php (modified) (3 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/call-daily-load.php (modified) (3 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/call-last-month.php (modified) (3 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/call-log.php (modified) (4 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/cdr.php (modified) (6 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/common/graph_hourdetail.php (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/common/graph_pie.php (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/common/graph_stat.php (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/common/graph_statbar.php (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/export_csv.php (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/export_pdf.php (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/index.html (copied) (copied from freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/index.html)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/lib/Class.Table.php (modified) (13 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/lib/defines.php (modified) (4 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/lib/fpdf.php (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/admin/cdr/lib/iam_csvdump.php (modified) (2 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/common/db_connect.php (modified) (5 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/common/php-asmanager.php (deleted)
- freepbx/trunk/amp_conf/htdocs/admin/config.php (modified) (8 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php (modified) (3 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/header.php (deleted)
- freepbx/trunk/amp_conf/htdocs/admin/header_auth.php (deleted)
- freepbx/trunk/amp_conf/htdocs/admin/libraries/config.functions.php (modified) (2 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/libraries/framework_view.functions.php (modified) (8 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/libraries/module.functions.php (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/admin/libraries/php-asmanager.php (copied) (copied from freepbx/branches/bootstrap/amp_conf/htdocs/admin/libraries/php-asmanager.php) (1 diff)
- freepbx/trunk/amp_conf/htdocs/admin/libraries/xml2Array.class.php (modified) (2 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/panel.php (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/admin/reports.php (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/admin/views/freepbx_admin.php (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/recordings/includes/bootstrap.php (modified) (4 diffs)
- freepbx/trunk/amp_conf/htdocs/recordings/includes/common.php (modified) (6 diffs)
- freepbx/trunk/amp_conf/htdocs/recordings/includes/main.conf.php (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/recordings/index.php (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/recordings/theme/page.tpl.php (modified) (4 diffs)
- freepbx/trunk/amp_conf/sbin/amportal (modified) (2 diffs)
- freepbx/trunk/upgrades/2.9.0alpha1/migrate_ampconf.php (modified) (8 diffs)
- freepbx/trunk/upgrades/2.9.0alpha1/removefiles.php (copied) (copied from freepbx/branches/bootstrap/upgrades/2.9.0alpha1/removefiles.php) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk
- Property svnmerge-integrated changed from /freepbx/branches/bootstrap:1-10361,10536-10545,10548-10555,10557,10561,10563-10617,10619-10621,10623-10635,10637-10638,10640-10642,10644-10645,10647-10650,10655-10670,10672-10677,10679-10703,10705-10715,10718-10725,10728,10780 /freepbx/branches/2.8:1-10634 to /freepbx/branches/bootstrap:1-10446,10448-10638,10640-10847 /freepbx/branches/2.8:1-10634
freepbx/trunk/amp_conf/agi-bin/phpagi.php
r8648 r10865 180 180 global $phpagi_error_handler_email; 181 181 $phpagi_error_handler_email = $this->config['phpagi']['admin']; 182 error_reporting(E_ALL);182 // error_reporting(E_ALL); 183 183 } 184 184 freepbx/trunk/amp_conf/bin/archive_recordings
r10635 r10865 1 1 #!/usr/bin/php -q 2 2 <?php 3 4 define("AMP_CONF", "/etc/amportal.conf"); 3 //include bootstrap 4 $bootstrap_settings['freepbx_auth'] = false; 5 if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { 6 include_once('/etc/asterisk/freepbx.conf'); 7 } 8 5 9 define("MONITOR_DIR", "/var/spool/asterisk/monitor"); 6 10 … … 36 40 out(" --mp3 Recursively convert all .WAV to .mp3"); 37 41 out(" --delwav Use with --mp3 to delete orignal files after converting to .mp3"); 38 }39 40 function parse_amportal_conf($filename) {41 // defaults, if not specified in the file42 $defaults = array(43 'AMPDBENGINE' => 'mysql',44 'AMPDBNAME' => 'asterisk',45 'AMPENGINE' => 'asterisk',46 'USECATEGORIES' => true,47 'ASTETCDIR' => '/etc/asterisk',48 'CDRDBNAME' => 'asteriskcdrdb',49 );50 // boolean values, will be converted to true/false51 // "yes", "true", 1 (case-insensitive) will be treated as true, everything else is false52 $booleans = array('USECATEGORIES');53 54 $file = file($filename);55 if (is_array($file)) {56 foreach ($file as $line) {57 if (preg_match("/^\s*([a-zA-Z0-9_]+)=([a-zA-Z0-9 .&-@=_!<>\"\']+)\s*$/",$line,$matches)) {58 $conf[ $matches[1] ] = $matches[2];59 }60 }61 } else {62 fatal("<h1>Missing or unreadable config file ($filename)...cannot continue</h1>");63 }64 65 // set defaults66 foreach ($defaults as $key=>$val) {67 if (!isset($conf[$key]) || $conf[$key] == '') {68 $conf[$key] = $val;69 }70 }71 72 // evaluate boolean values73 foreach ($booleans as $key) {74 $conf[$key] = isset($conf[$key]) && ($conf[$key] === true || strtolower($conf[$key]) == 'true' || $conf[$key] === 1 || $conf[$key] == '1' || strtolower($conf[$key]) == 'yes');75 }76 77 return $conf;78 42 } 79 43 … … 296 260 /********************************************************************************************************************/ 297 261 298 // **** Make sure we have STDIN etc299 300 // from ben-php dot net at efros dot com at php.net/install.unix.commandline301 if (version_compare(phpversion(),'4.3.0','<') || !defined("STDIN")) {302 define('STDIN',fopen("php://stdin","r"));303 define('STDOUT',fopen("php://stdout","r"));304 define('STDERR',fopen("php://stderr","r"));305 register_shutdown_function( create_function( '' , 'fclose(STDIN); fclose(STDOUT); fclose(STDERR); return true;' ) );306 }307 308 309 // **** Make sure we have PEAR's DB.php, and include it310 311 outn("Checking for PEAR DB..");312 if (! @ include('DB.php')) {313 out("FAILED");314 fatal("PEAR must be installed (requires DB.php). Include path: ".ini_get("include_path"));315 }316 out("OK");317 318 319 262 // **** Make sure we have PEAR's GetOpts.php, and include it 320 263 … … 380 323 381 324 382 // **** read amportal.conf383 384 outn("Reading ".AMP_CONF."..");385 $amp_conf = parse_amportal_conf(AMP_CONF);386 if (count($amp_conf) == 0) {387 fatal("FAILED");388 }389 out("OK");390 391 // **** Connect to database392 outn("Connecting to database..");393 394 395 // note, sqlite3 not supported yet!396 $db_user = $amp_conf["AMPDBUSER"];397 $db_pass = $amp_conf["AMPDBPASS"];398 $db_host = $amp_conf["AMPDBHOST"];399 $db_engine = $amp_conf["AMPDBENGINE"];400 $db_name = $amp_conf["CDRDBNAME"];401 402 $datasource = $db_engine.'://'.$db_user.':'.$db_pass.'@'.$db_host.'/'.$db_name;403 404 $db = DB::connect($datasource); // attempt connection405 406 if(DB::isError($db)) {407 out("FAILED");408 debug($db->userinfo);409 fatal("Cannot connect to database");410 411 }412 out("OK");413 414 325 check_table(); 415 326 process_files(); freepbx/trunk/amp_conf/bin/freepbx-cron-scheduler.php
r5838 r10865 1 1 #!/usr/bin/php -q 2 2 <?php 3 4 define("AMP_CONF", "/etc/amportal.conf"); 5 $amportalconf = AMP_CONF; 6 7 // Emulate gettext extension functions if gettext is not available 8 if (!function_exists('_')) { 9 function _($str) { 10 return $str; 11 } 3 //include bootstrap 4 $bootstrap_settings['freepbx_auth'] = false; 5 if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { 6 include_once('/etc/asterisk/freepbx.conf'); 12 7 } 13 14 function out($text) {15 //echo $text."\n";16 }17 18 function outn($text) {19 //echo $text;20 }21 22 function error($text) {23 echo "[ERROR] ".$text."\n";24 }25 26 function fatal($text, $extended_text="", $type="FATAL") {27 global $db;28 29 echo "[$type] ".$text." ".$extended_text."\n";30 31 if(!DB::isError($db)) {32 $nt = notifications::create($db);33 $nt->add_critical('cron_manager', $type, $text, $extended_text);34 }35 36 exit(1);37 }38 39 function debug($text) {40 global $debug;41 42 if ($debug) echo "[DEBUG-preDB] ".$text."\n";43 }44 45 // bootstrap retrieve_conf by getting the AMPWEBROOT since that is currently where the necessary46 // functions.inc.php resides, and then use that parser to properly parse the file and get all47 // the defaults as needed.48 //49 function parse_amportal_conf_bootstrap($filename) {50 $file = file($filename);51 foreach ($file as $line) {52 if (preg_match("/^\s*([\w]+)\s*=\s*\"?([\w\/\:\.\*\%-]*)\"?\s*([;#].*)?/",$line,$matches)) {53 $conf[ $matches[1] ] = $matches[2];54 }55 }56 if ( !isset($conf["AMPWEBROOT"]) || ($conf["AMPWEBROOT"] == "")) {57 $conf["AMPWEBROOT"] = "/var/www/html";58 } else {59 $conf["AMPWEBROOT"] = rtrim($conf["AMPWEBROOT"],'/');60 }61 62 return $conf;63 }64 65 /********************************************************************************************************************/66 67 // **** Make sure we have STDIN etc68 69 // from ben-php dot net at efros dot com at php.net/install.unix.commandline70 if (version_compare(phpversion(),'4.3.0','<') || !defined("STDIN")) {71 define('STDIN',fopen("php://stdin","r"));72 define('STDOUT',fopen("php://stdout","r"));73 define('STDERR',fopen("php://stderr","r"));74 register_shutdown_function( create_function( '' , 'fclose(STDIN); fclose(STDOUT); fclose(STDERR); return true;' ) );75 }76 77 // **** Make sure we have PEAR's DB.php, and include it78 79 outn(_("Checking for PEAR DB.."));80 if (! @ include('DB.php')) {81 out(_("FAILED"));82 fatal(_("PEAR Missing"),sprintf(_("PEAR must be installed (requires DB.php). Include path: %s "), ini_get("include_path")));83 }84 out(_("OK"));85 86 87 // **** Check for amportal.conf88 89 outn(sprintf(_("Checking for %s "), $amportalconf)._(".."));90 if (!file_exists($amportalconf)) {91 fatal(_("amportal.conf access problem: "),sprintf(_("The %s file does not exist, or is inaccessible"), $amportalconf));92 }93 out(_("OK"));94 95 // **** read amportal.conf96 97 outn(sprintf(_("Bootstrapping %s .."), $amportalconf));98 $amp_conf = parse_amportal_conf_bootstrap($amportalconf);99 if (count($amp_conf) == 0) {100 fatal(_("amportal.conf parsing failure"),sprintf(_("no entries found in %s"), $amportalconf));101 }102 out(_("OK"));103 104 outn(sprintf(_("Parsing %s .."), $amportalconf));105 require_once($amp_conf['AMPWEBROOT']."/admin/functions.inc.php");106 $amp_conf = parse_amportal_conf($amportalconf);107 if (count($amp_conf) == 0) {108 fatal(_("amportal.conf parsing failure"),sprintf(_("no entries found in %s"), $amportalconf));109 }110 out(_("OK"));111 112 $asterisk_conf_file = $amp_conf["ASTETCDIR"]."/asterisk.conf";113 outn(sprintf(_("Parsing %s .."), $asterisk_conf_file));114 $asterisk_conf = parse_asterisk_conf($asterisk_conf_file);115 if (count($asterisk_conf) == 0) {116 fatal(_("asterisk.conf parsing failure"),sprintf(_("no entries found in %s"), $asterisk_conf_file));117 }118 out(_("OK"));119 120 // **** Connect to database121 122 outn(_("Connecting to database.."));123 124 # the engine to be used for the SQL queries,125 # if none supplied, backfall to mysql126 $db_engine = "mysql";127 if (isset($amp_conf["AMPDBENGINE"])){128 $db_engine = $amp_conf["AMPDBENGINE"];129 }130 131 8 // Define the notification class for logging to the dashboard 132 9 // 133 10 $nt = notifications::create($db); 134 135 switch ($db_engine)136 {137 case "pgsql":138 case "mysql":139 /* datasource in in this style:140 dbengine://username:password@host/database */141 142 $db_user = $amp_conf["AMPDBUSER"];143 $db_pass = $amp_conf["AMPDBPASS"];144 $db_host = $amp_conf["AMPDBHOST"];145 $db_name = $amp_conf["AMPDBNAME"];146 147 $datasource = $db_engine.'://'.$db_user.':'.$db_pass.'@'.$db_host.'/'.$db_name;148 $db = DB::connect($datasource); // attempt connection149 break;150 151 case "sqlite":152 require_once('DB/sqlite.php');153 154 if (!isset($amp_conf["AMPDBFILE"]))155 fatal(_("AMPDBFILE not setup properly"),sprintf(_("You must setup properly AMPDBFILE in %s "), $amportalconf));156 157 if (isset($amp_conf["AMPDBFILE"]) == "")158 fatal(_("AMPDBFILE not setup properly"),sprintf(_("AMPDBFILE in %s cannot be blank"), $amportalconf));159 160 $DSN = array (161 "database" => $amp_conf["AMPDBFILE"],162 "mode" => 0666163 );164 165 $db = new DB_sqlite();166 $db->connect( $DSN );167 break;168 169 case "sqlite3":170 if (!isset($amp_conf["AMPDBFILE"]))171 fatal("You must setup properly AMPDBFILE in $amportalconf");172 173 if (isset($amp_conf["AMPDBFILE"]) == "")174 fatal("AMPDBFILE in $amportalconf cannot be blank");175 176 require_once('DB/sqlite3.php');177 $datasource = "sqlite3:///" . $amp_conf["AMPDBFILE"] . "?mode=0666";178 $db = DB::connect($datasource);179 break;180 181 default:182 fatal( "Unknown SQL engine: [$db_engine]");183 }184 185 if(DB::isError($db)) {186 out(_("FAILED"));187 debug($db->userinfo);188 fatal(_("database connection failure"),("failed trying to connect to the configured database"));189 190 }191 out(_("OK"));192 11 193 12 // Check to see if email should be sent freepbx/trunk/amp_conf/bin/freepbx_engine
r10122 r10865 1 1 #!/usr/bin/env bash 2 2 3 # Formating variables3 # Visual formating variables 4 4 # use like: ${b}text$bx - ${b} starts bold, $bx end it, etc. 5 5 # you must use echo -e for formating to be valid … … 10 10 11 11 ROOT_UID=0 # root uid is 0 12 E_NOTROOT=67 # Non-root exit error 13 12 E_NOTROOT=67 # Non-root exit error 13 # define freepbx config file if not alreaddy set 14 if [ ! -n "$FREEPBX_CONF" ]; then 15 FREEPBX_CONF="/etc/freepbx.conf" 16 fi 14 17 15 18 echo … … 22 25 fi 23 26 24 # make sure config file exists 25 if [ ! -e "/etc/amportal.conf" ] # Check if file exists. 26 then 27 echo; 28 echo "/etc/amportal.conf does not exist!"; 29 echo "Have you installed the AMP configuration?"; 30 exit; 31 fi 32 # Set some defaults which can be re-defined in amportal.conf 27 28 # Set some defaults which can be re-defined from the config file/db 33 29 AMPDEVUSER=asterisk 34 30 AMPDEVGROUP=asterisk … … 41 37 FPBXDBUGFILE=/tmp/freepbx_debug.log 42 38 43 . /etc/amportal.conf 39 write_freepbxconf() { 40 if [ ! -e $FREEPBX_CONF ]; then 41 cat > $FREEPBX_CONF <<-EOF 42 <?php 43 \$amp_conf['AMPDBUSER'] = '$AMPDBUSER'; 44 \$amp_conf['AMPDBPASS'] = '$AMPDBPASS'; 45 \$amp_conf['AMPDBHOST'] = '$AMPDBHOST'; 46 \$amp_conf['AMPDBNAME'] = '$AMPENGINE'; 47 \$amp_conf['AMPDBENGINE'] = '$AMPDBENGINE'; 48 \$amp_conf['datasource'] = ''; //for sqlite3 49 50 require_once('${AMPWEBROOT}/admin/bootstrap.php'); 51 52 EOF 53 fi 54 if [ -e /etc/asterisk/freepbx.conf ]; then 55 rm /etc/asterisk/freepbx.conf 56 fi 57 } 58 59 # get settings from db/config file 60 if [[ -e $FREEPBX_CONF && -w "/etc/amportal.conf" ]]; then 61 # get the path of this file to call the gen_amp_conf.php script which will 62 # generate all the amp_conf variables that can be exported 63 # 64 progdir=`dirname $0` 65 sv_pwd=$PWD 66 cd $progdir 67 gen_path=$PWD 68 cd $sv_pwd 69 `$gen_path/gen_amp_conf.php` 70 elif [ -e "/etc/amportal.conf" ]; then # Check if file exists, if it dose read it and then write out /etc/freepbx.conf 71 . /etc/amportal.conf 72 write_freepbxconf 73 else 74 echo; 75 echo "FreePBX config file not found!"; 76 echo "Have you installed FreePBX?"; 77 exit; 78 fi 44 79 45 80 if [ -z $PIDOF ]; then … … 47 82 fi 48 83 49 if [ $ASTRUNDIR = /var/run ] 84 if [ -e $AMPBIN/amportal ]; then 85 echo "new amportal script detected, moving it to $AMPSBIN and attempting to backup up old" 86 # just in case it isn't there though it should be 87 if [ -e $AMPSBIN/amportal ]; then 88 mv $AMPSBIN/amportal $AMPSBIN/amportal.bak 89 else 90 echo "no exiting $AMPSBIN/amportal to make a backup of" 91 fi 92 mv $AMPBIN/amportal $AMPSBIN/amportal 93 if [ "$?" -ne "0" ]; then 94 echo "unable to update to new amportal, check permissions and try again" 95 fi 96 chown root:root $AMPSBIN/amportal 97 chmod +x $AMPSBIN/amportal 98 fi 99 100 if [ "$ASTRUNDIR" = "/var/run" ] 50 101 then 51 102 echo "**** ERROR IN CONFIGURATION ****" … … 75 126 chown_asterisk() { 76 127 echo SETTING FILE PERMISSIONS 77 128 129 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP /etc/amportal.conf 130 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $FREEPBX_CONF 131 chmod g+w /etc/amportal.conf 132 chmod g+w $FREEPBX_CONF 78 133 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTRUNDIR 79 134 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTETCDIR … … 226 281 } 227 282 283 228 284 case "$1" in 229 285 start) … … 246 302 stop_fop 247 303 sleep 1 304 write_freepbxconf 248 305 chown_asterisk 249 306 run_asterisk … … 315 372 ;; 316 373 dbug) 317 if [ -f $FPBXDBUGFILE ]; then 318 tail -f $FPBXDBUGFILE 319 else 374 if [ ! -f $FPBXDBUGFILE ]; then 320 375 touch tail -f $FPBXDBUGFILE 321 376 chown $AMPASTERISKUSER:$AMPASTERISKGROUP $FPBXDBUGFILE 322 tail -f $FPBXDBUGFILE323 377 fi 378 if [ -f '/var/log/httpd/error_log' ]; then 379 httpd_error='/var/log/httpd/error_log' 380 fi 381 tail -f $FPBXDBUGFILE $httpd_error 324 382 ;; 325 383 *) … … 380 438 ;; 381 439 esac 382 freepbx/trunk/amp_conf/bin/generate_hints.php
r10635 r10865 1 1 #!/usr/bin/php -q 2 2 <?php 3 //include bootstrap 4 $restrict_mods = true; 5 $bootstrap_settings['freepbx_auth'] = false; 6 $bootstrap_settings['skip_db'] = true; 7 if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { 8 include_once('/etc/asterisk/freepbx.conf'); 9 } 10 $debug = -1; 3 11 4 $debug = -1; 12 // If set to nointercom then don't generate any hints 13 // 14 $intercom_code = isset($argv[1]) ? $argv[1] : ''; 15 $dnd_mode = isset($argv[2]) ? $argv[2] : ''; 5 16 6 // If set to nointercom then don't generate any hints 7 // 8 $intercom_code = isset($argv[1]) ? $argv[1] : ''; 9 $dnd_mode = isset($argv[2]) ? $argv[2] : ''; 17 $ast_with_dahdi = ast_with_dahdi(); 10 18 11 $amp_conf = parse_amportal_conf_bootstrap("/etc/amportal.conf"); 19 $var = $astman->database_show('AMPUSER'); 20 foreach ($var as $key => $value) { 21 $myvar = explode('/',trim($key,'/')); 22 $user_hash[$myvar[1]] = true; 23 } 12 24 13 require_once($amp_conf['AMPWEBROOT'].'/admin/functions.inc.php'); 14 require_once($amp_conf['AMPWEBROOT'].'/admin/common/php-asmanager.php'); 25 foreach (array_keys($user_hash) as $user) { 26 if ($user != 'none' && $user != '') { 27 $devices = get_devices($user); 28 debug("Set hints for user: $user for devices: ".$devices,5); 29 set_hint($user, $devices); 30 } 31 } 15 32 16 $amp_conf = parse_amportal_conf("/etc/amportal.conf"); 33 //--------------------------------------------------------------------- 17 34 18 $astman = new AGI_AsteriskManager(null, array('cachemode' => true)); 35 // Set the hint for a user based on the devices in their AMPUSER object 36 // 37 function set_hint($user, $devices) { 38 debug("set_hint: user: $user, devices: $devices",8); 39 global $astman; 40 global $dnd_mode; 41 global $intercom_code; 19 42 20 $astmanagerhost = (isset($amp_conf['ASTMANAGERHOST']) && trim($amp_conf['ASTMANAGERHOST']) != '')?$amp_conf['ASTMANAGERHOST']:'127.0.0.1'; 21 if (isset($amp_conf['ASTMANAGERPORT']) && trim($amp_conf['ASTMANAGERPORT']) != '') { 22 $astmanagerhost .= ':'.$amp_conf['ASTMANAGERPORT']; 23 } 43 $dnd_string = ($dnd_mode == 'dnd')?"&Custom:DND$user":''; 24 44 25 if (! $res = $astman->connect($astmanagerhost, $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"], 'off')) { 26 exit; 27 } 28 $ast_with_dahdi = ast_with_dahdi(); 29 30 $var = $astman->database_show('AMPUSER'); 31 foreach ($var as $key => $value) { 32 $myvar = explode('/',trim($key,'/')); 33 $user_hash[$myvar[1]] = true; 34 } 35 36 foreach (array_keys($user_hash) as $user) { 37 if ($user != 'none' && $user != '') { 38 $devices = get_devices($user); 39 debug("Set hints for user: $user for devices: ".$devices,5); 40 set_hint($user, $devices); 45 if ($devices) { 46 $dial_string = get_dial_string($devices); 47 echo "exten => $user,hint,$dial_string"."$dnd_string\n"; 48 if ($intercom_code != 'nointercom' && $intercom_code != '') { 49 echo "exten => $intercom_code"."$user,hint,$dial_string"."$dnd_string\n"; 50 } 51 } else if ($dnd_mode == 'dnd') { 52 echo "exten => $user,hint,Custom:DND$user\n"; 53 if ($intercom_code != 'nointercom' && $intercom_code != '') { 54 echo "exten => $intercom_code"."$user,hint,Custom:DND$user\n"; 41 55 } 42 56 } 57 } 43 58 44 //--------------------------------------------------------------------- 59 // Get the actual technology dialstrings from the DEVICE objects (used 60 // to create proper hints) 61 // 62 function get_dial_string($devices) { 63 debug("get_dial_string: devices: $devices",8); 64 global $astman; 65 global $ast_with_dahdi; 45 66 46 function parse_amportal_conf_bootstrap($filename) { 47 $file = file($filename); 48 foreach ($file as $line) { 49 if (preg_match("/^\s*([\w]+)\s*=\s*\"?([\w\/\:\.\*\%-]*)\"?\s*([;#].*)?/",$line,$matches)) { 50 $conf[ $matches[1] ] = $matches[2]; 51 } 52 } 53 if ( !isset($conf["AMPWEBROOT"]) || ($conf["AMPWEBROOT"] == "")) { 54 $conf["AMPWEBROOT"] = "/var/www/html"; 55 } else { 56 $conf["AMPWEBROOT"] = rtrim($conf["AMPWEBROOT"],'/'); 57 } 58 return $conf; 67 $device_array = explode( '&', $devices ); 68 $dialstring = ''; 69 foreach ($device_array as $adevice) { 70 $dds = $astman->database_get('DEVICE',$adevice.'/dial'); 71 $dialstring .= $dds.'&'; 59 72 } 73 if ($ast_with_dahdi) { 74 $dialstring = str_replace('ZAP/', 'DAHDI/', $dialstring); 75 } 76 return trim($dialstring," &"); 77 } 60 78 61 // Set the hint for a user based on the devices in their AMPUSER object 62 // 63 function set_hint($user, $devices) { 64 debug("set_hint: user: $user, devices: $devices",8); 65 global $astman; 66 global $dnd_mode; 67 global $intercom_code; 79 // Get the list of current devices for this user 80 // 81 function get_devices($user) { 82 debug("get_devices: user: $user", 8); 83 global $astman; 68 84 69 $dnd_string = ($dnd_mode == 'dnd')?"&Custom:DND$user":''; 85 $devices = $astman->database_get('AMPUSER',$user.'/device'); 86 return trim($devices); 87 } 70 88 71 if ($devices) { 72 $dial_string = get_dial_string($devices); 73 echo "exten => $user,hint,$dial_string"."$dnd_string\n"; 74 if ($intercom_code != 'nointercom' && $intercom_code != '') { 75 echo "exten => $intercom_code"."$user,hint,$dial_string"."$dnd_string\n"; 76 } 77 } else if ($dnd_mode == 'dnd') { 78 echo "exten => $user,hint,Custom:DND$user\n"; 79 if ($intercom_code != 'nointercom' && $intercom_code != '') { 80 echo "exten => $intercom_code"."$user,hint,Custom:DND$user\n"; 81 } 82 } 89 function debug($string, $level=3) { 90 global $debug; 91 if ($debug >= $level) { 92 echo $string."\n"; 83 93 } 84 85 // Get the actual technology dialstrings from the DEVICE objects (used 86 // to create proper hints) 87 // 88 function get_dial_string($devices) { 89 debug("get_dial_string: devices: $devices",8); 90 global $astman; 91 global $ast_with_dahdi; 92 93 $device_array = explode( '&', $devices ); 94 $dialstring = ''; 95 foreach ($device_array as $adevice) { 96 $dds = $astman->database_get('DEVICE',$adevice.'/dial'); 97 $dialstring .= $dds.'&'; 98 } 99 if ($ast_with_dahdi) { 100 $dialstring = str_replace('ZAP/', 'DAHDI/', $dialstring); 101 } 102 return trim($dialstring," &"); 103 } 104 105 // Get the list of current devices for this user 106 // 107 function get_devices($user) { 108 debug("get_devices: user: $user", 8); 109 global $astman; 110 111 $devices = $astman->database_get('AMPUSER',$user.'/device'); 112 return trim($devices); 113 } 114 115 function debug($string, $level=3) { 116 global $debug; 117 if ($debug >= $level) { 118 echo $string."\n"; 119 } 120 } 94 } freepbx/trunk/amp_conf/bin/module_admin
r10416 r10865 16 16 */ 17 17 18 define("AMP_CONF", "/etc/amportal.conf"); 19 18 $bootstrap_settings['freepbx_auth'] = false; 19 // don't include any of the functions.inc.php files from modules, this CLI version of 20 // module_admin is somtimes the only way to recover from a bad module being loaded into 21 // a system. 22 // 23 $restrict_mods = true; 24 if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { 25 include_once('/etc/asterisk/freepbx.conf'); 26 } 20 27 function out($text) { 21 28 echo $text."\n"; … … 41 48 } 42 49 43 44 function install_parse_amportal_conf($filename) {45 $file = file($filename);46 foreach ($file as $line) {47 if (preg_match("/^\s*([a-zA-Z0-9]+)\s*=\s*(.*)\s*([;#].*)?/",$line,$matches)) {48 $conf[ $matches[1] ] = $matches[2];49 }50 }51 return $conf;52 }53 54 function init_amportal_environment($ampconfpath) {55 global $amp_conf, $asterisk_conf, $db, $astman;56 global $amp_conf_defaults;57 58 if (!file_exists($ampconfpath)) {59 fatal('Cannot find conf file: '.$ampconfpath);60 }61 62 // primitive parse function, just to grab AMPWEBROOT63 $inst_amp_conf = install_parse_amportal_conf(AMP_CONF);64 65 define('AMP_BASE_INCLUDE_PATH', $inst_amp_conf['AMPWEBROOT'].'/admin');66 67 if (!file_exists(AMP_BASE_INCLUDE_PATH.'/functions.inc.php')) {68 fatal('Cannot locate '.AMP_BASE_INCLUDE_PATH.'/functions.inc.php');69 }70 // include the functions file from WEBROOT71 include(AMP_BASE_INCLUDE_PATH.'/functions.inc.php');72 // include astman api73 include(AMP_BASE_INCLUDE_PATH.'/common/php-asmanager.php');74 75 // now apply the real parse function (this makes some default assumptions and does a bit more error checking)76 $amp_conf = parse_amportal_conf($ampconfpath);77 78 $asterisk_conf = parse_asterisk_conf($amp_conf['ASTETCDIR']);79 80 // connect to database81 if (!file_exists(AMP_BASE_INCLUDE_PATH.'/common/db_connect.php')) {82 fatal('Cannot locate '.AMP_BASE_INCLUDE_PATH.'/common/db_connect.php');83 }84 require_once(AMP_BASE_INCLUDE_PATH.'/common/db_connect.php'); //PEAR must be installed85 86 $astman= new AGI_AsteriskManager();87 if (! $res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) {88 unset( $astman );89 }90 }91 50 92 51 function doReload() { … … 559 518 } 560 519 } 561 /**************************************************************************************************** 562 ****************************************************************************************************/ 563 564 // from ben-php dot net at efros dot com at php.net/install.unix.commandline 565 if (version_compare(phpversion(),'4.3.0','<') || !defined("STDIN")) { 566 define('STDIN',fopen("php://stdin","r")); 567 define('STDOUT',fopen("php://stdout","r")); 568 define('STDERR',fopen("php://stderr","r")); 569 register_shutdown_function( create_function( '' , 'fclose(STDIN); fclose(STDOUT); fclose(STDERR); return true;' ) ); 570 } 571 572 // **** Make sure we have PEAR's DB.php, and include it 573 if (! @ include('DB.php')) { 574 fatal("PEAR must be installed (requires DB.php). Include path: ".ini_get("include_path")); 575 } 520 //**************************************************************************************************** 521 576 522 577 523 // **** Make sure we have PEAR's GetOpts.php, and include it … … 591 537 } 592 538 593 $ampconfpath = AMP_CONF;594 595 539 // force operations 596 540 $force = false; … … 627 571 } 628 572 629 // create $amp_conf, $db, etc630 init_amportal_environment($ampconfpath);631 632 require_once( $amp_conf["AMPWEBROOT"].'/admin/common/php-asmanager.php' );633 $astman = new AGI_AsteriskManager();634 if (! $res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) {635 unset( $astman );636 }637 573 638 574 $operation = $args[1][0]; freepbx/trunk/amp_conf/htdocs/admin/bootstrap.php
r10367 r10865 1 1 <?php 2 /* Bootstrap Settings: 3 * 4 * bootstrap_settings['skip_db'] - legacy $skip_db, default false 5 * bootstrap_settings['skip_astman'] - legacy $skip_astman, default false 6 * 7 * bootstrap_settings['astman_config'] - default null, config arguemnt when creating new Astman 8 * bootstrap_settings['astman_options'] - default array(), config options creating new Astman 9 * e.g. array('cachemode' => true), see astman documentation 10 * bootstrap_settings['astman_events'] - default 'off' used when connecting, Astman defaults to 'on' 11 * 12 * bootstrap_settings['freepbx_error_handler'] - false don't set it, true use default, named use what is passed 13 * 14 * bootstrap_settings['freepbx_auth'] - true (default) - authorize, false - bypass authentication 15 * 16 * $restrict_mods: false means include all modules functions.inc.php, true skip all modules 17 * array of hashes means each module where there is a hash 18 * e.g. $restrict_mods = array('core' => true, 'dashboard' => true) 19 */ 20 21 if (!isset($bootstrap_settings['skip_db'])) { 22 $bootstrap_settings['skip_db'] = isset($skip_db) ? $skip_db : false; 23 } 24 if (!isset($bootstrap_settings['skip_astman'])) { 25 $bootstrap_settings['skip_astman'] = isset($skip_astman) ? $skip_astman : false; 26 } 27 $bootstrap_settings['astman_config'] = isset($bootstrap_settings['astman_config']) ? $bootstrap_settings['astman_config'] : null; 28 $bootstrap_settings['astman_options'] = isset($bootstrap_settings['astman_options']) && is_array($bootstrap_settings['astman_options']) ? $bootstrap_settings['astman_options'] : array(); 29 $bootstrap_settings['astman_events'] = isset($bootstrap_settings['astman_events']) ? $bootstrap_settings['astman_events'] : 'off'; 30 31 $bootstrap_settings['freepbx_error_handler'] = isset($bootstrap_settings['freepbx_error_handler']) ? $bootstrap_settings['freepbx_error_handler'] : true; 32 $bootstrap_settings['freepbx_auth'] = isset($bootstrap_settings['freepbx_auth']) ? $bootstrap_settings['freepbx_auth'] : true; 33 34 35 $restrict_mods = isset($restrict_mods) ? $restrict_mods : false; 36 37 38 39 //enable error reporting and start benchmarking 40 error_reporting(1); 41 function microtime_float() { list($usec,$sec) = explode(' ',microtime()); return ((float)$usec+(float)$sec); } 42 $benchmark_starttime = microtime_float(); 2 43 3 44 // include base functions 4 require_once( 'functions.inc.php');45 require_once(dirname(__FILE__) . '/functions.inc.php'); 5 46 6 // get settings 7 $amp_conf = parse_amportal_conf("/etc/amportal.conf"); 8 $asterisk_conf = parse_asterisk_conf($amp_conf["ASTETCDIR"]."/asterisk.conf"); 9 if (!$skip_astman) { 10 require_once('common/php-asmanager.php'); 11 $astman = new AGI_AsteriskManager(); 47 //now that its been included, use our own error handler as it tends to be much more verbose. 48 if ($bootstrap_settings['freepbx_error_handler']) { 49 $error_handler = $bootstrap_settings['freepbx_error_handler'] === true ? 'freepbx_error_handler' : $bootstrap_settings['freepbx_error_handler']; 50 if (function_exists($error_handler)) { 51 set_error_handler($error_handler, E_ALL & ~E_STRICT); 52 } 53 } 12 54 55 //include database conifguration 56 if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { 57 include_once('/etc/asterisk/freepbx.conf'); 58 } 59 60 // connect to database 61 if (!$bootstrap_settings['skip_db']) { 62 require_once(dirname(__FILE__) . '/common/db_connect.php'); //PEAR must be installed 63 //keep old values as well so that we have the db settings handy 64 // get settings 65 $amp_conf = $amp_conf + parse_amportal_conf("/etc/amportal.conf"); 66 $asterisk_conf = parse_asterisk_conf($amp_conf["ASTETCDIR"] . "/asterisk.conf"); 67 } 68 69 //set error reporting level if set 70 if (isset($amp_conf['php_error_reporting'])) { 71 error_reporting($amp_conf['php_error_reporting']); 72 } 73 74 if (!$bootstrap_settings['skip_astman']) { 75 require_once(dirname(__FILE__) . '/libraries/php-asmanager.php'); 76 $astman = new AGI_AsteriskManager($bootstrap_settings['astman_config'], $bootstrap_settings['astman_options']); 13 77 // attempt to connect to asterisk manager proxy 14 if (!isset($amp_conf["ASTMANAGERPROXYPORT"]) || !$res = $astman->connect($amp_conf["ASTMANAGERHOST"] . ":" . $amp_conf["ASTMANAGERPROXYPORT"], $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) {78 if (!isset($amp_conf["ASTMANAGERPROXYPORT"]) || !$res = $astman->connect($amp_conf["ASTMANAGERHOST"] . ":" . $amp_conf["ASTMANAGERPROXYPORT"], $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"], $bootstrap_settings['astman_events'])) { 15 79 // attempt to connect directly to asterisk, if no proxy or if proxy failed 16 if (!$res = $astman->connect($amp_conf["ASTMANAGERHOST"] . ":" . $amp_conf["ASTMANAGERPORT"], $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"], 'off')) {80 if (!$res = $astman->connect($amp_conf["ASTMANAGERHOST"] . ":" . $amp_conf["ASTMANAGERPORT"], $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"], $bootstrap_settings['astman_events'])) { 17 81 // couldn't connect at all 18 82 unset( $astman ); … … 21 85 } 22 86 23 // connect to database 24 require_once('common/db_connect.php'); //PEAR must be installed 87 //include gui functions + auth if nesesarry 88 // If set to freepbx_auth but we are in a cli mode, then don't bother authenticating either way. 89 // TODO: is it ever possible through an apache or httplite configuration to run a web launched php script 90 // as 'cli' ? Also, from a security perspective, should we just require this always be set to false 91 // if we want to bypass authentication and not try to be automatic about it? 92 // 93 if (!$bootstrap_settings['freepbx_auth'] || (php_sapi_name() == 'cli')) { 94 if (!defined('FREEPBX_IS_AUTH')) { 95 define('FREEPBX_IS_AUTH', 'TRUE'); 96 } 97 } else { 98 require(dirname(__FILE__) . '/libraries/framework_view.functions.php'); 99 frameworkPasswordCheck(); 100 } 101 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }//we should never need this, just another line of defence 25 102 26 if ($amp_conf['DEVEL']) { 27 // benchmark 28 function microtime_float() { list($usec,$sec) = explode(' ',microtime()); return ((float)$usec+(float)$sec); } 29 $benchmark_starttime = microtime_float(); 103 // I'm pretty sure if this is == true then there is no need to even pull all the module info as we are going down a path 104 // such as an ajax path that this is just overhead. (We'll no soon enough if this is too restrcitive). 105 // 106 if ($restrict_mods !== true) { 107 $active_modules = module_getinfo(false, MODULE_STATUS_ENABLED); 108 109 if(is_array($active_modules)){ 110 111 foreach($active_modules as $key => $module) { 112 //include module functions if there not dissabled 113 if ((!$restrict_mods || (is_array($restrict_mods) && isset($restrict_mods[$key]))) && is_file($amp_conf['AMPWEBROOT']."/admin/modules/{$key}/functions.inc.php")) { 114 require_once($amp_conf['AMPWEBROOT']."/admin/modules/{$key}/functions.inc.php"); 115 } 116 117 //create an array of module sections to display 118 // stored as [items][$type][$category][$name] = $displayvalue 119 if (isset($module['items']) && is_array($module['items'])) { 120 // loop through the types 121 foreach($module['items'] as $itemKey => $item) { 122 123 //if asterisk isnt running, mark moduels that depend on asterisk as disbaled 124 if (!isset($astman) || !$astman) { 125 if (( isset($item['needsenginedb']) && strtolower($item['needsenginedb']) == 'yes') 126 || (isset($item['needsenginerunning']) && strtolower($item['needsenginerunning']) == 'yes')) { 127 $active_modules[$key]['items'][$itemKey]['disabled'] = true; 128 } 129 } 130 131 // reference to the actual module 132 //$active_modules[$key][$itemKey]['module'] =& $active_modules[$key]; 133 134 } 135 } 136 } 137 } 30 138 } 31 32 $active_modules = module_getinfo(false, MODULE_STATUS_ENABLED);33 34 if(is_array($active_modules)){35 foreach($active_modules as $key => $module) {36 unset($active_modules[$key]['changelog']);37 //include module functions if there not dissabled38 if ((!$restrict_mods || isset($restrict_mods[$key])) && is_file("modules/{$key}/functions.inc.php")) {39 require_once("modules/{$key}/functions.inc.php");40 }41 42 //create an array of module sections to display43 // stored as [items][$type][$category][$name] = $displayvalue44 if (isset($module['items']) && is_array($module['items'])) {45 // loop through the types46 foreach($module['items'] as $itemKey => $item) {47 48 //if asterisk isnt running, mark moduels that depend on asterisk as disbaled49 if (!checkAstMan()) {50 if (( isset($item['needsenginedb']) && strtolower($item['needsenginedb']) == 'yes')51 || (isset($item['needsenginerunning']) && strtolower($item['needsenginerunning']) == 'yes')) {52 $active_modules[$key][$itemKey]['disabled'] = true;53 } else {54 $active_modules[$key][$itemKey]['disabled'] = false;55 }56 }57 58 // reference to the actual module59 //$active_modules[$key][$itemKey]['module'] =& $active_modules[$key];60 61 }62 }63 }64 }65 66 139 ?> freepbx/trunk/amp_conf/htdocs/admin/cdr/call-comp.php
r10274 r10865 1 1 <?php /* $Id$ */ 2 i nclude_once(dirname(__FILE__) . "/../header.php");2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 3 3 include_once(dirname(__FILE__) . "/lib/defines.php"); 4 4 include_once(dirname(__FILE__) . "/lib/Class.Table.php"); … … 48 48 Calldate Clid Src Dst Dcontext Channel Dstchannel Lastapp Lastdata Duration Billsec Disposition Amaflags Accountcode Uniqueid Serverid 49 49 *******/ 50 if (! @include($amp_conf['ASTETCDIR'].'/call-comp-table.php')) {50 if (!file_exists($amp_conf['ASTETCDIR'].'/call-log-table.php') || !@include($amp_conf['ASTETCDIR'].'/call-log-table.php')) { 51 51 52 52 $FG_TABLE_COL[]=array ("Calldate", "calldate", "18%", "center", "SORT", "19"); … … 202 202 /* --AMP BEGIN-- */ 203 203 //enforce restrictions for this AMP User 204 session_start();204 @session_start(); 205 205 $AMP_CLAUSE = $_SESSION['AMP_SQL']; 206 206 if (!isset($AMP_CLAUSE)) { freepbx/trunk/amp_conf/htdocs/admin/cdr/call-daily-load.php
r10274 r10865 1 1 <?php /* $Id$ */ 2 i nclude_once(dirname(__FILE__) . "/../header.php");2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 3 3 include_once(dirname(__FILE__) . "/lib/defines.php"); 4 4 include_once(dirname(__FILE__) . "/lib/Class.Table.php"); … … 42 42 $FG_TABLE_COL = array(); 43 43 44 if (! @include($amp_conf['ASTETCDIR'].'/call-daily-load-table.php')) {44 if (!file_exists($amp_conf['ASTETCDIR'].'/call-log-table.php') || !@include($amp_conf['ASTETCDIR'].'/call-log-table.php')) { 45 45 // The variable Var_col would define the col that we want show in your table 46 46 // First Name of the column in the html page, second name of the field … … 184 184 /* --AMP BEGIN-- */ 185 185 //enforce restrictions for this AMP User 186 session_start();186 @session_start(); 187 187 $AMP_CLAUSE = $_SESSION['AMP_SQL']; 188 188 if (!isset($AMP_CLAUSE)) { freepbx/trunk/amp_conf/htdocs/admin/cdr/call-last-month.php
r10274 r10865 1 1 <?php /* $Id$ */ 2 i nclude_once(dirname(__FILE__) . "/../header.php");2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 3 3 include_once(dirname(__FILE__) . "/lib/defines.php"); 4 4 include_once(dirname(__FILE__) . "/lib/Class.Table.php"); … … 48 48 *******/ 49 49 50 if (! @include($amp_conf['ASTETCDIR'].'/call-last-month-table.php')) {50 if (!file_exists($amp_conf['ASTETCDIR'].'/call-log-table.php') || !@include($amp_conf['ASTETCDIR'].'/call-log-table.php')) { 51 51 52 52 $FG_TABLE_COL[]=array ("Calldate", "calldate", "18%", "center", "SORT", "19"); … … 195 195 /* --AMP BEGIN-- */ 196 196 //enforce restrictions for this AMP User 197 session_start();197 @session_start(); 198 198 $AMP_CLAUSE = $_SESSION['AMP_SQL']; 199 199 if (!isset($AMP_CLAUSE)) { freepbx/trunk/amp_conf/htdocs/admin/cdr/call-log.php
r10274 r10865 1 1 <?php /* $Id$ */ 2 i nclude_once(dirname(__FILE__) . "/../header.php");2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 3 3 include_once(dirname(__FILE__) . "/lib/defines.php"); 4 4 include_once(dirname(__FILE__) . "/lib/Class.Table.php"); 5 5 6 7 6 // correct 31 +1 = 32 for the date 8 //session_start();7 @session_start(); 9 8 10 9 getpost_ifset(array('posted', 'Period', 'frommonth', 'fromstatsmonth', 'tomonth', 'tostatsmonth', 'fromday', 'fromstatsday_sday', 'fromstatsmonth_sday', 'today', 'tostatsday_sday', 'tostatsmonth_sday', 'dsttype', 'srctype', 'clidtype', 'channel', 'resulttype', 'stitle', 'atmenu', 'current_page', 'order', 'sens', 'dst', 'src', 'clid', 'userfieldtype', 'userfield', 'accountcodetype', 'accountcode', 'duration1', 'duration1type', 'duration2', 'duration2type')); … … 44 43 45 44 46 //$link = DbConnect(); 47 $DBHandle = DbConnect(); 45 $DBHandle = DbConnect(); 48 46 49 47 // The variable Var_col would define the col that we want show in your table … … 85 83 86 84 /* --AMP Begin-- */ 87 if (! @include($amp_conf['ASTETCDIR'].'/call-log-table.php')) {85 if (!file_exists($amp_conf['ASTETCDIR'].'/call-log-table.php') || !@include($amp_conf['ASTETCDIR'].'/call-log-table.php')) { 88 86 89 87 $FG_TABLE_COL[]=array ("Calldate", "calldate", "18%", "center", "SORT", "19"); … … 268 266 /* --AMP BEGIN-- */ 269 267 //enforce restrictions for this AMP User 270 @session_start(); 268 if(!isset($_SESSION)) { 269 @session_start(); 270 } 271 271 272 $AMP_CLAUSE = $_SESSION['AMP_SQL']; 272 273 if (!isset($AMP_CLAUSE)) { freepbx/trunk/amp_conf/htdocs/admin/cdr/cdr.php
r10274 r10865 1 1 <?php /* $Id$ */ 2 include_once(dirname(__FILE__) . "/../header.php"); 3 session_start(); 2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 4 3 5 4 6 5 /* -- AMP Begin -- */ 6 7 $low = $_SESSION["AMP_user"]->_extension_low; 8 $high = $_SESSION["AMP_user"]->_extension_high; 9 if ((!empty($low)) && (!empty($high))) { 10 $channelfilter="OR (FIELD( SUBSTRING_INDEX( channel, '/', 1 ) , 'SIP', 'IAX2' ) > 0 AND SUBSTRING_INDEX(SUBSTRING(channel,2+LENGTH(SUBSTRING_INDEX( channel, '/', 1 ))),'-',1) BETWEEN $low and $high)"; 11 $channelfilter.="OR (dstchannel<>'' AND FIELD( SUBSTRING_INDEX( dstchannel, '/', 1 ) , 'SIP', 'IAX2' ) > 0 AND SUBSTRING_INDEX(SUBSTRING(dstchannel,2+LENGTH(SUBSTRING_INDEX( dstchannel, '/', 1 ))),'-',1) BETWEEN $low and $high)"; 12 13 $_SESSION["AMP_SQL"] = " AND ((src+0 BETWEEN $low AND $high) OR (dst+0 BETWEEN $low AND $high) OR (dst+0 BETWEEN 8$low AND 8$high) $channelfilter)"; 14 } else { 15 $_SESSION["AMP_SQL"] = ""; 16 } 17 7 18 $AMP_CLAUSE = $_SESSION['AMP_SQL']; 8 19 if (!isset($AMP_CLAUSE)) { … … 10 21 echo "<font color=red>YOU MUST ACCESS THE CDR THROUGH THE ASTERISK MANAGEMENT PORTAL!</font>"; 11 22 } 23 12 24 //echo 'AMP_CLAUSE='.$AMP_CLAUSE.'<hr>'; 13 25 /* -- AMP End -- */ … … 29 41 } 30 42 31 32 33 43 cdrpage_getpost_ifset(array('s', 't')); 34 44 45 $get_vars = array( 46 /* 47 'accountcode', 48 'accountcodetype', 49 'after', 50 'atmenu', 51 'before', 52 'channel', 53 'clid', 54 'clidtype', 55 'duration1', 56 'duration1type', 57 'duration2', 58 'duration2type', 59 'dst', 60 'dsttype', 61 'fromday', 62 'frommonth', 63 'fromstatsday_sday', 64 'fromstatsmonth', 65 'fromstatsmonth_sday', 66 'letter', 67 'list', 68 'list_total', 69 'list_total_day', 70 'min_call', 71 'name', 72 'nb_record', 73 'order', 74 */ 75 'posted', 76 /* 77 'resulttype', 78 's', 79 'sens', 80 'sql_limit', 81 'src', 82 'srctype', 83 'stitle', 84 't', 85 'today', 86 'tomonth', 87 'tostatsday_sday', 88 'tostatsmonth_sday', 89 'tostatsmonth', 90 'totalcall', 91 'userfield', 92 'userfieldtype', 93 'AMP_SQL', 94 'FG_ACTION_SIZE_COLUMN', 95 'FG_DELETION', 96 'Period', 97 'SQLcmd', 98 */ 99 ); 35 100 101 foreach ($get_vars as $gv) { 102 if (!isset($$gv) || !$$gv) { 103 $$gv = isset($_REQUEST[$gv]) ? $_REQUEST[$gv] : ''; 104 } 105 } 36 106 $array = array ("INTRO", "CDR REPORT", "CALLS COMPARE", "MONTHLY TRAFFIC","DAILY LOAD", "CONTACT"); 37 $s = $s ? $s : 0;107 $s = $s ? $s : 1; 38 108 $t = (isset($t))?$t:null; 39 109 $section="section$s$t"; … … 63 133 64 134 65 66 <?php /* --AMP--67 <!-- header BEGIN -->68 <div id="fedora-header">69 70 <div id="fedora-header-logo">71 <table border="0" cellpadding="0" cellspacing="0"><tr><td><img src="images/asterisk.gif" alt="CDR (Call Detail Records)"></td><td>72 <H1><font color=#990000> CDR (Call Detail Records)</font></H1></td></tr></table>73 </div>74 75 </div>76 <div id="fedora-nav"></div>77 <!-- header END -->78 79 <!-- leftside BEGIN -->80 <div id="fedora-side-left">81 <div id="fedora-side-nav-label">Site Navigation:</div> <ul id="fedora-side-nav">82 <?php83 $nkey=array_keys($array);84 $i=0;85 while($i<sizeof($nkey)){86 87 $op_strong = (($i==$s) && (!is_string($t))) ? '<strong>' : '';88 $cl_strong = (($i==$s) && (!is_string($t))) ? '</strong>' : '';89 90 if(is_array($array[$nkey[$i]])){91 92 93 94 echo "\n\t<li>$op_strong<a href=\"$racine?s=$i\">".$nkey[$i]."</a>$cl_strong";95 96 $j=0;97 while($j<sizeof($array[$nkey[$i]] )){98 $op_strong = (($i==$s) && (isset($t)) && ($j==intval($t))) ? '<strong>' : '';99 $cl_strong = (($i==$s) && (isset($t))&& ($j==intval($t))) ? '</strong>' : '';100 echo "<ul>";101 echo "\n\t<li>$op_strong<a href=\"$racine?s=$i&t=$j\">".$array[$nkey[$i]][$j]."</a>$cl_strong";102 echo "</ul>";103 $j++;104 }105 106 }else{107 echo "\n\t<li>$op_strong<a href=\"$racine?s=$i\">".$array[$nkey[$i]]."</a>$cl_strong";108 }109 echo "</li>\n";110 111 $i++;112 }113 114 ?>115 116 </ul>117 118 <?php if ($paypal=="OK"){?>119 <center>120 <br><br>121 <form action="https://www.paypal.com/cgi-bin/webscr" method="post">122 <input type="hidden" name="cmd" value="_xclick">123 <input type="hidden" name="business" value="info@areski.net">124 <input type="hidden" name="no_note" value="1">125 <input type="hidden" name="currency_code" value="EUR">126 <input type="hidden" name="tax" value="0">127 <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">128 </form>129 </center>130 <?php } ?>131 132 </div>133 134 <!-- leftside END -->135 136 <!-- content BEGIN -->137 <div id="fedora-middle-two">138 <div class="fedora-corner-tr"> </div>139 <div class="fedora-corner-tl"> </div>140 <div id="fedora-content">141 142 --AMP-- */?>143 135 144 136 145 137 <?php if ($section=="section0"){?> 146 147 <h1>148 <center>ASTERISK : CDR ANALYSER</center>149 </h1>150 <h3>Call data collection</h3>151 <p>Regardless of their size, most telephone PBX (public branch exchange) and PMS (property management systems)152 output <b>Call Detail Records (CDR)</b>. Generally, these get created at the end of a call but on some phone systems153 the data is available during the call. This data is output from the phone system by a serial link known as the154 Station Message Detail Recording port (SMDR). <b>Some of the details included in call records are: Time, Date, Call155 Duration, Number dialed, Caller ID information, Extension, Line/trunk location, Cost, Call completion status.</b><br>156 <br>157 Call detail records, both local and long distance, can be used for usage verification, billing reconciliation,158 network management and to monitor telephone usage to determine volume of phone usage, as well as abuse of the system.159 CDR's aid in the planning for future telecommunications needs. <br>160 <br>161 Control with CDR analysis:162 <ul>163 164 <li>review all CDR's for accuracy165 <li>verify usage166 <li>resolve discrepancies with vendors167 <li>disconnect unused service168 <li>terminate leases on unused equipment169 <li>deter or detect fraud170 <li>etc ...171 </ul>172 138 173 139 <?php }elseif ($section=="section1"){?> … … 175 141 <?php require("call-log.php");?> 176 142 177 178 143 <?php }elseif ($section=="section2"){?> 179 144 180 145 <?php require("call-comp.php");?> 181 182 146 183 147 <?php }elseif ($section=="section3"){?> … … 188 152 189 153 <?php require("call-daily-load.php");?> 190 191 192 <?php }elseif ($section=="section5"){?>193 <h1>Contact</h1>194 <table width="90%">195 196 <tr>197 <td>198 <h3>Arezqui Belaïd <br> <i>Barcelona - Belgium</i></h3>199 <br>200 <a href='javascript:bite("3721 945 4728 2762 3565 3554 2008 1380 654 3721 3554 4468 3007 3877 4828 654",5123,2981)'>Click to email me</a>201 <br><br><i>Feel free to send me your suggestions to improve the application ;)</i>202 </td>203 </tr>204 205 </table>206 <br><br><em><strong>Last update:</strong></em> <?php echo $update?><br>207 208 154 209 155 <?php }else{?> freepbx/trunk/amp_conf/htdocs/admin/cdr/common/graph_hourdetail.php
r10243 r10865 1 1 <?php /* $Id: graph_hourdetail.php 6816 2008-09-19 18:33:18Z p_lindheimer $ */ 2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 2 3 include_once(dirname(__FILE__) . "/../lib/defines.php"); 3 4 include_once(dirname(__FILE__) . "/../lib/Class.Table.php"); freepbx/trunk/amp_conf/htdocs/admin/cdr/common/graph_pie.php
r10243 r10865 1 1 <?php /* $Id: graph_pie.php 6816 2008-09-19 18:33:18Z p_lindheimer $ */ 2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 2 3 include_once(dirname(__FILE__) . "/../lib/defines.php"); 3 4 include_once(dirname(__FILE__) . "/../lib/Class.Table.php"); freepbx/trunk/amp_conf/htdocs/admin/cdr/common/graph_stat.php
r10243 r10865 1 1 <?php 2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 2 3 include_once(dirname(__FILE__) . "/../lib/defines.php"); 3 4 include_once(dirname(__FILE__) . "/../lib/Class.Table.php"); freepbx/trunk/amp_conf/htdocs/admin/cdr/common/graph_statbar.php
r10243 r10865 1 1 <?php /* $Id: graph_statbar.php 6816 2008-09-19 18:33:18Z p_lindheimer $ */ 2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 2 3 include_once(dirname(__FILE__) . "/../lib/defines.php"); 3 4 include_once(dirname(__FILE__) . "/../lib/Class.Table.php"); freepbx/trunk/amp_conf/htdocs/admin/cdr/export_csv.php
r173 r10865 1 1 <?php 2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 2 3 include_once(dirname(__FILE__) . "/lib/defines.php"); 3 4 include_once(dirname(__FILE__) . "/lib/Class.Table.php"); freepbx/trunk/amp_conf/htdocs/admin/cdr/export_pdf.php
r188 r10865 1 1 <?php 2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 2 3 include_once(dirname(__FILE__) . "/lib/defines.php"); 3 4 include_once(dirname(__FILE__) . "/lib/Class.Table.php"); freepbx/trunk/amp_conf/htdocs/admin/cdr/lib/Class.Table.php
r6002 r10865 1 1 <?php 2 2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 3 3 class Table { 4 4 … … 16 16 $this -> table = $table; 17 17 $this -> fields = $liste_fields; 18 $this->db = DbConnect(); 18 19 19 20 } … … 39 40 40 41 function Get_list ($clause=null, $order=null, $sens=null, $field_order_letter=null, $letters = null, $limite=null, $current_record=NULL) { 41 //global $link;42 global $DBHandle;43 44 45 42 $sql = 'SELECT '.$this -> fields.' FROM '.trim($this -> table); 46 43 … … 78 75 $QUERY = $sql.$sql_clause.$sql_orderby.$sql_limit; 79 76 if ($this -> debug_st) echo "<br>QUERY:".$QUERY; 80 81 //$res=DbExec($link, $QUERY); 82 $res = $DBHandle -> query($QUERY); 77 78 $res = $this->db->query($QUERY); 83 79 if(DB::isError($res)) 84 80 { … … 108 104 109 105 function Table_count ($clause=null) { 110 //global $link;111 global $DBHandle;112 113 114 106 $sql = 'SELECT count(*) FROM '.trim($this -> table); 115 107 … … 124 116 //echo $sql; 125 117 126 if ($this -> debug_st) echo "<br>QUERY:".$QUERY; 127 //$res=DbExec($link, $QUERY); 128 $res = $DBHandle -> query($QUERY); 118 if ($this -> debug_st) echo "<br>QUERY:".$QUERY; 119 $res = $this->db->query($QUERY); 129 120 130 121 /////$num=DbCount($res); … … 143 134 144 135 function Add_table ($value, $func_fields = null, $func_table = null, $id_name = null) { 145 //global $link;146 global $DBHandle;147 148 136 if ($func_fields!=""){ 149 137 $this -> fields = $func_fields; … … 158 146 if ($this -> debug_st) echo "<br>QUERY:".$QUERY; 159 147 160 $res = $DBHandle ->query($QUERY);148 $res = dbquery($QUERY); 161 149 162 150 if (DB::isError($res)){ 163 151 //if (! $res=DbExec($link, $QUERY)) { 164 152 //$this -> errstr = "Could not create a new instance in the table '".$this -> table."'"; 165 $this -> errstr = $ DBHandle ->getMessage();153 $this -> errstr = $this->db->getMessage(); 166 154 167 155 … … 177 165 $sql = 'SELECT "'.$id_name.'" FROM "'.$this -> table.'" WHERE oid=\''.$oid.'\''; 178 166 179 if (! $res = $ DBHandle ->query($sql)) return (false);167 if (! $res = $this->db->query($sql)) return (false); 180 168 181 169 $row [] =$res -> fetchRow(); … … 189 177 190 178 function Update_table ($param_update, $clause, $func_table = null) { 191 //global $link;192 global $DBHandle;193 194 179 if ($param_update=="" || $clause==""){ 195 180 echo "<br>Update parameters wasn't correctly defined.<br>Check the function call 'Update_table'."; … … 206 191 207 192 208 if (! $res = $ DBHandle ->query($QUERY)){193 if (! $res = $this->db->query($QUERY)){ 209 194 //if (! $res=DbExec($link, $QUERY)) { 210 195 $this -> errstr = "Could not update the instances of the table '".$this -> table."'"; … … 218 203 219 204 function Delete_table ($clause, $func_table = null) { 220 //global $link;221 global $DBHandle;222 223 205 if ($clause==""){ 224 206 echo "<br>Delete parameters wasn't correctly defined.<br>Check the function call 'Update_table'."; … … 234 216 if ($this -> debug_st) echo "<br>QUERY:".$QUERY; 235 217 236 if (! $res = $ DBHandle ->query($QUERY)){218 if (! $res = $this->db->query($QUERY)){ 237 219 //if (! $res=DbExec($link, $QUERY)) { 238 220 $this -> errstr = "Could not delete the instances of the table '".$this -> table."'"; freepbx/trunk/amp_conf/htdocs/admin/cdr/lib/defines.php
r10122 r10865 1 1 <?php /* $Id$ */ 2 2 $restrict_mods = true; 3 $skip_db = true; 4 $skip_astman = true; 5 if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { 6 include_once('/etc/asterisk/freepbx.conf'); 7 } 8 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 3 9 require_once('DB.php'); // PEAR 4 5 if (!function_exists('parse_amportal_conf')) {6 function parse_amportal_conf($filename) {7 $file = file($filename);8 foreach ($file as $line) {9 if (preg_match("/^\s*([a-zA-Z0-9_]+)=([a-zA-Z0-9 .&-@=_!<>\"\']+)\s*$/",$line,$matches)) {10 $conf[ $matches[1] ] = $matches[2];11 }12 }13 return $conf;14 }15 }16 17 $amp_conf = parse_amportal_conf("/etc/amportal.conf");18 19 10 20 11 if (isset($amp_conf["AMPWEBADDRESS"])) { … … 23 14 define ("FSROOT", $amp_conf["AMPWEBROOT"]."/admin/cdr/"); 24 15 25 26 27 16 define ("LIBDIR", FSROOT."lib/"); 28 17 29 define ("HOST", (( !isset($amp_conf["CDRDBHOST"]) ? $amp_conf["AMPDBHOST"] : $amp_conf["CDRDBHOST"] )) );30 define ("PORT", (( !isset($amp_conf["CDRDBPORT"]) ? "5432" : $amp_conf["CDRDBPORT"] )) );31 define ("USER", (( !isset($amp_conf["CDRDBUSER"]) ? $amp_conf["AMPDBUSER"] : $amp_conf["CDRDBUSER"] )) );32 define ("PASS", (( !isset($amp_conf["CDRDBPASS"]) ? $amp_conf["AMPDBPASS"] : $amp_conf["CDRDBPASS"] )) );33 define ("DBNAME", (( !isset($amp_conf["CDRDBNAME"]) ? "asteriskcdrdb" : $amp_conf["CDRDBNAME"] )) );34 define ("DB_TYPE", (( !isset($amp_conf["CDRDBTYPE"]) ? $amp_conf["AMPDBENGINE"] : $amp_conf["CDRDBTYPE"] )) ); // mysql or postgres35 define ("DB_TABLENAME", (( !isset($amp_conf["CDRDBTABLENAME"]) ? "cdr" : $amp_conf["CDRDBTABLENAME"] )) );36 18 define ("HOST", (( (!isset($amp_conf["CDRDBHOST"]) || !$amp_conf["CDRDBHOST"]) ? $amp_conf["AMPDBHOST"] : $amp_conf["CDRDBHOST"] )) ); 19 define ("PORT", (( (!isset($amp_conf["CDRDBPORT"]) || !$amp_conf["CDRDBPORT"]) ? "5432" : $amp_conf["CDRDBPORT"] )) ); 20 define ("USER", (( (!isset($amp_conf["CDRDBUSER"]) || !$amp_conf["CDRDBUSER"]) ? $amp_conf["AMPDBUSER"] : $amp_conf["CDRDBUSER"] )) ); 21 define ("PASS", (( (!isset($amp_conf["CDRDBPASS"]) || !$amp_conf["CDRDBPASS"]) ? $amp_conf["AMPDBPASS"] : $amp_conf["CDRDBPASS"] )) ); 22 define ("DBNAME", (( (!isset($amp_conf["CDRDBNAME"]) || !$amp_conf["CDRDBNAME"]) ? "asteriskcdrdb" : $amp_conf["CDRDBNAME"] )) ); 23 define ("DB_TYPE", (( (!isset($amp_conf["CDRDBTYPE"]) ||!$amp_conf["CDRDBTYPE"]) ? $amp_conf["AMPDBENGINE"] : $amp_conf["CDRDBTYPE"] )) ); // mysql or postgres 24 define ("DB_TABLENAME", (( (!isset($amp_conf["CDRDBTABLENAME"]) || !$amp_conf["CDRDBTABLENAME"]) ? "cdr" : $amp_conf["CDRDBTABLENAME"] )) ); 25 37 26 // Regarding to the dst you can setup an application name 38 27 // Make more sense to have a text that just a number … … 47 36 48 37 49 function DbConnect() 50 { 38 function DbConnect() { 51 39 $options = array(); 52 if (DB_TYPE == "postgres") 53 { 54 $datasource = 'pgsql://'.USER.':'.PASS.'@'.HOST.'/'.DBNAME; 55 } 56 else if (DB_TYPE == "sqlite3") 57 { 40 if (DB_TYPE == "postgres") { 41 $datasource = 'pgsql://'.USER.':'.PASS.'@'.HOST.'/'.DBNAME; 42 } else if (DB_TYPE == "sqlite3") { 58 43 /* on centos this extension is not loaded by default */ 59 44 if (! extension_loaded('sqlite3') && ! extension_loaded('SQLITE3')) … … 70 55 'portability' => DB_PORTABILITY_NUMROWS 71 56 ); 72 } 73 else 74 { 57 }else{ 75 58 $datasource = DB_TYPE.'://'.USER.':'.PASS.'@'.HOST.'/'.DBNAME; 59 76 60 } 77 61 if(!empty($options)) freepbx/trunk/amp_conf/htdocs/admin/cdr/lib/fpdf.php
r173 r10865 9 9 * Vous pouvez utiliser et modifier ce logiciel comme vous le souhaitez. * 10 10 *******************************************************************************/ 11 11 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 12 12 if(!class_exists('FPDF')) 13 13 { freepbx/trunk/amp_conf/htdocs/admin/cdr/lib/iam_csvdump.php
r173 r10865 1 1 <?php 2 2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 3 3 /** 4 4 * IAM_CSVDump A class form performing a query dump and sending it to the browser or setting it or download. … … 8 8 /** 9 9 * IAM_CSVDump A class form performing a query dump and sending it to the browser or setting it or download. 10 * @author Iv án Ariel Melgrati <phpclasses@imelgrat.mailshell.com>10 * @author Iván Ariel Melgrati <phpclasses@imelgrat.mailshell.com> 11 11 * @package iam_csvdump 12 12 * @version 1.0 freepbx/trunk/amp_conf/htdocs/admin/common/db_connect.php
r6816 r10865 14 14 require_once('DB.php'); //PEAR must be installed 15 15 16 $db_engine = $amp_conf["AMPDBENGINE"]; 17 18 switch ($db_engine) 19 { 16 switch ($amp_conf['AMPDBENGINE']) { 20 17 case "pgsql": 21 18 case "mysql": … … 23 20 dbengine://username:password@host/database */ 24 21 25 $db_user = $amp_conf["AMPDBUSER"]; 26 $db_pass = $amp_conf["AMPDBPASS"]; 27 $db_host = $amp_conf["AMPDBHOST"]; 28 $db_name = $amp_conf["AMPDBNAME"]; 29 30 $datasource = $db_engine.'://'.$db_user.':'.$db_pass.'@'.$db_host.'/'.$db_name; 22 $datasource = 'mysql://' 23 . $amp_conf['AMPDBUSER'] 24 . ':' 25 . $amp_conf['AMPDBPASS'] 26 . '@' 27 . $amp_conf['AMPDBHOST'] 28 . '/' 29 . $amp_conf['AMPDBNAME']; 31 30 $db = DB::connect($datasource); // attempt connection 32 31 break; … … 37 36 38 37 case "sqlite3": 39 if (!isset($amp_conf["AMPDBFILE"])) 40 die_freepbx("You must setup properly AMPDBFILE in /etc/amportal.conf"); 41 42 if (isset($amp_conf["AMPDBFILE"]) == "") 43 die_freepbx("AMPDBFILE in /etc/amportal.conf cannot be blank"); 44 38 45 39 /* on centos this extension is not loaded by default */ 46 40 if (! extension_loaded('sqlite3') && ! extension_loaded('SQLITE3')) … … 51 45 die_freepbx("Your PHP installation has no PEAR/SQLite3 support. Please install php-sqlite3 and php-pear."); 52 46 } 53 54 $datasource = "sqlite3:///" . $amp_conf[ "AMPDBFILE"] . "?mode=0666";47 48 $datasource = "sqlite3:///" . $amp_conf['AMPDBFILE'] . "?mode=0666"; 55 49 $options = array( 56 50 'debug' => 4, 57 'portability' => DB_PORTABILITY_NUMROWS51 'portability' => DB_PORTABILITY_NUMROWS 58 52 ); 59 53 $db = DB::connect($datasource, $options); … … 69 63 die_freepbx($db->getMessage()); 70 64 } 71 72 // Now send or delete warning wrt to default passwords:73 //74 if (!isset($quietmode) || !$quietmode) {75 $nt = notifications::create($db);76 77 if ($amp_conf['AMPDBPASS'] == $amp_conf_defaults['AMPDBPASS'][1]) {78 $nt->add_warning('core', 'AMPDBPASS', _("Default SQL Password Used"), _("You are using the default SQL password that is widely known, you should set a secure password"));79 } else {80 $nt->delete('core', 'AMPDBPASS');81 }82 83 // Check and increase php memory_limit if needed and if allowed on the system84 //85 $current_memory_limit = rtrim(ini_get('memory_limit'),'M');86 $proper_memory_limit = '100';87 if ($current_memory_limit < $proper_memory_limit) {88 if (ini_set('memory_limit',$proper_memory_limit.'M') !== false) {89 $nt->add_notice('core', 'MEMLIMIT', _("Memory Limit Changed"), sprintf(_("Your memory_limit, %sM, is set too low and has been increased to %sM. You may want to change this in you php.ini config file"),$current_memory_limit,$proper_memory_limit));90 } else {91 $nt->add_warning('core', 'MEMERR', _("Low Memory Limit"), sprintf(_("Your memory_limit, %sM, is set too low and may cause problems. FreePBX is not able to change this on your system. You should increase this to %sM in you php.ini config file"),$current_memory_limit,$proper_memory_limit));92 }93 } else {94 $nt->delete('core', 'MEMLIMIT');95 }96 97 // send error if magic_quotes_gpc is enabled on this system as much of the code base assumes not98 //99 if(get_magic_quotes_gpc()) {100 $nt->add_error('core', 'MQGPC', _("Magic Quotes GPC"), _("You have magic_quotes_gpc enabled in your php.ini, http or .htaccess file which will cause errors in some modules. FreePBX expects this to be off and runs under that assumption"));101 } else {102 $nt->delete('core', 'MQGPC');103 }104 }freepbx/trunk/amp_conf/htdocs/admin/config.php
r10763 r10865 15 15 */ 16 16 17 // This is ugly, but it is the only way I can think of to get the menu sections localized. MC18 if (false) {19 _("Internal Options & Configuration");20 _("Inbound Call Control");21 _("Module Admin");22 _("System Administration");23 _("Third Party Addon");24 }25 26 /* benchmark */27 function microtime_float() { list($usec,$sec) = explode(' ',microtime()); return ((float)$usec+(float)$sec); }28 $benchmark_starttime = microtime_float();29 /*************/30 31 17 $type = isset($_REQUEST['type'])?$_REQUEST['type']:'setup'; 32 18 $display = isset($_REQUEST['display'])?$_REQUEST['display']:''; … … 40 26 $action = isset($_REQUEST['action'])?$_REQUEST['action']:null; 41 27 $quietmode = isset($_REQUEST['quietmode'])?$_REQUEST['quietmode']:''; 42 $ skip_astman= isset($_REQUEST['skip_astman'])?$_REQUEST['skip_astman']:false;28 $bootstrap_settings['skip_astman'] = isset($_REQUEST['skip_astman'])?$_REQUEST['skip_astman']:false; 43 29 if (isset($_REQUEST['restrictmods'])) { 44 30 $restrict_mods = explode('/',$_REQUEST['restrictmods']); … … 55 41 ); 56 42 57 include('header.php'); 43 @header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); 44 @header('Expires: Sat, 01 Jan 2000 00:00:00 GMT'); 45 @header('Cache-Control: post-check=0, pre-check=0',false); 46 @header('Pragma: no-cache'); 47 //session_cache_limiter('public, no-store'); 48 if (isset($_REQUEST['handler'])) { 49 $restrict_mods = true; 50 // I think reload is the only handler that requires astman, so skip it for others 51 switch ($_REQUEST['handler']) { 52 case 'reload': 53 break; 54 default: 55 $bootstrap_settings['skip_astman'] = true; 56 } 57 } 58 require('bootstrap.php'); 59 58 60 /* If there is an action request then some sort of update is usually being done. 59 61 This will protect from cross site request forgeries unless disabled. … … 75 77 // handle special requests 76 78 if (isset($_REQUEST['handler'])) { 77 switch ($_REQUEST['handler']) { 78 case 'cdr': 79 include('cdr/cdr.php'); 80 break; 81 case 'cdr_export_csv': 82 include('cdr/export_csv.php'); 83 break; 84 case 'cdr_export_pdf': 85 include('cdr/export_pdf.php'); 86 break; 87 case 'reload': 88 /** AJAX handler for reload event 89 */ 90 include_once('common/json.inc.php'); 91 $response = do_reload(); 92 $json = new Services_JSON(); 93 header("Content-type: application/json"); 94 echo $json->encode($response); 95 break; 96 case 'file': 97 /** Handler to pass-through file requests 98 * Looks for "module" and "file" variables, strips .. and only allows normal filename characters. 99 * Accepts only files of the type listed in $allowed_exts below, and sends the corresponding mime-type, 100 * and always interprets files through the PHP interpreter. (Most of?) the FreePBX environment is available, 101 * including $db and $astman, and the user is authenticated. 102 */ 103 if (!isset($_REQUEST['module']) || !isset($_REQUEST['file'])) { 104 die_freepbx("unknown"); 105 } 106 //TODO: this could probably be more efficient 107 $module = str_replace('..','.', preg_replace('/[^a-zA-Z0-9-\_\.]/','',$_REQUEST['module'])); 108 $file = str_replace('..','.', preg_replace('/[^a-zA-Z0-9-\_\.]/','',$_REQUEST['file'])); 109 110 $allowed_exts = array( 111 '.js' => 'text/javascript', 112 '.js.php' => 'text/javascript', 113 '.css' => 'text/css', 114 '.css.php' => 'text/css', 115 '.html.php' => 'text/html', 116 '.jpg.php' => 'image/jpeg', 117 '.jpeg.php' => 'image/jpeg', 118 '.png.php' => 'image/png', 119 '.gif.php' => 'image/gif', 120 ); 121 foreach ($allowed_exts as $ext=>$mimetype) { 122 if (substr($file, -1*strlen($ext)) == $ext) { 123 $fullpath = 'modules/'.$module.'/'.$file; 124 if (file_exists($fullpath)) { 125 // file exists, and is allowed extension 126 127 // image, css, js types - set Expires to an hour in advance so the client does 128 // not keep checking for them. Replace from header.php 129 if (!$amp_conf['DEVEL']) { 130 @header('Expires: '.gmdate('D, d M Y H:i:s', time()+3600).' GMT', true); 131 @header('Cache-Control: ',true); 132 @header('Pragma: ', true); 133 } 134 @header("Content-type: ".$mimetype); 135 include($fullpath); 136 exit(); 137 } 138 break; 139 } 140 } 141 die_freepbx("not allowed"); 142 break; 143 } 144 exit(); 145 } 146 79 $module = isset($_REQUEST['module']) ? $_REQUEST['module'] : ''; 80 $file = isset($_REQUEST['file']) ? $_REQUEST['file'] : ''; 81 fileRequestHandler($_REQUEST['handler'], $module, $file); 82 } 83 147 84 if (!$quietmode) { 148 85 module_run_notification_checks(); 149 86 } 150 87 151 $framework_asterisk_running = checkAstMan(); 152 153 // get all enabled modules 154 // active_modules array used below and in drawselects function and genConf function 155 $active_modules = module_getinfo(false, MODULE_STATUS_ENABLED); 156 88 //draw up freepbx menu 157 89 $fpbx_menu = array(); 158 159 160 90 // pointer to current item in $fpbx_menu, if applicable 161 91 $cur_menuitem = null; … … 163 93 // add module sections to $fpbx_menu 164 94 $types = array(); 95 165 96 if(is_array($active_modules)){ 166 97 foreach($active_modules as $key => $module) { 167 //include module functions 168 if ((!$restrict_mods || isset($restrict_mods[$key])) && is_file("modules/{$key}/functions.inc.php")) { 169 require_once("modules/{$key}/functions.inc.php"); 170 } 171 98 172 99 //create an array of module sections to display 173 100 // stored as [items][$type][$category][$name] = $displayvalue … … 177 104 178 105 // check access, unless module.xml defines all have access 106 //TODO: move this to bootstrap and make it work 179 107 if (!isset($item['access']) || strtolower($item['access']) != 'all') { 180 108 if (!$_SESSION["AMP_user"]->checkSection($itemKey)) { … … 184 112 } 185 113 186 if (!$framework_asterisk_running &&187 ((isset($item['needsenginedb']) && strtolower($item['needsenginedb'] == 'yes')) ||188 (isset($item['needsenginerunning']) && strtolower($item['needsenginerunning'] == 'yes')))189 )190 {191 $item['disabled'] = true;192 } else {193 $item['disabled'] = false;194 }195 196 114 if (!in_array($item['type'], $types)) { 197 115 $types[] = $item['type']; … … 222 140 } 223 141 } 142 224 143 sort($types); 225 144 freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php
r10763 r10865 13 13 14 14 //include all necessary classes TODO: include them dynamically as needed 15 require_once( (defined('AMP_BASE_INCLUDE_PATH') ? AMP_BASE_INCLUDE_PATH.'/' : '').'libraries/config.functions.php'); 16 require_once( (defined('AMP_BASE_INCLUDE_PATH') ? AMP_BASE_INCLUDE_PATH.'/' : '').'libraries/featurecodes.class.php'); 17 require_once( (defined('AMP_BASE_INCLUDE_PATH') ? AMP_BASE_INCLUDE_PATH.'/' : '').'libraries/components.class.php'); 18 require_once( (defined('AMP_BASE_INCLUDE_PATH') ? AMP_BASE_INCLUDE_PATH.'/' : '').'libraries/notifications.class.php'); 19 require_once( (defined('AMP_BASE_INCLUDE_PATH') ? AMP_BASE_INCLUDE_PATH.'/' : '').'libraries/moduleHook.class.php'); 20 require_once( (defined('AMP_BASE_INCLUDE_PATH') ? AMP_BASE_INCLUDE_PATH.'/' : '').'libraries/modulelist.class.php'); 21 require_once( (defined('AMP_BASE_INCLUDE_PATH') ? AMP_BASE_INCLUDE_PATH.'/' : '').'libraries/cronmanager.class.php'); 22 require_once( (defined('AMP_BASE_INCLUDE_PATH') ? AMP_BASE_INCLUDE_PATH.'/' : '').'libraries/ampuser.class.php'); 23 require_once( (defined('AMP_BASE_INCLUDE_PATH') ? AMP_BASE_INCLUDE_PATH.'/' : '').'libraries/xml2Array.class.php'); 15 $dirname = dirname(__FILE__); 16 17 require_once($dirname . '/libraries/components.class.php'); 18 require_once($dirname . '/libraries/xml2Array.class.php'); 19 require_once($dirname . '/libraries/cronmanager.class.php'); 20 require_once($dirname . '/libraries/moduleHook.class.php'); 21 require_once($dirname . '/libraries/notifications.class.php'); 22 require_once($dirname . '/libraries/ampuser.class.php'); 23 require_once($dirname . '/libraries/components.class.php'); 24 require_once($dirname . '/libraries/modulelist.class.php'); 25 require_once($dirname . '/libraries/config.functions.php'); 26 require_once($dirname . '/libraries/featurecodes.class.php'); 24 27 25 28 //include other files 26 require_once( (defined('AMP_BASE_INCLUDE_PATH') ? AMP_BASE_INCLUDE_PATH.'/' : '').'libraries/module.functions.php');27 require_once( (defined('AMP_BASE_INCLUDE_PATH') ? AMP_BASE_INCLUDE_PATH.'/' : '').'libraries/usage_registry.functions.php');28 require_once( (defined('AMP_BASE_INCLUDE_PATH') ? AMP_BASE_INCLUDE_PATH.'/' : '').'libraries/php-upgrade.functions.php');29 require_once( (defined('AMP_BASE_INCLUDE_PATH') ? AMP_BASE_INCLUDE_PATH.'/' : '').'libraries/sql.functions.php');29 require_once($dirname . '/libraries/module.functions.php'); 30 require_once($dirname . '/libraries/usage_registry.functions.php'); 31 require_once($dirname . '/libraries/php-upgrade.functions.php'); 32 require_once($dirname . '/libraries/sql.functions.php'); 30 33 31 34 // returns true if extension is within allowed range … … 888 891 function dbug(){ 889 892 $opts = func_get_args(); 893 $disc = $msg = $dump = null; 890 894 891 895 $dump = 0; … … 951 955 952 956 } 957 958 //http://php.net/manual/en/function.set-error-handler.php 959 function freepbx_error_handler($errno, $errstr, $errfile, $errline, $errcontext) { 960 $txt = date("Y-M-d H:i:s") 961 . "\t" . $errfile . ':' . $errline 962 . "\n\n" 963 . 'ERROR[' . $errno . ']: ' 964 . $errstr 965 . "\n\n\n"; 966 dbug_write($txt,$check=''); 967 } 968 953 969 /** Log an error to the (database-based) log 954 970 * @param string The section or script where the error occurred freepbx/trunk/amp_conf/htdocs/admin/libraries/config.functions.php
r10843 r10865 64 64 65 65 function parse_amportal_conf($filename) { 66 global $amp_conf_defaults ;66 global $amp_conf_defaults, $db; 67 67 68 68 /* defaults … … 70 70 * components don't have to keep being 'gun shy' about these variables. 71 71 * 72 * we will read these settings out of the db, but only when $filename is writeable 73 * otherwise, we read the $filename 72 74 */ 73 $file = file($filename); 74 if (is_array($file)) { 75 foreach ($file as $line) { 76 if (preg_match("/^\s*([a-zA-Z0-9_]+)=([a-zA-Z0-9 .&-@=_!<>\"\']+)\s*$/",$line,$matches)) { 77 $conf[ $matches[1] ] = $matches[2]; 75 if (!is_writable($filename)) { 76 $file = file($filename); 77 if (is_array($file)) { 78 foreach ($file as $line) { 79 if (preg_match("/^\s*([a-zA-Z0-9_]+)=([a-zA-Z0-9 .&-@=_!<>\"\']+)\s*$/",$line,$matches)) { 80 $conf[ $matches[1] ] = $matches[2]; 81 } 82 } 83 $conf['amportal_canwrite'] = false; 84 } else { 85 die_freepbx("<h1>".sprintf(_("Missing or unreadable config file (%s)...cannot continue"), $filename)."</h1>"); 78 86 } 87 } else { 88 $sql = 'SELECT `key`, value FROM freepbx_settings'; 89 $conf = $db->getAssoc($sql); 90 if(DB::IsError($conf)) { 91 die_freepbx($conf->getMessage()); 92 } else { 93 $conf['amportal_canwrite'] = true; 79 94 } 80 } else { 81 die_freepbx("<h1>".sprintf(_("Missing or unreadable config file (%s)...cannot continue"), $filename)."</h1>"); 95 82 96 } 83 97 98 84 99 // set defaults 85 100 foreach ($amp_conf_defaults as $key=>$arr) { freepbx/trunk/amp_conf/htdocs/admin/libraries/framework_view.functions.php
r10763 r10865 1 1 <?php 2 2 3 @session_start(); 3 4 if (isset($_REQUEST['logout'])) { 4 5 // logging out.. … … 34 35 if (!isset($_SESSION['AMP_user'])) { 35 36 // not logged in, send headers 36 @header('WWW-Authenticate: Basic realm=" FreePBX '._('Administration').'"');37 @header('WWW-Authenticate: Basic realm="'._('FreePBX Administration').'"'); 37 38 @header('HTTP/1.0 401 Unauthorized'); 38 39 showview("unauthorized"); 39 40 exit; 40 41 } 42 define('FREEPBX_IS_AUTH', 'TRUE'); 41 43 case 'none': 42 44 if (!isset($_SESSION['AMP_user'])) { … … 44 46 $_SESSION['AMP_user']->setAdmin(); 45 47 } 48 define('FREEPBX_IS_AUTH', 'TRUE'); 46 49 break; 47 50 case 'database': … … 64 67 // set admin access 65 68 $_SESSION['AMP_user']->setAdmin(); 69 define('FREEPBX_IS_AUTH', 'TRUE'); 66 70 } else { 67 71 // password failed and admin user fall-back failed … … 74 78 if (!isset($_SESSION['AMP_user'])) { 75 79 // not logged in, send headers 76 @header('WWW-Authenticate: Basic realm=" FreePBX '._('Administration').'"');80 @header('WWW-Authenticate: Basic realm=" '._('FreePBX Administration').'"'); 77 81 @header('HTTP/1.0 401 Unauthorized'); 78 82 showview("unauthorized"); 79 83 exit; 84 } 85 if (!defined('FREEPBX_IS_AUTH')) { 86 define('FREEPBX_IS_AUTH', 'TRUE'); 80 87 } 81 88 break; … … 96 103 } else { 97 104 $nt->delete('ari', 'ARI_ADMIN_PASSWORD'); 105 } 106 107 if ($amp_conf['AMPDBPASS'] == $amp_conf_defaults['AMPDBPASS'][1]) { 108 $nt->add_warning('core', 'AMPDBPASS', _("Default SQL Password Used"), _("You are using the default SQL password that is widely known, you should set a secure password")); 109 } else { 110 $nt->delete('core', 'AMPDBPASS'); 111 } 112 113 // Check and increase php memory_limit if needed and if allowed on the system 114 // 115 $current_memory_limit = rtrim(ini_get('memory_limit'),'M'); 116 $proper_memory_limit = '100'; 117 if ($current_memory_limit < $proper_memory_limit) { 118 if (ini_set('memory_limit',$proper_memory_limit.'M') !== false) { 119 $nt->add_notice('core', 'MEMLIMIT', _("Memory Limit Changed"), sprintf(_("Your memory_limit, %sM, is set too low and has been increased to %sM. You may want to change this in you php.ini config file"),$current_memory_limit,$proper_memory_limit)); 120 } else { 121 $nt->add_warning('core', 'MEMERR', _("Low Memory Limit"), sprintf(_("Your memory_limit, %sM, is set too low and may cause problems. FreePBX is not able to change this on your system. You should increase this to %sM in you php.ini config file"),$current_memory_limit,$proper_memory_limit)); 122 } 123 } else { 124 $nt->delete('core', 'MEMLIMIT'); 125 } 126 127 // send error if magic_quotes_gpc is enabled on this system as much of the code base assumes not 128 // 129 if(get_magic_quotes_gpc()) { 130 $nt->add_error('core', 'MQGPC', _("Magic Quotes GPC"), _("You have magic_quotes_gpc enabled in your php.ini, http or .htaccess file which will cause errors in some modules. FreePBX expects this to be off and runs under that assumption")); 131 } else { 132 $nt->delete('core', 'MQGPC'); 98 133 } 99 134 } … … 118 153 */ 119 154 function showview($viewname, $parameters = false) { 155 global $amp_conf, $db; 120 156 if (is_array($parameters)) { 121 157 extract($parameters); 122 158 } 123 159 124 160 $viewname = str_replace('..','.',$viewname); // protect against going to subdirectories 125 161 if (file_exists('views/'.$viewname.'.php')) { … … 159 195 case 'reload': 160 196 // AJAX handler for reload event 161 //include_once('../common/json.inc.php');162 197 $response = do_reload(); 163 //$json = new Services_JSON();164 198 header("Content-type: application/json"); 165 //echo $json->encode($response);166 199 echo json_encode($response); 167 200 break; freepbx/trunk/amp_conf/htdocs/admin/libraries/module.functions.php
r10699 r10865 1055 1055 // Now make sure all feature codes are uninstalled in case the module has not already done it 1056 1056 // 1057 require_once( (defined('AMP_BASE_INCLUDE_PATH') ? AMP_BASE_INCLUDE_PATH.'/' : '').'libraries/featurecodes.class.php');1057 require_once(dirname(__FILE__) . '/featurecodes.class.php'); //TODO: do we need this, now that we have bootstrap? -MB 1058 1058 featurecodes_delModuleFeatures($modulename); 1059 1059 freepbx/trunk/amp_conf/htdocs/admin/libraries/php-asmanager.php
r10558 r10865 27 27 * 28 28 */ 29 if(!defined("AMP_CONF")) { define("AMP_CONF", "/etc/amportal.conf"); } 29 30 $restrict_mods = false; 31 $skip_astman = true; 32 33 if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { 34 include_once('/etc/asterisk/freepbx.conf'); 35 } 30 36 31 37 define('AST_CONFIG_DIR', $amp_conf['ASTETCDIR']); freepbx/trunk/amp_conf/htdocs/admin/libraries/xml2Array.class.php
r10244 r10865 134 134 } 135 135 } 136 137 136 138 137 /* … … 203 202 } 204 203 } 205 206 ?>freepbx/trunk/amp_conf/htdocs/admin/panel.php
r6976 r10865 12 12 //GNU General Public License for more details. 13 13 14 $restrict_mods = true; 15 $skip_astman = true; 14 16 $quietmode = isset($_REQUEST['quietmode'])?$_REQUEST['quietmode']:''; 15 16 include 'header.php'; 17 if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { 18 include_once('/etc/asterisk/freepbx.conf'); 19 } 20 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 17 21 18 22 $title=_("FreePBX: Flash Operator Panel"); freepbx/trunk/amp_conf/htdocs/admin/reports.php
r10243 r10865 11 11 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 12 //GNU General Public License for more details. 13 13 $restrict_mods = true; 14 if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { 15 include_once('/etc/asterisk/freepbx.conf'); 16 } 17 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 14 18 $quietmode = isset($_REQUEST['quietmode'])?$_REQUEST['quietmode']:''; 15 16 include 'header.php';17 19 18 20 $title=_("FreePBX: Call Detail Reports"); freepbx/trunk/amp_conf/htdocs/admin/views/freepbx_admin.php
r10285 r10865 6 6 <!-- begin menu --> 7 7 <?php 8 9 // This is ugly, but it is the only way I can think of to get the menu sections localized. MC 10 if (false) { 11 _("Internal Options & Configuration"); 12 _("Inbound Call Control"); 13 _("Module Admin"); 14 _("System Administration"); 15 _("Third Party Addon"); 16 } 17 18 8 19 global $amp_conf; 9 20 $fd = $amp_conf['ASTETCDIR'].'/freepbx_menu.conf'; freepbx/trunk/amp_conf/htdocs/recordings/includes/bootstrap.php
r9663 r10865 100 100 global $SETTINGS_MAX_FILES; 101 101 $SETTINGS_MAX_FILES = isset($SETTINGS_MAX_FILES) ? $SETTINGS_MAX_FILES : 3000; 102 103 $files = array();102 $fileCount=0; 103 $files = array(); 104 104 105 105 if (@is_dir($path) && @is_readable($path)) { … … 262 262 set_time_limit(360); 263 263 session_start(); 264 $_SESSION['ari_error'] = ''; 264 265 } 265 266 } … … 274 275 275 276 // set error reporting 276 error_reporting (E_ALL & ~ E_NOTICE);277 // error_reporting (E_ALL & ~ E_NOTICE); 277 278 } 278 279 … … 315 316 include_once("./includes/login.php"); 316 317 317 318 318 ?> freepbx/trunk/amp_conf/htdocs/recordings/includes/common.php
r10317 r10865 12 12 13 13 if ($_SESSION['ari_error']) { 14 $ret .= "<div class='error'>14 $ret = "<div class='error'> 15 15 " . $_SESSION['ari_error'] . " 16 16 </div> … … 92 92 */ 93 93 function databaseLogon() { 94 95 global $STANDALONE; 96 97 global $ASTERISKMGR_DBHOST; 98 99 global $AMP_FUNCTIONS_FILES; 100 global $AMPORTAL_CONF_FILE; 101 102 global $LEGACY_AMP_DBENGINE; 103 global $LEGACY_AMP_DBFILE; 104 global $LEGACY_AMP_DBHOST; 105 global $LEGACY_AMP_DBNAME; 106 107 global $ASTERISKCDR_DBENGINE; 108 global $ASTERISKCDR_DBFILE; 109 global $ASTERISKCDR_DBHOST; 110 global $ASTERISKCDR_DBNAME; 111 112 global $ARI_DISABLED_MODULES; 113 114 global $ARI_ADMIN_USERNAME; 115 global $ARI_ADMIN_PASSWORD; 116 global $ariadminusername; 117 global $ariadminpassword; 118 119 global $loaded_modules; 94 global $STANDALONE; 95 96 global $ASTERISKMGR_DBHOST; 97 98 global $AMP_FUNCTIONS_FILES; 99 global $AMPORTAL_CONF_FILE; 100 101 global $LEGACY_AMP_DBENGINE; 102 global $LEGACY_AMP_DBFILE; 103 global $LEGACY_AMP_DBHOST; 104 global $LEGACY_AMP_DBNAME; 105 106 global $ASTERISKCDR_DBENGINE; 107 global $ASTERISKCDR_DBFILE; 108 global $ASTERISKCDR_DBHOST; 109 global $ASTERISKCDR_DBNAME; 110 111 global $ARI_DISABLED_MODULES; 112 113 global $ARI_ADMIN_USERNAME; 114 global $ARI_ADMIN_PASSWORD; 115 global $ariadminusername; 116 global $ariadminpassword; 117 118 global $loaded_modules; 120 119 121 120 // This variable is a global in the FreePBX function.inc.php but needs to be … … 126 125 127 126 // get user 128 if ($STANDALONE['use']) { 129 130 $mgrhost = $ASTERISKMGR_DBHOST; 131 $mgruser = $STANDALONE['asterisk_mgruser']; 132 $mgrpass = $STANDALONE['asterisk_mgrpass']; 133 134 $asteriskcdr_dbengine = $ASTERISKCDR_DBENGINE; 135 $asteriskcdr_dbfile = $ASTERISKCDR_DBFILE; 136 $asteriskcdr_dbuser = $STANDALONE['asteriskcdr_dbuser']; 137 $asteriskcdr_dbpass = $STANDALONE['asteriskcdr_dbpass']; 138 $asteriskcdr_dbhost = $ASTERISKCDR_DBHOST; 139 $asteriskcdr_dbname = $ASTERISKCDR_DBNAME; 140 } 141 else { 142 143 $include = 0; 144 $files = preg_split('/;/',$AMP_FUNCTIONS_FILES); 145 foreach ($files as $file) { 146 if (is_file($file)) { 147 include_once($file); 148 $include = 1; 149 } 150 } 151 152 if ($include) { 153 global $amp_conf; 154 $amp_conf = parse_amportal_conf($AMPORTAL_CONF_FILE); 155 $ariadminusername = isset($amp_conf["ARI_ADMIN_USERNAME"]) ? $amp_conf["ARI_ADMIN_USERNAME"] : $ARI_ADMIN_USERNAME; 156 $ariadminpassword = isset($amp_conf["ARI_ADMIN_PASSWORD"]) ? $amp_conf["ARI_ADMIN_PASSWORD"] : $ARI_ADMIN_PASSWORD; 157 $mgrhost = $ASTERISKMGR_DBHOST; 158 $mgruser = $amp_conf['AMPMGRUSER']; 159 $mgrpass = $amp_conf['AMPMGRPASS']; 160 161 $amp_dbengine = isset($amp_conf["AMPDBENGINE"]) ? $amp_conf["AMPDBENGINE"] : $LEGACY_AMP_DBENGINE; 162 $amp_dbfile = isset($amp_conf["AMPDBFILE"]) ? $amp_conf["AMPDBFILE"] : $LEGACY_AMP_DBFILE; 163 $amp_dbuser = $amp_conf["AMPDBUSER"]; 164 $amp_dbpass = $amp_conf["AMPDBPASS"]; 165 $amp_dbhost = isset($amp_conf["AMPDBHOST"]) ? $amp_conf["AMPDBHOST"] : $LEGACY_AMP_DBHOST; 166 $amp_dbname = isset($amp_conf["AMPDBNAME"]) ? $amp_conf["AMPDBNAME"] : $LEGACY_AMP_DBNAME; 167 168 $asteriskcdr_dbengine = $ASTERISKCDR_DBENGINE; 169 $asteriskcdr_dbfile = $ASTERISKCDR_DBFILE; 170 $asteriskcdr_dbuser = $amp_conf["AMPDBUSER"]; 171 $asteriskcdr_dbpass = $amp_conf["AMPDBPASS"]; 172 $asteriskcdr_dbhost = $ASTERISKCDR_DBHOST; 173 $asteriskcdr_dbhost = isset($amp_conf["AMPDBHOST"]) ? $amp_conf["AMPDBHOST"] : $ASTERISKCDR_DBHOST; 174 $asteriskcdr_dbname = $ASTERISKCDR_DBNAME; 175 176 global $amp_usedevstate; 177 $amp_usedevstate = isset($amp_conf["USEDEVSTATE"]) ? strtolower(trim($amp_conf["USEDEVSTATE"])) : 0; 178 if ($amp_usedevstate == 'yes' || $amp_usedevstate == 'true' || $amp_usedevstate == 'on' || $amp_usedevstate == '1') { 179 $amp_usedevstate = 1; 180 } else { 181 $amp_usedevstate = 0; 182 } 183 184 } 185 } 186 187 // asterisk manager interface (berkeley database I think) 188 global $asterisk_manager_interface; 189 $asterisk_manager_interface = new AsteriskManagerInterface(); 190 191 $success = $asterisk_manager_interface->Connect($mgrhost,$mgruser,$mgrpass); 192 if (!$success) { 193 $_SESSION['ari_error'] = 194 _("ARI does not appear to have access to the Asterisk Manager.") . " ($errno)<br>" . 195 _("Check the ARI 'main.conf.php' configuration file to set the Asterisk Manager Account.") . "<br>" . 196 _("Check /etc/asterisk/manager.conf for a proper Asterisk Manager Account") . "<br>" . 197 _("make sure [general] enabled = yes and a 'permit=' line for localhost or the webserver."); 198 return FALSE; 199 } 200 201 // php-agi asterisk manager interface proxy 202 global $astman; 203 $astman = new AGI_AsteriskManager(); 204 205 // attempt to connect to asterisk manager proxy 206 if (!isset($amp_conf["ASTMANAGERPROXYPORT"]) || !$res = $astman->connect("127.0.0.1:".$amp_conf["ASTMANAGERPROXYPORT"], $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"], 'off')) 207 { 208 // attempt to connect directly to asterisk, if no proxy or if proxy failed 209 if (!$res = $astman->connect("127.0.0.1:".$amp_conf["ASTMANAGERPORT"], $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"], 'off')) 210 { 211 // couldn't connect at all 212 unset( $astman ); 213 $_SESSION['ari_error'] = 214 _("ARI does not appear to have access to the Asterisk Manager.") . " ($errno)<br>" . 215 _("Check the ARI 'main.conf.php' configuration file to set the Asterisk Manager Account.") . "<br>" . 216 _("Check /etc/asterisk/manager.conf for a proper Asterisk Manager Account") . "<br>" . 217 _("make sure [general] enabled = yes and a 'permit=' line for localhost or the webserver."); 218 } 219 } 220 221 // pear interface databases 222 $db = new Database(); 223 224 // AMP asterisk database 225 if (!$STANDALONE['use']) { 226 $_SESSION['dbh_asterisk'] = $db->logon($amp_dbengine, 227 $amp_dbfile, 228 $amp_dbuser, 229 $amp_dbpass, 230 $amp_dbhost, 231 $amp_dbname); 232 if (!isset($_SESSION['dbh_asterisk'])) { 233 $_SESSION['ari_error'] .= _("Cannot connect to the $amp_dbname database") . "<br>" . 234 _("Check AMP installation, asterisk, and ARI main.conf"); 235 return FALSE; 236 } 237 } 127 if ($STANDALONE['use']) { 128 $mgrhost = $ASTERISKMGR_DBHOST; 129 $mgruser = $STANDALONE['asterisk_mgruser']; 130 $mgrpass = $STANDALONE['asterisk_mgrpass']; 131 $asteriskcdr_dbengine = $ASTERISKCDR_DBENGINE; 132 $asteriskcdr_dbfile = $ASTERISKCDR_DBFILE; 133 $asteriskcdr_dbuser = $STANDALONE['asteriskcdr_dbuser']; 134 $asteriskcdr_dbpass = $STANDALONE['asteriskcdr_dbpass']; 135 $asteriskcdr_dbhost = $ASTERISKCDR_DBHOST; 136 $asteriskcdr_dbname = $ASTERISKCDR_DBNAME; 137 } else { 138 139 global $amp_conf, $amp_usedevstate; 140 $ariadminusername = isset($amp_conf["ARI_ADMIN_USERNAME"]) ? $amp_conf["ARI_ADMIN_USERNAME"] : $ARI_ADMIN_USERNAME; 141 $ariadminpassword = isset($amp_conf["ARI_ADMIN_PASSWORD"]) ? $amp_conf["ARI_ADMIN_PASSWORD"] : $ARI_ADMIN_PASSWORD; 142 $mgrhost = $ASTERISKMGR_DBHOST; 143 $mgruser = $amp_conf['AMPMGRUSER']; 144 $mgrpass = $amp_conf['AMPMGRPASS']; 145 146 $amp_dbengine = isset($amp_conf["AMPDBENGINE"]) ? $amp_conf["AMPDBENGINE"] : $LEGACY_AMP_DBENGINE; 147 $amp_dbfile = isset($amp_conf["AMPDBFILE"]) ? $amp_conf["AMPDBFILE"] : $LEGACY_AMP_DBFILE; 148 $amp_dbuser = $amp_conf["AMPDBUSER"]; 149 $amp_dbpass = $amp_conf["AMPDBPASS"]; 150 $amp_dbhost = isset($amp_conf["AMPDBHOST"]) ? $amp_conf["AMPDBHOST"] : $LEGACY_AMP_DBHOST; 151 $amp_dbname = isset($amp_conf["AMPDBNAME"]) ? $amp_conf["AMPDBNAME"] : $LEGACY_AMP_DBNAME; 152 153 $asteriskcdr_dbengine = $ASTERISKCDR_DBENGINE; 154 $asteriskcdr_dbfile = $ASTERISKCDR_DBFILE; 155 $asteriskcdr_dbuser = $amp_conf["AMPDBUSER"]; 156 $asteriskcdr_dbpass = $amp_conf["AMPDBPASS"]; 157 $asteriskcdr_dbhost = $ASTERISKCDR_DBHOST; 158 $asteriskcdr_dbhost = isset($amp_conf["AMPDBHOST"]) ? $amp_conf["AMPDBHOST"] : $ASTERISKCDR_DBHOST; 159 $asteriskcdr_dbname = $ASTERISKCDR_DBNAME; 160 161 $amp_usedevstate = isset($amp_conf["USEDEVSTATE"]) ? strtolower(trim($amp_conf["USEDEVSTATE"])) : 0; 162 if ($amp_usedevstate == 'yes' || $amp_usedevstate == 'true' || $amp_usedevstate == 'on' || $amp_usedevstate == '1') { 163 $amp_usedevstate = 1; 164 } else { 165 $amp_usedevstate = 0; 166 } 167 168 } 169 170 // asterisk manager interface (berkeley database I think) 171 global $asterisk_manager_interface; 172 $asterisk_manager_interface = new AsteriskManagerInterface(); 173 174 $success = $asterisk_manager_interface->Connect($mgrhost,$mgruser,$mgrpass); 175 if (!$success) { 176 $_SESSION['ari_error'] = 177 _("ARI does not appear to have access to the Asterisk Manager.") . " ($errno)<br>" . 178 _("Check the ARI 'main.conf.php' configuration file to set the Asterisk Manager Account.") . "<br>" . 179 _("Check /etc/asterisk/manager.conf for a proper Asterisk Manager Account") . "<br>" . 180 _("make sure [general] enabled = yes and a 'permit=' line for localhost or the webserver."); 181 return FALSE; 182 } 183 184 185 global $astman; 186 if (!isset($astman) || !$astman) { 187 // couldn't connect to astman 188 $_SESSION['ari_error'] = 189 _("ARI does not appear to have access to the Asterisk Manager.") . " ($errno)<br>" . 190 _("Check the ARI 'main.conf.php' configuration file to set the Asterisk Manager Account.") . "<br>" . 191 _("Check /etc/asterisk/manager.conf for a proper Asterisk Manager Account") . "<br>" . 192 _("make sure [general] enabled = yes and a 'permit=' line for localhost or the webserver."); 193 } 194 195 196 global $db; 197 if (isset($db) && $db) { 198 $_SESSION['dbh_asterisk'] = $db; 199 } else { 200 $_SESSION['ari_error'] .= _("Cannot connect to the $amp_dbname database") . "<br>" . 201 _("Check AMP installation, asterisk, and ARI main.conf"); 202 return FALSE; 203 } 238 204 239 205 // cdr database 240 206 if (in_array('callmonitor',array_keys($loaded_modules))) { 241 $_SESSION['dbh_cdr'] = $db->logon($asteriskcdr_dbengine, 207 $cdrdb = new Database(); 208 $_SESSION['dbh_cdr'] = $cdrdb->logon($asteriskcdr_dbengine, 242 209 $asteriskcdr_dbfile, 243 210 $asteriskcdr_dbuser, … … 433 400 // login to database 434 401 $success = databaseLogon(); 402 435 403 if ($success) { 436 404 … … 444 412 445 413 $display = new Display(); 446 414 415 $content = ''; 447 416 $content .= $display->displayHeaderText("ARI"); 448 417 $content .= $display->displayLine(); … … 486 455 include_once("./includes/callme.php"); 487 456 include_once("../admin/functions.inc.php"); 488 include_once("../admin/ common/php-asmanager.php");457 include_once("../admin/libraries/php-asmanager.php"); 489 458 490 459 ?> freepbx/trunk/amp_conf/htdocs/recordings/includes/main.conf.php
r9651 r10865 15 15 $AMPORTAL_CONF_FILE = "/etc/amportal.conf"; 16 16 17 $amp_conf = parse_amportal_conf($AMPORTAL_CONF_FILE);17 //$amp_conf = parse_amportal_conf($AMPORTAL_CONF_FILE); 18 18 # 19 19 # Host for Asterisk Manager Interface freepbx/trunk/amp_conf/htdocs/recordings/index.php
r1065 r10865 5 5 * main 6 6 */ 7 7 if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { 8 include_once('/etc/asterisk/freepbx.conf'); 9 } 8 10 include_once("includes/bootstrap.php"); 9 11 ariPageHeader(); freepbx/trunk/amp_conf/htdocs/recordings/theme/page.tpl.php
r9462 r10865 36 36 <div><img height=4 src="theme/spacer.gif" alt=""></div> 37 37 <div class="nav"> 38 <?php if ( $nav_menu != '') { ?>38 <?php if (isset($nav_menu) && $nav_menu != '') { ?> 39 39 <b class='nav_b1'></b><b class='nav_b2'></b><b class='nav_b3'></b><b class='nav_b4'></b> 40 40 <div id='nav_menu'> … … 45 45 </div> 46 46 <div><img height=14 src="theme/spacer.gif" alt=""></div> 47 <?php if ( $subnav_menu != '') { ?>47 <?php if (isset($subnav_menu) && $subnav_menu != '') { ?> 48 48 <div class="subnav"> 49 49 <div class="subnav_title"><?php echo _("Folders")?>:</div> … … 59 59 <span class="right"> 60 60 <div id="center"> 61 <?php if ( $login != "") { ?>61 <?php if (isset($login) && $login != "") { ?> 62 62 <?php print($login) ?> 63 63 <?php } ?> … … 86 86 </body> 87 87 </html> 88 freepbx/trunk/amp_conf/sbin/amportal
r4993 r10865 3 3 ROOT_UID=0 # root uid is 0 4 4 E_NOTROOT=67 # Non-root exit error 5 5 # define freepbx config file if not alreaddy set 6 if [ ! -n "$FREEPBX_CONF" ]; then 7 FREEPBX_CONF="/etc/freepbx.conf" 8 fi 6 9 7 10 echo … … 14 17 fi 15 18 16 # make sure config file exists 17 if [ ! -e "/etc/amportal.conf" ] # Check if file exists. 18 then 19 echo; 20 echo "/etc/amportal.conf does not exist!"; 21 echo "Have you installed the AMP configuration?"; 19 # get settings from db/config file 20 21 if [[ -e $FREEPBX_CONF && -w "/etc/amportal.conf" ]]; then # Check if file exists. 22 23 php -r > /dev/null 2>&1 24 if [ $? -eq 0 ]; then 25 echo "running php" 26 `php -r ' 27 $bootstrap_settings["freepbx_auth"] = false; 28 $bootstrap_settings["skip_astman"] = true; 29 $restrict_mods = true; 30 if (!@include_once(getenv("FREEPBX_CONF") ? getenv("FREEPBX_CONF") : "/etc/freepbx.conf")) { 31 include_once("/etc/asterisk/freepbx.conf"); 32 } 33 foreach($amp_conf as $key => $val) { 34 if (is_bool($val)) { 35 echo "export " . trim($key) . "=" . ($val?"TRUE":"FALSE") ."\n"; 36 } else { 37 echo "export " . trim($key) . "=" . escapeshellcmd(trim($val)) ."\n"; 38 } 39 } 40 '` 41 elif [ -e "/var/lib/asterisk/bin/gen_amp_conf.php" ]; then 42 echo "running gen_amp_conf.php" 43 `/var/lib/asterisk/bin/gen_amp_conf.php` 44 elif [ -e "/etc/amportal.conf" ]; then # Check if file exists. 45 echo "running amportal.conf" 46 . /etc/amportal.conf 47 else 48 echo; 49 echo "FreePBX config file not found!"; 50 echo "Have you installed FreePBX?"; 51 exit; 52 fi 53 elif [ -e "/etc/amportal.conf" ]; then # Check if file exists. 54 . /etc/amportal.conf 55 else 56 echo; 57 echo "FreePBX config file not found!"; 58 echo "Have you installed FreePBX?"; 22 59 exit; 23 60 fi 24 . /etc/amportal.conf25 61 26 if [ -x ${AMPBIN}/freepbx_engine ] 27 then 62 if [ -x ${AMPBIN}/freepbx_engine ]; then 28 63 ${AMPBIN}/freepbx_engine $@ 29 elif [ -x ${ASTVARLIBDIR}/bin/freepbx_engine ] 30 then 64 elif [ -x ${ASTVARLIBDIR}/bin/freepbx_engine ]; then 31 65 ${ASTVARLIBDIR}/bin/freepbx_engine $@ 32 elif [ -x /var/lib/asterisk/bin/freepbx_engine ] 33 then 66 elif [ -x /var/lib/asterisk/bin/freepbx_engine ]; then 34 67 /var/lib/asterisk/bin/freepbx_engine $@ 35 68 else freepbx/trunk/upgrades/2.9.0alpha1/migrate_ampconf.php
r10579 r10865 1 1 <?php 2 //TODO: revisit migration once we have further refined the amportal.conf in a db 3 // architecture. We need a class that allows modules to add their own values 4 // or remove them much like feature codes, also need some concept of sections 5 // which is not necessarily per module. 6 if (! function_exists("out")) { 7 function out($text) { 8 echo $text."<br />"; 9 } 10 } 11 12 if (! function_exists("outn")) { 13 function outn($text) { 14 echo $text; 15 } 16 } 17 2 18 global $db, $amp_conf; 3 19 20 outn(_("Preparing to migrate amportal.conf settings..")); 4 21 $sql = 'SELECT count(*) FROM freepbx_settings'; 5 22 $result = $db->query($sql); … … 7 24 if(DB::IsError($result)){ 8 25 $sql[] = "CREATE TABLE `freepbx_settings` ( 9 `key` varchar( 25) default NULL,10 `value` varchar( 100) default NULL,26 `key` varchar(50) default NULL, 27 `value` varchar(255) default NULL, 11 28 `level` int(11) default '0', 12 29 `description` text default NULL, 13 30 `type` varchar(25) default NULL, 14 `options` varchar(500)default NULL,15 `defaultval` varchar( 100) default NULL,31 `options` blob default NULL, 32 `defaultval` varchar(255) default NULL, 16 33 `readonly` varchar(15) default NULL, 17 34 `hidden` varchar(15) default NULL, … … 28 45 ('AMPDBHOST','localhost',0,'Hostname where the database asterisk is located<br>Default = localhost','text',NULL,'localhost',NULL,NULL), 29 46 ('AMPDBNAME','asterisk',0,'Name of the FreePBX database<br>Default = asterisk','text',NULL,'asterisk',NULL,NULL), 30 ('AMPDBPASS',' fpbx',0,'Password for accessing the database asterisk. Used in combination with AMPDBUSER<br>Default = amp109','text',NULL,NULL,NULL,NULL),31 ('AMPDBUSER',' freepbx',0,'Username for accessing the database asterisk<br>Default = asteriskuser','text',NULL,NULL,NULL,NULL),47 ('AMPDBPASS','amp109',0,'Password for accessing the database asterisk. Used in combination with AMPDBUSER<br>Default = amp109','text',NULL,NULL,NULL,NULL), 48 ('AMPDBUSER','asteriskuser',0,'Username for accessing the database asterisk<br>Default = asteriskuser','text',NULL,NULL,NULL,NULL), 32 49 ('AMPDISABLELOG','TRUE',0,'Whether or not to invoke the FreePBX log facility<br>Default = true','select','TRUE,FALSE','TRUE',NULL,NULL), 33 50 ('AMPENABLEDEVELDEBUG','FALSE',0,'Whether or not to include log messages marked as <b>devel-debug</b> in the log system<br>Default = false','select','TRUE,FALSE','FALSE',NULL,NULL), … … 44 61 ('ARI_ADMIN_PASSWORD','ari_password',0,'This is the default admin password to allow an administrator to login to ARI bypassing all security. Change this to a secure password.Default = not set','text',NULL,'ari_password',NULL,NULL), 45 62 ('ARI_ADMIN_USERNAME','',0,'This is the default admin name used to allow an administrator to login to ARI bypassing all security. Change this to whatever you want, dont forget to change the ARI_ADMIN_PASSWORD as well.Default = not set','text',NULL,'admin',NULL,NULL), 46 ('ASTMANAGER','',0,'Port for the Asterisk Manager<br>Default = 5028','text',NULL,'5038',NULL,NULL), 47 ('ASTMANAGERHOST','localhost',0,'Hostname for the Asterisk Manager<br>Default = localhost','text',NULL,'localhost',NULL,NULL), 63 ('ASTAGIDIR','/var/lib/asterisk/agi-bin',0,'This is the default directory for Asterisks agi files<br>Default = /var/lib/asterisk/agi-bin','text',NULL,'/var/lib/asterisk/agi-bin',NULL,NULL), 64 ('ASTETCDIR','/etc/asterisk',0,'This is the default directory for Asterisks configuration files<br>Default = /etc/asterisk','text',NULL,'/etc/asterisk',NULL,NULL), 65 ('ASTLOGDIR','/var/log/asterisk',0,'This is the default directory for Asterisks log files<br>Default = /var/log/asterisk','text',NULL,'/var/log/asterisk',NULL,NULL), 66 ('ASTMODDIR','/usr/lib/asterisk/modules',0,'This is the default directory for Asterisks modules<br>Default = /usr/lib/asterisk/modules','text',NULL,'/usr/lib/asterisk/modules',NULL,NULL), 67 ('ASTSPOOLDIR','/var/spool/asterisk',0,'This is the default directory for Asterisks spool directory<br>Default = /var/spool/asterisk','text',NULL,'/var/spool/asterisk',NULL,NULL), 68 ('ASTRUNDIR','/var/run/asterisk',0,'This is the default directory for Asterisks run files<br>Default = /var/run/asterisk','text',NULL,'/var/run/asterisk',NULL,NULL), 69 ('ASTVARLIBDIR','/var/lib/asterisk',0,'This is the default directory for Asterisks lib files<br>Default = /var/lib/asterisk','text',NULL,'/var/lib/asterisk',NULL,NULL), 70 ('ASTMANAGERPORT','5038',0,'Port for the Asterisk Manager<br>Default = 5038','text',NULL,'5038',NULL,NULL), 71 ('ASTMANAGERHOST','localhost',0,'Hostname for the Asterisk Manager<br>Default = 5038','text',NULL,'5038',NULL,NULL), 48 72 ('AUTHTYPE','database',0,'Authentication type to use for web admin. If type set to <b>database</b>, the primary AMP admin credentials will be the AMPDBUSER/AMPDBPASS above. Valid settings are: none, database<br>Default = database','select','none,database','database',NULL,NULL), 49 73 ('BADDESTABORT','FALSE',0,'Setting either of these to true will result in retrieve_conf aborting during a reload if an extension conflict is detected or a destination is detected. It is usually better to allow the reload to go through and then correct the problem but these can be set if a more strict behavior is desired<br>Default = false','select','TRUE,FALSE','FALSE',NULL,NULL), … … 58 82 ('CUSTOMASERROR','TRUE',0,'If false, then the Destination Registry will not report unknown destinations as errors. This should be left to the default true and custom destinations should be moved into the new custom apps registry<br>Default = true','select','TRUE,FALSE','TRUE',NULL,NULL), 59 83 ('CWINUSEBUSY','TRUE',0,'For extensions that have CW enabled, report unanswered CW calls as <b>busy</b> (resulting in busy voicemail greeting). If set to no, unanswered CW calls simply report as <b>no-answer</b><br>Default = true','select','TRUE,FALSE','TRUE',NULL,NULL), 60 ('DASHBOARD_INFO_UPDATE_TIM','',0,'These can be used to change the refresh rate of the System Status Panel. Most of the stats are updated based on the STATS interval but a few items are','text',NULL,NULL,NULL,NULL), 61 ('DASHBOARD_STATS_UPDATE_TI','',0,'These can be used to change the refresh rate of the System Status Panel. Most of the stats are updated based on the STATS interval but a few items are','text',NULL,NULL,NULL,NULL), 84 ('DASHBOARD_INFO_UPDATE_TIME','',0,'These can be used to change the refresh rate of the System Status Panel. Most of the stats are updated based on the STATS interval but a few items are','text',NULL,NULL,NULL,NULL), 85 ('DASHBOARD_STATS_UPDATE_TIME','',0,'These can be used to change the refresh rate of the System Status Panel. Most of the stats are updated based on the STATS interval but a few items are','text',NULL,NULL,NULL,NULL), 86 ('DAYNIGHTTCHOOK','FALSE',0,'By default, the Day/Night module will not hook Time Conditions allowing one to associate a daynight manual override with a time condition since now time conditions have their own feature code. If there is already an associaiton configured (on an upgraded system), this will have no affect for the Time Conditions that # are effected. Setting this to true reverts the previous behavior by allowing for the continued use of a daynight toggle to be associated with a time conditon. This can be useful for two scenarios. First, to override a Time Condition without the automatic resetting that occurs with the built in Time Condition overrides. The second use is the ability to associate a single daynight toggle with multiple time conditions thus creating a <b>master switch</b> that can be used to override several possible call flows through different time conditions.<br>Default = false','select','TRUE,FALSE','TRUE',NULL,NULL), 62 87 ('DEVEL','FALSE',0,'Needs to be documented<br>Default = false','select','TRUE,FALSE','FALSE',NULL,NULL), 63 88 ('DEVELRELOAD','FALSE',0,'Needs to be documented<br>Default = false','select','TRUE,FALSE','FALSE',NULL,NULL), … … 77 102 ('POST_RELOAD_DEBUG','',0,'Display debug output for script used if POST_RELOAD is used<br>Default = not set','select','TRUE,FALSE','FALSE',NULL,NULL), 78 103 ('RELOADCONFIRM','TRUE',0,'When set to false, will bypass the confirm on Reload Box<br>Default = true','select','TRUE,FALSE','TRUE',NULL,NULL), 79 ('SERVERINTITLE','FALSE',0,'Precede browser title with the server name<br>Default = false','select','TRUE,FALSE','TRUE',NULL,NULL), 104 ('SERVERINTITLE','FALSE',0,'Precede browser title with the server name<br>Default = false','select','TRUE,FALSE','TRUE',NULL,NULL), 105 ('TCINTERVAL','60',0,'The polling interval used by the Time Conditions manintenace task, launched by an Asterisk call file used to update Time Conditions override states as well as keep custom device state hint values up-to-date when being used with BLF. This interval should be shorter than the shortest time condition true (open) or false (closed) interval to assure that an override is reset after the current time period has expired that it was set in.<br>Default value 60 seconds.','text',NULL,'60',NULL,NULL), 106 ('TCMAINT','TRUE',0,'If set to false, this will override the execution of the Time Conditons maintenace task launched by call files. If all the feature codes for time conditions are disabled, the maintenance task will not be launched so this is not needed for that condition. Setting this to false would be fairly un-common. On an extremely active system that has constant calls flowing throught all time conditions of interest that might be overriden one might set this to avoid the additional polling that would otherwise occur since calls traversing the time conditions contexts will also maintain all the necessary state information. You may also set this temporarily if debugging a system to avoid the periodic dialplan running through the CLI that the maintenance task otherwise creates.<br>Default = true','select','TRUE,FALSE','TRUE',NULL,NULL), 80 107 ('USECATEGORIES','TRUE',0,'Controls if the menu items in the admin interface are sorted by category (true) or sorted alphebetically with no categories shown (false). Defaults = true','select','TRUE,FALSE','TRUE',NULL,NULL), 81 108 ('USEDEVSTATE','TRUE',0,'If this is set, it assumes that you are running Asterisk 1.4 or higher and want to take advantage of the func_devstate.c backport available from Asterisk 1.6. This allows custom hints to be created to support BLF for server side feature codes such as daynight, followme, etc<br>Default = false','select','TRUE,FALSE','TRUE',NULL,NULL), … … 83 110 ('USEQUEUESTATE','FALSE',0,'Setting this flag will generate the required dialplan to integrate with the following Asterisk patch: <b>https://issues.asterisk.org/view.php?id=15168</b>. This feature is planned for a future 1.6 release but given the existence of the patch can be used prior. Once the release version is known, code will be added to automatically enable this format in versions of Asterisk that support it<br>Default = false','select','TRUE,FALSE','FALSE',NULL,NULL), 84 111 ('XTNCONFLICTABORT','FALSE',0,'Setting either of these to true will result in retrieve_conf aborting during a reload if an extension conflict is detected or a destination is detected. It is usually better to allow the reload to go through and then correct the problem but these can be set if a more strict behavior is desired<br>Default = false','select','TRUE,FALSE','FALSE',NULL,NULL), 85 ('ZAP2DAHDICOMPAT',' TRUE',0,'If set to true, FreePBX will check if you have chan_dadhi installed. If so, it will automatically use all your ZAP configuration settings (devices and trunks) and silently convert them, under the covers, to DAHDI so no changes are needed. The GUI will continue to refer to these as ZAP but it will use the proper DAHDI channels. This will also keep Zap Channel DIDs working<br>Default = false','select','TRUE,FALSE','TRUE',NULL,NULL),86 ('AMPBACKUPSUDO','',0,'This option allows you to use sudo when backing up files. Useful ONLY when using AMPPROVROOT. Allows backup and restore of files specified in AMPPROVROOT, based on permissions in /etc/sudoers for example, adding the following to sudoers would allow the user asterisk to run tar on ANY file on the system:<br>asterisk localhost=(root)NOPASSWD: /bin/tar<br>Defaults:asterisk !requiretty<br>PLEASE KEEP IN MIND THE SECURITY RISKS INVOLVED IN ALLOWING THE ASTERISK USER TO TAR/UNTAR ANY FILE<br>Default = false','select','TRUE,FALSE',NULL,NULL,NULL)";112 ('ZAP2DAHDICOMPAT','FALSE',0,'If set to true, FreePBX will check if you have chan_dadhi installed. If so, it will automatically use all your ZAP configuration settings (devices and trunks) and silently convert them, under the covers, to DAHDI so no changes are needed. The GUI will continue to refer to these as ZAP but it will use the proper DAHDI channels. This will also keep Zap Channel DIDs working<br>Default = false','select','TRUE,FALSE','TRUE',NULL,NULL)"; 113 87 114 88 115 foreach ($sql as $q) { … … 115 142 die_freepbx($result->getDebugInfo()); 116 143 } 144 out(_("migrated")); 145 } else { 146 out(_("previously migrated")); 117 147 } 118 148 //TODO: set crucial options to readonly 149 //build freepbx.conf if it doesnt already exists 150 151 152 outn(_("checking for freepbx.conf..")); 153 154 $freepbx_conf = getenv('FREEPBX_CONF'); 155 if ($freepbx_conf && file_exists($freepbx_conf)) { 156 out(sprintf(_("%s already exists"),$freepbx_conf)); 157 } else if (file_exists('/etc/freepbx.conf')) { 158 out(_("/etc/freepbx.conf already exists")); 159 } else if (file_exists('/etc/asterisk/freepbx.conf')) { 160 out(_("/etc/asterisk/freepbx.conf already exists")); 161 } else { 162 163 if ($freepbx_conf) { 164 $filename = $freepbx_conf; 165 } else { 166 $filename = is_writable('/etc') ? '/etc/freepbx.conf' : '/etc/asterisk/freepbx.conf'; 167 } 168 169 $txt = ''; 170 $txt .= '<?php' . "\n"; 171 $txt .= '$amp_conf[\'AMPDBUSER\'] = "' . $amp_conf['AMPDBUSER'] . '";' . "\n"; 172 $txt .= '$amp_conf[\'AMPDBPASS\'] = "' . $amp_conf['AMPDBPASS'] . '";' . "\n"; 173 $txt .= '$amp_conf[\'AMPDBHOST\'] = "' . $amp_conf['AMPDBHOST'] . '";' . "\n"; 174 $txt .= '$amp_conf[\'AMPDBNAME\'] = "' . $amp_conf['AMPDBNAME'] . '";' . "\n"; 175 $txt .= '$amp_conf[\'AMPDBENGINE\'] = "' . $amp_conf['AMPDBENGINE'] . '";' . "\n"; 176 $txt .= '$amp_conf[\'datasource\'] = "' . $amp_conf['datasource'] . '";' . "\n"; 177 $txt .= 'require_once(\'' . $amp_conf['AMPWEBROOT'] . '/admin/bootstrap.php\');' . "\n"; 178 179 // don't use file_put_contents re php4 compatibility for framework/core 180 $fh = fopen($filename,'w'); 181 if ($fh === false || (fwrite($fh,$txt) === false)) { 182 out(sprintf(_("FATAL error writing %s"),$filename)); 183 die_freepbx(_("You must have a proper freepbx.conf file to proceed")); 184 } 185 fclose($fh); 186 out(sprintf(_("created %s"),$filename)); 187 } 119 188 ?> freepbx/trunk/upgrades/2.9.0alpha1/removefiles.php
r10643 r10865 14 14 $amp_conf['AMPWEBROOT']."/admin/common/content.css", 15 15 "$htdocs/admin/common/content.css", 16 $amp_conf['AMPWEBROOT']."/admin/common/json.inc.php",17 "$htdocs/admin/common/json.inc.php",18 16 $amp_conf['AMPWEBROOT']."/admin/common/docbook.css", 19 17 "$htdocs/admin/common/docbook.css",
