Example #1
0
File: ICS.php Project: Kervinou/OBM
  function getOBMId($attendee, $entity) {
    global $cdg_sql;

    $db = new DB_OBM;
    $db_type = $obm_q->type;
    if(!is_null($attendee['cn'])) {
      $this->cns[$entity][$attendee['cn']] = NULL;
      $cn = "OR cn = '".addslashes($attendee['cn'])."'";
    }
    if(!is_null($attendee['mail'])) {
      $this->mails[$entity][$attendee['mail']] = NULL;
      $mail = "OR mail #LIKE '%".addslashes($attendee['mail'])."%' ";
    }
    if(!$mail && !$cn) {
      return NULL;
    }
    $entityTable = $this->buildEntityQuery($entity, $db);
    if(is_null($entityTable)) {
      return NULL;
    }
    $query = 'SELECT id, mail, cn
              FROM ('.$entityTable.') as Entity WHERE (1 = 0 '.$cn.' '.$mail.') 
              AND domain_id '.sql_parse_id($GLOBALS['obm']['domain_id'], true).'
              GROUP BY id, mail, cn';
    display_debug_msg($query, $cdg_sql, 'getOBMId');
    $db->xquery($query);
    while($db->next_record()) {
      if((!is_null($attendee['cn']) && strtolower($db->f('cn')) == $attendee['cn']) ||
         preg_match_all('/^('.($attendee['mail']).'|'.$attendee['email'].')\r?$/mi',$db->f('mail'),$results)) { 
        $this->cns[strtolower($db->f('cn'))][$entity] = $db->f('id');
        $emails = get_entity_email($db->f('mail'),null,true,null);
        foreach($emails as $email) {
          $this->mails[strtolower($email)][$entity] = $db->f('id');
        } 
        return  $db->f('id');
      }
    }
    return NULL;
  }
Example #2
0
File: ICS.php Project: Kervinou/OBM
 function Vcalendar_Writer_ICS() {
   $this->buffer = '';
   $this->attendees = array('user' => array(), 'resource' => array(), 'contact' => array(), 'group' => array());
   $this->noreply = get_entity_email('noreply'); 
 }