Example #1
0
 /**
  * Save the comment data for a blog post
  *
  */
 public static function SaveCommentData($post_index, $data)
 {
     global $langmessage;
     // check directory
     $dir = self::$data_dir . '/comments';
     if (!gpFiles::CheckDir($dir)) {
         return false;
     }
     $commentDataFile = $dir . '/' . $post_index . '.txt';
     $dataTxt = serialize($data);
     if (!gpFiles::Save($commentDataFile, $dataTxt)) {
         return false;
     }
     // clean pre 1.7.4 files
     $commentDataFile = self::$data_dir . '/comments_data_' . $post_index . '.txt';
     if (file_exists($commentDataFile)) {
         unlink($commentDataFile);
     }
     SimpleBlogCommon::AStrSet('comment_counts', $post_index, count($data));
     SimpleBlogCommon::SaveIndex();
     SimpleBlogCommon::ClearCommentCache();
     return true;
 }