diff --git a/bl-kernel/abstract/plugin.class.php b/bl-kernel/abstract/plugin.class.php index 42a76d4e..c459d252 100644 --- a/bl-kernel/abstract/plugin.class.php +++ b/bl-kernel/abstract/plugin.class.php @@ -103,13 +103,27 @@ class Plugin { return ''; } - public function setDb($array) + public function setDb($args) { $tmp = array(); - // All fields will be sanitize before save. - foreach($array as $key=>$value) { - $tmp[$key] = Sanitize::html($value); + foreach($this->dbFields as $key=>$value) + { + if(isset($args[$key])) + { + // Sanitize value + $tmpValue = Sanitize::html( $args[$key] ); + + // Set type + settype($tmpValue, gettype($value)); + + // Set value + $tmp[$key] = $tmpValue; + } + else + { + $tmp[$key] = false; + } } $this->db = $tmp; diff --git a/bl-kernel/boot/init.php b/bl-kernel/boot/init.php index 9ff1519a..605b238f 100644 --- a/bl-kernel/boot/init.php +++ b/bl-kernel/boot/init.php @@ -56,6 +56,9 @@ if(!defined('JSON_PRETTY_PRINT')) { define('JSON_PRETTY_PRINT', 128); } +// Alert status ok +define('CHECK_SYMBOLIC_LINKS', FALSE); + // Alert status ok define('ALERT_STATUS_OK', 0); diff --git a/bl-kernel/helpers/sanitize.class.php b/bl-kernel/helpers/sanitize.class.php index 0fab0886..b5482f38 100644 --- a/bl-kernel/helpers/sanitize.class.php +++ b/bl-kernel/helpers/sanitize.class.php @@ -40,7 +40,12 @@ class Sanitize { // Fix for Windows on paths. eg: $path = c:\diego/page/subpage convert to c:\diego\page\subpages $fullPath = str_replace('/', DS, $fullPath); - $real = realpath($fullPath); + if(CHECK_SYMBOLIC_LINKS) { + $real = realpath($fullPath); + } + else { + $real = file_exists($fullPath)?$fullPath:false; + } // If $real is FALSE the file does not exist. if($real===false) { diff --git a/bl-plugins/disqus/plugin.php b/bl-plugins/disqus/plugin.php index c81de08e..25c5822d 100644 --- a/bl-plugins/disqus/plugin.php +++ b/bl-plugins/disqus/plugin.php @@ -2,14 +2,14 @@ class pluginDisqus extends Plugin { - private $disable; + private $enable; public function init() { $this->dbFields = array( 'shortname'=>'', 'enablePages'=>false, - 'enablePosts'=>true, + 'enablePosts'=>false, 'enableDefaultHomePage'=>false ); } @@ -20,25 +20,17 @@ class pluginDisqus extends Plugin { global $Url; - // Disable the plugin IF ... - $this->disable = false; + $this->enable = false; - if( (!$this->getDbField('enablePosts')) && ($Url->whereAmI()=='post') ) { - $this->disable = true; + if( $this->getDbField('enablePosts') && ($Url->whereAmI()=='post') ) { + $this->enable = true; } - elseif( (!$this->getDbField('enablePages')) && ($Url->whereAmI()=='page') ) { - $this->disable = true; + elseif( $this->getDbField('enablePages') && ($Url->whereAmI()=='page') ) { + $this->enable = true; } - elseif( !$this->getDbField('enableDefaultHomePage') && ($Url->whereAmI()=='page') ) + elseif( $this->getDbField('enableDefaultHomePage') && ($Url->whereAmI()=='home') ) { - global $Site; - - if( Text::isNotEmpty($Site->homePage()) ) { - $this->disable = true; - } - } - elseif( ($Url->whereAmI()!='post') && ($Url->whereAmI()!='page') ) { - $this->disable = true; + $this->enable = true; } } @@ -71,41 +63,36 @@ class pluginDisqus extends Plugin { public function postEnd() { - if( $this->disable ) { - return false; + if( $this->enable ) { + return '
'; } - $html = '
'; - return $html; + return false; } public function pageEnd() { - if( $this->disable ) { - return false; + if( $this->enable ) { + return '
'; } - $html = '
'; - return $html; + return false; } public function siteHead() { - if( $this->disable ) { - return false; + if( $this->enable ) { + return ''; } - $html = ''; - return $html; + return false; } public function siteBodyEnd() { - if( $this->disable ) { - return false; - } + if( $this->enable ) { - $html = ' + $html = ' '; - return $html; + return $html; + } + + return false; } -} +} \ No newline at end of file