getSubmitData();
if (iMEMBER) {
$messages_count = dbquery("SELECT
SUM(message_folder=0) AS inbox_count,
SUM(message_folder=1) AS outbox_count,
SUM(message_folder=2) AS archive_count,
SUM(message_read=0 AND message_folder=0) AS unread_count
FROM ".DB_MESSAGES."
WHERE message_to=:user_id", [':user_id' => $userdata['user_id']]);
$messages_count = dbarray($messages_count);
$inbox_count = (int)$messages_count['inbox_count'];
$outbox_count = (int)$messages_count['outbox_count'];
$archive_count = (int)$messages_count['archive_count'];
$msg_count = (int)$messages_count['unread_count'];
$forum_exists = defined('FORUM_EXIST');
$forum_settings = get_settings('forum');
$pm_progress = '';
if (!iSUPERADMIN) {
$inbox_cfg = user_pm_settings($userdata['user_id'], "user_inbox");
if ($inbox_cfg !== 0) {
$inbox_percent = $inbox_cfg > 1 ? number_format(($inbox_count / $inbox_cfg) * 99, 0) : number_format(0 * 99, 0);
$pm_progress .= progress_bar($inbox_percent, $locale['UM098'], ['reverse' => TRUE, 'disabled' => ($inbox_cfg == 0 ? TRUE : FALSE)]);
}
$outbox_cfg = user_pm_settings($userdata['user_id'], "user_outbox");
if ($outbox_cfg !== 0) {
$outbox_percent = $outbox_cfg > 1 ? number_format(($outbox_count / $outbox_cfg) * 99, 0) : number_format(0 * 99, 0);
$pm_progress .= progress_bar($outbox_percent, $locale['UM099'], ['reverse' => TRUE, 'disabled' => ($inbox_cfg == 0 ? TRUE : FALSE)]);
}
$archive_cfg = user_pm_settings($userdata['user_id'], "user_archive");
if ($archive_cfg !== 0) {
$archive_percent = $archive_cfg > 1 ? number_format(($archive_count / $archive_cfg) * 99, 0) : number_format(0 * 99, 0);
$pm_progress .= progress_bar($archive_percent, $locale['UM100'], ['reverse' => TRUE, 'disabled' => ($inbox_cfg == 0 ? TRUE : FALSE)]);
}
}
$submissions_link_arr = [];
$submissions_link = '';
if (!empty($modules)) {
foreach ($modules as $stype => $title) {
$submissions_link_arr[] = [
'link' => BASEDIR.$title['submit_link'],
'title' => sprintf($title['title'], str_replace('...', '', fusion_get_locale('UM089', LOCALE.LOCALESET."global.php"))),
];
}
}
$info = [
'forum_exists' => $forum_exists,
'show_reputation' => !empty($forum_settings['forum_show_reputation']) && $forum_settings['forum_show_reputation'] ? 1 : 0,
'user_avatar' => display_avatar($userdata, '90px', '', FALSE, ''),
'user_name' => profile_link($userdata['user_id'], $userdata['user_name'], $userdata['user_status']),
'user_level' => $userdata['user_level'],
'user_reputation' => $forum_exists ? fusion_get_userdata('user_reputation') ?: 0 : '',
'user_reputation_icon' => $forum_exists ? "\n" : '',
'user_pm_link' => BASEDIR."messages.php?folder=inbox",
'user_pm_title' => sprintf($locale['UM085'], $msg_count).($msg_count == 1 ? $locale['UM086'] : $locale['UM087']),
'submissions' => $submissions_link_arr
] + $userdata;
ob_start();
display_user_info_panel($info);
echo strtr(ob_get_clean(), [
'{%openside%}' => fusion_get_function('openside', $locale['UM096'].$userdata['user_name']),
'{%closeside%}' => fusion_get_function('closeside'),
'{%user_avatar%}' => $info['user_avatar'],
'{%user_name%}' => $info['user_name'],
'{%user_level%}' => getuserlevel($info['user_level']),
'{%user_reputation_icon%}' => $info['user_reputation_icon'],
'{%user_reputation%}' => $info['user_reputation'],
'{%user_pm_notice%}' => ($msg_count ? " $msg_count" : ''),
'{%user_pm_progressbar%}' => $pm_progress,
'{%user_nav_title%}' => $locale['UM097'],
'{%edit_profile_link%}' => BASEDIR."edit_profile.php",
'{%edit_profile_title%}' => $locale['UM080'],
'{%pm_link%}' => BASEDIR."messages.php",
'{%pm_title%}' => $locale['UM081'],
'{%track_link%}' => $forum_exists ? INFUSIONS."forum_threads_list_panel/my_tracked_threads.php" : '',
'{%track_title%}' => $forum_exists ? $locale['UM088'] : '',
'{%member_link%}' => BASEDIR."members.php",
'{%member_title%}' => $locale['UM082'],
'{%acp_link%}' => (iADMIN ? ADMIN."index.php".fusion_get_aidlink()."&pagenum=0" : ''),
'{%acp_title%}' => (iADMIN ? $locale['UM083'] : ''),
'{%logout_link%}' => BASEDIR."index.php?logout=yes",
'{%logout_title%}' => $locale['UM084']
]);
} else {
if (!preg_match('/login.php/i', FUSION_SELF)) {
$action_url = FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : "");
if (isset($_GET['redirect']) && strstr($_GET['redirect'], "/")) {
$action_url = cleanurl(urldecode($_GET['redirect']));
}
switch (fusion_get_settings("login_method")) {
case 2 :
$placeholder = $locale['global_101c'];
break;
case 1 :
$placeholder = $locale['global_101b'];
break;
default:
$placeholder = $locale['global_101a'];
}
$info = [
'title' => $locale['global_100'],
'open_side' => fusion_get_function('openside', $locale['global_100']),
'close_side' => fusion_get_function('closeside'),
'login_openform' => openform('loginform', 'post', $action_url),
'login_closeform' => closeform(),
'login_name_field' => form_text('user_name', $locale['global_101'], '', [
'placeholder' => $placeholder,
'required' => 1
]),
'login_pass_field' => form_text('user_pass', $locale['global_102'], '', [
'placeholder' => $locale['global_102'],
'type' => 'password',
'required' => 1
]),
'login_remember_field' => form_checkbox('remember_me', $locale['global_103'], '', ['value' => 'y']),
'login_submit' => form_button('login', $locale['global_104'], '', ['class' => 'm-t-20 m-b-20 btn-block btn-primary']),
'registration_' => (fusion_get_settings('enable_registration') ? strtr($locale['global_105'], ['[LINK]' => "", '[/LINK]' => "\n"]) : ''),
'lostpassword_' => strtr($locale['global_106'], ['[LINK]' => "", '[/LINK]' => ""])
];
ob_start();
echo $info['login_openform'];
display_user_info_panel($info);
echo $info['login_closeform'];
echo strtr(ob_get_clean(),
[
'{%openside%}' => $info['open_side'],
'{%closeside%}' => $info['close_side'],
'{%login_name_field%}' => $info['login_name_field'],
'{%login_pass_field%}' => $info['login_pass_field'],
'{%login_remember_field%}' => $info['login_remember_field'],
'{%login_submit%}' => $info['login_submit'],
'{%registration_%}' => $info['registration_'],
'{%lostpassword_%}' => $info['lostpassword_'],
]
);
}
}