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


PHP CForumTopic::CanUserDeleteTopic方法代码示例

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


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

示例1: ForumSpamTopic

function ForumSpamTopic($topic, &$strErrorMessage, &$strOKMessage, $arAddParams = array())
{
    global $USER;
    $arError = array();
    $arOk = array();
    $arAddParams = !is_array($arAddParams) ? array($arAddParams) : $arAddParams;
    $arAddParams["PERMISSION"] = !empty($arAddParams["PERMISSION"]) ? $arAddParams["PERMISSION"] : false;
    $topic = ForumDataToArray($topic);
    if (empty($topic)) {
        $arError[] = GetMessage("SPAMTOP_NO_TOPIC");
    } else {
        if (!CForumUser::IsAdmin() && !$arAddParams["PERMISSION"]) {
            $db_res = CForumTopic::GetListEx(array(), array("@ID" => implode(",", $topic), "PERMISSION_STRONG" => true));
        } else {
            $db_res = CForumTopic::GetListEx(array(), array("@ID" => implode(",", $topic)));
        }
        if ($db_res && ($res = $db_res->Fetch())) {
            do {
                if (CForumTopic::CanUserDeleteTopic($res["ID"], $USER->GetUserGroupArray(), $USER->GetID(), $arAddParams["PERMISSION"])) {
                    $db_mes = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $res["ID"]));
                    if ($db_mes && ($mes = $db_mes->Fetch() && CModule::IncludeModule("mail"))) {
                        CMailMessage::MarkAsSpam($mes["XML_ID"], "Y");
                    }
                    if (CForumTopic::Delete($res["ID"])) {
                        $arOk[] = GetMessage("SPAMTOP_OK") . " (TID=" . intVal($res["ID"]) . ")";
                        CForumEventLog::Log("topic", "spam", $res["ID"], print_r($res, true) . print_r($mes, true));
                    } else {
                        $arError[] = GetMessage("SPAMTOP_NO") . " (TID=" . intVal($res["ID"]) . ")";
                    }
                } else {
                    $arError[] = GetMessage("SPAMTOP_NO_PERMS") . " (TID=" . intVal($res["ID"]) . ")";
                }
            } while ($res = $db_res->Fetch());
        } else {
            $arError[] = GetMessage("FMT_NO_PERMS_EDIT");
        }
    }
    if (count($arError) > 0) {
        $strErrorMessage .= implode(".\n", $arError) . ".\n";
    }
    if (count($arOk) > 0) {
        $strOKMessage .= implode(".\n", $arOk) . ".\n";
    }
    if (count($arError) > 0) {
        return false;
    } else {
        return true;
    }
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:49,代码来源:include.php

示例2: array

    }
    if (!empty($sError)) {
        $lAdmin->AddFilterError($sError);
    }
}
$rsData = CForumTopic::GetListEx(array($by => $order), $arFilter, false, 0, array("NoFilter" => true));
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("FM_TOPICS")));
/*******************************************************************/
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "TITLE", "content" => GetMessage("FM_TITLE_NAME"), "sort" => "TITLE", "default" => true), array("id" => "DESCRIPTION", "content" => GetMessage("FM_TITLE_DESCRIPTION"), "sort" => "DESCRIPTION", "default" => false), array("id" => "STATE", "content" => GetMessage("FM_TITLE_STATE"), "sort" => "STATE", "default" => true), array("id" => "APPROVED", "content" => GetMessage("FM_TITLE_APPROVED"), "sort" => "APPROVED", "default" => true), array("id" => "SORT", "content" => GetMessage("FM_TITLE_SORT"), "sort" => "SORT", "default" => true), array("id" => "USER_START_NAME", "content" => GetMessage("FM_TITLE_AUTHOR"), "sort" => "USER_START_NAME", "default" => true), array("id" => "START_DATE", "content" => GetMessage("FM_TITLE_DATE_CREATE"), "sort" => "START_DATE", "default" => true), array("id" => "POSTS", "content" => GetMessage("FM_TITLE_MESSAGES"), "sort" => "POSTS", "default" => false), array("id" => "VIEWS", "content" => GetMessage("FM_TITLE_VIEWS"), "sort" => "VIEWS", "default" => false), array("id" => "FORUM_ID", "content" => GetMessage("FM_TITLE_FORUM"), "sort" => "FORUM_NAME", "default" => true), array("id" => "LAST_POST_DATE", "content" => GetMessage("FM_TITLE_LAST_MESSAGE"), "sort" => "LAST_POST_DATE", "default" => false)));
/*******************************************************************/
while ($res = $rsData->NavNext(true, "t_")) {
    $row =& $lAdmin->AddRow($t_ID, $res);
    $bCanUpdateForum = CForumTopic::CanUserUpdateTopic($t_ID, $USER->GetUserGroupArray(), $USER->GetID());
    $bCanDeleteForum = CForumTopic::CanUserDeleteTopic($t_ID, $USER->GetUserGroupArray(), $USER->GetID());
    $row->bReadOnly = !$bCanUpdateForum || !$bCanDeleteForum ? true : false;
    $row->AddField("ID", $t_ID);
    $row->AddInputField("TITLE", array("size" => "35"));
    $row->AddInputField("DESCRIPTION", array("size" => "35"));
    if ($t_STATE != "L") {
        $row->AddSelectField("STATE", array("Y" => GetMessage("F_OPEN"), "N" => GetMessage("F_CLOSE")));
    } else {
        $row->AddField("STATE", "Link");
    }
    $row->AddSelectField("APPROVED", array("Y" => GetMessage("F_SHOW"), "N" => GetMessage("F_HIDE")));
    $row->AddSelectField("SORT", array("100" => GetMessage("F_PINN"), "150" => GetMessage("F_UNPINN")));
    $row->AddInputField("USER_START_NAME", array("size" => "20"));
    $row->AddInputField("START_DATE", array("size" => "16"));
    $row->AddField("POSTS", $t_POSTS);
    $row->AddInputField("VIEWS", array("size" => "2"));
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:forum_topics.php

示例3:

				 | 
				<font class="forumheadtext"><a href="read.php?FID=<?php 
        echo $FID;
        ?>
&TID=<?php 
        echo $TID;
        ?>
&ACTION=<?php 
        echo $arTopic["STATE"] != "Y" ? "STATE_Y" : "STATE_N";
        ?>
"><?php 
        echo $arTopic["STATE"] != "Y" ? "Открыть тему" : "Закрыть тему";
        ?>
</a></font>
				<?php 
        if (CForumTopic::CanUserDeleteTopic($TID, $USER->GetUserGroupArray(), $USER->GetID())) {
            ?>
					&nbsp;|&nbsp;
					<font class="forumheadtext"><a href="read.php?FID=<?php 
            echo $FID;
            ?>
&TID=<?php 
            echo $TID;
            ?>
&ACTION=DEL_TOPIC">Удалить тему</a></font>
			  <?php 
        }
        ?>
		  <?php 
    }
    ?>
开发者ID:,项目名称:,代码行数:31,代码来源:


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