includes/comment.php
changeset 330 acf430dc25e7
parent 318 eec2dfd2f0a3
equal deleted inserted replaced
329:e48b1937dfc3 330:acf430dc25e7
   287           // Preprocess
   287           // Preprocess
   288           $name = ( $session->user_logged_in ) ? htmlspecialchars($session->username) : htmlspecialchars($data['name']);
   288           $name = ( $session->user_logged_in ) ? htmlspecialchars($session->username) : htmlspecialchars($data['name']);
   289           $subj = htmlspecialchars($data['subj']);
   289           $subj = htmlspecialchars($data['subj']);
   290           $text = RenderMan::preprocess_text($data['text'], true, false);
   290           $text = RenderMan::preprocess_text($data['text'], true, false);
   291           $src = $text;
   291           $src = $text;
       
   292           $sql_subj = $db->escape($subj);
   292           $sql_text = $db->escape($text);
   293           $sql_text = $db->escape($text);
   293           $text = RenderMan::render($text);
   294           $text = RenderMan::render($text);
   294           $appr = ( getConfig('approve_comments') == '1' ) ? '0' : '1';
   295           $appr = ( getConfig('approve_comments') == '1' ) ? '0' : '1';
   295           $time = time();
   296           $time = time();
   296           $date = date('F d, Y h:i a', $time);
   297           $date = date('F d, Y h:i a', $time);
   297           
   298           
   298           // Send it to the database
   299           // Send it to the database
   299           $q = $db->sql_query('INSERT INTO '.table_prefix.'comments(page_id,namespace,name,subject,comment_data,approved, time, user_id) VALUES' .
   300           $q = $db->sql_query('INSERT INTO '.table_prefix.'comments(page_id,namespace,name,subject,comment_data,approved, time, user_id) VALUES' .
   300                               "('$this->page_id', '$this->namespace', '$name', '$subj', '$sql_text', $appr, $time, $session->user_id);");
   301                               "('$this->page_id', '$this->namespace', '$name', '$sql_subj', '$sql_text', $appr, $time, $session->user_id);");
   301           if(!$q)
   302           if(!$q)
   302             $db->die_json();
   303             $db->die_json();
   303           
   304           
   304           // Re-fetch
   305           // Re-fetch
   305           $q = $db->sql_query('SELECT c.comment_id,c.name,c.subject,c.comment_data,c.time,c.approved,u.user_level,u.user_id,u.signature FROM '.table_prefix.'comments AS c
   306           $q = $db->sql_query('SELECT c.comment_id,c.name,c.subject,c.comment_data,c.time,c.approved,u.user_level,u.user_id,u.signature FROM '.table_prefix.'comments AS c