mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-06 03:49:56 +02:00
Allow shout view for unregistered user if auth is not mandatory
Allow graph view for user owner
This commit is contained in:
parent
ca2028256a
commit
657ff21e43
13 changed files with 93 additions and 42 deletions
|
@ -462,12 +462,22 @@ class Graph
|
|||
|
||||
public static function display_from_request()
|
||||
{
|
||||
if (!Access::check('interface','50')) {
|
||||
$object_type = $_REQUEST['object_type'];
|
||||
$object_id = $_REQUEST['object_id'];
|
||||
|
||||
$libitem = null;
|
||||
$owner_id = 0;
|
||||
if ($object_id) {
|
||||
if (Core::is_library_item($object_type)) {
|
||||
$libitem = new $object_type($object_id);
|
||||
$owner_id = $libitem->get_user_owner();
|
||||
}
|
||||
}
|
||||
|
||||
if (($owner_id <= 0 || $owner_id != $GLOBALS['user']->id) && !Access::check('interface','50')) {
|
||||
UI::access_denied();
|
||||
} else {
|
||||
$user_id = $_REQUEST['user_id'];
|
||||
$object_type = $_REQUEST['object_type'];
|
||||
$object_id = $_REQUEST['object_id'];
|
||||
$end_date = $_REQUEST['end_date'] ? strtotime($_REQUEST['end_date']) : time();
|
||||
$f_end_date = date("Y-m-d H:i", $end_date);
|
||||
$start_date = $_REQUEST['start_date'] ? strtotime($_REQUEST['start_date']) : ($end_date - 864000);
|
||||
|
@ -485,13 +495,10 @@ class Graph
|
|||
}
|
||||
|
||||
$blink = '';
|
||||
if ($object_id) {
|
||||
if (Core::is_library_item($object_type)) {
|
||||
$libitem = new $object_type($object_id);
|
||||
$libitem->format();
|
||||
if (isset($libitem->f_link)) {
|
||||
$blink = $libitem->f_link;
|
||||
}
|
||||
if ($libitem !== null) {
|
||||
$libitem->format();
|
||||
if (isset($libitem->f_link)) {
|
||||
$blink = $libitem->f_link;
|
||||
}
|
||||
} else {
|
||||
if ($user_id) {
|
||||
|
|
|
@ -19,22 +19,26 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
$object_type = strtolower(get_class($object));
|
||||
?>
|
||||
<div>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
?>
|
||||
<div style="float: right">
|
||||
<?php
|
||||
$object_type = strtolower(get_class($object));
|
||||
|
||||
$boxtitle = T_('Post to Shoutbox');
|
||||
if ($data) {
|
||||
$boxtitle .= ' (' . $data . ')';
|
||||
}
|
||||
UI::show_box_top($boxtitle, 'box box_add_shout');
|
||||
?>
|
||||
<form method="post" enctype="multipart/form-data" action="<?php echo AmpConfig::get('web_path'); ?>/shout.php?action=add_shout">
|
||||
if ($data) {
|
||||
$boxtitle .= ' (' . $data . ')';
|
||||
}
|
||||
UI::show_box_top($boxtitle, 'box box_add_shout');
|
||||
?>
|
||||
<form method="post" enctype="multipart/form-data" action="<?php echo AmpConfig::get('web_path');
|
||||
?>/shout.php?action=add_shout">
|
||||
<table id="shoutbox-input" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><strong><?php echo T_('Comment:'); ?></strong>
|
||||
<td><strong><?php echo T_('Comment:');
|
||||
?></strong>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><textarea rows="5" cols="35" maxlength="140" name="comment"></textarea></td>
|
||||
|
@ -46,20 +50,29 @@ UI::show_box_top($boxtitle, 'box box_add_shout');
|
|||
?></strong></td>
|
||||
</tr>
|
||||
<?php
|
||||
} ?>
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo Core::form_register('add_shout'); ?>
|
||||
<input type="hidden" name="object_id" value="<?php echo $object->id; ?>" />
|
||||
<input type="hidden" name="object_type" value="<?php echo $object_type; ?>" />
|
||||
<input type="hidden" name="data" value="<?php echo $data; ?>" />
|
||||
<input type="submit" value="<?php echo T_('Create'); ?>" />
|
||||
<?php echo Core::form_register('add_shout');
|
||||
?>
|
||||
<input type="hidden" name="object_id" value="<?php echo $object->id;
|
||||
?>" />
|
||||
<input type="hidden" name="object_type" value="<?php echo $object_type;
|
||||
?>" />
|
||||
<input type="hidden" name="data" value="<?php echo $data;
|
||||
?>" />
|
||||
<input type="submit" value="<?php echo T_('Create');
|
||||
?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php UI::show_box_bottom(); ?>
|
||||
<?php UI::show_box_bottom();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
} ?>
|
||||
<div style="display: inline;">
|
||||
<?php
|
||||
$boxtitle = $object->f_title . ' ' . T_('Shoutbox');
|
||||
|
|
|
@ -163,7 +163,7 @@ if (AmpConfig::get('sociable') && $owner_id > 0) {
|
|||
</li>
|
||||
<?php
|
||||
} ?>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
<?php if (!AmpConfig::get('use_auth') || Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('sociable')) {
|
||||
?>
|
||||
|
@ -177,6 +177,11 @@ if (AmpConfig::get('sociable') && $owner_id > 0) {
|
|||
?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('share')) {
|
||||
?>
|
||||
|
@ -189,7 +194,7 @@ if (AmpConfig::get('sociable') && $owner_id > 0) {
|
|||
?>
|
||||
<?php
|
||||
} ?>
|
||||
<?php if (Access::check('interface','50')) {
|
||||
<?php if (($owner_id > 0 && $owner_id == $GLOBALS['user']->id) || Access::check('interface','50')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('statistical_graphs')) {
|
||||
?>
|
||||
|
|
|
@ -111,7 +111,7 @@ if (Art::is_enabled()) {
|
|||
<?php
|
||||
} ?>
|
||||
<td class="cel_action">
|
||||
<?php if (Access::check('interface','25')) {
|
||||
<?php if (!AmpConfig::get('use_auth') || Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('sociable') && (!$libitem->allow_group_disks || ($libitem->allow_group_disks && !count($libitem->album_suite)))) {
|
||||
?>
|
||||
|
@ -123,6 +123,11 @@ if (Art::is_enabled()) {
|
|||
</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('share') && (!$libitem->allow_group_disks || ($libitem->allow_group_disks && !count($libitem->album_suite)))) {
|
||||
?>
|
||||
|
|
|
@ -189,7 +189,7 @@ if (AmpConfig::get('sociable') && $owner_id > 0) {
|
|||
</li>
|
||||
<?php
|
||||
} ?>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
<?php if (!AmpConfig::get('use_auth') || Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('sociable')) {
|
||||
?>
|
||||
|
@ -218,9 +218,10 @@ if (AmpConfig::get('sociable') && $owner_id > 0) {
|
|||
?>"><?php echo T_('Download');
|
||||
?></a>
|
||||
</li>
|
||||
<?php
|
||||
<?php
|
||||
|
||||
} ?>
|
||||
<?php if (Access::check('interface','50')) {
|
||||
<?php if (($owner_id > 0 && $owner_id == $GLOBALS['user']->id) || Access::check('interface','50')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('statistical_graphs')) {
|
||||
?>
|
||||
|
|
|
@ -104,7 +104,7 @@ if (Art::is_enabled()) {
|
|||
<?php
|
||||
} ?>
|
||||
<td class="cel_action">
|
||||
<?php if (Access::check('interface','25')) {
|
||||
<?php if (!AmpConfig::get('use_auth') || Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('sociable') && (!$libitem->allow_group_disks || ($libitem->allow_group_disks && !count($libitem->album_suite)))) {
|
||||
?>
|
||||
|
|
|
@ -160,7 +160,7 @@ if (!$isVideo && !$isRadio && !$is_share) {
|
|||
echo "var artistobj = '<a href=\"javascript:NavigateTo(\'" . AmpConfig::get('web_path') . "/artists.php?action=show&artist=' + currenti.attr('data-artist_id') + '\');\" title=\"' + obj.artist + '\">' + obj.artist + '</a>';";
|
||||
echo "var lyricsobj = '<a href=\"javascript:NavigateTo(\'" . AmpConfig::get('web_path') . "/song.php?action=show_lyrics&song_id=' + currenti.attr('data-media_id') + '\');\">" . T_('Show Lyrics') . "</a>';";
|
||||
echo "var actionsobj = '|';";
|
||||
if (AmpConfig::get('sociable') && Access::check('interface','25')) {
|
||||
if (AmpConfig::get('sociable') && (!AmpConfig::get('use_auth') || Access::check('interface','25'))) {
|
||||
echo "actionsobj += ' <a href=\"javascript:NavigateTo(\'" . AmpConfig::get('web_path') . "/shout.php?action=show_add_shout&type=song&id=' + currenti.attr('data-media_id') + '\');\">" . UI::get_icon('comment', T_('Post Shout')) . "</a> |';";
|
||||
}
|
||||
echo "actionsobj += '<div id=\'action_buttons\'></div>';";
|
||||
|
|
|
@ -52,7 +52,7 @@ if ($label->website) {
|
|||
<div id="information_actions">
|
||||
<h3><?php echo T_('Actions'); ?>:</h3>
|
||||
<ul>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
<?php if (!AmpConfig::get('use_auth') || Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('sociable')) {
|
||||
?>
|
||||
|
|
|
@ -35,7 +35,7 @@ if (Art::is_enabled()) {
|
|||
<td class="cel_category"><?php echo $libitem->category; ?></td>
|
||||
<td class="cel_artists"><?php echo $libitem->artists; ?></td>
|
||||
<td class="cel_action">
|
||||
<?php if (Access::check('interface','25')) {
|
||||
<?php if (!AmpConfig::get('use_auth') || Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('sociable')) {
|
||||
?>
|
||||
|
|
|
@ -109,7 +109,7 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
<?php
|
||||
} ?>
|
||||
<?php echo Ajax::button('?action=basket&type=song&id=' . $song->id,'add', T_('Add to temporary playlist'),'add_song_' . $song->id); ?>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
<?php if (!AmpConfig::get('use_auth') || Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('sociable')) {
|
||||
?>
|
||||
|
@ -121,6 +121,11 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('share')) {
|
||||
?>
|
||||
|
@ -142,7 +147,7 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
?></a>
|
||||
<?php
|
||||
} ?>
|
||||
<?php if (Access::check('interface','50')) {
|
||||
<?php if (($song->user_upload > 0 && $song->user_upload == $GLOBALS['user']->id) || Access::check('interface','50')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('statistical_graphs')) {
|
||||
?>
|
||||
|
@ -155,7 +160,7 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
?>
|
||||
<?php
|
||||
} ?>
|
||||
<?php if (Access::check('interface','50') || ($libitem->user_upload == $GLOBALS['user']->id && AmpConfig::get('upload_allow_edit'))) {
|
||||
<?php if (Access::check('interface','50') || ($song->user_upload == $GLOBALS['user']->id && AmpConfig::get('upload_allow_edit'))) {
|
||||
?>
|
||||
<a onclick="showEditDialog('song_row', '<?php echo $song->id ?>', '<?php echo 'edit_song_'.$song->id ?>', '<?php echo T_('Edit') ?>', '')">
|
||||
<?php echo UI::get_icon('edit', T_('Edit'));
|
||||
|
|
|
@ -117,7 +117,7 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
<a href="<?php echo $libitem->link;
|
||||
?>"><?php echo UI::get_icon('preferences', T_('Song Information'));
|
||||
?></a>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
<?php if (!AmpConfig::get('use_auth') || Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('sociable')) {
|
||||
?>
|
||||
|
@ -127,6 +127,11 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('share')) {
|
||||
?>
|
||||
|
|
|
@ -112,7 +112,7 @@ $subtitles = $video->get_subtitles();
|
|||
?>
|
||||
<?php
|
||||
} ?>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
<?php if (!AmpConfig::get('use_auth') || Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('sociable')) {
|
||||
?>
|
||||
|
@ -122,6 +122,11 @@ $subtitles = $video->get_subtitles();
|
|||
?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('share')) {
|
||||
?>
|
||||
|
|
|
@ -105,7 +105,7 @@ if ($video_type != 'video') {
|
|||
} ?>
|
||||
<td class="cel_action">
|
||||
<a href="<?php echo $libitem->link; ?>"><?php echo UI::get_icon('preferences', T_('Video Information')); ?></a>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
<?php if (!AmpConfig::get('use_auth') || Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('sociable')) {
|
||||
?>
|
||||
|
@ -115,6 +115,11 @@ if ($video_type != 'video') {
|
|||
?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('share')) {
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue