SMF Ziyaretçilere Günlük Sayfa Gösterimi Limiti (paket+manuel+türkçeleştirildi)

Son güncelleme: 21.09.2010 18:29
  • Orjinal Konu: http://custom.simplemachines.org/mods/index.php?mod=1290
    Name: Limit A Guests Daily PageViews Mod
    Yapımcı: karlbenson
    Manuel: Var
    Uyumlu Sürüm: 1.1.5
    Türkçe: Var / By Tattoocu_Cartel

    Demo Görünüm
    http://custom.simplemachines.org/mods/index.php?action=download;mod=1290;id=60730;image
    http://custom.simplemachines.org/mods/index.php?action=download;mod=1290;id=60732;image



    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);
    }

    // Prepare and make html safe the remaining string
    if(!empty($modSettings['limited_views']) && !empty($_SESSION['limited_views']['views']))
    {
    $context['limited_views_remaining'] = strtr(' - '.
    $func['htmlspecialchars'](
    ($_SESSION['limited_views']['views'] > $modSettings['limited_views'] ? 0 :
    ($modSettings['limited_views'] - $_SESSION['limited_views']['views'])
    ).
    $txt['limited_views_remaining_'.
    ($modSettings['limited_views'] - $_SESSION['limited_views']['views'] == 1 ? 'singular' : 'plural')
    ]
    ),
    array(
    "\r" => '',
    "\n" => '',
    "\t" => ''
    )
    );
    if($modSettings['limited_views'] - $_SESSION['limited_views']['views'] >= 0)
    {
    // Avoid undefined error
    $context['html_headers'] = !empty($context['html_headers']) ? '' : $context['html_headers'];

    // 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']);
    }

    // End of Limit A Guests Daily PageViews Mod







    ./Sources/ModSettings.php
    Bul
    array('check[/swf2][swf3]allow_guestAccess'),

    Sonrasına Ekle
    array('int[/swf2][swf3]limited_views'),





    ./Themes/default/languages/Help.english.php
    Bul
    ?>

    Ö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).';






    ./Themes/default/languages/Help.english-uft8.php
    Bul
    ?>

    Ö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).';






    ./Themes/default/languages/Modifications.english.php
    Bul
    ?>

    Ö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';






    ./Themes/default/languages/Modifications.english-uft8.php
    Bul
    ?>

    Ö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';







    ./Themes/default/languages/Modifications.turkish.php
    Bul
    ?>

    Öncesine Ekle
    $txt['limited_views_remaining_singular'] = ' bugun kalan sayfa gosterimi';
    $txt['limited_views_remaining_plural'] = ' bugun kalan sayfa gosterimleri';
    $txt['limited_views'] = 'Gun basina ziyaretcilere x sayfa gosterimleri limiti<div class="smalltext">0 to disable</div>';
    $txt['limited_views_message'] = 'Butun ziyaretciler gun basina %s sayfa gosterimiyle limitlendi.<br /> Simdi Seni Davet Ediyoruz <a href="' . $scripturl . '?action=login">giris</a> or <a href="' . $scripturl . '?action=register">kayit</a> forumdan faydalanmak icin devam et.';
    $txt['limited_views_title'] = 'Lutfen Giris Yapin ya da Uye Degilseniz Kayit Olun';






    ./Themes/default/languages/Modifications.turkish-uft8.php
    Bul
    ?>

    Öncesine Ekle
    $txt['limited_views_remaining_singular'] = ' bugun kalan sayfa gosterimi';
    $txt['limited_views_remaining_plural'] = ' bugun kalan sayfa gosterimleri';
    $txt['limited_views'] = 'Gun basina ziyaretcilere x sayfa gosterimleri limiti<div class="smalltext">0 to disable</div>';
    $txt['limited_views_message'] = 'Butun ziyaretciler gun basina %s sayfa gosterimiyle limitlendi.<br /> Simdi Seni Davet Ediyoruz <a href="' . $scripturl . '?action=login">giris</a> or <a href="' . $scripturl . '?action=register">kayit</a> forumdan faydalanmak icin devam et.';
    $txt['limited_views_title'] = 'Lutfen Giris Yapin ya da Uye Degilseniz Kayit Olun';



    Admin Paneli >> Forum Seçenekleri >>Gun basina ziyaretcilere x sayfa gosterimleri limiti (bu seçeneğe istediğiniz rakamı yazabilirsiniz. sayfa bakma limitini belirler.

    Not: Orjinal Sitesinden Alıntıdır.
#07.08.2008 03:53 0 0 0
  • bakalım
#21.09.2010 18:29 0 0 0