Esempio n. 1
0
/** JJC
* Moves the order of a record
* @param integer The increment to reorder by
*/
function orderContacts($uid, $inc, $option)
{
    global $database;
    $row = new mosContact($database);
    $row->load($uid);
    $row->move($inc, "published >= 0");
    mosRedirect("index2.php?option={$option}");
}
Esempio n. 2
0
 function vcard()
 {
     $contact = new mosContact();
     $contact->load($this->contact_id);
     $params = new mosParameters($contact->params);
     if (!$params->get('vcard')) {
         echo "<script>alert (\"" . T_('There are no vCards available for download.') . "\"); window.history.go(-1);</script>";
         exit(0);
     }
     $name = explode(' ', $contact->name);
     $firstname = $name[0];
     unset($name[0]);
     $last = count($name);
     if (isset($name[$last])) {
         $surname = $name[$last];
         unset($name[$last]);
     } else {
         $surname = '';
     }
     $middlename = trim(implode(' ', $name));
     $v = new MambovCard();
     $v->setPhoneNumber($contact->telephone, 'PREF;WORK;VOICE');
     $v->setPhoneNumber($contact->fax, 'WORK;FAX');
     $v->setName($surname, $firstname, $middlename, '');
     $v->setAddress('', '', $contact->address, $contact->suburb, $contact->state, $contact->postcode, $contact->country, 'WORK;POSTAL');
     $v->setEmail($contact->email_to);
     $v->setNote($contact->misc);
     $v->setURL(mamboCore::get('mosConfig_live_site'), 'WORK');
     $v->setTitle($contact->con_position);
     $v->setOrg(mamboCore::get('mosConfig_sitename'));
     $filename = str_replace(' ', '_', $contact->name);
     $v->setFilename($filename);
     $output = $v->getVCard(mamboCore::get('mosConfig_sitename'));
     $filename = $v->getFileName();
     // header info for page
     header('Content-Disposition: attachment; filename=' . $filename);
     header('Content-Length: ' . strlen($output));
     header('Connection: close');
     header('Content-Type: text/x-vCard; name=' . $filename);
     print $output;
     //mosRedirect('index.php');
 }
Esempio n. 3
0
function vCard($id)
{
    global $database;
    global $mosConfig_sitename, $mosConfig_live_site;
    $contact = new mosContact($database);
    $contact->load((int) $id);
    $params = new mosParameters($contact->params);
    $show = $params->get('vcard', 0);
    if ($show) {
        // check to see if VCard option hsa been activated
        $name = explode(' ', $contact->name);
        $count = count($name);
        // handles conversion of name entry into firstname, surname, middlename distinction
        $surname = '';
        $middlename = '';
        switch ($count) {
            case 1:
                $firstname = $name[0];
                break;
            case 2:
                $firstname = $name[0];
                $surname = $name[1];
                break;
            default:
                $firstname = $name[0];
                $surname = $name[$count - 1];
                for ($i = 1; $i < $count - 1; $i++) {
                    $middlename .= $name[$i] . ' ';
                }
                break;
        }
        $middlename = trim($middlename);
        $v = new MambovCard();
        $v->setPhoneNumber($contact->telephone, 'PREF;WORK;VOICE');
        $v->setPhoneNumber($contact->fax, 'WORK;FAX');
        $v->setName($surname, $firstname, $middlename, '');
        $v->setAddress('', '', $contact->address, $contact->suburb, $contact->state, $contact->postcode, $contact->country, 'WORK;POSTAL');
        $v->setEmail($contact->email_to);
        $v->setNote($contact->misc);
        $v->setURL($mosConfig_live_site, 'WORK');
        $v->setTitle($contact->con_position);
        $v->setOrg($mosConfig_sitename);
        $filename = str_replace(' ', '_', $contact->name);
        $v->setFilename($filename);
        $output = $v->getVCard($mosConfig_sitename);
        $filename = $v->getFileName();
        // header info for page
        header('Content-Disposition: attachment; filename=' . $filename);
        header('Content-Length: ' . strlen($output));
        header('Connection: close');
        header('Content-Type: text/x-vCard; name=' . $filename);
        header('Cache-Control: store, cache');
        header('Pragma: cache');
        print $output;
    } else {
        mosNotAuth();
        return;
    }
}