From 3cf5c6e4abd05e17037e5242034f13fb48ac9f8b Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 11 Aug 2015 15:46:48 -0600 Subject: [PATCH 1/7] Use GRAV_ROOT for session identifier #53 --- system/src/Grav/Common/Session.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/src/Grav/Common/Session.php b/system/src/Grav/Common/Session.php index cb63df20b..2b3469178 100644 --- a/system/src/Grav/Common/Session.php +++ b/system/src/Grav/Common/Session.php @@ -44,8 +44,8 @@ class Session extends \RocketTheme\Toolbox\Session\Session $session_path ); - $site_identifier = $config->get('site.title', 'unknown'); - $this->setName($config->get('system.session.name', 'grav_site') . '_' . substr(md5($site_identifier), 0, 7) . ($is_admin ? '_admin' : '')); + $unique_identifier = GRAV_ROOT; + $this->setName($config->get('system.session.name', 'grav_site') . '_' . substr(md5($unique_identifier), 0, 7) . ($is_admin ? '_admin' : '')); $this->start(); setcookie(session_name(), session_id(), time() + $session_timeout, $session_path); } From 5a7ad45a7e68faf2ea13a1aa533f8271aebb04d5 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 11 Aug 2015 19:38:07 -0600 Subject: [PATCH 2/7] version update --- CHANGELOG.md | 12 +++++++++++- system/defines.php | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e160286d..bd3a997a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,18 @@ # v0.9.36 -## XX/XX/2015 +## 08/11/2015 +1. [](#new) + * Added a new `newuser` CLI command to create user accounts + * Added `default` blueprint for all templates + * Support `user` and `system` language translation merging 1. [](#improved) * Added isSymlink method in GPM to determine if Grav is symbolically linked or not + * Refactored page recursing + * Updated blueprints to use new toggles + * Updated blueprints to use current date for date format fields + * Updated composer.phar + * Use sessions for admin even when disabled for site + * Use `GRAV_ROOT` in session identifier # v0.9.35 ## 08/06/2015 diff --git a/system/defines.php b/system/defines.php index 6828ce4fe..84c41d5f6 100644 --- a/system/defines.php +++ b/system/defines.php @@ -2,7 +2,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '0.9.35'); +define('GRAV_VERSION', '0.9.36'); define('DS', '/'); // Directories and Paths From a975786b7b4669128ef7a35f05cf975bc0a83f0c Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 12 Aug 2015 05:57:14 -0600 Subject: [PATCH 3/7] fix for empty string header values throwing errors --- system/src/Grav/Common/Page/Page.php | 46 ++++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 4263a5731..712faa541 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -213,74 +213,74 @@ class Page } if ($var) { - if (isset($this->header->slug)) { + if (!empty($this->header->slug)) { $this->slug = trim($this->header->slug); } - if (isset($this->header->routes)) { + if (!empty($this->header->routes)) { $this->routes = (array)($this->header->routes); } - if (isset($this->header->title)) { + if (!empty($this->header->title)) { $this->title = trim($this->header->title); } - if (isset($this->header->language)) { + if (!empty($this->header->language)) { $this->language = trim($this->header->language); } - if (isset($this->header->template)) { + if (!empty($this->header->template)) { $this->template = trim($this->header->template); } - if (isset($this->header->menu)) { + if (!empty($this->header->menu)) { $this->menu = trim($this->header->menu); } - if (isset($this->header->routable)) { + if (!empty($this->header->routable)) { $this->routable = $this->header->routable; } - if (isset($this->header->visible)) { + if (!empty($this->header->visible)) { $this->visible = $this->header->visible; } - if (isset($this->header->order_dir)) { + if (!empty($this->header->order_dir)) { $this->order_dir = trim($this->header->order_dir); } - if (isset($this->header->order_by)) { + if (!empty($this->header->order_by)) { $this->order_by = trim($this->header->order_by); } - if (isset($this->header->order_manual)) { + if (!empty($this->header->order_manual)) { $this->order_manual = (array)$this->header->order_manual; } - if (isset($this->header->date)) { + if (!empty($this->header->date)) { $this->date = strtotime($this->header->date); } - if (isset($this->header->markdown_extra)) { + if (!empty($this->header->markdown_extra)) { $this->markdown_extra = (bool)$this->header->markdown_extra; } - if (isset($this->header->taxonomy)) { + if (!empty($this->header->taxonomy)) { foreach ($this->header->taxonomy as $taxonomy => $taxitems) { $this->taxonomy[$taxonomy] = (array)$taxitems; } } - if (isset($this->header->max_count)) { + if (!empty($this->header->max_count)) { $this->max_count = intval($this->header->max_count); } - if (isset($this->header->process)) { - foreach ($this->header->process as $process => $status) { + if (!empty($this->header->process)) { + foreach ((array) $this->header->process as $process => $status) { $this->process[$process] = $status; } } - if (isset($this->header->published)) { + if (!empty($this->header->published)) { $this->published = $this->header->published; } - if (isset($this->header->publish_date)) { + if (!empty($this->header->publish_date)) { $this->publish_date = strtotime($this->header->publish_date); } - if (isset($this->header->unpublish_date)) { + if (!empty($this->header->unpublish_date)) { $this->unpublish_date = strtotime($this->header->unpublish_date); } - if (isset($this->header->expires)) { + if (!empty($this->header->expires)) { $this->expires = intval($this->header->expires); } - if (isset($this->header->etag)) { + if (!empty($this->header->etag)) { $this->etag = (bool)$this->header->etag; } - if (isset($this->header->last_modified)) { + if (!empty($this->header->last_modified)) { $this->last_modified = (bool)$this->header->last_modified; } From e13c5c214acaf8f8d5ce831d6a88f6a307181369 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 12 Aug 2015 06:22:49 -0600 Subject: [PATCH 4/7] reverted !empty to isset and put in some casting logic to handle empty/invalid values --- CHANGELOG.md | 7 ++++ system/src/Grav/Common/Page/Page.php | 58 ++++++++++++++-------------- system/src/Grav/Common/Utils.php | 6 ++- 3 files changed, 41 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd3a997a1..0e3702027 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# v0.9.37 +## 08/12/2015 + +3. [](#bugfix) + * Fixed issue when saving `header.process` in page forms via the **admin plugin** + * Fixed error due to use of `set_time_limit` that might be disabled on some hosts + # v0.9.36 ## 08/11/2015 diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 712faa541..3c8a8dbb7 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -213,75 +213,75 @@ class Page } if ($var) { - if (!empty($this->header->slug)) { + if (isset($this->header->slug)) { $this->slug = trim($this->header->slug); } - if (!empty($this->header->routes)) { + if (isset($this->header->routes)) { $this->routes = (array)($this->header->routes); } - if (!empty($this->header->title)) { + if (isset($this->header->title)) { $this->title = trim($this->header->title); } - if (!empty($this->header->language)) { + if (isset($this->header->language)) { $this->language = trim($this->header->language); } - if (!empty($this->header->template)) { + if (isset($this->header->template)) { $this->template = trim($this->header->template); } - if (!empty($this->header->menu)) { + if (isset($this->header->menu)) { $this->menu = trim($this->header->menu); } - if (!empty($this->header->routable)) { - $this->routable = $this->header->routable; + if (isset($this->header->routable)) { + $this->routable = (bool) $this->header->routable; } - if (!empty($this->header->visible)) { - $this->visible = $this->header->visible; + if (isset($this->header->visible)) { + $this->visible = (bool) $this->header->visible; } - if (!empty($this->header->order_dir)) { + if (isset($this->header->order_dir)) { $this->order_dir = trim($this->header->order_dir); } - if (!empty($this->header->order_by)) { + if (isset($this->header->order_by)) { $this->order_by = trim($this->header->order_by); } - if (!empty($this->header->order_manual)) { + if (isset($this->header->order_manual)) { $this->order_manual = (array)$this->header->order_manual; } - if (!empty($this->header->date)) { + if (isset($this->header->date)) { $this->date = strtotime($this->header->date); } - if (!empty($this->header->markdown_extra)) { + if (isset($this->header->markdown_extra)) { $this->markdown_extra = (bool)$this->header->markdown_extra; } - if (!empty($this->header->taxonomy)) { - foreach ($this->header->taxonomy as $taxonomy => $taxitems) { + if (isset($this->header->taxonomy)) { + foreach ((array) $this->header->taxonomy as $taxonomy => $taxitems) { $this->taxonomy[$taxonomy] = (array)$taxitems; } } - if (!empty($this->header->max_count)) { + if (isset($this->header->max_count)) { $this->max_count = intval($this->header->max_count); } - if (!empty($this->header->process)) { + if (isset($this->header->process)) { foreach ((array) $this->header->process as $process => $status) { - $this->process[$process] = $status; + $this->process[$process] = (bool) $status; } } - if (!empty($this->header->published)) { - $this->published = $this->header->published; + if (isset($this->header->published)) { + $this->published = (bool) $this->header->published; } - if (!empty($this->header->publish_date)) { + if (isset($this->header->publish_date)) { $this->publish_date = strtotime($this->header->publish_date); } - if (!empty($this->header->unpublish_date)) { + if (isset($this->header->unpublish_date)) { $this->unpublish_date = strtotime($this->header->unpublish_date); } - if (!empty($this->header->expires)) { + if (isset($this->header->expires)) { $this->expires = intval($this->header->expires); } - if (!empty($this->header->etag)) { - $this->etag = (bool)$this->header->etag; + if (isset($this->header->etag)) { + $this->etag = (bool) $this->header->etag; } - if (!empty($this->header->last_modified)) { - $this->last_modified = (bool)$this->header->last_modified; + if (isset($this->header->last_modified)) { + $this->last_modified = (bool) $this->header->last_modified; } } diff --git a/system/src/Grav/Common/Utils.php b/system/src/Grav/Common/Utils.php index 5c38f97a9..2cd81ada6 100644 --- a/system/src/Grav/Common/Utils.php +++ b/system/src/Grav/Common/Utils.php @@ -219,7 +219,11 @@ abstract class Utils $file_parts = pathinfo($file); $filesize = filesize($file); - set_time_limit(0); + // check if this function is available, if so use it to stop any timeouts + if (function_exists('set_time_limit')) { + set_time_limit(0); + } + ignore_user_abort(false); if ($force_download) { From 38a7b0d7ab52abb04b6a0980025213ea01ab439b Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 12 Aug 2015 06:31:07 -0600 Subject: [PATCH 5/7] version update --- system/defines.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/defines.php b/system/defines.php index 84c41d5f6..d6803db21 100644 --- a/system/defines.php +++ b/system/defines.php @@ -2,7 +2,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '0.9.36'); +define('GRAV_VERSION', '0.9.37'); define('DS', '/'); // Directories and Paths From 42e6d587d8569c28858d2a9da1e649857200fc88 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Wed, 12 Aug 2015 15:35:45 +0200 Subject: [PATCH 6/7] Fix slug to be lowercase --- system/src/Grav/Common/GPM/Local/Package.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Common/GPM/Local/Package.php b/system/src/Grav/Common/GPM/Local/Package.php index 6af4a4e1a..f60c15fae 100644 --- a/system/src/Grav/Common/GPM/Local/Package.php +++ b/system/src/Grav/Common/GPM/Local/Package.php @@ -16,7 +16,7 @@ class Package extends BasePackage $this->settings = $package->toArray(); $html_description = \Parsedown::instance()->line($this->description); - $this->data->set('slug', $this->name); + $this->data->set('slug', strtolower($this->name)); $this->data->set('description_html', $html_description); $this->data->set('description_plain', strip_tags($html_description)); $this->data->set('symlink', is_link(USER_DIR . $package_type . DS . $this->name)); From 274ff3d8c0a0d7d22223cecc779b4bcfa7f36f5c Mon Sep 17 00:00:00 2001 From: Djamil Legato Date: Wed, 12 Aug 2015 10:41:47 -0700 Subject: [PATCH 7/7] Additional slug fixes with GPM (#44). Increased spaces in GPM CLI --- .../src/Grav/Common/GPM/Local/AbstractPackageCollection.php | 1 + system/src/Grav/Common/GPM/Local/Package.php | 2 +- system/src/Grav/Console/Gpm/IndexCommand.php | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/system/src/Grav/Common/GPM/Local/AbstractPackageCollection.php b/system/src/Grav/Common/GPM/Local/AbstractPackageCollection.php index 314829378..b61f92ce6 100644 --- a/system/src/Grav/Common/GPM/Local/AbstractPackageCollection.php +++ b/system/src/Grav/Common/GPM/Local/AbstractPackageCollection.php @@ -10,6 +10,7 @@ abstract class AbstractPackageCollection extends BaseCollection { public function __construct($items) { foreach ($items as $name => $data) { + $data->set('slug', $name); $this->items[$name] = new Package($data, $this->type); } } diff --git a/system/src/Grav/Common/GPM/Local/Package.php b/system/src/Grav/Common/GPM/Local/Package.php index f60c15fae..6505a59dd 100644 --- a/system/src/Grav/Common/GPM/Local/Package.php +++ b/system/src/Grav/Common/GPM/Local/Package.php @@ -16,7 +16,7 @@ class Package extends BasePackage $this->settings = $package->toArray(); $html_description = \Parsedown::instance()->line($this->description); - $this->data->set('slug', strtolower($this->name)); + $this->data->set('slug', $package->slug); $this->data->set('description_html', $html_description); $this->data->set('description_plain', strip_tags($html_description)); $this->data->set('symlink', is_link(USER_DIR . $package_type . DS . $this->name)); diff --git a/system/src/Grav/Console/Gpm/IndexCommand.php b/system/src/Grav/Console/Gpm/IndexCommand.php index 12ac9a6b5..f5b3e1618 100644 --- a/system/src/Grav/Console/Gpm/IndexCommand.php +++ b/system/src/Grav/Console/Gpm/IndexCommand.php @@ -67,9 +67,9 @@ class IndexCommand extends Command // index str_pad($index++ + 1, 2, '0', STR_PAD_LEFT) . ". " . // package name - "" . str_pad($package->name, 15) . " " . + "" . str_pad($package->name, 20) . " " . // slug - "[" . str_pad($slug, 15, ' ', STR_PAD_BOTH) . "] " . + "[" . str_pad($slug, 20, ' ', STR_PAD_BOTH) . "] " . // version details $this->versionDetails($package) );