This repository has been archived by the owner on Oct 31, 2021. It is now read-only.
forked from FreePBX/superfecta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
page.superfecta.php
532 lines (495 loc) · 23.4 KB
/
page.superfecta.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
<?php
// Superfecta code maintained by forummembers at PBXIAF.
// Development SVN is at projects.colsolgrp.net
// Caller ID Tricfecta / Superfecta was invented by Ward Mundy,
// based on another authors work.
//
// v 1.0.0 - 1.1.0 Created / coded by Tony Shiffer
// V 2.0.0 - 2.20 Principle developer Jeremy Jacobs
// v 2.2.1 Significant development by Patrick ELX
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
$scheme = (isset($_REQUEST['scheme'])) ? $_REQUEST['scheme'] : '';
$module_info = xml2array("modules/superfecta/module.xml");
if(count($_POST))
{
setConfig();
$scheme = (($_POST['scheme_name_orig'] == '') && ($_POST['scheme_name'] != '')) ? 'base_'.$_POST['scheme_name'] : '';
}
$schemeup = (isset($_REQUEST['schemeup'])) ? $_REQUEST['schemeup'] : '';
$schemedown = (isset($_REQUEST['schemedown'])) ? $_REQUEST['schemedown'] : '';
$schemedelete = (isset($_REQUEST['schemedelete'])) ? $_REQUEST['schemedelete'] : '';
$schemecopy = (isset($_REQUEST['schemecopy'])) ? $_REQUEST['schemecopy'] : '';
$schemeonoff = (isset($_REQUEST['schemeonoff'])) ? $_REQUEST['schemeonoff'] : '';
//change the order of the list if requested.
if($schemeup != "")
{
$sql = "SELECT ABS(value) FROM superfectaconfig WHERE source = '$schemeup' AND field = 'order'";
$results= sql($sql, "getAll");
//update positive numbers
$sql = "UPDATE superfectaconfig SET value = ".$results[0][0]." WHERE field = 'order' AND value = ".($results[0][0] - 1);
sql($sql);
$sql = "UPDATE superfectaconfig SET value = (value - 1) WHERE field = 'order' AND value > 0 AND source = '$schemeup'";
sql($sql);
//update negative numbers
$sql = "UPDATE superfectaconfig SET value = -".$results[0][0]." WHERE field = 'order' AND value = -".($results[0][0] - 1);
sql($sql);
$sql = "UPDATE superfectaconfig SET value = (value + 1) WHERE field = 'order' AND value < 0 AND source = '$schemeup'";
sql($sql);
}
if($schemedown != "")
{
$sql = "SELECT ABS(value) FROM superfectaconfig WHERE source = '$schemedown' AND field = 'order'";
$results= sql($sql, "getAll");
//update positive numbers
$sql = "UPDATE superfectaconfig SET value = ".$results[0][0]." WHERE field = 'order' AND value = ".($results[0][0] + 1);
sql($sql);
$sql = "UPDATE superfectaconfig SET value = (value + 1) WHERE field = 'order' AND value > 0 AND source = '$schemedown'";
sql($sql);
//update negative numbers
$sql = "UPDATE superfectaconfig SET value = -".$results[0][0]." WHERE field = 'order' AND value = -".($results[0][0] + 1);
sql($sql);
$sql = "UPDATE superfectaconfig SET value = (value - 1) WHERE field = 'order' AND value < 0 AND source = '$schemedown'";
sql($sql);
}
//delete scheme if requested.
if($schemedelete != "")
{
$sql = "SELECT ABS(value) FROM superfectaconfig WHERE source = '$schemedelete' AND field = 'order'";
$results= sql($sql, "getAll");
$sql = "UPDATE superfectaconfig SET value = (value - 1) WHERE field = 'order' AND value > ".$results[0][0];
sql($sql);
$sql = "UPDATE superfectaconfig SET value = (value + 1) WHERE field = 'order' AND value < -".$results[0][0];
sql($sql);
$sql = "DELETE FROM superfectaconfig WHERE source = '$schemedelete'";
sql($sql);
}
//turn scheme on or off.
if($schemeonoff != "")
{
$sql = "UPDATE superfectaconfig SET value = (value * -1) WHERE field = 'order' AND source = '$schemeonoff'";
sql($sql);
}
//create a copy of a scheme if requested
if($schemecopy != "")
{
//determine the highest order amount.
$query = "SELECT MAX(ABS(value)) FROM superfectaconfig WHERE field = 'order'";
$results= sql($query, "getAll");
$new_order = $results[0][0] + 1;
//set new scheme name
$name_good = false;
$new_name = $schemecopy.' copy';
$new_name_count = 2;
while(!$name_good)
{
$query = "SELECT * FROM superfectaconfig WHERE source = '".$new_name."'";
$results= sql($query, "getAll");
if(empty($results[0][0]))
{
$name_good = true;
}
else
{
if(substr($new_name,-4) == 'copy')
{
$new_name .= ' '.$new_name_count;
}
else
{
$new_name = substr($new_name,0,-2).' '.$new_name_count;
}
$new_name_count++;
}
}
//copy data from existing scheme into new scheme
$query = "SELECT field,value FROM superfectaconfig WHERE source = '".$schemecopy."'";
$results= sql($query, "getAll");
foreach($results as $val)
{
if(!empty($val))
{
if($val[0] == 'order')
{
$val[1] = $new_order;
}
$query = "REPLACE INTO superfectaconfig (source,field,value) VALUES('".$new_name."','$val[0]','$val[1]')";
sql($query);
}
}
$query = "SELECT source,field,value FROM superfectaconfig WHERE source LIKE '".substr($schemecopy,5)."\\_%'";
$results= sql($query, "getAll");
foreach($results as $val)
{
if(!empty($val))
{
$new_name_source = substr($new_name,5).substr($val[0],strlen(substr($schemecopy,5)));
$query = "REPLACE INTO superfectaconfig (source,field,value) VALUES('$new_name_source','$val[1]','$val[2]')";
sql($query);
}
}
$scheme = $new_name;
}
$sql = "SELECT source, value FROM superfectaconfig WHERE source LIKE 'base_%' AND field = 'order' ORDER BY ABS(value)";
$results= sql($sql, "getAll");
print '<div class="rnav" style="width:250px;">
<ul>
<li><a href="config.php?display=superfecta&scheme=new">Add Caller ID Scheme</a></li>';
$count = 1;
foreach($results as $val)
{
print '<li><img style="float: left; margin: 4px 1px 0px 1px;" class="button" onmouseover="this.style.cursor=\'pointer\';" onclick="window.location.href=\'config.php?display=superfecta&schemeonoff='.$val[0].'\'" src="modules/superfecta/on_off.gif" alt="On/Off" title="Turn this scheme on and off">';
if($count < count($results))
{
print '<img style="float: left; margin: 4px 1px 0px 1px;" class="button" onmouseover="this.style.cursor=\'pointer\';" onclick="window.location.href=\'config.php?display=superfecta&schemedown='.$val[0].'\'" src="images/scrolldown.gif" alt="Down Arrow" title="Move Down List">';
}
else
{
print '<div style="width: 11px; float: left; height: 5px;"></div>';
}
if(($count > 1) && (count($results) > 1))
{
print '<img style="float: left; margin: 4px 1px 0px 1px;" class="button" onmouseover="this.style.cursor=\'pointer\';" onclick="window.location.href=\'config.php?display=superfecta&schemeup='.$val[0].'\'" src="images/scrollup.gif" alt="Up Arrow" title="Move Up List">';
}
else
{
print '<div style="width: 11px; float: left; height: 5px;"></div>';
}
print '<img style="float: left; margin: 4px 1px 0px 1px;" class="button" onmouseover="this.style.cursor=\'pointer\';" onclick="window.location.href=\'config.php?display=superfecta&schemecopy='.$val[0].'\'" src="modules/superfecta/copy.gif" alt="Duplicate Scheme" title="Duplicate Scheme">
<img style="float: left; margin: 4px 1px 0px 1px;" class="button" onmouseover="this.style.cursor=\'pointer\';" onclick="decision(\'Are you sure you want to delete this Scheme?\',\'config.php?display=superfecta&schemedelete='.$val[0].'\');" src="modules/superfecta/delete.gif" alt="Delete Button" title="Delete Scheme">
<a href="config.php?display=superfecta&scheme='.$val[0].'" style="float: left;">';
if($val[1] > 0)
{
print substr($val[0],5);
}
else
{
print '<font color="#ff3c3c">'.substr($val[0],5).'</font>';
}
print '</a> </li>';
$count++;
}
print '</ul>
</div>
<h1><font face="Arial">Caller ID Superfecta</font></h1>
<hr>
<p>CallerID Superfecta for FreePBX is a utility program which adds incoming CallerID name lookups to your Asterisk system using multiple data sources.<br><br> Add, Remove, Enable, Disable, Sort and Configure data sources as appropriate for your situation.<br>
<strong><font size=2><br>NOTE:</strong> If your telephones are receiving Caller ID information that looks like this:<strong>"<!DOCTYPE HTML" </strong>, make sure you have specified the username and password in "General Options", below.</font></p>';
if($scheme != "")
{
$conf = getConfig($scheme);
if (isset($conf['DID']) && (strlen(trim($conf['DID'])))){
$did_test_html = '<a href="javascript:return(false);" class="info">DID Number:<span>DID number to test this scheme against</span></a> <input type="text" size="15" maxlength="20" name="testdid"><br>';
$did_test_script = 'document.forms.debug_form.testdid.value,';
} else {
$did_test_html = '';
$did_test_script = "'',";
}
print '<h2><u>Data Sources</u></h2>
<p>Select which data source(s) to use for your lookups, and the order in which you want them used:</p>
<form method="POST" action="javascript:Ht_Generate_List(\'\',\''.$scheme.'\');" name="CIDSources">
<div id="CIDSourcesList"></div>
<br><br>
</form>
<table border="0">
<tr>
<td valign="top">
<form method="POST" action="" name="Superfecta">
<input type="hidden" name="scheme_name_orig" value="'.substr($scheme,5).'">
<table border="0" id="table1" cellspacing="1">
<tr>
<td><a href="javascript:return(false);" class="info"><strong>Scheme Name:</strong><span>Duplicate Scheme names not allowed.</span></a></td>
<td><input type="text" name="scheme_name" size="23" maxlength="20" value="'.substr($scheme,5).'"></td>
</tr>
<tr>
<td valign="top"><a href="javascript:return(false);" class="info">DID Rules<span>Define the expected DID Number if your trunk passes DID on incoming calls. <br><br>Leave this blank to match calls with any or no DID info.<br><br>This rule trys both absolute and pattern matching (eg "_2[345]X", to match a range of numbers). (The "_" underscore is optional.)</span></a>:</td>
<td>
<textarea tabindex="1" cols="20" rows="5" name="DID">'.(isset($conf['DID']) ? $conf['DID'] : '' ).'</textarea>
</td>
</tr>
<tr>
<td valign="top">
<a href="javascript:return(false);" class="info">CID Rules<span>Incoming calls with CID matching the patterns specified here will use this CID Scheme. If this is left blank, this scheme will be used for any CID. It can be used to add or remove prefixes.<br>
<strong>Many sources require a specific number of digits in the phone number. It is recommended that you use the patterns to remove excess country code data from incoming CID to increase the effectiveness of this module.</strong><br>
Note that a pattern without a + or | (to add or remove a prefix) will not make any changes but will create a match. Only the first matched pattern will be executed and the remaining rules will not be acted on.<br /><br /><b>Rules:</b><br />
<strong>X</strong> matches any digit from 0-9<br />
<strong>Z</strong> matches any digit from 1-9<br />
<strong>N</strong> matches any digit from 2-9<br />
<strong>[1237-9]</strong> matches any digit or letter in the brackets (in this example, 1,2,3,7,8,9)<br />
<strong>.</strong> wildcard, matches one or more characters (not allowed before a | or +)<br />
<strong>|</strong> removes a dialing prefix from the number (for example, 613|NXXXXXX would match when some one dialed "6135551234" but would only pass "5551234" to the Superfecta look up.)<br><strong>+</strong> adds a dialing prefix to the number (for example, 1613+NXXXXXX would match when someone dialed "5551234" and would pass "16135551234" to the Superfecta look up.)<br /><br />
You can also use both + and |, for example: 01+0|1ZXXXXXXXXX would match "016065551234" and dial it as "0116065551234" Note that the order does not matter, eg. 0|01+1ZXXXXXXXXX does the same thing.</span></a>:
</td>
<td valign="top">
<textarea tabindex="2" id="dialrules" cols="20" rows="5" name="CID_rules">'.(isset($conf['CID_rules']) ? $conf['CID_rules'] : '' ).'</textarea>
</td>
</tr>
<tr>
<td colspan="2"><font face="Arial"><br><u>General Options</font></u></td>
</tr>
<tr>
<td><a href="javascript:return(false);" class="info">Username:<span>The HTTP Authentication username (you probably used it to get to this page.)</span></a></td>
<td><input type="text" name="http_username" size="23" maxlength="20" value="'.utf8_encode($conf['http_username']).'"></td>
</tr>
<tr>
<td><a href="javascript:return(false);" class="info">Password:<span>The HTTP Authentication password (you probably used it to get to this page.)</span></a></td>
<td><input type="password" name="http_password" size="23" maxlength="20" value="'.utf8_encode($conf['http_password']).'"></td>
</tr>
<tr>
<td><a href="javascript:return(false);" class="info">Cache results to Asterisk Address Book:<span>This option should be disabled for proper Superfecta operation</span></a></td>
<td><input type="text" name="cache" size="23" maxlength="20" value="'.utf8_encode($conf['cache']).'"></td>
</tr>
<tr>
<td><a href="javascript:return(false);" class="info">Lookup Timeout<span>Specify a timeout in seconds for each source. If the source fails to return a result within the alloted time, the script will move on.</span></a></td>
<td><input type="text" name="Curl_Timeout" size="4" maxlength="5" value="'.$conf['Curl_Timeout'].'"></td>
</tr>
<tr>
<td><a href="javascript:return(false);" class="info">SPAM Text<span>This text will be prepended to Caller ID information to help you identify calls as SPAM calls.</span></a></td>
<td><input type="text" name="SPAM_Text" size="23" maxlength="20" value="'.$conf['SPAM_Text'].'"></td>
</tr>
<tr>
<td><a href="javascript:return(false);" class="info">SPAM Text Substituted<span>When enabled, the text entered in "SPAM Text" (above) will replace the CID completely rather than pre-pending the CID value.</span></a></td>
<td>
<input type="checkbox" name="SPAM_Text_Substitute" value="Y"' . ( ( (isset($conf['SPAM_Text_Substitute'])) && ($conf['SPAM_Text_Substitute'] == 'Y') ) ? 'checked' : '' ) . '>
</td>
</tr>
<tr>
<td><a href="javascript:return(false);" class="info">CID Prefix URL<span>If you wish to prefix information on the caller id you can specify a url here where that prefix can be retrieved.<br>The data will not be parsed in any way, and will be truncated to the first 10 characters.<br>Example URL: http://www.example.com/GetCID.php?phone_number=[thenumber]<br>[thenumber] will be replaced with the full 10 digit phone number when the URL is called.</span></a></td>
<td><input type="text" name="Prefix_URL" size="23" maxlength="255" value="'.(isset($conf['Prefix_URL'])? $conf['Prefix_URL'] : '' ).'"></td>
</tr>
</table>
<p><a target="_blank" href="modules/superfecta/disclaimer.html">(License Terms) </a><input type="submit" value="Agree and Save" name="Save"></p>
<p style="font-size:12px;">(* By clicking on either the "Agree and Save"<br>button, or the "Debug" button on this form<br>you are agreeing to the Caller ID Superfecta<br>Licensing Terms.)</p>
</form>
</td>
<td valign="top">
<form name="debug_form"
action="javascript:Ht_debug(document.forms.debug_form.thenumber.value,'.$did_test_script.'document.forms.debug_form.Allscheme.checked);">
<p>Test a phone number against the selected sources.<br>
'.$did_test_html.'
<a href="javascript:return(false);" class="info">Phone Number:<span>Phone number to test this scheme against.</span></a> <input type="text" size="15" maxlength="20" name="thenumber"> <input type="submit" value="Debug"><br>
<font size=2><input type="checkbox" name="Allscheme" value="All">
<a href="javascript:return(false);" class="info">Test all CID schemes<span>When enabled, the debug function will test the number entered against all of the configured CID schemes.<br>When disabled, debug only checks up to the first scheme that provides positive results.</span></a></font></p>
</form>
<div id="debug" style="background-color: #E0E0E0; width:100%"></div>
</td>
</tr>
</table>
<script language="javascript">
<!--
';
//prompt the user if they have use http authentication to get to this page, but don't have that information specified in the fields
if(isset($_SERVER["REMOTE_USER"]))
{
if(($_SERVER["REMOTE_USER"] != '') && ($conf['http_username'] == ''))
{
//javascript alert the user that they are logged in using authentication and should probably fill out the fields in this form.
//also focus on the username form element.
print 'document.forms.Superfecta.http_username.focus();';
print 'alert("You are currently using HTTP Authentication with a username of '.$_SERVER["REMOTE_USER"].'. You should probably fill in the username and password portion (In the General Options section) of this form to ensure proper operation of Caller ID Superfecta.");';
}
else if(($conf['http_username'] != '') && ($conf['http_password'] == ''))
{
//javascript alert the user that they have a username filled out, but no password.
//also focus on the password form element.
print 'document.forms.Superfecta.http_password.focus();';
print 'alert("The form has a value entered for the username (In the General Options section), but the password is blank. You should probably fill in the password portion of this form to ensure proper operation of Caller ID Superfecta.");';
}
else if(($conf['http_username'] != '') && ($conf['cache'] == '1'))
{
//javascript alert the user that they have a caller ID cache results enabled
//also focus on the password form element.
// print 'document.forms.Superfecta.http_password.focus();';
print 'alert("The form has cache results enabled which is not recommended for superfecta operation.");';
}
}
print '
-->
</script>';
}
//uncomment line below to see the available array values in $module_info.
//print '<pre>'.print_r($module_info,true).'</pre>';
print '<p align="center" style="font-size:10px;">This Project is now hosted/maintained at <a href="https://github.com/tm1000/Caller-ID-Superfecta">https://github.com/tm1000/Caller-ID-Superfecta</a> Feel free to fork/help/complain<br />The CallerID Superfecta module was maintained by the Community at<a target="_blank" href="http://projects.colsolgrp.net/projects/show/superfecta"> CSG Software Projects</a>, and by the forum users at <a target="_blank" href="http://www.pbxinaflash.com/forum">PBX In A Flash Forums</a>.<br>The Superfecta was Modularized for FreePBX by Tony Shiffer, based on an earlier (non module) work by <a target="_blank" href="http://www.nerdvittles.com">Ward Mundy</a>.<br>
<a target="_blank" href="https://github.com/tm1000/Caller-ID-Superfecta/wiki">This Module\'s wiki pages can be found here.</a>
<br><br><a target="_blank" href="https://github.com/tm1000/Caller-ID-Superfecta/issues?sort=created&direction=desc&state=open">Module version '.$module_info['module']['version'].'</a></p>';
?>
<script language="javascript">
<!--
var isWorking = false;
var divname = '';
var http = getHTTPObject();
function getHTTPObject()
{
var xmlhttp;
//do not take out this section of code that appears to be commented out...if you do the guns stop working.
/*@cc_on
@if (@_jscript_version >= 5)
try
{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (E)
{
xmlhttp = false;
}
}
@else
{
xmlhttp = false;
}
@end @*/
if(!xmlhttp && typeof XMLHttpRequest != 'undefined')
{
try
{
xmlhttp = new XMLHttpRequest();
}
catch (e)
{
xmlhttp = false;
}
}
return xmlhttp;
}
function Ht_Response()
{
if (http.readyState == 4)
{
document.getElementById(divname).innerHTML = http.responseText;
isWorking = false;
reset_infoboxes();
}
}
function Ht_Generate_List(first_run,scheme)
{
first_run = first_run || "";
scheme = scheme || "";
var poststr = "first_run=" + first_run + "&scheme=" + scheme;
if(document.forms.CIDSources.src_list)
{
var this_form = document.forms.CIDSources;
var elem = this_form.elements;
for(var i = 0; i < elem.length; i++)
{
if(elem[i].type == 'checkbox')
{
if(elem[i].checked == true)
{
poststr = poststr + "&" + elem[i].name + "=on";
}
else
{
poststr = poststr + "&" + elem[i].name + "=off";
}
}
else if(elem[i].type != 'radio')
{
poststr = poststr + "&" + elem[i].name + "=" + elem[i].value;
}
}
var CIDList = this_form.src_list.value.split(',');
var array_count = 0;
while (array_count < CIDList.length)
{
var CIDsource = CIDList[array_count];
array_count+=1;
if(CIDsource != '')
{
var this_value = 0;
eval('if(document.forms.CIDSources.' + CIDsource + ') { this_value = this_form.' + CIDsource + '; }');
if(this_value != 0)
{
for(var i=0; i < this_value.length; i++)
{
if(this_value[i].checked)
{
this_value = this_value[i].value;
}
}
}
poststr = poststr + "&" + CIDsource + "=" + this_value;
}
}
}
if(!isWorking)
{
isWorking = true;
divname = 'CIDSourcesList';
http.open("POST", "modules/superfecta/sources.php", true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", poststr.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = Ht_Response;
http.send(poststr);
}
else
{
setTimeout("Ht_Generate_List('" + first_run + "')",100);
}
}
function Ht_debug(thenumber,testdid,checkall)
{
thenumber = thenumber || "";
testdid = testdid || "";
checkall = checkall || false;
var poststr = "debug=yes&thenumber=" + thenumber + "&testdid=" + testdid;
if(!checkall)
{
poststr = poststr + "&scheme=<?php print $scheme ?>";
}
if(!isWorking)
{
isWorking = true;
divname = 'debug';
document.getElementById(divname).innerHTML = "<img src='modules/superfecta/loading.gif' style='margin: 20px auto 20px 150px;'>";
http.open("POST", "modules/superfecta/bin/callerid.php", true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", poststr.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = Ht_Response;
http.send(poststr);
}
else
{
setTimeout("Ht_debug('" + thenumber + "','" + testdid + "'," + checkall + ")",100);
}
}
function reset_infoboxes(){
body_loaded();
// test for a function that seems to only be in freepbx 2.8+
if(typeof window.tabberAutomaticOnLoad == 'function') {
$("a.info").hover(function () {
var pos = $(this).offset();
var left = (200 - pos.left) + "px";
$(this).find("span").css("left", left).stop(true, true).delay(500).animate({
opacity: "show"
}, 750);
}, function () {
$(this).find("span").stop(true, true).animate({
opacity: "hide"
}, "fast");
});
}
}
function decision(message, url)
{
if(confirm(message)) location.href = url;
}
<?php
if(($scheme != "") && ($scheme != "new"))
{
print 'Ht_Generate_List(1,"'.$scheme.'");';
}
print '
//-->
</script>';