本文整理汇总了PHP中CForumUser::GetFormattedNameByUserID方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumUser::GetFormattedNameByUserID方法的具体用法?PHP CForumUser::GetFormattedNameByUserID怎么用?PHP CForumUser::GetFormattedNameByUserID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumUser
的用法示例。
在下文中一共展示了CForumUser::GetFormattedNameByUserID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetUserName
function GetUserName($USER_ID, $sNameTemplate = "")
{
$sNameTemplate = str_replace(array("#NOBR#", "#/NOBR#"), "", !empty($sNameTemplate) ? $sNameTemplate : CSite::GetDefaultNameFormat());
if (intval($USER_ID) <= 0) {
$db_res = CUser::GetByLogin($USER_ID);
$ar_res = $db_res->Fetch();
$USER_ID = $ar_res["ID"];
}
return CForumUser::GetFormattedNameByUserID($USER_ID, $sNameTemplate);
}
示例2: htmlspecialcharsbx
$userRec[$key] = htmlspecialcharsbx($val);
}
}
$userRec["FULL_NAME"] = CForumUser::GetFormattedNameByUserID($arParams["UID"], $arParams["NAME_TEMPLATE"], $userRec);
if ($USER->IsAuthorized()) {
$db_userY = CUser::GetByID($USER->GetID());
if ($db_userY) {
$userSend = $db_userY->GetNext();
}
$db_res = CForumUser::GetByUSER_ID($USER->GetID());
if ($db_res) {
while (list($key, $val) = each($db_res)) {
$userSend[$key] = htmlspecialcharsbx($val);
}
}
$userSend["FULL_NAME"] = CForumUser::GetFormattedNameByUserID($USER->GetID(), $arParams["NAME_TEMPLATE"], $userSend);
$userSend["E-MAIL"] = $arParams["TYPE"] == "ICQ" ? $userSend["PERSONAL_ICQ"] : $USER->GetEmail();
$arResult["CURRENT_USER"] = $userSend;
}
/********************************************************************
/Default params
********************************************************************/
/********************************************************************
Action
********************************************************************/
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["ACTION"] == "SEND" && check_bitrix_sessid()) {
$userSend["FULL_NAME"] = trim(empty($userSend["FULL_NAME"]) ? $_POST["NAME"] : $userSend["FULL_NAME"]);
$userSend["E-MAIL"] = trim(empty($userSend["E-MAIL"]) ? $_POST["EMAIL"] : $userSend["E-MAIL"]);
// Use captcha
if ($arParams["SEND_" . strToUpper($arParams["TYPE"])] < "Y" && !$USER->IsAuthorized()) {
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/captcha.php";
示例3: array
$arResult["VOTE_ACTION"] = "UNVOTE";
$arResult["URL"]["~VOTE"] = $APPLICATION->GetCurPageParam("CANCEL_VOTE=Y&VOTE_USER=Y", array("sessid", "VOTE_USER", "VOTES", "CANCEL_VOTE"));
} else {
$arResult["VOTE_ACTION"] = "VOTE";
$arResult["URL"]["~VOTE"] = $APPLICATION->GetCurPageParam("VOTE_USER=Y", array("sessid", "VOTE_USER", "VOTES", "CANCEL_VOTE"));
}
$arResult["URL"]["VOTE"] = $arResult["URL"]["~VOTE"] . "&" . bitrix_sessid_get();
}
/*******************************************************************/
if (!empty($arResult["FORUM_USER"]["DATE_REG"])) {
$arResult["FORUM_USER"]["DATE_REG_FORMATED"] = CForumFormat::DateFormat($arParams["DATE_FORMAT"], MakeTimeStamp($arResult["FORUM_USER"]["DATE_REG"], CSite::GetDateFormat()));
}
if (!empty($arResult["FORUM_USER"]["LAST_VISIT"])) {
$arResult["FORUM_USER"]["LAST_VISIT_FORMATED"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arResult["FORUM_USER"]["LAST_VISIT"], CSite::GetDateFormat()));
}
$arResult["~SHOW_NAME"] = CForumUser::GetFormattedNameByUserID($arResult["USER"]["ID"], $arParams["NAME_TEMPLATE"], array("SHOW_NAME" => $arResult["FORUM_USER"]["SHOW_NAME"], "LOGIN" => $arResult["USER"]["~LOGIN"], "NAME" => $arResult["USER"]["~NAME"], "SECOND_NAME" => $arResult["USER"]["~SECOND_NAME"], "LAST_NAME" => $arResult["USER"]["~LAST_NAME"]));
$arResult["SHOW_NAME"] = htmlspecialcharsEx($arResult["~SHOW_NAME"]);
$arResult["SHOW_EDIT_PROFILE_TITLE"] = intVal($USER->GetID()) != $arParams["UID"] ? GetMessage("F_EDIT_THIS_PROFILE") : GetMessage("F_EDIT_YOUR_PROFILE");
$arResult["SHOW_EDIT_PROFILE_TITLE_BOTTOM"] = (intVal($USER->GetID()) != $arParams["UID"] ? GetMessage("F_TO_CHANGE2") : GetMessage("F_TO_CHANGE3")) . " " . GetMessage("F_TO_CHANGE4");
if (strlen($arResult["USER"]["PERSONAL_WWW"]) > 0) {
$arResult["USER"]["PERSONAL_WWW_FORMATED"] = $arResult["USER"]["PERSONAL_WWW"];
$strBValueTmp = substr($arResult["USER"]["PERSONAL_WWW_FORMATED"], 0, 6);
if ($strBValueTmp != "http:/" && $strBValueTmp != "https:" && $strBValueTmp != "ftp://") {
$arResult["USER"]["PERSONAL_WWW_FORMATED"] = "http://" . $arResult["USER"]["PERSONAL_WWW_FORMATED"];
}
$arResult["USER"]["PERSONAL_WWW"] = "<noindex><a rel=\"nofollow\" href=\"" . $arResult["USER"]["PERSONAL_WWW_FORMATED"] . "\" target=\"_blank\">" . $arResult["USER"]["PERSONAL_WWW_FORMATED"] . "</a></noindex>";
}
if (strlen($arResult["USER"]["WORK_WWW"]) > 0) {
$arResult["USER"]["WORK_WWW_FORMATED"] = $arResult["USER"]["WORK_WWW"];
$strBValueTmp = substr($arResult["USER"]["WORK_WWW_FORMATED"], 0, 6);
if ($strBValueTmp != "http:/" && $strBValueTmp != "https:" && $strBValueTmp != "ftp://") {
示例4: Fetch
function Fetch()
{
global $DB;
$arFields = array();
if ($res = parent::Fetch()) {
if (COption::GetOptionString("forum", "MESSAGE_HTML", "N") == "Y" || COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
$res["POST_MESSAGE_HTML"] = trim($res["POST_MESSAGE_HTML"]);
$res["POST_MESSAGE_FILTER"] = trim($res["POST_MESSAGE_FILTER"]);
if (empty($res["POST_MESSAGE_HTML"]) && COption::GetOptionString("forum", "MESSAGE_HTML", "N") == "Y" || empty($res["POST_MESSAGE_FILTER"]) && COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
$arForum = CForumNew::GetByID($res["FORUM_ID"]);
if (COption::GetOptionString("forum", "FILTER", "Y") == "Y" && empty($res["POST_MESSAGE_FILTER"])) {
$arFields["POST_MESSAGE_FILTER"] = CFilterUnquotableWords::Filter($res["POST_MESSAGE"]);
$arFields["POST_MESSAGE_FILTER"] = empty($arFields["POST_MESSAGE_FILTER"]) ? "*" : $arFields["POST_MESSAGE_FILTER"];
}
if (COption::GetOptionString("forum", "MESSAGE_HTML", "N") == "Y" && empty($res["POST_MESSAGE_HTML"])) {
/* Info about one file is saved in old table field ATTACH_IMG */
$arFiles = false;
if (intval($res["ATTACH_IMG"]) > 0) {
$arFiles = array();
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), array("MESSAGE_ID" => $res["ID"]));
if ($db_files && ($res_file = $db_files->Fetch())) {
do {
$res_file["SRC"] = CFile::GetFileSRC($res);
$arFiles[$res_file["ID"]] = $res_file;
} while ($res_file = $db_files->Fetch());
}
}
$parser = new forumTextParser(LANGUAGE_ID);
$allow = forumTextParser::GetFeatures($arForum);
$allow['SMILES'] = $res["USE_SMILES"] == "Y" ? $allow['SMILES'] : "N";
$POST_MESSAGE_HTML = is_set($arFields, "POST_MESSAGE_FILTER") ? $arFields["POST_MESSAGE_FILTER"] : $res["POST_MESSAGE"];
$arFields["POST_MESSAGE_HTML"] = $parser->convert($POST_MESSAGE_HTML, $allow, "html", $arFiles);
}
$strUpdate = $DB->PrepareUpdate("b_forum_message", $arFields);
$strSql = "UPDATE b_forum_message SET " . $strUpdate . " WHERE ID = " . intVal($res["ID"]);
if ($DB->QueryBind($strSql, $arFields, false, "File: " . __FILE__ . "<br>Line: " . __LINE__)) {
foreach ($arFields as $key => $val) {
$res[$key] = $val;
}
}
}
}
if (COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
if (is_set($res, "HTML") || is_set($res, "FM_HTML")) {
$arr = @unserialize(is_set($res, "HTML") ? $res["HTML"] : $res["FM_HTML"]);
if (empty($arr) || !is_array($arr)) {
$arr = array("AUTHOR_NAME" => $res["AUTHOR_NAME"], "AUTHOR_EMAIL" => $res["AUTHOR_EMAIL"], "EDITOR_NAME" => $res["EDITOR_NAME"], "EDITOR_EMAIL" => $res["EDITOR_EMAIL"], "EDIT_REASON" => $res["EDIT_REASON"]);
foreach ($arr as $key => $val) {
if (!empty($val)) {
$val = CFilterUnquotableWords::Filter($val);
$arr[$key] = empty($val) ? "*" : $val;
} else {
$arr[$key] = '';
}
}
$arFields = array("HTML" => serialize($arr));
$strUpdate = $DB->PrepareUpdate("b_forum_message", $arFields);
$strSql = "UPDATE b_forum_message SET " . $strUpdate . " WHERE ID = " . intVal($res["ID"]);
$DB->QueryBind($strSql, $arFields, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
foreach ($arr as $key => $val) {
$res["~" . $key] = $res[$key];
$res["" . $key] = $val;
}
}
if (!empty($res["FT_HTML"])) {
$arr = @unserialize($res["FT_HTML"]);
if (is_array($arr) && !empty($arr["TITLE"])) {
foreach ($arr as $key => $val) {
$res["~FT_" . $key] = $res["FT_" . $key];
$res["FT_" . $key] = $val;
}
}
}
if (!empty($res["F_HTML"])) {
$arr = @unserialize($res["F_HTML"]);
if (is_array($arr)) {
foreach ($arr as $key => $val) {
$res["~F_" . $key] = $res["F_" . $key];
$res["F_" . $key] = $val;
}
}
if (!empty($res["FT_TITLE"])) {
$res["F_TITLE"] = $res["FT_TITLE"];
}
}
}
if (!empty($this->sNameTemplate)) {
$arTmp = array();
foreach (array("AUTHOR_ID" => "AUTHOR_NAME", "EDITOR_ID" => "EDITOR_NAME", "USER_START_ID" => "USER_START_NAME") as $id => $name) {
if (array_key_exists($id, $res)) {
$tmp = "";
if (!empty($res[$id])) {
if (in_array($res[$id], $arTmp)) {
$tmp = $arTmp[$res[$id]];
} else {
$arTmp[$res[$id]] = $tmp = !empty($res[$name . "_FRMT"]) ? $res[$name . "_FRMT"] : CForumUser::GetFormattedNameByUserID($res[$id], $this->sNameTemplate, $id == "AUTHOR_ID" ? $res : array());
}
}
$res[$name] = !empty($tmp) ? $tmp : $res[$name];
//.........这里部分代码省略.........
示例5: Fetch
function Fetch()
{
global $DB;
if ($res = parent::Fetch()) {
if (COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
if (strLen(trim($res["HTML"])) > 0) {
$arr = unserialize($res["HTML"]);
if (is_array($arr) && count($arr) > 0) {
$res["LAST_POSTER_NAME"] = $arr["LAST_POSTER_NAME"];
}
}
if (strLen(trim($res["TOPIC_HTML"])) > 0) {
$arr = unserialize($res["TOPIC_HTML"]);
if (is_array($arr) && is_set($arr, "TITLE")) {
$res["TITLE"] = $arr["TITLE"];
}
}
if (strLen(trim($res["ABS_TOPIC_HTML"])) > 0) {
$arr = unserialize($res["ABS_TOPIC_HTML"]);
if (is_array($arr)) {
if (is_set($arr, "TITLE")) {
$res["ABS_TITLE"] = $arr["TITLE"];
}
if (is_set($arr, "ABS_LAST_POSTER_NAME")) {
$res["ABS_LAST_POSTER_NAME"] = $arr["ABS_LAST_POSTER_NAME"];
}
}
}
}
if (!empty($this->sNameTemplate)) {
$arTmp = array();
foreach (array("LAST_POSTER_ID" => "LAST_POSTER_NAME", "ABS_LAST_POSTER_ID" => "ABS_LAST_POSTER_NAME") as $id => $name) {
$tmp = "";
if (!empty($res[$id])) {
if (in_array($res[$id], $arTmp)) {
$tmp = $arTmp[$res[$id]];
} else {
$arTmp[$res[$id]] = $tmp = !empty($res[$name . "_FRMT"]) ? $res[$name . "_FRMT"] : CForumUser::GetFormattedNameByUserID($res[$id], $this->sNameTemplate);
}
}
$res[$name] = !empty($tmp) ? $tmp : $res[$name];
}
}
}
return $res;
}
示例6: Fetch
function Fetch()
{
global $DB;
if ($res = parent::Fetch()) {
if (COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
if (!empty($res["HTML"])) {
$arr = unserialize($res["HTML"]);
if (is_array($arr) && is_set($arr, "TITLE")) {
foreach ($arr as $key => $val) {
if (strLen($val) > 0) {
$res[$key] = $val;
}
}
}
}
if (!empty($res["F_HTML"])) {
$arr = unserialize($res["F_HTML"]);
if (is_array($arr)) {
foreach ($arr as $key => $val) {
$res["F_" . $key] = $val;
}
}
if (!empty($res["TITLE"])) {
$res["F_TITLE"] = $res["TITLE"];
}
}
}
/* For CForumUser::UserAddInfo only */
if (is_set($res, "FIRST_POST") || is_set($res, "LAST_POST")) {
$arSqlSearch = array();
if (is_set($res, "FIRST_POST")) {
$arSqlSearch["FIRST_POST"] = "FM.ID=" . intVal($res["FIRST_POST"]);
}
if (is_set($res, "LAST_POST")) {
$arSqlSearch["LAST_POST"] = "FM.ID=" . intVal($res["LAST_POST"]);
}
if (!empty($arSqlSearch)) {
$strSql = "SELECT FM.ID, " . $DB->DateToCharFunction("FM.POST_DATE", "FULL") . " AS POST_DATE " . "FROM b_forum_message FM WHERE " . implode(" OR ", $arSqlSearch);
$db_res = $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
if ($db_res && ($val = $db_res->Fetch())) {
do {
if (is_set($res, "FIRST_POST") && $res["FIRST_POST"] == $val["ID"]) {
$res["FIRST_POST_DATE"] = $val["POST_DATE"];
}
if (is_set($res, "LAST_POST") && $res["LAST_POST"] == $val["ID"]) {
$res["LAST_POST_DATE"] = $val["POST_DATE"];
}
} while ($val = $db_res->Fetch());
}
}
}
if (!empty($this->sNameTemplate)) {
$arTmp = array();
foreach (array("USER_START_ID" => "USER_START_NAME", "LAST_POSTER_ID" => "LAST_POSTER_NAME", "ABS_LAST_POSTER_ID" => "ABS_LAST_POSTER_NAME") as $id => $name) {
$tmp = "";
if (!empty($res[$id])) {
if (in_array($res[$id], $arTmp)) {
$tmp = $arTmp[$res[$id]];
} else {
$arTmp[$res[$id]] = $tmp = !empty($res[$name . "_FRMT"]) ? $res[$name . "_FRMT"] : CForumUser::GetFormattedNameByUserID($res[$id], $this->sNameTemplate);
}
}
$res[$name] = !empty($tmp) ? $tmp : $res[$name];
}
}
}
return $res;
}