1
0
Эх сурвалжийг харах

Ticket #257 - The feature itself.

AntonLV 10 жил өмнө
parent
commit
bbe0e6636c

+ 93 - 0
inc/classes/BxDolDesigns.php

@@ -0,0 +1,93 @@
+<?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    TridentCore Trident Core
+ * @{
+ */
+
+class BxDolDesigns extends BxDol implements iBxDolSingleton
+{
+    protected $sDesign;
+    protected $oDesign;
+
+    protected $aParams;
+
+    function __construct()
+    {
+        if (isset($GLOBALS['bxDolClasses'][get_class($this)]))
+            trigger_error ('Multiple instances are not allowed for the class: ' . get_class($this), E_USER_ERROR);
+
+        parent::__construct();
+    }
+
+    /**
+     * Prevent cloning the instance
+     */
+    public function __clone()
+    {
+        if (isset($GLOBALS['bxDolClasses'][get_class($this)]))
+            trigger_error('Clone is not allowed for the class: ' . get_class($this), E_USER_ERROR);
+    }
+
+    /**
+     * Get singleton instance of the class
+     */
+    static function getInstance()
+    {
+        if(!isset($GLOBALS['bxDolClasses'][__CLASS__])) {
+            $GLOBALS['bxDolClasses'][__CLASS__] = new BxDolDesigns();
+            $GLOBALS['bxDolClasses'][__CLASS__]->init();
+        }
+
+        return $GLOBALS['bxDolClasses'][__CLASS__];
+    }
+
+    protected function init()
+    {
+    	$this->sDesign = BxDolTemplate::getInstance()->getCode();
+
+    	$aDesign = BxDolModuleQuery::getInstance()->getModuleByUri($this->sDesign);
+    	if(!empty($aDesign) && is_array($aDesign))
+    		$this->oDesign = BxDolModule::getInstance($aDesign['name']);
+
+    	//--- Init site's logo params.
+    	if($this->oDesign instanceof BxDolModule && method_exists($this->oDesign->_oConfig, 'getLogoParams'))
+    		list(
+    			$this->aParams['logo'], 
+    			$this->aParams['logo_alt'], 
+    			$this->aParams['logo_width'], 
+    			$this->aParams['logo_height']
+    		) = $this->oDesign->_oConfig->getLogoParams();
+    }
+
+    public function getSiteLogo()
+    {
+    	return $this->getSiteLogoParam('logo');
+    }
+	public function getSiteLogoAlt()
+    {
+    	return $this->getSiteLogoParam('logo_alt');
+    }
+	public function getSiteLogoWidth()
+    {
+    	return $this->getSiteLogoParam('logo_width');
+    }
+	public function getSiteLogoHeight()
+    {
+    	return $this->getSiteLogoParam('logo_height');
+    }
+    protected function getSiteLogoParam($sName)
+    {
+    	if(!empty($this->aParams[$sName])) {
+    		$sResult = getParam($this->aParams[$sName]);
+    		if(!empty($sResult))
+    			return $sResult;
+    	}
+
+    	return getParam('sys_site_' . $sName);
+    }
+}
+
+/** @} */

+ 76 - 15
studio/classes/BxDolStudioDesign.php

@@ -9,14 +9,21 @@
 
 define('BX_DOL_STUDIO_TEMPL_DEFAULT', 'basic');
 define('BX_DOL_STUDIO_TEMPL_TYPE_SETTINGS', 'settings');
+define('BX_DOL_STUDIO_TEMPL_TYPE_LOGO', 'logo');
 define('BX_DOL_STUDIO_TEMPL_TYPE_DEFAULT', BX_DOL_STUDIO_TEMPL_TYPE_SETTINGS);
 
+
 class BxDolStudioDesign extends BxTemplStudioPage
 {
+    protected $MODULE;
+
     protected $sTemplate;
     protected $aTemplate;
     protected $sPage;
 
+    protected $sManageUrlPattern;
+    protected $sManageUrl;
+
     public function __construct($sTemplate = "", $sPage = "")
     {
         parent::__construct($sTemplate);
@@ -31,24 +38,36 @@ class BxDolStudioDesign extends BxTemplStudioPage
         if(is_string($sPage) && !empty($sPage))
             $this->sPage = $sPage;
 
-        //--- Check actions ---//
-        if(($sAction = bx_get('templ_action')) !== false) {
-            $sAction = bx_process_input($sAction);
+		$this->sManageUrl = BX_DOL_URL_STUDIO . 'design.php?name=' . $this->sTemplate;
+    }
+
+	public static function getObjectInstance($sModule = "", $sPage = "", $bInit = true)
+	{
+	    $oModuleDb = BxDolModuleQuery::getInstance();
+
+        $sClass = 'BxTemplStudioDesign';
+	    if($sModule != '' && $oModuleDb->isModuleByName($sModule)) {
+	        $aModule = $oModuleDb->getModuleByName($sModule);
 
-            $aResult = array('code' => 1, 'message' => _t('_adm_dsg_err_cannot_process_action'));
-            switch($sAction) {
-                case 'activate':
-                    $sValue = bx_process_input(bx_get('templ_value'));
-                    if(empty($sValue))
-                        break;
+	        if(file_exists(BX_DIRECTORY_PATH_MODULES . $aModule['path'] . 'classes/' . $aModule['class_prefix'] . 'StudioPage.php')) {
+	            bx_import('StudioPage', $aModule);
+	            $sClass = $aModule['class_prefix'] . 'StudioPage';
+	        }
+	    }
 
-                    $aResult = $this->activate($sValue);
-                    break;
-            }
+	    $oObject = new $sClass($sModule, $sPage);
+	    if($bInit)
+	    	$oObject->init();
 
-            echo json_encode($aResult);
-            exit;
-        }
+	    return $oObject;
+	}
+
+	public function init()
+    {
+    	$this->checkAction();
+
+    	$oDesigner = $this->getObjectDesigner();
+    	$oDesigner->checkAction();
 
         $this->aTemplate = BxDolModuleQuery::getInstance()->getModuleByName($this->sTemplate);
         if(empty($this->aTemplate) || !is_array($this->aTemplate))
@@ -66,6 +85,37 @@ class BxDolStudioDesign extends BxTemplStudioPage
         ), false);
     }
 
+    public function checkAction()
+    {
+    	$sAction = bx_get('templ_action');
+    	if($sAction === false)
+    		return;
+
+		$sAction = bx_process_input($sAction);
+
+		$aResult = array('code' => 1, 'message' => _t('_adm_dsg_err_cannot_process_action'));
+		switch($sAction) {
+			case 'activate':
+				$sValue = bx_process_input(bx_get('templ_value'));
+				if(empty($sValue))
+					break;
+
+				$aResult = $this->activate($sValue);
+				break;
+
+			case 'delete_logo':
+				$oPage = $this->getObjectDesigner();
+
+				$aResult = array('code' => 0, 'message' => '');
+				if(!$oPage->deleteLogo())
+					$aResult = array('code' => 2, 'message' => _t('_adm_dsg_err_remove_old_logo'));
+				break;
+		}
+
+		echo json_encode($aResult);
+		exit;
+    }
+
     public function activate($sTemplate)
     {
         $aTemplate = BxDolModuleQuery::getInstance()->getModuleByName($sTemplate);
@@ -100,6 +150,17 @@ class BxDolStudioDesign extends BxTemplStudioPage
 
         return $aResult;
     }
+
+    protected function getObjectDesigner()
+    {
+    	$oPage = new BxTemplStudioDesigner($this->sPage);
+    	$oPage->setManageUrl($this->sManageUrl);
+
+    	$oModule = BxDolModule::getInstance($this->MODULE);
+    	$oPage->setLogoParams($oModule->_oConfig->getLogoParams());
+
+    	return $oPage;
+    }
 }
 
 /** @} */

+ 63 - 38
studio/classes/BxDolStudioDesigner.php

@@ -19,6 +19,13 @@ class BxDolStudioDesigner extends BxTemplStudioPage
 {
     protected $sPage;
 
+    protected $sManageUrl;
+
+    protected $sParamLogo;
+    protected $sParamLogoAlt;
+    protected $sParamLogoWidth;
+    protected $sParamLogoHeight;
+
     function __construct($sPage = "")
     {
         parent::__construct('designer');
@@ -29,39 +36,57 @@ class BxDolStudioDesigner extends BxTemplStudioPage
         if(is_string($sPage) && !empty($sPage))
             $this->sPage = $sPage;
 
-        //--- Check actions ---//
-        if(($sAction = bx_get('dsg_action')) !== false) {
-            $sAction = bx_process_input($sAction);
-
-            $aResult = array('code' => 1, 'message' => _t('_adm_dsg_err_cannot_process_action'));
-            switch($sAction) {
-                case 'delete_logo':
-                    $aResult = array('code' => 0, 'message' => '');
-                    if(!$this->deleteLogo())
-                        $aResult = array('code' => 2, 'message' => _t('_adm_dsg_err_remove_old_logo'));
-                    break;
-
-                case 'make_default':
-                    $aResult = array('code' => 0, 'message' => '');
-                    if(!$this->makeDefault())
-                        $aResult = array('code' => 2, 'message' => _t('_adm_dsg_err_make_default'));
-                    break;
-
-                case 'get-page-by-type':
-                    $sValue = bx_process_input(bx_get('dsg_value'));
-                    if(empty($sValue))
-                        break;
-
-                    $this->sPage = $sValue;
-                    $aResult = array('code' => 0, 'content' => $this->getPageCode());
-                    break;
-            }
+		$this->sManageUrl = BX_DOL_URL_STUDIO . 'designer.php';
 
-            echo json_encode($aResult);
-            exit;
-        }
+		$this->sParamLogo = 'sys_site_logo';
+		$this->sParamLogoAlt = 'sys_site_logo_alt';
+		$this->sParamLogoWidth = 'sys_site_logo_width';
+		$this->sParamLogoHeight = 'sys_site_logo_height';
     }
 
+    function checkAction()
+    {
+    	$sAction = bx_get('dsg_action');
+    	if($sAction === false)
+    		return;
+
+    	$sAction = bx_process_input($sAction);
+
+		$aResult = array('code' => 1, 'message' => _t('_adm_dsg_err_cannot_process_action'));
+		switch($sAction) {
+			case 'delete_logo':
+				$aResult = array('code' => 0, 'message' => '');
+				if(!$this->deleteLogo())
+					$aResult = array('code' => 2, 'message' => _t('_adm_dsg_err_remove_old_logo'));
+				break;
+
+			case 'make_default':
+				$aResult = array('code' => 0, 'message' => '');
+				if(!$this->makeDefault())
+					$aResult = array('code' => 2, 'message' => _t('_adm_dsg_err_make_default'));
+				break;
+
+			case 'get-page-by-type':
+				$sValue = bx_process_input(bx_get('dsg_value'));
+				if(empty($sValue))
+					break;
+
+				$this->sPage = $sValue;
+				$aResult = array('code' => 0, 'content' => $this->getPageCode());
+				break;
+		}
+
+		echo json_encode($aResult);
+		exit;
+    }
+	function setManageUrl($sUrl)
+	{
+		$this->sManageUrl = $sUrl;
+	}
+	function setLogoParams($aParams)
+	{
+		list($this->sParamLogo, $this->sParamLogoAlt, $this->sParamLogoWidth, $this->sParamLogoHeight) = $aParams;
+	}
     function makeDefault()
     {
         $sValue = bx_get('dsg_value');
@@ -84,18 +109,18 @@ class BxDolStudioDesigner extends BxTemplStudioPage
 
             $iId = $oStorage->storeFileFromForm($_FILES['image'], false, $iProfileId);
             if($iId === false) {
-                $this->oDb->setParam('sys_site_logo', 0);
+                $this->oDb->setParam($this->sParamLogo, 0);
                 return $this->getJsResult(_t('_adm_dsg_err_save') . $oStorage->getErrorString(), false);
             }
 
-            $this->oDb->setParam('sys_site_logo', $iId);
+            $this->oDb->setParam($this->sParamLogo, $iId);
             $oStorage->afterUploadCleanup($iId, $iProfileId);
         }
 
-        $this->oDb->setParam('sys_site_logo_alt', $oForm->getCleanValue('alt'));
-        $this->oDb->setParam('sys_site_logo_width', $oForm->getCleanValue('width'));
-        $this->oDb->setParam('sys_site_logo_height', $oForm->getCleanValue('height'));
-        return $this->getJsResult('_adm_dsg_scs_save', true, true, BX_DOL_URL_STUDIO . 'designer.php?page=' . BX_DOL_STUDIO_DSG_TYPE_LOGO);
+        $this->oDb->setParam($this->sParamLogoAlt, $oForm->getCleanValue('alt'));
+        $this->oDb->setParam($this->sParamLogoWidth, $oForm->getCleanValue('width'));
+        $this->oDb->setParam($this->sParamLogoHeight, $oForm->getCleanValue('height'));
+        return $this->getJsResult('_adm_dsg_scs_save', true, true, bx_append_url_params($this->sManageUrl, array('page' => BX_DOL_STUDIO_DSG_TYPE_LOGO)));
     }
 
     function deleteLogo()
@@ -104,11 +129,11 @@ class BxDolStudioDesigner extends BxTemplStudioPage
 
         $oStorage = BxDolStorage::getObjectInstance('sys_images_custom');
 
-        $iId = (int)getParam('sys_site_logo');
+        $iId = (int)getParam($this->sParamLogo);
         if($iId != 0 && !$oStorage->deleteFile($iId, $iProfileId))
             return false;
 
-        $this->oDb->setParam('sys_site_logo', 0);
+        $this->oDb->setParam($this->sParamLogo, 0);
         return true;
     }
 

+ 24 - 18
studio/classes/BxDolStudioModule.php

@@ -56,24 +56,7 @@ class BxDolStudioModule extends BxTemplStudioPage
 
     public function init()
     {
-        //--- Check Actions ---//
-        if(($sAction = bx_get('mod_action')) !== false) {
-            $sAction = bx_process_input($sAction);
-
-            $aResult = array('code' => 1, 'message' => _t('_adm_mod_err_cannot_process_action'));
-            switch($sAction) {
-                case 'activate':
-                    $sValue = bx_process_input(bx_get('mod_value'));
-                    if(empty($sValue))
-                        break;
-
-                    $aResult = $this->activate($sValue);
-                    break;
-            }
-
-            echo json_encode($aResult);
-            exit;
-        }
+        $this->checkAction();
 
         $this->aModule = $this->oDb->getModuleByName($this->sModule);
         if(empty($this->aModule) || !is_array($this->aModule))
@@ -97,6 +80,29 @@ class BxDolStudioModule extends BxTemplStudioPage
         ), false);
     }
 
+	public function checkAction()
+    {
+    	$sAction = bx_get('mod_action');
+    	if($sAction === false)
+    		return;
+
+		$sAction = bx_process_input($sAction);
+
+		$aResult = array('code' => 1, 'message' => _t('_adm_mod_err_cannot_process_action'));
+		switch($sAction) {
+			case 'activate':
+				$sValue = bx_process_input(bx_get('mod_value'));
+				if(empty($sValue))
+					break;
+
+				$aResult = $this->activate($sValue);
+				break;
+		}
+
+		echo json_encode($aResult);
+		exit;
+    }
+
     public function activate($sModule)
     {
         $aModule = $this->oDb->getModuleByName($sModule);

+ 1 - 7
studio/design.php

@@ -23,13 +23,7 @@ $sName = $sName !== false ? bx_process_input($sName) : '';
 $sPage = bx_get('page');
 $sPage = $sPage !== false ? bx_process_input($sPage) : '';
 
-$sCustomTemplateClass = BX_DIRECTORY_PATH_ROOT . 'templates/tmpl_' . $sName . '/scripts/BxTemplDesign.php';
-if(file_exists($sCustomTemplateClass)) {
-    require_once($sCustomTemplateClass);
-    $oPage = new BxTemplDesign($sName, $sPage);
-}
-else
-	$oPage = new BxTemplStudioDesign($sName, $sPage);
+$oPage = BxDolStudioDesign::getObjectInstance($sName, $sPage);
 
 $oTemplate = BxDolStudioTemplate::getInstance();
 $oTemplate->setPageNameIndex($oPage->getPageIndex());

+ 1 - 0
studio/designer.php

@@ -19,6 +19,7 @@ $sPage = bx_get('page');
 $sPage = $sPage !== false ? bx_process_input($sPage) : '';
 
 $oPage = new BxTemplStudioDesigner($sPage);
+$oPage->checkAction();
 
 $oTemplate = BxDolStudioTemplate::getInstance();
 $oTemplate->setPageNameIndex($oPage->getPageIndex());

+ 1 - 8
studio/template/designer.html

@@ -1,13 +1,6 @@
 __content__
 <script defer type="text/javascript">
 	var __js_object__ = new BxDolStudioDesigner({
-	    sActionUrl: '<bx_url_studio />designer.php',
-	    sLogoPreviewId: '__logo_preview_id__'
+	    sActionUrl: '__action_url__'
 	});
-    $(document).ready (function () {
-        var e = CodeMirror.fromTextArea($('textarea[name=code]').get(0), {
-            lineNumbers: true,
-            mode: "htmlmixed"
-        });
-    });
 </script>

+ 12 - 0
studio/template/designer_cover.html

@@ -0,0 +1,12 @@
+__content__
+<script defer type="text/javascript">
+	var __js_object__ = new BxDolStudioDesigner({
+		sActionUrl: '__action_url__'
+	});
+    $(document).ready (function () {
+        var e = CodeMirror.fromTextArea($('textarea[name=code]').get(0), {
+            lineNumbers: true,
+            mode: "htmlmixed"
+        });
+    });
+</script>

+ 15 - 2
studio/template/scripts/BxBaseStudioDesign.php

@@ -11,7 +11,8 @@
 class BxBaseStudioDesign extends BxDolStudioDesign
 {
     protected $aMenuItems = array(
-        BX_DOL_STUDIO_TEMPL_TYPE_SETTINGS => array('caption' => '_adm_lmi_cpt_settings', 'icon' => 'cogs')
+        BX_DOL_STUDIO_TEMPL_TYPE_SETTINGS => array('caption' => '_adm_lmi_cpt_settings', 'icon' => 'cogs'),
+        BX_DOL_STUDIO_TEMPL_TYPE_LOGO => array('caption' => '_adm_lmi_cpt_logo', 'icon' => 'pencil')
     );
 
     function __construct($sTemplate = "", $sPage = "")
@@ -56,7 +57,7 @@ class BxBaseStudioDesign extends BxDolStudioDesign
             $aMenu[] = array(
                 'name' => $sName,
                 'icon' => $aItem['icon'],
-                'link' => BX_DOL_URL_STUDIO . 'design.php?name=' . $this->sTemplate . '&page=' . $sName,
+                'link' => bx_append_url_params($this->sManageUrl, array('page' => $sName)),
                 'title' => _t($aItem['caption']),
                 'selected' => $sName == $this->sPage
             );
@@ -83,6 +84,18 @@ class BxBaseStudioDesign extends BxDolStudioDesign
             'content' => $oPage->getPageCode()
         ));
     }
+
+    protected function getLogo()
+    {
+    	$oPage = $this->getObjectDesigner();
+
+		$oTemplate = BxDolStudioTemplate::getInstance();
+        $oTemplate->addJs($oPage->getPageJs());
+        $oTemplate->addCss($oPage->getPageCss());
+    	return $oTemplate->parseHtmlByName('design.html', array(
+            'content' => $oPage->getPageCode()
+        ));
+    }
 }
 
 /** @} */

+ 13 - 8
studio/template/scripts/BxBaseStudioDesigner.php

@@ -115,6 +115,7 @@ class BxBaseStudioDesigner extends BxDolStudioDesigner
 
         return $oTemplate->parseHtmlByName('designer.html', array(
             'js_object' => $this->getPageJsObject(),
+        	'action_url' => $this->sManageUrl,
             'content' => $sContent,
         ));
     }
@@ -127,7 +128,7 @@ class BxBaseStudioDesigner extends BxDolStudioDesigner
             'form_attrs' => array(
                 'id' => $this->sLogoFormId,
                 'name' => $this->sLogoFormId,
-                'action' => BX_DOL_URL_STUDIO . 'designer.php',
+                'action' => $this->sManageUrl,
                 'method' => 'post',
                 'enctype' => 'multipart/form-data',
                 'target' => $this->sLogoIframeId
@@ -155,15 +156,15 @@ class BxBaseStudioDesigner extends BxDolStudioDesigner
                     'ajax_action_delete' => $this->getPageJsObject() . '.deleteLogo()',
                     'storage_object' => 'sys_images_custom',
                     'transcoder_object' => 'sys_custom_images',
-                    'transcoder_image_width' => getParam('sys_site_logo_width'),
-                    'transcoder_image_height' => getParam('sys_site_logo_height'),
-                    'value' => (int)getParam('sys_site_logo'),
+                    'transcoder_image_width' => (int)getParam($this->sParamLogoWidth),
+                    'transcoder_image_height' => (int)getParam($this->sParamLogoHeight),
+                    'value' => (int)getParam($this->sParamLogo),
                 ),
                 'width' => array(
                     'type' => 'text',
                     'name' => 'width',
                     'caption' => _t('_adm_stg_cpt_option_sys_site_logo_width'),
-                    'value' => getParam('sys_site_logo_width'),
+                    'value' => (int)getParam($this->sParamLogoWidth),
                     'db' => array (
                         'pass' => 'Int',
                     ),
@@ -172,7 +173,7 @@ class BxBaseStudioDesigner extends BxDolStudioDesigner
                     'type' => 'text',
                     'name' => 'height',
                     'caption' => _t('_adm_stg_cpt_option_sys_site_logo_height'),
-                    'value' => getParam('sys_site_logo_height'),
+                    'value' => (int)getParam($this->sParamLogoHeight),
                     'db' => array (
                         'pass' => 'Int',
                     ),
@@ -182,7 +183,7 @@ class BxBaseStudioDesigner extends BxDolStudioDesigner
                     'name' => 'alt',
                     'caption' => _t('_adm_dsg_txt_alt_text'),
                     'info' => _t('_adm_dsg_dsc_alt_text'),
-                    'value' => getParam('sys_site_logo_alt'),
+                    'value' => getParam($this->sParamLogoAlt),
                     'checker' => array(
                         'func' => '',
                         'params' => array(),
@@ -210,6 +211,7 @@ class BxBaseStudioDesigner extends BxDolStudioDesigner
 
         return $oTemplate->parseHtmlByName('designer.html', array(
             'js_object' => $this->getPageJsObject(),
+        	'action_url' => $this->sManageUrl,
             'content' => $this->getBlockCode(array(
 				'items' => $oTemplate->parseHtmlByName('dsr_logo.html', array('logo_iframe_id' => $this->sLogoIframeId, 'form' => $oForm->getCode())),
 			))
@@ -316,6 +318,7 @@ class BxBaseStudioDesigner extends BxDolStudioDesigner
 
         return $oTemplate->parseHtmlByName('designer.html', array(
             'js_object' => $this->getPageJsObject(),
+        	'action_url' => $this->sManageUrl,
             'content' => $this->getBlockCode(array(
 				'items' => $oTemplate->parseHtmlByName('dsr_icon.html', array('icon_iframe_id' => $this->sIconIframeId, 'form' => $oForm->getCode())),
 			))
@@ -388,8 +391,9 @@ class BxBaseStudioDesigner extends BxDolStudioDesigner
         $oTemplate->addJs(array('codemirror/codemirror.min.js'));
         $oTemplate->addCss(BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'codemirror/|codemirror.css');
 
-		return $oTemplate->parseHtmlByName('designer.html', array(
+		return $oTemplate->parseHtmlByName('designer_cover.html', array(
 			'js_object' => $this->getPageJsObject(),
+			'action_url' => $this->sManageUrl,
 			'content' => $this->getBlockCode(array(
 				'items' => $oTemplate->parseHtmlByName('dsr_cover.html', array(
 					'warning' => MsgBox(_t('_adm_dsg_dsc_cover_warning')),
@@ -406,6 +410,7 @@ class BxBaseStudioDesigner extends BxDolStudioDesigner
 
         return BxDolStudioTemplate::getInstance()->parseHtmlByName('designer.html', array(
             'js_object' => $this->getPageJsObject(),
+        	'action_url' => $this->sManageUrl,
             'content' => $oPage->getPageCode()
         ));
     }

+ 24 - 9
template/scripts/BxBaseFunctions.php

@@ -282,7 +282,9 @@ class BxBaseFunctions extends BxDol implements iBxDolSingleton
      */
     function getMainLogoUrl()
     {
-        $iFileId = (int)getParam('sys_site_logo');
+		$oDesigns = BxDolDesigns::getInstance();
+
+        $iFileId = (int)$oDesigns->getSiteLogo();
         if (!$iFileId) 
             return false;
 
@@ -291,10 +293,13 @@ class BxBaseFunctions extends BxDol implements iBxDolSingleton
         if (!$sFileUrl) 
             return false;
 
-        if (getParam('sys_site_logo_width') > 0)
-            $sFileUrl = bx_append_url_params($sFileUrl, array('x' => getParam('sys_site_logo_width')));
-        if (getParam('sys_site_logo_height') > 0)
-            $sFileUrl = bx_append_url_params($sFileUrl, array('y' => getParam('sys_site_logo_height')));
+		$iLogoWidth = (int)$oDesigns->getSiteLogoWidth();
+        if($iLogoWidth > 0)
+            $sFileUrl = bx_append_url_params($sFileUrl, array('x' => $iLogoWidth));
+
+		$iLogoHeight = (int)$oDesigns->getSiteLogoHeight();
+        if($iLogoHeight > 0)
+            $sFileUrl = bx_append_url_params($sFileUrl, array('y' => $iLogoHeight));
 
         return $sFileUrl;
     }
@@ -305,12 +310,22 @@ class BxBaseFunctions extends BxDol implements iBxDolSingleton
      */
     function getMainLogo()
     {
-        $sAlt = getParam('sys_site_logo_alt') ? getParam('sys_site_logo_alt') : getParam('site_title');
+		$oDesigns = BxDolDesigns::getInstance();
+
+        $sAlt = $oDesigns->getSiteLogoAlt();
+        if(empty($sAlt))
+        	$sAlt = getParam('site_title');
+
         $sLogo = $sAlt;
 
-        if ($sFileUrl = $this->getMainLogoUrl()) {
-            $sMaxWidth = getParam('sys_site_logo_width') > 0 ? 'max-width:' . round(getParam('sys_site_logo_width')/16, 3) . 'rem;' : '';
-            $sMaxHeight = getParam('sys_site_logo_height') > 0 ? 'max-height:' . round(getParam('sys_site_logo_height')/16, 3) . 'rem;' : '';
+        $sFileUrl = $this->getMainLogoUrl();
+        if (!empty($sFileUrl)) {
+        	$iLogoWidth = (int)$oDesigns->getSiteLogoWidth();
+            $sMaxWidth = $iLogoWidth > 0 ? 'max-width:' . round($iLogoWidth/16, 3) . 'rem;' : '';
+
+            $iLogoHeight = (int)$oDesigns->getSiteLogoHeight();
+            $sMaxHeight = $iLogoHeight > 0 ? 'max-height:' . round($iLogoHeight/16, 3) . 'rem;' : '';
+
             $sLogo = '<img style="' . $sMaxWidth . $sMaxHeight . '" src="' . $sFileUrl . '" id="bx-logo" alt="' . bx_html_attribute($sAlt, BX_ESCAPE_STR_QUOTE) . '" />';
         }