mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-03 09:14:48 +09:00
Merge pull request #306 from kijin/pr/plugin-blacklist
호환되지 않거나 불필요한 애드온과 모듈의 실행을 방지
This commit is contained in:
commit
4a79b5ce25
8 changed files with 79 additions and 21 deletions
|
|
@ -1,16 +1,16 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<addon version="0.2">
|
<addon version="0.2">
|
||||||
<title xml:lang="ko">[DEPRECATED] 커뮤니케이션</title>
|
<title xml:lang="ko">커뮤니케이션</title>
|
||||||
<title xml:lang="jp">[DEPRECATED] コミュニケーション</title>
|
<title xml:lang="jp">コミュニケーション</title>
|
||||||
<title xml:lang="zh-CN">[DEPRECATED] 会员交流</title>
|
<title xml:lang="zh-CN">会员交流</title>
|
||||||
<title xml:lang="en">[DEPRECATED] Communication</title>
|
<title xml:lang="en">Communication</title>
|
||||||
<title xml:lang="vi">[DEPRECATED] Truyền thông</title>
|
<title xml:lang="vi">Truyền thông</title>
|
||||||
<title xml:lang="ge">[DEPRECATED] Communication</title>
|
<title xml:lang="ge">Communication</title>
|
||||||
<title xml:lang="es">[DEPRECATED] Communication</title>
|
<title xml:lang="es">Communication</title>
|
||||||
<title xml:lang="ru">[DEPRECATED] Общение</title>
|
<title xml:lang="ru">Общение</title>
|
||||||
<title xml:lang="zh-TW">[DEPRECATED] 交流</title>
|
<title xml:lang="zh-TW">交流</title>
|
||||||
<description xml:lang="ko">
|
<description xml:lang="ko">
|
||||||
[DEPRECATED] 이 애드온은 빈 애드온입니다. 모든 기능은 커뮤니케이션 모듈로 이전되었습니다.
|
이 애드온은 빈 애드온입니다. 모든 기능은 커뮤니케이션 모듈로 이전되었습니다.
|
||||||
</description>
|
</description>
|
||||||
<version>1.7</version>
|
<version>1.7</version>
|
||||||
<date>2013-11-27</date>
|
<date>2013-11-27</date>
|
||||||
|
|
@ -28,4 +28,4 @@
|
||||||
</author>
|
</author>
|
||||||
<extra_vars>
|
<extra_vars>
|
||||||
</extra_vars>
|
</extra_vars>
|
||||||
</addon>
|
</addon>
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,11 @@ class Context
|
||||||
*/
|
*/
|
||||||
public $isSuccessInit = TRUE;
|
public $isSuccessInit = TRUE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin blacklist cache
|
||||||
|
*/
|
||||||
|
private static $_blacklist = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Singleton instance
|
* Singleton instance
|
||||||
* @var object
|
* @var object
|
||||||
|
|
@ -2566,6 +2571,26 @@ class Context
|
||||||
return self::$_instance->allow_rewrite;
|
return self::$_instance->allow_rewrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether an addon, module, or widget is blacklisted
|
||||||
|
*
|
||||||
|
* @param string $plugin_name
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isBlacklistedPlugin($plugin_name)
|
||||||
|
{
|
||||||
|
if (self::$_blacklist === null)
|
||||||
|
{
|
||||||
|
self::$_blacklist = (include RX_BASEDIR . 'common/defaults/blacklist.php');
|
||||||
|
if (!is_array(self::$_blacklist))
|
||||||
|
{
|
||||||
|
self::$_blacklist = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return isset(self::$_blacklist[$plugin_name]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a local path into an URL
|
* Converts a local path into an URL
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1191,6 +1191,12 @@ class ModuleHandler extends Handler
|
||||||
$type = $item->type;
|
$type = $item->type;
|
||||||
$called_method = $item->called_method;
|
$called_method = $item->called_method;
|
||||||
|
|
||||||
|
// do not call if module is blacklisted
|
||||||
|
if (Context::isBlacklistedPlugin($module))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// todo why don't we call a normal class object ?
|
// todo why don't we call a normal class object ?
|
||||||
$oModule = getModule($module, $type);
|
$oModule = getModule($module, $type);
|
||||||
if(!$oModule || !method_exists($oModule, $called_method))
|
if(!$oModule || !method_exists($oModule, $called_method))
|
||||||
|
|
|
||||||
12
common/defaults/blacklist.php
Normal file
12
common/defaults/blacklist.php
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rhymix Default Blacklist for Deprecated Plugins
|
||||||
|
*
|
||||||
|
* Copyright (c) Rhymix Developers and Contributors
|
||||||
|
*/
|
||||||
|
return array(
|
||||||
|
'member_communication' => true,
|
||||||
|
'smartphone' => true,
|
||||||
|
'zipperupper' => true,
|
||||||
|
);
|
||||||
|
|
@ -46,13 +46,23 @@ class addonAdminModel extends addon
|
||||||
$oAutoinstallModel = getModel('autoinstall');
|
$oAutoinstallModel = getModel('autoinstall');
|
||||||
foreach($addonList as $key => $addon)
|
foreach($addonList as $key => $addon)
|
||||||
{
|
{
|
||||||
|
// check blacklist
|
||||||
|
$addonList[$key]->isBlacklisted = Context::isBlacklistedPlugin($addon->addon);
|
||||||
|
|
||||||
// get easyinstall remove url
|
// get easyinstall remove url
|
||||||
$packageSrl = $oAutoinstallModel->getPackageSrlByPath($addon->path);
|
$packageSrl = $oAutoinstallModel->getPackageSrlByPath($addon->path);
|
||||||
$addonList[$key]->remove_url = $oAutoinstallModel->getRemoveUrlByPackageSrl($packageSrl);
|
$addonList[$key]->remove_url = $oAutoinstallModel->getRemoveUrlByPackageSrl($packageSrl);
|
||||||
|
|
||||||
// get easyinstall need update
|
// get easyinstall need update
|
||||||
$package = $oAutoinstallModel->getInstalledPackages($packageSrl);
|
if($addonList[$key]->isBlacklisted)
|
||||||
$addonList[$key]->need_update = $package[$packageSrl]->need_update;
|
{
|
||||||
|
$addonList[$key]->need_update = 'N';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$package = $oAutoinstallModel->getInstalledPackages($packageSrl);
|
||||||
|
$addonList[$key]->need_update = $package[$packageSrl]->need_update;
|
||||||
|
}
|
||||||
|
|
||||||
// get easyinstall update url
|
// get easyinstall update url
|
||||||
if($addonList[$key]->need_update == 'Y')
|
if($addonList[$key]->need_update == 'Y')
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ class addon extends ModuleObject
|
||||||
$oAddonController = getAdminController('addon');
|
$oAddonController = getAdminController('addon');
|
||||||
$oAddonController->doInsert('autolink', 0, 'site', 'Y');
|
$oAddonController->doInsert('autolink', 0, 'site', 'Y');
|
||||||
$oAddonController->doInsert('blogapi');
|
$oAddonController->doInsert('blogapi');
|
||||||
$oAddonController->doInsert('member_communication', 0, 'site', 'Y');
|
|
||||||
$oAddonController->doInsert('member_extra_info', 0, 'site', 'Y');
|
$oAddonController->doInsert('member_extra_info', 0, 'site', 'Y');
|
||||||
$oAddonController->doInsert('mobile', 0, 'site', 'Y');
|
$oAddonController->doInsert('mobile', 0, 'site', 'Y');
|
||||||
$oAddonController->doInsert('resize_image', 0, 'site', 'Y');
|
$oAddonController->doInsert('resize_image', 0, 'site', 'Y');
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ class addonController extends addon
|
||||||
$addon_list = $oAddonModel->getInsertedAddons($site_srl, $gtype);
|
$addon_list = $oAddonModel->getInsertedAddons($site_srl, $gtype);
|
||||||
foreach($addon_list as $addon => $val)
|
foreach($addon_list as $addon => $val)
|
||||||
{
|
{
|
||||||
if($val->addon == "smartphone"
|
if(Context::isBlacklistedPlugin($addon)
|
||||||
|| ($type == "pc" && $val->is_used != 'Y')
|
|| ($type == "pc" && $val->is_used != 'Y')
|
||||||
|| ($type == "mobile" && $val->is_used_m != 'Y')
|
|| ($type == "mobile" && $val->is_used_m != 'Y')
|
||||||
|| ($gtype == 'global' && $val->is_fixed != 'Y')
|
|| ($gtype == 'global' && $val->is_fixed != 'Y')
|
||||||
|
|
|
||||||
|
|
@ -34,23 +34,29 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr loop="$addon_list => $addon">
|
<tr loop="$addon_list => $addon">
|
||||||
<td class="title">
|
<td class="title">
|
||||||
<p><strong>{$addon->title}</strong></p>
|
<p><strong style="color:#aaa"|cond="$addon->isBlacklisted">{$addon->title}</strong></p>
|
||||||
<p>{$addon->description}</p>
|
<p>{$addon->description}</p>
|
||||||
<p cond="$addon->need_update == 'Y'" class="update">
|
<p cond="$addon->need_update == 'Y'" class="update">
|
||||||
{$lang->msg_avail_easy_update} <a href="{$addon->update_url}&return_url={urlencode(getRequestUriByServerEnviroment())}">{$lang->msg_do_you_like_update}</a>
|
{$lang->msg_avail_easy_update} <a href="{$addon->update_url}&return_url={urlencode(getRequestUriByServerEnviroment())}">{$lang->msg_do_you_like_update}</a>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td>{$addon->version}</td>
|
<td><span style="color:#aaa"|cond="$addon->isBlacklisted">{$addon->version}</span></td>
|
||||||
<td class="nowr">
|
<td class="nowr">
|
||||||
<block loop="$addon->author => $author">
|
<block loop="$addon->author => $author">
|
||||||
<a cond="$author->homepage" href="{$author->homepage}" target="_blank">{$author->name}</a>
|
<a cond="$author->homepage" href="{$author->homepage}" target="_blank">{$author->name}</a>
|
||||||
<block cond="!$author->homepage">{$author->name}</block>
|
<block cond="!$author->homepage">{$author->name}</block>
|
||||||
</block>
|
</block>
|
||||||
</td>
|
</td>
|
||||||
<td>{$addon->path}</td>
|
<td><span style="color:#aaa"|cond="$addon->isBlacklisted">{$addon->path}</span></td>
|
||||||
<td><a href="{getUrl('act', 'dispAddonAdminSetup', 'selected_addon', $addon->addon_name)}">{$lang->cmd_setup}</a></td>
|
<td>
|
||||||
<td><input type="checkbox" name="pc_on[]" title="PC" value="{htmlspecialchars($addon->addon_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}" checked="checked"|cond="$addon->activated" /></td>
|
<!--@if($addon->isBlacklisted)-->
|
||||||
<td><input type="checkbox" name="mobile_on[]" title="Mobile" value="{htmlspecialchars($addon->addon_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}" checked="checked"|cond="$addon->mactivated" /></td>
|
<span style="color:#aaa">{$lang->cmd_setup}</span>
|
||||||
|
<!--@else-->
|
||||||
|
<a href="{getUrl('act', 'dispAddonAdminSetup', 'selected_addon', $addon->addon_name)}">{$lang->cmd_setup}</a>
|
||||||
|
<!--@end-->
|
||||||
|
</td>
|
||||||
|
<td><input type="checkbox" name="pc_on[]" title="PC" value="{htmlspecialchars($addon->addon_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}" checked="checked"|cond="$addon->activated && !$addon->isBlacklisted" disabled="disabled"|cond="$addon->isBlacklisted" /></td>
|
||||||
|
<td><input type="checkbox" name="mobile_on[]" title="Mobile" value="{htmlspecialchars($addon->addon_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}" checked="checked"|cond="$addon->mactivated && !$addon->isBlacklisted" disabled="disabled"|cond="$addon->isBlacklisted" /></td>
|
||||||
<td><a cond="$addon->remove_url" href="{$addon->remove_url}&return_url={urlencode(getRequestUriByServerEnviroment())}">{$lang->cmd_delete}</a></td>
|
<td><a cond="$addon->remove_url" href="{$addon->remove_url}&return_url={urlencode(getRequestUriByServerEnviroment())}">{$lang->cmd_delete}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue