SimplePortal

Support => English Support => Topic started by: Raji on January 21, 2010, 09:18:30 AM

Title: PortalBlocks.php(3419) : eval()'d code
Post by: Raji on January 21, 2010, 09:18:30 AM
Hi there,

Today I have checked forum log found following error

Quote
8: Undefined index: new
File: /home2/baaskcom/public_html/diwwan/Sources/PortalBlocks.php(3419) : eval()'d code
Line: 53


Kindly help me out to resolve this issue as I am not good in php.

Thanks in advance for your prompt response.

With regards
Raji Baloch

Title: Re: PortalBlocks.php(3419) : eval()'d code
Post by: [SiNaN] on January 21, 2010, 12:12:27 PM
First disable template eval using this mod:

http://custom.simplemachines.org/mods/index.php?mod=2054

Once you disable the template eval, check your error log again and copy the error details here.

If you have any custom PHP blocks, it would help if you can copy the codes of them here too.
Title: Re: PortalBlocks.php(3419) : eval()'d code
Post by: Raji on January 21, 2010, 11:16:54 PM
Thanks for your response.

Here is the PHP BLOCK I have recently added:

Quote
global $txt, $scripturl, $settings, $context, $color_profile;

   $boards = null;
   $limit = 15;
   $type = 'ssi_recentTopics'; // Can also be 'ssi_recentPosts' for recent posts.
   $display = 'full'; // Could also be 'compact' for showing on the left and right sides. Although it doesn't work as well.

   $items = $type($limit, null, $boards, 'array');

   if (empty($items))
   {
      echo '
                        ', $txt['error_sp_no_posts_found'];
      return;
   }
   else
      $items[count($items) - 1]['is_last'] = true;

   $colorids = array();
   foreach ($items as $item)
      $colorids[] = $item['poster']['id'];

   if (!empty($colorids) && sp_loadColors($colorids) !== false)
   {
      foreach ($items as $k => $p)
      {
         if (!empty($color_profile[$p['poster']['id']]['link']))
            $items[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link'];
      }
   }

   echo '<marquee behavior="scroll" direction="up" height="170px" scrolldelay=" 10" scrollamount=" 1" onmouseover="this.stop()" onmouseout="this.start()">';

   if ($display == 'compact')
   {
      foreach ($items as $key => $item)
         echo '
                        <a href="', $item['href'], '">', $item['subject'], '</a> <span class="smalltext">', $txt['by'], ' ', $item['poster']['link'], $item['new'] ? '' : ' <a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '<br />[', $item['time'], ']</span><br />', empty($item['is_last']) ? '<hr />' : '';
   }
   elseif ($display == 'full')
   {
      echo '
                        <table class="sp_fullwidth">';

      foreach ($items as $item)
         echo '
                           <tr>
                              <td class="sp_recent_icon sp_center">
                                 ', sp_embed_image(empty($parameters['type']) ? 'post' : 'topic'), '
                              </td>
                              <td class="sp_recent_subject">
                                 <a href="', $item['href'], '">', $item['subject'], '</a>
                                 ', $item['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '<br />[', $item['board']['link'], ']
                              </td>
                              <td class="sp_recent_info sp_right">
                                 ', $item['poster']['link'], '<br />', $item['time'], '
                              </td>
                           </tr>';

      echo '
                        </table>';
   }
   
   echo '</marquee>';

After installation of "Disable Template Eval" there is nothing in Forum log.

With regards

Raji Baloch
Title: Re: PortalBlocks.php(3419) : eval()'d code
Post by: [SiNaN] on January 22, 2010, 09:02:40 AM
In your code above:

Code: (Find) [Select]
   if ($display == 'compact')
   {
      foreach ($items as $key => $item)
         echo '
                        <a href="', $item['href'], '">', $item['subject'], '</a> <span class="smalltext">', $txt['by'], ' ', $item['poster']['link'], $item['new'] ? '' : ' <a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '<br />[', $item['time'], ']</span><br />', empty($item['is_last']) ? '<hr />' : '';
   }
   elseif ($display == 'full')
   {
      echo '
                        <table class="sp_fullwidth">';

      foreach ($items as $item)
         echo '
                           <tr>
                              <td class="sp_recent_icon sp_center">
                                 ', sp_embed_image(empty($parameters['type']) ? 'post' : 'topic'), '
                              </td>
                              <td class="sp_recent_subject">
                                 <a href="', $item['href'], '">', $item['subject'], '</a>
                                 ', $item['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '<br />[', $item['board']['link'], ']
                              </td>
                              <td class="sp_recent_info sp_right">
                                 ', $item['poster']['link'], '<br />', $item['time'], '
                              </td>
                           </tr>';

      echo '
                        </table>';
   }

Code: (Replace) [Select]
if ($display == 'compact')
{
foreach ($items as $key => $item)
echo '
<a href="', $item['href'], '">', $item['subject'], '</a> <span class="smalltext">', $txt[525], ' ', $item['poster']['link'], $item['new'] ? '' : ' <a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '<br />[', $item['time'], ']</span><br />', empty($item['is_last']) ? '<hr />' : '';
}
elseif ($display == 'full')
{
echo '
<table class="sp_fullwidth">';

foreach ($items as $item)
echo '
<tr>
<td class="sp_recent_icon sp_center">
', sp_embed_image(empty($parameters['type']) ? 'post' : 'topic'), '
</td>
<td class="sp_recent_subject">
<a href="', $item['href'], '">', $item['subject'], '</a>
', $item['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '<br />[', $item['board']['link'], ']
</td>
<td class="sp_recent_info sp_right">
', $item['poster']['link'], '<br />', $item['time'], '
</td>
</tr>';

echo '
</table>';
}
SimplePortal 2.3.8 © 2008-2024, SimplePortal