Skip to content

Commit

Permalink
#961 Improve delete messages interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannick committed Nov 10, 2014
1 parent 81a32d5 commit df830e9
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 103 deletions.
76 changes: 23 additions & 53 deletions contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
$action = ((isset($_POST['action']) && ($_POST['action'] == 'send' || $_POST['action'] == 'authorize' || $_POST['action'] == 'refuse' || $_POST['action'] == 'delete_multiple')) ? $_POST['action'] : '');


if ($action != '')
{
if ($action != '') {
// Make sure they got here from the site
confirm_referrer('contacts.php');

Expand Down Expand Up @@ -121,58 +120,29 @@
$page_title = array(luna_htmlspecialchars($luna_config['o_board_title']), $lang_pms['Private Messages'], $lang_pms['Multidelete contacts'], $lang_pms['Contacts']);
define('FORUM_ACTIVE_PAGE', 'pm');
require load_page('header.php');
?>
<div class="linkst">
<div class="inbox crumbsplus">
<ul class="crumbs">
<li><a href="index.php"><?php echo $lang['Index'] ?></a></li>
<li><span>»&#160;</span><a href="contacts.php"><?php echo $lang_pms['Contacts'] ?></a></li>
<li><span>»&#160;</span><strong><?php echo $lang_pms['Multidelete contacts'] ?></strong></li>
</ul>
<div class="pagepost"></div>
<div class="clearer"></div>
</div>
</div>
<div class="block2col">
<div class="blockmenu">
<h2><span><?php echo $lang_pms['PM Menu'] ?></span></h2>
<div class="box">
<div class="inbox">
<ul>
<li><a href="inbox.php"><?php echo $lang_pms['Inbox'] ?></a></li>
<li><a href="new_inbox.php"><?php echo $lang_pms['Write message'] ?></a></li>
<li><a href="sending_lists.php"><?php echo $lang_pms['Sending lists'] ?></a></li>
<li class="isactive"><a href="contacts.php"><?php echo $lang_pms['Contacts'] ?></a></li>
</ul>
</div>

load_inbox_nav('contacts');
?>
<form method="post" action="inbox.php">
<div class="panel panel-danger">
<div class="panel-heading">
<h3 class="panel-title">Confirm deletion<span class="pull-right"><input class="btn btn-danger" type="submit" name="delete" value="<?php echo $lang_pms['Delete'] ?>" /></span></h3>
</div>
<div class="panel-body">
<input type="hidden" name="action" value="delete_multiple" />
<input type="hidden" name="contacts" value="<?php echo $idlist ?>" />
<input type="hidden" name="delete_multiple_comply" value="1" />
<p><?php echo $lang_pms['Delete contacts comply'] ?></p>
</div>
</div>
<br />
<div class="blockform">
<div class="box">
<form method="post" action="contacts.php">
<input type="hidden" name="action" value="delete_multiple" />
<input type="hidden" name="contacts" value="<?php echo $idlist ?>" />
<input type="hidden" name="delete_multiple_comply" value="1" />
<div class="inform">
<div class="forminfo">
<p><?php echo $lang_pms['Delete contacts comply'] ?></p>
</div>
</div>
<p class="buttons"><input type="submit" name="delete" value="<?php echo $lang_pms['Delete'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang['Go back'] ?></a></p>
</form>
</div>
</div>
</div>

<?php
require load_page('footer.php');
</form>
<?php
}
}
}

// Add a contact
if (isset($_POST['add']))
else if (isset($_POST['add']))
{
// Make sure they got here from the site
confirm_referrer('contacts.php');
Expand Down Expand Up @@ -213,7 +183,7 @@
}

// Delete a contact
if (isset($_GET['delete']))
else if (isset($_GET['delete']))
{
// Make sure they got here from the site
confirm_referrer('contacts.php');
Expand All @@ -231,7 +201,7 @@
}

// Switch contact status
if (isset($_GET['switch']))
else if (isset($_GET['switch']))
{
// Make sure they got here from the site
confirm_referrer('contacts.php');
Expand All @@ -246,8 +216,7 @@
$result = $db->query('UPDATE '.$db->prefix.'contacts SET allow_msg = 1-allow_msg WHERE id= '.$id) or error('Unable to edit the status of the contact', __FILE__, __LINE__, $db->error());

redirect('contacts.php',$lang_pms['Status redirect']);
}

} else {
// Build page
$page_title = array(luna_htmlspecialchars($luna_config['o_board_title']), $lang_pms['Private Messages'], $lang_pms['Contacts']);

Expand Down Expand Up @@ -363,5 +332,6 @@ function checkAll(checkWhat,command){
</form>

<?php
require load_page('footer.php');
?>
}

require load_page('footer.php');
4 changes: 2 additions & 2 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ function process_form(the_form) {
$num_new_pm = 0;
if ($luna_config['o_pms_enabled'] == '1' && $luna_user['g_pm'] == '1' && $luna_user['use_pm'] == '1') {
// Check for new messages
$result_messages = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'messages WHERE showed=0 AND show_message=1 AND owner='.$luna_user['id']) or error('Unable to check the availibility of new messages', __FILE__, __LINE__, $db->error());
$num_new_pm = $db->result($result_messages);
$result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'messages WHERE showed=0 AND show_message=1 AND owner='.$luna_user['id']) or error('Unable to check the availibility of new messages', __FILE__, __LINE__, $db->error());
$num_new_pm = $db->result($result);

if ($num_new_pm > 0)
$new_inbox = '<span class="label label-danger">'.$num_new_pm.'</span>&nbsp;&nbsp;&nbsp;&nbsp;';
Expand Down
68 changes: 20 additions & 48 deletions sending_lists.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,58 +54,29 @@
$page_title = array(luna_htmlspecialchars($luna_config['o_board_title']), $lang_pms['Private Messages'], $lang_pms['Multidelete lists'], $lang_pms['Sending lists']);
define('FORUM_ACTIVE_PAGE', 'pm');
require load_page('header.php');
?>
<div class="linkst">
<div class="inbox crumbsplus">
<ul class="crumbs">
<li><a href="index.php"><?php echo $lang['Index'] ?></a></li>
<li><span>»&#160;</span><a href="sending_lists.php"><?php echo $lang_pms['Sending lists'] ?></a></li>
<li><span>»&#160;</span><strong><?php echo $lang_pms['Multidelete lists'] ?></strong></li>
</ul>
<div class="pagepost"></div>
<div class="clearer"></div>
</div>
</div>
<div class="block2col">
<div class="blockmenu">
<h2><span><?php echo $lang_pms['PM Menu'] ?></span></h2>
<div class="box">
<div class="inbox">
<ul>
<li><a href="inbox.php"><?php echo $lang_pms['Inbox'] ?></a></li>
<li><a href="new_inbox.php"><?php echo $lang_pms['Write message'] ?></a></li>
<li class="isactive"><a href="sending_lists.php"><?php echo $lang_pms['Sending lists'] ?></a></li>
<li><a href="contacts.php"><?php echo $lang_pms['Contacts'] ?></a></li>
</ul>
</div>

load_inbox_nav('lists');
?>
<form method="post" action="sending_lists.php">
<div class="panel panel-danger">
<div class="panel-heading">
<h3 class="panel-title">Confirm deletion<span class="pull-right"><input class="btn btn-danger" type="submit" name="delete" value="<?php echo $lang_pms['Delete'] ?>" /></span></h3>
</div>
<div class="panel-body">
<input type="hidden" name="action" value="delete_multiple" />
<input type="hidden" name="selected_lists" value="<?php echo $idlist ?>" />
<input type="hidden" name="delete_multiple_comply" value="1" />
<p><?php echo $lang_pms['Delete lists comply'] ?></p>
</div>
</div>
<br />
<div class="blockform">
<div class="box">
<form method="post" action="">
<input type="hidden" name="action" value="delete_multiple" />
<input type="hidden" name="selected_lists" value="<?php echo $idlist ?>" />
<input type="hidden" name="delete_multiple_comply" value="1" />
<div class="inform">
<div class="forminfo">
<p><?php echo $lang_pms['Delete lists comply'] ?></p>
</div>
</div>
<p class="buttons"><input type="submit" name="delete" value="<?php echo $lang_pms['Delete'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang['Go back'] ?></a></p>
</form>
</div>
</div>
</div>

</form>
<?php
require load_page('footer.php');
}
}
}

// Add a list
if (isset($_POST['form_sent']))
else if (isset($_POST['form_sent']))
{
// Make sure they got here from the site
confirm_referrer('sending_lists.php');
Expand Down Expand Up @@ -160,7 +131,7 @@
}

// Delete a list
if (isset($_GET['delete']))
else if (isset($_GET['delete']))
{
$id = intval($_GET['delete']);

Expand All @@ -172,7 +143,7 @@
$result = $db->query('DELETE FROM '.$db->prefix.'sending_lists WHERE id= '.$id) or error('Unable to delete the list', __FILE__, __LINE__, $db->error());

redirect('sending_lists.php', $lang_pms['Deleted list redirect']);
}
} else {

// Build page
$page_title = array(luna_htmlspecialchars($luna_config['o_board_title']), $lang_pms['Private Messages'], $lang_pms['Sending lists']);
Expand Down Expand Up @@ -280,5 +251,6 @@ function checkAll(checkWhat,command){
</form>

<?php
require load_page('footer.php');
?>
}

require load_page('footer.php');

0 comments on commit df830e9

Please sign in to comment.