Skip to content

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Sep 16, 2015
2 parents b559d26 + ed1d4a7 commit d59d5d9
Show file tree
Hide file tree
Showing 15 changed files with 631 additions and 76 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# v0.6.0
## 09/16/2015

1. [](#new)
* Support for custom markdown editor buttons!
* Added Russian translations
* Added Japanese translations
* Ajax session keep-alive when editing forms
1. [](#improved)
* Added missing Italian translations
* Added additional options field into the pages form field
1. [](#bugfix)
* Fix GPM errors in offline mode
* Fix for duplicate status messages

# v0.5.0
## 09/11/2015

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Admin Panel
version: 0.5.0
version: 0.6.0
description: Adds an advanced administration panel to manage your site
icon: empire
author:
Expand Down
26 changes: 19 additions & 7 deletions classes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ public function plugins($local = true)
{
$gpm = $this->gpm();

if (!$gpm) {
return;
}

return $local ? $gpm->getInstalledPlugins() : $gpm->getRepositoryPlugins()->filter(function (
$package,
$slug
Expand All @@ -431,6 +435,10 @@ public function themes($local = true)
{
$gpm = $this->gpm();

if (!$gpm) {
return;
}

return $local ? $gpm->getInstalledThemes() : $gpm->getRepositoryThemes()->filter(function ($package, $slug) use
(
$gpm
Expand Down Expand Up @@ -489,7 +497,6 @@ public function latestPages($count = 10)
});

// build new array with just pages in it
// TODO: Optimized this
$list = array();
foreach ($latest as $item) {
$list[] = $item['page'];
Expand Down Expand Up @@ -699,13 +706,18 @@ public function isTeamGrav($info)
* @return string The phpinfo() output
*/
function phpinfo() {
ob_start();
phpinfo();
$pinfo = ob_get_contents();
ob_end_clean();

$pinfo = preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1',$pinfo);
return $pinfo;
if (function_exists('phpinfo')) {
ob_start();
phpinfo();
$pinfo = ob_get_contents();
ob_end_clean();

$pinfo = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $pinfo);
return $pinfo;
} else {
return 'phpinfo() method is not available on this server.';
}
}

/**
Expand Down
30 changes: 22 additions & 8 deletions classes/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ protected function taskLogout()
return true;
}

/**
* Handle logout.
*
* @return bool True if the action was performed.
*/
protected function taskKeepAlive()
{
exit();
}

/**
* Handle the email password recovery procedure.
*
Expand Down Expand Up @@ -746,7 +756,6 @@ public function taskActivate()
$config = $this->grav['config'];
$config->reload()->save();

// TODO: find out why reload and save doesn't always update the object itself (and remove this workaround).
$config->set('system.pages.theme', $name);

$this->admin->setMessage($this->admin->translate('PLUGIN_ADMIN.SUCCESSFULLY_CHANGED_THEME'), 'info');
Expand All @@ -770,7 +779,7 @@ public function taskInstall()

$package = $this->route;

$result = \Grav\Plugin\Admin\Gpm::install($package, []);
$result = \Grav\Plugin\Admin\Gpm::install($package, ['theme' => ($type == 'themes')]);

if ($result) {
$this->admin->setMessage($this->admin->translate('PLUGIN_ADMIN.INSTALLATION_SUCCESSFUL'), 'info');
Expand Down Expand Up @@ -819,6 +828,8 @@ public function taskUpdate()
$package = $this->route;
$permissions = [];

$type = $this->view === 'plugins' ? 'plugins' : 'themes';

// Update multi mode
if (!$package) {
$package = [];
Expand All @@ -840,7 +851,7 @@ public function taskUpdate()
}
}

$result = \Grav\Plugin\Admin\Gpm::update($package, []);
$result = \Grav\Plugin\Admin\Gpm::update($package, ['theme' => ($type == 'themes')]);

if ($this->view === 'update') {

Expand Down Expand Up @@ -1295,20 +1306,23 @@ protected function dataPermissions()
switch ($type) {
case 'configuration':
case 'system':
$permissions[] = ['admin.configuration'];
$permissions[] = 'admin.configuration';
break;
case 'settings':
case 'site':
$permissions[] = ['admin.settings'];
$permissions[] = 'admin.settings';
break;
case 'plugins':
$permissions[] = ['admin.plugins'];
$permissions[] = 'admin.plugins';
break;
case 'themes':
$permissions[] = ['admin.themes'];
$permissions[] = 'admin.themes';
break;
case 'users':
$permissions[] = ['admin.users'];
$permissions[] = 'admin.users';
break;
case 'pages':
$permissions[] = 'admin.pages';
break;
}

Expand Down
5 changes: 3 additions & 2 deletions classes/gpm.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public static function GPM()
'overwrite' => true,
'ignore_symlinks' => true,
'skip_invalid' => true,
'install_deps' => true
'install_deps' => true,
'theme' => false
];

public static function install($packages, $options)
Expand Down Expand Up @@ -79,7 +80,7 @@ public static function install($packages, $options)

$local = static::download($package);

Installer::install($local, $options['destination'], ['install_path' => $package->install_path]);
Installer::install($local, $options['destination'], ['install_path' => $package->install_path, 'theme' => $options['theme']]);
Folder::delete(dirname($local));

$errorCode = Installer::lastErrorCode();
Expand Down
Loading

0 comments on commit d59d5d9

Please sign in to comment.