Просмотр исходного кода

Upgrade script from 13.0.0-A2 to 13.0.0-A3

Alex Trofimov 4 лет назад
Родитель
Сommit
d77091bc2e

+ 21 - 12
upgrade/files/13.0.0.A2-13.0.0.A3/files/inc/utils.inc.php

@@ -1324,20 +1324,29 @@ function bx_get_base_url($sPageLink)
 
 function bx_get_page_info()
 {
-    $a = bx_get_base_url_inline();
-    $oPage = BxDolPage::getObjectInstanceByURI($a[1]['i']);
-    $oServ = bx_instance('BxTemplServices');
-    if ($oServ->serviceIsModuleContext($oPage->getModule())){
-        $oProfile = BxDolProfile::getInstanceByContentAndType($a[1]['id'], $oPage->getModule());
-        return ['context_module' => $oPage->getModule(), 'context_id' => isset($a[1]['id']) ? $a[1]['id'] : '', 'profile_context_id' => $oProfile->id()];
+    list($sPageLink, $aPageParams) = bx_get_base_url_inline();
+
+    if(isset($aPageParams['i'], $aPageParams['id']) && ($oPage = BxDolPage::getObjectInstanceByURI($aPageParams['i'])) !== false) {
+        $sPageModule = $oPage->getModule();
+        if(bx_srv('system', 'is_module_context', [$sPageModule]) && ($oProfile = BxDolProfile::getInstanceByContentAndType($aPageParams['id'], $sPageModule)) !== false)
+            return [
+                'context_module' => $sPageModule, 
+                'context_id' => $aPageParams['id'], 
+                'context_profile_id' => $oProfile->id()
+            ];
     }
-    
-    if (isset($a[1]['profile_id'])){
-        $oProfile = BxDolProfile::getInstance($a[1]['profile_id']);
-        if($oProfile  && $oServ->serviceIsModuleContext($oProfile->getModule())){
-            return ['context_module' => $oProfile->getModule(), 'context_id' => $oProfile->getContentId(), 'profile_context_id' => $a[1]['profile_id']];
-        }
+
+    if(isset($aPageParams['profile_id']) && ($oProfile = BxDolProfile::getInstance($aPageParams['profile_id'])) !== false) {
+        $sProfileModule = $oProfile->getModule();
+        if(bx_srv('system', 'is_module_context', [$sProfileModule]))
+            return [
+                'context_module' => $sProfileModule, 
+                'context_id' => $oProfile->getContentId(), 
+                'context_profile_id' => $aPageParams['profile_id']
+            ];
     }
+
+    return false;
 }
 
 function bx_get_location_bounds_latlng($fLatitude, $fLongitude, $iRadiusInKm)

+ 4 - 4
upgrade/files/13.0.0.A2-13.0.0.A3/files/modules/base/general/classes/BxBaseModGeneralModule.php

@@ -2391,12 +2391,12 @@ class BxBaseModGeneralModule extends BxDolModule
     public function serviceCategoriesMultiList($bDisplayEmptyCats = true)
     {
         $aContextInfo = bx_get_page_info();
+
         $mProfileContextId = false;
-        if (isset($aContextInfo['context_module']) && isset($aContextInfo['profile_context_id'])){
-            $mProfileContextId = $aContextInfo['profile_context_id'];
-        }
+        if ($aContextInfo !== false)
+            $mProfileContextId = $aContextInfo['context_profile_id'];
         
-		$oCategories = BxDolCategories::getInstance();
+        $oCategories = BxDolCategories::getInstance();
         if ($mProfileContextId)
             $aCats = $oCategories->getData([
                 'type' => 'by_module&context_with_num', 

+ 1 - 1
upgrade/files/13.0.0.A2-13.0.0.A3/files/plugins/autoload.php

@@ -4,4 +4,4 @@
 
 require_once __DIR__ . '/composer/autoload_real.php';
 
-return ComposerAutoloaderInita6c4a21debe3a86d296d6890d526cc19::getLoader();
+return ComposerAutoloaderInit60e3f6a64733205d9daf98e574d1e99b::getLoader();

+ 7 - 7
upgrade/files/13.0.0.A2-13.0.0.A3/files/plugins/composer/autoload_real.php

@@ -2,7 +2,7 @@
 
 // autoload_real.php @generated by Composer
 
-class ComposerAutoloaderInita6c4a21debe3a86d296d6890d526cc19
+class ComposerAutoloaderInit60e3f6a64733205d9daf98e574d1e99b
 {
     private static $loader;
 
@@ -24,15 +24,15 @@ class ComposerAutoloaderInita6c4a21debe3a86d296d6890d526cc19
 
         require __DIR__ . '/platform_check.php';
 
-        spl_autoload_register(array('ComposerAutoloaderInita6c4a21debe3a86d296d6890d526cc19', 'loadClassLoader'), true, true);
+        spl_autoload_register(array('ComposerAutoloaderInit60e3f6a64733205d9daf98e574d1e99b', 'loadClassLoader'), true, true);
         self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
-        spl_autoload_unregister(array('ComposerAutoloaderInita6c4a21debe3a86d296d6890d526cc19', 'loadClassLoader'));
+        spl_autoload_unregister(array('ComposerAutoloaderInit60e3f6a64733205d9daf98e574d1e99b', 'loadClassLoader'));
 
         $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
         if ($useStaticLoader) {
             require __DIR__ . '/autoload_static.php';
 
-            call_user_func(\Composer\Autoload\ComposerStaticInita6c4a21debe3a86d296d6890d526cc19::getInitializer($loader));
+            call_user_func(\Composer\Autoload\ComposerStaticInit60e3f6a64733205d9daf98e574d1e99b::getInitializer($loader));
         } else {
             $map = require __DIR__ . '/autoload_namespaces.php';
             foreach ($map as $namespace => $path) {
@@ -53,19 +53,19 @@ class ComposerAutoloaderInita6c4a21debe3a86d296d6890d526cc19
         $loader->register(true);
 
         if ($useStaticLoader) {
-            $includeFiles = Composer\Autoload\ComposerStaticInita6c4a21debe3a86d296d6890d526cc19::$files;
+            $includeFiles = Composer\Autoload\ComposerStaticInit60e3f6a64733205d9daf98e574d1e99b::$files;
         } else {
             $includeFiles = require __DIR__ . '/autoload_files.php';
         }
         foreach ($includeFiles as $fileIdentifier => $file) {
-            composerRequirea6c4a21debe3a86d296d6890d526cc19($fileIdentifier, $file);
+            composerRequire60e3f6a64733205d9daf98e574d1e99b($fileIdentifier, $file);
         }
 
         return $loader;
     }
 }
 
-function composerRequirea6c4a21debe3a86d296d6890d526cc19($fileIdentifier, $file)
+function composerRequire60e3f6a64733205d9daf98e574d1e99b($fileIdentifier, $file)
 {
     if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
         require $file;

+ 5 - 5
upgrade/files/13.0.0.A2-13.0.0.A3/files/plugins/composer/autoload_static.php

@@ -4,7 +4,7 @@
 
 namespace Composer\Autoload;
 
-class ComposerStaticInita6c4a21debe3a86d296d6890d526cc19
+class ComposerStaticInit60e3f6a64733205d9daf98e574d1e99b
 {
     public static $files = array (
         '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
@@ -282,10 +282,10 @@ class ComposerStaticInita6c4a21debe3a86d296d6890d526cc19
     public static function getInitializer(ClassLoader $loader)
     {
         return \Closure::bind(function () use ($loader) {
-            $loader->prefixLengthsPsr4 = ComposerStaticInita6c4a21debe3a86d296d6890d526cc19::$prefixLengthsPsr4;
-            $loader->prefixDirsPsr4 = ComposerStaticInita6c4a21debe3a86d296d6890d526cc19::$prefixDirsPsr4;
-            $loader->prefixesPsr0 = ComposerStaticInita6c4a21debe3a86d296d6890d526cc19::$prefixesPsr0;
-            $loader->classMap = ComposerStaticInita6c4a21debe3a86d296d6890d526cc19::$classMap;
+            $loader->prefixLengthsPsr4 = ComposerStaticInit60e3f6a64733205d9daf98e574d1e99b::$prefixLengthsPsr4;
+            $loader->prefixDirsPsr4 = ComposerStaticInit60e3f6a64733205d9daf98e574d1e99b::$prefixDirsPsr4;
+            $loader->prefixesPsr0 = ComposerStaticInit60e3f6a64733205d9daf98e574d1e99b::$prefixesPsr0;
+            $loader->classMap = ComposerStaticInit60e3f6a64733205d9daf98e574d1e99b::$classMap;
 
         }, null, ClassLoader::class);
     }

+ 2 - 2
upgrade/files/13.0.0.A2-13.0.0.A3/files/plugins/composer/installed.php

@@ -5,7 +5,7 @@
         'type' => 'library',
         'install_path' => __DIR__ . '/../../',
         'aliases' => array(),
-        'reference' => 'a285896dbfb744f65cc03a63f4de3349f5097223',
+        'reference' => '2b3adf499fc17dc235ed8f20171a5c02810e37eb',
         'name' => 'unaio/una',
         'dev' => true,
     ),
@@ -330,7 +330,7 @@
             'type' => 'library',
             'install_path' => __DIR__ . '/../../',
             'aliases' => array(),
-            'reference' => 'a285896dbfb744f65cc03a63f4de3349f5097223',
+            'reference' => '2b3adf499fc17dc235ed8f20171a5c02810e37eb',
             'dev_requirement' => false,
         ),
         'wikimedia/less.php' => array(

+ 44 - 0
upgrade/files/13.0.0.A2-13.0.0.A3/files/studio/store.php

@@ -0,0 +1,44 @@
+<?php
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaEndAdmin UNA Studio End Admin Pages
+ * @ingroup     UnaStudio
+ * @{
+ */
+
+require_once('./../inc/header.inc.php');
+require_once(BX_DIRECTORY_PATH_INC . 'design.inc.php');
+require_once(BX_DOL_DIR_STUDIO_INC . 'utils.inc.php');
+
+bx_import('BxDolLanguages');
+
+bx_require_authentication(true);
+
+$sPage = bx_get('page');
+$sPage = $sPage !== false ? bx_process_input($sPage) : '';
+
+$oPage = new BxTemplStudioStore($sPage);
+
+if(($mixedResult = $oPage->checkAction()) !== false) {
+    echoJson($mixedResult);
+    exit;
+}
+
+$oTemplate = BxDolStudioTemplate::getInstance();
+
+$sPageCode = $oPage->getPageCode();
+if($sPageCode === false)
+    $oTemplate->displayMsg(($sError = $oPage->getError(false)) !== false ? $sError : '_sys_txt_error_occured', true);
+
+$oTemplate->setPageNameIndex($oPage->getPageIndex());
+$oTemplate->setPageHeader($oPage->getPageHeader());
+$oTemplate->setPageContent('page_caption_code', $oPage->getPageCaption());
+$oTemplate->setPageContent('page_attributes', $oPage->getPageAttributes());
+$oTemplate->setPageContent('page_menu_code', $oPage->getPageMenu());
+$oTemplate->setPageContent('page_main_code', $sPageCode);
+$oTemplate->addCss($oPage->getPageCss());
+$oTemplate->addJs($oPage->getPageJs());
+$oTemplate->getPageCode();
+/** @} */

+ 3 - 3
upgrade/files/13.0.0.A2-13.0.0.A3/files/template/scripts/BxBaseCategory.php

@@ -70,10 +70,10 @@ class BxBaseCategory extends BxDolCategory
     public function getCategoriesList($bDisplayEmptyCats = true, $bAsArray = false)
     {
         $aContextInfo = bx_get_page_info();
+
         $mProfileContextId = false;
-        if (isset($aContextInfo['context_module']) && isset($aContextInfo['profile_context_id'])){
-            $mProfileContextId = $aContextInfo['profile_context_id'];
-        }
+        if ($aContextInfo !== false)
+            $mProfileContextId = $aContextInfo['context_profile_id'];
         
         $a = BxDolForm::getDataItems($this->_aObject['list_name']);
         if (!$a)

+ 6 - 7
upgrade/files/13.0.0.A2-13.0.0.A3/files/template/scripts/BxBaseServiceMetatags.php

@@ -52,16 +52,15 @@ class BxBaseServiceMetatags extends BxDol
     	$bShowEmpty = isset($aParams['show_empty']) ? (bool)$aParams['show_empty'] : false;
 
         $aContextInfo = bx_get_page_info();
-        if (isset($aContextInfo['context_module']) && isset($aContextInfo['profile_context_id'])){
-            $sResult = BxDolMetatags::getObjectInstance($sObject)->getKeywordsCloud($mixedSection, $iMaxCount, false, ['context_id' => $aContextInfo['profile_context_id']]);
-        }
-        else{
+        if ($aContextInfo !== false)
+            $sResult = BxDolMetatags::getObjectInstance($sObject)->getKeywordsCloud($mixedSection, $iMaxCount, false, ['context_id' => $aContextInfo['context_profile_id']]);
+        else
             $sResult = BxDolMetatags::getObjectInstance($sObject)->getKeywordsCloud($mixedSection, $iMaxCount);
-        }
+
         if(empty($sResult))
-			return $bShowEmpty ? MsgBox(_t('_Empty')) : '';
+            return $bShowEmpty ? MsgBox(_t('_Empty')) : '';
 
-		return $sResult;
+        return $sResult;
     }
 
     public function serviceBrowseLabels($aParams = array())