Bläddra i källkod

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

Alex Trofimov 12 år sedan
förälder
incheckning
813616ae38

+ 0 - 24
inc/classes/BxDolCmts.php

@@ -306,30 +306,6 @@ class BxDolCmts extends BxDol implements iBxDolReplaceable
         return $GLOBALS['bx_dol_cmts_systems'];
     }
 
-	/**
-     * it is called on cron every day or similar period to clean old comment votes
-     */
-    public static function maintenance() 
-    {
-        $iResult = 0;
-        $oDb = BxDolDb::getInstance();
-
-        $aSystems = self::getSystems();
-        foreach($aSystems as $aSystem) {
-			if(!$aSystem['is_on'])
-				continue;
-
-            $sQuery = $oDb->prepare("DELETE FROM `{$aSystem['table_track']}` WHERE `cmt_rate_ts` < (UNIX_TIMESTAMP() - ?)", BX_CMT_OLD_VOTES);
-            $iDeleted = (int)$oDb->query($sQuery);
-            if($iDeleted > 0)
-            	$oDb->query("OPTIMIZE TABLE `{$aSystem['table_track']}`");
-
-			$iResult += $iDeleted;
-        }
-
-        return $iResult;
-    }
-
     public function init ($iId)
     {
         if (empty($this->iId) && $iId)

+ 0 - 4
inc/classes/BxDolCronPruning.php

@@ -67,10 +67,6 @@ class BxDolCronPruning extends BxDolCron
         bx_import('BxDolVote');
         $iDeletedVotes = BxDolVote::maintenance();
 
-        // clean comments ratings
-        //bx_import('BxDolCmts');
-        //BxDolCmts::maintenance(); // TODO: fix it
-
         echo _t('_sys_pruning_db', $iDeleteMemLevels, $iSessions, $iDeletedViews, $iDeletedVotes, $iDeletedKeys, $iDeletedExpiredTokens, $iDeletedTranscodedImages);
     }
 

+ 2 - 2
modules/boonex/convos/install/config.php

@@ -56,14 +56,14 @@ $aConfig = array(
     ),
     'enable' => array(
         'execute_sql' => 1,
-        'recompile_main_menu' => 1,
+        'recompile_menus' => 1,
         'recompile_permalinks' => 1,
         'recompile_alerts' => 1,
         'clear_db_cache' => 1,
     ),
     'disable' => array (
         'execute_sql' => 1,
-        'recompile_main_menu' => 1,
+        'recompile_menus' => 1,
         'recompile_permalinks' => 1,
         'recompile_alerts' => 1,
         'clear_db_cache' => 1,

+ 3 - 29
modules/boonex/developer/install/config.php

@@ -38,44 +38,18 @@ $aConfig = array(
      * Installation/Uninstallation Section.
      */
     'install' => array(
-        'show_introduction' => 0,
-        'change_permissions' => 0,
         'execute_sql' => 1,
         'update_languages' => 1,
         'recompile_global_paramaters' => 1,
-        'recompile_main_menu' => 0,
-        'recompile_member_menu' => 0,
-        'recompile_site_stats' => 0,
-        'recompile_page_builder' => 1,
-        'recompile_profile_fields' => 0,
-        'recompile_comments' => 0,
-        'recompile_member_actions' => 0,
-        'recompile_votes' => 0,
-        'recompile_injections' => 0,
         'recompile_permalinks' => 1,
-        'recompile_alerts' => 0,
-        'clear_db_cache' => 1,
-        'show_conclusion' => 0
+        'clear_db_cache' => 1
     ),
     'uninstall' => array (
-        'show_introduction' => 0,
-        'change_permissions' => 0,
         'execute_sql' => 1,
         'update_languages' => 1,
         'recompile_global_paramaters' => 1,
-        'recompile_main_menu' => 0,
-        'recompile_member_menu' => 0,
-        'recompile_site_stats' => 0,
-        'recompile_page_builder' => 0,
-        'recompile_profile_fields' => 0,
-        'recompile_comments' => 0,
-        'recompile_member_actions' => 0,
-        'recompile_votes' => 0,
-        'recompile_injections' => 0,
-        'recompile_permalinks' => 0,
-        'recompile_alerts' => 0,
-        'clear_db_cache' => 1,
-        'show_conclusion' => 0
+        'recompile_permalinks' => 1,
+        'clear_db_cache' => 1
     ),
     'enable' => array(
         'execute_sql' => 1,

+ 0 - 37
modules/boonex/developer/js/main.js

@@ -1,37 +0,0 @@
-function BxDevMain(oOptions) {
-    this._sSystem = oOptions.sSystem;
-    this._sActionsUrl = oOptions.sActionUrl;
-    this._sObjName = oOptions.sObjName == undefined ? 'oDevMain' : oOptions.sObjName;
-    this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'slide' : oOptions.sAnimationEffect;
-    this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
-}
-
-BxDevMain.prototype.pgtRecompile = function(sLanguage) {
-    var $this = this;
-    var oDate = new Date();
-    var oParams = {
-        _t:oDate.getTime()
-    };
-
-    if(sTypeParams)
-        oParams['params'] = sTypeParams;
-
-    if($('#articles-filter-chb:checked').length > 0 && $('#articles-filter-txt').val().length > 0)
-        oParams['filter_value'] = $('#articles-filter-txt').val();
-
-    var sLoadingId = '#articles-' + sType + '-loading';
-    $(sLoadingId).bx_loading();
-
-    $.post(
-        this._sActionsUrl + 'act_get_articles/' + (sType ? sType + '/' : '') + iStart + '/' + iPerPage + '/',
-        oParams,
-        function(sData) {
-            $(sLoadingId).bx_loading();
-
-            $('.arl-view #arl-content-' + sType).bx_anim('hide', $this._sAnimationEffect, $this._iAnimationSpeed, function() {
-                $(this).replaceWith(sData);
-            });
-        },
-        'html'
-    );
-};

+ 5 - 8
modules/boonex/developer/request.php

@@ -9,14 +9,11 @@
  * @{
  */
 
-require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolRequest.php' );
+require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
 
-if (isset($aRequest[0]) && 0 == strncmp($aRequest[0], 'act_', 4)) {
-    $aRequest[0] = str_replace('act_', '', $aRequest[0]);
-    // TODO: is header with 'utf8' encoding needed here ?
-    echo BxDolRequest::processAsAction($aModule, $aRequest);
-} else {
-    BxDolRequest::processAsAction($aModule, $aRequest);
-}
+bx_import('BxDolLanguages');
+bx_import('BxDolRequest');
+
+BxDolRequest::processAsAction($GLOBALS['aModule'], $GLOBALS['aRequest']);
 
 /** @} */

+ 1 - 4
modules/boonex/english/data/langs/system.xml

@@ -1231,13 +1231,10 @@
 	<string name="_adm_txt_modules_recompile_comments"><![CDATA[Recompiling comments:]]></string>
 	<string name="_adm_txt_modules_recompile_global_paramaters"><![CDATA[Recompiling global paramaters:]]></string>
 	<string name="_adm_txt_modules_recompile_injections"><![CDATA[Recompiling injections:]]></string>
-	<string name="_adm_txt_modules_recompile_main_menu"><![CDATA[Recompiling main menu:]]></string>
+	<string name="_adm_txt_modules_recompile_menus"><![CDATA[Recompiling menus:]]></string>
 	<string name="_adm_txt_modules_recompile_member_actions"><![CDATA[Recompiling member actions:]]></string>
-	<string name="_adm_txt_modules_recompile_member_menu"><![CDATA[Recompiling member menu:]]></string>
 	<string name="_adm_txt_modules_recompile_member_stats"><![CDATA[Recompiling member statistics:]]></string>
-	<string name="_adm_txt_modules_recompile_page_builder"><![CDATA[Recompiling page builder:]]></string>
 	<string name="_adm_txt_modules_recompile_permalinks"><![CDATA[Recompiling permalinks:]]></string>
-	<string name="_adm_txt_modules_recompile_profile_fields"><![CDATA[Recompiling profile fields:]]></string>
 	<string name="_adm_txt_modules_recompile_search"><![CDATA[Recompiling search:]]></string>
 	<string name="_adm_txt_modules_recompile_site_stats"><![CDATA[Recompiling site statistics:]]></string>
 	<string name="_adm_txt_modules_recompile_votes"><![CDATA[Recompiling votes:]]></string>

+ 2 - 2
modules/boonex/notes/install/config.php

@@ -56,14 +56,14 @@ $aConfig = array(
     ),
     'enable' => array(
         'execute_sql' => 1,
-        'recompile_main_menu' => 1,
+        'recompile_menus' => 1,
         'recompile_permalinks' => 1,
         'recompile_alerts' => 1,
         'clear_db_cache' => 1,
     ),
     'disable' => array (
         'execute_sql' => 1,
-        'recompile_main_menu' => 1,
+        'recompile_menus' => 1,
         'recompile_permalinks' => 1,
         'recompile_alerts' => 1,
         'clear_db_cache' => 1,

+ 2 - 2
modules/boonex/organizations/install/config.php

@@ -56,14 +56,14 @@ $aConfig = array(
     ),
     'enable' => array(
         'execute_sql' => 1,
-        'recompile_main_menu' => 1,
+        'recompile_menus' => 1,
         'recompile_permalinks' => 1,
         'recompile_alerts' => 1,
         'clear_db_cache' => 1,
     ),
     'disable' => array (
         'execute_sql' => 1,
-        'recompile_main_menu' => 1,
+        'recompile_menus' => 1,
         'recompile_permalinks' => 1,
         'recompile_alerts' => 1,
         'clear_db_cache' => 1,

+ 2 - 2
modules/boonex/persons/install/config.php

@@ -56,14 +56,14 @@ $aConfig = array(
     ),
     'enable' => array(
         'execute_sql' => 1,
-        'recompile_main_menu' => 1,
+        'recompile_menus' => 1,
         'recompile_permalinks' => 1,
         'recompile_alerts' => 1,
         'clear_db_cache' => 1,
     ),
     'disable' => array (
         'execute_sql' => 1,
-        'recompile_main_menu' => 1,
+        'recompile_menus' => 1,
         'recompile_permalinks' => 1,
         'recompile_alerts' => 1,
         'clear_db_cache' => 1,

+ 1 - 4
modules/boonex/russian/data/langs/system.xml

@@ -2444,12 +2444,9 @@ Without doing that you won't be submitted to our database.</p>
 	<string name="_adm_txt_modules_install_language"><![CDATA[Install language:]]></string>
 	<string name="_adm_txt_modules_update_languages"><![CDATA[Update languages:]]></string>
 	<string name="_adm_txt_modules_recompile_global_paramaters"><![CDATA[Recompiling global paramaters:]]></string>
-	<string name="_adm_txt_modules_recompile_main_menu"><![CDATA[Recompiling main menu:]]></string>
-	<string name="_adm_txt_modules_recompile_member_menu"><![CDATA[Recompiling member menu:]]></string>
+	<string name="_adm_txt_modules_recompile_menus"><![CDATA[Recompiling menus:]]></string>
 	<string name="_adm_txt_modules_recompile_site_stats"><![CDATA[Recompiling site statistics:]]></string>
 	<string name="_adm_txt_modules_recompile_member_stats"><![CDATA[Recompiling member statistics:]]></string>
-	<string name="_adm_txt_modules_recompile_page_builder"><![CDATA[Recompiling page builder:]]></string>
-	<string name="_adm_txt_modules_recompile_profile_fields"><![CDATA[Recompiling profile fields:]]></string>
 	<string name="_adm_txt_modules_recompile_comments"><![CDATA[Recompiling comments:]]></string>
 	<string name="_adm_txt_modules_recompile_member_actions"><![CDATA[Recompiling member actions:]]></string>
 	<string name="_adm_txt_modules_recompile_votes"><![CDATA[Recompiling votes:]]></string>

+ 4 - 2
modules/boonex/sites/install/config.php

@@ -56,14 +56,16 @@ $aConfig = array(
     ),
     'enable' => array(
         'execute_sql' => 1,
-        'recompile_main_menu' => 1,
+    	'recompile_global_paramaters' => 1,
+        'recompile_menus' => 1,
         'recompile_permalinks' => 1,
         'recompile_alerts' => 1,
         'clear_db_cache' => 1,
     ),
     'disable' => array (
         'execute_sql' => 1,
-        'recompile_main_menu' => 1,
+	    'recompile_global_paramaters' => 1,
+        'recompile_menus' => 1,
         'recompile_permalinks' => 1,
         'recompile_alerts' => 1,
         'clear_db_cache' => 1,

+ 1 - 10
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -654,16 +654,7 @@ class BxTimelineModule extends BxDolModule
 		);
     }
 
-    //--- Check permissions methods ---//
-
-    // TODO: this function is incorrect ,$iAction is never defined, also it looks like it is not used anywhere: rewrite it or delete
-    public function checkActionErrorMsg ($iAction)
-    {
-        $iId = $this->_getAuthorId();
-        $check_res = checkAction($iId, $iAction);
-        return $check_res[CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED ? $check_res[CHECK_ACTION_MESSAGE] : '';
-    }
-    
+    //--- Check permissions methods ---//    
     public function isAllowedPost($bPerform = false)
     {
 		if(isAdmin())

+ 0 - 2
modules/boonex/timeline/install/config.php

@@ -54,14 +54,12 @@ $aConfig = array(
     ),
     'enable' => array(
         'execute_sql' => 1,
-        'recompile_main_menu' => 0,
         'recompile_permalinks' => 1,
         'recompile_alerts' => 1,
         'clear_db_cache' => 1,
     ),
     'disable' => array (
         'execute_sql' => 1,
-        'recompile_main_menu' => 0,
         'recompile_permalinks' => 1,
         'recompile_alerts' => 1,
         'clear_db_cache' => 1,

+ 2 - 10
modules/boonex/uni/install/config.php

@@ -44,22 +44,14 @@ $aConfig = array(
      * Installation/Uninstallation Section.
      */
     'install' => array(
-        'show_introduction' => 0,
-        'change_permissions' => 0,
         'execute_sql' => 1,
         'update_languages' => 1,
-        'recompile_global_paramaters' => 1,
-        'clear_db_cache' => 0,
-        'show_conclusion' => 0
+        'recompile_global_paramaters' => 1
     ),
     'uninstall' => array (
-        'show_introduction' => 0,
-        'change_permissions' => 0,
         'execute_sql' => 1,
         'update_languages' => 1,
-        'recompile_global_paramaters' => 1,
-        'clear_db_cache' => 0,
-        'show_conclusion' => 0
+        'recompile_global_paramaters' => 1
     ),
     'enable' => array(
         'execute_sql' => 1

+ 3 - 57
studio/classes/BxDolStudioInstaller.php

@@ -690,60 +690,14 @@ class BxDolStudioInstaller extends BxDolInstallerUtils {
         $bResult = $this->oDb->cacheParamsClear();
         return $bResult ? BX_DOL_STUDIO_INSTALLER_SUCCESS : BX_DOL_STUDIO_INSTALLER_FAILED;
     }
-    function actionRecompileMainMenu($sOperation) {
-        /*
-        TODO: Update the code when menu engine is rewrited.
-    	bx_import('BxDolMenu');
-        $bResult = BxDolMenu::getInstance()->_compile();
-		*/
-
-        $bResult = true;
-        return $bResult ? BX_DOL_STUDIO_INSTALLER_SUCCESS : BX_DOL_STUDIO_INSTALLER_FAILED;
-    }
-    function actionRecompileMemberMenu($sOperation) {
-        /*
-        //TODO: Recreate if the feature will be available.
-        bx_import('BxDolMemberMenu');
-        $oMemberMenu = new BxDolMemberMenu();
-
-        $bResult = $oMemberMenu->deleteMemberMenuCaches();
-        */
-
-        $bResult = true;
+    function actionRecompileMenus($sOperation) {
+        $bResult = $this->oDb->cleanCache('sys_objects_menu');
         return $bResult ? BX_DOL_STUDIO_INSTALLER_SUCCESS : BX_DOL_STUDIO_INSTALLER_FAILED;
     }
     function actionRecompileSiteStats($sOperation) {
         $bResult = $this->oDb->cleanCache('sys_stat_site');
         return $bResult ? BX_DOL_STUDIO_INSTALLER_SUCCESS : BX_DOL_STUDIO_INSTALLER_FAILED;
     }
-    function actionRecompilePageBuilder($sOperation) {
-        /*
-		//TODO: Recreate when cache engine is available. 
-    	bx_import('BxDolPageViewCacher');
-
-        ob_start();
-        $oPVCacher = new BxDolPageViewCacher('sys_page_compose', 'sys_page_compose.inc');
-        $bResult = $oPVCacher->createCache();
-        ob_get_clean();
-        */
-
-        $bResult = true;
-        return $bResult ? BX_DOL_STUDIO_INSTALLER_SUCCESS : BX_DOL_STUDIO_INSTALLER_FAILED;
-    }
-    function actionRecompileProfileFields($sOperation) {
-        /*
-		//TODO: Recreate when cache engine is available. 
-    	bx_import('BxDolPFMCacher');
-
-        ob_start();
-        $oBxDolPFMCacher = new BxDolPFMCacher();
-        $bResult = $oBxDolPFMCacher -> createCache();
-        ob_get_clean();
-		*/
-
-        $bResult = true;
-        return $bResult ? BX_DOL_STUDIO_INSTALLER_SUCCESS : BX_DOL_STUDIO_INSTALLER_FAILED;
-    }
     function actionRecompileComments($sOperation) {        
         $bResult = $this->oDb->cleanCache('sys_objects_cmts');
         return $bResult ? BX_DOL_STUDIO_INSTALLER_SUCCESS : BX_DOL_STUDIO_INSTALLER_FAILED;
@@ -765,18 +719,10 @@ class BxDolStudioInstaller extends BxDolInstallerUtils {
     function actionRecompilePermalinks($sOperation) {
         $bResult = true;
 
-        ob_start();
         bx_import('BxDolPermalinks');
         $bResult = $bResult && BxDolPermalinks::getInstance()->cacheInvalidate();
 
-        /*
-        TODO: Update the code when menu engine is rewrited. 
-        bx_import('BxDolMenu');
-        $bResult = $bResult && BxDolMenu::getInstance()->_compile();
-		*/
-
-        $bResult = $bResult && $this->oDb->cleanCache('sys_menu_member');
-        ob_get_clean();
+        $bResult = $bResult && ($this->actionRecompileMenus($sOperation) == BX_DOL_STUDIO_INSTALLER_SUCCESS);
 
         return $bResult ? BX_DOL_STUDIO_INSTALLER_SUCCESS : BX_DOL_STUDIO_INSTALLER_FAILED;
     }

+ 1 - 3
studio/classes/BxDolStudioOAuth.php

@@ -113,7 +113,7 @@ class BxDolStudioOAuth extends BxDol implements iBxDolSingleton {
 			    	return $this->processServerError($aRequestToken);
 
 			    $this->oSession->setValue('sys_oauth_secret', $aRequestToken['oauth_token_secret']);
-			    return _t('_adm_msg_oauth_need_authorize', bx_append_url_params(BX_DOL_OAUTH_URL_AUTHORIZE, array('oauth_token' => $aRequestToken['oauth_token'], 'sid' => generateSid())));
+			    return _t('_adm_msg_oauth_need_authorize', bx_append_url_params(BX_DOL_OAUTH_URL_AUTHORIZE, array('oauth_token' => $aRequestToken['oauth_token'], 'sid' => bx_site_hash())));
 			}
 
 			//--- Get access token. 
@@ -135,7 +135,6 @@ class BxDolStudioOAuth extends BxDol implements iBxDolSingleton {
 			}
 		}
 		catch(OAuthException $e) {
-			//TODO: Write in LOG print_r($e)
 			return _t('_adm_err_oauth_cannot_get_token');
 		}
     }
@@ -157,7 +156,6 @@ class BxDolStudioOAuth extends BxDol implements iBxDolSingleton {
 			return json_decode($oConsumer->getLastResponse(), true);
 		}
     	catch(OAuthException $e) {
-    		//TODO: Write in LOG print_r($e);
 			return array();
 		}
     }

+ 1 - 1
studio/classes/BxDolStudioStore.php

@@ -374,7 +374,7 @@ class BxDolStudioStore extends BxTemplStudioPage {
 		foreach($aItems as $aItem)
 			$aIds[] = $aItem['item_id'];
 
-		$sSid = generateSid();
+		$sSid = bx_site_hash();
 		return BX_DOL_UNITY_URL_MARKET . 'purchase/' . $sVendor . '?sid=' . $sSid . '&products=' . base64_encode(implode(',', $aIds));
     }
 

+ 0 - 8
studio/inc/utils.inc.php

@@ -5,14 +5,6 @@
  * @license     CC-BY - http://creativecommons.org/licenses/by/3.0/
  */
 
-/*
- * Returns unique SID for communication with BoonEx Unity.
- * @see BxDolStudioStore  -> checkoutCart and BxDolStudioOAuth -> authorize
- */
-function generateSid() {
-	return md5(BX_DOL_URL_ROOT . '_' . getParam('sys_version')); // TODO: maybe change to bx_site_hash() ?
-}
-
 function bx_array_insert_before($aInsert, $aSource, $sKey) {
 	return bx_array_insert($aInsert, $aSource, $sKey, 0);
 }

+ 1 - 0
studio/module.php

@@ -11,6 +11,7 @@
 require_once('./../inc/header.inc.php');
 require_once(BX_DIRECTORY_PATH_INC . 'design.inc.php');
 require_once(BX_DIRECTORY_PATH_PLUGINS . 'Services_JSON.php');
+require_once(BX_DOL_DIR_STUDIO_INC . 'utils.inc.php');
 
 bx_import('BxDolLanguages');