prepare to DC 2.24
This commit is contained in:
parent
c0b4696ab8
commit
d493dfa329
@ -1,3 +1,6 @@
|
|||||||
|
2022.11.12
|
||||||
|
- prepare to DC 2.24
|
||||||
|
|
||||||
2022.02.01
|
2022.02.01
|
||||||
- fix module info (id/root) before zip
|
- fix module info (id/root) before zip
|
||||||
- use dc2.21 new svg icon by @franck-paul
|
- use dc2.21 new svg icon by @franck-paul
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
[![Release](https://img.shields.io/github/v/release/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/releases)
|
[![Release](https://img.shields.io/github/v/release/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/releases)
|
||||||
[![Date](https://img.shields.io/github/release-date/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/releases)
|
[![Date](https://img.shields.io/github/release-date/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/releases)
|
||||||
[![Issues](https://img.shields.io/github/issues/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/issues)
|
[![Issues](https://img.shields.io/github/issues/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/issues)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.19-blue.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.24-blue.svg)](https://fr.dotclear.org/download)
|
||||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/pacKman)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/pacKman)
|
||||||
[![License](https://img.shields.io/github/license/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/blob/master/LICENSE)
|
[![License](https://img.shields.io/github/license/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/blob/master/LICENSE)
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ themes and plugins from Dotclear administration pages.
|
|||||||
pacKman requires:
|
pacKman requires:
|
||||||
|
|
||||||
* Super administrator permissions
|
* Super administrator permissions
|
||||||
* Dotclear 2.21
|
* Dotclear 2.24
|
||||||
* A writable cache directory
|
* A writable cache directory
|
||||||
* A writable directory to put paquetages.
|
* A writable directory to put paquetages.
|
||||||
|
|
||||||
|
12
_admin.php
12
_admin.php
@ -14,11 +14,11 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$core->blog->settings->addNamespace('pacKman');
|
dcCore::app()->blog->settings->addNamespace('pacKman');
|
||||||
|
|
||||||
$core->addBehavior('adminDashboardFavorites', ['packmanBehaviors', 'adminDashboardFavorites']);
|
dcCore::app()->addBehavior('adminDashboardFavoritesV2', ['packmanBehaviors', 'adminDashboardFavorites']);
|
||||||
|
|
||||||
$_menu['Plugins']->addItem(
|
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||||
__('Packages repository'),
|
__('Packages repository'),
|
||||||
'plugin.php?p=pacKman#packman-repository-repository',
|
'plugin.php?p=pacKman#packman-repository-repository',
|
||||||
[dcPage::getPF('pacKman/icon.svg'), dcPage::getPF('pacKman/icon-dark.svg')],
|
[dcPage::getPF('pacKman/icon.svg'), dcPage::getPF('pacKman/icon-dark.svg')],
|
||||||
@ -26,19 +26,19 @@ $_menu['Plugins']->addItem(
|
|||||||
'/plugin.php\?p=pacKman(&.*)?$/',
|
'/plugin.php\?p=pacKman(&.*)?$/',
|
||||||
$_SERVER['REQUEST_URI']
|
$_SERVER['REQUEST_URI']
|
||||||
),
|
),
|
||||||
$core->auth->isSuperAdmin()
|
dcCore::app()->auth->isSuperAdmin()
|
||||||
);
|
);
|
||||||
|
|
||||||
class packmanBehaviors
|
class packmanBehaviors
|
||||||
{
|
{
|
||||||
public static function adminDashboardFavorites(dcCore $core, dcFavorites $favs): void
|
public static function adminDashboardFavorites(dcFavorites $favs): void
|
||||||
{
|
{
|
||||||
$favs->register('pacKman', [
|
$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' => [dcPage::getPF('pacKman/icon.svg'), dcPage::getPF('pacKman/icon-dark.svg')],
|
'small-icon' => [dcPage::getPF('pacKman/icon.svg'), dcPage::getPF('pacKman/icon-dark.svg')],
|
||||||
'large-icon' => [dcPage::getPF('pacKman/icon.svg'), dcPage::getPF('pacKman/icon-dark.svg')],
|
'large-icon' => [dcPage::getPF('pacKman/icon.svg'), dcPage::getPF('pacKman/icon-dark.svg')],
|
||||||
'permissions' => $core->auth->isSuperAdmin(),
|
'permissions' => dcCore::app()->auth->isSuperAdmin(),
|
||||||
'active_cb' => [
|
'active_cb' => [
|
||||||
'packmanBehaviors',
|
'packmanBehaviors',
|
||||||
'adminDashboardFavoritesActive'
|
'adminDashboardFavoritesActive'
|
||||||
|
17
_config.php
17
_config.php
@ -15,11 +15,11 @@ if (!defined('DC_CONTEXT_MODULE')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$redir = empty($_REQUEST['redir']) ?
|
$redir = empty($_REQUEST['redir']) ?
|
||||||
$list->getURL() . '#plugins' : $_REQUEST['redir'];
|
dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir'];
|
||||||
|
|
||||||
# -- Get settings --
|
# -- Get settings --
|
||||||
$core->blog->settings->addNamespace('pacKman');
|
dcCore::app()->blog->settings->addNamespace('pacKman');
|
||||||
$s = $core->blog->settings->pacKman;
|
$s = dcCore::app()->blog->settings->pacKman;
|
||||||
|
|
||||||
$packman_pack_nocomment = $s->packman_pack_nocomment;
|
$packman_pack_nocomment = $s->packman_pack_nocomment;
|
||||||
$packman_pack_fixnewline = $s->packman_pack_fixnewline;
|
$packman_pack_fixnewline = $s->packman_pack_fixnewline;
|
||||||
@ -41,7 +41,6 @@ if (!empty($_POST['save'])) {
|
|||||||
$packman_pack_excludefiles = (string) $_POST['packman_pack_excludefiles'];
|
$packman_pack_excludefiles = (string) $_POST['packman_pack_excludefiles'];
|
||||||
|
|
||||||
$check = libPackman::is_configured(
|
$check = libPackman::is_configured(
|
||||||
$core,
|
|
||||||
$packman_pack_repository,
|
$packman_pack_repository,
|
||||||
$packman_pack_filename,
|
$packman_pack_filename,
|
||||||
$packman_secondpack_filename
|
$packman_secondpack_filename
|
||||||
@ -60,12 +59,12 @@ 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=' .
|
dcCore::app()->admin->list->getURL('module=pacKman&conf=1&redir=' .
|
||||||
$list->getRedir())
|
dcCore::app()->admin->list->getRedir())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,8 +78,8 @@ form::field('packman_pack_repository', 65, 255, $packman_pack_repository, 'maxim
|
|||||||
'</label></p>' .
|
'</label></p>' .
|
||||||
'<p class="form-note">' . sprintf(
|
'<p class="form-note">' . sprintf(
|
||||||
__('Preconization: %s'),
|
__('Preconization: %s'),
|
||||||
$core->blog->public_path ?
|
dcCore::app()->blog->public_path ?
|
||||||
$core->blog->public_path : __("Blog's public directory")
|
dcCore::app()->blog->public_path : __("Blog's public directory")
|
||||||
) . '</p>
|
) . '</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -18,9 +18,9 @@ $this->registerModule(
|
|||||||
'pacKman',
|
'pacKman',
|
||||||
'Manage your Dotclear packages',
|
'Manage your Dotclear packages',
|
||||||
'Jean-Christian Denis',
|
'Jean-Christian Denis',
|
||||||
'2022.02.01',
|
'2022.11.12',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.21']],
|
'requires' => [['core', '2.24']],
|
||||||
'permissions' => null,
|
'permissions' => null,
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'https://github.com/JcDenis/pacKman',
|
'support' => 'https://github.com/JcDenis/pacKman',
|
||||||
|
14
_install.php
14
_install.php
@ -69,8 +69,8 @@ try {
|
|||||||
|
|
||||||
# Check module version
|
# Check module version
|
||||||
if (version_compare(
|
if (version_compare(
|
||||||
$core->getVersion($mod_id),
|
dcCore::app()->getVersion($mod_id),
|
||||||
$core->plugins->moduleInfo($mod_id, 'version'),
|
dcCore::app()->plugins->moduleInfo($mod_id, 'version'),
|
||||||
'>='
|
'>='
|
||||||
)) {
|
)) {
|
||||||
return null;
|
return null;
|
||||||
@ -87,9 +87,9 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Set module settings
|
# Set module settings
|
||||||
$core->blog->settings->addNamespace($mod_id);
|
dcCore::app()->blog->settings->addNamespace($mod_id);
|
||||||
foreach ($mod_conf as $v) {
|
foreach ($mod_conf as $v) {
|
||||||
$core->blog->settings->{$mod_id}->put(
|
dcCore::app()->blog->settings->{$mod_id}->put(
|
||||||
$v[0],
|
$v[0],
|
||||||
$v[2],
|
$v[2],
|
||||||
$v[3],
|
$v[3],
|
||||||
@ -100,14 +100,14 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Set module version
|
# Set module version
|
||||||
$core->setVersion(
|
dcCore::app()->setVersion(
|
||||||
$mod_id,
|
$mod_id,
|
||||||
$core->plugins->moduleInfo($mod_id, 'version')
|
dcCore::app()->plugins->moduleInfo($mod_id, 'version')
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,8 @@ if (!defined('DC_RC_PATH')) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$d = dirname(__FILE__) . '/inc/';
|
$d = __DIR__ . '/inc/';
|
||||||
|
|
||||||
$__autoload['dcPackman'] = $d . 'class.dc.packman.php';
|
Clearbricks::lib()->autoload(['dcPackman' => $d . 'class.dc.packman.php']);
|
||||||
$__autoload['libPackman'] = $d . 'lib.packman.php';
|
Clearbricks::lib()->autoload(['libPackman' => $d . 'lib.packman.php']);
|
||||||
$__autoload['packmanFileZip'] = $d . 'lib.packman.filezip.php';
|
Clearbricks::lib()->autoload(['packmanFileZip' => $d . 'lib.packman.filezip.php']);
|
||||||
|
@ -42,7 +42,7 @@ class dcPackman
|
|||||||
return $exclude;
|
return $exclude;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPackages(dcCore $core, string $root): array
|
public static function getPackages(string $root): array
|
||||||
{
|
{
|
||||||
$res = [];
|
$res = [];
|
||||||
|
|
||||||
@ -84,12 +84,12 @@ class dcPackman
|
|||||||
|
|
||||||
$zip->unzip($define, $cache . '/_define.php');
|
$zip->unzip($define, $cache . '/_define.php');
|
||||||
|
|
||||||
$modules = new dcModules($core);
|
$modules = new dcModules(dcCore::app());
|
||||||
$modules->requireDefine($cache, $zip_root_dir);
|
$modules->requireDefine($cache, $zip_root_dir);
|
||||||
if ($modules->moduleExists($zip_root_dir)) {
|
if ($modules->moduleExists($zip_root_dir)) {
|
||||||
$res[$i] = $modules->getModules($zip_root_dir);
|
$res[$i] = $modules->getModules($zip_root_dir);
|
||||||
} else {
|
} else {
|
||||||
$themes = new dcThemes($core);
|
$themes = new dcThemes(dcCore::app());
|
||||||
$themes->requireDefine($cache, $zip_root_dir);
|
$themes->requireDefine($cache, $zip_root_dir);
|
||||||
$res[$i] = $themes->getModules($zip_root_dir);
|
$res[$i] = $themes->getModules($zip_root_dir);
|
||||||
}
|
}
|
||||||
|
@ -16,38 +16,38 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||||||
|
|
||||||
class libPackman
|
class libPackman
|
||||||
{
|
{
|
||||||
public static function is_configured(dcCore $core, string $repo, string $file_a, string $file_b): bool
|
public static function is_configured(string $repo, string $file_a, string $file_b): bool
|
||||||
{
|
{
|
||||||
if (!is_dir(DC_TPL_CACHE) || !is_writable(DC_TPL_CACHE)) {
|
if (!is_dir(DC_TPL_CACHE) || !is_writable(DC_TPL_CACHE)) {
|
||||||
$core->error->add(
|
dcCore::app()->error->add(
|
||||||
__('Cache directory is not writable.')
|
__('Cache directory is not writable.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!is_writable($repo)) {
|
if (!is_writable($repo)) {
|
||||||
$core->error->add(
|
dcCore::app()->error->add(
|
||||||
__('Path to repository is not writable.')
|
__('Path to repository is not writable.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($file_a)) {
|
if (empty($file_a)) {
|
||||||
$core->error->add(
|
dcCore::app()->error->add(
|
||||||
__('You must specify the name of package to export.')
|
__('You must specify the name of package to export.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_writable(dirname($repo . '/' . $file_a))) {
|
if (!is_writable(dirname($repo . '/' . $file_a))) {
|
||||||
$core->error->add(
|
dcCore::app()->error->add(
|
||||||
__('Path to first export package is not writable.')
|
__('Path to first export package is not writable.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($file_b) && !is_writable(dirname($repo . '/' . $file_b))) {
|
if (!empty($file_b) && !is_writable(dirname($repo . '/' . $file_b))) {
|
||||||
$core->error->add(
|
dcCore::app()->error->add(
|
||||||
__('Path to second export package is not writable.')
|
__('Path to second export package is not writable.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !$core->error->flag();
|
return !dcCore::app()->error->flag();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function is_writable(string $path, string $file): bool
|
public static function is_writable(string $path, string $file): bool
|
||||||
@ -55,7 +55,7 @@ class libPackman
|
|||||||
return !(empty($path) || empty($file) || !is_writable(dirname($path . '/' . $file)));
|
return !(empty($path) || empty($file) || !is_writable(dirname($path . '/' . $file)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function modules(dcCore $core, array $modules, string $type, string $title): ?bool
|
public static function modules(array $modules, string $type, string $title): ?bool
|
||||||
{
|
{
|
||||||
if (empty($modules) || !is_array($modules)) {
|
if (empty($modules) || !is_array($modules)) {
|
||||||
return null;
|
return null;
|
||||||
@ -110,7 +110,7 @@ class libPackman
|
|||||||
form::hidden(['action'], 'packup') .
|
form::hidden(['action'], 'packup') .
|
||||||
'<input type="submit" name="packup" value="' .
|
'<input type="submit" name="packup" value="' .
|
||||||
__('Pack up selected modules') . '" />' .
|
__('Pack up selected modules') . '" />' .
|
||||||
$core->formNonce() . '</p>' .
|
dcCore::app()->formNonce() . '</p>' .
|
||||||
'</form>' .
|
'</form>' .
|
||||||
|
|
||||||
'</div>';
|
'</div>';
|
||||||
@ -118,7 +118,7 @@ class libPackman
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function repository(dcCore $core, array $modules, string $type, string $title): ?bool
|
public static function repository(array $modules, string $type, string $title): ?bool
|
||||||
{
|
{
|
||||||
if (empty($modules) || !is_array($modules)) {
|
if (empty($modules) || !is_array($modules)) {
|
||||||
return null;
|
return null;
|
||||||
@ -198,7 +198,7 @@ class libPackman
|
|||||||
form::hidden(['p'], 'pacKman') .
|
form::hidden(['p'], 'pacKman') .
|
||||||
form::hidden(['tab'], 'repository') .
|
form::hidden(['tab'], 'repository') .
|
||||||
form::hidden(['type'], $type) .
|
form::hidden(['type'], $type) .
|
||||||
$core->formNonce() .
|
dcCore::app()->formNonce() .
|
||||||
'</p>' .
|
'</p>' .
|
||||||
'</div>' .
|
'</div>' .
|
||||||
'</form>' .
|
'</form>' .
|
||||||
|
80
index.php
80
index.php
@ -21,22 +21,22 @@ $action = $_POST['action'] ?? '';
|
|||||||
$type = isset($_POST['type']) && in_array($_POST['type'], ['plugins', 'themes', 'repository']) ? $_POST['type'] : '';
|
$type = isset($_POST['type']) && in_array($_POST['type'], ['plugins', 'themes', 'repository']) ? $_POST['type'] : '';
|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
$core->blog->settings->addNamespace('pacKman');
|
dcCore::app()->blog->settings->addNamespace('pacKman');
|
||||||
$s = $core->blog->settings->pacKman;
|
$s = dcCore::app()->blog->settings->pacKman;
|
||||||
|
|
||||||
# Modules
|
# Modules
|
||||||
if (!isset($core->themes)) {
|
if (!isset(dcCore::app()->themes)) {
|
||||||
$core->themes = new dcThemes($core);
|
dcCore::app()->themes = new dcThemes(dcCore::app());
|
||||||
$core->themes->loadModules($core->blog->themes_path, null);
|
dcCore::app()->themes->loadModules(dcCore::app()->blog->themes_path, null);
|
||||||
}
|
}
|
||||||
$themes = $core->themes;
|
$themes = dcCore::app()->themes;
|
||||||
$plugins = $core->plugins;
|
$plugins = dcCore::app()->plugins;
|
||||||
|
|
||||||
# Paths
|
# Paths
|
||||||
$ppexp = explode(PATH_SEPARATOR, DC_PLUGINS_ROOT);
|
$ppexp = explode(PATH_SEPARATOR, DC_PLUGINS_ROOT);
|
||||||
$pppop = array_pop($ppexp);
|
$pppop = array_pop($ppexp);
|
||||||
$plugins_path = (string) path::real($pppop);
|
$plugins_path = (string) path::real($pppop);
|
||||||
$themes_path = $core->blog->themes_path;
|
$themes_path = dcCore::app()->blog->themes_path;
|
||||||
$repo_path = $s->packman_pack_repository;
|
$repo_path = $s->packman_pack_repository;
|
||||||
|
|
||||||
# Rights
|
# Rights
|
||||||
@ -49,7 +49,6 @@ $is_editable = !empty($type)
|
|||||||
&& is_array($_POST['modules']);
|
&& is_array($_POST['modules']);
|
||||||
|
|
||||||
$is_configured = libPackman::is_configured(
|
$is_configured = libPackman::is_configured(
|
||||||
$core,
|
|
||||||
$s->packman_pack_repository,
|
$s->packman_pack_repository,
|
||||||
$s->packman_pack_filename,
|
$s->packman_pack_filename,
|
||||||
$s->packman_secondpack_filename
|
$s->packman_secondpack_filename
|
||||||
@ -61,13 +60,13 @@ try {
|
|||||||
if (isset($_REQUEST['package']) && empty($type)) {
|
if (isset($_REQUEST['package']) && empty($type)) {
|
||||||
$modules = [];
|
$modules = [];
|
||||||
if ($type == 'plugins') {
|
if ($type == 'plugins') {
|
||||||
$modules = dcPackman::getPackages($core, $plugins_path);
|
$modules = dcPackman::getPackages($plugins_path);
|
||||||
} elseif ($type == 'themes') {
|
} elseif ($type == 'themes') {
|
||||||
$modules = dcPackman::getPackages($core, $themes_path);
|
$modules = dcPackman::getPackages($themes_path);
|
||||||
} else {
|
} else {
|
||||||
$modules = array_merge(
|
$modules = array_merge(
|
||||||
dcPackman::getPackages($core, dirname($repo_path . '/' . $s->packman_pack_filename)),
|
dcPackman::getPackages(dirname($repo_path . '/' . $s->packman_pack_filename)),
|
||||||
dcPackman::getPackages($core, dirname($repo_path . '/' . $s->packman_secondpack_filename))
|
dcPackman::getPackages(dirname($repo_path . '/' . $s->packman_secondpack_filename))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +76,7 @@ try {
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanBeforeDownloadPackage
|
# --BEHAVIOR-- packmanBeforeDownloadPackage
|
||||||
$core->callBehavior('packmanBeforeDownloadPackage', $f, $type);
|
dcCore::app()->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']));
|
||||||
@ -85,7 +84,7 @@ try {
|
|||||||
readfile($f['root']);
|
readfile($f['root']);
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanAfterDownloadPackage
|
# --BEHAVIOR-- packmanAfterDownloadPackage
|
||||||
$core->callBehavior('packmanAfterDownloadPackage', $f, $type);
|
dcCore::app()->callBehavior('packmanAfterDownloadPackage', $f, $type);
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -120,12 +119,12 @@ try {
|
|||||||
$exclude = explode(',', $s->packman_pack_excludefiles);
|
$exclude = explode(',', $s->packman_pack_excludefiles);
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanBeforeCreatePackage
|
# --BEHAVIOR-- packmanBeforeCreatePackage
|
||||||
$core->callBehavior('packmanBeforeCreatePackage', $core, $module);
|
dcCore::app()->callBehavior('packmanBeforeCreatePackage', dcCore::app(), $module);
|
||||||
|
|
||||||
dcPackman::pack($module, $root, $files, $overwrite, $exclude, $nocomment, $fixnewline);
|
dcPackman::pack($module, $root, $files, $overwrite, $exclude, $nocomment, $fixnewline);
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanAfterCreatePackage
|
# --BEHAVIOR-- packmanAfterCreatePackage
|
||||||
$core->callBehavior('packmanAfterCreatePackage', $core, $module);
|
dcCore::app()->callBehavior('packmanAfterCreatePackage', dcCore::app(), $module);
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcPage::addSuccessNotice(
|
||||||
@ -135,7 +134,7 @@ try {
|
|||||||
if (!empty($_POST['redir'])) {
|
if (!empty($_POST['redir'])) {
|
||||||
http::redirect($_POST['redir']);
|
http::redirect($_POST['redir']);
|
||||||
} else {
|
} else {
|
||||||
$core->adminurl->redirect('admin.plugin.pacKman', [], '#packman-' . $type);
|
dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-' . $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Delete
|
# Delete
|
||||||
@ -155,7 +154,7 @@ try {
|
|||||||
if (!empty($_POST['redir'])) {
|
if (!empty($_POST['redir'])) {
|
||||||
http::redirect($_POST['redir']);
|
http::redirect($_POST['redir']);
|
||||||
} else {
|
} else {
|
||||||
$core->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
|
dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
@ -163,7 +162,7 @@ try {
|
|||||||
foreach ($_POST['modules'] as $root => $id) {
|
foreach ($_POST['modules'] as $root => $id) {
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanBeforeInstallPackage
|
# --BEHAVIOR-- packmanBeforeInstallPackage
|
||||||
$core->callBehavior('packmanBeforeInstallPackage', $type, $id, $root);
|
dcCore::app()->callBehavior('packmanBeforeInstallPackage', $type, $id, $root);
|
||||||
|
|
||||||
if ($type == 'plugins') {
|
if ($type == 'plugins') {
|
||||||
$plugins->installPackage($root, $plugins);
|
$plugins->installPackage($root, $plugins);
|
||||||
@ -173,7 +172,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanAfterInstallPackage
|
# --BEHAVIOR-- packmanAfterInstallPackage
|
||||||
$core->callBehavior('packmanAfterInstallPackage', $type, $id, $root);
|
dcCore::app()->callBehavior('packmanAfterInstallPackage', $type, $id, $root);
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcPage::addSuccessNotice(
|
||||||
@ -183,7 +182,7 @@ try {
|
|||||||
if (!empty($_POST['redir'])) {
|
if (!empty($_POST['redir'])) {
|
||||||
http::redirect($_POST['redir']);
|
http::redirect($_POST['redir']);
|
||||||
} else {
|
} else {
|
||||||
$core->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
|
dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Copy
|
# Copy
|
||||||
@ -209,7 +208,7 @@ try {
|
|||||||
if (!empty($_POST['redir'])) {
|
if (!empty($_POST['redir'])) {
|
||||||
http::redirect($_POST['redir']);
|
http::redirect($_POST['redir']);
|
||||||
} else {
|
} else {
|
||||||
$core->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
|
dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Move
|
# Move
|
||||||
@ -236,11 +235,11 @@ try {
|
|||||||
if (!empty($_POST['redir'])) {
|
if (!empty($_POST['redir'])) {
|
||||||
http::redirect($_POST['redir']);
|
http::redirect($_POST['redir']);
|
||||||
} else {
|
} else {
|
||||||
$core->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
|
dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
# Display
|
# Display
|
||||||
@ -250,7 +249,7 @@ dcPage::jsPageTabs() .
|
|||||||
dcPage::jsLoad(dcPage::getPF('pacKman/js/packman.js'));
|
dcPage::jsLoad(dcPage::getPF('pacKman/js/packman.js'));
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanAdminHeader
|
# --BEHAVIOR-- packmanAdminHeader
|
||||||
$core->callBehavior('packmanAdminHeader', $core);
|
dcCore::app()->callBehavior('packmanAdminHeader', dcCore::app());
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'</head><body>' .
|
'</head><body>' .
|
||||||
@ -261,7 +260,7 @@ dcPage::breadcrumb([
|
|||||||
]) .
|
]) .
|
||||||
dcPage::notices();
|
dcPage::notices();
|
||||||
|
|
||||||
if ($core->error->flag()) {
|
if (dcCore::app()->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&conf=1&redir=' .
|
'<a href="plugins.php?module=pacKman&conf=1&redir=' .
|
||||||
@ -269,54 +268,37 @@ if ($core->error->flag()) {
|
|||||||
'</p>';
|
'</p>';
|
||||||
} else {
|
} else {
|
||||||
$repo_path_modules = array_merge(
|
$repo_path_modules = array_merge(
|
||||||
dcPackman::getPackages(
|
dcPackman::getPackages(dirname($repo_path . '/' . $s->packman_pack_filename)),
|
||||||
$core,
|
dcPackman::getPackages(dirname($repo_path . '/' . $s->packman_secondpack_filename))
|
||||||
dirname($repo_path . '/' . $s->packman_pack_filename)
|
|
||||||
),
|
|
||||||
dcPackman::getPackages(
|
|
||||||
$core,
|
|
||||||
dirname($repo_path . '/' . $s->packman_secondpack_filename)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$plugins_path_modules = dcPackman::getPackages(
|
|
||||||
$core,
|
|
||||||
$plugins_path
|
|
||||||
);
|
|
||||||
$themes_path_modules = dcPackman::getPackages(
|
|
||||||
$core,
|
|
||||||
$themes_path
|
|
||||||
);
|
);
|
||||||
|
$plugins_path_modules = dcPackman::getPackages($plugins_path);
|
||||||
|
$themes_path_modules = dcPackman::getPackages($themes_path);
|
||||||
|
|
||||||
libPackman::modules(
|
libPackman::modules(
|
||||||
$core,
|
|
||||||
$plugins->getModules(),
|
$plugins->getModules(),
|
||||||
'plugins',
|
'plugins',
|
||||||
__('Installed plugins')
|
__('Installed plugins')
|
||||||
);
|
);
|
||||||
|
|
||||||
libPackman::modules(
|
libPackman::modules(
|
||||||
$core,
|
|
||||||
$themes->getModules(),
|
$themes->getModules(),
|
||||||
'themes',
|
'themes',
|
||||||
__('Installed themes')
|
__('Installed themes')
|
||||||
);
|
);
|
||||||
|
|
||||||
libPackman::repository(
|
libPackman::repository(
|
||||||
$core,
|
|
||||||
$plugins_path_modules,
|
$plugins_path_modules,
|
||||||
'plugins',
|
'plugins',
|
||||||
__('Plugins root')
|
__('Plugins root')
|
||||||
);
|
);
|
||||||
|
|
||||||
libPackman::repository(
|
libPackman::repository(
|
||||||
$core,
|
|
||||||
$themes_path_modules,
|
$themes_path_modules,
|
||||||
'themes',
|
'themes',
|
||||||
__('Themes root')
|
__('Themes root')
|
||||||
);
|
);
|
||||||
|
|
||||||
libPackman::repository(
|
libPackman::repository(
|
||||||
$core,
|
|
||||||
$repo_path_modules,
|
$repo_path_modules,
|
||||||
'repository',
|
'repository',
|
||||||
__('Packages repository')
|
__('Packages repository')
|
||||||
@ -324,7 +306,7 @@ if ($core->error->flag()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanAdminTabs
|
# --BEHAVIOR-- packmanAdminTabs
|
||||||
$core->callBehavior('packmanAdminTabs', $core);
|
dcCore::app()->callBehavior('packmanAdminTabs');
|
||||||
|
|
||||||
dcPage::helpBlock('pacKman');
|
dcPage::helpBlock('pacKman');
|
||||||
|
|
||||||
|
@ -14,6 +14,6 @@ if (!defined('DC_RC_PATH')) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($__resources['help']['pacKman'])) {
|
if (!isset(dcCore::app()->resources['help']['pacKman'])) {
|
||||||
$__resources['help']['pacKman'] = dirname(__FILE__) . '/help/help.html';
|
dcCore::app()->resources['help']['pacKman'] = __DIR__ . '/help/help.html';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user