/[LeafOK_CVS]/fenglin/bbs/post_service.php
ViewVC logotype

Diff of /fenglin/bbs/post_service.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 by sysadm, Fri Apr 4 03:35:16 2025 UTC Revision 1.6 by sysadm, Mon Apr 7 08:39:42 2025 UTC
# Line 6  Line 6 
6          require_once "../lib/lml.inc.php";          require_once "../lib/lml.inc.php";
7          require_once "./check_sub.inc.php";          require_once "./check_sub.inc.php";
8          require_once "../lib/str_process.inc.php";          require_once "../lib/str_process.inc.php";
9  ?>  
 <?  
10          force_login();          force_login();
11    
12          $id = (isset($_POST["id"]) ? intval($_POST["id"]) : 0);          $id = (isset($_POST["id"]) ? intval($_POST["id"]) : 0);
# Line 42  Line 41 
41                  ));                  ));
42          }          }
43    
44            $r_title = split_line($title, "", 80, 1);
45            if ($title != $r_title)
46            {
47                    $result_set["return"]["code"] = -1;
48                    array_push($result_set["return"]["errorFields"], array(
49                            "id" => "title",
50                            "errMsg" => "超长已截断",
51                            "updateValue" => $r_title,
52                    ));
53            }
54    
55            $r_title = check_badwords($title, "****");
56            if ($title != $r_title)
57            {
58                    $result_set["return"]["code"] = -1;
59                    array_push($result_set["return"]["errorFields"], array(
60                            "id" => "title",
61                            "errMsg" => "已过滤",
62                            "updateValue" => $r_title,
63                    ));
64            }
65    
66            $r_content = check_badwords($content, "****");
67            if ($content != $r_content)
68            {
69                    $result_set["return"]["code"] = -1;
70                    array_push($result_set["return"]["errorFields"], array(
71                            "id" => "content",
72                            "errMsg" => "已过滤",
73                            "updateValue" => $r_content,
74                    ));
75            }
76    
77          if ($emoji <= 0 || $emoji > $BBS_emoji_count)          if ($emoji <= 0 || $emoji > $BBS_emoji_count)
78          {          {
79                  $result_set["return"]["code"] = -1;                  $result_set["return"]["code"] = -1;
# Line 66  Line 98 
98                  exit(json_encode($result_set));                  exit(json_encode($result_set));
99          }          }
100    
101          // Append sign          // Append sign for new post
102          if ($sign_id > 0)          if ($id == 0 && $sign_id > 0)
103          {          {
104                  $sql = "SELECT sign_" . $sign_id . " AS sign FROM user_pubinfo WHERE UID = " . $_SESSION["BBS_uid"];                  $sql = "SELECT sign_" . $sign_id . " AS sign FROM user_pubinfo WHERE UID = " . $_SESSION["BBS_uid"];
105                  $rs = mysqli_query($db_conn, $sql);                  $rs = mysqli_query($db_conn, $sql);
# Line 93  Line 125 
125                  $content .= ("\n--\n※作者已于 " . date("Y-m-d H:i:s") . " 修改本文※\n");                  $content .= ("\n--\n※作者已于 " . date("Y-m-d H:i:s") . " 修改本文※\n");
126          }          }
127    
128          // Filter badwords and truncate          // Calculate length of content
         $title = check_badwords(split_line($title, "", 80, 1));  
         $content = check_badwords($content);  
129          $length = str_length(LML($content, false, false, 1024));          $length = str_length(LML($content, false, false, 1024));
130    
131          // Initial variables          // Initial variables
# Line 363  Line 393 
393                  }                  }
394          }          }
395    
396          //Process upload attachment          // Get upload quota and used space
397          $atta_id_list = "-1";          $atta_id_list = "-1";
398          $attachment_count = (isset($_FILES['attachment']['error']) ? count($_FILES['attachment']['error']) : 0);          $attachment_count = (isset($_FILES['attachment']['error']) ? count($_FILES['attachment']['error']) : 0);
399            if ($attachment_count > $BBS_upload_count_limit)
         if ($attachment_count >= $BBS_upload_count_limit)  
400          {          {
401                  $result_set["return"]["code"] = -1;                  $result_set["return"]["code"] = -1;
402                  array_push($result_set["return"]["errorFields"], array(                  array_push($result_set["return"]["errorFields"], array(
# Line 624  Line 653 
653                          while ($row = mysqli_fetch_array($rs))                          while ($row = mysqli_fetch_array($rs))
654                          {                          {
655                                  //Send notification message                                  //Send notification message
   
656                                  $msg_content = "[hide]SYS_Reply_Article[/hide]有人回复了您所发表/回复的主题文章,快来".                                  $msg_content = "[hide]SYS_Reply_Article[/hide]有人回复了您所发表/回复的主题文章,快来".
657                                          "[article " . $tid . "#" . $aid . "]看看[/article]《" . $r_title . "》吧!\n";                                          "[article $aid]看看[/article]《" . $r_title . "》吧!\n";
658    
659                                  $sql = "INSERT INTO bbs_msg(fromUID, toUID, content, send_dt, send_ip)                                  $sql = "INSERT INTO bbs_msg(fromUID, toUID, content, send_dt, send_ip)
660                                                  VALUES($BBS_sys_uid, " . $row["UID"] . ", '" .                                                  VALUES($BBS_sys_uid, " . $row["UID"] . ", '" .
# Line 646  Line 674 
674    
675                          mysqli_free_result($rs);                          mysqli_free_result($rs);
676                  }                  }
677                  else                  else // Post new article
678                  {                  {
679                          $tid = $aid;                          $tid = $aid;
680                  }                  }
# Line 683  Line 711 
711                  }                  }
712          }          }
713    
714            // Link content to article
715          $sql = "UPDATE bbs_content SET AID = $aid WHERE CID = $cid";          $sql = "UPDATE bbs_content SET AID = $aid WHERE CID = $cid";
716    
717          $rs = mysqli_query($db_conn, $sql);          $rs = mysqli_query($db_conn, $sql);
# Line 695  Line 724 
724                  exit(json_encode($result_set));                  exit(json_encode($result_set));
725          }          }
726    
727            // Link attachments to article
728          $sql = "UPDATE upload_file SET ref_AID = $aid WHERE AID IN ($atta_id_list)";          $sql = "UPDATE upload_file SET ref_AID = $aid WHERE AID IN ($atta_id_list)";
729    
730          $rs = mysqli_query($db_conn, $sql);          $rs = mysqli_query($db_conn, $sql);
# Line 707  Line 737 
737                  exit(json_encode($result_set));                  exit(json_encode($result_set));
738          }          }
739    
740          //Add log          // Add log
741          $rs = article_op_log($aid, $_SESSION["BBS_uid"], ($id == 0 ? "A" : "M"), client_addr(), $db_conn);          $rs = article_op_log($aid, $_SESSION["BBS_uid"], ($id == 0 ? "A" : "M"), client_addr(), $db_conn);
742          if ($rs == false)          if ($rs == false)
743          {          {
# Line 730  Line 760 
760          }          }
761    
762          // Set return path          // Set return path
         $result_set["return"]["tid"] = $tid;  
763          $result_set["return"]["aid"] = $aid;          $result_set["return"]["aid"] = $aid;
764    
765          $_SESSION["BBS_last_sub_tm"] = time();          $_SESSION["BBS_last_sub_tm"] = time();


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1