本文整理汇总了PHP中Horde_Util::getFormData方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Util::getFormData方法的具体用法?PHP Horde_Util::getFormData怎么用?PHP Horde_Util::getFormData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Util
的用法示例。
在下文中一共展示了Horde_Util::getFormData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _delete
/**
* 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 <jon@horde.org>
* @author Jan Schneider <jan@horde.org>
*/
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();
}
示例2: processRequest
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)));
}
}
示例3: execute
/**
* @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');
}
}
示例4: login
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');
}
}
示例5: token
/**
* 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);
}
}
示例6: __construct
/**
* 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;
}
示例7: menu
/**
*/
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');
}
示例8: html
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);
}
}
}
示例9: addFeedLink
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")));
}
示例10: display
/**
* 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
}
示例11: _whupsCallback
/**
* 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;
}
示例12: changeDir
/**
* 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);
}
}
示例13: handle_avatarselect
/**
* Copyright 2005-2007 Andrew Hosie <ahosie@gmail.com>
*
* 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;
}
示例14: foreach
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;
}
}
}
}
示例15: _save
/**
* 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 <chuck@horde.org>
* @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);
}