/** * Create a permission deleting form. * * @param Horde_Perms_Permission $permission A permissions object. */ public function setupDeleteForm($permission) { /* Initialise form if required. */ $this->_formInit(); $this->_form->setTitle(sprintf(Horde_Core_Translation::t("Delete permissions for \"%s\""), $this->_corePerms->getTitle($permission->getName()))); $this->_form->setButtons(array(array('class' => 'horde-delete', 'value' => Horde_Core_Translation::t("Delete")), array('class' => 'horde-cancel', 'value' => Horde_Core_Translation::t("Do not delete")))); $this->_form->addHidden('', 'perm_id', 'text', false); $this->_form->addVariable(sprintf(Horde_Core_Translation::t("Delete permissions for \"%s\" and any sub-permissions?"), $this->_corePerms->getTitle($permission->getName())), 'prompt', 'description', false); }
function prepareImportForm($p_variables, &$p_statement_file_variable) { $v_form = new Horde_Form($p_variables, 'Import Statement', 'import_statement'); $p_statement_file_variable = $v_form->addVariable('Statement File (CSV)', 'statement_file', 'file', TRUE); $v_file_description = '<p>The file must conform to the CSV standard and contain only ' . 'printable, UTF-8 characters.</p>' . '<p>Fields are:</p>' . '<ul><li>Item ID (unique)</li><li>Account Name</li>' . '<li>Item Type (O: opening balance, E: event, C: closing balance)</li>' . '<li>Description</li><li>Amount</li></ul>'; $v_file_description_variable = $v_form->addVariable('', 'description', 'html', FALSE, TRUE); $v_file_description_variable->setDefault($v_file_description); $v_form->setButtons('import'); return $v_form; }
/** * Expects: * $vars * $registry * $notification */ public function run() { extract($this->_params, EXTR_REFS); /* Set up the form variables and the form. */ $form_submit = $vars->get('submitbutton'); $channel_id = $vars->get('channel_id'); try { $channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($channel_id); } catch (Exception $e) { Horde::log($e, 'ERR'); $notification->push(_("Invalid channel specified for deletion."), 'horde.message'); Horde::url('channels')->redirect(); exit; } /* If not yet submitted set up the form vars from the fetched channel. */ if (empty($form_submit)) { $vars = new Horde_Variables($channel); } /* Check permissions and deny if not allowed. */ if (!Jonah::checkPermissions(Jonah::typeToPermName($channel['channel_type']), Horde_Perms::DELETE, $channel_id)) { $notification->push(_("You are not authorised for this action."), 'horde.warning'); throw new Horde_Exception_AuthenticationFailure(); } $title = sprintf(_("Delete News Channel \"%s\"?"), $vars->get('channel_name')); $form = new Horde_Form($vars, $title); $form->setButtons(array(_("Delete"), _("Do not delete"))); $form->addHidden('', 'channel_id', 'int', true, true); $msg = _("Really delete this News Channel? All stories created in this channel will be lost!"); $form->addVariable($msg, 'confirm', 'description', false); if ($form_submit == _("Delete")) { if ($form->validate($vars)) { $form->getInfo($vars, $info); try { $delete = $GLOBALS['injector']->getInstance('Jonah_Driver')->deleteChannel($info); $notification->push(_("The channel has been deleted."), 'horde.success'); Horde::url('channels')->redirect(); exit; } catch (Exception $e) { $notification->push(sprintf(_("There was an error deleting the channel: %s"), $e->getMessage()), 'horde.error'); } } } elseif (!empty($form_submit)) { $notification->push(_("Channel has not been deleted."), 'horde.message'); Horde::url('channels')->redirect(); exit; } $GLOBALS['page_output']->header(array('title' => $title)); $notification->notify(array('listeners' => 'status')); $form->renderActive(null, $vars, Horde::selfUrl(), 'post'); $GLOBALS['page_output']->footer(); }
Horde_Registry::appInit('ansel'); $faces = $GLOBALS['injector']->getInstance('Ansel_Faces'); $face_id = Horde_Util::getFormData('face'); try { $face = $faces->getFaceById($face_id); } catch (Ansel_Exception $e) { $notification->push($e->getMessage()); Horde::url('faces/search/all.php')->redirect(); exit; } $title = _("Tell us who is in this photo"); $vars = Horde_Variables::getDefaultVariables(); $form = new Horde_Form($vars, $title); $form->addHidden('', 'face', 'int', true); $form->addVariable(_("Person"), 'person', 'text', true); $form->setButtons($title); if ($form->validate()) { if (Horde_Util::getFormData('submitbutton') == _("Cancel")) { $notification->push(_("Action was cancelled."), 'horde.warning'); } else { $report = Ansel_Report::factory(); $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($face['gallery_id']); $face_link = Horde::url('faces/custom.php', true)->add(array('name' => $vars->get('person'), 'face' => $face_id, 'image' => $face['image_id']))->setRaw(true); $title = _("I know who is on one of your photos"); $body = _("Gallery Name") . ': ' . $gallery->get('name') . "\n" . _("Gallery Description") . ': ' . $gallery->get('desc') . "\n\n" . $title . "\n" . _("Person") . ': ' . $vars->get('person') . "\n" . _("Face") . ': ' . $face_link; $report->setTitle($title); try { $result = $report->report($body, $gallery->get('owner')); $notification->push(_("The owner of the photo, who will delegate the face name, was notified."), 'horde.success'); } catch (Ansel_Exception $e) { $notification->push(_("Face name was not reported.") . ' ' . $e->getMessage(), 'horde.error');
try { $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($vars->get('gallery')); } catch (Ansel_Exception $e) { $notification->push($gallery->getMessage()); Horde::url('view.php?view=List', true)->redirect(); exit; } $url = $vars->get('url'); $form = new Horde_Form($vars, _("Content Disclaimer"), 'disclamer'); $form->addVariable($gallery->get('name'), 'name', 'description', false); $form->addVariable($gallery->get('desc'), 'desc', 'description', false); $form->addHidden('', 'url', 'text', true); $form->addHidden('', 'gallery', 'int', true); $msg = sprintf(_("Photo content may be offensive. You must be over %d to continue."), $gallery->get('age')); $form->addVariable($msg, 'warning', 'description', false); $form->setButtons(array(sprintf(_("Continue - I'm over %d"), $gallery->get('age')), _("Cancel"))); if ($form->isSubmitted()) { if (Horde_Util::getFormData('submitbutton') == _("Cancel")) { $notification->push("You are not authorised to view this photo.", 'horde.warning'); Horde::url('view.php?view=List', true)->redirect(); exit; } else { $session->set('ansel', 'user_age', (int) $gallery->get('age')); $url->redirect(); exit; } } $page_output->header(); $notification->notify(array('listeners' => 'status')); $form->renderActive(null, null, null, 'post'); $page_output->footer();
if ($message instanceof PEAR_Error) { $notification->push(sprintf(_("Could not open the message. %s"), $message->getMessage()), 'horde.warning'); Horde::url('forums.php', true)->redirect(); } /* Check delete permissions */ if (!$messages->hasPermission(Horde_Perms::DELETE)) { $notification->push(sprintf(_("You don't have permission to delete messages in forum %s."), $forum_id), 'horde.warning'); $url = Agora::setAgoraId($forum_id, $message_id, Horde::url('messages/index.php', true), $scope); header('Location: ' . $url); exit; } /* Get the form object. */ $vars = Horde_Variables::getDefaultVariables(); $form = new Horde_Form($vars, sprintf(_("Split \"%s\""), $message['message_subject'])); // TODO Cancel button doesn't work currently, because it has no condition set $form->setButtons(array(_("Split"), _("Cancel"))); $form->addHidden('', 'agora', 'text', false); $form->addHidden('', 'scope', 'text', false); /* Validate the form. */ if ($form->validate()) { $form->getInfo($vars, $info); if ($vars->get('submitbutton') == _("Split")) { $split = $messages->splitThread($message_id); if ($split instanceof PEAR_Error) { $notification->push($split->getMessage(), 'horde.error'); } else { $notification->push(sprintf(_("Thread splitted by message %s."), $message_id), 'horde.error'); header('Location: ' . Agora::setAgoraId($forum_id, $message_id, Horde::url('messages/index.php', true), $scope)); exit; } }
try { $gallery = $injector->getInstance('Ansel_Storage')->getGallery($gallery_id); } catch (Ansel_Exception $e) { $notification->push($e->getMessage()); Horde::url('view.php?view=List', true)->redirect(); exit; } if (($image_id = Horde_Util::getFormData('image')) !== null) { $title = _("Do you really want to report this photo?"); $return_url = Ansel::getUrlFor('view', array('view' => 'Image', 'image' => $image_id, 'gallery' => $gallery_id), true); } else { $return_url = Ansel::getUrlFor('view', array('gallery' => $gallery_id, 'view' => 'Gallery'), true); } $vars = Horde_Variables::getDefaultVariables(); $form = new Horde_Form($vars, $title); $form->setButtons(array(array('class' => 'horde-default', 'value' => _("Report")), array('class' => 'horde-cancel', 'value' => _("Cancel")))); $enum = array('advertisement' => _("Advertisement content"), 'terms' => _("Terms and conditions infringement"), 'offensive' => _("Offensive content"), 'copyright' => _("Copyright infringement")); $form->addVariable($gallery->get('name'), 'name', 'description', false); $form->addVariable($gallery->get('desc'), 'desc', 'description', false); $form->addHidden('', 'gallery', 'text', true, true); $vars->set('gallery', $gallery_id); $form->addVariable(_("Report type"), 'type', 'radio', true, false, null, array($enum)); $form->addVariable(_("Report reason"), 'reason', 'longtext', true); $gallery_id = Horde_Util::getFormData('id'); if ($vars->get('submitbutton') == _("Cancel")) { Horde::url('', true)->redirect(); } if ($form->validate()) { if (Horde_Util::getFormData('submitbutton') == _("Report")) { $report = Ansel_Report::factory(); $body = _("Gallery Name") . ': ' . $gallery->get('name') . "\n" . _("Gallery Description") . ': ' . $gallery->get('desc') . "\n" . _("Gallery Id") . ': ' . $gallery->id . "\n" . _("Report type") . ': ' . $enum[$vars->get('type')] . "\n" . _("Report reason") . ': ' . $vars->get('reason') . "\n" . $return_url;
* did not receive this file, see http://www.horde.org/licenses/lgpl. * * @author Chuck Hagenbuch <*****@*****.**> * @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:users'))); $auth = $injector->getInstance('Horde_Core_Factory_Auth')->create(); $vars = $injector->getInstance('Horde_Variables'); if ($conf['signup']['allow'] && $conf['signup']['approve']) { $signup = $injector->getInstance('Horde_Core_Auth_Signup'); } $addForm = new Horde_Form($vars, _("Add a new user:"******"Add user"), _("Reset")); $addForm->addHidden('', 'form', 'text', true, true); /* Use hooks get any extra fields for new accounts. */ try { $extra = $injector->getInstance('Horde_Core_Hooks')->callHook('signup_getextra', 'horde'); if (!empty($extra)) { if (!isset($extra['user_name'])) { $addForm->addVariable(_("Username"), 'user_name', 'text', true); } if (!isset($extra['password'])) { $addForm->addVariable(_("Password"), 'password', 'passwordconfirm', false, false, _("type the password twice to confirm")); } foreach ($extra as $field_name => $field) { $readonly = isset($field['readonly']) ? $field['readonly'] : null; $desc = isset($field['desc']) ? $field['desc'] : null; $field_params = isset($field['params']) ? $field['params'] : array();
$idx .= '|' . $name; if (empty($added_nodes[$idx])) { if ($key == $lcount) { $node_params['url'] = $base_url->copy()->setRaw(true)->add(array('show' => 'entry', 'topic' => $id)); $added_nodes[$idx] = true; } $tree->addNode(array('id' => $idx, 'parent' => $parent, 'label' => $name, 'expanded' => false, 'params' => $node_params)); } $parent .= '|' . $name; } } break; case 'search': /* Create Form */ $searchForm = new Horde_Form($vars, null, 'search'); $searchForm->setButtons(_("Search")); $searchForm->addHidden('sidebar', 'show', 'text', false); $searchForm->addHidden('', 'module', 'text', false); $searchForm->addHidden('', 'side_show', 'text', false); $searchForm->addVariable(_("Keyword"), 'keyword', 'text', false, false, null, array(null, 20)); $renderer = new Horde_Form_Renderer(); $renderer->setAttrColumnWidth('50%'); Horde::startBuffer(); $searchForm->renderActive($renderer, $vars, $sidebar_url->copy()->setRaw(true), 'post'); $contents = Horde::endBuffer() . '<br />'; $keywords = $vars->get('keyword'); if (!empty($keywords)) { $results = $help->search($keywords); foreach ($results as $id => $title) { if (empty($title)) { continue;
public function run() { extract($this->_params, EXTR_REFS); $form_submit = $vars->get('submitbutton'); $channel_id = $vars->get('channel_id'); $story_id = $vars->get('id'); /* Driver */ $driver = $GLOBALS['injector']->getInstance('Jonah_Driver'); /* Fetch the channel details, needed for later and to check if valid * channel has been requested. */ try { $channel = $driver->getChannel($channel_id); } catch (Exception $e) { $notification->push(sprintf(_("Story editing failed: %s"), $e->getMessage()), 'horde.error'); Horde::url('channels/index.php', true)->redirect(); exit; } /* Check permissions. */ if (!Jonah::checkPermissions(Jonah::typeToPermName($channel['channel_type']), Horde_Perms::DELETE, $channel_id)) { $notification->push(_("You are not authorised for this action."), 'horde.warning'); throw new Horde_Exception_AuthenticationFailure(); } try { $story = $driver->getStory($channel_id, $story_id); } catch (Exception $e) { $notification->push(_("No valid story requested for deletion."), 'horde.message'); Horde::url('channels/index.php', true)->redirect(); exit; } /* If not yet submitted set up the form vars from the fetched story. */ if (empty($form_submit)) { $vars = new Horde_Variables($story); } $title = sprintf(_("Delete News Story \"%s\"?"), $vars->get('title')); $form = new Horde_Form($vars, $title); $form->setButtons(array(_("Delete"), _("Do not delete"))); $form->addHidden('', 'channel_id', 'int', true, true); $form->addHidden('', 'id', 'int', true, true); $form->addVariable(_("Really delete this News Story?"), 'confirm', 'description', false); if ($form_submit == _("Delete")) { if ($form->validate($vars)) { $form->getInfo($vars, $info); try { $delete = $driver->deleteStory($info['channel_id'], $info['id']); $notification->push(_("The story has been deleted."), 'horde.success'); Horde::url('stories/index.php', true)->add('channel_id', $channel_id)->setRaw(true)->redirect(); exit; } catch (Exception $e) { $notification->push(sprintf(_("There was an error deleting the story: %s"), $e->getMessage()), 'horde.error'); } } } elseif (!empty($form_submit)) { $notification->push(_("Story has not been deleted."), 'horde.message'); $url = Horde::url('stories/index.php', true)->add('channel_id', $channel_id)->setRaw(true); Horde::url('stories/index.php', true)->add('channel_id', $channel_id)->setRaw(true)->redirect(); exit; } $GLOBALS['page_output']->header(array('title' => $title)); $notification->notify(array('listeners' => 'status')); $form->renderActive(null, $vars, Horde::url('stories/delete.php'), 'post'); $GLOBALS['page_output']->footer(); }
if ($virtual_id && !$formname) { $vars = new Horde_Variables($vilma->driver->getVirtual($virtual_id)); $editing = true; } if (empty($domain)) { $domain = Vilma::stripDomain($vars->virtual_destination); } $users = $vilma->driver->getUsers($domain); $user_list = array(); foreach ($users as $user) { $virtual_destination = substr($user['user_name'], 0, strpos($user['user_name'], '@')); $user_list[$user['user_name']] = $virtual_destination; } $form = new Horde_Form($vars, $editing ? _("Edit Virtual Email Address") : _("New Virtual Email Address")); /* Set up the form. */ $form->setButtons(true, true); $form->addHidden('', 'virtual_id', 'int', false); $form->addHidden('', 'domain', 'text', false); $form->addVariable(_("Virtual Email"), 'stripped_email', 'text', true, false, sprintf(_("Enter a virtual email address @%s and then indicate below where mail sent to that address is to be delivered. The address must begin with an alphanumerical character, it must contain only alphanumerical and '._-' characters, and must end with an alphanumerical character."), $domain), array('~^[a-zA-Z0-9]{1,1}[a-zA-Z0-9._-]*[a-zA-Z0-9]$~')); $var =& $form->addVariable(_("Destination type"), 'destination_type', 'enum', true, false, null, array(array('local' => _("Local user"), 'remote' => _("Remote address")))); $var->setAction(Horde_Form_Action::factory('reload')); if ($vars->destination_type == 'remote') { $form->addVariable(_("Remote e-mail address"), 'virtual_destination', 'email', true, false); } else { $form->addVariable(_("Destination"), 'virtual_destination', 'enum', true, false, null, array($user_list, true)); } if ($form->validate($vars)) { $form->getInfo($vars, $info); $info['stripped_email'] = Horde_String::lower($info['stripped_email']); if ($info['destination_type'] == 'remote') { $info['virtual_destination'] = Horde_String::lower($info['virtual_destination']);
* @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)); // Make sure auth backend allows passwords to be reset. $auth = $injector->getInstance('Horde_Core_Factory_Auth')->create(); if (!$auth->hasCapability('update')) { $notification->push(_("Changing your password is not supported with the current configuration. Contact your administrator."), 'horde.error'); $registry->getServiceLink('login')->add('url', Horde_Util::getFormData('url'))->redirect(); } $vars = $injector->getInstance('Horde_Variables'); $title = _("Change Your Password"); $form = new Horde_Form($vars, $title); $form->setButtons(_("Continue")); $form->addVariable(_("Old password"), 'old_password', 'password', true); $form->addVariable(_("New password"), 'password_1', 'password', true); $form->addVariable(_("Retype new password"), 'password_2', 'password', true); if ($form->validate($vars)) { $form->getInfo($vars, $info); if ($registry->getAuthCredential('password') != $info['old_password']) { $notification->push(_("Old password is not correct."), 'horde.error'); } elseif ($info['password_1'] != $info['password_2']) { $notification->push(_("New passwords don't match."), 'horde.error'); } elseif ($info['old_password'] == $info['password_1']) { $notification->push(_("Old and new passwords must be different."), 'horde.error'); } else { try { $auth->updateUser($registry->getAuth(), $registry->getAuth(), array('password' => $info['password_1'])); $notification->push(_("Password changed successfully."), 'horde.success');
if ($message instanceof PEAR_Error) { $notification->push(sprintf(_("Could not open the message. %s"), $message->getMessage()), 'horde.warning'); Horde::url('forums.php', true)->redirect(); } /* We have any moderators? */ $forum = $messages->getForum(); if (!isset($forum['moderators'])) { $notification->push(_("No moderators are associated with this forum."), 'horde.warning'); $url = Agora::setAgoraId($forum_id, $message_id, Horde::url('messages/index.php', true), $scope); header('Location: ' . $url); exit; } /* Get the form object. */ $vars = Horde_Variables::getDefaultVariables(); $form = new Horde_Form($vars, _("Report as abuse")); $form->setButtons(array(_("Report as abuse"), _("Cancel"))); $form->addHidden('', 'agora', 'text', false); $form->addHidden('', 'scope', 'text', false); if ($form->validate()) { $url = Agora::setAgoraId($forum_id, $message_id, Horde::url('messages/index.php', true), $scope); if ($vars->get('submitbutton') == _("Cancel")) { header('Location: ' . $url); exit; } /* Collect moderators emails, and send them the notify */ $emails = array(); foreach ($forum['moderators'] as $moderator) { $identity = $injector->getInstance('Horde_Core_Factory_Identity')->create($moderator); $address = $identity->getValue('from_addr'); if (!empty($address)) { $emails[] = $address;
$message = $messages->getMessage($message_id); if ($message instanceof PEAR_Error) { $notification->push(sprintf(_("Could not open the message. %s"), $message->getMessage()), 'horde.warning'); Horde::url('forums.php', true)->redirect(); } /* Check delete permissions */ if (!$messages->hasPermission(Horde_Perms::DELETE)) { $notification->push(sprintf(_("You don't have permission to delete messages in forum %s."), $forum_id), 'horde.warning'); $url = Agora::setAgoraId($forum_id, $message_id, Horde::url('messages/index.php', true), $scope); header('Location: ' . $url); exit; } /* Get the form object. */ $vars = Horde_Variables::getDefaultVariables(); $form = new Horde_Form($vars, sprintf(_("Locking thread \"%s\""), $message['message_subject'])); $form->setButtons(_("Update"), true); $form->addHidden('', 'agora', 'text', false); $v = $form->addVariable(_("Allow replies in this thread"), 'message_lock', 'radio', true, false, null, array(array('0' => _("Yes, allow replies"), '1' => _("No, do not allow replies")))); $v->setDefault('0'); if ($form->validate()) { $form->getInfo($vars, $info); /* Try and delete this message. */ $result = $messages->setThreadLock($message_id, $info['message_lock']); if ($result instanceof PEAR_Error) { $notification->push(sprintf(_("Could not lock the thread. %s"), $result->getMessage()), 'horde.error'); } else { if ($info['message_lock']) { $notification->push(_("Thread locked."), 'horde.success'); } else { $notification->push(_("Thread unlocked."), 'horde.success'); }
/** * Process an single image (to be called by ajax) * * 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 <*****@*****.**> */ require_once 'tabs.php'; /* Search from */ $form = new Horde_Form($vars); $form->addVariable(_("Face name to search"), 'face_name', 'text', true); $form->setButtons(_("Search")); $page = Horde_Util::getFormData('page', 0); $perpage = $prefs->getValue('facesperpage'); $name = Horde_Util::getFormData('face_name'); if (!empty($name)) { $page = Horde_Util::getFormData('page', 0); $perpage = $prefs->getValue('faceperpage'); $count = $faces->countSearchFaces($name); if ($count) { $results = $faces->searchFaces($name, $page * $perpage, $perpage); } } else { $page = 0; $perpage = 0; $count = 0; }
if ($registry->hasMethod('video/listVideos')) { try { $result = $registry->call('video/listVideos', array(array('author' => $GLOBALS['registry']->getAuth()), 0, 100)); $videos = array(); foreach ($result as $video_id => $video) { $videos[$video_id] = $video['video_title'] . ' - ' . Folks::format_date($video['video_created']); } $video_link = '<a href="' . $registry->link('video/edit') . '">' . _("Upload a new video") . '</a>'; $form->addVariable(_("Video"), 'user_video', 'enum', false, false, $video_link, array($videos, _("--- Select ---"))); } catch (Horde_Exception $e) { $notification->push($e); } } $form->addVariable(_("Description"), 'user_description', 'longtext', false, false, false); $form->addVariable(_("Picture"), 'user_picture', 'image', false); $form->setButtons(array(_("Save"), _("Delete picture"))); if ($form->validate()) { switch (Horde_Util::getFormData('submitbutton')) { case _("Save"): $form->getInfo(null, $info); $info['user_description'] = strip_tags($info['user_description']); $info['user_city'] = strip_tags($info['user_city']); $info['user_url'] = strip_tags($info['user_url']); $result = $folks_driver->saveProfile($info); if ($result instanceof PEAR_Error) { $notification->push($result); } else { $notification->push(_("Your data were successfully updated."), 'horde.success'); if (empty($data['user_picture'])) { $folks_driver->logActivity(_("Updated his/her profile details.")); } else {
$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'); echo '<br />'; $form_security->renderActive(null, null, null, 'post'); $page_output->footer();
$message = $messages->getMessage($message_id); if ($message instanceof PEAR_Error) { $notification->push(sprintf(_("Could not open the message. %s"), $message->getMessage()), 'horde.warning'); Horde::url('forums.php', true)->redirect(); } /* Check delete permissions */ if (!$messages->hasPermission(Horde_Perms::DELETE)) { $notification->push(sprintf(_("You don't have permission to delete messages in forum %s."), $forum_id), 'horde.warning'); $url = Agora::setAgoraId($forum_id, $message_id, Horde::url('messages/index.php', true), $scope); header('Location: ' . $url); exit; } /* Get the form object. */ $vars = Horde_Variables::getDefaultVariables(); $form = new Horde_Form($vars, sprintf(_("Move \"%s\" to another forum"), $message['message_subject'])); $form->setButtons(array(_("Move"), _("Cancel"))); $form->addHidden('', 'agora', 'text', false); $form->addHidden('', 'scope', 'text', false); $forums_list = Agora::formatCategoryTree($messages->getForums(0, false)); $v =& $form->addVariable(_("Forum"), 'new_forum_id', 'enum', true, false, null, array($forums_list)); $v->setDefault($forum_id); /* Validate the form. */ if ($form->validate()) { $form->getInfo($vars, $info); if ($vars->get('submitbutton') == _("Move")) { $move = $messages->moveThread($message_id, $info['new_forum_id']); if ($move instanceof PEAR_Error) { $notification->push($move->getMessage(), 'horde.error'); } else { $notification->push(sprintf(_("Thread %s moved to from forum %s to %s."), $message_id, $forum_id, $info['new_forum_id']), 'horde.success'); header('Location: ' . Agora::setAgoraId($info['new_forum_id'], $message_id, Horde::url('messages/index.php', true), $scope));
* * @author Marko Djukic <*****@*****.**> */ require_once __DIR__ . '/lib/Application.php'; Horde_Registry::appInit('ulaform', array('admin' => true)); $delvars = Horde_Variables::getDefaultVariables(); $form_id = $delvars->get('form_id'); $form_submit = $delvars->get('submitbutton'); /* Set up the forms. */ $ulaform_driver = $injector->getInstance('Ulaform_Factory_Driver')->create(); $viewvars = new Horde_Variables($ulaform_driver->getForm($form_id)); $viewform = new Horde_Form($viewvars, _("Form Details")); $delform = new Horde_Form($delvars, _("Delete this form?")); $viewform->addVariable(_("Name"), 'form_name', 'text', false); $viewform->addVariable(_("Action"), 'form_action', 'email', false); $delform->setButtons(array(_("Delete"), _("Do not delete"))); $delform->addHidden('', 'form_id', 'int', true); if ($form_submit == _("Delete")) { $delform->validate($delvars); if ($delform->isValid()) { $delform->getInfo($delvars, $info); try { $deleteform = $ulaform_driver->deleteForm($info['form_id']); $notification->push(_("Form deleted."), 'horde.success'); Horde::url('forms.php', true)->redirect(); } catch (Ulaform_Exception $e) { $notification->push(sprintf(_("Error deleting form. %s."), $e->getMessage()), 'horde.error'); } } } elseif (!empty($form_submit)) { $notification->push(_("Form has not been deleted."), 'horde.message');
$base_folders = Hylax::getBaseFolders(); $vars = Horde_Variables::getDefaultVariables(); $fax_id = $vars->get('fax_id'); $url = $vars->get('url', 'folder.php'); $fax = $hylax->storage->getFax($fax_id); if (is_a($fax, 'PEAR_Error')) { $notification->push(sprintf(_("Could not open fax ID \"%s\". %s"), $fax_id, $fax->getMessage()), 'horde.error'); Horde::url($url, true)->redirect(); } elseif (!empty($fax['fax_number'])) { $notification->push(sprintf(_("Fax ID \"%s\" already has a fax number set."), $fax_id), 'horde.error'); Horde::url($url, true)->redirect(); } $title = _("Send Fax"); /* Set up the form. */ $form = new Horde_Form($vars, $title); $form->setButtons(_("Send"), true); $form->addHidden('', 'url', 'text', false); $form->addHidden('', 'fax_id', 'int', false); $form->addVariable(_("Fax destination"), 'fax_number', 'text', true, false, null, array('/^\\d+$/')); if ($form->validate($vars)) { $form->getInfo($vars, $info); $send = $hylax->storage->send($info['fax_id'], $info['fax_number']); if (is_a($send, 'PEAR_Error')) { $notification->push(sprintf(_("Could not send fax ID \"%s\". %s"), $info['fax_id'], $send->getMessage()), 'horde.error'); } else { $notification->push(sprintf(_("Fax ID \"%s\" submitted successfully."), $info['fax_id']), 'horde.success'); } Horde::url($url, true)->redirect(); } /* Get the preview pages. */ $pages = Hylax::getPages($fax_id, $fax['fax_pages']);
$form_action = $vars->get('form_action'); /* Get details for this action. */ $actions = Ulaform_Action::getDrivers(); /* Check if user changed action. */ if ($form_action != $old_form_action && $formname) { $changed_action = true; $notification->push(_("Changed action driver."), 'horde.message'); } /* Selected a action so get the info and parameters for this action. */ if ($form_action) { $action_info = Ulaform::getActionInfo($form_action); $action_params = Ulaform::getActionParams($form_action); } /* Set up the form. */ $form = new Horde_Form($vars, _("Form Details")); $form->setButtons(empty($form_id) ? _("Create") : _("Modify"), true); $form->addHidden('', 'form_id', 'int', false); $form->addHidden('', 'old_form_action', 'text', false); $form->addVariable(_("Name"), 'form_name', 'text', true); /* Selectable action drivers and update form based on selection. */ $v = $form->addVariable(_("Action"), 'form_action', 'enum', true, false, null, array(array('' => _("-- select --")) + $actions)); $v->setAction(Horde_Form_Action::factory('submit')); $v->setHelp('form-action'); if (!empty($action_params)) { foreach ($action_params as $id => $param) { $param['required'] = isset($param['required']) ? $param['required'] : true; $param['readonly'] = isset($param['readonly']) ? $param['readonly'] : false; $param['desc'] = isset($param['desc']) ? $param['desc'] : null; $param['params'] = isset($param['params']) ? $param['params'] : null; $form->addVariable($param['label'], 'form_params[' . $id . ']', $param['type'], $param['required'], $param['readonly'], $param['desc'], $param['params']); }
/** * Allows other Horde apps to remove messages. * * The forum name is constructed by just the $forum_name variable * under the data root 'agora.forums.<app>'. It is up to the apps * themselves to make sure that the forum name is unique. * * @access private * * @param string $scope The application which is posting this message. * @param string $forum_name The unique name for the forum. * @param string $callback A callback method of the specified application * that gets called to make sure that posting to * this forum is allowed. * @param array $params Any parameters for the forum message posting. * <pre> * message_id - An existing message to delete * </pre> * @param array $variables A hash with all variables of a submitted form * generated by this method. * * @return mixed Returns either the rendered Horde_Form for posting a message * or PEAR_Error object on error, or true in case of a * successful post. */ public function removeMessage($scope, $forum_name, $callback, $params = array(), $variables = null) { global $registry; /* Check if posting messages is allowed. */ $check = $registry->callByPackage($scope, $callback, array($forum_name)); if ($check instanceof PEAR_Error || !$check) { return ''; } /* Create a separate notification queue. */ $queue = Horde_Notification::singleton('agoraRemoveMessage'); $queue->attach('status'); /* Set up the forums object. */ $forums = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create($scope); $params['forum_id'] = $forums->getForumId($forum_name); if (empty($params['forum_id'])) { return PEAR::raiseError(sprintf(_("Forum %s does not exist."), $forum_name)); } /* Set up the messages control object. */ $messages = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create($scope, $params['forum_id']); if ($messages instanceof PEAR_Error) { PEAR::raiseError(sprintf(_("Could not delete the message. %s"), $messages->getMessage())); } /* Check delete permissions. */ if (!$messages->hasPermission(Horde_Perms::DELETE)) { return PEAR::raiseError(sprintf(_("You don't have permission to delete messages in forum %s."), $params['forum_id'])); } /* Get the message to be deleted. */ $message = $messages->getMessage($params['message_id']); if ($message instanceof PEAR_Error) { return PEAR::raiseError(sprintf(_("Could not delete the message. %s"), $message->getMessage())); } /* Set up the form. */ $vars = new Horde_Variables($variables); $form = new Horde_Form($vars, sprintf(_("Delete \"%s\" and all replies?"), $message['message_subject']), 'delete_agora_message'); $form->setButtons(array(_("Delete"), _("Cancel"))); $form->addHidden('', 'forum_id', 'int', true); $form->addHidden('', 'message_id', 'int', true); if ($form->validate()) { if ($vars->get('submitbutton') == _("Delete")) { $result = $messages->deleteMessage($params['message_id']); if ($result instanceof PEAR_Error) { $queue->push(sprintf(_("Could not delete the message. %s"), $result->getMessage()), 'horde.error'); } else { $queue->push(_("Message deleted."), 'horde.success'); $count = $messages->countMessages(); $registry->callByPackage($scope, $callback, array($forum_name, 'messages', $count)); } } else { $queue->push(_("Message not deleted."), 'horde.message'); } Horde::startBuffer(); $queue->notify(array('listeners' => 'status')); return Horde::endBuffer(); } Horde::startBuffer(); $form->renderActive(null, null, null, 'post', null, false); return Horde::endBuffer(); }
require_once __DIR__ . '/lib/Application.php'; Horde_Registry::appInit('ulaform', array('admin' => true)); /* Get some variables. */ $vars = Horde_Variables::getDefaultVariables(); $formname = $vars->get('formname'); $field_id = $vars->get('field_id'); $form_id = $vars->get('form_id'); $old_field_type = $vars->get('old_field_type'); /* Check if a field is being edited. */ if ($field_id && !$formname) { $vars = $ulaform_driver->getField($form_id, $vars->get('field_id')); $vars = new Horde_Variables($vars); } /* Set up the form. */ $fieldform = new Horde_Form($vars, _("Field Details")); $fieldform->setButtons(_("Save Field")); $fieldform->addHidden('', 'field_id', 'int', false); $fieldform->addHidden('', 'form_id', 'int', false); $fieldform->addHidden('', 'field_order', 'int', false); $fieldform->addHidden('', 'old_field_type', 'text', false); $fieldform->addVariable(_("Label"), 'field_label', 'text', true); $fieldform->addVariable(_("Internal name"), 'field_name', 'text', false, false, _("Set this name if you have a particular reason to override the automatic internal naming of fields.")); /* Set up the field type selection, with a submit action. */ $fields = Ulaform::getFieldTypes(); $v = $fieldform->addVariable(_("Type"), 'field_type', 'enum', true, false, null, array($fields, true)); $v->setAction(Horde_Form_Action::factory('submit')); $v->setOption('trackchange', true); $fieldform->addVariable(_("Required"), 'field_required', 'boolean', false); $fieldform->addVariable(_("Read only"), 'field_readonly', 'boolean', false); $fieldform->addVariable(_("Description"), 'field_desc', 'longtext', false, false, '', array(3, 40)); /* Check if the submitted field type has extra parameters and set them up. */
$formname = $vars->get('formname'); $form_id = $vars->get('form_id'); $type = $vars->get('type'); $old_type = $vars->get('old_type'); /* Check if type has been changed. */ if ($type != $old_type && $formname) { $changed_type = true; $notification->push(_("Changed embed type."), 'horde.message'); } /* Fetch the form details and set a nice title. */ $form_details = $injector->getInstance('Ulaform_Factory_Driver')->create()->getForm($form_id); $title = sprintf(_("HTML Generation for \"%s\""), $form_details['form_name']); $form = new Horde_Form($vars, $title); $form->useToken(false); /* Set up the form. */ $form->setButtons(_("Generate HTML")); $form->addHidden('', 'form_id', 'int', false); $form->addHidden('', 'old_type', 'text', false); $embed_types = array('php_pear' => _("PHP using PEAR classes"), 'iframe' => _("iframe")); $v =& $form->addVariable(_("Select how you wish to embed the form"), 'type', 'enum', true, false, null, array($embed_types, true)); $v->setAction(Horde_Form_Action::factory('submit')); switch ($type) { case 'php_pear': break; case 'iframe': $form->addVariable(_("Name"), 'params[name]', 'text', true, false); $form->addVariable(_("Height"), 'params[height]', 'int', false, false); $form->addVariable(_("Width"), 'params[width]', 'int', false, false); break; } /* Set up the gateway choice fields. */
* @category Horde * @license http://www.horde.org/licenses/lgpl LGPL-2 * @package Horde */ require_once __DIR__ . '/../lib/Application.php'; Horde_Registry::appInit('horde', array('authentication' => 'none')); $vars = $injector->getInstance('Horde_Variables'); // Make sure auth backend allows passwords to be reset. $auth = $injector->getInstance('Horde_Core_Factory_Auth')->create(); if (empty($conf['auth']['resetpassword']) || !$auth->hasCapability('resetpassword')) { $notification->push(_("Cannot reset password automatically, contact your administrator."), 'horde.error'); $registry->getServiceLink('login')->add('url', $vars->url)->redirect(); } $title = _("Reset your password"); $form = new Horde_Form($vars, $title); $form->setButtons(_("Continue")); /* Set up the fields for the username and alternate email. */ $form->addHidden('', 'url', 'text', false); $v =& $form->addVariable(_("Username"), 'username', 'text', true); $v->setOption('trackchange', true); $form->addVariable(_("Alternate email address"), 'email', 'email', true); $can_validate = false; /* If a username has been supplied try fetching the prefs stored info. */ if ($username = $vars->get('username')) { $username = $registry->convertUsername($username, true); $prefs = $injector->getInstance('Horde_Core_Factory_Prefs')->create('horde', array('cache' => false, 'user' => $username)); $email = $prefs->getValue('alternate_email'); /* Does the alternate email stored in prefs match the one submitted? */ if ($vars->get('email') == $email) { $can_validate = true; $form->setButtons(_("Reset Password"));
/** * Process an single image (to be called by 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 <*****@*****.**> */ require_once 'tabs.php'; /* Search from */ $form = new Horde_Form($vars); $msg = _("Please upload photo with the face to search for. You can search only one face at a time."); $form->addVariable(_("Face to search for"), 'image', 'file', true, false, $msg, array(false)); $form->setButtons(_("Upload")); if ($form->validate()) { $form->getInfo(null, $info); $tmp = Horde::getTempDir(); $img = Ansel::getImageObject(); try { $img->loadFile($info['image']['file']); $dimensions = $img->getDimensions(); } catch (Horde_Image_Exception $e) { $notification->push($e->getMessage()); Horde::url('faces/search/image.php')->redirect(); exit; } if ($dimensions['width'] < 50 || $dimensions['height'] < 50) { $notification->push(_("Photo is too small. Search photo must be at least 50x50 pixels.")); Horde::url('faces/search/image.php')->redirect();
<?php /** * Copyright 2007 Obala d.o.o. (http://www.obala.si/) * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.horde.org/licenses/lgpl21. * * @author Duck <*****@*****.**> */ require_once __DIR__ . '/tabs.php'; $vars = Horde_Variables::getDefaultVariables(); $title = _("Forgot your username?"); $form = new Horde_Form($vars, $title); $form->setButtons(_("Send me my username")); $form->addVariable(_("Your email"), 'email', 'email', true); /* Validate the form. */ if ($form->validate()) { $form->getInfo(null, $info); $users = $folks_driver->getUsers(array('email' => $info['email'])); if ($users instanceof PEAR_Error) { $notification->push($users); } elseif (empty($users) || count($users) != 1) { $notification->push(_("Could not find any username with this email."), 'horde.warning'); } else { $users = current($users); $body = sprintf(_("Your username on %s %s is: %s. \n\n It was requested by %s on %s"), $registry->get('name', 'horde'), Horde::url($registry->get('webroot', 'horde'), true), $users['user_uid'], $_SERVER['REMOTE_ADDR'], date('Ymd H:i:s')); Folks::sendMail($info['email'], _("Your username was requested"), $body); $notification->push(sprintf(_("Your username was sent, check your email (%s)."), $users['user_email']), 'horde.success'); throw new Horde_Exception_AuthenticationFailure(); }
require HYLAX_BASE . '/config/covers.php'; /* Get Cover Page template name */ $covers = array(); foreach ($_covers as $id => $cover) { $covers[$id] = $cover['name']; } $tpl = Horde_Util::getFormData('template', 'default'); if (empty($_covers[$tpl])) { throw new Horde_Exception(_("The requested Cover Page does not exist.")); } /* Load Form Actions */ $action = Horde_Form_Action::factory('submit'); /* Create Form */ $vars = Horde_Variables::getDefaultVariables(); $form = new Horde_Form($vars, _("Compose a new Fax"), 'compose'); $form->setButtons(_("Send")); $form->appendButtons(_("Preview")); /* Cover Page section */ $form->addVariable(_("Cover Page"), 'fromhdr', 'header', false); $form->addVariable(_("Template"), 'template', 'enum', true, false, null, array($covers)); $form->addVariable(_("Fax Number"), 'faxnum', 'text', true); $form->addVariable(_("Name"), 'name', 'text', false); $form->addVariable(_("Company"), 'company', 'text', false); $form->addVariable(_("Subject"), 'subject', 'text', false, false, null, array(false, 60)); $form->addVariable(_("Comment"), 'comment', 'longtext', false, false, null, array(4, 80)); /* Set up template. */ $template = $injector->createInstance('Horde_Template'); $template->set('form', ''); $template->set('menu', Hylax::getMenu('string')); Horde::startBuffer(); $notification->notify(array('listeners' => 'status'));
if (!$forums->hasPermission(Horde_Perms::DELETE)) { $notification->push(sprintf(_("You don't have permissions to delete forums in %s"), $registry->get('name', $scope)), 'horde.warning'); Horde::url('forums.php', true)->redirect(); } /* Get forum. */ list($forum_id) = Agora::getAgoraId(); $forum = $forums->getForum($forum_id); if ($forum instanceof PEAR_Error) { $notification->push($forum->message, 'horde.error'); Horde::url('forums.php', true)->redirect(); } /* Prepare forum. */ $vars = Horde_Variables::getDefaultVariables(); $form = new Horde_Form($vars, _("Delete Forum")); // TODO Cancel button doesn't work currently, because it has no condition set $form->setButtons(array(_("Delete"), _("Cancel"))); $form->addHidden('', 'forum_id', 'int', $forum_id); $form->addHidden('', 'scope', 'text', $scope); $form->addVariable(_("This will delete the forum, any subforums and all relative messages."), 'prompt', 'description', false); $form->addVariable(_("Forum name"), 'forum_name', 'text', false, true); $vars->set('forum_name', $forum['forum_name']); $vars->set('forum_id', $forum_id); /* Get a list of available forums. */ $forums_list = Agora::formatCategoryTree($forums->getForums($forum_id, false, null, null)); if (!empty($forums_list)) { $html = implode('<br />', $forums_list); $form->addVariable(_("Subforums"), 'subforums', 'html', false, true); $vars->set('subforums', $html); } /* Process delete. */ if ($form->validate()) {
$ftpform = ''; if ($session->get('horde', 'config/')) { $url = Horde::url('admin/config/diff.php'); $action = _("Show differences between currently saved and the newly generated configuration."); $actions[] = array('icon' => Horde_Themes_Image::tag('search.png', array('attr' => array('align' => 'middle'))), 'link' => Horde::link('#', '', '', '', Horde::popupJs($url, array('height' => 480, 'width' => 640, 'urlencode' => true)) . 'return false;') . $action . '</a>'); /* Action to download the configuration upgrade PHP script. */ $url = Horde::url('admin/config/scripts.php')->add(array('setup' => 'conf', 'type' => 'php')); $action = _("Download generated configuration as PHP script."); $actions[] = array('icon' => Horde_Themes_Image::tag('download.png', array('attr' => array('align' => 'middle'))), 'link' => Horde::link($url) . $action . '</a>'); /* Action to save the configuration upgrade PHP script. */ $action = _("Save generated configuration as a PHP script to your server's temporary directory."); $actions[] = array('icon' => Horde_Themes_Image::tag('save.png', array('attr' => array('align' => 'middle'))), 'link' => Horde::link($url->add('save', 'tmp')) . $action . '</a>'); /* Set up the form for FTP upload of scripts. */ $vars = Horde_Variables::getDefaultVariables(); $ftpform = new Horde_Form($vars); $ftpform->setButtons(_("Upload"), true); $ftpform->addVariable(_("Username"), 'username', 'text', true, false, null, array('', 20)); $ftpform->addVariable(_("Password"), 'password', 'password', false); if ($ftpform->validate($vars)) { $ftpform->getInfo($vars, $info); $upload = _uploadFTP($info); if ($upload) { $notification->push(_("Uploaded all application configuration files to the server."), 'horde.success'); Horde::url('admin/config/index.php', true)->redirect(); } } /* Render the form. */ Horde::startBuffer(); $ftpform->renderActive(new Horde_Form_Renderer(), $vars, Horde::url('admin/config/index.php'), 'post'); $ftpform = Horde::endBuffer(); }