function save() { $mainframe =& JFactory::getApplication(); $row =& JTable::getInstance('K2UserGroup', 'Table'); if (!$row->bind(JRequest::get('post'))) { $mainframe->redirect('index.php?option=com_k2&view=userGroups', $row->getError(), 'error'); } if (!$row->check()) { $mainframe->redirect('index.php?option=com_k2&view=userGroup&cid=' . $row->id, $row->getError(), 'error'); } if (!$row->store()) { $mainframe->redirect('index.php?option=com_k2&view=userGroups', $row->getError(), 'error'); } $cache =& JFactory::getCache('com_k2'); $cache->clean(); switch (JRequest::getCmd('task')) { case 'apply': $msg = JText::_('Changes to User Group saved'); $link = 'index.php?option=com_k2&view=userGroup&cid=' . $row->id; break; case 'save': default: $msg = JText::_('User Group Saved'); $link = 'index.php?option=com_k2&view=userGroups'; break; } $mainframe->redirect($link, $msg); }
/** * Handle the save task * * @author RickG */ function save($data = 0){ JRequest::checkToken() or jexit( 'Invalid Token' ); $model = VmModel::getModel('config'); $data = JRequest::get('post'); $data['offline_message'] = JRequest::getVar('offline_message','','post','STRING',JREQUEST_ALLOWHTML); if(strpos($data['offline_message'],'|')!==false){ $data['offline_message'] = str_replace('|','',$data['offline_message']); } if ($model->store($data)) { $msg = JText::_('COM_VIRTUEMART_CONFIG_SAVED'); // Load the newly saved values into the session. VmConfig::loadConfig(); } else { $msg = $model->getError(); } $redir = 'index.php?option=com_virtuemart'; if(JRequest::getCmd('task') == 'apply'){ $redir = $this->redirectPath; } $this->setRedirect($redir, $msg); }
function save() { $productfieldgroup = JTable::getInstance('productFieldGroup', 'jshop'); $post = JRequest::get("post"); JPluginHelper::importPlugin('jshoppingadmin'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeSaveProductFieldGroup', array(&$post)); if (!$productfieldgroup->bind($post)) { JError::raiseWarning("", _JSHOP_ERROR_BIND); $this->setRedirect("index.php?option=com_jshopping&controller=productfieldgroups"); return 0; } if (!$id) { $productfieldgroup->ordering = null; $productfieldgroup->ordering = $productfieldgroup->getNextOrder(); } if (!$productfieldgroup->store()) { JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE); $this->setRedirect("index.php?option=com_jshopping&controller=productfieldgroups"); return 0; } $dispatcher->trigger('onAfterSaveProductFieldGroup', array(&$productfieldgroup)); if ($this->getTask() == 'apply') { $this->setRedirect("index.php?option=com_jshopping&controller=productfieldgroups&task=edit&id=" . $productfieldgroup->id); } else { $this->setRedirect("index.php?option=com_jshopping&controller=productfieldgroups"); } }
function save() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $post = JRequest::get('post'); $model = $this->getModel(); if ($post['id'] == 0) { if ($model->addNewCompany($post)) { $msg = JText::_('Company added'); $link = 'index.php?option=com_rxcompanies'; $this->setRedirect($link, $msg); } else { $msg = JText::_('There was an error - the company was not added to the database'); $link = 'index.php?option=com_rxcompanies'; $this->setRedirect($link, $msg); } } else { if ($model->updateCompany($post)) { $msg = JText::_('Company updated'); $link = 'index.php?option=com_rxcompanies'; $this->setRedirect($link, $msg); } else { $msg = JText::_('There was an error - the lab was not updated'); $link = 'index.php?option=com_rxcompanies'; $this->setRedirect($link, $msg); } } }
function processSave($id = 0, $post = null) { //save aclparam and core param in individual columns $id = JRequest::getVar('id', $id); $data = array(); if ($post === null) { $post = JRequest::get('post'); } $model = $this->getModel(); // Get the complete INI string of params $param = new XiptParameter(); $post['coreparams']['core_display_message'] = base64_encode($post['coreparams']['core_display_message']); $param->loadArray($post['coreparams'], 'xipt_coreparams'); $data['coreparams'] = $param->toString('XiptINI', 'xipt_coreparams'); $data['aclname'] = $post['aclname']; $data['rulename'] = $post['rulename']; $data['published'] = $post['published']; $aclObject = XiptAclFactory::getAclObject($data['aclname']); $data['aclparams'] = $aclObject->collectParamsFromPost($post); // Save it // XITODO : clean it if (!($info['id'] = $model->save($data, $id))) { $info['msg'] = XiptText::_('ERROR_IN_SAVING_RULE'); } else { $info['msg'] = XiptText::_('RULE_SAVED'); } return $info; }
function store() { $row =& JTable::getInstance('contactus', 'Table'); //$row =& $this->getTable(); $data = JRequest::get('post'); //print_r($data); //exit(); if (!$row->bind($data)) { $this->setError($this->_db->getErrorMsg()); return false; } // Make sure the hello record is valid if (!$row->check()) { $this->setError($this->_db->getErrorMsg()); return false; } // Store the web link table to the database if (!$row->store()) { $this->setError($this->_db->getErrorMsg()); return false; } //echo $this->_db->getErrorMsg(); //exit(); return true; }
public function save($apply = 0) { $post = JRequest::get('post', JREQUEST_ALLOWRAW); $giftcard_desc = JRequest::getVar('giftcard_desc', '', 'post', 'string', JREQUEST_ALLOWRAW); $post["giftcard_desc"] = $giftcard_desc; $showbuttons = JRequest::getVar('showbuttons'); $option = JRequest::getVar('option'); $model = $this->getModel('giftcard_detail'); $row = $model->store($post); if ($row) { $msg = JText::_('COM_REDSHOP_GIFTCARD_SAVED'); } else { $msg = JText::_('COM_REDSHOP_ERROR_SAVING_GIFTCARD'); } if (!$showbuttons) { if ($apply == 1) { $this->setRedirect('index.php?option=' . $option . '&view=giftcard_detail&task=edit&cid[]=' . $row->giftcard_id, $msg); } else { $this->setRedirect('index.php?option=' . $option . '&view=giftcard', $msg); } } else { ?> <script language="javascript" type="text/javascript"> window.parent.SqueezeBox.close(); </script> <?php } }
function save() { $dispatcher = JDispatcher::getInstance(); $currency_id = JRequest::getInt("currency_id"); $apply = JRequest::getVar("apply"); $currency = JSFactory::getTable('currency', 'jshop'); $post = JRequest::get("post"); $post['currency_value'] = saveAsPrice($post['currency_value']); $dispatcher->trigger('onBeforeSaveCurrencie', array(&$post)); if (!$currency->bind($post)) { JError::raiseWarning("", _JSHOP_ERROR_BIND); $this->setRedirect("index.php?option=com_jshopping&controller=currencies"); return 0; } if ($currency->currency_value == 0) { $currency->currency_value = 1; } $this->_reorderCurrency($currency); if (!$currency->store()) { JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE); $this->setRedirect("index.php?option=com_jshopping&controller=currencies"); return 0; } $dispatcher->trigger('onAfterSaveCurrencie', array(&$currency)); if ($this->getTask() == 'apply') { $this->setRedirect("index.php?option=com_jshopping&controller=currencies&task=edit¤cy_id=" . $currency->currency_id); } else { $this->setRedirect("index.php?option=com_jshopping&controller=currencies"); } }
function tranAlias($easyset) { // set translate language $SourceLan = $easyset->params->get('originLan'); $ResultLan = $easyset->params->get('tranLlan', 'en'); // get query $post = JRequest::get('post'); if (!isset($post['jform']) || !isset($post['jform']['alias'])) { return; } $alias = $post['jform']['alias']; $title = $post['jform']['title']; $titleTmp = explode('::', $post['jform']['title']); if (!empty($titleTmp[1])) { $title = $titleTmp[0]; $alias = JFilterOutput::stringURLSafe($titleTmp[1]); } if (trim($alias) == '') { $alias = AKHelper::_('lang.translate', $title, $SourceLan, $ResultLan); $alias = trim($alias); $alias = JFilterOutput::stringURLSafe($alias); $replace = array('aquot' => '', 'a39' => '', '--' => '-'); $alias = strtr($alias, $replace); $alias = trim($alias, '-'); } $post['jform']['alias'] = $alias; $post['jform']['title'] = $title; $input = JFactory::getApplication()->input; JRequest::setVar('jform', $post['jform'], 'method', true); $input->post->set('jform', $post['jform']); $input->request->set('jform', $post['jform']); }
function display($tpl = null) { $objPhpExcel = new PHPExcel(); $data = JRequest::get('donvi_id'); $user = JFactory::getUser(); $user_id = $user->id; $model = JModelLegacy::getInstance('Tuan', 'BaocaotuanModel'); if ($data['task'] == "excelbctuan") { $baocao_id = $data['baocao_id']; $ketqua = $model->getThongtin('ju.name as tennhanvien, bc.*', 'zxbaocao bc', array('inner' => 'jos_users ju on ju.id = bc.user_id'), 'bc.trangthai = 1 and bc.user_id = ' . $user_id . ' and bc.id IN (' . $baocao_id . ')', 'batdau asc, ketthuc asc'); $this->assignRef('rows', $ketqua); if (is_null($tpl)) { $tpl = 'excel_baocaotuan'; } } if ($data['task'] == "excellamthemgio") { $lamthemgio_id = $data['lamthemgio_id']; $thongtin_all = $model->getThongtin('ju.name as tennhanvien, DATE_FORMAT(ltg.timebatdau,"%Hh%i") as timebatdau, DATE_FORMAT(ltg.timeketthuc,"%Hh%i") as timeketthuc,ltg.thoigian,ltg.congvieclamthem as congvieclamthem, DATE_FORMAT(ltg.ngaylamthem,"%d/%m/%Y") as ngaylamthem, DATE_FORMAT(ltg.ngaylamthem,"%m") as thanglamthem, DATE_FORMAT(ltg.ngaylamthem,"%Y") as namlamthem', 'zxlamthemgio ltg', array('inner' => 'jos_users ju on ju.id = ltg.user_id'), ' ltg.user_id = ' . $user_id . ' and ltg.id IN (' . $lamthemgio_id . ')', ' ngaylamthem asc'); $thanglamthem = $model->getThongtin('distinct(DATE_FORMAT(ltg.ngaylamthem,"%m")) as thanglamthem', 'zxlamthemgio ltg', null, ' ltg.user_id = ' . $user_id . ' and ltg.id IN (' . $lamthemgio_id . ')', ' ngaylamthem asc'); $ketqua = array(); for ($i = 0; $i < count($thanglamthem); $i++) { for ($j = 0; $j < count($thongtin_all); $j++) { if ($thanglamthem[$i]->thanglamthem == $thongtin_all[$j]->thanglamthem) { $ketqua[$thanglamthem[$i]->thanglamthem][] = $thongtin_all[$j]; } } } $this->assignRef('rows', $ketqua); if (is_null($tpl)) { $tpl = 'excel_lamthemgio'; } } parent::display($tpl); }
function store() { $row =& JTable::getInstance('Referfriend', 'Table'); $data = JRequest::get('post'); if (isset($data['checkbox1'])) { $data['checkbox1'] = 1; } else { $data['checkbox1'] = 0; } if (isset($data['checkbox2'])) { $data['checkbox2'] = 1; } else { $data['checkbox2'] = 0; } if (!$row->bind($data)) { $this->setError($this->_db->getErrorMsg()); return false; } if (!$row->check()) { $this->setError($this->_db->getErrorMsg()); return false; } if (!$row->store()) { $this->setError($this->_db->getErrorMsg()); return false; } return true; }
private function _displayInfo($tpl) { $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; $mainframe =& JFactory::getApplication(); $option = JRequest::getCmd('option'); $uri =& JFactory::getURI(); $db =& JFactory::getDBO(); $post = JRequest::get('post'); $model =& $this->getModel('jlextdfbnetplayerimport'); // Set toolbar items for the page //JToolBarHelper::title(JText::_('COM_JOOMLEAGUE_ADMIN_DFBNET_IMPORT_TITLE_3_3'),'generic.png'); //JToolBarHelper::back(); //JLToolBarHelper::onlinehelp(); $this->assignRef('starttime', $starttime); $this->assignRef('importData', $model->importData($post)); $this->assignRef('postData', $post); $revisionDate = '2011-04-28 - 12:00'; $this->assignRef('revisionDate', $revisionDate); /* echo 'view.html<br>'; echo '<pre>'; print_r($this->importData); echo '</pre>'; */ parent::display($tpl); }
function save() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $post = JRequest::get('post'); //TMZ added 2012-08-21 $post['otherinfo'] = JRequest::getVar('otherinfo', '', 'post', 'string', JREQUEST_ALLOWHTML); $post['price'] = JRequest::getVar('price', '', 'post', 'string', JREQUEST_ALLOWHTML); $post['sphnotes'] = JRequest::getVar('sphnotes', '', 'post', 'string', JREQUEST_ALLOWHTML); $post['cylnotes'] = JRequest::getVar('cylnotes', '', 'post', 'string', JREQUEST_ALLOWHTML); $model = $this->getModel(); // $model->updateLens($post); if ($post['id'] == 0) { if ($model->addNewLens($post)) { $msg = JText::_('Lens added'); $link = 'index.php?option=com_pnlenses'; $this->setRedirect($link, $msg); } else { $msg = JText::_('There was an error - the lens was not added to the database'); $link = 'index.php?option=com_pnlenses'; $this->setRedirect($link, $msg); } } else { if ($model->updateLens($post)) { $msg = JText::_('Lens updated'); $link = 'index.php?option=com_pnlenses'; $this->setRedirect($link, $msg); } else { $msg = JText::_('There was an error - the lens was not updated'); $link = 'index.php?option=com_pnlenses'; $this->setRedirect($link, $msg); } } }
function save() { $post = JRequest::get('post'); $phocaSet = JRequest::getVar('phocaset', array(0), 'post', 'array'); $model = $this->getModel('phocadownloadset'); $errorMsg = ''; switch (JRequest::getCmd('task')) { case 'apply': if ($model->store($phocaSet, $errorMsg)) { $msg = JText::_('Changes to Phoca Download Settings Saved'); if ($errorMsg != '') { $msg .= '<br />' . JText::_($errorMsg); } } else { $msg = JText::_('Error Saving Phoca Download Settings'); } $this->setRedirect('index.php?option=com_phocadownload&view=phocadownloadset', $msg); break; case 'save': default: if ($model->store($phocaSet, $errorMsg)) { $msg = JText::_('Phoca Download Settings Saved'); if ($errorMsg != '') { $msg .= '<br />' . JText::_($errorMsg); } } else { $msg = JText::_('Error Saving Phoca Download Settings'); } $this->setRedirect('index.php?option=com_phocadownload', $msg); break; } // Check the table in so it can be edited.... we are done with it anyway $model->checkin(); }
/** * save a record (and redirect to main page) * @return void */ function save() { JRequest::checkToken() or jexit('Invalid Token'); $post = JRequest::get('post'); $task = JRequest::getVar('task'); $model =& $this->getModel('hotellinkedit'); if ($model->store($post)) { switch ($task) { case 'apply': $link = 'index.php?option=com_hotelguide&view=hotellinkedit&cid[]=' . (int) $model->get('id'); break; case 'saveandnew': $link = 'index.php?option=com_hotelguide&view=hotellinkedit'; break; default: $link = 'index.php?option=com_hotelguide&view=hotellinks'; break; } $msg = JText::_('HG_LINK_SAVED'); } else { $link = 'index.php?option=com_hotelguide&view=hotellinks'; $msg = JText::_('HG_ERROR_SAVING_LINK'); } $this->setRedirect($link, $msg); }
function sendEmail() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $post = JRequest::get('post'); $this->addModelPath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'models'); $model = $this->getModel('location'); $location = $model->getData(); $contact_name = $post['contact_name']; $contact_email = $post['contact_email']; $contact_message = $post['contact_message']; if ($contact_name == null || $contact_message == null) { echo JText::_('Please enter a name and message to send.'); return false; } else { if (false) { return false; } else { JUtility::sendMail($contact_email, $contact_name, $location->email, 'Contact Message for: ' . $location->name, $contact_message, 0, null, null, null, $contact_email, $contact_name); echo JText::_('Message Sent'); return true; } } return false; }
function save() { $apply = JRequest::getVar("apply"); $vendor = JSFactory::getTable('vendor', 'jshop'); $dispatcher = JDispatcher::getInstance(); $id = JRequest::getInt("id"); $vendor->load($id); if (!isset($_POST['publish'])) { $_POST['publish'] = 0; } $post = JRequest::get("post"); $dispatcher->trigger('onBeforeSaveVendor', array(&$post)); $vendor->bind($post); JSFactory::loadLanguageFile(); if (!$vendor->check()) { JError::raiseWarning("", $vendor->getError()); $this->setRedirect("index.php?option=com_jshopping&controller=vendors&task=edit&id=" . $vendor->id); return 0; } if (!$vendor->store()) { JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE); $this->setRedirect("index.php?option=com_jshopping&controller=vendors&task=edit&id=" . $vendor->id); return 0; } $dispatcher->trigger('onAfterSaveVendor', array(&$vendor)); if ($this->getTask() == 'apply') { $this->setRedirect("index.php?option=com_jshopping&controller=vendors&task=edit&id=" . $vendor->id); } else { $this->setRedirect("index.php?option=com_jshopping&controller=vendors"); } }
public function doAjaxLayout() { // Set common options $this->setLayout('ajax'); // Create a new request $request = array(); // Get the current request-options $get = JRequest::get('get'); if (!empty($get)) { foreach ($get as $name => $value) { $request[$name] = $value; } } // Merge the POST if it is there $post = JRequest::get('post'); if (!empty($post)) { foreach ($post as $name => $value) { $request[$name] = $value; } } // Add new variables $request['view'] = 'element'; $request['format'] = 'ajax'; // Load the AJAX-script $url = 'index.php?option=com_magebridge'; foreach ($request as $name => $value) { $url .= '&' . $name . '=' . $value; } MageBridgeElementHelper::ajax($url, 'ajaxelement'); }
function save() { $mainframe = JFactory::getApplication(); $id = JRequest::getInt("id"); $deliveryTimes = JSFactory::getTable('deliveryTimes', 'jshop'); $post = JRequest::get("post"); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeSaveDeliveryTime', array(&$post)); if (!$deliveryTimes->bind($post)) { JError::raiseWarning("", _JSHOP_ERROR_BIND); $this->setRedirect("index.php?option=com_jshopping&controller=deliverytimes"); return 0; } if (!$deliveryTimes->store()) { JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE); $this->setRedirect("index.php?option=com_jshopping&controller=deliverytimes"); return 0; } $dispatcher->trigger('onAfterSaveDeliveryTime', array(&$deliveryTimes)); if ($this->getTask() == 'apply') { $this->setRedirect("index.php?option=com_jshopping&controller=deliverytimes&task=edit&id=" . $deliveryTimes->id); } else { $this->setRedirect("index.php?option=com_jshopping&controller=deliverytimes"); } }
function save($url = null) { if (!JSession::checkToken('post')) { $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); $this->app->redirect(KunenaRoute::_($this->baseurl, false)); } $properties = $this->config->getProperties(); foreach (JRequest::get('post', JREQUEST_ALLOWHTML) as $postsetting => $postvalue) { if (JString::strpos($postsetting, 'cfg_') === 0) { //remove cfg_ and force lower case if (is_array($postvalue)) { $postvalue = implode(',', $postvalue); } $postname = JString::strtolower(JString::substr($postsetting, 4)); // No matter what got posted, we only store config parameters defined // in the config class. Anything else posted gets ignored. if (array_key_exists($postname, $properties)) { $this->config->set($postname, $postvalue); } } } $this->config->save(); $this->app->enqueueMessage(JText::_('COM_KUNENA_CONFIGSAVED')); if (empty($url)) { $this->app->redirect(KunenaRoute::_($this->kunenabaseurl, false)); } else { $this->app->redirect(KunenaRoute::_($url, false)); } }
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 rss() { $mainframe = JFactory::getApplication(); require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'feedcreator.class.php'; $alias = JRequest::getVar('alias', NULL); $model = $this->getModel(); $model_items = JAVBModel::getInstance('items', 'javoiceModel'); $feed = JTable::getInstance('feeds', 'Table'); if (!$alias) { $post = JRequest::get('request', JREQUEST_ALLOWHTML); $post['feed_name'] = isset($post['feed_name']) ? $post['feed_name'] : JText::_("NO_NAME"); $feed->bind($post); } else { $feeds = $model->getItems(" AND f.feed_alias='{$alias}'"); if (!$feeds) { $mainframe->redirect(JRoute::_("index.php?option=com_javoice&view=feeds&layout=guide"), JText::_("NOT_FOUND_RSS")); return FALSE; } $feed->bind($feeds[0]); } //print_r($feed);exit; $where = $model->getWhereClause($feed); $document = JFactory::getDocument(); $document->setTitle($feed->feed_name); $limit = 20; if ($feed->msg_count > 0) { $limit = $feed->msg_count; } $joins = " INNER JOIN #__jav_voice_type_status as s ON s.id=i.voice_type_status_id "; $items = $model_items->getItems($where, '', 0, $limit, '', $joins); $content = $model->getContentRss($feed, $items); $this->assignRef('feed', $feed); $this->assignRef('content', $content); return TRUE; }
function save() { // Check for request forgeries JRequest::checkToken() or die('COM_JOOMLEAGUE_GLOBAL_INVALID_TOKEN'); $cid = JRequest::getInt("cid", 0); $post = JRequest::get('post'); if ($cid > 0) { $club =& JTable::getInstance("Club", "Table"); $club->load($cid); $club->bind($post); $params =& JComponentHelper::getParams('com_joomleague'); if ($club->store() && $params->get('cfg_edit_club_info_update_notify') == "1") { $db = JFactory::getDBO(); $user = JFactory::getUser(); $query = "SELECT email\n FROM #__users \n WHERE usertype = 'Super Administrator' \n OR usertype = 'Administrator'"; $db->setQuery($query); $to = $db->loadResultArray(); $subject = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_SUBJECT"), $club->name)); $message = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_MESSAGE"), $user->name, $club->name)); $message .= $this->_getShowClubInfoLink(); JUtility::sendMail('', '', $to, $subject, $message); } } $this->setRedirect($this->_getShowClubInfoLink()); }
public function save() { // Check for request forgeries JRequest::checkToken() or die('RESTRICTED'); $row = WFExtensionHelper::getPlugin(null, 'jcemediabox', 'system'); $task = $this->getTask(); // remove id for Joomla! 2.5+ if ($row->extension_id) { unset($row->id); } if (!$row->bind(JRequest::get('post'))) { JError::raiseError(500, $row->getError()); } if (!$row->check()) { JError::raiseError(500, $row->getError()); } if (!$row->store()) { JError::raiseError(500, $row->getError()); } $row->checkin(); $msg = JText::sprintf('WF_MEDIABOX_SAVED'); switch ($task) { case 'apply': $this->setRedirect('index.php?option=com_jce&view=mediabox', $msg); break; case 'save': default: $this->setRedirect('index.php?option=com_jce&view=cpanel', $msg); break; } }
function save() { $mainframe = JFactory::getApplication(); $row = JTable::getInstance('K2Tag', 'Table'); if (!$row->bind(JRequest::get('post'))) { $mainframe->enqueueMessage($row->getError(), 'error'); $mainframe->redirect('index.php?option=com_k2&view=tags'); } if (!$row->check()) { $mainframe->enqueueMessage($row->getError(), 'error'); $mainframe->redirect('index.php?option=com_k2&view=tag&cid=' . $row->id); } if (!$row->store()) { $mainframe->enqueueMessage($row->getError(), 'error'); $mainframe->redirect('index.php?option=com_k2&view=tags'); } $cache = JFactory::getCache('com_k2'); $cache->clean(); switch (JRequest::getCmd('task')) { case 'apply': $msg = JText::_('K2_CHANGES_TO_TAG_SAVED'); $link = 'index.php?option=com_k2&view=tag&cid=' . $row->id; break; case 'save': default: $msg = JText::_('K2_TAG_SAVED'); $link = 'index.php?option=com_k2&view=tags'; break; } $mainframe->enqueueMessage($msg); $mainframe->redirect($link); }
public function save() { $app = JFactory::getApplication(); $model = $this->getModel('promotion'); $row =& JTable::getInstance('Promotions', 'DJClassifiedsTable'); $par =& JComponentHelper::getParams('com_djclassifieds'); if (!$row->bind(JRequest::get('post'))) { echo "<script> alert('" . $row->getError() . "');\n\t\t\t\twindow.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "');\n\t\t\t\twindow.history.go(-1); </script>\n"; exit; } switch (JRequest::getVar('task')) { case 'apply': $link = 'index.php?option=com_djclassifieds&task=promotion.edit&id=' . $row->id; $msg = JText::_('COM_DJCLASSIFIEDS_PROMOTION_SAVED'); break; case 'save2new': $link = 'index.php?option=com_djclassifieds&task=promotion.add'; $msg = JText::_('COM_DJCLASSIFIEDS_PROMOTION_SAVED'); break; case 'saveItem': default: $link = 'index.php?option=com_djclassifieds&view=promotions'; $msg = JText::_('COM_DJCLASSIFIEDS_PROMOTION_SAVED'); break; } $app->redirect($link, $msg); }
/** * Method to unsubscribe newsletter * * @return void */ public function unsubscribe() { $post = JRequest::get('get'); $model = $this->getModel('newsletter'); $option = JRequest::getVar('option'); $Itemid = JRequest::getVar('Itemid'); $email = JRequest::getVar('email1'); $newsletteritemid = JRequest::getVar('newsletteritemid'); $menu = JFactory::getApplication()->getMenu(); $item = $menu->getItem($newsletteritemid); if ($item) { $return = $item->link . '&Itemid=' . $newsletteritemid; } else { $return = "index.php?option=com_redshop&view=newsletter&layout=thankyou&Itemid=" . $Itemid; } /* * check if user has subscribe or not. */ $alreadysubscriberbymail = $model->checksubscriptionbymail($email); if ($alreadysubscriberbymail) { $userhelper = new rsUserhelper(); if ($userhelper->newsletterUnsubscribe($email)) { $msg = JText::_('COM_REDSHOP_CANCLE_SUBSCRIPTION'); } else { $msg = JText::_('COM_REDSHOP_CANCLE_SUBSCRIPTION_FAIL'); } } else { $msg = JText::_('COM_REDSHOP_ALREADY_CANCLE_SUBSCRIPTION'); } $this->setRedirect($return, $msg); }
function saveinfo() { $juser =& JFactory::getUser(); if ($juser->guest) { $error = 'Bạn phải đăng nhập để thực hiện chức năng này'; $this->setError($error); return false; } $post = JRequest::get('post'); $data = array(); $data['user_id'] = $juser->id; $data['couple_name'] = $post['couple_name']; $data['address'] = $post['address']; $data['country'] = $post['country']; if (isset($_FILES['avatar']) && $_FILES['avatar']['error'] == 0) { require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'thumb.php'; $p = manThumb::resize($_FILES['avatar']['tmp_name'], 96, 96); $name = 'avatar_' . $juser->id . '.jpg'; $file = JPATH_ROOT . DS . 'images' . DS . 'wedding' . DS . 'avatar' . DS . $name; imagejpeg($p, $file, 90); imagedestroy($p); $data['avatar'] = 'images/wedding/avatar/' . $name; } $row =& $this->getTable('users'); if (!$row->bind($data)) { $this->setError($this->_db->getErrorMsg()); return false; } if (!$row->store()) { $this->setError($this->_db->getErrorMsg()); return false; } return true; }
/** * looks at the validation condition & evaulates it * if evaulation is true then the validation rule is applied *@return bol apply validation */ function shouldValidate($data, $c) { $params =& $this->getParams(); $post = JRequest::get('post'); $v = $params->get($this->_pluginName . '-validation_condition', '', '_default', 'array', $c); if (!array_key_exists($c, $v)) { return true; } $condition = $v[$c]; if ($condition == '') { return true; } $w = new FabrikWorker(); // $$$ rob merge join data into main array so we can access them in parseMessageForPlaceHolder() $joindata = JArrayHelper::getValue($post, 'join', array()); foreach ($joindata as $joinid => $joind) { foreach ($joind as $k => $v) { if ($k !== 'rowid') { $post[$k] = $v; } } } $condition = trim($w->parseMessageForPlaceHolder($condition, $post)); // $$$ hugh - this screws things up if it's more than one line of code. /* if (substr(strtolower($condition ), 0, 6) !== 'return') { $condition = "return $condition"; } */ $res = @eval($condition); if (is_null($res)) { return true; } return $res; }
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; }