Esempio n. 1
0
 function check()
 {
     if (JFilterInput::checkAttribute(array('href', $this->website))) {
         $this->setError(JText::_('Please provide a valid URL'));
         return false;
     }
     // check for http on website
     if (strlen($this->website) > 0 && !(eregi('http://', $this->website) || eregi('https://', $this->website) || eregi('ftp://', $this->website))) {
         $this->website = 'http://' . $this->website;
     }
     return true;
 }
Esempio n. 2
0
 function check()
 {
     if (JFilterInput::checkAttribute(array('href', $this->website))) {
         $this->setError(JText::_('Please provide a valid URL'));
         return false;
     }
     // check for http on website
     if (strlen($this->website) > 0 && !(eregi('http://', $this->website) || eregi('https://', $this->website) || eregi('ftp://', $this->website))) {
         $this->website = 'http://' . $this->website;
     }
     if (!JMailHelper::isEmailAddress($this->emailid)) {
         $this->setError(JText::_('Please provide a valid EmailID for company.'));
         return false;
     }
     return true;
 }
 public function check()
 {
     if (JFilterInput::checkAttribute(array('href', $this->url))) {
         $this->setError(JText::_('COM_JCORRESPONDENCE_ERR_TABLES_PROVIDE_URL'));
         return false;
     }
     // check for valid name
     if (trim($this->title) == '') {
         $this->setError(JText::_('COM_CORRESPONDENCE_ERR_TABLES_TITLE'));
         return false;
     }
     // check for existing name
     $query = 'SELECT postid FROM #__correspondence_header WHERE title = ' . $this->_db->Quote($this->title) . ' AND catid = ' . (int) $this->catid;
     $this->_db->setQuery($query);
     $xid = intval($this->_db->loadResult());
     if ($xid && $xid != intval($this->postid)) {
         $this->setError(JText::_('COM_JCORRESPONDENCE_ERR_TABLES_NAME'));
         return false;
     }
     return true;
 }
 /**
  * Overloaded check function
  *
  * @return boolean
  *
  * @see   JTable::check
  * @since 1.7.0
  */
 public function check()
 {
     if (JFilterInput::checkAttribute(['href', $this->webpage])) {
         $this->setError(JText::_('COM_CHURCHDIRECTORY_WARNING_PROVIDE_VALID_URL'));
         return false;
     }
     // Check for http, https, ftp on webpage
     if (strlen($this->webpage) > 0 && stripos($this->webpage, 'http://') === false && stripos($this->webpage, 'https://') === false && stripos($this->webpage, 'ftp://') === false) {
         $this->webpage = 'http://' . $this->webpage;
     }
     /** check for valid name */
     if (trim($this->name) == '') {
         $this->setError(JText::_('COM_CHURCHDIRECTORY_WARNING_PROVIDE_VALID_NAME'));
         return false;
     }
     /** check for existing name */
     $query = 'SELECT id FROM #__churchdirectory_familyunit WHERE name = ' . $this->_db->q($this->name);
     $this->_db->setQuery($query);
     $xid = intval($this->_db->loadResult());
     if ($xid && $xid != intval($this->id)) {
         $this->setError(JText::_('COM_CHURCHDIRECTORY_WARNING_SAME_NAME'));
         return false;
     }
     if (empty($this->alias)) {
         $this->alias = $this->name;
     }
     $this->alias = JApplicationHelper::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
     }
     // Check the publish down date is not earlier than publish up.
     if (intval($this->publish_down) > 0 && $this->publish_down < $this->publish_up) {
         // Swap the dates.
         $temp = $this->publish_up;
         $this->publish_up = $this->publish_down;
         $this->publish_down = $temp;
     }
     return true;
 }
Esempio n. 5
0
 /**
  * Overloaded check method to ensure data integrity.
  *
  * @return	boolean	True on success.
  */
 public function check()
 {
     if (JFilterInput::checkAttribute(array('href', $this->url))) {
         $this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_PROVIDE_URL'));
         return false;
     }
     // check for valid name
     if (trim($this->title) == '') {
         $this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_TITLE'));
         return false;
     }
     // check for existing name
     $query = 'SELECT id FROM #__weblinks WHERE title = ' . $this->_db->Quote($this->title) . ' AND catid = ' . (int) $this->catid;
     $this->_db->setQuery($query);
     $xid = intval($this->_db->loadResult());
     if ($xid && $xid != intval($this->id)) {
         $this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_NAME'));
         return false;
     }
     if (empty($this->alias)) {
         $this->alias = $this->title;
     }
     $this->alias = JApplication::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
     }
     // Check the publish down date is not earlier than publish up.
     if ($this->publish_down > $this->_db->getNullDate() && $this->publish_down < $this->publish_up) {
         $this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH'));
         return false;
     }
     // clean up keywords -- eliminate extra spaces between phrases
     // and cr (\r) and lf (\n) characters from string
     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 ", "
     }
     return true;
 }
Esempio n. 6
0
 /**
  * Overloaded check function
  *
  * @access public
  * @return boolean
  * @see JTable::check
  * @since 1.5
  */
 function check()
 {
     $this->default_con = intval($this->default_con);
     if (JFilterInput::checkAttribute(array('href', $this->webpage))) {
         $this->setError(JText::_('Please provide a valid URL'));
         return false;
     }
     // check for http on webpage
     if (strlen($this->webpage) > 0 && !(eregi('http://', $this->webpage) || eregi('https://', $this->webpage) || eregi('ftp://', $this->webpage))) {
         $this->webpage = 'http://' . $this->webpage;
     }
     if (empty($this->alias)) {
         $this->alias = $this->name;
     }
     $this->alias = JFilterOutput::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $datenow = new JDate();
         $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
     }
     return true;
 }
Esempio n. 7
0
 function check($elsettings)
 {
     // not typed in a venue name
     if (!trim($this->venue)) {
         $this->_error = JText::_('ADD VENUE');
         JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
         return false;
     }
     $alias = JFilterOutput::stringURLSafe($this->venue);
     if (empty($this->alias) || $this->alias === $alias) {
         $this->alias = $alias;
     }
     if ($this->map) {
         if (!trim($this->street) || !trim($this->city) || !trim($this->country) || !trim($this->plz)) {
             if (!trim($this->latitude) && !trim($this->longitude)) {
                 $this->_error = JText::_('ERROR ADDRESS');
                 JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
                 return false;
             }
         }
     }
     if (JFilterInput::checkAttribute(array('href', $this->url))) {
         $this->_error = JText::_('ERROR URL WRONG FORMAT');
         JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
         return false;
     }
     if (trim($this->url)) {
         $this->url = strip_tags($this->url);
         $urllength = strlen($this->url);
         if ($urllength > 199) {
             $this->_error = JText::_('ERROR URL LONG');
             JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
             return false;
         }
         if (!preg_match('/^(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}' . '((:[0-9]{1,5})?\\/.*)?$/i', $this->url)) {
             $this->_error = JText::_('ERROR URL WRONG FORMAT');
             JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
             return false;
         }
     }
     $this->street = strip_tags($this->street);
     $streetlength = JString::strlen($this->street);
     if ($streetlength > 50) {
         $this->_error = JText::_('ERROR STREET LONG');
         JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
         return false;
     }
     $this->plz = strip_tags($this->plz);
     $plzlength = JString::strlen($this->plz);
     if ($plzlength > 10) {
         $this->_error = JText::_('ERROR ZIP LONG');
         JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
         return false;
     }
     $this->city = strip_tags($this->city);
     $citylength = JString::strlen($this->city);
     if ($citylength > 50) {
         $this->_error = JText::_('ERROR CITY LONG');
         JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
         return false;
     }
     $this->state = strip_tags($this->state);
     $statelength = JString::strlen($this->state);
     if ($statelength > 50) {
         $this->_error = JText::_('ERROR STATE LONG');
         JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
         return false;
     }
     $this->country = strip_tags($this->country);
     $countrylength = JString::strlen($this->country);
     if ($countrylength > 2) {
         $this->_error = JText::_('ERROR COUNTRY LONG');
         JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
         return false;
     }
     /** check for existing name */
     $query = 'SELECT id FROM #__eventlist_venues WHERE venue = ' . $this->_db->Quote($this->venue);
     $this->_db->setQuery($query);
     $xid = intval($this->_db->loadResult());
     if ($xid && $xid != intval($this->id)) {
         JError::raiseWarning('SOME_ERROR_CODE', JText::sprintf('VENUE NAME ALREADY EXIST', $this->venue));
         return false;
     }
     return true;
 }
 /**
  * Overloaded check function
  *
  * @return  boolean  True on success, false on failure
  *
  * @see JTable::check
  * @since 1.5
  */
 public function check()
 {
     $this->default_con = (int) $this->default_con;
     if (JFilterInput::checkAttribute(array('href', $this->webpage))) {
         $this->setError(JText::_('COM_CONTACT_WARNING_PROVIDE_VALID_URL'));
         return false;
     }
     /** check for valid name */
     if (trim($this->name) == '') {
         $this->setError(JText::_('COM_CONTACT_WARNING_PROVIDE_VALID_NAME'));
         return false;
     }
     if (empty($this->alias)) {
         $this->alias = $this->name;
     }
     $this->alias = JApplication::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
     }
     /** check for valid category */
     if (trim($this->catid) == '') {
         $this->setError(JText::_('COM_CONTACT_WARNING_CATEGORY'));
         return false;
     }
     // Check the publish down date is not earlier than publish up.
     if ((int) $this->publish_down > 0 && $this->publish_down < $this->publish_up) {
         $this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH'));
         return false;
     }
     // Clean up keywords -- eliminate extra spaces between phrases
     // and cr (\r) and lf (\n) characters from string
     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 ", "
     }
     // Clean up description -- eliminate quotes and <> brackets
     if (!empty($this->metadesc)) {
         // Only process if not empty
         $bad_characters = array("\"", "<", ">");
         $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc);
     }
     return true;
 }
Esempio n. 9
0
 /**
  * Overloaded check function
  *
  * @return boolean
  * @see JTable::check
  * @since 1.5
  */
 function check()
 {
     $this->default_con = intval($this->default_con);
     if (JFilterInput::checkAttribute(array('href', $this->webpage))) {
         $this->setError(JText::_('CONTACT_WARNING_PROVIDE_VALID_URL'));
         return false;
     }
     // check for http, https, ftp on webpage
     if (strlen($this->webpage) > 0 && stripos($this->webpage, 'http://') === false && stripos($this->webpage, 'https://') === false && stripos($this->webpage, 'ftp://') === false) {
         $this->webpage = 'http://' . $this->webpage;
     }
     // check for http on additional links
     /** check for valid name */
     if (trim($this->name) == '') {
         $this->setError(JText::_('CONTACT_WARNING_NAME'));
         return false;
     }
     /** check for existing name */
     $query = 'SELECT id FROM #__contact_details WHERE name = ' . $this->_db->Quote($this->name) . ' AND catid = ' . (int) $this->catid;
     $this->_db->setQuery($query);
     $xid = intval($this->_db->loadResult());
     if ($xid && $xid != intval($this->id)) {
         $this->setError(JText::sprintf('Contact_Warning_Same_Name', JText::_('Contact')));
         return false;
     }
     if (empty($this->alias)) {
         $this->alias = $this->name;
     }
     $this->alias = JApplication::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->toFormat("%Y-%m-%d-%H-%M-%S");
     }
     /** check for valid category */
     if (trim($this->catid) == '') {
         $this->setError(JText::_('CONTACT_WARNING_CATEGORY'));
         return false;
     }
     return true;
 }
Esempio n. 10
0
 function check($elsettings)
 {
     // not typed in a venue name
     if (!trim($this->venue)) {
         $this->setError(JText::_('COM_REDEVENT_ADD_VENUE'));
         return false;
     }
     $alias = JFilterOutput::stringURLSafe($this->venue);
     if (empty($this->alias) || $this->alias === $alias) {
         $this->alias = $alias;
     }
     if ($this->map && !($this->latitude || $this->longitude)) {
         if (!trim($this->street) || !trim($this->plz) || !trim($this->city) || !trim($this->country)) {
             $this->setError(JText::_('COM_REDEVENT_ADD_ADDRESS'));
             return false;
         }
     }
     if (JFilterInput::checkAttribute(array('href', $this->url))) {
         $this->setError(JText::_('COM_REDEVENT_ERROR_URL_WRONG_FORMAT'));
         return false;
     }
     if (trim($this->url)) {
         $this->url = strip_tags($this->url);
         $urllength = strlen($this->url);
         if ($urllength > 199) {
             $this->setError(JText::_('COM_REDEVENT_ERROR_URL_LONG'));
             return false;
         }
         if (!preg_match('/^(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}' . '((:[0-9]{1,5})?\\/.*)?$/i', $this->url)) {
             $this->setError(JText::_('COM_REDEVENT_ERROR_URL_WRONG_FORMAT'));
             return false;
         }
     }
     $this->street = strip_tags($this->street);
     $streetlength = JString::strlen($this->street);
     if ($streetlength > 50) {
         $this->setError(JText::_('COM_REDEVENT_ERROR_STREET_LONG'));
         return false;
     }
     $this->plz = strip_tags($this->plz);
     $plzlength = JString::strlen($this->plz);
     if ($plzlength > 10) {
         $this->setError(JText::_('COM_REDEVENT_ERROR_ZIP_LONG'));
         return false;
     }
     $this->city = strip_tags($this->city);
     $citylength = JString::strlen($this->city);
     if ($citylength > 50) {
         $this->setError(JText::_('COM_REDEVENT_ERROR_CITY_LONG'));
         return false;
     }
     $this->state = strip_tags($this->state);
     $statelength = JString::strlen($this->state);
     if ($statelength > 50) {
         $this->setError(JText::_('COM_REDEVENT_ERROR_STATE_LONG'));
         return false;
     }
     $this->country = strip_tags($this->country);
     $countrylength = JString::strlen($this->country);
     if ($countrylength > 2) {
         $this->setError(JText::_('COM_REDEVENT_ERROR_COUNTRY_LONG'));
         return false;
     }
     /** check for existing venue */
     $query = ' SELECT id FROM #__redevent_venues' . ' WHERE venue = ' . $this->_db->Quote($this->venue) . '   AND street = ' . $this->_db->Quote($this->street) . '   AND city = ' . $this->_db->Quote($this->city);
     $this->_db->setQuery($query);
     $xid = intval($this->_db->loadResult());
     if ($xid && $xid != intval($this->id)) {
         $this->setError(JText::sprintf('COM_REDEVENT_VENUE_S_ALREADY_EXIST', $this->venue));
         return false;
     }
     return true;
 }
Esempio n. 11
0
 /**
  * Overloaded check function
  *
  * @return boolean
  * @see JTable::check
  * @since 1.5
  */
 function check()
 {
     $this->default_con = intval($this->default_con);
     if (JFilterInput::checkAttribute(array('href', $this->webpage))) {
         $this->setError(JText::_('COM_CONTACT_WARNING_PROVIDE_VALID_URL'));
         return false;
     }
     /** check for valid name */
     if (trim($this->name) == '') {
         $this->setError(JText::_('COM_CONTACT_WARNING_PROVIDE_VALID_NAME'));
         return false;
     }
     /** check for existing name */
     $query = 'SELECT id FROM #__contact_details WHERE name = ' . $this->_db->Quote($this->name) . ' AND catid = ' . (int) $this->catid;
     $this->_db->setQuery($query);
     $xid = intval($this->_db->loadResult());
     if ($xid && $xid != intval($this->id)) {
         $this->setError(JText::_('COM_CONTACT_WARNING_SAME_NAME'));
         return false;
     }
     if (empty($this->alias)) {
         $this->alias = $this->name;
     }
     $this->alias = JApplication::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
     }
     /** check for valid category */
     if (trim($this->catid) == '') {
         $this->setError(JText::_('COM_CONTACT_WARNING_CATEGORY'));
         return false;
     }
     // Check the publish down date is not earlier than publish up.
     if (intval($this->publish_down) > 0 && $this->publish_down < $this->publish_up) {
         // Swap the dates.
         $temp = $this->publish_up;
         $this->publish_up = $this->publish_down;
         $this->publish_down = $temp;
     }
     return true;
     // clean up keywords -- eliminate extra spaces between phrases
     // and cr (\r) and lf (\n) characters from string
     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 ", "
     }
     // clean up description -- eliminate quotes and <> brackets
     if (!empty($this->metadesc)) {
         // only process if not empty
         $bad_characters = array("\"", "<", ">");
         $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc);
     }
     return true;
 }
Esempio n. 12
0
	function check()
	{
		// not typed in a venue name
		if(!trim($this->venue)) {
			$this->_error = JText::_('COM_JEM_ADD_VENUE');
			JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
			return false;
		}

		$alias = JFilterOutput::stringURLSafe($this->venue);

		if(empty($this->alias) || $this->alias === $alias) {
			$this->alias = $alias;
		}

		if ($this->map) {
			if (!trim($this->street) || !trim($this->city) || !trim($this->country) || !trim($this->postalCode)) {
				if ((!trim($this->latitude) && !trim($this->longitude))) {
					$this->_error = JText::_('COM_JEM_ERROR_ADDRESS');
					JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
					return false;
				}
			}
		}

		if (JFilterInput::checkAttribute(array ('href', $this->url))) {
			$this->_error = JText::_('COM_JEM_ERROR_URL_WRONG_FORMAT');
			JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
			return false;
		}

		if (trim($this->url)) {
			$this->url = strip_tags($this->url);

			if (strlen($this->url) > 199) {
				$this->_error = JText::_('COM_JEM_ERROR_URL_LONG');
				JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
				return false;
			}
			if (!preg_match('/^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}'
			.'((:[0-9]{1,5})?\/.*)?$/i' , $this->url)) {
				$this->_error = JText::_('COM_JEM_ERROR_URL_WRONG_FORMAT');
				JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
				return false;
			}
		}

		$this->street = strip_tags($this->street);
		if (JString::strlen($this->street) > 50) {
			$this->_error = JText::_('COM_JEM_ERROR_STREET_LONG');
			JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
			return false;
		}

		$this->postalCode = strip_tags($this->postalCode);
		if (JString::strlen($this->postalCode) > 10) {
			$this->_error = JText::_('COM_JEM_ERROR_ZIP_LONG');
			JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
			return false;
		}

		$this->city = strip_tags($this->city);
		if (JString::strlen($this->city) > 50) {
			$this->_error = JText::_('COM_JEM_ERROR_CITY_LONG');
			JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
			return false;
		}

		$this->state = strip_tags($this->state);
		if (JString::strlen($this->state) > 50) {
			$this->_error = JText::_('COM_JEM_ERROR_STATE_LONG');
			JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
			return false;
		}

		$this->country = strip_tags($this->country);
		if (JString::strlen($this->country) > 2) {
			$this->_error = JText::_('COM_JEM_ERROR_COUNTRY_LONG');
			JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
			return false;
		}

		/** check for existing name */
		/*
		$query = 'SELECT id FROM #__jem_venues WHERE venue = '.$this->_db->Quote($this->venue);
		$this->_db->setQuery($query);

		$xid = intval($this->_db->loadResult());
		if ($xid && $xid != intval($this->id)) {
			JError::raiseWarning('SOME_ERROR_CODE', JText::sprintf('COM_JEM_VENUE_NAME_ALREADY_EXIST', $this->venue));
			return false;
		}
		*/

		return true;
	}
Esempio n. 13
0
 /**
  * Overloaded check method to ensure data integrity
  *
  * @access public
  * @return boolean True on success
  * @since 1.0
  */
 function check()
 {
     if (JFilterInput::checkAttribute(array('href', $this->url))) {
         $this->setError(JText::_('Please provide a valid URL'));
         return false;
     }
     /** check for valid name */
     if (trim($this->title) == '') {
         $this->setError(JText::_('Your Weblink must contain a title.'));
         return false;
     }
     if (!(eregi('http://', $this->url) || eregi('https://', $this->url) || eregi('ftp://', $this->url))) {
         $this->url = 'http://' . $this->url;
     }
     /** check for existing name */
     $query = 'SELECT id FROM #__weblinks WHERE title = ' . $this->_db->Quote($this->title) . ' AND catid = ' . (int) $this->catid;
     $this->_db->setQuery($query);
     $xid = intval($this->_db->loadResult());
     if ($xid && $xid != intval($this->id)) {
         $this->setError(JText::sprintf('WARNNAMETRYAGAIN', JText::_('Web Link')));
         return false;
     }
     if (empty($this->alias)) {
         $this->alias = $this->title;
     }
     $this->alias = JFilterOutput::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $datenow =& JFactory::getDate();
         $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
     }
     return true;
 }
Esempio n. 14
0
 /**
  * Overloaded check function
  *
  * @return  boolean  True on success, false on failure
  *
  * @see JTable::check
  * @since 1.5
  */
 public function check()
 {
     $this->default_con = (int) $this->default_con;
     if (JFilterInput::checkAttribute(array('href', $this->webpage))) {
         $this->setError(JText::_('COM_PROVEEDOR_WARNING_PROVIDE_VALID_URL'));
         return false;
     }
     /** check for valid name */
     if (trim($this->name) == '') {
         $this->setError(JText::_('COM_PROVEEDOR_WARNING_PROVIDE_VALID_NAME'));
         return false;
     }
     // Generate a valid alias
     $this->generateAlias();
     /** check for valid category */
     if (trim($this->catid) == '') {
         $this->setError(JText::_('COM_PROVEEDOR_WARNING_CATEGORY'));
         return false;
     }
     // Check the publish down date is not earlier than publish up.
     if ((int) $this->publish_down > 0 && $this->publish_down < $this->publish_up) {
         $this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH'));
         return false;
     }
     /*
      * Clean up keywords -- eliminate extra spaces between phrases
      * and cr (\r) and lf (\n) characters from string.
      * Only process if not empty.
      */
     if (!empty($this->metakey)) {
         // Array of characters to remove.
         $bad_characters = array("\n", "\r", "\"", "<", ">");
         // Remove bad characters.
         $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey);
         // Create array using commas as delimiter.
         $keys = explode(',', $after_clean);
         $clean_keys = array();
         foreach ($keys as $key) {
             // Ignore blank keywords.
             if (trim($key)) {
                 $clean_keys[] = trim($key);
             }
         }
         // Put array back together delimited by ", "
         $this->metakey = implode(", ", $clean_keys);
     }
     // Clean up description -- eliminate quotes and <> brackets
     if (!empty($this->metadesc)) {
         // Only process if not empty
         $bad_characters = array("\"", "<", ">");
         $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc);
     }
     return true;
 }
Esempio n. 15
0
 /**
  * Overloaded check method to ensure data integrity.
  *
  * @return  boolean  True on success.
  *
  * @since   1.5
  */
 public function check()
 {
     if (JFilterInput::checkAttribute(array('href', $this->url))) {
         $this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_PROVIDE_URL'));
         return false;
     }
     // check for valid name
     if (trim($this->title) == '') {
         $this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_TITLE'));
         return false;
     }
     // Check for existing name
     $db = $this->getDbo();
     $query = $db->getQuery(true)->select($db->quoteName('id'))->from($db->quoteName('#__weblinks'))->where($db->quoteName('title') . ' = ' . $db->quote($this->title))->where($db->quoteName('catid') . ' = ' . (int) $this->catid);
     $db->setQuery($query);
     $xid = (int) $db->loadResult();
     if ($xid && $xid != (int) $this->id) {
         $this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_NAME'));
         return false;
     }
     if (empty($this->alias)) {
         $this->alias = $this->title;
     }
     $this->alias = JApplicationHelper::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
     }
     // Check the publish down date is not earlier than publish up.
     if ($this->publish_down > $db->getNullDate() && $this->publish_down < $this->publish_up) {
         $this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH'));
         return false;
     }
     /*
      * Clean up keywords -- eliminate extra spaces between phrases
      * and cr (\r) and lf (\n) characters from string
      */
     if (!empty($this->metakey)) {
         // Array of characters to remove
         $bad_characters = array("\n", "\r", "\"", "<", ">");
         $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey);
         $keys = explode(',', $after_clean);
         $clean_keys = array();
         foreach ($keys as $key) {
             // Ignore blank keywords
             if (trim($key)) {
                 $clean_keys[] = trim($key);
             }
         }
         // Put array back together delimited by ", "
         $this->metakey = implode(", ", $clean_keys);
     }
     return true;
 }
Esempio n. 16
0
 /**
  * Internal method to strip a tag of certain attributes
  *
  * @access	protected
  * @param	array	$attrSet	Array of attribute pairs to filter
  * @return	array	Filtered array of attribute pairs
  * @since	1.5
  */
 function _cleanAttributes($attrSet)
 {
     // Initialize variables
     $newSet = array();
     // Iterate through attribute pairs
     for ($i = 0; $i < count($attrSet); $i++) {
         // Skip blank spaces
         if (!$attrSet[$i]) {
             continue;
         }
         // Split into name/value pairs
         $attrSubSet = explode('=', trim($attrSet[$i]), 2);
         list($attrSubSet[0]) = explode(' ', $attrSubSet[0]);
         /*
          * Remove all "non-regular" attribute names
          * AND blacklisted attributes
          */
         if (!preg_match('/[a-z]*$/i', $attrSubSet[0]) || $this->xssAuto && (in_array(strtolower($attrSubSet[0]), $this->attrBlacklist) || substr($attrSubSet[0], 0, 2) == 'on')) {
             continue;
         }
         // XSS attribute value filtering
         if ($attrSubSet[1]) {
             // strips unicode, hex, etc
             $attrSubSet[1] = str_replace('&#', '', $attrSubSet[1]);
             // strip normal newline within attr value
             $attrSubSet[1] = preg_replace('/\\s+/', '', $attrSubSet[1]);
             // strip double quotes
             $attrSubSet[1] = str_replace('"', '', $attrSubSet[1]);
             // convert single quotes from either side to doubles (Single quotes shouldn't be used to pad attr value)
             if (substr($attrSubSet[1], 0, 1) == "'" && substr($attrSubSet[1], strlen($attrSubSet[1]) - 1, 1) == "'") {
                 $attrSubSet[1] = substr($attrSubSet[1], 1, strlen($attrSubSet[1]) - 2);
             }
             // strip slashes
             $attrSubSet[1] = stripslashes($attrSubSet[1]);
         }
         // Autostrip script tags
         if (JFilterInput::checkAttribute($attrSubSet)) {
             continue;
         }
         // Is our attribute in the user input array?
         $attrFound = in_array(strtolower($attrSubSet[0]), $this->attrArray);
         // If the tag is allowed lets keep it
         if (!$attrFound && $this->attrMethod || $attrFound && !$this->attrMethod) {
             // Does the attribute have a value?
             if ($attrSubSet[1]) {
                 $newSet[] = $attrSubSet[0] . '="' . $attrSubSet[1] . '"';
             } elseif ($attrSubSet[1] == "0") {
                 /*
                  * Special Case
                  * Is the value 0?
                  */
                 $newSet[] = $attrSubSet[0] . '="0"';
             } else {
                 $newSet[] = $attrSubSet[0] . '="' . $attrSubSet[0] . '"';
             }
         }
     }
     return $newSet;
 }
 /**
  * Overloaded check function
  *
  * @return boolean
  *
  * @see   JTable::check
  * @since 1.7.0
  */
 public function check()
 {
     $this->default_con = intval($this->default_con);
     if (JFilterInput::checkAttribute(['href', $this->webpage])) {
         $this->setError(JText::_('COM_CHURCHDIRECTORY_WARNING_PROVIDE_VALID_URL'));
         return false;
     }
     /** check for valid name */
     if (trim($this->name) == '') {
         $this->setError(JText::_('COM_CHURCHDIRECTORY_WARNING_PROVIDE_VALID_NAME'));
         return false;
     }
     /** check for existing name */
     /* TF removed - if same first name exists it errors - this should not be.
     				 * $query = 'SELECT id FROM #__churchdirectory_details WHERE name = ' . $this->_db->Quote($this->name) . ' AND catid = ' . (int) $this->catid;
     				$this->_db->setQuery($query);
     
     				$xid = intval($this->_db->loadResult());
     
     				if ($xid && $xid != intval($this->id))
     				{
     					$this->setError(JText::_('COM_CHURCHDIRECTORY_WARNING_SAME_NAME'));
     
     					return false;
     				}
     		*/
     if (empty($this->alias)) {
         $this->alias = $this->name;
     }
     $this->alias = JApplicationHelper::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
     }
     /** check for valid category */
     if (trim($this->catid) == '') {
         $this->setError(JText::_('COM_CHURCHDIRECTORY_WARNING_CATEGORY'));
         return false;
     }
     // Check the publish down date is not earlier than publish up.
     if (intval($this->publish_down) > 0 && $this->publish_down < $this->publish_up) {
         $this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH'));
         return false;
     }
     // Clean up keywords -- eliminate extra spaces between phrases
     // and cr (\r) and lf (\n) characters from string
     if (!empty($this->metakey)) {
         // Only process if not empty
         $bad_characters = ["\n", "\r", "\"", "<", ">"];
         $after_clean = \Joomla\String\StringHelper::str_ireplace($bad_characters, "", $this->metakey);
         $keys = explode(',', $after_clean);
         $clean_keys = [];
         foreach ($keys as $key) {
             if (trim($key)) {
                 // Ignore blank keywords
                 $clean_keys[] = trim($key);
             }
         }
         $this->metakey = implode(", ", $clean_keys);
     }
     // Clean up description -- eliminate quotes and <> brackets
     if (!empty($this->metadesc)) {
         // Only process if not empty
         $bad_characters = ["\"", "<", ">"];
         $this->metadesc = \Joomla\String\StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
     }
     return true;
 }