当前位置: 首页>>代码示例>>PHP>>正文


PHP JFilterInput::checkAttribute方法代码示例

本文整理汇总了PHP中JFilterInput::checkAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP JFilterInput::checkAttribute方法的具体用法?PHP JFilterInput::checkAttribute怎么用?PHP JFilterInput::checkAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JFilterInput的用法示例。


在下文中一共展示了JFilterInput::checkAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check

 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;
 }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:12,代码来源:medical.php

示例2: check

 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;
 }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:16,代码来源:realstate.php

示例3: check

 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;
 }
开发者ID:konstantinosDMS,项目名称:jNotification,代码行数:21,代码来源:correspondence.php

示例4: check

 /**
  * 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;
 }
开发者ID:Joomla-Bible-Study,项目名称:joomla_churchdirectory,代码行数:47,代码来源:familyunit.php

示例5: check

 /**
  * 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;
 }
开发者ID:Nechoj23,项目名称:SVI-Homepage,代码行数:58,代码来源:weblink.php

示例6: check

 /**
  * 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;
 }
开发者ID:Fellah,项目名称:govnobaki,代码行数:29,代码来源:contact.php

示例7: check

 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;
 }
开发者ID:julienV,项目名称:testrepo,代码行数:85,代码来源:eventlist_venues.php

示例8: check

 /**
  * 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;
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:65,代码来源:contact.php

示例9: check

 /**
  * 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;
 }
开发者ID:joebushi,项目名称:joomla,代码行数:46,代码来源:contact.php

示例10: check

 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;
 }
开发者ID:jaanusnurmoja,项目名称:redjoomla,代码行数:73,代码来源:redevent_venues.php

示例11: check

 /**
  * 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;
 }
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:75,代码来源:contact.php

示例12: check

	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;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:96,代码来源:jem_venues.php

示例13: check

 /**
  * 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;
 }
开发者ID:RangerWalt,项目名称:ecci,代码行数:39,代码来源:weblink.php

示例14: check

 /**
  * 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;
 }
开发者ID:Ricardolau,项目名称:comp_proveedor,代码行数:62,代码来源:proveedor.php

示例15: check

 /**
  * 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;
 }
开发者ID:N6REJ,项目名称:weblinks,代码行数:60,代码来源:weblink.php


注:本文中的JFilterInput::checkAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。