Функция поиска по постам
Мне это всё расписывать что-ли? Смотрите в содержание коммита, мне феерически индифферентно
This commit is contained in:
@ -45,7 +45,7 @@ function Post_ParseRawTagString (string $str): ReturnT {
|
||||
$currLen = 0;
|
||||
$currTag = "";
|
||||
} else {
|
||||
return new ReturnT(err_code: E_UIN_BADARGS, err_desc: "syntax error while trying to parse tags");
|
||||
return new ReturnT(err_code: E_UIN_BADARGS, err_desc: "syntax error at index $i while trying to parse tags");
|
||||
}
|
||||
} elseif (!IntlChar::isspace($str[$i])) {
|
||||
$currTag .= $str[$i];
|
||||
@ -70,7 +70,7 @@ function Post_ParseRawTagString (string $str): ReturnT {
|
||||
* FUNCTION
|
||||
* Check if image size properties are valid
|
||||
*/
|
||||
function Post_ImgResIsValid ($x, $y): bool {
|
||||
function Post_ImgResIsValid (int $x, int $y): bool {
|
||||
global $Config;
|
||||
|
||||
return ($x <= $Config["media"]["max_pic_res"]["x"])
|
||||
@ -179,10 +179,6 @@ function Post_Create (
|
||||
|
||||
$result = null;
|
||||
|
||||
// Author ID must exist
|
||||
if (!User_IDExist($author_id))
|
||||
return new ReturnT(err_code: E_UIN_WRONGID, err_desc: "specified user id does not exist");
|
||||
|
||||
// Performing SQL query
|
||||
$s = $db->prepare("INSERT INTO posts (author_id,tags,title,pic_path,preview_path,comments_enabled,edit_lock) VALUES (?,?,?,?,?,?,?)");
|
||||
$s->bind_param("issssii", $author_id, $tags, $title, $pic_path, $prev_path, $comms_enabled, $edit_lock);
|
||||
@ -202,6 +198,11 @@ function Post_Create (
|
||||
/*
|
||||
* METHOD
|
||||
* Create single publication
|
||||
* Request fields:
|
||||
* tags - list of tags, should be delimited by comma
|
||||
* title - optional title for post
|
||||
* Files fields:
|
||||
* pic - id of file object in $_FILES variable
|
||||
*/
|
||||
function Post_Create_Method (array $req, array $files): ReturnT {
|
||||
global $Config, $LOGGED_IN, $THIS_USER;
|
||||
@ -257,7 +258,7 @@ function Post_Create_Method (array $req, array $files): ReturnT {
|
||||
$realTitleLen = strlen($req["title"]);
|
||||
if ($realTitleLen > $maxTitleLen)
|
||||
return new ReturnT(err_code: E_UIN_BADARGS, err_desc: "title length exceeds maximum value");
|
||||
// Cleaning off all bad symbols (no script injection allowed here)
|
||||
// Cleaning off all bad symbols (no script injection allowed here) TODO: move to function
|
||||
for ($i = 0; $i < $realTitleLen; ++$i) {
|
||||
switch ($req["title"][$i]) {
|
||||
case "<":
|
||||
|
Reference in New Issue
Block a user