amic 1 mese fa
parent
commit
3bd2af082b

+ 11 - 8
models/base/Image.php

@@ -80,6 +80,17 @@ class Image extends Model
 
 	public function getSomebody($one, $type){
 		$f = false;
+// Повторное изображение из другой новости
+		if( isset( $this->photo_name ) && $this->photo_name != '' ){
+			if(  is_numeric( $this->photo_name  ) && is_int( $this->photo_name*1 ) ){
+				$obj = new image();
+				$obj = $obj->findOne($this->photo_name*1);
+				return $obj->getUrl($one, $type, false);
+			}
+			return $this->photo_name;
+		}
+//
+
 		foreach( self::PREFIX_IMG as $key => $pref ){
 			$key = str_replace( '_', '', $key );
 			if( $key == $one ) $f = true;
@@ -103,14 +114,6 @@ class Image extends Model
 			}
 			if( $type == 'jpg' && file_exists(\Yii::getAlias('@webroot')."/images/news/news/{$this->post_id}_{$pref}.jpg")  )  return "/images/news/news/{$this->post_id}_{$pref}.jpg";
 		}
-		if( isset( $this->photo_name ) && $this->photo_name != '' ){
-			if(  is_numeric( $this->photo_name  ) && is_int( $this->photo_name*1 ) ){
-				$obj = new image();
-				$obj = $obj->findOne($this->photo_name*1);
-				return $obj->getUrl($one, $type, false);
-			}
-			return $this->photo_name;
-		}
 		return false;
 	}
     public function getIcon(){

+ 5 - 1
modules/manager/controllers/NewsController.php

@@ -379,7 +379,11 @@ class NewsController extends BaseController
 		$post['dt_pub'] = date("Y-m-d H:i:s", strtotime($post['dt_pub']));
 		$post['alias'] = (isset($post['alias']) && trim( $post['alias'] ) != '' && $post['active'] == 'Y')?$post['alias']:Transliterator::toUrl($post['title']);
 		$post['editors'] = $post['editors'].(($post['editors'])?',':'').$profile->name;
-		$post['photo_name'] = isset($post['photo_name'])?$post['photo_name']:'';
+		if( isset($_FILES['News']) && is_uploaded_file($_FILES['News']['tmp_name']['photo']) ){
+			$post['photo_name'] = '';
+		}else{
+			$post['photo_name'] = isset($post['photo_name'])?$post['photo_name']:'';
+		}
 		$post['flags'] = isset($post['nofirst'])?1:0;
 		$post['flags'] = $post['flags'] | (isset($post['photoamic'])?2:0);
 

+ 2 - 0
views/_etc/banners/adfinityInContent.php

@@ -1,4 +1,5 @@
 <?php
+/*
 ?>
 <style>
     @media screen and (min-device-width: 900px) {
@@ -11,6 +12,7 @@
 	<div class='adfinity_block_2416'></div>
 </div>
 <?
+*/
 /*
  *
 		<div style="min-height: 300px;" class="adfox_placeholder"></div>

+ 1 - 1
web/turbo-del.xml

@@ -13,7 +13,7 @@
       <link>https://www.amic.ru/long/460916/</link>
     </item>
     <item turbo="false">
-      <link>https://www.amic.ru/news/anons-kommercheskiy/rosselhozbank-podderzhal-rossiyskih-agrarievna-276-mlrd-rubley-516929</link>
+      <link>https://www.amic.ru/news/sibiryachka-pohudela-na-chetvert-centnera-i-razvelas-s-muzhem-kotorogo-pererosla-521599</link>
     </item>
 
     <item turbo="false">