Scusate ragazzi avrei bisogno di modificare il modulo : mod_smf_recent_topics
Per eliminare spostare o centrare i recenti post visualizzati.
In altra parole voglio eliminare il puntino e lo sapzio che si vede all'inizio di ogni post.
Si veda il modulo intitolato "I commenti nella Comunità" sul mio sito
www.carpinofolkfestival.comDi seguito il testo del file php :
<?php
/* tabstop=4 tabreplace=space */
/**
* SMF Recent Topics Module
*
* This file's purpose is to query the SMF database and then create
* a list of Recent Topics for display as a module
*
* LICENSE: This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @category Component
* @package com_joomla_smf_forum
* @author Cowboy <ross@joomlahacks.com>
* @author Wolverine <wolverine@themofoclan.com>
* @copyright (C) JoomlaHacks.com. All rights reserved.
* @license
http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @version $Id: functions.smf.php 78 2006-03-16 16:13:05Z joshualross $
* @revision $LastChangedRevision: 78 $
* @date $LastChangedDate: 2006-03-16 11:13:05 -0500 (Thu, 16 Mar 2006) $
* @file $HeadURL:
http://scm.joomla.org/svn/repos/joomla-smf_1_1/functions.smf.php $
* @link
http://www.JoomlaHacks.com * @since File available since Release 1.0
*
* Visit JoomlaHacks.com for more Joomla Hacks!
*/
/* no direct access */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
/* 1.5 params-get() second parameter is a default (-Wolverine)*/
//These defaults are identical to the defaults set in mod_smf_recent_topics.xml
$moduleclass_sfx = $params->get( 'moduleclass_sfx', '' );
$bln_icon = $params->get( 'bln_icon', 0 );
$bln_board = $params->get( 'bln_board', 0 );
$int_num_topics = $params->get( 'int_num_topics', 5 );
$bln_date_time = $params->get( 'bln_date_time', 0 );
$int_num_char = $params->get( 'int_num_char', 10 );
$bln_real_name = $params->get( 'namedisplay', 0 );
$bln_marquee_scroll = $params->get( 'bln_marquee_scroll', 0 );
$str_scroll_direction = $params->get( 'str_scroll_direction', 'up' );
$int_scroll_amount = $params->get( 'int_scroll_amount', 2 );
$int_scroll_delay = $params->get( 'int_scroll_delay', 20 );
$bln_replies = $params->get( 'bln_replies', 1 );
$bln_poster = $params->get( 'bln_poster', 1 );
/*1.6.1 Use our own smf prefix*/
$str_table_prefix = $params->get( 'str_table_prefix', '' );
/* 1.5 User does not need to save to initialize parameters if they want the defaults (-Wolverine)*/
//Include the JoomlaSMF bridge variables
/*1.6.2 don't need em! (-Wolverine)*/
//require($mosConfig_absolute_path."/administrator/components/com_smf/config.smf.php");
/* 1.3 use $str_table_prefix instead of $db_prefix(-Wolverine)*/
/*1.7.1 add modSettings based on teh new query from SSI */
global $database, $context, $txt, $settings, $user_info, $mosConfig_sef, $modSettings;
/*1.6.1 Return immediately if smf table prefix isn't set (-Wolverine)*/
if(empty($str_table_prefix))
{
echo "
Please configure the SMF table prefix for this module!";
return false;
}
/* 1.5 smfItemid is already stored in $mosurl in config.smf.php (-Wolverine) */
/*1.6.1 smfItemid is not in all bridges, so the query returns(-Wolverine)*/
$database->setQuery("SELECT id FROM #__menu WHERE link = 'index.php?option=com_smf'");
if ($result = $database->query()) {
$row = mysql_fetch_object($result);
$smfItemid = $row->id;
}
else {
echo "Error fetching smfItemid: ".mysql_errno()." ".mysql_error();
return false;
}
//make a sefReltoAbs friendly URL
$str_jsmf_url = "index.php?option=com_smf&Itemid=".$smfItemid."&";
/*1.6.2 Get the ID_MEMBER using $user_info['username'] (-Wolverine)*/
/*1.7.1 Check if not guest and if ID_MEMBER isn't set */
if(!$user_info['is_guest'] && (!isset($ID_MEMBER) || empty($ID_MEMBER))) {
$database->setQuery("SELECT ID_MEMBER from {$str_table_prefix}members WHERE memberName = '".$user_info['username']."'");
if ($result = $database->query()) {
$row = mysql_fetch_object($result);
$ID_MEMBER = $row->ID_MEMBER;
}
else {
echo "Error fetching ID_MEMBER: ".mysql_errno()." ".mysql_error();
return false;
}
}
$exclude_boards = array();
$output_method = 'echo';
// Find all the posts. Newer ones will have higher IDs.
/*1.3 - Find only the posts this user is allowed to see(-Wolverine)*/
/*1.4 - The whole db_query stuff wasn't working in Joomla 1.0.4 so I changed the method to use setQuery followed by query (-Wolverine)*/
/*1.6 The table $str_table_prefix}log_topics fields changed in SMF 1.1RC2, specifically log_Time was changed to ID_MSG. Many
SQL changes were included in this fix. (-Wolverine)*/
/*1.7 SMF 1.1RC2 changes require changes to this query... again (-Wolverine)*/
$database->setQuery("" .
"SELECT
mem.realName, m.posterTime, ms.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD, b.name AS bName, t.numReplies, t.ID_LAST_MSG,
IFNULL(mem.realName, m.posterName) AS posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead,
IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon
FROM ({$str_table_prefix}messages AS m, {$str_table_prefix}topics AS t, {$str_table_prefix}boards AS b, {$str_table_prefix}messages AS ms)
LEFT JOIN {$str_table_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "
LEFT JOIN {$str_table_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$str_table_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" : '') . "
WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 35 * min($int_num_topics, 5)) . "
AND t.ID_LAST_MSG = m.ID_MSG
AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards) ? '' : "
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
AND $user_info[query_see_board]
AND ms.ID_MSG = t.ID_FIRST_MSG
ORDER BY t.ID_LAST_MSG DESC
LIMIT $int_num_topics");
/*"
SELECT
mem.realName,
m.posterTime,
m2.subject,
t.ID_TOPIC,
t.ID_MEMBER_UPDATED,
t.ID_LAST_MSG,
m.ID_MSG_MODIFIED,
m.ID_BOARD,
b.name AS bName,
t.numReplies,
m.posterName AS memberName,
" . ($user_info['is_guest'] ? "0" : "IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1") . " AS new_from
FROM
({$str_table_prefix}members AS mem,
{$str_table_prefix}topics AS t,
{$str_table_prefix}messages AS m,
{$str_table_prefix}messages AS m2,
{$str_table_prefix}boards AS b
" . (!$user_info['is_guest'] ? "
LEFT JOIN {$str_table_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = '".$ID_MEMBER."')
LEFT JOIN {$str_table_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = t.ID_BOARD AND lmr.ID_MEMBER = '".$ID_MEMBER."')" : "") . ")
WHERE
t.ID_BOARD = m.ID_BOARD
AND t.ID_BOARD = b.ID_BOARD" . (empty($exclude_boards) ? '' : "
AND t.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
AND t.ID_LAST_MSG = m.ID_MSG
AND t.ID_FIRST_MSG = m2.ID_MSG
AND mem.memberName = m.posterName
AND $user_info[query_see_board]
ORDER BY
m.ID_MSG DESC
LIMIT ".$int_num_topics."");*/
/* 1.5.1 Do not use $this outside object context (-Wolverine) */
if ($result = $database->query())
{
$posts = array();
while ($row = mysql_fetch_assoc($result)) {
// Censor the subject.
censorText($row['subject']);
/*1.6 The structure of the link to a message has changed in SMF 1.1 RC2. (-Wolverine) */
//$posthref = sefRelToAbs($str_jsmf_url . 'topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' . $row['ID_LAST_MSG']) .
'#new');
//$posthref = (substr($posthref,strlen($posthref)-1)=="/" ? substr($posthref,0,strlen($posthref)-1) : $posthref );
// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['ID_BOARD'],
'name' => $row['bName'],
//1.7-1 SEF changes
'href' => sefRelToAbs($str_jsmf_url . '?board=' . $row['ID_BOARD'] . '.0'),
'link' => '<a href="' . sefRelToAbs($str_jsmf_url . 'board=' . $row['ID_BOARD'] . '.0').'">' . $row['bName'] . '[/url]'
),
'topic' => $row['ID_TOPIC'],
/*1.6 poster was changed to member to follow SMF methods (-Wolverine)*/
'member' => array(
'username' => $row['posterName'],
'name' => $row['realName'],
'id' => $row['ID_MEMBER'],
//1.7-1 SEF changes
'href' => !empty($row['ID_MEMBER']) ? sefRelToAbs($str_jsmf_url . ($mosConfig_sef ? 'action=profile&u=' : 'action=profile;u=')
. $row['ID_MEMBER']) : '',
'link' => !empty($row['ID_MEMBER']) ? '<a href="' . sefRelToAbs($str_jsmf_url . ($mosConfig_sef ? 'action=profile&u=' :
'action=profile;u=') . $row['ID_MEMBER']) . '" title="' . $txt[92] . ' ' . $row['posterName'] . '">' . ($bln_real_name ? $row['realName'] :
$row['posterName']) . '[/url]' : ($bln_real_name ? $row['realName'] : $row['posterName'])
),
'subject' => $row['subject'],
'short_subject' => strlen(un_htmlspecialchars($row['subject'])) > 25 ? htmlspecialchars(substr(un_htmlspecialchars($row['subject']), 0, 22) .
'...') : $row['subject'],
'time' => timeformat($row['posterTime']),
'timestamp' => $row['posterTime'],
//1.7-1 Fix all URL's at once
'href' => sefRelToAbs($str_jsmf_url . 'topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' . $row['ID_LAST_MSG']) .
'#new'),
/* 1.6 link compatibility changes (-Wolverine)*/
'link' => '<a href="' . sefRelToAbs($str_jsmf_url . '?topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' .
$row['ID_LAST_MSG']) . '#new').'">' . $row['subject'] . '[/url]',
/* 1.6 Use the msg id to determine if the post is new (-Wolverine)*/
'new' => !empty($row['isRead']),
'new_from' => $row['new_from'],
'replies' => $row['numReplies'],
//images_url is the url to the theme that is selected for the site. Alternative is default_images_url which is the default theme.
'icon' => '<img src="' . $settings['images_url']. '/post/' . $row['icon'] . '.gif" alt="' . $row['icon'] . '" border="0" />'
);
}
/*1.4.1 Free only if we got a result (-Wolverine)*/
mysql_free_result($result);
} else {
echo "Error fetching Recent Topics: ".mysql_errno()." ".mysql_error();
return false;
}
// Just return it.
/* 1.5 Use strcmp, much better method for string comparisons (-Wolverine)*/
if (strcmp($output_method, 'echo') != 0 || empty($posts))
return $posts;
/* 1.5 PHPNuke marquee scrolling (-Wolverine)*/
//PHPNuke scrolling adapted from Forums Scroll V2
//Original Author: Telli
//E-mail: telli@codezwiz.com
//Home Page:
www.Codezwiz.comif($bln_marquee_scroll) {
echo '<marquee behavior="scroll" direction="',$str_scroll_direction,'"', ($int_scroll_amount != 0 ? " scrollamount=\"$int_scroll_amount\"" :
""),'',($int_scroll_delay != 0 ? " scrolldelay=\"$int_scroll_delay\"" : ""),' onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>';
}
//foreach($settings as $key => $value)
// $str_out .= "$key -> $value
";
//die($str_out);
echo '<ul class="latestnews',$moduleclass_sfx,'"> ';
foreach ($posts as $post) {
$post['href'] = removeTrailingSlash($post['href']);
$post['member']['link'] = removeTrailingSlash($post['member']['link']);
echo '<li class="latestnews'.$moduleclass_sfx.'">';
//This section is done this way(very explicit) so that
//future options can be built into the module easier
//Start subject link
echo '<a class="latestnews'.$moduleclass_sfx.'" href="'.$post['href'].'">';
//let's leave the formatting to our users in the future
//1.7-3 Let them display the topic icon.
if($bln_icon) {
echo $post['icon'];
//space
echo ' ';
}
if ($bln_board) {
echo '
'.$post['board']['name'].' : ';
}
/* 1.6 post['href'] contains the link to a new post as well, use it (-Wolverine) */
// echo ($int_num_char != '' ? substr($post['subject'],0,$int_num_char).(strlen($post['subject']) > $int_num_char ? '...' : '') :
$post['subject']) , '[/url] (',
// $post['replies'], ') ', $txt[525], ' ', ($mosConfig_sef == '1' ? str_replace(";","/",$post['member']['link']) :
$post['member']['link']) , '
// ', ($post['new'] ? '<a href="' . $post['href'] . '"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] .
'/new.gif" alt="' . $txt[302] . '" border="0" />[/url]' : '');
//
// echo (!empty($int_num_char) ? substr($post['subject'], 0, $int_num_char) : $post['subject']) , '[/url] (',
// $post['replies'], ') ', $txt[525], ' ', $post['member']['link'], '
// ', ($post['new'] ? '<a href="' . $post['href'] . '"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif"
alt="' . $txt[302] . '" border="0" />[/url]' : '');
//
if(!empty($int_num_char)) {
echo substr($post['subject'], 0, $int_num_char);
if(strlen($post['subject']) > $int_num_char) {
echo '...';
}
}
else {
echo $post['subject'];
}
echo '[/url]';
if($bln_replies) {
//space
echo ' ';
//output the number of posts for this subject
echo '('.$post['replies'].')';
}
if($bln_poster) {
//space
echo ' ';
//this is the 'by' in 'by username'
echo $txt[525];
//space
echo ' ';
//member link
echo $post['member']['link'];
}
if ($bln_date_time) {
//space
echo ' ';
echo '-';
//space
echo ' ';
echo $post['time'];
}
if(empty($post['new'])) {
//space
echo ' ';
//link
echo '<a href="' . $post['href'] . '">';
//image
echo '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" />';
echo '[/url]';
}
echo '</li>';
}
echo '</ul>';
if($bln_marquee_scroll) {
echo '</marquee>';
}
/**
* This function simply removes a trailing slash on URL's
* @return string
*/
function removeTrailingSlash($url) {
return (substr($url,strlen($url)-1)=="/" ? substr($url,0,strlen($url)-1) : $url );
}
?>