english/administrator/components/com_aicontactsafe/models/profiles.php
// function to write the contact information
function to write the contact information
function to write the contact information
function writeContactInformation( $postData = array(), $id = 0 ) {
		if (count($postData) == 0) {
			$postData = $this->readPostDataFromSession();
			$id = $postData['id'];
		}
		$id = (int)$id;
		$name = $this->getProfileName($id);
		$db = &JFactory::getDBO();
		$query = 'UPDATE `#__aicontactsafe_profiles` set display_format = '.$postData['display_format'].', plg_contact_info = '.$postData['plg_contact_info'].' WHERE id = ' . $id;
		$db->setQuery( $query );
		$db->query();
		$query = 'SELECT id FROM #__aicontactsafe_contactinformations WHERE profile_id = ' . $id . ' and info_key = \'contact_info\'';
		$db->setQuery( $query );
		$added = $db->loadResult();
		if ($added > 0) {
			$query = 'UPDATE `#__aicontactsafe_contactinformations` set info_label = \'contact_info (' . $name . ')\', info_value = \'' . $postData['contact_info'] . '\' WHERE profile_id = ' . $id . ' and info_key = \'contact_info\'';
		} else {
			$query = 'INSERT INTO `#__aicontactsafe_contactinformations` (`id`, `profile_id`, `info_key`, `info_label`, `info_value`) VALUES (null, ' . $id . ', \'contact_info\', \'contact_info (' . $name . ')\', \'' . $postData['contact_info'] . '\')';
		}
		$db->setQuery( $query );
		$db->query();
		return true;
	}
function writeContactInformation ( $ postData = array ( ) , $ id = 0 ) { if ( count ( $ postData ) == 0 ) { $ postData = $ this -> readPostDataFromSession ( ) ; $ id = $ postData [ 'id' ] ; } $ id = ( int ) $ id ; $ name = $ this -> getProfileName ( $ id ) ; $ db = & JFactory :: getDBO ( ) ; $ query = 'UPDATE `#__aicontactsafe_profiles` set display_format = ' . $ postData [ 'display_format' ] . ', plg_contact_info = ' . $ postData [ 'plg_contact_info' ] . ' WHERE id = ' . $ id ; $ db -> setQuery ( $ query ) ; $ db -> query ( ) ; $ query = 'SELECT id FROM #__aicontactsafe_contactinformations WHERE profile_id = ' . $ id . ' and info_key = \'contact_info\'' ; $ db -> setQuery ( $ query ) ; $ added = $ db -> loadResult ( ) ; if ( $ added > 0 ) { $ query = 'UPDATE `#__aicontactsafe_contactinformations` set info_label = \'contact_info (' . $ name . ')\', info_value = \'' . $ postData [ 'contact_info' ] . '\' WHERE profile_id = ' . $ id . ' and info_key = \'contact_info\'' ; } else { $ query = 'INSERT INTO `#__aicontactsafe_contactinformations` (`id`, `profile_id`, `info_key`, `info_label`, `info_value`) VALUES (null, ' . $ id . ', \'contact_info\', \'contact_info (' . $ name . ')\', \'' . $ postData [ 'contact_info' ] . '\')' ; } $ db -> setQuery ( $ query ) ; $ db -> query ( ) ; return true ; }
function to write the contact information
function to write the contact information
// check to see if any postdata was sent // get the information in the form // initialize the database // save contact_info in the profiles table // save contact_info