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

Recent

Welcome to TinyPortal. Please login or sign up.

April 19, 2024, 09:06:12 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 266
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 78
  • Total: 78

error in TP log

Started by 4thHorseman, November 01, 2006, 08:33:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

4thHorseman

Well..... I have been messing around trying to figure out this error and i got it... its not the TP  as i thought it was its a block i added....
a calendar block

Quoteglobal $scripturl, $modSettings, $sdays;

$now = mktime() + $modSettings['time_offset'] * 3600;
$today = date('j',$now);
$year = date("Y",$now);
if (isset($_REQUEST['month'])) {
   $month = $_REQUEST['month'];
} else {
   $month = date("n",$now);
}

#create notice for Holidays, Events & Birthdays.

if (ssi_rafy_todaysBirthdays('')) {
   echo '<div align="center" class="smalltext" style="font-weight: bold;" color: #' . $modSettings['cal_bdaycolor'] . ';">Birthdays</div>';
   echo '<span class="smalltext">';
   $birthdays = split(',', ssi_rafy_todaysBirthdays('echo', $month));
   echo '</span>';
   
   echo '<hr style="border: 1px solid #7C5401" />';
}

if (ssi_rafy_todaysEvents('')) {
   echo '<div align="center" class="smalltext" style="font-weight: bold; color: #' . $modSettings['cal_eventcolor'] . ';">Upcoming Events</div>';
   echo '<span class="smalltext">';
   $events = split(',', ssi_rafy_todaysEvents('echo', $month));
   echo '</span>';
   
   echo '<hr style="border: 1px solid #7C5401" />';
}

if (ssi_rafy_todaysHolidays('')) {
   echo '<div align="center" class="smalltext" style="font-weight: bold; color: #' . $modSettings['cal_holidaycolor'] . ';">Holidays</div>';
   echo '<span class="smalltext">';
   $holidays = split(',', ssi_rafy_todaysHolidays('echo', $month));
   echo '</span>';
   
   echo '<hr style="border: 1px solid #7C5401" />';
}


//list($eventday, $eventlink) = each($events);
//echo '
';
//foreach($holidays as $ed){
//   $event = split('=>', $ed);
//   echo $event[0].$event[1];
//}
//echo '
';

   $days = array($today=>array(''.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$today.'',NULL,'<span style="font-weight: bold; border: solid 1px white; padding: 0px 0px 0px 0px;">'.$today.'</span>'));
   
   $day_name_length = 1;
   $month_href = $scripturl . '?action=calendar&month=' . $month;
   $first_day = 0;
   $pn = array('ÂÃ,«Ã‚Ã,«Ã‚Ã,«'=>$scripturl.'?month='.($month-1), 'ÂÃ,»Ã‚Ã,»Ã‚Ã,»'=>$scripturl.'?month='.($month+'1'));

   $first_of_month = gmmktime(0,0,0,$month,1,$year);
   #remember that mktime will automatically correct if invalid dates are entered
   # for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
   # this provides a built in "rounding" feature to generate_calendar()

   $day_names = array(); #generate all the day names according to the current locale
   for($n=0,$t=(3+$first_day)*86400; $n<7; $n++,$t+=86400) #January 4, 1970 was a Sunday
      $day_names[$n] = ucfirst(gmstrftime('%A',$t)); #%A means full textual day name

   list($month, $year, $month_name, $weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));
   $weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
   $title   = htmlentities(ucfirst($month_name)).' '.$year;  #note that some locales don't capitalize month and day names

   #Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
   @list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable
   if($p) $p = '<span class="smalltext">'.($pl ? '<a href="'.htmlspecialchars($pl).'">'.$p.'</a>' : $p).'</span>   ';
   if($n) $n = '   <span class="smalltext">'.($nl ? '<a href="'.htmlspecialchars($nl).'">'.$n.'</a>' : $n).'</span>';

   $calendar = '<table class="smalltext" width="100%">'."\n".
      '<caption >'.$p.($month_href ? '<a href="'.htmlspecialchars($month_href).'">'.$title.'</a>' : $title).$n."</caption>\n<tr>";

   if($day_name_length){ #if the day names should be shown ($day_name_length > 0)
      #if day_name_length is >3, the full name of the day will be printed
      foreach($day_names as $d)
         $calendar .= '<th class="smalltext" abbr="'.htmlentities($d).'">'.htmlentities($day_name_length < 4 ? substr($d,0,$day_name_length) : $d).'</th>';
            $calendar .= "</tr>\n<tr style=\"text-align:center;\">";
   }

   if($weekday > 0) $calendar .= '<td class="smalltext" colspan="'.$weekday.'"> </td>'; #initial 'empty' days
   for($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month; $day++,$weekday++){
      $sp1 = '';
      $sp2 = '';
      foreach($holidays as $sd) {
         $event = split('=>', $sd);
         if($day == intval($event[0]))
         {
            $sp1 = '<span align="center" style="color: #FFFFFF; background-color: #' . $modSettings['cal_holidaycolor'] . '; padding: 0px 0px 0px 0px;" title="'.htmlspecialchars($event[1]).'">';
            $sp2 = '</span>';
         }
      }
      foreach($events as $sd) {
         $event = split('=>', $sd);
         if($day == intval($event[0]))
         {
            $sp1 = '<span align="center" style="color: #FFFFFF; background-color: #' . $modSettings['cal_eventcolor'] . '; padding: 0px 0px 0px 0px;" title="'.htmlspecialchars($event[1]).'">';
            $sp2 = '</span>';
         }
      }
      foreach($birthdays as $sd) {
         $event = split('=>', $sd);
         if($day == intval($sd))
         {
            $sp1 = '<span align="center" style="color: #FFFFFF; background-color: #' . $modSettings['cal_bdaycolor'] . '; padding: 0px 0px 0px 0px;" title="'.htmlspecialchars($event[1]).'">';
            $sp2 = '</span>';
         }
      }   
      if($weekday == 7){
         $weekday   = 0; #start a new week
         $calendar .= "</tr>\n<tr style=\"text-align:center;\">";
      }
      if(isset($days[$day]) and is_array($days[$day]) and ($month == date("n",$now))){
         @list($link, $classes, $content) = $days[$day];
         if(is_null($content))  $content  = $day;
         $calendar .= '<td'.($classes ? ' class="'.htmlspecialchars($classes).'">' : '>');
         $calendar .= ($link ? '<a href="'.htmlspecialchars($link).'">'.$sp1.$content.$sp2.'</a>' : $sp1.$content.$sp2).'</td>';
      }
      else
      {
         $calendar .= "<td style=\"padding-right: 0px; font-size: x-small; font-family: arial, sans-serif;\"><a";
         if(((($weekday+$first_day) % 7)==0)||((($weekday+$first_day) % 7)==6))
         {
            $calendar .= ' style="color:#C00000;"';
         }
         $calendar .= " href=\"".$scripturl."?action=calendar;month=".$month.";year=".$year.";day=".$day."\" target=\"_self\">$sp1$day$sp2</a></td>";
      }
   }   
if($weekday != 7) $calendar .= '<td class="smalltext" colspan="'.(7-$weekday).'"> </td>'; #remaining "empty" days
echo $calendar.'</tr>';
echo '</table>';

// Show today's birthdays.
function ssi_rafy_todaysBirthdays($output_method = 'echo', $month)
{
   global $context, $scripturl, $db_prefix;

   if (!smf_loadCalendarInfo() || empty($context['calendar_birthdays']))
      return array();

   if ($output_method != 'echo')
      return $context['calendar_birthdays'];

   foreach ($context['calendar_birthdays'] as $member)
   {
      $query = db_query(
      "SELECT birthdate
      FROM {$db_prefix}members
      WHERE ID_MEMBER='".$member['id']."'", __FILE__, __LINE__);
      
      $row = mysql_fetch_assoc($query);
      $birthdate = strtotime($row['birthdate']);
      
      echo '<div align="center">';
      echo '<a href="', $scripturl, '?action=calendar;year=' . date("Y") . ';month=' . date("n",$birthdate) . '">' . date("F jS",$birthdate) . '</a>';
      echo '
';
      echo '<img src="/Themes/rOrb/images/icons/birthday_small.gif" width="13" height="17" align="absmiddle" hspace="5">';
      echo '<a href="', $scripturl, '?action=profile;u=', $member['id'], '">';
      echo $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '');
      echo '</a>';
//      echo (!$member['is_last'] ? '
' : '');

      echo '</div>';
      
      if(date("n",$birthdate) == $month)
      {
         $sdays .= date("j",$birthdate).'=>'.$member['name'].'ÂÃ,´s bDay'.',';
      }
   }
   return $sdays;
}

// Show today's events.
function ssi_rafy_todaysEvents($output_method = 'echo', $month)
{
   global $context, $db_prefix;

   if (!smf_loadCalendarInfo() || empty($context['calendar_events']))
      return array();

   if ($output_method != 'echo')
      return $context['calendar_events'];

   foreach ($context['calendar_events'] as $event)
   {
      $query = db_query(
      "SELECT startDate
      FROM {$db_prefix}calendar
      WHERE ID_EVENT='".$event['id']."'", __FILE__, __LINE__);
      
      $row = mysql_fetch_assoc($query);
      $startDate = strtotime($row['startDate']);

      echo '<div align="center">';
      echo '<a href="', $scripturl, '?action=calendar;year=' . date("Y") . ';month=' . date("n",$startDate) . '">' . date("F jS Y",$startDate) . '</a>';
      echo '
';

      if ($event['can_edit'])
         echo '<a href="' . $event['modify_href'] . '" style="color: #FF0000;">[e]</a> ';
      echo $event['link'] ;
//      echo (!$event['is_last'] ? '
' : '');
      echo '</div>';
   
      if(date("n",$startDate) == $month)
      {
         $sdays .= date("j",$startDate).'=>'.str_replace("'","ÂÃ,´",$event['link']).',';
      }
   }
   return $sdays;
}

// Show today's holidays.
function ssi_rafy_todaysHolidays($output_method = 'echo', $month)
{
   global $context;

   if (!smf_loadCalendarInfo() || empty($context['calendar_holidays']))
      return array();

   if ($output_method != 'echo')
      return $context['calendar_holidays'];


   foreach($context['calendar_holidays'] as $holiday) {
      $query = db_query(
      "SELECT eventDate
      FROM {$db_prefix}smf_calendar_holidays
      WHERE title='".str_replace("'","''",$holiday)."'
      AND (eventDate LIKE '".date("Y")."%' OR eventDate LIKE '0004%')", __FILE__, __LINE__);
      
      $row = mysql_fetch_assoc($query);
      $eventDate = strtotime($row['eventDate']);

      echo '<div align="center">';
      echo '<a href="', $scripturl, '?action=calendar;year=' . date("Y") . ';month=' . date("n",$eventDate) . '">' . date("F jS",$eventDate) . '</a>';
      echo '
';
      echo $holiday;
      echo '</div>';

      if(date("n",$eventDate) == $month)
      {
         $sdays .= date("j",$eventDate).'=>'.str_replace("'","ÂÃ,´",$holiday).',';
      }
   }
   return $sdays;
}

this is the code for the calendar can someone tell me why its generating this error???/

4thHorseman

i want to thank everyone that replyed to this problem...

but i have found a Calendar code that works without the error..