Changeset 1395 for freepbx/trunk/amp_conf/htdocs/recordings/includes
- Timestamp:
- 04/08/06 21:24:05 (7 years ago)
- Files:
-
- freepbx/trunk/amp_conf/htdocs/recordings/includes/ajax.php (modified) (4 diffs)
- freepbx/trunk/amp_conf/htdocs/recordings/includes/asi.php (modified) (3 diffs)
- freepbx/trunk/amp_conf/htdocs/recordings/includes/bootstrap.php (modified) (18 diffs)
- freepbx/trunk/amp_conf/htdocs/recordings/includes/common.php (modified) (12 diffs)
- freepbx/trunk/amp_conf/htdocs/recordings/includes/database.php (modified) (2 diffs)
- freepbx/trunk/amp_conf/htdocs/recordings/includes/display.php (modified) (3 diffs)
- freepbx/trunk/amp_conf/htdocs/recordings/includes/lang.php (modified) (3 diffs)
- freepbx/trunk/amp_conf/htdocs/recordings/includes/login.php (modified) (8 diffs)
- freepbx/trunk/amp_conf/htdocs/recordings/includes/main.conf.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk/amp_conf/htdocs/recordings/includes/ajax.php
r1360 r1395 50 50 function alertContents() { 51 51 52 if ( http_request == false) {52 if (!http_request) { 53 53 return; 54 54 } … … 62 62 } 63 63 64 var delimiter = '<-&*&->'; 65 var response_array = http_request.responseText.split(delimiter); 64 var response = http_request.responseXML.documentElement; 66 65 67 var i1 = http_request.responseText.indexOf(delimiter); 68 var i2 = i1 + delimiter.length; 69 var i3 = http_request.responseText.indexOf(delimiter,i2); 70 var i4 = i3 + delimiter.length; 71 72 var nav_menu_len = i1; 73 var nav_submenu_len = i3 - i2; 74 75 var nav_menu = http_request.responseText.substr(0,nav_menu_len); 76 var nav_submenu = http_request.responseText.substr(i2,nav_submenu_len); 77 var content = http_request.responseText.substr(i4); 66 var nav_menu = ''; 67 if (response.getElementsByTagName('nav_menu')[0]) { 68 nav_menu = response.getElementsByTagName('nav_menu')[0].firstChild.data; 69 } 70 var nav_submenu = ''; 71 if (response.getElementsByTagName('nav_submenu')[0]) { 72 nav_submenu = response.getElementsByTagName('nav_submenu')[0].firstChild.data; 73 } 74 var content = ''; 75 if (response.getElementsByTagName('content')[0]) { 76 content = response.getElementsByTagName('content')[0].firstChild.data; 77 } 78 78 79 79 if (nav_menu) { … … 94 94 95 95 function updatePage() { 96 makeRequest('" . $_SE RVER['PHP_SELF'] . "', '" . $url_args . "');96 makeRequest('" . $_SESSION['ARI_ROOT'] . "', '" . $url_args . "'); 97 97 } 98 98 … … 122 122 } 123 123 124 window.onload=beginRefresh ();124 window.onload=beginRefresh; 125 125 126 126 </script>"; freepbx/trunk/amp_conf/htdocs/recordings/includes/asi.php
r1066 r1395 27 27 * asterisk manager interface password 28 28 */ 29 function connect($username,$password) { 30 31 global $ASTERISKMGR_DBHOST; 29 function connect($host,$username,$password) { 32 30 33 31 // connect 34 $fp = fsockopen($ ASTERISKMGR_DBHOST, 5038, $errno, $errstr, 10);32 $fp = fsockopen($host, 5038, $errno, $errstr, 10); 35 33 if (!$fp) { 36 34 return FALSE; … … 83 81 * @param $command 84 82 * Command to be sent to the asterisk manager interface 83 * @return $ret 84 * response from asterisk manager interface 85 85 */ 86 function command($command,&$response) { 86 function command($command) { 87 88 $response = ''; 87 89 88 90 fwrite($this->socket,$command); … … 107 109 if ($count>100) { 108 110 $_SESSION['ari_error'] = _("Asterisk command not understood") . "<br />" . $buffer . "<br />\n"; 109 return FALSE;111 return; 110 112 } 111 113 $count++; 112 114 } 113 115 114 return TRUE;116 return $response; 115 117 } 116 118 freepbx/trunk/amp_conf/htdocs/recordings/includes/bootstrap.php
r1204 r1395 7 7 8 8 /** 9 * Set a arguments. 10 * 11 * @param $args 12 * The name of the array being acted upon. 13 * @param $name 14 * The name of the variable to set. 15 * @param $value 16 * The value to set. This can be any PHP data type; these functions take care 17 * of serialization as necessary. 18 */ 19 function setArgument(&$args, $name, $value) { 20 21 if (!isset($value)) { 22 $value = ''; 9 * Sets doc root 10 */ 11 function setARIRoot() { 12 13 $found = 0; 14 if (isset($_SERVER['PHP_SELF'])) { 15 if ($_SERVER['PHP_SELF']!='') { 16 $_SESSION['ARI_ROOT'] = $_SERVER['PHP_SELF']; 17 } 23 18 } 24 19 25 $args[$name] = $value; 26 } 27 28 /** 29 * Unset a arguments. 30 * 31 * @param $args 32 * The name of the array being acted upon. 33 * @param $name 34 * The name of the variable to undefine. 35 */ 36 function unsetArgument(&$args, $name) { 37 38 unset($args[$name]); 20 if (!$found) { 21 $_SESSION['ARI_ROOT'] = "index.php"; 22 } 39 23 } 40 24 … … 49 33 * The value of the variable. 50 34 */ 51 function getArgument( &$args, $name) {35 function getArgument($args, $name) { 52 36 53 37 return isset($args[$name]) ? $args[$name] : ''; … … 61 45 * @param $filter 62 46 * string to use as a filter to match files to return 63 * @ param$directories47 * @return $directories 64 48 * directories found 65 49 */ 66 function getDirectories($path,$filter,&$directories) { 50 function getDirectories($path,$filter) { 51 52 $directories = array(); 67 53 68 54 if (is_dir($path)) { … … 72 58 if($item!="." && $item!="..") { 73 59 74 checkPathSlash($path);60 $path = fixPathSlash($path); 75 61 $directory = $path; 76 AppendPath($directory,$item);62 $directory = appendPath($directory,$item); 77 63 78 64 if (is_dir($directory)) { … … 93 79 } 94 80 } 81 82 return $directories; 95 83 } 96 84 … … 106 94 * @param $recursive_count 107 95 * current sub folder count 108 * @ param$files96 * @return $files 109 97 * files found 110 98 */ 111 function getFiles($path,$filter,$recursive_max,&$recursive_count,&$files) { 99 function getFiles($path,$filter,$recursive_max,$recursive_count) { 100 101 $files = array(); 112 102 113 103 if (@is_dir($path) && @is_readable($path)) { … … 116 106 if($item!="." && $item!="..") { 117 107 118 CheckPathSlash($path); 119 $msg_path = $path; 120 AppendPath($msg_path,$item); 108 $path = fixPathSlash($path); 109 $msg_path = appendPath($path,$item); 121 110 122 111 $fileCount++; … … 137 126 138 127 $count = $recursive_count + 1; 139 GetFiles($msg_path,$filter,$recursive_max,$count,$files); 140 } else { 128 $path_files = getFiles($msg_path,$filter,$recursive_max,$count); 129 $files = array_merge($files,$path_files); 130 } 131 else { 141 132 $found = 0; 142 133 if ($filter) { … … 154 145 } 155 146 } 147 148 return $files; 156 149 } 157 150 … … 159 152 160 153 /** 161 * Checks the path for a trailing slash154 * Fixes the path for a trailing slash 162 155 * 163 156 * @param $path 164 157 * path to append 165 */ 166 function checkPathSlash(&$path) { 158 * @return $ret 159 * path to returned 160 */ 161 function fixPathSlash($path) { 162 163 $ret = $path; 167 164 168 165 $slash = ''; … … 170 167 $slash = '/'; 171 168 } 172 $path .= $slash; 169 $ret .= $slash; 170 171 return $ret; 173 172 } 174 173 … … 180 179 * @param $folder 181 180 * folder to append to path 182 */ 183 function appendPath(&$path,$folder) { 181 * @return $ret 182 * path to returned 183 */ 184 function appendPath($path,$folder) { 185 186 $ret = $path; 184 187 185 188 $m = ''; … … 187 190 $m = '/'; 188 191 } 189 $path .= $m . $folder; 192 $ret .= $m . $folder; 193 194 return $ret; 190 195 } 191 196 … … 218 223 219 224 // check for PHP 220 if (!version_compare(phpversion(), '4 ', '>=')) {221 echo _("ARI requires a version of PHP 4. 0or later");225 if (!version_compare(phpversion(), '4.3', '>=')) { 226 echo _("ARI requires a version of PHP 4.3 or later"); 222 227 exit(); 223 228 } … … 229 234 $found = 0; 230 235 foreach ($buf as $path) { 231 checkPathSlash($path);232 $pear_check_path = "/" .$path . "DB.php";236 $path = fixPathSlash($path); 237 $pear_check_path = $path . "DB.php"; 233 238 if (is_file($pear_check_path)) { 234 239 $found = 1; … … 244 249 245 250 /** 246 * Cleans up old versions with files that will crater the system247 */248 function versionCleanup() {249 250 if (is_file("./includes/info.inc")) {251 unlink("./includes/info.inc");252 }253 if (is_file("./modules/database.module")) {254 unlink("./modules/database.module");255 }256 if (is_file("./modules/display.module")) {257 unlink("./modules/display.module");258 }259 if (is_file("./modules/info.module")) {260 unlink("./modules/info.module");261 }262 if (is_file("./theme/style.css")) {263 unlink("./theme/style.css");264 }265 }266 267 /**268 251 * Starts the session 269 252 */ … … 287 270 function bootstrap() { 288 271 289 if(isset($_REQUEST['logout'])) {290 $login = new Login();291 $login->Unauth();292 }293 294 if (!isset($_SESSION['ari_user'])) {295 $login = new Login();296 $login->Auth();297 }298 299 272 // set error reporting 300 273 error_reporting (E_ALL & ~ E_NOTICE); … … 324 297 * Includes and run functions 325 298 */ 299 300 checkDependencies(); 301 startARISession(); 302 setARIRoot(); 326 303 327 304 include_once("./includes/lang.php"); 328 305 $language = new Language(); 329 306 $language->set(); 330 331 //checkDependencies();332 versionCleanup();333 startARISession();334 307 335 308 include_once("./includes/main.conf.php"); freepbx/trunk/amp_conf/htdocs/recordings/includes/common.php
r1150 r1395 38 38 $recursive_max = 1; 39 39 $recursive_count = 0; 40 getFiles($modules_path,$filter,$recursive_max,$recursive_count,$files);40 $files = getFiles($modules_path,$filter,$recursive_max,$recursive_count); 41 41 42 42 foreach($files as $key => $path) { … … 94 94 95 95 global $STANDALONE; 96 97 global $ASTERISKMGR_DBHOST; 98 96 99 global $AMP_FUNCTIONS_FILES; 97 100 global $AMPORTAL_CONF_FILE; 98 global $ASTERISK_DBHOST; 99 global $ASTERISK_DBNAME; 100 global $ASTERISK_DBTYPE; 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; 101 109 global $ASTERISKCDR_DBHOST; 102 110 global $ASTERISKCDR_DBNAME; 103 global $ASTERISKCDR_DBTYPE; 111 104 112 global $ARI_DISABLED_MODULES; 105 113 … … 108 116 // get user 109 117 if ($STANDALONE['use']) { 118 119 $mgrhost = $ASTERISKMGR_DBHOST; 110 120 $mgruser = $STANDALONE['asterisk_mgruser']; 111 121 $mgrpass = $STANDALONE['asterisk_mgrpass']; 112 $dbuser = $STANDALONE['asterisk_dbuser']; 113 $dbpass = $STANDALONE['asterisk_dbpass']; 114 $cdrdbuser = $STANDALONE['asterisk_cdrdbuser']; 115 $cdrdbpass = $STANDALONE['asterisk_cdrdbpass']; 122 123 $asteriskcdr_dbengine = $ASTERISKCDR_DBENGINE; 124 $asteriskcdr_dbfile = $ASTERISKCDR_DBFILE; 125 $asteriskcdr_dbuser = $STANDALONE['asteriskcdr_dbuser']; 126 $asteriskcdr_dbpass = $STANDALONE['asteriskcdr_dbpass']; 127 $asteriskcdr_dbhost = $ASTERISKCDR_DBHOST; 128 $asteriskcdr_dbname = $ASTERISKCDR_DBNAME; 116 129 } 117 130 else { … … 128 141 if ($include) { 129 142 $amp_conf = parse_amportal_conf($AMPORTAL_CONF_FILE); 143 144 $mgrhost = $ASTERISKMGR_DBHOST; 130 145 $mgruser = $amp_conf['AMPMGRUSER']; 131 146 $mgrpass = $amp_conf['AMPMGRPASS']; 132 $dbuser = $amp_conf["AMPDBUSER"]; 133 $dbpass = $amp_conf["AMPDBPASS"]; 134 $cdrdbuser = $amp_conf["AMPDBUSER"]; 135 $cdrdbpass = $amp_conf["AMPDBPASS"]; 147 148 $amp_dbengine = isset($amp_conf["AMPDBENGINE"]) ? $amp_conf["AMPDBENGINE"] : $LEGACY_AMP_DBENGINE; 149 $amp_dbfile = isset($amp_conf["AMPDBFILE"]) ? $amp_conf["AMPDBFILE"] : $LEGACY_AMP_DBFILE; 150 $amp_dbuser = $amp_conf["AMPDBUSER"]; 151 $amp_dbpass = $amp_conf["AMPDBPASS"]; 152 $amp_dbhost = isset($amp_conf["AMPDBHOST"]) ? $amp_conf["AMPDBHOST"] : $LEGACY_AMP_DBHOST; 153 $amp_dbname = isset($amp_conf["AMPDBNAME"]) ? $amp_conf["AMPDBNAME"] : $LEGACY_AMP_DBNAME; 154 155 $asteriskcdr_dbengine = $ASTERISKCDR_DBENGINE; 156 $asteriskcdr_dbfile = $ASTERISKCDR_DBFILE; 157 $asteriskcdr_dbuser = $amp_conf["AMPDBUSER"]; 158 $asteriskcdr_dbpass = $amp_conf["AMPDBPASS"]; 159 $asteriskcdr_dbhost = $ASTERISKCDR_DBHOST; 160 $asteriskcdr_dbname = $ASTERISKCDR_DBNAME; 161 136 162 unset($amp_conf); 137 163 } … … 142 168 $asterisk_manager_interface = new AsteriskManagerInterface(); 143 169 144 $success = $asterisk_manager_interface->Connect($mgr user,$mgrpass);170 $success = $asterisk_manager_interface->Connect($mgrhost,$mgruser,$mgrpass); 145 171 if (!$success) { 146 172 $_SESSION['ari_error'] = … … 157 183 // AMP asterisk database 158 184 if (!$STANDALONE['use']) { 159 $ success = $db->logon($dbuser,160 $dbpass,161 $ASTERISK_DBHOST,162 $ASTERISK_DBNAME,163 $ASTERISK_DBTYPE,164 $_SESSION['dbh_asterisk']);165 if (! $success) {166 $_SESSION['ari_error'] .= _("Cannot connect to the $ ASTERISK_DBNAMEdatabase") . "<br>" .185 $_SESSION['dbh_asterisk'] = $db->logon($amp_dbengine, 186 $amp_dbfile, 187 $amp_dbuser, 188 $amp_dbpass, 189 $amp_dbhost, 190 $amp_dbname); 191 if (!isset($_SESSION['dbh_asterisk'])) { 192 $_SESSION['ari_error'] .= _("Cannot connect to the $amp_dbname database") . "<br>" . 167 193 _("Check AMP installation, asterisk, and ARI main.conf"); 168 194 return FALSE; … … 172 198 // cdr database 173 199 if (in_array('callmonitor',array_keys($loaded_modules))) { 174 $ success = $db->logon($cdrdbuser,175 $cdrdbpass,176 $ASTERISKCDR_DBHOST,177 $ASTERISKCDR_DBNAME,178 $ASTERISKCDR_DBTYPE,179 $_SESSION['dbh_cdr']);180 if (! $success) {181 $_SESSION['ari_error'] .= sprintf(_("Cannot connect to the $ ASTERISKCDR_DBNAME database"),$ASTERISKCDR_DBNAME) . "<br>" .200 $_SESSION['dbh_cdr'] = $db->logon($asteriskcdr_dbengine, 201 $asteriskcdr_dbfile, 202 $asteriskcdr_dbuser, 203 $asteriskcdr_dbpass, 204 $asteriskcdr_dbhost, 205 $asteriskcdr_dbname); 206 if (!isset($_SESSION['dbh_cdr'])) { 207 $_SESSION['ari_error'] .= sprintf(_("Cannot connect to the $asteriskcdr_dbname database"),$asteriskcdr_dbname) . "<br>" . 182 208 _("Check AMP installation, asterisk, and ARI main.conf"); 183 209 return FALSE; … … 203 229 function loginBlock() { 204 230 205 if ( !isset($_SESSION['ari_user']) ) { 231 $login = new Login(); 232 233 if (isset($_REQUEST['logout'])) { 234 $login->Unauth(); 235 } 236 237 if (!isset($_SESSION['ari_user'])) { 238 $login->Auth(); 239 } 240 241 if (!isset($_SESSION['ari_user'])) { 206 242 207 243 if (isset($_REQUEST)) { $request = $_REQUEST; } else { $request = NULL; } 208 209 $login = new Login();210 244 211 245 // login form … … 247 281 248 282 // set arguments 283 $args = array(); 249 284 foreach($_REQUEST as $key => $value) { 250 SetArgument($args,$key,$value);285 $args[$key] = $value; 251 286 } 252 287 … … 309 344 // add logout link 310 345 if ($logout != '') { 311 $nav_menu .= "<p><small><small><a href='" . $_SE RVER['PHP_SELF'] . "?logout=1'>" . _("Logout") . "</a></small></small></p>";346 $nav_menu .= "<p><small><small><a href='" . $_SESSION['ARI_ROOT'] . "?logout=1'>" . _("Logout") . "</a></small></small></p>"; 312 347 } 313 348 … … 340 375 if ($success) { 341 376 342 // check if login is needed (user auth done in bootstrap)377 // check if login is needed 343 378 $content = loginBlock(); 344 379 if (!isset($content)) { … … 360 395 // check for ajax request and refresh or if not build the page 361 396 if (isset($_REQUEST['ajax_refresh'])) { 362 echo $nav_menu . "<-&*&->" . $subnav_menu . "<-&*&->" . $content; 397 398 echo "<?xml version='1.0' encoding='UTF-8' standalone='yes'?> 399 <response> 400 <nav_menu><![CDATA[" . $nav_menu . "]]></nav_menu> 401 <subnav_menu><![CDATA[" . $subnav_menu . "]]></subnav_menu> 402 <content><![CDATA[" . $content . "]]></content> 403 </response>"; 363 404 } 364 405 else { freepbx/trunk/amp_conf/htdocs/recordings/includes/database.php
r1066 r1395 23 23 * Logs into database and returns database handle 24 24 * 25 26 * @param $engine 27 * database engine 28 * @param $dbfile 29 * database file 25 30 * @param $username 26 31 * username for database … … 29 34 * @param $host 30 35 * database host 31 * @param $host32 * database host computer33 36 * @param $name 34 37 * database name 35 * @param $engine 36 * database type 37 * @param $dbh 38 * @return $dbh 38 39 * variable to hold the returned database handle 39 40 */ 40 function logon($ username,$password,$host,$name,$engine,&$dbh) {41 function logon($engine,$dbfile,$username,$password,$host,$name) { 41 42 42 // datasource in in this style: dbengine://username:password@host/database 43 $datasource = $engine . '://' . $username . ':' . $password . '@' . $host . '/' . $name; 43 // connect string 44 if ($dbfile) { 45 // datasource mostly to support sqlite: dbengine://dbfile?mode=xxxx 46 $dsn = $engine . '://' . $dbfile . '?mode=0666'; 47 } 48 else { 49 // datasource in in this style: dbengine://username:password@host/database 50 $datasource = $engine . '://' . $username . ':' . $password . '@' . $host . '/' . $name; 51 } 52 53 // options 54 $options = array( 55 'portability' => DB_PORTABILITY_ALL, 56 ); 44 57 45 $dbh = DB::connect($datasource); // attempt connection 58 // attempt connection 59 $dbh = DB::connect($datasource,$options); 46 60 47 61 // if connection failed show error 48 62 if(DB::isError($dbh)) { 49 63 $_SESSION['ari_error'] .= $dbh->getMessage() . "<br><br>"; 50 return false;64 return; 51 65 } 52 return true;66 return $dbh; 53 67 } 54 68 } freepbx/trunk/amp_conf/htdocs/recordings/includes/display.php
r1150 r1395 85 85 // build 86 86 $ret .= "<div " . $alignText . "> 87 <form class='bar' action='" . $_SE RVER['PHP_SELF'] . "' method='GET' name='search'>87 <form class='bar' action='" . $_SESSION['ARI_ROOT'] . "' method='GET' name='search'> 88 88 <input type=hidden name=m value=" . $m . "> 89 89 <input type=text name=q size=40 value='" . $q . "' maxlength=256> … … 137 137 138 138 if ($span<$total) { 139 $right_text = "<small><small>" . sprintf(_("Results %d of %d"),$start_count -$span_count,$total) . "</small></small>";139 $right_text = "<small><small>" . sprintf(_("Results %d - %d of %d"),$start_count,$span_count,$total) . "</small></small>"; 140 140 } else { 141 141 $right_text = "<small><small>" . sprintf(_("Results %d"),$total) . "</small></small>"; … … 189 189 } 190 190 191 $url = $_SE RVER['PHP_SELF'] . "?m=" . $m . "&q=" . $unicode_q . $option_text;191 $url = $_SESSION['ARI_ROOT'] . "?m=" . $m . "&q=" . $unicode_q . $option_text; 192 192 193 193 // build freepbx/trunk/amp_conf/htdocs/recordings/includes/lang.php
r1066 r1395 29 29 $locale = 'en_US'; 30 30 $locale_dir = "./locale"; 31 $directories = array(); 32 getdirectories($locale_dir,"",&$directories); 31 $directories = getdirectories($locale_dir,""); 33 32 foreach($directories as $directory) { 34 33 $buf = substr($directory,strlen($locale_dir)+1,strlen($directory) - strlen($locale_dir)); … … 40 39 41 40 // set locale 42 $language = $_COOKIE['ari_lang'] ? $_COOKIE['ari_lang']:$locale;41 $language = isset($_COOKIE['ari_lang']) ? $_COOKIE['ari_lang'] : $locale; 43 42 putenv("LANG=$language"); 44 43 putenv("LANGUAGE=$language"); … … 88 87 } 89 88 </script> 90 <form class='lang' name='lang' action=" . $_SE RVER['PHP_SELF'] . " method='POST'>89 <form class='lang' name='lang' action=" . $_SESSION['ARI_ROOT'] . " method='POST'> 91 90 <select class='lang_code' name='lang_code' onChange=\"setCookie('ari_lang',document.lang.lang_code.value); window.location.reload();\"> 92 91 <option value='en_US' " . ($_COOKIE['ari_lang']=='en_US' ? 'selected' : '') . ">English</option> freepbx/trunk/amp_conf/htdocs/recordings/includes/login.php
r1066 r1395 33 33 $crypt = new Crypt(); 34 34 35 // init variables 36 $extension = ''; 37 $displayname = ''; 38 $vm_password = ''; 39 $category = ''; 40 $context = ''; 41 $voicemail_email_address = ''; 42 $voicemail_pager_address = ''; 43 $voicemail_email_enable = ''; 44 $admin = ''; 45 $admin_callmonitor = ''; 46 $default_page = ''; 47 48 $username = ''; 49 $password = ''; 50 35 51 // get the ari authentication cookie 36 $buf = unserialize($_COOKIE['ari_auth']); 37 list($data,$chksum) = $buf; 52 $data = ''; 53 $chksum = ''; 54 if (isset($_COOKIE['ari_auth'])) { 55 $buf = unserialize($_COOKIE['ari_auth']); 56 list($data,$chksum) = $buf; 57 } 38 58 if (md5($data) == $chksum) { 39 59 $data = unserialize($crypt->decrypt($data,$ARI_CRYPT_PASSWORD)); … … 79 99 80 100 $lines = file($ASTERISK_VOICEMAIL_CONF); 101 102 // look for include files and tack their lines to end of array 103 foreach ($lines as $key => $line) { 104 105 if (preg_match("/include/i",$line)) { 106 107 $include_filename = ''; 108 $parts = split(' ',$line); 109 if (isset($parts[1])) { 110 $include_filename = trim($parts[1]); 111 } 112 113 if ($include_filename) { 114 $path_parts = pathinfo($ASTERISK_VOICEMAIL_CONF); 115 $include_path = fixPathSlash($path_parts['dirname']) . $include_filename; 116 foreach (glob($include_path) as $include_file) { 117 $include_lines = file($include_file); 118 $lines = array_merge($include_lines,$lines); 119 } 120 } 121 } 122 } 123 124 // process 81 125 foreach ($lines as $key => $line) { 82 126 … … 92 136 // check for user and process 93 137 unset($value); 94 list($var,$value) = split('=>',$line); 138 $parts = split('=>',$line); 139 if (isset($parts[0])) { 140 $var = $parts[0]; 141 } 142 if (isset($parts[1])) { 143 $value = $parts[1]; 144 } 95 145 $var = trim($var); 96 146 if ($var==$username && $value) { … … 167 217 168 218 unset($value); 169 list($var,$value) = split('=',$line); 170 $var = trim($var); 171 $value = trim($value); 219 $parts = split('=',$line); 220 if (isset($parts[0])) { 221 $var = trim($parts[0]); 222 } 223 if (isset($parts[1])) { 224 $value = trim($parts[1]); 225 } 172 226 if ($var=="username") { 173 227 $protocol_username = $value; … … 228 282 229 283 // if authenticated and user wants to be remembered, set cookie 230 if ($auth && $_POST['remember']) { 284 $remember = ''; 285 if (isset($_POST['remember'])) { 286 $remember = $_POST['remember']; 287 } 288 if ($auth && $remember) { 231 289 232 290 $data = array('username' => $username, 'password' => $password); … … 257 315 } 258 316 317 // get outboundCID if it exists 318 $outboundCID = $this->getOutboundCID($extension); 319 320 // set 259 321 if ($extension) { 260 322 $_SESSION['ari_user']['extension'] = $extension; 323 $_SESSION['ari_user']['outboundCID'] = $outboundCID; 261 324 $_SESSION['ari_user']['displayname'] = $displayname; 262 325 $_SESSION['ari_user']['voicemail_password'] = $vm_password; … … 272 335 $_SESSION['ari_user']['admin_callmonitor'] = $admin_callmonitor; 273 336 $_SESSION['ari_user']['default_page'] = $default_page; 337 338 // force the session data saved 339 session_write_close(); 274 340 } 275 341 } 276 342 } 343 344 /* 345 * Gets user outbound caller id 346 * 347 * @param $exten 348 * Extension to get information about 349 * @return $ret 350 * outbound caller id 351 */ 352 function getOutboundCID($extension) { 353 354 global $asterisk_manager_interface; 355 356 $ret = ''; 357 $response = $asterisk_manager_interface->Command("Action: Command\r\nCommand: database get AMPUSER $extension/outboundcid\r\n\r\n"); 358 if ($response) { 359 $buf = split(' ',trim($response)); 360 $ret = $buf[1]; 361 } 362 363 return $ret; 364 } 277 365 278 366 /** … … 329 417 $ret .= " 330 418 <table id='login'> 331 <form id='login' name='login' action=" . $_SE RVER['PHP_SELF'] . " method='POST'>419 <form id='login' name='login' action=" . $_SESSION['ARI_ROOT'] . " method='POST'> 332 420 " . $hiddenInputText . " 333 421 <tr> freepbx/trunk/amp_conf/htdocs/recordings/includes/main.conf.php
r1204 r1395 16 16 17 17 # 18 # Database host and name 18 # Host for Asterisk Manager Interface 19 # 20 $ASTERISKMGR_DBHOST = "localhost"; 21 22 # 23 # Database options for older legacy AMP installations (pre-FreePBX) 24 # - $LEGACY_AMP_DBFILE only needs to be set if using a database like sqlite 25 # 26 $LEGACY_AMP_DBENGINE = "mysql"; 27 $LEGACY_AMP_DBFILE = ""; 28 $LEGACY_AMP_DBHOST = "localhost"; 29 $LEGACY_AMP_DBNAME = "asterisk"; 30 31 # 32 # Database cdr settings 33 # - Only need to update these settings if standalone or an older AMP version (pre-FreePBX) is used 34 # - $ASTERISKCDR_DBFILE only needs to be set if using a database like sqlite 19 35 # Options: supported database types (others are supported, but not listed) 20 36 # 'mysql' - MySQL … … 23 39 # 'odbc' - ODBC 24 40 # 25 $ASTERISKMGR_DBHOST = "localhost"; 26 $ASTERISK_DBHOST = "localhost"; 27 $ASTERISK_DBNAME = "asterisk"; 28 $ASTERISK_DBTYPE = "mysql"; 41 $ASTERISKCDR_DBENGINE = "mysql"; 42 $ASTERISKCDR_DBFILE = ""; 29 43 $ASTERISKCDR_DBHOST = "localhost"; 30 44 $ASTERISKCDR_DBNAME = "asteriskcdrdb"; 31 $ASTERISKCDR_DBTYPE = "mysql";32 45 $ASTERISKCDR_DBTABLE = "cdr"; 33 46 … … 41 54 $STANDALONE['asterisk_mgruser'] = ""; 42 55 $STANDALONE['asterisk_mgrpass'] = ""; 43 $STANDALONE['asterisk _cdrdbuser'] = "";44 $STANDALONE['asterisk _cdrdbpass'] = "";56 $STANDALONE['asteriskcdr_dbuser'] = ""; 57 $STANDALONE['asteriskcdr_dbpass'] = ""; 45 58 46 59 ############################### … … 210 223 $ARI_HELP_FEATURE_CODES['*90'] = _("Call Forward on Busy"); 211 224 $ARI_HELP_FEATURE_CODES['*91'] = _("Disable Call Forward on Busy"); 212 $ARI_HELP_FEATURE_CODES['*97'] = _("Message Center (does no ask for extension)");225 $ARI_HELP_FEATURE_CODES['*97'] = _("Message Center (does not ask for extension)"); 213 226 $ARI_HELP_FEATURE_CODES['*98'] = _("Enter Message Center"); 214 227 $ARI_HELP_FEATURE_CODES['*99'] = _("Playback IVR Recording");
