19Loc::loadMessages(__FILE__);
24 private $blogId = NULL;
27 private $avatarSizes =
array(
28 'COMMENT' =>
array(
'WIDTH' => 30,
'HEIGHT' => 30),
29 'POST' =>
array(
'WIDTH' => 100,
'HEIGHT' => 100),
32 private $cacheTime = 0;
37 $height = intval($height);
41 $this->avatarSizes[
$key] =
array(
'WIDTH' =>
$width,
'HEIGHT' => $height);
54 $this->cacheTime = intval($cacheTime);
63 $this->blogId = intval($id);
69 $this->cacheTime = $cacheTime;
84 if ($this->cacheTime > 0)
86 $result = $this->getUsersFromCache($ids);
90 $result = $this->getUsersFromDB($ids);
103 private function getUsersFromCache($ids)
105 $cache = Cache::createInstance();
106 if ($cache->initCache($this->cacheTime, self::createCacheId($ids), self::createCacheDir($this->blogId)))
110 elseif ($cache->startDataCache())
112 $result = self::getUsersFromDB($ids);
131 $cache = Cache::createInstance();
133 $cache->cleanDir(self::CACHE_ID, self::createCacheDir($blogId));
137 private static function createCacheDir($blogId = NULL)
140 $dir .= $blogId ?
'/BLOG_ID_' . $blogId :
'/BLOGS_ALL';
151 private static function createCacheId($ids)
153 $ids = array_unique($ids);
156 return self::CACHE_ID .
'_' . implode(
'_', $ids);
163 private function getUsersFromDB($ids =
array())
171 $resBlogUsers = Internals\BlogUserTable::getList(
array(
173 'ID',
'USER_ID',
'ALIAS',
'DESCRIPTION',
'AVATAR',
'INTERESTS',
'LAST_VISIT',
'DATE_REG',
'ALLOW_POST',
174 'USER.PERSONAL_PHOTO',
'USER.LOGIN',
'USER.NAME',
'USER.LAST_NAME'
180 if (is_array($ids) && !empty($ids))
181 $notExistingUsersIds = array_combine($ids, $ids);
183 while ($row = $resBlogUsers->fetch())
185 unset($notExistingUsersIds[$row[
"USER_ID"]]);
187 $row[
"BLOG_USER_ID"] = $row[
"ID"];
190 $row[
"BlogUser"] =
array(
191 "ALIAS" => $row[
"ALIAS"],
192 "DESCRIPTION" => $row[
"DESCRIPTION"],
193 "INTERESTS" => $row[
"INTERESTS"],
197 $row[
"BlogUser"][
"DATE_REG"] =
FormatDate(
"FULL", $row[
"DATE_REG"]->getTimestamp());
198 if($row[
"LAST_VISIT"])
199 $row[
"BlogUser"][
"LAST_VISIT"] =
FormatDate(
"FULL", $row[
"LAST_VISIT"]->getTimestamp());
200 $row[
"BlogUser"][
"ID"] = $row[
"ID"];
201 $row[
"BlogUser"][
"USER_ID"] = $row[
"USER_ID"];
202 $row[
"BlogUser"][
"AVATAR"] = $row[
"AVATAR"];
203 $row[
"BlogUser"][
"ALLOW_POST"] = $row[
"ALLOW_POST"];
206 $row[
"BlogUser"][
"AVATAR_file"] = intval($row[
"AVATAR"]) > 0 ?
207 \CFile::GetFileArray($row[
"AVATAR"]) :
208 \CFile::GetFileArray($row[
"BLOG_INTERNALS_BLOG_USER_USER_PERSONAL_PHOTO"]);
209 if ($row[
"BlogUser"][
"AVATAR_file"] !==
false)
211 foreach ($this->avatarSizes as
$key => $avatarSize)
213 $row[
"BlogUser"][
"Avatar_resized"][$avatarSize[
'WIDTH'] .
'_' . $avatarSize[
'HEIGHT']] = \CFile::ResizeImageGet(
214 $row[
"BlogUser"][
"AVATAR_file"],
215 array(
"width" => $avatarSize[
'WIDTH'],
"height" => $avatarSize[
'HEIGHT']),
219 $row[
"BlogUser"][
"AVATAR_img"][$avatarSize[
'WIDTH'] .
'_' . $avatarSize[
'HEIGHT']] = \CFile::ShowImage(
220 $row[
"BlogUser"][
"Avatar_resized"][$avatarSize[
'WIDTH'] .
'_' . $avatarSize[
'HEIGHT']][
"src"],
221 $avatarSize[
'WIDTH'],
222 $avatarSize[
'HEIGHT'],
223 "border=0 align='right'"
231 $row[
"BLOG_INTERNALS_BLOG_USER_USER_NAME"],
232 $row[
"BLOG_INTERNALS_BLOG_USER_USER_LAST_NAME"],
233 $row[
"BLOG_INTERNALS_BLOG_USER_USER_LOGIN"]
235 $row[
"~AUTHOR_NAME"] = htmlspecialcharsex($row[
"AUTHOR_NAME"]);
238 $row[
"arUser"] =
array(
239 "ID" => $row[
"USER_ID"],
240 "NAME" => $row[
"BLOG_INTERNALS_BLOG_USER_USER_NAME"],
241 "LAST_NAME" => $row[
"BLOG_INTERNALS_BLOG_USER_USER_LAST_NAME"],
242 "LOGIN" => $row[
"BLOG_INTERNALS_BLOG_USER_USER_LOGIN"],
244 $row[
"arUser"] = \CBlogTools::htmlspecialcharsExArray($row[
"arUser"]);
247 $result[$row[
"arUser"][
'ID']] = $row;
251 if (!empty($notExistingUsersIds))
252 $result =
$result + $this->addNotExistingUsers($notExistingUsersIds);
258 private function addNotExistingUsers($ids =
array())
263 $rsUsers = \CUser::GetList(
266 array(
'ID' => implode(
'|', $ids)),
267 array(
'FIELDS' =>
array(
'ID',
'DATE_REGISTER'))
270 while (
$user = $rsUsers->Fetch())
274 if (!
is_set(
$user,
"DATE_REGISTER") || (!
$DB->IsDate(
$user[
"DATE_REGISTER"],
false, LANG,
"FULL")))
275 $user[
"DATE_REGISTER"] =
new DateTime();
277 $resId = \CBlogUser::Add(
279 'USER_ID' =>
$user[
'ID'],
280 'DATE_REG' =>
$user[
"DATE_REGISTER"],
287 throw new SystemException($ex->GetString());
291 return $this->getUsersFromDB($ids);
304 $postId = intval($postId);
308 while (
$comment = $resComment->Fetch())
325 $blogId = intval($blogId);
329 while (
$post = $resPost->Fetch())
330 if (
$post[
"AUTHOR_ID"])
353 while (
$post = $resPost->Fetch())
354 if (
$post[
"AUTHOR_ID"])
376 $canUseAlias = \COption::GetOptionString(
"blog",
"allow_alias",
"Y");
377 if ($canUseAlias ==
"Y")
383 \CSite::GetNameFormat(
false),
385 "LAST_NAME" => $lastName,
386 "SECOND_NAME" => $secondName,
401 $canUseAlias = \COption::GetOptionString(
"blog",
"allow_alias",
"Y");
402 if ($canUseAlias ==
"Y")
408 $params[
"NAME_TEMPLATE"] =
$params[
"NAME_TEMPLATE"] ?
$params[
"NAME_TEMPLATE"] : \CSite::GetNameFormat();
409 $params[
"NAME_TEMPLATE"] = str_replace(
410 array(
"#NOBR#",
"#/NOBR#"),
414 $isUseLogin = (
$params[
"SHOW_LOGIN"] ??
null) !=
"N" ?
true :
false;
437 if (!$agreementId || $agreementId <= 0)
442 $request = Application::getInstance()->getContext()->getRequest();
444 $urlDir = pathinfo(
$url);
445 $urlDir = $urlDir[
'dirname'];
449 "%=URL" =>
"%$urlDir%",
450 "=AGREEMENT_ID" => $agreementId,
453 $isGivenAgreement =
false;
455 if ($consents->fetch())
456 $isGivenAgreement =
true;
458 return $isGivenAgreement;
476 return \CBlogUser::delete(
$userId);
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
static getPostAuthorsIdsByBlogId($blogId)
static GetUserNameEx($user, $blogUser, $params)
static cleanCache($blogId=NULL)
static getPostAuthorsIdsByDbFilter($arFilter)
__construct($cacheTime=0)
static GetUserName($alias, $name, $lastName, $login, $secondName="")
static onUserDelete($userId=NULL)
static getCommentAuthorsIdsByPostId($postId)
addAvatarSize($width, $height, $key="")
static isUserGivenConsent($userId, $agreementId)
static deleteByEntity($value='')
static getList(array $parameters=array())
static GetList( $arOrder=["ID"=> "DESC"], $arFilter=[], $arGroupBy=false, $arNavStartParams=false, $arSelectFields=[])
static htmlspecialcharsExArray($array)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
const BX_RESIZE_IMAGE_EXACT
FormatDate($format="", $timestamp=false, $now=false, ?string $languageId=null)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']