Ticket #2594: blacklist_target.diff

File blacklist_target.diff, 3.7 kB (added by daniele.martini, 3 years ago)
  • uninstall.php

    old new  
    11<?php 
    22 
    33sql('DELETE FROM featurecodes WHERE modulename="blacklist"'); 
    4  
     4sql('DELETE FROM globals WHERE variable="BLACKLIST_DEST"'; 
    55needreload(); 
    66 
    77?> 
  • functions.inc.php

    old new  
    77        global $ext; 
    88        switch($engine) { 
    99                case "asterisk": 
     10                      $results = sql("SELECT value FROM globals WHERE variable='BLACKLIST_DEST'","getAll",DB_FETCHMODE_ASSOC); 
     11                      $row=$results[0]; 
     12                      $goto=$row['value'];           
    1013 
    1114                      $id = "app-blacklist"; 
    1215                      $ext->addInclude('from-internal-additional', $id); // Add the include from from-internal 
     
    1417                      $id = "app-blacklist-check"; 
    1518                      $c = "s"; 
    1619                      $ext->add($id, $c, '', new ext_lookupblacklist('')); 
    17                       $ext->add($id, $c, '', new ext_gotoif('$["${LOOKUPBLSTATUS}"="FOUND"]', 'blacklisted')); 
     20                      $ext->add($id, $c, '', new ext_gotoif('$["${LOOKUPBLSTATUS}"="FOUND"]', $goto)); 
    1821                      $ext->add($id, $c, '', new ext_return('')); 
    19                       $ext->add($id, $c, 'blacklisted', new ext_answer('')); 
    20                       $ext->add($id, $c, '', new ext_wait(1)); 
    21                       $ext->add($id, $c, '', new ext_zapateller('')); 
    22                       $ext->add($id, $c, '', new ext_playback('ss-noservice')); 
    23                       $ext->add($id, $c, '', new ext_hangup('')); 
    2422 
    2523                      $modulename = 'blacklist'; 
    2624 
     
    208206        return true; 
    209207} 
    210208 
     209function blacklist_setdestination($dest){ 
     210            global $amp_conf; 
     211            global $astman; 
     212            global $db; 
     213     
     214            sql("UPDATE globals SET value='".$dest."' WHERE variable='BLACKLIST_DEST')"); 
     215} 
     216 
    211217?> 
  • page.blacklist.php

    old new  
    1919 
    2020$dispnum = "blacklist"; //used for switch on config.php 
    2121 
     22if (isset($_REQUEST['goto0']) && isset($_REQUEST[$_REQUEST['goto0']."0"])) { 
     23            $goto = $_REQUEST[$_REQUEST['goto0']."0"]; 
     24} else{ 
     25            $results = sql("SELECT value FROM globals WHERE variable='BLACKLIST_DEST'","getAll",DB_FETCHMODE_ASSOC); 
     26            $row=$results[0]; 
     27            $goto=$row['value']; 
     28} 
     29 
    2230//if submitting form, update database 
    2331 
    2432if(isset($_REQUEST['action'])) { 
     
    3644                        blacklist_add($_POST); 
    3745                        redirect_standard('editnumber'); 
    3846                break; 
    39  
    40  
     47                case "setdestination": 
     48                        blacklist_setdestination($goto); 
     49                        needreload(); 
     50                        redirect_standard(); 
     51                break; 
    4152        } 
    4253} 
    4354 
     
    141152 
    142153 
    143154</form> 
     155 
     156<form autocomplete="off" name="edit" action="<?php $_SERVER['PHP_SELF'] ?>" method="post"> 
     157        <input type="hidden" name="action" value="setdestination"> 
     158         
     159        <table>  
     160        <tr> 
     161                <td colspan="2"><h5><?php echo _("Set Destination") ?><hr></h5></td> 
     162        </tr> 
     163         
     164        <?php echo drawselects($goto,0); ?> 
     165        <tr> 
     166        <td colspan="2"><br><h6><input name="submit" type="submit" value="<?php echo _("Submit Changes")?>"></h6></td> 
     167        </tr> 
     168        </table> 
     169</form> 
  • install.php

    old new  
    1616$fcc->setDefault('*32'); 
    1717$fcc->update(); 
    1818unset($fcc); 
     19 
     20sql("INSERT INTO globals VALUES('BLACKLIST_DEST','app-blackhole,zapateller,1')"); 
    1921?>