本文整理汇总了PHP中Horde_Util::getPost方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Util::getPost方法的具体用法?PHP Horde_Util::getPost怎么用?PHP Horde_Util::getPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Util
的用法示例。
在下文中一共展示了Horde_Util::getPost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
}
示例2: appTests
/**
* Any application specific tests that need to be done.
*
* @return string HTML output.
*/
public function appTests()
{
$ret = '<h1>LDAP Support Test</h1>';
$params = array('server' => Horde_Util::getPost('server'), 'port' => Horde_Util::getPost('port', 389), 'basedn' => Horde_Util::getPost('basedn'), 'user' => Horde_Util::getPost('user'), 'passwd' => Horde_Util::getPost('passwd'), 'filter' => Horde_Util::getPost('filter'), 'proto' => Horde_Util::getPost('proto'));
if (!empty($params['server']) && !empty($params['basedn']) && !empty($params['filter'])) {
$ret .= $this->_doConnectionTest($params);
}
$self_url = Horde::selfUrl()->add('app', 'turba');
Horde::startBuffer();
require TURBA_TEMPLATES . '/test/ldapserver.inc';
return $ret . Horde::endBuffer();
}
示例3: readForm
/**
* Populate this slice from a time entry form.
* Assumes the values are POSTed.
*/
public function readForm()
{
// Required
$this->_properties['date'] = Hermes::parseDate(Horde_Util::getPost('start_date'));
$this->_properties['hours'] = Horde_Util::getPost('hours');
$this->_properties['description'] = Horde_Util::getPost('description');
$this->_properties['id'] = Horde_Util::getPost('id', 0);
$this->_properties['billable'] = Horde_Util::getPost('billable') ? 1 : 0;
// Optional
$client = Horde_Util::getPost('client');
$this->_properties['client'] = empty($client) ? '' : $client;
$this->_properties['type'] = Horde_Util::getPost('type');
$this->_properties['costobject'] = Horde_Util::getPost('costobject');
$this->_properties['note'] = Horde_Util::getPost('notes');
// Admin only
if ($GLOBALS['registry']->isAdmin(array('permission' => 'hermes:timeadmin')) || $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('hermes:review', $GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
$this->_properties['employee'] = Horde_Util::getPost('employee');
if (empty($this->_properties['employee'])) {
$this->_properties['employee'] = $GLOBALS['registry']->getAuth();
}
} else {
$this->_properties['employee'] = $GLOBALS['registry']->getAuth();
}
}
示例4: array
<?php
/**
* Copyright 2007-2014 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL-2). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl.
*
* @author Jan Schneider <jan@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/lgpl LGPL-2
* @package Horde
*/
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('horde', array('nologintasks' => true));
$alarm = $injector->getInstance('Horde_Alarm');
$id = Horde_Util::getPost('alarm');
$snooze = Horde_Util::getPost('snooze');
if ($id && $snooze) {
try {
$alarm->snooze($id, $registry->getAuth(), (int) $snooze);
} catch (Horde_Alarm_Exception $e) {
header('HTTP/1.0 500 ' . $e->getMessage());
}
} else {
header('HTTP/1.0 400 Bad Request');
}
示例5: while
$notification->push($result);
break;
}
$notification->push(_("Password changed."), 'horde.success');
// reset credentials so user is not forced to relogin
if ($registry->getAuthCredential('password') == $info['old']) {
$registry->setAuthCredential('password', $info['new']);
}
} while (false);
// update password reminder prefs
if (Horde_Util::getPost('formname') == 'security') {
if ($prefs->getValue('security_question') != Horde_Util::getPost('security_question')) {
$prefs->setValue('security_question', Horde_Util::getPost('security_question'));
}
if ($prefs->getValue('security_answer') != Horde_Util::getPost('security_answer')) {
$prefs->setValue('security_answer', Horde_Util::getPost('security_answer'));
}
$notification->push(_("Your securiy questions was updated."), 'horde.success');
}
$form_security = new Horde_Form($vars, _("Security question used when reseting password"), 'security');
$form_security->setButtons(_("Continue"), _("Reset"));
if (!$prefs->isLocked('security_question')) {
$v = $form_security->addVariable(_("Security question"), 'security_question', 'text', true);
$v->setDefault($prefs->getValue('security_question'));
}
$v = $form_security->addVariable(_("Security answer"), 'security_answer', 'text', true);
$v->setDefault($prefs->getValue('security_answer'));
$page_output->header(array('title' => $title));
require FOLKS_TEMPLATES . '/menu.inc';
echo $tabs->render('password');
$form->renderActive(null, null, null, 'post');
示例6: update
/**
*/
public function update(Horde_Core_Prefs_Ui $ui)
{
global $injector, $notification, $registry;
$auth = $registry->getAuth();
$state = $injector->getInstance('Horde_ActiveSyncState');
$state->setLogger($injector->getInstance('Horde_Log_Logger'));
try {
if ($ui->vars->wipeid) {
if (!$state->deviceExists($ui->vars->wipeid, $auth)) {
throw new Horde_Exception_PermissionDenied();
}
$state->setDeviceRWStatus($ui->vars->wipeid, Horde_ActiveSync::RWSTATUS_PENDING);
$notification->push(sprintf(_("A remote wipe for device id %s has been initiated. The device will be wiped during the next synchronisation."), $ui->vars->wipe));
} elseif ($ui->vars->cancelwipe) {
if (!$state->deviceExists($ui->vars->cancelwipe, $auth)) {
throw new Horde_Exception_PermissionDenied();
}
$state->setDeviceRWStatus($ui->vars->cancelwipe, Horde_ActiveSync::RWSTATUS_OK);
$notification->push(sprintf(_("The Remote Wipe for device id %s has been cancelled."), $ui->vars->wipe));
} elseif ($ui->vars->reset) {
$devices = $state->listDevices($auth);
foreach ($devices as $device) {
$state->removeState(array('devId' => $device['device_id'], 'user' => $auth));
}
$notification->push(_("All state removed for your ActiveSync devices. They will resynchronize next time they connect to the server."));
} elseif ($ui->vars->removedevice) {
$state->removeState(array('devId' => $ui->vars->removedevice, 'user' => $auth));
$notification->push(sprintf(_("The state for device id %s has been reset. It will resynchronize next time it connects to the server."), $ui->vars->removedevice));
}
} catch (Horde_ActiveSync_Exception $e) {
$notification->push(_("There was an error communicating with the ActiveSync server: %s"), $e->getMessage(), 'horde.err');
}
$GLOBALS['prefs']->setValue('activesync_identity', Horde_Util::getPost('activesync_identity'));
return false;
}
示例7: catch
<?php
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('nag');
if ($quickText = Horde_Util::getPost('quickText')) {
try {
$result = Nag::createTasksFromText($quickText, Nag::getDefaultTasklist(Horde_Perms::EDIT));
} catch (Nag_Exception $e) {
$notification->push($e->getMessage());
}
if ($result) {
$notification->push(sprintf(ngettext("Added %d task", "Added %d tasks", count($result)), count($result)), 'horde.success');
} else {
$notification->push(_("No tasks have been added."), 'horde.warning');
}
} else {
$notification->push(_("No tasks have been added."), 'horde.warning');
}
Horde::url('list.php', true)->redirect();
示例8: handleAction
public function handleAction()
{
global $notification;
$page = Wicked_Page::getPage($this->referrer());
if ($page->allows(Wicked::MODE_EDIT)) {
$version = Horde_Util::getPost('version');
if (empty($version)) {
$notification->push(sprintf(_("Can't revert to an unknown version.")), 'horde.error');
Wicked::url($this->referrer(), true)->redirect();
}
$oldpage = Wicked_Page::getPage($this->referrer(), $version);
$page->updateText($oldpage->getText(), 'Revert');
$notification->push(sprintf(_("Reverted to version %s of \"%s\"."), $version, $page->pageName()));
Wicked::url($page->pageName(), true)->redirect();
}
$notification->push(sprintf(_("You don't have permission to edit \"%s\"."), $page->pageName()), 'horde.warning');
Wicked::url($this->referrer(), true)->redirect();
}
示例9: empty
* Copyright 2008-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 Duck <duck@obala.net>
*/
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('ansel');
$image_id = (int) Horde_Util::getFormData('image_id');
$gallery_id = (int) Horde_Util::getFormData('gallery_id');
$face_id = (int) Horde_Util::getFormData('face_id');
$url = Horde_Util::getFormData('url');
$page = Horde_Util::getFormData('page', 0);
$back_url = empty($url) ? Horde::url('faces/gallery.php')->add(array('gallery' => $gallery_id, 'page' => $page))->setRaw(true) : new Horde_Url($url);
if (Horde_Util::getPost('submit') == _("Cancel")) {
$notification->push(_("Changes cancelled."), 'horde.warning');
$back_url->redirect();
exit;
}
try {
$faces = $GLOBALS['injector']->getInstance('Ansel_Faces');
$result = $faces->saveCustomFace($face_id, $image_id, (int) Horde_Util::getFormData('x1'), (int) Horde_Util::getFormData('y1'), (int) Horde_Util::getFormData('x2'), (int) Horde_Util::getFormData('y2'), Horde_Util::getFormData('name'));
} catch (Ansel_Exception $e) {
$notification->push($e->getMessage());
$back_url->redirect();
exit;
}
if ($face_id == 0) {
$notification->push(_("Face successfuly created"), 'horde.success');
} else {
示例10: switch
$device->blocked = true;
$device->save(false);
break;
case 'unblock':
$device = $state->loadDeviceInfo($deviceID);
$device->blocked = false;
$device->save(false);
break;
}
}
switch (Horde_Util::getPost('searchBy')) {
case 'username':
$devices = $state->listDevices(Horde_Util::getPost('searchInput'));
break;
default:
$devices = $state->listDevices(null, array(Horde_Util::getPost('searchBy') => Horde_Util::getPost('searchInput')));
}
$view = new Horde_View(array('templatePath' => array(HORDE_TEMPLATES . '/admin', HORDE_TEMPLATES . '/activesync')));
$view->addHelper('Tag');
$selfurl = Horde::selfUrl();
$view->reset = $selfurl->copy()->add('reset', 1);
$devs = array();
$js = array();
$collections = array();
foreach (array_values($devices) as $device) {
$dev = $state->loadDeviceInfo($device['device_id'], $device['device_user']);
try {
$dev = $GLOBALS['injector']->getInstance('Horde_Core_Hooks')->callHook('activesync_device_modify', 'horde', array($dev));
} catch (Horde_Exception_HookNotSet $e) {
}
$syncCache = new Horde_ActiveSync_SyncCache($state, $dev->id, $dev->user, $injector->getInstance('Horde_Log_Logger'));
示例11: catch
/**
* Process an single image (to be called via Ajax)
*
* Copyright 2008-2015 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 Duck <duck@obala.net>
*/
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('ansel');
$faces = $GLOBALS['injector']->getInstance('Ansel_Faces');
$name = '';
$image_id = (int) Horde_Util::getPost('image');
$reload = (int) Horde_Util::getPost('reload');
$results = $faces->getImageFacesData($image_id);
// Attempt to get faces from the picture if we don't already have results,
// or if we were asked to explicitly try again.
if ($reload || empty($results)) {
$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getImage($image_id);
try {
$image->createView('screen', null, $GLOBALS['prefs']->getValue('watermark_auto') ? $GLOBALS['prefs']->getValue('watermark_text', '') : '');
$results = $faces->getFromPicture($image_id, true);
} catch (Ansel_Exception $e) {
Horde::log($e, 'ERR');
$results = null;
}
}
if (!empty($results)) {
$customurl = Horde::url('faces/custom.php');
示例12: handleAction
public function handleAction()
{
global $notification, $wicked;
if (!$this->allows(Wicked::MODE_EDIT)) {
$notification->push(sprintf(_("You don't have permission to create \"%s\"."), $this->referrer()));
} else {
if (!empty($GLOBALS['conf']['wicked']['captcha']) && !$GLOBALS['registry']->getAuth() && Horde_String::lower(Horde_Util::getFormData('wicked_captcha')) != Horde_String::lower(Wicked::getCAPTCHA())) {
$notification->push(_("Random string did not match."), 'horde.error');
return;
}
$text = Horde_Util::getPost('page_text');
if (empty($text)) {
$notification->push(_("Pages cannot be empty."), 'horde.error');
return;
}
try {
$result = $wicked->newPage($this->referrer(), $text);
$notification->push(_("Page Created"), 'horde.success');
} catch (Wicked_Exception $e) {
$notification->push(sprintf(_("Create Failed: %s"), $e->getMessage()), 'horde.error');
}
}
// Show the newly created page.
Wicked::url($this->referrer(), true)->redirect();
}
示例13: header
if (empty($url_param)) {
$url_param = Folks::getUrlFor('user', $_COOKIE['folks_login_user']);
}
header('Location: ' . $url_param);
exit;
}
/*
* Form
*/
$title = sprintf(_("Login to %s"), $registry->get('name', 'horde'));
$vars = Horde_Variables::getDefaultVariables();
$form = new Folks_Login_Form($vars, $title, 'folks_login');
/*
* Check time between one login and anther
*/
$username = Horde_String::lower(trim(Horde_Util::getPost('username')));
if ($username && $conf['login']['diff']) {
$last_try = $cache->get('login_last_try_' . $username, $conf['cache']['default_lifetime']);
if ($last_try && $_SERVER['REQUEST_TIME'] - $last_try <= $conf['login']['diff']) {
$notification->push(_("You are entering your data too fast!"));
header('Location: ' . $login_url);
exit;
} else {
$cache->set('login_last_try_' . $username, $_SERVER['REQUEST_TIME']);
}
}
/*
* Process form
*/
if ($form->isSubmitted()) {
// check password
示例14: handleAction
/**
* Retrieves the form fields and processes the attachment.
*/
public function handleAction()
{
global $notification, $wicked, $registry, $conf;
// Only allow POST commands.
$cmd = Horde_Util::getPost('cmd');
$version = Horde_Util::getFormData('version');
$is_update = (bool) Horde_Util::getFormData('is_update');
$filename = Horde_Util::getFormData('filename');
$change_log = Horde_Util::getFormData('change_log');
// See if we're supposed to delete an attachment.
if ($cmd == 'delete' && $filename && $version) {
if (!$this->allows(Wicked::MODE_REMOVE)) {
$notification->push(_("You do not have permission to delete attachments from this page."), 'horde.error');
return;
}
try {
$wicked->removeAttachment($wicked->getPageId($this->referrer()), $filename, $version);
$notification->push(sprintf(_("Successfully deleted version %s of \"%s\" from \"%s\""), $version, $filename, $this->referrer()), 'horde.success');
} catch (Wicked_Exception $e) {
$notification->push($result->getMessage(), 'horde.error');
}
return;
}
if (empty($filename)) {
$filename = Horde_Util::dispelMagicQuotes($_FILES['attachment_file']['name']);
}
try {
$GLOBALS['browser']->wasFileUploaded('attachment_file', _("attachment"));
} catch (Horde_Browser_Exception $e) {
$notification->push($e, 'horde.error');
return;
}
if (strpos($filename, ' ') !== false) {
$notification->push(_("Attachments with spaces can't be embedded into a page."), 'horde.warning');
}
$data = file_get_contents($_FILES['attachment_file']['tmp_name']);
if ($data === false) {
$notification->push(_("Can't read uploaded file."), 'horde.error');
return;
}
if (!$this->allows(Wicked::MODE_EDIT)) {
$notification->push(sprintf(_("You do not have permission to edit \"%s\""), $this->referrer()), 'horde.error');
return;
}
if ($conf['wicked']['require_change_log'] && empty($change_log)) {
$notification->push(_("You must enter a change description to attach this file."), 'horde.error');
return;
}
$referrer_id = $wicked->getPageId($this->referrer());
try {
$attachments = $wicked->getAttachedFiles($referrer_id);
} catch (Wicked_Exception $e) {
$notification->push(sprintf(_("Error retrieving attachments: %s"), $e->getMessage()), 'horde.error');
return;
}
$found = false;
foreach ($attachments as $attach) {
if ($filename == $attach['attachment_name']) {
$found = true;
break;
}
}
if ($is_update) {
if (!$found) {
$notification->push(sprintf(_("Can't update \"%s\": no such attachment."), $filename), 'horde.error');
return;
}
} else {
if ($found) {
$notification->push(sprintf(_("There is already an attachment named \"%s\"."), $filename), 'horde.error');
return;
}
}
$file = array('page_id' => $referrer_id, 'attachment_name' => $filename, 'change_log' => $change_log);
try {
$wicked->attachFile($file, $data);
} catch (Wicked_Exception $e) {
$notification->push($e);
Horde::log($e);
throw $e;
}
if ($is_update) {
$message = sprintf(_("Updated attachment \"%s\" on page \"%s\"."), $filename, $this->referrer());
} else {
$message = sprintf(_("New attachment \"%s\" to page \"%s\"."), $filename, $this->referrer());
}
$notification->push($message, 'horde.success');
$url = Wicked::url($this->referrer(), true, -1);
Wicked::mail($message . ' ' . _("View page: ") . $url . "\n", array('Subject' => '[' . $registry->get('name') . '] attachment: ' . $this->referrer() . ', ' . $filename));
}
示例15: array
* @author Chuck Hagenbuch <chuck@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/lgpl LGPL-2
* @package Horde
*/
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('horde', array('permission' => array('horde:administration:cmdshell')));
$title = _("Command Shell");
$view = new Horde_View(array('templatePath' => HORDE_TEMPLATES . '/admin'));
$view->addHelper('Horde_Core_View_Helper_Help');
$view->addHelper('Text');
$view->action = Horde::url('admin/cmdshell.php');
$view->command = trim(Horde_Util::getFormData('cmd'));
$view->title = $title;
$view->session = $session;
if ($view->command) {
$session->checkToken(Horde_Util::getPost('token'));
$cmds = explode("\n", $view->command);
$out = array();
foreach ($cmds as $cmd) {
$cmd = trim($cmd);
if (strlen($cmd)) {
$out[] = shell_exec($cmd);
}
}
$view->out = $out;
}
$page_output->header(array('title' => $title));
require HORDE_TEMPLATES . '/admin/menu.inc';
echo $view->render('cmdshell');
$page_output->footer();