phpBB Italia chiude!
phpBB Italia ringrazia tutti gli utenti che hanno dato fiducia al nostro progetto per ben 9 anni, e che, grazie al grande lavoro fatto da tutto lo Staff (rigorosamente a titolo gratuito), hanno portato il portale a diventare il principale punto di riferimento italiano alla piattaforma phpBB.
Purtroppo, causa motivi personali, non ho più modo di gestirlo e portarlo avanti. Il forum viene ora posto in uno stato di sola lettura, nonché un archivio storico per permettere a chiunque di fruire di tutte le discussioni trattate.
Il nuovo portale di assistenza per l'Italia di phpBB diventa phpBB-Store.it, cui ringrazio per aver deciso di portare avanti questo grande progetto.
Grazie ancora,
Carlo - Amministratore di phpBB Italia
phpBB Italia ringrazia tutti gli utenti che hanno dato fiducia al nostro progetto per ben 9 anni, e che, grazie al grande lavoro fatto da tutto lo Staff (rigorosamente a titolo gratuito), hanno portato il portale a diventare il principale punto di riferimento italiano alla piattaforma phpBB.
Purtroppo, causa motivi personali, non ho più modo di gestirlo e portarlo avanti. Il forum viene ora posto in uno stato di sola lettura, nonché un archivio storico per permettere a chiunque di fruire di tutte le discussioni trattate.
Il nuovo portale di assistenza per l'Italia di phpBB diventa phpBB-Store.it, cui ringrazio per aver deciso di portare avanti questo grande progetto.
Grazie ancora,
Carlo - Amministratore di phpBB Italia
[DEV] View Last Pictures 2
- Micogian
- Leader Programmatori
- Messaggi: 3704
- Iscritto il: 07/01/2010, 8:51
- Versione: 3.2.0
- Server: UNIX/Linux
- PHP: 5.4.36
- Database: MySQL 5.1.70-log
- Località: Udine
- Contatta:
Re: [DEV] View Last Pictures 2
Hai mai usato la funzione "cerca" ???????
Ho detto che ho sbagliato io e mi sembra di averti passato due codici, uno per ilPHP e uno per il template.
L'errore è nel PHP.
http://www.phpbbitalia.net/forum/mods-i ... tml#p24534
Ho detto che ho sbagliato io e mi sembra di averti passato due codici, uno per ilPHP e uno per il template.
L'errore è nel PHP.
http://www.phpbbitalia.net/forum/mods-i ... tml#p24534
-
- Utente
- Messaggi: 212
- Iscritto il: 27/09/2010, 8:12
- Versione: 3.0.9
- Server: UNIX/Linux
- PHP: 5.2.17
- Database: MySQL 5.1.60-community-log
- Contatta:
Re: [DEV] View Last Pictures 2
nel mio file index non e presente quel codice te lo allego
Codice: Seleziona tutto
<?php
/**
*
* @package phpBB3
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
display_forums('', $config['load_moderators']);
// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts = $config['num_posts'];
$total_topics = $config['num_topics'];
$total_users = $config['num_users'];
$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
$boarddays = ceil((time() - $config['board_startdate']) / 86400);
$posts_per_day = $total_posts / $boarddays;
$l_posts_per_day_s = ($posts_per_day == 0) ? 'POSTS_PER_DAY_ZERO' : 'POSTS_PER_DAY_OTHER';
$boarddays = ceil((time() - $config['board_startdate']) / 86400);
$topics_per_day = $total_topics / $boarddays;
$l_topics_per_day_s = ($topics_per_day == 0) ? 'TOPICS_PER_DAY_ZERO' : 'TOPICS_PER_DAY_OTHER';
$boarddays = ceil((time() - $config['board_startdate']) / 86400);
$users_per_day = $total_users / $boarddays;
$l_users_per_day_s = ($users_per_day == 0) ? 'USERS_PER_DAY_ZERO' : 'USERS_PER_DAY_OTHER';
// Grab group details for legend display
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="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>';
}
}
$db->sql_freeresult($result);
$legend = implode(', ', $legend);
// Generate birthday list if required ...
$birthday_list = '';
if ($config['load_birthdays'] && $config['allow_birthdays'])
{
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
$sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
FROM ' . USERS_TABLE . ' u
LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
WHERE (b.ban_id IS NULL
OR b.ban_exclude = 1)
AND u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
if ($age = (int) substr($row['user_birthday'], -4))
{
$birthday_list .= ' (' . ($now['year'] - $age) . ')';
}
}
$db->sql_freeresult($result);
}
if ( isset($config['announcement_enable']))
{
if ( $config['announcement_show_index'] && ($config['announcement_enable'] || $config['announcement_show_birthdays_always']) )
{
if (!function_exists('get_announcement_data'))
{
include($phpbb_root_path . 'includes/functions_announcements.' . $phpEx);
}
get_announcement_data();
}
}
// Assign index specific vars
$template->assign_vars(array(
'TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts),
'TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics),
'TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users),
'POSTS_PER_DAY' => sprintf($user->lang[$l_posts_per_day_s], $posts_per_day),
'TOPICS_PER_DAY' => sprintf($user->lang[$l_topics_per_day_s], $topics_per_day),
'USERS_PER_DAY' => sprintf($user->lang[$l_users_per_day_s], $users_per_day),
'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
'LEGEND' => $legend,
'BIRTHDAY_LIST' => $birthday_list,
'FORUM_IMG' => $user->img('forum_read', 'NO_NEW_POSTS'),
'FORUM_NEW_IMG' => $user->img('forum_unread', 'NEW_POSTS'),
'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
'FORUM_NEW_LOCKED_IMG' => $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),
'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,
'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums') : '',
'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '')
);
// ####### INIZIO MOD VIEW LAST PICTURES ##########
// function che copia l'allegato in formato thumb
function resize_thumbs($physical,$attach_id){
$img_des = $phpbb_root_path . "thumbs/" . $attach_id . ".jpg" ;
// Ottengo le informazioni sull'immagine originale
list($width, $height, $type, $attr) = getimagesize($phpbb_root_path . "files/" . $physical);
// Creo la versione ridimensionata dell'immagine (thumbnail)
$new_height = '120' ;
$new_width = ($width * $new_height / $height);
$thumb = imagecreatetruecolor($new_width, $new_height);
$source = imagecreatefromjpeg($phpbb_root_path . "files/" . $physical);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Salvo l'immagine ridimensionata
imagejpeg($thumb, $img_des, 75);
return "thumbs/". $attach_id . ".jpg" ;
}
$forum_attach_id = 24; // ATTENZIONE inserire il forum_id (padre) dal quale si vuole estrarre gli allegati
// Redirect to login upon emailed notification links
if (isset($_GET['e']) && !$user->data['is_registered'])
{
login_box('', $user->lang['LOGIN_NOTIFY_FORUM']);
}
$sql = "SELECT f.*
FROM ".FORUMS_TABLE." f
WHERE f.forum_id = " . (isset($forum_attach_id) ? $forum_attach_id : 0);
$result = $db->sql_query($sql);
$forum_attach_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// Check if forum exist
if (!$forum_attach_data)
{
trigger_error('NO_FORUM');
}
// Check if user have permissions
if (!$auth->acl_gets('f_list', 'f_read', $forum_attach_id) || ($forum_attach_data['forum_type'] == FORUM_LINK && $forum_attach_data['forum_link'] && !$auth->acl_get('f_read', $forum_attach_id)))
{
if ($user->data['user_id'] != ANONYMOUS)
{
trigger_error('SORRY_AUTH_READ');
}
login_box('', $user->lang['LOGIN_VIEWFORUM']);
}
// Check if forum is passworded
if ($forum_attach_data['forum_password'])
{
login_forum_box($forum_attach_data);
}
//query per estrarre gli ultimi 6 Topics con allegati
$sql = "SELECT
pt.topic_id, pt.forum_id, pt.topic_title, pt.topic_first_poster_name, pt.topic_attachment, pf.forum_name, pf.parent_id, pf.forum_id, pt.topic_time
FROM ". TOPICS_TABLE." pt,". FORUMS_TABLE. " pf
WHERE pt.forum_id IN(12,13,14,15,16,17,19,20,21,22,24,26,29,30,31,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,49,51,52,53,55,56,57,60,61,62,63,64,65,69,70,71,79,82,83,84,85,86,88,89,90,91,95,97,98,99,100,102,105,104,106,107,108,109,111,112,114,115,117,118,119,120,121,122,123,124)
AND pt.forum_id = pf.forum_id
AND pt.topic_attachment = 1
ORDER BY pt.topic_time DESC LIMIT 6";
$db->sql_query($sql);
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$topic_id = $row['topic_id'];
// ricerca il primo attach_id dei topics selezionati
$sql_pic = "SELECT pa.attach_id, pa.topic_id, pa.physical_filename, pa.extension
FROM ". ATTACHMENTS_TABLE." pa
WHERE pa.topic_id = $topic_id
AND pa.extension = 'jpg'
ORDER BY pa.attach_id LIMIT 1" ;
$db->sql_query($sql_pic);
$result1 = $db->sql_query($sql_pic);
$row1 = $db->sql_fetchrow($result1);
$attach_id = $row1['attach_id'];
$physical = $row1['physical_filename'];
$thumbs = "thumbs/". $attach_id . ".jpg" ;
if (is_file($thumbs)){
$thumb_cor = $thumbs ; // se il file thumb esiste visualizza questo
}else{
$thumb_cor = resize_thumbs($physical, $attach_id); // altrimenti lo crea
}
// assegna le variabili da passare al file HTML
$template->assign_block_vars('attach_list', array(
'MY_TOPIC_ID' => $row['topic_id'],
'MY_FORUM_ID' => $row['forum_id'],
'MY_TOPIC_TITLE' => $row['topic_title'],
'MY_TOPIC_LINK' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't='.$row['topic_id']),
'MY_ATTACH_LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'id='.$attach_id),
'MY_FORUM_NAME' => $row['forum_name'],
'MY_TOPIC_AUTHOR' => $row['topic_first_poster_name'],
'MY_ATTACH_ID' => $attach_id,
'MY_THUMBS' => $thumb_cor
));
}
//$db->sql_freeresult($result);
// ####### FINE MOD VIEW LAST PICTURES ##########
// ----- inizio MOD Top Ten Topics : 10 Topics più visti, 10 Topics con maggiori risposte e 10 Topics più recenti ------
// INIZIO - 10 Topics più Visti
$sql1 = "SELECT topic_id, forum_id, topic_title, topic_first_poster_name, topic_views FROM " . TOPICS_TABLE . " ORDER BY topic_views DESC LIMIT 0,10";
$result1 = $db->sql_query($sql1);
while ($row1 = $db->sql_fetchrow($result1))
{
if ($auth->acl_get('f_read', $row1['forum_id']) == 1) {
$template->assign_block_vars('topics_view', array(
'VIEW_LINK' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row1['forum_id'] . "&t=" . $row1['topic_id']),
'VIEW_TITOLO' => $row1['topic_title'],
'VIEW_AUTHOR' => $row1['topic_first_poster_name'],
'VIEW_VIEWS' => $row1['topic_views']
));
}
}
$db->sql_freeresult($result1);
// FINE QUERY 10 TOPICS PIU' VISTI
// INIZIO - 10 TOPIC CON PIU' RISPOSTE
$sql2 = "SELECT topic_id, forum_id, topic_title, topic_first_poster_name, topic_replies FROM " . TOPICS_TABLE . " ORDER BY topic_replies DESC LIMIT 0,10";
$result2 = $db->sql_query($sql2);
while ($row2 = $db->sql_fetchrow($result2))
{
if ($auth->acl_get('f_read', $row2['forum_id']) == 1) {
$template->assign_block_vars('topics_replies', array(
'REPLIES_LINK' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row2['forum_id'] . "&t=" . $row2['topic_id']),
'REPLIES_TITOLO' => $row2['topic_title'],
'REPLIES_AUTHOR' => $row2['topic_first_poster_name'],
'REPLIES_REPLIES' => $row2['topic_replies']
));
}
}
$db->sql_freeresult($result);
// FINE QUERY 10 TOPICS CON PIU' RISPOSTE
// INIZIO - 10 Topics più Recenti
$sql3 = "SELECT topic_id, forum_id, topic_title, topic_time, topic_moved_id, topic_first_poster_name
FROM " . TOPICS_TABLE . "
WHERE topic_type = 0
AND topic_moved_id = 0
ORDER BY topic_time DESC LIMIT 0,10";
$result3 = $db->sql_query($sql3);
while ($row3 = $db->sql_fetchrow($result3))
{
if ($auth->acl_get('f_read', $row3['forum_id']) == 1) {
$template->assign_block_vars('topics_last', array(
'LAST_LINK' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row3['forum_id'] . "&t=" . $row3['topic_id']),
'LAST_TITOLO' => $row3['topic_title'],
'LAST_AUTHOR' => $row3['topic_first_poster_name'],
'LAST_DATA' => date("d.m.Y",$row3['topic_time'])
));
}
}
$db->sql_freeresult($result1);
// FINE QUERY 10 TOPIC RECENTI
// ----------------------------------------------
include($phpbb_root_path . 'includes/functions_activity_stats.' . $phpEx);
activity_mod();
// Output page
// www.phpBB-SEO.com SEO TOOLKIT BEGIN - TITLE
page_header($config['sitename']);
// www.phpBB-SEO.com SEO TOOLKIT END - TITLE
$template->set_filenames(array(
'body' => 'index_body.html')
);
page_footer();
?>
- Micogian
- Leader Programmatori
- Messaggi: 3704
- Iscritto il: 07/01/2010, 8:51
- Versione: 3.2.0
- Server: UNIX/Linux
- PHP: 5.4.36
- Database: MySQL 5.1.70-log
- Località: Udine
- Contatta:
Re: [DEV] View Last Pictures 2
Qui siamo nell'assurdo.
Leggiti meglio i miei interventi, ci troverai il post che ti ho linkato e le indicazioni di cosa si dovrebbe fare. Ti ho spiegato qual'è la modifica che devi fare per ottenere il titolo breve.
Nel codice che ho postato ho fatto un errore e ti chiedo semplicemente di togliere il carattere 1 alla stringa $row1.
Del tuo file e di cosa tu abbia fatto delle mie indicazioni non mi interessa. Se vuoi ottenere un risultato devi solamente seguire le mie indicazioni e considerare solamente che ho messo un 1 di troppo.
Leggiti meglio i miei interventi, ci troverai il post che ti ho linkato e le indicazioni di cosa si dovrebbe fare. Ti ho spiegato qual'è la modifica che devi fare per ottenere il titolo breve.
Nel codice che ho postato ho fatto un errore e ti chiedo semplicemente di togliere il carattere 1 alla stringa $row1.
Del tuo file e di cosa tu abbia fatto delle mie indicazioni non mi interessa. Se vuoi ottenere un risultato devi solamente seguire le mie indicazioni e considerare solamente che ho messo un 1 di troppo.
-
- Utente
- Messaggi: 212
- Iscritto il: 27/09/2010, 8:12
- Versione: 3.0.9
- Server: UNIX/Linux
- PHP: 5.2.17
- Database: MySQL 5.1.60-community-log
- Contatta:
Re: [DEV] View Last Pictures 2
ho inserito questo e mi da errore
WHERE pa.topic_id = $topic_id
AND pa.extension = 'jpg'
ORDER BY pa.attach_id LIMIT 1" ;
$db->sql_query($sql_pic);
$result1 = $db->sql_query($sql_pic);
$row1 = $db->sql_fetchrow($result1);
$attach_id = $row1['attach_id'];
$physical = $row1['physical_filename'];
$thumbs = "thumbs/". $attach_id . ".jpg" ;
if (is_file($thumbs)){
$thumb_cor = $thumbs ; // se il file thumb esiste visualizza questo
}else{
$thumb_cor = resize_thumbs($physical, $attach_id); // altrimenti lo crea
}
if strlen($row['topic_title'] > 14)
{
$short_title = substr($row['topic_title'],0,14) . "...";
}else{
$short_title = $row['topic_title'] ;
}
mi da questo errore
Parse error: syntax error, unexpected T_STRING, expecting '(' in /home3/vendobar/public_html/cnc-forum/cnc-forum/index.php on line 256
WHERE pa.topic_id = $topic_id
AND pa.extension = 'jpg'
ORDER BY pa.attach_id LIMIT 1" ;
$db->sql_query($sql_pic);
$result1 = $db->sql_query($sql_pic);
$row1 = $db->sql_fetchrow($result1);
$attach_id = $row1['attach_id'];
$physical = $row1['physical_filename'];
$thumbs = "thumbs/". $attach_id . ".jpg" ;
if (is_file($thumbs)){
$thumb_cor = $thumbs ; // se il file thumb esiste visualizza questo
}else{
$thumb_cor = resize_thumbs($physical, $attach_id); // altrimenti lo crea
}
if strlen($row['topic_title'] > 14)
{
$short_title = substr($row['topic_title'],0,14) . "...";
}else{
$short_title = $row['topic_title'] ;
}
mi da questo errore
Parse error: syntax error, unexpected T_STRING, expecting '(' in /home3/vendobar/public_html/cnc-forum/cnc-forum/index.php on line 256
- Carlo
- Amministratore
- Messaggi: 9957
- Iscritto il: 19/04/2009, 10:24
- Sesso: Maschio
- Versione: 3.2.0
- Server: UNIX/Linux
- PHP: 7.1.0
- Database: MySQL(i) 10.0.27-MariaDB-cll-lve
- Località: Puglia
- Contatta:
Re: [DEV] View Last Pictures 2
Per favore, utilizza il BBCode CODE per inserire il codice, altrimenti si perdono tutte le tabulazioni, e diventa difficile trovare l'errore.
Non so chi abbia scritto questo codice, ma c'è una query che viene eseguita due volte.
La prima volta non viene il risultato non viene assegnato a nessuna variabile:
Non so chi abbia scritto questo codice, ma c'è una query che viene eseguita due volte.
La prima volta non viene il risultato non viene assegnato a nessuna variabile:
Codice: Seleziona tutto
$db->sql_query($sql_pic);
$result1 = $db->sql_query($sql_pic);
- Micogian
- Leader Programmatori
- Messaggi: 3704
- Iscritto il: 07/01/2010, 8:51
- Versione: 3.2.0
- Server: UNIX/Linux
- PHP: 5.4.36
- Database: MySQL 5.1.70-log
- Località: Udine
- Contatta:
Re: [DEV] View Last Pictures 2
La query è mia. In effetti la riga è doppia ma non sta lì il problema.
L'utente aveva chiesto una modifica alla vecchia Mod, gli è stato consigliato di creare un file esterno di nome mod_last_pictures.php con il seguente contenuto
e poi di inserire nel file index.php la riga che richiama il file
L'unico problema era che avevo inserito per errore la stringa
L'utente ha invece mantenuto tutto il codice all'interno di index.php e non ne salta fuori.
Io i consigli cerco di darli, se poi uno si intestardisce a fare di testa sua faccia pure, io non ho tempo da perdere.
Il codice postato, a parte alcuni errori non determinanti, funziona.
L'utente aveva chiesto una modifica alla vecchia Mod, gli è stato consigliato di creare un file esterno di nome mod_last_pictures.php con il seguente contenuto
Codice: Seleziona tutto
<?php
// ####### INIZIO MOD VIEW LAST PICTURES ##########
// Visualizza nell'indice le ultime immagini inserite nel Forum
// created by Micogian (Bingo)
if (!defined('IN_PHPBB'))
{
exit;
}
// function che copia l'allegato in formato thumb
function resize_thumbs($physical,$attach_id){
$img_des = $phpbb_root_path . "thumbs/" . $attach_id . ".jpg" ;
// Ottengo le informazioni sull'immagine originale
list($width, $height, $type, $attr) = getimagesize($phpbb_root_path . "files/" . $physical);
// Creo la versione ridimensionata dell'immagine (thumbnail)
$new_height = '120' ;
$new_width = ($width * $new_height / $height);
$thumb = imagecreatetruecolor($new_width, $new_height);
$source = imagecreatefromjpeg($phpbb_root_path . "files/" . $physical);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Salvo l'immagine ridimensionata
imagejpeg($thumb, $img_des, 75);
return "thumbs/". $attach_id . ".jpg" ;
}
$forum_attach_id = 83; // ATTENZIONE inserire il forum_id (padre) dal quale si vuole estrarre gli allegati
// Redirect to login upon emailed notification links
if (isset($_GET['e']) && !$user->data['is_registered'])
{
login_box('', $user->lang['LOGIN_NOTIFY_FORUM']);
}
$sql = "SELECT f.*
FROM ".FORUMS_TABLE." f
WHERE f.forum_id = " . (isset($forum_attach_id) ? $forum_attach_id : 0);
$result = $db->sql_query($sql);
$forum_attach_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// Check if forum exist
if (!$forum_attach_data)
{
trigger_error('NO_FORUM');
}
// Check if user have permissions
if (!$auth->acl_gets('f_list', 'f_read', $forum_attach_id) || ($forum_attach_data['forum_type'] == FORUM_LINK && $forum_attach_data['forum_link'] && !$auth->acl_get('f_read', $forum_attach_id)))
{
if ($user->data['user_id'] != ANONYMOUS)
{
trigger_error('SORRY_AUTH_READ');
}
login_box('', $user->lang['LOGIN_VIEWFORUM']);
}
// Check if forum is passworded
if ($forum_attach_data['forum_password'])
{
login_forum_box($forum_attach_data);
}
//query per estrarre gli ultimi 5 Topics con allegati
$sql = "SELECT
pt.topic_id, pt.forum_id, pt.topic_title, pt.topic_first_poster_name, pt.topic_attachment, pf.forum_name, pf.parent_id, pf.forum_id, pt.topic_time
FROM ". TOPICS_TABLE." pt,". FORUMS_TABLE. " pf
WHERE pf.parent_id = $forum_attach_id
AND pt.forum_id = pf.forum_id
AND pt.topic_attachment = 1
ORDER BY pt.topic_time DESC LIMIT 6";
//$db->sql_query($sql);
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$topic_id = $row['topic_id'];
// ricerca il primo attach_id dei topics selezionati
$sql_pic = "SELECT pa.attach_id, pa.topic_id, pa.physical_filename, pa.extension
FROM ". ATTACHMENTS_TABLE." pa
WHERE pa.topic_id = $topic_id
AND pa.extension = 'jpg'
ORDER BY pa.attach_id LIMIT 1" ;
$db->sql_query($sql_pic);
$result1 = $db->sql_query($sql_pic);
$row1 = $db->sql_fetchrow($result1);
$attach_id = $row1['attach_id'];
$physical = $row1['physical_filename'];
$thumbs = "thumbs/". $attach_id . ".jpg" ;
if (is_file($thumbs)){
$thumb_cor = $thumbs ; // se il file thumb esiste visualizza questo
}else{
$thumb_cor = resize_thumbs($physical, $attach_id); // altrimenti lo crea
}
if (strlen($row['topic_title'] > '14'))
{
$short_title = substr($row['topic_title'],0,14) . "...";
}else{
$short_title = $row['topic_title'] ;
}
// assegna le variabili da passare al file HTML
$template->assign_block_vars('attach_list', array(
'MY_TOPIC_ID' => $row['topic_id'],
'MY_FORUM_ID' => $row['forum_id'],
'MY_TOPIC_TITLE' => $row['topic_title'],
'MY_TOPIC_LINK' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't='.$row['topic_id']),
'MY_ATTACH_LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'id='.$attach_id),
'MY_FORUM_NAME' => $row['forum_name'],
'MY_TOPIC_AUTHOR' => $row['topic_first_poster_name'],
'MY_ATTACH_ID' => $attach_id,
'MY_THUMBS' => $thumb_cor,
'MY_SHORT_TITLE' => $short_title
));
}
//$db->sql_freeresult($result);
// ####### FINE MOD VIEW LAST PICTURES ##########
?>
Codice: Seleziona tutto
include($phpbb_root_path . 'mod_last_pictures.' . $phpEx);
$row1
al posto di $row
L'utente ha invece mantenuto tutto il codice all'interno di index.php e non ne salta fuori.
Io i consigli cerco di darli, se poi uno si intestardisce a fare di testa sua faccia pure, io non ho tempo da perdere.
Il codice postato, a parte alcuni errori non determinanti, funziona.
-
- Utente
- Messaggi: 212
- Iscritto il: 27/09/2010, 8:12
- Versione: 3.0.9
- Server: UNIX/Linux
- PHP: 5.2.17
- Database: MySQL 5.1.60-community-log
- Contatta:
Re: [DEV] View Last Pictures 2
ok adesso ho capito riprovo tutto e vi faccio sapere
Grazie
Grazie
-
- Utente
- Messaggi: 212
- Iscritto il: 27/09/2010, 8:12
- Versione: 3.0.9
- Server: UNIX/Linux
- PHP: 5.2.17
- Database: MySQL 5.1.60-community-log
- Contatta:
Re: [DEV] View Last Pictures 2
adesso o creata la nuova pagina in php e inserito il codice
Ma questa non ho capito dove metterlo include($phpbb_root_path . 'mod_last_pictures.' . $phpEx);
Ma questa non ho capito dove metterlo include($phpbb_root_path . 'mod_last_pictures.' . $phpEx);
- Micogian
- Leader Programmatori
- Messaggi: 3704
- Iscritto il: 07/01/2010, 8:51
- Versione: 3.2.0
- Server: UNIX/Linux
- PHP: 5.4.36
- Database: MySQL 5.1.70-log
- Località: Udine
- Contatta:
Re: [DEV] View Last Pictures 2
Basterebbe solo leggere attentamente quello che ho scritto
http://www.phpbbitalia.net/forum/mods-i ... tml#p24534
E' in italiano, hai forse problemi di comprensione ?
Ovviamente se metti la riga "include" devi togliere il codice che avevi messo prima nel file index.php, ma ho l'impressione che sia problematico.
http://www.phpbbitalia.net/forum/mods-i ... tml#p24534
E' in italiano, hai forse problemi di comprensione ?
Ovviamente se metti la riga "include" devi togliere il codice che avevi messo prima nel file index.php, ma ho l'impressione che sia problematico.
-
- Utente
- Messaggi: 212
- Iscritto il: 27/09/2010, 8:12
- Versione: 3.0.9
- Server: UNIX/Linux
- PHP: 5.2.17
- Database: MySQL 5.1.60-community-log
- Contatta:
Re: [DEV] View Last Pictures 2
con la calma si fa tutto magari per te lo vedi in un' altra maniere perchè sai l' orgomento io non sono molto bravo e sto facendo un po di confusione con tutti questi codici
Chi c’è in linea
Visitano il forum: Nessuno e 50 ospiti