protected function getInput() { if (!NNFrameworkFunctions::extensionInstalled('virtuemart')) { return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>'; } $this->params = $this->element->attributes(); $this->db = JFactory::getDBO(); $group = $this->get('group', 'categories'); $tables = $this->db->getTableList(); if (!in_array($this->db->getPrefix() . 'virtuemart_' . $group, $tables)) { return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>'; } $parameters = NNParameters::getInstance(); $params = $parameters->getPluginParams('nnframework'); $this->max_list_count = $params->max_list_count; if (!is_array($this->value)) { $this->value = explode(',', $this->value); } $options = $this->{'get' . $group}(); $size = (int) $this->get('size'); $multiple = $this->get('multiple'); if ($group == 'categories') { require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php'; return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple); } $attr = ''; $attr .= ' size="' . (int) $size . '"'; $attr .= $multiple ? ' multiple="multiple"' : ''; return JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); }
function hikashopSubscriptionType() { if (!HIKASHOP_PHP5) { $acl =& JFactory::getACL(); } else { $acl = JFactory::getACL(); } if (!HIKASHOP_J16) { $this->groups = $acl->get_group_children_tree(null, 'USERS', false); } else { $db = JFactory::getDBO(); $db->setQuery('SELECT a.*, a.title as text, a.id as value FROM #__usergroups AS a ORDER BY a.lft ASC'); $this->groups = $db->loadObjectList('id'); foreach ($this->groups as $id => $group) { if (isset($this->groups[$group->parent_id])) { $this->groups[$id]->level = intval(@$this->groups[$group->parent_id]->level) + 1; $this->groups[$id]->text = str_repeat('- - ', $this->groups[$id]->level) . $this->groups[$id]->text; } } } $this->choice = array(); $this->choice[] = JHTML::_('select.option', 'none', JText::_('HIKA_NONE')); $this->choice[] = JHTML::_('select.option', 'special', JText::_('HIKA_CUSTOM')); $js = "function updateSubscription(map){\r\n\t\t\tchoice = document.adminForm['choice_'+map];\r\n\t\t\tchoiceValue = 'special';\r\n\t\t\tfor (var i=0; i < choice.length; i++){\r\n\t\t\t\tif (choice[i].checked){\r\n\t\t\t\t\tchoiceValue = choice[i].value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\thiddenVar = document.getElementById('hidden_'+map);\r\n\t\t\tif(choiceValue != 'special'){\r\n\t\t\t\thiddenVar.value = choiceValue;\r\n\t\t\t\tif(hiddenVar.value == 'none') hiddenVar.value = '';\r\n\t\t\t\tdocument.getElementById('div_'+map).style.display = 'none';\r\n\t\t\t}else{\r\n\t\t\t\tdocument.getElementById('div_'+map).style.display = '';\r\n\t\t\t\tspecialVar = eval('document.adminForm.special_'+map);\r\n\t\t\t\tfinalValue = '';\r\n\t\t\t\tfor (var i=0; i < specialVar.length; i++){\r\n\t\t\t\t\tif (specialVar[i].checked){\r\n\t\t\t\t\t\tfinalValue += specialVar[i].value;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\thiddenVar.value = finalValue;\r\n\t\t\t}\r\n\t\t}"; if (!HIKASHOP_PHP5) { $doc =& JFactory::getDocument(); } else { $doc = JFactory::getDocument(); } $doc->addScriptDeclaration($js); }
/** * Enable the backup on update feature */ function com_akeeba_postinstall_backuponupdate_action() { $db = JFactory::getDBO(); $query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('enabled') . ' = ' . $db->q('1'))->where($db->qn('element') . ' = ' . $db->q('backuponupdate'))->where($db->qn('folder') . ' = ' . $db->q('system')); $db->setQuery($query); $db->execute(); }
function sendMemberDaytimeToAdmin($member_id, $service_id, $daytime_id) { define("BodyMemberDaytimeToAdmin", "<h1>Nouvelle inscription à une tranche horaire</h1><p>Un bénévole s'est inscrit à un secteur / tranche horaire.</p><p><strong>Nom :</strong> %s <br /><strong>Secteur :</strong> %s<br /><strong>Date :</strong> %s<br /><strong>Tranche horaire :</strong> %s</p><p><a href=\"" . JURI::root() . "/administrator/index.php?option=com_estivole&view=member&layout=edit&member_id=%s\">Cliquez ici</a> pour valider l'inscription et/ou recontacter le bénévole.</p>"); define("SubjectMemberDaytimeToAdmin", "Nouvelle inscription à une tranche horaire"); $db = JFactory::getDBO(); $query = $db->getQuery(TRUE); $this->user = JFactory::getUser(); // Get the dispatcher and load the user's plugins. $dispatcher = JEventDispatcher::getInstance(); JPluginHelper::importPlugin('user'); $data = new JObject(); $data->id = $this->user->id; // Trigger the data preparation event. $dispatcher->trigger('onContentPrepareData', array('com_users.profilestivole', &$data)); $userProfilEstivole = $data; $userName = $userProfilEstivole->profilestivole['firstname'] . ' ' . $userProfilEstivole->profilestivole['lastname']; $query->select('*'); $query->from('#__estivole_members as b, #__estivole_services as s, #__estivole_daytimes as d'); $query->where('b.member_id = ' . (int) $member_id); $query->where('s.service_id = ' . (int) $service_id); $query->where('d.daytime_id = ' . (int) $daytime_id); $db->setQuery($query); $mailModel = $db->loadObject(); $mail = JFactory::getMailer(); $mail->setBody(sprintf(constant("BodyMemberDaytimeToAdmin"), $userName, $mailModel->service_name, date('d-m-Y', strtotime($mailModel->daytime_day)), date('H:i', strtotime($mailModel->daytime_hour_start)) . ' - ' . date('H:i', strtotime($mailModel->daytime_hour_end)), $mailModel->member_id)); $mail->setSubject(constant("SubjectMemberDaytimeToAdmin")); $mail->isHtml(); $recipient = array('*****@*****.**', $mailModel->email_responsable); $mail->addRecipient($recipient); $mail->Send('*****@*****.**'); }
function rebuild() { $class = hikashop_get('class.category'); $database = JFactory::getDBO(); $query = 'SELECT category_left,category_right,category_depth,category_id,category_parent_id FROM #__hikashop_category ORDER BY category_left ASC'; $database->setQuery($query); $root = null; $categories = $database->loadObjectList(); $class->categories = array(); foreach ($categories as $cat) { $class->categories[$cat->category_parent_id][] = $cat; if (empty($cat->category_parent_id)) { $root = $cat; } } if (!empty($root)) { $query = 'UPDATE `#__hikashop_category` SET category_parent_id = ' . (int) $root->category_id . ' WHERE category_parent_id = 0 AND category_id != ' . (int) $root->category_id . ''; $database->setQuery($query); $database->query(); } $class->rebuildTree($root, 0, 1); $app = JFactory::getApplication(); $app->enqueueMessage(JText::_('CATEGORY_TREE_REBUILT')); $this->listing(); }
function getInput($name, $id, $value, $params, $children, $j15 = 0) { $this->params = $params; JHTML::_('behavior.modal', 'a.modal'); $_size = $this->def('size'); $_multiple = $this->def('multiple', 1); $_doc =& JFactory::getDocument(); $_js = "\n\t\t\tfunction jSelectArticle( id, title, object )\n\t\t\t{\n\t\t\t\tif ( document.getElementById(object+'_name') ) {\n\t\t\t\t\tdocument.getElementById(object+'_id').value = id;\n\t\t\t\t\tdocument.getElementById(object+'_name').value = title;\n\t\t\t\t} else {\n\t\t\t\t\t// multiple\n\t\t\t\t\tdocument.getElementById(object+'_id').value = document.getElementById(object+'_id').value.trim();\n\t\t\t\t\tif ( document.getElementById(object+'_id').value ) {\n\t\t\t\t\t\t document.getElementById(object+'_id').value += ',';\n\t\t\t\t\t}\n\t\t\t\t\tdocument.getElementById(object+'_id').value += id;\n\t\t\t\t}\n\t\t\t\tdocument.getElementById('sbox-window').close();\n\t\t\t}"; $_doc->addScriptDeclaration($_js); $_link = 'index.php?option=com_content&task=element&tmpl=component&object=' . $id; $html = "\n" . '<div style="float: left;">'; if (!$_multiple) { $val_name = $value; if ($value) { $db =& JFactory::getDBO(); // load the list of menu types $query = 'SELECT title' . ' FROM #__content' . ' WHERE id = ' . $value . ' LIMIT 1'; $db->setQuery($query); $val_name = $db->loadResult(); $val_name .= ' [' . $value . ']'; } $html .= '<input type="text" id="' . $id . '_name" value="' . $val_name . '" class="inputbox" size="' . $_size . '" disabled="disabled" />'; $html .= '<input type="hidden" name="' . $name . '" id="' . $id . '_id" value="' . $value . '" />'; } else { $html .= '<input type="text" name="' . $name . '" id="' . $id . '_id" value="' . $value . '" class="inputbox" size="' . $_size . '" />'; } $html .= '</div>'; $html .= '<div class="button2-left"><div class="blank"><a class="modal" title="' . JText::_('NN_SELECT_AN_ARTICLE') . '" href="' . $_link . '" rel="{handler: \'iframe\', size: {x: 650, y: 375}}">' . JText::_('NN_SELECT') . '</a></div></div>' . "\n"; return $html; }
protected function getOptions() { // Initialize variables. $session = JFactory::getSession(); $attr = ''; // Initialize some field attributes. $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; // To avoid user's confusion, readonly="true" should imply disabled="true". if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') { $attr .= ' disabled="disabled"'; } $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $attr .= $this->multiple ? ' multiple="multiple"' : ''; // Initialize JavaScript field attributes. $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; $db = JFactory::getDBO(); // generating query $db->setQuery("SELECT c.title AS name, c.id AS id, c.parent_id AS parent FROM #__categories AS c WHERE published = 1 AND extension = 'com_solidres' ORDER BY c.title, c.parent_id ASC"); // getting results $results = $db->loadObjectList(); if (count($results)) { // iterating $temp_options = array(); foreach ($results as $item) { array_push($temp_options, array($item->id, $item->name, $item->parent)); } foreach ($temp_options as $option) { if ($option[2] == 1) { $this->options[] = JHtml::_('select.option', $option[0], $option[1]); $this->recursive_options($temp_options, 1, $option[0]); } } } }
function displayAnnouncement($tpl = null) { if (KunenaFactory::getConfig()->showannouncement > 0) { $moderator = intval($this->me->isModerator('global')); $cache = JFactory::getCache('com_kunena', 'output'); if ($cache->start("{$this->template->name}.common.announcement.{$moderator}", 'com_kunena.template')) return; // User needs to be global moderator to edit announcements if ($moderator) { $this->canEdit = true; } else { $this->canEdit = false; } // FIXME: move into model $db = JFactory::getDBO(); $query = "SELECT * FROM #__kunena_announcement WHERE published='1' ORDER BY created DESC"; $db->setQuery ( $query, 0, 1 ); $this->announcement = $db->loadObject (); if (KunenaError::checkDatabaseError()) return; if ($this->announcement) { $this->annTitle = KunenaHtmlParser::parseText($this->announcement->title); $this->annDescription = $this->announcement->sdescription ? KunenaHtmlParser::parseBBCode($this->announcement->sdescription) : KunenaHtmlParser::parseBBCode($this->announcement->description, 300); $this->annDate = KunenaDate::getInstance($this->announcement->created); $this->annListURL = KunenaRoute::_("index.php?option=com_kunena&view=announcement&layout=list"); $this->annMoreURL = !empty($this->announcement->description) ? KunenaRoute::_("index.php?option=com_kunena&view=announcement&id={$this->announcement->id}") : null; $result = $this->loadTemplate($tpl); if (JError::isError($result)) { return $result; } echo $result; } else { echo ' '; } $cache->end(); } else echo ' '; }
protected function getListQuery() { // Create a new query object. $db = JFactory::getDBO(); $query = $db->getQuery(true)->select($this->fields)->from($this->table_name . ' as h')->leftJoin('#__fleet_entity as c ON entity_id=c.id')->leftJoin('#__fleet_entity as b ON b.id=c.parent_entity_id'); return $query; }
function onPromoteData($id) { $db = JFactory::getDBO(); $Itemid = JRequest::getInt('Itemid'); $jschk = $this->_chkextension(); if (!empty($jschk)) { $query = "SELECT cf.id FROM #__community_fields as cf\n\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cf.name like '%About me%' AND cfv.user_id=" . $id; $db->setQuery($query); $fieldid = $db->loadresult(); $query = "SELECT u.name AS title, cu.avatar AS image, cfv.value AS bodytext\n\t\t\t\t\t\t\t\t\tFROM #__users AS u\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_users AS cu ON u.id=cu.userid\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cu.userid=cfv.user_id\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields AS cf ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cu.userid =" . $id; if ($fieldid) { $query .= " AND cfv.field_id=" . $fieldid; } $db->setQuery($query); $previewdata = $db->loadObjectlist(); if (!$fieldid) { $previewdata[0]->bodytext = ''; } // Include Jomsocial core $jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community'; include_once $jspath . DS . 'libraries' . DS . 'core.php'; $previewdata[0]->url = JUri::root() . substr(CRoute::_('index.php?option=com_community&view=profile&userid=' . $id), strlen(JUri::base(true)) + 1); if ($previewdata[0]->image == '') { $previewdata[0]->image = 'components/com_community/assets/user-Male.png'; } return $previewdata; } else { return ''; } }
/** * Builds the query to select contact items * @param array * @return string * @access protected */ function _getContactQuery(&$options) { // TODO: Cache on the fingerprint of the arguments $db =& JFactory::getDBO(); $aid = @$options['aid']; $id = @$options['id']; $groupBy = @$options['group by']; $orderBy = @$options['order by']; $select = 'a.*, cc.title as category_name'; $from = '#__contact_details AS a'; $joins[] = 'INNER JOIN #__categories AS cc on cc.id = a.catid'; $wheres[] = 'a.id = ' . (int) $id; $wheres[] = 'a.published = 1'; $wheres[] = 'cc.published = 1'; if ($aid !== null) { $wheres[] = 'a.access <= ' . (int) $aid; $wheres[] = 'cc.access <= ' . (int) $aid; } /* * Query to retrieve all categories that belong under the contacts * section and that are published. */ $query = 'SELECT ' . $select . ' FROM ' . $from . ' ' . implode(' ', $joins) . ' WHERE ' . implode(' AND ', $wheres); return $query; }
/** * Contructor * */ public function JSNISData() { $this->_setRootTag('database'); $this->_xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><' . $this->_rootTag . '></' . $this->_rootTag . '>'); $this->_setAttributteRootTag(); $this->_db = JFactory::getDBO(); }
function getObjectOwner($id) { $db =& JFactory::getDBO(); $db->setQuery("SELECT created_by, id FROM #__zoo_core_item WHERE id = " . $id); $userid = $db->loadResult(); return intval($userid); }
function __construct($name = null, $extensions = false) { jimport('legacy.component.helper'); JLoader::import('helpers.jupgradepro', JPATH_COMPONENT_ADMINISTRATOR); // Creating dabatase instance for this installation $this->_db = JFactory::getDBO(); // Set step table if ($extensions == false) { $this->_table = '#__jupgradepro_steps'; } else { if ($extensions === 'tables') { $this->_table = '#__jupgradepro_extensions_tables'; } else { if ($extensions == true) { $this->_table = '#__jupgradepro_extensions'; } } } // Get the old version $this->old_ver = JUpgradeproHelper::getVersion('old'); // Load the last step from database if ($name !== false) { $this->_load($name); } }
/** * Method to get the list of template style options * grouped by template. * Use the client attribute to specify a specific client. * Use the template attribute to specify a specific template * * @return array The field option objects as a nested array in groups. * * @since 11.1 */ protected function getGroups() { // Initialize variables. $groups = array(); $lang = JFactory::getLanguage(); // Get the client and client_id. $clientName = $this->element['client'] ? (string) $this->element['client'] : 'site'; $client = JApplicationHelper::getClientInfo($clientName, true); // Get the template. $template = (string) $this->element['template']; // Get the database object and a new query object. $db = JFactory::getDBO(); $query = $db->getQuery(true); // Build the query. $query->select('s.id, s.title, e.name as name, s.template'); $query->from('#__template_styles as s'); $query->where('s.client_id = ' . (int) $client->id); $query->order('template'); $query->order('title'); if ($template) { $query->where('s.template = ' . $db->quote($template)); } $query->join('LEFT', '#__extensions as e on e.element=s.template'); $query->where('e.enabled=1'); // Set the query and load the styles. $db->setQuery($query); $styles = $db->loadObjectList(); // Build the grouped list array. if ($styles) { foreach ($styles as $style) { $template = $style->template; $lang->load('tpl_' . $template . '.sys', $client->path, null, false, false) || $lang->load('tpl_' . $template . '.sys', $client->path . '/templates/' . $template, null, false, false) || $lang->load('tpl_' . $template . '.sys', $client->path, $lang->getDefault(), false, false) || $lang->load('tpl_' . $template . '.sys', $client->path . '/templates/' . $template, $lang->getDefault(), false, false); $name = JText::_($style->name); // Initialize the group if necessary. if (!isset($groups[$name])) { $groups[$name] = array(); } $groups[$name][] = JHtml::_('select.option', $style->id, $style->title); } } // Merge any additional groups in the XML definition. $groups = array_merge(parent::getGroups(), $groups); return $groups; }
function display($dummy1 = false, $dummy2 = false) { $moduleId = JRequest::getInt('formid'); if (empty($moduleId)) { return; } if (JRequest::getInt('interval') > 0) { setcookie('acymailingSubscriptionState', true, time() + JRequest::getInt('interval'), '/'); } $db = JFactory::getDBO(); $db->setQuery('SELECT * FROM #__modules WHERE id = ' . intval($moduleId) . ' AND `module` LIKE \'%acymailing%\' LIMIT 1'); $module = $db->loadObject(); if (empty($module)) { echo 'No module found'; exit; } $module->user = substr($module->module, 0, 4) == 'mod_' ? 0 : 1; $module->name = $module->user ? $module->title : substr($module->module, 4); $module->style = null; $module->module = preg_replace('/[^A-Z0-9_\\.-]/i', '', $module->module); $params = array(); if (JRequest::getInt('autofocus', 0)) { acymailing_loadMootools(); $js = "\n\t\t\t\twindow = addEvent('load', function(){\n\t\t\t\t\tthis.focus();\n\t\t\t\t\tvar moduleInputs = document.getElementsByTagName('input');\n\t\t\t\t\tif(moduleInputs){\n\t\t\t\t\t\tvar i = 0;\n\t\t\t\t\t\twhile(moduleInputs[i].disabled == true){\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(moduleInputs[i]) moduleInputs[i].focus();\n\t\t\t\t\t}\n\t\t\t\t});"; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); } echo JModuleHelper::renderModule($module, $params); }
/** * Retireve a list of currencies from the database. * This function is used in the backend for the currency listing, therefore no asking if enabled or not * @author Max Milbers * @return object List of currency objects */ function getItemList($search = '') { $select = ' supplier.* FROM #__tsmart_supplier AS supplier'; $where = array(); $user = JFactory::getUser(); $shared = ''; if (vmAccess::manager()) { $shared = 'OR `supplier.shared`="1"'; } if (empty($search)) { $search = vRequest::getString('search', false); } // add filters if ($search) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; $where[] = '`supplier.supplier_name` LIKE ' . $search; } $whereString = ''; if (count($where) > 0) { $whereString = ' WHERE ' . implode(' AND ', $where); } $data = $this->exeSortSearchListQuery(0, $select, '', $whereString, '', $this->_getOrdering()); return $data; }
/** * Validates the order status record fields. * * @return boolean True if the table buffer is contains valid data, false otherwise. */ function check() { // if (empty($this->order_status_code)) { // vmError(JText::_('COM_VIRTUEMART_ORDER_TABLE_ERROR_CODE')); // return false; // } // if (empty($this->order_status_name)) { // vmError(JText::_('COM_VIRTUEMART_ORDER_TABLE_ERROR_NAME')); // return false; // } $db = JFactory::getDBO(); $q = 'SELECT count(*),virtuemart_orderstate_id FROM `#__virtuemart_orderstates` '; $q .= 'WHERE `order_status_code`="' . $this->order_status_code . '"'; $db->setQuery($q); $row = $db->loadRow(); if (is_array($row)) { if ($row[0] > 0) { if ($row[1] != $this->virtuemart_orderstate_id) { vmError(JText::_('COM_VIRTUEMART_ORDER_STATUS_CODE_EXISTS')); return false; } } } return parent::check(); }
public function postflight($type, $parent) { $db = JFactory::getDBO(); $query = "UPDATE #__extensions SET enabled=1 WHERE type='plugin' AND element=" . $db->Quote('bt_shortcode') . " AND folder=" . $db->Quote('editors-xtd'); $db->setQuery($query); $db->query(); }
/** * Method to get an ojbect. * * @param integer The id of the object to get. * * @return mixed Object on success, false on failure. FIGYELEM!!! alternativák tömb is!!!!! */ public function &getItem($id = null) { $db = JFactory::getDBO(); if ($this->_item === null) { $this->_item = false; if (empty($id)) { $id = $this->getState('alternativak.id'); } // Get a level row instance. $table = JTable::getInstance('Alternativak', 'Table'); // Attempt to load the row. if ($id == null | $id == 0) { // rekord init felvitelhez $user = JFactory::getUser(); $this->_item = new stdclass(); $this->_item->id = 0; $this->_item->megnevezes = ''; $this->_item->leiras = ''; $this->_item->temakor_id = JRequest::getVar('temakor', 0); $this->_item->szavazas_id = JRequest::getVar('szavazas', 0); $this->_item->letrehozo = $user->id; $this->_item->letrehozva = date('Y-m-d H:i:s'); } else { if ($table->load($id)) { // Convert the JTable to a clean JObject. $this->_item = JArrayHelper::toObject($table->getProperties(1), 'JObject'); } else { if ($error = $table->getError()) { $this->setError($error); } } } } return $this->_item; }
function getObjectOwner($id) { $db =& JFactory::getDBO(); $db->setQuery('SELECT created_by, id FROM #__jcp_polls WHERE id = ' . $id); $userid = $db->loadResult(); return $userid; }
/** * Update method to register message sending events. * * @access public * @param $args['news_id'] Newsletter identifier refferring to the event. * * @param $args['msg_id'] Message identifier refferring to the event. * @return false if something wrong. * @since 0.6 */ function update(&$args) { jincimport('utility.servicelocator'); $servicelocator = ServiceLocator::getInstance(); $logger = $servicelocator->getLogger(); if (!isset($args['news_id']) || !isset($args['msg_id'])) { return false; } $news_id = (int) $args['news_id']; $msg_id = (int) $args['msg_id']; $dbo =& JFactory::getDBO(); $query = 'UPDATE #__jinc_newsletter SET lastsent = now() ' . 'WHERE id = ' . (int) $news_id; $dbo->setQuery($query); $logger->debug('SentMsgEvent: executing query: ' . $query); if (!$dbo->query()) { $logger->error('SentMsgEvent: error updating last newsletter dispatch date'); return false; } $query = 'UPDATE #__jinc_message SET datasent = now() ' . 'WHERE id = ' . (int) $msg_id; $dbo->setQuery($query); $logger->debug('SentMsgEvent: executing query: ' . $query); if (!$dbo->query()) { $logger->error('SentMsgEvent: error updating last message dispatch date'); return false; } return true; }
/** * SEF url parser * * @access public * @static * @param $router object of JRouter class * @param $uri object of JURI class */ function parseJumiRouter(&$router, &$uri) { if ($router->getMode() == JROUTER_MODE_RAW) { return array(); } $db =& JFactory::getDBO(); $db->setQuery('select id, title, alias from #__jumi where published = 1'); $apps = $db->loadRowList(); $alias = array(); foreach ($apps as $i => $app) { if (empty($app[2])) { $apps[$i][2] = JFilterOutput::stringURLSafe($app[1]); } $alias[$i] = $apps[$i][2]; } $segments = explode('/', $uri->getPath()); foreach ($segments as $i => $segment) { if (($j = array_search($segment, $alias)) !== false) { unset($segments[$i]); $uri->setVar('option', 'com_jumi'); $uri->setVar('fileid', $apps[$j][0]); } } $uri->setPath(implode('/', $segments)); return array(); }
function display($tpl = null) { //initialise variables $document =& JFactory::getDocument(); $db =& JFactory::getDBO(); $app =& JFactory::getApplication(); JHTML::_('behavior.tooltip'); JHTML::_('behavior.modal'); //get vars $filter_order = $app->getUserStateFromRequest('com_eventlist.categoryelement.filter_order', 'filter_order', 'c.ordering', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest('com_eventlist.categoryelement.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_state = $app->getUserStateFromRequest('com_eventlist.categoryelement.filter_state', 'filter_state', '*', 'word'); $search = $app->getUserStateFromRequest('com_eventlist.categoryelement.search', 'search', '', 'string'); $search = $db->getEscaped(trim(JString::strtolower($search))); $template = $app->getTemplate(); //prepare document $document->setTitle(JText::_('SELECT CATEGORY')); $document->addStyleSheet('templates/' . $template . '/css/general.css'); $document->addStyleSheet('components/com_eventlist/assets/css/eventlistbackend.css'); // Get data from the model $rows =& $this->get('Data'); $pageNav =& $this->get('Pagination'); //publish unpublished filter $lists['state'] = JHTML::_('grid.state', $filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; //assign data to template $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('pageNav', $pageNav); parent::display($tpl); }
/** * Creates category filter * * @param unknown_type $filtertype * @param unknown_type $contentElement * @return unknown */ public function createFilterHTML() { $db = JFactory::getDBO(); if (!$this->filterField) { return ""; } // limit choices to specific section $sectionfilter = ""; if ($this->section_filter_value != -1) { $sectionfilter = " AND section=" . $db->quote($this->section_filter_value); } $categoryOptions = array(); $categoryOptions[-1] = JHTML::_('select.option', '-1', JText::_('ALL_CATEGORIES')); // if content categories then add "static content" null category if ($this->tableName == "content" && $this->section_filter_value <= 0) { $categoryOptions[0] = JHTML::_('select.option', '0', JText::_('UNCATEGORIZED')); } // $sql = "SELECT c.id, c.title FROM #__categories as c ORDER BY c.title"; $sql = "SELECT DISTINCT cat.id, cat.title FROM #__categories as cat, #__" . $this->tableName . " as c\n\t\t\tWHERE c." . $this->filterField . "=cat.id {$sectionfilter} ORDER BY cat.title"; $db->setQuery($sql); $cats = $db->loadObjectList(); $catcount = 0; foreach ($cats as $cat) { $categoryOptions[$cat->id] = JHTML::_('select.option', $cat->id, $cat->title); $catcount++; } $categoryList = array(); $categoryList["title"] = JText::_('CATEGORY_FILTER'); $categoryList["html"] = JHTML::_('select.genericlist', $categoryOptions, 'category_filter_value', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $this->filter_value); return $categoryList; }
public static function getEmails($list_id = 0) { $db = JFactory::getDBO(); $query = $db->getQuery(true); //get Acymailing subscribers email $query->select('s.email')->from('#__acymailing_subscriber AS s')->join('LEFT', '#__acymailing_listsub AS l ON s.subid = l.subid')->where('l.listid = ' . (int) $list_id)->where('l.status = 1')->where('s.enabled = 1')->where('s.accept = 1'); $db->setQuery($query); try { $emails = $db->loadColumn(); } catch (RuntimeException $e) { if (PWEBCONTACT_DEBUG) { modPwebcontactHelper::setLog('Acymailing query error: ' . $e->getMessage()); } return false; } if (version_compare(JVERSION, '3.0.0') == -1 and $error = $db->getErrorMsg()) { if (PWEBCONTACT_DEBUG) { modPwebcontactHelper::setLog('Acymailing query error: ' . $error); } return false; } if (is_array($emails) and count($emails)) { return $emails; } return false; }
protected function getInput() { // Base name of the HTML control. $ctrl = $this->name; $value = $this->value; // Construct an array of the HTML OPTION statements. $options = array(); // Construct the various argument calls that are supported. $attribs = ' '; if (isset($this->element['size'])) { $attribs .= 'size="' . (int) $this->element['size'] . '"'; } if (isset($this->element['class'])) { $attribs .= 'class="' . (string) $this->element['class'] . '"'; } else { $attribs .= 'class="inputbox"'; } if (isset($this->element['multiple'])) { $attribs .= ' multiple="multiple"'; } $db = JFactory::getDBO(); $options = array(); $options[0] = new stdClass(); $options[0]->id = 0; $options[0]->name = JText::_('RSM_NO_CATEGORY'); $db->setQuery("SELECT * FROM #__rsmembership_categories ORDER BY ordering"); $options = array_merge($options, $db->loadObjectList()); if ($value == '') { $value = $options; } // Render the HTML SELECT list. return JHTML::_('select.genericlist', $options, $ctrl, $attribs, 'id', 'name', $value, $ctrl); }
function _save_templateinvite($apply = 0) { $app = JFactory::getApplication(); // initialize variables $db = JFactory::getDBO(); //$post = $_POST; $post = JFactory::getApplication()->input->getArray(array()); $row = JTable::getInstance('template_invite'); $id = JFactory::getApplication()->input->get('id', 0, 'int'); if (!$row->bind($post)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $msg = JText::_('AUP_TEMPLATESAVED'); if (!$apply) { JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints&task=templateinvite', $msg); } else { JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints&task=edittemplateinvite&cid[]=' . $id, $msg); } JControllerLegacy::redirect(); }
/** * Displays the form * * @param string $tpl - The tmpl * * @return mixed|void */ public function display($tpl = null) { if (MatukioHelperSettings::getSettings('rss_feed', 1) == 0) { JError::raiseError(403, JText::_("ALERTNOTAUTH")); } $database = JFactory::getDBO(); $neudatum = MatukioHelperUtilsDate::getCurrentDate(); $where = array(); $database->setQuery("SELECT id, access FROM #__categories WHERE extension='" . JFactory::getApplication()->input->get('option') . "'"); $cats = $database->loadObjectList(); $allowedcat = array(); foreach ($cats as $cat) { if ($cat->access < 1) { $allowedcat[] = $cat->id; } } if (count($allowedcat) > 0) { $allowedcat = implode(',', $allowedcat); $where[] = "a.catid IN ({$allowedcat})"; } $where[] = "a.published = '1'"; $where[] = "a.end > '{$neudatum}'"; $where[] = "a.booked > '{$neudatum}'"; $database->setQuery("SELECT a.*, r.*, cat.title AS category FROM #__matukio_recurring AS r\r\n\t\t LEFT JOIN #__matukio AS a ON r.event_id = a.id\r\n\t\t LEFT JOIN #__categories AS cat ON cat.id = a.catid" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "") . "\nORDER BY r.begin ASC" . "\nLIMIT 0, 1000"); $rows = $database->loadObjectList(); $this->rows = $rows; parent::display($tpl); }
function onLoginUser($user, $options) { $device = JRequest::getVar('device', ''); if ($_SERVER['REMOTE_ADDR'] == '174.111.57.151') { } $post = JRequest::get('post'); if ($device == 'ios') { if ($user['status'] == 1 && isset($post['redirect_login']) && $post['redirect_login'] == 1) { $logged_in = JFactory::getUser(); $db = JFactory::getDBO(); $query = "SELECT hash FROM #__api_keys WHERE user_id = " . $db->Quote($logged_in->id); $db->setQuery($query); $apikey = $db->loadResult(); if (!$apikey) { jimport('joomla.application.component.model'); JTable::addIncludePath(JPATH_SITE . '/components/com_api/tables'); JModel::addIncludePath(JPATH_SITE . '/components/com_api/models'); JLoader::register('ApiModel', JPATH_SITE . '/components/com_api/libraries/model.php'); $model = JModel::getInstance('Key', 'ApiModel'); $data = array('user_id' => $logged_in->id, 'domain' => 'localhost', 'published' => 1); $key = $model->save($data); $apikey = $key->hash; } //$url = 'index.php?option=com_api&app=community&resource=user&data=1&key='.$apikey; $url = 'hooked://' . $apikey; //JFactory::getApplication()->redirect($url); header("Location: " . $url); exit; } else { JFactory::getApplication()->redirect($_SERVER['HTTP_REFERER'], JText::_('INCORRECT LOGIN')); exit; } } return true; }