|
From: <abe...@us...> - 2010-04-23 16:29:22
|
Revision: 3949
http://astlinux.svn.sourceforge.net/astlinux/?rev=3949&view=rev
Author: abelbeck
Date: 2010-04-23 16:29:15 +0000 (Fri, 23 Apr 2010)
Log Message:
-----------
Web interface, Directory tab, optionally allow SSL authentication
Modified Paths:
--------------
branches/0.7/package/webinterface/altweb/admin/prefs.php
branches/0.7/package/webinterface/altweb/common/header.php
branches/0.7/package/webinterface/altweb/common/version.php
branches/0.7/package/webinterface/altweb/directory.php
Added Paths:
-----------
branches/0.7/package/webinterface/altweb/admin/directory.php
branches/0.7/package/webinterface/altweb/common/directory.inc
Added: branches/0.7/package/webinterface/altweb/admin/directory.php
===================================================================
--- branches/0.7/package/webinterface/altweb/admin/directory.php (rev 0)
+++ branches/0.7/package/webinterface/altweb/admin/directory.php 2010-04-23 16:29:15 UTC (rev 3949)
@@ -0,0 +1,20 @@
+<?php
+
+// Copyright (C) 2008-2010 Lonnie Abelbeck
+// This is free software, licensed under the GNU General Public License
+// version 3 as published by the Free Software Foundation; you can
+// redistribute it and/or modify it under the terms of the GNU
+// General Public License; and comes with ABSOLUTELY NO WARRANTY.
+
+// directory.php for AstLinux
+// 08-06-2008
+// 04-23-2010, Allow directory.php to be authenticated
+//
+
+$DIRECTORY_AUTH = TRUE;
+
+$COMMON = '../common/';
+
+require_once $COMMON.'directory.inc';
+
+?>
Property changes on: branches/0.7/package/webinterface/altweb/admin/directory.php
___________________________________________________________________
Added: svn:executable
+ *
Modified: branches/0.7/package/webinterface/altweb/admin/prefs.php
===================================================================
--- branches/0.7/package/webinterface/altweb/admin/prefs.php 2010-04-23 16:28:23 UTC (rev 3948)
+++ branches/0.7/package/webinterface/altweb/admin/prefs.php 2010-04-23 16:29:15 UTC (rev 3949)
@@ -99,10 +99,14 @@
$value = 'status_password_warning = no';
fwrite($fp, $value."\n");
}
- if (isset($_POST['require_auth'])) {
+ if (isset($_POST['status_auth'])) {
$value = 'status_require_auth = yes';
fwrite($fp, $value."\n");
}
+ if (isset($_POST['directory_auth'])) {
+ $value = 'directory_require_auth = yes';
+ fwrite($fp, $value."\n");
+ }
if (isset($_POST['disable_ami'])) {
$value = 'status_asterisk_manager = no';
fwrite($fp, $value."\n");
@@ -392,6 +396,9 @@
<?php
putHtml('</td></tr>');
putHtml('<tr class="dtrow1"><td style="text-align: right;">');
+ $sel = (getPREFdef($global_prefs, 'status_require_auth') === 'yes') ? ' checked="checked"' : '';
+ putHtml('<input type="checkbox" value="status_auth" name="status_auth"'.$sel.' /></td><td colspan="5">Require Authentication for Status Tab</td></tr>');
+ putHtml('<tr class="dtrow1"><td style="text-align: right;">');
$sel = (getPREFdef($global_prefs, 'status_pppoe_connection') !== 'no') ? ' checked="checked"' : '';
putHtml('<input type="checkbox" value="pppoe_connection" name="pppoe_connection"'.$sel.' /></td><td colspan="5">Show PPPoE Connection Status when Active</td></tr>');
putHtml('<tr class="dtrow1"><td style="text-align: right;">');
@@ -442,9 +449,6 @@
$sel = (getPREFdef($global_prefs, 'status_password_warning') === 'no') ? ' checked="checked"' : '';
putHtml('<input type="checkbox" value="pass_warn" name="pass_warn"'.$sel.' /></td><td colspan="5">Disable "Password not set" Warning</td></tr>');
putHtml('<tr class="dtrow1"><td style="text-align: right;">');
- $sel = (getPREFdef($global_prefs, 'status_require_auth') === 'yes') ? ' checked="checked"' : '';
- putHtml('<input type="checkbox" value="require_auth" name="require_auth"'.$sel.' /></td><td colspan="5">Require Authentication for Status Tab</td></tr>');
- putHtml('<tr class="dtrow1"><td style="text-align: right;">');
$sel = (getPREFdef($global_prefs, 'status_asterisk_manager') === 'no') ? ' checked="checked"' : '';
putHtml('<input type="checkbox" value="disable_ami" name="disable_ami"'.$sel.' /></td><td colspan="5">Disable Asterisk Manager Interface for Asterisk Commands</td></tr>');
putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="3">Active Channels Command:</td><td colspan="3">');
@@ -461,6 +465,15 @@
putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>');
putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">');
+ putHtml('<strong>Directory Tab Options:</strong>');
+ putHtml('</td></tr>');
+ putHtml('<tr class="dtrow1"><td style="text-align: right;">');
+ $sel = (getPREFdef($global_prefs, 'directory_require_auth') === 'yes') ? ' checked="checked"' : '';
+ putHtml('<input type="checkbox" value="directory_auth" name="directory_auth"'.$sel.' /></td><td colspan="5">Require Authentication for Directory Tab</td></tr>');
+
+ putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>');
+
+ putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">');
putHtml('<strong>Voicemail & Monitor Tab Options:</strong>');
putHtml('</td></tr>');
putHtml('<tr class="dtrow1"><td style="text-align: right;">');
Added: branches/0.7/package/webinterface/altweb/common/directory.inc
===================================================================
--- branches/0.7/package/webinterface/altweb/common/directory.inc (rev 0)
+++ branches/0.7/package/webinterface/altweb/common/directory.inc 2010-04-23 16:29:15 UTC (rev 3949)
@@ -0,0 +1,87 @@
+<?php
+
+// Copyright (C) 2008-2010 Lonnie Abelbeck
+// This is free software, licensed under the GNU General Public License
+// version 3 as published by the Free Software Foundation; you can
+// redistribute it and/or modify it under the terms of the GNU
+// General Public License; and comes with ABSOLUTELY NO WARRANTY.
+
+// directory.php for AstLinux
+// 08-06-2008
+// 04-23-2010, Allow directory.php to be authenticated
+//
+
+$familyname = "sysdialname";
+$myself = $_SERVER['PHP_SELF'];
+
+require_once $COMMON.'functions.php';
+
+if (getPREFdef($global_prefs, 'directory_require_auth') === 'yes') {
+ if (! $DIRECTORY_AUTH) {
+ header('Location: /admin/directory.php');
+ exit;
+ }
+}
+
+if (($ext_prefix = getPREFdef($global_prefs, 'sysdial_ext_prefix_cmdstr')) === '') {
+ $ext_prefix = '11';
+}
+
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ $result = 1;
+ header('Location: '.$myself.'?result='.$result);
+ exit;
+} else { // Start of HTTP GET
+require_once $COMMON.'header.php';
+
+putHtml("<center>");
+putHtml("<p> </p>");
+putHtml("</center>");
+?>
+ <center>
+ <table class="layout"><tr><td><center>
+ <table width="100%" class="stdtable">
+ <tr><td style="text-align: center;">
+ <h2>Speed Dial Directory:</h2>
+ </td></tr>
+ </table>
+<?php
+ $db = parseAstDB($familyname);
+
+ // Sort by Name
+ if (($n = count($db['data'])) > 0) {
+ foreach ($db['data'] as $key => $row) {
+ $name[$key] = $row['value'];
+ }
+ array_multisort($name, SORT_ASC, SORT_STRING, $db['data']);
+ }
+
+ putHtml('<table class="datatable">');
+ putHtml("<tr>");
+
+ if (($n = count($db['data'])) > 0) {
+ echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "Name", "</td>";
+ echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "Extension", "</td>";
+ for ($i = 0; $i < $n; $i++) {
+ putHtml("</tr>");
+ echo '<tr ', ($i % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>';
+ echo '<td>', htmlspecialchars($db['data'][$i]['value']), '</td>';
+ echo '<td>'.$ext_prefix.$db['data'][$i]['key'], '</td>';
+ }
+ } else {
+ if ($db['status'] == 0) {
+ echo '<td style="text-align: center;">No Database Entries for: ', $db['family'], "</td>";
+ putHtml("</tr><tr>");
+ echo '<td>Only entries in the Speed Dial Tab with a "Name" specified will be listed here.', '</td>';
+ } else {
+ echo '<td style="color: red;">', asteriskERROR($db['status']), '</td>';
+ }
+ }
+ putHtml("</tr>");
+ putHtml("</table>");
+ putHtml("</center></td></tr></table>");
+ putHtml("</center>");
+} // End of HTTP GET
+require_once $COMMON.'footer.php';
+
+?>
Modified: branches/0.7/package/webinterface/altweb/common/header.php
===================================================================
--- branches/0.7/package/webinterface/altweb/common/header.php 2010-04-23 16:28:23 UTC (rev 3948)
+++ branches/0.7/package/webinterface/altweb/common/header.php 2010-04-23 16:29:15 UTC (rev 3949)
@@ -63,6 +63,7 @@
<meta http-equiv="Expires" content="0" />
<?php
$status = (getPREFdef($global_prefs, 'status_require_auth') === 'yes') ? '/admin/status.php' : '/status.php';
+ $directory = (getPREFdef($global_prefs, 'directory_require_auth') === 'yes') ? '/admin/directory.php' : '/directory.php';
$tabname = getTABname();
putHtml('<title>'.getTITLEname($global_prefs).'</title>');
@@ -108,7 +109,7 @@
} else {
putHtml('<li><a href="'.$status.'"><span>Status</span></a></li>');
if (getPREFdef($global_prefs, 'tab_directory_show') === 'yes') {
- putHtml('<li><a href="/directory.php"><span>Directory</span></a></li>');
+ putHtml('<li><a href="'.$directory.'"><span>Directory</span></a></li>');
}
if ((! $global_staff_disable_voicemail) && getPREFdef($global_prefs, 'tab_voicemail_show') === 'yes') {
putHtml('<li><a href="/admin/voicemail.php"><span>Voicemail</span></a></li>');
@@ -162,6 +163,7 @@
// non-staff and non-admin
if (! ($global_staff ||
$tabname === 'status' ||
+ $tabname === 'directory' ||
$tabname === 'voicemail' ||
$tabname === 'monitor' ||
$tabname === 'followme')) {
@@ -171,6 +173,7 @@
// staff
if (! ($global_admin ||
$tabname === 'status' ||
+ $tabname === 'directory' ||
($tabname === 'voicemail' && (! $global_staff_disable_voicemail)) ||
($tabname === 'monitor' && (! $global_staff_disable_monitor)) ||
($tabname === 'followme' && (! $global_staff_disable_followme)) ||
Modified: branches/0.7/package/webinterface/altweb/common/version.php
===================================================================
--- branches/0.7/package/webinterface/altweb/common/version.php 2010-04-23 16:28:23 UTC (rev 3948)
+++ branches/0.7/package/webinterface/altweb/common/version.php 2010-04-23 16:29:15 UTC (rev 3949)
@@ -1,6 +1,6 @@
<?php
// version.php for AstLinux Alternate Web Interface
-$GUI_VERSION = '1.6.18';
+$GUI_VERSION = '1.6.19';
?>
Modified: branches/0.7/package/webinterface/altweb/directory.php
===================================================================
--- branches/0.7/package/webinterface/altweb/directory.php 2010-04-23 16:28:23 UTC (rev 3948)
+++ branches/0.7/package/webinterface/altweb/directory.php 2010-04-23 16:29:15 UTC (rev 3949)
@@ -1,6 +1,6 @@
<?php
-// Copyright (C) 2008 Lonnie Abelbeck
+// Copyright (C) 2008-2010 Lonnie Abelbeck
// This is free software, licensed under the GNU General Public License
// version 3 as published by the Free Software Foundation; you can
// redistribute it and/or modify it under the terms of the GNU
@@ -8,72 +8,13 @@
// directory.php for AstLinux
// 08-06-2008
+// 04-23-2010, Allow directory.php to be authenticated
//
-$familyname = "sysdialname";
-$myself = $_SERVER['PHP_SELF'];
+$DIRECTORY_AUTH = FALSE;
-require_once './common/functions.php';
+$COMMON = './common/';
-if (($ext_prefix = getPREFdef($global_prefs, 'sysdial_ext_prefix_cmdstr')) === '') {
- $ext_prefix = '11';
-}
+require_once $COMMON.'directory.inc';
-if ($_SERVER['REQUEST_METHOD'] === 'POST') {
- $result = 1;
- header('Location: '.$myself.'?result='.$result);
- exit;
-} else { // Start of HTTP GET
-require_once './common/header.php';
-
-putHtml("<center>");
-putHtml("<p> </p>");
-putHtml("</center>");
?>
- <center>
- <table class="layout"><tr><td><center>
- <table width="100%" class="stdtable">
- <tr><td style="text-align: center;">
- <h2>Speed Dial Directory:</h2>
- </td></tr>
- </table>
-<?php
- $db = parseAstDB($familyname);
-
- // Sort by Name
- if (($n = count($db['data'])) > 0) {
- foreach ($db['data'] as $key => $row) {
- $name[$key] = $row['value'];
- }
- array_multisort($name, SORT_ASC, SORT_STRING, $db['data']);
- }
-
- putHtml('<table class="datatable">');
- putHtml("<tr>");
-
- if (($n = count($db['data'])) > 0) {
- echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "Name", "</td>";
- echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "Extension", "</td>";
- for ($i = 0; $i < $n; $i++) {
- putHtml("</tr>");
- echo '<tr ', ($i % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>';
- echo '<td>', htmlspecialchars($db['data'][$i]['value']), '</td>';
- echo '<td>'.$ext_prefix.$db['data'][$i]['key'], '</td>';
- }
- } else {
- if ($db['status'] == 0) {
- echo '<td style="text-align: center;">No Database Entries for: ', $db['family'], "</td>";
- putHtml("</tr><tr>");
- echo '<td>Only entries in the Speed Dial Tab with a "Name" specified will be listed here.', '</td>';
- } else {
- echo '<td style="color: red;">', asteriskERROR($db['status']), '</td>';
- }
- }
- putHtml("</tr>");
- putHtml("</table>");
- putHtml("</center></td></tr></table>");
- putHtml("</center>");
-} // End of HTTP GET
-require_once './common/footer.php';
-
-?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|