当前位置: 首页>>代码示例>>PHP>>正文


PHP CForumNew::GetSelectFields方法代码示例

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


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

示例1: GetByIDEx

 function GetByIDEx($ID, $arAddParams = array())
 {
     global $DB;
     $ID = intVal($ID);
     $res = false;
     if ($ID <= 0) {
         return false;
     }
     $arAddParams = is_array($arAddParams) ? $arAddParams : array($arAddParams);
     $arAddParams["GET_TOPIC_INFO"] = $arAddParams["GET_TOPIC_INFO"] == "Y" ? "Y" : "N";
     $arAddParams["FILTER_TOPIC_INFO"] = $arAddParams["FILTER_TOPIC_INFO"] == "N" ? "N" : "Y";
     $arAddParams["GET_FORUM_INFO"] = $arAddParams["GET_FORUM_INFO"] == "Y" ? "Y" : "N";
     $arAddParams["FILTER_FORUM_INFO"] = $arAddParams["FILTER_FORUM_INFO"] == "N" ? "N" : "Y";
     $arAddParams["FILTER_MESSAGE_INFO"] = $arAddParams["FILTER_MESSAGE_INFO"] == "N" ? "N" : "Y";
     if (COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
         $arAddParams["FILTER"] = is_set($arAddParams, "FILTER") ? $arAddParams["FILTER"] : "P";
         $arAddParams["FILTER"] = $arAddParams["FILTER"] == "Y" || $arAddParams["FILTER"] == "P" ? $arAddParams["FILTER"] : "N";
     } else {
         $arAddParams["FILTER"] = "N";
     }
     if ($arAddParams["FILTER"] == "N") {
         $arAddParams["FILTER_TOPIC_INFO"] = "N";
         $arAddParams["FILTER_FORUM_INFO"] = "N";
         $arAddParams["FILTER_MESSAGE_INFO"] = "N";
     } elseif ($arAddParams["FILTER"] == "P") {
         $arAddParams["FILTER_MESSAGE_INFO"] = "N";
     }
     $arSqlSelect = array();
     $arSqlFrom = array();
     if ($arAddParams["GET_TOPIC_INFO"] == "Y") {
         $arSqlSelect[] = CForumTopic::GetSelectFields(array("sPrefix" => "FT_", "sReturnResult" => "string"));
         if ($arAddParams["FILTER_TOPIC_INFO"] != "N") {
             $arSqlSelect[] = "FT.HTML as FT_HTML";
         }
         $arSqlSelect[] = "FT.XML_ID as FT_XML_ID";
         $arSqlFrom[] = "INNER JOIN b_forum_topic FT ON (FM.TOPIC_ID = FT.ID)";
     }
     if ($arAddParams["GET_FORUM_INFO"] == "Y") {
         $arSqlSelect[] = CForumNew::GetSelectFields(array("sPrefix" => "F_", "sReturnResult" => "string"));
         if ($arAddParams["FILTER_FORUM_INFO"] != "N") {
             $arSqlSelect[] = "F.HTML as F_HTML";
         }
         $arSqlFrom[] = "INNER JOIN b_forum F ON (FM.FORUM_ID = F.ID)";
     }
     $strSql = "SELECT FM.*, " . $DB->DateToCharFunction("FM.POST_DATE", "FULL") . " as POST_DATE,\n\t\t\t\tFU.SHOW_NAME, FU.DESCRIPTION, FU.NUM_POSTS, FU.POINTS as NUM_POINTS, FU.SIGNATURE, FU.AVATAR, FU.RANK_ID,\n\t\t\t\t" . $DB->DateToCharFunction("FU.DATE_REG", "SHORT") . " as DATE_REG,\n\t\t\t\tU.EMAIL, U.PERSONAL_ICQ, U.LOGIN, U.NAME, U.SECOND_NAME, U.LAST_NAME" . (!empty($arSqlSelect) ? ", " . implode(", ", $arSqlSelect) : "") . "\n\t\t\tFROM b_forum_message FM\n\t\t\t\tLEFT JOIN b_forum_user FU ON (FM.AUTHOR_ID = FU.USER_ID)\n\t\t\t\tLEFT JOIN b_user U ON (FM.AUTHOR_ID = U.ID)\n\t\t\t\t" . implode(" ", $arSqlFrom) . "\n\t\t\tWHERE FM.ID = " . $ID . "";
     $db_res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if ($db_res && ($res = $db_res->Fetch())) {
         if ($arAddParams["FILTER_MESSAGE_INFO"] == "N") {
             unset($res["HTML"]);
         }
         if ($arAddParams["GET_TOPIC_INFO"] == "Y" && COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
             $arTopic = array();
             foreach ($res as $key => $val) {
                 if (substr($key, 0, 3) == "FT_") {
                     $arTopic[substr($key, 3)] = $val;
                 }
             }
             if (!empty($arTopic)) {
                 $GLOBALS["FORUM_CACHE"]["TOPIC"][intVal($res["TOPIC_INFO"]["ID"])] = $arTopic;
                 $db_res_filter = new CDBResult();
                 $db_res_filter->InitFromArray(array($arTopic));
                 $db_res_filter = new _CTopicDBResult($db_res_filter);
                 if ($res_filter = $db_res_filter->Fetch()) {
                     $GLOBALS["FORUM_CACHE"]["TOPIC_FILTER"][intVal($res["TOPIC_INFO"]["ID"])] = $res_filter;
                 }
             }
         }
         $db_res = new CDBResult();
         $db_res->InitFromArray(array($res));
         $db_res = new _CMessageDBResult($db_res, $arAddParams);
         $res = $db_res->Fetch();
         if ($arAddParams["GET_TOPIC_INFO"] == "Y" || $arAddParams["GET_FORUM_INFO"] == "Y") {
             $res["TOPIC_INFO"] = array();
             $res["FORUM_INFO"] = array();
             $res["MESSAGE_INFO"] = array();
             foreach ($res as $key => $val) {
                 if (substr($key, 0, 3) == "FT_") {
                     $res["TOPIC_INFO"][substr($key, 3)] = $val;
                 } elseif (substr($key, 0, 2) == "F_") {
                     $res["FORUM_INFO"][substr($key, 2)] = $val;
                 } else {
                     $res["MESSAGE_INFO"][$key] = $val;
                 }
             }
             if (COption::GetOptionString("forum", "FILTER", "Y") != "Y" && !empty($res["TOPIC_INFO"])) {
                 $GLOBALS["FORUM_CACHE"]["TOPIC"][intVal($res["TOPIC_INFO"]["ID"])] = $res["TOPIC_INFO"];
             }
             if (!empty($res["FORUM_INFO"])) {
                 $GLOBALS["FORUM_CACHE"]["FORUM"][intVal($res["FORUM_INFO"]["ID"])] = $res["FORUM_INFO"];
             }
         }
         if ($arAddParams["getFiles"] == "Y" && !empty($res)) {
             $res["FILES"] = CForumFiles::getByMessageID($ID);
         }
         return $res;
     }
     return false;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:98,代码来源:message.php

示例2: GetByIDEx

 function GetByIDEx($ID, $arAddParams = array())
 {
     global $DB;
     $ID = intVal($ID);
     if ($ID <= 0) {
         return false;
     }
     $arAddParams = is_array($arAddParams) ? $arAddParams : array($arAddParams);
     $arAddParams["GET_FORUM_INFO"] = $arAddParams["GET_FORUM_INFO"] == "Y" ? "Y" : "N";
     $arSQL = array("select" => array(), "join" => array());
     if (!empty($arAddParams["sNameTemplate"])) {
         $arSQL = array_merge_recursive(CForumUser::GetFormattedNameFieldsForSelect(array_merge($arAddParams, array("sUserTablePrefix" => "U_START.", "sForumUserTablePrefix" => "FU_START.", "sFieldName" => "USER_START_NAME_FRMT", "sUserIDFieldName" => "FT.USER_START_ID"))), CForumUser::GetFormattedNameFieldsForSelect(array_merge($arAddParams, array("sUserTablePrefix" => "U_LAST.", "sForumUserTablePrefix" => "FU_LAST.", "sFieldName" => "LAST_POSTER_NAME_FRMT", "sUserIDFieldName" => "FT.LAST_POSTER_ID"))), CForumUser::GetFormattedNameFieldsForSelect(array_merge($arAddParams, array("sUserTablePrefix" => "U_ABS_LAST.", "sForumUserTablePrefix" => "FU_ABS_LAST.", "sFieldName" => "ABS_LAST_POSTER_NAME_FRMT", "sUserIDFieldName" => "FT.ABS_LAST_POSTER_ID"))));
     }
     if ($arAddParams["GET_FORUM_INFO"] == "Y") {
         $arSQL["select"][] = CForumNew::GetSelectFields(array("sPrefix" => "F_", "sReturnResult" => "string"));
         $arSQL["join"][] = "INNER JOIN b_forum F ON (FT.FORUM_ID = F.ID)";
     }
     $arSQL["select"] = !empty($arSQL["select"]) ? ",\n\t" . implode(",\n\t", $arSQL["select"]) : "";
     $arSQL["join"] = !empty($arSQL["join"]) ? "\n\t" . implode("\n", $arSQL["join"]) : "";
     $strSql = "SELECT FT.*,\n" . "\t" . $DB->DateToCharFunction("FT.START_DATE", "FULL") . " as START_DATE, \n" . "\t" . $DB->DateToCharFunction("FT.LAST_POST_DATE", "FULL") . " as LAST_POST_DATE, \n" . "\tFS.IMAGE, '' as IMAGE_DESCR" . $arSQL["select"] . "\n" . "FROM b_forum_topic FT \n" . "\tLEFT JOIN b_forum_smile FS ON (FT.ICON_ID = FS.ID)" . $arSQL["join"] . "\n" . "WHERE FT.ID = " . $ID;
     $db_res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if (COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
         $db_res = new _CTopicDBResult($db_res);
     }
     if ($res = $db_res->Fetch()) {
         if (is_array($res)) {
             // Cache topic data for hits
             if ($arAddParams["GET_FORUM_INFO"] == "Y") {
                 $res["TOPIC_INFO"] = array();
                 $res["FORUM_INFO"] = array();
                 foreach ($res as $key => $val) {
                     if (substr($key, 0, 2) == "F_") {
                         $res["FORUM_INFO"][substr($key, 2)] = $val;
                     } else {
                         $res["TOPIC_INFO"][$key] = $val;
                     }
                 }
                 if (!empty($res["TOPIC_INFO"])) {
                     $GLOBALS["FORUM_CACHE"]["TOPIC"][intVal($res["TOPIC_INFO"]["ID"])] = $res["TOPIC_INFO"];
                     if (COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
                         $db_res_filter = new CDBResult();
                         $db_res_filter->InitFromArray(array($res["TOPIC_INFO"]));
                         $db_res_filter = new _CTopicDBResult($db_res_filter);
                         if ($res_filter = $db_res_filter->Fetch()) {
                             $GLOBALS["FORUM_CACHE"]["TOPIC_FILTER"][intVal($res["TOPIC_INFO"]["ID"])] = $res_filter;
                         }
                     }
                 }
                 if (!empty($res["FORUM_INFO"])) {
                     $GLOBALS["FORUM_CACHE"]["FORUM"][intVal($res["FORUM_INFO"]["ID"])] = $res["FORUM_INFO"];
                 }
             }
         }
         return $res;
     }
     return false;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:57,代码来源:topic.php


注:本文中的CForumNew::GetSelectFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。