Montego Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic
Author Message
meotoo
Newbie
Newbie



Joined: Aug 04, 2009
Posts: 2

PostPosted: Mon Sep 14, 2009 9:54 am Reply with quote

Hello Montego, and all.

We at www.meotoo.com started using ShortLinks and i just would like to express my gratitude to you (and previous involved people) for such a great add-on. Thank You.

As some reward.. here you have a fixed tnsl_fCleanLinks() function which should work fast(?)/sweet or at least bugfree, cause i've noticed your original function tries to transform the whole page contents (while only links should be needed) causing unpredictable errors from embed javascript code.

Code:

function fCleanLinks_Stub($link,$q)
{ // MeoToo way ;)
   if(strpos( $link, '&') !== false)
      $link = str_replace(array('&#','&amp;','&','<<#>>'),array('<<#>>','&','&amp;','&#'),$link);
   return $q.$link.$q;
}
function tnsl_fCleanLinks(&$getNextGen) {
   // Function Fixed/Improved by MeoToo Development - http://www.meotoo.com/ 20090913
   
   $getNextGen = preg_replace('#\s+(src|href|action)\=([\'"]?)([^\s\\2]+)\\2#ei','" $1=".fCleanLinks_Stub("$3","$2")',$getNextGen);
   
   // montego - following code is required to allow the new RNYA AJAX validations to work properly
   $getNextGen = preg_replace('/rnxhr.php\?name=Your_Account&amp;file/', 'rnxhr.php\?name=Your_Account&file', $getNextGen );
   return;
}


We did as well a few number of cleanups, if you want i could send you the whole shortlinks.php file.

Regarding the donation you request by using this addon, what about if we give you a discount with some of our products? Smile or if you like FlashGames we could give you a GamesPack for free Wink


Best Regards.
 
View user's profile Send private message Visit poster's website
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Mon Sep 14, 2009 5:31 pm Reply with quote

Meotoo,

Very much appreciate your post and thanks. No worries on the donation since you are giving back to the community in making ShortLinks better. If you do not mind, I would like to see the entire set of changes side-by-side, so, yes, I would love to see the completed PHP script.

Please send to montego || at }} montegoscripts {{ dot || com

Thank you!

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
meotoo
Newbie
Newbie



Joined: Aug 04, 2009
Posts: 2

PostPosted: Wed Sep 16, 2009 3:58 pm Reply with quote

Sent.

(Sorry for the delay ;)
 
View user's profile Send private message Visit poster's website
Lucifix
Newbie
Newbie



Joined: Feb 26, 2008
Posts: 5

PostPosted: Fri May 21, 2010 12:12 pm Reply with quote

I have one question, on my site im using The PHP thumbnail generator
http://phpthumb.sourceforge.net/

I've alot of problems with replacing & with &amp; because after that I get a lot of errors with my apache.

This is how code should look like:
Code:
phpThumb.php?src=pathtoimage&w=90&h=90&zc=1&q=100


but with replacing & with &amp; i get this:
Code:
phpThumb.php?src=pathtoimage&amp;w=90&h=90&amp;zc=1&amp;q=100


Image show up, but i get too many errors in apache and the server will eventual shut down.

Does anyone have any solution for that not to replace all &?

PS: it's pretty urgent, because I need to restart server even more then twice a day and my vacation is coming very soon (who will restart my server then?) Wink
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sat May 22, 2010 10:40 am Reply with quote

I don't understand what errors you would be getting in Apache. A URL with &amp; in it is compliant to W3C standards for URLs. Would you mind posting for me a few samples of these errors (remove path specifics or PM me if you would rather).

Also, it would help if I could see the page where you have such links. I'd like to see where they are located and the resultant HTML. Again, if you would rather post the URL to your site inside a PM, that is fine.

My first thought was to "tap" these links like everything else but the Apache error thing is really bugging me. I need to understand that better first before I can recommend a path to take.

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
Lucifix
Newbie
Newbie



Joined: Feb 26, 2008
Posts: 5

PostPosted: Thu May 27, 2010 1:35 am Reply with quote

This is from error log:
getimagesize(PATHTOMYWEBSITE/phpThumb/phpThumb.php?src=IMAGENAME.jpg&amp;w=250&amp;h=142&amp;zc=1&amp;q=90) [<a href='function.getimagesize'>function.getimagesize</a>]: could not make seekable

Then my apache crash with this error:
[notice] child pid xyz exit signal Segmentation fault (11)

xyz = some numbers

My website: http://www.slo-foto.net/

Now I have installed @meotoo links, but I want to use shortlinks only for "a href" link, but not for images (<img src..>) or javascript (<script src="...">)
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Thu May 27, 2010 3:53 pm Reply with quote

Since you are using meotoo's code, have you tried changing this:

Code:

(src|href|action)


to just:

Code:

(href)


?
 
View user's profile Send private message Visit poster's website
Lucifix
Newbie
Newbie



Joined: Feb 26, 2008
Posts: 5

PostPosted: Fri May 28, 2010 8:09 am Reply with quote

I did that but look what happened to javascript:
Code:
<a href="javascript:replyb(\'Lucifix\', '114202');">


It should be:
Code:
<a href="javascript:replyb('Lucifix', '114202');">
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sat May 29, 2010 10:53 am Reply with quote

Are you sure that ShortLinks is doing that substitution? Try turning ShortLinks off and checking that again.
 
View user's profile Send private message Visit poster's website
Lucifix
Newbie
Newbie



Joined: Feb 26, 2008
Posts: 5

PostPosted: Tue Jun 29, 2010 7:05 am Reply with quote

montego wrote:
Are you sure that ShortLinks is doing that substitution? Try turning ShortLinks off and checking that again.


Sorry for my delay answer, yes I turned ShortLinks off and it's working normaly.

This is how my code looks like:
Code:
function tnsl_fCleanLinks(&$getNextGen) {
   // Function Fixed/Improved by MeoToo Development - http://www.meotoo.com/ 20090913
   
   $getNextGen = preg_replace('#\s+(href|action)\=([\'"]?)([^\s\\2]+)\\2#ei','" $1=".fCleanLinks_Stub("$3","$2")',$getNextGen);
   
   // montego - following code is required to allow the new RNYA AJAX validations to work properly
   $getNextGen = preg_replace('/rnxhr.php\?name=Your_Account&amp;file/', 'rnxhr.php\?name=Your_Account&file', $getNextGen );
   return;
}
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sun Jul 04, 2010 3:02 pm Reply with quote

The code from Meotoo is not a part of ShortLinks. Please try me base code, as provided, and see if that works.
 
View user's profile Send private message Visit poster's website
Palbin
Newbie
Newbie



Joined: Nov 26, 2007
Posts: 25

PostPosted: Sun Mar 27, 2011 12:55 pm Reply with quote

I find this to be a slightly better variation:

Code:

function fCleanLinks_Stub($link) {
   if(strpos( $link, '&') !== false) {
      $link = str_replace(array('&#','&amp;','&','<<#>>'), array('<<#>>','&','&amp;','&#'), $link);
   }
   return $link;
}

function tnsl_fCleanLinks(&$getNextGen) {
   $getNextGen = preg_replace('#(href\s*=\s*[\'"]?)([a-zA-Z0-9/&;:=\?\._-]*)(["\'])#eiu', '"$1" . fCleanLinks_Stub("$2") . "$3"', $getNextGen);
   return;
}


I removed the reference to "src" and "action" because I do not think they apply here as I do not see why they should the shortened.
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sun Mar 27, 2011 1:01 pm Reply with quote

Just so you know, I'm not endorsing this... yet. I need the time to review. Just haven't yet.. sorry. Life is busy atm. I hope to get to it tomorrow as I have the day off just for me. Smile

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
Palbin
Newbie
Newbie



Joined: Nov 26, 2007
Posts: 25

PostPosted: Sun Mar 27, 2011 3:49 pm Reply with quote

Just offering my opinion Wink
 
View user's profile Send private message
Killing-Hours
Newbie
Newbie



Joined: Mar 24, 2011
Posts: 10

PostPosted: Mon Mar 28, 2011 11:09 am Reply with quote

Palbin-

I wish I were advanced enough to understand how your code works and how I could help test this further... but I can't.

I did test it with my json/ajax test module and it seemed to work flawlessly. That's not to say it won't break other things elsewhere... but I really appreciate you. Thanks!

@Montego-

I'll wait till you endorse this so I can feel safe with it.

Really appreciate both of you and your work.
 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 4 Hours
 
Forums ©
linear-bunch
linear-bunchlinear-bunch