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

Merge branch 'master' of https://github.com/boonex/dolphin

AntonLV 10 лет назад
Родитель
Сommit
e646262b4b

+ 6 - 0
inc/classes/BxDolStorageQuery.php

@@ -84,6 +84,9 @@ class BxDolStorageQuery extends BxDolDb
 
     public function getUserQuota($iProfileId)
     {
+        if (!$iProfileId) // for guests and storages without owner don't count per-user quota
+            return array('current_size' => 0, 'current_number' => 0, 'quota_size' => 0, 'quota_number' => 0, 'max_file_size' => 0);
+
         $sQuery = $this->prepare("SELECT `current_size`, `current_number`, 0 as `quota_size`, 0 as `quota_number`, 0 as `max_file_size` FROM `sys_storage_user_quotas` WHERE `profile_id` = ?", $iProfileId);
         $a = $this->getRow($sQuery);
         if (!is_array($a) || !$a)
@@ -105,6 +108,9 @@ class BxDolStorageQuery extends BxDolDb
 
     public function updateUserQuota($iProfileId, $iSize, $iNumber = 1)
     {
+        if (!$iProfileId) // for guests and storages without owner don't update per-user quota
+            return true;
+            
         $iTime = time();
         $sQuery = $this->prepare("
             INSERT INTO `sys_storage_user_quotas`

+ 10 - 8
modules/base/connect/classes/BxBaseModConnectAlerts.php

@@ -25,15 +25,17 @@ class BxBaseModConnectAlerts extends BxDolAlertsResponse
 
                 case 'add':
                     // add remote account and local profile association
-                    bx_import('BxDolSession');
-                    $oSession = BxDolSession::getInstance();
-
-                    $iRemoteProfileId = $oSession->getValue($this->oModule->_oConfig->sSessionUid);
-                    if ($iRemoteProfileId) {
-                        $oSession->unsetValue($this->oModule->_oConfig->sSessionUid);
-                        $this->oModule->_oDb->saveRemoteId($o->iObject, $iRemoteProfileId);
+                    $oProfile = BxDolProfile::getInstance($o->iObject);
+                    if ($oProfile && 'system' != $oProfile->getModule()) {
+                        bx_import('BxDolSession');
+                        $oSession = BxDolSession::getInstance();
+
+                        $iRemoteProfileId = $oSession->getValue($this->oModule->_oConfig->sSessionUid);
+                        if ($iRemoteProfileId) {
+                            $oSession->unsetValue($this->oModule->_oConfig->sSessionUid);
+                            $this->oModule->_oDb->saveRemoteId($o->iObject, $iRemoteProfileId);
+                        }
                     }
-
                     break;
 
             }

+ 1 - 0
modules/base/profile/classes/BxBaseModProfileFormsEntryHelper.php

@@ -96,6 +96,7 @@ class BxBaseModProfileFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
 
         // create an alert
         bx_alert($this->_oModule->getName(), 'edited', $aContentInfo[$CNF['FIELD_ID']]);
+        bx_alert('profile', 'edit', $oProfile->id(), 0, array('content' => $iContentId, 'module' => $this->_oModule->getName()));
 
         return '';
     }

+ 30 - 0
modules/base/template/classes/BxBaseModTemplateInstaller.php

@@ -0,0 +1,30 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    BaseTemplate Base classes for template modules
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxBaseModTemplateInstaller extends BxDolStudioInstaller
+{
+    function __construct($aConfig)
+    {
+        parent::__construct($aConfig);
+    }
+
+	function enable($aParams)
+    {
+        $aResult = parent::enable($aParams);
+
+        if ($aResult['result'] && !getParam('template'))
+            setParam('template', $this->_aConfig['home_uri']);
+
+        return $aResult;
+    }
+}
+
+/** @} */

+ 1 - 3
modules/boonex/air/install/installer.php

@@ -9,9 +9,7 @@
  * @{
  */
 
-bx_import('BxDolStudioInstaller');
-
-class BxAirInstaller extends BxDolStudioInstaller
+class BxAirInstaller extends BxBaseModTemplateInstaller
 {
     function __construct($aConfig)
     {

+ 27 - 0
modules/boonex/chat_plus/classes/BxChatPlusStudioPage.php

@@ -0,0 +1,27 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    ChatPlus Chat+ module
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxChatPlusStudioPage extends BxTemplStudioModule
+{
+    function getHelp ()
+    {
+        return _t('_bx_chat_plus_information_block');
+    }
+
+    protected function getPageCaptionHelp()
+    {
+        $oTemplate = BxDolStudioTemplate::getInstance();
+        $sContent = '<a href="' . BX_DOL_URL_STUDIO . 'module.php?name=bx_chat_plus&page=help">' . _t('_bx_chat_plus_information') . "</a>";
+        return $oTemplate->parseHtmlByName('page_caption_help.html', array('content' => $sContent));
+    }
+}
+
+/** @} */

+ 3 - 3
modules/boonex/chat_plus/install/langs/en.xml

@@ -23,13 +23,13 @@
 	<string name="_bx_chat_plus_information"><![CDATA[Information]]></string>
 	<string name="_bx_chat_plus_information_block"><![CDATA[To enable this module, chat server must be installed separately. <br />
 
-Enter the chat URL in the form below. <br />
+Enter the chat URL in this module settings. <br />
 
 Then OAuth login must be configured. <a href="{0}modules/?r=oauth2/administration/">Generate Key & Secret pair</a> in OAuth2 Server module by pointing chat URL and  desired name. <br />
 
-After Key & Secret pair is generated you need to enter them in Chat Administration &gt; OAuth &gt; Dolphin.
+After Key & Secret pair is generated you need to enter them in Chat Administration &gt; OAuth &gt; Trident.
 
 <hr />
 
-To enable Helpdesk Chat you need to enable it in the Chat Administration &gt; Livechat and in the form below. You don\'t need to insert JS code into Dolphin, it is added automatically.]]></string>
+To enable Helpdesk Chat you need to enable it in the Chat Administration &gt; Livechat and in this module settings. You don't need to insert JS code, it is added automatically.]]></string>
 </resources>

+ 1 - 1
modules/boonex/chat_plus/install/sql/enable.sql

@@ -36,5 +36,5 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbo
 -- Injections
 
 INSERT INTO `sys_injections` (`name`, `page_index`, `key`, `type`, `data`, `replace`, `active`) VALUES
-('bx_chat_plus', 0, 'injection_footer', 'service', 'a:2:{s:6:"module";s:9:"chat_plus";s:6:"method";s:13:"helpdesk_code";}', 0, 1);
+('bx_chat_plus', 0, 'injection_footer', 'service', 'a:2:{s:6:"module";s:12:"bx_chat_plus";s:6:"method";s:13:"helpdesk_code";}', 0, 1);
 

+ 4 - 3
modules/boonex/oauth2/classes/BxOAuthFormAdd.php

@@ -42,7 +42,7 @@ class BxOAuthFormAdd extends BxTemplFormView
                     'required' => true,
                     'checker' => array (
                         'func' => 'avail',
-                        'error' => _t ('_sys_adm_form_err_required_field'),
+                        'error' => _t ('_sys_form_account_input_name_error'),
                     ),
                     'db' => array (
                         'pass' => 'Xss',
@@ -55,8 +55,9 @@ class BxOAuthFormAdd extends BxTemplFormView
                     'caption' => _t('_bx_oauth_client_url'),
                     'required' => true,
                     'checker' => array (
-                        'func' => 'avail',
-                        'error' => _t ('_sys_adm_form_err_required_field'),
+                        'func' => 'preg',
+                        'params' => array('/^https?:\/\//'),
+                        'error' => _t ('_bx_oauth_form_valid_url'),
                     ),
                     'db' => array (
                         'pass' => 'Xss',

+ 3 - 1
modules/boonex/oauth2/install/langs/en.xml

@@ -14,7 +14,9 @@ Specify the following "Dolphin Connect URL" on the client sites:<br />
 	<string name="_bx_oauth_add"><![CDATA[Add new client]]></string>
 	<string name="_bx_oauth_clients"><![CDATA[OAuth2 clients]]></string>
 	<string name="_bx_oauth_authorization"><![CDATA[Authorization]]></string>
-	<string name="_bx_oauth_authorize_app"><![CDATA[Choose profile to use on "{0}" site:]]></string>
+    <string name="_bx_oauth_authorize_app"><![CDATA[Choose profile to use on "{0}" site:]]></string>
+    <string name="_bx_oauth_form_valid_url"><![CDATA[Valid URL is required]]></string>
+    <string name="_bx_oauth_url"><![CDATA[URL]]></string>
 
 	<string name="_bx_oauth_adm_stg_cpt_type"><![CDATA[OAuth2 Server]]></string>
 	<string name="_bx_oauth_adm_stg_cpt_category_general"><![CDATA[General]]></string>

+ 5 - 4
modules/boonex/oauth2/install/sql/enable.sql

@@ -2,13 +2,14 @@
 -- GRID
 
 INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `field_id`, `field_order`, `paginate_url`, `paginate_per_page`, `paginate_simple`, `paginate_get_start`, `paginate_get_per_page`, `filter_fields`, `filter_mode`, `sorting_fields`, `override_class_name`, `override_class_file`) VALUES
-('bx_oauth', 'Sql', 'SELECT * FROM `bx_oauth_clients`', 'bx_oauth_clients', 'id', '', '', 10, NULL, 'start', '', 'title,client_id,client_secret', 'auto', 'title,client_id,client_secret', 'BxOAuthGrid', 'modules/boonex/oauth2/classes/BxOAuthGrid.php');
+('bx_oauth', 'Sql', 'SELECT * FROM `bx_oauth_clients`', 'bx_oauth_clients', 'id', '', '', 10, NULL, 'start', '', 'title,client_id,client_secret,redirect_uri', 'auto', 'title,client_id,client_secret,redirect_uri', 'BxOAuthGrid', 'modules/boonex/oauth2/classes/BxOAuthGrid.php');
 
 INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `params`, `order`) VALUES
 ('bx_oauth', 'checkbox', 'Select', '2%', '', 10),
-('bx_oauth', 'title', '_Title', '28%', '', 20),
-('bx_oauth', 'client_id', '_bx_oauth_client_id', '35%', '', 30),
-('bx_oauth', 'client_secret', '_bx_oauth_client_secret', '35%', '', 40);
+('bx_oauth', 'title', '_Title', '20%', '', 20),
+('bx_oauth', 'client_id', '_bx_oauth_client_id', '15%', '', 30),
+('bx_oauth', 'client_secret', '_bx_oauth_client_secret', '30%', '', 40),
+('bx_oauth', 'redirect_uri', '_bx_oauth_url', '33%', '', 50);
 
 INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `confirm`, `order`) VALUES
 ('bx_oauth', 'bulk', 'delete', '_Delete', 1, 1),

+ 1 - 1
modules/boonex/ocean/install/installer.php

@@ -9,7 +9,7 @@
  * @{
  */
 
-class BxOceanInstaller extends BxDolStudioInstaller
+class BxOceanInstaller extends BxBaseModTemplateInstaller
 {
     function __construct($aConfig)
     {

+ 2 - 2
modules/boonex/profiler/classes/BxProfiler.php

@@ -207,7 +207,7 @@ class BxProfiler extends BxDol
 
     function beginAlert($sUnit, $sAction, $sHandler)
     {
-        $sHash = md5($sUnit . $sAction . $sHandler);
+        $sHash = md5($sUnit . $sAction . $sHandler . $this->_iAlertsLevel);
         ++$this->_iAlertsLevel;
         $this->_aAlerts[$sHash] = array (
             'name' => str_repeat("--", $this->_iAlertsLevel-1) . $sHandler,
@@ -221,8 +221,8 @@ class BxProfiler extends BxDol
 
     function endAlert($sUnit, $sAction, $sHandler)
     {
-        $sHash = md5($sUnit . $sAction . $sHandler);
         --$this->_iAlertsLevel;
+        $sHash = md5($sUnit . $sAction . $sHandler . $this->_iAlertsLevel);
         $iTime = $this->_calcTime ($this->_aAlerts[$sHash]['begin']);
         unset ($this->_aAlerts[$sHash]['begin']);
         $this->_aAlerts[$sHash]['time'] = $this->_formatTime($iTime, 5);

+ 1 - 1
modules/boonex/protean/install/installer.php

@@ -9,7 +9,7 @@
  * @{
  */
 
-class BxProteanInstaller extends BxDolStudioInstaller
+class BxProteanInstaller extends BxBaseModTemplateInstaller
 {
     function __construct($aConfig)
     {

+ 4 - 4
modules/boonex/russian/data/langs/bx_chat_plus/ru.xml

@@ -23,16 +23,16 @@
 	<string name="_bx_chat_plus_information"><![CDATA[Информация]]></string>
 	<string name="_bx_chat_plus_information_block"><![CDATA[Чат сервер должен быть сконфигурирован, чтобы этот модуль заработал. <br />
 
-Нужно ввести URL чата в форме ниже. <br />
+Нужно ввести URL чата в настройках этого модуля. <br />
 
 Затем OAuth модуль должен быть сконфигурирован. <a href="{0}modules/?r=oauth2/administration/">Сгенерируйте пару Ключ & Секрет</a> в модуле OAuth2 сервер указав адрес чата и произвольный заголовок. <br />
 
 После того как пара Ключ & Секрет сгенерированы, нужно указать их в чате: <br />
-Администрирование &gt; OAuth &gt; Dolphin.
+Администрирование &gt; OAuth &gt; Trident.
 
 <hr />
 
-Чтобы заработала "Служба поддержки" нужно включить эту функцию в форме ниже и в чате: Администрирование &gt; Livechat.
-Вставлять специальный JavaScript код в Dolphin не нужно - это делается автоматически.]]></string>
+Чтобы заработала "Служба поддержки" нужно включить эту функцию настройках этого модуля и в чате: Администрирование &gt; Livechat.
+Вставлять специальный JavaScript код не нужно - это делается автоматически.]]></string>
 
 </resources>

+ 3 - 1
modules/boonex/russian/data/langs/bx_oauth/ru.xml

@@ -14,7 +14,9 @@
 	<string name="_bx_oauth_add"><![CDATA[Добавить]]></string>
 	<string name="_bx_oauth_clients"><![CDATA[Клиенты OAuth2]]></string>
 	<string name="_bx_oauth_authorization"><![CDATA[Authorization]]></string>
-	<string name="_bx_oauth_authorize_app"><![CDATA[Выбери профайл, для использования на "{0}" сайте:]]></string>
+    <string name="_bx_oauth_authorize_app"><![CDATA[Выбери профайл, для использования на "{0}" сайте:]]></string>
+    <string name="_bx_oauth_form_valid_url"><![CDATA[Нужно ввести правильный URL]]></string>
+    <string name="_bx_oauth_url"><![CDATA[URL]]></string>
 
 	<string name="_bx_oauth_adm_stg_cpt_type"><![CDATA[OAuth2 сервер]]></string>
 	<string name="_bx_oauth_adm_stg_cpt_category_general"><![CDATA[Общие]]></string>