/** * Copyright 2001-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. * * @author Jon Parise <*****@*****.**> * @author Jan Schneider <*****@*****.**> */ function _delete($task_id, $tasklist_id) { global $injector, $nag_shares, $notification, $registry; if (!empty($task_id)) { try { $task = Nag::getTask($tasklist_id, $task_id); $task->loadChildren(); try { $share = $nag_shares->getShare($tasklist_id); } catch (Horde_Share_Exception $e) { throw new Nag_Exception($e); } if (!$share->hasPermission($registry->getAuth(), Horde_Perms::DELETE)) { $notification->push(_("Access denied deleting task."), 'horde.error'); } else { $storage = $injector->getInstance('Nag_Factory_Driver')->create($tasklist_id); try { $storage->delete($task_id); } catch (Nag_Exception $e) { $notification->push(sprintf(_("There was a problem deleting %s: %s"), $task->name, $e->getMessage()), 'horde.error'); } $notification->push(sprintf(_("Deleted %s."), $task->name), 'horde.success'); } } catch (Nag_Exception $e) { $notification->push(sprintf(_("Error deleting task: %s"), $e->getMessage()), 'horde.error'); } } /* Return to the last page or to the task list. */ if ($url = Horde_Util::getFormData('url')) { header('Location: ' . $url); exit; } Horde::url('list.php', true)->redirect(); }
public function processRequest(Horde_Controller_Request $request, Horde_Controller_Response $response) { $id = Horde_Util::getFormData('bookmark'); $gateway = $this->getInjector()->getInstance('Trean_Bookmarks'); $notification = $this->getInjector()->getInstance('Horde_Notification'); try { $bookmark = $gateway->getBookmark($id); $old_url = $bookmark->url; $bookmark->url = Horde_Util::getFormData('bookmark_url'); $bookmark->title = Horde_Util::getFormData('bookmark_title'); $bookmark->description = Horde_Util::getFormData('bookmark_description'); $bookmark->tags = Horde_Util::getFormData('treanBookmarkTags'); if ($old_url != $bookmark->url) { $bookmark->http_status = ''; } $bookmark->save(); $result = array('data' => 'saved'); } catch (Horde_Exception $e) { $notification->push(sprintf(_("There was an error saving the bookmark: %s"), $e->getMessage()), 'horde.error'); $result = array('error' => $e->getMessage()); } if (Horde_Util::getFormData('format') == 'json') { $response->setContentType('application/json'); $response->setBody(json_encode($result)); } else { $response->setRedirectUrl(Horde_Util::getFormData('url', Horde::url('browse.php', true))); } }
/** * @throws Turba_Exception */ public function execute() { // If cancel was clicked, return false. if ($this->_vars->get('submitbutton') == _("Cancel")) { Horde::url('', true)->redirect(); } if (!$GLOBALS['registry']->getAuth() || $this->_addressbook->get('owner') != $GLOBALS['registry']->getAuth()) { throw new Turba_Exception(_("You do not have permissions to delete this address book.")); } $driver = $GLOBALS['injector']->getInstance('Turba_Factory_Driver')->create($this->_addressbook->getName()); if ($driver->hasCapability('delete_all')) { try { $driver->deleteAll(); } catch (Turba_Exception $e) { Horde::log($e->getMessage(), 'ERR'); throw $e; } } // Address book successfully deleted from backend, remove the share. try { $GLOBALS['injector']->getInstance('Turba_Shares')->removeShare($this->_addressbook); } catch (Horde_Share_Exception $e) { Horde::log($e->getMessage(), 'ERR'); throw new Turba_Exception($e); } if ($GLOBALS['session']->get('turba', 'source') == Horde_Util::getFormData('deleteshare')) { $GLOBALS['session']->remove('turba', 'source'); } }
public function login() { $auth = $GLOBALS['registry']->getAuth(); if (!empty($auth)) { $this->urlFor(array('controller' => 'index', 'action' => 'index'))->redirect(); } $this->title = _("Login"); $this->post = $this->urlFor(array('controller' => 'index', 'action' => 'login')); if (isset($_POST['horde_user']) && isset($_POST['horde_pass'])) { /* Destroy any existing session on login and make sure to use a * new session ID, to avoid session fixation issues. */ $GLOBALS['registry']->getCleanSession(); if ($this->koward->auth->authenticate(Horde_Util::getPost('horde_user'), array('password' => Horde_Util::getPost('horde_pass')))) { $entry = sprintf('Login success for %s [%s] to Horde', $GLOBALS['registry']->getAuth(), $_SERVER['REMOTE_ADDR']); Horde::log($entry, 'NOTICE'); $type = $this->koward->getType(); if (!empty($type) && isset($this->koward->objects[$type]['default_view'])) { $url = $this->urlFor($this->koward->objects[$type]['default_view']); } else { if (isset($this->koward->conf['koward']['default_view'])) { $url = $this->urlFor($this->koward->conf['koward']['default_view']); } else { $url = $this->urlFor(array('controller' => 'index', 'action' => 'index')); } } $url->redirect(); } $entry = sprintf('FAILED LOGIN for %s [%s] to Horde', Horde_Util::getFormData('horde_user'), $_SERVER['REMOTE_ADDR']); Horde::log($entry, 'ERR'); } if ($reason = $this->koward->auth->getLogoutReasonString()) { $this->koward->notification->push(str_replace('<br />', ' ', $reason), 'horde.message'); } }
/** * Renders a token into text matching the requested format. * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. */ public function token($options) { if (!isset($options['attr']['alt'])) { $options['attr']['alt'] = $options['src']; } if (strpos($options['src'], '://') === false) { if ($options['src'][0] != '/') { if (strpos($options['src'], ':')) { list($page, $options['src']) = explode(':', $options['src'], 2); } else { $page = Horde_Util::getFormData('page'); if ($page == 'EditPage') { $page = Horde_Util::getFormData('referrer'); } if (empty($page)) { $page = 'Wiki/Home'; } } $params = array('page' => $page, 'mime' => '1', 'file' => $options['src']); $options['src'] = $GLOBALS['registry']->downloadUrl($options['src'], $params)->setRaw(true); } } else { $options['src'] = new Horde_Url(Horde::externalUrl($options['src'])); $options['src']->setRaw(true); } // Send external links through Horde::externalUrl(). if (isset($options['attr']['link']) && strpos($options['attr']['link'], '://')) { $href = htmlspecialchars($options['attr']['link']); unset($options['attr']['link']); return Horde::link(Horde::externalUrl($href), $href) . $this->_token($options) . '</a>'; } else { return $this->_token($options); } }
/** * Const'r * */ public function __construct($bookmarks = null, $browser = null) { $this->_bookmarks = $bookmarks; if ($browser) { $this->_browser = $browser; } else { $this->_browser = $GLOBALS['injector']->getInstance('Trean_TagBrowser'); } $action = Horde_Util::getFormData('actionID', ''); switch ($action) { case 'remove': $tag = Horde_Util::getFormData('tag'); if (isset($tag)) { $this->_browser->removeTag($tag); $this->_browser->save(); } break; case 'add': default: // Add new tag to the stack, save to session. $tag = Horde_Util::getFormData('tag'); if (isset($tag)) { $this->_browser->addTag($tag); $this->_browser->save(); } } // Check for empty tag search.. then do what? $this->_noSearch = $this->_browser->tagCount() < 1; }
/** */ public function menu($menu) { $scope = Horde_Util::getGet('scope', 'agora'); /* Agora Home. */ $url = Horde::url('forums.php')->add('scope', $scope); $menu->add($url, _("_Forums"), 'forums.png', null, null, null, dirname($_SERVER['PHP_SELF']) == $GLOBALS['registry']->get('webroot') && basename($_SERVER['PHP_SELF']) == 'index.php' ? 'current' : null); /* Thread list, if applicable. */ if (isset($GLOBALS['forum_id'])) { $menu->add(Agora::setAgoraId($GLOBALS['forum_id'], null, Horde::url('threads.php')), _("_Threads"), 'threads.png'); if ($scope == 'agora' && $GLOBALS['registry']->getAuth()) { $menu->add(Agora::setAgoraId($GLOBALS['forum_id'], null, Horde::url('messages/edit.php')), _("New Thread"), 'newmessage.png'); } } if ($scope == 'agora' && Agora_Driver::hasPermission(Horde_Perms::DELETE, 0, $scope)) { $menu->add(Horde::url('editforum.php'), _("_New Forum"), 'newforum.png', null, null, null, Horde_Util::getFormData('agora') ? '__noselection' : null); } if (Agora_Driver::hasPermission(Horde_Perms::DELETE, 0, $scope)) { $url = Horde::url('moderate.php')->add('scope', $scope); $menu->add($url, _("_Moderate"), 'moderate.png'); } if ($GLOBALS['registry']->isAdmin()) { $menu->add(Horde::url('moderators.php'), _("_Moderators"), 'hot.png'); } $url = Horde::url('search.php')->add('scope', $scope); $menu->add($url, _("_Search"), 'search.png'); }
public function html($active = true) { if (!$this->contact) { echo '<h3>' . _("The requested contact was not found.") . '</h3>'; return; } if (!$this->contact->hasPermission(Horde_Perms::DELETE)) { if (!$this->contact->hasPermission(Horde_Perms::READ)) { echo '<h3>' . _("You do not have permission to view this contact.") . '</h3>'; return; } else { echo '<h3>' . _("You only have permission to view this contact.") . '</h3>'; return; } } echo '<div id="DeleteContact"' . ($active ? '' : ' style="display:none"') . '>'; ?> <form action="<?php echo Horde::url('delete.php'); ?> " method="post"> <?php echo Horde_Util::formInput(); ?> <input type="hidden" name="url" value="<?php echo htmlspecialchars(Horde_Util::getFormData('url')); ?> " /> <input type="hidden" name="source" value="<?php echo htmlspecialchars($this->contact->driver->getName()); ?> " /> <input type="hidden" name="key" value="<?php echo htmlspecialchars($this->contact->getValue('__key')); ?> " /> <div class="headerbox" style="padding: 8px"> <p><?php echo _("Permanently delete this contact?"); ?> </p> <input type="submit" class="horde-delete" name="delete" value="<?php echo _("Delete"); ?> " /> </div> </form> </div> <?php if ($active && $GLOBALS['browser']->hasFeature('dom')) { if ($this->contact->hasPermission(Horde_Perms::READ)) { $view = new Turba_View_Contact($this->contact); $view->html(false); } if ($this->contact->hasPermission(Horde_Perms::EDIT)) { $delete = new Turba_View_EditContact($this->contact); $delete->html(false); } } }
public static function addFeedLink() { $rss = Horde::url('rss.php', true, -1); if ($label = Horde_Util::getFormData('label')) { $rss->add('label', $label); } $GLOBALS['page_output']->addLinkTag(array('href' => $rss, 'title' => _("Bookmarks Feed"))); }
/** * Renders this page in display mode. * * @throws Wicked_Exception */ public function display() { $version = Horde_Util::getFormData('version'); $page = Wicked_Page::getPage($this->referrer(), $version); $msg = sprintf(_("Are you sure you want to revert to version %s of this page?"), $version); ?> <form method="post" name="revertform" action="<?php echo Wicked::url('RevertPage'); ?> "> <?php Horde_Util::pformInput(); ?> <input type="hidden" name="page" value="RevertPage" /> <input type="hidden" name="actionID" value="special" /> <input type="hidden" name="version" value="<?php echo htmlspecialchars($version); ?> " /> <input type="hidden" name="referrer" value="<?php echo htmlspecialchars($page->pageName()); ?> " /> <h1 class="header"> <?php echo _("Revert Page") . ': ' . Horde::link($page->pageUrl(), $page->pageName()) . $page->pageName() . '</a>'; if ($page->isLocked()) { echo Horde::img('locked.png', _("Locked")); } ?> </h1> <div class="headerbox" style="padding:4px"> <p><?php echo $msg; ?> </p> <p> <input type="submit" value="<?php echo _("Revert"); ?> " class="horde-default" /> <a class="horde-cancel" href="<?php echo Wicked::url($page->pageName()); ?> "><?php echo _("Cancel"); ?> </a> </p> </div> </form> <?php }
/** * The function to use as a callback to _toHTML(). * * @param integer $key The position of the file in the zip archive. * @param array $val The information array for the archived file. * * @return string The content-type of the output. */ protected function _whupsCallback($key, $val) { $name = preg_replace('/( )+$/', '', $val['name']); if (!empty($val['size']) && strstr($val['attr'], 'D') === false && ($val['method'] == 0x8 && Horde_Util::extensionExists('zlib') || $val['method'] == 0x0)) { $mime_part = $this->_mimepart; $mime_part->setName(basename($name)); $val['name'] = str_replace($name, Horde::url('view.php')->add(array('actionID' => 'view_file', 'type' => Horde_Util::getFormData('type'), 'file' => Horde_Util::getFormData('file'), 'ticket' => Horde_Util::getFormData('ticket'), 'zip_attachment' => $key + 1))->link() . $name . '</a>', $val['name']); } return $val; }
/** * Changes the current directory of the Gollem session based on the * 'dir' form field. * * @throws Gollem_Exception */ public static function changeDir() { $dir = Horde_Util::getFormData('dir'); if (is_null($dir)) { self::_setLabel(); } else { if (strpos($dir, '/') !== 0) { $dir = self::$backend['dir'] . '/' . $dir; } self::setDir($dir); } }
/** * Copyright 2005-2007 Andrew Hosie <*****@*****.**> * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.horde.org/licenses/gpl. */ function handle_avatarselect($updated) { if ($GLOBALS['conf']['avatar']['allow_avatars']) { $avatar_path = Horde_Util::getFormData('avatar_path'); $avatar_path = Agora::validateAvatar($avatar_path) ? $avatar_path : null; if ($avatar_path) { $GLOBALS['prefs']->setValue('avatar_path', $avatar_path); $updated = true; } } return $updated; }
function &execute() { $submit = Horde_Util::getFormData('submitbutton'); if (!empty($submit)) { $type = $this->koward->getType($this->object); foreach ($this->koward->objects[$type]['actions'] as $action => $label) { if ($submit == $label) { return $action; } } } }
/** * Copyright 1999-2014 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. * * @author Chuck Hagenbuch <*****@*****.**> * @package Kronolith */ function _save(&$event) { try { $event->save(); if (Horde_Util::getFormData('sendupdates', false)) { Kronolith::sendITipNotifications($event, $GLOBALS['notification'], Kronolith::ITIP_REQUEST); } } catch (Exception $e) { $GLOBALS['notification']->push(sprintf(_("There was an error editing the event: %s"), $e->getMessage()), 'horde.error'); } Kronolith::notifyOfResourceRejection($event); }
/** * Initial app setup code. */ public static function initialize() { global $sources, $sourceid, $source, $files, $index, $pathname; require LUXOR_BASE . '/config/backends.php'; /* Default to the first source; overridden elsewhere if necessary. */ $sourceid = Horde_Util::getFormData('source'); if (!isset($sources[$sourceid])) { $sourceid = key($sources); } $source = $sources[$sourceid]; $files = Luxor_Files::factory($source['driver'], $source); $index = Luxor_Driver::factory($sourceid); $pathname = Luxor::fixPaths(Horde_Util::getFormData('f')); }
/** */ public function menu($menu) { global $conf, $registry; /* Browse/Search */ $menu->add(Horde::url('browse.php'), _("_Browse"), 'ansel-browse', null, null, null, $GLOBALS['prefs']->getValue('defaultview') == 'browse' && basename($_SERVER['PHP_SELF']) == 'index.php' || basename($_SERVER['PHP_SELF']) == 'browse.php' ? 'current' : '__noselection'); if ($GLOBALS['registry']->getAuth()) { $url = Ansel::getUrlFor('view', array('owner' => $GLOBALS['registry']->getAuth(), 'groupby' => 'owner', 'view' => 'List')); $menu->add($url, _("_My Galleries"), 'ansel-mygalleries', null, null, null, Horde_Util::getFormData('owner', false) == $GLOBALS['registry']->getAuth() ? 'current' : '__noselection'); } $menu->add(Ansel::getUrlFor('view', array('view' => 'List')), _("_All Galleries"), 'ansel-allgalleries', null, null, null, $GLOBALS['prefs']->getValue('defaultview') == 'galleries' && basename($_SERVER['PHP_SELF']) == 'index.php' || basename($_SERVER['PHP_SELF']) == 'group.php' && Horde_Util::getFormData('owner') !== $GLOBALS['registry']->getAuth() ? 'current' : '__noselection'); if ($conf['faces']['driver'] && $registry->isAuthenticated()) { $menu->add(Horde::url('faces/search/all.php'), _("_Faces"), 'ansel-faces'); } }
public function html($active = true) { if (!$this->_event) { echo '<h3>' . _("Event not found") . '</h3>'; exit; } if (is_string($this->_event)) { echo '<h3>' . $this->_event . '</h3>'; exit; } global $conf, $prefs; $this->_event->loadHistory(); $creatorId = $this->_event->creator; $description = $this->_event->description; $location = $this->_event->location; $eventurl = $this->_event->url; $private = $this->_event->isPrivate(); $owner = Kronolith::getUserName($creatorId); $status = Kronolith::statusToString($this->_event->status); $attendees = $this->_event->attendees; $resources = $this->_event->getResources(); if ($datetime = Horde_Util::getFormData('datetime')) { $datetime = new Horde_Date($datetime); $month = $datetime->month; $year = $datetime->year; } else { $month = (int) Horde_Util::getFormData('month', date('n')); $year = (int) Horde_Util::getFormData('year', date('Y')); } $dateFormat = $prefs->getValue('date_format'); $timeFormat = $prefs->getValue('twentyFour') ? 'G:i' : 'g:ia'; // Tags $tags = implode(', ', $this->_event->tags); echo '<div id="Event"' . ($active ? '' : ' style="display:none"') . '>'; require KRONOLITH_TEMPLATES . '/view/view.inc'; echo '</div>'; if ($active && $GLOBALS['browser']->hasFeature('dom')) { /* We check for read permissions, because we can always save a * copy if we can read the event. */ if ($this->_event->hasPermission(Horde_Perms::READ) && Kronolith::getDefaultCalendar(Horde_Perms::EDIT)) { $edit = new Kronolith_View_EditEvent($this->_event); $edit->html(false); } if ($this->_event->hasPermission(Horde_Perms::DELETE)) { $delete = new Kronolith_View_DeleteEvent($this->_event); $delete->html(false); } } }
/** */ public function menu($menu) { /* If authorized, show admin links. */ if (Jonah::checkPermissions('jonah:news', Horde_Perms::EDIT)) { $menu->addArray(array('icon' => 'jonah.png', 'text' => _("_Feeds"), 'url' => Horde::url('channels/index.php'))); $menu->addArray(array('icon' => 'new.png', 'text' => _("New Feed"), 'url' => Horde::url('channels/edit.php'))); } /* If viewing a channel, show new story links if authorized */ if ($channel_id = Horde_Util::getFormData('channel_id')) { $news = $GLOBALS['injector']->getInstance('Jonah_Driver'); $channel = $news->getChannel($channel_id); if (Jonah::checkPermissions('channels', Horde_Perms::EDIT, array($channel_id))) { $menu->addArray(array('icon' => 'new.png', 'text' => _("_New Story"), 'url' => Horde::url('stories/edit.php')->add('channel_id', (int) $channel_id))); } } }
public function html($active = true) { global $browser, $conf, $registry; if (!$this->contact || !$this->contact->hasPermission(Horde_Perms::READ)) { echo '<h3>' . _("The requested contact was not found.") . '</h3>'; return; } $vars = new Horde_Variables(); $form = new Turba_Form_Contact($vars, $this->contact); $form->setOpenSection(Horde_Util::getFormData('section', 0)); /* Get the contact's history. */ $history = $this->contact->getHistory(); foreach ($history as $what => $when) { $v = $form->addVariable($what == 'created' ? _("Created") : _("Last Modified"), 'object[__' . $what . ']', 'text', false, false); $v->disable(); $vars->set('object[__' . $what . ']', $when); } echo '<div id="Contact"' . ($active ? '' : ' style="display:none"') . '>'; $form->renderInactive($form->getRenderer(), $vars); /* Comments. */ if (!empty($conf['comments']['allow']) && $registry->hasMethod('forums/doComments')) { try { $comments = $registry->call('forums/doComments', array('turba', $this->contact->driver->getName() . '.' . $this->contact->getValue('__key'), 'commentCallback')); } catch (Horde_Exception $e) { Horde::log($e, 'DEBUG'); $comments = array(); } } if (!empty($comments['threads'])) { echo '<br />' . $comments['threads']; } if (!empty($comments['comments'])) { echo '<br />' . $comments['comments']; } echo '</div>'; if ($active && $browser->hasFeature('dom')) { if ($this->contact->hasPermission(Horde_Perms::EDIT)) { $edit = new Turba_View_EditContact($this->contact); $edit->html(false); } if ($this->contact->hasPermission(Horde_Perms::DELETE)) { $delete = new Turba_View_DeleteContact($this->contact); $delete->html(false); } } }
protected function _init() { $this->driver = Vilma_Driver::factory(); // Get the currently active domain, possibly storing a change into the // session. // Domain is passed in by ID, which may or may not be the // the same as the actual DNS domain name. $domain_id = Horde_Util::getFormData('domain_id'); if (strlen($domain_id)) { $domain = $this->driver->getDomain($domain_id); if (!empty($domain['domain_name'])) { $this->curdomain = $domain; Vilma::setCurDomain($domain); } } elseif ($domain = $GLOBALS['session']->get('vilma', 'domain')) { $this->curdomain = $domain; } }
/** */ public function menu($menu) { // We are editing rather than adding if an ID was passed $editing = Horde_Util::getFormData('id'); $editing = !empty($editing); $menu->add(Horde::url('listzones.php'), _("List Domains"), 'website.png'); if (!empty($_SESSION['beatnik']['curdomain'])) { $menu->add(Horde::url('editrec.php')->add('curdomain', $_SESSION['beatnik']['curdomain']['zonename']), $editing ? _("Edit Record") : _("Add Record"), 'edit.png'); } else { $menu->add(Horde::url('editrec.php?rectype=soa'), _("Add Zone"), 'edit.png'); } $url = Horde::selfUrl(true)->add(array('expertmode' => 'toggle')); $menu->add($url, _("Expert Mode"), 'hide_panel.png', null, '', null, $_SESSION['beatnik']['expertmode'] ? 'current' : ''); if (count(Beatnik::needCommit())) { $url = Horde::url('commit.php')->add(array('domain' => 'all')); $menu->add($url, _("Commit All"), 'commit-all.png'); } }
function __construct($vars, $title = '', $name = null) { parent::__construct($vars, $title, $name); $this->addHidden('', 'url', 'text', Horde_Util::getFormData('url', '/')); $this->setButtons(_("Login")); $this->addVariable(_("Username"), 'username', 'text', true, false, sprintf(_("Enter the username you registered to %s"), $GLOBALS['registry']->get('name', 'horde')), array('', 30, 26)); $this->addVariable(_("Password"), 'password', 'password', true, false, _("Enter your password. Please be aware that password is case sensitive.")); $v =& $this->addVariable(_("Remember login?"), 'loginfor', 'radio', true, false, null, array(array('0' => _("No, only for this view"), '1' => _("Yes, remember me so the next time I don't neet to login")))); $v->setDefault('0'); $username = $vars->get('username'); if ($GLOBALS['conf']['login']['tries'] && !empty($username)) { $tries = (int) $GLOBALS['cache']->get('login_tries_' . $username, 0); $GLOBALS['cache']->set('login_tries_' . $username, $tries + 1); if ($tries >= $GLOBALS['conf']['login']['tries']) { $desc = _("Please enter the text above"); $this->addVariable('Preverjanje:', 'captcha', 'captcha', true, false, $desc, array($this->_getCAPTCHA(!$this->isSubmitted()), HORDE_BASE . '/config/couri.ttf')); } } }
/** */ protected function _init() { global $registry, $session; // Create the session. if (!$session->exists('ingo', 'script_categories')) { Ingo_Session::create(); } if ($sig = $session->get('ingo', 'personal_share')) { $curr_share = $session->get('ingo', 'current_share'); $ruleset = Horde_Util::getFormData('ruleset'); /* Select current share. */ if (is_null($curr_share) || !empty($ruleset) && $ruleset != $curr_share) { $session->set('ingo', 'current_share', $ruleset); $all_rulesets = $this->_listRulesets(); if (is_null($curr_share) || empty($all_rulesets[$ruleset]) || !$all_rulesets[$ruleset]->hasPermission($registry->getAuth(), Horde_Perms::READ)) { $session->set('ingo', 'current_share', $sig); } } } }
/** */ public function menu($menu) { /* If authorized, show admin links. */ if (Jonah::checkPermissions('jonah:news', Horde_Perms::EDIT)) { $menu->addArray(array('icon' => 'jonah.png', 'text' => _("_Feeds"), 'url' => Horde::url('channels/index.php'))); } foreach ($GLOBALS['conf']['news']['enable'] as $channel_type) { if (Jonah::checkPermissions($channel_type, Horde_Perms::EDIT)) { $menu->addArray(array('icon' => 'new.png', 'text' => _("New Feed"), 'url' => Horde::url('channels/edit.php'))); break; } } if ($channel_id = Horde_Util::getFormData('channel_id')) { $news = $GLOBALS['injector']->getInstance('Jonah_Driver'); $channel = $news->getChannel($channel_id); if ($channel['channel_type'] == Jonah::INTERNAL_CHANNEL && Jonah::checkPermissions(Jonah::typeToPermName($channel['channel_type']), Horde_Perms::EDIT, $channel_id)) { $menu->addArray(array('icon' => 'new.png', 'text' => _("_New Story"), 'url' => Horde::url('stories/edit.php')->add('channel_id', (int) $channel_id))); } } }
public function processRequest(Horde_Controller_Request $request, Horde_Controller_Response $response) { $id = Horde_Util::getFormData('bookmark'); $gateway = $this->getInjector()->getInstance('Trean_Bookmarks'); $notification = $this->getInjector()->getInstance('Horde_Notification'); try { $bookmark = $gateway->getBookmark($id); $gateway->removeBookmark($bookmark); $notification->push(_("Deleted bookmark: ") . $bookmark->title, 'horde.success'); $result = array('data' => 'deleted'); } catch (Horde_Exception $e) { $notification->push(sprintf(_("There was a problem deleting the bookmark: %s"), $e->getMessage()), 'horde.error'); $result = array('error' => $e->getMessage()); } if (Horde_Util::getFormData('format') == 'json') { $response->setContentType('application/json'); $response->setBody(json_encode($result)); } else { $response->setRedirectUrl(Horde_Util::getFormData('url', Horde::url('browse.php', true))); } }
/** */ public function menu($menu) { global $conf, $page; if (@count($conf['menu']['pages'])) { $pages = array('Wiki/Home' => _("_Home"), 'Wiki/Usage' => _("_Usage"), 'RecentChanges' => _("_Recent Changes"), 'AllPages' => _("_All Pages"), 'MostPopular' => _("Most Popular"), 'LeastPopular' => _("Least Popular")); foreach ($conf['menu']['pages'] as $pagename) { /* Determine who we should say referred us. */ $curpage = isset($page) ? $page->pageName() : null; $referrer = Horde_Util::getFormData('referrer', $curpage); /* Determine if we should depress the button. We have to do * this on our own because all the buttons go to the same .php * file, just with different args. */ if (!strstr($_SERVER['PHP_SELF'], 'prefs.php') && $curpage === $pagename) { $cellclass = 'current'; } else { $cellclass = '__noselection'; } $url = Wicked::url($pagename)->add('referrer', $referrer); $menu->add($url, $pages[$pagename], 'wicked-' . str_replace('/', '', $pagename), null, null, null, $cellclass); } } }
public function html($active = true) { if (!$this->_event) { echo '<h3>' . _("Event not found") . '</h3>'; exit; } if (is_string($this->_event)) { echo '<h3>' . $this->_event . '</h3>'; exit; } if ($datetime = Horde_Util::getFormData('datetime')) { $datetime = new Horde_Date($datetime); $month = $datetime->month; $year = $datetime->year; $day = $datetime->mday; } else { $month = Horde_Util::getFormData('month', date('n')); $day = Horde_Util::getFormData('mday', date('j')); $year = Horde_Util::getFormData('year', date('Y')); } $url = Horde_Util::getFormData('url'); echo '<div id="DeleteEvent"' . ($active ? '' : ' style="display:none"') . '>'; if (!$this->_event->recurs()) { require KRONOLITH_TEMPLATES . '/delete/one.inc'; } else { require KRONOLITH_TEMPLATES . '/delete/delete.inc'; } echo '</div>'; if ($active && $GLOBALS['browser']->hasFeature('dom')) { if ($this->_event->hasPermission(Horde_Perms::READ)) { $view = new Kronolith_View_Event($this->_event); $view->html(false); } if ($this->_event->hasPermission(Horde_Perms::READ) && Kronolith::getDefaultCalendar(Horde_Perms::EDIT)) { $edit = new Kronolith_View_EditEvent($this->_event); $edit->html(false); } } }
/** */ protected function _init() { try { $this->storage = Shout_Driver::factory('storage'); $this->extensions = Shout_Driver::factory('extensions'); $this->devices = Shout_Driver::factory('devices'); $this->dialplan = Shout_Driver::factory('dialplan'); $conf = $GLOBALS['conf']; $this->vfs = Horde_Vfs::factory($conf['ivr']['driver'], $conf['ivr']['params']); $accounts = $this->storage->getAccounts(); } catch (Shout_Exception $e) { $GLOBALS['notification']->push($e); $accounts = false; return false; } $account = Horde_Util::getFormData('account'); if (empty($account)) { $account = $GLOBALS['session']->get('shout', 'curaccount_code'); } if (!empty($account) && !in_array($account, array_keys($accounts))) { // Requested account not available $GLOBALS['notification']->push(_("You do not have permission to access that account."), 'horde.error'); $account = false; } if (empty($account)) { if (count($accounts)) { // Default to the user's first account $account = reset(array_keys($accounts)); } else { // No account requested and/or no accounts available anyway $GLOBALS['notification']->push("Please select a account to continue.", 'horde.info'); $account = false; } } $session->set('shout', 'curaccount_code', $accounts[$account]['code']); $session->set('shout', 'curaccount_name', $accounts[$account]['name']); }
/** * Adds a node to the node tree array. * * @param array $node A hash with node properties: * - id: (string) The unique node id. * - parent: (string) The parent's unique node id. * - label: (string) The text label for the node. * - expanded: (boolean) Is this level expanded or not. * - params: (array) Any other parameters to set * (see addNodeParams() of the renderers * for full details). */ public function addNode($node) { $node = array_merge(array('parent' => null, 'expanded' => true, 'params' => array()), $node); $nodeid = $this->nodeId($node['id']); $expanded = $node['expanded']; if ($this->_session) { $toggle_id = Horde_Util::getFormData(Horde_Tree::TOGGLE . $this->instance); if ($nodeid == $toggle_id) { /* We have a URL toggle request for this node. */ $expanded = call_user_func($this->_session['get'], $this->instance, $node['id']) !== null ? !call_user_func($this->_session['get'], $this->instance, $nodeid) : !$node['expanded']; call_user_func($this->_session['set'], $this->instance, $nodeid, $expanded); } elseif (($exp_get = call_user_func($this->_session['get'], $this->instance, $nodeid)) !== null) { /* If we have a saved session state use it. */ $expanded = $exp_get; } } $this->_nodes[$nodeid]['label'] = $node['label']; $this->_nodes[$nodeid]['expanded'] = $expanded; /* If any params included here add them now. */ if (!empty($node['params'])) { $this->addNodeParams($node['id'], $node['params']); } if (is_null($node['parent'])) { if (!in_array($nodeid, $this->_root_nodes)) { $this->_root_nodes[] = $nodeid; } } else { $parent = $this->nodeId($node['parent']); if (empty($this->_nodes[$parent]['children'])) { $this->_nodes[$parent]['children'] = array(); } if (!in_array($nodeid, $this->_nodes[$parent]['children'])) { $this->_nodes[$parent]['children'][] = $nodeid; } } }