Skip to content

Commit 3b7c4e8

Browse files
committed
fix a bug
1 parent b7521ef commit 3b7c4e8

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

create-page.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@
1313
throw new fValidationException('There cannot be .. or // in the path');
1414
}
1515

16-
$parent_path = Page::parentPage($page_path);
17-
try {
18-
$parent = new Page(array('path' => $parent_path));
19-
} catch (fNotFoundException $e) {
20-
throw new fValidationException('Please create the parent page first');
21-
}
22-
$user_name = wiki_get_current_user();
23-
if (!$parent->isPermitted($user_name, 'create')) {
24-
throw new fValidationException('You are not permitted to create pages here!');
16+
if ($page_path!='/') {
17+
$parent_path = Page::parentPage($page_path);
18+
try {
19+
$parent = new Page(array('path' => $parent_path));
20+
} catch (fNotFoundException $e) {
21+
throw new fValidationException('Please create the parent page first');
22+
}
23+
$user_name = wiki_get_current_user();
24+
if (!$parent->isPermitted($user_name, 'create')) {
25+
throw new fValidationException('You are not permitted to create pages here!');
26+
}
2527
}
2628

2729
$body = fRequest::get('body');

0 commit comments

Comments
 (0)