TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 629
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 411
  • Total: 411

Undefined index: newtime

Started by smartmouse, September 16, 2007, 01:35:37 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

smartmouse

I find newtime in MessageIndex.php (Source folder). Here is a part of the file:

// 'Print' the topic info.
$context['topics'][$row['ID_TOPIC']] = array(
'id' => $row['ID_TOPIC'],
'description' => $row['description'],//-Topic description MOD-
'first_post' => array(
'id' => $row['ID_FIRST_MSG'],
'member' => array(
'username' => $row['firstMemberName'],
'name' => $row['firstDisplayName'],
'id' => $row['firstID_MEMBER'],
'href' => !empty($row['firstID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row['firstID_MEMBER'] : '',
'link' => !empty($row['firstID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['firstID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['firstDisplayName'] . '">' . $row['firstDisplayName'] . '</a>' : $row['firstDisplayName']
),
'time' => timeformat($row['firstPosterTime']),
'timestamp' => forum_time(true, $row['firstPosterTime']),
'subject' => $row['firstSubject'],
'preview' => $row['firstBody'],
'icon' => $row['firstIcon'],
'icon_url' => $settings[$context['icon_sources'][$row['firstIcon']]] . '/post/' . $row['firstIcon'] . '.gif',
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['firstSubject'] . '</a>'
),
'last_post' => array(
'id' => $row['ID_LAST_MSG'],
'member' => array(
'username' => $row['lastMemberName'],
'name' => $row['lastDisplayName'],
'id' => $row['lastID_MEMBER'],
'href' => !empty($row['lastID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row['lastID_MEMBER'] : '',
'link' => !empty($row['lastID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['lastID_MEMBER'] . '">' . $row['lastDisplayName'] . '</a>' : $row['lastDisplayName']
),
'time' => timeformat($row['lastPosterTime']),
'timestamp' => forum_time(true, $row['lastPosterTime']),
'subject' => $row['lastSubject'],
'preview' => $row['lastBody'],
'icon' => $row['lastIcon'],
'icon_url' => $settings[$context['icon_sources'][$row['lastIcon']]] . '/post/' . $row['lastIcon'] . '.gif',
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' . $row['ID_LAST_MSG']) . '#new',
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' . $row['ID_LAST_MSG']) . '#new">' . $row['lastSubject'] . '</a>'
),
'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($row['isSticky']),
'is_locked' => !empty($row['locked']),
'is_poll' => $modSettings['pollMode'] == '1' && $row['ID_POLL'] > 0,
'is_hot' => $row['numReplies'] >= $modSettings['hotTopicPosts'],
'is_very_hot' => $row['numReplies'] >= $modSettings['hotTopicVeryPosts'],
'is_posted_in' => false,
'icon' => $row['firstIcon'],
'icon_url' => $settings[$context['icon_sources'][$row['firstIcon']]] . '/post/' . $row['firstIcon'] . '.gif',
'subject' => $row['firstSubject'],
'new' => $row['new_from'] <= $row['ID_MSG_MODIFIED'],
'new_from' => $row['new_from'],
'newtime' => $row['new_from'],
'new_href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['new_from'] . '#new',
'pages' => $pages,
'replies' => $row['numReplies'],
'views' => $row['numViews']
);


I hope you will understand what the problem is!

jacortina

And that code defines that index, so it's not going to generate that error.

The error you showed said it was being generated by Tportal.template.php with an 'eval' notation. That usually points to the contents of blocks or articles. You can't search those contents by looking in files. It's stored in the database. You need to go into admin and look in the php blocks and/or articles.

You can switch off any custom blocks you've made and turn them back on one-by-one, checking for errors after every refresh to pin it down.

smartmouse

Quote from: J.A.Cortina on September 17, 2007, 03:03:56 AM
You can't search those contents by looking in files. It's stored in the database.

What can i search in the database? Any keyword to search in it?


smartmouse

#13
I have found the block, it is a custom block that shows recent topics of a certain board:

Quoteglobal $context, $scripturl;
$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$result=ssi_recentTopics_Include(30,array(62),'return');
foreach($result as $my){
  echo "$bullet";
  echo '<span class="smalltext">'.$my['link'];
  // is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
echo '
                                                <a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['newtime'], '&phpMyAdmin=82aefbd2e6db95aebc87975aa0060ae4&phpMyAdmin=8c7b7a06fcf2a9209d5b5b940b70a69d#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo '
';
}
echo '</span>';

How to fix it?

JPDeni

Looks like the problem is in ssi_recentTopics_Include. Is newtime defined in that function?

jacortina

Looks like a session ID in there (which shouldn't be necessary). Note that the index values which are valid will depend on what is in that SSI function (which is NOT a standard SSI function, but is a custom edit to SSI).

Try replacing:
echo '
                                                <a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['newtime'], '&phpMyAdmin=82aefbd2e6db95aebc87975aa0060ae4&phpMyAdmin=8c7b7a06fcf2a9209d5b5b940b70a69d#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';

(note that you should always paste code in 'code' bbc; see how the quoted code turned that final "< / a >" into a "[ / url ]")

With this:
echo '<a href="', $scripturl, '?topic=', $my['ID_TOPIC'], '.msg', $my['new_from'], ';topicseen#new"> <img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" /></a>';

If that doesn't work, you'll need to post the "ssi_recentTopics_Include()" function from your SSI.php file.

smartmouse

#16
@J.A.Cortina: do you remember this? You replied me there! ;)

I tried to remove only
&phpMyAdmin=82aefbd2e6db95aebc87975aa0060ae4&phpMyAdmin=8c7b7a06fcf2a9209d5b5b940b70a69d
from the code... Hope it works now.

Thank you for your great work!

jacortina

From the SSI.php you gave, this is the array that's returned (called $posts within the function and returned to $request in your code and iterated through into the $my array):

$posts[] = array(
'board' => array(
'id' => $row['ID_BOARD'],
'name' => $row['bName'],
'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bName'] . '</a>'
),
'topic' => $row['ID_TOPIC'],
'poster' => array(
'id' => $row['ID_MEMBER'],
'name' => $row['posterName'],
'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
),
'subject' => $row['subject'],
'short_subject' => shorten_subject($row['subject'], 25),
'preview' => $row['body'],
'time' => timeformat($row['posterTime']),
'timestamp' => forum_time(true, $row['posterTime']),
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#new',
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#new">' . $row['subject'] . '</a>',
'new' => !empty($row['isRead']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
);


So, the entry you're looking for would be 'new_from'. But the replacement line I gave you above should reference 'topic' instead of 'ID_TOPIC':
echo '<a href="', $scripturl, '?topic=', $my['ID_TOPIC'], '.msg', $my['new_from'], ';topicseen#new"> <img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" /></a>';

Try that line in place of the line with the bad 'newtime' index.

The form you were using, with the ".from" clause, was used in SMF's 1.0x versions. Unless you're still using that, you need to use the ".msg" style link above.

smartmouse

You are right. I'm using SMF v1.1.3 and even if i removed that session id, it did not work anyway.
Now i replace that line with 'newtime' with the line you pasted above.

Hope it works... i will let you know ;)


The phpbox now is:

global $context, $scripturl;
$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$result=ssi_recentTopics_Include(30,array(62),'return');
foreach($result as $my){
  echo "$bullet";
  echo '<span class="smalltext">'.$my['link'];
  // is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
echo '<a href="', $scripturl, '?topic=', $my['ID_TOPIC'], '.msg', $my['new_from'], ';topicseen#new"> <img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" /></a>';
echo '<br>';
}
echo '</span>';


Is it ok?

smartmouse

It was not ok:

New error comes:

8: Undefined index: ID_TOPIC
File: /var/www/vhosts/moneywantersforum.com/httpdocs/Themes/default/TPortal.template.php (eval?)

This website is proudly hosted on Crocweb Cloud Website Hosting.