Zaloha
@throws AbortException
@throws BadRequestException
328996
public function handleBackup(): void
	{
		$this->checkHandlerPermission(false);

		$file = $this->app->backup();
		$this->presenter->sendResponse(new FileResponse($file, 'backup.zip'));
	}
1164709
public function handleDeleteAllImages(): void
	{
		if ($this->request->isAjax()) {
			$result = $this->getStorage()->delete();
			foreach ($result as $row) {
				$this->imageStorage->delete($row);
			}

			$this->redrawControl('gallery');
		} else {
			throw new AbortException;
		}
	}
355509
private void badRequest(HttpServletResponse res) throws IOException {
		res.setContentType("text/html");
		PrintWriter pw = res.getWriter();
		pw.write(BAD_REQUEST);
		pw.close();
	}
162112
public function disableSorting(): void
    {
        if ($this->request->getQueryParam("sort") !== null) {
            throw $this->exceptionFactory->createSortingUnsupportedException($this->request);
        }
    }
100689
private void abort(Error error) {
    try {
      if (mContext == null || mContext.getError() != null || mContext.isDoneUnsafe()) {
        // Note, we may reach here via events due to network errors bubbling up before
        // mContext is initialized, or stream error after the request is finished.
        return;
      }
      mContext.setError(error);
      cleanupRequest(mContext);
      replyError();
    } catch (Exception e) {
      LOG.warn("Failed to cleanup states with error {}.", e.getMessage());
    }
  }
574688
private void abort(List<TransactionableResourceManagerListener> listeners) throws XAException
   {
      boolean exception = false;
      for (int i = 0, length = listeners.size(); i < length; i++)
      {
         TransactionableResourceManagerListener listener = listeners.get(i);
         try
         {
            listener.onAbort();
         }
         catch (Exception e)
         {
            log.error("Could not execute the method onAbort", e);
            exception = true;
         }
      }
      if (exception)
      {
         throw new XAException(XAException.XAER_RMERR);
      }
   }
1169769
protected function validateMoveRequest()
    {
        if (!$this->isRequestPost()) {
            throw new common_exception_MethodNotAllowed('Only POST method is allowed to move instances.');
        }

        if (!$this->hasRequestParameter('destinationClassUri')) {
            throw new InvalidArgumentException('Destination class must be specified');
        }

        $destinationClass = new \core_kernel_classes_Class($this->getRequestParameter('destinationClassUri'));
        if (!$destinationClass->isClass()) {
            throw new InvalidArgumentException('Destination class must be a valid class');
        }
    }
729269
protected function handlePOST()
    {
        /** @var BaseSystemModel $modelClass */
        $modelClass = static::$model;

        if (!empty($this->resource)) {
            throw new BadRequestException('Create record by identifier not currently supported.');
        }

        $records = ResourcesWrapper::unwrapResources($this->getPayloadData());
        if (empty($records)) {
            throw new BadRequestException('No record(s) detected in request.' . ResourcesWrapper::getWrapperMsg());
        }

        $result = $modelClass::bulkCreate($records, $this->request->getParameters());

        $asList = $this->request->getParameterAsBool(ApiOptions::AS_LIST);
        $idField = $this->request->getParameter(ApiOptions::ID_FIELD, static::getResourceIdentifier());
        $result = ResourcesWrapper::cleanResources($result, $asList, $idField, ApiOptions::FIELDS_ALL);

        return ResponseFactory::create($result, null, ServiceResponseInterface::HTTP_CREATED);
    }
787230
protected function _checkRequestMethods()
    {
        if ($this->_request()->is('put')) {
            throw new BadRequestException('JSON API does not support the PUT method, use PATCH instead');
        }

        if (!$this->_request()->contentType()) {
            return true;
        }

        $jsonApiMimeType = $this->_response()->getMimeType('jsonapi');

        if ($this->_request()->contentType() !== $jsonApiMimeType) {
            throw new BadRequestException("JSON API requests with data require the \"$jsonApiMimeType\" Content-Type header");
        }

        return true;
    }
1132161
public function block() : void
    {
        if ($this->onlineIdParameter() === 'me') return;

        $this->post(sprintf(self::USERS_ENDPOINT . 'blockList/%s', $this->client->onlineId(), $this->onlineId()), null);
    }
680170
public static void onRequestEnd ()
  {
    final IRequestScope aRequestScope = getRequestScopeOrNull ();
    try
    {
      // Do we have something to destroy?
      if (aRequestScope != null)
      {
        _destroyRequestScope (aRequestScope);
      }
      else
      {
        // Happens after an internal redirect happened in a web-application
        // (e.g. for 404 page) for the original scope
        LOGGER.warn ("No request scope present that could be ended!");
      }
    }
    finally
    {
      // Remove from ThreadLocal
      internalClearRequestScope ();
    }
  }
100629
void abort() throws SQLException {
        if (mRegisteredLobs != null) {
            for (JDBCLob lob : mRegisteredLobs) {
                lob.close();
            }
            mRegisteredLobs = null;
        }

        if (mIsNested) {
            if (mReady) {
                if (mSavepoint != null) {
                    mConnection.rollback(mSavepoint);
                    mSavepoint = null;
                }
                mReady = false;
            }

            if (mOriginalLevel != LEVEL_NOT_CHANGED) {
                if (mOriginalLevel == Connection.TRANSACTION_NONE) {
                    mConnection.setAutoCommit(true);
                } else {
                    mConnection.setTransactionIsolation(mOriginalLevel);
                }
            }

        } else {
            if (mReady) {
                mConnection.rollback();
                mReady = false;
            }
        }
    }
1177199
public void abort(int slot) {
		try {
			HttpGet httpGet = httpGets.get(slot);
			httpGet.abort();
			abortListeners(httpGet.getURI().toString());
		} catch(Exception e) {
			log.error(e.getMessage());
		}
	}
371516
void abortResponse(Throwable cause) {
        isResponseAborted = true;
        // Try to close the request first, then abort the response if it is already closed.
        if (!tryClose(cause) &&
            response != null && !response.isComplete()) {
            response.abort();
        }
    }
1340551
function abort (err, stream, db, cb) {
  debug('aborting with error: ' + err);
  stream.destroy();
  db.close(function () {
    cb(err);
  })
}
1184722
public function run()
    {
        $id = yii::$app->getRequest()->get($this->paramSign, null);
        if (! $id) throw new BadRequestHttpException(yii::t('app', "{$this->paramSign} doesn't exit"));
        /* @var $model yii\db\ActiveRecord */
        $model = call_user_func([$this->modelClass, 'findOne'], $id);
        if (! $model) throw new BadRequestHttpException(yii::t('app', "Cannot find model by $id"));
        $model->setScenario( $this->scenario );

        if (yii::$app->getRequest()->getIsPost()) {
            if ($model->load(Yii::$app->getRequest()->post()) && $model->save()) {
                if( yii::$app->getRequest()->getIsAjax() ){
                    yii::$app->getSession()->setFlash('success', yii::t('app', 'Update Success'));
                    return [];
                }else {
                    yii::$app->getSession()->setFlash('success', yii::t('app', 'Update Success'));
                    if( $this->successRedirect ) return $this->controller->redirect($this->successRedirect);
                    return $this->controller->refresh();
                }
            } else {
                $errors = $model->getErrors();
                $err = '';
                foreach ($errors as $v) {
                    $err .= $v[0] . '<br>';
                }
                if( yii::$app->getRequest()->getIsAjax() ){
                    throw new UnprocessableEntityHttpException($err);
                }else {
                    yii::$app->getSession()->setFlash('error', $err);
                }
                $model = call_user_func([$this->modelClass, 'findOne'], $id);
            }
        }

        $this->viewFile === null && $this->viewFile = $this->id;
        $data = [
            'model' => $model,
        ];
        if( is_array($this->data) ){
            $data = array_merge($data, $this->data);
        }elseif ($this->data instanceof \Closure){
            $data = call_user_func_array($this->data, [$model, $this]);
        }
        return $this->controller->render($this->viewFile, $data);
    }
531203
public function sort()
    {
        if (!$this->request->is('ajax') || !$this->request->is('post')) {
            throw new MethodNotAllowedException();
        }
        if (empty($this->request->data)) {
            throw new BadRequestException();
        }

        // save the new language positions
        $languages = $this->Languages->patchEntities(
            $this->Languages->find('allFrontendBackend'),
            $this->request->data
        );
        /** @var Connection $connection */
        $connection = $this->Languages->connection();
        $connection->begin();
        foreach ($languages as $language) {
            if (!$this->Languages->save($language)) {
                $connection->rollback();
                break;
            }
        }
        if ($connection->inTransaction()) {
            $connection->commit();
            $status = 'success';
            $flashMessage = __d('wasabi_core', 'The language position has been updated.');
        } else {
            $status = 'error';
            $flashMessage = $this->dbErrorMessage;
        }

        // create the json response
        $frontendLanguages = $this->Languages
            ->filterFrontend(new Collection($languages))
            ->sortBy('position', SORT_ASC, SORT_NUMERIC)
            ->toList();
        $backendLanguages = $this->Languages
            ->filterBackend(new Collection($languages))
            ->sortBy('position', SORT_ASC, SORT_NUMERIC)
            ->toList();

        $this->set(compact('status', 'flashMessage', 'frontendLanguages', 'backendLanguages'));
        $this->set('_serialize', ['status', 'flashMessage', 'frontendLanguages', 'backendLanguages']);

        $this->RequestHandler->renderAs($this, 'json');
    }