Adding template for error box.
[squirrelmail.git] / functions / addressbook.php
index 362d1e4092b8de2fb219dd238f32b86e659b16b6..863d7d811a9afde643d0dea111b8905229e93d64 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Functions require SM_PATH and support of forms.php functions
  *
- * @copyright © 1999-2005 The SquirrelMail Project Team
+ * @copyright © 1999-2006 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -20,8 +20,9 @@ if (!defined('SM_PATH'))  {
     define('SM_PATH','../');
 }
 
-/* make sure that display_messages.php is loaded */
+/* required includes */
 include_once(SM_PATH . 'functions/display_messages.php');
+include_once(SM_PATH . 'templates/util_global.php');
 
 global $addrbook_dsn, $addrbook_global_dsn;
 
@@ -385,7 +386,7 @@ function get_abook_sort() {
  * @return string html code with sorting images and urls
  */
 function show_abook_sort_button($abook_sort_order, $alt_tag, $Down, $Up ) {
-    global $form_url;
+    global $form_url, $icon_theme_path;
 
      /* Figure out which image we want to use. */
     if ($abook_sort_order != $Up && $abook_sort_order != $Down) {
@@ -399,11 +400,11 @@ function show_abook_sort_button($abook_sort_order, $alt_tag, $Down, $Up ) {
         $which = 8;
     }
 
-      /* Now that we have everything figured out, show the actual button. */
-    return ' <a href="' . $form_url .'?abook_sort_order=' . $which
-         . '"><img src="../images/' . $img
-         . '" border="0" width="12" height="10" alt="' . $alt_tag . '" title="'
-         . _("Click here to change the sorting of the address list") .'" /></a>';
+    /* Now that we have everything figured out, show the actual button. */
+    return ' <a href="' . $form_url .'?abook_sort_order=' . $which .
+           '">' .
+           getIcon($icon_theme_path, $img, $alt_tag, _("Click here to change the sorting of the address list")) .
+           '</a>';
 }
 
 
@@ -447,6 +448,20 @@ class AddressBook {
      * @var string
      */
     var $localbackendname = '';
+    /**
+     * Controls use of 'extra' field
+     * 
+     * Extra field can be used to add link to form, which allows 
+     * to modify all fields supported by backend. This is the only field 
+     * that is not sanitized with htmlspecialchars. Backends MUST make
+     * sure that field data is sanitized and displayed correctly inside
+     * table cell. Use of html formating in other address book fields is
+     * not allowed. Backends that don't return 'extra' row in address book 
+     * data should not modify this object property.
+     * @var boolean
+     * @since 1.5.1
+     */
+    var $add_extra_field = false;
 
     /**
      * Constructor function.
@@ -607,7 +622,7 @@ class AddressBook {
             if (is_array($res)) {
                return $res;
             } else {
-               $this->error = htmlspecialchars($backend->error);
+               $this->error = htmlspecialchars($this->backends[$bnum]->error);
                return false;
             }
         }
@@ -953,4 +968,4 @@ if((isset($addrbook_dsn) && !empty($addrbook_dsn)) ||
  */
 do_hook('abook_add_class');
 
-?>
\ No newline at end of file
+?>