Ignore:
Timestamp:
Jan 30, 2008, 6:55:54 PM (16 years ago)
Author:
george
Message:

Upraveno: Zpřehlednění a zhuštění zobrazení historie SunriseChatu.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • www/sunrisechat/history.php

    r4 r32  
    88$DateParts = explode('-',$Date);
    99 
    10 $DbResult = $Database->select('sunrisechat_history','MAX(time),MIN(time)');
     10$DbResult = $Database->select('sunrisechat_history','MAX(time), MIN(time)');
    1111$RowTotal = $DbResult->fetch_array();
    1212 
     
    2222}
    2323 
     24if(!array_key_exists('year', $_SESSION)) $_SESSION['year'] = date('Y', time());
     25if(array_key_exists('year', $_GET)) $_SESSION['year'] = addslashes($_GET['year']);
     26 
     27if(!array_key_exists('month', $_SESSION)) $_SESSION['month'] = date('n', time());
     28if(array_key_exists('month', $_GET)) $_SESSION['month'] = addslashes($_GET['month']);
     29 
    2430echo('<div style="font-size: small;">');
    2531for($Year = $EndDateParts[0]; $Year >= $StartDateParts[0]; $Year--)
    2632{
    27   echo('<div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;">'.$Year.'</div>
    28   <div style="margin-left: 15px; margin-right: 15px;">');
    29   if($Year == $StartDateParts[0]) $StartMonth = ($StartDateParts[1]+0); else $StartMonth = 1;
    30   if($Year == $EndDateParts[0]) $EndMonth = ($EndDateParts[1]+0); else $EndMonth = 12;
    31   for($Month = $EndMonth; $Month >= $StartMonth; $Month--)
     33  if($_SESSION['year'] == $Year)
    3234  {
    33 //      echo('<div><span>');
    34     echo('<div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;">'.$MonthNames[$Month].'
    35     <span style="position: absolute; left: 100px;">');
    36     if(($Year == $StartDateParts[0]) and ($Month == $StartDateParts[1])) $StartDay = ($StartDateParts[2]+0); else $StartDay = 1;
    37     if(($Year == $EndDateParts[0]) and ($Month == $EndDateParts[1])) $EndDay = ($EndDateParts[2]+0); else $EndDay = date('t',mktime(0,0,0,$Month,0,$Year));
    38     for($Day = $StartDay; $Day <= $EndDay; $Day++)
    39     {
     35    echo('<div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;">'.$Year.'</div>
     36    <div style="margin-left: 15px; margin-right: 15px;">');
     37    if($Year == $StartDateParts[0]) $StartMonth = ($StartDateParts[1]+0); else $StartMonth = 1;
     38    if($Year == $EndDateParts[0]) $EndMonth = ($EndDateParts[1]+0); else $EndMonth = 12;
     39    for($Month = $EndMonth; $Month >= $StartMonth; $Month--)
     40    {
     41      if($_SESSION['month'] == $Month)
     42      {
     43      //      echo('<div><span>');
     44      echo('<div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;">'.$MonthNames[$Month].'
     45      <span style="position: absolute; left: 100px;">');
     46      if(($Year == $StartDateParts[0]) and ($Month == $StartDateParts[1])) $StartDay = ($StartDateParts[2]+0); else $StartDay = 1;
     47      if(($Year == $EndDateParts[0]) and ($Month == $EndDateParts[1])) $EndDay = ($EndDateParts[2]+0); else $EndDay = date('t',mktime(0,0,0,$Month,0,$Year));
     48      for($Day = $StartDay; $Day <= $EndDay; $Day++)
     49      {
    4050//        $Date = $Year.'-'.$Month.'-'.$Day;
    4151        //DB_Select('sunrisechat_history','COUNT(*)',"roomtype=0 AND time>'".$Date." 00:00:00' AND time<'".$Date." //23:59:59'");
    4252  //      $CR = DB_Row();
    4353//        $Text = '<a href="history.php?date='.$Year.'-'.$Month.'-'.$Day.'">'.$Day.'('.$CR['COUNT(*)'].')</a> ';
    44       $Text = '<a href="history.php?date='.$Year.'-'.$Month.'-'.$Day.'">'.$Day.'</a> ';
     54        $Text = '<a href="history.php?date='.$Year.'-'.$Month.'-'.$Day.'">'.$Day.'</a> ';
     55        flush();
     56        if(($DateParts[0] == $Year) and ($DateParts[1] == $Month) and ($DateParts[2] == $Day)) $Text = '<strong style="border-style: solid; border-width: 1; border-color: black; padding-left: 3px;">'.$Text.'</strong>';
     57        echo($Text);
     58      }
     59      echo('</span></div>');
     60      } else echo('<span style="border-style: solid; border-bottom-color: gray; border-width: 0 0 0 0; margin-bottom: 3px; padding-bottom: 2px;"><a href="?month='.$Month.'">'.$MonthNames[$Month].'</a></span> ');
     61    }
     62    echo('</div>');
     63    } else echo('<div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;"><a href="?year='.$Year.'">'.$Year.'</a></div>');
     64  }
     65  echo('</div><div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;"></div>');
     66 
     67    $DbResult = $Database->select('sunrisechat_history','nick,color,text,UNIX_TIMESTAMP(time)',"roomtype=0 AND time>'".$Date." 00:00:00' AND time<'".$Date." 23:59:59' ORDER BY time DESC");
     68    //echo('Vpis posledn�h 100 zpr�:<br>');
     69    echo('<div style="font-size: small;">');
     70    while($Row = $DbResult->fetch_array())
     71    {
     72      $Text = $Row['text'];;
     73      // StrTr($Row['text'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE");
     74      echo('['.date('d.m.Y H:i:s',$Row['UNIX_TIMESTAMP(time)']).'] <span style="color: #'.dechexr($Row['color']).'"><strong>&lt;'.$Row['nick'].'&gt;</strong> '.(htmlspecialchars($Text)).'</span><br>');
    4575      flush();
    46       if(($DateParts[0] == $Year) and ($DateParts[1] == $Month) and ($DateParts[2] == $Day)) $Text = '<strong style="border-style: solid; border-width: 1; border-color: black; padding-left: 3px;">'.$Text.'</strong>';
    47       echo($Text);
    4876    }
    49     echo('</span></div>');
    50   }
    51   echo('</div>');
    52 }
    53 echo('</div>');
    54 
    55 $DbResult = $Database->select('sunrisechat_history','nick,color,text,UNIX_TIMESTAMP(time)',"roomtype=0 AND time>'".$Date." 00:00:00' AND time<'".$Date." 23:59:59' ORDER BY time DESC");
    56 //echo('Výpis posledních 100 zpráv:<br>');
    57 echo('<div style="font-size: small;">');
    58 while($Row = $DbResult->fetch_array())
    59 {
    60   $Text = $Row['text'];;
    61   // StrTr($Row['text'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE");
    62   echo('['.date('d.m.Y H:i:s',$Row['UNIX_TIMESTAMP(time)']).'] <span style="color: #'.dechexr($Row['color']).'"><strong>&lt;'.$Row['nick'].'&gt;</strong> '.(htmlspecialchars($Text)).'</span><br>');
    63   flush();
    64 }
    65 echo('</div>');
     77    echo('</div>');
    6678 
    67 ShowFooter();
     79  ShowFooter();
    6880?>
Note: See TracChangeset for help on using the changeset viewer.