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


PHP Chat::banUser方法代码示例

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


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

示例1: ini_set

ini_set( "include_path", dirname(__FILE__)."/../" );
require( "commandLine.inc" );

if (isset($options['help'])) {
	die( "migrating the ban status from old system to new system" );
}


if ( WikiFactory::getVarValueByName("wgChatBanMigrated", $wgCityId ) ) {
//	die( "migrating the ban status from old system to new system" );	 
}
$db = wfGetDB(DB_SLAVE, array());

/*
 * first time it run only count on pages and then it run this script with param -do and list 
 * it is hack for problem with memory leak from parser 
 */

$res = $db->query("select ug_user, ug_group from user_groups where ug_group = 'bannedfromchat'");

$admin = User::newFromName("WikiaBot");

while ($row = $db->fetchRow($res)) {
	$userToBan = User::newFromID($row['ug_user']);
	Chat::banUser($userToBan->getName(), $admin, 60*60*24*30*6, "Auto migration script for new version of chat");
	$userToBan->removeGroup('chatmoderator');
}

WikiFactory::setVarByName("wgChatBanMigrated", $wgCityId, true );

echo "List of pages\n";
开发者ID:schwarer2006,项目名称:wikia,代码行数:31,代码来源:chatBanMigration.php

示例2: blockOrBanChat

 /**
  * Ajax endpoint for blocking privata chat with user.
  */
 public static function blockOrBanChat()
 {
     ChatHelper::info(__METHOD__ . ': Method called');
     global $wgRequest, $wgUser;
     wfProfileIn(__METHOD__);
     $kickingUser = $wgUser;
     $retVal = array();
     $userToBan = $wgRequest->getVal('userToBan');
     $userToBanId = $wgRequest->getVal('userToBanId', 0);
     if (!empty($userToBanId)) {
         $userToBan = User::newFromId($userToBanId);
         if (!empty($userToBanId)) {
             $userToBan = $userToBan->getName();
         }
     }
     $mode = $wgRequest->getVal('mode', 'private');
     if (empty($userToBan)) {
         $retVal["error"] = wfMsg('chat-missing-required-parameter', 'usertoBan');
     } else {
         $dir = $wgRequest->getVal('dir', 'add');
         if ($mode == 'private') {
             $result = Chat::blockPrivate($userToBan, $dir, $kickingUser);
         } else {
             if ($mode == 'global') {
                 $time = (int) $wgRequest->getVal('time', 0);
                 $result = Chat::banUser($userToBan, $kickingUser, $time, $wgRequest->getVal('reason'));
             }
         }
         if ($result === true) {
             $retVal["success"] = true;
         } else {
             $retVal["error"] = $result;
         }
     }
     wfProfileOut(__METHOD__);
     return $retVal;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:40,代码来源:ChatAjax.class.php


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