Copyright 1999-2016 Horde LLC (http://www.horde.org/)
See the enclosed file COPYING for license information (GPL). If you
did not receive this file, see http://www.horde.org/licenses/gpl.
/** */ public function display(Horde_Core_Prefs_Ui $ui) { $sources = array(); foreach (Gollem_Auth::getBackend() as $source => $info) { $selected = $unselected = array(); $selected_list = array_flip(Gollem::getColumns($source)); foreach ($info['attributes'] as $column) { if (isset($selected_list[$column])) { $selected[$column] = $column; } else { $unselected[$column] = $column; } } $sources[$source] = array('label' => $info['name'], 'selected' => $selected, 'unselected' => $unselected); } return Horde_Core_Prefs_Ui_Widgets::source(array('mainlabel' => _("Choose which columns to display, and in what order:"), 'selectlabel' => _("These columns will display in this order:"), 'sourcelabel' => _("Select a backend:"), 'sources' => $sources, 'unselectlabel' => _("Columns that will not be displayed:"))); }
/** * @throws Gollem_Exception */ protected function _getBackend($path) { // A file or directory has been requested. // Locate the backend_key in the path. $backend_key = strchr($path, '/') ? substr($path, 0, strpos($path, '/')) : $path; throw new Gollem_Exception('Not implemented'); // Validate and perform permissions checks on the requested backend if (!$GLOBALS['session']->exists('gollem', 'backends/' . $backend_key)) { throw new Gollem_Exception(sprintf(_("Invalid backend requested: %s"), $backend_key)); } if (!Gollem_Session::createSession($backend_key)) { throw new Gollem_Exception(_("Unable to create Gollem session")); } if (!Gollem::checkPermissions('backend', Horde_Perms::READ)) { throw new Gollem_Exception(_("Permission denied to this backend.")); } return $backend_key; }
/** */ public function menu($menu) { $backend_key = Gollem_Auth::getPreferredBackend(); $menu->add(Horde::url('manager.php')->add('dir', Gollem::$backend['home']), _("Start Folder"), 'gollem-home', null, null, null, '__noselection'); if (Gollem::checkPermissions('backend', Horde_Perms::EDIT) && Gollem::checkPermissions('directory', Horde_Perms::EDIT, Gollem::$backend['dir']) && $GLOBALS['session']->get('gollem', 'clipboard', Horde_Session::TYPE_ARRAY)) { $menu->add(Horde::url('clipboard.php')->add('dir', Gollem::$backend['dir']), _("Clipboard"), 'gollem-clipboard'); } if (!empty(Gollem::$backend['quota'])) { if ($GLOBALS['browser']->hasFeature('javascript')) { $quota_url = 'javascript:' . Horde::popupJs(Horde::url('quota.php'), array('params' => array('backend' => $backend_key), 'height' => 300, 'width' => 300, 'urlencode' => true)); } else { $quota_url = Horde::url('quota.php')->add('backend', $backend_key); } $menu->add($quota_url, _("Check Quota"), 'gollem-quota'); } if ($GLOBALS['registry']->isAdmin() && !$GLOBALS['injector']->getInstance('Horde_Perms') instanceof Horde_Perms_Null) { $menu->add(Horde::url('permissions.php')->add('backend', $backend_key), _("_Permissions"), 'horde-perms'); } }
/** * Parses the 'columns' preference. * * @return array The list of columns to be displayed. */ public static function getColumns($backend) { if (!isset(self::$_columns)) { self::$_columns = array(); $sources = json_decode($GLOBALS['prefs']->getValue('columns')); foreach ($sources as $source) { self::$_columns[array_shift($source)] = $source; } } if (empty(self::$_columns[$backend])) { $info = Gollem_Auth::getBackend($backend); self::$_columns[$backend] = $info['attributes']; } return self::$_columns[$backend]; }
* * @author Michael Slusarz <*****@*****.**> * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @package Gollem */ require_once __DIR__ . '/lib/Application.php'; Horde_Registry::appInit('gollem'); $vars = Horde_Variables::getDefaultVariables(); /* Set up the template object. */ $template = $injector->createInstance('Horde_View'); $template->cancelbutton = _("Cancel"); $template->clearbutton = _("Clear"); $template->pastebutton = _("Paste"); $template->cutgraphic = Horde::img('cut.png', _("Cut")); $template->copygraphic = Horde::img('copy.png', _("Copy")); $template->currdir = Gollem::getDisplayPath($vars->dir); $template->dir = $vars->dir; $template->manager_url = Horde::url('manager.php'); $entry = array(); foreach ($session->get('gollem', 'clipboard') as $key => $val) { $entry[] = array('copy' => $val['action'] == 'copy', 'cut' => $val['action'] == 'cut', 'id' => $key, 'name' => $val['display']); } $template->entries = $entry; $page_output->addScriptFile('clipboard.js'); $page_output->addScriptFile('tables.js', 'horde'); $page_output->addInlineJsVars(array('GollemClipboard.selectall' => _("Select All"), 'GollemClipboard.selectnone' => _("Select None"))); $page_output->header(array('title' => _("Clipboard"))); $notification->notify(array('listeners' => 'status')); echo $template->render('clipboard'); $page_output->footer();
/** * Change the currently active backend. * * @param string $key The ID of the backend to set as active. */ public static function changeBackend($key) { $GLOBALS['session']->set('gollem', 'backend_key', $key); Gollem::$backend = self::getBackend($key); }
* did not receive this file, see http://www.horde.org/licenses/gpl. * * @author Max Kalika <*****@*****.**> * @author Chuck Hagenbuch <*****@*****.**> * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @package Gollem */ require_once __DIR__ . '/lib/Application.php'; Horde_Registry::appInit('gollem', array('session_control' => 'readonly')); $vars = Horde_Variables::getDefaultVariables(); if ($vars->driver != Gollem::$backend['driver']) { Horde::url('login.php')->add(array('backend_key' => $vars->driver, 'url' => Horde::selfUrl(true)))->redirect(); } try { Gollem::changeDir(); } catch (Horde_Vfs_Exception $e) { $notification->push($e); } $gollem_vfs = $injector->getInstance('Gollem_Vfs'); $stream = null; $data = ''; try { if (is_callable(array($gollem_vfs, 'readStream'))) { $stream = $gollem_vfs->readStream($vars->dir, $vars->file); } else { $data = $gollem_vfs->read($vars->dir, $vars->file); } } catch (Horde_Vfs_Exception $e) { Horde::log($e, 'NOTICE'); throw $e;
case '**dir': $url = $self_url->copy()->add(array('cacheid' => $cacheid, 'dir' => Gollem::subdirectory(Gollem::$backend['dir'], $val['name']), 'formid' => $vars->formid)); $item['link'] = $url->link() . '<strong>' . $name . '</strong></a>'; $item['dir'] = true; break; case '**sym': if ($val['linktype'] === '**dir') { if (substr($val['link'], 0, 1) == '/') { $parts = explode('/', $val['link']); $name = array_pop($parts); $dir = implode('/', $parts); } else { $name = $val['link']; $dir = Gollem::$backend['dir']; } $url = $self_url->copy()->add(array('cacheid' => $cacheid, 'dir' => Gollem::subdirectory(Gollem::$backend['dir'], $val['name']), 'formid' => $vars->formid)); $item['link'] = $item['name'] . ' -> <strong>' . $url->link() . $val['link'] . '</a></strong>'; } else { $item['link'] = $item['name'] . ' -> ' . $val['link']; } break; default: $item['link'] = $name; break; } if (!empty($selectlist['files']) && in_array(Gollem::$backend['dir'] . '|' . $val['name'], $selectlist['files'])) { $item['selected'] = true; } $item['item'] = ++$rowct % 2 ? 'rowEven' : 'rowOdd'; $entry[] = $item; }
} break; case '**broken': $item['link'] = $name; break; case '**sym': if ($val['linktype'] === '**dir') { if (substr($val['link'], 0, 1) == '/') { $parts = explode('/', $val['link']); $name = array_pop($parts); $dir = implode('/', $parts); } else { $name = $val['link']; $dir = Gollem::$backend['dir']; } $url = $manager_url->copy()->add('dir', Gollem::subdirectory($dir, $name)); $item['link'] = $item['name'] . ' -> ' . $url->link() . $val['link'] . '</a>'; } else { $item['link'] = $item['name'] . ' -> ' . $val['link']; } break; default: $mime_type = Horde_Mime_Magic::extToMime($val['type']); // Edit link if possible. if (strpos($mime_type, 'text/') === 0) { $url = $edit_url->copy()->add(array('actionID' => 'edit_file', 'type' => $val['type'], 'file' => $val['name'], 'dir' => Gollem::$backend['dir'], 'driver' => Gollem::$backend['driver'])); $item['edit'] = Horde::link('#', '', '', '_blank', Horde::popupJs($url)); } // We can always download files. $item['dl'] = $registry->downloadUrl($val['name'], array('dir' => Gollem::$backend['dir'], 'backend' => $GLOBALS['session']->get('gollem', 'backend_key')))->link(array('title' => sprintf(_("Download %s"), $val['name']))); // Try a view link.