Konu: En iyiler bloğu  (Okunma sayısı 811 defa)

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

11 Kasım 2012, 00:20
  • *
    • İleti: 2018
    • Karma: 41
    • Spina Bifida
    • Profili Görüntüle

akbora rumuzlu üyemizin isteği üzerine Erhan paşam rumuzlu üyemizin Simple Portal En İyiler konusundaki kodlar geliştirilerek yapılmıştır.



Demo için tıklayınız...

Aşağıdaki kodlarla php blok oluşturup kullanabilirsiniz.
Kod: [Seç]
  global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far today
   // Change the time depending on server time offset
   list($year, $month, $day) = explode('-', date('Y-m-d'));
    $starttime = mktime(0, 0, 0, $month, $day, $year);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
         
   $context['top_posters_day'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_day'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_day'] as $i => $j)
      $context['top_posters_day'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);
   
   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);

   echo '
   <table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="150">
      <font color=#000000><b> Günün En İyileri:</b></td> <td style="border-style: none; border-width: medium">  <table border="0" cellpadding="1" cellspacing="0" width="100%">
         <tr>
             
             
            </tr>';

   foreach ($context['top_posters_day'] as $poster)
      echo '
            <tr>
', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), '&nbsp;', $poster['link'], '&nbsp;&nbsp;&nbsp;[', $poster['num_posts'], ']&nbsp;&nbsp;&nbsp;&nbsp;
            </tr>';
   echo '
         </table></td>
</tr>
</table>
';



   global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far this week  (starts sunday)
   $starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (date("N")*3600*24);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
   
   $context['top_posters_week'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_week'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_week'] as $i => $j)
      $context['top_posters_week'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);

   echo '
   <table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="150">
<font color=#000000>   <b> Haftanın En İyileri:</b></font>
</td>
<td style="border-style: none; border-width: medium">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
              <tr>
             
               
            </tr>';

   foreach ($context['top_posters_week'] as $poster)
      echo '
            <tr>
              ', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), '&nbsp;', $poster['link'], ' &nbsp;&nbsp;&nbsp; [', $poster['num_posts'], ']&nbsp;&nbsp;&nbsp;&nbsp;
            </tr>';
   echo '
         </table></td>
</tr>
</table>
';






   global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far this month  (starts sunday)
   $starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (3600*24*31);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
   
   $context['top_posters_month'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_month'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_month'] as $i => $j)
      $context['top_posters_month'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);

echo '
<table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="150">
<font color=#000000>    <b> Ayın En İyileri:</b></font> </td>
<td style="border-style: none; border-width: medium">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
         <tr>

            </tr>';

   foreach ($context['top_posters_month'] as $poster)
      echo '
            <tr >
              ', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), '&nbsp;', $poster['link'], '&nbsp;&nbsp;&nbsp;[', $poster['num_posts'], ']&nbsp;&nbsp;&nbsp;&nbsp;
            </tr>';
   echo '
         </table></td>
</tr>
</table>
';

Aşağıdaki resimdeki gibi olsun isteyenler için:



php kod:
Kod: [Seç]
  global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far today
   // Change the time depending on server time offset
   list($year, $month, $day) = explode('-', date('Y-m-d'));
    $starttime = mktime(0, 0, 0, $month, $day, $year);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
         
   $context['top_posters_day'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_day'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_day'] as $i => $j)
      $context['top_posters_day'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);
   
   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);
   global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far this week  (starts sunday)
   $starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (date("N")*3600*24);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
   
   $context['top_posters_week'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_week'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_week'] as $i => $j)
      $context['top_posters_week'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);
      global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far this month  (starts sunday)
   $starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (3600*24*31);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
   
   $context['top_posters_month'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_month'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_month'] as $i => $j)
      $context['top_posters_month'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);

   echo '


<table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium">   <table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
     <img border="0" src="http://www.spinabifidaturkey.com/images/makale/gununen.gif" width="75" height="98"></td> <td style="border-style: none; border-width: medium">  <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_day'] as $poster)
      echo '
            <tr>
<div>', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ' ', $poster['link'], '   [', $poster['num_posts'], ']</div>
            </tr>';
   echo '
         </table></td>
</tr>
</table></td>
<td style="border-style: none; border-width: medium">   <table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
<img border="0" src="http://www.spinabifidaturkey.com/images/makale/haftaninen.gif" width="75" height="98">
</td>
<td style="border-style: none; border-width: medium">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_week'] as $poster)
      echo '
            <tr>
              <div>', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ' ', $poster['link'], '     [', $poster['num_posts'], ']</div>
            </tr>';
   echo '
         </table></td>
</tr>
</table>
</td>
<td style="border-style: none; border-width: medium"><table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
<img border="0" src="http://www.spinabifidaturkey.com/images/makale/ayinen.gif" width="75" height="98"> </td>
<td style="border-style: none; border-width: medium">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_month'] as $poster)
      echo '
            <tr >
             <div> ', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ' ', $poster['link'], '   [', $poster['num_posts'], ']</div>
            </tr>';
   echo '
         </table></td>
</tr>
</table></td>
</tr>
</table>';

css kodlaması için blok görüntüleme seçeneklerinden aşağıdakileri yapıp:

Tanımlı İçerik Sınıfı: information
Özel içerik sınıfı: en

index.css şunun altına:
Kod: [Seç]
.information
{
padding: 0.5em 1em;
font-size: 0.9em;
line-height: 1.3em;
border: 1px solid #003c74;
background: #f5f5f5;
margin: 0.2em 1px 1em 1px;
}

Şunu ekleyin:
Kod: [Seç]
.en
{
padding: 0.5em 1em;
font-size: 0.9em;
line-height: 1.3em;
border: 1px solid #003c74;
background: #ffffff;
margin: 0.2em 1px 1em 1px;
}

« Son Düzenleme: 11 Kasım 2012, 09:09 Gönderen: bolubeyi »

11 Kasım 2012, 02:28
Yanıtla #1
  • *
    • İleti: 2018
    • Karma: 41
    • Spina Bifida
    • Profili Görüntüle

akbora rumuzlu üyemizin isteği üzerine Erhan paşam rumuzlu üyemizin Simple Portal En İyiler konusundaki kodlar geliştirilerek yapılmıştır.



Demo için tıklayınız...

Aşağıdaki kodlarla php blok oluşturup kullanabilirsiniz.
Kod: [Seç]
  global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far today
   // Change the time depending on server time offset
   list($year, $month, $day) = explode('-', date('Y-m-d'));
    $starttime = mktime(0, 0, 0, $month, $day, $year);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
         
   $context['top_posters_day'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_day'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_day'] as $i => $j)
      $context['top_posters_day'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);
   
   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);

   echo '
   <table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="150">
      <font color=#000000><b> Günün En İyileri:</b></td> <td style="border-style: none; border-width: medium">  <table border="0" cellpadding="1" cellspacing="0" width="100%">
         <tr>
             
             
            </tr>';

   foreach ($context['top_posters_day'] as $poster)
      echo '
            <tr>
', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), '&nbsp;', $poster['link'], '&nbsp;&nbsp;&nbsp;[', $poster['num_posts'], ']&nbsp;&nbsp;&nbsp;&nbsp;
            </tr>';
   echo '
         </table></td>
</tr>
</table>
';



   global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far this week  (starts sunday)
   $starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (date("N")*3600*24);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
   
   $context['top_posters_week'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_week'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_week'] as $i => $j)
      $context['top_posters_week'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);

   echo '
   <table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="150">
<font color=#000000>   <b> Haftanın En İyileri:</b></font>
</td>
<td style="border-style: none; border-width: medium">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
              <tr>
             
               
            </tr>';

   foreach ($context['top_posters_week'] as $poster)
      echo '
            <tr>
              ', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), '&nbsp;', $poster['link'], ' &nbsp;&nbsp;&nbsp; [', $poster['num_posts'], ']&nbsp;&nbsp;&nbsp;&nbsp;
            </tr>';
   echo '
         </table></td>
</tr>
</table>
';






   global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far this month  (starts sunday)
   $starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (3600*24*31);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
   
   $context['top_posters_month'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_month'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_month'] as $i => $j)
      $context['top_posters_month'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);

echo '
<table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="150">
<font color=#000000>    <b> Ayın En İyileri:</b></font> </td>
<td style="border-style: none; border-width: medium">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
         <tr>

            </tr>';

   foreach ($context['top_posters_month'] as $poster)
      echo '
            <tr >
              ', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), '&nbsp;', $poster['link'], '&nbsp;&nbsp;&nbsp;[', $poster['num_posts'], ']&nbsp;&nbsp;&nbsp;&nbsp;
            </tr>';
   echo '
         </table></td>
</tr>
</table>
';


11 Kasım 2012, 07:12
Yanıtla #2
  • *
    • İleti: 2018
    • Karma: 41
    • Spina Bifida
    • Profili Görüntüle

Kod: [Seç]
  global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far today
   // Change the time depending on server time offset
   list($year, $month, $day) = explode('-', date('Y-m-d'));
    $starttime = mktime(0, 0, 0, $month, $day, $year);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
         
   $context['top_posters_day'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_day'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_day'] as $i => $j)
      $context['top_posters_day'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);
   
   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);
   global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far this week  (starts sunday)
   $starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (date("N")*3600*24);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
   
   $context['top_posters_week'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_week'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_week'] as $i => $j)
      $context['top_posters_week'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);
      global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far this month  (starts sunday)
   $starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (3600*24*31);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
   
   $context['top_posters_month'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_month'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_month'] as $i => $j)
      $context['top_posters_month'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);

   echo '


<table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium">   <table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
     <img border="0" src="http://www.spinabifidaturkey.com/images/makale/gununen.gif" width="75" height="98"></td> <td style="border-style: none; border-width: medium">  <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_day'] as $poster)
      echo '
            <tr>
<div>', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ' ', $poster['link'], '   [', $poster['num_posts'], ']<div>
            </tr>';
   echo '
         </table></td>
</tr>
</table></td>
<td style="border-style: none; border-width: medium">   <table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
<img border="0" src="http://www.spinabifidaturkey.com/images/makale/haftaninen.gif" width="75" height="98">
</td>
<td style="border-style: none; border-width: medium">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_week'] as $poster)
      echo '
            <tr>
              <div>', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ' ', $poster['link'], '     [', $poster['num_posts'], ']</div>
            </tr>';
   echo '
         </table></td>
</tr>
</table>
</td>
<td style="border-style: none; border-width: medium"><table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
<img border="0" src="http://www.spinabifidaturkey.com/images/makale/ayinen.gif" width="75" height="98"> </td>
<td style="border-style: none; border-width: medium">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_month'] as $poster)
      echo '
            <tr >
             <div> ', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ' ', $poster['link'], '   [', $poster['num_posts'], ']</div>
            </tr>';
   echo '
         </table></td>
</tr>
</table></td>
</tr>
</table>';


11 Kasım 2012, 09:05
Yanıtla #3
  • *
    • İleti: 2018
    • Karma: 41
    • Spina Bifida
    • Profili Görüntüle

Kod: [Seç]
  global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far today
   // Change the time depending on server time offset
   list($year, $month, $day) = explode('-', date('Y-m-d'));
    $starttime = mktime(0, 0, 0, $month, $day, $year);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
         
   $context['top_posters_day'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_day'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_day'] as $i => $j)
      $context['top_posters_day'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);
   
   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);
   global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far this week  (starts sunday)
   $starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (date("N")*3600*24);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
   
   $context['top_posters_week'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_week'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_week'] as $i => $j)
      $context['top_posters_week'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);
      global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far this month  (starts sunday)
   $starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (3600*24*31);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
   
   $context['top_posters_month'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_month'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_month'] as $i => $j)
      $context['top_posters_month'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);

   echo '


<table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium">   <table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
     <img border="0" src="http://www.spinabifidaturkey.com/images/makale/gununen.gif" width="75" height="98"></td> <td style="border-style: none; border-width: medium">  <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_day'] as $poster)
      echo '
            <tr>
<td>', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ' ', $poster['link'], '   </td>
<td align="center">[', $poster['num_posts'], ']</td>
            </tr>';
   echo '
         </table></td>
</tr>
</table></td>
<td style="border-style: none; border-width: medium">   <table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
<img border="0" src="http://www.spinabifidaturkey.com/images/makale/haftaninen.gif" width="75" height="98">
</td>
<td style="border-style: none; border-width: medium">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_week'] as $poster)
      echo '
            <tr>
              <td>', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ' ', $poster['link'], '     </td>
              <td align="center">[', $poster['num_posts'], ']</td>
            </tr>';
   echo '
         </table></td>
</tr>
</table>
</td>
<td style="border-style: none; border-width: medium"><table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
<img border="0" src="http://www.spinabifidaturkey.com/images/makale/ayinen.gif" width="75" height="98"> </td>
<td style="border-style: none; border-width: medium">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_month'] as $poster)
      echo '
            <tr >
             <td> ', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ' ', $poster['link'], '   </td>
             <td align="center"> [', $poster['num_posts'], ']</td>
            </tr>';
   echo '
         </table></td>
</tr>
</table></td>
</tr>
</table>';


11 Kasım 2012, 09:53
Yanıtla #4
  • *
    • İleti: 2018
    • Karma: 41
    • Spina Bifida
    • Profili Görüntüle

Kod: [Seç]
  global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far today
   // Change the time depending on server time offset
   list($year, $month, $day) = explode('-', date('Y-m-d'));
    $starttime = mktime(0, 0, 0, $month, $day, $year);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
         
   $context['top_posters_day'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_day'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_day'] as $i => $j)
      $context['top_posters_day'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);
   
   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);
   global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far this week  (starts sunday)
   $starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (date("N")*3600*24);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
   
   $context['top_posters_week'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_week'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_week'] as $i => $j)
      $context['top_posters_week'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);
      global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far this month  (starts sunday)
   $starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (3600*24*31);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
   
   $context['top_posters_month'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_month'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_month'] as $i => $j)
      $context['top_posters_month'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);

   echo '


<table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium">   <table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
     <img border="0" src="http://www.spinabifidaturkey.com/images/makale/gununen.gif" width="75" height="98"></td> <td style="border-style: none; border-width: medium">  <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_day'] as $poster)
      echo '
            <tr>
<td><img border="0" src="http://www.spinabifidaturkey.com/images/maviuser.png" width="16" height="16"> ', $poster['link'], '   </td>
<td align="center">[', $poster['num_posts'], ']</td>
            </tr>';
   echo '
         </table></td>
</tr>
</table></td>
<td style="border-style: none; border-width: medium">   <table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
<img border="0" src="http://www.spinabifidaturkey.com/images/makale/haftaninen.gif" width="75" height="98">
</td>
<td style="border-style: none; border-width: medium">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_week'] as $poster)
      echo '
            <tr>
              <td><img border="0" src="http://www.spinabifidaturkey.com/images/yesiluser.png" width="16" height="16"> ', $poster['link'], '     </td>
              <td align="center">[', $poster['num_posts'], ']</td>
            </tr>';
   echo '
         </table></td>
</tr>
</table>
</td>
<td style="border-style: none; border-width: medium"><table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
<img border="0" src="http://www.spinabifidaturkey.com/images/makale/ayinen.gif" width="75" height="98"> </td>
<td style="border-style: none; border-width: medium">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_month'] as $poster)
      echo '
            <tr >
             <td> <img border="0" src="http://www.spinabifidaturkey.com/images/sariuser.png" width="16" height="16"> ', $poster['link'], '   </td>
             <td align="center"> [', $poster['num_posts'], ']</td>
            </tr>';
   echo '
         </table></td>
</tr>
</table></td>
</tr>
</table>';


12 Kasım 2012, 00:39
Yanıtla #5
  • *
    • İleti: 2018
    • Karma: 41
    • Spina Bifida
    • Profili Görüntüle

Kod: [Seç]
  global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far today
   // Change the time depending on server time offset
   list($year, $month, $day) = explode('-', date('Y-m-d'));
$starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (date("N")*3600*24);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
         
   $context['top_posters_day'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_day'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_day'] as $i => $j)
      $context['top_posters_day'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);
   
   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);
   global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far this week  (starts sunday)
$starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (date("n")*3600*24);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m
         LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
   
   $context['top_posters_week'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_week'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_week'] as $i => $j)
      $context['top_posters_week'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);
      global $smcFunc, $scripturl, $context, $settings;

   // Top 10 Posters so far this month  (starts sunday)
   $starttime = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (3600*24*31);
   // Offset based on forum time
   $starttime = forum_time(false, $starttime);
   
   $request = $smcFunc['db_query']('', '
      SELECT me.id_member, me.real_name, COUNT(*) as count_posts
      FROM {db_prefix}messages AS m LEFT JOIN {db_prefix}members AS me ON (me.id_member = m.id_member)
      WHERE m.poster_time > {int:start_time}
         AND m.id_member != 0
      GROUP BY me.id_member
      ORDER BY count_posts DESC
      LIMIT 5',
      array(
         'start_time' => $starttime,
      )
   );
   
   $context['top_posters_month'] = array();
   $max_num_posts = 1;
   while ($row_members = $smcFunc['db_fetch_assoc']($request))
   {
      $context['top_posters_month'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['count_posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );

      if ($max_num_posts < $row_members['count_posts'])
         $max_num_posts = $row_members['count_posts'];
   }
   $smcFunc['db_free_result']($request);

   foreach ($context['top_posters_month'] as $i => $j)
      $context['top_posters_month'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

   // Tidy up
   unset($max_num_posts, $row_members, $j, $i);

   echo '


<table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium">   <table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
     <img border="0" src="http://www.spinabifidaturkey.com/images/makale/gununen.gif" width="75" height="98"></td> <td style="border-style: none; border-width: medium">  <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_day'] as $poster)
      echo '
            <tr>
<td><img border="0" src="http://www.spinabifidaturkey.com/images/maviuser.png" width="16" height="16"> ', $poster['link'], '   </td>
<td align="center"><font color="#005bb7">[', $poster['num_posts'], ']</font></td>
            </tr>';
   echo '
         </table></td>
</tr>
</table></td>
<td style="border-style: none; border-width: medium">   <table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
<img border="0" src="http://www.spinabifidaturkey.com/images/makale/haftaninen.gif" width="75" height="98">
</td>
<td style="border-style: none; border-width: medium">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_week'] as $poster)
      echo '
            <tr>
              <td><img border="0" src="http://www.spinabifidaturkey.com/images/yesiluser.png" width="16" height="16"> ', $poster['link'], '     </td>
              <td align="center"><font color="#006600">[', $poster['num_posts'], ']</font></td>
            </tr>';
   echo '
         </table></td>
</tr>
</table>
</td>
<td style="border-style: none; border-width: medium"><table border="1" width="100%" style="border-collapse: collapse; border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium" width="100" align="right">
<img border="0" src="http://www.spinabifidaturkey.com/images/makale/ayinen.gif" width="75" height="98"> </td>
<td style="border-style: none; border-width: medium">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
';

   foreach ($context['top_posters_month'] as $poster)
      echo '
            <tr >
             <td> <img border="0" src="http://www.spinabifidaturkey.com/images/sariuser.png" width="16" height="16"> ', $poster['link'], '   </td>
             <td align="center"><font color="#9f6000"> [', $poster['num_posts'], '] </font></td>
            </tr>';
   echo '
         </table></td>
</tr>
</table></td>
</tr>
</table>';

« Son Düzenleme: 12 Kasım 2012, 02:22 Gönderen: bolubeyi »