protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     // add your code here
     // instantiate a parser object
     $parse = new Contact_Vcard_Parse();
     // parse it
     $data = $parse->fromFile(sfConfig::get('sf_upload_dir') . DIRECTORY_SEPARATOR . 'contacts.vcf');
     // output results
     $contact_collection = new Doctrine_Collection('contact');
     $company_collection = new Doctrine_Collection('company');
     foreach ($data as $contact) {
         print_r($contact);
         $vcard = new vcard($contact);
         if ($vcard->isCompany()) {
             // it's a company
             //        $db_contact = new Company();
             //        $db_contact->merge($vcard->getCompanyData());
             //        $company_collection->add($db_contact);
             print_r($vcard->getCompanyData());
         } else {
             // it's a contact
             //        $db_contact = new Contact();
             //        $db_contact->merge($vcard->getContactData());
             //        $contact_collection->add($db_contact);
             print_r($vcard->getContactData());
         }
     }
     //    $company_collection->save();
     //    $contact_collection->save();
 }
 function vcard($id)
 {
     $this->Lead->id = $id;
     $this->Lead->recursive = -1;
     $data = $this->Lead->read(null, $id);
     list($firstname, $lastname) = explode(' ', $data['Lead']['name']);
     $info = array('fileName' => 'vcardx', 'saveTo' => 'upload', 'vcard_birtda' => '', 'vcard_f_name' => $firstname, 'vcard_s_name' => $lastname, 'vcard_uri' => '', 'vcard_nickna' => $data['Lead']['name'], 'vcard_note' => '', 'vcard_cellul' => '', 'vcard_c_mobile' => '', 'vcard_compan' => $data['Lead']['company'], 'vcard_p_pager' => '', 'vcard_h_addr' => '', 'vcard_h_city' => '', 'vcard_h_coun' => '', 'vcard_h_fax' => '', 'vcard_h_mail' => '', 'vcard_h_phon' => '', 'vcard_h_zip' => '', 'vcard_h_uri' => '', 'vcard_w_addr' => '', 'vcard_w_city' => '', 'vcard_w_coun' => '', 'vcard_w_fax' => '', 'vcard_w_mail' => $data['Lead']['email'], 'vcard_w_phon' => $this->phone($data['Lead']['phone']), 'vcard_w_role' => '', 'vcard_w_titl' => '', 'vcard_w_zip' => '', 'vcard_w_uri' => $data['Lead']['url']);
     $vcard = new vcard($info);
     $vcard->createVcard();
     $vcard->DownloadVcard();
     exit;
 }
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('contact_view')) {
    //access granted
} else {
    echo "access denied";
    exit;
}
if (count($_GET) > 0) {
    //add multi-lingual support
    $language = new text();
    $text = $language->get();
    //create the vcard object
    require_once "resources/classes/vcard.php";
    $vcard = new vcard();
    //get the contact id
    $contact_uuid = $_GET["id"];
    //get the contact's information
    $sql = "select * from v_contacts ";
    $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
    $sql .= "and contact_uuid = '" . $contact_uuid . "' ";
    $prep_statement = $db->prepare(check_sql($sql));
    $prep_statement->execute();
    $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
    foreach ($result as &$row) {
        $contact_type = $row["contact_type"];
        $contact_organization = $row["contact_organization"];
        $contact_name_given = $row["contact_name_given"];
        $contact_name_family = $row["contact_name_family"];
        $contact_nickname = $row["contact_nickname"];
Beispiel #4
0
* Description....: An example of using Troy Wolf's class_vcard.
*/
// various copy includes
require_once "../../config.gen.inc.php";
// records stats
require_once "../page_builder/page_header.php";
// libs
require_once 'lib/vcard.lib.php';
require_once '../../lib/ldap_services.php';
$error = false;
$send = false;
if (isset($_REQUEST["email"]) && isset($_REQUEST["username"])) {
    if (preg_match('/([A-z]{3})([0-9]{3})/i', $_REQUEST["username"]) && preg_match('/^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\\-+)|([A-Za-z0-9]+\\.+)|([A-Za-z0-9]+\\++))*[A-Za-z0-9]+@((\\w+\\-+)|(\\w+\\.))*\\w{1,63}\\.[a-zA-Z]{2,6}$/', $_REQUEST['email'])) {
        $person = lookup_username($_REQUEST["username"]);
        $person = html_escape_person($person);
        $vc = new vcard();
        $vc->data['first_name'] = $person["givenname"][0];
        $vc->data['last_name'] = $person["surname"][0];
        # Contact's company, department, title, profession
        $vc->data['company'] = $inst_name_full;
        # from config.gen.inc.php
        $vc->data['department'] = $person["dept"][0];
        $vc->data['title'] = $person["title"][0];
        # Contact's work address
        if ($person['affiliation'][0] == 'facstaff') {
            $vc->data['work_address'] = $person["address"][0];
            if (preg_match('/PO Box/i', $person["address"][1])) {
                $vc->data['work_po_box'] = $person["address"][1];
                $city_state_zip = explode(", ", $person["address"][2]);
                $vc->data['work_city'] = $city_state_zip[0];
                $vc->data['work_state'] = $city_state_zip[1];
$vnconv->set_to('utf8');
$vnconv->set_from($_POST['encoding'] == "none" ? '' : $_POST['encoding']);
if ($task == 'import') {
    $contact_groups[''] = 0;
    $group_mode = isset($_POST['group_mode']) ? $_POST['group_mode'] : 'group_name';
    $group_id = isset($_POST['group_id']) ? $_POST['group_id'] : 'group_id';
    if ($group_mode == 'file') {
        $ab->get_groups($_POST['addressbook_id']);
        while ($ab->next_record()) {
            $contact_groups[$ab->f('name')] = $ab->f('id');
        }
    }
    switch ($_POST['file_type']) {
        case 'vcf':
            require_once $GO_MODULES->path . "classes/vcard.class.inc";
            $vcard = new vcard();
            $success = $vcard->import($_POST['import_file'], $GO_SECURITY->user_id, $_POST['addressbook_id'], $vnconv);
            unlink($_POST['import_file']);
            if ($success) {
                echo $contacts_import_success;
            } else {
                echo $ab_import_failed;
            }
            echo '<br /><br />';
            $button = new button($cmdOk, "javascript:document.location='" . $return_to . "'");
            break;
        case 'csv':
            $seperator = isset($_POST['seperator']) ? $_POST['seperator'] : ';';
            $fp = fopen($_POST['import_file'], "r");
            if (!$fp || !($addressbook = $ab->get_addressbook($_POST['addressbook_id']))) {
                unlink($_POST['import_file']);
Beispiel #6
0
	the Initial Developer. All Rights Reserved.

	Contributor(s):
	Mark J Crane <*****@*****.**>
*/
include "root.php";
require_once "includes/config.php";
require_once "includes/checkauth.php";
if (ifgroup("admin") || ifgroup("superadmin")) {
    //access granted
} else {
    echo "access denied";
    exit;
}
require_once "includes/class_vcard.php";
$vc = new vcard();
if (count($_GET) > 0) {
    $id = $_GET["id"];
    $sql = "";
    $sql .= "select * from v_users ";
    $sql .= "where id = '{$id}' ";
    $prepstatement = $db->prepare(check_sql($sql));
    $prepstatement->execute();
    $result = $prepstatement->fetchAll();
    //print_r($result);
    foreach ($result as &$row) {
        $vc->data[display_name] = $row["userfirstname"] . " " . $row["userlastname"];
        //$vc->data[zzz] = $row["usertype"];
        //$vc->data[zzz] = $row["usercategory"];
        $vc->data[first_name] = $row["userfirstname"];
        $vc->data[last_name] = $row["userlastname"];