SimplePortal

Customization => Blocks and Modifications => Block Requests => Topic started by: amko_sa on January 28, 2011, 12:08:48 PM

Title: PHP block error
Post by: amko_sa on January 28, 2011, 12:08:48 PM
I need help.
Why I have error after activate this custom PHP block:

 8: Undefined variable: scripturl

File: /home/****/public_html/Themes/Animated/BoardIndex.template.php (portal_above sub template - eval?)
Line: 68
also Line 44, Line 51, Line 52, Line 61

Code: [Select]
global $context, $txt, $settings, $modSettings, $sourcedir, $user_info;

   // Get the user online list.
   require_once($sourcedir . '/Subs-MembersOnline.php');
   $membersOnlineOptions = array(
      'show_hidden' => allowedTo('moderate_forum'),
      'sort' => 'log_time',
      'reverse_sort' => true,
   );
   $context += getMembersOnlineStats($membersOnlineOptions);

   $context['show_buddies'] = !empty($user_info['buddies']);

   // Are we showing all membergroups on the board index?
   if (!empty($settings['show_group_key']))
      $context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array());

   // Track most online statistics? (Subs-MembersOnline.php)
   if (!empty($modSettings['trackStats']))
      trackStatsUsersOnline($context['num_guests'] + $context['num_spiders'] + $context['num_users_online']);

   // Retrieve the latests posts if the theme settings require it.
   if (isset($settings['number_recent_posts']) && $settings['number_recent_posts'] > 1)
   {
      $latestPostOptions = array(
         'number_posts' => $settings['number_recent_posts'],
      );
      $context['latest_posts'] = cache_quick_get('boardindex-latest_posts:' . md5($user_info['query_wanna_see_board'] . $user_info['language']), 'Subs-Recent.php', 'cache_getLastPosts', array($latestPostOptions));
   }

   $settings['display_recent_bar'] = !empty($settings['number_recent_posts']) ? $settings['number_recent_posts'] : 0;
   $settings['show_member_bar'] &= allowedTo('view_mlist');
   $context['show_stats'] = allowedTo('view_stats') && !empty($modSettings['trackStats']);
   $context['show_member_list'] = allowedTo('view_mlist');
   $context['show_who'] = allowedTo('who_view') && !empty($modSettings['who_enabled']);

   // Show statistical style information...
   if ($settings['show_stats_index'])
   {
      echo '
         <div class="title_barIC">
            <h4 class="titlebg">
               <span class="ie6_header floatleft">
                  <a href="', $scripturl, '?action=stats"><img class="icon" src="', $settings['images_url'], '/icons/info.gif" alt="', $txt['forum_stats'], '" /></a>
                  ', $txt['forum_stats'], '
               </span>
            </h4>
         </div>
         <p class="infobg2">
            ', $context['common_stats']['total_posts'], ' ', $txt['posts_made'], ' ', $txt['in'], ' ', $context['common_stats']['total_topics'], ' ', $txt['topics'], ' ', $txt['by'], ' ', $context['common_stats']['total_members'], ' ', $txt['members'], '. ', !empty($settings['show_latest_member']) ? $txt['latest_member'] . ': <strong> ' . $context['common_stats']['latest_member']['link'] . '</strong>' : '', '<br />
            ', (!empty($context['latest_post']) ? $txt['latest_post'] . ': <strong>&quot;' . $context['latest_post']['link'] . '&quot;</strong>  ( ' . $context['latest_post']['time'] . ' )<br />' : ''), '
            <a href="', $scripturl, '?action=recent">', $txt['recent_view'], '</a>', $context['show_stats'] ? '<br />
            <a href="' . $scripturl . '?action=stats">' . $txt['more_stats'] . '</a>' : '', '
         </p>';
   }
   // "Users online" - in order of activity.
   echo '
         <div class="title_barIC">
            <h4 class="titlebg">
               <span class="ie6_header floatleft">
                  ', $context['show_who'] ? '<a href="' . $scripturl . '?action=who' . '">' : '', '<img class="icon" src="', $settings['images_url'], '/icons/online.gif', '" alt="', $txt['online_users'], '" />', $context['show_who'] ? '</a>' : '', '
                  ', $txt['online_users'], '
               </span>
            </h4>
         </div>
         <div class="infobg2">
         <p class="inline stats">
            ', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', comma_format($context['num_guests']), ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . comma_format($context['num_users_online']), ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];

   // Handle hidden users and buddies.
   $bracketList = array();
   if ($context['show_buddies'])
      $bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
   if (!empty($context['num_spiders']))
      $bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
   if (!empty($context['num_users_hidden']))
      $bracketList[] = comma_format($context['num_users_hidden']) . ' ' . $txt['hidden'];

   if (!empty($bracketList))
      echo ' (' . implode(', ', $bracketList) . ')';

   echo $context['show_who'] ? '</a>' : '', '
         </p>
         <p class="inline smalltext">';

   // Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
   if (!empty($context['users_online']))
   {
      echo '
            ', sprintf($txt['users_active'], $modSettings['lastActive']), ':<br />', implode(', ', $context['list_users_online']);

      // Showing membergroups?
      if (!empty($settings['show_group_key']) && !empty($context['membergroups']))
         echo '
            <br />[' . implode(']&nbsp;&nbsp;[', $context['membergroups']) . ']';
   }

   echo '
         </p>
         <p class="last smalltext">
            ', $txt['most_online_today'], ': <strong>', comma_format($modSettings['mostOnlineToday']), '</strong>.
            ', $txt['most_online_ever'], ': ', comma_format($modSettings['mostOnline']), ' (', timeformat($modSettings['mostDate']), ')
         </p>
         </div>';

   // If they are logged in, but statistical information is off... show a personal message bar.
   if ($context['user']['is_logged'] && !$settings['show_stats_index'])
   {
      echo '
         <div class="title_barIC">
            <h4 class="titlebg">
               <span class="ie6_header floatleft">
                  ', $context['allow_pm'] ? '<a href="' . $scripturl . '?action=pm">' : '', '<img class="icon" src="', $settings['images_url'], '/message_sm.gif" alt="', $txt['personal_message'], '" />', $context['allow_pm'] ? '</a>' : '', '
                  <span>', $txt['personal_message'], '</span>
               </span>
            </h4>
         </div>
         <p class="pminfo">
            <strong><a href="', $scripturl, '?action=pm">', $txt['personal_message'], '</a></strong>
            <span class="smalltext">
               ', $txt['you_have'], ' ', comma_format($context['user']['messages']), ' ', $context['user']['messages'] == 1 ? $txt['message_lowercase'] : $txt['msg_alert_messages'], '.... ', $txt['click'], ' <a href="', $scripturl, '?action=pm">', $txt['here'], '</a> ', $txt['to_view'], '
            </span>
         </p>';
   }
Title: Re: PHP block error
Post by: amko_sa on January 28, 2011, 02:15:03 PM
Found what is problem on this topic:

http://simpleportal.net/index.php?topic=593.0
SimplePortal 2.3.8 © 2008-2024, SimplePortal