SimplePortal

Support => Turkish (Türkçe) => International Support => Ki?iselle?tirme => Topic started by: ismail9 on April 07, 2011, 11:08:34 AM

Title: Who.php
Post by: ismail9 on April 07, 2011, 11:08:34 AM
Selam smf nin Who.php dosyasini PHP Block olarak anasayfada göstermek istiyorum, Kim nereye bakiyor Önsayfada göstermek istiyorum.
Title: Re: Who.php
Post by: grafitus on April 07, 2011, 11:37:19 AM
Yeni bir PHP bloku oluşturup içeriğine şu kodları girin:
Code: [Select]
global $context, $scripturl, $user_info, $txt, $modSettings, $memberContext, $smcFunc, $sourcedir;

if (empty($modSettings['who_enabled']))
fatal_lang_error('who_off', false);

loadLanguage('Who');

if (!allowedTo('moderate_forum'))
$conditions[] = '(IFNULL(mem.show_online, 1) = 1)';

$request = $smcFunc['db_query']('', '
SELECT
lo.log_time, lo.id_member, lo.url, mem.real_name,
lo.session, mg.online_color, IFNULL(mem.show_online, 1) AS show_online,
lo.id_spider
FROM {db_prefix}log_online AS lo
LEFT JOIN {db_prefix}members AS mem ON (lo.id_member = mem.id_member)
LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN mem.id_group = {int:regular_member} THEN mem.id_post_group ELSE mem.id_group END)' . (!empty($conditions) ? '
WHERE ' . implode(' AND ', $conditions) : '') . '
LIMIT {int:limit}',
array(
'regular_member' => 0,
'limit' => $modSettings['defaultMaxMembers'],
)
);
$context['members'] = array();
$member_ids = array();
$url_data = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$actions = @unserialize($row['url']);
if ($actions === false)
continue;

$context['members'][$row['session']] = array(
'id' => $row['id_member'],
'time' => strtr(timeformat($row['log_time']), array($txt['today'] => '', $txt['yesterday'] => '')),
'timestamp' => forum_time(true, $row['log_time']),
'query' => $actions,
'is_hidden' => $row['show_online'] == 0,
'id_spider' => $row['id_spider'],
'color' => empty($row['online_color']) ? '' : $row['online_color']
);

$url_data[$row['session']] = array($row['url'], $row['id_member']);
$member_ids[] = $row['id_member'];
}
$smcFunc['db_free_result']($request);

loadMemberData($member_ids);

$memberContext[0] = array(
'id' => 0,
'name' => $txt['guest_title'],
'group' => $txt['guest_title'],
'href' => '',
'link' => $txt['guest_title'],
'email' => $txt['guest_title'],
'is_guest' => true
);
$spiderContext = array();
if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] == 2 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache']))
{
foreach (unserialize($modSettings['spider_name_cache']) as $id => $name)
$spiderContext[$id] = array(
'id' => 0,
'name' => $name,
'group' => $txt['spiders'],
'href' => '',
'link' => $name,
'email' => $name,
'is_guest' => true
);
}

require_once($sourcedir . '/Who.php');
$url_data = determineActions($url_data);

foreach ($context['members'] as $i => $member)
{
if ($member['id'] != 0)
$member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0;

$memberContext[$member['id']]['ip'] = $member['ip'];
$context['members'][$i]['action'] = isset($url_data[$i]) ? $url_data[$i] : $txt['who_hidden'];
if ($member['id'] == 0 && isset($spiderContext[$member['id_spider']]))
$context['members'][$i] += $spiderContext[$member['id_spider']];
else
$context['members'][$i] += $memberContext[$member['id']];
}

echo '
<table class="table_grid" cellspacing="0">
<thead>
<tr class="catbg">
<th scope="col" class="lefttext first_th" width="40%">', $txt['who_user'], '</a></th>
<th scope="col" class="lefttext" width="10%">', $txt['who_time'], '</a></th>
<th scope="col" class="lefttext last_th" width="50%">', $txt['who_action'], '</th>
</tr>
</thead>
<tbody>';

$alternate = 0;

foreach ($context['members'] as $member)
{
echo '
<tr class="windowbg', $alternate ? '2' : '', '">
<td>
<span class="member', $member['is_hidden'] ? ' hidden' : '', '">
', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt['profile_of'] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', '
</span>
</td>
<td nowrap="nowrap">', $member['time'], '</td>
<td>', $member['action'], '</td>
</tr>';

$alternate = !$alternate;
}

if (empty($context['members']))
{
echo '
<tr class="windowbg2">
<td colspan="3" align="center">
', $txt['who_no_online_' . ($context['show_by'] == 'guests' || $context['show_by'] == 'spiders' ? $context['show_by'] : 'members')], '
</td>
</tr>';
}
echo '
</tbody>
</table>';
Title: Re: Who.php
Post by: ismail9 on April 07, 2011, 11:57:10 AM
Süper oldu eline saglik, birde bu Modu yüklesem calisirmi bu MOD ön sayfada

Auto Refresh Who Online (action=who)

http://custom.simplemachines.org/mods/index.php?mod=2369

veya su kodu eklesem olurmu :  <meta http-equiv="refresh" content="5" />
Title: Re: Who.php
Post by: ismail9 on April 07, 2011, 12:17:13 PM
bu kodu ekledigimde komple anasayfa yenileniyor  <meta http-equiv="refresh" content="5" />
amacim tek o Blockun yenilenmesi
Title: Re: Who.php
Post by: grafitus on April 07, 2011, 12:19:14 PM
Kodlara AJAX eklemek gerek. Ama bu henüz o sayfa için bile yapılmadı. ;)
Title: Re: Who.php
Post by: ismail9 on April 07, 2011, 12:30:27 PM
Ajax recent Post  diye Mod var burda http://custom.simplemachines.org/mods/index.php?mod=1284
bu modu degisdirip Who.php uygulaya bilirmiyiz.

burdada galiba ajax jquery kullaniliyor.

bu modu yükledim ayri bir sayfa aciyor üst tarafta Forum menüsü alt tarafta Recen Post ( son konular)
ve forumda yeni bir konu acilinca komple sayfa kendisini yenilemiyor sadece son konular bölümü :)

Title: Re: Who.php
Post by: ismail9 on April 07, 2011, 12:40:23 PM
aklima birsey gelmis bunuda yazayim, senin verdigin kodu kimnerede.php dosyasina eklesem ve Blockun icine jquery Codu eklesem bu dosyayi calisdirsam olurmu :)
Title: Re: Who.php
Post by: grafitus on April 07, 2011, 01:05:37 PM
Hayır. :nervous-happy: Birçok yerinde değişiklik gerektirir.
Title: Re: Who.php
Post by: ismail9 on April 07, 2011, 04:06:22 PM
grafitus, Koda LIMIT koymayin unuttun galiba, 500 kisi Online ziyaretcilerle beraber hepsini Anasayfada gösteriyor, buna limit koymak lazim :)
Title: Re: Who.php
Post by: grafitus on April 07, 2011, 04:24:04 PM
Hehe. Yukarıda verdiğim kodu düzenledim.
Title: Re: Who.php
Post by: ismail9 on April 07, 2011, 04:50:04 PM
bir ufacik birsey daha, bu Limiti forumundaki Limiti kullanmasin , kendim belirlesem daha iyi olur.
Forumda 1 sayfada 50 kisi gösterme ayarladim, Ön panelde ise 15 kisi yapmak istiyorum :)
Title: Re: Who.php
Post by: ismail9 on April 07, 2011, 05:03:06 PM
tamam Limiti böyle yaptim
'limit' => $modSettings['defaultMaxMembers'],

'limit' => 10,


tesekürler grafitus, belki bu baskalrin isinede yarar
Title: Re: Who.php
Post by: ismail9 on April 08, 2011, 01:01:24 PM
grafitus senin verdiğin Kodda bir tuhaflık var, önce hep ziyaretciler gözüküyor sonra üyeler, tabiki zamanları da tersine gösteriyor, altaki resime bakarsan zamanlar bir eski , bir yeni , yani karışık.
Bunun Smf deki gibi olması gerekmezmi.
SimplePortal 2.3.8 © 2008-2024, SimplePortal