瀏覽代碼

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

AntonLV 4 年之前
父節點
當前提交
4d18ab840f

+ 5 - 1
inc/classes/BxDolForm.php

@@ -934,6 +934,10 @@ class BxDolForm extends BxDol implements iBxDolReplaceable
             }
         }
 
+        //if this is a comments form then we support it since V13.A3 as a special case
+        if (isset($this->aParams['module']) && $this->aParams['module'] == 'system' && isset($this->aParams['object']) && $this->aParams['object'] == 'sys_comment')
+            return true;
+
         return false;
     }
 
@@ -942,7 +946,7 @@ class BxDolForm extends BxDol implements iBxDolReplaceable
             $oModule = BxDolModule::getInstance($this->aParams['module']);
             $CNF = &$oModule->_oConfig->CNF;
 
-            if (isset($oModule->_oConfig->CNF) && isset($CNF['FIELD_STATUS_ADMIN'])) $aValsToAdd[$CNF['FIELD_STATUS_ADMIN']] = BX_BASE_MOD_TEXT_STATUS_HIDDEN;
+            if (isset($oModule->_oConfig->CNF) && isset($CNF['FIELD_STATUS_ADMIN'])) $aValsToAdd[$CNF['FIELD_STATUS_ADMIN']] = 'pending';
         }
     }
 

+ 2 - 2
inc/js/functions.js

@@ -1173,9 +1173,9 @@ function bx_autocomplete_fields(iId, sUrl, sName, bShowImg, bOnlyOnce, onSelect)
 			if(bShowImg && item.unit != undefined)
 				sImage = item.unit;
 			else if(bShowImg && item.thumb != undefined)
-				sImage = '<img class="bx-def-thumb bx-def-thumb-size bx-def-margin-sec-right" src="' + item.thumb + '">';
+				sImage = '<img class="bx-def-thumb bx-def-icon-size bx-def-margin-sec-right" src="' + item.thumb + '">';
 
-			$(this).before('<b class="bx-def-color-bg-hl bx-def-round-corners">' + sImage + item.label + '<input type="hidden" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" name="' + sName + (bOnlyOnce ? '' : '[]') + '" value="' + item.value + '" /></b>');
+			$(this).before('<b class="val bx-def-color-bg-hl bx-def-round-corners">' + sImage + item.label + '<input type="hidden" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" name="' + sName + (bOnlyOnce ? '' : '[]') + '" value="' + item.value + '" /></b>');
 		}
 
 		if (!bOnlyOnce)

+ 1 - 1
modules/base/profile/classes/BxBaseModProfileModule.php

@@ -336,7 +336,7 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
                 'value' => $r['profile_id'], 
                 'url' => $oProfile->getUrl(),
             	'thumb' => $oProfile->getThumb(),
-                'unit' => $oProfile->getUnit(0, array('template' => 'unit_wo_info'))
+                'unit' => $oProfile->getUnit(0, ['template' => ['name' => 'unit_wo_info', 'size' => 'icon']])
             );
         }
 

+ 2 - 0
modules/boonex/antispam/classes/BxAntispamAlertsResponse.php

@@ -42,6 +42,8 @@ class BxAntispamAlertsResponse extends BxDolAlertsResponse
                     BxDolService::call('bx_antispam', 'on_form_submitted', array($oAlert->aExtras['module'], $oAlert->aExtras['entry_id']));
                     break;
             }
+        } elseif ('comment' == $oAlert->sUnit && BxDolService::call('bx_antispam', 'is_last_form_submitted_toxic', array())) {
+            BxDolService::call('bx_antispam', 'set_comment_as_pending', array($oAlert->iObject));
         }
     }
 }

+ 5 - 0
modules/boonex/antispam/classes/BxAntispamDb.php

@@ -15,6 +15,11 @@ class BxAntispamDb extends BxDolModuleDb
     {
         parent::__construct($oConfig);
     }
+
+    function setCommentStatus($iCmtId, $sStatus) {
+        $sTableName = BxDolCmts::$sTableIds;
+        $this->query("UPDATE `{$sTableName}` SET `status_admin` = :status WHERE `id` = :id", ['id' => $iCmtId, 'status' => $sStatus]);
+    }
 }
 
 /** @} */

+ 21 - 6
modules/boonex/antispam/classes/BxAntispamModule.php

@@ -16,6 +16,7 @@ class BxAntispamModule extends BxDolModule
     public function __construct(&$aModule)
     {
         parent::__construct($aModule);
+        $this->_bLastSubmittedFormWasToxic = false;
     }
 
     public function serviceUpdateDisposableDomainsLists ()
@@ -145,9 +146,9 @@ class BxAntispamModule extends BxDolModule
      * @param $isStripSlashes slashes parameter:
      *          BX_SLASHES_AUTO - automatically detect magic_quotes_gpc setting
      *          BX_SLASHES_NO_ACTION - do not perform any action with slashes
-     * @return true if spam detected and content shouln't be recorded, false if content should be processed as usual.
+     * @return true if toxic content detected and content shouln't be recorded, false if content should be processed as usual.
      */
-    public function serviceIsToxic ($sContent, $sIp = '', $isStripSlashes = BX_SLASHES_AUTO)
+    public function serviceIsToxic ($sContent, $sIp = '', $isStripSlashes = BX_SLASHES_AUTO, $bSupressNotification = false)
     {
         if (defined('BX_DOL_CRON_EXECUTE') || isAdmin())
             return false;
@@ -168,6 +169,8 @@ class BxAntispamModule extends BxDolModule
                 if ($oPerspectiveAPI->isToxic($sContent)) {
                     $oPerspectiveAPI->onPositiveDetection($sContent);
                     $aQuickCache[$key] = true;
+
+                    if (!$bSupressNotification) $this->serviceOnToxicContentFound($sContent);
                 }
             }
         }
@@ -209,14 +212,14 @@ class BxAntispamModule extends BxDolModule
             $sFormText .= " ".$val; // collect all text fields into a single text
         }
 
-        if ($this->serviceIsToxic($sFormText)) {
+        if ($this->serviceIsToxic($sFormText, '', BX_SLASHES_AUTO, true)) {
             $this->_bLastSubmittedFormWasToxic = true;
 
             $sActionrequired = $this->_oConfig->getAntispamOption('toxicity_action');
 
             if ($sActionrequired == 'block' || $sActionrequired == 'disapprove' && !$oForm->isStatusFieldSupported()) {
                 $oForm->setValid(false);
-                $this->serviceOnToxicContentBlocked($sFormText);
+                $this->serviceOnToxicContentFound($sFormText);
 
                 if ($sSubmitName)
                     $oForm->aInputs[$sSubmitName]['error'] = _t('_bx_antispam_form_submission_error');
@@ -227,13 +230,21 @@ class BxAntispamModule extends BxDolModule
         }
     }
 
+    public function serviceIsLastFormSubmittedToxic() {
+        return $this->_bLastSubmittedFormWasToxic;
+    }
+
+    public function serviceSetCommentAsPending($iCmtId) {
+        return $this->_oDb->setCommentStatus($iCmtId, BX_CMT_STATUS_PENDING);
+    }
+
     public function serviceOnFormSubmitted($sModule, $iEntry) {
         if ($this->_bLastSubmittedFormWasToxic) {
             $this->serviceOnToxicContentPosted($sModule, $iEntry);
         }
     }
 
-    public function serviceOnToxicContentBlocked(&$sText) {
+    public function serviceOnToxicContentFound(&$sText) {
         if ('on' == $this->_oConfig->getAntispamOption('toxicity_report')) {
             $oProfile = BxDolProfile::getInstance();
             if (!$oProfile) return;
@@ -249,6 +260,10 @@ class BxAntispamModule extends BxDolModule
                 trigger_error('Email template or translation missing: bx_antispam_toxicity_blocked_report', E_USER_ERROR);
 
             sendMail(getParam('site_email'), $aTemplate['Subject'], $aTemplate['Body']);
+
+            bx_alert('bx_antispam', 'toxic_content_found', 0, bx_get_logged_profile_id(), array(
+                'text' => $sText,
+            ));
         }
     }
 
@@ -285,7 +300,7 @@ class BxAntispamModule extends BxDolModule
             bx_alert('bx_antispam', 'toxic_content_posted', $iContentId, bx_get_logged_profile_id(), array(
                 'module' => $sModule,
                 'entry_id' => $iContentId,
-                'etrny_url' => $sContentUrl,
+                'entry_url' => $sContentUrl,
             ));
         }
     }

+ 3 - 1
modules/boonex/antispam/install/sql/enable.sql

@@ -225,7 +225,9 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 ('account', 'check_join', @iHandler),
 ('system', 'check_spam', @iHandler),
 ('system', 'form_check', @iHandler),
-('system', 'form_submitted', @iHandler);
+('system', 'form_submitted', @iHandler),
+('comment', 'added', @iHandler),
+('comment', 'edited', @iHandler);
 
 -- email templates
 

+ 20 - 5
modules/boonex/artificer/data/template/system/css/forms.css

@@ -260,9 +260,10 @@ import url(../../../../../../../template/css/forms.css);
 
 
 /*--- Form field: Auto-siggestion ---*/
+
 .bx-form-value .bx-form-input-autotoken:not(.bx-form-input-labels) {
     float:left;
-    padding: 2px 0;
+    padding: 2px 2px;
     height:auto;
     box-shadow: none;
     min-height: 2.375rem;
@@ -280,9 +281,6 @@ import url(../../../../../../../template/css/forms.css);
 .bx-form-value .bx-form-input-autotoken:not(.bx-form-input-labels) b.val-wo-icon {
     padding-left: 1.5rem;
 }
-.bx-form-value .bx-form-input-autotoken:not(.bx-form-input-labels) b:first-child {
-    margin-left: 0.75rem;
-}
 .bx-form-value .bx-form-input-autotoken:not(.bx-form-input-labels) b:hover {
     opacity: 0.7;
 }
@@ -308,7 +306,6 @@ import url(../../../../../../../template/css/forms.css);
     padding: 0 0 0 0.5rem;
     border: 0;
     box-shadow: none;
-    line-height: 2.5rem;
 }
 .bx-form-value .bx-form-input-autotoken:not(.bx-form-input-labels) .bx-base-pofile-unit-wo-info {
     display: inline-block;
@@ -316,6 +313,23 @@ import url(../../../../../../../template/css/forms.css);
 
     margin-right: 0.5rem;
 }
+.sys-labels .bx-form-input-text.bx-form-input-autotoken b:first-child{
+    margin-left: 2px !important;
+}
+
+.sys-labels .bx-form-input-text.bx-form-input-autotoken.bx-form-input-disabled b{
+    height: 2rem;
+    line-height: 2rem;
+}
+
+.bx-form-value .sys-labels .bx-form-input-autotoken.bx-form-input-labels{
+    padding: 0 !important;
+    padding-top: 2px !important;
+}
+.sys-labels .bx-form-input-text.bx-form-input-autotoken
+{
+    min-height: 2.375rem !important;
+}
 .bx-form-value .bx-form-input-labels > a {
     margin-left: 0.5rem;
 }
@@ -340,3 +354,4 @@ import url(../../../../../../../template/css/forms.css);
 .bx-form-input-wrapper-html .second-toolbar{
     border-bottom:none !important;
 }
+

+ 1 - 1
modules/boonex/decorous/data/template/system/css/default.less

@@ -768,7 +768,7 @@
     .bx-form-value .bx-form-input-price,
     .bx-form-value .bx-form-input-wrapper-price span,
     .bx-form-value .bx-form-input-wrapper-password {
-        height: @bx-height-form-input;
+        height: @bx-height-form-input + 0.25rem;
     }
     .bx-form-value .bx-form-input-text.bx-form-input-autotoken:not(.bx-form-input-labels) b {
         line-height: @bx-height-form-input;

+ 13 - 2
modules/boonex/lucid/data/template/system/css/default.less

@@ -821,9 +821,20 @@
     {
         border-width: 0;
     }
-    .bx-form-value .bx-form-input-text.bx-form-input-autotoken:not(.bx-form-input-labels) b {
-        line-height: @bx-height-form-input;
+    .bx-form-value .bx-form-input-text.bx-form-input-autotoken:not(.bx-form-input-labels) {
+        height: @bx-height-form-input ;
+        line-height: @bx-height-form-input  - 0.5rem;
+        padding: 0.125rem;
+    }
+    
+    .bx-form-value .bx-form-input-text.bx-form-input-autotoken.bx-form-input-labels {
+        padding: 3px 0.125rem;
     }
+    
+    .bx-form-value .bx-form-input-text.bx-form-input-autotoken .ui-autocomplete-input{
+        height: @bx-height-form-input  - 0.5rem;
+    }
+    
     .bx-form-value .bx-form-input-text.bx-form-input-autotoken:not(.bx-form-input-labels) b .bx-def-thumb-size {
         width: @bx-height-form-input;
         height: @bx-height-form-input;

+ 13 - 2
modules/boonex/protean/data/template/system/css/default.less

@@ -728,8 +728,19 @@
     .bx-form-value .bx-form-input-wrapper-password {
         height: @bx-height-form-input;
     }
-    .bx-form-value .bx-form-input-text.bx-form-input-autotoken:not(.bx-form-input-labels) b {
-        line-height: @bx-height-form-input;
+    .bx-form-value .bx-form-input-text.bx-form-input-autotoken:not(.bx-form-input-labels) {
+        height: @bx-height-form-input ;
+        line-height: @bx-height-form-input  - 0.5rem;
+        padding-top: 0.125rem;
+        padding-bottom: 0.125rem;
+    }
+    
+    .bx-form-value .bx-form-input-text.bx-form-input-autotoken.bx-form-input-labels {
+        padding: 3px 0.125rem;
+    }
+    
+    .bx-form-value .bx-form-input-text.bx-form-input-autotoken .ui-autocomplete-input{
+        height: @bx-height-form-input  - 0.5rem;
     }
     .bx-form-value .bx-form-input-text.bx-form-input-autotoken:not(.bx-form-input-labels) b .bx-def-thumb-size {
         width: @bx-height-form-input;

+ 21 - 16
modules/boonex/timeline/js/view.js

@@ -100,6 +100,9 @@ BxTimelineView.prototype.init = function(bForceInit)
 
         //--- Init 'Infinite Scroll'
         this.initInfiniteScroll(this.oView);
+
+        // Init calendar
+        this.initCalendar();
     }
 
     if(this.bViewOutline) {
@@ -595,26 +598,26 @@ BxTimelineView.prototype.changeTimeline = function(oLink, sDate)
     });
 };
 
-BxTimelineView.prototype.showCalendar = function(oLink)
+BxTimelineView.prototype.initCalendar = function()
 {
     var $this = this;
-    var oInput = $(oLink).siblings('.' + this.sSP + '-jump-to-calendar');
+    var oInput = $('.' + $this.sSP + '-jump-to-calendar');
     if(!oInput.length)
         return;
 
-    var sClassProcessed = this.sSP + '-datepicker-processed';
-    if(!oInput.hasClass(sClassProcessed)) {
-        flatpickr(oInput.parent, {
-            wrap: true,
-            dateFormat: "Y-m-d",
-            minDate: 1900,
-            maxDate: "today",
-            onValueUpdate: function(sDate, oPicker){
-                $this.changeTimeline(oLink, sDate);
-            }
-        });
-        oInput.addClass(sClassProcessed);
-    }
+    flatpickr(oInput.parents('.flatpickr').get(0), {
+        wrap: true,
+        dateFormat: "Y-m-d",
+        minDate: 1900,
+        maxDate: "today",
+        onValueUpdate: function(aDates, sDate, oPicker){
+            $this.changeTimeline(oInput.parent(), sDate);
+        }
+    });
+};
+
+BxTimelineView.prototype.showCalendar = function(oLink)
+{
 };
 
 BxTimelineView.prototype.showMore = function(oLink)
@@ -1216,6 +1219,8 @@ BxTimelineView.prototype._onGetPosts = function(oData)
 
         if(oData && oData.empty != undefined)
             $this.oView.find('.' + $this.sSP + '-empty-holder').html($.trim(oData.empty));
+
+        $this.initCalendar();
     };
 
     if(oData && oData.items != undefined) {
@@ -1226,7 +1231,7 @@ BxTimelineView.prototype._onGetPosts = function(oData)
             oItems.html(sItems).bxProcessHtml();
 
             this.blink(oItems);
-            this.initFlickity(this.oView);
+            this.initFlickity(this.oView);            
 
             onComplete();
             return;

+ 2 - 2
modules/boonex/timeline/template/jump_to.html

@@ -4,7 +4,7 @@
     </div>
 </bx_if:show_list>
 <bx_if:show_calendar>
-    <div class="__style_prefix__-jump-to-cnt">
-        <bx_text:_bx_timeline_txt_or_jump_to />&nbsp;<input class="__style_prefix__-jump-to-calendar data-input" type="text" /><a class="bx-btn data-toggle" href="javascript:void(0)" onclick="__onclick__"><i class="sys-icon calendar-alt"></i></a>
+    <div class="__style_prefix__-jump-to-cnt flatpickr">
+        <bx_text:_bx_timeline_txt_or_jump_to />&nbsp;<a data-toggle class="bx-btn" href="javascript:void(0)" onclick="__onclick__"><i class="sys-icon calendar-alt"></i><input class="__style_prefix__-jump-to-calendar" type="text" data-input /></a>
     </div>
 </bx_if:show_calendar>

+ 3 - 5
template/css/forms.css

@@ -640,19 +640,17 @@
 
 /* auto-siggestion input */
 
-.bx-form-value .bx-form-input-autotoken:not(.bx-form-input-labels) {
+.bx-form-value .bx-form-input-autotoken {
     float:left;
     padding:0px;
     height:auto;
     box-shadow: none;
-    min-height: 2.8rem;
+    padding: 2px;
 }
 .bx-form-value .bx-form-input-autotoken b {
     cursor:pointer;
     display:block;
     float:left;
-    line-height: 40px;
-    line-height: 2.5rem;
     padding-right: 1.5em; 
     margin-left:0.1em;
     margin-right:0.1em;
@@ -670,7 +668,7 @@
     content: "\f00d";    
     position:absolute;    
     padding:0 0.5em;
-    margin-left: 0.5em;
+    margin-left: 0.25em;
     font-size:0.7em;
     font-weight:bold;
 }

+ 20 - 9
template/css/label.css

@@ -8,8 +8,6 @@
     box-sizing: border-box;
     height: auto;
     min-height: 2.5rem;
-
-    padding: 0.25rem;
 }
 .sys-labels .bx-form-input-text.bx-form-input-autotoken b,
 .sys-labels .bx-form-input-text.bx-form-input-autotoken input:not([type = 'hidden']) {
@@ -18,7 +16,6 @@
     float: none;
 
     height: 1.625rem;
-    margin: 0.125rem;
 
     line-height: 1.625rem;
 }
@@ -31,22 +28,33 @@
     white-space: nowrap;
     cursor: pointer;
 }
-.sys-labels .bx-form-input-text.bx-form-input-autotoken b:first-child {
-    margin-left: 0.75rem;
-}
+
 .sys-labels .bx-form-input-text.bx-form-input-autotoken b:after {
     top: -1px;
 
     margin: 0;
     padding: 0 0.5rem;
 }
-.sys-labels .bx-form-input-text.bx-form-input-autotoken b.val-placeholder {
-    border-style: dashed;
-}
 .sys-labels .bx-form-input-text.bx-form-input-autotoken.bx-form-input-disabled b {
     padding-left: 0.5rem;
     padding-right: 0.5rem;
+    height: 2rem;
+    line-height: 2rem;
+    margin-right: 0.125rem;
+}
+.sys-labels .bx-form-input-text.bx-form-input-autotoken b.val-placeholder{
+    padding-left: 1.5rem !important;
 }
+.sys-labels .bx-form-input-text.bx-form-input-autotoken b.val-placeholder::before{
+    font-family: 'sys-user', 'sys-user-fal';
+    content: "\f067";
+    position: absolute;
+    margin-left: -1.5em;
+    font-size: 0.7em;
+    font-weight: bold;
+}
+
+
 .sys-labels .bx-form-input-text.bx-form-input-autotoken input:not([type = 'hidden']) {
     width: auto !important;
     padding: 0;
@@ -132,4 +140,7 @@
     white-space: nowrap;
     text-overflow: ellipsis;
     overflow: hidden;
+}
+.sys-labels .bx-form-input-text.bx-form-input-autotoken b:first-child{
+    margin-left: 0.125rem;
 }

+ 2 - 1
template/scripts/BxBaseFormView.php

@@ -2169,11 +2169,12 @@ BLAH;
         $sLang = BxDolLanguages::getInstance()->detectLanguageFromArray ($aLangs);
 
         $this->_addJs(array(
+            'jquery-ui/jquery-ui.custom.min.js',
             'flatpickr/dist/flatpickr.min.js',
             'flatpickr/dist/l10n/' . $sLang . '.js',
         ), "'undefined' === typeof(flatpickr)");
         
-        $this->_addCss(BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'flatpickr/dist/|flatpickr.min.css');
+        $this->_addCss([BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'flatpickr/dist/|flatpickr.min.css', 'jquery-ui/jquery-ui.css']);
 
         self::$_isCssJsUiAdded = true;
     }