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 pacKman 2013.11.15
===========================================================
* Fix all forms: Use modules root intead of Id * Fix all forms: Use modules root intead of Id
pacKman 2013.10.28 pacKman 2013.10.28
===========================================================
* Change behaviors arguments * Change behaviors arguments
* Typo and minor fixes * Typo and minor fixes
pacKman 2013.10.26 pacKman 2013.10.26
===========================================================
* Switch to DC 2.6 * Switch to DC 2.6
* Fix use of dcThemes, thx franckpaul * Fix use of dcThemes, thx franckpaul
* New icon, thx kozlika * New icon, thx kozlika
@ -16,23 +16,19 @@ pacKman 2013.10.26
* Clean up code and (again) lighter admin interface * Clean up code and (again) lighter admin interface
pacKman 2013.05.11 pacKman 2013.05.11
===========================================================
* Added option to remove comments from files * Added option to remove comments from files
* Fixed page title and messages and contents * Fixed page title and messages and contents
pacKman 0.5.1 - 2010-10-12 pacKman 0.5.1 - 2010-10-12
===========================================================
* Fixed install on nightly build * Fixed install on nightly build
* Fixed missing namespace on admin * Fixed missing namespace on admin
pacKman 0.5 - 2010-06-05 pacKman 0.5 - 2010-06-05
===========================================================
* Switched to DC 2.2 * Switched to DC 2.2
* Changed admin interface (easy, light, fast) * Changed admin interface (easy, light, fast)
* Added direct download button on repository (closes #449) * Added direct download button on repository (closes #449)
pacKman 0.4 - 2009-10-10 pacKman 0.4 - 2009-10-10
===========================================================
* Fixed second package management * Fixed second package management
* Fixed subfolder in filename * Fixed subfolder in filename
* Added install and uninstall features * 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 Once it's done you can manage your packages from menu
''Packages repository'' on sidebar or you can add dashboard icon. ''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 ------------------------------------ # -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) { if (!defined('DC_CONTEXT_ADMIN')) {
return null; return null;
} }
$core->blog->settings->addNamespace('pacKman'); $core->blog->settings->addNamespace('pacKman');
$core->addBehavior( $core->addBehavior('adminDashboardFavorites', ['packmanBehaviors', 'adminDashboardFavorites']);
'adminDashboardFavorites',
array('packmanBehaviors', 'adminDashboardFavorites')
);
$_menu['Plugins']->addItem( $_menu['Plugins']->addItem(
__('Packages repository'), __('Packages repository'),
@ -39,7 +35,7 @@ class packmanBehaviors
{ {
public static function adminDashboardFavorites($core, $favs) public static function adminDashboardFavorites($core, $favs)
{ {
$favs->register('pacKman', array( $favs->register('pacKman', [
'title' => __('Packages repository'), 'title' => __('Packages repository'),
'url' => 'plugin.php?p=pacKman#packman-repository-repository', 'url' => 'plugin.php?p=pacKman#packman-repository-repository',
'small-icon' => 'index.php?pf=pacKman/icon.png', 'small-icon' => 'index.php?pf=pacKman/icon.png',
@ -49,7 +45,7 @@ class packmanBehaviors
'packmanBehaviors', 'packmanBehaviors',
'adminDashboardFavoritesActive' 'adminDashboardFavoritesActive'
) )
)); ]);
} }
public static function adminDashboardFavoritesActive($request, $params) public static function adminDashboardFavoritesActive($request, $params)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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