Skip to content

Commit

Permalink
#961 Replace Inbox to the user menu, can now show notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannick committed Nov 10, 2014
1 parent 0f6fa2d commit 72a9706
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
5 changes: 1 addition & 4 deletions db_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,8 @@ function stripslashes_array($array) {

$db->query('INSERT INTO '.$db_prefix.'menu (url, name, disp_position, visible, sys_entry) VALUES(\'search.php\', \'Search\', 3, \'1\', 1)')
or error('Unable to add Search menu item. Please check your configuration and try again', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db_prefix.'menu (url, name, disp_position, visible, sys_entry) VALUES(\'pms_inbox.php\', \'Inbox\', 4, \'1\', 0)')
or error('Unable to add PM menu item. Please check your configuration and try again', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db_prefix.'menu (url, name, disp_position, visible, sys_entry) VALUES(\'backstage/index.php\', \'Backstage\', 5, \'1\', 1)')
$db->query('INSERT INTO '.$db_prefix.'menu (url, name, disp_position, visible, sys_entry) VALUES(\'backstage/index.php\', \'Backstage\', 4, \'1\', 1)')
or error('Unable to add Backstage menu item. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
}

Expand Down
17 changes: 16 additions & 1 deletion header.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ function process_form(the_form) {
// Navbar data
$links = array();
$menu_title = $luna_config['o_board_title'];

$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);

if ($num_new_pm > 0)
$new_inbox = '<span class="label label-danger">'.$num_new_pm.'</span>';
else
$new_inbox = '';
}

$result = $db->query('SELECT id, url, name, disp_position, visible FROM '.$db->prefix.'menu ORDER BY disp_position') or error('Unable to fetch menu items', __FILE__, __LINE__, $db->error());

if ($luna_user['is_guest'])
Expand All @@ -90,10 +103,12 @@ function process_form(the_form) {
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle avatar-item" data-toggle="dropdown">'.$user_avatar.' <span class="fa fa-angle-down"></a>
<a href="#" class="dropdown-toggle avatar-item" data-toggle="dropdown">'.$new_inbox.'&nbsp;&nbsp;&nbsp;&nbsp;'.$user_avatar.' <span class="fa fa-angle-down"></a>
<ul class="dropdown-menu">
<li><a href="pms_inbox.php">Inbox</a></li>
<li><a href="profile.php?id='.$luna_user['id'].'">'.$lang['Profile'].'</a></li>
<li><a href="me.php?id='.$luna_user['id'].'">Me</a></li>
<li class="divider"></li>
<li><a href="help.php">'.$lang['Help'].'</a></li>
<li class="divider"></li>
<li><a href="login.php?action=out&amp;id='.$luna_user['id'].'&amp;csrf_token='.luna_hash($luna_user['id'].luna_hash(get_remote_address())).'">'.$lang['Logout'].'</a></li>
Expand Down
5 changes: 1 addition & 4 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -1803,11 +1803,8 @@ function process_form(the_form) {

$db->query('INSERT INTO '.$db_prefix.'menu (url, name, disp_position, visible, sys_entry) VALUES(\'search.php\', \'Search\', 3, \'1\', 1)')
or error('Unable to add Search menu item. Please check your configuration and try again', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db_prefix.'menu (url, name, disp_position, visible, sys_entry) VALUES(\'pms_inbox.php\', \'Inbox\', 4, \'1\', 0)')
or error('Unable to add PM menu item. Please check your configuration and try again', __FILE__, __LINE__, $db->error());

$db->query('INSERT INTO '.$db_prefix.'menu (url, name, disp_position, visible, sys_entry) VALUES(\'backstage/index.php\', \'Backstage\', 5, \'1\', 1)')
$db->query('INSERT INTO '.$db_prefix.'menu (url, name, disp_position, visible, sys_entry) VALUES(\'backstage/index.php\', \'Backstage\', 4, \'1\', 1)')
or error('Unable to add Backstage menu item. Please check your configuration and try again', __FILE__, __LINE__, $db->error());

// Enable/disable avatars depending on file_uploads setting in PHP configuration
Expand Down

0 comments on commit 72a9706

Please sign in to comment.