Changeset 7556

Show
Ignore:
Timestamp:
03/30/09 16:58:34 (4 years ago)
Author:
ethans
Message:

Added support for Unknown/Blocked CID

Files:

Legend:

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

    r7470 r7556  
    3232          $id = "app-blacklist-check"; 
    3333          $c = "s"; 
     34          // LookupBlackList doesn't seem to match empty astdb entry for "blacklist/", so we  
     35          // need to check for the setting and if set, send to the blacklisted area 
     36                      $ext->add($id, $c, '', new ext_gotoif('$["${CALLERID(number)}" = ""]','check-blocked','checked')); 
     37                      $ext->add($id, $c, 'check-blocked', new ext_gotoif('$["${DB(blacklist/blocked)}" = "1"]','blacklisted')); 
     38 
    3439                      if (version_compare($version, "1.6", "ge")) { 
    35                              $ext->add($id, $c, '', new ext_gotoif('$["${BLACKLIST()}"="1"]', 'blacklisted')); 
     40                             $ext->add($id, $c, 'check', new ext_gotoif('$["${BLACKLIST()}"="1"]', 'blacklisted')); 
    3641                      } else { 
    37                              $ext->add($id, $c, '', new ext_lookupblacklist('')); 
     42                             $ext->add($id, $c, 'check', new ext_lookupblacklist('')); 
    3843                             $ext->add($id, $c, '', new ext_gotoif('$["${LOOKUPBLSTATUS}"="FOUND"]', 'blacklisted')); 
    3944                      } 
     
    224229  if ($astman) { 
    225230    $astman->database_put("blacklist",$number, '1'); 
     231    // Remove filtering for blocked/unknown cid 
     232    $astman->database_del("blacklist","blocked"); 
     233    // Add it back if it's checked 
     234    if($post['blocked'] == "1")  { 
     235      $astman->database_put("blacklist","blocked", "1"); 
     236      needreload(); 
     237    } 
    226238  } else { 
    227239    fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 
  • modules/branches/2.6/blacklist/page.blacklist.php

    r7470 r7556  
    7676<?php 
    7777// Why should I specify type=setup ??? 
    78  
     78  $filter_blocked = false; 
    7979  foreach ($numbers as $num)  { 
    80     print('<tr>'); 
    81     printf('<td>%s</td>', $num); 
    82     printf('<td><a href="%s?type=setup&display=%s&number=%s&action=delete">%s</a></td>',  
    83       $_SERVER['PHP_SELF'], urlencode($dispnum), urlencode($num), _("Delete")); 
    84     printf('<td><a href="#" onClick="theForm.number.value = \'%s\'; theForm.editnumber.value = \'%s\' ; theForm.action.value = \'edit\' ; ">%s</a></td>', 
    85       $num, $num, _("Edit")); 
    86     print('</tr>'); 
     80    if($num == "blocked")  { // Don't display the blocked/unknown CID as an item, but keep track of it for displaying the checkbox later 
     81      $filter_blocked = true; 
     82    } 
     83    else  { 
     84     
     85      print('<tr>'); 
     86      printf('<td>%s</td>', $num); 
     87      printf('<td><a href="%s?type=setup&display=%s&number=%s&action=delete">%s</a></td>',  
     88        $_SERVER['PHP_SELF'], urlencode($dispnum), urlencode($num), _("Delete")); 
     89      printf('<td><a href="#" onClick="theForm.number.value = \'%s\'; theForm.editnumber.value = \'%s\' ; theForm.action.value = \'edit\' ; ">%s</a></td>',$num, $num, _("Edit")); 
     90      print('</tr>'); 
     91    } 
    8792  } 
    8893 
     
    105110                <span><?php echo _("Enter the number you want to block")?></span></a></td> 
    106111                <td><input type="text" name="number"></td> 
     112        </tr> 
     113        <tr> 
     114                <td><a href="#" class="info"><?php echo _("Block Unknown/Blocked Caller ID:")?> 
     115                <span><?php echo _("Check here to catch Unknown/Blocked Caller ID")?></span></a></td> 
     116                <td><input type="checkbox" name="blocked" value="1" <? echo ($filter_blocked === true?" checked":"");?></td> 
    107117        </tr> 
    108118 
     
    136146function edit_onsubmit() { 
    137147  defaultEmptyOK = false; 
    138         if (!isDialDigitsPlus(theForm.number.value)) 
     148        if (theForm.number.value && !isDialDigitsPlus(theForm.number.value)) 
    139149                return warnInvalid(theForm.number, "Please enter a valid Number"); 
    140150  return true;