Browse Source

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

roman.lesnikov@gmail.com 2 years ago
parent
commit
11bf91ca3d

+ 8 - 6
inc/classes/BxDolMetatags.php

@@ -780,7 +780,7 @@ class BxDolMetatags extends BxDolFactory implements iBxDolFactoryObject
      * @param $oSearchResult search results object
      * @param $oSearchResult search results object
      * @param $sCountry country and other location info
      * @param $sCountry country and other location info
      */
      */
-    public function locationsSetSearchCondition($oSearchResult, $sCountry, $sState = false, $sCity = false, $sZip = false)
+    public function locationsSetSearchCondition($oSearchResult, $sCountry = false, $sState = false, $sCity = false, $sZip = false)
     {
     {
         if (empty($this->_aObject['table_locations'])) {
         if (empty($this->_aObject['table_locations'])) {
             $oSearchResult->aCurrent['restriction']['meta_location'] = array(
             $oSearchResult->aCurrent['restriction']['meta_location'] = array(
@@ -791,17 +791,19 @@ class BxDolMetatags extends BxDolFactory implements iBxDolFactoryObject
             return;
             return;
         }
         }
 
 
-        $a = array('country' => 'sCountry', 'state' => 'sState', 'city' => 'sCity', 'zip' => 'sZip');
-        foreach ($a as $sIndex => $sVar) {
+        $aIndexes = ['country' => 'sCountry', 'state' => 'sState', 'city' => 'sCity', 'zip' => 'sZip'];
+        $aOperators = ['city' => 'like'];
+
+        foreach ($aIndexes as $sIndex => $sVar) {
             if (!$$sVar)
             if (!$$sVar)
                 continue;
                 continue;
 
 
-            $oSearchResult->aCurrent['restriction']['meta_location_' . $sIndex] = array(
+            $oSearchResult->aCurrent['restriction']['meta_location_' . $sIndex] = [
                 'value' => $$sVar,
                 'value' => $$sVar,
                 'field' => $sIndex,
                 'field' => $sIndex,
-                'operator' => '=',
+                'operator' => isset($aOperators[$sIndex]) ? $aOperators[$sIndex] : '=',
                 'table' => $this->_aObject['table_locations'],
                 'table' => $this->_aObject['table_locations'],
-            );
+            ];
         }
         }
 
 
         $oSearchResult->aCurrent['join']['meta_location'] = array(
         $oSearchResult->aCurrent['join']['meta_location'] = array(

+ 6 - 0
inc/classes/BxDolSearch.php

@@ -964,6 +964,12 @@ class BxDolSearchResult implements iBxDolReplaceable
                     case 'location_country_city':
                     case 'location_country_city':
                         $o->locationsSetSearchCondition($this, $sKeyword, bx_process_input(isset($this->_aCustomSearchCondition['state']) ? $this->_aCustomSearchCondition['state'] : bx_get('state')), bx_process_input(isset($this->_aCustomSearchCondition['city']) ? $this->_aCustomSearchCondition['city'] : bx_get('city')));
                         $o->locationsSetSearchCondition($this, $sKeyword, bx_process_input(isset($this->_aCustomSearchCondition['state']) ? $this->_aCustomSearchCondition['state'] : bx_get('state')), bx_process_input(isset($this->_aCustomSearchCondition['city']) ? $this->_aCustomSearchCondition['city'] : bx_get('city')));
                         break;
                         break;
+                    case 'location_state':
+                        $o->locationsSetSearchCondition($this, false, $sKeyword);
+                        break;
+                    case 'location_city':
+                        $o->locationsSetSearchCondition($this, false, false, $sKeyword);
+                        break;
                     case 'mention':
                     case 'mention':
                         $oCmts = !empty($this->sModuleObjectComments) ? BxDolCmts::getObjectInstance($this->sModuleObjectComments, 0, false) : false;
                         $oCmts = !empty($this->sModuleObjectComments) ? BxDolCmts::getObjectInstance($this->sModuleObjectComments, 0, false) : false;
                         $o->mentionsSetSearchCondition($this, $sKeyword, $oCmts ? $oCmts->getSystemId() : 0);
                         $o->mentionsSetSearchCondition($this, $sKeyword, $oCmts ? $oCmts->getSystemId() : 0);

+ 0 - 9
inc/utils.inc.php

@@ -2399,7 +2399,6 @@ function bx_api_check_access()
             exit;
             exit;
         }
         }
     }
     }
-    /*
     elseif (getParam('sys_api_access_by_origin') && $sOriginHeader) {
     elseif (getParam('sys_api_access_by_origin') && $sOriginHeader) {
 
 
         if (parse_url($sOriginHeader, PHP_URL_HOST) != parse_url(BX_DOL_URL_ROOT, PHP_URL_HOST)) {
         if (parse_url($sOriginHeader, PHP_URL_HOST) != parse_url(BX_DOL_URL_ROOT, PHP_URL_HOST)) {
@@ -2424,14 +2423,6 @@ function bx_api_check_access()
         header('HTTP/1.0 403 Forbidden');
         header('HTTP/1.0 403 Forbidden');
         echo json_encode(['status' => 403, 'error' => _t("_Access denied")]);
         echo json_encode(['status' => 403, 'error' => _t("_Access denied")]);
         exit;
         exit;
-    }
-     * 
-     */
-
-    if (isset($_GET['demo']) && $_GET['demo'] == 1 ){
-        bx_login(1);
-        check_logged();
-        
     }
     }
 
 
     // TODO: Temporarily to use logged state
     // TODO: Temporarily to use logged state

+ 0 - 5
modules/base/groups/classes/BxBaseModGroupsModule.php

@@ -2126,11 +2126,6 @@ class BxBaseModGroupsModule extends BxBaseModProfileModule
         return $aResult;
         return $aResult;
     }
     }
 
 
-    /*
-     * TODO: Start from here!!!
-     * 
-     * https://neo.so/api.php?r=system/get_page_by_request/TemplServicePages&params[]=view-event-profile/ert&demo=1
-     */
     public function getMenuItemTitleByConnection($sConnection, $sAction, $iContentProfileId, $iInitiatorProfileId = 0)
     public function getMenuItemTitleByConnection($sConnection, $sAction, $iContentProfileId, $iInitiatorProfileId = 0)
     {
     {
         $CNF = $this->_oConfig->getCNF();
         $CNF = $this->_oConfig->getCNF();

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

@@ -1412,6 +1412,11 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
         return $this->_serviceGetTimelineProfileImageAllowedView($aEvent);
         return $this->_serviceGetTimelineProfileImageAllowedView($aEvent);
     }
     }
 
 
+    public function serviceGetMenuItemTitleByConnection($sConnection, $sAction, $iContentProfileId, $iInitiatorProfileId = 0)
+    {
+        return $this->getMenuItemTitleByConnection($sConnection, $sAction, $iContentProfileId, $iInitiatorProfileId);
+    }
+
 
 
     // ====== PERMISSION METHODS
     // ====== PERMISSION METHODS
     /**
     /**
@@ -1596,11 +1601,6 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
         return $o -> getSearchData();
         return $o -> getSearchData();
     }
     }
 
 
-    public function serviceGetMenuItemTitleByConnection($sConnection, $sAction, $iContentProfileId, $iInitiatorProfileId = 0)
-    {
-        return $this->getMenuItemTitleByConnection($sConnection, $sAction, $iContentProfileId, $iInitiatorProfileId);
-    }
-
     /**
     /**
      * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. So make sure to make strict(===) checking.
      * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. So make sure to make strict(===) checking.
      */
      */

+ 1 - 1
modules/boonex/events/classes/BxEventsModule.php

@@ -29,7 +29,7 @@ class BxEventsModule extends BxBaseModGroupsModule implements iBxDolCalendarServ
         ]);
         ]);
 
 
         $this->_aBrowsingFiltersKeys = array_merge($this->_aBrowsingFiltersKeys, [
         $this->_aBrowsingFiltersKeys = array_merge($this->_aBrowsingFiltersKeys, [
-            'by_date', 'date_start', 'date_end', 'timezone'
+            'by_city', 'by_date', 'date_start', 'date_end', 'timezone'
         ]);
         ]);
     }
     }
 
 

+ 5 - 0
modules/boonex/events/classes/BxEventsSearchResult.php

@@ -83,6 +83,11 @@ class BxEventsSearchResult extends BxBaseModGroupsSearchResult
         $oJoinedProfile = null;
         $oJoinedProfile = null;
         $bProcessConditionsForPrivateContent = true;
         $bProcessConditionsForPrivateContent = true;
 
 
+        if(isset($this->_aParams['by_city'])) {
+            $this->setMetaType('location_city');
+            $this->setCustomSearchCondition(['keyword' => $this->_aParams['by_city']]);
+        }
+
         $iDateStart = $iDateEnd = 0;
         $iDateStart = $iDateEnd = 0;
         if(isset($this->_aParams['by_date'])) {
         if(isset($this->_aParams['by_date'])) {
             $iTimezoneOffset = 0;
             $iTimezoneOffset = 0;

+ 5 - 0
modules/boonex/events/classes/BxEventsTemplate.php

@@ -100,6 +100,11 @@ class BxEventsTemplate extends BxBaseModGroupsTemplate
                 'view_mode' => 0,
                 'view_mode' => 0,
             ],
             ],
             'inputs' => [
             'inputs' => [
+                'by_city' => [
+                    'name' => 'by_city',
+                    'type' => 'text',
+                    'caption' => _t('_bx_events_form_filters_input_by_city'),
+                ],
                 'by_date' => [
                 'by_date' => [
                     'name' => 'by_date',
                     'name' => 'by_date',
                     'type' => 'radio_set',
                     'type' => 'radio_set',

+ 1 - 0
modules/boonex/events/install/langs/en.xml

@@ -152,6 +152,7 @@
     <string name="_bx_events_form_price_input_sys_do_cancel"><![CDATA[Cancel]]></string>
     <string name="_bx_events_form_price_input_sys_do_cancel"><![CDATA[Cancel]]></string>
     <string name="_bx_events_form_price_input_do_cancel"><![CDATA[Cancel]]></string>
     <string name="_bx_events_form_price_input_do_cancel"><![CDATA[Cancel]]></string>
 
 
+    <string name="_bx_events_form_filters_input_by_city"><![CDATA[By city]]></string>
     <string name="_bx_events_form_filters_input_by_date"><![CDATA[By date]]></string>
     <string name="_bx_events_form_filters_input_by_date"><![CDATA[By date]]></string>
     <string name="_bx_events_form_filters_input_by_date_all"><![CDATA[Any date]]></string>
     <string name="_bx_events_form_filters_input_by_date_all"><![CDATA[Any date]]></string>
     <string name="_bx_events_form_filters_input_by_date_today"><![CDATA[Today]]></string>
     <string name="_bx_events_form_filters_input_by_date_today"><![CDATA[Today]]></string>

+ 2 - 0
modules/boonex/events/js/main.js

@@ -42,6 +42,8 @@ BxEventsMain.prototype.applyBrowsingFilter = function(oElement, oRequestParams)
     if(oRequestParams == undefined)
     if(oRequestParams == undefined)
         oRequestParams = {};
         oRequestParams = {};
 
 
+    oRequestParams.by_city = oFilters.find("input[name='by_city']").val();
+
     oRequestParams.by_date = oFilters.find("input[name='by_date']:checked").val();
     oRequestParams.by_date = oFilters.find("input[name='by_date']:checked").val();
     if(oRequestParams.by_date == 'date_range') {
     if(oRequestParams.by_date == 'date_range') {
         oRequestParams.date_start = oFilters.find("input[name='date_start']").val();
         oRequestParams.date_start = oFilters.find("input[name='date_start']").val();

+ 12 - 0
modules/boonex/russian/data/langs/bx_events/ru.xml

@@ -128,6 +128,18 @@
     <string name="_bx_events_form_session_input_sys_do_cancel"><![CDATA[Отмена]]></string>
     <string name="_bx_events_form_session_input_sys_do_cancel"><![CDATA[Отмена]]></string>
     <string name="_bx_events_form_session_input_do_cancel"><![CDATA[Отмена]]></string>
     <string name="_bx_events_form_session_input_do_cancel"><![CDATA[Отмена]]></string>
 
 
+    <string name="_bx_events_form_filters_input_by_city"><![CDATA[По городу]]></string>
+    <string name="_bx_events_form_filters_input_by_date"><![CDATA[По дате]]></string>
+    <string name="_bx_events_form_filters_input_by_date_all"><![CDATA[Любая дата]]></string>
+    <string name="_bx_events_form_filters_input_by_date_today"><![CDATA[Сегодня]]></string>
+    <string name="_bx_events_form_filters_input_by_date_tomorrow"><![CDATA[Завтра]]></string>
+    <string name="_bx_events_form_filters_input_by_date_weekend"><![CDATA[В эти выходные]]></string>
+    <string name="_bx_events_form_filters_input_by_date_this_week"><![CDATA[На этой неделе]]></string>
+    <string name="_bx_events_form_filters_input_by_date_next_week"><![CDATA[На следующей неделе]]></string>
+    <string name="_bx_events_form_filters_input_by_date_this_month"><![CDATA[В этом месяце]]></string>
+    <string name="_bx_events_form_filters_input_by_date_date_range"><![CDATA[Диапазон дат]]></string>
+    <string name="_bx_events_form_filters_input_do_apply"><![CDATA[Применить]]></string>
+
     <string name="_bx_events_acl_action_create_profile"><![CDATA[Создать событие]]></string>
     <string name="_bx_events_acl_action_create_profile"><![CDATA[Создать событие]]></string>
     <string name="_bx_events_acl_action_delete_profile"><![CDATA[Удалить событие]]></string>
     <string name="_bx_events_acl_action_delete_profile"><![CDATA[Удалить событие]]></string>
     <string name="_bx_events_acl_action_view_profile"><![CDATA[Просмотреть событие]]></string>
     <string name="_bx_events_acl_action_view_profile"><![CDATA[Просмотреть событие]]></string>

+ 1 - 1
template/scripts/BxBaseServiceConnections.php

@@ -102,7 +102,7 @@ class BxBaseServiceConnections extends BxDol
             $sAction = $aFlip[$sAction];
             $sAction = $aFlip[$sAction];
 
 
         return !empty($aTitles[$sAction]) ? _t($aTitles[$sAction]) : '';
         return !empty($aTitles[$sAction]) ? _t($aTitles[$sAction]) : '';
-    }       
+    }
 
 
     /**
     /**
      * get grid with friends connections
      * get grid with friends connections