This should be a class constant
authorMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 31 Jan 2011 14:27:17 +0000 (09:27 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 31 Jan 2011 14:27:17 +0000 (09:27 -0500)
turba/lib/Object.php
turba/lib/Turba.php
turba/view.php

index 5cecdca..a68e344 100644 (file)
@@ -317,7 +317,7 @@ class Turba_Object
     public function addFile(array $info)
     {
         $this->_vfsInit();
-        $dir = TURBA_VFS_PATH . '/' . $this->getValue('__uid');
+        $dir = Turba::VFS_PATH . '/' . $this->getValue('__uid');
         $file = $info['name'];
         while ($this->_vfs->exists($dir, $file)) {
             if (preg_match('/(.*)\[(\d+)\](\.[^.]*)?$/', $file, $match)) {
@@ -348,7 +348,7 @@ class Turba_Object
     {
         $this->_vfsInit();
         try {
-            $this->_vfs->deleteFile(TURBA_VFS_PATH . '/' . $this->getValue('__uid'), $file);
+            $this->_vfs->deleteFile(Turba::VFS_PATH . '/' . $this->getValue('__uid'), $file);
         } catch (VFS_Exception $e) {
             throw new Turba_Exception($e);
         }
@@ -362,9 +362,9 @@ class Turba_Object
     public function deleteFiles()
     {
         $this->_vfsInit();
-        if ($this->_vfs->exists(TURBA_VFS_PATH, $this->getValue('__uid'))) {
+        if ($this->_vfs->exists(Turba::VFS_PATH, $this->getValue('__uid'))) {
             try {
-                $this->_vfs->deleteFolder(TURBA_VFS_PATH, $this->getValue('__uid'), true);
+                $this->_vfs->deleteFolder(Turba::VFS_PATH, $this->getValue('__uid'), true);
             } catch (VFS_Exception $e) {
                 throw new Turba_Exception($e);
             }
@@ -380,8 +380,8 @@ class Turba_Object
     {
         try {
             $this->_vfsInit();
-            if ($this->_vfs->exists(TURBA_VFS_PATH, $this->getValue('__uid'))) {
-                return $this->_vfs->listFolder(TURBA_VFS_PATH . '/' . $this->getValue('__uid'));
+            if ($this->_vfs->exists(Turba::VFS_PATH, $this->getValue('__uid'))) {
+                return $this->_vfs->listFolder(Turba::VFS_PATH . '/' . $this->getValue('__uid'));
             }
         } catch (Turba_Exception $e) {}
 
index e94c84d..1d8a9ea 100644 (file)
@@ -1,7 +1,4 @@
 <?php
-/** The virtual path to use for VFS data. */
-define('TURBA_VFS_PATH', '.horde/turba/documents');
-
 /**
  * Turba Base Class.
  *
@@ -12,6 +9,11 @@ define('TURBA_VFS_PATH', '.horde/turba/documents');
 class Turba
 {
     /**
+     *  The virtual path to use for VFS data.
+     */
+    const VFS_PATH = '.horde/turba/documents';
+
+    /**
      * @todo Consolidate on a single mail/compose method.
      *
      * @param mixed $data  Either a single email address or an array of email
index b5e31b4..a6430eb 100644 (file)
@@ -43,7 +43,7 @@ try {
 }
 
 try {
-    $data = $vfs->read(TURBA_VFS_PATH . '/' . $object->getValue('__uid'), $filename);
+    $data = $vfs->read(Turba::VFS_PATH . '/' . $object->getValue('__uid'), $filename);
 } catch (VFS_Exception $e) {
     Horde::logMessage($e, 'ERR');
     throw new Turba_Exception(sprintf(_("Access denied to %s"), $filename));