Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-01-01 17:53:16

rayben
Member
From: Cologne, Germany
Registered: 2004-10-20
Posts: 31

Block rss link in shortstat

Does anyone know ?!?

Thx ahead

Offline

#2 2006-01-01 20:10:26

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,421
Website GitHub Mastodon

Re: Block rss link in shortstat

I assume you currently integrate ShortStat by adding this line to index.php at the root level of your Textpattern installation:

bc.. @include_once($_SERVER[“DOCUMENT_ROOT”].”/shorttat/inc.stats.php”);

You will have to inhibit the logging of all requests which are RSS-related. This may be either /rss, /atom in clean URL mode, or ?rss=1 and ?atom=1 in messy URL mode. Just choose which one you would want to block.

Modify this line to contain a conditional statement which performs logging based on the request URI or string:

if (  !in_array ($_SERVER["REQUEST_URI"], array('/rss', '/atom'))  && 
      !in_array ($_SERVER["QUERY_STRING"], array('rss=1', 'atom=1'))  ) {
	@include_once( $_SERVER["DOCUMENT_ROOT"]."/shortstat/inc.stats.php" ); 
}

array('/rss', '/atom') and array('rss=1', 'atom=1')) contain the URLs and query strings, respectively, which will not be logged. You can easily extend these arrays by adding any other unwanted URL.

Alternatively, you could use wet_slimpattern and modify this plugin according to the instructions above. I’d recommend upgrading to SlimStat because of database performance reasons anyway.

Last edited by wet (2006-01-04 18:52:16)

Offline

#3 2006-01-02 16:20:45

KLS
Member
From: Singapore
Registered: 2005-12-26
Posts: 35
Website

Re: Block rss link in shortstat

On a related note, can’t i paste @include_once($_SERVER[“DOCUMENT_ROOT”].”/shorttat/inc.stats.php”); into the Presentation > Pages (default) ? Can shortstat read all the inner pages of my journal? Thanks in advance.

Offline

#4 2006-01-03 06:14:16

KLS
Member
From: Singapore
Registered: 2005-12-26
Posts: 35
Website

Re: Block rss link in shortstat

Wet, when you say paste this

if ( !in_array ($_SERVER[“REQUEST_URI”], array(‘/rss’, ‘/atom’)) && !in_array ($_SERVER[“QUERY_STRING”], array(‘rss=1’, ‘atom=1’)) ) { @include_once( $_SERVER[“DOCUMENT_ROOT”].”/shortstat/inc.stats.php” );
}

into index.php, is it the one located in /textpattern root or in my root folder before it?

Offline

#5 2006-01-03 06:19:54

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,421
Website GitHub Mastodon

Re: Block rss link in shortstat

It is meant to be pasted into index.php at the root level or your site just below the line which reads textpattern(); and above the trailing ?>

//w&

Offline

#6 2006-01-03 06:28:48

KLS
Member
From: Singapore
Registered: 2005-12-26
Posts: 35
Website

Re: Block rss link in shortstat

Thanks Wet, btw, kinda OT, but do u know how to block our own ip so that shortstat doesnt count my own visits?

Offline

#7 2006-01-03 06:37:00

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,421
Website GitHub Mastodon

Re: Block rss link in shortstat

No, no idea besides this one: Get SlimStat where this is a built-in feature.

ShortStat is abandoned by Shaun Inman and replaced with Mint while SlimStat is actively developed. Instructions for the migration procedure are here.

Offline

#8 2006-01-03 06:45:53

KLS
Member
From: Singapore
Registered: 2005-12-26
Posts: 35
Website

Re: Block rss link in shortstat

“SlimStat is not currently able to show search terms or visits from your existing data. I am writing converter scripts, which will be made available soon.”

I’ll use slim when that converter script is ready. Anyways, thanks again wet, you’ve been helpful. :)

Offline

#9 2006-01-04 18:36:40

rayben
Member
From: Cologne, Germany
Registered: 2004-10-20
Posts: 31

Re: Block rss link in shortstat

Thanks a lot for your quick & detailed answer! I decided to use slimstat and I just love it!
Sorry for my delayed answer.

But I have one further question: The conditional statement you showed above, should it replace the whole content of the wet_slimpattern plugin (besides the mint related stuff) ?

I did it this way and it works fine, but no I left out the txpinterface == ‘public’ stuff, because otherwise I get an error message when I visit my website, I hope it is not a problem…

Thanks again for your support

Last edited by rayben (2006-01-04 19:14:27)

Offline

#10 2006-01-08 17:55:16

rayben
Member
From: Cologne, Germany
Registered: 2004-10-20
Posts: 31

Re: Block rss link in shortstat

Okay, maybe I didn’t make myself clear enough, what I meant was: How exactly would the code look like if I replaced the original php-code from the wet_slimpattern plugin ? I’m sorry, but I’m such a php-noob…

Thanks in advance.

Offline

#11 2006-01-08 18:01:51

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,421
Website GitHub Mastodon

Re: Block rss link in shortstat

I do not get it: Are you using wet_slimpattern, or are you integrating shortstat by adding some php code into /index.php?

Offline

#12 2006-01-08 18:08:09

rayben
Member
From: Cologne, Germany
Registered: 2004-10-20
Posts: 31

Re: Block rss link in shortstat

At first I was using Shortstat and know I use wet_slimpattern/slimstat.

Offline

#13 2006-01-08 18:16:43

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,421
Website GitHub Mastodon

Re: Block rss link in shortstat

Ok, then probably the plugin should contain exactly this code (though I am not sure why you should get an error message by leaving the txpinterface condition in place):

<pre>
if ( !in_array ($_SERVER[“REQUEST_URI”], array(‘/rss’, ‘/atom’)) && !in_array ($_SERVER[“QUERY_STRING”], array(‘rss=1’, ‘atom=1’)) ) { @include_once( $_SERVER[“DOCUMENT_ROOT”].”/slimstat/inc.stats.php” );
}
</pre>

This assumes that slimstat is installed into its default directory, /slimstat.

Last edited by wet (2006-01-08 18:18:38)

Offline

#14 2006-01-08 18:32:44

rayben
Member
From: Cologne, Germany
Registered: 2004-10-20
Posts: 31

Re: Block rss link in shortstat

Now it works fine, but the code must be ‘/rss/’ and /atom/’ to work properly ;-)

Nevertheless Thanks for your patience & support!

Offline

#15 2006-01-08 19:53:01

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,421
Website GitHub Mastodon

Re: Block rss link in shortstat

You will notice that different aggregators use permutations of these URLs with or without trainling slashes, eg Rojo uses /rss while Bloglines uses /rss/ ignoring the way your feed link is spelled in reality. But, as I’ve mentioned before, you can extend both arrays to include any ressource you wanted to suppress.

Offline

Board footer

Powered by FluxBB