• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CForumFiles类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CForumFiles的典型用法代码示例。如果您正苦于以下问题:PHP CForumFiles类的具体用法?PHP CForumFiles怎么用?PHP CForumFiles使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CForumFiles类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __FPF_AddEntityInForumFiles

 function __FPF_AddEntityInForumFiles(&$arCustomFile, $arParams = null)
 {
     static $arFileParams = array();
     if ($arParams !== null) {
         $arFileParams = $arParams;
     }
     $arFiles = array(array("FILE_ID" => $arCustomFile["fileID"]));
     if (!is_array($arCustomFile) || !isset($arCustomFile['fileID'])) {
         return false;
     } elseif (!CForumFiles::CheckFields($arFiles, $arFileParams, "NOT_CHECK_DB")) {
         $ex = $GLOBALS["APPLICATION"]->GetException();
         return $ex ? $ex->GetString() : "File upload error.";
     } elseif (!empty($arFiles)) {
         $GLOBALS["APPLICATION"]->RestartBuffer();
         CForumFiles::Add($arCustomFile['fileID'], $arFileParams);
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:17,代码来源:result_modifier.php


示例2: OnCommentPreview

 function OnCommentPreview()
 {
     $arResult =& $this->component->arResult;
     $arParams =& $this->component->arParams;
     $arError = array();
     $arFields = array("FORUM_ID" => intVal($arParams["FORUM_ID"]), "TOPIC_ID" => 0, "MESSAGE_ID" => 0, "USER_ID" => intVal($GLOBALS["USER"]->GetID()));
     $arFiles = array();
     $arFilesExists = array();
     $res = array();
     foreach ($_FILES as $key => $val) {
         if (substr($key, 0, strLen("FILE_NEW")) == "FILE_NEW" && !empty($val["name"])) {
             $arFiles[] = $_FILES[$key];
         }
     }
     foreach ($_REQUEST["FILES"] as $key => $val) {
         if (!in_array($val, $_REQUEST["FILES_TO_UPLOAD"])) {
             $arFiles[$val] = array("FILE_ID" => $val, "del" => "Y");
             unset($_REQUEST["FILES"][$key]);
             unset($_REQUEST["FILES_TO_UPLOAD"][$key]);
         } else {
             $arFilesExists[$val] = array("FILE_ID" => $val);
         }
     }
     if (!empty($arFiles)) {
         $res = CForumFiles::Save($arFiles, $arFields);
         $res1 = $GLOBALS['APPLICATION']->GetException();
         if ($res1) {
             $arError[] = array("code" => "file upload error", "title" => $res1->GetString());
         }
     }
     $res = is_array($res) ? $res : array();
     foreach ($res as $key => $val) {
         $arFilesExists[$key] = $val;
     }
     $arFilesExists = array_keys($arFilesExists);
     sort($arFilesExists);
     $arResult["MESSAGE_VIEW"]["FILES"] = $_REQUEST["FILES"] = $arFilesExists;
     $arResult["REVIEW_FILES"] = array();
     foreach ($_REQUEST["FILES"] as $key => $val) {
         $arResult["REVIEW_FILES"][$val] = CFile::GetFileArray($val);
     }
     if (!empty($arError)) {
         $arResult['ERROR'] = $arError;
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:45,代码来源:files.php


示例3: prepareFields

 private function prepareFields(array &$params, ErrorCollection $errorCollectionParam)
 {
     $result = array("FORUM_ID" => $this->topic["FORUM_ID"], "TOPIC_ID" => $this->topic["ID"], "POST_MESSAGE" => trim($params["POST_MESSAGE"]), "AUTHOR_ID" => $params["AUTHOR_ID"], "AUTHOR_NAME" => trim($params["AUTHOR_NAME"]), "AUTHOR_EMAIL" => trim($params["AUTHOR_EMAIL"]), "USE_SMILES" => $params["USE_SMILES"] == "Y" ? "Y" : "N", "APPROVED" => $this->topic["APPROVED"], "XML_ID" => $this->getEntity()->getXmlId());
     $errorCollection = new ErrorCollection();
     if (strlen($result["POST_MESSAGE"]) <= 0) {
         $errorCollection->addOne(new Error(Loc::getMessage("FORUM_CM_ERR_EMPTY_TEXT"), self::ERROR_PARAMS_MESSAGE));
     }
     if (strlen($result["AUTHOR_NAME"]) <= 0 && $result["AUTHOR_ID"] > 0) {
         $result["AUTHOR_NAME"] = self::getUserName($result["AUTHOR_ID"]);
     }
     if (strlen($result["AUTHOR_NAME"]) <= 0) {
         $errorCollection->addOne(new Error(Loc::getMessage("FORUM_CM_ERR_EMPTY_AUTHORS_NAME"), self::ERROR_PARAMS_MESSAGE));
     }
     if (is_array($params["FILES"]) && in_array($this->forum["ALLOW_UPLOAD"], array("Y", "F", "A"))) {
         $result["FILES"] = array();
         foreach ($params["FILES"] as $key => $val) {
             if (intval($val["FILE_ID"]) > 0) {
                 $val["del"] = $val["del"] == "Y" ? "Y" : "";
             }
             $result["FILES"][$key] = $val;
         }
         $res = array("FORUM_ID" => $this->forum["ID"], "TOPIC_ID" => $this->topic["ID"], "MESSAGE_ID" => 0, "USER_ID" => $result["AUTHOR_ID"], "FORUM" => $this->forum);
         if (!\CForumFiles::CheckFields($result["FILES"], $res, "NOT_CHECK_DB")) {
             $text = "File upload error.";
             if (($ex = $this->getApplication()->getException()) && $ex) {
                 $text = $ex->getString();
             }
             $errorCollection->addOne(new Error($text, self::ERROR_PARAMS_MESSAGE));
         }
     }
     if ($result["APPROVED"] != "N") {
         $result["APPROVED"] = $this->forum["MODERATION"] != "Y" || $this->getEntity()->canModerate() ? "Y" : "N";
     }
     if ($errorCollection->hasErrors()) {
         $errorCollectionParam->add($errorCollection->toArray());
         return false;
     } else {
         $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("FORUM_MESSAGE", $result);
         $params = $result;
         return true;
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:42,代码来源:comment.php


示例4: ForumMoveMessage


//.........这里部分代码省略.........
            if ($db_res && ($res = $db_res->Fetch())) {
                $arRes["NAME"] = $res["AUTHOR_NAME"];
                $arRes["ID"] = $res["AUTHOR_ID"];
            }
            $arFieldsTopic = array("TITLE" => $arFields["TITLE"], "TITLE_SEO" => $arFields["TITLE_SEO"], "DESCRIPTION" => $arFields["DESCRIPTION"], "ICON" => $arFields["ICON"], "TAGS" => $arFields["TAGS"], "FORUM_ID" => $FID, "USER_START_ID" => $arRes["ID"], "USER_START_NAME" => $arRes["NAME"], "LAST_POSTER_NAME" => $arRes["NAME"], "LAST_POSTER_ID" => $arRes["ID"], "APPROVED" => $arFields["APPROVED"]);
            $NewTID = CForumTopic::Add($arFieldsTopic);
            if (IntVal($NewTID) <= 0) {
                $arError[] = GetMessage("FMM_NO_TOPIC_NOT_CREATED");
            } else {
                $arNewTopic = CForumTopic::GetByID($NewTID);
                if ($arNewTopic) {
                    $NewFID = $FID;
                    $arNewForum = $arForum;
                    $SendSubscribe = true;
                } else {
                    $arError[] = GetMessage("FMM_NO_TOPIC_NOT_CREATED");
                }
            }
        }
    }
    if (count($arError) <= 0) {
        // Move message
        $db_res = CForumMessage::GetList(array(), array("@ID" => implode(",", $Message), "TOPIC_ID" => $TID));
        if ($db_res && ($res = $db_res->Fetch())) {
            do {
                //				echo "NewFID: ".$NewFID." -- FID:".$FID."<br/>";
                $arMessage = array();
                if ($NewFID != $FID) {
                    $arMessage["APPROVED"] = $arNewForum["MODERATION"] == "Y" ? "N" : "Y";
                    if ($arCurrUser["Perms"]["NewFID"] >= "Q") {
                        $arMessage["APPROVED"] = "Y";
                    }
                    $arMessage["FORUM_ID"] = $NewFID;
                    $arMessage["POST_MESSAGE_HTML"] = "";
                }
                if ($NewTID != $TID) {
                    $arMessage["NEW_TOPIC"] = "N";
                    $arMessage["TOPIC_ID"] = $NewTID;
                }
                if (count($arMessage) > 0) {
                    $MID = CForumMessage::Update($res["ID"], $arMessage, true);
                    $res_log = $SendSubscribe == true ? GetMessage("F_MESSAGE_WAS_MOVED_TO_NEW") : GetMessage("F_MESSAGE_WAS_MOVED");
                    $res_log = str_replace(array("#ID#", "#TOPIC_TITLE#", "#TOPIC_ID#", "#NEW_TOPIC_TITLE#", "#NEW_TOPIC_ID#"), array($MID, $arTopic["TITLE"], $arTopic["ID"], $arNewTopic['TITLE'], $arNewTopic['ID']), $res_log);
                    $res["TITLE"] = $arNewTopic['TITLE'];
                    $res["TOPIC_ID"] = $arNewTopic['ID'];
                    $res["beforeTITLE"] = $arTopic["TITLE"];
                    $res["DESCRIPTION"] = $res_log;
                    CForumEventLog::Log("message", "move", $MID, serialize($res));
                    $db_res2 = CForumFiles::GetList(array(), array("FILE_MESSAGE_ID" => $res["ID"]));
                    if ($db_res2 && ($res2 = $db_res2->Fetch())) {
                        $arFiles = array();
                        do {
                            $arFiles[] = $res2["FILE_ID"];
                        } while ($res2 = $db_res2->Fetch());
                        CForumFiles::UpdateByID($arFiles, $arMessage);
                    }
                    if (IntVal($MID) <= 0) {
                        $arError[] = str_replace("##", $res["ID"], GetMessage("FMM_NO_MESSAGE_MOVE"));
                        break;
                    }
                }
            } while ($res = $db_res->Fetch());
        }
    }
    if (count($arError) <= 0) {
        $db_res = CForumMessage::GetList(array(), array("TOPIC_ID" => $TID), false, 1);
        if (!($db_res && ($res = $db_res->Fetch()))) {
            CForumTopic::Delete($TID);
        } else {
            CForumTopic::SetStat($TID);
        }
        $db_res = CForumMessage::GetList(array(), array("TOPIC_ID" => $NewTID), false, 1);
        if (!($db_res && ($res = $db_res->Fetch()))) {
            CForumTopic::Delete($NewTID);
        } else {
            CForumTopic::SetStat($NewTID);
        }
        CForumNew::SetStat($FID);
        if ($NewFID != $FID) {
            CForumNew::SetStat($NewFID);
        }
    }
    if (count($arError) <= 0) {
        $DB->Commit();
    } else {
        $DB->Rollback();
    }
    if (count($arError) > 0) {
        $strErrorMessage .= implode(". \n", $arError) . ". \n";
    } else {
        $strOKMessage .= GetMessage("FMM_YES_MESSAGE_MOVE");
        if ($SendSubscribe) {
            foreach ($Message as $MID) {
                CForumMessage::SendMailMessage($MID, array(), false, "NEW_FORUM_MESSAGE");
            }
        }
        return true;
    }
    return false;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:include.php


示例5: OnCommentAdd

 function OnCommentAdd($entityType, $entityID, &$arPost)
 {
     global $USER;
     $arParams =& $this->component->arParams;
     $arResult =& $this->component->arResult;
     $arForum =& $arResult['FORUM'];
     $iFileSize = intval(COption::GetOptionString("forum", "file_max_size", 50000));
     $arCommentParams = array("FORUM_ID" => $arParams["FORUM_ID"], "TOPIC_ID" => null, "USER_ID" => $USER->IsAuthorized() ? $USER->GetID() : null);
     $arFiles = $arNewFiles = array();
     if (isset($_REQUEST['FILE_NEW']) && is_array($_REQUEST['FILE_NEW'])) {
         foreach ($_REQUEST['FILE_NEW'] as $val) {
             $arNewFiles[$val] = array("FILE_ID" => $val);
         }
     }
     if (isset($_REQUEST['FILES']) && is_array($_REQUEST['FILES'])) {
         foreach ($_REQUEST['FILES'] as $val) {
             if (in_array($val, $_REQUEST["FILES_TO_UPLOAD"])) {
                 $arFiles[$val] = array("FILE_ID" => $val);
             }
         }
     }
     if (!empty($arNewFiles)) {
         CForumFiles::Add(array_keys($arNewFiles), $arCommentParams);
     }
     $arFiles = $arFiles + $arNewFiles;
     if (!isset($arPost['FILES'])) {
         $arPost['FILES'] = array();
     }
     $arPost['FILES'] = array_merge($arPost['FILES'], $arFiles);
     foreach ($arPost['FILES'] as $fileIndex => $fileArr) {
         $fileID = $fileArr['FILE_ID'];
         $attach_file = CFile::MakeFileArray(intval($fileID));
         $attach = "";
         if ($attach_file && is_set($attach_file, "name")) {
             // Y - Image files		F - Files of specified type		A - All files
             if ($arForum["ALLOW_UPLOAD"] == "Y") {
                 $attach = CFile::CheckImageFile($attach_file, $iFileSize, 0, 0);
             } elseif ($arForum["ALLOW_UPLOAD"] == "F") {
                 $attach = CFile::CheckFile($attach_file, $iFileSize, false, $arForum["ALLOW_UPLOAD_EXT"]);
             } elseif ($arForum["ALLOW_UPLOAD"] == "A") {
                 $attach = CFile::CheckFile($attach_file, $iFileSize, false, false);
             }
             if ($attach != '') {
                 unset($arPost['FILES'][$fileIndex]);
                 $arPost['ERROR'] = $attach_file['name'] . ': ' . $attach;
                 return false;
             }
         }
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:50,代码来源:files_input.php


示例6: AddComment_Report_Forum

 public static function AddComment_Report_Forum($arFields, $FORUM_ID, $arLog)
 {
     global $USER, $DB;
     $mess_id = false;
     $dbReport = CTimeManReportFull::GetByID($arLog["SOURCE_ID"]);
     $arReport = $dbReport->Fetch();
     if (CModule::IncludeModule("forum") && $arReport) {
         $ufFileID = array();
         $ufDocID = array();
         if (!($userName = trim($USER->GetFormattedName(false)))) {
             $userName = $USER->GetLogin();
         }
         if (!$arReport["FORUM_TOPIC_ID"]) {
             $arTopicFields = array("TITLE" => $arReport["DATE_FROM"] . "-" . $arReport["DATE_TO"], "USER_START_ID" => $arFields["USER_ID"], "STATE" => "Y", "FORUM_ID" => $FORUM_ID, "USER_START_NAME" => $userName, "START_DATE" => ConvertTimeStamp(time(), "FULL"), "POSTS" => 0, "VIEWS" => 0, "APPROVED" => "Y", "LAST_POSTER_NAME" => $userName, "LAST_POST_DATE" => ConvertTimeStamp(time(), "FULL"), "LAST_MESSAGE_ID" => 0, "XML_ID" => "TIMEMAN_REPORT_" . $arLog["SOURCE_ID"]);
             $TOPIC_ID = CForumTopic::Add($arTopicFields);
             if ($TOPIC_ID) {
                 CTimeManReportFull::Update($arLog["SOURCE_ID"], array("FORUM_TOPIC_ID" => $TOPIC_ID));
             }
         } else {
             $TOPIC_ID = $arReport["FORUM_TOPIC_ID"];
         }
         if ($TOPIC_ID) {
             $arFieldsP = array("AUTHOR_ID" => $arFields["USER_ID"], "AUTHOR_NAME" => $userName, "POST_MESSAGE" => $arFields["TEXT_MESSAGE"], "FORUM_ID" => $FORUM_ID, "TOPIC_ID" => $TOPIC_ID, "APPROVED" => "Y", "PARAM2" => $arLog["SOURCE_ID"]);
             $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("SONET_COMMENT", $arTmp);
             if (is_array($arTmp)) {
                 if (array_key_exists("UF_SONET_COM_DOC", $arTmp)) {
                     $GLOBALS["UF_FORUM_MESSAGE_DOC"] = $arTmp["UF_SONET_COM_DOC"];
                 } elseif (array_key_exists("UF_SONET_COM_FILE", $arTmp)) {
                     $arFieldsP["FILES"] = array();
                     foreach ($arTmp["UF_SONET_COM_FILE"] as $file_id) {
                         $arFieldsP["FILES"][] = array("FILE_ID" => $file_id);
                     }
                 }
             }
             $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("FORUM_MESSAGE", $arFieldsP);
             $mess_id = CForumMessage::Add($arFieldsP);
             // get UF DOC value and FILE_ID there
             if ($mess_id > 0) {
                 $dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $mess_id));
                 while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch()) {
                     $ufFileID[] = $arAddedMessageFiles["FILE_ID"];
                 }
                 $ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $mess_id, LANGUAGE_ID);
             }
         }
     }
     return array("SOURCE_ID" => $mess_id, "UF" => array("FILE" => $ufFileID, "DOC" => $ufDocID));
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:48,代码来源:timeman_report_full.php


示例7: __deprecated_Add


//.........这里部分代码省略.........
         $arEmailUserIDs = array_unique(array_merge($arEmailUserIDs, $arTask["ACCOMPLICES"], $arTask["AUDITORS"]));
         $currentUserPos = array_search($givenUserId, $arEmailUserIDs);
         if ($currentUserPos !== false) {
             unset($arEmailUserIDs[$currentUserPos]);
         }
         $parser = new CTextParser();
         $parser->imageWidth = $imageWidth;
         $parser->imageHeight = $imageHeight;
         $parser->smiles = $arSmiles;
         $parser->allow = array("HTML" => $arForum["ALLOW_HTML"], "ANCHOR" => $arForum["ALLOW_ANCHOR"], "BIU" => $arForum["ALLOW_BIU"], "IMG" => "N", "VIDEO" => "N", "LIST" => $arForum["ALLOW_LIST"], "QUOTE" => $arForum["ALLOW_QUOTE"], "CODE" => $arForum["ALLOW_CODE"], "FONT" => $arForum["ALLOW_FONT"], "SMILES" => "N", "UPLOAD" => $arForum["ALLOW_UPLOAD"], "NL2BR" => $arForum["ALLOW_NL2BR"], "TABLE" => "Y");
         $arAllow = NULL;
         $MESSAGE = HTMLToTxt($parser->convertText($commentText, $arAllow));
         // remove [ url] for socialnetwork log
         $MESSAGE = preg_replace("/(\\s\\[\\s(http:\\/\\/|https:\\/\\/|ftp:\\/\\/))(.*?)(\\s\\])/is", "", $MESSAGE);
         $parser->allow = array("HTML" => 'Y', "ANCHOR" => 'Y', "BIU" => 'Y', "IMG" => "Y", "VIDEO" => "Y", "LIST" => 'N', "QUOTE" => 'Y', "CODE" => 'Y', "FONT" => 'Y', "SMILES" => "N", "UPLOAD" => 'N', "NL2BR" => 'N', "TABLE" => "Y");
         $message_notify = $parser->convertText($commentText);
         $arRecipientsIDs = CTaskNotifications::GetRecipientsIDs($arTask);
         // Instant Messages
         if (IsModuleInstalled("im") && CModule::IncludeModule("im") && sizeof($arRecipientsIDs)) {
             // this entire class is deprecated. disable edit message, add only here
             if ($MESSAGE_TYPE != 'EDIT') {
                 CTaskComments::sendAddMessage(array('ID' => $MID, 'POST_MESSAGE' => $message_notify), $arTask, $givenUserId, $arRecipientsIDs, array());
             }
         }
         $strURL = !empty($backPage) ? $backPage : $GLOBALS['APPLICATION']->GetCurPageParam("", array("IFRAME", "MID", "SEF_APPLICATION_CUR_PAGE_URL", BX_AJAX_PARAM_ID, "result"));
         $strURL = ForumAddPageParams($strURL, array("MID" => $MID, "result" => $arForum["MODERATION"] != "Y" || CForumNew::CanUserModerateForum($forumId, $arUserGroupArray) ? "reply" : "not_approved"), false, false);
         $outStrUrl = $strURL;
         // sonet log
         if (CModule::IncludeModule("socialnetwork")) {
             $dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "tasks", "SOURCE_ID" => $arTask["ID"]), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID", "TMP_ID"));
             if ($arRes = $dbRes->Fetch()) {
                 $log_id = $arRes["TMP_ID"];
                 $entity_type = $arRes["ENTITY_TYPE"];
                 $entity_id = $arRes["ENTITY_ID"];
             } else {
                 $entity_type = $arTask["GROUP_ID"] ? SONET_ENTITY_GROUP : SONET_ENTITY_USER;
                 $entity_id = $arTask["GROUP_ID"] ? $arTask["GROUP_ID"] : $arTask["CREATED_BY"];
                 $rsUser = CUser::GetByID($arTask["CREATED_BY"]);
                 if ($arUser = $rsUser->Fetch()) {
                     $arSoFields = array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "tasks", "LOG_DATE" => $arTask["CREATED_DATE"], "TITLE_TEMPLATE" => "#TITLE#", "TITLE" => htmlspecialcharsBack($arTask["~TITLE"]), "MESSAGE" => "", "TEXT_MESSAGE" => $strMsgNewTask, "MODULE_ID" => "tasks", "CALLBACK_FUNC" => false, "SOURCE_ID" => $arTask["ID"], "ENABLE_COMMENTS" => "Y", "USER_ID" => $arTask["CREATED_BY"], "URL" => CTaskNotifications::GetNotificationPath($arUser, $arTask["ID"]), "PARAMS" => serialize(array("TYPE" => "create")));
                     $log_id = CSocNetLog::Add($arSoFields, false);
                     if (intval($log_id) > 0) {
                         CSocNetLog::Update($log_id, array("TMP_ID" => $log_id));
                         $arRights = CTaskNotifications::__UserIDs2Rights(CTaskNotifications::GetRecipientsIDs($arTask, false));
                         if ($arTask["GROUP_ID"]) {
                             $arRights[] = "S" . SONET_ENTITY_GROUP . $arTask["GROUP_ID"];
                         }
                         CSocNetLogRights::Add($log_id, $arRights);
                     }
                 }
             }
             if (intval($log_id) > 0) {
                 $sText = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"];
                 CSocNetLog::Update($log_id, array('PARAMS' => serialize(array('TYPE' => 'comment'))));
                 $arFieldsForSocnet = array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "tasks_comment", "MESSAGE" => $sText, "TEXT_MESSAGE" => $parser->convert4mail($sText), "URL" => str_replace("?IFRAME=Y", "", str_replace("&IFRAME=Y", "", str_replace("IFRAME=Y&", "", $strURL))), "MODULE_ID" => "tasks", "SOURCE_ID" => $MID, "LOG_ID" => $log_id, "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => $MID);
                 if ($MESSAGE_TYPE == "EDIT") {
                     $dbRes = CSocNetLogComments::GetList(array("ID" => "DESC"), array("EVENT_ID" => array("tasks_comment"), "SOURCE_ID" => $MID), false, false, array("ID"));
                     while ($arRes = $dbRes->Fetch()) {
                         CSocNetLogComments::Update($arRes["ID"], $arFieldsForSocnet);
                     }
                 } else {
                     $arFieldsForSocnet['USER_ID'] = $givenUserId;
                     $arFieldsForSocnet['=LOG_DATE'] = $GLOBALS['DB']->CurrentTimeFunction();
                     $ufFileID = array();
                     $dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $MID));
                     while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch()) {
                         $ufFileID[] = $arAddedMessageFiles["FILE_ID"];
                     }
                     if (count($ufFileID) > 0) {
                         $arFieldsForSocnet["UF_SONET_COM_FILE"] = $ufFileID;
                     }
                     $ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $MID, LANGUAGE_ID);
                     if ($ufDocID) {
                         $arFieldsForSocnet["UF_SONET_COM_DOC"] = $ufDocID;
                     }
                     $ufDocVer = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_VER", $MID, LANGUAGE_ID);
                     if ($ufDocVer) {
                         $arFieldsForSocnet["UF_SONET_COM_VER"] = $ufDocVer;
                     }
                     if (isset($arFieldsAdditional["ANCILLARY"]) && $arFieldsAdditional["ANCILLARY"]) {
                         CSocNetLogComments::Add($arFieldsForSocnet, false, false, false);
                     } else {
                         $comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
                         CSocNetLog::CounterIncrement($comment_id, false, false, "LC");
                     }
                 }
             }
         }
         $occurAsUserId = CTasksTools::getOccurAsUserId();
         if (!$occurAsUserId) {
             $occurAsUserId = $arMessage["AUTHOR_ID"] ? $arMessage["AUTHOR_ID"] : 1;
         }
         // Tasks log
         $arLogFields = array("TASK_ID" => $arTask["ID"], "USER_ID" => $occurAsUserId, "CREATED_DATE" => $arMessage["EDIT_DATE"] ? ConvertTimeStamp(MakeTimeStamp($arMessage["EDIT_DATE"], CSite::GetDateFormat()), "FULL") : $arMessage["POST_DATE"], "FIELD" => "COMMENT", "TO_VALUE" => $MID);
         $log = new CTaskLog();
         $log->Add($arLogFields);
     }
     return $MID;
     // Message id
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:taskcomments.php


示例8: AddComment_Calendar

 public static function AddComment_Calendar($arFields)
 {
     global $DB;
     if (!CModule::IncludeModule("forum")) {
         return false;
     }
     $ufFileID = array();
     $ufDocID = array();
     $dbResult = CSocNetLog::GetList(array(), array("ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "SITE_ID"));
     if ($arLog = $dbResult->Fetch()) {
         $arCalendarEvent = CCalendarEvent::GetById($arLog["SOURCE_ID"]);
         if ($arCalendarEvent) {
             $arCalendarSettings = CCalendar::GetSettings();
             $forumID = $arCalendarSettings["forum_id"];
             if ($forumID) {
                 $arFilter = array("FORUM_ID" => $forumID, "XML_ID" => "EVENT_" . $arLog["SOURCE_ID"]);
                 $dbTopic = CForumTopic::GetList(null, $arFilter);
                 if ($dbTopic && ($arTopic = $dbTopic->Fetch())) {
                     $topicID = $arTopic["ID"];
                 } else {
                     $topicID = 0;
                 }
                 $currentUserId = CCalendar::GetCurUserId();
                 $strPermission = $currentUserId == $arCalendarEvent["OWNER_ID"] ? "Y" : "M";
                 $arFieldsMessage = array("POST_MESSAGE" => $arFields["TEXT_MESSAGE"], "USE_SMILES" => "Y", "PERMISSION_EXTERNAL" => "Q", "PERMISSION" => $strPermission, "APPROVED" => "Y");
                 if ($topicID === 0) {
                     $arFieldsMessage["TITLE"] = "EVENT_" . $arLog["SOURCE_ID"];
                     $arFieldsMessage["TOPIC_XML_ID"] = "EVENT_" . $arLog["SOURCE_ID"];
                 }
                 $arTmp = false;
                 $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("SONET_COMMENT", $arTmp);
                 if (is_array($arTmp)) {
                     if (array_key_exists("UF_SONET_COM_DOC", $arTmp)) {
                         $GLOBALS["UF_FORUM_MESSAGE_DOC"] = $arTmp["UF_SONET_COM_DOC"];
                     } elseif (array_key_exists("UF_SONET_COM_FILE", $arTmp)) {
                         $arFieldsMessage["FILES"] = array();
                         foreach ($arTmp["UF_SONET_COM_FILE"] as $file_id) {
                             $arFieldsMessage["FILES"][] = array("FILE_ID" => $file_id);
                         }
                     }
                 }
                 $messageID = ForumAddMessage($topicID > 0 ? "REPLY" : "NEW", $forumID, $topicID, 0, $arFieldsMessage, $sError, $sNote);
                 // get UF DOC value and FILE_ID there
                 if ($messageID > 0) {
                     $messageUrl = CCalendar::GetPath("user", $arCalendarEvent["OWNER_ID"]);
                     $messageUrl = $messageUrl . (strpos($messageUrl, "?") === false ? "?" : "&") . "EVENT_ID=" . $arCalendarEvent["ID"] . "&MID=" . $messageID;
                     $dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $messageID));
                     while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch()) {
                         $ufFileID[] = $arAddedMessageFiles["FILE_ID"];
                     }
                     $ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $messageID, LANGUAGE_ID);
                 }
             }
         }
     }
     if (!$messageID) {
         $sError = GetMessage("EC_LF_ADD_COMMENT_SOURCE_ERROR");
     }
     return array("SOURCE_ID" => $messageID, "MESSAGE" => $arFieldsMessage ? $arFieldsMessage["POST_MESSAGE"] : false, "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => $messageID, "ERROR" => $sError, "NOTES" => $sNote, "UF" => array("FILE" => $ufFileID, "DOC" => $ufDocID), "URL" => $messageUrl);
 }
开发者ID:rasuldev,项目名称:torino,代码行数:60,代码来源:calendar_livefeed.php


示例9: array

}
$MESS = array();
$path = str_replace(array("\\", "//"), "/", dirname(__FILE__) . "/lang/" . LANGUAGE_ID . "/show_file.php");
include_once $path;
$MESS1 =& $MESS;
$GLOBALS["MESS"] = $MESS1 + $GLOBALS["MESS"];
CModule::IncludeModule("forum");
// ************************* Input params***************************************************************
// ************************* BASE **********************************************************************
$arParams = array("FILE_ID" => intval($_REQUEST["fid"]), "WIDTH" => intval($_REQUEST['width']), "HEIGHT" => intval($_REQUEST['height']), "ACTION" => $_REQUEST["action"] == "download" ? "download" : "view", "PERMISSION" => false);
// *************************/Input params***************************************************************
// ************************* Default params*************************************************************
$arResult = array("MESSAGE" => array(), "FILE" => array());
$arError = array();
if (intVal($arParams["FILE_ID"]) > 0) {
    $db_res = CForumFiles::GetList(array("ID" => "ASC"), array("FILE_ID" => $arParams["FILE_ID"]));
    if ($db_res && ($arResult["FILE"] = $db_res->GetNext())) {
        $res = CFile::GetFileArray($arParams["FILE_ID"]);
        if (!!$res) {
            $arResult["FILE"] += $res;
        }
    }
}
if (empty($arResult["FILE"])) {
    $arError = array("code" => "EMPTY FILE", "title" => GetMessage("F_EMPTY_FID"));
} elseif (intVal($arResult["FILE"]["MESSAGE_ID"]) > 0) {
    $arResult["MESSAGE"] = CForumMessage::GetByIDEx($arResult["FILE"]["MESSAGE_ID"], array("GET_FORUM_INFO" => "Y", "GET_TOPIC_INFO" => "Y"));
    $arResult["TOPIC"] = $arResult["MESSAGE"]["TOPIC_INFO"];
    $arResult["FORUM"] = $arResult["MESSAGE"]["FORUM_INFO"];
    if (IsModuleInstalled('meeting') && CModule::IncludeModule('meeting')) {
        $forumId = COption::GetOptionInt('meeting', 'comments_forum_id', 0, SITE_ID);
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:show_file.php


示例10: onAfterCommentUpdate


//.........这里部分代码省略.........
							$entity_type = $arLog["ENTITY_TYPE"];
							$entity_id = $arLog["ENTITY_ID"];

							$sText = (COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"]);
							$strURL = $GLOBALS['APPLICATION']->GetCurPageParam("", array("IFRAME", "MID", "SEF_APPLICATION_CUR_PAGE_URL", BX_AJAX_PARAM_ID, "result"));
							$strURL = ForumAddPageParams(
								$strURL,
								array(
									"MID" => intval($arData["MESSAGE_ID"]),
									"result" => "reply"
								),
								false,
								false
							);

							$arFieldsForSocnet = array(
								"ENTITY_TYPE" => $entity_type,
								"ENTITY_ID" => $entity_id,
								"EVENT_ID" => $arLogCommentEvent["EVENT_ID"],
								"MESSAGE" => $sText,
								"TEXT_MESSAGE" => $parser->convert4mail($sText),
								"URL" => str_replace("?IFRAME=Y", "", str_replace("&IFRAME=Y", "", str_replace("IFRAME=Y&", "", $strURL))),
								"MODULE_ID" => (array_key_exists("MODULE_ID", $arLogCommentEvent) && strlen($arLogCommentEvent["MODULE_ID"]) > 0 ? $arLogCommentEvent["MODULE_ID"] : ""),
								"SOURCE_ID" => intval($arData["MESSAGE_ID"]),
								"LOG_ID" => $log_id,
								"RATING_TYPE_ID" => "FORUM_POST",
								"RATING_ENTITY_ID" => intval($arData["MESSAGE_ID"])
							);

							$arFieldsForSocnet["USER_ID"] = $arMessage["AUTHOR_ID"];
							$arFieldsForSocnet["=LOG_DATE"] = $GLOBALS["DB"]->CurrentTimeFunction();

							$ufFileID = array();
							$dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => intval($arData["MESSAGE_ID"])));
							while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch())
								$ufFileID[] = $arAddedMessageFiles["FILE_ID"];

							if (count($ufFileID) > 0)
								$arFieldsForSocnet["UF_SONET_COM_FILE"] = $ufFileID;

							$ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", intval($arData["MESSAGE_ID"]), LANGUAGE_ID);
							if ($ufDocID)
								$arFieldsForSocnet["UF_SONET_COM_DOC"] = $ufDocID;

							$comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
							CSocNetLog::CounterIncrement(
								$comment_id, 
								false, 
								false, 
								"LC",
								CSocNetLogRights::CheckForUserAll($log_id)
							);
						}
					}
				}
				break;
			case "EDIT":
				$arMessage = CForumMessage::GetByID(intval($arData["MESSAGE_ID"]));
				if ($arMessage)
				{
					$dbLogComment = CSocNetLogComments::GetList(
						array("ID" => "DESC"),
						array(
							"EVENT_ID"	=> array($arLogCommentEvent["EVENT_ID"]),
							"SOURCE_ID" => intval($arData["MESSAGE_ID"])
						),
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:67,代码来源:log_forum_comments.php


示例11: Delete

 function Delete($ID)
 {
     global $DB;
     $ID = intVal($ID);
     $arTopic = CForumTopic::GetByID($ID);
     if (empty($arTopic)) {
         return false;
     }
     /***************** Event onBeforeTopicDelete ***********************/
     $events = GetModuleEvents("forum", "onBeforeTopicDelete");
     while ($arEvent = $events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array(&$ID, $arTopic)) === false) {
             return false;
         }
     }
     /***************** /Event ******************************************/
     $arAuthor = array();
     $arVotes = array();
     $db_res = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $ID));
     while ($res = $db_res->Fetch()) {
         if (intVal($res["AUTHOR_ID"]) > 0) {
             $arAuthor[intVal($res["AUTHOR_ID"])] = $res["AUTHOR_ID"];
         }
         if ($res["PARAM1"] == "VT" && intVal($res["PARAM2"]) > 0) {
             $arVotes[] = intVal($res["PARAM2"]);
         }
     }
     if (!empty($arVotes) && IsModuleInstalled("vote") && CModule::IncludeModule("vote")) {
         foreach ($arVotes as $res) {
             CVote::Delete($res);
         }
     }
     //		$DB->StartTransaction();
     CForumFiles::Delete(array("TOPIC_ID" => $ID), array("DELETE_TOPIC_FILE" => "Y"));
     $DB->Query("DELETE FROM b_forum_subscribe WHERE TOPIC_ID = " . $ID . "");
     $DB->Query("DELETE FROM b_forum_message WHERE TOPIC_ID = " . $ID . "");
     $DB->Query("DELETE FROM b_forum_user_topic WHERE TOPIC_ID = " . $ID . "");
     $DB->Query("DELETE FROM b_forum_topic WHERE ID = " . $ID . "");
     $DB->Query("DELETE FROM b_forum_topic WHERE TOPIC_ID = " . $ID . "");
     $DB->Query("DELETE FROM b_forum_stat WHERE TOPIC_ID = " . $ID . "");
     //		$DB->Commit();
     unset($GLOBALS["FORUM_CACHE"]["TOPIC"][$ID]);
     unset($GLOBALS["FORUM_CACHE"]["TOPIC_FILTER"][$ID]);
     foreach ($arAuthor as $key) {
         CForumUser::SetStat($key);
     }
     CForumNew::SetStat($arTopic["FORUM_ID"]);
     if (IsModuleInstalled("search") && CModule::IncludeModule("search")) {
         CSearch::DeleteIndex("forum", false, $arTopic["FORUM_ID"], $ID);
     }
     /***************** Event onAfterTopicDelete ************************/
     $events = GetModuleEvents("forum", "onAfterTopicDelete");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array(&$ID, $arTopic));
     }
     /***************** /Event ******************************************/
     return true;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:58,代码来源:topic.php


示例12: AddCommentMessage

 public static function AddCommentMessage($arFields, $FORUM_ID, $arLog)
 {
     global $USER, $DB;
     $dbRes = CTimeManEntry::GetList(array(), array('ID' => $arLog['SOURCE_ID']));
     $arEntry = $dbRes->Fetch();
     if ($arEntry && CModule::IncludeModule("forum")) {
         $ufFileID = array();
         $ufDocID = array();
         if (!($userName = trim($USER->GetFormattedName(false)))) {
             $userName = $USER->GetLogin();
         }
         if ($arEntry["FORUM_TOPIC_ID"] <= 0) {
             $t = ConvertTimeStamp(time(), "FULL");
             $arTopicFields = array("TITLE" => $arEntry["DATE_START"], "USER_START_ID" => $arFields["USER_ID"], "STATE" => "Y", "FORUM_ID" => $FORUM_ID, "USER_START_NAME" => $userName, "START_DATE" => $t, "POSTS" => 0, "VIEWS" => 0, "APPROVED" => "Y", "LAST_POSTER_NAME" => $userName, "LAST_POST_DATE" => $t, "LAST_MESSAGE_ID" => 0, "XML_ID" => "TIMEMAN_ENTRY_" . $arLog["SOURCE_ID"]);
             $TOPIC_ID = CForumTopic::Add($arTopicFields);
             if ($TOPIC_ID > 0) {
                 CTimeManEntry::Update($arLog['SOURCE_ID'], array("FORUM_TOPIC_ID" => $TOPIC_ID));
             }
         } else {
             $TOPIC_ID = $arEntry["FORUM_TOPIC_ID"];
         }
         if ($TOPIC_ID) {
             $arFieldsP = array("AUTHOR_ID" => $arFields["USER_ID"], "AUTHOR_NAME" => $userName, "POST_MESSAGE" => $arFields["TEXT_MESSAGE"], "POST_DATE" => date($DB->DateFormatToPHP(CLang::GetDateFormat("FULL")), time() - 1), "FORUM_ID" => $FORUM_ID, "TOPIC_ID" => $TOPIC_ID, "APPROVED" => "Y", "PARAM2" => $arLog["SOURCE_ID"]);
             $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("SONET_COMMENT", $arTmp);
             if (is_array($arTmp)) {
                 if (array_key_exists("UF_SONET_COM_DOC", $arTmp)) {
                     $GLOBALS["UF_FORUM_MESSAGE_DOC"] = $arTmp["UF_SONET_COM_DOC"];
                 } elseif (array_key_exists("UF_SONET_COM_FILE", $arTmp)) {
                     $arFieldsP["FILES"] = array();
                     foreach ($arTmp["UF_SONET_COM_FILE"] as $file_id) {
                         $arFieldsP["FILES"][] = array("FILE_ID" => $file_id);
                     }
                 }
             }
             $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("FORUM_MESSAGE", $arFieldsP);
             $mess_id = CForumMessage::Add($arFieldsP);
             // get UF DOC value and FILE_ID there
             if ($mess_id > 0) {
                 $dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $mess_id));
                 while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch()) {
                     $ufFileID[] = $arAddedMessageFiles["FILE_ID"];
                 }
                 $ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $mess_id, LANGUAGE_ID);
             }
             if (IsModuleInstalled("im")) {
                 CTimeManNotify::AddCommentToIM(array("USER_ID" => $arFieldsP["AUTHOR_ID"], "ENTRY_ID" => $arEntry["ID"], "LOG_ID" => $arLog["ID"], "MESSAGE" => $arFields["TEXT_MESSAGE"]));
             }
         }
         return array("SOURCE_ID" => $mess_id, "UF" => array("FILE" => $ufFileID, "DOC" => $ufDocID));
     }
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:52,代码来源:timeman_notify.php


示例13: array

    $arTask['DESCRIPTION'] = $parser->convertText($arTask['DESCRIPTION']);
}
// collect files data
if ($arTask['FILES']) {
    $rsFiles = CFile::GetList(array(), array('@ID' => implode(',', $arTask['FILES'])));
    $arTask['FILES'] = array();
    while ($arFile = $rsFiles->GetNext()) {
        $arFile['META::SIZE_FORMATTED'] = CFile::FormatSize($arFile['FILE_SIZE']);
        $arTask['FILES'][] = $arFile;
    }
    unset($rsFiles, $arFile);
}
// collect comments files
$arTask['FORUM_FILES'] = array();
if ($arTask['FORUM_TOPIC_ID']) {
    $rsFiles = CForumFiles::GetList(array('ID' => 'ASC'), array('TOPIC_ID' => $arTask['FORUM_TOPIC_ID']));
    whi 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CForumMessage类代码示例发布时间:2022-05-23
下一篇:
PHP CFormTable类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap