本文整理汇总了PHP中Jfactory::getDbo方法的典型用法代码示例。如果您正苦于以下问题:PHP Jfactory::getDbo方法的具体用法?PHP Jfactory::getDbo怎么用?PHP Jfactory::getDbo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jfactory
的用法示例。
在下文中一共展示了Jfactory::getDbo方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($id = null)
{
if ($id) {
$this->setId($id);
}
$this->_db = Jfactory::getDbo();
}
示例2: eventAccess
/**
* Function to return event access (access levels, approval and event access status)
*
* @access public static
* @param $id - id of the event
* @return list array of access levels, approval and event access status
*
* @since 3.4.0
*/
public static function eventAccess($id = null)
{
// Preparing connection to db
$db = Jfactory::getDbo();
// Preparing the query
$query = $db->getQuery(true);
$query->select('e.state AS evtState, e.approval AS evtApproval, e.access AS evtAccess')->from($db->qn('#__icagenda_events') . ' AS e')->where($db->qn('e.id') . ' = ' . $db->q($id));
$query->select('v.title AS accessName')->join('LEFT', $db->quoteName('#__viewlevels') . ' AS v ON v.id = e.access');
$db->setQuery($query);
$eventAccess = $db->loadObject();
if ($eventAccess) {
return $eventAccess;
} else {
return false;
}
}
示例3: showTopicComments
function showTopicComments($data)
{
$_JLMS_PLUGINS =& JLMSFactory::getPlugins();
$option = 'com_joomla_lms';
$db =& Jfactory::getDbo();
$botParams = $_JLMS_PLUGINS->getPluginParams('jc_integration');
$search_jc = JRequest::getVar('search_jc', '', 'request', 'int');
$search_jc_text = JRequest::getVar('search_jc_text', '', 'request', 'string');
$obj_data = new stdClass();
if ($botParams->get('topic_comments', 1)) {
$comments = JPATH_SITE . '/components/com_jcomments/jcomments.php';
if (file_exists($comments)) {
require_once $comments;
$obj_data->form = '';
if ($botParams->get('search_topic_comments', 1)) {
$obj_data->form .= showSearchCommentsStandard(1);
}
if ($search_jc) {
$comments_form = JLMS_JComments::showComments($data->id, $data->component, $data->title, $search_jc_text);
} else {
$comments_form = JComments::showComments($data->id, $data->component, $data->title);
}
$obj_data->form .= $comments_form;
}
}
if (isset($obj_data->form)) {
JLMS_TMPL::OpenTS();
echo $obj_data->form;
JLMS_TMPL::CloseTS();
}
return $obj_data;
}
示例4: count_Events
/**
*
* ALL EVENTS DISPLAY
*
*/
public function count_Events()
{
// Get Params Menu
$app = JFactory::getApplication();
$iCmenuParams = $app->getParams();
// Get Data
$db = Jfactory::getDbo();
$query = $db->getQuery(true);
$query->select('count(e.id) AS nbevents')->from('#__icagenda_events AS e');
// Adding Filter if State Published
$where = "(e.state = 1)";
// Adding Filter per Category in Navigation
$mcatid = $iCmenuParams->get('mcatid');
if (is_array($mcatid)) {
$selcat = implode(', ', $mcatid);
if (!in_array('0', $mcatid)) {
$where .= " AND (e.catid IN ({$selcat}))";
}
}
// UTC datetime is converted in joomla config time zone
// Get a date object based on UTC.
$config = JFactory::getConfig();
if (version_compare(JVERSION, '3.0', 'ge')) {
$offset = $config->get('offset');
} else {
$offset = $config->getValue('config.offset');
}
$joomlaTZ_datetime = JFactory::getDate('now', $offset);
$joomlaTZ_date = date('Y-m-d', strtotime($joomlaTZ_datetime));
// Adding Filter per Time in Navigation
$filter_time = $iCmenuParams->get('time');
// if($filter_time==1) $where.=' AND e.next >= (CURDATE())';
// if($filter_time==2) $where.=' AND e.next < (CURDATE())';
// if($filter_time==3) $where.=' AND e.next >= (NOW())';
// if($filter_time==4) $where.=' AND (e.next >= (CURDATE()) AND (e.next < (CURDATE() + INTERVAL 1 DAY)))';
if ($filter_time == 1) {
$where .= ' AND ' . $db->qn('e.next') . ' >= ' . $db->q($joomlaTZ_date) . '';
}
// COM_ICAGENDA_OPTION_TODAY_AND_UPCOMING
if ($filter_time == 2) {
$where .= ' AND ' . $db->qn('e.next') . ' < ' . $db->q($joomlaTZ_date) . '';
}
// COM_ICAGENDA_OPTION_PAST
if ($filter_time == 3) {
$where .= ' AND ' . $db->qn('e.next') . ' > ' . $db->q($joomlaTZ_datetime) . '';
}
// COM_ICAGENDA_OPTION_FUTURE
if ($filter_time == 4) {
$where .= ' AND (' . $db->qn('e.next') . ' >= ' . $db->q($joomlaTZ_date) . '';
$where .= ' AND (' . $db->qn('e.next') . ' < (' . $db->q($joomlaTZ_date) . ' + INTERVAL 1 DAY)))';
}
// Language Control
$lang = JFactory::getLanguage();
$langcur = $lang->getTag();
$langcurrent = $langcur;
$where .= " AND ((e.language = '{$langcurrent}') OR (e.language = '*') OR (e.language = NULL) OR (e.language = ''))";
// Access Control
$user = JFactory::getUser();
$userID = $user->id;
$userLevels = $user->getAuthorisedViewLevels();
if (version_compare(JVERSION, '3.0', 'lt')) {
$userGroups = $user->getAuthorisedGroups();
} else {
$userGroups = $user->groups;
}
$groupid = JComponentHelper::getParams('com_icagenda')->get('approvalGroups', array("8"));
jimport('joomla.access.access');
$adminUsersArray = array();
foreach ($groupid as $gp) {
$adminUsers = JAccess::getUsersByGroup($gp, False);
$adminUsersArray = array_merge($adminUsersArray, $adminUsers);
}
// Test if user has Access Permissions
if (!in_array('8', $userGroups)) {
$useraccess = implode(', ', $userLevels);
$where .= ' AND e.access IN (' . $useraccess . ')';
}
// Test if user logged-in has Approval Rights
if (!in_array($userID, $adminUsersArray) and !in_array('8', $userGroups)) {
$where .= ' AND e.approval <> 1';
} else {
$where .= ' AND e.approval < 2';
}
$query->where($where);
$db->setQuery($query);
$result = $db->loadObject()->nbevents;
return $result;
}
示例5:
</td>
<!-- Status Joomla -->
<?php
if (isset($this->items[0]->state)) {
?>
<td class="center">
<?php
// Control of dates if valid (EDIT SINCE VERSION 3.0)
// if (($nextdate == '943916400') OR ($nextdate == '943920000')) {
if ($item->next == '0000-00-00 00:00:00') {
//echo JHtml::_('jgrid.published', $item->state, $i, 'events.', '', 'cb');
echo '<br/><i class="icon-warning"></i><br/><span style="color:red;"><strong>' . JText::_('COM_ICAGENDA_NO_VALID_DATE') . '</strong></span>';
if ($item->state == '1') {
//$state = 0;
$db = Jfactory::getDbo();
$query = $db->getQuery(true);
$query->clear();
$query->update(' #__icagenda_events ');
$query->set(' state = 0 ');
$query->where(' id = ' . (int) $item->id);
$db->setQuery((string) $query);
$db->query($query);
}
} else {
echo JHtml::_('jgrid.published', $item->state, $i, 'events.', $canChange, 'cb');
// echo JHtml::_('approveEvent', $item->approval, $i, 'events.', $canChange, 'cb');
}
?>
</td>
<td class="center">
示例6: getRating
public function getRating($docId, $commentId)
{
$userId = JFactory::getUser()->id;
$db = Jfactory::getDbo();
$query = $db->getQuery(true);
$query->select('r.*')
->from('#__judownload_rating AS r')
->join('LEFT', '#__judownload_comments AS cm ON cm.rating_id = r.id')
->where('r.user_id = ' . $userId)
->where('r.doc_id = ' . $docId)
->where('cm.id = ' . $commentId)
->order('r.created DESC');
$db->setQuery($query, 0, 1);
return $db->loadObject();
}
示例7: GetlettersearchParameters
/**
* Method to parse mod_redshop_lettersearch module parameter.
*
* @return void
*/
public function GetlettersearchParameters()
{
$db = Jfactory::getDbo();
$sel = 'SELECT params from #__extensions where element = "mod_redshop_lettersearch" ';
$db->setQuery($sel);
$params = $db->loadResult();
$letterparamArr = array();
$allparams = explode("\n", $params);
for ($i = 0; $i < count($allparams); $i++) {
$letter_param = explode('=', $allparams[$i]);
if (!empty($letter_param)) {
$letterparamArr[$letter_param[0]] = $letter_param[1];
}
}
return $letterparamArr;
}
示例8: ManagerIcons
protected function ManagerIcons($i)
{
$app = JFactory::getApplication();
// Get Current Itemid
$this_itemid = JRequest::getInt('Itemid');
// Get Current Url
$returnURL = base64_encode(JURI::getInstance()->toString());
$event_slug = empty($i->alias) ? $i->id : $i->id . ':' . $i->alias;
// Set Manager Actions Url
$managerActionsURL = 'index.php?option=com_icagenda&view=list&layout=event&id=' . $event_slug . '&Itemid=' . $this_itemid;
// Set Email Notification Url to event
$linkEmailUrl = JURI::base() . 'index.php?option=com_icagenda&view=list&layout=event&id=' . $event_slug . '&Itemid=' . $this_itemid;
// Get Approval Status
$approved = $i->approval;
// Get User groups allowed to approve event submitted
$groupid = JComponentHelper::getParams('com_icagenda')->get('approvalGroups', array("8"));
$groupid = is_array($groupid) ? $groupid : array($groupid);
// Get User Infos
$user = JFactory::getUser();
$icid = $user->get('id');
$icu = $user->get('username');
$icp = $user->get('password');
// Get User groups of the user logged-in
if (version_compare(JVERSION, '3.0', 'lt')) {
$userGroups = $user->getAuthorisedGroups();
} else {
$userGroups = $user->groups;
}
$baseURL = JURI::base();
$subpathURL = JURI::base(true);
$baseURL = str_replace('/administrator', '', $baseURL);
$subpathURL = str_replace('/administrator', '', $subpathURL);
$urlcheck = str_replace('&', '&', JRoute::_('administrator/index.php?option=com_icagenda&view=events') . '&icu=' . $icu . '&icp=' . $icp . '&filter_search=' . $i->id);
// Sub Path filtering
$subpathURL = ltrim($subpathURL, '/');
// URL Event Check filtering
$urlcheck = ltrim($urlcheck, '/');
if (substr($urlcheck, 0, strlen($subpathURL) + 1) == "{$subpathURL}/") {
$urlcheck = substr($urlcheck, strlen($subpathURL) + 1);
}
$urlcheck = rtrim($baseURL, '/') . '/' . ltrim($urlcheck, '/');
$icu_approve = JRequest::getVar('manageraction', '');
$jlayout = JRequest::getCmd('layout', '');
$layouts_array = array('event', 'registration');
$icu_layout = in_array($jlayout, $layouts_array) ? $jlayout : '';
// $icu_layout = JRequest::getVar('layout', '');
if (array_intersect($userGroups, $groupid) || in_array('8', $userGroups)) {
if ($approved == 1) {
if (version_compare(JVERSION, '3.0', 'lt')) {
$approvalButton = '<a class="iCtip" href="' . JRoute::_($managerActionsURL . '&manageraction=approve') . '" title="' . JText::_('COM_ICAGENDA_APPROVE_AN_EVENT_LBL') . '"><div class="iCicon-16 approval"></div></a>';
} else {
$approvalButton = '<a class="iCtip" href="' . JRoute::_($managerActionsURL . '&manageraction=approve') . '" title="' . JText::_('COM_ICAGENDA_APPROVE_AN_EVENT_LBL') . '"><button type="button" class="btn btn-micro btn-warning btn-xs"><i class="icon-checkmark"></i></button></a>';
}
if ($icu_layout == 'event' && $icu_approve == 'approve') {
$db = Jfactory::getDbo();
$query = $db->getQuery(true);
$query->clear();
$query->update(' #__icagenda_events ');
$query->set(' approval = 0 ');
$query->where(' id = ' . (int) $i->id);
$db->setQuery((string) $query);
$db->query($query);
$approveSuccess = '"' . $i->title . '"';
$alertmsg = JText::sprintf('COM_ICAGENDA_APPROVED_SUCCESS', $approveSuccess);
$alerttitle = JText::_('COM_ICAGENDA_APPROVED');
$alerttype = 'success';
$approvedLink = JRoute::_($managerActionsURL);
self::ApprovedNotification($i->created_by_email, $i->username, $i->title, $linkEmailUrl);
$app->enqueueMessage($alertmsg, $alerttitle, $alerttype);
} else {
return $approvalButton;
}
} else {
return false;
}
} else {
return false;
}
}
示例9: verifyUserPassword
public function verifyUserPassword($userid, $password)
{
$db = Jfactory::getDbo();
$query = $db->getQuery(true)->select('password')->from('#__users')->where('id=' . $db->quote($userid));
$db->setQuery($query);
$result = $db->loadResult();
$match = false;
if (!empty($result)) {
if (strpos($result, '$P$') === 0) {
$phpass = new PasswordHash(10, true);
$match = $phpass->CheckPassword($password, $result);
} elseif (substr($result, 0, 4) == '$2y$') {
$password60 = substr($result, 0, 60);
if (JCrypt::hasStrongPasswordSupport()) {
$match = password_verify($password, $password60);
}
} elseif (substr($result, 0, 8) == '{SHA256}') {
$parts = explode(':', $result);
$crypt = $parts[0];
$salt = @$parts[1];
$testcrypt = JUserHelper::getCryptedPassword($password, $salt, 'sha256', false);
$match = $result == $testcrypt;
} else {
$parts = explode(':', $result);
$crypt = $parts[0];
$salt = @$parts[1];
$testcrypt = JUserHelper::getCryptedPassword($password, $salt, 'md5-hex', false);
$match = $crypt == $testcrypt;
}
}
return $match;
}
示例10: thisEventDates
/**
* Return list of all dates (singles and period) from an event
*
* @since 3.5.0 (Not Yet Used)
*/
public static function thisEventDates($id)
{
// Set vars
$nodate = '0000-00-00 00:00:00';
$ic_nodate = '0000-00-00 00:00';
$eventTimeZone = null;
// Get Data
$db = Jfactory::getDbo();
$query = $db->getQuery(true);
$query->select('e.next, e.dates, e.startdate, e.enddate, e.period, e.weekdays, e.displaytime, e.id');
$query->from('#__icagenda_events AS e');
$query->leftJoin('`#__icagenda_category` AS c ON c.id = e.catid');
$query->where('c.state = 1');
$query->where('e.id = ' . $db->q($id));
$db->setQuery($query);
$result = $db->loadObjectList();
// Get Data
$tId = $id;
$tDates = $result->dates;
$tStartdate = $result->startdate;
$tEnddate = $result->enddate;
$tWeekdays = $result->weekdays;
// Declare AllDates array
$thisEventDates = array();
// Get WeekDays Array
$WeeksDays = iCDatePeriod::weekdaysToArray($tWeekdays);
// If Single Dates, added each one to All Dates for this event
$singledates = unserialize($tDates);
foreach ($singledates as $sd) {
$isValid = iCDate::isDate($sd);
if ($isValid) {
array_push($thisEventDates, $sd);
}
}
$perioddates = iCDatePeriod::listDates($tStartdate, $tEnddate, $eventTimeZone);
if (isset($perioddates) && $perioddates != NULL) {
foreach ($perioddates as $Dat) {
if (in_array(date('w', strtotime($Dat)), $WeeksDays)) {
$isValid = iCDate::isDate($Dat);
if ($isValid) {
// $SingleDate = JHtml::date($Dat, 'Y-m-d H:i:s', $eventTimeZone);
$SingleDate = date('Y-m-d H:i:s', strtotime($Dat));
array_push($thisEventDates, $SingleDate);
}
}
}
}
return $thisEventDates;
}