mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-10 05:52:13 +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"?>
|
||||
<addon version="0.2">
|
||||
<title xml:lang="ko">[DEPRECATED] 커뮤니케이션</title>
|
||||
<title xml:lang="jp">[DEPRECATED] コミュニケーション</title>
|
||||
<title xml:lang="zh-CN">[DEPRECATED] 会员交流</title>
|
||||
<title xml:lang="en">[DEPRECATED] Communication</title>
|
||||
<title xml:lang="vi">[DEPRECATED] Truyền thông</title>
|
||||
<title xml:lang="ge">[DEPRECATED] Communication</title>
|
||||
<title xml:lang="es">[DEPRECATED] Communication</title>
|
||||
<title xml:lang="ru">[DEPRECATED] Общение</title>
|
||||
<title xml:lang="zh-TW">[DEPRECATED] 交流</title>
|
||||
<title xml:lang="ko">커뮤니케이션</title>
|
||||
<title xml:lang="jp">コミュニケーション</title>
|
||||
<title xml:lang="zh-CN">会员交流</title>
|
||||
<title xml:lang="en">Communication</title>
|
||||
<title xml:lang="vi">Truyền thông</title>
|
||||
<title xml:lang="ge">Communication</title>
|
||||
<title xml:lang="es">Communication</title>
|
||||
<title xml:lang="ru">Общение</title>
|
||||
<title xml:lang="zh-TW">交流</title>
|
||||
<description xml:lang="ko">
|
||||
[DEPRECATED] 이 애드온은 빈 애드온입니다. 모든 기능은 커뮤니케이션 모듈로 이전되었습니다.
|
||||
이 애드온은 빈 애드온입니다. 모든 기능은 커뮤니케이션 모듈로 이전되었습니다.
|
||||
</description>
|
||||
<version>1.7</version>
|
||||
<date>2013-11-27</date>
|
||||
|
|
@ -28,4 +28,4 @@
|
|||
</author>
|
||||
<extra_vars>
|
||||
</extra_vars>
|
||||
</addon>
|
||||
</addon>
|
||||
|
|
|
|||
|
|
@ -157,6 +157,11 @@ class Context
|
|||
*/
|
||||
public $isSuccessInit = TRUE;
|
||||
|
||||
/**
|
||||
* Plugin blacklist cache
|
||||
*/
|
||||
private static $_blacklist = null;
|
||||
|
||||
/**
|
||||
* Singleton instance
|
||||
* @var object
|
||||
|
|
@ -2566,6 +2571,26 @@ class Context
|
|||
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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1191,6 +1191,12 @@ class ModuleHandler extends Handler
|
|||
$type = $item->type;
|
||||
$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 ?
|
||||
$oModule = getModule($module, $type);
|
||||
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');
|
||||
foreach($addonList as $key => $addon)
|
||||
{
|
||||
// check blacklist
|
||||
$addonList[$key]->isBlacklisted = Context::isBlacklistedPlugin($addon->addon);
|
||||
|
||||
// get easyinstall remove url
|
||||
$packageSrl = $oAutoinstallModel->getPackageSrlByPath($addon->path);
|
||||
$addonList[$key]->remove_url = $oAutoinstallModel->getRemoveUrlByPackageSrl($packageSrl);
|
||||
|
||||
// get easyinstall need update
|
||||
$package = $oAutoinstallModel->getInstalledPackages($packageSrl);
|
||||
$addonList[$key]->need_update = $package[$packageSrl]->need_update;
|
||||
if($addonList[$key]->isBlacklisted)
|
||||
{
|
||||
$addonList[$key]->need_update = 'N';
|
||||
}
|
||||
else
|
||||
{
|
||||
$package = $oAutoinstallModel->getInstalledPackages($packageSrl);
|
||||
$addonList[$key]->need_update = $package[$packageSrl]->need_update;
|
||||
}
|
||||
|
||||
// get easyinstall update url
|
||||
if($addonList[$key]->need_update == 'Y')
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ class addon extends ModuleObject
|
|||
$oAddonController = getAdminController('addon');
|
||||
$oAddonController->doInsert('autolink', 0, 'site', 'Y');
|
||||
$oAddonController->doInsert('blogapi');
|
||||
$oAddonController->doInsert('member_communication', 0, 'site', 'Y');
|
||||
$oAddonController->doInsert('member_extra_info', 0, 'site', 'Y');
|
||||
$oAddonController->doInsert('mobile', 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);
|
||||
foreach($addon_list as $addon => $val)
|
||||
{
|
||||
if($val->addon == "smartphone"
|
||||
if(Context::isBlacklistedPlugin($addon)
|
||||
|| ($type == "pc" && $val->is_used != 'Y')
|
||||
|| ($type == "mobile" && $val->is_used_m != 'Y')
|
||||
|| ($gtype == 'global' && $val->is_fixed != 'Y')
|
||||
|
|
|
|||
|
|
@ -34,23 +34,29 @@
|
|||
<tbody>
|
||||
<tr loop="$addon_list => $addon">
|
||||
<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 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>
|
||||
</p>
|
||||
</td>
|
||||
<td>{$addon->version}</td>
|
||||
<td><span style="color:#aaa"|cond="$addon->isBlacklisted">{$addon->version}</span></td>
|
||||
<td class="nowr">
|
||||
<block loop="$addon->author => $author">
|
||||
<a cond="$author->homepage" href="{$author->homepage}" target="_blank">{$author->name}</a>
|
||||
<block cond="!$author->homepage">{$author->name}</block>
|
||||
</block>
|
||||
</td>
|
||||
<td>{$addon->path}</td>
|
||||
<td><a href="{getUrl('act', 'dispAddonAdminSetup', 'selected_addon', $addon->addon_name)}">{$lang->cmd_setup}</a></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>
|
||||
<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>
|
||||
<td><span style="color:#aaa"|cond="$addon->isBlacklisted">{$addon->path}</span></td>
|
||||
<td>
|
||||
<!--@if($addon->isBlacklisted)-->
|
||||
<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>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue