root/modules/branches/2.4/blacklist/page.blacklist.php

Revision 5197, 3.5 kB (checked in by p_lindheimer, 5 years ago)

Merged revisions 5186-5188,5192,5194-5196 via svnmerge from
http://svn.freepbx.org/modules/branches/2.3

........

r5186 | p_lindheimer | 2007-11-02 15:35:24 -0700 (Fri, 02 Nov 2007) | 1 line


#2411, #2402 - fix bug so editing a device does not logout the user, and add default_user field along with fix to macro-user-logoff so that default user information is retained when a user logs off, and fix issue that was allowing a blank extension to be created when javascript was disabled or bugs existed which would make extensions stop working on a system

........

r5187 | p_lindheimer | 2007-11-02 15:47:03 -0700 (Fri, 02 Nov 2007) | 1 line


#2359 deal with other special characters in fax did during fax processing

........

r5188 | p_lindheimer | 2007-11-02 15:57:34 -0700 (Fri, 02 Nov 2007) | 1 line


move Macro(user-callerid) to be called with each conf to accomodate future language settings

........

r5192 | p_lindheimer | 2007-11-02 18:04:40 -0700 (Fri, 02 Nov 2007) | 1 line


#2455 allow + and other valid dial digits

........

r5196 | p_lindheimer | 2007-11-03 09:33:45 -0700 (Sat, 03 Nov 2007) | 1 line


fix to r5186 (#2411, #2402): when editing device into a fixed device, reset user. When changing a device from a fixed to adhoc, reset user

........

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
Line 
1 <?php /* $Id */
2 //Copyright (C) 2006 Magnus Ullberg (magnus@ullberg.us)
3 //
4 //This program is free software; you can redistribute it and/or
5 //modify it under the terms of the GNU General Public License
6 //as published by the Free Software Foundation; either version 2
7 //of the License, or (at your option) any later version.
8 //
9 //This program is distributed in the hope that it will be useful,
10 //but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //GNU General Public License for more details.
13
14 isset($_REQUEST['action'])?$action = $_REQUEST['action']:$action='';
15
16 isset($_REQUEST['number'])?$number = $_REQUEST['number']:$number='';
17
18 isset($_REQUEST['editnumber'])?$editnumber = $_REQUEST['editnumber']:$editnumber='';
19
20 $dispnum = "blacklist"; //used for switch on config.php
21
22 //if submitting form, update database
23
24 if(isset($_REQUEST['action'])) {
25   switch ($action) {
26     case "add":
27       blacklist_add($_POST);
28       redirect_standard();
29     break;
30     case "delete":
31       blacklist_del($number);
32       redirect_standard();
33     break;
34                 case "edit":
35                         blacklist_del($editnumber);
36       blacklist_add($_POST);
37       redirect_standard('editnumber');
38                 break;
39
40
41   }
42 }
43
44 $numbers = blacklist_list();
45 ?>
46 </div>
47
48 <!-- NO rnav in this module -->
49
50
51 <div class="content">
52 <?php
53 if ($action == 'delete')
54   echo '<h3>'._("Blacklist entry").' '.$itemid.' '._("deleted").'!</h3>';
55
56 if (is_array($numbers)) {
57
58 ?>
59
60 <table cellpadding="5">
61         <tr>
62     <td colspan="4"><h5><?php echo _("Blacklist entries") ?><hr></h5></td>
63   </tr>
64
65   <tr>
66     <td><b><?php _("Number") ?></b></td>
67     <td>&nbsp;</td>
68     <td>&nbsp;</td>
69   </tr>
70
71 <?php
72 // Why should I specify type=setup ???
73
74   foreach ($numbers as $num)  {
75     print('<tr>');
76     printf('<td>%s</td>', $num);
77     printf('<td><a href="%s?type=setup&display=%s&number=%s&action=delete">%s</a></td>',
78       $_SERVER['PHP_SELF'], urlencode($dispnum), urlencode($num), _("Delete"));
79     printf('<td><a href="#" onClick="theForm.number.value = \'%s\'; theForm.editnumber.value = \'%s\' ; theForm.action.value = \'edit\' ; ">%s</a></td>',
80       $num, $num, _("Edit"));
81     print('</tr>');
82   }
83
84   print('</table>');
85 }
86
87 ?>
88
89
90 <form autocomplete="off" name="edit" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return edit_onsubmit();">
91   <input type="hidden" name="display" value="<?php echo $dispnum?>">
92   <input type="hidden" name="action" value="add">
93   <input type="hidden" name="editnumber" value="">
94
95   <table>
96   <tr><td colspan="2"><h5><?php echo _("Add or replace entry") ?><hr></h5></td></tr>
97
98         <tr>
99                 <td><a href="#" class="info"><?php echo _("Number:")?>
100                 <span><?php echo _("Enter the number you want to block")?></span></a></td>
101                 <td><input type="text" name="number"></td>
102         </tr>
103
104   <tr>
105     <td colspan="2"><br><h6><input name="submit" type="submit" value="<?php echo _("Submit Changes")?>"></h6></td>
106   </tr>
107   </table>
108 <script language="javascript">
109 <!--
110
111 var theForm = document.edit;
112 theForm.number.focus();
113
114 function isDialDigitsPlus(s)
115 {
116   var i;
117
118   if (isEmpty(s)) {
119     return false;
120   }
121
122   for (i = 0; i < s.length; i++) {
123     var c = s.charAt(i);
124
125     if (!isDialDigitChar(c) && (c != "+")) return false;
126   }
127   return true;
128 }
129
130
131 function edit_onsubmit() {
132   defaultEmptyOK = false;
133         if (!isDialDigitsPlus(theForm.number.value))
134                 return warnInvalid(theForm.number, "Please enter a valid Number");
135   return true;
136 }
137
138
139 -->
140 </script>
141
142
143 </form>
Note: See TracBrowser for help on using the browser.