search user started topics - 1.0.0

Eklenti geliştirme bölümü.

search user started topics - 1.0.0

İleti sabri ünal 29.10.2006, 15:43

Kod: Tümünü seç
###########################################
## Mod NAME: search user started topics
## Mod VERSION : [alfa] - 1.0.0
## Mod AUTHOR: yakusha < yakushaBB@yahoo.com > (sabri ünal) < http://www.canver.net | http://www.yakusha.net >
###########################################
## Mod DESC:
## Üyenin profiline mesaj sayısının yanında başlattığı başlık sayısının da bir istatistiğini ekler.
## Bu istatistik üstünden de "üye tarafından başlatılan tüm mesajları bul" diye yeni bir arama seçeneğini
## arama sayfasına ekler...
###########################################
## Installation Level: Medium
## Installation Time :  10 minutes
## Edited Files:  ()
## - lang_main.php, usercp_viewprofile.php, profile_view_body.tpl, search.php
## Included Files:  (0)
###########################################
## Faydalanılan Modlar
##
## MOD Title: Kullanıcı Menüsü
## MOD Author: ALEXIS < spam@canver.net > http://www.canver.net
## | search_id=egoreplies | özelliğinden faydalanılmıştır.
##
## MOD Title: Topiccount
## MOD Author: Leuchte < mail@leuchte.net > http://www.leuchte.net
## İstatistik bilgileri bu mod tarafından sağlanmaktadır
##
############################################
## Support and Help : http://www.canver.net - http://www.yakusha.net
## copyleft : Copyleft © - canver|net, yakusha|net
## Lisance : GNU Public License v2 http://opensource.org/licenses/gpl-license.php
############################################
## Security Varning:
##
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##
###########################################
## Author Notes:
## phpBB & Canver & Yakusha! All my Love :)
###########################################
##
## Mod History:
##
## 1.0.0 - 29-10-2006
##
############################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
############################################
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
$lang['User_post_pct_stats'] = '%.2f%% of total'; // 1.25% of total
$lang['User_post_day_stats'] = '%.2f posts per day'; // 1.5 posts per day

#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['Total_topics'] = 'Topics total';
$lang['User_topic_pct_stats'] = '%.2f%% of total topics';
$lang['User_topic_day_stats'] = '%.2f Topics per day';
$lang['Search_user_posts'] = 'Find all topics by %s';


//türkçesi
$lang['Total_topics'] = 'Başlık sayısı';
$lang['User_topic_pct_stats'] = 'Tüm başlıkların %.2f%%';
$lang['User_topic_day_stats'] = 'Ortalama hergün %.2f başlık';
$lang['Search_user_topics'] = '%s tarafından gönderilen tüm başlıkları bul';

#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php

#
#-----[ FIND ]------------------------------------------
#
$avatar_img = '';
if ( $profiledata['user_avatar_type'] && $profiledata['user_allowavatar'] )
{

#
#-----[ BEFORE, ADD ]------------------------------------------
#
   $sql = "SELECT COUNT(topic_id) AS topics
      FROM ". TOPICS_TABLE ."
      WHERE topic_poster = '". $profiledata['user_id'] ."'";
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, "Could not count topics", '', __LINE__, __FILE__, $sql);
   }
   $topics = $db->sql_fetchrow($result);
   $poster_topics = ( $topics['topics'] == 0 ) ? $lang['None'] : $topics['topics'];
      
    $topics_per_day = $topics['topics'] / $memberdays;
if ( $topics['topics'] != 0 )
{
    $total_topics = get_db_stat('topiccount');
    $topic_perc = ( $total_topics ) ? min(100, ($topics['topics'] / $total_topics) * 100) : 0;
}
else
{
    $topic_perc = 0;
}

#
#-----[ FIND ]------------------------------------------
#
   'SEARCH_IMG' => $search_img,
   'SEARCH' => $search,
   'PM_IMG' => $pm_img,

#
#-----[ BEFORE, ADD ]------------------------------------------
#
   'L_SEARCH_USER_TOPICS' => sprintf($lang['Search_user_topics'], $profiledata['username']),
   'U_SEARCH_USER_TOPICS' => append_sid("search.$phpEx?search_id=usertopics&amp;user_id=" . $profiledata['user_id']),

   'L_TOTAL_TOPICS' => $lang['Total_topics'],
   'TOPIC_PERC' => $topic_perc . '%',
   'TOPICS' => $poster_topics,
   'TOPICS_DAY_STATS' => sprintf($lang['User_topic_day_stats'], $topics_per_day),
   'TOPICS_PERCENT_STATS' => sprintf($lang['User_topic_pct_stats'], $topic_perc),

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_view_body.tpl

#
#-----[ FIND ]------------------------------------------
#
class="genmed">[{POST_PERCENT_STATS} / {POST_DAY_STATS}]</span> <br /><span class="genmed"><a href="{U_SEARCH_USER}" class="genmed">{L_SEARCH_USER_POSTS}</a></span></td>
         </tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#
         <tr>
            <td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_TOTAL_TOPICS}:&nbsp;</span></td>
            <td valign="top"><b><span class="gen">{TOPICS}</span></b><br /><span class="genmed">[{TOPICS_PERCENT_STATS} / {TOPICS_DAY_STATS}]</span><br /><span class="genmed"><a href="{U_SEARCH_USER_TOPICS}" class="genmed">{L_SEARCH_USER_TOPICS}</a></span></td>
         </tr>

#
#-----[ OPEN ]------------------------------------------
#

search.php

#
#-----[ BUL ]-------------------------------------------------------------------------
#

if ( isset($HTTP_POST_VARS['search_keywords']) || isset($HTTP_GET_VARS['search_keywords']) )
{
   $search_keywords = ( isset($HTTP_POST_VARS['search_keywords']) ) ? $HTTP_POST_VARS['search_keywords'] : $HTTP_GET_VARS['search_keywords'];
}
else
{
   $search_keywords = '';
}

#
#-----[ SONRASINA EKLE ]-------------------------------------------------------------------------
#

if ( isset($HTTP_POST_VARS['user_id']) || isset($HTTP_GET_VARS['user_id']))
{
   $user_id = ( isset($HTTP_POST_VARS['user_id'])) ? $HTTP_POST_VARS['user_id'] : $HTTP_GET_VARS['user_id'];
   $user_id = intval($user_id);
   if ($user_id < 2)
   {
      message_die(GENERAL_MESSAGE, $lang['No_search_match']);
        }
}
else
{
   $user_id = '';
}


#
#-----[ BUL ]-------------------------------------------------------------------------
#
   //
   // Cycle through options ...
   //
   if ( $search_id == 'newposts' || $search_id == 'egosearch' || $search_id == 'unanswered' || $search_keywords != '' || $search_author != '' )

#
#-----[ SATIRİÇİNDE BUL ]-------------------------------------------------------------
#
$search_id == 'unanswered'

#
#-----[ SATIRİÇİNDE, SONRASINA EKLE ]-------------------------------------------------
#

$search_id == 'usertopics' ||


#-----[ BUL ]-------------------------------------------------------------------------
#
      else
      {
         message_die(GENERAL_MESSAGE, $lang['No_search_match']);
      }

      //
      // Finish building query (for all combinations)
      // and run it ...
      //

#
#-----[ ÖNCESİNE EKLE ]---------------------------------------------------------------
#

      //---[+]search user topics--------------------------
      //belli bir üyenin başlıklarını ara
      else if ( $search_id == 'usertopics' )
      {
         if ( $auth_sql != '' )
         {
            $sql = "SELECT t.topic_id, f.forum_id
               FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
               WHERE t.forum_id = f.forum_id
                  AND t.topic_moved_id = 0
                  AND t.topic_poster = " . $user_id . "
                  AND $auth_sql";
         }
         else
         {
            $sql = "SELECT topic_id
               FROM " . TOPICS_TABLE . "
               WHERE topic_moved_id = 0
                  AND topic_poster = " . $user_id ;
         }
            
         if ( !($result = $db->sql_query($sql)) )
         {
            message_die(GENERAL_ERROR, 'Could not obtain user ids', '', __LINE__, __FILE__, $sql);
         }

         $search_ids = array();
         while( $row = $db->sql_fetchrow($result) )
         {
            $search_ids[] = $row['topic_id'];
         }
         $db->sql_freeresult($result);

         $total_match_count = count($search_ids);

         // Basic requirements
         $show_results = 'topics';
         $sort_by = 0;
         $sort_dir = 'DESC';
      }
      //---[+]search user topics--------------------------

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Mutluyum, biraz komedi takılıyorum! sakın kızmayın yakında geçer, sebebini ben de bilmiyorum! yeni bir aşk da bulmuş değilim!
Kullanıcı avatarı
sabri ünal
Üye
Üye
 
İleti: 1325
Kayıt: 27.10.2005, 15:49
Konum: İstanbul

Eklenti Geliştirme



Kimler çevrimiçi

Bu forumu görüntüleyenler: Kayıtlı kullanıcı yok ve 0 misafir

cron