mosDBTable( '#__contact_details', 'id', $database ); } function check() { $this->default_con = intval( $this->default_con ); return true; } function &getCategories ($user) { static $contact_cats = ''; if (!is_array($contact_cats)) { $database = mamboDatabase::getInstance(); /* Query to retrieve all categories that belong under the contacts section and that are published. */ $query = "SELECT cc.*,a.catid, COUNT(a.id) AS numlinks, MIN(a.id) as minimum" . "\n FROM #__categories AS cc" . "\n LEFT JOIN #__contact_details AS a ON a.catid = cc.id" . "\n WHERE a.published='1'" . "\n AND cc.section='com_contact_details'" . "\n AND cc.published='1'" . "\n AND a.access <= '". $user->gid ."'" . "\n AND cc.access <= '". $user->gid ."'" . "\n GROUP BY cc.id" . "\n ORDER BY cc.ordering" ; $database->setQuery( $query ); $contact_cats = $database->loadObjectList(); if (!$contact_cats) $contact_cats = array(); } return $contact_cats; } function &getContacts ($catid, $user) { $database = mamboDatabase::getInstance(); $query = "SELECT *" . "\n FROM #__contact_details" . "\n WHERE catid = '". $catid."'" . "\n AND published='1'" . "\n AND access <= '". $user->gid ."'" . "\n ORDER BY ordering" ; $contacts = $database->doSQLget($query, 'mosContact'); return $contacts; } } /** * @package Mambo * class needed to extend vcard class and to correct minor errors */ class MambovCard extends vCard { // needed to fix bug in vcard class function setName( $family='', $first='', $additional='', $prefix='', $suffix='' ) { $this->properties["N"] = "$family;$first;$additional;$prefix;$suffix"; $this->setFormattedName( trim( "$prefix $first $additional $family $suffix" ) ); } // needed to fix bug in vcard class function setAddress( $postoffice='', $extended='', $street='', $city='', $region='', $zip='', $country='', $type='HOME;POSTAL' ) { // $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL" $key = 'ADR'; if ( $type != '' ) { $key .= ';'. $type; } $key.= ';ENCODING=QUOTED-PRINTABLE'; $this->properties[$key] = encode( $extended ) .';'. encode( $street ) .';'. encode( $city ) .';'. encode( $region) .';'. encode( $zip ) .';'. encode( $country ); } // added ability to set filename function setFilename( $filename ) { $this->filename = $filename .'.vcf'; } // added ability to set position/title function setTitle( $title ) { $title = trim( $title ); $this->properties['TITLE'] = $title; } // added ability to set organisation/company function setOrg( $org ) { $org = trim( $org ); $this->properties['ORG'] = $org; } function getVCard( $sitename ) { $text = "BEGIN:VCARD\r\n"; $text .= "VERSION:2.1\r\n"; foreach( $this->properties as $key => $value ) { $text .= "$key:$value\r\n"; } $text .= "REV:" .date("Y-m-d") ."T". date("H:i:s"). "Z\r\n"; $text .= "MAILER: ".sprintf(T_('Mambo vCard for %s'),$sitename) ."\r\n"; $text .= "END:VCARD\r\n"; return $text; } } ?>