MANUEL ANLATIM - TÜRKÇESİ ÇEVİRİSİ İLE (Yedek Almayı Unutmayınız)
./index.php
Bul
// Load the current user's permissions.
loadPermissions();
Sonrasına Ekle
// Start of Limit A Guests Daily PageViews Mod
// Extra globals we need access to (if not already got access)
global $txt, $context, $func;
// Sanitize - cast as integer / prevent undefined index - especially after initial install of mod
$modSettings['limited_views'] = !empty($modSettings['limited_views']) ? (int) $modSettings['limited_views'] : 0 ;
// Only if guest access is enabled, and a limit is set, AND the user is a guest
if(!empty($modSettings['allow_guestAccess']) && !empty($modSettings['limited_views']) && $context['user']['is_guest'])
{
if(!isset($_SESSION['limited_views']))
// Setup the array
$_SESSION['limited_views'] = array(
'views' => 1,
'last_view' => time()
);
// Have viewed pages before
else
{
// Sanitize - cast as integers
$_SESSION['limited_views']['views'] = ((int) $_SESSION['limited_views']['views']) + 1;
$_SESSION['limited_views']['last_view'] = (int) $_SESSION['limited_views']['last_view'];
// Last view yesterday (done on forum time)
$date = date('dm',forum_time(null, $_SESSION['limited_views']['last_view']));
// Update the session info. If new day set views to 1, else increase by 1.
// Don't increase if already exceeds the limit (prevents views from getting out of control eg bots/spiders)
$_SESSION['limited_views']['views'] = ($date != date('dm')) ? 1 : ($_SESSION['limited_views']['views'] > $modSettings['limited_views'] ? $modSettings['limited_views'] + 1 : $_SESSION['limited_views']['views']);
// Set the latest view to now, unless we've reached the limit - we will keep this timestamp until tomorrow.
$_SESSION['limited_views']['last_view'] = $_SESSION['limited_views']['views'] > $modSettings['limited_views'] ? $_SESSION['limited_views']['last_view'] : time();
// Tidy up
unset($date);
// Don't be stupid - If they've reached the limit, we must allow them the guest actions of register/login
// Also, note you can add other actions (must be on the action array) here to exempt
$temp = array('login[/swf2][swf3]login2[/swf2][swf3]register[/swf2][swf3]register2[/swf2][swf3]reminder[/swf2][swf3]activate[/swf2][swf3]smstats[/swf2][swf3]help[/swf2][swf3].xml[/swf2][swf3]verificationcode');
if (empty($_REQUEST['action']) || !in_array(strtolower($_REQUEST['action']), $temp))
{
// Fatal error, must register as exceeded no. of page views
if($_SESSION['limited_views']['views'] > $modSettings['limited_views'])
{
// Mr Search Engine, don't index this page (its just an error message)
$context['robot_no_index'] = true;
// Switcharoo on smf language string to set the page title for header and <title> for browser
// Make html safe so doesn't break the forum.
$context['page_title'] = $txt['106'] = strtr($func['htmlspecialchars']($txt['limited_views_title']), array("\r" => '', "\n" => '', "\t" => ''));
fatal_lang_error('limited_views_message', false, array($modSettings['limited_views']));
}
}
// Tidy up
unset($temp);
}
// Now build javascript message (javascript to try to keep the information title out of the search engine)
// Keep on new line (as there maybe extra headers above/below)
// Tabbed out of sync to keep inline with html output
$context['html_headers'] .= '
<script language="JavaScript" type="text/javascript"><!-- // -->'.
chr(60) . chr(33) . chr(91) . chr(67) . chr(68) . chr(65) . chr(84) . chr(65) . chr(91).'
document.title = document.title + \''.$context['limited_views_remaining'].'\';
// '.chr(93) . chr(93) . chr(62).'</script>
';
}
}
}
// Either a user and/or guest access is disabled or no limit is set, in which case
else
{
// If a session variable for this exists, its no longer needed.
if(isset($_SESSION['limited_views']))
unset($_SESSION['limited_views']);
}
Öncesine Ekle
$helptxt['limited_views'] = 'Limit the no. of page views that guests can view. Warning, spiders/bots WILL be limited by this. <br /><br />(As excluding them would be seen as Black Hat and likely to violate Google & other search engines Terms of Service).';
Öncesine Ekle
$helptxt['limited_views'] = 'Limit the no. of page views that guests can view. Warning, spiders/bots WILL be limited by this. <br /><br />(As excluding them would be seen as Black Hat and likely to violate Google & other search engines Terms of Service).';
Öncesine Ekle
$txt['limited_views_remaining_singular'] = ' page view remaining today';
$txt['limited_views_remaining_plural'] = ' page views remaining today';
$txt['limited_views'] = 'Limit guests to x page views per day<div class="smalltext">0 to disable</div>';
$txt['limited_views_message'] = 'All guests are limited to %s page views per day.<br /> We now invite you to <a href="' . $scripturl . '?action=login">login</a> or <a href="' . $scripturl . '?action=register">register</a> to continue accessing the forum.';
$txt['limited_views_title'] = 'Please Login or Register';
Öncesine Ekle
$txt['limited_views_remaining_singular'] = ' page view remaining today';
$txt['limited_views_remaining_plural'] = ' page views remaining today';
$txt['limited_views'] = 'Limit guests to x page views per day<div class="smalltext">0 to disable</div>';
$txt['limited_views_message'] = 'All guests are limited to %s page views per day.<br /> We now invite you to <a href="' . $scripturl . '?action=login">login</a> or <a href="' . $scripturl . '?action=register">register</a> to continue accessing the forum.';
$txt['limited_views_title'] = 'Please Login or Register';