function addEvForm() { $listid = JRequest::getInt('listid'); $viewName = 'calendar'; $usersConfig = JComponentHelper::getParams('com_fabrik'); $model =& $this->getModel($viewName); $id = JRequest::getInt('visualizationid', $usersConfig->get('visualizationid', 0)); $model->setId($id); $model->setupEvents(); if (array_key_exists($listid, $model->_events)) { $datefield = $model->_events[$listid][0]['startdate']; } else { $config = JFactory::getConfig(); $prefix = $config->getValue('config.dbprefix'); $datefield = $prefix . 'fabrik_calendar_events___start_date'; } $rowid = JRequest::getInt('rowid'); $listModel = JModel::getInstance('list', 'FabrikFEModel'); $listModel->setId($listid); $table = $listModel->getTable(); JRequest::setVar('view', 'form'); JRequest::setVar('formid', $table->form_id); JRequest::setVar('tmpl', 'component'); JRequest::setVar('ajax', '1'); $link = 'index.php?option=com_fabrik&view=form&formid=' . $table->form_id . '&rowid=' . $rowid . '&tmpl=component&ajax=1'; $link .= '&jos_fabrik_calendar_events___visualization_id=' . JRequest::getInt('jos_fabrik_calendar_events___visualization_id'); $start_date = JRequest::getVar('start_date', ''); if (!empty($start_date)) { $link .= "&{$datefield}=" . $start_date; } // $$$ rob have to add this to stop the calendar filtering itself after adding an new event? $link .= '&clearfilters=1'; $this->setRedirect($link); }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { // Initialise variables. $html = array(); $recordId = (int) $this->form->getValue('id'); $size = ($v = $this->element['size']) ? ' size="' . $v . '"' : ''; $class = ($v = $this->element['class']) ? ' class="' . $v . '"' : 'class="text_area"'; // Get a reverse lookup of the base link URL to Title $model = JModel::getInstance('menutypes', 'menusModel'); $rlu = $model->getReverseLookup(); switch ($this->value) { case 'url': $value = JText::_('COM_MENUS_TYPE_EXTERNAL_URL'); break; case 'alias': $value = JText::_('COM_MENUS_TYPE_ALIAS'); break; case 'separator': $value = JText::_('COM_MENUS_TYPE_SEPARATOR'); break; default: $link = $this->form->getValue('link'); // Clean the link back to the option, view and layout $value = JText::_(JArrayHelper::getValue($rlu, MenusHelper::getLinkKey($link))); break; } // Load the javascript and css JHtml::_('behavior.framework'); JHtml::_('behavior.modal'); $html[] = '<input type="text" readonly="readonly" disabled="disabled" value="' . $value . '"' . $size . $class . ' />'; $html[] = '<input type="button" value="' . JText::_('JSELECT') . '" onclick="SqueezeBox.fromElement(this, {handler:\'iframe\', size: {x: 600, y: 450}, url:\'' . JRoute::_('index.php?option=com_menus&view=menutypes&tmpl=component&recordId=' . $recordId) . '\'})" />'; $html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" />'; return implode("\n", $html); }
/** * Load up a field 'select as' statement * * @param JModel $formModel Form model * @param string $fieldName Element full name * @param array &$asfields As fields to append as statement to * @param array $opts Options * * @throws RuntimeException * * @return void */ private function asField($formModel, $fieldName, &$asfields, $opts) { $elementModel = $formModel->getElement($fieldName); $fields = array(); if ($elementModel) { if ($elementModel->getElement()->published != 1) { throw new RuntimeException('Approval ' . $fieldName . ' element must be published', 500); } $elementModel->getAsField_html($asfields, $fields, $opts); } }
/** * Function that allows child controller access to model data after the data has been saved. * * @param JModel $model The data model object. * * @return void * @since 1.6 */ protected function postSaveHook(JModel &$model, $validData = array()) { // Initialise variables. $app = JFactory::getApplication(); $task = $this->getTask(); switch ($task) { case 'save2new': $app->setUserState('com_modules.add.module.extension_id', $model->getState('module.extension_id')); break; default: $app->setUserState('com_modules.add.module.extension_id', null); break; } }
public function display($tpl = null) { TOOLBAR_enmasse::_SMENU(); $task = JRequest::getWord('task'); switch ($task) { case 'show': TOOLBAR_enmasse::_BILLTEMPLATE(); $this->arBillTmpl = JModel::getInstance('billTemplate', 'enmasseModel')->listAll(); break; case 'edit': TOOLBAR_enmasse::_BILLTEMPLATE_EDIT(); $cid = JRequest::getVar('cid', array(), 'method', 'array'); if (!empty($cid)) { $this->oBillTmpl = JModel::getInstance('billTemplate', 'enmasseModel')->getById($cid[0]); if (!$this->oBillTmpl->id) { $link = JRoute::_('index.php?option=com_enmasse&controller=billTemplate&task=show'); $msg = JText::_('BILL_TEMPLATE_INVALID_TEMPLATE_MSG'); JFactory::getApplication()->redirect($link, $msg, 'error'); } } else { $link = JRoute::_('index.php?option=com_enmasse&controller=billTemplate&task=show'); $msg = JText::_('BILL_TEMPLATE_INVALID_TEMPLATE_MSG'); JFactory::getApplication()->redirect($link, $msg, 'error'); } break; } parent::display($tpl); }
public function post() { // Set variables to be used JMHelper::setSessionUser(); JFactory::getLanguage()->load('com_users', JPATH_ADMINISTRATOR); // Include dependencies jimport('joomla.application.component.controller'); jimport('joomla.form.form'); jimport('joomla.database.table'); JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_users/models'); JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_users/models/forms'); JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_users/tables'); // Get user data $data = JRequest::getVar('jform', array(), 'post', 'array'); if (!isset($data['groups'])) { $data['groups'] = array(); } // Save user $model = JModel::getInstance('User', 'UsersModel'); $model->getState('user.id'); // This is only here to trigger populateState() $success = $model->save($data); if ($model->getError()) { $response = $this->getErrorResponse(400, $model->getError()); } elseif (!$success) { $response = $this->getErrorResponse(400, JText::_('COM_JM_ERROR_OCURRED')); } else { $response = $this->getSuccessResponse(201, JText::_('COM_JM_SUCCESS')); $response->id = $model->getState('user.id'); } $this->plugin->setResponse($response); }
/** * Base Controller Constructor * * @param array $config Controller initialization configuration parameters * @return void * @since 0.1 */ public function __construct($config = array()) { parent::__construct($config); $this->set('option', JRequest::getCmd('option')); JModel::addIncludePath(JPATH_SITE . '/components/com_api/models'); JTable::addIncludePath(JPATH_SITE . '/components/com_api/tables'); }
function getState($property = null) { if (!$this->__state_set) { $option = JRequest::getCmd('option'); $app =& JFactory::getApplication(); $context = $option . '.' . $this->getName(); $this->setState('filter_published', $app->getUserStateFromRequest($context . '.filter_published', 'filter_published', 0, 'int')); $this->setState('filter_catid', $app->getUserStateFromRequest($context . '.filter_catid', 'filter_catid', 0, 'int')); $this->setState('filter_species', $app->getUserStateFromRequest($context . '.filter_species', 'filter_species', 0, 'word')); $this->setState('filter_location_state', $app->getUserStateFromRequest($context . '.filter_location_state', 'filter_location_state', 0, 'word')); $this->setState('filter_adoption_status', $app->getUserStateFromRequest($context . '.filter_adoption_status', 'filter_adoption_status', 0, 'word')); $this->setState('filter_real_time_need', $app->getUserStateFromRequest($context . '.filter_real_time_need', 'filter_real_time_need', 0, 'word')); $this->setState('filter_real_time_status', $app->getUserStateFromRequest($context . '.filter_real_time_status', 'filter_real_time_status', 0, 'word')); $this->setState('filter_search', $app->getUserStateFromRequest($context . '.filter_search', 'filter_search', '')); $this->setState('filter_order', $app->getUserStateFromRequest($context . '.filter_order', 'filter_order', 'title', 'cmd')); $this->setState('filter_order_Dir', $app->getUserStateFromRequest($context . '.filter_order_Dir', 'filter_order_Dir', 'ASC', 'word')); $limit = $app->getUserStateFromRequest($context . '.limit', 'limit', $app->getCfg('list_limit', 5), 'int'); //strange limitstart // $limitstart = $app->getUserStateFromRequest( $context.'.limitstart', 'limitstart', 0, 'int' ); $limitstart = JRequest::getInt('limitstart', 0, '', 'int'); $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $this->setState('limit', $limit); $this->setState('limitstart', $limitstart); $this->__state_set = true; } return parent::getState($property); }
function display($tpl = null) { $option = JRequest::getCmd('option'); $mainframe = JFactory::getApplication(); $uri = JFactory::getUri(); // Get data from the model $items = $this->get('Items'); $this->assignRef('items', $items); foreach ($this->items as $item) { $item->count_projectdivisions = 0; $mdlProjectDivisions = JModel::getInstance("divisions", "JoomleagueModel"); $item->count_projectdivisions = $mdlProjectDivisions->getProjectDivisionsCount($item->id); $item->count_projectpositions = 0; $mdlProjectPositions = JModel::getInstance("Projectposition", "JoomleagueModel"); $item->count_projectpositions = $mdlProjectPositions->getProjectPositionsCount($item->id); $item->count_projectreferees = 0; $mdlProjectReferees = JModel::getInstance("Projectreferees", "JoomleagueModel"); $item->count_projectreferees = $mdlProjectReferees->getProjectRefereesCount($item->id); $item->count_projectteams = 0; $mdlProjecteams = JModel::getInstance("Projectteams", "JoomleagueModel"); $item->count_projectteams = $mdlProjecteams->getProjectTeamsCount($item->id); $item->count_matchdays = 0; $mdlRounds = JModel::getInstance("Rounds", "JoomleagueModel"); $item->count_matchdays = $mdlRounds->getRoundsCount($item->id); } $this->addToolbar(); parent::display($tpl); }
function __construct() { parent::__construct(); $cid = JRequest::getVar('cid', 0); $this->_cid = $cid; $this->_issearch = JRequest::getVar('issearch', 0); }
function doCron(&$pluginManager) { $db = FabrikWorker::getDbo(); $cid = JRequest::getVar('element_id', array(), 'method', 'array'); $query = $db->getQuery(); $query->select('id, plugin')->from('#__{package}_cron'); if (!empty($cid)) { $query->where(" id IN (" . implode(',', $cid) . ")"); } $db->setQuery($query); $rows = $db->loadObjectList(); $viewModel = JModel::getInstance('view', 'FabrikFEModel'); $c = 0; foreach ($rows as $row) { //load in the plugin $plugin =& $pluginManager->getPlugIn($row->plugin, 'cron'); $plugin->setId($row->id); $params =& $plugin->getParams(); $thisViewModel = clone $viewModel; $thisViewModel->setId($params->get('table')); $table =& $viewModel->getTable(); $total = $thisViewModel->getTotalRecords(); $nav =& $thisViewModel->getPagination($total, 0, $total); $data = $thisViewModel->getData(); // $$$ hugh - added table model param, in case plugin wants to do further table processing $c = $c + $plugin->process($data, $thisViewModel); } $query = $db->getQuery(); $query->update('#__{package}_cron')->set('lastrun=NOW()')->where("id IN (" . implode(',', $cid) . ")"); $db->setQuery($query); $db->query(); }
/** * Constructor that retrieves the ID from the request * * @access public * @return void */ function __construct() { parent::__construct(); ini_set('max_execution_time', '3600'); $this->_config = $this->getConfig(); $this->getConnectToExternalDB(); }
/** * Constructor * * @since 0.1 */ function __construct() { parent::__construct(); $array = JRequest::getVar('cid', array(0), '', 'array'); $this->setId((int) $array[0]); $this->setSubmitKey(JRequest::getVar('submit_key', '')); }
function __construct() { parent::__construct(); global $option; $id = JRequest::getInt('feed_id', 0, '', 'int'); $this->setId((int) $id); }
/** * get the list's active/selected plug-ins * @return array */ public function getPlugins() { $item = $this->getItem(); // load up the active plug-ins $dispatcher =& JDispatcher::getInstance(); $plugins = JArrayHelper::getValue($item->params, 'plugins', array()); $return = array(); //JModel::addIncludePath(JPATH_SITE.DS.'components'.DS.'com_fabrik'.DS.'models'); $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikFEModel'); //@todo prob wont work for any other model that extends this class except for the form/list model switch (get_class($this)) { case 'FabrikModelList': $class = 'list'; break; default: $class = 'form'; } $feModel = JModel::getInstance($class, 'FabrikFEModel'); $feModel->setId($this->getState($class . '.id')); foreach ($plugins as $x => $plugin) { $o = $pluginManager->getPlugIn($plugin, $this->pluginType); $o->getJForm()->model = $feModel; $data = (array) $item->params; $str = $o->onRenderAdminSettings($data, $x); //$str = str_replace(array("\n", "\r"), "", $str); $str = addslashes(str_replace(array("\n", "\r"), "", $str)); $location = $this->getPluginLocation($x); $event = $this->getPluginEvent($x); $return[] = array('plugin' => $plugin, 'html' => $str, 'location' => $location, 'event' => $event); } return $return; }
public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array(); } parent::__construct($config); }
/** * * @param array $values The input values from the form * @return unknown_type */ function onValidateSelectShipping($values) { $return = new JObject(); $return->error = null; // boolean $return->message = null; // string if (empty($values['billing_address_id']) && empty($values['billing_input_phone_1'])) { $return->error = true; // boolean $return->message = JText::_('Please Include a Phone Number with Your Billing Address'); // string } if (!empty($values['billing_address_id'])) { // Load the address from the database $model = JModel::getInstance('Addresses', 'TiendaModel'); $model->setId($values['billing_address_id']); $address = $model->getItem(); // Does the address have a phone number associated with it? // if not, what do you want to do? if (empty($address->phone_1)) { $return->error = true; // boolean $return->message = JText::_('Stored Address Missing Phone Number'); // string } } return $return; }
function display($tpl = null) { $model =& JModel::getInstance('jigs', 'BattleModel'); $player = $model->get_stats(); // print_r($player[0]); $this->assignRef('player', $player); $computer_action = JRequest::getCmd('action'); if ($computer_action != '') { $model = $this->getmodel(); $model->{$computer_action}($player); } $flags = $player[0]['flags']; $flags = explode(',', $flags); if (!in_array(2, $flags)) { } elseif (in_array(2, $flags)) { if (!in_array(3, $flags)) { //update flags to 3 so we never have to login again $model =& JModel::getInstance('jigs', 'BattleModel'); $flags[] = 3; $model->update_flags($flags); $tpl = "computer_page_1"; // first time view } else { $tpl = "computer_page_2"; } } parent::display($tpl); }
public function display($tpl = null) { // get model and update context with current $model =& JModel::getInstance('urls', 'Sh404sefModel'); $context = $model->setContext($this->_context . '.' . $this->getLayout()); // store it $model =& $this->setModel($model, true); // read data from model $list =& $model->getList((object) array('layout' => $this->getLayout(), 'getPageId' => true)); // and push it into the view for display $this->assign('items', $list); $this->assign('itemCount', count($this->items)); $this->assign('pagination', $model->getPagination((object) array('layout' => $this->getLayout(), 'getPageId' => true))); $options = $model->getDisplayOptions(); $this->assign('options', $options); $this->assign('optionsSelect', $this->_makeOptionsSelect($options)); $this->assign('helpMessage', JText16::_('COM_SH404SEF_PAGEID_HELP')); // add behaviors and styles as needed $modalSelector = 'a.modalediturl'; $js = '\\function(){shAlreadySqueezed = false;if(parent.shReloadModal) {parent.window.location=\'' . $this->defaultRedirectUrl . '\';parent.shReloadModal=true}}'; $params = array('overlayOpacity' => 0, 'classWindow' => 'sh404sef-popup', 'classOverlay' => 'sh404sef-popup', 'onClose' => $js); Sh404sefHelperHtml::modal($modalSelector, $params); // build the toolbar $toolbarMethod = '_makeToolbar' . ucfirst($this->getLayout()); if (is_callable(array($this, $toolbarMethod))) { $this->{$toolbarMethod}($params); } // add our own css JHtml::styleSheet('list.css', Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/'); // link to custom javascript JHtml::script('list.js', Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/'); JHtml::script('metas.js', Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/'); // now display normally parent::display($tpl); }
/** * passPHP * * @param <object> $params * @param <array> $selection * @param <string> $assignment * * @return <bool> */ function passPHP( &$main, &$params, $selection = array(), $assignment = 'all', $article = 0 ) { if ( !is_array( $selection ) ) { $selection = array( $selection ); } $pass = 0; foreach ( $selection as $php ) { // replace \n with newline and other fix stuff $php = str_replace( '\|', '|', $php ); $php = preg_replace( '#(?<!\\\)\\\n#', "\n", $php ); $php = str_replace( '[:REGEX_ENTER:]', '\n', $php ); if ( trim( $php ) == '' ) { $pass = 1; break; } if ( !$article && !( strpos( $php, '$article' ) === false ) && $main->_params->option == 'com_content' && $main->_params->view == 'article' ) { require_once JPATH_SITE.'/components/com_content/models/article.php'; $model = JModel::getInstance( 'article', 'contentModel' ); $model->setId( $main->_params->id ); $article = $model->getArticle(); } if ( !isset( $Itemid ) ) { $Itemid = JRequest::getInt( 'Itemid' ); } if ( !isset( $mainframe ) ) { $mainframe = ( strpos( $php, '$mainframe' ) === false ) ? '' : JFactory::getApplication(); } if ( !isset( $app ) ) { $app = ( strpos( $php, '$app' ) === false ) ? '' : JFactory::getApplication(); } if ( !isset( $database ) ) { $database = ( strpos( $php, '$database' ) === false ) ? '' : JFactory::getDBO(); } if ( !isset( $db ) ) { $db = ( strpos( $php, '$db' ) === false ) ? '' : JFactory::getDBO(); } if ( !isset( $user ) ) { $user = ( strpos( $php, '$user' ) === false ) ? '' : JFactory::getUser(); } $vars = '$article,$Itemid,$mainframe,$app,$database,$db,$user'; $val = '$temp_PHP_Val = create_function( \''.$vars.'\', $php.\';\' );'; $val .= ' $pass = ( $temp_PHP_Val('.$vars.') ) ? 1 : 0; unset( $temp_PHP_Val );'; @eval( $val ); if ( $pass ) { break; } } if ( $pass ) { return ( $assignment == 'include' ); } else { return ( $assignment == 'exclude' ); } }
function display($tmpl = 'default') { FabrikHelperHTML::framework(); $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $visualization = $model->getVisualization(); $pluginParams = $model->getPluginParams(); $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikModel'); $plugin = $pluginManager->getPlugIn($visualization->plugin, 'visualization'); $plugin->_row = $visualization; if ($visualization->published == 0) { return JError::raiseWarning(500, JText::_('COM_FABRIK_SORRY_THIS_VISUALIZATION_IS_UNPUBLISHED')); } //plugin is basically a model $pluginTask = JRequest::getVar('plugintask', 'render', 'request'); // @FIXME cant set params directly like this, but I think plugin model setParams() is not right $plugin->_params = $pluginParams; $tmpl = $plugin->getParams()->get('calendar_layout', $tmpl); $plugin->{$pluginTask}($this); $this->plugin = $plugin; $viewName = $this->getName(); $this->addTemplatePath($this->_basePath . DS . 'plugins' . DS . $this->_name . DS . $plugin->_name . DS . 'tmpl' . DS . $tmpl); $this->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_fabrik' . DS . 'visualization' . DS . $plugin->_name . DS . $tmpl); $ab_css_file = JPATH_SITE . "/plugins/fabrik_visualization/" . $plugin->_name . "/tmpl/{$tmpl}/template.css"; if (JFile::exists($ab_css_file)) { JHTML::stylesheet('template.css', 'plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/', true); } echo parent::display(); }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } if (!RSTicketsProHelper::isStaff()) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_USERS')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $this->_permissions = RSTicketsProHelper::getCurrentPermissions(); if (!$this->_permissions->add_ticket_customers && !$this->_permissions->add_ticket_staff) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_USERS')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $this->_db = JFactory::getDBO(); // Get pagination request variables $limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'), '', 'int'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); // In case limit has been changed, adjust it $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $this->setState($option . '.users.limit', $limit); $this->setState($option . '.users.limitstart', $limitstart); $this->_query = $this->_buildQuery(); }
public function __construct() { parent::__construct(); $this->_table_prefix = '#__redshop_'; $array = JRequest::getVar('cid', 0, '', 'array'); $this->setId((int) $array[0]); }
/** * Constructor * * @since 1.0 */ function __construct() { parent::__construct(); $cid = JRequest::getVar('cid', array(0), '', 'array'); JArrayHelper::toInteger($cid, array(0)); $this->setId($cid[0]); }
/** * get an element model * @return object element model */ private function getElementModel() { if (!isset($this->_elementModel)) { $this->_elementModel =& JModel::getInstance('element', 'FabrikModel'); } return $this->_elementModel; }
/** * Load letter from DB, load SMTP settings * TODO: Move this to NewsletterModel or NewsletterModelEntity * * @param <string> $name - id of a letter * * @return object - letter * @since 1.0 */ public static function loadLetter($id = false) { $letter = JTable::getInstance('Newsletter', 'NewsletterTable'); $letter->load((int) $id); // If letter absent then fail. if (!$letter) { return false; } $letter = (object) $letter->getProperties(); $letter->params = (array) json_decode($letter->params); if (empty($letter->params['encoding'])) { $letter->params['encoding'] = 'utf-8'; } PlaceholderHelper::setPlaceholders($letter->params); $profileEntity = JModel::getInstance('Smtpprofile', 'NewsletterModelEntity'); $profileEntity->load((int) $letter->smtp_profile_id); $letter->smtp_profile = $profileEntity->toObject(); // Set data when using J! SMTP profile if ($letter->smtp_profile_id == NewsletterModelEntitySmtpprofile::JOOMLA_SMTP_ID) { if (!empty($letter->params['newsletter_from_email'])) { $letter->smtp_profile->from_email = $letter->params['newsletter_from_email']; } if (!empty($letter->params['newsletter_from_name'])) { $letter->smtp_profile->from_name = $letter->params['newsletter_from_name']; } if (!empty($letter->params['newsletter_to_email'])) { $letter->smtp_profile->reply_to_email = $letter->params['newsletter_to_email']; } if (!empty($letter->params['newsletter_to_name'])) { $letter->smtp_profile->reply_to_name = $letter->params['newsletter_to_name']; } } return $letter; }
function __construct() { parent::__construct(); $this->_data = array(); jimport('joomla.filesystem.file'); require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_jdefender' . DS . 'helpers' . DS . 'vars.php'; }
function getUserNotifications() { $user = JFactory::getUser(); $db = FabrikWorker::getDbo(); $sql = "SELECT * FROM #__{package}_notification WHERE user_id = " . $user->get('id'); $db->setQuery($sql); $rows = $db->loadObjectList(); $listModel = JModel::getInstance('list', 'FabrikFEModel'); foreach ($rows as &$row) { /* * {observer_name, creator_name, event, record url * dear %s, %s has %s on %s */ $event = JText::_($row->event); list($listid, $formid, $rowid) = explode('.', $row->reference); $listModel->setId($listid); $data = $listModel->getRow($rowid); $row->url = JRoute::_('index.php?option=com_fabrik&view=details&listid='.$listid.'&formid='.$formid.'&rowid='.$rowid); $row->title = $row->url; foreach ($data as $key => $value) { $k = strtolower(array_pop(explode('___', $key))); if ($k == 'title') { $row->title = $value; } } } return $rows; }
/** * Constructor that retrieves the ID from the request * * @access public * @return void */ function __construct() { parent::__construct(); $id = JRequest::getVar('cid', 0, '', 'int'); $this->setId($id); }
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; }