Changeset 7556
- Timestamp:
- 03/30/09 16:58:34 (4 years ago)
- Files:
-
- modules/branches/2.6/blacklist/functions.inc.php (modified) (2 diffs)
- modules/branches/2.6/blacklist/page.blacklist.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.6/blacklist/functions.inc.php
r7470 r7556 32 32 $id = "app-blacklist-check"; 33 33 $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 34 39 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')); 36 41 } else { 37 $ext->add($id, $c, ' ', new ext_lookupblacklist(''));42 $ext->add($id, $c, 'check', new ext_lookupblacklist('')); 38 43 $ext->add($id, $c, '', new ext_gotoif('$["${LOOKUPBLSTATUS}"="FOUND"]', 'blacklisted')); 39 44 } … … 224 229 if ($astman) { 225 230 $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 } 226 238 } else { 227 239 fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); modules/branches/2.6/blacklist/page.blacklist.php
r7470 r7556 76 76 <?php 77 77 // Why should I specify type=setup ??? 78 78 $filter_blocked = false; 79 79 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 } 87 92 } 88 93 … … 105 110 <span><?php echo _("Enter the number you want to block")?></span></a></td> 106 111 <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> 107 117 </tr> 108 118 … … 136 146 function edit_onsubmit() { 137 147 defaultEmptyOK = false; 138 if ( !isDialDigitsPlus(theForm.number.value))148 if (theForm.number.value && !isDialDigitsPlus(theForm.number.value)) 139 149 return warnInvalid(theForm.number, "Please enter a valid Number"); 140 150 return true;
