Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
public function actionCreate($type) { $model = new Content(); $model->permission = 1; $model->keywords_uz = [14]; $model->keywords_ru = [15]; $model->keywords_en = [16]; $model->views = 0; if($model->load(Yii::$app->request->post())){ if($model->id == null){ $model->id = Content::find()->orderBy(['id' => SORT_DESC])->one()->id + rand(10, 20); } $frontend = Yii::getAlias("@frontend") . '/web/upload/cover-images/'; $image_uz = UploadedFile::getInstance($model, 'image_uz'); $image_ru = UploadedFile::getInstance($model, 'image_ru'); $image_en = UploadedFile::getInstance($model, 'image_en'); $img_uz = $this->getUniqName(); $img_ru = $this->getUniqName(); $img_en = $this->getUniqName(); $imagine_uz = Image::getImagine(); $imagine_ru = Image::getImagine(); $imagine_en = Image::getImagine(); if($model->has_uz){ if($image_uz && $image_uz != null && $image_uz != ''){ if(file_exists($frontend . $img_uz . '.' . $image_uz->extension)){ unlink($frontend . $img_uz . '.' . $image_uz->extension); } Image::crop($image_uz->tempName, 1200, 627)->save($frontend . $img_uz . '.' . $image_uz->extension, ['quality' => 100]); $model->image_uz = $img_uz . '.' . $image_uz->extension; } } else{ $model->url_uz = null; $model->desc_uz = null; $model->image_uz = null; $model->title_uz = null; $model->content_uz = null; } if($model->has_ru){ if($image_ru && $image_ru != null && $image_ru != ''){ if(file_exists($frontend . $img_ru . '.' . $image_ru->extension)){ unlink($frontend . $img_ru . '.' . $image_ru->extension); } Image::crop($image_ru->tempName, 1200, 627)->save($frontend . $img_ru . '.' . $image_ru->extension, ['quality' => 100]); $model->image_ru = $img_ru . '.' . $image_ru->extension; } } else{ $model->url_ru = null; $model->desc_ru = null; $model->image_ru = null; $model->title_ru = null; $model->content_ru = null; } if($model->has_en){ if($image_en && $image_en != null && $image_en != ''){ if(file_exists($frontend . $img_en . '.' . $image_en->extension)){ unlink($frontend . $img_en . '.' . $image_en->extension); } Image::crop($image_en->tempName, 1200, 627)->save($frontend . $img_en . '.' . $image_en->extension, ['quality' => 100]); $model->image_en = $img_en . '.' . $image_en->extension; } } else{ $model->url_en = null; $model->desc_en = null; $model->image_en = null; $model->title_en = null; $model->content_en = null; } $model->content_type = ContentType::getId($type); $model->modified = time(); $model->created_at = time(); $model->created_by = Yii::$app->user->identity->id; $model->modified_by = Yii::$app->user->identity->id; $model->status = StatusType::getId('inactive'); $model->keywords_uz = json_encode($model->keywords_uz); $model->keywords_ru = json_encode($model->keywords_ru); $model->keywords_en = json_encode($model->keywords_en); $model->shared = 0; if($type == 'pages'){ $model->created = time(); } else{ $model->created = strtotime($model->created); } if($model->content_type == ContentType::getId('agenda')){ $model->alias = '' . date('Y-m-d', $model->created) . '-' . $model->id; $model->permission = ContentPermission::getId('moderator'); $model->execution_time = $model->created; } else if($model->content_type == ContentType::getId('handouts')){ $model->alias = '' . date('Y-m-d', $model->created) . '-' . $model->id; $model->permission = ContentPermission::getId('moderator'); $model->execution_time = $model->created; } if($model->alias == '')$model->alias = null; if(($model->has_uz == 1 || $model->has_ru == 1 || $model->has_en == 1) && $model->save()){ $model->setGalleryContent(); if($model->hasAlias()){ return $this->redirect(['view-by', 'alias' => $model->alias, 'type' => $type]); } else { return $this->redirect(['view', 'id' => $model->id, 'type' => $type]); } } } $model->has_uz = 0; $model->has_ru = 0; $model->has_en = 0; return $this->render('create', [ 'model' => $model, 'type' => $type ]); }
[Sat Feb 17 11:09:45.051404 2024] [proxy_fcgi:error] [pid 3603429:tid 140457417885376] (70007)The timeout specified has expired: [client 213.230.124.180:0] AH01075: Error dispatching request to : (polling), referer: https://