Changeset 9580

Show
Ignore:
Timestamp:
05/03/10 08:37:37 (3 years ago)
Author:
mbrevda
Message:

re #4147; agi scrip/class improvments; hopefully sqlite3 support (untested)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.8/directory/agi-bin/directory.agi

    r9566 r9580  
    33require_once(dirname(__FILE__).'/directory.lib.php'); 
    44$loopcounter1=$loopcounter2=0; 
     5$matches=false; 
    56$search=array(); 
    67$dir=new Dir(); 
     
    2425  $matchesloop=0; 
    2526  $matches=$dir->search($search,1); 
    26 dbug('$matches',$matches); 
     27 
    2728  //prompt the caller for more info if there are too many results (and he didnt terminate with #) 
    2829  while($matches > 1 && $matchesloop < $dir->dir['repeat_loops'] && substr($search,-1)!='#'){ 
  • modules/branches/2.8/directory/agi-bin/directory.lib.php

    r9566 r9580  
    2929  //get agi handel/inital agi vars, called by __construct() 
    3030  function __construct_agi(){ 
    31     require_once('/var/lib/asterisk/agi-bin/phpagi.php');//todo: remove hardcoded path 
     31    require_once('phpagi.php'); 
    3232    $agi=new AGI(); 
    3333    foreach($agi->request as $key => $value){//strip agi_ prefix from keys 
    3434      if(substr($key,0,4)=='agi_'){ 
    35         $opts[str_replace('agi_','',$key)]=$value; 
     35        $opts[substr($key,4)]=$value; 
    3636      } 
    3737    } 
     
    5858  //get ami handel, called by __construct() 
    5959  function __construct_ami(){ 
    60     require_once($this->agi_get_var('ASTAGIDIR').'/phpagi-asmanager.php');//todo: remove hardcoded path 
     60    require_once('phpagi-asmanager.php'); 
    6161    $ami=new AGI_AsteriskManager(); 
    6262    return $ami; 
     
    6666  function __construct_db(){ 
    6767    require_once("DB.php"); 
    68     $dbhost=$this->agi_get_var('AMPDBHOST'); 
    69     $dbname=$this->agi_get_var('AMPDBNAME'); 
    70     $dbuser=$this->agi_get_var('AMPDBUSER'); 
    71     $dbpass=$this->agi_get_var('AMPDBPASS'); 
    72     $db=DB::connect('mysql://'.$dbuser.':'.$dbpass.'@'.$dbhost.'/'.$dbname); 
     68    $dsn=array( 
     69      'phptype'  => $this->agi_get_var('AMPDBENGINE'), 
     70      'hostspec' => $this->agi_get_var('AMPDBHOST'), 
     71      'database' => $this->agi_get_var('AMPDBNAME'), 
     72      'username' => $this->agi_get_var('AMPDBUSER'), 
     73      'password' => $this->agi_get_var('AMPDBPASS'), 
     74    ); 
     75    $db=DB::connect($dsn); 
    7376    return $db; 
    7477  }