本文整理汇总了PHP中Horde_Variables::getDefaultVariables方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Variables::getDefaultVariables方法的具体用法?PHP Horde_Variables::getDefaultVariables怎么用?PHP Horde_Variables::getDefaultVariables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Variables
的用法示例。
在下文中一共展示了Horde_Variables::getDefaultVariables方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _content
/**
*/
protected function _content()
{
if (!($query = $this->_getQuery())) {
return '<p class="horde-content"><em>' . _("No query to run") . '</em></p>';
}
$vars = Horde_Variables::getDefaultVariables();
$tickets = $GLOBALS['whups_driver']->executeQuery($query, $vars);
return $this->_table($tickets, 'whups_block_query_' . $query->id);
}
示例2: refreshContent
/**
* Handle user initiated block refresh. Set a private member to avoid
* BC issues with having to add a parameter to the _content method.
*
* @param Horde_Variables $vars
*
* @return string
*/
public function refreshContent($vars = null)
{
if (empty($vars) || empty($vars->location)) {
$this->_refreshParams = Horde_Variables::getDefaultVariables();
$this->_refreshParams->set('location', $this->_params['location']);
} else {
$this->_refreshParams = $vars;
}
return $this->_content();
}
示例3: __construct
public function __construct(&$object, $buttons)
{
$this->koward =& Koward::singleton();
parent::__construct(Horde_Variables::getDefaultVariables());
$this->setTitle(_("Object actions"));
$this->object = $object;
if (!empty($buttons)) {
$this->setButtons($buttons);
}
}
示例4: testTwoAssignees
public function testTwoAssignees()
{
$share = array_shift($GLOBALS['nag_shares']->listShares('test@example.com'));
$share = $GLOBALS['nag_shares']->getShare($share->getName());
$share->addUserPermission('jane', Horde_Perms::READ);
$vars = Horde_Variables::getDefaultVariables();
$vars->set('tasklist_id', $share->getName());
$form = new Nag_Form_Task($vars, _("New Task"));
$this->assertEquals(array('jane' => 'jane', 'test@example.com' => 'test@example.com'), $this->_getAssignees($form));
}
示例5: appTests
/**
*/
public function appTests()
{
$ret = '<h1>Mail Server Support Test</h1>';
$vars = Horde_Variables::getDefaultVariables();
if ($vars->user && $vars->passwd) {
$ret .= $this->_doConnectionTest($vars);
}
$self_url = Horde::selfUrl()->add('app', 'imp');
Horde::startBuffer();
require IMP_TEMPLATES . '/test/mailserver.inc';
return $ret . Horde::endBuffer();
}
示例6: display
/**
* Display form
*
* @param integer $form_id Form id dispaly
* @param string $target_url Target url to link form to
*/
public function display($form_id, $target_url = null)
{
/* Get the stored form information from the backend. */
try {
$form_info = $GLOBALS['injector']->getInstance('Ulaform_Factory_Driver')->create()->getForm($form_id, Horde_Perms::READ);
} catch (Horde_Exception $e) {
throw new Ulaform_Exception($e->getMessage());
}
if (!empty($form_info['form_params']['language'])) {
Horde_Nls::setLanguageEnvironment($form_info['form_params']['language']);
}
$vars = Horde_Variables::getDefaultVariables();
$vars->set('form_id', $form_id);
$form = new Horde_Form($vars);
$form->addHidden('', 'form_id', 'int', false);
$form->addHidden('', 'user_uid', 'text', false);
$form->addHidden('', 'email', 'email', false);
$vars->set('user_uid', $GLOBALS['registry']->getAuth());
$vars->set('email', $GLOBALS['prefs']->getValue('from_addr'));
try {
$fields = $GLOBALS['injector']->getInstance('Ulaform_Factory_Driver')->create()->getFields($form_id);
} catch (Ulaform_Exception $e) {
throw new Ulaform_Exception($e->getMessage());
}
foreach ($fields as $field) {
/* In case of these types get array from stringlist. */
if ($field['field_type'] == 'link' || $field['field_type'] == 'enum' || $field['field_type'] == 'multienum' || $field['field_type'] == 'mlenum' || $field['field_type'] == 'radio' || $field['field_type'] == 'set' || $field['field_type'] == 'sorter') {
$field['field_params']['values'] = Ulaform::getStringlistArray($field['field_params']['values']);
}
/* Setup the field with all the parameters. */
$form->addVariable($field['field_label'], $field['field_name'], $field['field_type'], $field['field_required'], $field['field_readonly'], $field['field_desc'], $field['field_params']);
}
/* Check if submitted and validate. */
$result = array('title' => $form_info['form_name']);
if ($form->validate()) {
$form->getInfo(null, $info);
try {
$GLOBALS['ulaform_driver']->submitForm($info);
return true;
} catch (Horde_Exception $e) {
throw new Ulaform_Exception(sprintf(_("Error submitting form. %s."), $e->getMessage()));
}
}
if (is_null($target_url)) {
$target_url = Horde::selfUrl(true);
}
Horde::startBuffer();
$form->renderActive(null, null, $target_url, 'post', 'multipart/form-data');
return array('title' => $form_info['form_name'], 'form' => Horde::endBuffer());
}
示例7: _content
protected function _content()
{
$vars = Horde_Variables::getDefaultVariables();
$formname = $vars->get('formname');
$done = false;
$form = new Horde_Form($vars);
$fields = $GLOBALS['injector']->getInstance('Ulaform_Factory_Driver')->create()->getFields($this->_params['form_id']);
foreach ($fields as $field) {
/* In case of these types get array from stringlist. */
if ($field['field_type'] == 'link' || $field['field_type'] == 'enum' || $field['field_type'] == 'multienum' || $field['field_type'] == 'radio' || $field['field_type'] == 'set' || $field['field_type'] == 'sorter') {
$field['field_params']['values'] = Ulaform::getStringlistArray($field['field_params']['values']);
}
/* Setup the field with all the parameters. */
$form->addVariable($field['field_label'], $field['field_name'], $field['field_type'], $field['field_required'], $field['field_readonly'], $field['field_desc'], $field['field_params']);
}
if ($formname) {
$form->validate($vars);
if ($form->isValid() && $formname) {
$form->getInfo($vars, $info);
$info['form_id'] = $this->_params['form_id'];
try {
$submit = $GLOBALS['ulaform_driver']->submitForm($info);
$GLOBALS['notification']->push(_("Form submitted successfully."), 'horde.success');
$done = true;
} catch (Horde_Exception $e) {
$GLOBALS['notification']->push(sprintf(_("Error submitting form. %s."), $e->getMessage()), 'horde.error');
}
}
}
/* Render active or inactive, depending if submitted or
* not. */
$render_type = $done ? 'renderInactive' : 'renderActive';
/* Render the form. */
$renderer = new Horde_Form_Renderer();
$renderer->showHeader(false);
Horde::startBuffer();
$form->{$render_type}($renderer, $vars, Horde::selfUrl(true), 'post');
return Horde::endBuffer();
}
示例8: ExtensionDeleteForm
$vars->set('account', $curaccount);
$Form = new ExtensionDeleteForm($vars);
$FormValid = $Form->validate($vars, true);
if ($Form->isSubmitted() && $FormValid) {
try {
$Form->execute();
$notification->push(_("Extension Deleted."));
$action = 'list';
} catch (Exception $e) {
$notification->push($e);
}
} elseif ($Form->isSubmitted()) {
// Submitted but not valid
$notification->push(_("Problem processing the form. Please check below and try again."), 'horde.warning');
}
$vars = Horde_Variables::getDefaultVariables(array());
$vars->set('account', $curaccount);
$Form = new ExtensionDeleteForm($vars);
break;
case 'list':
default:
$action = 'list';
$title .= _("List Numbers");
}
try {
$accounts = $shout->storage->getAccounts();
$numbers = $shout->storage->getNumbers();
} catch (Exception $e) {
$notification->push($e);
}
$page_output->addScriptFile('stripe.js', 'horde');
示例9: header
<?php
/**
* $Id: delete_event.php,v 1.1 2010/10/24 17:24:39 pety Exp pety $
*
* Copyright 2007-2009 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*
* @author Peter Sagi <psagi@freemail.hu>
*/
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('cloudbank');
require_once CLOUDBANK_BASE . '/lib/Cloudbank.php';
require_once CLOUDBANK_BASE . '/lib/Book.php';
/* main() */
$g_variables =& Horde_Variables::getDefaultVariables();
$g_account_id = $g_variables->get('account_id');
$g_event_id = $g_variables->get('event_id');
try {
Book::Singleton()->deleteEvent($g_event_id);
header('Location: ' . Horde::url('events.php', true)->add(array('ledger_account_id' => $g_account_id, 'ledger_account_type' => CloudBankConsts::LedgerAccountType_Account), NULL, false));
} catch (Exception $v_exception) {
Cloudbank::PushError(Book::XtractMessage($v_exception));
$page_output->header();
$notification->notify(array('listeners' => 'status'));
$page_output->footer();
}
示例10: processRequest
public function processRequest(Horde_Controller_Request $request, Horde_Controller_Response $response)
{
global $nag_shares, $prefs;
$vars = Horde_Variables::getDefaultVariables();
$registry = $this->getInjector()->getInstance('Horde_Registry');
$notification = $this->getInjector()->getInstance('Horde_Notification');
$form = new Nag_Form_Task($vars, $vars->get('task_id') ? sprintf(_("Edit: %s"), $vars->get('name')) : _("New Task"));
if (!$form->validate($vars)) {
// Hideous
$_REQUEST['actionID'] = 'task_form';
require NAG_BASE . '/task.php';
exit;
}
$form->getInfo($vars, $info);
// Check if we are here due to a search_return push.
if ($vars->search_return) {
Horde::url('list.php', true)->add(array('actionID' => 'search_return', 'list' => $vars->list, 'tab_name' => $vars->tab_name))->redirect();
}
// Check if we are here due to a deletebutton push
if ($vars->deletebutton) {
try {
$share = $nag_shares->getShare($info['old_tasklist']);
} catch (Horde_Share_Exception $e) {
$notification->push(sprintf(_("Access denied deleting task: %s"), $e->getMessage()), 'horde.error');
Horde::url('list.php', true)->redirect();
}
if (!$share->hasPermission($registry->getAuth(), Horde_Perms::DELETE)) {
$notification->push(_("Access denied deleting task"), 'horde.error');
Horde::url('list.php', true)->redirect();
}
$storage = $this->getInjector()->getInstance('Nag_Factory_Driver')->create($info['old_tasklist']);
try {
$storage->delete($info['task_id']);
} catch (Nag_Exception $e) {
$notification->push(sprintf(_("Error deleting task: %s"), $e->getMessage()), 'horde.error');
Horde::url('list.php', true)->redirect();
}
$notification->push(_("Task successfully deleted"), 'horde.success');
Horde::url('list.php', true)->redirect();
}
if ($prefs->isLocked('default_tasklist') || count(Nag::listTasklists(false, Horde_Perms::EDIT, false)) <= 1) {
$info['tasklist_id'] = $info['old_tasklist'] = Nag::getDefaultTasklist(Horde_Perms::EDIT);
}
try {
$share = $nag_shares->getShare($info['tasklist_id']);
} catch (Horde_Share_Exception $e) {
$notification->push(sprintf(_("Access denied saving task: %s"), $e->getMessage()), 'horde.error');
Horde::url('list.php', true)->redirect();
}
if (!$share->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("Access denied saving task to this task list."), 'horde.error');
Horde::url('list.php', true)->redirect();
}
/* If a task id is set, we're modifying an existing task. Otherwise,
* we're adding a new task with the provided attributes. */
if (!empty($info['task_id']) && !empty($info['old_tasklist'])) {
$storage = $this->getInjector()->getInstance('Nag_Factory_Driver')->create($info['old_tasklist']);
$info['tasklist'] = $info['tasklist_id'];
$result = $storage->modify($info['task_id'], $info);
} else {
/* Check permissions. */
$perms = $this->getInjector()->getInstance('Horde_Core_Perms');
if ($perms->hasAppPermission('max_tasks') !== true && $perms->hasAppPermission('max_tasks') <= Nag::countTasks()) {
Horde::url('list.php', true)->redirect();
}
/* Creating a new task. */
$storage = $this->getInjector()->getInstance('Nag_Factory_Driver')->create($info['tasklist_id']);
// These must be unset since the form sets them to NULL
unset($info['owner']);
unset($info['uid']);
try {
$newid = $storage->add($info);
} catch (Nag_Exception $e) {
$notification->push(sprintf(_("There was a problem saving the task: %s."), $e->getMessage()), 'horde.error');
Horde::url('list.php', true)->redirect();
}
}
$notification->push(sprintf(_("Saved %s."), $info['name']), 'horde.success');
/* Return to the last page or to the task list. */
if ($vars->savenewbutton) {
$url = Horde::url('task.php', true)->add(array('actionID' => 'add_task', 'tasklist_id' => $info['tasklist_id'], 'parent' => $info['parent']));
} else {
$url = Horde_Util::getFormData('url', (string) Horde::url('list.php', true));
$url = Horde::url($url, true);
}
$response->setRedirectUrl($url);
}
示例11: getAdminTabs
public static function getAdminTabs()
{
$tabname = Horde_Util::getFormData('view');
$tabs = new Horde_Core_Ui_Tabs('view', Horde_Variables::getDefaultVariables());
$tabs->addTab(_("Telephone Numbers"), Horde::url('admin/numbers.php'), array('view' => 'numbers', id => 'tabnumbers'));
$tabs->addTab(_("Accounts"), Horde::url('admin/accounts.php'), array('view' => 'accounts', id => 'tabaccounts'));
if ($view === null) {
$view = 'numbers';
}
echo $tabs->render($view);
}
示例12: _formInit
/**
* Creates any form objects if they have not been initialised yet.
*/
protected function _formInit()
{
if (is_null($this->_vars)) {
/* No existing vars set, get them now. */
$this->_vars = Horde_Variables::getDefaultVariables();
}
if (!$this->_form instanceof Horde_Form) {
/* No existing valid form object set so set up a new one. */
$this->_form = new Horde_Form($this->_vars);
}
}
示例13: _setupPager
/**
* Populate the Horde_View with the $pager object.
*
* @param Horde_View $view The Horde_View object.
*/
protected function _setupPager(Horde_View &$view)
{
$vars = Horde_Variables::getDefaultVariables();
if (!empty($this->view->page)) {
$vars->add('page', $this->view->page);
$view->page = $this->view->page;
} else {
$view->page = 0;
}
$pagerurl = $this->_getPagerUrl();
if (!empty($this->view->urlCallback)) {
$callback = $this->view->urlCallback;
} else {
$callback = null;
}
$params = array('num' => $this->numTiles, 'url' => $pagerurl, 'perpage' => $this->perpage, 'url_callback' => $callback);
$view->pager = new Horde_Core_Ui_Pager('page', $vars, $params);
}
示例14: _init
/**
* Global variables defined:
* $chora_conf
* $sourceroots
*/
protected function _init()
{
global $acts, $conf, $defaultActs, $where, $atdir, $fullname, $sourceroot, $page_output;
// TODO: If chora isn't fully/properly setup, init() will throw fatal
// errors. Don't want that if this class is being loaded simply to
// obtain basic chora application information.
$initial_app = $GLOBALS['registry']->initialApp == 'chora';
try {
$GLOBALS['sourceroots'] = Horde::loadConfiguration('backends.php', 'sourceroots');
} catch (Horde_Exception $e) {
$GLOBALS['sourceroots'] = array();
if (!$initial_app) {
return;
}
$GLOBALS['notification']->push($e);
}
$sourceroots = Chora::sourceroots();
/**
* Variables we wish to propagate across web pages
* ha = Hide Attic Files
* ord = Sort order
* sbt = Sort By Type (name, age, author, etc)
*
* Obviously, defaults go into $defaultActs :)
* TODO: defaults of 1 will not get propagated correctly - avsm
* XXX: Rewrite this propagation code, since it sucks - avsm
*/
$defaultActs = $acts = array('onb' => 0, 'ord' => Horde_Vcs::SORT_ASCENDING, 'rev' => 0, 'rt' => null, 'sa' => 0, 'sbt' => constant($conf['options']['defaultsort']), 'ws' => 1);
/* See if any actions have been passed as form variables, and if so,
* assign them into the acts array. */
$vars = Horde_Variables::getDefaultVariables();
foreach (array_keys($acts) as $key) {
if (isset($vars->{$key})) {
$acts[$key] = $vars->{$key};
}
}
/* Use the value of the 'rt' form value for the sourceroot. If not
* present, use the last sourceroot used as the default value if the
* user has that preference. Otherwise, use default sourceroot. */
$last_sourceroot = $GLOBALS['prefs']->getValue('last_sourceroot');
if (is_null($acts['rt'])) {
if (!empty($last_sourceroot) && !empty($sourceroots[$last_sourceroot]) && is_array($sourceroots[$last_sourceroot])) {
$acts['rt'] = $last_sourceroot;
} else {
foreach ($sourceroots as $key => $val) {
if (!isset($acts['rt']) || isset($val['default'])) {
$acts['rt'] = $key;
break;
}
}
if (is_null($acts['rt'])) {
if ($initial_app) {
Chora::fatal(new Chora_Exception(_("No repositories found.")));
}
return;
}
}
}
if (!isset($sourceroots[$acts['rt']])) {
if ($initial_app) {
Chora::fatal(new Chora_Exception(sprintf(_("The repository with the slug '%s' was not found"), $acts['rt'])));
}
return;
}
$sourcerootopts = $sourceroots[$acts['rt']];
$sourceroot = $acts['rt'];
/* Store last repository viewed */
if ($acts['rt'] != $last_sourceroot) {
$GLOBALS['prefs']->setValue('last_sourceroot', $acts['rt']);
}
// Cache.
$cache = empty($conf['caching']) ? null : $GLOBALS['injector']->getInstance('Horde_Cache');
$GLOBALS['chora_conf'] = array('cvsusers' => $sourcerootopts['location'] . '/' . (isset($sourcerootopts['cvsusers']) ? $sourcerootopts['cvsusers'] : ''), 'introText' => CHORA_BASE . '/config/' . (isset($sourcerootopts['intro']) ? $sourcerootopts['intro'] : ''), 'introTitle' => isset($sourcerootopts['title']) ? $sourcerootopts['title'] : '', 'sourceRootName' => $sourcerootopts['name']);
$chora_conf =& $GLOBALS['chora_conf'];
$GLOBALS['VC'] = Horde_Vcs::factory(Horde_String::ucfirst($sourcerootopts['type']), array('cache' => $cache, 'sourceroot' => $sourcerootopts['location'], 'paths' => array_merge($conf['paths'], array('temp' => Horde::getTempDir())), 'username' => isset($sourcerootopts['username']) ? $sourcerootopts['username'] : '', 'password' => isset($sourcerootopts['password']) ? $sourcerootopts['password'] : ''));
if (!$initial_app) {
return;
}
$where = Horde_Util::getFormData('f', '/');
/* Location relative to the sourceroot. */
$where = preg_replace(array('|^/|', '|\\.\\.|'), '', $where);
$fullname = $sourcerootopts['location'] . (substr($sourcerootopts['location'], -1) == '/' ? '' : '/') . $where;
if ($sourcerootopts['type'] == 'cvs') {
$fullname = preg_replace('|/$|', '', $fullname);
$atdir = @is_dir($fullname);
} else {
$atdir = !$where || substr($where, -1) == '/';
}
$where = preg_replace('|/$|', '', $where);
if ($sourcerootopts['type'] == 'cvs' && !@is_dir($sourcerootopts['location'])) {
Chora::fatal(new Chora_Exception(_("Sourceroot not found. This could be a misconfiguration by the server administrator, or the server could be having temporary problems. Please try again later.")));
}
if (Chora::isRestricted($where)) {
Chora::fatal(new Chora_Exception(sprintf(_("%s: Forbidden by server configuration"), $where)));
}
//.........这里部分代码省略.........
示例15: editActions
/**
* Check for, and handle, image editing actions.
*
* @param string $actionID The action identifier.
*
* @return boolean True if an action was handled, otherwise false.
* @throws Ansel_Exception
*/
public static function editActions($actionID)
{
global $notification, $page_output, $registry;
$ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Storage');
$gallery_id = Horde_Util::getFormData('gallery');
$image_id = Horde_Util::getFormData('image');
$date = Ansel::getDateParameter();
$page = Horde_Util::getFormData('page', 0);
$watermark_font = Horde_Util::getFormData('font');
$watermark_halign = Horde_Util::getFormData('whalign');
$watermark_valign = Horde_Util::getFormData('wvalign');
$watermark = Horde_Util::getFormData('watermark', $GLOBALS['prefs']->getValue('watermark_text'));
// Get the gallery object and style information.
try {
$gallery = $ansel_storage->getGallery($gallery_id);
} catch (Ansel_Exception $e) {
$notification->push(sprintf(_("Gallery %s not found."), $gallery_id), 'horde.error');
Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
switch ($actionID) {
case 'modify':
try {
$image = $ansel_storage->getImage($image_id);
$ret = Horde_Util::getFormData('ret', 'gallery');
} catch (Ansel_Exception $e) {
$notification->push(_("Photo not found."), 'horde.error');
Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
$title = sprintf(_("Edit properties :: %s"), $image->filename);
// Set up the form object.
$vars = Horde_Variables::getDefaultVariables();
if ($ret == 'gallery') {
$vars->set('actionID', 'saveclose');
} else {
$vars->set('actionID', 'savecloseimage');
}
$form = new Ansel_Form_Image($vars, $title);
$renderer = new Horde_Form_Renderer();
// Set up the gallery attributes.
$vars->set('image_default', $image->id == $gallery->get('default'));
$vars->set('image_desc', $image->caption);
$vars->set('image_tags', implode(', ', $image->getTags()));
$vars->set('image_originalDate', $image->originalDate);
$vars->set('image_uploaded', $image->uploaded);
$page_output->header(array('title' => $title));
$form->renderActive($renderer, $vars, Horde::url('image.php'), 'post', 'multipart/form-data');
$page_output->footer();
exit;
case 'savecloseimage':
case 'saveclose':
case 'save':
$title = _("Save Photo");
if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("Access denied saving photo to this gallery."), 'horde.error');
Ansel::getUrlFor('view', array_merge(array('gallery' => $gallery_id, 'slug' => $gallery->get('slug'), 'view' => 'Gallery', 'page' => $page), $date), true)->redirect();
exit;
}
// Validate the form object.
$vars = Horde_Variables::getDefaultVariables();
$vars->set('actionID', 'save');
$renderer = new Horde_Form_Renderer();
$form = new Ansel_Form_Image($vars, _("Edit a photo"));
// Update existing image.
if ($form->validate($vars)) {
$form->getInfo($vars, $info);
// Replacing photo
if (!empty($info['file0']['file'])) {
try {
$GLOBALS['browser']->wasFileUploaded('file0');
if (filesize($info['file0']['file'])) {
$data = file_get_contents($info['file0']['file']);
if (getimagesize($info['file0']['file']) === false) {
$notification->push(_("The file you uploaded does not appear to be a valid photo."), 'horde.error');
unset($data);
}
}
} catch (Horde_Browser_Exception $e) {
}
}
$image = $ansel_storage->getImage($image_id);
$image->caption = $vars->get('image_desc');
$image->setTags(explode(',', $vars->get('image_tags')));
$newDate = new Horde_Date($vars->get('image_originalDate'));
$image->originalDate = (int) $newDate->timestamp();
if (!empty($data)) {
try {
$image->replace($data);
} catch (Ansel_Exception $e) {
$notification->push(_("There was an error replacing the photo."), 'horde.error');
}
//.........这里部分代码省略.........