function album_check_user_exists($user_id)
{
    if ($user_id == ALBUM_PUBLIC_GALLERY) {
        return true;
    }
    $tmpusername = album_get_user_name($user_id);
    return !empty($tmpusername) ? true : false;
}
*
* @Extra credits for this file
* IdleVoid (idlevoid@slater.dk)
*
*/
if (!defined('IN_ICYPHOENIX')) {
    die('Hacking attempt');
}
// ------------------------------------------------------------------------
// $album_user_id, $cat_id and $moderators_list are as default set
// in album.php file in the main folder.
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Get the name of this user
// ------------------------------------------------------------------------
$username = album_get_user_name($album_user_id);
if (empty($username)) {
    if (!defined('STATUS_404')) {
        define('STATUS_404', true);
    }
    message_die(GENERAL_MESSAGE, 'NO_USER');
}
// ------------------------------------
// Build the thumbnail page
// ------------------------------------
if (check_http_var_exists('type', false)) {
    $album_view_type = request_var('type', '');
}
$start = request_var('start', 0);
$start = $start < 0 ? 0 : $start;
$pics_per_page = $album_config['rows_per_page'] * $album_config['cols_per_page'];
function album_display_index($user_id, $cur_cat_id = ALBUM_ROOT_CATEGORY, $show_header = false, $show_public_footer = false, $force_display = false)
{
    global $lang, $config, $template, $images, $album_data, $album_config, $user;
    $keys = array();
    // for testing ONLY
    if (album_is_debug_enabled() == true) {
        if (strcmp($cur_cat_id, 'Root') == 0) {
            die('WRONG ROOT VALUE');
        }
    }
    $is_personal_gallery = $user_id != ALBUM_PUBLIC_GALLERY ? true : false;
    // if we are showing a personal gallery AND we are at the root of personal gallery
    // then ignore the root folder of the personal gallery, since it's 'hidden'
    if ($is_personal_gallery && $cur_cat_id == ALBUM_ROOT_CATEGORY) {
        $cur_cat_id = album_get_personal_root_id($user_id);
    }
    $template->set_filenames(array('album' => 'album_box.tpl'));
    $keys = album_get_auth_keys($cur_cat_id, ALBUM_AUTH_VIEW);
    $display = album_build_index($user_id, $keys, $cur_cat_id, ALBUM_ROOT_CATEGORY, ALBUM_ROOT_CATEGORY);
    if ($force_display && !$is_personal_gallery && sizeof($album_data) == 0) {
        $template->assign_block_vars('catmain', array());
        $template->assign_block_vars('catmain.catrow', array('CAT_TITLE' => $lang['No_Public_Galleries'], 'CAT_IMG' => $images['forum_nor_locked_read']));
        $display = true;
    }
    // Added so that, even if there are no public galleries, the member or user galleries can be reached
    if ($force_display && !$is_personal_gallery && !$display) {
        $display = true;
    }
    // lets do some debugging..
    if (album_is_debug_enabled() == true) {
        album_debug('$user_id = %d<br />$cur_cat_id = %d<br />$display = %d<br />album data = %s<br />authentication keys = %s', $user_id, $cur_cat_id, intval($display), $album_data, $keys);
    }
    if ($display || album_is_debug_enabled() == true) {
        if ($show_header) {
            // create header and send it to template
            $template->assign_block_vars('catheader', array('L_CATEGORY' => $lang['Category'], 'L_PUBLIC_CATS' => !$is_personal_gallery ? $lang['Public_Categories'] : sprintf($lang['Personal_Gallery_Of_User'], album_get_user_name($user_id)), 'U_YOUR_PERSONAL_GALLERY' => append_sid(album_append_uid('album.' . PHP_EXT . '?user_id=' . $user->data['user_id'])), 'L_YOUR_PERSONAL_GALLERY' => $lang['Your_Personal_Gallery'], 'U_USERS_PERSONAL_GALLERIES' => append_sid(album_append_uid('album_personal_index.' . PHP_EXT)), 'L_USERS_PERSONAL_GALLERIES' => $lang['Users_Personal_Galleries']));
            $cols_span = album_generate_index_columns($username);
            // but we need to specificly specify if we want to show the public gallery header
            if ($show_public_footer == true) {
                $template->assign_block_vars('catfooter.cat_public_footer', array('U_YOUR_PERSONAL_GALLERY' => append_sid(album_append_uid('album.' . PHP_EXT . '?user_id=' . $user->data['user_id'])), 'L_YOUR_PERSONAL_GALLERY' => $lang['Your_Personal_Gallery'], 'U_USERS_PERSONAL_GALLERIES' => append_sid(album_append_uid('album_personal_index.' . PHP_EXT)), 'L_USERS_PERSONAL_GALLERIES' => $lang['Users_Personal_Galleries'], 'FOOTER_COL_SPAN' => $cols_span));
                if ($album_config['show_otf_link'] == 1) {
                    $template->assign_block_vars('catfooter.cat_public_footer.show_otf_link', array());
                }
                if ($album_config['show_all_pics_link'] == 1) {
                    $template->assign_block_vars('catfooter.cat_public_footer.show_all_pics_link', array());
                }
                if ($album_config['show_personal_galleries_link'] == 1) {
                    $template->assign_block_vars('catfooter.cat_public_footer.show_personal_galleries_link', array());
                }
            }
        }
        $template->assign_var_from_handle('ALBUM_BOARD_INDEX', 'album');
    }
    return $display;
}