本文整理汇总了PHP中CKunenaTools::isModOrAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP CKunenaTools::isModOrAdmin方法的具体用法?PHP CKunenaTools::isModOrAdmin怎么用?PHP CKunenaTools::isModOrAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKunenaTools
的用法示例。
在下文中一共展示了CKunenaTools::isModOrAdmin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fbMovePosts
function fbMovePosts($catid, $isMod, $return)
{
$app =& JFactory::getApplication();
$backUrl = $app->getUserState("com_kunena.ActionBulk");
$kunena_db =& JFactory::getDBO();
$kunena_my =& JFactory::getUser();
// $isMod if user is moderator in the current category
if (!$isMod) {
// Test also if user is a moderator in some other category
$kunena_db->setQuery("SELECT userid FROM #__fb_moderation WHERE userid='{$kunena_my->id}'");
$isMod = $kunena_db->loadResult();
check_dberror("Unable to load moderation info.");
}
$isAdmin = CKunenaTools::isModOrAdmin();
//isMod will stay until better group management comes in
if (!$isAdmin && !$isMod) {
$app->redirect($return, _POST_NOT_MODERATOR);
}
$catid = (int) $catid;
if ($catid > 0) {
$items = fbGetArrayInts("fbDelete");
// start iterating here
foreach ($items as $id => $value) {
$id = (int) $id;
$kunena_db->setQuery("SELECT subject, catid, time AS timestamp FROM #__fb_messages WHERE id='{$id}'");
$oldRecord = $kunena_db->loadObjectList();
check_dberror("Unable to load message detail.");
$newCatObj = new jbCategory($kunena_db, $oldRecord[0]->catid);
if (fb_has_moderator_permission($kunena_db, $newCatObj, $kunena_my->id, $isAdmin)) {
$newSubject = _MOVED_TOPIC . " " . $oldRecord[0]->subject;
$kunena_db->setQuery("SELECT MAX(time) AS timestamp FROM #__fb_messages WHERE thread='{$id}'");
$lastTimestamp = $kunena_db->loadResult();
check_dberror("Unable to load messages max(time).");
if ($lastTimestamp == "") {
$lastTimestamp = $oldRecord[0]->timestamp;
}
//perform the actual move
$kunena_db->setQuery("UPDATE #__fb_messages SET `catid`='{$catid}' WHERE `id`='{$id}' OR `thread`='{$id}'");
$kunena_db->query();
check_dberror("Unable to move thread.");
$err = _POST_SUCCESS_MOVE;
} else {
$err = _POST_NOT_MODERATOR;
}
}
//end foreach
} else {
$err = _POST_NO_DEST_CATEGORY;
}
CKunenaTools::reCountBoards();
$app->redirect($return, $err);
}
示例2: editUserProfile
//.........这里部分代码省略.........
} else {
echo "<td> </td>";
}
?>
</tr>
<tr cellspacing = "3" colspan = "2">
</td>
</tr>
</table>
<table border = 0 cellspacing = 0 width = "100%" align = "center" class = "adminform">
<tr>
<th colspan = "2" class = "title">
<?php
echo _KUNENA_MOD_NEW;
?>
</td>
</tr>
</tr>
<tr>
<td width = "150" class = "contentpane">
<?php
echo _KUNENA_ISMOD;
?>
<?php
//admins are always moderators
if (CKunenaTools::isModOrAdmin($uid)) {
echo _KUNENA_ISADM;
?>
<input type = "hidden" name = "moderator" value = "1">
<?php
} else {
echo $selectMod;
}
?>
</td>
<td>
<?php
echo $modCats;
?>
</td>
</tr>
</table>
<input type = "hidden" name = "uid" value = "<?php
echo $uid;
?>
">
<input type = "hidden" name = "task" value = ""/>
<input type = "hidden" name = "option" value = "com_kunena"/>
</form>
<table border = 0 cellspacing = 0 width = "100%" align = "center" class = "adminform">
<tr>
<th colspan = "2" class = "title">
<?php
echo _KUNENA_SUBFOR;
?>
<?php
echo $username;
?>
</td>
</tr>
<?php
$enum = 1;
//reset value
$k = 0;
//value for alternating rows
if ($csubslist > 0) {
foreach ($subslist as $subs) {
//get all message details for each subscription
$kunena_db->setQuery("select * from #__fb_messages where id={$subs->thread}");
$subdet = $kunena_db->loadObjectList();
check_dberror("Unable to load subscription messages.");
foreach ($subdet as $sub) {
$k = 1 - $k;
echo "<tr class=\"row{$k}\">";
echo " <td>{$enum}: " . html_entity_decode_utf8(stripslashes($sub->subject)) . " by " . html_entity_decode_utf8(stripslashes($sub->name));
echo " <td> </td>";
echo "</tr>";
$enum++;
}
}
} else {
echo "<tr><td class=\"message\">" . _KUNENA_NOSUBS . "</td></tr>";
}
echo "</table>";
}