Skip to content

Commit

Permalink
refs #1749 : bugfix - plugin config poisoning
Browse files Browse the repository at this point in the history
 * Plugin configuration did not reflect the current plugin.
 * FIXME : unset plugin configuration after calling them
  • Loading branch information
inureyes committed Jul 7, 2015
1 parent c619eb6 commit ecb6e7f
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 25 deletions.
2 changes: 1 addition & 1 deletion framework/alias/DBAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
}
require_once(ROOT . "/framework/data/IAdapter.php");
require_once(ROOT . "/framework/data/" . $dbms . "/Adapter.php");
?>
?>
10 changes: 6 additions & 4 deletions interface/common/blog/end.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@
$context->setProperty('plugin.uri', $context->getProperty('service.path')."/plugins/{$plugin}");
$context->setProperty('plugin.path', ROOT . "/plugins/{$plugin}");
$context->setProperty('plugin.name', ROOT . $plugin);
if( !empty( $configMappings[$plugin]['config'] ) )
$configVal = getCurrentSetting($plugin);
else
if( !empty( $configMappings[$plugin]['config'] ) ) {
$configVal = getCurrentSetting($plugin); // LEGACY SUPPORT
$context->setProperty('plugin.config',Setting::fetchConfigVal($configVal));
} else {
$configVal ='';

$context->setProperty('plugin.config',array());
}
dress($element, call_user_func($pluginData['handler'], $pluginData['parameters']), $view);
}
}
Expand Down
2 changes: 1 addition & 1 deletion interface/owner/entry/setAuthor/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
} else
Respond::PrintResult(array('error' => 1, 'message' => _t('권한이 없습니다.')));

?>
?>
2 changes: 1 addition & 1 deletion interface/owner/entry/tag/panel/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
'entryList' => $entryList
);
Respond::PrintResult($result);
?>
?>
7 changes: 5 additions & 2 deletions interface/owner/plugin/adminHandler/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@

include_once (ROOT . "/plugins/{$plugin}/index.php");
if (function_exists($handler)) {
if( !empty( $configMappings[$plugin]['config'] ) )
if( !empty( $configMappings[$plugin]['config'] ) ) {
$configVal = getCurrentSetting($plugin);
else
$context->setProperty('plugin.config',Setting::fetchConfigVal($configVal));
} else {
$configVal ='';
$context->setProperty('plugin.config',array());
}

call_user_func($handler);
}
Expand Down
7 changes: 5 additions & 2 deletions interface/owner/plugin/adminMenu/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,13 @@
}
include_once (ROOT . "/plugins/{$plugin}/index.php");
if (function_exists($handler)) {
if( !empty( $configMappings[$plugin]['config'] ) )
if( !empty( $configMappings[$plugin]['config'] ) ) {
$configVal = getCurrentSetting($plugin);
else
$context->setProperty('plugin.config',Setting::fetchConfigVal($configVal));
} else {
$configVal ='';
$context->setProperty('plugin.config',array());
}
call_user_func($handler);
}
/// unload.
Expand Down
2 changes: 1 addition & 1 deletion interface/owner/setting/blog/feed/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
clearFeed();
CacheControl::flushSkin();
Respond::ResultPage(0);
?>
?>
2 changes: 1 addition & 1 deletion interface/owner/setting/entry/refreshLine/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
requireStrictRoute();
if(Setting::removeBlogSetting('LineSetting',true)) Respond::ResultPage(0);
else Respond::ResultPage(-1);
?>
?>
7 changes: 5 additions & 2 deletions interface/owner/skin/coverpage/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,13 @@ function pretty_dress($view)
}
if (function_exists($handler))
{
if( !empty( $configMappings[$plugin]['config'] ) )
if( !empty( $configMappings[$plugin]['config'] ) ) {
$configVal = getCurrentSetting($plugin);
else
$context->setProperty('plugin.config',Setting::fetchConfigVal($configVal));
} else {
$configVal ='';
$context->setProperty('plugin.config',array());
}
?>
<li class="coverpage-module coverpage-plugin-module" id="coverpage-element-<?php echo "{$i}-{$j}";?>">
<h4 class="module-title"><?php echo $coverpagePluginArray[$sidbarPluginIndex]['display'], '::', $coverpagePluginArray[$sidbarPluginIndex]['title'];?></h4>
Expand Down
8 changes: 6 additions & 2 deletions interface/owner/skin/coverpage/preview/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,13 @@ function pretty_dress($view)
if (array_key_exists($sidbarPluginIndex, $coverpagePluginArray)) {
$pluginURL = $context->getProperty('service.path')."/plugins/{$target['id']['plugin']}";
include_once (ROOT . "/plugins/{$target['id']['plugin']}/index.php");
if(!empty( $configMappings[$target['id']['plugin']]['config'] ))
if(!empty( $configMappings[$target['id']['plugin']]['config'] )) {
$configVal = getCurrentSetting($target['id']['plugin']);
else $configVal = '';
$context->setProperty('plugin.config',Setting::fetchConfigVal($configVal));
} else {
$configVal = '';
$context->setProperty('plugin.config',array());
}
echo pretty_dress(call_user_func($target['id']['handler'], $target['parameters']));
}
}
Expand Down
2 changes: 1 addition & 1 deletion interface/owner/skin/setting/skin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
} else {
Respond::PrintResult(array('error' => 1, 'msg' => POD::error()));
}
?>
?>
7 changes: 5 additions & 2 deletions interface/owner/skin/sidebar/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,13 @@ function pretty_dress($view)
}
//if (function_exists($handler))
{
if( !empty( $configMappings[$plugin]['config'] ) )
if( !empty( $configMappings[$plugin]['config'] ) ) {
$configVal = getCurrentSetting($plugin);
else
$context->setProperty('plugin.config',Setting::fetchConfigVal($configVal));
} else {
$configVal ='';
$context->setProperty('plugin.config',array());
}
?>
<li class="sidebar-module sidebar-plugin-module" id="sidebar-element-<?php echo "{$i}-{$j}";?>">
<h4 class="module-title"><?php echo $sidebarPluginArray[$sidbarPluginIndex]['display'], '::', $sidebarPluginArray[$sidbarPluginIndex]['title'];?></h4>
Expand Down
8 changes: 6 additions & 2 deletions interface/owner/skin/sidebar/preview/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,13 @@ function pretty_dress($view)
if (array_key_exists($sidbarPluginIndex, $sidebarPluginArray)) {
$pluginURL = $context->getProperty('service.path')."/plugins/{$target['id']['plugin']}";
include_once (ROOT . "/plugins/{$target['id']['plugin']}/index.php");
if(!empty( $configMappings[$target['id']['plugin']]['config'] ))
if(!empty( $configMappings[$target['id']['plugin']]['config'] )) {
$configVal = getCurrentSetting($target['id']['plugin']);
else $configVal = '';
$context->setProperty('plugin.config',Setting::fetchConfigVal($configVal));
} else {
$configVal = '';
$context->setProperty('plugin.config',array());
}
echo pretty_dress(call_user_func($target['id']['handler'], $target['parameters']));
}
}
Expand Down
2 changes: 1 addition & 1 deletion interface/rss/archive/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
fireEvent('FeedOBStart');
echo fireEvent('ViewArchiveRSS', $cache->contents);
fireEvent('FeedOBEnd');
?>
?>
6 changes: 4 additions & 2 deletions library/model/common/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ function getEditorInfo($editor) {
$context->setProperty('plugin.name', $editorMappings[$editor]['plugin']);
$context->setProperty('plugin.path',ROOT . "/plugins/{$pluginName}");
if (!empty($configMappings[$pluginName]['config'])) {
$configVal = getCurrentSetting($pluginName);
$configVal = getCurrentSetting($pluginName);
$context->setProperty('plugin.config',Setting::fetchConfigVal($configVal));
} else {
$configVal = null;
$configVal = null;
$context->setProperty('plugin.config',array());
}
include_once ROOT . "/plugins/{$editorMappings[$editor]['plugin']}/index.php";
}
Expand Down

0 comments on commit ecb6e7f

Please sign in to comment.