fix PSR coding style
This commit is contained in:
parent
e2d8a94e28
commit
af474f0189
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_MODULE')) {
|
if (!defined('DC_CONTEXT_MODULE')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -78,7 +77,9 @@ echo '
|
|||||||
<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>
|
||||||
@ -96,7 +97,7 @@ form::field('packman_secondpack_filename', 65, 255, $packman_secondpack_filename
|
|||||||
'</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 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>
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
20
_install.php
20
_install.php
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -72,7 +71,8 @@ try {
|
|||||||
if (version_compare(
|
if (version_compare(
|
||||||
$core->getVersion($mod_id),
|
$core->getVersion($mod_id),
|
||||||
$core->plugins->moduleInfo($mod_id, 'version'),
|
$core->plugins->moduleInfo($mod_id, 'version'),
|
||||||
'>=')) {
|
'>='
|
||||||
|
)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,15 +80,22 @@ try {
|
|||||||
if (!method_exists('dcUtils', 'versionsCompare')
|
if (!method_exists('dcUtils', 'versionsCompare')
|
||||||
|| dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)) {
|
|| dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)) {
|
||||||
throw new Exception(sprintf(
|
throw new Exception(sprintf(
|
||||||
'%s requires Dotclear %s', $mod_id, $dc_min
|
'%s requires Dotclear %s',
|
||||||
|
$mod_id,
|
||||||
|
$dc_min
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set module settings
|
# Set module settings
|
||||||
$core->blog->settings->addNamespace($mod_id);
|
$core->blog->settings->addNamespace($mod_id);
|
||||||
foreach($mod_conf as $v) {
|
foreach ($mod_conf as $v) {
|
||||||
$core->blog->settings->{$mod_id}->put(
|
$core->blog->settings->{$mod_id}->put(
|
||||||
$v[0], $v[2], $v[3], $v[1], false, true
|
$v[0],
|
||||||
|
$v[2],
|
||||||
|
$v[3],
|
||||||
|
$v[1],
|
||||||
|
false,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,8 +106,7 @@ try {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e) {
|
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -18,43 +17,67 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||||||
$mod_id = 'pacKman';
|
$mod_id = 'pacKman';
|
||||||
|
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'settings',
|
/* type */
|
||||||
/* action */ 'delete_all',
|
'settings',
|
||||||
/* ns */ $mod_id,
|
/* action */
|
||||||
/* desc */ __('delete all settings')
|
'delete_all',
|
||||||
|
/* ns */
|
||||||
|
$mod_id,
|
||||||
|
/* desc */
|
||||||
|
__('delete all settings')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'plugins',
|
/* type */
|
||||||
/* action */ 'delete',
|
'plugins',
|
||||||
/* ns */ $mod_id,
|
/* action */
|
||||||
/* desc */ __('delete plugin files')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
$mod_id,
|
||||||
|
/* desc */
|
||||||
|
__('delete plugin files')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'versions',
|
/* type */
|
||||||
/* action */ 'delete',
|
'versions',
|
||||||
/* ns */ $mod_id,
|
/* action */
|
||||||
/* desc */ __('delete the version number')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
$mod_id,
|
||||||
|
/* desc */
|
||||||
|
__('delete the version number')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'settings',
|
/* type */
|
||||||
/* action */ 'delete_all',
|
'settings',
|
||||||
/* ns */ $mod_id,
|
/* action */
|
||||||
/* desc */ sprintf(__('delete all %s settings'), $mod_id)
|
'delete_all',
|
||||||
|
/* ns */
|
||||||
|
$mod_id,
|
||||||
|
/* desc */
|
||||||
|
sprintf(__('delete all %s settings'), $mod_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'plugins',
|
/* type */
|
||||||
/* action */ 'delete',
|
'plugins',
|
||||||
/* ns */ $mod_id,
|
/* action */
|
||||||
/* desc */ sprintf(__('delete %s plugin files'), $mod_id)
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
$mod_id,
|
||||||
|
/* desc */
|
||||||
|
sprintf(__('delete %s plugin files'), $mod_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'versions',
|
/* type */
|
||||||
/* action */ 'delete',
|
'versions',
|
||||||
/* ns */ $mod_id,
|
/* action */
|
||||||
/* desc */ sprintf(__('delete %s version number'), $mod_id)
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
$mod_id,
|
||||||
|
/* desc */
|
||||||
|
sprintf(__('delete %s version number'), $mod_id)
|
||||||
);
|
);
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -31,7 +30,7 @@ class dcPackman
|
|||||||
|
|
||||||
public static function quote_exclude($exclude)
|
public static function quote_exclude($exclude)
|
||||||
{
|
{
|
||||||
foreach($exclude AS $k => $v) {
|
foreach ($exclude as $k => $v) {
|
||||||
$exclude[$k] = '#(^|/)(' . str_replace(
|
$exclude[$k] = '#(^|/)(' . str_replace(
|
||||||
['.', '*'],
|
['.', '*'],
|
||||||
['\.', '.*?'],
|
['\.', '.*?'],
|
||||||
@ -53,7 +52,7 @@ class dcPackman
|
|||||||
|
|
||||||
$files = files::scanDir($root);
|
$files = files::scanDir($root);
|
||||||
$zip_files = [];
|
$zip_files = [];
|
||||||
foreach($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (!preg_match('#(^|/)(.*?)\.zip(/|$)#', $file)) {
|
if (!preg_match('#(^|/)(.*?)\.zip(/|$)#', $file)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -65,7 +64,7 @@ class dcPackman
|
|||||||
}
|
}
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach($zip_files as $zip_file) {
|
foreach ($zip_files as $zip_file) {
|
||||||
$zip = new fileUnzip($root . '/' . $zip_file);
|
$zip = new fileUnzip($root . '/' . $zip_file);
|
||||||
|
|
||||||
$zip_root_dir = $zip->getRootDir();
|
$zip_root_dir = $zip->getRootDir();
|
||||||
@ -113,7 +112,7 @@ class dcPackman
|
|||||||
|
|
||||||
$exclude = self::getExclude($exclude);
|
$exclude = self::getExclude($exclude);
|
||||||
|
|
||||||
foreach($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (!($file = self::getFile($file, $info))
|
if (!($file = self::getFile($file, $info))
|
||||||
|| !($dest = self::getOverwrite($overwrite, $root, $file))
|
|| !($dest = self::getOverwrite($overwrite, $root, $file))
|
||||||
) {
|
) {
|
||||||
@ -131,7 +130,7 @@ class dcPackman
|
|||||||
}
|
}
|
||||||
$zip = new packmanFileZip($fp);
|
$zip = new packmanFileZip($fp);
|
||||||
|
|
||||||
foreach($exclude AS $e) {
|
foreach ($exclude as $e) {
|
||||||
$zip->addExclusion($e);
|
$zip->addExclusion($e);
|
||||||
}
|
}
|
||||||
$zip->addDirectory(
|
$zip->addDirectory(
|
||||||
@ -201,9 +200,10 @@ class dcPackman
|
|||||||
$file
|
$file
|
||||||
);
|
);
|
||||||
$parts = explode('/', $file);
|
$parts = explode('/', $file);
|
||||||
foreach($parts as $i => $part) {
|
foreach ($parts as $i => $part) {
|
||||||
$parts[$i] = files::tidyFileName($part);
|
$parts[$i] = files::tidyFileName($part);
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode('/', $parts) . '.zip';
|
return implode('/', $parts) . '.zip';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class packmanFileZip extends fileZip
|
class packmanFileZip extends fileZip
|
||||||
{
|
{
|
||||||
public static $remove_comment = false;
|
public static $remove_comment = false;
|
||||||
@ -29,10 +28,10 @@ class packmanFileZip extends fileZip
|
|||||||
|
|
||||||
//cleanup file contents
|
//cleanup file contents
|
||||||
// at this time only php files
|
// at this time only php files
|
||||||
if (self::$remove_comment && substr($file,-4) == '.php') {
|
if (self::$remove_comment && substr($file, -4) == '.php') {
|
||||||
$content = self::removePHPComment($content);
|
$content = self::removePHPComment($content);
|
||||||
}
|
}
|
||||||
if (self::$fix_newline && substr($file,-4) == '.php') {
|
if (self::$fix_newline && substr($file, -4) == '.php') {
|
||||||
$content = self::fixNewline($content);
|
$content = self::fixNewline($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,8 +46,7 @@ class packmanFileZip extends fileZip
|
|||||||
$mtime = $this->makeTime($mtime);
|
$mtime = $this->makeTime($mtime);
|
||||||
|
|
||||||
# Data descriptor
|
# Data descriptor
|
||||||
$data_desc =
|
$data_desc = "\x50\x4b\x03\x04" .
|
||||||
"\x50\x4b\x03\x04" .
|
|
||||||
"\x14\x00" . # ver needed to extract
|
"\x14\x00" . # ver needed to extract
|
||||||
"\x00\x00" . # gen purpose bit flag
|
"\x00\x00" . # gen purpose bit flag
|
||||||
"\x08\x00" . # compression method
|
"\x08\x00" . # compression method
|
||||||
@ -58,7 +56,7 @@ class packmanFileZip extends fileZip
|
|||||||
pack('V', $c_len) . # compressed filesize
|
pack('V', $c_len) . # compressed filesize
|
||||||
pack('V', $unc_len) . # uncompressed filesize
|
pack('V', $unc_len) . # uncompressed filesize
|
||||||
pack('v', strlen($name)) . # length of filename
|
pack('v', strlen($name)) . # length of filename
|
||||||
pack('v' ,0) . # extra field length
|
pack('v', 0) . # extra field length
|
||||||
$name . # end of "local file header" segment
|
$name . # end of "local file header" segment
|
||||||
$zdata . # "file data" segment
|
$zdata . # "file data" segment
|
||||||
pack('V', $crc) . # crc32
|
pack('V', $crc) . # crc32
|
||||||
@ -71,8 +69,7 @@ class packmanFileZip extends fileZip
|
|||||||
$new_offset = $this->old_offset + strlen($data_desc);
|
$new_offset = $this->old_offset + strlen($data_desc);
|
||||||
|
|
||||||
# Add to central directory record
|
# Add to central directory record
|
||||||
$cdrec =
|
$cdrec = "\x50\x4b\x01\x02" .
|
||||||
"\x50\x4b\x01\x02" .
|
|
||||||
"\x00\x00" . # version made by
|
"\x00\x00" . # version made by
|
||||||
"\x14\x00" . # version needed to extract
|
"\x14\x00" . # version needed to extract
|
||||||
"\x00\x00" . # gen purpose bit flag
|
"\x00\x00" . # gen purpose bit flag
|
||||||
@ -88,7 +85,7 @@ class packmanFileZip extends fileZip
|
|||||||
pack('v', 0) . # disk number start
|
pack('v', 0) . # disk number start
|
||||||
pack('v', 0) . # internal file attributes
|
pack('v', 0) . # internal file attributes
|
||||||
pack('V', 32) . # external file attributes - 'archive' bit set
|
pack('V', 32) . # external file attributes - 'archive' bit set
|
||||||
pack('V', $this->old_offset). # relative offset of local header
|
pack('V', $this->old_offset) . # relative offset of local header
|
||||||
$name;
|
$name;
|
||||||
|
|
||||||
$this->old_offset = $new_offset;
|
$this->old_offset = $new_offset;
|
||||||
@ -119,6 +116,7 @@ class packmanFileZip extends fileZip
|
|||||||
$newStr .= $token;
|
$newStr .= $token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $newStr;
|
return $newStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -99,7 +98,8 @@ class libPackman
|
|||||||
'</table>' .
|
'</table>' .
|
||||||
'<p class="checkboxes-helpers"></p>' .
|
'<p class="checkboxes-helpers"></p>' .
|
||||||
'<p>' .
|
'<p>' .
|
||||||
(!empty($_REQUEST['redir']) ?
|
(
|
||||||
|
!empty($_REQUEST['redir']) ?
|
||||||
form::hidden(
|
form::hidden(
|
||||||
['redir'],
|
['redir'],
|
||||||
html::escapeHTML($_REQUEST['redir'])
|
html::escapeHTML($_REQUEST['redir'])
|
||||||
@ -109,7 +109,7 @@ class libPackman
|
|||||||
form::hidden(['type'], $type) .
|
form::hidden(['type'], $type) .
|
||||||
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>' .
|
$core->formNonce() . '</p>' .
|
||||||
'</form>' .
|
'</form>' .
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ class libPackman
|
|||||||
'</tr>';
|
'</tr>';
|
||||||
|
|
||||||
$dup = [];
|
$dup = [];
|
||||||
foreach(self::sort($modules) AS $module) {
|
foreach (self::sort($modules) as $module) {
|
||||||
if (isset($dup[$module['root']])) {
|
if (isset($dup[$module['root']])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ class libPackman
|
|||||||
'</td>' .
|
'</td>' .
|
||||||
'<td class="nowrap">' .
|
'<td class="nowrap">' .
|
||||||
'<a class="packman-download" href="plugin.php?p=pacKman&package=' .
|
'<a class="packman-download" href="plugin.php?p=pacKman&package=' .
|
||||||
basename($module['root']) . '&repo=' . $type . '" title="'. __('Download') . '">' .
|
basename($module['root']) . '&repo=' . $type . '" title="' . __('Download') . '">' .
|
||||||
html::escapeHTML(basename($module['root'])) . '</a>' .
|
html::escapeHTML(basename($module['root'])) . '</a>' .
|
||||||
'</td>' .
|
'</td>' .
|
||||||
'</tr>';
|
'</tr>';
|
||||||
@ -206,7 +206,7 @@ class libPackman
|
|||||||
protected static function sort($modules)
|
protected static function sort($modules)
|
||||||
{
|
{
|
||||||
$key = $ver = [];
|
$key = $ver = [];
|
||||||
foreach($modules as $i => $module) {
|
foreach ($modules as $i => $module) {
|
||||||
$key[$i] = $module['id'] ?? $i;
|
$key[$i] = $module['id'] ?? $i;
|
||||||
$ver[$i] = $module['version'];
|
$ver[$i] = $module['version'];
|
||||||
}
|
}
|
||||||
|
16
index.php
16
index.php
@ -10,7 +10,6 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -18,7 +17,7 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||||||
dcPage::checkSuper();
|
dcPage::checkSuper();
|
||||||
|
|
||||||
# Queries
|
# Queries
|
||||||
$action = isset($_POST['action']) ? $_POST['action'] : '';
|
$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
|
||||||
@ -45,8 +44,7 @@ $is_writable = libPackman::is_writable(
|
|||||||
$s->packman_pack_repository,
|
$s->packman_pack_repository,
|
||||||
$s->packman_pack_filename
|
$s->packman_pack_filename
|
||||||
);
|
);
|
||||||
$is_editable =
|
$is_editable = !empty($type)
|
||||||
!empty($type)
|
|
||||||
&& !empty($_POST['modules'])
|
&& !empty($_POST['modules'])
|
||||||
&& is_array($_POST['modules']);
|
&& is_array($_POST['modules']);
|
||||||
|
|
||||||
@ -73,7 +71,7 @@ try {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
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'])
|
||||||
) {
|
) {
|
||||||
@ -97,7 +95,6 @@ try {
|
|||||||
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) {
|
||||||
throw new Exception('No selected modules');
|
throw new Exception('No selected modules');
|
||||||
|
|
||||||
@ -129,7 +126,6 @@ try {
|
|||||||
|
|
||||||
# --BEHAVIOR-- packmanAfterCreatePackage
|
# --BEHAVIOR-- packmanAfterCreatePackage
|
||||||
$core->callBehavior('packmanAfterCreatePackage', $core, $module);
|
$core->callBehavior('packmanAfterCreatePackage', $core, $module);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcPage::addSuccessNotice(
|
||||||
@ -178,7 +174,6 @@ try {
|
|||||||
|
|
||||||
# --BEHAVIOR-- packmanAfterInstallPackage
|
# --BEHAVIOR-- packmanAfterInstallPackage
|
||||||
$core->callBehavior('packmanAfterInstallPackage', $type, $id, $root);
|
$core->callBehavior('packmanAfterInstallPackage', $type, $id, $root);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcPage::addSuccessNotice(
|
||||||
@ -246,7 +241,7 @@ try {
|
|||||||
$core->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
|
$core->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +260,7 @@ echo
|
|||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
__('pacKman') => ''
|
__('pacKman') => ''
|
||||||
]).
|
]) .
|
||||||
dcPage::notices();
|
dcPage::notices();
|
||||||
|
|
||||||
if ($core->error->flag()) {
|
if ($core->error->flag()) {
|
||||||
@ -274,7 +269,6 @@ if ($core->error->flag()) {
|
|||||||
'<a href="plugins.php?module=pacKman&conf=1&redir=' .
|
'<a href="plugins.php?module=pacKman&conf=1&redir=' .
|
||||||
urlencode('plugin.php?p=pacKman') . '">' . __('Configuration') . '</a>' .
|
urlencode('plugin.php?p=pacKman') . '">' . __('Configuration') . '</a>' .
|
||||||
'</p>';
|
'</p>';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$repo_path_modules = array_merge(
|
$repo_path_modules = array_merge(
|
||||||
dcPackman::getPackages(
|
dcPackman::getPackages(
|
||||||
|
Loading…
Reference in New Issue
Block a user