Show
Ignore:
Timestamp:
04/08/06 21:24:05 (7 years ago)
Author:
dan_littlejohn
Message:

ARI version 00.10.00

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/recordings/includes/ajax.php

    r1360 r1395  
    5050      function alertContents() { 
    5151 
    52         if (http_request == false) { 
     52        if (!http_request) { 
    5353          return; 
    5454        } 
     
    6262            } 
    6363 
    64             var delimiter = '<-&*&->'; 
    65             var response_array = http_request.responseText.split(delimiter); 
     64            var response = http_request.responseXML.documentElement; 
    6665 
    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            } 
    7878 
    7979            if (nav_menu) { 
     
    9494 
    9595      function updatePage() { 
    96         makeRequest('" . $_SERVER['PHP_SELF'] . "', '" . $url_args . "'); 
     96        makeRequest('" . $_SESSION['ARI_ROOT'] . "', '" . $url_args . "'); 
    9797      } 
    9898 
     
    122122      } 
    123123 
    124       window.onload=beginRefresh()
     124      window.onload=beginRefresh
    125125 
    126126    </script>"; 
  • freepbx/trunk/amp_conf/htdocs/recordings/includes/asi.php

    r1066 r1395  
    2727   *   asterisk manager interface password  
    2828   */ 
    29   function connect($username,$password) { 
    30  
    31     global $ASTERISKMGR_DBHOST; 
     29  function connect($host,$username,$password) { 
    3230 
    3331    // connect 
    34     $fp = fsockopen($ASTERISKMGR_DBHOST, 5038, $errno, $errstr, 10); 
     32    $fp = fsockopen($host, 5038, $errno, $errstr, 10); 
    3533    if (!$fp) { 
    3634      return FALSE; 
     
    8381   * @param $command 
    8482   *   Command to be sent to the asterisk manager interface  
     83   * @return $ret 
     84   *   response from asterisk manager interface  
    8585   */ 
    86   function command($command,&$response) { 
     86  function command($command) { 
     87 
     88    $response = ''; 
    8789 
    8890    fwrite($this->socket,$command); 
     
    107109      if ($count>100) { 
    108110        $_SESSION['ari_error'] =  _("Asterisk command not understood") . "<br />" . $buffer . "<br />\n"; 
    109         return FALSE
     111        return
    110112      } 
    111113      $count++; 
    112114    } 
    113115 
    114     return TRUE
     116    return $response
    115117  } 
    116118 
  • freepbx/trunk/amp_conf/htdocs/recordings/includes/bootstrap.php

    r1204 r1395  
    77 
    88/** 
    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 */ 
     11function setARIRoot() { 
     12 
     13  $found = 0; 
     14  if (isset($_SERVER['PHP_SELF'])) { 
     15    if ($_SERVER['PHP_SELF']!='') { 
     16      $_SESSION['ARI_ROOT'] = $_SERVER['PHP_SELF']; 
     17    } 
    2318  } 
    2419   
    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  } 
    3923} 
    4024 
     
    4933 *   The value of the variable. 
    5034 */ 
    51 function getArgument(&$args, $name) { 
     35function getArgument($args, $name) { 
    5236 
    5337  return isset($args[$name]) ? $args[$name] : ''; 
     
    6145 * @param $filter 
    6246 *   string to use as a filter to match files to return 
    63  * @param $directories 
     47 * @return $directories 
    6448 *   directories found 
    6549 */ 
    66 function getDirectories($path,$filter,&$directories) { 
     50function getDirectories($path,$filter) { 
     51 
     52  $directories = array(); 
    6753 
    6854  if (is_dir($path)) { 
     
    7258      if($item!="." && $item!="..") { 
    7359 
    74         checkPathSlash($path); 
     60        $path = fixPathSlash($path); 
    7561        $directory = $path; 
    76         AppendPath($directory,$item); 
     62        $directory = appendPath($directory,$item); 
    7763 
    7864        if (is_dir($directory)) { 
     
    9379    }  
    9480  } 
     81 
     82  return $directories; 
    9583} 
    9684 
     
    10694 * @param $recursive_count 
    10795 *   current sub folder count 
    108  * @param $files 
     96 * @return $files 
    10997 *   files found 
    11098 */ 
    111 function getFiles($path,$filter,$recursive_max,&$recursive_count,&$files) { 
     99function getFiles($path,$filter,$recursive_max,$recursive_count) { 
     100 
     101  $files = array(); 
    112102 
    113103  if (@is_dir($path) && @is_readable($path)) { 
     
    116106      if($item!="." && $item!="..") { 
    117107 
    118         CheckPathSlash($path); 
    119         $msg_path = $path; 
    120         AppendPath($msg_path,$item); 
     108        $path = fixPathSlash($path); 
     109        $msg_path = appendPath($path,$item); 
    121110 
    122111        $fileCount++; 
     
    137126 
    138127          $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 { 
    141132          $found = 0; 
    142133          if ($filter) { 
     
    154145    }  
    155146  } 
     147 
     148  return $files; 
    156149} 
    157150 
     
    159152 
    160153/** 
    161  * Checks the path for a trailing slash 
     154 * Fixes the path for a trailing slash 
    162155 * 
    163156 * @param $path 
    164157 *   path to append 
    165  */ 
    166 function checkPathSlash(&$path) { 
     158 * @return $ret 
     159 *   path to returned 
     160 */ 
     161function fixPathSlash($path) { 
     162 
     163  $ret = $path; 
    167164 
    168165  $slash = ''; 
     
    170167    $slash = '/'; 
    171168  }  
    172   $path .= $slash;  
     169  $ret .= $slash; 
     170 
     171  return $ret;  
    173172} 
    174173 
     
    180179 * @param $folder 
    181180 *   folder to append to path 
    182  */ 
    183 function appendPath(&$path,$folder) { 
     181 * @return $ret 
     182 *   path to returned 
     183 */ 
     184function appendPath($path,$folder) { 
     185 
     186  $ret = $path; 
    184187 
    185188  $m = ''; 
     
    187190    $m = '/'; 
    188191  }  
    189   $path .= $m . $folder;  
     192  $ret .= $m . $folder;  
     193 
     194  return $ret; 
    190195} 
    191196 
     
    218223 
    219224  // check for PHP 
    220   if (!version_compare(phpversion(), '4', '>=')) { 
    221     echo _("ARI requires a version of PHP 4.0 or later"); 
     225  if (!version_compare(phpversion(), '4.3', '>=')) { 
     226    echo _("ARI requires a version of PHP 4.3 or later"); 
    222227    exit(); 
    223228  } 
     
    229234  $found = 0; 
    230235  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"; 
    233238    if (is_file($pear_check_path)) { 
    234239      $found = 1; 
     
    244249 
    245250/** 
    246  * Cleans up old versions with files that will crater the system 
    247  */ 
    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 /** 
    268251 * Starts the session 
    269252 */ 
     
    287270function bootstrap() { 
    288271 
    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  
    299272  // set error reporting 
    300273  error_reporting (E_ALL & ~ E_NOTICE);   
     
    324297 * Includes and run functions 
    325298 */ 
     299 
     300checkDependencies(); 
     301startARISession(); 
     302setARIRoot(); 
    326303 
    327304include_once("./includes/lang.php"); 
    328305$language = new Language(); 
    329306$language->set(); 
    330  
    331 //checkDependencies(); 
    332 versionCleanup(); 
    333 startARISession(); 
    334307 
    335308include_once("./includes/main.conf.php"); 
  • freepbx/trunk/amp_conf/htdocs/recordings/includes/common.php

    r1150 r1395  
    3838    $recursive_max = 1; 
    3939    $recursive_count = 0; 
    40     getFiles($modules_path,$filter,$recursive_max,$recursive_count,$files); 
     40    $files = getFiles($modules_path,$filter,$recursive_max,$recursive_count); 
    4141 
    4242    foreach($files as $key => $path) { 
     
    9494 
    9595  global $STANDALONE; 
     96 
     97  global $ASTERISKMGR_DBHOST; 
     98 
    9699  global $AMP_FUNCTIONS_FILES; 
    97100  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; 
    101109  global $ASTERISKCDR_DBHOST; 
    102110  global $ASTERISKCDR_DBNAME; 
    103   global $ASTERISKCDR_DBTYPE; 
     111 
    104112  global $ARI_DISABLED_MODULES; 
    105113 
     
    108116  // get user 
    109117  if ($STANDALONE['use']) { 
     118 
     119    $mgrhost = $ASTERISKMGR_DBHOST; 
    110120    $mgruser = $STANDALONE['asterisk_mgruser']; 
    111121    $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; 
    116129  }  
    117130  else { 
     
    128141    if ($include) { 
    129142      $amp_conf = parse_amportal_conf($AMPORTAL_CONF_FILE); 
     143 
     144      $mgrhost = $ASTERISKMGR_DBHOST; 
    130145      $mgruser = $amp_conf['AMPMGRUSER']; 
    131146      $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 
    136162      unset($amp_conf); 
    137163    }  
     
    142168  $asterisk_manager_interface = new AsteriskManagerInterface(); 
    143169 
    144   $success = $asterisk_manager_interface->Connect($mgruser,$mgrpass); 
     170  $success = $asterisk_manager_interface->Connect($mgrhost,$mgruser,$mgrpass); 
    145171  if (!$success) { 
    146172    $_SESSION['ari_error'] =   
     
    157183  // AMP asterisk database 
    158184  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_DBNAME database") . "<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>" . 
    167193                               _("Check AMP installation, asterisk, and ARI main.conf"); 
    168194      return FALSE; 
     
    172198  // cdr database 
    173199  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>" . 
    182208                               _("Check AMP installation, asterisk, and ARI main.conf"); 
    183209      return FALSE; 
     
    203229function loginBlock() { 
    204230 
    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'])) { 
    206242 
    207243    if (isset($_REQUEST)) { $request = $_REQUEST; } else { $request = NULL; } 
    208  
    209     $login = new Login(); 
    210244 
    211245    // login form 
     
    247281 
    248282  // set arguments 
     283  $args = array(); 
    249284  foreach($_REQUEST as $key => $value) { 
    250     SetArgument($args,$key,$value)
     285    $args[$key] = $value
    251286  } 
    252287 
     
    309344  // add logout link 
    310345  if ($logout != '') {  
    311     $nav_menu .= "<p><small><small><a href='" . $_SERVER['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>"; 
    312347  }  
    313348 
     
    340375  if ($success) { 
    341376 
    342     // check if login is needed (user auth done in bootstrap) 
     377    // check if login is needed 
    343378    $content = loginBlock(); 
    344379    if (!isset($content)) { 
     
    360395  // check for ajax request and refresh or if not build the page 
    361396  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>"; 
    363404  } 
    364405  else { 
  • freepbx/trunk/amp_conf/htdocs/recordings/includes/database.php

    r1066 r1395  
    2323   * Logs into database and returns database handle 
    2424   * 
     25 
     26   * @param $engine 
     27   *   database engine 
     28   * @param $dbfile 
     29   *   database file 
    2530   * @param $username 
    2631   *   username for database 
     
    2934   * @param $host 
    3035   *   database host 
    31    * @param $host 
    32    *   database host computer 
    3336   * @param $name 
    3437   *   database name 
    35    * @param $engine 
    36    *   database type 
    37    * @param $dbh 
     38   * @return $dbh 
    3839   *   variable to hold the returned database handle 
    3940   */ 
    40   function logon($username,$password,$host,$name,$engine,&$dbh) { 
     41  function logon($engine,$dbfile,$username,$password,$host,$name) { 
    4142 
    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    ); 
    4457     
    45     $dbh = DB::connect($datasource); // attempt connection 
     58    // attempt connection 
     59    $dbh = DB::connect($datasource,$options);  
    4660 
    4761    // if connection failed show error 
    4862    if(DB::isError($dbh)) { 
    4963      $_SESSION['ari_error'] .= $dbh->getMessage() . "<br><br>";  
    50       return false
     64      return
    5165    } 
    52     return true
     66    return $dbh
    5367  }  
    5468}  
  • freepbx/trunk/amp_conf/htdocs/recordings/includes/display.php

    r1150 r1395  
    8585    // build 
    8686    $ret .= "<div " . $alignText . "> 
    87                <form class='bar' action='" . $_SERVER['PHP_SELF'] . "' method='GET' name='search'> 
     87               <form class='bar' action='" . $_SESSION['ARI_ROOT'] . "' method='GET' name='search'> 
    8888                 <input type=hidden name=m value=" . $m . ">   
    8989                 <input type=text name=q size=40 value='" . $q . "' maxlength=256> 
     
    137137 
    138138    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>"; 
    140140    } else { 
    141141      $right_text = "<small><small>" . sprintf(_("Results %d"),$total) . "</small></small>"; 
     
    189189    } 
    190190 
    191     $url = $_SERVER['PHP_SELF'] . "?m=" . $m . "&q=" . $unicode_q . $option_text; 
     191    $url = $_SESSION['ARI_ROOT'] . "?m=" . $m . "&q=" . $unicode_q . $option_text; 
    192192 
    193193    // build 
  • freepbx/trunk/amp_conf/htdocs/recordings/includes/lang.php

    r1066 r1395  
    2929      $locale = 'en_US'; 
    3030      $locale_dir = "./locale"; 
    31       $directories = array(); 
    32       getdirectories($locale_dir,"",&$directories); 
     31      $directories = getdirectories($locale_dir,""); 
    3332      foreach($directories as $directory) { 
    3433        $buf = substr($directory,strlen($locale_dir)+1,strlen($directory) - strlen($locale_dir)); 
     
    4039 
    4140      // set locale 
    42       $language = $_COOKIE['ari_lang'] ? $_COOKIE['ari_lang']:$locale; 
     41      $language = isset($_COOKIE['ari_lang']) ? $_COOKIE['ari_lang'] : $locale; 
    4342      putenv("LANG=$language");  
    4443      putenv("LANGUAGE=$language"); 
     
    8887          } 
    8988        </script> 
    90         <form class='lang' name='lang' action=" . $_SERVER['PHP_SELF'] . " method='POST'> 
     89        <form class='lang' name='lang' action=" . $_SESSION['ARI_ROOT'] . " method='POST'> 
    9190          <select class='lang_code' name='lang_code'  onChange=\"setCookie('ari_lang',document.lang.lang_code.value); window.location.reload();\"> 
    9291            <option value='en_US' " . ($_COOKIE['ari_lang']=='en_US' ? 'selected' : '') .  ">English</option> 
  • freepbx/trunk/amp_conf/htdocs/recordings/includes/login.php

    r1066 r1395  
    3333    $crypt = new Crypt(); 
    3434 
     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 
    3551    // 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    } 
    3858    if (md5($data) == $chksum) { 
    3959      $data = unserialize($crypt->decrypt($data,$ARI_CRYPT_PASSWORD)); 
     
    7999 
    80100          $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 
    81125          foreach ($lines as $key => $line) { 
    82126 
     
    92136            // check for user and process 
    93137            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            } 
    95145            $var = trim($var); 
    96146            if ($var==$username && $value) { 
     
    167217 
    168218                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                } 
    172226                if ($var=="username") { 
    173227                  $protocol_username = $value; 
     
    228282 
    229283      // 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) { 
    231289 
    232290        $data = array('username' => $username, 'password' => $password); 
     
    257315      }  
    258316 
     317      // get outboundCID if it exists 
     318      $outboundCID = $this->getOutboundCID($extension); 
     319 
     320      // set 
    259321      if ($extension) { 
    260322        $_SESSION['ari_user']['extension'] = $extension; 
     323        $_SESSION['ari_user']['outboundCID'] = $outboundCID; 
    261324        $_SESSION['ari_user']['displayname'] = $displayname; 
    262325        $_SESSION['ari_user']['voicemail_password'] = $vm_password; 
     
    272335        $_SESSION['ari_user']['admin_callmonitor'] = $admin_callmonitor; 
    273336        $_SESSION['ari_user']['default_page'] = $default_page; 
     337 
     338        // force the session data saved 
     339        session_write_close(); 
    274340      }  
    275341    } 
    276342  }  
     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  } 
    277365 
    278366  /** 
     
    329417    $ret .= " 
    330418      <table id='login'> 
    331         <form id='login' name='login' action=" . $_SERVER['PHP_SELF'] . " method='POST'> 
     419        <form id='login' name='login' action=" . $_SESSION['ARI_ROOT'] . " method='POST'> 
    332420        " . $hiddenInputText . " 
    333421          <tr> 
  • freepbx/trunk/amp_conf/htdocs/recordings/includes/main.conf.php

    r1204 r1395  
    1616 
    1717# 
    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 
    1935#   Options: supported database types (others are supported, but not listed) 
    2036#     'mysql' - MySQL 
     
    2339#     'odbc' - ODBC 
    2440# 
    25 $ASTERISKMGR_DBHOST = "localhost"; 
    26 $ASTERISK_DBHOST = "localhost"; 
    27 $ASTERISK_DBNAME = "asterisk"; 
    28 $ASTERISK_DBTYPE = "mysql"; 
     41$ASTERISKCDR_DBENGINE = "mysql"; 
     42$ASTERISKCDR_DBFILE = ""; 
    2943$ASTERISKCDR_DBHOST = "localhost"; 
    3044$ASTERISKCDR_DBNAME = "asteriskcdrdb"; 
    31 $ASTERISKCDR_DBTYPE = "mysql"; 
    3245$ASTERISKCDR_DBTABLE = "cdr"; 
    3346 
     
    4154$STANDALONE['asterisk_mgruser'] = ""; 
    4255$STANDALONE['asterisk_mgrpass'] = ""; 
    43 $STANDALONE['asterisk_cdrdbuser'] = ""; 
    44 $STANDALONE['asterisk_cdrdbpass'] = ""; 
     56$STANDALONE['asteriskcdr_dbuser'] = ""; 
     57$STANDALONE['asteriskcdr_dbpass'] = ""; 
    4558 
    4659############################### 
     
    210223$ARI_HELP_FEATURE_CODES['*90'] = _("Call Forward on Busy"); 
    211224$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)"); 
    213226$ARI_HELP_FEATURE_CODES['*98'] = _("Enter Message Center"); 
    214227$ARI_HELP_FEATURE_CODES['*99'] = _("Playback IVR Recording");