if (!check_perms('site_torrents_notify')) {
error(403);
}
View::show_header('Manage notifications', 'jquery,jquery.validate,form_validate');
?>
$DB->query("
SELECT
ID,
Label,
Artists,
ExcludeVA,
NewGroupsOnly,
Tags,
NotTags,
ReleaseTypes,
Categories,
Formats,
Encodings,
Media,
FromYear,
ToYear,
Users
FROM users_notify_filters
WHERE UserID=$LoggedUser[ID]");
$NumFilters = $DB->record_count();
$Notifications = $DB->to_array();
$Notifications[] = array(
'ID' => false,
'Label' => '',
'Artists' => '',
'ExcludeVA' => false,
'NewGroupsOnly' => true,
'Tags' => '',
'NotTags' => '',
'ReleaseTypes' => '',
'Categories' => '',
'Formats' => '',
'Encodings' => '',
'Media' => '',
'FromYear' => '',
'ToYear' => '',
'Users' => ''
);
$i = 0;
foreach ($Notifications as $N) { // $N stands for Notifications
$i++;
$NewFilter = $N['ID'] === false;
$N['Artists'] = implode(', ', explode('|', substr($N['Artists'], 1, -1)));
$N['Tags'] = implode(', ', explode('|', substr($N['Tags'], 1, -1)));
$N['NotTags'] = implode(', ', explode('|', substr($N['NotTags'], 1, -1)));
$N['ReleaseTypes'] = explode('|', substr($N['ReleaseTypes'], 1, -1));
$N['Categories'] = explode('|', substr($N['Categories'], 1, -1));
$N['Formats'] = explode('|', substr($N['Formats'], 1, -1));
$N['Encodings'] = explode('|', substr($N['Encodings'], 1, -1));
$N['Media'] = explode('|', substr($N['Media'], 1, -1));
$N['Users'] = explode('|', substr($N['Users'], 1, -1));
$Usernames = '';
foreach ($N['Users'] as $UserID) {
$UserInfo = Users::user_info($UserID);
$Usernames .= $UserInfo['Username'] . ', ';
}
$Usernames = rtrim($Usernames, ', ');
if ($N['FromYear'] == 0) {
$N['FromYear'] = '';
}
if ($N['ToYear'] == 0) {
$N['ToYear'] = '';
}
if ($NewFilter && $NumFilters > 0) {
?>
Create a new notification filter
} elseif ($NumFilters > 0) { ?>
=display_str($N['Label'])?>
Delete
Show
} ?>
} ?>
View::show_footer(); ?>