Subs-Recent.php Error

Started by kimber, February 06, 2009, 12:50:06 PM

Previous topic - Next topic

kimber

Hello I'm receiving the following error and was unable to locate the problem.  Can someone help?

Quote
8: Undefined variable: post
Apply Filter: Only show the errors from this file
File: /home/content/c/l/o/clooneyn/html/smf/Sources/Subs-Recent.php
Line: 77

I'm running SMF 2.0 RC1 with the following mods

   SMF Gallery Lite      2.0.5      
   Advanced Contact Form    1.1    
   View Only Boards    1.2    
   Profil Moderator Managment    1.0.0    
   SMF Arcade    2.5 Beta 4.1 Public    
   Enhanced PM Warning Message    1.0    
   Top 10 Posters Today And This Week Stats

Here's the Subs-Recent.php

<?php
/**********************************************************************************
* Subs-Recent.php                                                                 *
***********************************************************************************
* SMF: Simple Machines Forum                                                      *
* Open-Source Project Inspired by Zef Hemel ([email protected])                    *
* =============================================================================== *
* Software Version:           SMF 2.0 RC1                                         *
* Software by:                Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006-2009 by:     Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
* Support, News, Updates at:  http://www.simplemachines.org                       *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under   *
* the terms of the provided license as published by Simple Machines LLC.          *
*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version can always be found at http://www.simplemachines.org.        *
**********************************************************************************/

if (!defined('SMF'))
die('Hacking attempt...');

/* !!!

*/

// Get the latest posts of a forum.
function getLastPosts($latestPostOptions)
{
global $scripturl$txt$user_info$modSettings$smcFunc$context;

// Find all the posts.  Newer ones will have higher IDs.  (assuming the last 20 * number are accessable...)
// !!!SLOW This query is now slow, NEEDS to be fixed.  Maybe break into two?
$request $smcFunc['db_query']('substring''
SELECT
m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg,
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE m.id_msg >= {int:likely_max_msg}' 
.
(!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > '
AND b.id_board != {int:recycle_board}' 
'') . '
AND {query_wanna_see_board}' 
. ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' 
'') . '
ORDER BY m.id_msg DESC
LIMIT ' 
$latestPostOptions['number_posts'],
array(
'likely_max_msg' => max(0$modSettings['maxMsgID'] - 50 $latestPostOptions['number_posts']),
'recycle_board' => $modSettings['recycle_board'],
'is_approved' => 1,
)
);
$posts = array();
while ($row $smcFunc['db_fetch_assoc']($request))
{
// Censor the subject and post for the preview ;).
censorText($row['subject']);
censorText($row['body']);

$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '&#38;#10;')));
if ($smcFunc['strlen']($row['body']) > 128)
$row['body'] = $smcFunc['substr']($row['body'], 0128) . '...';

// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['id_board'],
'protected' => in_array($post['board'], $user_info['view_only_boards']), //- View Only Boards MOD-
'name' => $row['board_name'],
'href' => $scripturl '?board=' $row['id_board'] . '.0',
'link' => '<a href="' $scripturl '?board=' $row['id_board'] . '.0">' $row['board_name'] . '</a>'
),
'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' $scripturl '?action=profile;u=' $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' $scripturl '?action=profile;u=' $row['id_member'] . '">' $row['poster_name'] . '</a>'
),
'subject' => $row['subject'],
'short_subject' => shorten_subject($row['subject'], 24),
'preview' => $row['body'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true$row['poster_time']),
'raw_timestamp' => $row['poster_time'],
'href' => $scripturl '?topic=' $row['id_topic'] . '.msg' $row['id_msg'] . ';topicseen#msg' $row['id_msg'],
'link' => '<a href="' $scripturl '?topic=' $row['id_topic'] . '.msg' $row['id_msg'] . ';topicseen#msg' $row['id_msg'] . '" rel="nofollow">' $row['subject'] . '</a>'
);
}
$smcFunc['db_free_result']($request);

return $posts;
}

// Callback-function for the cache for getLastPosts().
function cache_getLastPosts($latestPostOptions)
{
return array(
'data' => getLastPosts($latestPostOptions),
'expires' => time() + 60,
'post_retri_eval' => '
foreach ($cache_block[\'data\'] as $k => $post)
{
$cache_block[\'data\'][$k][\'time\'] = timeformat($post[\'raw_timestamp\']);
$cache_block[\'data\'][$k][\'timestamp\'] = forum_time(true, $post[\'raw_timestamp\']);
}'
,
);
}


?>


karlbenson

Its caused by View Only Boards  mod.

            'protected' => in_array($post['board'], $user_info['view_only_boards']), //- View Only Boards MOD-

Because $post doesn't exist.

I'd recommend raising this with the mod author via the mods support topic.

kimber

I will..  thank you for replying.   

Advertisement: