8: Undefined index: newtime
File: /var/www/xxxxxxxxxxxxxxxxxxxxxxxx/httpdocs/Themes/default/TPortal.template.php (eval?)
Linea: 10
Every day i get a lot of pages with this error! It is made by different users... how to fix it?
I make a search on forum but it seems to be an unsolved problem!!!
Please help me! Thank you.
Since it appears nobody knows where the error comes from, perhaps you could try to track down where it is happening. If you are one of the people who creates this error, maybe you can see where you are or what you are clicking on that makes it appear in your log.
Quote from: IchBinâ,,¢ on September 16, 2007, 04:32:37 AM
Since it appears nobody knows where the error comes from, perhaps you could try to track down where it is happening. If you are one of the people who creates this error, maybe you can see where you are or what you are clicking on that makes it appear in your log.
My username does not create this error... how can i try to fix it?
www.simplemachines.org and the searchfunction
And also click this Link here (http://www.tinyportal.net/index.php?action=search2;params=YWR2YW5jZWR8J3wwfCJ8YnJkfCd8MTIsMjUsMTEwLDcwLDY5LDU5LDYwLDkxLDcyLDkyLDkzLDk0LDk1LDk2LDE1LDEwOSwxMjksMTYyLDg5LDE1NCw0NiwxMzMsMTMwLDg1LDY4LDExOCwxMTksMTIwLDEzMSw1Niw5NywxMTcsMzYsMzUsMTcwLDExMyw5LDE1MSw4OCwzMSwxMTUsNjMsMzIsMjcsMjYsMjMsMjIsMjEsMjAsMTksMTgsMTcsMjksMTU1LDc2LDE0OSwxNDYsMTIyLDEwNSw4NCw4MiwxMzQsMTU2LDE1MiwxMzYsMTE0LDEwNiw5MCw4Myw4MSw4MCw3OSw3Nyw3NSw3Myw2NSwxMTYsMTU4LDE1OSwxNjMsMTY2LDE1NywxMzksMTA4LDc4LDc0LDE2NywxMjcsMTI4LDE2NSwzMCw4LDUxLDEyMSw1OCwxNDMsMTI2LDUyLDMzLDUwLDEwNywxMjMsMTI0LDEzNSwxMzcsMTM4LDE0NCwxNDUsMTUwLDE1MywxNjAsMTYxLDE2NCwxNjgsMTY5LDk4LDk5LDE0MCwxNDgsMTQxLDE0MiwxNDd8InxzaG93X2NvbXBsZXRlfCd8fCJ8c3ViamVjdF9vbmx5fCd8fCJ8c29ydHwnfHJlbGV2YW5jZXwifHNvcnRfZGlyfCd8ZGVzY3wifHNlYXJjaHwnfG5ld3RpbWU=)
Quote from: smartmouse on September 16, 2007, 01:35:37 AM
I make a search on forum but it seems to be an unsolved problem!!!
So? Really no solution exist for this problem??
Told you to use the search at simplemachines.org to
http://www.simplemachines.org/community/index.php?topic=112107.0
Quote from: G6 on September 16, 2007, 07:23:47 PM
Told you to use the search at simplemachines.org to
http://www.simplemachines.org/community/index.php?topic=112107.0
Sorry! :-X
My intial thought is that Line 10 of some Article or Block you've added refers to an array with the index 'newtime' which has not been initialized or defined correctly.
If this is so, you need to track down the article or block and see why that index isn't correct.
Maybe the problem is that i'm using two recent topics blocks and related modify to SSI.php file?
Check those blocks. Is the index 'newtime' used in them?
I don't believe that anything with an index of 'newtime' is specified by ssi_recenttopics (though I can't speak to whether it's included in a modified version of it).
Having two of them shouldn't matter, though.
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!
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.
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?
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?
Looks like the problem is in ssi_recentTopics_Include. Is newtime defined in that function?
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.
@J.A.Cortina: do you remember this (http://www.tinyportal.net/index.php?topic=1234.msg105411#msg105411)? 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!
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.
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?
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?)
Yes. After all that, I said that ID_TOPIC would be wrong in my last post but failed to replace it in that line:
echo '<a href="', $scripturl, '?topic=', $my['topic'], '.msg', $my['new_from'], ';topicseen#new"> <img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" /></a>';
Please confirm that it is right now:
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['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>';
At the moment, it seems to work with no errors. I'm crossing my fingers...
It works!
Problem solved! Thank you so much for your help and your patience!