Edito...
raga, ci sono riuscito...
ho copiato questo nell index.php del forum...
Scusate, ma è giorni che tento di capire come funziona il php, e ho le idee confuse...
Codice: Seleziona tutto
/**
* Recent images & comments and random images
*/
/**
* int array including all relevent numbers for rows, columns and stuff like that,
* display int sum of the options which should be displayed, see gallery/includes/constants.php "// Display-options for RRC-Feature" for values
* modes int sum of the modes which should be displayed, see gallery/includes/constants.php "// Mode-options for RRC-Feature" for values
* collapse bool collapse comments
* include_pgalleries bool include personal albums
* mode_id string 'user' or 'album' to only display images of a certain user or album
* id int user_id for user profile or album_id for view of recent and random images
*/
if (phpbb_gallery_config::get('rrc_gindex_mode'))
{
$ints = array(
phpbb_gallery_config::get('rrc_gindex_rows'),
phpbb_gallery_config::get('rrc_gindex_columns'),
phpbb_gallery_config::get('rrc_gindex_crows'),
phpbb_gallery_config::get('rrc_gindex_contests'),
);
$gallery_block = new phpbb_gallery_block(phpbb_gallery_config::get('rrc_gindex_mode'), phpbb_gallery_config::get('rrc_gindex_display'), $ints, phpbb_gallery_config::get('rrc_gindex_comments'), phpbb_gallery_config::get('rrc_gindex_pegas'));
$gallery_block->display();
}
// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_images = phpbb_gallery_config::get('num_images');
$total_comments = phpbb_gallery_config::get('num_comments');
$total_pgalleries = phpbb_gallery_config::get('num_pegas');
//@TODO: Use $user->lang()
$l_total_image_s = ($total_images == 0) ? 'TOTAL_IMAGES_ZERO' : 'TOTAL_IMAGES_OTHER';
$l_total_comment_s = ($total_comments == 0) ? 'TOTAL_COMMENTS_ZERO' : 'TOTAL_COMMENTS_OTHER';
$l_total_pgallery_s = ($total_pgalleries == 0) ? 'TOTAL_PGALLERIES_ZERO' : 'TOTAL_PGALLERIES_OTHER';
// Grab group details for legend display
$legend = '';
if (phpbb_gallery_config::get('disp_whoisonline'))
{
// Copied from phpbb::index.php
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
$sql = 'SELECT group_id, group_name, group_colour, group_type
FROM ' . GROUPS_TABLE . '
WHERE group_legend = 1
ORDER BY group_name ASC';
}
else
{
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
FROM ' . GROUPS_TABLE . ' g
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
ON (
g.group_id = ug.group_id
AND ug.user_id = ' . $user->data['user_id'] . '
AND ug.user_pending = 0
)
WHERE g.group_legend = 1
AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
ORDER BY g.group_name ASC';
}
$result = $db->sql_query($sql);
$legend = array();
while ($row = $db->sql_fetchrow($result))
{
$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
{
$legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
}
else
{
$legend[] = '<a' . $colour_text . ' href="' . phpbb_gallery_url::append_sid('phpbb', 'memberlist', 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>';
}
}
$db->sql_freeresult($result);
$legend = implode(', ', $legend);
}
// Output page
$template->assign_vars(array(
'TOTAL_IMAGES' => (phpbb_gallery_config::get('disp_statistic')) ? $user->lang('TOTAL_IMAGES_SPRINTF', $total_images) : '',
'TOTAL_COMMENTS' => (phpbb_gallery_config::get('allow_comments')) ? sprintf($user->lang[$l_total_comment_s], $total_comments) : '',
'TOTAL_PGALLERIES' => (phpbb_gallery::$auth->acl_check('a_list', phpbb_gallery_auth::PERSONAL_ALBUM)) ? sprintf($user->lang[$l_total_pgallery_s], $total_pgalleries) : '',
'NEWEST_PGALLERIES' => ($total_pgalleries) ? sprintf($user->lang['NEWEST_PGALLERY'], get_username_string('full', phpbb_gallery_config::get('newest_pega_user_id'), phpbb_gallery_config::get('newest_pega_username'), phpbb_gallery_config::get('newest_pega_user_colour'), '', phpbb_gallery_url::append_sid('album', 'album_id=' . phpbb_gallery_config::get('newest_pega_album_id')))) : '',
'S_DISP_LOGIN' => phpbb_gallery_config::get('disp_login'),
'S_DISP_WHOISONLINE' => phpbb_gallery_config::get('disp_whoisonline'),
'LEGEND' => $legend,
'BIRTHDAY_LIST' => $birthday_list,
'S_LOGIN_ACTION' => phpbb_gallery_url::append_sid('phpbb', 'ucp', 'mode=login&redirect=' . urlencode(phpbb_gallery_url::path('relative') . "index.$phpEx" . (($mode == 'personal') ? '?mode=personal' : ''))),
'S_DISPLAY_BIRTHDAY_LIST' => (phpbb_gallery_config::get('disp_birthdays')) ? true : false,
'U_YOUR_PERSONAL_GALLERY' => (phpbb_gallery::$auth->acl_check('i_upload', phpbb_gallery_auth::OWN_ALBUM)) ? (phpbb_gallery::$user->get_data('personal_album_id')) ? phpbb_gallery_url::append_sid('album', 'album_id=' . phpbb_gallery::$user->get_data('personal_album_id')) : phpbb_gallery_url::append_sid('phpbb', 'ucp', 'i=gallery&mode=manage_albums') : '',
'U_USERS_PERSONAL_GALLERIES' => (phpbb_gallery::$auth->acl_check('a_list', phpbb_gallery_auth::PERSONAL_ALBUM)) ? phpbb_gallery_url::append_sid('index', 'mode=personal') : '',
'S_USERS_PERSONAL_GALLERIES' => (!phpbb_gallery_config::get('pegas_index_album') && phpbb_gallery::$auth->acl_check('a_list', phpbb_gallery_auth::PERSONAL_ALBUM)) ? true : false,
'S_CHAR_OPTIONS' => $s_char_options,
'U_MCP' => (phpbb_gallery::$auth->acl_check_global('m_')) ? phpbb_gallery_url::append_sid('mcp', 'mode=overview') : '',
'U_MARK_ALBUMS' => ($user->data['is_registered']) ? phpbb_gallery_url::append_sid('index', 'hash=' . generate_link_hash('global') . '&mark=albums') : '',
'U_G_SEARCH_COMMENTED' => (phpbb_gallery_config::get('allow_comments')) ? phpbb_gallery_url::append_sid('search', 'search_id=commented') : '',
'U_G_SEARCH_CONTESTS' => (phpbb_gallery_config::get('allow_rates') && phpbb_gallery_config::get('contests_ended')) ? phpbb_gallery_url::append_sid('search', 'search_id=contests') : '',
'U_G_SEARCH_RANDOM' => phpbb_gallery_url::append_sid('search', 'search_id=random'),
'U_G_SEARCH_RECENT' => phpbb_gallery_url::append_sid('search', 'search_id=recent'),
'U_G_SEARCH_SELF' => phpbb_gallery_url::append_sid('search', 'search_id=egosearch'),
'U_G_SEARCH_TOPRATED' => (phpbb_gallery_config::get('allow_rates')) ? phpbb_gallery_url::append_sid('search', 'search_id=toprated') : '',
));