-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Исправлен баг в алгоритме "SetPageProperty/SetDirProperty" с og:descr…
…iption
- Loading branch information
1 parent
bcf507f
commit 4568d5b
Showing
4 changed files
with
26 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
/** | ||
* @author dev2fun <darkfriend> | ||
* @copyright (c) 2019, darkfriend <[email protected]> | ||
* @version 1.3.0 | ||
* @version 1.3.4 | ||
*/ | ||
|
||
namespace Dev2fun\Module; | ||
|
@@ -191,10 +191,12 @@ public function saveElement(&$arFields) { | |
if (is_numeric($file)) { | ||
$reqFields['image'] = $file; | ||
} else { | ||
if (!file_exists($file['tmp_name'])) { | ||
if(empty($file['tmp_name'])) { | ||
$file = \CFile::MakeFileArray($file); | ||
} elseif (!file_exists($file['tmp_name'])) { | ||
$upload_dir = \COption::GetOptionString("main", "upload_dir", "upload"); | ||
$absPath = $_SERVER["DOCUMENT_ROOT"] . "/" . $upload_dir . "/tmp"; | ||
if (!empty($file['tmp_name']) && !strpos($file['tmp_name'],$absPath)) { | ||
if (!empty($file['tmp_name']) && !strpos($file['tmp_name'], $absPath)) { | ||
$file['tmp_name'] = $absPath . $file['tmp_name']; | ||
} | ||
} | ||
|
@@ -263,7 +265,9 @@ public function saveSection(&$arFields) { | |
if (is_numeric($file)) { | ||
$reqFields['image'] = $file; | ||
} else { | ||
if (!file_exists($file['tmp_name'])) { | ||
if(empty($file['tmp_name'])) { | ||
$file = \CFile::MakeFileArray($file); | ||
} elseif (!file_exists($file['tmp_name'])) { | ||
$upload_dir = \COption::GetOptionString("main", "upload_dir", "upload"); | ||
$absPath = $_SERVER["DOCUMENT_ROOT"] . "/" . $upload_dir . "/tmp"; | ||
if (!empty($file['tmp_name']) && !strpos($file['tmp_name'],$absPath)) { | ||
|
@@ -630,7 +634,8 @@ public function setPropertyPropFields($ogData) { | |
// print_pre('PropFields'); | ||
// break; | ||
case 'og:description' : | ||
$ogValue = $APPLICATION->GetProperty('description'); | ||
$ogValue = $APPLICATION->GetProperty('og:description'); | ||
if(!$ogValue) $ogValue = $APPLICATION->GetProperty('description'); | ||
break; | ||
case 'og:image' : | ||
if (!preg_match('#^(http|https)\:\\\\#', $ogValue)) { | ||
|
@@ -677,7 +682,7 @@ public function setPropertyDefault($ogData) { | |
$url = $oModule->getUrl($APPLICATION->GetCurPage()); | ||
$ogValue = $this->getPrepareUrl($url); | ||
break; | ||
case 'site_name' : | ||
case 'og:site_name' : | ||
$obSite = \CSite::GetByID(SITE_ID); | ||
if ($arSite = $obSite->Fetch()) { | ||
$ogValue = htmlentities($arSite['SITE_NAME']); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
$arModuleVersion = array( | ||
"VERSION" => "1.3.3", | ||
"VERSION_DATE" => "2019-03-04 11:00:00", | ||
"VERSION" => "1.3.4", | ||
"VERSION_DATE" => "2019-05-30 10:00:00", | ||
); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
/** | ||
* @author dev2fun <darkfriend> | ||
* @copyright (c) 2019, darkfriend <[email protected]> | ||
* @version 1.3.0 | ||
* @version 1.3.4 | ||
*/ | ||
|
||
namespace Dev2fun\Module; | ||
|
@@ -191,10 +191,12 @@ public function saveElement(&$arFields) { | |
if (is_numeric($file)) { | ||
$reqFields['image'] = $file; | ||
} else { | ||
if (!file_exists($file['tmp_name'])) { | ||
if(empty($file['tmp_name'])) { | ||
$file = \CFile::MakeFileArray($file); | ||
} elseif (!file_exists($file['tmp_name'])) { | ||
$upload_dir = \COption::GetOptionString("main", "upload_dir", "upload"); | ||
$absPath = $_SERVER["DOCUMENT_ROOT"] . "/" . $upload_dir . "/tmp"; | ||
if (!empty($file['tmp_name']) && !strpos($file['tmp_name'],$absPath)) { | ||
if (!empty($file['tmp_name']) && !strpos($file['tmp_name'], $absPath)) { | ||
$file['tmp_name'] = $absPath . $file['tmp_name']; | ||
} | ||
} | ||
|
@@ -263,7 +265,9 @@ public function saveSection(&$arFields) { | |
if (is_numeric($file)) { | ||
$reqFields['image'] = $file; | ||
} else { | ||
if (!file_exists($file['tmp_name'])) { | ||
if(empty($file['tmp_name'])) { | ||
$file = \CFile::MakeFileArray($file); | ||
} elseif (!file_exists($file['tmp_name'])) { | ||
$upload_dir = \COption::GetOptionString("main", "upload_dir", "upload"); | ||
$absPath = $_SERVER["DOCUMENT_ROOT"] . "/" . $upload_dir . "/tmp"; | ||
if (!empty($file['tmp_name']) && !strpos($file['tmp_name'],$absPath)) { | ||
|
@@ -630,7 +634,8 @@ public function setPropertyPropFields($ogData) { | |
// print_pre('PropFields'); | ||
// break; | ||
case 'og:description' : | ||
$ogValue = $APPLICATION->GetProperty('description'); | ||
$ogValue = $APPLICATION->GetProperty('og:description'); | ||
if(!$ogValue) $ogValue = $APPLICATION->GetProperty('description'); | ||
break; | ||
case 'og:image' : | ||
if (!preg_match('#^(http|https)\:\\\\#', $ogValue)) { | ||
|
@@ -677,7 +682,7 @@ public function setPropertyDefault($ogData) { | |
$url = $oModule->getUrl($APPLICATION->GetCurPage()); | ||
$ogValue = $this->getPrepareUrl($url); | ||
break; | ||
case 'site_name' : | ||
case 'og:site_name' : | ||
$obSite = \CSite::GetByID(SITE_ID); | ||
if ($arSite = $obSite->Fetch()) { | ||
$ogValue = htmlentities($arSite['SITE_NAME']); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
$arModuleVersion = array( | ||
"VERSION" => "1.3.3", | ||
"VERSION_DATE" => "2019-03-04 11:00:00", | ||
"VERSION" => "1.3.4", | ||
"VERSION_DATE" => "2019-05-30 10:00:00", | ||
); | ||
?> |