Ejemplo n.º 1
3
 public function store($updateNulls = false)
 {
     if (isset($this->alias)) {
         $this->alias = JApplication::stringURLSafe($this->alias);
     }
     if (!empty($this->metakey)) {
         // Only process if not empty
         $bad_characters = array("\n", "\r", "\"", "<", ">");
         // array of characters to remove
         $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey);
         // remove bad characters
         $keys = explode(',', $after_clean);
         // create array using commas as delimiter
         $clean_keys = array();
         foreach ($keys as $key) {
             if (trim($key)) {
                 // Ignore blank keywords
                 $clean_keys[] = trim($key);
             }
         }
         $this->metakey = implode(", ", $clean_keys);
         // put array back together delimited by ", "
     }
     if (empty($this->answer_created_by_id)) {
         $this->answer_created_by_id = JFactory::getUser()->id;
     }
     return parent::store($updateNulls);
 }
Ejemplo n.º 2
1
 public function store($updateNulls = false)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     // Attempt to store the user data.
     return parent::store($updateNulls);
 }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
0
 /**
  * Override paren't store method so we can do some checking with the watermarks.
  * 
  * @return	bool	True on success.	 	 
  **/
 public function store()
 {
     if (!$this->id) {
         $this->ordering = parent::getNextOrder();
     }
     parent::store();
 }
Ejemplo n.º 5
0
 public function store($updateNulls = false)
 {
     if (empty($this->key)) {
         $this->key = $this->generate();
     }
     return parent::store($updateNulls);
 }
Ejemplo n.º 6
0
 public function store($updateNulls = false)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     $id = (int) $this->id;
     $country_id = (int) $this->country_id;
     $tax_rate = (int) $this->tax_rate_id;
     $client = substr(strtoupper($this->client_type), 0, 1);
     $this->client_type = $client;
     $query = $db->getQuery(true);
     $where = array();
     $query->select('count(*)');
     $query->from('#__djc2_tax_rules');
     if ($id) {
         $where[] = 'id != ' . $id;
     }
     if ($country_id > 0) {
         $where[] = 'country_id=' . $country_id;
     }
     $where[] = 'tax_rate_id=' . $tax_rate;
     $query->where($where);
     $db->setQuery($query);
     $count = $db->loadResult();
     if ($count > 0) {
         $this->setError(JText::_('COM_DJCATALOG2_ERROR_UNIQUE_TAX_RULE'));
         return false;
     }
     return parent::store($updateNulls);
 }
Ejemplo n.º 7
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);
 }
Ejemplo n.º 8
0
 function store($updateNulls = false)
 {
     if (empty($this->name)) {
         $this->name = $this->code;
     }
     return parent::store($updateNulls);
 }
Ejemplo n.º 9
0
 function store($updateNulls = false)
 {
     if ($this->userid != 0 && empty($this->email)) {
         $user = JFactory::getUser($this->userid);
         $this->email = $user->email;
     }
     if ($this->userid == 0 && !empty($this->email)) {
         $db = JFactory::getDBO();
         $query = $db->getQuery(true);
         $query->select('*');
         $query->from($db->quoteName('#__users'));
         $query->where($db->quoteName('email') . ' = ' . $db->Quote($db->escape($this->email, true)));
         $db->setQuery($query);
         $users = $db->loadObjectList();
         if (count($users)) {
             $this->userid = $users[0]->id;
             $this->name = $users[0]->name;
         }
     }
     if (empty($this->lang)) {
         $this->lang = JCommentsMultilingual::getLanguage();
     }
     $this->hash = $this->getHash();
     return parent::store($updateNulls);
 }
Ejemplo n.º 10
0
 /**
  * method to store a row
  *
  * @param boolean $updateNulls True to update fields even if they are null.
  */
 function store($updateNulls = false)
 {
     //echo "<br>TABLE STORE:: ".$this->id;
     // echo "<br>TABLE STORE:: ".$this->_getAssetName();
     // Attempt to store the user data.
     return parent::store($updateNulls);
 }
Ejemplo n.º 11
0
 /**
  * Extend store
  */
 public function store($updateNulls = false)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     // created & modified
     if (!$this->created) {
         $this->created = $date->toSql();
     }
     if (!$this->created_by) {
         $this->created_by = $user->get('id');
     }
     $this->modified = $date->toSql();
     $this->modified_by = $user->get('id');
     // ordering
     if (!$this->id) {
         $where = "catid = " . $this->catid;
         $this->ordering = $this->getNextOrder($where);
     }
     // params
     // Transform the params field
     if (is_array($this->params)) {
         $registry = new JRegistry();
         $registry->loadArray($this->params);
         $this->params = (string) $registry;
     }
     return parent::store($updateNulls);
 }
Ejemplo n.º 12
0
 /**
  * Stores a publisher.
  *
  * @param   boolean  $updateNulls  True to update fields even if they are null.
  *
  * @return  boolean  True on success, false on failure.
  *
  * @since   1.6
  */
 public function store($updateNulls = false)
 {
     // Transform the params field
     if (isset($this->params) && is_array($this->params)) {
         $registry = new Registry();
         $registry->loadArray($this->params);
         $this->params = (string) $registry;
     }
     // Get date and user
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if ($this->id) {
         // Existing item
         $this->modified_by = $user->get('username');
         $this->modified = $date->toSql();
     } else {
         // New item
         $this->created_by = $user->get('username');
         $this->created = $date->toSql();
     }
     // Question 7: from array to comma separated string
     if (is_array($this->question_7)) {
         if (count($this->question_7) > 0) {
             $this->question_7 = implode(',', $this->question_7);
         } else {
             $this->question_7 = '';
         }
     } else {
         $this->question_7 = '';
     }
     return parent::store($updateNulls);
 }
Ejemplo n.º 13
0
 public function store($updateNulls = false)
 {
     if (empty($this->created) || $this->created == '0000-00-00 00:00:00') {
         $this->created = DiscussHelper::getDate()->toMySQL();
     }
     return parent::store();
 }
Ejemplo n.º 14
0
 /**
  * Overriden JTable::store to set modified data.
  *
  * @param   boolean	 $updateNulls  True to update fields even if they are null.
  *
  * @return  boolean  True on success.
  *
  * @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 edashboard. A feed created and created_by field can be set by the user,
         // so we don't touch either of these if they are set.
         if (!(int) $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('Edashboard', 'EdashboardTable');
     if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) {
         $this->setError(JText::_('COM_EDASHBOARD_ERROR_UNIQUE_ALIAS') . ' ' . $this->alias);
         return false;
     }
     return parent::store($updateNulls);
 }
Ejemplo n.º 15
0
	/**
	 * Overrides JTable::store to check unique fields.
	 *
	 * @param   boolean  $updateNulls  True to update fields even if they are null.
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   11.4
	 */
	public function store($updateNulls = false)
	{
		// Verify that the sef field is unique
		$table = JTable::getInstance('Language', 'JTable');
		if ($table->load(array('sef' => $this->sef)) && ($table->lang_id != $this->lang_id || $this->lang_id == 0))
		{
			$this->setError(JText::_('JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_SEF'));
			return false;
		}

		// Verify that the image field is unique
		if ($table->load(array('image' => $this->image)) && ($table->lang_id != $this->lang_id || $this->lang_id == 0))
		{
			$this->setError(JText::_('JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_IMAGE'));
			return false;
		}

		// Verify that the language code is unique
		if ($table->load(array('lang_code' => $this->lang_code)) && ($table->lang_id != $this->lang_id || $this->lang_id == 0))
		{
			$this->setError(JText::_('JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_LANG_CODE'));
			return false;
		}
		return parent::store($updateNulls);
	}
Ejemplo n.º 16
0
 public function store()
 {
     $now = new JDate();
     // Always update the stream last updated time
     $this->updated = $now->toMySQL();
     return parent::store();
 }
Ejemplo n.º 17
0
 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');
     }
     // New product. A product created and created_by field can be set by the user,
     // so we don't touch either of these if they are set.
     if (!(int) $this->created) {
         $this->created = $date->toSql();
     }
     if (empty($this->created_by)) {
         $this->created_by = $user->get('id');
     }
     // Set publish_up to null date if not set
     if (!$this->publish_up) {
         $this->publish_up = $this->_db->getNullDate();
     }
     // Set publish_down to null date if not set
     if (!$this->publish_down) {
         $this->publish_down = $this->_db->getNullDate();
     }
     // Verify that the alias is unique
     $table = JTable::getInstance('Product', 'Table');
     if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) {
         $this->setError(JText::_('COM_DIGICOM_ERROR_UNIQUE_ALIAS'));
         return false;
     }
     return parent::store($updateNulls);
 }
Ejemplo n.º 18
0
 /**
  * Store Table override
  * @override
  *
  * @see JTable::store()
  */
 public function store($updateNulls = false)
 {
     $result = parent::store($updateNulls);
     // If store sucessful go on to popuplate relations table for sources/datasets
     if ($result) {
         // Clear table from previous records
         $queryDelete = "DELETE" . "\n FROM " . $this->_db->quoteName('#__jmap_dss_relations') . "\n WHERE" . "\n " . $this->_db->quoteName('datasetid') . " = " . "\n " . (int) $this->id;
         if (!$this->_db->setQuery($queryDelete)->execute()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         // Manage multiple tuples to be inserted using single query
         $selectedSources = json_decode($this->sources);
         if (count($selectedSources)) {
             $insertTuples = array();
             foreach ($selectedSources as $source) {
                 $insertTuples[] = '(' . (int) $this->id . ',' . $source . ')';
             }
             $insertTuples = implode(',', $insertTuples);
             $queryMultipleInsert = "INSERT" . "\n INTO " . $this->_db->quoteName('#__jmap_dss_relations') . "\n (" . $this->_db->quoteName('datasetid') . "," . $this->_db->quoteName('datasourceid') . ")" . "\n VALUES " . $insertTuples;
             if (!$this->_db->setQuery($queryMultipleInsert)->execute()) {
                 $this->setError($this->_db->getErrorMsg());
                 return false;
             }
         }
     }
     return $result;
 }
 /**
  * Stores an Identifier Range.
  *
  * @param   boolean  $updateNulls  True to update fields even if they are null.
  *
  * @return  boolean  True on success, false on failure.
  *
  * @since   1.6
  */
 public function store($updateNulls = false)
 {
     // Transform the params field
     if (isset($this->params) && is_array($this->params)) {
         $registry = new Registry();
         $registry->loadArray($this->params);
         $this->params = (string) $registry;
     }
     // Get date and user
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if ($this->id) {
         // Existing item
         $this->modified_by = $user->get('username');
         $this->modified = $date->toSql();
     } else {
         // New item
         $this->created_by = $user->get('username');
         $this->created = $date->toSql();
         $this->category = strlen($this->range_begin);
         $this->free = $this->range_end - $this->range_begin + 1;
         $this->next = $this->range_begin;
     }
     return parent::store($updateNulls);
 }
Ejemplo n.º 20
0
 function store($updateNulls = false)
 {
     $query = 'SELECT * FROM #__imageshow_external_source_picasa WHERE external_source_id =' . (int) $this->external_source_id;
     $this->_db->setQuery($query);
     $current = $this->_db->loadObject();
     $updateThumbnailSize = false;
     $updateImageSize = false;
     if ($current) {
         if ($this->picasa_thumbnail_size && $this->picasa_thumbnail_size != $current->picasa_thumbnail_size) {
             $updateThumbnailSize = $this->picasa_thumbnail_size;
         }
         if ($this->picasa_image_size && $this->picasa_image_size != $current->picasa_image_size) {
             $updateImageSize = $this->picasa_image_size;
         }
     }
     if (parent::store($updateNulls = false)) {
         // if thumbnail size and image size changed, upate the images link
         if (isset($updateImageSize)) {
             $this->updateImageSize($this->external_source_id, $updateImageSize);
         }
         if (isset($updateThumbnailSize)) {
             $this->updateThumbnailSize($this->external_source_id, $updateThumbnailSize);
         }
     } else {
         return false;
     }
     return true;
 }
Ejemplo n.º 21
0
 /**
  * Override paren't store method so we can do some checking with the watermarks.
  *
  * @return	bool	True on success.
  **/
 public function store($updateNulls = false)
 {
     if (!$this->id) {
         $this->ordering = parent::getNextOrder();
     }
     parent::store();
 }
Ejemplo n.º 22
0
 public function store()
 {
     if (!$this->check()) {
         return false;
     }
     return parent::store();
 }
Ejemplo n.º 23
0
 /**
  * Stores a contact
  *
  * @param	boolean	True to update fields even if they are null.
  * @return	boolean	True on success, false on failure.
  * @since	1.6
  */
 public function store($updateNulls = false)
 {
     // Transform the params field
     if (is_array($this->params)) {
         $registry = new JRegistry();
         $registry->loadArray($this->params);
         $this->params = (string) $registry;
     }
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if ($this->id) {
         // Existing item
         $this->modified = $date->toSql();
         $this->modified_by = $user->get('id');
     } else {
         // New newsfeed. A feed 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('Contact', 'ContactTable');
     if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) {
         $this->setError(JText::_('COM_CONTACT_ERROR_UNIQUE_ALIAS'));
         return false;
     }
     // Attempt to store the data.
     return parent::store($updateNulls);
 }
Ejemplo n.º 24
0
 public function store($updateNulls = false)
 {
     if (empty($this->email) && $this->userid) {
         $user = JFactory::getUser($this->userid);
         $this->fullname = $user->email();
     }
     if (empty($this->fullname) && $this->userid) {
         $profile = DiscussHelper::getTable('Profile');
         $profile->load($this->userid);
         $this->fullname = $profile->getName();
     }
     if (empty($this->member)) {
         $this->member = $this->userid ? 1 : 0;
     }
     if (empty($this->interval)) {
         $this->interval = 'instant';
     }
     if (empty($this->created)) {
         $this->created = DiscussHelper::getDate()->toMySQL();
     }
     if (empty($this->sent_out)) {
         $this->sent_out = DiscussHelper::getDate()->toMySQL();
     }
     return parent::store($updateNulls);
 }
Ejemplo n.º 25
0
 /**
  * Binds an array into this object's property
  *
  * @access	public
  * @param	$data	mixed	An associative array or object
  * */
 public function store($updateNulls = false)
 {
     if (!$this->check()) {
         return false;
     }
     return parent::store();
 }
Ejemplo n.º 26
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();
     /*
     if ($this->id)
     		{
     			// Existing item
     			$this->hits		= $this->hits+1;
     		}
     */
     // New item. A item created and created_by field can be set by the user,
     // so we don't touch either of these if they are set.
     if (!(int) $this->creation_date) {
         $this->creation_date = $date->toSql();
     }
     // Verify that the file is
     $table = JTable::getInstance('Files', 'Table');
     if ($table->load(array('product_id' => $this->product_id, 'url' => $this->url)) && ($table->id != $this->id || $this->id == 0)) {
         if (!($table->name == $this->name)) {
             $table->name = $this->name;
             $table->store();
         }
         return true;
     }
     return parent::store($updateNulls);
 }
Ejemplo n.º 27
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);
 }
Ejemplo n.º 28
0
 /**
  * method to store a row
  *
  * @param boolean $updateNulls True to update fields even if they are null.
  */
 function store($updateNulls = false)
 {
     if (empty($this->id)) {
         // Store the row
         parent::store($updateNulls);
     } else {
         // Get the old row
         $oldrow = JTable::getInstance('Comment', 'Jnt_HanhphucTable');
         if (!$oldrow->load($this->id) && $oldrow->getError()) {
             $this->setError($oldrow->getError());
         }
         // Verify that the alias is unique
         $table = JTable::getInstance('Comment', 'Jnt_HanhphucTable');
         if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) {
             $this->setError(JText::_('COM_BANNERS_ERROR_UNIQUE_ALIAS'));
             return false;
         }
         // Store the new row
         parent::store($updateNulls);
         // Need to reorder ?
         if ($oldrow->state >= 0 && ($this->state < 0 || $oldrow->catid != $this->catid)) {
             // Reorder the oldrow
             $this->reorder($this->_db->quoteName('catid') . '=' . $this->_db->Quote($oldrow->catid) . ' AND state>=0');
         }
     }
     return count($this->getErrors()) == 0;
 }
Ejemplo n.º 29
0
 /**
  * method to store a row
  *
  * @param boolean $updateNulls True to update fields even if they are null.
  */
 function store($updateNulls = false)
 {
     if (empty($this->id)) {
         // Store the row
         parent::store($updateNulls);
     } else {
         // Get the old row
         $oldrow = JTable::getInstance('Templates', 'WeddingTable');
         if (!$oldrow->load($this->id) && $oldrow->getError()) {
             $this->setError($oldrow->getError());
         }
         // Verify that the code is unique
         $table = JTable::getInstance('Templates', 'WeddingTable');
         if ($table->load(array('code' => $this->code)) && ($table->id != $this->id || $this->id == 0)) {
             $this->setError(JText::_('COM_WEDDING_ERROR_UNIQUE_ALIAS'));
             return false;
         }
         // Store the new row
         parent::store($updateNulls);
         // Need to reorder ?
         if ($oldrow->published >= 0 && ($this->published < 0 || $oldrow->catid != $this->catid)) {
             // Reorder the oldrow
             $this->reorder('published>=0');
         }
     }
     return count($this->getErrors()) == 0;
 }
Ejemplo n.º 30
0
 public function store($updateNulls = false)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     $id = (int) $this->id;
     $country_id = (int) $this->country_id;
     $name = $this->name;
     $query = $db->getQuery(true);
     $where = array();
     $query->select('count(*)');
     $query->from('#__djc2_countries_states');
     if ($id) {
         $where[] = 'id != ' . $id;
     }
     if ($country_id > 0) {
         $where[] = 'country_id=' . $country_id;
     }
     $where[] = 'name=' . $db->quote($name);
     $query->where($where);
     $db->setQuery($query);
     $count = $db->loadResult();
     if ($count > 0) {
         $this->setError(JText::_('COM_DJCATALOG2_ERROR_UNIQUE_NAME'));
         return false;
     }
     return parent::store($updateNulls);
 }