//-----------------------------------------------
// Display the album hierarchy index table
// IF there is anything to display
//-----------------------------------------------
function album_display_index($user_id, $cur_cat_id = ALBUM_ROOT_CATEGORY, $show_header = false, $show_public_footer = false, $force_display = false)
{
global $lang, $board_config, $template, $images, $album_data, $album_config, $phpEx, $userdata;
$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) && (count($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_locked']
)
);
$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.' . $phpEx . '?user_id=' . $userdata['user_id'])),
//'U_YOUR_PERSONAL_GALLERY' => append_sid(album_append_uid('album_cat.' . $phpEx . '?cat_id=' . album_get_personal_root_id($userdata['user_id']) . 'user_id=' . $userdata['user_id'])),
'L_YOUR_PERSONAL_GALLERY' => $lang['Your_Personal_Gallery'],
'U_USERS_PERSONAL_GALLERIES' => append_sid(album_append_uid('album_personal_index.' . $phpEx)),
'L_USERS_PERSONAL_GALLERIES' => $lang['Users_Personal_Galleries']
)
);
$cols_span = album_generate_index_columns($username);
// but we need to specific ly 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.' . $phpEx . '?user_id=' . $userdata['user_id'])),
//'U_YOUR_PERSONAL_GALLERY' => append_sid(album_append_uid('album_cat.' . $phpEx . '?cat_id=' . album_get_personal_root_id($userdata['user_id']) . 'user_id=' . $userdata['user_id'])),
'L_YOUR_PERSONAL_GALLERY' => $lang['Your_Personal_Gallery'],
'U_USERS_PERSONAL_GALLERIES' => append_sid(album_append_uid('album_personal_index.' . $phpEx)),
'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;
}