Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/unaio/una
Browse files Browse the repository at this point in the history
  • Loading branch information
romanlesnikov committed Mar 23, 2022
2 parents 735aad5 + f348b5f commit cf179a0
Show file tree
Hide file tree
Showing 21 changed files with 177 additions and 78 deletions.
27 changes: 20 additions & 7 deletions inc/js/jquery.dolPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,12 @@
oBtnOk.html(options.params.ok.title);
}

var bFuncOk = options.onClickOk && typeof(options.onClickOk) == 'function';
if(bFuncOk)
options.closeOnOuterClick = false;

oBtnOk.bind('click', function() {
if(options.onClickOk && typeof(options.onClickOk) == 'function')
if(bFuncOk)
options.onClickOk(oAPopup);

oAPopup.dolPopupHide();
Expand Down Expand Up @@ -687,10 +691,15 @@
oBtnNo.html(options.params.no.title);
}

var bFuncYes = options.onClickYes && typeof(options.onClickYes) == 'function';
var bFuncNo = options.onClickNo && typeof(options.onClickNo) == 'function';
if(bFuncYes || bFuncNo)
options.closeOnOuterClick = false;

oBtnYes.bind('click', function(event) {
event.stopPropagation();

if(options.onClickYes && typeof(options.onClickYes) == 'function')
if(bFuncYes)
options.onClickYes(oCPopup);

oCPopup.dolPopupHide();
Expand All @@ -699,7 +708,7 @@
oBtnNo.bind('click', function(event) {
event.stopPropagation();

if (options.onClickNo && typeof(options.onClickNo) == 'function')
if(bFuncNo)
options.onClickNo(oCPopup);

oCPopup.dolPopupHide();
Expand Down Expand Up @@ -763,16 +772,21 @@
sDefBtnCancelTitle = oBtnCancel.html();
oBtnCancel.html(options.params.cancel.title);
}


var bFuncOk = options.onClickOk && typeof(options.onClickOk) == 'function';
var bFuncCancel = options.onClickCancel && typeof(options.onClickCancel) == 'function';
if(bFuncOk || bFuncCancel)
options.closeOnOuterClick = false;

oBtnOk.bind('click', function() {
if(options.onClickOk && typeof(options.onClickOk) == 'function')
if(bFuncOk)
options.onClickOk(oPPopup);

oPPopup.dolPopupHide();
});

oBtnCancel.bind('click', function() {
if(options.onClickCancel && typeof(options.onClickCancel) == 'function')
if(bFuncCancel)
options.onClickCancel(oPPopup);

oPPopup.dolPopupHide();
Expand All @@ -783,7 +797,6 @@
if(typeof(fOnHide) == 'function')
fOnHide(oPPopup);


/**
* Restore default functions and layout
* if the last one was customized.
Expand Down
1 change: 1 addition & 0 deletions install/sql/system.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5357,6 +5357,7 @@ CREATE TABLE IF NOT EXISTS `sys_pages_blocks` (
`title_system` varchar(255) NOT NULL,
`title` varchar(255) NOT NULL,
`designbox_id` int(11) NOT NULL DEFAULT '11',
`class` varchar(128) NOT NULL DEFAULT '',
`submenu` varchar(64) NOT NULL DEFAULT '',
`tabs` tinyint(4) NOT NULL DEFAULT '0',
`async` int(11) NOT NULL DEFAULT '0',
Expand Down
2 changes: 1 addition & 1 deletion modules/boonex/credits/classes/BxCreditsDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public function isHistory($iId)
public function insertHistory($aSet)
{
$sQuery = "INSERT INTO `" . $this->_oConfig->CNF['TABLE_HISTORY'] . "` SET " . $this->arrayToSQL($aSet);
return (int)$this->query($sQuery) > 0;
return (int)$this->query($sQuery) > 0 ? $this->lastId() : false;
}

public function updateHistory($aSet, $aWhere)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ protected function _performActionWithProfileAmount($sAction)
$sMessage = $oForm->getCleanValue('message');
$aResult = $this->_oModule->{'process' . bx_gen_method_name($sAction)}($this->_iUserId, $iProfile, $fAmount, $sMessage);

if((int)$aResult['code'] == 0)
$aRes = ['msg' => _t(!empty($aResult['msg']) ? $aResult['msg'] : '_bx_credits_msg_action_performed')];
if((int)$aResult['code'] == 0) {
if(!empty($aResult['id']))
$aRes = ['grid' => $this->getCode(false), 'blink' => $aResult['id']];
else
$aRes = ['msg' => _t(!empty($aResult['msg']) ? $aResult['msg'] : '_bx_credits_msg_action_performed')];
}
else
$aRes = ['msg' => _t(!empty($aResult['msg']) ? $aResult['msg'] : '_bx_credits_err_cannot_perform_action')];

Expand Down
52 changes: 29 additions & 23 deletions modules/boonex/credits/classes/BxCreditsModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ public function serviceMakePayment($iBuyerPid, $fAmount, $iSellerPid, $sOrder =
return false;

if(!$this->updateProfileBalance($iSellerPid, $iBuyerPid, $fAmount, $sOrder, $sInfo)) {
$this->updateProfileBalance($iBuyerPid, 0, $fAmount, $sOrder, '_bx_credits_txt_history_info_refund');
$this->updateProfileBalance($iBuyerPid, 0, $fAmount, $sOrder, '_bx_credits_txt_history_info_cancellation');
return false;
}

Expand Down Expand Up @@ -736,7 +736,7 @@ public function updateProfileBalance($iFirstPid, $iSecondPid, $fAmount, $sOrder
$fAmountAbs = abs($fAmount);
$sDirection = $fAmount > 0 ? BX_CREDITS_DIRECTION_IN : BX_CREDITS_DIRECTION_OUT;

$this->_oDb->insertHistory(array(
$iHistoryId = $this->_oDb->insertHistory(array(
'first_pid' => $iFirstPid,
'second_pid' => $iSecondPid,
'amount' => $fAmountAbs,
Expand All @@ -747,6 +747,9 @@ public function updateProfileBalance($iFirstPid, $iSecondPid, $fAmount, $sOrder
'date' => time()
));

if(!$iHistoryId)
return false;

bx_alert($this->getName(), 'update_balance', 0, false, array(
'first_pid' => $iFirstPid,
'second_pid' => $iSecondPid,
Expand All @@ -761,7 +764,7 @@ public function updateProfileBalance($iFirstPid, $iSecondPid, $fAmount, $sOrder
'amount' => $fAmountAbs,
));

return true;
return $iHistoryId;
}

public function processGrant($iUserId, $iProfileId, $fAmount, $sMessage = '')
Expand All @@ -773,20 +776,21 @@ public function processGrant($iUserId, $iProfileId, $fAmount, $sMessage = '')
return ['code' => 2, 'msg' => '_bx_credits_err_profile_not_found'];

$sInfo = '_bx_credits_txt_history_info_grant';
if(!$this->updateProfileBalance($iProfileId, 0, $fAmount, '', $sInfo))
$iHistoryId = $this->updateProfileBalance($iProfileId, 0, $fAmount, '', $sInfo);
if(!$iHistoryId)
return ['code' => 3, 'msg' => '_bx_credits_err_cannot_update_balance'];

sendMailTemplate($CNF['ETEMPLATE_GRANTED'], 0, $iProfileId, array(
sendMailTemplate($CNF['ETEMPLATE_GRANTED'], 0, $iProfileId, [
'amount' => $fAmount,
'message' => $sMessage
));
]);

bx_alert($this->getName(), 'granted', 0, false, array(
bx_alert($this->getName(), 'granted', 0, false, [
'profile' => $iProfileId,
'amount' => $fAmount,
));
]);

return array('code' => 0);
return ['code' => 0, 'id' => $iHistoryId];
}

public function processSend($iUserId, $iProfileId, $fAmount, $sMessage = '')
Expand All @@ -804,14 +808,15 @@ public function processSend($iUserId, $iProfileId, $fAmount, $sMessage = '')
$sOrder = $this->_oConfig->getOrder();
$sInfo = !empty($sMessage) ? $sMessage : '_bx_credits_txt_history_info_send';

if(!$this->updateProfileBalance($iUserId, $iProfileId, -$fAmount, $sOrder, $sInfo))
$iHistoryId = $this->updateProfileBalance($iUserId, $iProfileId, -$fAmount, $sOrder, $sInfo);
if(!$iHistoryId)
return ['code' => 3, 'msg' => '_bx_credits_err_cannot_update_balance'];

if(!$this->updateProfileBalance($iProfileId, $iUserId, $fAmount, $sOrder, $sInfo)) {
$sInfo = '_bx_credits_txt_history_info_cancellation';
$this->updateProfileBalance($iUserId, $iProfileId, $fAmount, $sOrder, $sInfo);
$iHistoryId = $this->updateProfileBalance($iUserId, 0, $fAmount, $sOrder, $sInfo);

return ['code' => 3, 'msg' => '_bx_credits_err_cannot_update_balance'];
return ['code' => 3, 'id' => $iHistoryId, 'msg' => '_bx_credits_err_cannot_update_balance'];
}

$oUser = BxDolProfile::getInstance($iUserId);
Expand All @@ -831,7 +836,7 @@ public function processSend($iUserId, $iProfileId, $fAmount, $sMessage = '')
'order' => $sOrder,
]);

return ['code' => 0];
return ['code' => 0, 'id' => $iHistoryId];
}

public function processWithdrawRequest($iUserId, $iProfileId, $fAmount, $sMessage = '')
Expand Down Expand Up @@ -891,28 +896,29 @@ public function processWithdrawConfirm($iUserId, $iProfileId, $fAmount, $sMessag

$oProfile = BxDolProfile::getInstance($iProfileId);
if(!$oProfile)
return array('code' => 1, 'msg' => '_bx_credits_err_profile_not_found');
return ['code' => 1, 'msg' => '_bx_credits_err_profile_not_found'];

$fBalance = $this->getProfileBalance($iProfileId);
if($fAmount > $fBalance)
return array('code' => 2, 'msg' => '_bx_credits_err_low_balance');
return ['code' => 2, 'msg' => '_bx_credits_err_low_balance'];

$sInfo = '_bx_credits_txt_history_info_withdraw';
if(!$this->updateProfileBalance($iProfileId, 0, -$fAmount, '', $sInfo))
return array('code' => 3, 'msg' => '_bx_credits_err_cannot_update_balance');
$iHistoryId = $this->updateProfileBalance($iProfileId, 0, -$fAmount, '', $sInfo);
if(!$iHistoryId)
return ['code' => 3, 'msg' => '_bx_credits_err_cannot_update_balance'];

sendMailTemplate($CNF['ETEMPLATE_WITHDRAW_SENT'], 0, $iProfileId, array(
sendMailTemplate($CNF['ETEMPLATE_WITHDRAW_SENT'], 0, $iProfileId, [
'amount' => $fAmount,
'message' => $sMessage
));
]);

bx_alert($this->getName(), 'withdraw_sent', 0, $iUserId, array(
bx_alert($this->getName(), 'withdraw_sent', 0, $iUserId, [
'performer' => $iUserId,
'profile' => $iProfileId,
'amount' => $fAmount,
));
]);

return array('code' => 0);
return ['code' => 0, 'id' => $iHistoryId];
}

/*
Expand Down
2 changes: 2 additions & 0 deletions modules/boonex/developer/classes/BxDevBuilderPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ protected function onLoadBlock(&$oForm, &$aBlock)
foreach($aDBoxes as $aDBox)
$oForm->aInputs['designbox_id']['values'][] = array('key' => $this->sSelectKeyPrefix . $aDBox['id'], 'value' => _t($aDBox['title']));

$oForm->aInputs['class']['value'] = $aBlock['class'];

$aContentPlaceholders = $this->oDb->getContentPlaceholders();
$oForm->aInputs['async']['values'] = array(
array('key' => 0, 'value' => _t('_sys_no_async'))
Expand Down
2 changes: 2 additions & 0 deletions modules/boonex/developer/install/langs/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@
<string name="_bx_dev_bp_txt_sys_block_designbox_id"><![CDATA[Layout]]></string>
<string name="_bx_dev_bp_txt_block_designbox_id"><![CDATA[Layout]]></string>
<string name="_bx_dev_bp_err_block_designbox_id"><![CDATA[You need to select a layout]]></string>
<string name="_bx_dev_bp_txt_sys_block_class"><![CDATA[CSS class]]></string>
<string name="_bx_dev_bp_txt_block_class"><![CDATA[CSS class]]></string>
<string name="_bx_dev_bp_txt_sys_block_async"><![CDATA[Asynchronous Mode]]></string>
<string name="_bx_dev_bp_txt_block_async"><![CDATA[Asynchronous Mode]]></string>
<string name="_bx_dev_bp_txt_sys_block_submenu"><![CDATA[Block submenu]]></string>
Expand Down
16 changes: 9 additions & 7 deletions modules/boonex/developer/install/sql/install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ INSERT INTO `sys_form_inputs` (`object`, `module`, `name`, `value`, `values`, `c
('bx_developer_bp_block', @sName, 'title_system', '', '', 0, 'text', '_bx_dev_bp_txt_sys_block_title_system', '_bx_dev_bp_txt_block_title_system', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
('bx_developer_bp_block', @sName, 'title', '', '', 0, 'text', '_bx_dev_bp_txt_sys_block_title', '_bx_dev_bp_txt_block_title', '', 1, 0, 0, '', '', '', 'Length', 'a:2:{s:3:"min";i:6;s:3:"max";i:100;}', '_bx_dev_bp_err_block_title', 'Xss', '', 0, 0),
('bx_developer_bp_block', @sName, 'designbox_id', '', '', 0, 'select', '_bx_dev_bp_txt_sys_block_designbox_id', '_bx_dev_bp_txt_block_designbox_id', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_dev_bp_err_block_designbox_id', 'Xss', '', 0, 0),
('bx_developer_bp_block', @sName, 'class', '', '', 0, 'text', '_bx_dev_bp_txt_sys_block_class', '_bx_dev_bp_txt_block_class', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),

('bx_developer_bp_block', @sName, 'async', '', '', 0, 'select', '_bx_dev_bp_txt_sys_block_async', '_bx_dev_bp_txt_block_async', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 0, 0),
('bx_developer_bp_block', @sName, 'submenu', '', '', 0, 'select', '_bx_dev_bp_txt_sys_block_submenu', '_bx_dev_bp_txt_block_submenu', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
Expand Down Expand Up @@ -652,13 +653,14 @@ INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_fo
('bx_developer_bp_block_edit', 'hidden_on', 2147483647, 1, 10),
('bx_developer_bp_block_edit', 'visible_for', 2147483647, 1, 11),
('bx_developer_bp_block_edit', 'visible_for_levels', 2147483647, 1, 12),
('bx_developer_bp_block_edit', 'deletable', 2147483647, 1, 13),
('bx_developer_bp_block_edit', 'copyable', 2147483647, 1, 14),
('bx_developer_bp_block_edit', 'active', 2147483647, 1, 15),
('bx_developer_bp_block_edit', 'controls', 2147483647, 1, 16),
('bx_developer_bp_block_edit', 'do_submit', 2147483647, 1, 17),
('bx_developer_bp_block_edit', 'cancel', 2147483647, 1, 18),
('bx_developer_bp_block_edit', 'delete', 2147483647, 1, 19);
('bx_developer_bp_block_edit', 'class', 2147483647, 1, 13),
('bx_developer_bp_block_edit', 'deletable', 2147483647, 1, 14),
('bx_developer_bp_block_edit', 'copyable', 2147483647, 1, 15),
('bx_developer_bp_block_edit', 'active', 2147483647, 1, 16),
('bx_developer_bp_block_edit', 'controls', 2147483647, 1, 17),
('bx_developer_bp_block_edit', 'do_submit', 2147483647, 1, 18),
('bx_developer_bp_block_edit', 'cancel', 2147483647, 1, 19),
('bx_developer_bp_block_edit', 'delete', 2147483647, 1, 20);

--
-- Polyglot -> Grid descriptors
Expand Down
1 change: 1 addition & 0 deletions modules/boonex/english/data/langs/system/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@
<string name="_adm_bp_txt_block_content_service_module"><![CDATA[Module]]></string>
<string name="_adm_bp_txt_block_designbox"><![CDATA[Block Layout]]></string>
<string name="_adm_bp_txt_block_designbox_empty"><![CDATA[Select layout...]]></string>
<string name="_adm_bp_txt_block_class"><![CDATA[CSS Class]]></string>
<string name="_adm_bp_txt_block_help"><![CDATA[Help]]></string>
<string name="_adm_bp_txt_block_hidden_on"><![CDATA[Hidden on]]></string>
<string name="_adm_bp_txt_block_hidden_on_phone"><![CDATA[phone]]></string>
Expand Down
11 changes: 10 additions & 1 deletion modules/boonex/payment/classes/BxPaymentProviderChargebee.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,16 @@ protected function _getDataTransaction(&$aEvent, $sWithStatusCheck = '')
if(empty($aTransaction) || (!empty($sWithStatusCheck) && $aTransaction['status'] != $sWithStatusCheck))
return false;

$aPending = $this->_oModule->_oDb->getOrderPending(array('type' => 'order', 'order' => $aTransaction['subscription_id']));
$sOrder = '';
if(isset($aTransaction['subscription_id']))
$sOrder = $aTransaction['subscription_id'];
else if(isset($aTransaction['id']))
$sOrder = $aTransaction['id'];

if(empty($sOrder))
return false;

$aPending = $this->_oModule->_oDb->getOrderPending(['type' => 'order', 'order' => $sOrder]);
if(empty($aPending) || !is_array($aPending))
return false;

Expand Down
2 changes: 2 additions & 0 deletions modules/boonex/russian/data/langs/bx_developer/ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@
<string name="_bx_dev_bp_txt_sys_block_designbox_id"><![CDATA[Дизайн]]></string>
<string name="_bx_dev_bp_txt_block_designbox_id"><![CDATA[Дизайн]]></string>
<string name="_bx_dev_bp_err_block_designbox_id"><![CDATA[Нужно выбрать дизайн]]></string>
<string name="_bx_dev_bp_txt_sys_block_class"><![CDATA[CSS класс]]></string>
<string name="_bx_dev_bp_txt_block_class"><![CDATA[CSS класс]]></string>
<string name="_bx_dev_bp_txt_sys_block_async"><![CDATA[Асинхронный режим]]></string>
<string name="_bx_dev_bp_txt_block_async"><![CDATA[Асинхронный режим]]></string>
<string name="_bx_dev_bp_txt_sys_block_submenu"><![CDATA[Подменю блока]]></string>
Expand Down
1 change: 1 addition & 0 deletions modules/boonex/russian/data/langs/bx_timeline/ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<string name="_bx_timeline_option_hot_sources_content"><![CDATA[Добавление контента]]></string>
<string name="_bx_timeline_option_hot_sources_comment"><![CDATA[Добавление комментария]]></string>
<string name="_bx_timeline_option_hot_sources_vote"><![CDATA[Добавление голоса]]></string>
<string name="_bx_timeline_option_hot_threshold_age"><![CDATA[Максимальный возраст поста, который включается в 'горячую' хронику (в днях, 0 - без ограничений)]]></string>
<string name="_bx_timeline_option_hot_threshold_comment"><![CDATA[Минимальное количество комментариев, необходимое для появления контента в 'горячей' хронике]]></string>
<string name="_bx_timeline_option_hot_threshold_vote"><![CDATA[Минимальное количество голосов, необходимое для появления контента в 'горячей' хронике]]></string>
<string name="_bx_timeline_option_hot_interval"><![CDATA[Интервал времени (в часах) для получения 'горячих' событий]]></string>
Expand Down
1 change: 1 addition & 0 deletions modules/boonex/russian/data/langs/system/ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@
<string name="_adm_bp_txt_block_content_service_module"><![CDATA[Модуль]]></string>
<string name="_adm_bp_txt_block_designbox"><![CDATA[Отображение блока]]></string>
<string name="_adm_bp_txt_block_designbox_empty"><![CDATA[Выбрать отображение...]]></string>
<string name="_adm_bp_txt_block_class"><![CDATA[CSS класс]]></string>
<string name="_adm_bp_txt_block_help"><![CDATA[Помощь]]></string>
<string name="_adm_bp_txt_block_hidden_on"><![CDATA[Скрыть на]]></string>
<string name="_adm_bp_txt_block_hidden_on_phone"><![CDATA[телефоне]]></string>
Expand Down
4 changes: 3 additions & 1 deletion modules/boonex/timeline/classes/BxTimelineConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig

protected $_bHot;
protected $_iHotInterval;
protected $_iHotThresholdContent;
protected $_iHotThresholdComment;
protected $_iHotThresholdVote;
protected $_aHotSources;
Expand Down Expand Up @@ -416,6 +417,7 @@ public function init(&$oDb)
$this->_sAttachmentsLayout = getParam($sOptionPrefix . 'attachments_layout');

$this->_bHot = getParam($sOptionPrefix . 'enable_hot') == 'on';
$this->_iHotThresholdContent = (int)getParam($sOptionPrefix . 'hot_threshold_age');
$this->_iHotThresholdComment = (int)getParam($sOptionPrefix . 'hot_threshold_comment');
$this->_iHotThresholdVote = (int)getParam($sOptionPrefix . 'hot_threshold_vote');
$this->_iHotInterval = (int)getParam($sOptionPrefix . 'hot_interval');
Expand Down Expand Up @@ -546,7 +548,7 @@ public function isHotSource($sName)

public function getHotThreshold($sSource)
{
if(!in_array($sSource, [BX_TIMELINE_HFS_COMMENT, BX_TIMELINE_HFS_VOTE]))
if(!in_array($sSource, [BX_TIMELINE_HFS_CONTENT, BX_TIMELINE_HFS_COMMENT, BX_TIMELINE_HFS_VOTE]))
return false;

return $this->{'_iHotThreshold' . ucfirst($sSource)};
Expand Down
Loading

0 comments on commit cf179a0

Please sign in to comment.