//
//
// Verify Custom Title Status
//
$membertime = $mode != 'register' ? time() - $userdata['user_regdate'] : 0;
$custom_title_activated = FALSE;
if ($userdata['user_custom_title_status'] == CUSTOM_TITLE_ENABLED || $userdata['user_custom_title_status'] == CUSTOM_TITLE_REGDATE && $membertime >= $board_config['custom_title_days'] * 86400 && $userdata['user_posts'] >= $board_config['custom_title_posts']) {
    $custom_title_activated = TRUE;
    $lang['profilcp_signature_shortcut'] = $lang['Custom_title'] . '/Signature';
}
//
// Custom Title MOD End
//
if (!empty($setmodules)) {
    if ($board_config['allow_sig']) {
        pcp_set_sub_menu('profil', 'signature', 30, __FILE__, 'profilcp_signature_shortcut', 'profilcp_signature_pagetitle');
    }
    return;
}
// check access
if ($userdata['user_id'] != $view_userdata['user_id'] && (!is_admin($userdata) || $level_prior[get_user_level($userdata)] <= $level_prior[get_user_level($view_userdata)])) {
    return;
}
//
// template file
$template->set_filenames(array('body' => 'profilcp/profil_signature_body.tpl'));
if ($submit || $preview) {
    //
    // Custom Title MOD
    //
    $custom_title = str_replace('<br />', "\n", trim(str_replace("\\'", "''", $HTTP_POST_VARS['custom_title'])));
//
// FILENAME	 : profilecp_public_groups.php
// STARTED	 : Tue Jan 1, 2004
// COPYRIGHT : © 2003, 2004	Project	Minerva	Team
//           : © 2001, 2003 The phpBB Group
//           : © 2003       Ptirhiik
// WWW		 : http://www.project-minerva.org/
// LICENCE	 : GPL v2.0	[ see /docs/COPYING	]
//
//--------------------------------------------------------------------------------------------------
if (!defined('IN_PHPBB')) {
    die('Hacking attempt');
    exit;
}
if (!empty($setmodules)) {
    pcp_set_sub_menu('viewprofile', 'groups', 20, __FILE__, 'profilcp_public_groups_shortcut', 'profilcp_public_groups_pagetitle');
    return;
}
//
// template file
$template->set_filenames(array('body' => 'profilcp/public_groups_body.tpl'));
$template->assign_block_vars('full_panel', array());
// groupes
$groups = array();
$sql = "SELECT\n\t\t\tg.group_id,\n\t\t\tg.group_name,\n\t\t\tg.group_description,\n\t\t\tg.group_type\n\t\tFROM\n\t\t\t" . USER_GROUP_TABLE . " l,\n\t\t\t" . GROUPS_TABLE . " g\n\t\tWHERE l.user_pending = 0\n\t\t\tAND g.group_single_user = 0\n\t\t\tAND l.user_id = {$view_user_id}\n\t\t\tAND g.group_id = l.group_id\n\t\tORDER BY\n\t\t\tg.group_name,\n\t\t\tg.group_id";
if (!($result = $db->sql_query($sql))) {
    message_die(GENERAL_ERROR, 'Could not read groups', '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result)) {
    $groups[] = $row;
}
                        $pgm = __FILE__;
                    }
                    $order = $user_maps[$map_root]['order'];
                    $shortcut = $user_maps[$map_root]['title'];
                    $pagetitle = $user_maps[$map_root]['title'];
                    pcp_set_menu($map_tree[$i], $order, $pgm, $shortcut, $pagetitle);
                }
                if ($i > 1) {
                    $pgm = '';
                    if ($i == count($map_tree) - 1) {
                        $pgm = __FILE__;
                    }
                    $order = $user_maps[$map_root]['order'];
                    $shortcut = $user_maps[$map_root]['title'];
                    $pagetitle = $user_maps[$map_root]['title'];
                    pcp_set_sub_menu($map_tree[$i - 1], $map_tree[$i], $order, $pgm, $shortcut, $pagetitle);
                }
            }
        }
    }
    return;
}
//----------------------------------------
//
// inits
//
//----------------------------------------
// ids
$user_id = $userdata['user_id'];
$view_user_id = $view_userdata['user_id'];
// get buddy infos
                    $res_maps[$map_tree[$start - 1]][$map_tree[$start]]['shortcut'] = $user_maps[$map_root]['title'];
                    $res_maps[$map_tree[$start - 1]][$map_tree[$start]]['pagetitle'] = $user_maps[$map_root]['title'];
                    break;
                }
            }
        }
    }
    // process the maps found
    @reset($res_maps);
    while (list($main, $main_data) = @each($res_maps)) {
        @reset($main_data);
        while (list($sub, $data) = @each($main_data)) {
            if (empty($sub)) {
                pcp_set_menu($main, $data['order'], $data['pgm'], $data['shortcut'], $data['pagetitle']);
            } else {
                pcp_set_sub_menu($main, $sub, $data['order'], $data['pgm'], $data['shortcut'], $data['pagetitle']);
            }
        }
    }
    return;
}
// access to users admins and himself
if ($userdata['user_id'] != $view_userdata['user_id'] && !is_admin($userdata)) {
    return;
}
// create entry if NULL : fix isset issue
@reset($view_userdata);
while (list($key, $data) = each($view_userdata)) {
    if ($view_userdata[$key] == NULL) {
        $view_userdata[$key] = '';
    }
// COPYRIGHT : © 2003, 2004	Project	Minerva	Team
//           : © 2001, 2003 The phpBB Group
//           : © 2003       Ptirhiik
// WWW		 : http://www.project-minerva.org/
// LICENCE	 : GPL v2.0	[ see /docs/COPYING	]
//
//--------------------------------------------------------------------------------------------------
if (!defined('IN_PHPBB')) {
    die('Hacking attempt');
    exit;
}
if (!empty($setmodules)) {
    pcp_set_menu('buddy', 70, __FILE__, 'profilcp_buddy_shortcut', 'profilcp_buddy_pagetitle');
    pcp_set_sub_menu('buddy', 'friend', 10, __FILE__, 'profilcp_buddy_friend_shortcut', 'profilcp_buddy_friend_pagetitle');
    pcp_set_sub_menu('buddy', 'ignore', 20, __FILE__, 'profilcp_buddy_ignore_shortcut', 'profilcp_buddy_ignore_pagetitle');
    pcp_set_sub_menu('buddy', 'memberlist', 30, __FILE__, 'profilcp_buddy_list_shortcut', 'profilcp_buddy_list_pagetitle');
    return;
}
// map used
$map_name = 'PCP.buddy';
// check access
if ($userdata['user_id'] != $view_userdata['user_id'] && (!is_admin($userdata) || $level_prior[get_user_level($userdata)] <= $level_prior[get_user_level($view_userdata)])) {
    return;
}
// operators
$operators = array('LE' => $lang['Comp_LE'], 'EQ' => $lang['Comp_EQ'], 'NE' => $lang['Comp_NE'], 'GE' => $lang['Comp_GE'], 'IN' => $lang['Comp_IN'], 'NI' => $lang['Comp_NI']);
// buddy id
$buddy_id = -1;
if (isset($HTTP_POST_VARS['b']) || isset($HTTP_GET_VARS['b'])) {
    $buddy_id = isset($HTTP_POST_VARS['b']) ? intval($HTTP_POST_VARS['b']) : intval($HTTP_GET_VARS['b']);
}
// FILENAME	 : profilecp_profil_avatar.php
// STARTED	 : Tue Jan 1, 2004
// COPYRIGHT : © 2003, 2004	Project	Minerva	Team
//           : © 2001, 2003 The phpBB Group
//           : © 2003       Ptirhiik
// WWW		 : http://www.project-minerva.org/
// LICENCE	 : GPL v2.0	[ see /docs/COPYING	]
//
//--------------------------------------------------------------------------------------------------
if (!defined('IN_PHPBB')) {
    die('Hacking attempt');
    exit;
}
if (!empty($setmodules)) {
    if ($board_config['allow_avatar_upload'] || $board_config['allow_avatar_remote'] || $board_config['allow_avatar_local']) {
        pcp_set_sub_menu('profil', 'avatar', 30, __FILE__, 'profilcp_avatar_shortcut', 'profilcp_avatar_pagetitle');
    }
    return;
}
// check access
if ($userdata['user_id'] != $view_userdata['user_id'] && (!is_admin($userdata) || $level_prior[get_user_level($userdata)] <= $level_prior[get_user_level($view_userdata)])) {
    return;
}
//
// template file
$template->set_filenames(array('body' => 'profilcp/profil_avatar_body.tpl'));
if ($submit) {
    $user_avatar_local = !empty($HTTP_POST_VARS['avatarlocal']) && $board_config['allow_avatar_local'] ? trim(htmlspecialchars($HTTP_POST_VARS['avatarlocal'])) : '';
    $user_avatar_remoteurl = !empty($HTTP_POST_VARS['avatarremoteurl']) ? trim(htmlspecialchars($HTTP_POST_VARS['avatarremoteurl'])) : '';
    $user_avatar_upload = !empty($HTTP_POST_VARS['avatarurl']) ? trim($HTTP_POST_VARS['avatarurl']) : ($HTTP_POST_FILES['avatar']['tmp_name'] != "none" ? $HTTP_POST_FILES['avatar']['tmp_name'] : '');
    $user_avatar_name = !empty($HTTP_POST_FILES['avatar']['name']) ? $HTTP_POST_FILES['avatar']['name'] : '';