Changeset 10372

Show
Ignore:
Timestamp:
10/06/10 13:40:56 (3 years ago)
Author:
mickecarlsson
Message:

Revert r10371, should have been 2.9. Sorry

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.8/blacklist/functions.inc.php

    r10371 r10372  
    1616// 
    1717//  Copyright (C) 2006 Magnus Ullberg (magnus@ullberg.us) 
    18 //  Portions Copyright (C) 2010 Mikael Carlsson (mickecamino@gmail.com) 
    1918// 
    2019 
     
    2625  global $version; 
    2726  global $astman; 
    28  
    2927  switch($engine) { 
    3028    case "asterisk": 
     
    4644        $ext->add($id, $c, 'check-blocked', new ext_gotoif('$["${DB(blacklist/blocked)}" = "1"]','blacklisted')); 
    4745      } 
    48        
     46 
    4947      if (version_compare($version, "1.6", "ge")) { 
    5048        $ext->add($id, $c, 'check', new ext_gotoif('$["${BLACKLIST()}"="1"]', 'blacklisted')); 
     
    5351        $ext->add($id, $c, '', new ext_gotoif('$["${LOOKUPBLSTATUS}"="FOUND"]', 'blacklisted')); 
    5452      } 
    55          $ext->add($id, $c, '', new ext_setvar('CALLED_BLACKLIST','1')); 
     53      $ext->add($id, $c, '', new ext_setvar('CALLED_BLACKLIST','1')); 
    5654      $ext->add($id, $c, '', new ext_return('')); 
    5755      $ext->add($id, $c, 'blacklisted', new ext_answer('')); 
     
    213211  global $astman; 
    214212 
    215 $engineinfo = engine_getinfo(); 
    216 $astver =  $engineinfo['version']; 
    217213        if ($astman) { 
    218     $list = $astman->database_show('blacklist'); 
    219     if(version_compare($astver, "1.6", "ge")) { 
    220         foreach ($list as $k => $v) { 
    221       $numbers = substr($k, 11); 
    222       $blacklisted[] = array('number' => $numbers, 'description' => $v); 
    223       } 
    224         if (isset($blacklisted) && is_array($blacklisted)) 
    225       // Why this sorting? When used it does not yield the result I want 
    226       //    natsort($blacklisted); 
    227         return isset($blacklisted)?$blacklisted:null; 
    228     } else { 
    229         foreach ($list as $k => $v) { 
    230       $numbers[substr($k, 11)] = substr($k, 11); 
    231       } 
    232       if (isset($numbers) && is_array($numbers)) 
    233           natcasesort($numbers); 
    234       return isset($numbers)?$numbers:null; 
    235       } 
     214    $list = $astman->database_show(); 
     215    foreach ($list as $k => $v) { 
     216      if (substr($k, 1, 9) == 'blacklist') 
     217      { 
     218        $numbers[substr($k, 11)] = substr($k, 11); 
     219      } 
     220    } 
     221 
     222    if (isset($numbers) && is_array($numbers)) 
     223      natcasesort($numbers); 
     224 
     225    return isset($numbers)?$numbers:null; 
    236226        } else { 
    237227                fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 
     
    242232  global $amp_conf; 
    243233  global $astman; 
     234 
    244235  if ($astman) { 
    245236    $astman->database_del("blacklist",$number); 
     
    253244  global $astman; 
    254245 
    255 $engineinfo = engine_getinfo(); 
    256 $astver =  $engineinfo['version']; 
    257  
    258246  if(!blacklist_chk($post)) 
    259247    return false; 
     
    261249  extract($post); 
    262250  if ($astman) { 
    263     if (version_compare($astver, "1.6", "ge")) { 
    264     $post['description']==""?$post['description'] = '1':$post['description']; 
    265     $astman->database_put("blacklist",$post['number'], '"'.$post['description'].'"'); 
    266         } else { 
    267               $astman->database_put("blacklist",$number, '1'); 
    268               } 
     251    $astman->database_put("blacklist",$number, '1'); 
    269252    // Remove filtering for blocked/unknown cid 
    270253    $astman->database_del("blacklist","blocked"); 
  • modules/branches/2.8/blacklist/page.blacklist.php

    r10371 r10372  
    1515//    along with FreePBX.  If not, see <http://www.gnu.org/licenses/>. 
    1616// 
    17 //    Copyright (C) 2006 Magnus Ullberg (magnus@ullberg.us) 
    18 //    Portions Copyright (C) 2010 Mikael Carlsson (mickecamino@gmail.com) 
     17//Copyright (C) 2006 Magnus Ullberg (magnus@ullberg.us) 
    1918// 
     19isset($_REQUEST['action'])?$action = $_REQUEST['action']:$action=''; 
    2020 
    21 $engineinfo = engine_getinfo(); 
    22 $astver =  $engineinfo['version']; 
    23  
    24 isset($_REQUEST['action'])?$action = $_REQUEST['action']:$action=''; 
    2521isset($_REQUEST['number'])?$number = $_REQUEST['number']:$number=''; 
    26  
    27 if(version_compare($astver, "1,6", "ge")) { 
    28     isset($_REQUEST['description'])?$description = $_REQUEST['description']:$description=''; 
    29     } 
    3022 
    3123isset($_REQUEST['editnumber'])?$editnumber = $_REQUEST['editnumber']:$editnumber=''; 
    3224 
    3325$dispnum = "blacklist"; //used for switch on config.php 
    34      
     26 
    3527//if submitting form, update database 
    3628 
     
    5042      redirect_standard('editnumber'); 
    5143                break; 
     44 
     45 
    5246  } 
    5347} 
     
    7569 
    7670  <tr> 
    77      
    78   <?php 
    79   if(version_compare($astver, "1,6", "ge")) { 
    80       echo "<td><b>"._("Number")."</b></td>"; 
    81       echo "<td><b>"._("Description")."</b></td>"; 
    82     } else { 
    83     echo "<td><b>"._("Number")."</b></td>"; 
    84     echo "<td>&nbsp;</td>"; 
    85       } 
    86 ?>     
    87     <td>&nbsp;</td>    
     71    <td><b><?php echo _("Number") ?></b></td> 
     72    <td>&nbsp;</td> 
     73    <td>&nbsp;</td> 
    8874  </tr> 
    8975 
     
    9783    else  { 
    9884     
    99                 if(version_compare($astver, "1,6", "ge")) { 
    100       print('<tr>'); 
    101       printf('<td>%s</td>', $num['number']); 
    102           printf('<td>%s</td>', $num['description']); 
    103       printf('<td><a href="%s?type=setup&display=%s&number=%s&action=delete">%s</a></td>',  
    104         $_SERVER['PHP_SELF'], urlencode($dispnum), urlencode($num['number']), _("Delete")); 
    105       printf('<td><a href="#" onClick="theForm.number.value = \'%s\';  
    106         theForm.editnumber.value = \'%s\' ; 
    107         theForm.description.value = \'%s\';  
    108         theForm.editdescription.value = \'%s\' ;  
    109         theForm.action.value = \'edit\' ; ">%s</a></td>',$num['number'], $num['number'], $num['description'], $num['description'], _("Edit")); 
    110       print('</tr>'); 
    111        
    112       } else { 
    11385      print('<tr>'); 
    11486      printf('<td>%s</td>', $num); 
    115               printf('<td>%s</td>', $description); 
    11687      printf('<td><a href="%s?type=setup&display=%s&number=%s&action=delete">%s</a></td>',  
    11788        $_SERVER['PHP_SELF'], urlencode($dispnum), urlencode($num), _("Delete")); 
    11889      printf('<td><a href="#" onClick="theForm.number.value = \'%s\'; theForm.editnumber.value = \'%s\' ; theForm.action.value = \'edit\' ; ">%s</a></td>',$num, $num, _("Edit")); 
    11990      print('</tr>'); 
    120       } 
    12191    } 
    12292  } 
     93 
    12394  print('</table>'); 
    12495} 
     96 
    12597?> 
     98 
    12699 
    127100<form autocomplete="off" name="edit" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return edit_onsubmit();"> 
     
    130103  <input type="hidden" name="editnumber" value=""> 
    131104 
    132   <?php if(version_compare($astver, "1,6", "ge")) { 
    133           echo "<input type=\"hidden\" name=\"editdescripton\" value=\"\">"; 
    134       }?> 
    135105  <table> 
    136106  <tr><td colspan="2"><h5><?php echo _("Add or replace entry") ?><hr></h5></td></tr> 
    137107 
    138108        <tr> 
    139    <td><a href="#" class="info"><?php echo _("Number:")?> 
    140    <span><?php echo _("Enter the number you want to block")?></span></a></td> 
     109                <td><a href="#" class="info"><?php echo _("Number:")?> 
     110                <span><?php echo _("Enter the number you want to block")?></span></a></td> 
    141111                <td><input type="text" name="number"></td> 
    142112        </tr> 
    143         <?php if(version_compare($astver, "1,6", "ge")) { 
    144         echo "<tr>"; 
    145                 echo "<td><a href=\"#\" class=\"info\">"._("Description:"); 
    146                 echo "<span>"._("Enter a description for the number you want to block")."</span></a></td>"; 
    147                 echo "<td><input type=\"text\" name=\"description\"></td>"; 
    148         echo "</tr>";         
    149       }?> 
    150  
    151113        <tr> 
    152114                <td><a href="#" class="info"><?php echo _("Block Unknown/Blocked Caller ID:")?>