summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/access.php8
-rwxr-xr-ximages/ampache.gifbin6343 -> 9631 bytes
-rw-r--r--lib/class/access.class.php76
-rw-r--r--login.php4
-rw-r--r--templates/show_access_list.inc28
-rw-r--r--templates/show_login_form.inc59
-rw-r--r--templates/show_user_registration.inc.php53
7 files changed, 126 insertions, 102 deletions
diff --git a/admin/access.php b/admin/access.php
index d7bc11c8..74f13d6b 100644
--- a/admin/access.php
+++ b/admin/access.php
@@ -28,7 +28,7 @@ $action = scrub_in($_REQUEST['action']);
$access_id = scrub_in($_REQUEST['access_id']);
$access = new Access($access_id);
-if (!$GLOBALS['user']->has_access(100)) {
+if (!$GLOBALS['user']->has_access(100) || conf('demo_mode')) {
access_denied();
exit();
}
@@ -39,7 +39,9 @@ show_template('header');
switch ($action ) {
case 'show_confirm_delete':
- show_confirmation(_('Confirm Delete'),_('Do you really want to delete this Access Record?'),'admin/access.php?access_id=' . scrub_out($_REQUEST['access_id']) . '&action=delete_host','1');
+ $title = _('Confirm Delete');
+ $body = _('Do you really want to delete this Access Record?');
+ show_confirmation($title,$body,'admin/access.php?access_id=' . scrub_out($_REQUEST['access_id']) . '&action=delete_host','1');
break;
case 'delete_host':
$access->delete($_REQUEST['access_id']);
@@ -47,7 +49,7 @@ switch ($action ) {
show_confirmation(_('Entry Deleted'),_('Your Access List Entry has been removed'),$url);
break;
case 'add_host':
- $access->create($_REQUEST['name'],$_REQUEST['start'],$_REQUEST['end'],$_REQUEST['level']);
+ $access->create($_REQUEST['name'],$_REQUEST['start'],$_REQUEST['end'],$_REQUEST['level'],$_REQUEST['user'],$_REQUEST['key'],$_REQUEST['type']);
$url = conf('web_path') . '/admin/access.php';
show_confirmation(_('Entry Added'),_('Your new Access List Entry has been created'),$url);
break;
diff --git a/images/ampache.gif b/images/ampache.gif
index fb110191..b085c7f2 100755
--- a/images/ampache.gif
+++ b/images/ampache.gif
Binary files differ
diff --git a/lib/class/access.class.php b/lib/class/access.class.php
index 04456610..330156b7 100644
--- a/lib/class/access.class.php
+++ b/lib/class/access.class.php
@@ -33,6 +33,9 @@ class Access {
var $start;
var $end;
var $level;
+ var $user;
+ var $type;
+ var $key;
/*!
@function Access
@@ -52,6 +55,9 @@ class Access {
$this->start = $info->start;
$this->end = $info->end;
$this->level = $info->level;
+ $this->key = $info->key;
+ $this->user = $info->user;
+ $this->type = $info->type;
return true;
@@ -95,7 +101,7 @@ class Access {
@function create
@discussion creates a new entry
*/
- function create($name,$start,$end,$level) {
+ function create($name,$start,$end,$level,$user,$key,$type) {
/* We need to verify the incomming data a littlebit */
$start = intval($start);
@@ -104,7 +110,10 @@ class Access {
$start = ip2int($start);
$end = ip2int($end);
$name = sql_escape($name);
+ $key = sql_escape($key);
+ $user = sql_escape($user);
$level = intval($level);
+ $type = $this->validate_type($type);
$sql = "INSERT INTO access_list (`name`,`level`,`start`,`end`) VALUES ".
"('$name','$level','$start','$end')";
@@ -156,6 +165,24 @@ class Access {
} // check
+ /**
+ * validate_type
+ * This cleans up and validates the specified type
+ */
+ function validate_type($type) {
+
+ switch($type) {
+ case 'xml-rpc':
+ case 'interface':
+ case 'network':
+ return $type;
+ break;
+ default:
+ return 'stream';
+ break;
+ } // end switch
+ } // validate_type
+
/*!
@function get_access_list
@discussion returns a full listing of all access
@@ -166,7 +193,7 @@ class Access {
$sql = "SELECT * FROM access_list";
$db_results = mysql_query($sql, dbh());
-
+ // Man this is the wrong way to do it...
while ($r = mysql_fetch_object($db_results)) {
$obj = new Access();
$obj->id = $r->id;
@@ -174,6 +201,9 @@ class Access {
$obj->end = $r->end;
$obj->name = $r->name;
$obj->level = $r->level;
+ $obj->user = $r->user;
+ $obj->key = $r->key;
+ $obj->type = $r->type;
$results[] = $obj;
} // end while access list mojo
@@ -190,21 +220,55 @@ class Access {
function get_level_name() {
if ($this->level == '75') {
- return "Full Access";
+ return "Read/Write/Modify";
}
if ($this->level == '5') {
- return "Demo";
+ return "View";
}
if ($this->level == '25') {
- return "Stream";
+ return "Read";
}
if ($this->level == '50') {
- return "Stream/Download";
+ return "Read/Write";
}
} // get_level_name
+ /**
+ * get_user_name
+ * Take a user and return their full name
+ */
+ function get_user_name() {
+
+ $user = new User($this->user);
+ return $user->name;
+
+ } // get_user_name
+
+ /**
+ * get_type_name
+ * This function returns the pretty name for our current type
+ */
+ function get_type_name() {
+
+ switch ($this->type) {
+ case 'xml-rpc':
+ return 'XML-RPC';
+ break;
+ case 'network':
+ return 'Local Network Definition';
+ break;
+ case 'interface':
+ return 'Web Interface';
+ break;
+ case 'stream':
+ default:
+ return 'Stream Access';
+ break;
+ } // end switch
+ } // get_type_name
+
} //end of access class
?>
diff --git a/login.php b/login.php
index e044beb1..1b5634af 100644
--- a/login.php
+++ b/login.php
@@ -134,7 +134,11 @@ function focus(){ document.login.username.focus(); }
require(conf('prefix') . "/templates/show_login_form.inc");
if (@is_readable(conf('prefix') . '/config/motd.php')) {
+ echo "<div align=\"center\">\n";
+ show_box_top(_('Message of the Day'));
include conf('prefix') . '/config/motd.php';
+ show_box_bottom();
+ echo "</div>\n";
}
?>
diff --git a/templates/show_access_list.inc b/templates/show_access_list.inc
index 817dc04f..13a24fbd 100644
--- a/templates/show_access_list.inc
+++ b/templates/show_access_list.inc
@@ -47,26 +47,32 @@ stream from this server.</p>
<table cellspacing="1" cellpadding="3" class="border">
<tr class="table-header" align="center">
- <td><?php print _("Name"); ?></td>
- <td><?php print _("Start Address"); ?></td>
- <td><?php print _("End Address"); ?></td>
- <td><?php print _("Level"); ?></td>
- <td><?php print _("Action"); ?></td>
+ <td><?php echo _('Name'); ?></td>
+ <td><?php echo _('Start Address'); ?></td>
+ <td><?php echo _('End Address'); ?></td>
+ <td><?php echo _('Level'); ?></td>
+ <td><?php echo _('User'); ?></td>
+ <td><?php echo _('Key'); ?></td>
+ <td><?php echo _('Type'); ?></td>
+ <td><?php echo _('Action'); ?></td>
</tr>
<?php
if (count($list)) {
/* Start foreach List Item */
foreach ($list as $access) {
?>
- <tr class="<?php print $row_classes[0]; ?>">
- <td><?php print scrub_out($access->name); ?></td>
- <td><?php print int2ip($access->start); ?></td>
- <td><?php print int2ip($access->end); ?></td>
- <td><?php print $access->get_level_name(); ?></td>
+ <tr class="<?php echo $row_classes[0]; ?>">
+ <td><?php echo scrub_out($access->name); ?></td>
+ <td><?php echo int2ip($access->start); ?></td>
+ <td><?php echo int2ip($access->end); ?></td>
+ <td><?php echo $access->get_level_name(); ?></td>
+ <td><?php echo $access->get_user_name(); ?></td>
+ <td><?php echo $access->key; ?></td>
+ <td><?php echo $access->get_type_name(); ?></td>
<td>
<a href="<?php echo $web_path; ?>/admin/access.php?action=show_edit_host&amp;access_id=<?php echo scrub_out($access->id); ?>"><?php echo _('Edit'); ?></a>
|
- <a href="<?php echo $web_path; ?>/admin/access.php?action=show_confirm_delete&amp;access_id=<?php print scrub_out($access->id); ?>"><?php print _("Revoke"); ?></a>
+ <a href="<?php echo $web_path; ?>/admin/access.php?action=show_confirm_delete&amp;access_id=<?php echo scrub_out($access->id); ?>"><?php print _("Revoke"); ?></a>
</td>
</tr>
<?php $row_classes = array_reverse($row_classes); ?>
diff --git a/templates/show_login_form.inc b/templates/show_login_form.inc
index 3032bec3..8102aadf 100644
--- a/templates/show_login_form.inc
+++ b/templates/show_login_form.inc
@@ -39,56 +39,13 @@
</div>
</div>
-
-<?php
-if (conf('allow_public_registration')) { ?>
- <p align="center">
- [<a class="header2" href="<?php echo conf('web_path'); ?>/register.php"><?php echo _('Register'); ?></a>]
- </p>
-<?php } // end if (conf('allow_public_registration'))
-
-
-exit();
-?>
-<br /><br />
-<p align="center">
- <a href="http://www.ampache.org"><img src="<?php echo conf('web_path'); ?><?php echo conf('theme_path'); ?>/images/ampache.gif" title="<?php echo conf('site_title'); ?>" border="0" alt="Ampache" />
- </a>
-</p>
-<form name="login" method="post" enctype="multipart/form-data" action="<?php echo conf('web_path'); ; ?>/login.php" style="Display:inline">
-<table class="login" bgcolor="<?php echo conf('base_color2'); ?>" border="0" align="center">
-<tr>
- <td align="center" colspan="2">
- <?php echo conf('login_message'); ; ?>&nbsp;
- <?php $GLOBALS['error']->print_error('general'); ?>
- </td>
-
- </tr>
-<tr>
- <td><?php echo _("Login"); ; ?>:</td>
- <td><input type="text" name="username" value="<?php echo $_REQUEST['username']; ; ?>" /></td>
-</tr>
-<tr>
- <td><?php echo _("Password"); ; ?>:</td>
- <td><input type="password" name="password" value="" /></td>
-</tr>
-<tr>
- <td>&nbsp;</td>
- <td><input type="checkbox" name="rememberme" />
- <?php echo _("Remember Me"); ?></td>
-</tr>
-<tr>
- <td colspan="2" align="center">
- <input class="button" type="submit" value="<?php echo _("Login"); ?>" />
- <input type="hidden" name="referrer" value="<?php echo $referrer; ?>" />
- <input type="hidden" name="action" value="login" />
- </td>
-</tr>
-</table>
-</form>
<?php
if (conf('allow_public_registration')) { ?>
- <p align="center">
- [<a class="header2" href="<?php echo conf('web_path'); ?>/register.php"><?php echo _("Register"); ?></a>]
- </p>
-<?php } // end if (conf('allow_public_registration'))
+<div align="center">
+ <?php show_box_top(); ?>
+ <span class="text-action">
+ <a href="<?php echo conf('web_path'); ?>/register.php"><?php echo _('Register'); ?></a>
+ </span>
+ <?php show_box_bottom(); ?>
+</div>
+<?php } // end if (conf('allow_public_registration')) ?>
diff --git a/templates/show_user_registration.inc.php b/templates/show_user_registration.inc.php
index f75bb3d0..c92b2fbc 100644
--- a/templates/show_user_registration.inc.php
+++ b/templates/show_user_registration.inc.php
@@ -27,7 +27,8 @@ $htmllang = str_replace("_","-",conf('lang'));
<head>
<link rel="shortcut icon" href="<?php echo conf('web_path'); ?>/favicon.ico" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo conf('site_charset'); ?>" />
-<?php show_template('style'); ?>
+<link rel="stylesheet" href="<?php echo $web_path; ?>/templates/default.css" type="text/css" />
+<link rel="stylesheet" href="<?php echo $web_path; ?><?php echo conf('theme_path'); ?>/templates/default.css" type="text/css" />
<title><?php echo conf('site_title'); ?> - <?php echo $location['title']; ?></title>
</head>
<body>
@@ -36,9 +37,9 @@ $htmllang = str_replace("_","-",conf('lang'));
<div id="maincontainer">
<!-- This is the topbar row -->
<div id="topbar">
- <div id="topbarleft">
- <a href="http://www.ampache.org">
- <img class="pageheader" src="<?php echo conf('web_path'); ?><?php echo conf('theme_path'); ?>/images/ampache.gif" border="0" title="Ampache: For the love of music" alt="Ampache: For the love of music" />
+ <div align="center">
+ <a href="http://www.ampache.org/">
+ <img src="<?php echo conf('web_path'); ?><?php echo conf('theme_path'); ?>/images/ampache.gif" border="0" title="Ampache: For the love of music" alt="Ampache: For the love of music" />
</a>
</div>
</div>
@@ -50,24 +51,19 @@ $fullname = scrub_in($_REQUEST['fullname']);
$username = scrub_in($_REQUEST['username']);
$email = scrub_in($_REQUEST['email']);
?>
-
<div align="center">
+<?php show_box_top(_('Ampache New User Registration')); ?>
<form name="update_user" method="post" action="<?php echo conf('web_path'); ?>/register.php" enctype="multipart/form-data">
-<table class="border" width='700' cellpadding='0' cellspacing='0' border='0'>
-<tr class="table-header">
- <td>
- <font size="2"><b><u><?php echo _("Ampache New User Registration"); ?></u></b></font>
- </td>
-</tr>
+<table width='700px' cellpadding='0' cellspacing='0' border='0'>
<?php
/* If we should show the user agreement */
if(conf('user_agreement')){ ?>
<tr>
- <td height='15' bgcolor="<?php print conf('base_color2'); ?>">
+ <td height='15'>
</td>
</tr>
<tr>
- <td bgcolor="<?php print conf('base_color2'); ?>" align='center' valign='top'>
+ <td align='center' valign='top'>
<table width='100%' border='0' cellpadding='0' cellspacing='0'>
<tr class="table-header">
<td align='center'>
@@ -90,23 +86,17 @@ if(conf('user_agreement')){ ?>
</tr>
<? } // end if(conf('user_agreement')) ?>
<tr>
- <td height='15' bgcolor="<?php print conf('base_color2'); ?>">
+ <td height='15'>
</td>
</tr>
<tr>
- <td bgcolor="<?php print conf('base_color2'); ?>" align="center" valign="top">
- <table width="100%" cellpadding="0" cellspacing="0" border="0">
- <tr class="table-header">
- <td align='center'>
- <font size="1"><b><u><?php echo _('User Information'); ?></u></b></font>
- </td>
- </tr>
- </table>
- <br />
+ <td valign="top">
+ <p class="box-title"><?php echo _('User Information'); ?></p>
+
<table width='99%' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td align='right'>
- <?php echo _("Username"); ?>:
+ <?php echo _('Username'); ?>:
</td>
<td>
<font color='red'>*</font> <input type='text' name='username' id='username' value='<?php echo scrub_out($username); ?>' />
@@ -116,7 +106,7 @@ if(conf('user_agreement')){ ?>
</tr>
<tr>
<td align='right'>
- <?php echo _("Full Name"); ?>:
+ <?php echo _('Full Name'); ?>:
</td>
<td>
<font color='red'>*</font> <input type='text' name='fullname' id='fullname' value='<?php echo scrub_out($fullname); ?>' />
@@ -125,7 +115,7 @@ if(conf('user_agreement')){ ?>
</tr>
<tr>
<td align='right'>
- <?php echo _("E-mail"); ?>:
+ <?php echo _('E-mail'); ?>:
</td>
<td>
<font color='red'>*</font> <input type='text' name='email' id='email' value='<?php echo scrub_out($email); ?>' />
@@ -134,7 +124,7 @@ if(conf('user_agreement')){ ?>
</tr>
<tr>
<td align='right'>
- <?php echo _("Password"); ?>:
+ <?php echo _('Password'); ?>:
</td>
<td>
<font color='red'>*</font> <input type='password' name='password_1' id='password_1' />
@@ -143,7 +133,7 @@ if(conf('user_agreement')){ ?>
</tr>
<tr>
<td align='right'>
- <?php echo _("Confirm Password"); ?>:
+ <?php echo _('Confirm Password'); ?>:
</td>
<td>
<font color='red'>*</font> <input type='password' name='password_2' id='password_2' />
@@ -156,15 +146,15 @@ if(conf('user_agreement')){ ?>
</tr>
<?php } ?>
<tr>
- <td colspan='2' bgcolor="<?php print conf('base_color2'); ?>" align='center' height='20'>
+ <td colspan='2' align='center' height='20'>
<font color='red'>*</font>Required fields
</td>
</tr>
<tr>
- <td colspan='2' bgcolor="<?php print conf('base_color2'); ?>" align='center' height='50'>
+ <td colspan='2' align='center' height='50'>
<input type="hidden" name="action" value="add_user" />
<input type='reset' name='clear_info' id='clear_info' value='<?php echo _('Clear Info'); ?>' />
- <input type='submit' name='submit_registration' id='submit_registration' value='<?php echo _("Register User"); ?>' />
+ <input type='submit' name='submit_registration' id='submit_registration' value='<?php echo _('Register User'); ?>' />
</td>
</tr>
</table>
@@ -172,6 +162,7 @@ if(conf('user_agreement')){ ?>
</tr>
</table>
</form>
+<?php show_box_bottom(); ?>
</div>
</div><!--end <div>id="maincontainer-->
</body>