Webmaster Genel Forumları kategorimiz yenilendi!
SMF 2.0 sürümleri için yeni modül/eklentiler sitemizde! İlgili kategorilere gözatabilirsiniz.
Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
Hoşgeldiniz Ziyaretçi. Lütfen giriş yapın veya kayıt olun
Tarih/Saat: 09 Şubat 2012, 14:13:18
Sayfa: [1] Yazdır
Gönderen Konu: Ajax Son Konular 2.x (manuel)  (Okunma sayısı 406 defa)
goKhaN-c3
Moderatör
*
İleti: 940
Teşekkür Sayısı: 63
Çevrimdışı Çevrimdışı
Cinsiyet: Bay
« : 08 Eylül 2010, 10:15:11 »

Modifikasyon Adı: AJAX Recent Topics
Yazar: live627
Güncel Sürüm: 1.1
Uyumluluk: 1.1.6, 1.1.11, 2.0 Beta 4, 2.0 RC3
Paket Halinde Kurulum İçin: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin


Yedek alarak başlayın...

./index.php'de
Bul:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
      'recent' => array('Recent.php', 'RecentPosts'),
Sonrasına Ekle:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
      'recenttopics' => array('Recent.php', 'RecentTopics'),

./Sources/Recent.php'de
Bul:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
?>
Öncesine Ekle:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
function RecentTopics()
{
   global $context, $modSettings, $scripturl, $txt;
   global $user_info, $modSettings, $smcFunc, $board;

   loadTemplate('Recent');
   $context['page_title'] = $txt['recent_topics'];
   $context['sub_template'] = isset($_REQUEST['xml']) ? 'recent_xml' : 'recent';
   
   $query_parameters = array();
   if (!empty($_REQUEST['c']) && empty($board))
   {
      $_REQUEST['c'] = explode(',', $_REQUEST['c']);
      foreach ($_REQUEST['c'] as $i => $c)
         $_REQUEST['c'][$i] = (int) $c;

      if (count($_REQUEST['c']) == 1)
      {
         $request = $smcFunc['db_query']('', '
            SELECT name
            FROM {db_prefix}categories
            WHERE id_cat = {int:id_cat}
            LIMIT 1',
            array(
               'id_cat' => $_REQUEST['c'][0],
            )
         );
         list ($name) = $smcFunc['db_fetch_row']($request);
         $smcFunc['db_free_result']($request);

         if (empty($name))
            fatal_lang_error('no_access', false);

         $context['linktree'][] = array(
            'url' => $scripturl . '#' . (int) $_REQUEST['c'],
            'name' => $name
         );
      }

      $request = $smcFunc['db_query']('', '
         SELECT b.id_board
         FROM {db_prefix}boards AS b
         WHERE b.id_cat IN ({array_int:category_list})
            AND {query_see_board}',
         array(
            'category_list' => $_REQUEST['c'],
         )
      );
      $boards = array();
      while ($row = $smcFunc['db_fetch_assoc']($request))
         $boards[] = $row['id_board'];
      $smcFunc['db_free_result']($request);

      if (empty($boards))
         fatal_lang_error('error_no_boards_selected');

      $query_this_board = 'b.id_board IN ({array_int:boards})';
      $query_parameters['boards'] = $boards;
   }
   elseif (!empty($_REQUEST['boards']))
   {
      $_REQUEST['boards'] = explode(',', $_REQUEST['boards']);
      foreach ($_REQUEST['boards'] as $i => $b)
         $_REQUEST['boards'][$i] = (int) $b;

      $request = $smcFunc['db_query']('', '
         SELECT b.id_board
         FROM {db_prefix}boards AS b
         WHERE b.id_board IN ({array_int:board_list})
            AND {query_see_board}
         LIMIT {int:limit}',
         array(
            'board_list' => $_REQUEST['boards'],
            'limit' => count($_REQUEST['boards']),
         )
      );
      $boards = array();
      while ($row = $smcFunc['db_fetch_assoc']($request))
         $boards[] = $row['id_board'];
      $smcFunc['db_free_result']($request);

      if (empty($boards))
         fatal_lang_error('error_no_boards_selected');

      $query_this_board = 'b.id_board IN ({array_int:boards})';
      $query_parameters['boards'] = $boards;
   }
   elseif (!empty($board))
   {
      $query_this_board = 'b.id_board = {int:board}';
      $query_parameters['board'] = $board;
   }
   else
   {
      $query_this_board = '{query_wanna_see_board}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
         AND b.id_board != {int:recycle_board}' : '');
      $query_parameters['recycle_board'] = $modSettings['recycle_board'];
   }

   $context['linktree'][] = array(
      'url' => $scripturl . '?action=' . $_REQUEST['action'],
      'name' => $txt['recent_topics'],
   );
     
   $latest_post = !empty($_REQUEST['latest']) ? 'AND m.poster_time > {int:latest}' : '';
   if (!empty($latest_post))
      $query_parameters['latest'] = (int) $_REQUEST['latest'];
   
   $min_msg_id = $modSettings['maxMsgID'] - (int) (($modSettings['totalMessages'] / $modSettings['totalTopics']) * $modSettings['number_recent_topics']);
   
   $context['topics'] = array();
   $request = $smcFunc['db_query']('', '
      SELECT
         ms.poster_time as firstTime, m.poster_time as lastTime, ms.subject, m.id_topic, t.num_replies,
         ms.id_member as id_first_poster, m.id_member as id_last_poster, m.id_msg, b.id_board, b.name AS bName,
         IFNULL(mem2.real_name, ms.poster_name) AS firstPoster,
         IFNULL(mem.real_name, m.poster_name) AS lastPoster
      FROM {db_prefix}topics AS t
         INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_last_msg)
         INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
         INNER JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
         LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
         LEFT JOIN {db_prefix}members AS mem2 ON (mem2.id_member = t.id_member_started)
      WHERE t.id_last_msg >= {int:min_msg_id}
         AND ' . $query_this_board  . ($modSettings['postmod_active'] ? '
         AND t.approved = {int:is_approved}
         AND m.approved = {int:is_approved}' : '') . '
         ' . $latest_post . '
      ORDER BY t.id_last_msg DESC
      LIMIT {int:limit}',
      array_merge($query_parameters, array(
         'min_msg_id' => $min_msg_id,
         'is_approved' => 1,
         'limit' =>  $modSettings['number_recent_topics'],
      ))
   );

   while ($row = $smcFunc['db_fetch_assoc']($request))
   {
      $context['topics'][] = array(
         'id' => $row['id_topic'],
         'subject' => $row['subject'],
         'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
         'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['subject'] . '</a>',
         'replies' => $row['num_replies'],
         'board' => array(
            'id' => $row['id_board'],
            'name' => $row['bName'],
            'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
            'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['bName'] . '</a>'
         ),
         'firstPoster' => array(
            'id' => $row['id_first_poster'],
            'name' => $row['firstPoster'],
            'time' => (time() - $row['firstTime'] < 3600) ? round((time() - $row['firstTime'])/60, 0) . $txt['minutes_ago'] : timeformat($row['firstTime']),
            'href' => $scripturl . '?action=profile;u=' . $row['id_first_poster'],
            'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_first_poster'] . '">' . $row['firstPoster'] . '</a>'
         ),
         'lastPoster' => array(
            'id' => $row['id_last_poster'],
            'name' => $row['lastPoster'],
            'time' => (time() - $row['lastTime'] < 3600) ? round((time() - $row['lastTime'])/60, 0) . $txt['minutes_ago'] : timeformat($row['lastTime']),
            'href' => $scripturl . '?action=profile;u=' . $row['id_last_poster'],
            'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_last_poster'] . '">' . $row['lastPoster'] . '</a>'
         ),
         'lastPost' => array(
            'time' => $row['lastTime'],
            'href' => $scripturl . '?topic=' . $row['id_topic'] . '.new;topicseen#new',
            'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.new;topicseen#new">' . $row['subject'] . '</a>'
         ),
      );
   }
   $smcFunc['db_free_result']($request);
   if (!empty($context['topics']))
      $context['last_post_time'] = $context['topics'][0]['lastPost']['time'];
   
   // If we have an XML request for latests posts, we need to reverse the array
   if (!empty($latest_post))
      $context['topics'] = array_reverse($context['topics']);
}



./Sources/Subs.php'de
Bul:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
         'mlist' => array(
            'title' => $txt['members_title'],

Öncesine Ekle:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
         'recenttopics' => array(
            'title' => $txt['recent_topics'],
            'href' => $scripturl . '?action=recenttopics',
            'show' => true,
            'sub_buttons' => array(
            ),
         ),


./Themes/default/languages/Modifications.english.php'de
Bul:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
?>
Öncesine Ekle:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
// AJAX Recent Topics
$txt['recent_topics'] = 'Recent Topics';
$txt['minutes_ago'] = ' minutes ago';
$txt['number_recent_topics_interval'] = 'Time delay (in seconds) between checking for updated topics';
$txt['number_recent_topics_interval_desc'] = 'Not too low, a 5-10 second delay is reasonable';
$txt['number_recent_topics'] = 'Topics to display on Recent Topic page';


./Themes/default/languages/Modifications.turkish.php'de

Bul:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
?>
Öncesine Ekle:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
// AJAX Recent Topics
$txt['recent_topics'] = 'Son Konular';
$txt['minutes_ago'] = ' dakika önce';
$txt['number_recent_topics_interval'] = 'Yenilenme Süresi';
$txt['number_recent_topics_interval_desc'] = '5-10 saniye ideal bir değerdir';
$txt['number_recent_topics'] = 'Son konularda gözükecek konu sayısı';


./Themes/default/Recent.template.php'de
Bul:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
?>
Öncesine Ekle:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
function template_recent()
{
   global $context, $txt, $modSettings, $scripturl, $settings;

   $alt = false;
   echo '
   <table width="100%" border="0" cellspacing="0" cellpadding="3">
      <tr>
         <td>', theme_linktree(), '</td>
      </tr>
   </table>';

   echo '
      <div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;"' : '', '>
         <table border="0" width="100%" cellspacing="0" cellpadding="4" class="t" id="topicTable">
            <tr class="catbg">';

   // Are there actually any topics to show?
   echo '
               <td width="15%" class="catbg3"><strong>', $txt['board'], '</strong></td>
               <td class="catbg3"><strong>', $txt['topic'], '</strong></td>
               <td width="50" class="catbg3" align="center"><strong>', $txt['replies'], '</strong></td>
               <td width="150" class="catbg3" align="center"><strong>', $txt['started_by'], '</strong></td>
               <td width="150" class="catbg3" align="center"><strong>', $txt['last_post'], '</strong></td>
               <td width="16" class="catbg3"></td>
            </tr>';

   // No topics.... just say, "sorry bub".
   if (empty($context['topics']))
      echo '
            <tr id="no_topics">
               <td class="windowbg2" width="100%" colspan="6"><strong>', $txt[151], '</strong></td>';

   else
      foreach ($context['topics'] as $topic)
      {
         echo '
            <tr class="windowbg', ($alt ? '2' : ''), '" id="topic_', $topic['id'], '">
               <td class="smalltext" style="padding-left: 10px; border-bottom: 1px solid rgb(204, 204, 204);">', $topic['board']['link'], '</td>
               <td style="padding-left: 10px; border-bottom: 1px solid rgb(204, 204, 204);">', $topic['link'], '</td>
               <td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['replies'], '</td>
               <td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['firstPoster']['link'], '<br />', $topic['firstPoster']['time'], '</td>
               <td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['lastPoster']['link'], '<br />', $topic['lastPoster']['time'], '</td>
               <td align="center" style="border-bottom: 1px solid rgb(204, 204, 204);"><a href="', $topic['lastPost']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" /></a></td>
            </tr>';
      $alt = !$alt;
      }
   
   echo '
         </table>
      </div>';
   
   // Now for all of the javascript stuff
   echo '
      <script language="Javascript" type="text/javascript"><!-- // -->
         var last_post = ', (!empty($context['last_post_time']) ? $context['last_post_time'] : 0), ';
         var time_interval = ', $modSettings['number_recent_topics_interval'] * 1000, ';
         var max_topics = ', $modSettings['number_recent_topics'], ';
         
         var interval_id = setInterval( "getTopics()", time_interval);

         function getTopics()
         {
            if (window.XMLHttpRequest)
               getXMLDocument("', $scripturl, '?action=recenttopics;latest=" + last_post + ";xml", gotTopics);
            else
               clearInterval(interval_id);
         }
         
         function gotTopics(XMLDoc)
         {
            var updated_time = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("lastTime")[0];
            var topics = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic");
            var topic, id_topic, board, subject, replies, firstPost, lastPost, link;
            var myTable = document.getElementById("topicTable"), oldRow, myRow, myCell, myData, rowCount;
           
            // If this exists, we have at least one updated/new topic
            if (updated_time)
            {
               // Update the last post time
               last_post = updated_time.childNodes[0].nodeValue;
               
               // No Messages message?  Ditch it!
               // Note, this should only happen if there are literally zero topics
               // on the board when a user visits this page.
               if (document.getElementById("no_topics") != null)
                  myTable.deleteRow(-1);
               
               // If the topic is already in the list, remove it
               for (var i = 0; i < topics.length; i++)
               {
                  topic = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic")[i];
                  id_topic = topic.getElementsByTagName("id")[0].childNodes[0].nodeValue;
                  if ((oldRow = document.getElementById("topic_" + id_topic)) != null)
                     myTable.deleteRow(oldRow.rowIndex);
               }
               
               // Are we going to exceed the maximum topic count allowed?
               while (((myTable.rows.length - 1 + topics.length) - max_topics) > 0)
                  myTable.deleteRow(-1);
               
               // Now start the insertion
               for (var i = 0; i < topics.length; i++)
               {
                  // Lets get all of our data
                  topic = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic")[i];
                  id_topic = topic.getElementsByTagName("id")[0].childNodes[0].nodeValue;
                  board = topic.getElementsByTagName("board")[0].childNodes[0].nodeValue;
                  subject = topic.getElementsByTagName("subject")[0].childNodes[0].nodeValue;
                  replies = topic.getElementsByTagName("replies")[0].childNodes[0].nodeValue;
                  firstPost = topic.getElementsByTagName("first")[0].childNodes[0].nodeValue;
                  lastPost = topic.getElementsByTagName("last")[0].childNodes[0].nodeValue;
                  link = topic.getElementsByTagName("lastLink")[0].childNodes[0].nodeValue;
                 
                  // Now to create the new row...
                  myRow = myTable.insertRow(1);
                  myRow.id = "topic_" + id_topic;
                  myRow.className = "windowbg";
                 
                  // First the Board
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.style.paddingLeft = "10px";
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, board);
                 
                  // Then subject
                  myCell = myRow.insertCell(-1);
                  myCell.style.paddingLeft = "10px";
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, subject);
                 
                  // replies
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, replies);
                 
                  // first post
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, firstPost);
                 
                  // last post
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, lastPost);
                 
                  // last post
                  myCell = myRow.insertCell(-1);
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, link);
               }

               correctAltBG(myTable, "tr");
            }
         }

         function correctAltBG(oElement, sChild)
         {
            element = oElement.getElementsByTagName(sChild);
            var i = element.length;
            while (i--)
            {
               if (element[i].id.indexOf("topic_") > -1)
                  if (i % 2 == 0)
                     element[i].className = "windowbg2";
                  else
                     element[i].className = "windowbg";
            }
         }
      // ]]></script>';
}

function template_recent_xml()
{
   global $context, $modSettings, $settings, $txt;
   
   echo '<?xml version="1.0" encoding="', $context['character_set'], '"?>
<smf>';
   
   if (!empty($context['topics']))
      echo '
   <lastTime><!', '[CDATA[', $context['last_post_time'], ']', ']></lastTime>';
   
   foreach ($context['topics'] as $topic)
      echo '
   <topic>
      <id><!', '[CDATA[', $topic['id'], ']', ']></id>
      <board><!', '[CDATA[', str_replace(']'.']>', ']]]'.']><!'.'[CDATA[>', $topic['board']['link']), ']', ']></board>
      <subject><!', '[CDATA[', str_replace(']'.']>', ']]]'.']><!'.'[CDATA[>', $topic['link']), ']', ']></subject>
      <replies><!', '[CDATA[', $topic['replies'], ']', ']></replies>
      <first><!', '[CDATA[', str_replace(']'.']>', ']]]'.']><!'.'[CDATA[>', $topic['firstPoster']['link'] . '<br />' . $topic['firstPoster']['time']), ']', ']></first>
      <last><!', '[CDATA[', str_replace(']'.']>', ']]]'.']><!'.'[CDATA[>', $topic['lastPoster']['link'] . '<br />' . $topic['lastPoster']['time']), ']', ']></last>
      <lastLink><!', '[CDATA[<a href="', $topic['lastPost']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" /></a>]', ']></lastLink>
   </topic>';
   
   echo '
</smf>';
}



./Sources/Admin.php'de
Bul:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
                  // Note the comma!! The setting with automatically appear with the first mod to be added.
Sonrasına Ekle:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
                  'recenttopics' => array($txt['recent_topics']),
Bul:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
      // Mod authors if you want to be "real freaking good" then add any setting pages for your mod BELOW this line!
Sonrasına Ekle:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
      array('ModifyRecentTopics', 'area=modsettings;sa=recenttopics'),

./Sources/ManageSettings.php'de
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
      // Mod authors, once again, if you have a whole section to add do it AFTER this line, and keep a comma at the end.
Sonrasına Ekle:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
      'recenttopics' => 'ModifyRecentTopics',
Bul:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
?>
Öncesine Ekle:
Kod: Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
// Modify AJAX Recent Topics
function ModifyRecentTopics($return_config = false)
{
   global $txt, $scripturl, $context, $modSettings, $sc, $modSettings;

   $config_vars = array(
      array('int', 'number_recent_topics'),
      array('int', 'number_recent_topics_interval', 3, 'subtext' => $txt['number_recent_topics_interval_desc']),
   );

   if ($return_config)
      return $config_vars;

   $context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=recenttopics';
   $context['settings_title'] = $txt['recent_topics'];

   if (isset($_GET['save']))
   {
      checkSession();
      saveDBSettings($config_vars);
      redirectexit('action=admin;area=modsettings;sa=recenttopics');
   }

   prepareDBSettingContext($config_vars);
}


Son olarak ekdeki install dosyasını ftp'den forum klasörüne atarak br kez çalıştırmalısınız.
« Son Düzenleme: 08 Eylül 2010, 10:23:27 Gönderen: goKhaN-c3 » Kayıtlı

SimpleTurk - Türkiye'nin Lider SMF Destek Portalı!
Yönetim Ekibi - Genel Sorumlu
Web Siteler - Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin | Linkleri goruntulemenize izin verilmiyor. Kayit olun veya Giris yapin
Sayfa: [1] Yazdır 
Etiketler: