/** * * @param DBConnect $db * @param <int> $userID * @param <int> $childOf * @param <string> $title * @param <int> $rank * @param <string> $content * @param <int> $forumType * @return <int> new pageID */ public static final function _CreatePage( DBConnect &$db, $userID, $childOf, $title, $rank, $content, $isPrivate, $forumType){ logger_FuncCall(__FILE__, __LINE__, __FUNCTION__); if (!is_numeric($userID)){ throw new InvalidParamException(1, _T::NUMBER); } if (!is_numeric($childOf)){ throw new InvalidParamException(2, _T::NUMBER); } if (!is_string($title)){ throw new InvalidParamException(3, _T::STRING); } if (!is_numeric($rank)){ throw new InvalidParamException(4, _T::NUMBER); } if (!is_string($content)){ throw new InvalidParamException(5, _T::STRING); } if (!is_bool($isPrivate)){ throw new InvalidParamException(6, _T::BOOL); } if (!is_numeric($forumType)){ throw new InvalidParamException(7, _T::NUMBER); } if (!$db->DoesRecordExist(USERS, USERS_USERID."=$userID") || $db->DoesRecordExist(USERS, USERS_USERNAME."='Guest' AND ".USERS_USERID."=$userID")){ throw new InvalidValueException('$userID'); } if (!_FCORE::ValidateNumeric($forumType, 0, 2)){ throw new InvalidValueException('$forumType'); } if (!$childOf!=0 && $db->DoesRecordExist(PAGES, PAGES_PAGEID."=$childOf AND ".PAGES_USERID."=$userID")) { throw new InvalidValueException('$childOf'); } $title = $db->escapeString($title); $content = $db->escapeString($content); return $db->InsertThenReturnID(PAGES, PAGES_USERID."=$userID,". PAGES_CHILDOF."=$childOf,". PAGES_TITLE."='$title',". PAGES_RANK."=$rank,". PAGES_CONTENT."='$content',". PAGES_FORUMTYPE."=$forumType,". PAGES_ISPRIVATE."=".($isPrivate ? "1" : "0")); }