move to Franck style

This commit is contained in:
Jean-Christian Paul Denis 2021-08-17 23:12:33 +02:00
parent 373a26d730
commit 42f12a73e6
9 changed files with 450 additions and 472 deletions

View File

@ -1,14 +1,14 @@
pacKman 2021.08.17
* move to Franck style
pacKman 2013.11.15
===========================================================
* Fix all forms: Use modules root intead of Id
pacKman 2013.10.28
===========================================================
* Change behaviors arguments
* Typo and minor fixes
pacKman 2013.10.26
===========================================================
* Switch to DC 2.6
* Fix use of dcThemes, thx franckpaul
* New icon, thx kozlika
@ -16,23 +16,19 @@ pacKman 2013.10.26
* Clean up code and (again) lighter admin interface
pacKman 2013.05.11
===========================================================
* Added option to remove comments from files
* Fixed page title and messages and contents
pacKman 0.5.1 - 2010-10-12
===========================================================
* Fixed install on nightly build
* Fixed missing namespace on admin
pacKman 0.5 - 2010-06-05
===========================================================
* Switched to DC 2.2
* Changed admin interface (easy, light, fast)
* Added direct download button on repository (closes #449)
pacKman 0.4 - 2009-10-10
===========================================================
* Fixed second package management
* Fixed subfolder in filename
* Added install and uninstall features

View File

@ -27,3 +27,9 @@ go to ''configure plugin'', fill in form.
Once it's done you can manage your packages from menu
''Packages repository'' on sidebar or you can add dashboard icon.
## MORE
* License : GNU GPL v2
* Source & contribution : [GitHub Page](https://github.com/JcDenis/pacKman)
* Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/pacKman)

View File

@ -13,16 +13,12 @@
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
$core->blog->settings->addNamespace('pacKman');
$core->addBehavior(
'adminDashboardFavorites',
array('packmanBehaviors', 'adminDashboardFavorites')
);
$core->addBehavior('adminDashboardFavorites', ['packmanBehaviors', 'adminDashboardFavorites']);
$_menu['Plugins']->addItem(
__('Packages repository'),
@ -39,7 +35,7 @@ class packmanBehaviors
{
public static function adminDashboardFavorites($core, $favs)
{
$favs->register('pacKman', array(
$favs->register('pacKman', [
'title' => __('Packages repository'),
'url' => 'plugin.php?p=pacKman#packman-repository-repository',
'small-icon' => 'index.php?pf=pacKman/icon.png',
@ -49,7 +45,7 @@ class packmanBehaviors
'packmanBehaviors',
'adminDashboardFavoritesActive'
)
));
]);
}
public static function adminDashboardFavoritesActive($request, $params)

View File

@ -13,12 +13,11 @@
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_MODULE')) {
return null;
}
$redir = empty($_REQUEST['redir']) ?
$list->getURL().'#plugins' : $_REQUEST['redir'];
$list->getURL() . '#plugins' : $_REQUEST['redir'];
# -- Get settings --
$core->blog->settings->addNamespace('pacKman');
@ -62,7 +61,7 @@ if (!empty($_POST['save'])) {
__('Configuration has been successfully updated.')
);
http::redirect(
$list->getURL('module=pacKman&conf=1&redir='.
$list->getURL('module=pacKman&conf=1&redir=' .
$list->getRedir())
);
}
@ -74,47 +73,46 @@ if (!empty($_POST['save'])) {
# -- Display form --
echo '
<div class="fieldset">
<h4>'.__('Root').'</h4>
<h4>' . __('Root') . '</h4>
<p><label for="packman_pack_repository">'.__('Path to repository:').' '.
form::field('packman_pack_repository', 65, 255, $packman_pack_repository, 'maximal').
'</label></p>'.
'<p class="form-note">'.sprintf(__('Preconization: %s'), $core->blog->public_path ?
<p><label for="packman_pack_repository">' . __('Path to repository:') . ' ' .
form::field('packman_pack_repository', 65, 255, $packman_pack_repository, 'maximal') .
'</label></p>' .
'<p class="form-note">' . sprintf(__('Preconization: %s'), $core->blog->public_path ?
$core->blog->public_path : __("Blog's public directory")
).'</p>
) . '</p>
</div>
<div class="fieldset">
<h4>'.__('Files').'</h4>
<h4>' . __('Files') . '</h4>
<p><label for="packman_pack_filename">'.__('Name of exported package:').' '.
form::field('packman_pack_filename', 65, 255, $packman_pack_filename, 'maximal').
<p><label for="packman_pack_filename">' . __('Name of exported package:') . ' ' .
form::field('packman_pack_filename', 65, 255, $packman_pack_filename, 'maximal') .
'</label></p>
<p class="form-note">'.sprintf(__('Preconization: %s'), '%type%-%id%-%version%').'</p>
<p class="form-note">' . sprintf(__('Preconization: %s'), '%type%-%id%-%version%') . '</p>
<p><label for="packman_secondpack_filename">'.__('Name of second exported package:').' '.
form::field('packman_secondpack_filename', 65, 255, $packman_secondpack_filename, 'maximal').
<p><label for="packman_secondpack_filename">' . __('Name of second exported package:') . ' ' .
form::field('packman_secondpack_filename', 65, 255, $packman_secondpack_filename, 'maximal') .
'</label></p>
<p class="form-note">'.sprintf(__('Preconization: %s'), '%type%-%id%').'</p>
<p class="form-note">' . sprintf(__('Preconization: %s'), '%type%-%id%') . '</p>
<p><label class="classic" for="packman_pack_overwrite">'.
form::checkbox('packman_pack_overwrite', 1, $packman_pack_overwrite).' '.
__('Overwrite existing package').'</label></p>
form::checkbox('packman_pack_overwrite', 1, $packman_pack_overwrite) . ' ' .
__('Overwrite existing package') . '</label></p>
</div>
<div class="fieldset">
<h4>'.__('Content').'</h4>
<h4>' . __('Content') . '</h4>
<p><label for="packman_pack_excludefiles">'.__('Extra files to exclude from package:').' '.
form::field('packman_pack_excludefiles', 65, 255, $packman_pack_excludefiles, 'maximal').
<p><label for="packman_pack_excludefiles">' . __('Extra files to exclude from package:') . ' ' .
form::field('packman_pack_excludefiles', 65, 255, $packman_pack_excludefiles, 'maximal') .
'</label></p>
<p class="form-note">'.sprintf(__('Preconization: %s'), '*.zip,*.tar,*.tar.gz').'</p>
<p class="form-note">' . sprintf(__('Preconization: %s'), '*.zip,*.tar,*.tar.gz') . '</p>
<p><label class="classic" for="packman_pack_nocomment">'.
form::checkbox('packman_pack_nocomment', 1, $packman_pack_nocomment).' '.
__('Remove comments from files').'</label></p>
<p><label class="classic" for="packman_pack_nocomment">' .
form::checkbox('packman_pack_nocomment', 1, $packman_pack_nocomment) . ' ' .
__('Remove comments from files') . '</label></p>
</div>';

View File

@ -13,25 +13,19 @@
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) {
return null;
}
$this->registerModule(
/* Name */
"pacKman",
/* Description*/
"Manage your Dotclear packages",
/* Author */
"Jean-Christian Denis",
/* Version */
'2013.11.15',
/* Properies */
array(
'pacKman', // Name
'Manage your Dotclear packages', // Description
'Jean-Christian Denis', // Author
'2021.08.17', // Version
[
'permissions' => null,
'type' => 'plugin',
'dc_min' => '2.6',
'support' => 'http://jcd.lv/q=pacKman',
'details' => 'http://plugins.dotaddict.org/dc2/details/pacKman'
)
'dc_min' => '2.19',
'support' => 'https://github.com/JcDenis/pacKman',
'details' => 'https://plugins.dotaddict.org/dc2/details/pacKman'
]
);

View File

@ -13,7 +13,6 @@
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
@ -109,5 +108,3 @@ catch (Exception $e) {
return false;
}
?>

View File

@ -13,7 +13,6 @@
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) {
return null;
}

View File

@ -13,7 +13,6 @@
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}

View File

@ -22,7 +22,7 @@ dcPage::checkSuper();
$p_url = 'plugin.php?p=pacKman';
$action = isset($_POST['action']) ? $_POST['action'] : '';
$type = isset($_POST['type']) && in_array($_POST['type'],
array('plugins','themes','repository')) ? $_POST['type'] : '';
array('plugins', 'themes', 'repository')) ? $_POST['type'] : '';
# Settings
$core->blog->settings->addNamespace('pacKman');
@ -31,7 +31,7 @@ $s = $core->blog->settings->pacKman;
# Modules
if (!isset($core->themes)) {
$core->themes = new dcThemes($core);
$core->themes->loadModules($core->blog->themes_path,null);
$core->themes->loadModules($core->blog->themes_path, null);
}
$themes = $core->themes;
$plugins = $core->plugins;
@ -75,14 +75,14 @@ try
}
else {
$modules = array_merge(
dcPackman::getPackages($core, dirname($repo_path.'/'.$s->packman_pack_filename)),
dcPackman::getPackages($core, dirname($repo_path.'/'.$s->packman_secondpack_filename))
dcPackman::getPackages($core, dirname($repo_path . '/' . $s->packman_pack_filename)),
dcPackman::getPackages($core, dirname($repo_path . '/' . $s->packman_secondpack_filename))
);
}
foreach($modules as $f) {
if (preg_match('/'.preg_quote($_REQUEST['package']).'$/', $f['root'])
if (preg_match('/' . preg_quote($_REQUEST['package']) . '$/', $f['root'])
&& is_file($f['root']) && is_readable($f['root'])
) {
@ -90,8 +90,8 @@ try
$core->callBehavior('packmanBeforeDownloadPackage', $f, $type);
header('Content-Type: application/zip');
header('Content-Length: '.filesize($f['root']));
header('Content-Disposition: attachment; filename="'.basename($f['root']).'"');
header('Content-Length: ' . filesize($f['root']));
header('Content-Disposition: attachment; filename="' . basename($f['root']) . '"');
readfile($f['root']);
# --BEHAVIOR-- packmanAfterDownloadPackage
@ -103,7 +103,7 @@ try
# Not found
header('Content-Type: text/plain');
http::head(404,'Not Found');
http::head(404, 'Not Found');
exit;
}
elseif (!empty($action) && !$is_editable) {
@ -146,7 +146,7 @@ try
__('Package successfully created.')
);
http::redirect(empty($_POST['redir']) ?
$p_url.'#packman-'.$type : $_POST['redir']
$p_url . '#packman-' . $type : $_POST['redir']
);
}
@ -155,7 +155,7 @@ try
foreach ($_POST['modules'] as $root => $id) {
if (!file_exists($root) || !files::isDeletable($root)) {
throw new Exception('Undeletable file: '.$root);
throw new Exception('Undeletable file: ' . $root);
}
unlink($root);
@ -165,7 +165,7 @@ try
__('Package successfully deleted.')
);
http::redirect(
$p_url.'#packman-repository-'.$type
$p_url . '#packman-repository-' . $type
);
}
@ -193,7 +193,7 @@ try
__('Package successfully installed.')
);
http::redirect(
$p_url.'#packman-repository-'.$type
$p_url . '#packman-repository-' . $type
);
}
@ -212,7 +212,7 @@ try
foreach ($_POST['modules'] as $root => $id) {
file_put_contents(
$dest.'/'.basename($root),
$dest . '/' . basename($root),
file_get_contents($root)
);
}
@ -221,7 +221,7 @@ try
__('Package successfully copied.')
);
http::redirect(
$p_url.'#packman-repository-'.$type
$p_url . '#packman-repository-' . $type
);
}
@ -240,7 +240,7 @@ try
foreach ($_POST['modules'] as $root => $id) {
file_put_contents(
$dest.'/'.basename($root),
$dest . '/' . basename($root),
file_get_contents($root)
);
unlink($root);
@ -250,7 +250,7 @@ try
__('Package successfully moved.')
);
http::redirect(
$p_url.'#packman-repository-'.$type
$p_url . '#packman-repository-' . $type
);
}
}
@ -260,15 +260,15 @@ catch(Exception $e) {
# Display
echo
'<html><head><title>'.__('pacKman').'</title>'.
dcPage::jsPageTabs().
'<html><head><title>' . __('pacKman') . '</title>' .
dcPage::jsPageTabs() .
dcPage::jsLoad('index.php?pf=pacKman/js/packman.js');
# --BEHAVIOR-- packmanAdminHeader
$core->callBehavior('packmanAdminHeader', $core);
echo
'</head><body>'.
'</head><body>' .
dcPage::breadcrumb(
array(
@ -280,9 +280,9 @@ dcPage::notices();
if ($core->error->flag()) {
echo
'<p class="warning">'.__('pacKman is not well configured.').' '.
'<a href="plugins.php?module=pacKman&amp;conf=1&amp;redir='.
urlencode('plugin.php?p=pacKman').'">'.__('Configuration').'</a>'.
'<p class="warning">' . __('pacKman is not well configured.') . ' ' .
'<a href="plugins.php?module=pacKman&amp;conf=1&amp;redir=' .
urlencode('plugin.php?p=pacKman') . '">' . __('Configuration') . '</a>' .
'</p>';
}
else {
@ -290,11 +290,11 @@ else {
$repo_path_modules = array_merge(
dcPackman::getPackages(
$core,
dirname($repo_path.'/'.$s->packman_pack_filename)
dirname($repo_path . '/' . $s->packman_pack_filename)
),
dcPackman::getPackages(
$core,
dirname($repo_path.'/'.$s->packman_secondpack_filename)
dirname($repo_path . '/' . $s->packman_secondpack_filename)
)
);
$plugins_path_modules = dcPackman::getPackages(
@ -348,11 +348,4 @@ $core->callBehavior('packmanAdminTabs', $core);
dcPage::helpBlock('pacKman');
echo
'<hr class="clear"/><p class="right modules">
<a class="module-config" '.
'href="plugins.php?module=pacKman&amp;conf=1&amp;redir='.
urlencode('plugin.php?p=pacKman').'">'.__('Configuration').'</a> -
pacKman - '.$core->plugins->moduleInfo('pacKman', 'version').'&nbsp;
<img alt="'.__('pacKman').'" src="index.php?pf=pacKman/icon.png" />
</p>
</body></html>';
'</body></html>';