Example #1
0
 /**
  * 	Process comment update
  */
 public function processCommentUpdate()
 {
     global $CFG;
     // Default
     if (strlen($_POST['webcell_title'])) {
         $webcell_title = $_POST['webcell_title'];
     } else {
         $webcell_title = 'Comment';
     }
     $mysql = new mysqlquery();
     $query = "SELECT webcell_id\r\n\t\t\t          FROM {$_SESSION['RealS_prefix']}webcells, {$_SESSION['RealS_prefix']}items\r\n\t\t\t          WHERE item_id = " . $mysql->escape_value($_POST['comment_item_id'], 'int') . "\r\n\t\t\t          \tAND item_webcell=webcell_id\r\n\t\t\t          \tAND webcell_member=" . $_SESSION['USER']->id;
     // Debugging
     //echo $query;
     $comments = $mysql->runsql($query);
     if (count($comments) > 0) {
         $query = "UPDATE {$_SESSION['RealS_prefix']}webcells SET\r\n\t\t\t\t        \twebcell_text = " . $mysql->escape_value($_POST['webcell_text'], 'text') . ",\r\n\t\t\t\t        \twebcell_title = " . $mysql->escape_value($webcell_title, 'text') . "\r\n\t\t\t\t        WHERE webcell_id = " . $comments[0]['webcell_id'];
         // Debugging
         //echo $query;
         $mysql->query($query);
         // Save comment member statuses, i.e. make this comment unread for all share cohort members
         $obj_count = new commentEvidenceCount();
         $obj_count->increaseCommentCounter($this->item_type_id, $this->unit_item_id, $_POST['comment_item_id'], $_POST['share_id']);
     }
 }