Exemple #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);
 }
Exemple #2
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');
 }
Exemple #3
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;
 }
 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;
     }
 }
Exemple #5
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);
 }
Exemple #6
0
 /**
 	get field value of $userId accordimg to $fieldCode
 */
 public function getInfo($userId, $fieldCode)
 {
     // Run Query to return 1 value
     $db = JFactory::getDBO();
     $query = 'SELECT b.* FROM ' . $db->nameQuote('#__community_fields') . ' AS a ' . 'INNER JOIN ' . $db->nameQuote('#__community_fields_values') . ' AS b ' . 'ON b.' . $db->nameQuote('field_id') . '=a.' . $db->nameQuote('id') . ' ' . 'AND b.' . $db->nameQuote('user_id') . '=' . $db->Quote($userId) . ' ' . 'INNER JOIN ' . $db->nameQuote('#__community_users') . ' AS c ' . 'ON c.' . $db->nameQuote('userid') . '= b.' . $db->nameQuote('user_id') . 'WHERE a.' . $db->nameQuote('fieldcode') . ' =' . $db->Quote($fieldCode);
     $db->setQuery($query);
     $result = $db->loadObject();
     $field = JTable::getInstance('FieldValue', 'CTable');
     $field->bind($result);
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     $config = CFactory::getConfig();
     // @rule: Only trigger 3rd party apps whenever they override extendeduserinfo configs
     if ($config->getBool('extendeduserinfo')) {
         CFactory::load('libraries', 'apps');
         $apps = CAppPlugins::getInstance();
         $apps->loadApplications();
         $params = array();
         $params[] = $fieldCode;
         $params[] =& $field->value;
         $apps->triggerEvent('onGetUserInfo', $params);
     }
     // Respect privacy settings.
     if (!XIPT_JOOMLA_15) {
         $my = CFactory::getUser();
         CFactory::load('libraries', 'privacy');
         if (!CPrivacy::isAccessAllowed($my->id, $userId, 'custom', $field->access)) {
             return false;
         }
     }
     return $field->value;
 }
Exemple #7
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);
 }
Exemple #8
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;
 }
Exemple #9
0
 /**
  * Method to get an ojbect.
  *
  * @param	integer	The id of the object to get.
  *
  * @return	mixed	Object on success, false on failure.
  */
 public function &getItem($id = null)
 {
     if ($this->_item === null) {
         $this->_item = false;
         if (empty($id)) {
             $id = $this->getState('weblink.id');
         }
         // Get a level row instance.
         $table = JTable::getInstance('Weblink', 'WeblinksTable');
         // Attempt to load the row.
         if ($table->load($id)) {
             // Check published state.
             if ($published = $this->getState('filter.published')) {
                 if ($table->state != $published) {
                     return $this->_item;
                 }
             }
             // Convert the JTable to a clean JObject.
             $properties = $table->getProperties(1);
             $this->_item = JArrayHelper::toObject($properties, 'JObject');
         } else {
             if ($error = $table->getError()) {
                 $this->setError($error);
             }
         }
     }
     return $this->_item;
 }
 function getCategory()
 {
     $category_id = $this->category_id;
     $row =& JTable::getInstance('RSTicketsPro_KB_Categories', 'Table');
     $row->load($category_id);
     $cat =& JTable::getInstance('RSTicketsPro_KB_Categories', 'Table');
     if ($row->parent_id) {
         $parent_id = $row->parent_id;
         $cat->load($parent_id);
         while ($parent_id > 0) {
             $parent_id = $cat->parent_id;
             $cat->load($parent_id);
             if ($cat->private) {
                 $row->private = 1;
             }
             if (!$cat->published) {
                 $row->published = 0;
             }
         }
     }
     if (!$this->is_staff && $row->private || !$row->published) {
         $mainframe =& JFactory::getApplication();
         JError::raiseWarning(500, JText::_('RST_CANNOT_VIEW_CATEGORY'));
         $mainframe->redirect('index.php?option=com_rsticketspro&view=knowledgebase');
     }
     $document =& JFactory::getDocument();
     if (!empty($row->meta_description)) {
         $document->setMetaData('description', $row->meta_description);
     }
     if (!empty($row->meta_keywords)) {
         $document->setMetaData('keywords', $row->meta_keywords);
     }
     return $row;
 }
 /**
  * Method to get a version history row.
  *
  * @return  stdClass|boolean    On success, standard object with row data. False on failure.
  *
  * @since   3.2
  */
 public function getItem()
 {
     /** @var JTableContenthistory $table */
     $table = JTable::getInstance('Contenthistory');
     $versionId = JFactory::getApplication()->input->getInt('version_id');
     if (!$table->load($versionId)) {
         return false;
     }
     // Get the content type's record so we can check ACL
     /** @var JTableContenttype $contentTypeTable */
     $contentTypeTable = JTable::getInstance('Contenttype');
     if (!$contentTypeTable->load($table->ucm_type_id)) {
         // Assume a failure to load the content type means broken data, abort mission
         return false;
     }
     // Access check
     if (!JFactory::getUser()->authorise('core.edit', $contentTypeTable->type_alias . '.' . (int) $table->ucm_item_id)) {
         $this->setError(JText::_('JERROR_ALERTNOAUTHOR'));
         return false;
     }
     // Good to go, finish processing the data
     $result = new stdClass();
     $result->save_date = $table->save_date;
     $result->version_note = $table->version_note;
     $result->data = ContenthistoryHelper::prepareData($table);
     return $result;
 }
Exemple #12
0
 public function store($updateNulls = false)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     if (!$this->id) {
         if (!intval($this->created)) {
             $this->created = $date->toSql();
         }
         if (empty($this->created_by)) {
             $this->created_by = $user->get('id');
         }
     }
     $table = JTable::getInstance('Producers', 'Djcatalog2Table');
     if ($app->isSite() || $app->input->get('task') == 'import') {
         if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) {
             $db->setQuery('select alias from #__djc2_producers where id != ' . $this->id . ' and alias like ' . $db->quote($db->escape($this->alias) . '%') . ' order by alias asc');
             $aliases = $db->loadColumn();
             $suffix = 2;
             while (in_array($this->alias . '-' . $suffix, $aliases)) {
                 $suffix++;
             }
             $this->alias = $this->alias . '-' . $suffix;
         }
     } else {
         if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) {
             $this->setError(JText::_('COM_DJCATALOG2_ERROR_UNIQUE_ALIAS'));
             return false;
         }
     }
     return parent::store($updateNulls);
 }
Exemple #13
0
 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;
 }
Exemple #14
0
 function addAddress($type = 'billing', $data = array())
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     if (isset($data) && count($data)) {
         $post = $data;
     } else {
         $post = $app->input->getArray($_POST);
     }
     foreach ($post as $key => $value) {
         //in case the value is an array, store as a json encoded message
         if (is_array($value)) {
             $post[$key] = $db->escape(json_encode($value));
         }
     }
     //first save data to the address table
     $row = JTable::getInstance('Address', 'Table');
     //set the id so that it updates the record rather than changing
     if (!$row->bind($post)) {
         $this->setError($row->getError());
         return false;
     }
     if ($user->id) {
         $row->user_id = $user->id;
     }
     $row->type = $type;
     if (!$row->store()) {
         $this->setError($row->getError());
         return false;
     }
     return $row->id;
 }
Exemple #15
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.date'));
     $db->setQuery($query, $start, $limit);
     $rows = $db->loadObjectList();
     foreach ($rows as $row) {
         $table = JTable::getInstance('Comment', 'JCommentsTable');
         $table->object_id = $row->contentid;
         $table->object_group = $row->option;
         $table->parent = $row->parentid;
         $table->userid = $row->userid;
         $table->name = $row->name;
         $table->username = $row->username;
         $table->comment = $row->comment;
         $table->ip = $row->ip;
         $table->email = $row->email;
         $table->homepage = $row->website;
         $table->published = $row->published;
         $table->date = $row->date;
         $table->isgood = $row->voted > 0 ? $row->voted : 0;
         $table->ispoor = $row->voted < 0 ? abs($row->voted) : 0;
         $table->lang = $language;
         $table->source_id = $row->id;
         $table->source = $source;
         $table->store();
     }
 }
Exemple #16
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');
 }
Exemple #17
0
 /**
  * Overload the store method for the Weblinks table.
  *
  * @param	boolean	Toggle whether null values should be updated.
  * @return	boolean	True on success, false on failure.
  * @since	1.6
  */
 public function store($updateNulls = false)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if ($this->id) {
         // Existing item
         $this->modified = $date->toSql();
         $this->modified_by = $user->get('id');
     } else {
         // New weblink. A weblink created and created_by field can be set by the user,
         // so we don't touch either of these if they are set.
         if (!intval($this->created)) {
             $this->created = $date->toSql();
         }
         if (empty($this->created_by)) {
             $this->created_by = $user->get('id');
         }
     }
     // Verify that the alias is unique
     $table = JTable::getInstance('Weblink', 'WeblinksTable');
     if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) {
         $this->setError(JText::_('COM_WEBLINKS_ERROR_UNIQUE_ALIAS'));
         return false;
     }
     // Attempt to store the user data.
     return parent::store($updateNulls);
 }
Exemple #18
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);
 }
 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());
 }
Exemple #20
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;
 }
Exemple #21
0
 function &getTable()
 {
     if ($this->_table == null) {
         $this->_table = JTable::getInstance('produsts', $this->getDBO());
     }
     return $this->_table;
 }
 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;
 }
Exemple #23
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();
 }
Exemple #24
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;
 }
Exemple #25
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;
 }
 /**
  * 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;
     }
 }
 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;
 }
Exemple #28
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();
     }
 }
Exemple #29
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();
 }
 public function install($adapter)
 {
     $version = new JVersion();
     $db = JFactory::getDbo();
     $module = JTable::getInstance('module');
     if ($module->load(array('module' => 'mod_comprofileronline', 'position' => '')) || !$module->load(array('module' => 'mod_comprofileronline'))) {
         $module->set('title', 'CB Online');
         $module->set('ordering', '3');
         $module->set('position', 'position-7');
         $module->set('published', '1');
         $module->set('module', 'mod_comprofileronline');
         $module->set('access', '1');
         $module->set('showtitle', '1');
         if ($version->isCompatible('3.0')) {
             $module->set('params', '{"pretext":"","posttext":"","cb_plugins":"0","layout":"_:default","moduleclass_sfx":"","cache":"0","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}');
         } else {
             $module->set('params', '{"pretext":"","posttext":"","cb_plugins":"0","layout":"_:default","moduleclass_sfx":"","cache":"0"}');
         }
         $module->set('client_id', '0');
         $module->set('language', '*');
         if ($module->store()) {
             $moduleId = $module->get('id');
             if ($moduleId) {
                 $db->setQuery('INSERT IGNORE INTO `#__modules_menu` ( `moduleid`, `menuid` ) VALUES ( ' . (int) $moduleId . ', 0 )');
                 try {
                     $db->execute();
                 } catch (RuntimeException $e) {
                 }
             }
         }
     }
 }