Posting html code with php fails at style attribute and spaces -
Posting html code with php fails at style attribute and spaces -
i'm using ace editor website has been developed codeigniter framework. problem after submitting form, tags attributes stripped.
html:
<form enctype="multipart/form-data" method="post" action="<?php echo site_url( 'admin/slider/populatefile')?>"> <div id="e1" style="display: none;"> <?php if(isset($sliderhtml)) { echo $sliderhtml; } ?> </div> <textarea class=" form-control" id="editortextarea" name="sliderhtml" type="text" rows='20' wrap="off"> <?php if(isset($sliderhtml)) { echo $sliderhtml; } ?> </textarea> <pre id="editor"></pre> </form>
php:
function populatefile() { $sliderhtml = $this->input->post('sliderhtml'); //echo $sliderhtml; $filepath = 'application/views/admin/slider/sliderhtml.txt'; write_file($filepath, $sliderhtml, 'w'); redirect('admin/slider', 'location'); }
this illustration of i'm trying write in code editor:
<img class="ls-l" style="top:195px;left:50%;white-space:nowrap;" data-ls="offsetxin:0;delayin:1720;easingin:easeinoutquart;scalexin:0.7;scaleyin:0.7;offsetxout:-800;durationout:1000;" src="http://localhost:8080/afa/application/views/images/upload/slider/4978d-s1.jpg" alt=""> <p class="ls-l" style="top:150px;left:116px;font-weight: 300;height:40px;padding-right:10px;padding-left:10px;font-size:30px;line-height:37px;color:#ffffff;background:#82d10c;border-radius:3px;white-space:nowrap;" data-ls="offsetxin:0;durationin:2000;delayin:1500;easingin:easeoutelastic;rotatexin:-90;transformoriginin:50% top 0;offsetxout:-200;durationout:1000;"> features </p>
but, output like:
<img class="ls-l" data-ls="offsetxin:0;delayin:1720;easingin:easeinoutquart;scalexin:0.7;scaleyin:0.7;offsetxout:-800;durationout:1000;" src="http://localhost:8080/afa/application/views/images/upload/slider/4978d-s1.jpg" alt=""> <p class="ls-l" 300;height:40px;padding-right:10px;padding-left:10px;font-size:30px;line-height:37px;color:#ffffff;background:#82d10c;border-radius:3px;white-space:nowrap;" data-ls="offsetxin:0;durationin:2000;delayin:1500;easingin:easeoutelastic;rotatexin:-90;transformoriginin:50% top 0;offsetxout:-200;durationout:1000;"> features </p>
notice style attribute of img
has been stripped, , happens <p>
stops on space after font-weight:
. don't know why.
any ideas?
edit: finally, knew has nil code editor. problem xss_filtering in codeigniter , this reply works me. :)
i not familiar ace in particular (i wysihtml5), think have in common.
wysihtml5 strips html (you can select which). makes sure html output clean.
in short, it's function , apparently style not permitted. should permit (if has alternative to)
php html codeigniter post ace-editor
Comments
Post a Comment