First pass to clean up code.
parent
b2deebd188
commit
bbdd672463
|
@ -6,7 +6,8 @@
|
||||||
- [ ] fix php7.3+ and php8.0
|
- [ ] fix php7.3+ and php8.0
|
||||||
- [ ] fix PSR(1)2 coding style
|
- [ ] fix PSR(1)2 coding style
|
||||||
- [ ] fix translation
|
- [ ] fix translation
|
||||||
- [ ] update license
|
- [x] add dcstore (pre release)
|
||||||
|
- [x] update license
|
||||||
- [x] update readme
|
- [x] update readme
|
||||||
|
|
||||||
0.7.3 - 2018.03.12 - Pierre Van Glabeke
|
0.7.3 - 2018.03.12 - Pierre Van Glabeke
|
||||||
|
|
45
_admin.php
45
_admin.php
|
@ -1,34 +1,35 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of dcAdvancedCleaner, a plugin for Dotclear 2.
|
* @brief dcAdvancedCleaner, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2018 JC Denis and contributors
|
* @package Dotclear
|
||||||
# jcdenis@gdwd.com
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Jean-Christian Denis and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Christian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')){return;}
|
if (!defined('DC_CONTEXT_ADMIN')){return;}
|
||||||
|
|
||||||
$_menu['Plugins']->addItem(
|
$_menu['Plugins']->addItem(
|
||||||
__('Advanced cleaner'),
|
__('Advanced cleaner'),
|
||||||
'plugin.php?p=dcAdvancedCleaner',
|
'plugin.php?p=dcAdvancedCleaner',
|
||||||
'index.php?pf=dcAdvancedCleaner/icon.png',
|
'index.php?pf=dcAdvancedCleaner/icon.png',
|
||||||
preg_match('/plugin.php\?p=dcAdvancedCleaner(&.*)?$/',$_SERVER['REQUEST_URI']),
|
preg_match('/plugin.php\?p=dcAdvancedCleaner(&.*)?$/',$_SERVER['REQUEST_URI']),
|
||||||
$core->auth->isSuperAdmin()
|
$core->auth->isSuperAdmin()
|
||||||
);
|
);
|
||||||
|
|
||||||
$core->addBehavior('adminDashboardFavorites','dcAdvancedCleanerDashboardFavorites');
|
$core->addBehavior('adminDashboardFavorites','dcAdvancedCleanerDashboardFavorites');
|
||||||
|
|
||||||
function dcAdvancedCleanerDashboardFavorites($core,$favs)
|
function dcAdvancedCleanerDashboardFavorites($core,$favs)
|
||||||
{
|
{
|
||||||
$favs->register('dcAdvancedCleaner', array(
|
$favs->register('dcAdvancedCleaner', array(
|
||||||
'title' => __('Advanced cleaner'),
|
'title' => __('Advanced cleaner'),
|
||||||
'url' => 'plugin.php?p=dcAdvancedCleaner',
|
'url' => 'plugin.php?p=dcAdvancedCleaner',
|
||||||
'small-icon' => 'index.php?pf=dcAdvancedCleaner/icon.png',
|
'small-icon' => 'index.php?pf=dcAdvancedCleaner/icon.png',
|
||||||
'large-icon' => 'index.php?pf=dcAdvancedCleaner/icon-big.png',
|
'large-icon' => 'index.php?pf=dcAdvancedCleaner/icon-big.png',
|
||||||
'permissions' => 'usage,contentadmin'
|
'permissions' => 'usage,contentadmin'
|
||||||
));
|
));
|
||||||
}
|
}
|
50
_define.php
50
_define.php
|
@ -1,29 +1,31 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of dcAdvancedCleaner, a plugin for Dotclear 2.
|
* @brief dcAdvancedCleaner, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2018 JC Denis and contributors
|
* @package Dotclear
|
||||||
# jcdenis@gdwd.com
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Jean-Christian Denis and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Christian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')){return;}
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
/* Name */ "Advanced cleaner",
|
'Advanced cleaner',
|
||||||
/* Description*/ "Make a huge cleaning of dotclear",
|
'Make a huge cleaning of dotclear',
|
||||||
/* Author */ "JC Denis",
|
'Jean-Christian Denis and Contributors',
|
||||||
/* Version */ '0.7.3',
|
'0.7.3.1',
|
||||||
/* Properties */
|
[
|
||||||
array(
|
'requires' => [['core', '2.19']],
|
||||||
'permissions' => null,
|
'permissions' => null,
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'dc_min' => '2.9',
|
'support' => 'https://github.com/JcDenis/dcAdvancedCleaner',
|
||||||
'support' => 'https://forum.dotclear.org/viewtopic.php?id=40381',
|
'details' => 'https://plugins.dotaddict.org/dc2/details/dcAdvancedCleaner',
|
||||||
'details' => 'http://plugins.dotaddict.org/dc2/details/dcAdvancedCleaner'
|
'repository' => 'https://raw.githubusercontent.com/JcDenis/dcAdvancedCleaner/master/dcstore.xml'
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
/* date */ #20180213
|
|
49
_install.php
49
_install.php
|
@ -1,14 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of dcAdvancedCleaner, a plugin for Dotclear 2.
|
* @brief dcAdvancedCleaner, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2018 JC Denis and contributors
|
* @package Dotclear
|
||||||
# jcdenis@gdwd.com
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Jean-Christian Denis and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Christian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')){return;}
|
if (!defined('DC_CONTEXT_ADMIN')){return;}
|
||||||
|
|
||||||
|
@ -22,24 +23,24 @@ if (version_compare($old_version,$new_version,'>=')) {return;}
|
||||||
# Install or update
|
# Install or update
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
# Check DC version
|
# Check DC version
|
||||||
if (version_compare(str_replace("-r","-p",DC_VERSION),'2.2-alpha','<'))
|
if (version_compare(str_replace("-r","-p",DC_VERSION),'2.2-alpha','<'))
|
||||||
{
|
{
|
||||||
throw new Exception('dcAdvancedCleaner requires Dotclear 2.2');
|
throw new Exception('dcAdvancedCleaner requires Dotclear 2.2');
|
||||||
}
|
}
|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
$core->blog->settings->addNamespace('dcAdvancedCleaner');
|
$core->blog->settings->addNamespace('dcAdvancedCleaner');
|
||||||
$core->blog->settings->dcAdvancedCleaner->put('dcAdvancedCleaner_behavior_active',true,'boolean','',false,true);
|
$core->blog->settings->dcAdvancedCleaner->put('dcAdvancedCleaner_behavior_active',true,'boolean','',false,true);
|
||||||
$core->blog->settings->dcAdvancedCleaner->put('dcAdvancedCleaner_dcproperty_hide',true,'boolean','',false,true);
|
$core->blog->settings->dcAdvancedCleaner->put('dcAdvancedCleaner_dcproperty_hide',true,'boolean','',false,true);
|
||||||
|
|
||||||
# Version
|
# Version
|
||||||
$core->setVersion('dcAdvancedCleaner',$new_version);
|
$core->setVersion('dcAdvancedCleaner',$new_version);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
37
_prepend.php
37
_prepend.php
|
@ -1,14 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of dcAdvancedCleaner, a plugin for Dotclear 2.
|
* @brief dcAdvancedCleaner, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2018 JC Denis and contributors
|
* @package Dotclear
|
||||||
# jcdenis@gdwd.com
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Jean-Christian Denis and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Christian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) return;
|
if (!defined('DC_RC_PATH')) return;
|
||||||
|
|
||||||
|
@ -17,34 +18,34 @@ $core->blog->settings->addNamespace('dcAdvancedCleaner');
|
||||||
|
|
||||||
# Main class
|
# Main class
|
||||||
$__autoload['dcAdvancedCleaner'] =
|
$__autoload['dcAdvancedCleaner'] =
|
||||||
dirname(__FILE__).'/inc/class.dc.advanced.cleaner.php';
|
dirname(__FILE__).'/inc/class.dc.advanced.cleaner.php';
|
||||||
|
|
||||||
# Behaviors class
|
# Behaviors class
|
||||||
$__autoload['behaviorsDcAdvancedCleaner'] =
|
$__autoload['behaviorsDcAdvancedCleaner'] =
|
||||||
dirname(__FILE__).'/inc/lib.dc.advanced.cleaner.behaviors.php';
|
dirname(__FILE__).'/inc/lib.dc.advanced.cleaner.behaviors.php';
|
||||||
|
|
||||||
# Unsintaller class
|
# Unsintaller class
|
||||||
$__autoload['dcUninstaller'] =
|
$__autoload['dcUninstaller'] =
|
||||||
dirname(__FILE__).'/inc/class.dc.uninstaller.php';
|
dirname(__FILE__).'/inc/class.dc.uninstaller.php';
|
||||||
|
|
||||||
# Add tab on plugin admin page
|
# Add tab on plugin admin page
|
||||||
$core->addBehavior('pluginsToolsTabs',
|
$core->addBehavior('pluginsToolsTabs',
|
||||||
array('behaviorsDcAdvancedCleaner','pluginsToolsTabs'));
|
array('behaviorsDcAdvancedCleaner','pluginsToolsTabs'));
|
||||||
|
|
||||||
# Action on plugin deletion
|
# Action on plugin deletion
|
||||||
$core->addBehavior('pluginsBeforeDelete',
|
$core->addBehavior('pluginsBeforeDelete',
|
||||||
array('behaviorsDcAdvancedCleaner','pluginsBeforeDelete'));
|
array('behaviorsDcAdvancedCleaner','pluginsBeforeDelete'));
|
||||||
|
|
||||||
# Action on theme deletion
|
# Action on theme deletion
|
||||||
$core->addBehavior('themeBeforeDelete',
|
$core->addBehavior('themeBeforeDelete',
|
||||||
array('behaviorsDcAdvancedCleaner','themeBeforeDelete'));
|
array('behaviorsDcAdvancedCleaner','themeBeforeDelete'));
|
||||||
|
|
||||||
# Tabs of dcAvdancedCleaner admin page
|
# Tabs of dcAvdancedCleaner admin page
|
||||||
$core->addBehavior('dcAdvancedCleanerAdminTabs',
|
$core->addBehavior('dcAdvancedCleanerAdminTabs',
|
||||||
array('behaviorsDcAdvancedCleaner','dcAdvancedCleanerAdminTabs'));
|
array('behaviorsDcAdvancedCleaner','dcAdvancedCleanerAdminTabs'));
|
||||||
|
|
||||||
# Add dcac events on plugin activityReport
|
# Add dcac events on plugin activityReport
|
||||||
if (defined('ACTIVITY_REPORT'))
|
if (defined('ACTIVITY_REPORT'))
|
||||||
{
|
{
|
||||||
require_once dirname(__FILE__).'/inc/lib.dc.advanced.cleaner.activityreport.php';
|
require_once dirname(__FILE__).'/inc/lib.dc.advanced.cleaner.activityreport.php';
|
||||||
}
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
|
<module id="dcAdvancedCleaner">
|
||||||
|
<name>Nettoyeur avancé</name>
|
||||||
|
<version>0.7.3.1</version>
|
||||||
|
<author>Jean-Christian Denis and Contributors</author>
|
||||||
|
<desc>Make a huge cleaning of dotclear</desc>
|
||||||
|
<file>https://github.com/JcDenis/dcAdvancedCleaner/releases/download/v0.7.3.1/plugin-dcAdvancedCleaner.zip</file>
|
||||||
|
<da:dcmin>2.19</da:dcmin>
|
||||||
|
<da:details>https://plugins.dotaddict.org/dc2/details/dcAdvancedCleaner</da:details>
|
||||||
|
<da:support>https://github.com/JcDenis/dcAdvancedCleaner</da:support>
|
||||||
|
</module>
|
||||||
|
</modules>
|
|
@ -1,395 +1,396 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of dcAdvancedCleaner, a plugin for Dotclear 2.
|
* @brief dcAdvancedCleaner, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2018 JC Denis and contributors
|
* @package Dotclear
|
||||||
# jcdenis@gdwd.com
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Jean-Christian Denis and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Christian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
if (!defined('DC_ADMIN_CONTEXT')){return;}
|
if (!defined('DC_ADMIN_CONTEXT')){return;}
|
||||||
|
|
||||||
class dcAdvancedCleaner
|
class dcAdvancedCleaner
|
||||||
{
|
{
|
||||||
protected static $errors = array(
|
protected static $errors = array(
|
||||||
'settings' => array(
|
'settings' => array(
|
||||||
'delete_global' => 'Failed to delete global settings',
|
'delete_global' => 'Failed to delete global settings',
|
||||||
'delete_local' => 'Failed to delete local settings',
|
'delete_local' => 'Failed to delete local settings',
|
||||||
'delete_all' => 'Failed to delete all settings'
|
'delete_all' => 'Failed to delete all settings'
|
||||||
),
|
),
|
||||||
'tables' => array(
|
'tables' => array(
|
||||||
'empty' => 'Failed to empty table',
|
'empty' => 'Failed to empty table',
|
||||||
'delete' => 'Failed to delete table'
|
'delete' => 'Failed to delete table'
|
||||||
),
|
),
|
||||||
'plugins' => array(
|
'plugins' => array(
|
||||||
'empty' => 'Failed to empty plugin folder',
|
'empty' => 'Failed to empty plugin folder',
|
||||||
'delete' => 'Failed to delete plugin folder'
|
'delete' => 'Failed to delete plugin folder'
|
||||||
),
|
),
|
||||||
'themes' => array(
|
'themes' => array(
|
||||||
'empty' => 'Failed to empty themes folder',
|
'empty' => 'Failed to empty themes folder',
|
||||||
'delete' => 'Failed to delete themes folder'
|
'delete' => 'Failed to delete themes folder'
|
||||||
),
|
),
|
||||||
'caches' => array(
|
'caches' => array(
|
||||||
'empty' => 'Failed to empty cache folder',
|
'empty' => 'Failed to empty cache folder',
|
||||||
'delete' => 'Failed to delete cache folder'
|
'delete' => 'Failed to delete cache folder'
|
||||||
),
|
),
|
||||||
'versions' => array(
|
'versions' => array(
|
||||||
'delete' => 'Failed to delete version'
|
'delete' => 'Failed to delete version'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
public static $dotclear = array(
|
public static $dotclear = array(
|
||||||
'settings' => array(
|
'settings' => array(
|
||||||
'akismet','antispam','breadcrumb','dcckeditor','dclegacyeditor','maintenance',
|
'akismet','antispam','breadcrumb','dcckeditor','dclegacyeditor','maintenance',
|
||||||
'pages','pings','system','themes','widgets'
|
'pages','pings','system','themes','widgets'
|
||||||
),
|
),
|
||||||
'tables' => array(
|
'tables' => array(
|
||||||
'blog','category','comment','link','log','media',
|
'blog','category','comment','link','log','media',
|
||||||
'meta','permissions','ping','post','post_media','pref','session',
|
'meta','permissions','ping','post','post_media','pref','session',
|
||||||
'setting','spamrule','user','version'
|
'setting','spamrule','user','version'
|
||||||
),
|
),
|
||||||
'plugins' => array(
|
'plugins' => array(
|
||||||
'aboutConfig','akismet','antispam','attachments','blogroll','blowupConfig',
|
'aboutConfig','akismet','antispam','attachments','blogroll','blowupConfig',
|
||||||
'breadcrumb','dcCKEditor','dclegacy','dcLegacyEditor','fairTrackbacks','importExport','maintenance',
|
'breadcrumb','dcCKEditor','dclegacy','dcLegacyEditor','fairTrackbacks','importExport','maintenance',
|
||||||
'pages','pings','simpleMenu','tags','themeEditor','userPref','widgets'
|
'pages','pings','simpleMenu','tags','themeEditor','userPref','widgets'
|
||||||
),
|
),
|
||||||
'themes' => array(
|
'themes' => array(
|
||||||
'default','customCSS','blueSilence','berlin','ductile'
|
'default','customCSS','blueSilence','berlin','ductile'
|
||||||
),
|
),
|
||||||
'caches' => array(
|
'caches' => array(
|
||||||
'cbfeed','dcrepo','versions'
|
'cbfeed','dcrepo','versions'
|
||||||
),
|
),
|
||||||
'versions' => array(
|
'versions' => array(
|
||||||
'antispam','blogroll','blowupConfig','core','dcCKEditor','dcLegacyEditor','pages','pings','simpleMenu','tags','widgets'
|
'antispam','blogroll','blowupConfig','core','dcCKEditor','dcLegacyEditor','pages','pings','simpleMenu','tags','widgets'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
public static $exclude = array(
|
public static $exclude = array(
|
||||||
'.','..','__MACOSX','.svn','CVS','.DS_Store','Thumbs.db'
|
'.','..','__MACOSX','.svn','CVS','.DS_Store','Thumbs.db'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function getSettings($core)
|
public static function getSettings($core)
|
||||||
{
|
{
|
||||||
$res = $core->con->select(
|
$res = $core->con->select(
|
||||||
'SELECT setting_ns '.
|
'SELECT setting_ns '.
|
||||||
'FROM '.$core->prefix.'setting '.
|
'FROM '.$core->prefix.'setting '.
|
||||||
'WHERE blog_id IS NULL '.
|
'WHERE blog_id IS NULL '.
|
||||||
"OR blog_id IS NOT NULL ".
|
"OR blog_id IS NOT NULL ".
|
||||||
'GROUP BY setting_ns');
|
'GROUP BY setting_ns');
|
||||||
|
|
||||||
$rs = array();
|
$rs = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while($res->fetch()) {
|
while($res->fetch()) {
|
||||||
|
|
||||||
$rs[$i]['key'] = $res->setting_ns;
|
$rs[$i]['key'] = $res->setting_ns;
|
||||||
$rs[$i]['value'] = $core->con->select(
|
$rs[$i]['value'] = $core->con->select(
|
||||||
'SELECT count(*) FROM '.$core->prefix.'setting '.
|
'SELECT count(*) FROM '.$core->prefix.'setting '.
|
||||||
"WHERE setting_ns = '".$res->setting_ns."' ".
|
"WHERE setting_ns = '".$res->setting_ns."' ".
|
||||||
"AND (blog_id IS NULL OR blog_id IS NOT NULL) ".
|
"AND (blog_id IS NULL OR blog_id IS NOT NULL) ".
|
||||||
"GROUP BY setting_ns ")->f(0);
|
"GROUP BY setting_ns ")->f(0);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function deleteGlobalSettings($core,$entry)
|
protected static function deleteGlobalSettings($core,$entry)
|
||||||
{
|
{
|
||||||
$core->con->execute(
|
$core->con->execute(
|
||||||
'DELETE FROM '.$core->prefix.'setting '.
|
'DELETE FROM '.$core->prefix.'setting '.
|
||||||
'WHERE blog_id IS NULL '.
|
'WHERE blog_id IS NULL '.
|
||||||
"AND setting_ns = '".$core->con->escape($entry)."' "
|
"AND setting_ns = '".$core->con->escape($entry)."' "
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function deleteLocalSettings($core,$entry)
|
protected static function deleteLocalSettings($core,$entry)
|
||||||
{
|
{
|
||||||
$core->con->execute(
|
$core->con->execute(
|
||||||
'DELETE FROM '.$core->prefix.'setting '.
|
'DELETE FROM '.$core->prefix.'setting '.
|
||||||
"WHERE blog_id = '".$core->con->escape($core->blog->id)."' ".
|
"WHERE blog_id = '".$core->con->escape($core->blog->id)."' ".
|
||||||
"AND setting_ns = '".$core->con->escape($entry)."' "
|
"AND setting_ns = '".$core->con->escape($entry)."' "
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function deleteAllSettings($core,$entry)
|
protected static function deleteAllSettings($core,$entry)
|
||||||
{
|
{
|
||||||
$core->con->execute(
|
$core->con->execute(
|
||||||
'DELETE FROM '.$core->prefix.'setting '.
|
'DELETE FROM '.$core->prefix.'setting '.
|
||||||
"WHERE setting_ns = '".$core->con->escape($entry)."' ".
|
"WHERE setting_ns = '".$core->con->escape($entry)."' ".
|
||||||
"AND (blog_id IS NULL OR blog_id != '') "
|
"AND (blog_id IS NULL OR blog_id != '') "
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getTables($core)
|
public static function getTables($core)
|
||||||
{
|
{
|
||||||
$object = dbSchema::init($core->con);
|
$object = dbSchema::init($core->con);
|
||||||
$res = $object->getTables();
|
$res = $object->getTables();
|
||||||
|
|
||||||
$rs = array();
|
$rs = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach($res as $k => $v)
|
foreach($res as $k => $v)
|
||||||
{
|
{
|
||||||
if ('' != $core->prefix)
|
if ('' != $core->prefix)
|
||||||
{
|
{
|
||||||
if (!preg_match('/^'.preg_quote($core->prefix).'(.*?)$/',$v,$m)) continue;
|
if (!preg_match('/^'.preg_quote($core->prefix).'(.*?)$/',$v,$m)) continue;
|
||||||
$v = $m[1];
|
$v = $m[1];
|
||||||
}
|
}
|
||||||
$rs[$i]['key'] = $v;
|
$rs[$i]['key'] = $v;
|
||||||
$rs[$i]['value'] = $core->con->select('SELECT count(*) FROM '.$res[$k])->f(0);
|
$rs[$i]['value'] = $core->con->select('SELECT count(*) FROM '.$res[$k])->f(0);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function emptyTable($core,$entry)
|
protected static function emptyTable($core,$entry)
|
||||||
{
|
{
|
||||||
$core->con->execute(
|
$core->con->execute(
|
||||||
'DELETE FROM '.$core->con->escapeSystem($core->prefix.$entry)
|
'DELETE FROM '.$core->con->escapeSystem($core->prefix.$entry)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function deleteTable($core,$entry)
|
protected static function deleteTable($core,$entry)
|
||||||
{
|
{
|
||||||
self::emptyTable($core,$entry);
|
self::emptyTable($core,$entry);
|
||||||
|
|
||||||
$core->con->execute(
|
$core->con->execute(
|
||||||
'DROP TABLE '.$core->con->escapeSystem($core->prefix.$entry)
|
'DROP TABLE '.$core->con->escapeSystem($core->prefix.$entry)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getVersions($core)
|
public static function getVersions($core)
|
||||||
{
|
{
|
||||||
$res = $core->con->select('SELECT * FROM '.$core->prefix.'version');
|
$res = $core->con->select('SELECT * FROM '.$core->prefix.'version');
|
||||||
|
|
||||||
$rs = array();
|
$rs = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($res->fetch()) {
|
while ($res->fetch()) {
|
||||||
|
|
||||||
$rs[$i]['key'] = $res->module;
|
$rs[$i]['key'] = $res->module;
|
||||||
$rs[$i]['value'] = $res->version;
|
$rs[$i]['value'] = $res->version;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function deleteVersion($core,$entry)
|
protected static function deleteVersion($core,$entry)
|
||||||
{
|
{
|
||||||
$core->con->execute(
|
$core->con->execute(
|
||||||
'DELETE FROM '.$core->prefix.'version '.
|
'DELETE FROM '.$core->prefix.'version '.
|
||||||
"WHERE module = '".$core->con->escape($entry)."' "
|
"WHERE module = '".$core->con->escape($entry)."' "
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPlugins($core)
|
public static function getPlugins($core)
|
||||||
{
|
{
|
||||||
$res = explode(PATH_SEPARATOR,DC_PLUGINS_ROOT);
|
$res = explode(PATH_SEPARATOR,DC_PLUGINS_ROOT);
|
||||||
return self::getDirs($res);
|
return self::getDirs($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function emptyPlugin($core,$entry)
|
protected static function emptyPlugin($core,$entry)
|
||||||
{
|
{
|
||||||
$res = explode(PATH_SEPARATOR,DC_PLUGINS_ROOT);
|
$res = explode(PATH_SEPARATOR,DC_PLUGINS_ROOT);
|
||||||
self::delDir($res,$entry,false);
|
self::delDir($res,$entry,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function deletePlugin($core,$entry)
|
protected static function deletePlugin($core,$entry)
|
||||||
{
|
{
|
||||||
$res = explode(PATH_SEPARATOR,DC_PLUGINS_ROOT);
|
$res = explode(PATH_SEPARATOR,DC_PLUGINS_ROOT);
|
||||||
self::delDir($res,$entry,true);
|
self::delDir($res,$entry,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getThemes($core)
|
public static function getThemes($core)
|
||||||
{
|
{
|
||||||
return self::getDirs($core->blog->themes_path);
|
return self::getDirs($core->blog->themes_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function emptyTheme($core,$entry)
|
protected static function emptyTheme($core,$entry)
|
||||||
{
|
{
|
||||||
self::delDir($core->blog->themes_path,$entry,false);
|
self::delDir($core->blog->themes_path,$entry,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function deleteTheme($core,$entry)
|
protected static function deleteTheme($core,$entry)
|
||||||
{
|
{
|
||||||
self::delDir($core->blog->themes_path,$entry,true);
|
self::delDir($core->blog->themes_path,$entry,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCaches($core)
|
public static function getCaches($core)
|
||||||
{
|
{
|
||||||
return self::getDirs(DC_TPL_CACHE);
|
return self::getDirs(DC_TPL_CACHE);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function emptyCache($core,$entry)
|
protected static function emptyCache($core,$entry)
|
||||||
{
|
{
|
||||||
self::delDir(DC_TPL_CACHE,$entry,false);
|
self::delDir(DC_TPL_CACHE,$entry,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function deleteCache($core,$entry)
|
protected static function deleteCache($core,$entry)
|
||||||
{
|
{
|
||||||
self::delDir(DC_TPL_CACHE,$entry,true);
|
self::delDir(DC_TPL_CACHE,$entry,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function execute($core,$type,$action,$ns)
|
public static function execute($core,$type,$action,$ns)
|
||||||
{
|
{
|
||||||
if (strtolower($ns) == 'dcadvancedcleaner')
|
if (strtolower($ns) == 'dcadvancedcleaner')
|
||||||
throw new exception("dcAdvancedCleaner can't remove itself");
|
throw new exception("dcAdvancedCleaner can't remove itself");
|
||||||
|
|
||||||
# BEHAVIOR dcAdvancedCleanerBeforeAction
|
# BEHAVIOR dcAdvancedCleanerBeforeAction
|
||||||
$core->callBehavior('dcAdvancedCleanerBeforeAction',$type,$action,$ns);
|
$core->callBehavior('dcAdvancedCleanerBeforeAction',$type,$action,$ns);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
# Delete global settings
|
# Delete global settings
|
||||||
if ($type == 'settings' && $action == 'delete_global')
|
if ($type == 'settings' && $action == 'delete_global')
|
||||||
self::deleteGlobalSettings($core,$ns);
|
self::deleteGlobalSettings($core,$ns);
|
||||||
|
|
||||||
# Delete local settings
|
# Delete local settings
|
||||||
if ($type == 'settings' && $action == 'delete_local')
|
if ($type == 'settings' && $action == 'delete_local')
|
||||||
self::deleteLocalSettings($core,$ns);
|
self::deleteLocalSettings($core,$ns);
|
||||||
|
|
||||||
# Delete all settings
|
# Delete all settings
|
||||||
if ($type == 'settings' && $action == 'delete_all')
|
if ($type == 'settings' && $action == 'delete_all')
|
||||||
self::deleteAllSettings($core,$ns);
|
self::deleteAllSettings($core,$ns);
|
||||||
|
|
||||||
# Empty tables
|
# Empty tables
|
||||||
if ($type == 'tables' && $action == 'empty')
|
if ($type == 'tables' && $action == 'empty')
|
||||||
self::emptyTable($core,$ns);
|
self::emptyTable($core,$ns);
|
||||||
|
|
||||||
# Delete tables
|
# Delete tables
|
||||||
if ($type == 'tables' && $action == 'delete')
|
if ($type == 'tables' && $action == 'delete')
|
||||||
self::deleteTable($core,$ns);
|
self::deleteTable($core,$ns);
|
||||||
|
|
||||||
# Delete versions
|
# Delete versions
|
||||||
if ($type == 'versions' && $action == 'delete')
|
if ($type == 'versions' && $action == 'delete')
|
||||||
self::deleteVersion($core,$ns);
|
self::deleteVersion($core,$ns);
|
||||||
|
|
||||||
# Empty plugins
|
# Empty plugins
|
||||||
if ($type == 'plugins' && $action == 'empty')
|
if ($type == 'plugins' && $action == 'empty')
|
||||||
self::emptyPlugin($core,$ns);
|
self::emptyPlugin($core,$ns);
|
||||||
|
|
||||||
# Delete plugins
|
# Delete plugins
|
||||||
if ($type == 'plugins' && $action == 'delete')
|
if ($type == 'plugins' && $action == 'delete')
|
||||||
self::deletePlugin($core,$ns);
|
self::deletePlugin($core,$ns);
|
||||||
|
|
||||||
# Empty themes
|
# Empty themes
|
||||||
if ($type == 'themes' && $action == 'empty')
|
if ($type == 'themes' && $action == 'empty')
|
||||||
self::emptyTheme($core,$ns);
|
self::emptyTheme($core,$ns);
|
||||||
|
|
||||||
# Delete themes
|
# Delete themes
|
||||||
if ($type == 'themes' && $action == 'delete')
|
if ($type == 'themes' && $action == 'delete')
|
||||||
self::deleteTheme($core,$ns);
|
self::deleteTheme($core,$ns);
|
||||||
|
|
||||||
# Empty caches
|
# Empty caches
|
||||||
if ($type == 'caches' && $action == 'empty')
|
if ($type == 'caches' && $action == 'empty')
|
||||||
self::emptyCache($core,$ns);
|
self::emptyCache($core,$ns);
|
||||||
|
|
||||||
# Delete caches
|
# Delete caches
|
||||||
if ($type == 'caches' && $action == 'delete')
|
if ($type == 'caches' && $action == 'delete')
|
||||||
self::deleteCache($core,$ns);
|
self::deleteCache($core,$ns);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(Exception $e) {
|
catch(Exception $e) {
|
||||||
$errors = self::$errors;
|
$errors = self::$errors;
|
||||||
if (isset($errors[$type][$action])) {
|
if (isset($errors[$type][$action])) {
|
||||||
throw new Exception(__($errors[$type][$action]));
|
throw new Exception(__($errors[$type][$action]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Exception(sprintf(__('Cannot execute "%s" of type "%s"'),$action,$type));
|
throw new Exception(sprintf(__('Cannot execute "%s" of type "%s"'),$action,$type));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getDirs($roots)
|
protected static function getDirs($roots)
|
||||||
{
|
{
|
||||||
if (!is_array($roots))
|
if (!is_array($roots))
|
||||||
$roots = array($roots);
|
$roots = array($roots);
|
||||||
|
|
||||||
$rs = array();
|
$rs = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($roots as $root) {
|
foreach ($roots as $root) {
|
||||||
|
|
||||||
$dirs = files::scanDir($root);
|
$dirs = files::scanDir($root);
|
||||||
foreach($dirs as $k) {
|
foreach($dirs as $k) {
|
||||||
|
|
||||||
if ('.' == $k || '..' == $k || !is_dir($root.'/'.$k)) continue;
|
if ('.' == $k || '..' == $k || !is_dir($root.'/'.$k)) continue;
|
||||||
|
|
||||||
$rs[$i]['key'] = $k;
|
$rs[$i]['key'] = $k;
|
||||||
$rs[$i]['value'] = count(self::scanDir($root.'/'.$k));
|
$rs[$i]['value'] = count(self::scanDir($root.'/'.$k));
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function delDir($roots,$folder,$delfolder=true)
|
protected static function delDir($roots,$folder,$delfolder=true)
|
||||||
{
|
{
|
||||||
if (strpos($folder,'/'))
|
if (strpos($folder,'/'))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!is_array($roots))
|
if (!is_array($roots))
|
||||||
$roots = array($roots);
|
$roots = array($roots);
|
||||||
|
|
||||||
foreach ($roots as $root)
|
foreach ($roots as $root)
|
||||||
{
|
{
|
||||||
if (file_exists($root.'/'.$folder))
|
if (file_exists($root.'/'.$folder))
|
||||||
return self::delTree($root.'/'.$folder,$delfolder);
|
return self::delTree($root.'/'.$folder,$delfolder);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function scanDir($path,$dir='',$res=array())
|
protected static function scanDir($path,$dir='',$res=array())
|
||||||
{
|
{
|
||||||
$exclude = self::$exclude;
|
$exclude = self::$exclude;
|
||||||
|
|
||||||
$path = path::real($path);
|
$path = path::real($path);
|
||||||
if (!is_dir($path) || !is_readable($path)) return array();
|
if (!is_dir($path) || !is_readable($path)) return array();
|
||||||
|
|
||||||
$files = files::scandir($path);
|
$files = files::scandir($path);
|
||||||
|
|
||||||
foreach($files AS $file) {
|
foreach($files AS $file) {
|
||||||
if (in_array($file,$exclude)) continue;
|
if (in_array($file,$exclude)) continue;
|
||||||
|
|
||||||
if (is_dir($path.'/'.$file)) {
|
if (is_dir($path.'/'.$file)) {
|
||||||
|
|
||||||
$res[] = $file;
|
$res[] = $file;
|
||||||
$res = self::scanDir($path.'/'.$file,$dir.'/'.$file,$res);
|
$res = self::scanDir($path.'/'.$file,$dir.'/'.$file,$res);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$res[] = empty($dir) ? $file : $dir.'/'.$file;
|
$res[] = empty($dir) ? $file : $dir.'/'.$file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function delTree($dir,$delroot=true)
|
protected static function delTree($dir,$delroot=true)
|
||||||
{
|
{
|
||||||
if (!is_dir($dir) || !is_readable($dir)) return false;
|
if (!is_dir($dir) || !is_readable($dir)) return false;
|
||||||
|
|
||||||
if (substr($dir,-1) != '/') $dir .= '/';
|
if (substr($dir,-1) != '/') $dir .= '/';
|
||||||
|
|
||||||
if (($d = @dir($dir)) === false) return false;
|
if (($d = @dir($dir)) === false) return false;
|
||||||
|
|
||||||
while (($entryname = $d->read()) !== false)
|
while (($entryname = $d->read()) !== false)
|
||||||
{
|
{
|
||||||
if ($entryname != '.' && $entryname != '..')
|
if ($entryname != '.' && $entryname != '..')
|
||||||
{
|
{
|
||||||
if (is_dir($dir.'/'.$entryname))
|
if (is_dir($dir.'/'.$entryname))
|
||||||
{
|
{
|
||||||
if (!self::delTree($dir.'/'.$entryname)) return false;
|
if (!self::delTree($dir.'/'.$entryname)) return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!@unlink($dir.'/'.$entryname)) return false;
|
if (!@unlink($dir.'/'.$entryname)) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$d->close();
|
$d->close();
|
||||||
|
|
||||||
if ($delroot)
|
if ($delroot)
|
||||||
return @rmdir($dir);
|
return @rmdir($dir);
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,14 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of dcAdvancedCleaner, a plugin for Dotclear 2.
|
* @brief dcAdvancedCleaner, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2018 JC Denis and contributors
|
* @package Dotclear
|
||||||
# jcdenis@gdwd.com
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Jean-Christian Denis and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Christian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
if (!defined('DC_ADMIN_CONTEXT')){return;}
|
if (!defined('DC_ADMIN_CONTEXT')){return;}
|
||||||
|
|
||||||
|
@ -21,334 +22,334 @@ This class used dcAdvancedCleaner.
|
||||||
*/
|
*/
|
||||||
class dcUninstaller
|
class dcUninstaller
|
||||||
{
|
{
|
||||||
protected $path;
|
protected $path;
|
||||||
|
|
||||||
protected $modules = array(); ///< <b>array</b> Modules informations array
|
protected $modules = array(); ///< <b>array</b> Modules informations array
|
||||||
protected $actions = array('user'=>array(),'callback'=>array());
|
protected $actions = array('user'=>array(),'callback'=>array());
|
||||||
protected $callbacks = array('user'=>array(),'callback'=>array());
|
protected $callbacks = array('user'=>array(),'callback'=>array());
|
||||||
|
|
||||||
protected $id = null;
|
protected $id = null;
|
||||||
protected $mroot = null;
|
protected $mroot = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Array of all allowed properties to uninstall parts of modules.
|
Array of all allowed properties to uninstall parts of modules.
|
||||||
'settings' : settings set on dcSettings,
|
'settings' : settings set on dcSettings,
|
||||||
'tables' : if module creates table,
|
'tables' : if module creates table,
|
||||||
'plugins' : if module has files on plugin path,
|
'plugins' : if module has files on plugin path,
|
||||||
'themes' : if module has files on theme path, (on current blog)
|
'themes' : if module has files on theme path, (on current blog)
|
||||||
'caches' : if module has files on DC caches path,
|
'caches' : if module has files on DC caches path,
|
||||||
'versions' : if module set a versions on DC table 'version'
|
'versions' : if module set a versions on DC table 'version'
|
||||||
*/
|
*/
|
||||||
protected static $allowed_properties = array(
|
protected static $allowed_properties = array(
|
||||||
'versions' => array(
|
'versions' => array(
|
||||||
'delete' => 'delete version in dc'
|
'delete' => 'delete version in dc'
|
||||||
),
|
),
|
||||||
'settings' => array(
|
'settings' => array(
|
||||||
'delete_global' => 'delete global settings',
|
'delete_global' => 'delete global settings',
|
||||||
'delete_local' => 'delete local settings',
|
'delete_local' => 'delete local settings',
|
||||||
'delete_all' => 'delete all settings'
|
'delete_all' => 'delete all settings'
|
||||||
),
|
),
|
||||||
'tables' => array(
|
'tables' => array(
|
||||||
'empty' => 'empty table',
|
'empty' => 'empty table',
|
||||||
'delete' => 'delete table'
|
'delete' => 'delete table'
|
||||||
),
|
),
|
||||||
'plugins' => array(
|
'plugins' => array(
|
||||||
'empty' => 'empty plugin folder',
|
'empty' => 'empty plugin folder',
|
||||||
'delete' => 'delete plugin folder'
|
'delete' => 'delete plugin folder'
|
||||||
),
|
),
|
||||||
'themes' => array(
|
'themes' => array(
|
||||||
'empty' => 'empty theme folder',
|
'empty' => 'empty theme folder',
|
||||||
'delete' => 'delete theme folder'
|
'delete' => 'delete theme folder'
|
||||||
),
|
),
|
||||||
'caches' => array(
|
'caches' => array(
|
||||||
'empty' => 'empty cache folder',
|
'empty' => 'empty cache folder',
|
||||||
'delete' => 'delete cache folder'
|
'delete' => 'delete cache folder'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
protected static $priority_properties = array(
|
protected static $priority_properties = array(
|
||||||
'versions','settings','tables','themes','plugins','caches'
|
'versions','settings','tables','themes','plugins','caches'
|
||||||
);
|
);
|
||||||
|
|
||||||
public $core; ///< <b>dcCore</b> dcCore instance
|
public $core; ///< <b>dcCore</b> dcCore instance
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Object constructor.
|
Object constructor.
|
||||||
|
|
||||||
@param core <b>dcCore</b> dcCore instance
|
@param core <b>dcCore</b> dcCore instance
|
||||||
*/
|
*/
|
||||||
public function __construct($core)
|
public function __construct($core)
|
||||||
{
|
{
|
||||||
$this->core =& $core;
|
$this->core =& $core;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAllowedProperties()
|
public static function getAllowedProperties()
|
||||||
{
|
{
|
||||||
return self::$allowed_properties;
|
return self::$allowed_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Loads modules.
|
Loads modules.
|
||||||
Files _defines.php and _uninstall.php must be present on module
|
Files _defines.php and _uninstall.php must be present on module
|
||||||
to be recognized.
|
to be recognized.
|
||||||
(path separator depends on your OS).
|
(path separator depends on your OS).
|
||||||
|
|
||||||
@param path <b>string</b> Separated list of paths
|
@param path <b>string</b> Separated list of paths
|
||||||
*/
|
*/
|
||||||
public function loadModules($path)
|
public function loadModules($path)
|
||||||
{
|
{
|
||||||
$this->path = explode(PATH_SEPARATOR,$path);
|
$this->path = explode(PATH_SEPARATOR,$path);
|
||||||
|
|
||||||
foreach ($this->path as $root)
|
foreach ($this->path as $root)
|
||||||
{
|
{
|
||||||
if (!is_dir($root) || !is_readable($root)) continue;
|
if (!is_dir($root) || !is_readable($root)) continue;
|
||||||
|
|
||||||
if (substr($root,-1) != '/') $root .= '/';
|
if (substr($root,-1) != '/') $root .= '/';
|
||||||
|
|
||||||
if (($d = @dir($root)) === false) continue;
|
if (($d = @dir($root)) === false) continue;
|
||||||
|
|
||||||
while (($entry = $d->read()) !== false)
|
while (($entry = $d->read()) !== false)
|
||||||
{
|
{
|
||||||
$full_entry = $root.'/'.$entry;
|
$full_entry = $root.'/'.$entry;
|
||||||
|
|
||||||
if ($entry != '.' && $entry != '..' && is_dir($full_entry))
|
if ($entry != '.' && $entry != '..' && is_dir($full_entry))
|
||||||
{
|
{
|
||||||
$this->loadModule($full_entry);
|
$this->loadModule($full_entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$d->close();
|
$d->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sort modules by name
|
# Sort modules by name
|
||||||
uasort($this->modules,array($this,'sortModules'));
|
uasort($this->modules,array($this,'sortModules'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Load one module.
|
Load one module.
|
||||||
Files _defines.php and _uninstall.php must be present on module
|
Files _defines.php and _uninstall.php must be present on module
|
||||||
to be recognized.
|
to be recognized.
|
||||||
|
|
||||||
@param root <b>string</b> path of module
|
@param root <b>string</b> path of module
|
||||||
*/
|
*/
|
||||||
public function loadModule($root)
|
public function loadModule($root)
|
||||||
{
|
{
|
||||||
if (file_exists($root.'/_define.php')
|
if (file_exists($root.'/_define.php')
|
||||||
&& file_exists($root.'/_uninstall.php')) {
|
&& file_exists($root.'/_uninstall.php')) {
|
||||||
|
|
||||||
$this->id = basename($root);
|
$this->id = basename($root);
|
||||||
$this->mroot = $root;
|
$this->mroot = $root;
|
||||||
|
|
||||||
require $root.'/_define.php';
|
require $root.'/_define.php';
|
||||||
require $root.'/_uninstall.php';
|
require $root.'/_uninstall.php';
|
||||||
|
|
||||||
$this->id = null;
|
$this->id = null;
|
||||||
$this->mroot = null;
|
$this->mroot = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This method registers a module in modules list. You should use
|
This method registers a module in modules list. You should use
|
||||||
this to register a new module.
|
this to register a new module.
|
||||||
|
|
||||||
@param name <b>string</b> Module name
|
@param name <b>string</b> Module name
|
||||||
@param desc <b>string</b> Module description
|
@param desc <b>string</b> Module description
|
||||||
@param author <b>string</b> Module author name
|
@param author <b>string</b> Module author name
|
||||||
@param version <b>string</b> Module version
|
@param version <b>string</b> Module version
|
||||||
*/
|
*/
|
||||||
public function registerModule($name,$desc,$author,$version)
|
public function registerModule($name,$desc,$author,$version)
|
||||||
{
|
{
|
||||||
if ($this->id) {
|
if ($this->id) {
|
||||||
$this->modules[$this->id] = array(
|
$this->modules[$this->id] = array(
|
||||||
'root' => $this->mroot,
|
'root' => $this->mroot,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'desc' => $desc,
|
'desc' => $desc,
|
||||||
'author' => $author,
|
'author' => $author,
|
||||||
'version' => $version,
|
'version' => $version,
|
||||||
'root_writable' => is_writable($this->mroot)
|
'root_writable' => is_writable($this->mroot)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns all modules associative array or only one module if <var>$id</var>
|
Returns all modules associative array or only one module if <var>$id</var>
|
||||||
is present.
|
is present.
|
||||||
|
|
||||||
@param id <b>string</b> Optionnal module ID
|
@param id <b>string</b> Optionnal module ID
|
||||||
@return <b>array</b>
|
@return <b>array</b>
|
||||||
*/
|
*/
|
||||||
public function getModules($id=null)
|
public function getModules($id=null)
|
||||||
{
|
{
|
||||||
if ($id && isset($this->modules[$id])) {
|
if ($id && isset($this->modules[$id])) {
|
||||||
return $this->modules[$id];
|
return $this->modules[$id];
|
||||||
}
|
}
|
||||||
return $this->modules;
|
return $this->modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns true if the module with ID <var>$id</var> exists.
|
Returns true if the module with ID <var>$id</var> exists.
|
||||||
|
|
||||||
@param id <b>string</b> Module ID
|
@param id <b>string</b> Module ID
|
||||||
@return <b>boolean</b>
|
@return <b>boolean</b>
|
||||||
*/
|
*/
|
||||||
public function moduleExists($id)
|
public function moduleExists($id)
|
||||||
{
|
{
|
||||||
return isset($this->modules[$id]);
|
return isset($this->modules[$id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add a predefined action to unsintall features.
|
Add a predefined action to unsintall features.
|
||||||
This action is set in _uninstall.php.
|
This action is set in _uninstall.php.
|
||||||
|
|
||||||
@param type <b>string</b> Type of action (from $allowed_properties)
|
@param type <b>string</b> Type of action (from $allowed_properties)
|
||||||
@param action <b>string</b> Action (from $allowed_properties)
|
@param action <b>string</b> Action (from $allowed_properties)
|
||||||
@param ns <b>string</b> Name of setting related to module.
|
@param ns <b>string</b> Name of setting related to module.
|
||||||
@param desc <b>string</b> Description of action
|
@param desc <b>string</b> Description of action
|
||||||
*/
|
*/
|
||||||
protected function addUserAction($type,$action,$ns,$desc='')
|
protected function addUserAction($type,$action,$ns,$desc='')
|
||||||
{
|
{
|
||||||
$this->addAction('user',$type,$action,$ns,$desc);
|
$this->addAction('user',$type,$action,$ns,$desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addDirectAction($type,$action,$ns,$desc='')
|
protected function addDirectAction($type,$action,$ns,$desc='')
|
||||||
{
|
{
|
||||||
$this->addAction('direct',$type,$action,$ns,$desc);
|
$this->addAction('direct',$type,$action,$ns,$desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addAction($group,$type,$action,$ns,$desc)
|
private function addAction($group,$type,$action,$ns,$desc)
|
||||||
{
|
{
|
||||||
$group = self::group($group);
|
$group = self::group($group);
|
||||||
|
|
||||||
if (null === $this->id) return;
|
if (null === $this->id) return;
|
||||||
|
|
||||||
if (empty($type) || empty($ns)) return;
|
if (empty($type) || empty($ns)) return;
|
||||||
|
|
||||||
if (!isset(self::$allowed_properties[$type][$action])) return;
|
if (!isset(self::$allowed_properties[$type][$action])) return;
|
||||||
|
|
||||||
if (empty($desc)) $desc = __($action);
|
if (empty($desc)) $desc = __($action);
|
||||||
|
|
||||||
$this->actions[$group][$this->id][$type][] = array(
|
$this->actions[$group][$this->id][$type][] = array(
|
||||||
'ns' => $ns,
|
'ns' => $ns,
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
'desc' => $desc
|
'desc' => $desc
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns modules <var>$id</var> predefined actions associative array
|
Returns modules <var>$id</var> predefined actions associative array
|
||||||
ordered by priority
|
ordered by priority
|
||||||
|
|
||||||
@param id <b>string</b> Optionnal module ID
|
@param id <b>string</b> Optionnal module ID
|
||||||
@return <b>array</b>
|
@return <b>array</b>
|
||||||
*/
|
*/
|
||||||
public function getUserActions($id)
|
public function getUserActions($id)
|
||||||
{
|
{
|
||||||
return $this->getActions('user',$id);
|
return $this->getActions('user',$id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDirectActions($id)
|
public function getDirectActions($id)
|
||||||
{
|
{
|
||||||
return $this->getActions('direct',$id);
|
return $this->getActions('direct',$id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getActions($group,$id)
|
protected function getActions($group,$id)
|
||||||
{
|
{
|
||||||
$group = self::group($group);
|
$group = self::group($group);
|
||||||
|
|
||||||
if (!isset($this->actions[$group][$id])) return array();
|
if (!isset($this->actions[$group][$id])) return array();
|
||||||
|
|
||||||
$res = array();
|
$res = array();
|
||||||
foreach(self::$priority_properties as $k => $v)
|
foreach(self::$priority_properties as $k => $v)
|
||||||
{
|
{
|
||||||
if (!isset($this->actions[$group][$id][$v])) continue;
|
if (!isset($this->actions[$group][$id][$v])) continue;
|
||||||
$res[$v] = $this->actions[$group][$id][$v];
|
$res[$v] = $this->actions[$group][$id][$v];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add a callable function for unsintall features.
|
Add a callable function for unsintall features.
|
||||||
This action is set in _uninstall.php.
|
This action is set in _uninstall.php.
|
||||||
|
|
||||||
@param func <b>string</b> Callable function
|
@param func <b>string</b> Callable function
|
||||||
@param desc <b>string</b> Description of action
|
@param desc <b>string</b> Description of action
|
||||||
*/
|
*/
|
||||||
protected function addUserCallback($func,$desc='')
|
protected function addUserCallback($func,$desc='')
|
||||||
{
|
{
|
||||||
$this->addCallback('user',$func,$desc);
|
$this->addCallback('user',$func,$desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addDirectCallback($func,$desc='')
|
protected function addDirectCallback($func,$desc='')
|
||||||
{
|
{
|
||||||
$this->addCallback('direct',$func,$desc);
|
$this->addCallback('direct',$func,$desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addCallback($group,$func,$desc)
|
private function addCallback($group,$func,$desc)
|
||||||
{
|
{
|
||||||
$group = self::group($group);
|
$group = self::group($group);
|
||||||
|
|
||||||
if (null === $this->id) return;
|
if (null === $this->id) return;
|
||||||
|
|
||||||
if (empty($desc)) $desc = __('extra action');
|
if (empty($desc)) $desc = __('extra action');
|
||||||
|
|
||||||
if (!is_callable($func)) return;
|
if (!is_callable($func)) return;
|
||||||
|
|
||||||
$this->callbacks[$group][$this->id][] = array(
|
$this->callbacks[$group][$this->id][] = array(
|
||||||
'func' => $func,
|
'func' => $func,
|
||||||
'desc' => $desc
|
'desc' => $desc
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns modules <var>$id</var> callback actions associative array
|
Returns modules <var>$id</var> callback actions associative array
|
||||||
|
|
||||||
@param id <b>string</b> Optionnal module ID
|
@param id <b>string</b> Optionnal module ID
|
||||||
@return <b>array</b>
|
@return <b>array</b>
|
||||||
*/
|
*/
|
||||||
public function getUserCallbacks($id)
|
public function getUserCallbacks($id)
|
||||||
{
|
{
|
||||||
return $this->getCallbacks('user',$id);
|
return $this->getCallbacks('user',$id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDirectCallbacks($id)
|
public function getDirectCallbacks($id)
|
||||||
{
|
{
|
||||||
return $this->getCallbacks('direct',$id);
|
return $this->getCallbacks('direct',$id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCallbacks($group,$id)
|
protected function getCallbacks($group,$id)
|
||||||
{
|
{
|
||||||
$group = self::group($group);
|
$group = self::group($group);
|
||||||
|
|
||||||
if (!isset($this->callbacks[$group][$id])) return array();
|
if (!isset($this->callbacks[$group][$id])) return array();
|
||||||
|
|
||||||
return $this->callbacks[$group][$id];
|
return $this->callbacks[$group][$id];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Execute a predifined action. This function call dcAdvancedCleaner
|
Execute a predifined action. This function call dcAdvancedCleaner
|
||||||
to do actions.
|
to do actions.
|
||||||
|
|
||||||
@param type <b>string</b> Type of action (from $allowed_properties)
|
@param type <b>string</b> Type of action (from $allowed_properties)
|
||||||
@param action <b>string</b> Action (from $allowed_properties)
|
@param action <b>string</b> Action (from $allowed_properties)
|
||||||
@param ns <b>string</b> Name of setting related to module.
|
@param ns <b>string</b> Name of setting related to module.
|
||||||
@return <b>array</b>
|
@return <b>array</b>
|
||||||
*/
|
*/
|
||||||
public function execute($type,$action,$ns)
|
public function execute($type,$action,$ns)
|
||||||
{
|
{
|
||||||
$prop = $this->getAllowedProperties();
|
$prop = $this->getAllowedProperties();
|
||||||
|
|
||||||
if (!isset($prop[$type][$action]) || empty($ns)) return;
|
if (!isset($prop[$type][$action]) || empty($ns)) return;
|
||||||
|
|
||||||
dcAdvancedCleaner::execute($this->core,$type,$action,$ns);
|
dcAdvancedCleaner::execute($this->core,$type,$action,$ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function sortModules($a,$b)
|
private function sortModules($a,$b)
|
||||||
{
|
{
|
||||||
return strcasecmp($a['name'],$b['name']);
|
return strcasecmp($a['name'],$b['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function group($group)
|
private function group($group)
|
||||||
{
|
{
|
||||||
return in_array($group,array('user','direct')) ? $group : null;
|
return in_array($group,array('user','direct')) ? $group : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,14 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of dcAdvancedCleaner, a plugin for Dotclear 2.
|
* @brief dcAdvancedCleaner, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2018 JC Denis and contributors
|
* @package Dotclear
|
||||||
# jcdenis@gdwd.com
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Jean-Christian Denis and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Christian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')){return;}
|
if (!defined('DC_RC_PATH')){return;}
|
||||||
|
|
||||||
|
@ -18,20 +19,20 @@ $core->activityReport->addGroup('dcadvancedcleaner',__('Plugin dcAdvancedCleaner
|
||||||
# from BEHAVIOR dcAdvancedCleanerBeforeAction
|
# from BEHAVIOR dcAdvancedCleanerBeforeAction
|
||||||
# in dcAdvancedCleaner/inc/class.dc.advanced.cleaner.php
|
# in dcAdvancedCleaner/inc/class.dc.advanced.cleaner.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'dcadvancedcleaner',
|
'dcadvancedcleaner',
|
||||||
'maintenance',
|
'maintenance',
|
||||||
__('Maintenance'),
|
__('Maintenance'),
|
||||||
__('New action from dcAdvancedCleaner has been made with type="%s", action="%s", ns="%s".'),
|
__('New action from dcAdvancedCleaner has been made with type="%s", action="%s", ns="%s".'),
|
||||||
'dcAdvancedCleanerBeforeAction',
|
'dcAdvancedCleanerBeforeAction',
|
||||||
array('dcAdvancedCleanerActivityReportBehaviors','maintenance')
|
array('dcAdvancedCleanerActivityReportBehaviors','maintenance')
|
||||||
);
|
);
|
||||||
|
|
||||||
class dcAdvancedCleanerActivityReportBehaviors
|
class dcAdvancedCleanerActivityReportBehaviors
|
||||||
{
|
{
|
||||||
public static function maintenance($type,$action,$ns)
|
public static function maintenance($type,$action,$ns)
|
||||||
{
|
{
|
||||||
$logs = array($type,$action,$ns);
|
$logs = array($type,$action,$ns);
|
||||||
|
|
||||||
$GLOBALS['core']->activityReport->addLog('dcadvancedcleaner','maintenance',$logs);
|
$GLOBALS['core']->activityReport->addLog('dcadvancedcleaner','maintenance',$logs);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,224 +1,225 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of dcAdvancedCleaner, a plugin for Dotclear 2.
|
* @brief dcAdvancedCleaner, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2018 JC Denis and contributors
|
* @package Dotclear
|
||||||
# jcdenis@gdwd.com
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Jean-Christian Denis and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Christian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
if (!defined('DC_ADMIN_CONTEXT')){return;}
|
if (!defined('DC_ADMIN_CONTEXT')){return;}
|
||||||
|
|
||||||
class behaviorsDcAdvancedCleaner
|
class behaviorsDcAdvancedCleaner
|
||||||
{
|
{
|
||||||
public static function pluginsBeforeDelete($plugin)
|
public static function pluginsBeforeDelete($plugin)
|
||||||
{
|
{
|
||||||
self::moduleBeforeDelete($plugin,'plugins.php?removed=1');
|
self::moduleBeforeDelete($plugin,'plugins.php?removed=1');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function themeBeforeDelete($theme)
|
public static function themeBeforeDelete($theme)
|
||||||
{
|
{
|
||||||
self::moduleBeforeDelete($theme,'blog_theme.php?del=1');
|
self::moduleBeforeDelete($theme,'blog_theme.php?del=1');
|
||||||
}
|
}
|
||||||
|
|
||||||
# Generic module before delete
|
# Generic module before delete
|
||||||
public static function moduleBeforeDelete($module,$redir)
|
public static function moduleBeforeDelete($module,$redir)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
$done = false;
|
$done = false;
|
||||||
|
|
||||||
if (!$core->blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_behavior_active) return;
|
if (!$core->blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_behavior_active) return;
|
||||||
|
|
||||||
$uninstaller = new dcUninstaller($core);
|
$uninstaller = new dcUninstaller($core);
|
||||||
$uninstaller->loadModule($module['root']);
|
$uninstaller->loadModule($module['root']);
|
||||||
|
|
||||||
$m_callbacks = $uninstaller->getDirectCallbacks($module['id']);
|
$m_callbacks = $uninstaller->getDirectCallbacks($module['id']);
|
||||||
$m_actions = $uninstaller->getDirectActions($module['id']);
|
$m_actions = $uninstaller->getDirectActions($module['id']);
|
||||||
|
|
||||||
foreach($m_callbacks as $k => $callback)
|
foreach($m_callbacks as $k => $callback)
|
||||||
{
|
{
|
||||||
if (!isset($callback['func']) || !is_callable($callback['func'])) continue;
|
if (!isset($callback['func']) || !is_callable($callback['func'])) continue;
|
||||||
|
|
||||||
call_user_func($callback['func'],$module);
|
call_user_func($callback['func'],$module);
|
||||||
$done = true;
|
$done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($m_actions as $type => $actions)
|
foreach($m_actions as $type => $actions)
|
||||||
{
|
{
|
||||||
foreach($actions as $v)
|
foreach($actions as $v)
|
||||||
{
|
{
|
||||||
$uninstaller->execute($type,$v['action'],$v['ns']);
|
$uninstaller->execute($type,$v['action'],$v['ns']);
|
||||||
$done = true;
|
$done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($done) {
|
if ($done) {
|
||||||
http::redirect($redir);
|
http::redirect($redir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function dcAdvancedCleanerAdminTabs($core,$p_url)
|
public static function dcAdvancedCleanerAdminTabs($core,$p_url)
|
||||||
{
|
{
|
||||||
self::modulesTabs($core,DC_PLUGINS_ROOT,$p_url.'&tab=uninstaller');
|
self::modulesTabs($core,DC_PLUGINS_ROOT,$p_url.'&tab=uninstaller');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function pluginsToolsTabs($core)
|
public static function pluginsToolsTabs($core)
|
||||||
{
|
{
|
||||||
self::modulesTabs($core,DC_PLUGINS_ROOT,'plugins.php?tab=uninstaller');
|
self::modulesTabs($core,DC_PLUGINS_ROOT,'plugins.php?tab=uninstaller');
|
||||||
}
|
}
|
||||||
|
|
||||||
# Generic module tabs
|
# Generic module tabs
|
||||||
public static function modulesTabs($core,$path,$redir,$title='')
|
public static function modulesTabs($core,$path,$redir,$title='')
|
||||||
{
|
{
|
||||||
if (!$core->blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_behavior_active) return;
|
if (!$core->blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_behavior_active) return;
|
||||||
|
|
||||||
$err = '';
|
$err = '';
|
||||||
$title = empty($title) ? __('Advanced uninstall') : $title;
|
$title = empty($title) ? __('Advanced uninstall') : $title;
|
||||||
|
|
||||||
$uninstaller = new dcUninstaller($core);
|
$uninstaller = new dcUninstaller($core);
|
||||||
$uninstaller->loadModules($path);
|
$uninstaller->loadModules($path);
|
||||||
$modules = $uninstaller->getModules();
|
$modules = $uninstaller->getModules();
|
||||||
$props = $uninstaller->getAllowedProperties();
|
$props = $uninstaller->getAllowedProperties();
|
||||||
|
|
||||||
# Execute
|
# Execute
|
||||||
if (isset($_POST['action']) && $_POST['action'] == 'uninstall'
|
if (isset($_POST['action']) && $_POST['action'] == 'uninstall'
|
||||||
&& (!empty($_POST['extras']) || !empty($_POST['actions']))) {
|
&& (!empty($_POST['extras']) || !empty($_POST['actions']))) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
# Extras
|
# Extras
|
||||||
if (!empty($_POST['extras'])) {
|
if (!empty($_POST['extras'])) {
|
||||||
foreach($_POST['extras'] as $module_id => $extras)
|
foreach($_POST['extras'] as $module_id => $extras)
|
||||||
{
|
{
|
||||||
foreach($extras as $k => $sentence)
|
foreach($extras as $k => $sentence)
|
||||||
{
|
{
|
||||||
$extra = @unserialize(@base64_decode($sentence));
|
$extra = @unserialize(@base64_decode($sentence));
|
||||||
|
|
||||||
if (!$extra || !is_callable($extra)) continue;
|
if (!$extra || !is_callable($extra)) continue;
|
||||||
|
|
||||||
call_user_func($extra,$modul_id);
|
call_user_func($extra,$modul_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Actions
|
# Actions
|
||||||
if (!empty($_POST['actions'])) {
|
if (!empty($_POST['actions'])) {
|
||||||
foreach($_POST['actions'] as $module_id => $actions)
|
foreach($_POST['actions'] as $module_id => $actions)
|
||||||
{
|
{
|
||||||
foreach($actions as $k => $sentence)
|
foreach($actions as $k => $sentence)
|
||||||
{
|
{
|
||||||
$action = @unserialize(@base64_decode($sentence));
|
$action = @unserialize(@base64_decode($sentence));
|
||||||
|
|
||||||
if (!$action
|
if (!$action
|
||||||
|| !isset($action['type'])
|
|| !isset($action['type'])
|
||||||
|| !isset($action['action'])
|
|| !isset($action['action'])
|
||||||
|| !isset($action['ns'])) continue;
|
|| !isset($action['ns'])) continue;
|
||||||
|
|
||||||
$uninstaller->execute($action['type'],$action['action'],$action['ns']);
|
$uninstaller->execute($action['type'],$action['action'],$action['ns']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
http::redirect($redir.'&msg=1');
|
http::redirect($redir.'&msg=1');
|
||||||
}
|
}
|
||||||
catch(Exception $e) {
|
catch(Exception $e) {
|
||||||
$err = $e->getMessage();
|
$err = $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<div class="multi-part" id="uninstaller" title="'.__($title).'">';
|
'<div class="multi-part" id="uninstaller" title="'.__($title).'">';
|
||||||
|
|
||||||
if($err)
|
if($err)
|
||||||
echo '<p class="error">'.$err.'</p>';
|
echo '<p class="error">'.$err.'</p>';
|
||||||
|
|
||||||
if(!count($modules)) {
|
if(!count($modules)) {
|
||||||
echo '<p>'.__('There is no module with uninstall features').'</p></div>';
|
echo '<p>'.__('There is no module with uninstall features').'</p></div>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<p>'.__('List of modules with advanced uninstall features').'</p>'.
|
'<p>'.__('List of modules with advanced uninstall features').'</p>'.
|
||||||
'<form method="post" action="'.$redir.'">'.
|
'<form method="post" action="'.$redir.'">'.
|
||||||
'<table class="clear"><tr>'.
|
'<table class="clear"><tr>'.
|
||||||
'<th>'.__('id').'</th>'.
|
'<th>'.__('id').'</th>'.
|
||||||
'<th>'.__('n°').'</th>';
|
'<th>'.__('n°').'</th>';
|
||||||
|
|
||||||
foreach($props as $pro_id => $prop) {
|
foreach($props as $pro_id => $prop) {
|
||||||
echo '<th>'.__($pro_id).'</th>';
|
echo '<th>'.__($pro_id).'</th>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<th>'.__('extra').'</th>'.
|
'<th>'.__('extra').'</th>'.
|
||||||
'</tr>';
|
'</tr>';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach($modules as $module_id => $module) {
|
foreach($modules as $module_id => $module) {
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<tr class="line">'.
|
'<tr class="line">'.
|
||||||
'<td class="nowrap">'.$module_id.'</td>'.
|
'<td class="nowrap">'.$module_id.'</td>'.
|
||||||
'<td class="nowrap">'.$module['version'].'</td>';
|
'<td class="nowrap">'.$module['version'].'</td>';
|
||||||
|
|
||||||
$actions = $uninstaller->getUserActions($module_id);
|
$actions = $uninstaller->getUserActions($module_id);
|
||||||
|
|
||||||
foreach($props as $prop_id => $prop) {
|
foreach($props as $prop_id => $prop) {
|
||||||
echo '<td class="nowrap">';
|
echo '<td class="nowrap">';
|
||||||
|
|
||||||
if (!isset($actions[$prop_id])) {
|
if (!isset($actions[$prop_id])) {
|
||||||
echo '--</td>';
|
echo '--</td>';
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$j = 0;
|
$j = 0;
|
||||||
foreach($actions[$prop_id] as $action_id => $action) {
|
foreach($actions[$prop_id] as $action_id => $action) {
|
||||||
|
|
||||||
if (!isset($props[$prop_id][$action['action']])) continue;
|
if (!isset($props[$prop_id][$action['action']])) continue;
|
||||||
|
|
||||||
$ret = base64_encode(serialize(array(
|
$ret = base64_encode(serialize(array(
|
||||||
'type' => $prop_id,
|
'type' => $prop_id,
|
||||||
'action'=>$action['action'],
|
'action'=>$action['action'],
|
||||||
'ns'=>$action['ns']
|
'ns'=>$action['ns']
|
||||||
)));
|
)));
|
||||||
|
|
||||||
echo '<label class="classic">'.
|
echo '<label class="classic">'.
|
||||||
form::checkbox(array('actions['.$module_id.']['.$j.']'),$ret).
|
form::checkbox(array('actions['.$module_id.']['.$j.']'),$ret).
|
||||||
' '.$action['desc'].'</label><br />';
|
' '.$action['desc'].'</label><br />';
|
||||||
|
|
||||||
$j++;
|
$j++;
|
||||||
}
|
}
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<td class="nowrap">';
|
echo '<td class="nowrap">';
|
||||||
|
|
||||||
$callbacks = $uninstaller->getUserCallbacks($module_id);
|
$callbacks = $uninstaller->getUserCallbacks($module_id);
|
||||||
|
|
||||||
if (empty($callbacks)) {
|
if (empty($callbacks)) {
|
||||||
echo '--';
|
echo '--';
|
||||||
}
|
}
|
||||||
|
|
||||||
$k = 0;
|
$k = 0;
|
||||||
foreach($callbacks as $callback_id => $callback) {
|
foreach($callbacks as $callback_id => $callback) {
|
||||||
|
|
||||||
$ret = base64_encode(serialize($callback['func']));
|
$ret = base64_encode(serialize($callback['func']));
|
||||||
|
|
||||||
echo '<label class="classic">'.
|
echo '<label class="classic">'.
|
||||||
form::checkbox(array('extras['.$module_id.']['.$k.']'),$ret).
|
form::checkbox(array('extras['.$module_id.']['.$k.']'),$ret).
|
||||||
' '.$callback['desc'].'</label><br />';
|
' '.$callback['desc'].'</label><br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
'</table>'.
|
'</table>'.
|
||||||
'<p>'.
|
'<p>'.
|
||||||
$core->formNonce().
|
$core->formNonce().
|
||||||
form::hidden(array('redir'),$redir).
|
form::hidden(array('redir'),$redir).
|
||||||
form::hidden(array('action'),'uninstall').
|
form::hidden(array('action'),'uninstall').
|
||||||
'<input type="submit" name="submit" value="'.__('Perform selected actions').'" /> '.
|
'<input type="submit" name="submit" value="'.__('Perform selected actions').'" /> '.
|
||||||
'</p>'.
|
'</p>'.
|
||||||
'</form>'.
|
'</form>'.
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
260
index.php
260
index.php
|
@ -1,14 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of dcAdvancedCleaner, a plugin for Dotclear 2.
|
* @brief dcAdvancedCleaner, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2018 JC Denis and contributors
|
* @package Dotclear
|
||||||
# jcdenis@gdwd.com
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Jean-Christian Denis and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Christian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')){return;}
|
if (!defined('DC_CONTEXT_ADMIN')){return;}
|
||||||
|
|
||||||
|
@ -19,99 +20,99 @@ $page_title = __('Advanced cleaner');
|
||||||
# Lists
|
# Lists
|
||||||
function drawDcAdvancedCleanerLists($core,$type)
|
function drawDcAdvancedCleanerLists($core,$type)
|
||||||
{
|
{
|
||||||
$combo_funcs = array(
|
$combo_funcs = array(
|
||||||
'settings' => array('dcAdvancedCleaner','getSettings'),
|
'settings' => array('dcAdvancedCleaner','getSettings'),
|
||||||
'tables' => array('dcAdvancedCleaner','getTables'),
|
'tables' => array('dcAdvancedCleaner','getTables'),
|
||||||
'plugins' => array('dcAdvancedCleaner','getPlugins'),
|
'plugins' => array('dcAdvancedCleaner','getPlugins'),
|
||||||
'themes' => array('dcAdvancedCleaner','getThemes'),
|
'themes' => array('dcAdvancedCleaner','getThemes'),
|
||||||
'caches' => array('dcAdvancedCleaner','getCaches'),
|
'caches' => array('dcAdvancedCleaner','getCaches'),
|
||||||
'versions' => array('dcAdvancedCleaner','getVersions')
|
'versions' => array('dcAdvancedCleaner','getVersions')
|
||||||
);
|
);
|
||||||
$combo_actions = array(
|
$combo_actions = array(
|
||||||
'settings' => array(
|
'settings' => array(
|
||||||
__('delete global settings') => 'delete_global',
|
__('delete global settings') => 'delete_global',
|
||||||
__('delete blog settings') => 'delete_local',
|
__('delete blog settings') => 'delete_local',
|
||||||
__('delete all settings') =>'delete_all'
|
__('delete all settings') =>'delete_all'
|
||||||
),
|
),
|
||||||
'tables' => array(
|
'tables' => array(
|
||||||
__('delete') => 'delete',
|
__('delete') => 'delete',
|
||||||
__('empty') => 'empty'
|
__('empty') => 'empty'
|
||||||
),
|
),
|
||||||
'plugins' => array(
|
'plugins' => array(
|
||||||
__('delete') => 'delete',
|
__('delete') => 'delete',
|
||||||
__('empty') => 'empty'
|
__('empty') => 'empty'
|
||||||
),
|
),
|
||||||
'themes' => array(
|
'themes' => array(
|
||||||
__('delete') => 'delete',
|
__('delete') => 'delete',
|
||||||
__('empty') => 'empty'
|
__('empty') => 'empty'
|
||||||
),
|
),
|
||||||
'caches' => array(
|
'caches' => array(
|
||||||
__('delete') => 'delete',
|
__('delete') => 'delete',
|
||||||
__('empty') => 'empty'
|
__('empty') => 'empty'
|
||||||
),
|
),
|
||||||
'versions' => array(
|
'versions' => array(
|
||||||
__('delete') => 'delete'
|
__('delete') => 'delete'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$combo_help = array(
|
$combo_help = array(
|
||||||
'settings' => __('Namespaces registered in dcSettings'),
|
'settings' => __('Namespaces registered in dcSettings'),
|
||||||
'tables' => __('All database tables of Dotclear'),
|
'tables' => __('All database tables of Dotclear'),
|
||||||
'plugins' => __('Folders from plugins directories'),
|
'plugins' => __('Folders from plugins directories'),
|
||||||
'themes' => __('Folders from blog themes directory'),
|
'themes' => __('Folders from blog themes directory'),
|
||||||
'caches' => __('Folders from cache directory'),
|
'caches' => __('Folders from cache directory'),
|
||||||
'versions' => __('Versions registered in table "version" of Dotclear')
|
'versions' => __('Versions registered in table "version" of Dotclear')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!isset($combo_funcs[$type])) return '';
|
if (!isset($combo_funcs[$type])) return '';
|
||||||
|
|
||||||
$rs = call_user_func($combo_funcs[$type],$core);
|
$rs = call_user_func($combo_funcs[$type],$core);
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<div class="listDcAdvancedCleaner">'.
|
'<div class="listDcAdvancedCleaner">'.
|
||||||
'<p class="form-note">'.$combo_help[$type].'</p>';
|
'<p class="form-note">'.$combo_help[$type].'</p>';
|
||||||
|
|
||||||
if (empty($rs)) {
|
if (empty($rs)) {
|
||||||
echo
|
echo
|
||||||
'<p>'.sprintf(__('There is no %s'),__(substr($type,0,-1))).'</p>';
|
'<p>'.sprintf(__('There is no %s'),__(substr($type,0,-1))).'</p>';
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<p>'.sprintf(__('There are %s %s'),count($rs),__($type)).'</p>'.
|
'<p>'.sprintf(__('There are %s %s'),count($rs),__($type)).'</p>'.
|
||||||
'<form method="post" action="plugin.php?p=dcAdvancedCleaner&tab=lists&part='.$type.'">'.
|
'<form method="post" action="plugin.php?p=dcAdvancedCleaner&tab=lists&part='.$type.'">'.
|
||||||
'<table><thead><tr>'.
|
'<table><thead><tr>'.
|
||||||
'<th>'.__('Name').'</th><th>'.__('Objects').'</th>'.
|
'<th>'.__('Name').'</th><th>'.__('Objects').'</th>'.
|
||||||
'</tr></thead><tbody>';
|
'</tr></thead><tbody>';
|
||||||
|
|
||||||
foreach($rs as $k => $v)
|
foreach($rs as $k => $v)
|
||||||
{
|
{
|
||||||
$offline = in_array($v['key'],dcAdvancedCleaner::$dotclear[$type]);
|
$offline = in_array($v['key'],dcAdvancedCleaner::$dotclear[$type]);
|
||||||
|
|
||||||
if ($core->blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_dcproperty_hide && $offline) continue;
|
if ($core->blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_dcproperty_hide && $offline) continue;
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<tr class="line'.
|
'<tr class="line'.
|
||||||
($offline ? ' offline' : '').
|
($offline ? ' offline' : '').
|
||||||
'">'.
|
'">'.
|
||||||
'<td class="nowrap"><label class="classic">'.
|
'<td class="nowrap"><label class="classic">'.
|
||||||
form::checkbox(array('entries['.$k.']'),html::escapeHTML($v['key'])).' '.$v['key'].'</label></td>'.
|
form::checkbox(array('entries['.$k.']'),html::escapeHTML($v['key'])).' '.$v['key'].'</label></td>'.
|
||||||
'<td class="nowrap">'.$v['value'].'</td>'.
|
'<td class="nowrap">'.$v['value'].'</td>'.
|
||||||
'</tr>';
|
'</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'</tbody></table>'.
|
'</tbody></table>'.
|
||||||
'<p>'.__('Action on selected rows:').'<br />'.
|
'<p>'.__('Action on selected rows:').'<br />'.
|
||||||
form::combo(array('action'),$combo_actions[$type]).
|
form::combo(array('action'),$combo_actions[$type]).
|
||||||
'<input type="submit" value="'.__('ok').'" />'.
|
'<input type="submit" value="'.__('ok').'" />'.
|
||||||
form::hidden(array('p'),'dcAdvancedCleaner').
|
form::hidden(array('p'),'dcAdvancedCleaner').
|
||||||
form::hidden(array('tab'),'lists').
|
form::hidden(array('tab'),'lists').
|
||||||
form::hidden(array('part'),$type).
|
form::hidden(array('part'),$type).
|
||||||
form::hidden(array('type'),$type).
|
form::hidden(array('type'),$type).
|
||||||
$core->formNonce().'</p>'.
|
$core->formNonce().'</p>'.
|
||||||
'</form>';
|
'</form>';
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
'<div>';
|
'<div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
# Localized l10n
|
# Localized l10n
|
||||||
|
@ -147,35 +148,35 @@ $s = $core->blog->settings->dcAdvancedCleaner;
|
||||||
|
|
||||||
# Combos
|
# Combos
|
||||||
$combo_title = array(
|
$combo_title = array(
|
||||||
'settings' => __('Settings'),
|
'settings' => __('Settings'),
|
||||||
'tables' => __('Tables'),
|
'tables' => __('Tables'),
|
||||||
'plugins' => __('Extensions'),
|
'plugins' => __('Extensions'),
|
||||||
'themes' => __('Themes'),
|
'themes' => __('Themes'),
|
||||||
'caches' => __('Cache'),
|
'caches' => __('Cache'),
|
||||||
'versions' => __('Versions')
|
'versions' => __('Versions')
|
||||||
);
|
);
|
||||||
|
|
||||||
$combo_type = array(
|
$combo_type = array(
|
||||||
'settings' => array('delete_global','delete_local','delete_all'),
|
'settings' => array('delete_global','delete_local','delete_all'),
|
||||||
'tables' => array('empty','delete'),
|
'tables' => array('empty','delete'),
|
||||||
'plugins' => array('empty','delete'),
|
'plugins' => array('empty','delete'),
|
||||||
'themes' => array('empty','delete'),
|
'themes' => array('empty','delete'),
|
||||||
'caches' => array('empty','delete'),
|
'caches' => array('empty','delete'),
|
||||||
'versions' => array('delete')
|
'versions' => array('delete')
|
||||||
);
|
);
|
||||||
|
|
||||||
# This plugin settings
|
# This plugin settings
|
||||||
if ($tab == 'dcac' && $action == 'dcadvancedcleaner_settings')
|
if ($tab == 'dcac' && $action == 'dcadvancedcleaner_settings')
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$s->put('dcAdvancedCleaner_behavior_active',isset($_POST['dcadvancedcleaner_behavior_active']),'boolean');
|
$s->put('dcAdvancedCleaner_behavior_active',isset($_POST['dcadvancedcleaner_behavior_active']),'boolean');
|
||||||
$s->put('dcAdvancedCleaner_dcproperty_hide',isset($_POST['dcadvancedcleaner_dcproperty_hide']),'boolean');
|
$s->put('dcAdvancedCleaner_dcproperty_hide',isset($_POST['dcadvancedcleaner_dcproperty_hide']),'boolean');
|
||||||
|
|
||||||
http::redirect($p_url.'&tab=dcac&part=dcac&part=&msg=done');
|
http::redirect($p_url.'&tab=dcac&part=dcac&part=&msg=done');
|
||||||
}
|
}
|
||||||
catch(Exception $e) {
|
catch(Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Actions
|
# Actions
|
||||||
|
@ -183,16 +184,16 @@ if ($tab == 'lists' && !empty($entries)
|
||||||
&& isset($combo_type[$type])
|
&& isset($combo_type[$type])
|
||||||
&& in_array($action,$combo_type[$type])) {
|
&& in_array($action,$combo_type[$type])) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
foreach($entries as $v) {
|
foreach($entries as $v) {
|
||||||
dcAdvancedCleaner::execute($core,$type,$action,$v);
|
dcAdvancedCleaner::execute($core,$type,$action,$v);
|
||||||
}
|
}
|
||||||
|
|
||||||
http::redirect($p_url.'&tab=lists&part='.$part.'&msg=done');
|
http::redirect($p_url.'&tab=lists&part='.$part.'&msg=done');
|
||||||
}
|
}
|
||||||
catch(Exception $e) {
|
catch(Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
|
@ -208,7 +209,7 @@ $core->callBehavior('dcAdvancedCleanerAdminHeader',$core,$p_url,$tab);
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</head><body>'.
|
</head><body>'.
|
||||||
dcPage::breadcrumb(
|
dcPage::breadcrumb(
|
||||||
array(
|
array(
|
||||||
html::escapeHTML($core->blog->name) => '',
|
html::escapeHTML($core->blog->name) => '',
|
||||||
'<span class="page-title">'.$page_title.'</span>' => ''
|
'<span class="page-title">'.$page_title.'</span>' => ''
|
||||||
|
@ -225,20 +226,20 @@ echo '<div class="multi-part" id="lists" title="'.__('Records and folders').'">'
|
||||||
'<p>';
|
'<p>';
|
||||||
foreach($combo_title as $k => $v)
|
foreach($combo_title as $k => $v)
|
||||||
{
|
{
|
||||||
echo '<a class="button" href="'.$p_url.'&tab=lists&part='.$k.'">'.$v.'</a> ';
|
echo '<a class="button" href="'.$p_url.'&tab=lists&part='.$k.'">'.$v.'</a> ';
|
||||||
}
|
}
|
||||||
echo '</p>';
|
echo '</p>';
|
||||||
|
|
||||||
# Load "part" page
|
# Load "part" page
|
||||||
if (isset($combo_title[$part]))
|
if (isset($combo_title[$part]))
|
||||||
{
|
{
|
||||||
echo '<fieldset><legend>'.$combo_title[$part].'</legend>';
|
echo '<fieldset><legend>'.$combo_title[$part].'</legend>';
|
||||||
drawDcAdvancedCleanerLists($core,$part);
|
drawDcAdvancedCleanerLists($core,$part);
|
||||||
echo '</fieldset>';
|
echo '</fieldset>';
|
||||||
}
|
}
|
||||||
if ($s->dcAdvancedCleaner_dcproperty_hide)
|
if ($s->dcAdvancedCleaner_dcproperty_hide)
|
||||||
{
|
{
|
||||||
echo '<p class="info">'.__('Default values of Dotclear are hidden. You can change this in settings tab').'</p>';
|
echo '<p class="info">'.__('Default values of Dotclear are hidden. You can change this in settings tab').'</p>';
|
||||||
}
|
}
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
|
@ -279,4 +280,3 @@ dcAdvancedCleaner - '.$core->plugins->moduleInfo('dcAdvancedCleaner','version').
|
||||||
<img alt="dcMiniUrl" src="index.php?pf=dcAdvancedCleaner/icon.png" />
|
<img alt="dcMiniUrl" src="index.php?pf=dcAdvancedCleaner/icon.png" />
|
||||||
</p>
|
</p>
|
||||||
</body></html>';
|
</body></html>';
|
||||||
?>
|
|
|
@ -12,5 +12,5 @@
|
||||||
if (!defined('DC_RC_PATH')){return;}
|
if (!defined('DC_RC_PATH')){return;}
|
||||||
if (!isset($__resources['help']['dcAdvancedCleaner']))
|
if (!isset($__resources['help']['dcAdvancedCleaner']))
|
||||||
{
|
{
|
||||||
$__resources['help']['dcAdvancedCleaner'] = dirname(__FILE__).'/help/dcAdvancedCleaner.html';
|
$__resources['help']['dcAdvancedCleaner'] = dirname(__FILE__).'/help/dcAdvancedCleaner.html';
|
||||||
}
|
}
|
|
@ -188,5 +188,3 @@ $GLOBALS['__l10n']['Hide Dotclear default properties in actions tabs'] = 'Cacher
|
||||||
$GLOBALS['__l10n']['Prevent from deleting Dotclear important properties.'] = 'Évite de supprimer des propriétés importantes de Dotclear.';
|
$GLOBALS['__l10n']['Prevent from deleting Dotclear important properties.'] = 'Évite de supprimer des propriétés importantes de Dotclear.';
|
||||||
|
|
||||||
$GLOBALS['__l10n']['Make a huge cleaning of dotclear'] = 'Faites un énorme nettoyage de dotclear';
|
$GLOBALS['__l10n']['Make a huge cleaning of dotclear'] = 'Faites un énorme nettoyage de dotclear';
|
||||||
|
|
||||||
?>
|
|
|
@ -12,5 +12,5 @@
|
||||||
if (!defined('DC_RC_PATH')){return;}
|
if (!defined('DC_RC_PATH')){return;}
|
||||||
if (!isset($__resources['help']['dcAdvancedCleaner']))
|
if (!isset($__resources['help']['dcAdvancedCleaner']))
|
||||||
{
|
{
|
||||||
$__resources['help']['dcAdvancedCleaner'] = dirname(__FILE__).'/help/dcAdvancedCleaner.html';
|
$__resources['help']['dcAdvancedCleaner'] = dirname(__FILE__).'/help/dcAdvancedCleaner.html';
|
||||||
}
|
}
|
Loading…
Reference in New Issue