Beispiel #1
4
 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);
 }
Beispiel #2
1
 /**
  * Assigns the listeners to the table's event dispatcher.
  *
  * If you want to customise the events registered to the dispatcher you should override this method. A standard set
  * of listeners is supplied with this class and registered by default.
  *
  * @return  void
  *
  * @since   4.0
  */
 public function attachListenersToDispatcher()
 {
     // Get the dispatcher
     $dispatcher = $this->table->getDispatcher();
     // Assign the listeners to the dispatcher
     $dispatcher->addListener('onBeforeLoad', [$this, 'onBeforeLoadListener']);
     $dispatcher->addListener('onAfterLoad', [$this, 'onAfterLoadListener']);
     $dispatcher->addListener('onBeforeStore', [$this, 'onBeforeStoreListener']);
     $dispatcher->addListener('onAfterStore', [$this, 'onAfterStoreListener']);
 }
Beispiel #3
1
 private function load()
 {
     $result = false;
     // Load the table object, empty if _state->data->key = null;
     $this->getTable()->load($this->_state->get($this->_key, null));
     //if we have incoming data, bind it to the table object
     if ($data = $this->_state->get('data', false)) {
         $this->_table->bind($data);
     }
     //set the state to the table data.
     $this->_state->set('data', get_object_vars($this->_table));
 }
Beispiel #4
1
 /**
  * Prepare and sanitise the table data prior to saving.
  *
  * @param   JTable  $table  A reference to a JTable object.
  *
  * @return  void
  *
  * @since   12.2
  */
 protected function prepareTable($table)
 {
     require_once JDeveloperLIB . "/template.php";
     $type = $table->get("type", "");
     $dir = JDeveloperTEMPLATES . "/fields/formfields/" . $type . ".php";
     if ($table->id == 0 && JFile::exists($dir)) {
         $template = new JDeveloperTemplate($dir);
         $template->addAreas(array("header" => false));
         $template->addPlaceholders(array("name" => $table->name), true);
         $table->source = $template->getBuffer();
     }
 }
Beispiel #5
1
 /**
  * Logic to move
  */
 function move()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // Get the table instance
     $row =& JTable::getInstance('RSMembership_Extras', 'Table');
     // Get the selected items
     $cid = JRequest::getVar('cid', array(0), 'post', 'array');
     // Get the task
     $task = JRequest::getCmd('task');
     // Force array elements to be integers
     JArrayHelper::toInteger($cid, array(0));
     // Set the direction to move
     $direction = $task == 'orderup' ? -1 : 1;
     // Can move only one element
     if (is_array($cid)) {
         $cid = $cid[0];
     }
     // Load row
     if (!$row->load($cid)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // Move
     $row->move($direction);
     // Redirect
     $this->setRedirect('index.php?option=com_rsmembership&view=extras');
 }
Beispiel #6
1
 public function store($updateNulls = true)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if ($this->id) {
         $this->modified_time = $date->toSql();
         $this->modified_user_id = $user->get('id');
     } else {
         if (!(int) $this->created_time) {
             $this->created_time = $date->toSql();
         }
         if (empty($this->created_user_id)) {
             $this->created_user_id = $user->get('id');
         }
     }
     $table = JTable::getInstance('Page', 'SppagebuilderTable');
     $alias = JFilterOutput::stringURLSafe($this->alias);
     if ($alias == '') {
         $alias = JFilterOutput::stringURLSafe($this->title);
     }
     $this->alias = $alias;
     if ($table->load(array('alias' => $alias)) && ($table->id != $this->id || $this->id == 0)) {
         $this->setError(JText::_('COM_SPPAGEBUILDER_ERROR_UNIQUE_ALIAS'));
         return false;
     }
     return parent::store($updateNulls);
 }
Beispiel #7
1
 private function _getAllEvents()
 {
     $mainframe = JFactory::getApplication();
     $rows = $this->model->getEvents();
     $items = array();
     foreach ($rows as $row) {
         $item = new stdClass();
         $table =& JTable::getInstance('Event', 'CTable');
         $table->bind($row);
         $table->thumbnail = $table->getThumbAvatar();
         $table->avatar = $table->getAvatar();
         $author = CFactory::getUser($table->creator);
         $item->id = $row->id;
         $item->created = $row->created;
         $item->creator = CStringHelper::escape($author->getDisplayname());
         $item->title = $row->title;
         $item->description = CStringHelper::escape($row->description);
         $item->location = CStringHelper::escape($row->location);
         $tiem->startdate = $row->startdate;
         $item->enddate = $row->enddate;
         $item->thumbnail = $table->thumbnail;
         $tiem->avatar = $table->avatar;
         $item->ticket = $row->ticket;
         $item->invited = $row->invitedcount;
         $item->confirmed = $row->confirmedcount;
         $item->declined = $row->declinedcount;
         $item->maybe = $row->maybecount;
         $item->latitude = $row->latitude;
         $item->longitude = $row->longitude;
         $items[] = $item;
     }
     return $items;
 }
Beispiel #8
1
 public function delete($pk = null)
 {
     // Get form model
     $formModel = JModelLegacy::getInstance('form', 'IssnregistryModel');
     if ($pk != null) {
         // Get number of forms related to this publisher
         $formsCount = $formModel->getFormsCountByPublisherId($pk);
         // Check result
         if ($formsCount != 0) {
             // If there are forms, the publisher can't be deleted
             JFactory::getApplication()->enqueueMessage(JText::_('COM_ISSNREGISTRY_PUBLISHER_DELETE_FAILED_FORMS_EXIST'), 'warning');
             // Return false as the item can't be deleted
             return false;
         }
         // Delete messages
         //$messageModel = JModelLegacy::getInstance('message', 'IssnregistryModel');
         //$messageModel->deleteByPublisherId($pk);
     }
     if (parent::delete($pk)) {
         // If this publisher was created based on a form, remove
         // publisher created attribute from the form
         if ($this->form_id != 0) {
             $formModel->removePublisherCreated($this->form_id);
         }
         // Get message model
         $messageModel = JModelLegacy::getInstance('message', 'IssnregistryModel');
         // Delete messages related to this publisher
         $messageModel->deleteByPublisherId($pk);
         // Return true
         return true;
     }
     return false;
 }
 public function store($updateNulls = false)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     // Attempt to store the user data.
     return parent::store($updateNulls);
 }
Beispiel #10
1
 public function __construct($contentElement)
 {
     $this->filterNullValue = -1;
     $this->filterType = "category";
     $this->filterField = $contentElement->getFilter("category");
     parent::__construct($contentElement);
     // if currently selected category is not compatible with section then reset
     if (intval(JRequest::getVar('filter_reset', 0))) {
         $this->section_filter_value = -1;
     } else {
         if ($this->rememberValues) {
             $this->section_filter_value = JFactory::getApplication()->getUserStateFromRequest('section_filter_value', 'section_filter_value', -1);
         } else {
             $this->section_filter_value = JRequest::getVar("section_filter_value", -1);
         }
     }
     if ($this->section_filter_value != -1 and $this->filter_value >= 0) {
         $cat = JTable::getInstance('category');
         $cat->load($this->filter_value);
         if ($cat->section != $this->section_filter_value) {
             $this->filter_value = -1;
         }
     }
     if ($this->section_filter_value == 0) {
         $this->filter_value = 0;
     }
 }
Beispiel #11
1
 /**
  * Get a connection table object
  *
  * @param   int  $id  connection id
  *
  * @return  object  connection tables
  */
 public function &getConnection($id = null)
 {
     if (!is_null($id)) {
         $this->setId($id);
     }
     if (!is_object($this->_connection)) {
         $session = JFactory::getSession();
         $key = 'fabrik.connection.' . $this->_id;
         if ($session->has($key)) {
             $connProperties = unserialize($session->get($key));
             // $$$ rob since J1.6 - connection properties stored as an array (in f2 it was an object)
             if (is_a($connProperties, '__PHP_Incomplete_Class') || JArrayHelper::getValue($connProperties, 'id') == '') {
                 $session->clear($key);
             } else {
                 $this->_connection = FabTable::getInstance('connection', 'FabrikTable');
                 $this->_connection->bind($connProperties);
                 return $this->_connection;
             }
         }
         if ($this->_id == -1 || $this->_id == '') {
             $this->_connection = $this->loadDefaultConnection();
         } else {
             $this->_connection = FabTable::getInstance('Connection', 'FabrikTable');
             $this->_connection->load($this->_id);
         }
         // $$$ rob store the connection for later use as it may be required by modules/plugins
         $session->set($key, serialize($this->_connection->getProperties()));
     }
     return $this->_connection;
 }
Beispiel #12
0
 public function postflight($action, $adapter)
 {
     $table = JTable::getInstance('extension');
     $component = "com_jevents";
     if (!$table->load(array("element" => "com_jevents", "type" => "component"))) {
         JFactory::getApplication()->enqueueMessage('Not a valid component', 'error');
         return false;
     }
     $params = JComponentHelper::getParams("com_jevents");
     $checkClashes = $params->get("checkclashes", 0);
     if ($params->get("noclashes", 0)) {
         $params->set("checkconflicts", "2");
     } else {
         if ($params->get("checkclashes", 0)) {
             $params->set("checkconflicts", "1");
         }
     }
     $paramsArray = $params->toArray();
     unset($paramsArray['checkclashes']);
     unset($paramsArray['noclashes']);
     $post['params'] = $paramsArray;
     $post['option'] = $component;
     $table->bind($post);
     // pre-save checks
     if (!$table->check()) {
         JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
         return false;
     }
     // save the changes
     if (!$table->store()) {
         JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
         return false;
     }
     return true;
 }
Beispiel #13
0
 /**
  * Overloaded bind function
  *
  * @acces public
  * @param array $hash named array
  * @return null|string	null is operation was satisfactory, otherwise returns an error
  * @see JTable:bind
  * @since 1.5
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['params']) && is_array($array['params'])) {
         $array['params'] = json_encode($array['params']);
     }
     return parent::bind($array, $ignore);
 }
Beispiel #14
0
 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);
 }
Beispiel #15
0
 /**
  * Constructor
  *
  * @param   JDatabaseDriver  $db  Database driver object.
  *
  * @since   11.1
  * @deprecated  13.3  Use SQL queries to interact with the session table.
  */
 public function __construct(JDatabaseDriver $db)
 {
     JLog::add('JTableSession is deprecated. Use SQL queries directly to interact with the session table.', JLog::WARNING, 'deprecated');
     parent::__construct('#__session', 'session_id', $db);
     $this->guest = 1;
     $this->username = '';
 }
Beispiel #16
0
 function is_checkout($checked_out)
 {
     if ($this->user && JTable::isCheckedOut($this->user->get('id'), $checked_out)) {
         return true;
     }
     return false;
 }
Beispiel #17
0
 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;
 }
Beispiel #18
0
 function &getTable()
 {
     if ($this->_table == null) {
         $this->_table = JTable::getInstance('produsts', $this->getDBO());
     }
     return $this->_table;
 }
Beispiel #19
0
 /**
  * Gets a users basic information
  *
  * @param int $userid
  * @return obj CitruscartAddresses if found, false otherwise
  */
 public static function getBasicInfo($userid)
 {
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
     $row = JTable::getInstance('UserInfo', 'CitruscartTable');
     $row->load(array('user_id' => $userid));
     return $row;
 }
Beispiel #20
0
 /**
  * Post data from JSON resource item.
  *
  * @param   string	$data  The JSON+HAL resource.
  *
  * @return bool True if resource is created, false if some error occured
  */
 public function postData($data, $tableClass = false, $tablePrefix = 'JTable', $tablePath = array())
 {
     // Declare return
     $return = false;
     // Get the database query object.
     $query = $this->db->getQuery(true);
     // Get a database query helper object.
     $apiQuery = $this->getApiQuery();
     // Get the correct table class
     $tableClass = $tableClass != false ? $this->tableClass : $tableClass;
     // Get the correct table prefix
     $tablePrefix = $tablePrefix != 'JTable' ? $tablePrefix : 'JTable';
     // Include the legacy table classes
     JTable::addIncludePath(JPATH_LIBRARIES . '/legacy/table/');
     // Include the custom table path if exists
     if (count($tablePath)) {
         foreach ($tablePath as $path) {
             JTable::addIncludePath($path);
         }
     }
     // Declare the JTable class
     $table = JTable::getInstance($tableClass, $tablePrefix, array('dbo' => $this->db));
     try {
         $return = $apiQuery->postItem($query, $table, $data);
     } catch (Exception $e) {
         $this->app->setHeader('status', '400', true);
         // An exception has been caught, echo the message and exit.
         echo json_encode(array('message' => $e->getMessage(), 'code' => $e->getCode(), 'type' => get_class($e)));
         exit;
     }
     return $return;
 }
 /**
  * Start element parser callback.
  *
  * @param   object  $parser  The parser object.
  * @param   string  $name    The name of the element.
  * @param   array   $attrs   The attributes of the element.
  *
  * @return  void
  *
  * @since   11.1
  */
 protected function _startElement($parser, $name, $attrs = array())
 {
     array_push($this->stack, $name);
     $tag = $this->_getStackLocation();
     // Reset the data
     if (isset($this->{$tag})) {
         $this->{$tag}->_data = "";
     }
     switch ($name) {
         case 'UPDATE':
             $this->currentUpdate = JTable::getInstance('update');
             $this->currentUpdate->update_site_id = $this->updateSiteId;
             $this->currentUpdate->detailsurl = $this->_url;
             $this->currentUpdate->folder = "";
             $this->currentUpdate->client_id = 1;
             break;
             // Don't do anything
         // Don't do anything
         case 'UPDATES':
             break;
         default:
             if (in_array($name, $this->updatecols)) {
                 $name = strtolower($name);
                 $this->currentUpdate->{$name} = '';
             }
             if ($name == 'TARGETPLATFORM') {
                 $this->currentUpdate->targetplatform = $attrs;
             }
             if ($name == 'PHP_MINIMUM') {
                 $this->currentUpdate->php_minimum = '';
             }
             break;
     }
 }
Beispiel #22
0
 function createCustomField($what)
 {
     // Load the JTable Object.
     JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_community' . DS . 'tables');
     $row = JTable::getInstance('profiles', 'CommunityTable');
     $row->load(0);
     switch ($what) {
         case PROFILETYPE_CUSTOM_FIELD_CODE:
             $data['type'] = PROFILETYPE_FIELD_TYPE_NAME;
             $data['name'] = 'Profiletype';
             $data['tips'] = 'Profiletype Of User';
             break;
         case TEMPLATE_CUSTOM_FIELD_CODE:
             $data['type'] = TEMPLATE_FIELD_TYPE_NAME;
             $data['name'] = 'Template';
             $data['tips'] = 'Template Of User';
             break;
         default:
             XiptError::assert(0);
             break;
     }
     $data['published'] = 1;
     $data['fieldcode'] = $what;
     return $row->bind($data) && $row->store();
 }
Beispiel #23
0
 public function execute($language, $start = 0, $limit = 100)
 {
     $db = JFactory::getDBO();
     $source = $this->getCode();
     $query = $db->getQuery(true);
     $query->select('c.*');
     $query->from($db->quoteName($this->tableName) . ' AS c');
     $query->select('u.username as user_username, u.name as user_name, u.email as user_email');
     $query->join('LEFT', $db->quoteName('#__users') . ' AS u ON c.userid = u.id');
     $query->order($db->escape('c.time'));
     $db->setQuery($query, $start, $limit);
     $rows = $db->loadObjectList();
     foreach ($rows as $row) {
         $table = JTable::getInstance('Comment', 'JCommentsTable');
         $table->object_id = $row->product_id;
         $table->object_group = 'com_virtuemart';
         $table->parent = 0;
         $table->userid = $row->userid;
         $table->name = $row->name;
         $table->username = $row->username;
         $table->comment = $row->comment;
         $table->email = $row->email;
         $table->published = $row->published;
         $table->date = strftime("%Y-%m-%d %H:%M:00", $row->time);
         $table->lang = $language;
         $table->source = $source;
         $table->store();
     }
 }
Beispiel #24
0
 /**
  * 
  * Enter description here ...
  * @param $subscription     mixed  CitruscartTableSubscriptions object or a subscription_id
  * @return unknown_type
  */
 function doExpiredSubscription($subscription)
 {
     if (is_numeric($subscription)) {
         JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
         $table = JTable::getInstance('Subscriptions', 'CitruscartTable');
         $table->load(array('subscription_id' => $subscription));
         $subscription = $table;
     }
     if (empty($subscription->subscription_id) || !is_object($subscription)) {
         $this->setError(JText::_('COM_CITRUSCART_JUGA_INVALID_SUBSCRIPTION'));
         return false;
     }
     if (!empty($subscription->product_id)) {
         JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models');
         $model = JModelLegacy::getInstance('Products', 'CitruscartModel');
         $model->setId($subscription->product_id);
         $product = $model->getItem();
         $juga_group_csv_add = $product->product_parameters->get('juga_group_csv_add_expiration');
         $juga_group_csv_remove = $product->product_parameters->get('juga_group_csv_remove_expiration');
         $ids_remove = explode(',', $juga_group_csv_remove);
         if (!empty($ids_remove)) {
             foreach ($ids_remove as $id) {
                 $this->remove($subscription->user_id, $id);
             }
         }
         $ids_add = explode(',', $juga_group_csv_add);
         if (!empty($ids_add)) {
             foreach ($ids_add as $id) {
                 $this->add($subscription->user_id, $id);
             }
         }
     }
     return true;
 }
Beispiel #25
0
 public function copy()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $cid = $this->input->post->get('cid', array(), 'array');
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tagmeta/tables');
     $table =& JTable::getInstance('Rule', 'TagMetaTable');
     $n = count($cid);
     if ($n > 0) {
         $i = 0;
         foreach ($cid as $id) {
             if ($table->load((int) $id)) {
                 $table->id = 0;
                 $table->url = JText::_('COM_TAGMETA_COPY_OF') . $table->url;
                 $table->ordering = 0;
                 $table->published = false;
                 $table->checked_out = false;
                 if ($table->store()) {
                     $i++;
                 } else {
                     JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_TAGMETA_COPY_ERROR_SAVING', $id, $table->getError()), 'error');
                 }
             } else {
                 JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_TAGMETA_COPY_ERROR_LOADING', $id, $table->getError()), 'error');
             }
         }
     } else {
         return JError::raiseWarning(500, JText::_('COM_TAGMETA_COPY_ERROR_NO_SELECTION'));
     }
     $this->setMessage(JText::sprintf('COM_TAGMETA_COPY_OK', $i));
     $this->setRedirect('index.php?option=com_tagmeta&view=rules');
 }
Beispiel #26
0
 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();
 }
 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 static function getRow($id, $content_type = '')
 {
     if (!$id) {
         return NULL;
     }
     $index = $id . '_' . $content_type;
     if (isset(self::$_items[$index])) {
         return self::$_items[$index];
     }
     $row = JTable::getInstance('content');
     $row->load($id);
     if (!$content_type) {
         $content_type = JCckDatabase::loadResult('SELECT cck FROM #__cck_core WHERE storage_location = "joomla_article" AND pk = ' . $row->id);
     }
     if ($content_type) {
         $fields = JCckDatabase::loadObject('SELECT * FROM #__cck_store_form_' . $content_type . ' WHERE id = ' . $row->id);
         if (count($fields)) {
             foreach ($fields as $k => $v) {
                 $row->{$k} = $v;
             }
         }
     }
     self::$_items[$index] = $row;
     return $row;
 }
Beispiel #29
0
 function publish()
 {
     //      global $option;
     $cid = JRequest::getVar('cid', array());
     $row = JTable::getInstance('twines', 'Table');
     $publish = 1;
     if ($this->getTask() == 'unpublish') {
         $publish = 0;
     }
     if (!$row->publish($cid, $publish)) {
         JError::raiseError(500, $row->getError());
     }
     $s = '';
     if (count($cid) > 1) {
         $s = 's';
     }
     $msg = 'Page' . $s;
     if ($this->getTask() == 'unpublish') {
         $msg .= ' unpublished';
     } else {
         $msg .= ' published';
     }
     // $this->setRedirect('index.php?option=' . $option, $msg);
     $this->setRedirect('index.php?option=com_battle&view=twines', $msg);
 }
Beispiel #30
-1
 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;
 }