php - CKeditor and TinyMCE output HTML tags on published content -


i know old 1 because i've searched web 3 hours , can't figure 1 out. know somewhere in code have put html_entity_decode or htmlspecialchars_decode because believe html entities aren't converting when pulled database...but where? doesn't matter whether it's edit or create...and tried use both ckeditor , tinymce..same thing happens..without plugins..so whitout changes made on editors..

here's edit

  <?php find_selected_page(); ?>    <?php if (isset($_post['submit'])) { // process form  $id = $current_subject["id"]; $menu_name = mysql_prep($_post["menu_name"]); $position = (int) $_post["position"]; $visible = (int) $_post["visible"]; $content = mysql_prep($_post["content"]);  // validations $required_fields = array("menu_name", "position", "visible", "content"); validate_presences($required_fields);  $fields_with_max_lengths = array("menu_name" => 30); validate_max_lengths($fields_with_max_lengths);  if (empty($errors)) {   // perform update  $query  = "update subjects set "; $query .= "menu_name = '{$menu_name}', "; $query .= "position = {$position}, "; $query .= "visible = {$visible}, "; $query .= "content = '{$content}' "; $query .= "where id = {$id} "; $query .= "limit 1"; $result = mysqli_query($connection, $query);  if ($result && mysqli_affected_rows($connection) == 1) {     // success     $_session["message"] = "stranica uređena.";     redirect_to("manage_content.php?subject={$id}"); } else {     // failure     $_session["message"] = "uređivanje stranice neuspjelo."; }  } } else {     // request  } // end: if (isset($_post['submit']))  ?> 

here's it's echoed

<textarea name="content" id="editor1" class="form-control" rows="20" cols="80"><?php echo htmlentities($current_subject["content"]); ?></textarea>                                        <script>                                          // replace <textarea id="editor1"> ckeditor                                         // instance, using default configuration.                                         ckeditor.replace( 'editor1', {                                                 language: 'hr',                                                                                                                                                                       } );                                       </script> 

here functions

function find_all_subjects($public=true) {     global $connection;       $query  = "select * ";     $query .= "from subjects ";     if($public) {         $query .= "where visible = 1 ";     }            $query .= "order position asc";      $subject_set = mysqli_query($connection, $query);     confirm_query($subject_set);     return $subject_set; } function find_subject_by_id($subject_id, $public=true) {     global $connection;       $safe_subject_id = mysqli_real_escape_string($connection, $subject_id);      $query  = "select * ";     $query .= "from subjects ";     $query .= "where id = {$safe_subject_id} ";     if($public){         $query .= "and visible = 1 ";     }     $query .= "limit 1";      $subject_set = mysqli_query($connection, $query);     //test if there query error     confirm_query($subject_set);     if($subject = mysqli_fetch_assoc($subject_set)) {     return $subject;     }else {         return null;     } }  function find_selected_page($public=false) {     global $current_subject;     global $current_page;      if(isset($_get["subject"])) {          $current_subject = find_subject_by_id($_get["subject"], $public);          $current_page = null;     }elseif (isset($_get["page"])) {          $current_page = find_page_by_id($_get["page"], $public);          $current_subject = null;     }else{          $current_subject = null;         $current_page = null;     }  } 

so, @ end should this: here some text on public page

instead looks this

<p>here <strong>some</strong> text on public page</p> 

is there else add here code need see?

any suggestions?

is possible display echoed text raw , editor takes , displays without html tags?

or how can use this?

php’s strip_tags() equivalent mysql function

if add

    $content = mysql_prep(strip_tags(html_entity_decode($_post["content"]))); 

then there's no text formatting..

thanks in advance...

i got it...turns out looking @ wrong thing...i looking @ "edit page" , fiddled there lot had apply html_entity_decode content had been shown client side or in case in "manage content"... didn't include part in question...so stupid... :d

<?php echo html_entity_decode($current_subject["content"]); ?> 

maybe in future... :)


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -