Register | Login | |||||
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
| |
0 users currently in Programming. |
User | Post | ||||||
Stifu Posts: 228/647 |
So, can't you figure it out or did you forget about me ? | ||||||
Stifu Posts: 208/647 |
Sure thing, here you go: http://stifu.free.fr/dl/temp/fctsml.zip
Thank you. | ||||||
Parasyte + Posts: 50/53 |
Do you mind zipping your function.php file so I can take a closer look at it? And you smilies config, if you can. | ||||||
Stifu Posts: 207/647 |
Oh yes, I did remove the $1 while messing with the file... Sorry about that.
And I don't know why it doesn't work inside the loop, but it certainly does not, no matter what... I tried countless times. Have a look: http://stifu.free.fr/board2/thread.php?id=8891 | ||||||
Parasyte + Posts: 49/53 |
How odd, it looks like the $1 is getting removed from your s.php. The script is replacing the smilie AND the preceeding character. The $1 will put the preceeding character back, while the $2 puts the proceeding character back.
And the for loop shouldn't change anything. Someone correct me if I am wrong, but that should have no affect at all. | ||||||
Stifu Posts: 205/647 |
Yes...
http://stifu.free.fr/s.php However, for some reason, when I tested it locally using EasyPHP, it wouldn't work anymore if used inside the for. Looks like it's the same once uploaded... I don't get any error anymore, it simply displays smilies all the time, regardless of what's around them... | ||||||
Parasyte + Posts: 48/53 |
The edited function would look like this:
Did you test s.php on your server to ensure it works as it is supposed to? | ||||||
Stifu Posts: 204/647 |
Copied incorrectly ? I can't see how.
I'm simply replacing the original "$msg=..." by what you gave me. I'll try that link you gave me once I'm back home, and I'll let you know... ___ Edit: The problem probably comes from the fact I don't overwrite what I should, that's what you must have meant... The original function is like that:
I assumed I had to put what you gave me inside instead of the $msg= line... I tried other things too, with no success. | ||||||
Parasyte + Posts: 44/53 |
It is being copied incorrectly. This is the only answer? Test the demo script on your server, copy the code directly from it:
http://parasyte.panicus.org/s.zip | ||||||
Stifu Posts: 198/647 |
Still not...
| ||||||
Parasyte + Posts: 42/53 |
Hmm, I think I know what it could be, add this to the list of escape codes:
(I have already added it to the 'original' post) $smilie[0]=str_replace("/", "\\/", $smilie[0]); | ||||||
Stifu Posts: 195/647 |
Still doesn't work... Except the error is different this time.
That's too bad, as your script seems to do exactly what I wanted... | ||||||
Parasyte + Posts: 41/53 |
I don't know? I tested it on my server, and it works as expected. Unless you are dumping an 8MB post of text into it, it should not be overflowing anything...
I did have to update it once again, though. I had "$milie[0]" in one part... The dollar sign hardly substitutes for the 's', oops. ;( Here, you can see the script in action... view page source to see all of the line breaks and everything: http://parasyte.panicus.org/s.php And if you REALLY need to see the script source as an example, I can post that as well. Then you can test it for yourself? :X | ||||||
Stifu Posts: 194/647 |
Exact same error as before... | ||||||
Parasyte + Posts: 39/53 |
I've since updated the code in my last post. It had some errors. :X | ||||||
Stifu Posts: 193/647 |
Hmmmmm...
Any idea ? Thanks. By the way, does anyone know how to fix the bug that makes it so no more than one guest ever appears ? | ||||||
Parasyte + Posts: 38/53 |
Did you edit your smilies list? Remember, you have to escape the special characters within the list. The following characters must be escaped:
[ \ ^ $ . | ? * + ( ) Which means that every instance of these in your smilies list must be preceded by a single backslash: \[ \\ \^ \$ \. \| \? \* \+ \( \) If you skip this step using my code, your smilie identifiers will be interpreted as part of the regex, which will definitely screw things up. If you wish to take the easy way out, you can have php do the escaping for you: $smilie[0]=str_replace("[", "\\[", $smilie[0]); | ||||||
Stifu Posts: 192/647 |
Originally posted by Randy53215 Hmmmm... I tried that: if (preg_match('/^.*(\\:\\))(?=((?=\\W)(?!\\d))+).*$/m', $message)) { } else { $msg=str_replace($smilie[0],"< } and that: if(!preg_match('/^.*(\\:\\))(?=((?=\\W)(?!\\d))+).*$/m', $message)) $msg=str_replace($smilie[0],"< Didn't work. No error or anything, but I just couldn't see any difference. It's in function function doreplace2, right ? Originally posted by Parasyte + Hmmm... Didn't work either, I may be doing something wrong. Here's the whole function: function doreplace2($msg){ global $smilies; if(!$smilies) $smilies=readsmilies(); for($s=0;$smilies[$s][0];$s++){ $smilie=$smilies[$s]; $msg=preg_replace("/(^|[^a-z0-9])".$smilie[0]."($|[^a-z0-9])/imx","$1< } It gave me many compilation errors... Parasyte + |
Posts: 35/53 Originally posted by Stifu No, it does not insert the additional backslashes. Those are needed to escape the special characters so they are not considered a part of the expression. When you edit a post using that code, it will 1) display the img tags if those are not already reverse filtered ... they should be. Or 2) it will just display the smilies exactly as they were originally entered. What you would do with the code is replace the line that Arthus showed. Randy53215 |
Posts: 126/726 if (preg_match('/^.*(\\:\\))(?=((?=\\W)(?!\\d))+).*$/m', $message)) {
| // DO NOT PUT IN IMAGE } else { // PUT IN IMAGE } That should work just put your variables in. This is a long thread. Click here to view it. | |