mirror of
https://github.com/e107inc/e107.git
synced 2025-08-12 17:44:37 +02:00
Bugtracker #3984 - prevent uninstalled shortcodes from showing
This commit is contained in:
@@ -12,9 +12,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
|
||||
| $Revision: 1.7 $
|
||||
| $Date: 2007-06-13 02:53:21 $
|
||||
| $Author: mcfly_e107 $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2007-07-18 20:46:32 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@@ -30,10 +30,10 @@ function register_shortcode($code, $filename, $function, $force=false)
|
||||
}
|
||||
|
||||
class e_shortcode {
|
||||
var $scList;
|
||||
var $parseSCFiles;
|
||||
var $addedCodes;
|
||||
var $registered_codes;
|
||||
var $scList; // The actual code - added by parsing files or when plugin codes encountered. Array key is the shortcode name.
|
||||
var $parseSCFiles; // True if shortcode file has been parsed
|
||||
var $addedCodes; // Apparently not used
|
||||
var $registered_codes; // Shortcodes added by plugins
|
||||
|
||||
function e_shortcode()
|
||||
{
|
||||
@@ -55,6 +55,7 @@ class e_shortcode {
|
||||
$code = strtoupper($code);
|
||||
$this->registered_codes[$code]['type'] = 'plugin';
|
||||
$this->registered_codes[$code]['path'] = $path;
|
||||
$this->registered_codes[$code]['perms'] = $uclass; // Add this in
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,12 +146,14 @@ class e_shortcode {
|
||||
}
|
||||
else
|
||||
{
|
||||
$sc_perms = e_UC_PUBLIC; // Default permissions are 'everybody'
|
||||
if ($this->parseSCFiles == TRUE)
|
||||
{
|
||||
if (is_array($this -> registered_codes) && array_key_exists($code, $this->registered_codes))
|
||||
{
|
||||
if($this->registered_codes[$code]['type'] == 'plugin')
|
||||
{
|
||||
if (isset($this->registered_codes[$code]['perms'])) $sc_perms = $this->registered_codes[$code]['perms'];
|
||||
$scFile = e_PLUGIN.strtolower($this->registered_codes[$code]['path']).'/'.strtolower($code).'.sc';
|
||||
}
|
||||
else
|
||||
@@ -162,7 +165,13 @@ class e_shortcode {
|
||||
{
|
||||
$scFile = e_FILE."shortcode/".strtolower($code).".sc";
|
||||
}
|
||||
if (file_exists($scFile)) {
|
||||
if (!check_class($sc_perms))
|
||||
{ // Mainly to pick up e_UC_NOBODY
|
||||
$shortcode = 'return;';
|
||||
$this->scList[$code] = 'return;';
|
||||
}
|
||||
elseif (file_exists($scFile))
|
||||
{
|
||||
$shortcode = file_get_contents($scFile);
|
||||
$this->scList[$code] = $shortcode;
|
||||
}
|
||||
@@ -177,8 +186,9 @@ class e_shortcode {
|
||||
|
||||
if(E107_DBG_SC)
|
||||
{
|
||||
echo " sc= ".str_replace(e_FILE."shortcode/","",$scFile)."<br />";
|
||||
}
|
||||
echo ($scFile) ? "<br />sc_file= ".str_replace(e_FILE."shortcode/","",$scFile)."<br />" : "";
|
||||
echo "<br />sc= <b>$code</b>";
|
||||
}
|
||||
|
||||
if(E107_DBG_BBSC)
|
||||
{
|
||||
|
Reference in New Issue
Block a user