| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
$display = isset($_REQUEST['display'])?$_REQUEST['display']:'restart'; |
|---|
| 16 |
|
|---|
| 17 |
$action = isset($_REQUEST['action'])?$_REQUEST['action']:''; |
|---|
| 18 |
$restartlist = isset($_REQUEST['restartlist'])?$_REQUEST['restartlist']:''; |
|---|
| 19 |
|
|---|
| 20 |
?> |
|---|
| 21 |
|
|---|
| 22 |
</div> |
|---|
| 23 |
<?php |
|---|
| 24 |
|
|---|
| 25 |
switch ($action) { |
|---|
| 26 |
case "restart": |
|---|
| 27 |
$restarted = false; |
|---|
| 28 |
if(is_array($restartlist) && sizeof($restartlist)) { |
|---|
| 29 |
foreach($restartlist as $device) { |
|---|
| 30 |
restart_device($device); |
|---|
| 31 |
} |
|---|
| 32 |
$restarted = true; |
|---|
| 33 |
} |
|---|
| 34 |
break; |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
?> |
|---|
| 38 |
<p> |
|---|
| 39 |
<? |
|---|
| 40 |
echo "<form name='restart' action='".$_SERVER['PHP_SELF']."' method'post'>\n"; |
|---|
| 41 |
echo "<input type='hidden' name='action' value='restart'>\n"; |
|---|
| 42 |
echo "<input type='hidden' name='display' value='${display}'>\n"; |
|---|
| 43 |
|
|---|
| 44 |
echo "<table><tr><td><div class='content'><h2>"._("Restart Phones")."</h2></span></td></tr>\n"; |
|---|
| 45 |
if($restarted) { |
|---|
| 46 |
echo "<tr><td><b>"._("Restart requests sent!")."</b><br/><br/></td></tr>"; |
|---|
| 47 |
} |
|---|
| 48 |
else { |
|---|
| 49 |
echo "<tr><td><b>"._("Warning: The restart mechanism behavior is vendor specific. Some vendors only restart the phone if there is a change to the phone configuration or if an updated firmware is available via tftp/ftp/http"). "</b><br/><br/></td></tr>"; |
|---|
| 50 |
|
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
?> |
|---|
| 54 |
<tr><td valign='top'><a href='#' class='info'><?php echo _("Device List:")."<span><br>"._("Select Device(s) to restart. Currently, only Aastra, Snom, Polycom, Grandstream and Cisco devices are supported. All other devices will not show up in this list. Click the \"Select All\" button to restart all supported devices. ") ?> |
|---|
| 55 |
<br><br></span></a></td> |
|---|
| 56 |
<tr> |
|---|
| 57 |
<td valign="top"> |
|---|
| 58 |
|
|---|
| 59 |
<select multiple="multiple" name="restartlist[]" id="xtnlist" tabindex="<?php echo ++$tabindex;?>"> |
|---|
| 60 |
<?php |
|---|
| 61 |
if (is_null($selected)) $selected = array(); |
|---|
| 62 |
foreach (core_devices_list() as $device) { |
|---|
| 63 |
if($ua = get_device_useragent($device[0])) { |
|---|
| 64 |
echo '<option value="'.$device[0].'" '; |
|---|
| 65 |
if (array_search($device[0], $selected) !== false) echo ' selected="selected" '; |
|---|
| 66 |
echo '>'.$device[0].' - '.$device[1].' - '.ucfirst($ua).' Device</option>'; |
|---|
| 67 |
} |
|---|
| 68 |
} |
|---|
| 69 |
?> |
|---|
| 70 |
</select> |
|---|
| 71 |
</td></tr> |
|---|
| 72 |
<tr><td><input type="button" name="Button" value="Select All" onclick="selectAll('xtnlist',true)" /></td></tr> |
|---|
| 73 |
|
|---|
| 74 |
<?php |
|---|
| 75 |
|
|---|
| 76 |
// object was initialized in config.php |
|---|
| 77 |
echo $module_hook->hookHtml; |
|---|
| 78 |
?> |
|---|
| 79 |
|
|---|
| 80 |
<tr> |
|---|
| 81 |
<td colspan="2"><br><h6><input type="submit" name="Submit" type="button" value="<?php echo _("Restart Phones")?>" tabindex="<?php echo ++$tabindex;?>"></h6></td> |
|---|
| 82 |
</tr> |
|---|
| 83 |
</table> |
|---|
| 84 |
</form> |
|---|
| 85 |
<script language="javascript"> |
|---|
| 86 |
<!-- hide script from older browsers |
|---|
| 87 |
|
|---|
| 88 |
function selectAll(selectBox,selectAll) { |
|---|
| 89 |
// have we been passed an ID |
|---|
| 90 |
if (typeof selectBox == "string") { |
|---|
| 91 |
selectBox = document.getElementById(selectBox); |
|---|
| 92 |
} |
|---|
| 93 |
// is the select box a multiple select box? |
|---|
| 94 |
if (selectBox.type == "select-multiple") { |
|---|
| 95 |
for (var i = 0; i < selectBox.options.length; i++) { |
|---|
| 96 |
selectBox.options[i].selected = selectAll; |
|---|
| 97 |
} |
|---|
| 98 |
} |
|---|
| 99 |
} |
|---|
| 100 |
// end of hiding script --> |
|---|
| 101 |
</script> |
|---|
| 102 |
|
|---|