corz.org uses cookies to remember that you've seen this notice explaining that corz.org uses cookies, okay!
corzblog bbcode parser preview
Here it is! My [search engine fodder] bbcode to html parser, and html to bbcode parser [/search engine fodder]!
This is the actual very onsite parser that parses the bbcode of my blogs and site comments, which as well its usual tasks of, well, you know, the parsing stuff, also moonlights doing a cute wee background demo of itself, you're looking at it. it knew you wanted to do that. hit the "preview" button to see at least one half of the parser's bbcode to html/html to bbcode functionality.
The front-end (below) is built-in to the parser, you just call the
function and it creates the form. The cool, super-portable JavaScript bbcode buttons and functions come
in the package, too. Have fun. Oh, and by the way, output is 100% pure HTML5, or nice plain bbcode, which ever way you look at it, it's free.
Welcome to the comments facility!
Hi Hubble.
It's temtping to jump in with a few potential solutions, but less valuable than first asking.. Have you consulted your php error log?
It's clear that cbparser can handle these characters fine (you just used one), so before I rip it apart, even load it in my text editor, I'll need to know things like; what operating system you are using, what version of cbparser, any log output, errors, is it running alone or embedded in some other page, and so on.
Also, when you say the output is totally blank, do you mean the entire page (i.e. it desn't load at all) or just the area where you expected to see html output from cbparser?
It's not possible to give me too much information!
;o)
(or
I'm running apache 2.2 with PHP Version 5.2.4 on a Windows XP desktop. Also using MySQL 5.0.
I've checked the error log from apache but it gives no error, I also tried debug error logging but it still was empty. I'm using the 1.2 parser version, but I had it with 1.0 too.
The page is not embedded. Everything on the page loads fine accept the part where the text parsed by the bbparser should be. I also have this all running on the web, but there it works fine. So it's a local problem.
When I remove the special character everything works well.
Hubble
Hmm. Is utf-8 enabled on the server, and in your local site? perhaps add this to the .htaccess..
A phpinfo() would let you know the current setting. Not that this should make the output blank.
I'm assuming your system has international language support, too. Not that you should need it for this. It's just a good thing!
Can you hack in and echo the output of these two variables..
<?php
$GLOBALS['cbparser']['warning_message']
$GLOBALS['cbparser']['state']
?>
.. to see what cbparser's error condition was? Pop it into the foot of the page or something (or run with my debug unit).
What bothers me is the lack of php errors. For cbparser to spit out NOTHING AT ALL takes a fairly error condition. And if that's the case, where's the php error log entry?
Is error logging even enabled? Can you produce another error? Any error? (i.e. intentionally, with another file, by adding some gibberish to its code) and actually physically see the error produced in your log? If your error log is empty, go make php add something, on purpose, to check all is working.
Trouble is, it's easy enough to disable all php error logging and error viewing and then not have a clue what's going on, because php won't tell you, if you tell it not to!
;o)
(or
First thing I tried before changing anything was getting the warning message and state.
The warning message gave nothing but the state returned 5, xss attack or php injection...
My windows system is Dutch and has indeed international language support.
I'm going to try to get more out the logs... <edit-2> I have my php logging on ALL and Apache on DEBUG and the page just doesn't give any errors...
(The logs are not completely empty offcourse, the are lots of minor errors and they are all explainable and have nothing to do with the cbparser or this particular page.)
Can you tell me what that state: 5 means?
<edit>
I disabled line 769 to test what would happen, and I got this:
<edit3> When I totally remove the lines, there errors are also gone again, it was probably because only half the line was disabled...</edit3>
- tried the htaccess. file with php_value default_charset utf-8
- tried adding AddDefaultCharset utf-8 to httpd.conf
- tried adding to php.ini
- mbstring.language = Neutral; Set default language to Neutral(UTF-8) (default)
- mbstring.internal_encoding = UTF-8 ; Set internal encoding to UTF-8
- mbstring.encoding_translation = On
- mbstring.http_output = UTF-8 ; Set HTTP output encoding to UTF-8
all no success...
Thanks for all the help, by the way!
Hubble
Hmm. Error 5 is just what it says on the can (and in the notes at the top of cbparser); script-kiddie attack. Though clearly that's not the real issue here, as you aren't trying to input dodgy javascript or php into the textarea, I presume.
I don't know what version you are running; those line numbers lead to the demo text! You can delete ALL that; it's just for the demo here at corz.org, really.
One thing that springs to mind is slashes. Everywhere cbparser has been working and developed has had magic quotes enabled.. and I do remember noting somewhere that behaviour with it disabled (very rare) was "unpredictable", though I'm in no hurry to look into this, you might want to.
Also, did you try disabling xss protection?
;o)
(or
ps. also, check your editor isn't messing with the file; use a good plain text editor, and ensure characters aren't getting left outside the php tags.
The magic quotes we're off, so I turned it on, but it didn't help. I tried turning of the xss, this still gave no output and the state became 0. I was using the 1.2 parser and also tried yout beta. 1.2.1.
I think I will remove the php engine and reïnstall it to see if my setup might be causing it.
Hubble
I deïnstalled php and apache and removed all files left behind, reïnstalled apache 2.2.6. and php 5.2.5.
The problem is still there, I also uploaded my site to our domain to test it and it works fine online (just to make sure)
If I put in my page: I receive the error: there was no text!
Apache does give an error now but it also gives it when the text has no special character and thus the page parses good;
Because it works online perfectly and it's only occuring on my system I think we shouldn't pay much attention to it, maybe a clean install we resolve it.
Thanks for all the help anyway.
Hubble
Och well. You might want to try..
<?php
$bb2html = htmlentities($bb2html, ENT_NOQUOTES); ?>
note, no utf-8. I've seen that throw up errors before, but php usually carries on gracefully.
It is a pain when things don't work. I haven't seen this sort of trouble with cbparser before; it sure is used in a lot of places, inside various CMS and all sorts, so I'm guessing you've got something local going on. I wish I could be more help in pinning it down.
The next time I dive into cbparser, will probably be a ground-up rewrite, so I'm leaving it well alone for now!
for now..
;o)
(or
Dear bbcode creator,
I'm using your script for my wap site http://m.mobitrek .com/ (using XHMTL mobile spec) on some occasion your script is running well, but when user type wrong ordered tag, then it produces error, the tag sample is like this haha then it will error, can u add some tag order check before?
Thanks.
Sony AK
sony-ak@phpindonesia.com
hi,
can u plz post an installation guide? cuz i'm all messed up and i just couldn't install this usefull editor...
many thanks!
Sony AK, cbparser will check for certain things, unclosed tags and such, but it won't teach people the basic concepts of bbcode. Your example works just fine. Feel free to drop an example that doesn't work, I'll get a better idea of exactly what you mean.
amir, throw the script into a text editor - voluminous notes and instructions are provided within. You should be in there setting your prefs, anyway.
Never run a script without first studying its contents!!!
;o)
(or