Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeks-semenov committed Mar 27, 2024
1 parent 3789119 commit 8a961a0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/components/imaging/filters/Thumbnail.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public function init()
if (!$this->w && !$this->h) {
throw new Exception("Необходимо указать ширину или высоту");
}

if (!$this->m) {
$this->m = ManipulatorInterface::THUMBNAIL_INSET;
}

$q = (int)$this->q;
if (!$q) {
Expand Down
13 changes: 13 additions & 0 deletions src/controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ public function behaviors()
'class' => VerbFilter::className(),
'actions' => [
'logout' => ['post'],
'auth-by-callcheck-phone-password' => ['post'],
'auth-by-phone' => ['post'],
'auth-by-callcheck-phone' => ['post'],
'auth-by-phone-password' => ['post'],
'auth-by-phone-sms-code' => ['post'],
'auth-by-callcheck-phone-code' => ['post'],
'auth-by-email-code' => ['post'],
'generate-phone-code' => ['post'],
'generate-callcheck-phone-code' => ['post'],
'generate-email-code' => ['post'],
'generate-email-code' => ['post'],
],
],
];
Expand Down Expand Up @@ -606,6 +617,7 @@ public function actionAuthByCallcheckPhone()
public function actionAuthByPhonePassword()
{
$rr = new RequestResponse();
$rr->setResponseFormatJson();

//Запрос ajax post
if ($rr->isRequestAjaxPost() && \Yii::$app->user->isGuest) {
Expand Down Expand Up @@ -660,6 +672,7 @@ public function actionAuthByPhonePassword()
public function actionAuthByCallcheckPhonePassword()
{
$rr = new RequestResponse();
$rr->setResponseFormatJson();

//Запрос ajax post
if ($rr->isRequestAjaxPost() && \Yii::$app->user->isGuest) {
Expand Down
15 changes: 9 additions & 6 deletions src/controllers/ImagePreviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function actionProcess()
$imaging = \Yii::$app->imaging;
if (!$imaging) {
//TODO: можно добавить проверку YII ensure...
throw new \yii\base\Exception("Component Imaging not found");
throw new NotFoundHttpException("Component Imaging not found");
}

$newFileSrc = \Yii::$app->request->getPathInfo();
Expand All @@ -55,12 +55,12 @@ public function actionProcess()


if (!$extension) {
throw new \yii\base\Exception("Extension not found: ".$newFileSrc);
throw new NotFoundHttpException("Extension not found: ".$newFileSrc);
}


if (!$imaging->isAllowExtension($extension)) {
throw new \yii\base\Exception("Extension '{$extension}' not supported in Imaging component");
throw new NotFoundHttpException("Extension '{$extension}' not supported in Imaging component");
}


Expand Down Expand Up @@ -99,12 +99,12 @@ public function actionProcess()
if ($params = \Yii::$app->request->get()) {
$pramsCheckArray = explode(DIRECTORY_SEPARATOR, $filterSting);
if (count($pramsCheckArray) < 3) {
throw new \yii\base\Exception("the control line not found: ".$newFileSrc);
throw new NotFoundHttpException("the control line not found: ".$newFileSrc);
}

$string = $imaging->getParamsCheckString($params);
if ($pramsCheckArray[1] != $string) {
throw new \yii\base\Exception("Parameters invalid: ".$newFileSrc);
throw new NotFoundHttpException("Parameters invalid: ".$newFileSrc);
}
}

Expand All @@ -114,7 +114,7 @@ public function actionProcess()


if (!class_exists($filterClass)) {
throw new \ErrorException("Filter class is not created: ".$newFileSrc);
throw new NotFoundHttpException("Filter class is not created: ".$newFileSrc);
}

ArrayHelper::remove($params, "ext");
Expand All @@ -134,6 +134,9 @@ public function actionProcess()


try {
/*if (YII_ENV_DEV) {
print_r($filter);die;
}*/
//Проверяем а создан ли уже файл, и если да то просто делаем на него ссылку.
$filter
->setOriginalRootFilePath($originalFileRoot)
Expand Down

0 comments on commit 8a961a0

Please sign in to comment.