Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit 8eea241

Browse files
ricventunedlosster
authored andcommitted
Hotfix which function (#12)
* fix function new_AsteriskManager in phpagi class * fix asmanager config reference * check if global $_ENV exists * fix a bug setting $chpath to $_ENV['PATH'] in function 'which'
1 parent 20fe79f commit 8eea241

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

phpagi-asmanager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class AGI_AsteriskManager
7878
* @access private
7979
* @var AGI
8080
*/
81-
private $pagi;
81+
public $pagi = false;
8282

8383
/**
8484
* Event Handlers

phpagi.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,9 +1549,9 @@ function say_punctuation($text, $escape_digits='', $frequency=8000)
15491549
*/
15501550
function &new_AsteriskManager()
15511551
{
1552-
$this->asm = new AGI_AsteriskManager(NULL, $this->config);
1552+
$this->asm = new AGI_AsteriskManager(NULL, $this->config['asmanager']);
15531553
$this->asm->pagi =& $this;
1554-
$this->config =& $this->asm->config;
1554+
$this->config['asmanager'] =& $this->asm->config['asmanager'];
15551555
return $this->asm;
15561556
}
15571557

@@ -1690,15 +1690,22 @@ function conlog($str, $vbl=1)
16901690
function which($cmd, $checkpath=NULL)
16911691
{
16921692
global $_ENV;
1693-
$chpath = is_null($checkpath) ? $_ENV['PATH'] : $checkpath;
1693+
1694+
if (is_null($checkpath)) {
1695+
if (isset($_ENV['PATH'])) {
1696+
$chpath = $_ENV['PATH'];
1697+
} else {
1698+
$chpath = '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:'.
1699+
'/usr/X11R6/bin:/usr/local/apache/bin:/usr/local/mysql/bin';
1700+
}
1701+
} else {
1702+
$chpath = $checkpath;
1703+
}
16941704

16951705
foreach(explode(':', $chpath) as $path)
16961706
if(is_executable("$path/$cmd"))
16971707
return "$path/$cmd";
16981708

1699-
if(is_null($checkpath))
1700-
return $this->which($cmd, '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:'.
1701-
'/usr/X11R6/bin:/usr/local/apache/bin:/usr/local/mysql/bin');
17021709
return false;
17031710
}
17041711

0 commit comments

Comments
 (0)