本文整理汇总了PHP中DiscussHelper::getJoomlaVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussHelper::getJoomlaVersion方法的具体用法?PHP DiscussHelper::getJoomlaVersion怎么用?PHP DiscussHelper::getJoomlaVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussHelper
的用法示例。
在下文中一共展示了DiscussHelper::getJoomlaVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.spools', 'com_easydiscuss')) {
JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
JFactory::getApplication()->close();
}
}
// Initialise variables
$mainframe = JFactory::getApplication();
$filter_state = $mainframe->getUserStateFromRequest('com_easydiscuss.spools.filter_state', 'filter_state', '*', 'word');
$search = $mainframe->getUserStateFromRequest('com_easydiscuss.spools.search', 'search', '', 'string');
$search = trim(JString::strtolower($search));
$order = $mainframe->getUserStateFromRequest('com_easydiscuss.spools.filter_order', 'filter_order', 'created', 'cmd');
$orderDirection = $mainframe->getUserStateFromRequest('com_easydiscuss.spools.filter_order_Dir', 'filter_order_Dir', 'asc', 'word');
$mails = $this->get('Data');
$pagination = $this->get('Pagination');
$this->assign('mails', $mails);
$this->assign('pagination', $pagination);
$this->assign('state', JHTML::_('grid.state', $filter_state, JText::_('COM_EASYDISCUSS_SENT'), JText::_('COM_EASYDISCUSS_PENDING')));
$this->assign('search', $search);
$this->assign('order', $order);
$this->assign('orderDirection', $orderDirection);
parent::display($tpl);
}
示例2: 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.post_types', 'com_easydiscuss')) {
JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
JFactory::getApplication()->close();
}
}
// Initialise variables
$document = JFactory::getDocument();
$user = JFactory::getUser();
$mainframe = JFactory::getApplication();
// REMOVE THIS COMMENT LATER: Don't ever use $this->getModel because it will conflict with K2
$model = DiscussHelper::getModel('Post_Types', true);
$postTypes = $model->getTypes();
$pagination = $this->get('Pagination');
$filter_state = $mainframe->getUserStateFromRequest('com_easydiscuss.post_types.filter_state', 'filter_state', '*', 'word');
$order = $mainframe->getUserStateFromRequest('com_easydiscuss.post_types.filter_order', 'filter_order', 'id', 'cmd');
$orderDirection = $mainframe->getUserStateFromRequest('com_easydiscuss.post_types.filter_order_Dir', 'filter_order_Dir', '', 'word');
$browse = JRequest::getInt('browse', 0);
$browseFunction = JRequest::getVar('browseFunction', '');
$search = $mainframe->getUserStateFromRequest('com_easydiscuss.post_types.search', 'search', '', 'string');
$search = trim(JString::strtolower($search));
$this->assign('browseFunction', $browseFunction);
$this->assign('browse', $browse);
$this->assign('search', $search);
$this->assign('postTypes', $postTypes);
$this->assign('state', $this->getFilterState($filter_state));
$this->assign('order', $order);
$this->assign('orderDirection', $orderDirection);
$this->assign('pagination', $pagination);
parent::display($tpl);
}
示例3: get
public function get($key, $default = null)
{
if (DiscussHelper::getJoomlaVersion() >= '3.0') {
return $this->config->get($key, $default);
}
return $this->config->getValue($key, $default);
}
示例4: setOffset
public function setOffset($offset)
{
if (DiscussHelper::getJoomlaVersion() >= '3.0') {
$tz = new DateTimeZone($offset);
return $this->date->setTimezone($tz);
}
return $this->date->setOffset($offset);
}
示例5: __construct
public function __construct()
{
$version = DiscussHelper::getJoomlaVersion();
$className = 'EasyDiscussDBJoomla15';
if ($version >= '2.5') {
$className = 'EasyDiscussDBJoomla30';
}
$this->helper = new $className();
}
示例6: __construct
/**
* Creates a new instance of the Joomla parser.
*
* @since 1.0
* @access public
*/
public function __construct($contents = '', $isFile = false)
{
$this->version = DiscussHelper::getJoomlaVersion();
if ($this->version >= '3.0') {
$parser = JFactory::getXML($contents, $isFile);
} else {
$parser = JFactory::getXMLParser('Simple');
$parser->loadString($contents);
}
$this->parser = $parser;
return $this;
}
示例7: _buildQuery
/**
* Method to build the query for the roles
*
* @access private
* @return string
*/
protected function _buildQuery()
{
// Get the WHERE and ORDER BY clauses for the query
$where = $this->_buildQueryWhere();
$orderby = $this->_buildQueryOrderBy();
$db = DiscussHelper::getDBO();
if (DiscussHelper::getJoomlaVersion() >= '1.6') {
$select = ' b.title AS usergroup_title';
$join = ' LEFT JOIN `#__usergroups` AS b ON b.id = a.usergroup_id';
} else {
$select = ' b.name AS usergroup_title';
$join = ' LEFT JOIN `#__core_acl_aro_groups` AS b ON b.id = a.usergroup_id';
}
$query = 'SELECT a.*, ' . $select . ' FROM `#__discuss_roles` AS a ' . $join . $where . ' ' . $orderby;
return $query;
}
示例8: sendOnPageLoad
function sendOnPageLoad()
{
$db = DiscussHelper::getDBO();
$config = DiscussHelper::getConfig();
$max = (int) $config->get('main_mailqueuenumber');
// Delete existing mails that has already been sent.
$query = 'DELETE FROM ' . $db->nameQuote('#__discuss_mailq') . ' WHERE ' . $db->nameQuote('status') . '=' . $db->Quote(1) . ' AND DATEDIFF(NOW(), `created`) >= 30';
$db->setQuery($query);
$db->Query();
$query = 'SELECT `id` FROM `#__discuss_mailq` WHERE `status` = 0';
$query .= ' ORDER BY `created` ASC';
$query .= ' LIMIT ' . $max;
$db->setQuery($query);
$result = $db->loadObjectList();
if (!empty($result)) {
foreach ($result as $mail) {
$mailq = DiscussHelper::getTable('MailQueue');
$mailq->load($mail->id);
// update the status to 1 == proccessed
$mailq->status = 1;
if ($mailq->store()) {
if (DiscussHelper::getJoomlaVersion() > '1.6') {
$mail = JFactory::getMailer();
$result = $mail->sendMail($mailq->mailfrom, $mailq->fromname, $mailq->recipient, $mailq->subject, $mailq->body, $mailq->ashtml);
// This code is to record all the activities from crons.
// Need to create a table for this
// $date = JFactory::getDate();
// $data = new stdClass();
// $data->id = null;
// $data->recipient = $mailq->recipient;
// $data->subject = $mailq->subject;
// $data->body = $mailq->body;
// $data->status = $mailq->status;
// $data->created = $date->toMySQL();
// $db->insertObject( '#__discuss_cron_logs', $data, id );
} else {
JUtility::sendMail($mailq->mailfrom, $mailq->fromname, $mailq->recipient, $mailq->subject, $mailq->body, $mailq->ashtml);
}
}
//end foreach
}
}
}
示例9: registerToolbar
public function registerToolbar()
{
if ($this->cat->id != 0) {
JToolBarHelper::title(JText::sprintf('COM_EASYDISCUSS_CATEGORIES_EDIT_CATEGORY_TITLE', $this->cat->title), 'category');
} else {
JToolBarHelper::title(JText::_('COM_EASYDISCUSS_CATEGORIES_EDIT_ADD_CATEGORY_TITLE'), 'category');
}
JToolBarHelper::back(JText::_('COM_EASYDISCUSS_BACK'), 'index.php?option=com_easydiscuss&view=categories');
JToolBarHelper::divider();
JToolbarHelper::apply();
JToolbarHelper::save();
if (DiscussHelper::getJoomlaVersion() > '1.6') {
JToolBarHelper::save2new('savePublishNew');
} else {
JToolBarHelper::save('savePublishNew', JText::_('COM_EASYDISCUSS_SAVE_AND_NEW'));
}
JToolBarHelper::divider();
JToolBarHelper::cancel();
}
示例10: getAdmins
function getAdmins()
{
$db = DiscussHelper::getDBO();
$query = 'SELECT `id`';
$query .= ' FROM #__users';
if (DiscussHelper::getJoomlaVersion() >= '1.6') {
$saUsersIds = DiscussHelper::getSAUsersIds();
$query .= ' WHERE id IN (' . implode(',', $saUsersIds) . ')';
} else {
$query .= ' WHERE LOWER( `usertype` ) = ' . $db->Quote('super administrator');
}
$query .= ' AND `sendEmail` = ' . $db->Quote('1');
$db->setQuery($query);
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
$result = $db->loadObjectList();
return $result;
}
示例11: showMoveDialog
public function showMoveDialog()
{
$ajax = new Disjax();
$options = new stdClass();
// Get list of categories.
$categories = DiscussHelper::populateCategories('', '', 'select', 'new_category', '', true, true, true, true);
$options->title = JText::_('COM_EASYDISCUSS_DIALOG_MOVE_TITLE');
$action = DiscussHelper::getJoomlaVersion() >= '1.6' ? 'Joomla.submitbutton(\'movePosts\');' : 'submitbutton(\'movePosts\')';
ob_start();
?>
<div style="display:none;" id="new_category_error" class="alert alert-error"></div>
<p><?php
echo JText::_('COM_EASYDISCUSS_DIALOG_MOVE_CONTENT');
?>
</p>
<p>
<?php
echo $categories;
?>
</p>
<?php
$options->content = ob_get_clean();
$buttons = array();
$button = new stdClass();
$button->title = JText::_('COM_EASYDISCUSS_CANCEL_BUTTON');
$button->action = 'disjax.closedlg();';
$buttons[] = $button;
$button = new stdClass();
$button->title = JText::_('COM_EASYDISCUSS_MOVE_BUTTON');
$button->action = $action;
$button->className = 'btn-primary';
$buttons[] = $button;
$options->buttons = $buttons;
$ajax->dialog($options);
$ajax->send();
}
示例12: getLoginLink
public static function getLoginLink($returnURL = '')
{
$config = DiscussHelper::getConfig();
if (!empty($returnURL)) {
$returnURL = '&return=' . $returnURL;
}
if (DiscussHelper::getJoomlaVersion() >= '1.6') {
$link = DiscussRouter::_('index.php?option=com_users&view=login' . $returnURL);
} else {
$link = DiscussRouter::_('index.php?option=com_user&view=login' . $returnURL);
}
return $link;
}
示例13:
<span class="pull-left">
<label for="discuss-post-remember" class="checkbox">
<input type="checkbox" tabindex="203" id="discuss-post-remember" name="remember" class="" value="yes" />
<?php
echo JText::_('COM_EASYDISCUSS_REMEMBER_ME');
?>
</label>
</span>
<input type="submit" tabindex="204" value="<?php
echo JText::_('COM_EASYDISCUSS_LOGIN', true);
?>
" name="Submit" class="btn btn-primary pull-right" />
</li>
</ul>
<?php
if (DiscussHelper::getJoomlaVersion() >= '1.6') {
?>
<input type="hidden" value="com_users" name="option">
<input type="hidden" value="user.login" name="task">
<input type="hidden" name="return" value="<?php
echo base64_encode(DiscussRouter::getPostRoute($post->id, false));
?>
" />
<?php
} else {
?>
<input type="hidden" value="com_user" name="option">
<input type="hidden" value="login" name="task">
<input type="hidden" name="return" value="<?php
echo base64_encode(DiscussRouter::getPostRoute($post->id, false));
?>
示例14: _getRuleSet
private function _getRuleSet($userId)
{
static $rulesData = null;
$my = empty($userId) ? JFactory::getUser() : JFactory::getUser($userId);
if (!isset($rulesData[$my->id])) {
$db = DiscussHelper::getDBO();
$config = DiscussHelper::getConfig();
$rulesets = new stdClass();
$rulesets->rules = new stdClass();
if (!empty($my->id)) {
$rulesets->id = $my->id;
$rulesets->name = $my->name;
$rulesets->group = isset($my->usertype) ? $my->usertype : '';
// @Task: Retreive assigned rulesets for this particular user.
// Assigned rulesets always have higher precedence
$query = 'SELECT * FROM ' . $db->nameQuote('#__discuss_acl_group') . ' ' . 'WHERE ' . $db->nameQuote('content_id') . '=' . $db->Quote($my->id) . ' ' . 'AND ' . $db->nameQuote('type') . '=' . $db->Quote('assigned') . ' ORDER BY `acl_id`';
$db->setQuery($query);
$tmp = $db->loadObjectList();
$result = array();
foreach ($tmp as $row) {
$result[$row->acl_id] = $row;
}
if (count($result) > 0) {
$rulesets = $this->_mapRules($result, $rulesets);
} else {
if (DiscussHelper::getJoomlaVersion() >= '1.6') {
// get user's joomla usergroups ids.
$groupIds = '';
$query = 'SELECT `group_id` FROM `#__user_usergroup_map` WHERE `user_id` = ' . $db->Quote($my->id);
$db->setQuery($query);
$groupIds = $db->loadResultArray();
$groups = array();
// get the last index.
for ($i = 0; $i < count($groupIds); $i++) {
$grpId =& $groupIds[$i];
$query = 'SELECT * FROM ' . $db->nameQuote('#__discuss_acl_group') . ' ' . 'WHERE ' . $db->nameQuote('content_id') . '=' . $db->Quote($grpId) . ' ' . 'AND ' . $db->nameQuote('type') . '=' . $db->Quote('group') . ' ORDER BY `acl_id`';
$db->setQuery($query);
$groups[] = $db->loadObjectList();
}
// Allow explicit overrides in the groups
// If user A is in group A (allow) and group B (not allowed) , user A should be allowed
$result = array();
foreach ($groups as $group) {
foreach ($group as $rule) {
if (!isset($result[$rule->acl_id])) {
$result[$rule->acl_id] = new stdClass();
}
if (isset($result[$rule->acl_id]->acl_id) && $result[$rule->acl_id]->status != '1' || !isset($result[$rule->acl_id]->acl_id)) {
$result[$rule->acl_id]->acl_id = $rule->acl_id;
$result[$rule->acl_id]->status = $rule->status;
}
}
}
} else {
$query = 'SELECT * FROM ' . $db->nameQuote('#__discuss_acl_group') . ' ' . 'WHERE ' . $db->nameQuote('content_id') . '=' . $db->Quote($my->gid) . ' ' . 'AND ' . $db->nameQuote('type') . '=' . $db->Quote('group') . ' ORDER BY `acl_id`';
$db->setQuery($query);
$group = $db->loadObjectList();
$result = array();
foreach ($group as $rule) {
if (!isset($result[$rule->acl_id])) {
$result[$rule->acl_id] = new stdClass();
}
if (isset($result[$rule->acl_id]->acl_id) && $result[$rule->acl_id]->status != '1' || !isset($result[$rule->acl_id]->acl_id)) {
$result[$rule->acl_id]->acl_id = $rule->acl_id;
$result[$rule->acl_id]->status = $rule->status;
}
}
}
$rulesets = $this->_mapRules($result, $rulesets);
}
} else {
$rulesets->id = '0';
$rulesets->name = 'guest';
$rulesets->group = 'public';
if (DiscussHelper::getJoomlaVersion() >= '1.6') {
$query = 'SELECT `id` FROM ' . $db->nameQuote('#__usergroups') . ' ' . 'WHERE ' . $db->nameQuote('parent_id') . '=' . $db->Quote('0');
$db->setQuery($query);
$publicGroup = $db->loadResult();
} else {
$publicGroup = '0';
}
$query = 'SELECT * FROM ' . $db->nameQuote('#__discuss_acl_group') . ' ' . 'WHERE ' . $db->nameQuote('content_id') . '=' . $db->Quote($publicGroup) . ' ' . 'AND ' . $db->nameQuote('type') . '=' . $db->Quote('group') . ' ORDER BY `acl_id`';
$db->setQuery($query);
$tmp = $db->loadObjectList();
$result = array();
foreach ($tmp as $row) {
$result[$row->acl_id] = $row;
}
$rulesets = $this->_mapRules($result, $rulesets);
}
$rulesData[$my->id] = $rulesets;
}
$this->ruleset = $rulesData[$my->id];
return $rulesData[$my->id];
}
示例15: _verifyOnwerShip
function _verifyOnwerShip($id)
{
$db = DiscussHelper::getDBO();
$query = 'SELECT `id` FROM `#__users` WHERE `id` = ' . $db->Quote($id);
$db->setQuery($query);
$result = $db->loadResult();
if (empty($result)) {
if (DiscussHelper::getJoomlaVersion() >= '1.6') {
$saUsersId = DiscussHelper::getSAUsersIds();
$result = $saUsersId[0];
} else {
$result = $this->_getSuperAdminId();
}
}
return $result;
}