summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-03-27 04:29:23 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-03-27 04:29:23 +0000
commit7673d000dd8ec85908a99a1174840c8ca3c53e16 (patch)
tree8cbce751084279e680055f156824c52ea3b3b88b /admin
parent75434cbeb6e6c2e4107b9932a79b3d146dbdcc0f (diff)
downloadampache-7673d000dd8ec85908a99a1174840c8ca3c53e16.tar.gz
ampache-7673d000dd8ec85908a99a1174840c8ca3c53e16.tar.bz2
ampache-7673d000dd8ec85908a99a1174840c8ca3c53e16.zip
added some more to flagging and updated mail page to fit new standards
Diffstat (limited to 'admin')
-rw-r--r--admin/flag.php17
-rw-r--r--admin/mail.php136
2 files changed, 66 insertions, 87 deletions
diff --git a/admin/flag.php b/admin/flag.php
index df7893c2..2c8e4c16 100644
--- a/admin/flag.php
+++ b/admin/flag.php
@@ -71,6 +71,15 @@ switch ($action) {
}
show_confirmation(_('Song Updated'),_('The requested song has been updated'),$_SESSION['source']);
break;
+ case 'reject_flag':
+ $flag_id = scrub_in($_REQUEST['flag_id']);
+ $flag = new Flag($flag_id);
+ $flag->delete_flag();
+ $url = return_referer();
+ $title = _('Flag Removed');
+ $body = _('Flag Removed from') . " " . $flag->print_name();
+ show_confirmation($title,$body,$url);
+ break;
case 'show_edit_song':
$_SESSION['source'] = return_referer();
$song = new Song($_REQUEST['song']);
@@ -88,7 +97,7 @@ switch ($action) {
} // end else
show_confirmation(_('Songs Disabled'),_('The requested song(s) have been disabled'),return_referer());
break;
- case "enabled":
+ case 'enabled':
$song_obj = new Song();
// If we pass just one, make it still work
if (!is_array($_REQUEST['song_ids'])) { $song_obj->update_enabled(1,$_REQUEST['song_ids']); }
@@ -99,6 +108,12 @@ switch ($action) {
} // end else
show_confirmation(_('Songs Enabled'),_('The requested song(s) have been enabled'),return_referer());
break;
+ case 'show_flagged':
+ $flag = new Flag();
+ $flagged = $flag->get_flagged();
+ echo "<span class=\"header1\">" . _('Flagged Records') . "</span>\n";
+ require (conf('prefix') . '/templates/show_flagged.inc.php');
+ break;
default:
break;
} // end switch
diff --git a/admin/mail.php b/admin/mail.php
index a69b0ead..df717780 100644
--- a/admin/mail.php
+++ b/admin/mail.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2005 Ampache.org
+ Copyright (c) 2001 - 2006 Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -20,16 +20,11 @@
*/
-/*!
- @header Mail Admin Page
- Means to mail your users or give updates about the server
-
-*/
-
require('../modules/init.php');
-if (!$user->has_access(100)) {
+if (!$GLOBALS['user']->has_access(100)) {
access_denied();
+ exit();
}
@@ -38,92 +33,61 @@ $to = scrub_in($_REQUEST['to']);
$subject = stripslashes(scrub_in($_POST['subject']));
$message = stripslashes(scrub_in($_POST['message']));
-if ( $action == 'send_mail' && !conf('demo_mode')) {
- $user = $GLOBALS['user'];
- // do the mail mojo here
- if ( $to == 'all' ) {
- $sql = "SELECT * FROM user WHERE email IS NOT NULL";
- }
- elseif ( $to == 'users' ) {
- $sql = "SELECT * FROM user WHERE access='users' OR access='25' AND email IS NOT NULL";
- }
- elseif ( $to == 'admins' ) {
- $sql = "SELECT * FROM user WHERE access='admin' OR access='100' AND email IS NOT NULL";
- }
+/* Always show the header */
+show_template('header');
+
+switch ($action) {
+ case 'send_mail':
+ if (conf('demo_mode')) { break; }
+
+ // do the mail mojo here
+ if ( $to == 'all' ) {
+ $sql = "SELECT * FROM user WHERE email IS NOT NULL";
+ }
+ elseif ( $to == 'users' ) {
+ $sql = "SELECT * FROM user WHERE access='users' OR access='25' AND email IS NOT NULL";
+ }
+ elseif ( $to == 'admins' ) {
+ $sql = "SELECT * FROM user WHERE access='admin' OR access='100' AND email IS NOT NULL";
+ }
- $db_result = mysql_query($sql, dbh());
+ $db_result = mysql_query($sql, dbh());
- $recipient = '';
+ $recipient = '';
- while ( $u = mysql_fetch_object($db_result) ) {
- $recipient .= "$u->fullname <$u->email>, ";
- }
+ while ( $u = mysql_fetch_object($db_result) ) {
+ $recipient .= "$u->fullname <$u->email>, ";
+ }
- // Remove the last , from the recipient
- $recipient = rtrim($recipient,",");
+ // Remove the last , from the recipient
+ $recipient = rtrim($recipient,",");
- $from = $user->fullname."<".$user->email.">";
+ $from = $user->fullname."<".$user->email.">";
- // woohoo!!
- mail ($from, $subject, $message,
- "From: $from\r\n".
- "Bcc: $recipient\r\n");
+ // woohoo!!
+ mail ($from, $subject, $message,
+ "From: $from\r\n".
+ "Bcc: $recipient\r\n");
- // tell them that it was sent
- $complete_text = "Your message was successfully sent.";
-}
+ /* Confirmation Send */
+ $url = conf('web_path') . '/admin/mail.php';
+ $title = _('E-mail Sent');
+ $body = _('Your E-mail was successfully sent.');
+ show_confirmation($title,$body,$url);
+ break;
+ default:
+ if ( empty($to) ) {
+ $to = 'all';
+ }
-if ( empty($to) ) {
- $to = 'all';
-}
+ if ( empty($subject) ) {
+ $subject = "[" . conf('site_title') . "] ";
+ }
+ require (conf('prefix') . '/templates/show_mail_users.inc.php');
+ break;
+} // end switch
-if ( empty($subject) ) {
- $site_title = conf('site_title');
- $subject = "[$site_title] ";
-}
+show_footer();
-show_template('header');
-?>
-<form name="mail" method="post" action="<?php echo conf('web_path'); ?>/admin/mail.php" enctype="multipart/form-data">
-
-<p><font color="<?php echo conf('error_color'); ?>"><?php echo $complete_text; ?></font></p>
-
-<table>
- <tr>
- <td><?php echo _("Mail to"); ?>:</td>
- <td>
- <select name="to">
- <option value="all" <?php if ($to == 'all') { echo "selected=\"selected\""; } ?>>All</option>
- <option value="users" <?php if ($to == 'user') { echo "selected=\"selected\""; } ?>>Users</option>
- <option value="admins" <?php if ($to == 'admin') { echo "selected=\"selected\""; } ?>>Admins</option>
- </select>
- </td>
- </tr>
-
- <tr>
- <td><?php echo _("Subject"); ?>:</td>
- <td>
- <input name="subject" value="<?php echo $_POST['subject']; ?>" size="50"></input>
- </td>
- </tr>
-
- <tr>
- <td valign="top"><?php echo _("Message"); ?>:</td>
- <td>
- <textarea class="input" name="message" rows="20" cols="70"><?php echo $message; ?></textarea>
- </td>
- </tr>
-
- <tr>
- <td>&nbsp;</td>
- <td>
- <input type="hidden" name="action" value="send_mail" />
- <input type="submit" value="<?php echo _("Send Mail"); ?>" />
- </td>
- </tr>
-</table>
-
-</form>
-<br /><br />
-<?php show_footer(); ?>
+?>