Skip to content

Commit

Permalink
Stay on shoutbox page when posting a new shout
Browse files Browse the repository at this point in the history
Fix light sidebar home page link
  • Loading branch information
Afterster committed Apr 28, 2015
1 parent b5fa569 commit 0c26c33
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/class/privatemsg.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,17 @@ public static function create(array $data)

if (!Error::occurred()) {
$from_user = $data['from_user'] ?: $GLOBALS['user']->id;
$creation_date = $data['creation_date'] ?: time();
$is_read = $data['is_read'] ?: 0;
$sql = "INSERT INTO `user_pvmsg` (`subject`, `message`, `from_user`, `to_user`, `creation_date`, `is_read`) " .
"VALUES (?, ?, ?, ?, ?, ?)";
if (Dba::write($sql, array($subject, $message, $from_user, $to_user->id, time(), '0'))) {
if (Dba::write($sql, array($subject, $message, $from_user, $to_user->id, $creation_date, $is_read))) {
$insert_id = Dba::insert_id();

// Never send email in case of user impersonation
if (!isset($data['from_user']) && $insert_id) {
if (Preference::get_by_user($to_user->id, 'notify_email')) {
if (!empty($to_user->email)) {
$libitem->format();
$domain = parse_url(AmpConfig::get('web_path'), PHP_URL_HOST);

$mailer = new Mailer();
Expand Down
2 changes: 1 addition & 1 deletion lib/class/update.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2200,7 +2200,7 @@ public static function update_360035()
$retval = true;

$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('stream_beautiful_url','0','Use beautiful stream url',100,'boolean','streaming')";
"VALUES ('stream_beautiful_url','0','Enable url rewriting',100,'boolean','streaming')";
$retval = Dba::write($sql) ? $retval : false;
$id = Dba::insert_id();
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'0')";
Expand Down
6 changes: 6 additions & 0 deletions pvmsg.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
if (isset($_POST['from_user'])) {
unset($_POST['from_user']);
}
if (isset($_POST['creation_date'])) {
unset($_POST['creation_date']);
}
if (isset($_POST['is_read'])) {
unset($_POST['is_read']);
}

$pvmsg_id = PrivateMsg::create($_POST);
if (!$pvmsg_id) {
Expand Down
8 changes: 7 additions & 1 deletion shout.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@
unset($_POST['date']);
}

if (!Core::is_library_item($_POST['object_type'])) {
UI::access_denied();
exit;
}

$shout_id = Shoutbox::create($_POST);
header("Location:" . AmpConfig::get('web_path'));
header("Location:" . AmpConfig::get('web_path') . '/shout.php?action=show_add_shout&type=' . $_POST['object_type'] . '&id=' . intval($_POST['object_id']));
exit;
break;
case 'show_add_shout':
// Get our object first
Expand Down
2 changes: 1 addition & 1 deletion sql/ampache.sql
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ INSERT INTO `preference` (`id`, `name`, `value`, `description`, `level`, `type`,
(98, 'autoupdate_lastversion_new', '', 'AutoUpdate last version from last check is newer', 25, 'boolean', 'internal'),
(99, 'webplayer_confirmclose', '0', 'Confirmation when closing current playing window', 25, 'boolean', 'interface'),
(100, 'webplayer_pausetabs', '1', 'Auto-pause betweens tabs', 25, 'boolean', 'interface'),
(101, 'stream_beautiful_url', '0', 'Use beautiful stream url', 100, 'boolean', 'streaming'),
(101, 'stream_beautiful_url', '0', 'Enable url rewriting', 100, 'boolean', 'streaming'),
(103, 'share_expire', '7', 'Share links default expiration days (0=never)', 100, 'integer', 'system'),
(104, 'slideshow_time', '0', 'Artist slideshow inactivity time', 25, 'integer', 'interface'),
(105, 'broadcast_by_default', '0', 'Broadcast web player by default', 25, 'boolean', 'streaming'),
Expand Down
2 changes: 1 addition & 1 deletion templates/sidebar.light.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
?>

<ul id="sidebar-light">
<li><a href="<?php echo $web_path; ?>"><img src="<?php echo $web_path; ?>/images/topmenu-home.png" title="<?php echo T_('Home'); ?>" /></a></li>
<li><a href="<?php echo $web_path; ?>/index.php"><img src="<?php echo $web_path; ?>/images/topmenu-home.png" title="<?php echo T_('Home'); ?>" /></a></li>
<li><a href="<?php echo $web_path; ?>/browse.php?action=artist"><img src="<?php echo $web_path; ?>/images/topmenu-music.png" title="<?php echo T_('Artists'); ?>" /></a></li>
<li><a href="<?php echo $web_path; ?>/browse.php?action=playlist"><img src="<?php echo $web_path; ?>/images/topmenu-playlist.png" title="<?php echo T_('Playlists'); ?>" /></a></li>
<?php if (AmpConfig::get('userflags')) { ?>
Expand Down

0 comments on commit 0c26c33

Please sign in to comment.