should fix one #1105760 issue. (old config file and $data_dir, that
[squirrelmail.git] / functions / addressbook.php
index 05ecc91ad59afbe5b64b3adc7cc884d1b79b8ccc..b4a31a363119de0743ebec9d48f07cd9e5ff7408 100644 (file)
@@ -61,8 +61,13 @@ function addressbook_init($showerr = true, $onlylocal = false) {
         && trim($abook_global_file)!=''){
         // Detect place of address book
         if (! preg_match("/[\/\\\]/",$abook_global_file)) {
-            // no path chars
-            $abook_global_filename=$data_dir . $abook_global_file;
+            /* no path chars, address book stored in data directory
+             * make sure that there is a slash between data directory 
+             * and address book file name
+             */
+            $abook_global_filename=$data_dir
+                . ((substr($data_dir, -1) != '/') ? '/' : '')
+                . $abook_global_file;
         } elseif (preg_match("/^\/|\w:/",$abook_global_file)) {
             // full path is set in options (starts with slash or x:)
             $abook_global_filename=$abook_global_file;
@@ -98,6 +103,7 @@ function addressbook_init($showerr = true, $onlylocal = false) {
      * hook allows to include different address book backends.
      * plugins should extract $abook and $r from arguments
      * and use same add_backend commands as above functions.
+     * @since 1.5.1
      */
     $hookReturn = do_hook('abook_init', $abook, $r);
     $abook = $hookReturn[1];
@@ -896,6 +902,7 @@ if((isset($addrbook_dsn) && !empty($addrbook_dsn)) ||
  * class must follow address book class coding standards.
  *
  * see addressbook_backend class and functions/abook_*.php files.
+ * @since 1.5.1
  */
 do_hook('abook_add_class');