Use injector for Horde_Share objects
authorMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 19 May 2010 17:20:30 +0000 (13:20 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 19 May 2010 17:20:53 +0000 (13:20 -0400)
26 files changed:
ansel/lib/Storage.php
fima/lib/base.php
folks/lib/Driver.php
folks/lib/Friends/shared.php
folks/perms.php
framework/Core/lib/Horde/Core/Binder/Share.php [new file with mode: 0644]
framework/Core/lib/Horde/Core/Factory/Share.php [new file with mode: 0644]
framework/Core/lib/Horde/Registry.php
framework/Core/package.xml
framework/Group/Group/contactlists.php
framework/Kolab_Storage/test/Horde/Kolab/Storage/Scenario.php
framework/Prefs/lib/Horde/Prefs/KolabImap.php
horde/lib/Api.php
horde/services/shares/edit.php
ingo/lib/Application.php
kronolith/lib/Application.php
kronolith/perms.php
mnemo/lib/Block/summary.php
mnemo/lib/Mnemo.php
nag/lib/Application.php
nag/lib/Block/summary.php
skoli/lib/base.php
turba/lib/Application.php
turba/lib/tests/KolabTestBase.php
turba/scripts/import_squirrelmail_sql_abook.php
whups/lib/Query.php

index 5afd1d7..d4355c1 100644 (file)
@@ -62,9 +62,7 @@ class Ansel_Storage
         }
 
         /* This is the only supported share backend for Ansel */
-        $this->_shares = Horde_Share::singleton($this->_scope,
-                                               'sql_hierarchical');
-
+        $this->_shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($this->_scope, 'Sql_Hierarchical');
         /* Ansel_Gallery is just a subclass of Horde_Share_Object */
         $this->_shares->setShareClass('Ansel_Gallery');
 
index 73ab3c5..f3ab522 100644 (file)
@@ -48,6 +48,6 @@ Horde::compressOutput();
 Horde_Nls::setTimeZone();
 
 // Create a share instance.
-$GLOBALS['fima_shares'] = Horde_Share::singleton($registry->getApp());
+$GLOBALS['fima_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
 
 Fima::initialize();
index dd03658..babe102 100644 (file)
@@ -488,7 +488,7 @@ class Folks_Driver {
 
         // Delete groups
         if ($GLOBALS['conf']['friends']) {
-            $shares = Horde_Share::singleton('folks');
+            $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
             $groups = $shares->listShares(Horde_Auth::getAuth(), Horde_Perms::SHOW, true);
             foreach ($groups as $share) {
                 $result = $shares->removeShare($share);
index 6947472..a853887 100644 (file)
@@ -42,7 +42,7 @@ class Folks_Friends_shared extends  Folks_Friends_sql {
      */
     public function getGroupOwner($group)
     {
-        $GLOBALS['folks_shares'] = Horde_Share::singleton('folks');
+        $GLOBALS['folks_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
 
         $share = $GLOBALS['folks_shares']->getShareById($group);
         if ($share instanceof PEAR_Error) {
@@ -57,7 +57,7 @@ class Folks_Friends_shared extends  Folks_Friends_sql {
      */
     protected function _getGroups()
     {
-        $GLOBALS['folks_shares'] = Horde_Share::singleton('folks');
+        $GLOBALS['folks_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
 
         $groups = $GLOBALS['folks_shares']->listShares($this->_user, Horde_Perms::READ);
         if ($groups instanceof PEAR_Error) {
@@ -83,7 +83,7 @@ class Folks_Friends_shared extends  Folks_Friends_sql {
             return PEAR::raiseError(_("A group names cannot be empty"));
         }
 
-        $GLOBALS['folks_shares'] = Horde_Share::singleton('folks');
+        $GLOBALS['folks_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
 
         $share = $GLOBALS['folks_shares']->getShareById($group);
         if ($share instanceof PEAR_Error) {
@@ -115,7 +115,7 @@ class Folks_Friends_shared extends  Folks_Friends_sql {
      */
     public function removeGroup($group)
     {
-        $GLOBALS['folks_shares'] = Horde_Share::singleton('folks');
+        $GLOBALS['folks_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
 
         $share = $GLOBALS['folks_shares']->getShareById($group);
         if ($share instanceof PEAR_Error) {
@@ -165,7 +165,7 @@ class Folks_Friends_shared extends  Folks_Friends_sql {
             return PEAR::raiseError(sprintf(_("You already have a group named \"%s\"."), $name));
         }
 
-        $GLOBALS['folks_shares'] = Horde_Share::singleton('folks');
+        $GLOBALS['folks_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
 
         $share = $GLOBALS['folks_shares']->newShare(hash('md5', microtime()));
         if ($share instanceof PEAR_Error) {
index ef0046e..0d0e1b1 100644 (file)
@@ -12,7 +12,7 @@
 require_once dirname(__FILE__) . '/lib/base.php';
 require_once 'Horde/Group.php';
 
-$shares = &Horde_Share::singleton('folks');
+$shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
 $groups = &Group::singleton();
 $auth = Horde_Auth::singleton($conf['auth']['driver']);
 
diff --git a/framework/Core/lib/Horde/Core/Binder/Share.php b/framework/Core/lib/Horde/Core/Binder/Share.php
new file mode 100644 (file)
index 0000000..1a99046
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+/**
+ * @category Horde
+ * @package  Core
+ */
+class Horde_Core_Binder_Share implements Horde_Injector_Binder
+{
+    public function create(Horde_Injector $injector)
+    {
+        return new Horde_Core_Factory_Share($injector);
+    }
+
+    public function equals(Horde_Injector_Binder $binder)
+    {
+        return false;
+    }
+
+}
diff --git a/framework/Core/lib/Horde/Core/Factory/Share.php b/framework/Core/lib/Horde/Core/Factory/Share.php
new file mode 100644 (file)
index 0000000..c7497f0
--- /dev/null
@@ -0,0 +1,98 @@
+<?php
+/**
+ * A Horde_Injector:: based Horde_Share:: factory.
+ *
+ * @category Horde
+ * @package  Core
+ * @author   Michael J. Rubinsky <mrubinsk@horde.org>
+ */
+
+/**
+ * A Horde_Injector:: based Horde_Identity:: factory.
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Horde
+ * @package  Core
+ * @author   Michael J. Rubinsky <mrubinsk@horde.org>
+ */
+class Horde_Core_Factory_Share
+{
+    /**
+     * Instances.
+     *
+     * @var array
+     */
+    private $_instances = array();
+
+    /**
+     * The injector.
+     *
+     * @var Horde_Injector
+     */
+    private $_injector;
+
+    /**
+     * Constructor.
+     *
+     * @param Horde_Injector $injector  The injector to use.
+     */
+    public function __construct(Horde_Injector $injector)
+    {
+        $this->_injector = $injector;
+    }
+
+    /**
+     * Return the Horde_Share:: instance.
+     *
+     * @param string $app     The application scope to use, if not the current
+     *                        app.
+     * @param string $driver  The share driver. Either empty (use default
+     *                        driver from $conf) or a driver name.
+     *
+     * @return Horde_Share  The Horde_Share instance.
+     * @throws Horde_Exception
+     */
+    public function getScope($app = null, $driver = null)
+    {
+        if (empty($driver)) {
+            $driver = $GLOBALS['conf']['share']['driver'];
+        }
+        if (empty($app)) {
+            $app = $this->_injector->getInstance('Horde_Registry')->getApp();
+        }
+
+        $class = 'Horde_Share_' . ucfirst(basename($driver));
+        $signature = $app . '_' . $driver;
+        if (!isset($this->_instances[$signature]) &&
+            !empty($GLOBALS['conf']['share']['cache'])) {
+            
+            $session = new Horde_SessionObjects();
+            $shares[$signature] = $session->query('horde_share_' . $app . '_' . $driver . '1');
+        }
+
+        if (empty($shares[$signature])) {
+            if (!class_exists($class)) {
+                throw new Horde_Exception((sprintf(_("\"%s\" share driver not found."), $driver)));
+            }
+            
+            $shares[$signature] = new $class($app);
+        }
+
+        if (!isset($shares[$signature]) &&
+            !empty($GLOBALS['conf']['share']['cache'])) {
+            $session = new Horde_SessionObjects();
+            $shares[$signature] = $session->query('horde_share_' . $app . '_' . $driver . '1');
+        }
+
+        if (!empty($GLOBALS['conf']['share']['cache'])) {
+            register_shutdown_function(array($shares[$signature], 'shutdown'));
+        }
+
+        return $shares[$signature];
+    }
+
+}
index 77aa287..d0ae79e 100644 (file)
@@ -248,6 +248,7 @@ class Horde_Registry
             'Horde_Prefs_Identity' => new Horde_Core_Binder_Identity(),
             // 'Horde_Registry' - initialized below
             'Horde_Secret' => new Horde_Core_Binder_Secret(),
+            'Horde_Share' => new Horde_Core_Binder_Share(),
             'Horde_SessionHandler' => new Horde_Core_Binder_SessionHandler(),
             'Horde_Template' => new Horde_Core_Binder_Template(),
             'Horde_Token' => new Horde_Core_Binder_Token(),
index 17cb7c8..1e25501 100644 (file)
@@ -89,6 +89,7 @@ Application Framework.
        <file name="Token.php" role="php" />
        <file name="Vfs.php" role="php" />
        <file name="Facebook.php" role="php" />
+       <file name="Share.php" role="php" />
       </dir> <!-- /lib/Horde/Core/Binder -->
       <dir name="Factory">
        <file name="DbPear.php" role="php" />
@@ -99,6 +100,7 @@ Application Framework.
        <file name="KolabSession.php" role="php" />
        <file name="KolabStorage.php" role="php" />
        <file name="LoginTasks.php" role="php" />
+       <file name="Share.php" role="php" />
       </dir> <!-- /lib/Horde/Core/Factory -->
       <dir name="Log">
        <file name="Logger.php" role="php" />
@@ -262,6 +264,7 @@ Application Framework.
    <install name="lib/Horde/Core/Binder/Token.php" as="Horde/Core/Binder/Token.php" />
    <install name="lib/Horde/Core/Binder/Vfs.php" as="Horde/Core/Binder/Vfs.php" />
    <install name="lib/Horde/Core/Binder/Facebook.php" as="Horde/Core/Binder/Facebook.php" />
+   <install name="lib/Horde/Core/Binder/Share.php" as="Horde/Core/Binder/Share.php" />
    <install name="lib/Horde/Core/Factory/DbPear.php" as="Horde/Core/Factory/DbPear.php" />
    <install name="lib/Horde/Core/Factory/Data.php" as="Horde/Core/Factory/Data.php" />
    <install name="lib/Horde/Core/Factory/Editor.php" as="Horde/Core/Factory/Editor.php" />
@@ -270,6 +273,7 @@ Application Framework.
    <install name="lib/Horde/Core/Factory/KolabSession.php" as="Horde/Core/Factory/KolabSession.php" />
    <install name="lib/Horde/Core/Factory/KolabStorage.php" as="Horde/Core/Factory/KolabStorage.php" />
    <install name="lib/Horde/Core/Factory/LoginTasks.php" as="Horde/Core/Factory/LoginTasks.php" />
+   <install name="lib/Horde/Core/Factory/Share.php" as="Horde/Core/Factory/Share.php" />
    <install name="lib/Horde/Core/Log/Logger.php" as="Horde/Core/Log/Logger.php" />
    <install name="lib/Horde/Core/LoginTasks/Backend/Horde.php" as="Horde/Core/LoginTasks/Backend/Horde.php" />
    <install name="lib/Horde/Core/Notification/Hordelog.php" as="Horde/Core/Notification/Hordelog.php" />
index 9ddcbcc..52ea400 100644 (file)
@@ -337,7 +337,7 @@ class Group_contactlists extends Group {
             if ($source['use_shares']) {
                 if (empty($contact_shares)) {
                     $scope = $GLOBALS['registry']->hasInterface('contacts');
-                    $shares = Horde_Share::singleton($scope);
+                    $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope);
                     $this->_contact_shares = $shares->listShares(Horde_Auth::getAuth(), Horde_Perms::SHOW, Horde_Auth::getAuth());
                 }
                 // Contruct a list of owner ids to use
index 3a74ac2..84c99f3 100644 (file)
@@ -88,7 +88,7 @@ class Horde_Kolab_Storage_Scenario extends Horde_Kolab_Server_Integration_Scenar
             $folder->setACL($arguments[0], 'alrid');
             break;
         case 'retrieving the list of shares for the application':
-            $shares = Horde_Share::singleton($arguments[0], 'kolab');
+            $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($arguments[0], 'kolab');
 
             $world['list'] = $shares->listShares(Auth::getAuth());
             break;
index 1013d45..4a98d45 100644 (file)
@@ -38,7 +38,7 @@ class Horde_Prefs_KolabImap extends Horde_Prefs
             return;
         }
 
-        $shares = Horde_Share::singleton('h-prefs');
+        $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope('h-prefs');
         $default = $shares->getDefaultShare();
         if ($default instanceof PEAR_Error) {
             Horde::logMessage($default, 'ERR');
index b9f3d96..5b04762 100644 (file)
@@ -500,19 +500,19 @@ class Horde_Api extends Horde_Registry_Api
     /**
      * Adds a share to the shares system.
      *
-     * @param string $shareRoot   The name of the share root, e.g. the
+     * @param string $scope   The name of the share root, e.g. the
      *                            application that the share belongs to.
      * @param string $shareName   The share's name.
      * @param string $shareTitle  The share's human readable title.
      * @param string $userName    The share's owner.
      */
-    public function addShare($shareRoot, $shareName, $shareTitle, $userName)
+    public function addShare($scope, $shareName, $shareTitle, $userName)
     {
         if (!Horde_Auth::isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to add shares."));
         }
 
-        $shares = Horde_Share::singleton($shareRoot);
+        $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope);
 
         if (is_a($share = &$shares->newShare($shareName), 'PEAR_Error')) {
             return $share;
@@ -530,17 +530,17 @@ class Horde_Api extends Horde_Registry_Api
     /**
      * Removes a share from the shares system permanently.
      *
-     * @param string $shareRoot  The name of the share root, e.g. the
+     * @param string $scope      The name of the share root, e.g. the
      *                           application that the share belongs to.
      * @param string $shareName  The share's name.
      */
-    public function removeShare($shareRoot, $shareName)
+    public function removeShare($scope, $shareName)
     {
         if (!Horde_Auth::isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to delete shares."));
         }
 
-        $shares = Horde_Share::singleton($shareRoot);
+        $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope);
 
         if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) {
             return $share;
@@ -556,19 +556,19 @@ class Horde_Api extends Horde_Registry_Api
     /**
      * Returns an array of all shares that $userName is the owner of.
      *
-     * @param string $shareRoot  The name of the share root, e.g. the
+     * @param string $scope      The name of the share root, e.g. the
      *                           application that the share belongs to.
      * @param string $userName   The share's owner.
      *
      * @return array  The list of shares.
      */
-    public function listSharesOfOwner($shareRoot, $userName)
+    public function listSharesOfOwner($scope, $userName)
     {
         if (!Horde_Auth::isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to list shares."));
         }
 
-        $shares = Horde_Share::singleton($shareRoot);
+        $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope);
 
         $share_list = &$shares->listShares($userName, Horde_Perms::SHOW, $userName);
         $myshares = array();
@@ -582,20 +582,20 @@ class Horde_Api extends Horde_Registry_Api
     /**
      * Gives a user certain privileges for a share.
      *
-     * @param string $shareRoot   The name of the share root, e.g. the
+     * @param string $scope       The name of the share root, e.g. the
      *                            application that the share belongs to.
      * @param string $shareName   The share's name.
      * @param string $userName    The user's name.
      * @param array $permissions  A list of permissions (show, read, edit, delete).
      */
-    public function addUserPermissions($shareRoot, $shareName, $userName,
+    public function addUserPermissions($scope, $shareName, $userName,
         $permissions)
     {
         if (!Horde_Auth::isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to change shares."));
         }
 
-        $shares = Horde_Share::singleton($shareRoot);
+        $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope);
 
         if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) {
             return $share;
@@ -619,13 +619,13 @@ class Horde_Api extends Horde_Registry_Api
     /**
      * Gives a group certain privileges for a share.
      *
-     * @param string $shareRoot   The name of the share root, e.g. the
+     * @param string $scope   The name of the share root, e.g. the
      *                            application that the share belongs to.
      * @param string $shareName   The share's name.
      * @param string $groupName   The group's name.
      * @param array $permissions  A list of permissions (show, read, edit, delete).
      */
-    public function addGroupPermissions($shareRoot, $shareName, $groupName,
+    public function addGroupPermissions($scope, $shareName, $groupName,
         $permissions)
     {
         if (!Horde_Auth::isAdmin()) {
@@ -633,7 +633,7 @@ class Horde_Api extends Horde_Registry_Api
         }
 
         require_once 'Horde/Group.php';
-        $shares = Horde_Share::singleton($shareRoot);
+        $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope);
         $groups = Group::singleton();
 
         if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) {
@@ -661,18 +661,18 @@ class Horde_Api extends Horde_Registry_Api
     /**
      * Removes a user from a share.
      *
-     * @param string $shareRoot   The name of the share root, e.g. the
+     * @param string $scope       The name of the share root, e.g. the
      *                            application that the share belongs to.
      * @param string $shareName   The share's name.
      * @param string $userName    The user's name.
      */
-    public function removeUserPermissions($shareRoot, $shareName, $userName)
+    public function removeUserPermissions($scope, $shareName, $userName)
     {
         if (!Horde_Auth::isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to change shares."));
         }
 
-        $shares = Horde_Share::singleton($shareRoot);
+        $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope);
 
         if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) {
             return $share;
@@ -688,19 +688,19 @@ class Horde_Api extends Horde_Registry_Api
     /**
      * Removes a group from a share.
      *
-     * @param string $shareRoot   The name of the share root, e.g. the
+     * @param string $scope   The name of the share root, e.g. the
      *                            application that the share belongs to.
      * @param string $shareName   The share's name.
      * @param string $groupName   The group's name.
      */
-    public function removeGroupPermissions($shareRoot, $shareName, $groupName)
+    public function removeGroupPermissions($scope, $shareName, $groupName)
     {
         if (!Horde_Auth::isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to change shares."));
         }
 
         require_once 'Horde/Group.php';
-        $shares = Horde_Share::singleton($shareRoot);
+        $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope);
         $groups = Group::singleton();
 
         if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) {
@@ -720,14 +720,14 @@ class Horde_Api extends Horde_Registry_Api
     /**
      * Returns an array of all user permissions on a share.
      *
-     * @param string $shareRoot   The name of the share root, e.g. the
+     * @param string $scope  The name of the share root, e.g. the
      *                            application that the share belongs to.
      * @param string $shareName   The share's name.
      * @param string $userName    The user's name.
      *
      * @return array  All user permissions for this share.
      */
-    public function listUserPermissions($shareRoot, $shareName, $userName)
+    public function listUserPermissions($scope, $shareName, $userName)
     {
         if (!Horde_Auth::isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to list share permissions."));
@@ -738,7 +738,7 @@ class Horde_Api extends Horde_Registry_Api
             Horde_Perms::EDIT => 'edit',
             Horde_Perms::DELETE => 'delete');
 
-        $shares = Horde_Share::singleton($shareRoot);
+        $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope);
 
         if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) {
             return $share;
@@ -761,14 +761,14 @@ class Horde_Api extends Horde_Registry_Api
     /**
      * Returns an array of all group permissions on a share.
      *
-     * @param string $shareRoot   The name of the share root, e.g. the
+     * @param string $scope   The name of the share root, e.g. the
      *                            application that the share belongs to.
      * @param string $shareName   The share's name.
      * @param string $groupName   The group's name.
      *
      * @return array  All group permissions for this share.
      */
-    public function listGroupPermissions($shareRoot, $shareName, $groupName)
+    public function listGroupPermissions($scope, $shareName, $groupName)
     {
         if (!Horde_Auth::isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to list share permissions."));
@@ -779,7 +779,7 @@ class Horde_Api extends Horde_Registry_Api
             Horde_Perms::EDIT => 'edit',
             Horde_Perms::DELETE => 'delete');
 
-        $shares = Horde_Share::singleton($shareRoot);
+        $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope);
 
         if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) {
             return $share;
@@ -802,20 +802,20 @@ class Horde_Api extends Horde_Registry_Api
     /**
      * Returns a list of users which have have certain permissions on a share.
      *
-     * @param string $shareRoot   The name of the share root, e.g. the
+     * @param string $scope   The name of the share root, e.g. the
      *                            application that the share belongs to.
      * @param string $shareName   The share's name.
      * @param array $permissions  A list of permissions (show, read, edit, delete).
      *
      * @return array  List of users with the specified permissions.
      */
-    public function listUsersOfShare($shareRoot, $shareName, $permissions)
+    public function listUsersOfShare($scope, $shareName, $permissions)
     {
         if (!Horde_Auth::isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to list users of shares."));
         }
 
-        $shares = Horde_Share::singleton($shareRoot);
+        $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope);
 
         if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) {
             return $share;
@@ -835,20 +835,20 @@ class Horde_Api extends Horde_Registry_Api
     /**
      * Returns a list of groups which have have certain permissions on a share.
      *
-     * @param string $shareRoot   The name of the share root, e.g. the
+     * @param string $scope   The name of the share root, e.g. the
      *                            application that the share belongs to.
      * @param string $shareName   The share's name.
      * @param array $permissions  A list of permissions (show, read, edit, delete).
      *
      * @return array  List of groups with the specified permissions.
      */
-    public function listGroupsOfShare($shareRoot, $shareName, $permissions)
+    public function listGroupsOfShare($scope, $shareName, $permissions)
     {
         if (!Horde_Auth::isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to list groups of shares."));
         }
 
-        $shares = Horde_Share::singleton($shareRoot);
+        $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope);
 
         if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) {
             return $share;
index 903463e..a5b9e04 100644 (file)
@@ -26,7 +26,7 @@ $fieldsList = array(
 );
 
 $app = Horde_Util::getFormData('app');
-$shares = Horde_Share::singleton($app);
+$shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($app);
 $groups = Group::singleton();
 $auth = Horde_Auth::singleton($conf['auth']['driver']);
 if ($registry->hasMethod('shareHelp', $app)) {
index 01d640c..3324893 100644 (file)
@@ -64,7 +64,7 @@ class Ingo_Application extends Horde_Registry_Application
         // Create shares if necessary.
         $driver = Ingo::getDriver();
         if ($driver->supportShares()) {
-            $GLOBALS['ingo_shares'] = Horde_Share::singleton($registry->getApp());
+            $GLOBALS['ingo_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
             $GLOBALS['all_rulesets'] = Ingo::listRulesets();
 
             /* If personal share doesn't exist then create it. */
index 2eec8bc..523efae 100644 (file)
@@ -68,7 +68,7 @@ class Kronolith_Application extends Horde_Registry_Application
         Horde_Nls::setTimeZone();
 
         /* Create a share instance. */
-        $GLOBALS['kronolith_shares'] = Horde_Share::singleton($GLOBALS['registry']->getApp());
+        $GLOBALS['kronolith_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
 
         Kronolith::initialize();
     }
index 62d994b..f571fd8 100644 (file)
@@ -19,7 +19,7 @@ if (!empty($conf['share']['no_sharing'])) {
     throw new Horde_Exception('Permission denied.');
 }
 
-$shares = Horde_Share::singleton('kronolith');
+$shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
 $groups = Group::singleton();
 $auth = Horde_Auth::singleton($conf['auth']['driver']);
 
index 1a09ba6..5d46cb2 100644 (file)
@@ -57,7 +57,7 @@ class Horde_Block_Mnemo_summary extends Horde_Block {
         $fgcolors = $cManager->fgColors();
 
         if (!empty($this->_params['show_notepad'])) {
-            $shares = &Horde_Share::singleton('mnemo');
+            $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
         }
 
         $html = '';
index c2b3c77..760aa83 100644 (file)
@@ -401,7 +401,7 @@ class Mnemo {
      */
     public static function initialize()
     {
-        $GLOBALS['mnemo_shares'] = Horde_Share::singleton($GLOBALS['injector']->getInstance('Horde_Registry')->getApp());
+        $GLOBALS['mnemo_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
 
         // Update the preference for which notepads to display. If the
         // user doesn't have any selected notepads for view then fall
index 0205bfb..657a287 100644 (file)
@@ -51,7 +51,7 @@ class Nag_Application extends Horde_Registry_Application
         Horde_Nls::setTimeZone();
 
         // Create a share instance.
-        $GLOBALS['nag_shares'] = Horde_Share::singleton($GLOBALS['registry']->getApp());
+        $GLOBALS['nag_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
 
         Nag::initialize();
     }
index 42b52af..9dace3a 100644 (file)
@@ -202,7 +202,7 @@ class Horde_Block_nag_summary extends Horde_Block {
 
             if (!empty($this->_params['show_tasklist'])) {
                 $owner = $task->tasklist;
-                $shares = &Horde_Share::singleton($registry->getApp());
+                $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
                 $share = $shares->getShare($owner);
                 if (!is_a($share, 'PEAR_Error')) {
                     $owner = $share->get('name');
index 5426065..a04f8aa 100644 (file)
@@ -32,6 +32,6 @@ $conf = &$GLOBALS['conf'];
 Horde::compressOutput();
 
 // Create a share instance.
-$GLOBALS['skoli_shares'] = Horde_Share::singleton($registry->getApp());
+$GLOBALS['skoli_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
 
 Skoli::initialize();
index da6ddb5..ed34da5 100644 (file)
@@ -69,7 +69,7 @@ class Turba_Application extends Horde_Registry_Application
             if (!empty($cfg['use_shares'])) {
                 // Create a share instance.
                 $_SESSION['turba']['has_share'] = true;
-                $GLOBALS['turba_shares'] = Horde_Share::singleton('turba');
+                $GLOBALS['turba_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
                 $cfgSources = Turba::getConfigFromShares($cfgSources);
                 break;
             }
index 5675602..2261315 100644 (file)
@@ -156,7 +156,7 @@ class Turba_KolabTestBase extends Horde_Kolab_Test_Storage
         $this->prepareNewFolder($world['storage'], 'test2', 'contact');
 
         $_SESSION['turba']['has_share'] =  true;
-        $GLOBALS['turba_shares'] = &Horde_Share::singleton('turba');
+        $GLOBALS['turba_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
 
         $GLOBALS['cfgSources'] = Turba::getConfigFromShares($cfgSources);
     }
index 77e1ac0..ec4afa1 100755 (executable)
@@ -40,7 +40,7 @@ $handle = $db->query('SELECT owner, nickname, firstname, lastname, email, label
 if (is_a($handle, 'PEAR_Error')) {
     $cli->fatal($handle->toString());
 }
-$turba_shares = Horde_Share::singleton('turba');
+$turba_shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
 $user = null;
 $count = 0;
 while ($row = $handle->fetchRow(DB_FETCHMODE_ASSOC)) {
index 07c503a..c1c563c 100644 (file)
@@ -876,7 +876,7 @@ class Whups_QueryManager {
      */
     function Whups_QueryManager()
     {
-        $this->_shareManager = &Horde_Share::singleton('whups');
+        $this->_shareManager = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
     }
 
     /**