[ Index ]
 

Code source de IMP H3 (4.1.5)

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> contacts.php (source)

   1  <?php
   2  /**
   3   * $Horde: imp/contacts.php,v 2.67.10.7 2007/01/02 13:54:54 jan Exp $
   4   *
   5   * Copyright 2002-2007 Marcus I. Ryan <marcus@riboflavin.net>
   6   *
   7   * See the enclosed file COPYING for license information (GPL).  If you did
   8   * not receive this file, see http://www.fsf.org/copyleft/gpl.html.
   9   */
  10  
  11  @define('IMP_BASE', dirname(__FILE__));
  12  $authentication = 'horde';
  13  require_once  IMP_BASE . '/lib/base.php';
  14  
  15  /* Get the lists of address books through the API. */
  16  $source_list = $registry->call('contacts/sources');
  17  
  18  /* If we self-submitted, use that source. Otherwise, choose a good
  19   * source. */
  20  $source = Util::getFormData('source');
  21  if (empty($source) || !isset($source_list[$source])) {
  22      /* We don't just pass the second argument to getFormData() because
  23       * we want to trap for invalid sources, not just no source. */
  24      $source = key($source_list);
  25  }
  26  
  27  /* Get the search as submitted (defaults to '' which should list everyone). */
  28  $search = Util::getFormData('search');
  29  
  30  /* Get the name of the calling form (Defaults to 'compose'). */
  31  $formname = Util::getFormData('formname', 'compose');
  32  
  33  /* Are we limiting to only the 'To:' field? */
  34  $to_only = Util::getFormData('to_only');
  35  
  36  $apiargs = array(
  37      'addresses' => array($search),
  38      'addressbooks' => array($source),
  39      'fields' => array()
  40  );
  41  
  42  if ($search_fields_pref = $prefs->getValue('search_fields')) {
  43      foreach (explode("\n", $search_fields_pref) as $s) {
  44          $s = trim($s);
  45          $s = explode("\t", $s);
  46          if (!empty($s[0]) && ($s[0] == $source)) {
  47              $apiargs['fields'][array_shift($s)] = $s;
  48              break;
  49          }
  50      }
  51  }
  52  
  53  $results = array();
  54  if (Util::getFormData('searched') || $prefs->getValue('display_contact')) {
  55      $results = $registry->call('contacts/search', $apiargs);
  56  }
  57  
  58  /* The results list returns an array for each source searched - at least
  59   * that's how it looks to me. Make it all one array instead. */
  60  $addresses = array();
  61  foreach ($results as $r) {
  62      $addresses = array_merge($addresses, $r);
  63  }
  64  
  65  /* If self-submitted, preserve the currently selected users encoded by
  66   * javascript to pass as value|text. */
  67  $selected_addresses = array();
  68  $sa = explode('|', Util::getFormData('sa'));
  69  for ($i = 0; $i < count($sa) - 1; $i += 2) {
  70      $selected_addresses[$sa[$i]] = $sa[$i + 1];
  71  }
  72  
  73  /* Register the double click events. */
  74  if ($browser->isBrowser('msie')) {
  75      $select_event = ' ondblclick="addAddress(\'to\')"';
  76      $option_event = '';
  77  } else {
  78      $select_event = '';
  79      $option_event = ' ondblclick="addAddress(\'to\')"';
  80  }
  81  
  82  /* Set the default list display (name or email). */
  83  $display = Util::getFormData('display', 'name');
  84  
  85  /* Display the form. */
  86  $title = _("Address Book");
  87  require IMP_TEMPLATES . '/common-header.inc';
  88  require IMP_TEMPLATES . '/contacts/contacts.inc';
  89  require $registry->get('templates', 'horde') . '/common-footer.inc';


Généré le : Thu Nov 29 12:30:07 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics