Skip to content

Commit

Permalink
Installing forms from subdirectories
Browse files Browse the repository at this point in the history
  • Loading branch information
makss committed Sep 28, 2017
1 parent 8a222de commit 1f3e6be
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 3 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 7 additions & 3 deletions textpattern/setup/txpsql.php
Expand Up @@ -87,9 +87,13 @@
safe_query("INSERT INTO `".PFX."txp_css`(name, css) VALUES('".doSlash($key)."', '".doSlash($data)."')");
}

foreach (get_files_content($themedir.'/forms', 'txp') as $key=>$data) {
list($type, $name) = explode('.', $key);
safe_query("INSERT INTO `".PFX."txp_form`(type, name, Form) VALUES('".doSlash($type)."', '".doSlash($name)."', '".doSlash($data)."')");
if ($files = glob("{$themedir}/forms/*/*\.txp")) {
foreach ($files as $file) {
if (preg_match('%/forms/(\w+)/(\w+)\.txp$%', $file, $mm)) {
$data = @file_get_contents($file);
safe_query("INSERT INTO `".PFX."txp_form`(type, name, Form) VALUES('".doSlash($mm[1])."', '".doSlash($mm[2])."', '".doSlash($data)."')");
}
}
}

foreach (get_files_content($themedir.'/pages', 'txp') as $key=>$data) {
Expand Down

0 comments on commit 1f3e6be

Please sign in to comment.