as the title suggests, I would like to create a scroll marquee of images to be shown in the forum index. This old code works with a php 5.6 version but doesn't seem to work with the new 8.2 version.
Code: Select all
<?php
/**
* @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');
if (!defined('IN_PHPBB'))
{
exit;
}
global $output, $output0, $output1, $output2, $output3;
if ($user->data['is_registered'])
{
// Latest 6 e-Books
$sql = 'SELECT min(p.post_id) as post_id, p.topic_id, topic_title, topic_first_poster_name, topic_views, topic_time, p.forum_id, p.post_text
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t
WHERE p.forum_id LIKE "12"
AND post_id = topic_first_post_id
AND (post_text LIKE "%[img:%]%JPG[/img:%]%"
OR post_text LIKE "%[img:%]%jpg[/img:%]%"
OR post_text LIKE "%[img:%]%PNG[/img:%]%"
OR post_text LIKE "%[img:%]%png[/img:%]%"
OR post_text LIKE "%[img:%]%GIF[/img:%]%"
OR post_text LIKE "%[img:%]%gif[/img:%]%")
GROUP BY topic_id ORDER BY p.post_time DESC LIMIT 6
';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
foreach($row as $cell)
$matches = null;
$returnValue = preg_match('/\[img:(.*?)\](.*?)\[\/img:(.*?)\]/', $cell , $matches, 0);
$post_link = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx . '?f=12&t=' . $row['topic_id']);
$user_post = 'Postato da: ' . iconv('UTF-8', 'UTF-8', $row['topic_first_poster_name']);
$visite = 'Visitato da: ' . $row['topic_views'] . ' utenti';
$the_date = 'In data: ' . date('g:i A on D, M j Y', $row['topic_time']);
$title = iconv('UTF-8', 'UTF-8', $row['topic_title']);
if ($matches[2] == "")
{
$no_image = "{$phpbb_root_path}images/no-image.png";
$output .= '<a href="' . $post_link . '" title="'. substr($title, 0, 60) .'"><img src="' . $no_image . '" width="100" height="140" title="' . substr($title, 0, 60) . '
' . $user_post . '
' . $visite . '
' . $the_date . '" alt="' . substr($title, 0, 60) . '"></a>';
}else{
$output .= '<a href="' . $post_link . '" title="'. substr($title, 0, 60) .'"><img src="' . $matches[2] . '" width="100" height="140" title="' . substr($title, 0, 60) . '
' . $user_post . '
' . $visite . '
' . $the_date . '" alt="' . substr($title, 0, 60) . '"></a>';
}
}
}else{
echo 'NOT REGISTERED USER!!';
}
echo $output;
?>
Best Regards
Salvo