本文整理汇总了PHP中DiscussHelper::getDefaultSAIds方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussHelper::getDefaultSAIds方法的具体用法?PHP DiscussHelper::getDefaultSAIds怎么用?PHP DiscussHelper::getDefaultSAIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussHelper
的用法示例。
在下文中一共展示了DiscussHelper::getDefaultSAIds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($tpl = null)
{
// @rule: Test for user access if on 1.6 and above
if (DiscussHelper::getJoomlaVersion() >= '1.6') {
if (!JFactory::getUser()->authorise('discuss.manage.settings', 'com_easydiscuss')) {
JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
JFactory::getApplication()->close();
}
}
// Initialise variables
$config = DiscussHelper::getConfig();
$jconfig = DiscussHelper::getJConfig();
$defaultSAId = DiscussHelper::getDefaultSAIds();
$joomlaVersion = DiscussHelper::getJoomlaVersion();
$joomlaGroups = DiscussHelper::getJoomlaUserGroups();
$this->assignRef('config', $config);
$this->assignRef('jconfig', $jconfig);
$this->assignRef('defaultSAId', $defaultSAId);
$this->assignRef('defaultLength', $defaultLength);
$this->assignRef('joomlaversion', $joomlaVersion);
$this->assignRef('joomlaGroups', $joomlaGroups);
if ($this->getLayout() == 'default') {
$app = JFactory::getApplication();
$app->redirect('index.php?option=com_easydiscuss&view=settings&layout=default_main_workflow&child=general');
}
parent::display($tpl);
}
示例2: _getnewOwnerShip
function _getnewOwnerShip($curUserId)
{
$econfig = DiscussHelper::getConfig();
// this should get from backend. If backend not defined, get the default superadmin.
$defaultSAid = DiscussHelper::getDefaultSAIds();
$newOwnerShipId = $econfig->get('main_orphanitem_ownership', $defaultSAid);
/**
* we check if the tobe deleted user is the same user id as the saved user id in config.
* if yes, we try to get a next SA id.
*/
if ($curUserId == $newOwnerShipId) {
// this is no no a big no! try to get the next admin.
if (DiscussHelper::getJoomlaVersion() >= '1.6') {
$saUsersId = DiscussHelper::getSAUsersIds();
if (count($saUsersId) > 0) {
for ($i = 0; $i < count($saUsersId); $i++) {
if ($saUsersId[$i] != $curUserId) {
$newOwnerShip = $saUsersId[$i];
break;
}
}
}
} else {
$newOwnerShip = $this->_getSuperAdminId($curUserId);
}
}
$newOwnerShipId = $this->_verifyOnwerShip($newOwnerShipId);
$db = DiscussHelper::getDBO();
$query = 'SELECT a.`id`, a.`name`, a.`username`, b.`nickname`, a.`email` ' . ' FROM ' . $db->nameQuote('#__users') . ' as a ' . ' INNER JOIN ' . $db->nameQuote('#__discuss_users') . ' as b on a.`id` = b.`id` ' . ' WHERE a.`id` = ' . $db->Quote($newOwnerShipId);
$db->setQuery($query);
$result = $db->loadAssoc();
$displayFormat = $econfig->get('layout_nameformat', 'name');
$displayName = '';
switch ($displayFormat) {
case "name":
$displayName = $result['name'];
break;
case "username":
$displayName = $result['username'];
break;
case "nickname":
default:
$displayName = empty($result['nickname']) ? $result['name'] : $result['nickname'];
break;
}
$newOwnerShip = new stdClass();
$newOwnerShip->id = $result['id'];
$newOwnerShip->name = $displayName;
$newOwnerShip->email = $result['email'];
return $newOwnerShip;
}
示例3: mapVBulletinCategory
private function mapVBulletinCategory($vCategory, &$category, $parentId = 0)
{
$parentId = $parentId ? $parentId : 0;
// @task: Since vBulletin does not store the creator of the category, we'll need to assign a default owner.
$category->set('created_by', DiscussHelper::getDefaultSAIds());
$category->set('title', strip_tags($vCategory->title));
$category->set('description', $vCategory->description);
$category->set('published', 1);
$category->set('parent_id', $parentId);
// @TODO: Detect if it has a parent id and migrate according to the category tree.
$category->store(true);
$this->added('vBulletin', $category->id, $vCategory->forumid, 'category');
}