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

Merge branch 'master' of https://github.com/unaio/una

roman.lesnikov@gmail.com 4 лет назад
Родитель
Сommit
0aecb371e4

+ 1 - 1
composer.json

@@ -88,7 +88,7 @@
         "wikimedia/less.php": "*",
         "matthiasmullie/minify": "^1.3",
         "lusitanian/oauth": "^0.8.11",
-        "bshaffer/oauth2-server-php": "^1.11",
+        "bshaffer/oauth2-server-php": "^1.12",
         "erusev/parsedown": "@dev",
         "paypal/paypal-checkout-sdk": "^1.0",
         "phpmailer/phpmailer": "^6.5",

+ 24 - 24
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "94b28ce348b24b6bbc561c4992edca28",
+    "content-hash": "78768e5138ed84dbf0e50d07eff17ef8",
     "packages": [
         {
             "name": "achingbrain/php5-akismet",
@@ -61,7 +61,7 @@
             ],
             "support": {
                 "issues": "https://github.com/akeeba/s3/issues",
-                "source": "https://github.com/akeeba/s3/tree/development"
+                "source": "https://github.com/akeeba/s3/tree/2.1.0"
             },
             "time": "2022-05-30T09:14:13+00:00"
         },
@@ -445,22 +445,22 @@
         },
         {
             "name": "guzzlehttp/guzzle",
-            "version": "7.4.4",
+            "version": "7.4.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/guzzle/guzzle.git",
-                "reference": "e3ff079b22820c2029d4c2a87796b6a0b8716ad8"
+                "reference": "1dd98b0564cb3f6bd16ce683cb755f94c10fbd82"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/e3ff079b22820c2029d4c2a87796b6a0b8716ad8",
-                "reference": "e3ff079b22820c2029d4c2a87796b6a0b8716ad8",
+                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/1dd98b0564cb3f6bd16ce683cb755f94c10fbd82",
+                "reference": "1dd98b0564cb3f6bd16ce683cb755f94c10fbd82",
                 "shasum": ""
             },
             "require": {
                 "ext-json": "*",
                 "guzzlehttp/promises": "^1.5",
-                "guzzlehttp/psr7": "^1.8.3 || ^2.1",
+                "guzzlehttp/psr7": "^1.9 || ^2.4",
                 "php": "^7.2.5 || ^8.0",
                 "psr/http-client": "^1.0",
                 "symfony/deprecation-contracts": "^2.2 || ^3.0"
@@ -549,7 +549,7 @@
             ],
             "support": {
                 "issues": "https://github.com/guzzle/guzzle/issues",
-                "source": "https://github.com/guzzle/guzzle/tree/7.4.4"
+                "source": "https://github.com/guzzle/guzzle/tree/7.4.5"
             },
             "funding": [
                 {
@@ -565,7 +565,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-06-09T21:39:15+00:00"
+            "time": "2022-06-20T22:16:13+00:00"
         },
         {
             "name": "guzzlehttp/promises",
@@ -653,16 +653,16 @@
         },
         {
             "name": "guzzlehttp/psr7",
-            "version": "2.3.0",
+            "version": "2.4.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/guzzle/psr7.git",
-                "reference": "83260bb50b8fc753c72d14dc1621a2dac31877ee"
+                "reference": "13388f00956b1503577598873fffb5ae994b5737"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/guzzle/psr7/zipball/83260bb50b8fc753c72d14dc1621a2dac31877ee",
-                "reference": "83260bb50b8fc753c72d14dc1621a2dac31877ee",
+                "url": "https://api.github.com/repos/guzzle/psr7/zipball/13388f00956b1503577598873fffb5ae994b5737",
+                "reference": "13388f00956b1503577598873fffb5ae994b5737",
                 "shasum": ""
             },
             "require": {
@@ -686,7 +686,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "2.3-dev"
+                    "dev-master": "2.4-dev"
                 }
             },
             "autoload": {
@@ -748,7 +748,7 @@
             ],
             "support": {
                 "issues": "https://github.com/guzzle/psr7/issues",
-                "source": "https://github.com/guzzle/psr7/tree/2.3.0"
+                "source": "https://github.com/guzzle/psr7/tree/2.4.0"
             },
             "funding": [
                 {
@@ -764,7 +764,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-06-09T08:26:02+00:00"
+            "time": "2022-06-20T21:43:11+00:00"
         },
         {
             "name": "intervention/image",
@@ -1211,16 +1211,16 @@
         },
         {
             "name": "phpmailer/phpmailer",
-            "version": "v6.6.2",
+            "version": "v6.6.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/PHPMailer/PHPMailer.git",
-                "reference": "b52ed06864fdda81b82ec8bf564cf15d45ed4f95"
+                "reference": "9400f305a898f194caff5521f64e5dfa926626f3"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/b52ed06864fdda81b82ec8bf564cf15d45ed4f95",
-                "reference": "b52ed06864fdda81b82ec8bf564cf15d45ed4f95",
+                "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/9400f305a898f194caff5521f64e5dfa926626f3",
+                "reference": "9400f305a898f194caff5521f64e5dfa926626f3",
                 "shasum": ""
             },
             "require": {
@@ -1277,7 +1277,7 @@
             "description": "PHPMailer is a full-featured email creation and transfer class for PHP",
             "support": {
                 "issues": "https://github.com/PHPMailer/PHPMailer/issues",
-                "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.6.2"
+                "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.6.3"
             },
             "funding": [
                 {
@@ -1285,7 +1285,7 @@
                     "type": "github"
                 }
             ],
-            "time": "2022-06-14T09:27:21+00:00"
+            "time": "2022-06-20T09:21:02+00:00"
         },
         {
             "name": "psr/http-client",
@@ -1665,7 +1665,7 @@
         },
         {
             "name": "symfony/deprecation-contracts",
-            "version": "v2.5.1",
+            "version": "v2.5.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/deprecation-contracts.git",
@@ -1712,7 +1712,7 @@
             "description": "A generic function and convention to trigger deprecation notices",
             "homepage": "https://symfony.com",
             "support": {
-                "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1"
+                "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2"
             },
             "funding": [
                 {

+ 1 - 1
install/sql/system.sql

@@ -4446,7 +4446,7 @@ CREATE TABLE IF NOT EXISTS `sys_menu_items` (
   `name` varchar(255) NOT NULL,
   `title_system` varchar(255) NOT NULL,
   `title` varchar(255) NOT NULL,
-  `link` varchar(255) NOT NULL,
+  `link` varchar(512) NOT NULL,
   `onclick` varchar(255) NOT NULL,
   `target` varchar(255) NOT NULL,
   `icon` text NOT NULL,

+ 7 - 2
modules/base/profile/classes/BxBaseModProfileModule.php

@@ -1031,9 +1031,14 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
 
         list($iContentId, $aContentInfo) = $mixedContent;
 
+        $iViewer = bx_get_logged_profile_id();
+        $iOwner = (int)$aContentInfo['profile_id'];
+        if($iViewer == $iOwner)
+            return false;
+
         bx_import('BxDolConnection');
-        $s = $this->serviceBrowseConnectionsQuick ($aContentInfo['profile_id'], 'sys_profiles_friends', BX_CONNECTIONS_CONTENT_TYPE_COMMON, true, bx_get_logged_profile_id());
-        if (!$s)
+        $s = $this->serviceBrowseConnectionsQuick ($iOwner, 'sys_profiles_friends', BX_CONNECTIONS_CONTENT_TYPE_COMMON, true, $iViewer);
+        if(!$s)
             return MsgBox(_t('_sys_txt_empty'));
 
         return $s;

+ 22 - 15
modules/boonex/payment/classes/BxPaymentProviderStripeV3.php

@@ -488,12 +488,17 @@ class BxPaymentProviderStripeV3 extends BxPaymentProviderStripeBasic implements
     protected function _createSession($sType, $aParams, &$aClient, &$aCartInfo)
     {
         $sMode = '';
-        $aLineItems = array();
-        $aMetaItems = array();
+        $aLineItems = $aMetaItems = [];
+        $bVerify = true;
 
         switch($sType) {
             case 'authorize':
                 $sMode = 'setup';
+                $bVerify = false;
+
+                foreach($aCartInfo['items'] as $aItem)
+                    $aMetaItems[] = $this->_oModule->_oConfig->descriptorA2S([$aItem['module_id'], $aItem['id']]);
+
                 $aParams['customer_creation'] = 'always';
                 break;
 
@@ -501,20 +506,20 @@ class BxPaymentProviderStripeV3 extends BxPaymentProviderStripeBasic implements
                 $sMode = 'payment';
 
                 foreach($aCartInfo['items'] as $aItem) {
-                    $aProductData = array(
+                    $aProductData = [
                         'name' => $aItem['title']
-                    );
+                    ];
                     if(!empty($aItem['description']))
                         $aProductData['description'] = strmaxtextlen(strip_tags($aItem['description']), 60, '...');
 
-                    $aLineItems[] = array(
-                        'price_data' => array(
+                    $aLineItems[] = [
+                        'price_data' => [
                             'currency' => $aCartInfo['vendor_currency_code'],
                             'product_data' => $aProductData,
                             'unit_amount' => 100 * round($this->_oModule->_oConfig->getPrice($sType, $aItem), $this->_iAmountPrecision),
-                        ),
+                        ],
                         'quantity' => $aItem['quantity'],
-                    );
+                    ];
 
                     $aMetaItems[] = $this->_oModule->_oConfig->descriptorA2S([$aItem['module_id'], $aItem['id']]);
                 }
@@ -524,10 +529,10 @@ class BxPaymentProviderStripeV3 extends BxPaymentProviderStripeBasic implements
                 $sMode = 'subscription';
 
                 foreach($aCartInfo['items'] as $aItem) {
-                    $aLineItems[] = array(
+                    $aLineItems[] = [
                         'price' => $aItem['name'],
                         'quantity' => $aItem['quantity'],
-                    );
+                    ];
 
                     $aMetaItems[] = $this->_oModule->_oConfig->descriptorA2S([$aItem['module_id'], $aItem['id']]);
                 }
@@ -548,15 +553,17 @@ class BxPaymentProviderStripeV3 extends BxPaymentProviderStripeBasic implements
 
         $bMetaData = !empty($aMetaItems);
         if($bMetaData) {
-            $fAmount = 100 * round((float)$aCartInfo['items_price'], $this->_iAmountPrecision);
-
             $aSession['metadata'] = [
                 'vendor' => $aCartInfo['vendor_id'],
                 'client' => $aClient['id'],
                 'type' => $sType, 
-                'items' => $this->_oModule->_oConfig->descriptorsA2S($aMetaItems),
-                'verification' => $this->getVerificationCodeSession($aCartInfo['vendor_id'], $aClient['id'], $fAmount, $aCartInfo['vendor_currency_code'])
+                'items' => $this->_oModule->_oConfig->descriptorsA2S($aMetaItems)
             ];
+
+            if($bVerify) {
+                $fAmount = 100 * round((float)$aCartInfo['items_price'], $this->_iAmountPrecision);
+                $aSession['metadata']['verification'] = $this->getVerificationCodeSession($aCartInfo['vendor_id'], $aClient['id'], $fAmount, $aCartInfo['vendor_currency_code']);
+            }
         }
 
         bx_alert($this->_oModule->_oConfig->getName(), $this->_sName . '_create_session', 0, false, array(
@@ -576,7 +583,7 @@ class BxPaymentProviderStripeV3 extends BxPaymentProviderStripeBasic implements
         if(empty($aResult) || !is_array($aResult))
             return false;
 
-        if($bMetaData && !$this->checkVerificationCodeSession($aCartInfo['vendor_id'], $aClient['id'], $aResult))
+        if($bVerify && !$this->checkVerificationCodeSession($aCartInfo['vendor_id'], $aClient['id'], $aResult))
             return false;
 
         return $aResult['id'];

+ 1 - 1
modules/boonex/stream/classes/BxStrmDb.php

@@ -34,7 +34,7 @@ class BxStrmDb extends BxBaseModTextDb
     public function getPendingRecordings ($iLimit = 2)
     {
         $CNF = &$this->_oConfig->CNF;
-        return $this->getAll("SELECT `r`.* FROM `bx_stream_recordings_seq` AS `r` INNER JOIN `{$CNF['TABLE_ENTRIES']}` AS `c` ON (`r`.`content_id` = `c`.`id` AND `c`.`status` = 'awaiting') ORDER BY `r`.`id` ASC LIMIT " . (int)$iLimit);
+        return $this->getAll("SELECT `r`.* FROM `bx_stream_recordings_seq` AS `r` INNER JOIN `{$CNF['TABLE_ENTRIES']}` AS `c` ON (`r`.`content_id` = `c`.`id` AND `c`.`status` = 'awaiting' AND `r`.`status` = 'pending') ORDER BY `r`.`id` ASC LIMIT " . (int)$iLimit);
     }
 
     public function updateRecording($iRecordingId, $aValues = [])

+ 3 - 1
modules/boonex/stream/classes/BxStrmEngineOvenMediaEngine.php

@@ -90,6 +90,8 @@ class BxStrmEngineOvenMediaEngine extends BxDol
         if ($oStorage) {
             $sFileUrl = getParam('bx_stream_recordings_url') . $aContentInfo['key'] . '_' . $iRecordingId . '.ts';
 
+            $oModule->_oDb->updateRecording($iRecordingId, ['status' => 'processing']);
+
             $iFileId = $oStorage->storeFileFromUrl($sFileUrl, true, $aContentInfo[$CNF['FIELD_AUTHOR']], $aContentInfo['id']);
             if ($iFileId) {
                 $bDeleteRecording = true;
@@ -107,7 +109,7 @@ class BxStrmEngineOvenMediaEngine extends BxDol
             $oModule->_oDb->deleteRecording($iRecordingId);
         }
         else {
-            $oModule->_oDb->updateRecording($iRecordingId, ['tries' => $iTries + 1]);
+            $oModule->_oDb->updateRecording($iRecordingId, ['tries' => $iTries + 1, 'status' => 'pending']);
         }
     }
 

+ 4 - 0
modules/boonex/stream/classes/BxStrmModule.php

@@ -157,6 +157,10 @@ class BxStrmModule extends BxBaseModTextModule
             return false;
         list($iContentId, $aContentInfo) = $mixedContent;
 
+        $mixedMsg = $this->checkAllowedAdd (false);
+        if ($mixedMsg !== CHECK_ACTION_RESULT_ALLOWED)
+            return MsgBox($mixedMsg);
+
         if ($aContentInfo[$CNF['FIELD_AUTHOR']] !== bx_get_logged_profile_id() && !isAdmin()) 
             return false;
 

+ 4 - 0
modules/boonex/stream/classes/BxStrmTemplate.php

@@ -38,6 +38,10 @@ class BxStrmTemplate extends BxBaseModTextTemplate
         if (!$oEngine->isSreamFromBrowser()) 
             return MsgBox(_t('_bx_stream_from_webcam_not_supported'));
 
+        $mixedMsg = $this->getModule()->checkAllowedAdd (false);
+        if ($mixedMsg !== CHECK_ACTION_RESULT_ALLOWED)
+            return MsgBox($mixedMsg);
+
         $CNF = &$this->getModule()->_oConfig->CNF;
 
         return $this->parseHtmlByName('stream_broadcast_ome.html', array(

+ 1 - 0
modules/boonex/stream/install/sql/install.sql

@@ -87,6 +87,7 @@ CREATE TABLE IF NOT EXISTS `bx_stream_recordings_seq` (
   `content_id` int(10) unsigned NOT NULL,
   `tries` tinyint(4) NOT NULL DEFAULT 0,
   `added` int(10) unsigned NOT NULL,
+  `status` enum('pending','processing') NOT NULL DEFAULT 'pending',
   PRIMARY KEY (`id`),
   KEY `content_id` (`content_id`)
 );