english/administrator/components/com_aicontactsafe/models/messages.php
// function to check if a user has access to a message
function to check if a user has access to a message
function to check if a user has access to a message
function checkAccessToMessage( $id = 0 ) {
		$id = (int)$id;
		if ($this->_backend) {
			$user_has_access = true;
		} else {
			$user_has_access = false;
			$user = & JFactory::getUser();
			$gid_user_id = $user->get('gid');
			if ($gid_user_id < $this->_config_values['gid_messages'] && $this->_config_values['gid_messages'] != 29) {
				$user_has_access = false;
			} else {
				if ( $this->_config_values['users_all_messages'] ) {
					$user_has_access = true;
				} else {
					$db = &JFactory::getDBO();
					$query = 'SELECT id FROM #__aicontactsafe_messages WHERE user_id = '.$id;
					$db->setQuery($query);
					$own_message = $db->loadResult();
					if ( $own_message ) {
						$user_has_access = true;
					}
				}
			}
		}
		return $user_has_access;
	}
function checkAccessToMessage ( $ id = 0 ) { $ id = ( int ) $ id ; if ( $ this -> _backend ) { $ user_has_access = true ; } else { $ user_has_access = false ; $ user = & JFactory :: getUser ( ) ; $ gid_user_id = $ user -> get ( 'gid' ) ; if ( $ gid_user_id < $ this -> _config_values [ 'gid_messages' ] && $ this -> _config_values [ 'gid_messages' ] != 29 ) { $ user_has_access = false ; } else { if ( $ this -> _config_values [ 'users_all_messages' ] ) { $ user_has_access = true ; } else { $ db = & JFactory :: getDBO ( ) ; $ query = 'SELECT id FROM #__aicontactsafe_messages WHERE user_id = ' . $ id ; $ db -> setQuery ( $ query ) ; $ own_message = $ db -> loadResult ( ) ; if ( $ own_message ) { $ user_has_access = true ; } } } } return $ user_has_access ; }
function to check if a user has access to a message
function to check if a user has access to a message