Handles post from the "Add room" form on the homepage, and
    redirects to the new room.
16022
def create(request):
    
    name = request.POST.get("name")
    if name:
        room, created = ChatRoom.objects.get_or_create(name=name)
        return redirect(room)
    return redirect(rooms)
1239452
protected function addAddress()
    {
        if (!$this->isError()) {

            $id = $this->address->add($this->getSubmitted());

            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }

            $this->line($id);
        }
    }
2609
protected function submitAddReview()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->validateComponent('review');
        $this->addReview();
    }
48907
public function changePositionAction()
    {
        $request = $this->getRequest();
        if ($request->isXmlHttpRequest())
        {
            $em = $this->getDoctrine()->getManager();
            $pageRepository = $this->getDoctrine()->getRepository('FulgurioLightCMSBundle:Page');
            $page = $this->getPage($request->request->get('pageId'));
            $parentId = $request->request->get('parentId');
            $position = $request->request->get('position');
            if ($parentId != $page->getParent()->getId())
            {
                $pageRepository->downPagesPosition($parentId, $position);
                $pageRepository->upPagesPosition($page->getParent(), $page->getPosition() + 1);
                $page->setParent($pageRepository->find($parentId));
                $models = $this->container->getParameter('fulgurio_light_cms.models');
                $formHandlerClassName = isset($models[$page->getModel()]['back']['handler']) ? $models[$page->getModel()]['back']['handler'] : '\Fulgurio\LightCMSBundle\Form\Handler\AdminPageHandler';
                $formHandler = new $formHandlerClassName();
                $formHandler->setDoctrine($this->getDoctrine());
                $formHandler->makeFullpath($page);
                $em->persist($page);
                $em->flush();
            }
            else
            {
                if ($position > $page->getPosition())
                {
                    $pageRepository->upPagesPosition($page->getParent(), $page->getPosition() + 1, $position - 1);
                    --$position;
                }
                else
                {
                    $pageRepository->downPagesPosition($page->getParent(), $position, $page->getPosition() - 1);
                }
            }
            $page->setPosition($position);
            $em->persist($page);
            $em->flush();
            $response = new Response(json_encode(array('code' => 42)));
            $response->headers->set('Content-Type', 'application/json');
            return $response;
        }
        throw new AccessDeniedException();
    }
358933
private function redirectPost()
    {
        if (!isset($_SERVER['REQUEST_URI'])) {
            return;
        }
        if (!isset($_SERVER['REQUEST_METHOD']) || $_SERVER['REQUEST_METHOD'] != 'POST') {
            return;
        }
        if (!$this->cfg['prg']) {
            return;
        }
        if (!$this->status['submitted']) {
            return;
        }
        $this->debug->log('redirecting');
        $event = $this->eventManager->publish('page.redirect', null, array('location' => $_SERVER['REQUEST_URI']));
        $location = $event['location'];
        $this->debug->log('%cLocation:%c <a href="%s">%s</a>', 'font-weight:bold;', '', $location, $location);
        if (\headers_sent($file, $line)) {
            $this->debug->warn('headers alrady sent from '.$file.' line '.$line);
            return;
        }
        if ($event->isPropagationStopped()) {
            $this->debug->alert('<i class="fa fa-external-link fa-lg" aria-hidden="true"></i> Location: <a class="alert-link" href="'.\htmlspecialchars($location).'">'.\htmlspecialchars($location).'</a>', 'info');
        } else {
            \header('Location: '.$location);
        }
        throw new \Exception('exit');
    }
37068
public function Homepage() {
      $this->Permission('Garden.Settings.Manage');
      
      // Page setup
      $this->AddSideMenu('dashboard/settings/homepage');
      $this->Title(T('Homepage'));
      
      $CurrentRoute = GetValue('Destination', Gdn::Router()->GetRoute('DefaultController'), '');
      $this->SetData('CurrentTarget', $CurrentRoute);
      if (!$this->Form->AuthenticatedPostBack()) {
         $this->Form->SetData(array(
            'Target' => $CurrentRoute
         ));
      } else {
         $NewRoute = GetValue('Target', $this->Form->FormValues(), '');
         Gdn::Router()->DeleteRoute('DefaultController');
         Gdn::Router()->SetRoute('DefaultController', $NewRoute, 'Internal');
         $this->SetData('CurrentTarget', $NewRoute);
         
         // Save the preferred layout setting
         SaveToConfig(array(
            'Vanilla.Discussions.Layout' => GetValue('DiscussionsLayout', $this->Form->FormValues(), ''),
            'Vanilla.Categories.Layout' => GetValue('CategoriesLayout', $this->Form->FormValues(), '')
         ));
         
         $this->InformMessage(T("Your changes were saved successfully."));
      }
      
      $this->Render();      
   }
219293
private function handle_add_network() {
		$options_to_clone = filter_input( INPUT_POST, 'options_to_clone', FILTER_FORCE_ARRAY );
		if ( ! empty( $options_to_clone ) ) {
			$options_to_clone = array_keys( $options_to_clone );
		} else {
			$options_to_clone = array_keys( network_options_to_copy() );
		}

		$clone = filter_input( INPUT_POST, 'clone_network', FILTER_SANITIZE_NUMBER_INT );
		if ( empty( $clone ) ) {
			$clone = get_current_site()->id;
		}

		$network_title  = wp_unslash( filter_input( INPUT_POST, 'title', FILTER_SANITIZE_STRING ) );
		$network_domain = wp_unslash( filter_input( INPUT_POST, 'domain', FILTER_SANITIZE_STRING ) );
		$network_path   = wp_unslash( filter_input( INPUT_POST, 'path', FILTER_SANITIZE_STRING ) );
		$site_name      = wp_unslash( filter_input( INPUT_POST, 'new_site', FILTER_SANITIZE_STRING ) );

		$network_title  = strip_tags( $network_title );
		$network_domain = str_replace( ' ', '', strtolower( sanitize_text_field( $network_domain ) ) );
		$network_path   = str_replace( ' ', '', strtolower( sanitize_text_field( $network_path ) ) );
		$site_name      = ! empty( $site_name ) ? strip_tags( $site_name ) : $network_title;

		// Bail if missing fields.
		if ( empty( $network_title ) || empty( $network_domain ) || empty( $network_path ) ) {
			$this->handle_redirect( array(
				'page'            => 'add-new-network',
				'network_created' => '0',
			) );
		}

		$result  = add_network( array(
			'domain'           => $network_domain,
			'path'             => $network_path,
			'site_name'        => $site_name,
			'user_id'          => get_current_user_id(),
			'clone_network'    => $clone,
			'options_to_clone' => $options_to_clone,
		) );
		$success = '0';

		if ( ! empty( $result ) && ! is_wp_error( $result ) ) {
			if ( ! empty( $posted['title'] ) ) {
				update_network_option( $result, 'site_name', $posted['title'] );
			}

			update_network_option( $result, 'active_sitewide_plugins', array(
				'wp-multi-network/wpmn-loader.php' => time(),
			) );

			$success = '1';
		}

		$this->handle_redirect( array(
			'network_created' => $success,
		) );
	}
795580
def _add_request_entry(self, entry=()):
        
        if not self._lookup_request_entry(entry):
            self.request_entry.append(entry)
1087302
def render_done(self, form, **kwargs):
        
        if kwargs.get('step', None) != self.done_step_name:
            return redirect(self.url_name, step=self.done_step_name)
        return super(NamedUrlWizardView, self).render_done(form, **kwargs)
1079275
private void onClickAdd() {

        if (m_currentLocation.isPresent()) {
            CmsFavoriteEntry entry = m_currentLocation.get();
            List<CmsFavoriteEntry> entries = getEntries();
            entries.add(entry);
            try {
                m_favDao.saveFavorites(entries);
            } catch (Exception e) {
                CmsErrorDialog.showErrorDialog(e);
            }
            m_context.close();
        }
    }
154561
def add_entry(id, title, updated, link, options={})
      entries << {
        :id => id,
        :title => title,
        :updated => updated,
        :link => link
        }.merge(options)
    end
99070
public function add()
    {
        $cmsTerm = $this->CmsTerm->newEntity();
        if ($this->request->is('post')) {
            $cmsTerm = $this->CmsTerm->patchEntity($cmsTerm, $this->request->data);
            if ($this->CmsTerm->save($cmsTerm)) {
                $this->Flash->success('The cms term has been saved.');
                return $this->redirect(['action' => 'index']);
            } else {
                $this->Flash->error('The cms term could not be saved. Please, try again.');
            }
        }
        $this->set(compact('cmsTerm'));
        $this->set('_serialize', ['cmsTerm']);
    }
389686
void submit() {

        String siteRoot = (String)m_siteComboBox.getValue();
        if (!m_context.getCms().getRequestContext().getSiteRoot().equals(siteRoot)) {
            A_CmsUI.get().changeSite(siteRoot);
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(siteRoot) || OpenCms.getSiteManager().isSharedFolder(siteRoot)) {
                // switch to explorer view when selecting shared or root site

                Page.getCurrent().open(CmsCoreService.getFileExplorerLink(A_CmsUI.getCmsObject(), siteRoot), "_top");
                return;
            }
        } else {
            siteRoot = null;
        }
        m_context.finish(null, siteRoot);
    }
1193908
public function addAction()
    {
        $isPosted = $this->request->getPost('doCreate');
        
        if (!$isPosted) {
            $this->response->redirect($this->request->getPost('redirect'));
        }

        $comment = [
            'content'   => $this->request->getPost('content'),
            'name'      => $this->request->getPost('name'),
            'web'       => $this->request->getPost('web'),
            'mail'      => $this->request->getPost('mail'),
            'timestamp' => time(),
            'ip'        => $this->request->getServer('REMOTE_ADDR'),
        ];

        $comments = new \Phpmvc\Comment\CommentsInSession();
        $comments->setDI($this->di);

        $comments->add($comment);

        $this->response->redirect($this->request->getPost('redirect'));
    }
1347619
public function actionAdd() 
	{
		$model=new OmmuPages;

		// Uncomment the following line if AJAX validation is needed
		$this->performAjaxValidation($model);

		if(isset($_POST['OmmuPages'])) {
			$model->attributes=$_POST['OmmuPages'];
			
			if($model->save()) {
				Yii::app()->user->setFlash('success', Yii::t('phrase', 'Pages success created.'));
				$this->redirect(array('manage'));
			}
		}

		$this->pageTitle = Yii::t('phrase', 'Add Page');
		$this->pageDescription = '';
		$this->pageMeta = '';
		$this->render('admin_add', array(
			'model'=>$model,
		));
	}
63726
def move_page(request, page_id, extra_context=None):
    """"""
    page = Page.objects.get(pk=page_id)

    target = request.POST.get('target', None)
    position = request.POST.get('position', None)
    if target is not None and position is not None:
        try:
            target = Page.objects.get(pk=target)
        except Page.DoesNotExist:
            pass
            # TODO: should use the django message system
            # to display this message
            # _('Page could not been moved.')
        else:
            page.invalidate()
            target.invalidate()
            from mptt.exceptions import InvalidMove
            invalid_move = False
            try:
                page.move_to(target, position)
            except InvalidMove:
                invalid_move = True
            return list_pages_ajax(request, invalid_move)
    return HttpResponseRedirect('../../')
715151
public function add()
    {
        $backup = new BackupForm;

        if ($this->request->is('post')) {
            //Creates the backup
            if ($backup->execute($this->request->getData())) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('backup'));
    }