Changeset 2127

Show
Ignore:
Timestamp:
07/05/06 08:12:29 (7 years ago)
Author:
qldrob
Message:

New extensions.class.php from #946

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/admin/extensions.class.php

    r2101 r2127  
    295295} 
    296296 
     297class ext_gosub extends extension { 
     298  var $pri; 
     299  var $ext; 
     300  var $context; 
     301   
     302  function ext_gosub($pri, $ext = false, $context = false) { 
     303    if ($context !== false && $ext === false) { 
     304      trigger_error(E_ERROR, "\$ext is required when passing \$context in ext_gosub::ext_gosub()"); 
     305    } 
     306     
     307    $this->pri = $pri; 
     308    $this->ext = $ext; 
     309    $this->context = $context; 
     310  } 
     311   
     312  function incrementContents($value) { 
     313    $this->pri += $value; 
     314  } 
     315   
     316  function output() { 
     317    return 'Gosub('.($this->context ? $this->context.',' : '').($this->ext ? $this->ext.',' : '').$this->pri.')' ; 
     318  } 
     319} 
     320 
     321class ext_gosubif extends extension { 
     322  var $true_priority; 
     323  var $false_priority; 
     324  var $condition; 
     325  function ext_gosubif($condition, $true_priority, $false_priority = false) { 
     326    $this->true_priority = $true_priority; 
     327    $this->false_priority = $false_priority; 
     328    $this->condition = $condition; 
     329  } 
     330  function output() { 
     331    return 'GosubIf(' .$this->condition. '?' .$this->true_priority.($this->false_priority ? ':' .$this->false_priority : '' ). ')' ; 
     332  } 
     333  function incrementContents($value) { 
     334    $this->true_priority += $value; 
     335    $this->false_priority += $value; 
     336  } 
     337} 
     338 
    297339class ext_goto extends extension { 
    298340  var $pri; 
     
    610652  function output() { 
    611653    return "Pickup(".$this->data.")"; 
     654  } 
     655} 
     656class ext_lookupcidname extends extension { 
     657  function output() { 
     658    return "LookupCIDName"; 
     659  } 
     660} 
     661 
     662class ext_txtcidname extends extension { 
     663  var $cidnum; 
     664   
     665  function ext_txtcidname($cidnum) { 
     666    $this->cidnum = $cidnum; 
     667  } 
     668   
     669  function output() { 
     670    return "TXTCIDName(".$this->cidnum.")"; 
     671  } 
     672} 
     673 
     674class ext_mysql_connect extends extension { 
     675  var $connid; 
     676  var $dbhost; 
     677  var $dbuser; 
     678  var $dbpass; 
     679  var $dbname; 
     680   
     681  function ext_mysql_connect($connid, $dbhost, $dbuser, $dbpass, $dbname) { 
     682    $this->connid = $connid; 
     683    $this->dbhost = $dbhost; 
     684    $this->dbuser = $dbuser; 
     685    $this->dbpass = $dbpass; 
     686    $this->dbname = $dbname; 
     687  } 
     688   
     689  function output() { 
     690    return "MYSQL(Connect ".$this->connid." ".$this->dbhost." ".$this->dbuser." ".$this->dbpass." ".$this->dbname.")"; 
     691  } 
     692} 
     693 
     694class ext_mysql_query extends extension { 
     695  var $resultid; 
     696  var $connid; 
     697  var $query; 
     698   
     699  function ext_mysql_query($resultid, $connid, $query) { 
     700    $this->resultid = $resultid; 
     701    $this->connid = $connid; 
     702    $this->query = $query; 
     703    // Not escaping mysql query here, you may want to insert asterisk variables in it 
     704  } 
     705   
     706  function output() { 
     707    return 'MYSQL(Query '.$this->resultid.' ${'.$this->connid.'} '.$this->query.')'; 
     708  } 
     709} 
     710 
     711class ext_mysql_fetch extends extension { 
     712  var $fetchid; 
     713  var $resultid; 
     714  var $fars; 
     715   
     716  function ext_mysql_fetch($fetchid, $resultid, $vars) { 
     717    $this->fetchid = $fetchid; 
     718    $this->resultid = $resultid; 
     719    $this->vars = $vars; 
     720  } 
     721   
     722  function output() { 
     723    return 'MYSQL(Fetch '.$this->fetchid.' ${'.$this->resultid.'} '.$this->vars.')'; 
     724  } 
     725} 
     726 
     727class ext_mysql_clear extends extension { 
     728  var $resultid; 
     729   
     730  function ext_mysql_clear($resultid) { 
     731    $this->resultid = $resultid; 
     732  } 
     733   
     734  function output() { 
     735    return 'MYSQL(Clear ${'.$this->resultid.'})'; 
     736  } 
     737} 
     738 
     739class ext_mysql_disconnect extends extension { 
     740  var $connid; 
     741   
     742  function ext_mysql_disconnect($connid) { 
     743    $this->connid = $connid; 
     744  } 
     745   
     746  function output() { 
     747    return 'MYSQL(Disconnect ${'.$this->connid.'})'; 
     748  } 
     749} 
     750 
     751 
     752class ext_return extends extension { 
     753  function output() { 
     754    return "Return()"; 
     755  } 
     756} 
     757 
     758class ext_db_put extends extension { 
     759  var $family; 
     760  var $key; 
     761  var $value; 
     762   
     763  function ext_db_put($family, $key, $value) { 
     764    $this->family = $family; 
     765    $this->key = $key; 
     766    $this->value = $value; 
     767  } 
     768   
     769  function output() { 
     770    return 'Set(DB('.$this->family.'/'.$this->key.')='.$this->value.')'; 
    612771  } 
    613772}