protected function getInput() { $params = $this->form->getValue('params'); //remove request param lable $doc = JFactory::getDocument(); $doc->addScriptDeclaration("\$(window).addEvent('load', function(){jQuery('#jform_params_jarequest-lbl').parent().remove();});"); $task = JRequest::getString('task', ''); $jarequest = strtolower(JRequest::getString('jarequest')); //process if ($jarequest && $task) { //load file to excute task require_once dirname(dirname(dirname(__FILE__))) . '/admin/jarequest/' . $jarequest . '.php'; $obLevel = ob_get_level(); if ($obLevel) { while ($obLevel > 0) { ob_end_clean(); $obLevel--; } } else { ob_clean(); } $obj = new $jarequest(); $data = $obj->{$task}($params); echo json_encode($data); exit; } }
/** * Method to log in a user. * * @access public * @since 1.0 */ function login() { JRequest::checkToken('post') or jexit(JText::_('JInvalid_Token')); $app =& JFactory::getApplication(); $data = $app->getUserState('users.login.form.data', array()); // Set the return URL if empty. if (!isset($data['return']) || empty($data['return'])) { $data['return'] = 'index.php?option=com_users&view=profile'; } // Get the log in options. $options = array(); $options['remember'] = JRequest::getBool('remember', false); $options['return'] = $data['return']; // Get the log in credentials. $credentials = array(); $credentials['username'] = JRequest::getVar('username', '', 'method', 'username'); $credentials['password'] = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW); // Perform the log in. $error = $app->login($credentials, $options); // Check if the log in succeeded. if (!JError::isError($error)) { $app->setUserState('users.login.form.data', array()); $app->redirect(JRoute::_($data['return'], false)); } else { $data['remember'] = (int) $options['remember']; $app->setUserState('users.login.form.data', $data); $app->redirect(JRoute::_('index.php?option=com_users&view=login', false)); } }
function fetchMethodForm($uid, $step, $update = false) { global $task; switch ($step) { case 2: $lists = array(); $lists['action'] = _taskLink($task, $uid, array('step' => $step + 1), false); return HTML_DMUploadMethod::linkFileForm($lists); break; case 3: $url = stripslashes(JRequest::getString('url', 'http://')); $err = DMUploadMethod::linkFileProcess($uid, $step, $url); if ($err['_error']) { _returnTo($task, $err['_errmsg'], '', array("method" => 'link', "step" => $step - 1, "localfile" => '', "url" => DOCMAN_Utils::safeEncodeURL($url))); } $uploaded = DOCMAN_Utils::safeEncodeURL(_DM_DOCUMENT_LINK . $url); $catid = $update ? 0 : $uid; $docid = $update ? $uid : 0; $session = JFactory::getSession(); $session->set('docman.dmfilename', _DM_DOCUMENT_LINK); $session->set('docman.document_url', $url); return fetchEditDocumentForm($docid, $uploaded, $catid); break; default: break; } return true; }
function send_certificate() { $app = JFactory::getApplication(); $params = $app->getParams(); $moodle_url = $params->get('MOODLE_URL'); $cert_id = JRequest::getVar('cert_id'); $simple = JRequest::getVar('simple'); $email = JRequest::getString('mailto', '', 'post'); $sender = JRequest::getString('sender', '', 'post'); $from = JRequest::getString('from', '', 'post'); $user = JFactory::getUser(); $username = $user->username; $subject_default = JText::sprintf('COM_JOOMDLE_CERTIFICATE_EMAIL_SUBJECT', $user->name); $subject = JRequest::getString('subject', $subject_default, 'post'); if (!$subject) { $subject = $subject_default; } $mailer = JFactory::getMailer(); $config = JFactory::getConfig(); $sender = array($config->get('mailfrom'), $config->get('fromname')); $mailer->setSender($sender); $mailer->addRecipient($email); $body = JText::sprintf('COM_JOOMDLE_CERTIFICATE_EMAIL_BODY', $user->name); $mailer->setSubject($subject); $mailer->setBody($body); $session = JFactory::getSession(); $token = md5($session->getId()); $pdf = file_get_contents($moodle_url . '/auth/joomdle/' . $simple . 'certificate_view.php?id=' . $cert_id . '&certificate=1&action=review&username='******'&token=' . $token); $tmp_path = $config->get('tmp_path'); $filename = 'certificate-' . $cert_id . '-' . $user->name . '.pdf'; file_put_contents($tmp_path . '/' . $filename, $pdf); $mailer->addAttachment($tmp_path . '/' . $filename); $send = $mailer->Send(); unlink($tmp_path . '/' . $filename); if ($send !== true) { JError::raiseNotice(500, JText::_('COM_JOOMDLE_EMAIL_NOT_SENT')); } else { ?> <div style="padding: 10px;"> <div style="text-align:right"> <a href="javascript: void window.close()"> <?php echo JText::_('COM_JOOMDLE_CLOSE_WINDOW'); ?> <?php echo JHtml::_('image', 'mailto/close-x.png', NULL, NULL, true); ?> </a> </div> <h2> <?php echo JText::_('COM_JOOMDLE_EMAIL_SENT'); ?> </h2> </div> <?php } }
public static function getMtCats($params = array()) { $db = oseDB::instance(); $user = JFactory::getUser(); $user_id = JRequest::getInt('member_id', 0); $rootName = 'root'; $node = JRequest::getString('node', $rootName); $node_id = explode('/', $node); $node_id = $node_id[count($node_id) - 1]; //oseExit($node_id); $parant_id = $node_id == $rootName ? 0 : $node_id; //oseExit($parant_id); $query = " SELECT * FROM `#__mt_cats` " . " WHERE cat_parent = {$parant_id}"; $db->setQuery($query); //oseExit($db->_sql); $items = oseDB::loadList(); foreach ($items as $key => $item) { $item['id'] = $node . '/' . $item['cat_id']; $item['leaf'] = false; $item['cls'] = 'folder'; $item['text'] = $item['cat_name']; $items[$key] = $item; } if (empty($items)) { $result['total'] = 0; $result['results'] = ''; } else { $result['total'] = count($items); $result['results'] = $items; } return $items; }
function export() { $selectedMail = JRequest::getInt('filter_mail', 0); $selectedStatus = JRequest::getString('filter_status', ''); $filters = array(); if (!empty($selectedMail)) { $filters[] = 'a.mailid = ' . $selectedMail; } if (!empty($selectedStatus)) { if ($selectedStatus == 'bounce') { $filters[] = 'a.bounce > 0'; } elseif ($selectedStatus == 'open') { $filters[] = 'a.open > 0'; } elseif ($selectedStatus == 'notopen') { $filters[] = 'a.open < 1'; } elseif ($selectedStatus == 'failed') { $filters[] = 'a.fail > 0'; } } $query = 'SELECT `subid` FROM `#__acymailing_userstats` as a '; if (!empty($filters)) { $query .= ' WHERE (' . implode(') AND (', $filters) . ')'; } $currentSession =& JFactory::getSession(); $currentSession->set('acyexportquery', $query); $this->setRedirect(acymailing_completeLink('data&task=export&sessionquery=1', false, true)); }
function store() { $table =& $this->getTable(); $info = JRequest::get('post'); // Fix HTML $info['htmltext'] = JRequest::getString('htmltext', '', 'post', JREQUEST_ALLOWRAW); $info['htmlsmall'] = JRequest::getString('htmlsmall', '', 'post', JREQUEST_ALLOWRAW); $info['htmllarge'] = JRequest::getString('htmllarge', '', 'post', JREQUEST_ALLOWRAW); $info['htmlbutton'] = JRequest::getString('htmlbutton', '', 'post', JREQUEST_ALLOWRAW); $info['htmlcustom'] = JRequest::getString('htmlcustom', '', 'post', JREQUEST_ALLOWRAW); // Bind form data to table fields if (!$table->bind($info)) { $this->setError($table->getError()); return false; } // Make sure the record is a valid one if (!$table->check()) { $this->setError($table->getError()); return false; } // Save bookmark if (!$table->store()) { $this->setError($table->getError()); return false; } return $table->get('id'); }
function update() { $currency = JRequest::getInt('hikashopcurrency', 0); if (!empty($currency)) { $app = JFactory::getApplication(); $app->setUserState(HIKASHOP_COMPONENT . '.currency_id', $currency); $app->setUserState(HIKASHOP_COMPONENT . '.shipping_method', null); $app->setUserState(HIKASHOP_COMPONENT . '.shipping_id', null); $app->setUserState(HIKASHOP_COMPONENT . '.shipping_data', null); $app->setUserState(HIKASHOP_COMPONENT . '.payment_method', null); $app->setUserState(HIKASHOP_COMPONENT . '.payment_id', null); $app->setUserState(HIKASHOP_COMPONENT . '.payment_data', null); $url = JRequest::getString('return_url', ''); if (HIKASHOP_J30) { $plugin = JPluginHelper::getPlugin('system', 'cache'); $params = new JRegistry(@$plugin->params); $options = array('defaultgroup' => 'page', 'browsercache' => $params->get('browsercache', false), 'caching' => false); $cache = JCache::getInstance('page', $options); $cache->clean(); } if (!empty($url)) { if (hikashop_disallowUrlRedirect($url)) { return false; } $app->redirect(urldecode($url)); } } return true; }
/** * Constructor * * @since 1.5 */ function __construct() { parent::__construct(); //Get configuration $app = JFactory::getApplication(); $config = JFactory::getConfig(); // Get the pagination request variables $this->setState('limit', $app->getUserStateFromRequest('com_search.limit', 'limit', $config->get('list_limit'), 'uint')); $this->setState('limitstart', JRequest::getUInt('limitstart', 0)); // Get parameters. $params = $app->getParams(); if ($params->get('searchphrase') == 1) { $searchphrase = 'any'; } elseif ($params->get('searchphrase') == 2) { $searchphrase = 'exact'; } else { $searchphrase = 'all'; } // Set the search parameters $keyword = urldecode(JRequest::getString('searchword')); $match = JRequest::getWord('searchphrase', $searchphrase); $ordering = JRequest::getWord('ordering', $params->get('ordering', 'newest')); $this->setSearch($keyword, $match, $ordering); //Set the search areas $areas = JRequest::getVar('areas'); $this->setAreas($areas); }
function tag() { $doc = JFactory::getDocument(); $doc->addStyleSheet(ACYMAILING_CSS . 'frontendedition.css?v=' . filemtime(ACYMAILING_MEDIA . 'css' . DS . 'frontendedition.css')); JPluginHelper::importPlugin('acymailing'); $dispatcher = JDispatcher::getInstance(); $tagsfamilies = $dispatcher->trigger('acymailing_getPluginType'); $defaultFamily = reset($tagsfamilies); $app = JFactory::getApplication(); $fctplug = $app->getUserStateFromRequest(ACYMAILING_COMPONENT . ".tag", 'fctplug', $defaultFamily->function, 'cmd'); ob_start(); $defaultContents = $dispatcher->trigger($fctplug); $defaultContent = ob_get_clean(); $js = 'function insertTag(){if(window.parent.insertTag(window.document.getElementById(\'tagstring\').value)) {acymailing_js.closeBox(true);}}'; $js .= 'function setTag(tagvalue){window.document.getElementById(\'tagstring\').value = tagvalue;}'; $js .= 'function showTagButton(){window.document.getElementById(\'insertButton\').style.display = \'inline\'; window.document.getElementById(\'tagstring\').style.display=\'inline\';}'; $js .= 'function hideTagButton(){}'; $js .= 'try{window.parent.previousSelection = window.parent.getPreviousSelection(); }catch(err){window.parent.previousSelection=false; }'; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); $this->assignRef('fctplug', $fctplug); $type = JRequest::getString('type', 'news'); $this->assignRef('type', $type); $this->assignRef('defaultContent', $defaultContent); $this->assignRef('tagsfamilies', $tagsfamilies); $app = JFactory::getApplication(); $this->assignRef('app', $app); $ctrl = JRequest::getString('ctrl'); $this->assignRef('ctrl', $ctrl); }
function display($tpl = null) { if (JRequest::getString('task') != 'edit' && JRequest::getString('task') != 'add') { JToolBarHelper::title('J-Hotel Reservation : ' . JText::_('LNG_MANAGE_AIRPORT_TRANSFER_TYPES', true), 'generic.png'); //JRequest::setVar( 'hidemainmenu', 1 ); $hotel_id = $this->get('HotelId'); if ($hotel_id > 0) { JToolBarHelper::addNew('manageairporttransfertypes.edit'); JToolBarHelper::editList('manageairporttransfertypes.edit'); JToolBarHelper::deleteList('', 'manageairporttransfertypes.delete', JText::_('LNG_DELETE', true)); } JToolBarHelper::custom('back', JHotelUtil::getDashBoardIcon(), 'home', 'Back', false, false); $this->hotel_id = $hotel_id; $items = $this->get('Datas'); $this->items = $items; $hotels = $this->get('Hotels'); $hotels = checkHotels(JFactory::getUser()->id, $hotels); $this->hotels = $hotels; } else { $item = $this->get('Data'); $this->item = $item; $hotel_id = $this->get('HotelId'); $this->hotel_id = $hotel_id; $hotel = $this->get('Hotel'); $this->hotel = $hotel; JToolBarHelper::title('J-Hotel Reservation : ' . ($item->airport_transfer_type_id > 0 ? JText::_('LNG_EDIT', true) : JText::_('LNG_ADD_NEW', true)) . ' ' . JText::_('LNG_AIRPORT_TRANSFER_TYPE', true), 'generic.png'); JRequest::setVar('hidemainmenu', 1); JToolBarHelper::cancel('manageairporttransfertypes.cancel'); JToolBarHelper::save('manageairporttransfertypes.save'); } parent::display($tpl); }
function emailFriend() { JRequest::checkToken() or jexit('Invalid Token'); require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'jobboard_member.php'; $app = JFactory::getApplication(); if (JobBoardHelper::verifyHumans()) { if (!JobBoardMemberHelper::matchHumanCode(JRequest::getString('human_ver', ''))) { $post = JArrayHelper::toObject(JRequest::get('post')); $post->errors = 1; if (isset($post->human_ver)) { unset($post->human_ver); } $app->setUserState('com_jobboard.sfields', $post); $app->redirect(JRoute::_('index.php?option=com_jobboard&view=share&errors=1&job_id=' . $post->job_id . '&Itemid=' . JRequest::getInt('Itemid')), JText::_('COM_JOBBOARD_FORM_CAPTCHA_FAILMSG'), 'error'); return; } } $message = new JObject(); $message->job_id = JRequest::getVar('job_id', '', '', 'int'); $catid = JRequest::getVar('catid', '', '', 'int'); $message->job_title = JRequest::getVar('job_title', '', '', 'string'); $message->job_city = JRequest::getVar('job_city', '', '', 'string'); $message->personal_message = JRequest::getVar('personal_message', '', '', 'string'); $uri =& JURI::getInstance(); $message->link = $uri->getScheme() . '://' . $uri->getHost() . JRequest::getVar('job_path', '', '', 'string'); $fields_valid = $this->validateFields(); $message->sender_email = $fields_valid->sender_email; $message->sender_name = $fields_valid->sender_name; $message->rec_emails = $fields_valid->rec_emails; if ($fields_valid->errors === true) { $errmsg = $fields_valid->errmsg . '</ul>'; $app->setUserState('sfields', $message); $link = JRoute::_('index.php?option=com_jobboard&view=share&errors=1&job_id=' . $message->job_id . '&Itemid=' . $itemid); $this->setRedirect($link, $errmsg, ''); return; } else { if (stristr($message->rec_emails, ',') === TRUE) { $rec_emailarray = explode(',', $message->rec_emails); foreach ($rec_emailarray as $email_recipient) { $this->sendEmail($message, trim($email_recipient)); } } else { $this->sendEmail($message, trim($message->rec_emails)); } $mesgModel =& $this->getModel('Message'); $saved = $mesgModel->saveMessage($message); if ($saved) { $msg = ' ' . JText::_('SEND_MSG_SUCCESS'); $link = JRoute::_('index.php?option=com_jobboard&view=job&id=' . $message->job_id, false); $this->setRedirect($link, $msg, ''); return; } else { $msg = ' ' . JText::_('ERR_WAIT'); $link = JRoute::_('index.php?option=com_jobboard&view=job&id=' . $message->job_id, false); $this->setRedirect($link, $msg, ''); return; } } parent::display(); }
function &getData() { $user = JFactory::getUser(); $data = new stdClass(); $data->link = urldecode(JRequest::getVar('link', '', 'method', 'base64')); if ($data->link == '') { JError::raiseError(403, JText::_('COM_MAILTO_LINK_IS_MISSING')); $false = false; return $false; } // Load with previous data, if it exists $mailto = JRequest::getString('mailto', '', 'post'); $sender = JRequest::getString('sender', '', 'post'); $from = JRequest::getString('from', '', 'post'); $subject = JRequest::getString('subject', '', 'post'); if ($user->get('id') > 0) { $data->sender = $user->get('name'); $data->from = $user->get('email'); } else { $data->sender = $sender; $data->from = $from; } $data->subject = $subject; $data->mailto = $mailto; return $data; }
function getList($params) { global $mainframe; $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $temp = JRequest::getString('id'); $temp = explode(':', $temp); $id = $temp[0]; $aid = $user->get('aid', 0); $showDate = $params->get('showDate', 0); $conf =& JFactory::getConfig(); if ($option == 'com_content' && $view == 'article' && $id) { if ($params->get('cache_items', 0) == 1 && $conf->getValue('config.caching')) { $cache =& JFactory::getCache('mod_related_items', 'callback'); $cache->setLifeTime($params->get('cache_time', $conf->getValue('config.cachetime') * 60)); $cache->setCacheValidation(true); $related = $cache->get(array('modRelatedItemsHelper', 'getRelatedItemsById'), array($id, $aid, $showDate)); } else { $related = modRelatedItemsHelper::getRelatedItemsById($id, $aid, $showDate); } } else { $related = array(); } return $related; }
/** * Method to log in a user. * * @since 1.6 */ public function login() { JSession::checkToken('post') or jexit(JText::_('JInvalid_Token')); $app = JFactory::getApplication(); // Populate the data array: $data = array(); $data['return'] = base64_decode(JRequest::getVar('return', '', 'POST', 'BASE64')); $data['username'] = JRequest::getVar('username', '', 'method', 'username'); $data['password'] = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW); // Set the return URL if empty. if (empty($data['return'])) { $data['return'] = 'index.php?option=com_users&view=profile'; } // Set the return URL in the user state to allow modification by plugins $app->setUserState('users.login.form.return', $data['return']); // Get the log in options. $options = array(); $options['remember'] = JRequest::getBool('remember', false); $options['return'] = $data['return']; // Get the log in credentials. $credentials = array(); $credentials['username'] = $data['username']; $credentials['password'] = $data['password']; // Perform the log in. if (true === $app->login($credentials, $options)) { // Success $app->setUserState('users.login.form.data', array()); $app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false)); } else { // Login failed ! $data['remember'] = (int) $options['remember']; $app->setUserState('users.login.form.data', $data); $app->redirect(JRoute::_('index.php?option=com_users&view=login', false)); } }
function remove() { if (!$this->isAllowed($this->aclCat, 'delete')) { return; } JRequest::checkToken() or die('Invalid Token'); $mailid = JRequest::getVar('filter_mail', 0, 'post', 'int'); $queueClass = acymailing_get('class.queue'); $search = JRequest::getString('search'); $filters = array(); if (!empty($search)) { $db = JFactory::getDBO(); $searchVal = '\'%' . acymailing_getEscaped($search, true) . '%\''; $searchFields = array('b.name', 'b.email', 'c.subject', 'a.mailid', 'a.subid'); $filters[] = implode(" LIKE {$searchVal} OR ", $searchFields) . " LIKE {$searchVal}"; } if (!empty($mailid)) { $filters[] = 'a.mailid = ' . intval($mailid); } $total = $queueClass->delete($filters); $app = JFactory::getApplication(); $app->enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS', $total), 'message'); JRequest::setVar('filter_mail', 0, 'post'); JRequest::setVar('search', '', 'post'); return $this->listing(); }
function &getData() { $user = JFactory::getUser(); $data = new stdClass(); $data->cert_id = JRequest::getVar('cert_id', ''); // Load with previous data, if it exists $mailto = JRequest::getString('mailto', '', 'post'); $sender = JRequest::getString('sender', '', 'post'); $from = JRequest::getString('from', '', 'post'); $subject = JRequest::getString('subject', '', 'post'); if ($user->get('id') > 0) { $data->sender = $user->get('name'); $data->from = $user->get('email'); } else { $data->sender = $sender; $data->from = $from; } $data->subject = $subject; $data->mailto = $mailto; return $data; }
function save() { $db = JFactory::getDBO(); if (!JSession::checkToken('post')) { $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); $this->setRedirect(KunenaRoute::_($this->baseurl, false)); return; } $rank_title = JRequest::getString('rank_title'); $rank_image = basename(JRequest::getString('rank_image')); $rank_special = JRequest::getInt('rank_special'); $rank_min = JRequest::getInt('rank_min'); $rankid = JRequest::getInt('rankid', 0); if (!$rankid) { $db->setQuery("INSERT INTO #__kunena_ranks SET\n\t\t\t\t\trank_title={$db->quote($rank_title)},\n\t\t\t\t\trank_image={$db->quote($rank_image)},\n\t\t\t\t\trank_special={$db->quote($rank_special)},\n\t\t\t\t\trank_min={$db->quote($rank_min)}"); $db->query(); if (KunenaError::checkDatabaseError()) { return; } } else { $db->setQuery("UPDATE #__kunena_ranks SET\n\t\t\t\t\trank_title={$db->quote($rank_title)},\n\t\t\t\t\trank_image={$db->quote($rank_image)},\n\t\t\t\t\trank_special={$db->quote($rank_special)},\n\t\t\t\t\trank_min={$db->quote($rank_min)}\n\t\t\t\tWHERE rank_id={$db->quote($rankid)}"); $db->query(); if (KunenaError::checkDatabaseError()) { return; } } $this->app->enqueueMessage(JText::_('COM_KUNENA_RANK_SAVED')); $this->setRedirect(KunenaRoute::_($this->baseurl, false)); }
/** * Method to get the help search string * @return string Help search string */ function &getHelpSearch() { if (is_null($this->help_search)) { $this->help_search = JRequest::getString('helpsearch'); } return $this->help_search; }
function store() { JRequest::checkToken() or die('Invalid Token'); $plugin = JRequest::getString('plugin'); $plugin = preg_replace('#[^a-zA-Z0-9]#Uis', '', $plugin); $body = JRequest::getVar('templatebody', '', '', 'string', JREQUEST_ALLOWRAW); if (empty($body)) { acymailing_display(JText::_('FILL_ALL'), 'error'); return; } $pluginsFolder = ACYMAILING_MEDIA . 'plugins'; if (!file_exists($pluginsFolder)) { acymailing_createDir($pluginsFolder); } try { jimport('joomla.filesystem.file'); $status = JFile::write($pluginsFolder . DS . $plugin . '.php', $body); } catch (Exception $e) { $status = false; } if ($status) { acymailing_display(JText::_('JOOMEXT_SUCC_SAVED'), 'success'); } else { acymailing_display(JText::sprintf('FAIL_SAVE', $pluginsFolder . DS . $plugin . '.php'), 'error'); } }
function display($tpl = null) { if (JRequest::getString('task') != 'edit' && JRequest::getString('task') != 'add') { JToolBarHelper::title('J-HotelReservation : ' . JText::_('LNG_MANAGE_TAXES', true), 'generic.png'); JRequest::setVar('hidemainmenu', 1); $hotel_id = $this->get('HotelId'); if ($hotel_id > 0) { JToolBarHelper::addNew('managetaxes.edit'); JToolBarHelper::editList('managetaxes.edit'); JToolBarHelper::deleteList('', 'managetaxes.delete', JText::_('LNG_DELETE', true)); JToolBarHelper::custom('managetaxes.back', JHotelUtil::getDashBoardIcon(), 'home', JText::_('LNG_HOTEL_DASHBOARD', true), false, false); } $this->hotel_id = $hotel_id; $items = $this->get('Datas'); $this->items = $items; $hotels = $this->get('Hotels'); $hotels = checkHotels(JFactory::getUser()->id, $hotels); $this->hotels = $hotels; } else { $item = $this->get('Data'); $this->item = $item; $hotel_id = $this->get('HotelId'); $this->hotel_id = $hotel_id; $hotel = $this->get('Hotel'); $this->hotel = $hotel; JToolBarHelper::title('J-Hotel Reservation : ' . ($item->tax_id > 0 ? JText::_("LNG_EDIT", true) : JText::_("LNG_ADD_NEW", true)) . ' ' . JText::_('LNG_TAX', true), 'generic.png'); JRequest::setVar('hidemainmenu', 1); JToolBarHelper::cancel('managetaxes.back'); JToolBarHelper::save('managetaxes.save'); } parent::display($tpl); }
function save() { $db = JFactory::getDBO(); if (!JSession::checkToken('post')) { $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); $this->setRedirect(KunenaRoute::_($this->baseurl, false)); return; } $smiley_code = JRequest::getString('smiley_code'); $smiley_location = basename(JRequest::getString('smiley_url')); $smiley_emoticonbar = JRequest::getInt('smiley_emoticonbar', 0); $smileyid = JRequest::getInt('smileyid', 0); if (!$smileyid) { $db->setQuery("INSERT INTO #__kunena_smileys SET\r\n\t\t\t\t\tcode={$db->quote($smiley_code)},\r\n\t\t\t\t\tlocation={$db->quote($smiley_location)},\r\n\t\t\t\t\temoticonbar={$db->quote($smiley_emoticonbar)}"); $db->query(); if (KunenaError::checkDatabaseError()) { return; } } else { $db->setQuery("UPDATE #__kunena_smileys SET\r\n\t\t\t\t\tcode={$db->quote($smiley_code)},\r\n\t\t\t\t\tlocation={$db->quote($smiley_location)},\r\n\t\t\t\t\temoticonbar={$db->quote($smiley_emoticonbar)}\r\n\t\t\t\tWHERE id = '{$smileyid}'"); $db->query(); if (KunenaError::checkDatabaseError()) { return; } } $this->app->enqueueMessage(JText::_('COM_KUNENA_SMILEY_SAVED')); $this->setRedirect(KunenaRoute::_($this->baseurl, false)); }
public function doPost() { $client_id = JRequest::getString('client_id'); $client_secret = JRequest::getString('client_secret'); $redirect_uri = JRequest::getString('redirect_uri'); $code = JRequest::getString('code'); $method = JRequest::getString('method'); if ($method == 'gettoken') { $params = array('grant_type' => 'authorization_code', 'client_id' => $client_id, 'client_secret' => $client_secret, 'code' => $code, 'redirect_uri' => $redirect_uri); $url = 'https://www.linkedin.com/uas/oauth2/accessToken?' . http_build_query($params); $response = self::getContentUrl($url); $token = json_decode($response); $this->result['access_token'] = $token->access_token; return json_encode($this->result); } if ($method == 'getuser') { $access_token = JRequest::getString('access_token'); $params = array('oauth2_access_token' => $access_token, 'format' => 'json'); $url = 'https://api.linkedin.com/v1/people/~:(id,public-profile-url,picture-url,formatted-name)?' . http_build_query($params); $response = self::getContentUrl($url); $user = json_decode($response); self::update_token($access_token, $user->id); $this->result['uid'] = $user->id; $this->result['uname'] = $user->formattedName; $this->result['data'] = self::prepareData($user); return json_encode($this->result); } }
/** * Validates the username. * * @since 1.0 * @access public * @param null * @return JSON A jsong encoded string. * * @author Jason Rey <*****@*****.**> */ public function isValid() { // Render the ajax lib. $ajax = FD::getInstance('Ajax'); // Get the userid $userid = JRequest::getInt('userid', 0); // Get the event $event = JRequest::getString('event'); // Set the current username $current = ''; if (!empty($userid)) { $user = FD::user($userid); $current = $user->username; } // Get the provided username that the user has typed. $username = JRequest::getVar('username', ''); // Username is required, check if username is empty if (JString::strlen($username) < $this->params->get('min')) { return $ajax->reject(JText::sprintf('PLG_FIELDS_JOOMLA_USERNAME_MIN_CHARACTERS', $this->params->get('min'))); } // Test if username is allowed (by pass for adminedit). if ($event !== 'onAdminEdit' && !SocialFieldsUserJoomlaUsernameHelper::allowed($username, $this->params)) { return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_NOT_ALLOWED')); } // Test if username exists. if (SocialFieldsUserJoomlaUsernameHelper::exists($username, $current)) { return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_NOT_AVAILABLE')); } // Test if the username is valid if (!SocialFieldsUserJoomlaUsernameHelper::isValid($username, $this->params)) { return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_IS_INVALID')); } $text = JText::_('PLG_FIELDS_JOOMLA_USERNAME_AVAILABLE'); return $ajax->resolve($text); }
function save() { $app = JFactory::getApplication (); $db = JFactory::getDBO (); if (!JRequest::checkToken()) { $app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' ); $app->redirect ( KunenaRoute::_($this->baseurl, false) ); return; } $iconname = JRequest::getString ( 'topiciconname' ); $filename = JRequest::getString ( 'topiciconslist' ); $published = JRequest::getInt ( 'published' ); $ordering = JRequest::getInt ( 'ordering', 0 ); $topiciconid = JRequest::getInt( 'topiciconid', 0 ); /*if ( !$topiciconid ) { $db->setQuery ( "INSERT INTO #__kunena_topics_icons SET name = '$iconname', filename = '$filename', published = '$published', ordering ='$ordering'" ); $db->query (); if (KunenaError::checkDatabaseError()) return; } else { $db->setQuery ( "UPDATE #__kunena_topics_icons SET name = '$iconname', filename = '$filename', published = '$published', ordering ='$ordering' WHERE id = '$topiciconid'" ); $db->query (); if (KunenaError::checkDatabaseError()) return; }*/ $app->enqueueMessage ( JText::_('COM_KUNENA_TOPICICON_SAVED') ); $app->redirect ( KunenaRoute::_($this->baseurl, false) ); }
public function showCaptcha() { include JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'securimage' . DIRECTORY_SEPARATOR . 'securimage.php'; $img = new securimage(); $mod_jinc = JRequest::getString('mod_jinc', 'false'); $mod_jinc = trim($mod_jinc); if ($mod_jinc == 'true') { $img->image_width = 125; $img->image_height = 30; $img->code_length = rand(4, 4); $img->setSessionPrefix('mod_jinc'); } else { $img->image_width = 250; $img->image_height = 40; $img->code_length = rand(5, 6); } $img->perturbation = 0.7; $img->image_bg_color = new Securimage_Color("#ffffff"); $img->use_transparent_text = true; $img->text_transparency_percentage = 45; // 100 = completely transparent $img->num_lines = 2; $img->image_signature = ''; $img->text_color = new Securimage_Color("#333366"); $img->line_color = new Securimage_Color("#FFFFCC"); $img->show(''); // alternate use: $img->show('/path/to/background_image.jpg'); }
function language() { $app = JFactory::getApplication(); $code = JRequest::getString('code'); if (empty($code)) { $app->enqueueMessage(JText::_('Code not specified', true)); return; } $file = new stdClass(); $file->name = $code; $path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'language' . DS . $code . DS . $code . getBookingExtName() . '.ini'; $file->path = $path; jimport('joomla.filesystem.file'); $showLatest = true; $loadLatest = false; if (JFile::exists($path)) { $file->content = JFile::read($path); if (empty($file->content)) { $app->enqueueMessage('File not found : ' . $path); } } else { $loadLatest = true; $file->content = JFile::read(JPATH_COMPONENT_ADMINISTRATOR . DS . 'language' . 'en-GB' . DS . 'en-GB.' . getBookingExtName() . '.ini'); } $this->assignRef('file', $file); $tpl = "language"; return $tpl; }
/** * Calls an HTTP POST function to verify if the user's guess was correct * * @return True if the answer is correct, false otherwise * * @since 2.5 */ public function onCheckAnswer($code) { // Initialise variables $privatekey = $this->params->get('private_key'); $remoteip = JRequest::getVar('REMOTE_ADDR', '', 'SERVER'); $challenge = JRequest::getString('recaptcha_challenge_field', ''); $response = JRequest::getString('recaptcha_response_field', ''); // Check for Private Key if (empty($privatekey)) { $this->_subject->setError(JText::_('PLG_RECAPTCHA_ERROR_NO_PRIVATE_KEY')); return false; } // Check for IP if (empty($remoteip)) { $this->_subject->setError(JText::_('PLG_RECAPTCHA_ERROR_NO_IP')); return false; } // Discard spam submissions if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { $this->_subject->setError(JText::_('PLG_RECAPTCHA_ERROR_EMPTY_SOLUTION')); return false; } $response = $this->_recaptcha_http_post(self::RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", array('privatekey' => $privatekey, 'remoteip' => $remoteip, 'challenge' => $challenge, 'response' => $response)); $answers = explode("\n", $response[1]); if (trim($answers[0]) == 'true') { return true; } else { //@todo use exceptions here $this->_subject->setError(JText::_('PLG_RECAPTCHA_ERROR_' . strtoupper(str_replace('-', '_', $answers[1])))); return false; } }
function process() { if (!$this->isAllowed('lists', 'filter')) { return; } JRequest::checkToken() or die('Invalid Token'); $filid = JRequest::getInt('filid'); if (!empty($filid)) { $this->store(); } $filterClass = acymailing_get('class.filter'); $filterClass->subid = JRequest::getString('subid'); $filterClass->execute(JRequest::getVar('filter'), JRequest::getVar('action')); if (!empty($filterClass->report)) { if (JRequest::getCmd('tmpl') == 'component') { echo acymailing_display($filterClass->report, 'info'); $js = "setTimeout('redirect()',2000); function redirect(){window.top.location.href = 'index.php?option=com_acymailing&ctrl=subscriber'; }"; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); return; } else { $app = JFactory::getApplication(); foreach ($filterClass->report as $oneReport) { $app->enqueueMessage($oneReport); } } } return $this->edit(); }
public function getOrderDetails() { $orderModel = VmModel::getModel('orders'); $orderDetails = 0; // If the user is not logged in, we will check the order number and order pass if ($orderPass = JRequest::getString('order_pass', false) and $orderNumber = JRequest::getString('order_number', false)) { $orderId = $orderModel->getOrderIdByOrderPass($orderNumber, $orderPass); if (empty($orderId)) { vmDebug('Invalid order_number/password ' . JText::_('COM_VIRTUEMART_RESTRICTED_ACCESS')); return 0; } $orderDetails = $orderModel->getOrder($orderId); } if ($orderDetails == 0) { $_currentUser = JFactory::getUser(); $cuid = $_currentUser->get('id'); // If the user is logged in, we will check if the order belongs to him $virtuemart_order_id = JRequest::getInt('virtuemart_order_id', 0); if (!$virtuemart_order_id) { $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber(JRequest::getString('order_number')); } $orderDetails = $orderModel->getOrder($virtuemart_order_id); JLoader::register('Permissions', JPATH_VM_ADMINISTRATOR . '/helpers/permissions.php'); if (!Permissions::getInstance()->check("admin")) { if (!empty($orderDetails['details']['BT']->virtuemart_user_id)) { if ($orderDetails['details']['BT']->virtuemart_user_id != $cuid) { echo 'view ' . JText::_('COM_VIRTUEMART_RESTRICTED_ACCESS'); return; } } } } return $orderDetails; }