Browse Source

sql Content Element

master
Dom SP 3 years ago
parent
commit
a602eda084
1 changed files with 35 additions and 1 deletions
  1. +35
    -1
      app/modules/filesinfolders.php

+ 35
- 1
app/modules/filesinfolders.php View File

@@ -391,7 +391,7 @@ class FilesInFolders {
);
}
break;
case 'TOC':
// throw away TOC part of request, we don't need it
array_shift($request);
@@ -402,6 +402,39 @@ class FilesInFolders {
$toc);
break;

case 'sql':
//array_shift($request);
switch ($request[1]) {
case 'sqlite':
$array = [];
$db = new \DB\SQL('sqlite:' . $this->folder . $request[2]);
$sql = implode(" ", $body);
if ( strpos($sql,'insert')===false &&
strpos($sql,'update')===false &&
strpos($sql,'drop')===false) {
$rows = $db->exec($sql);
foreach ($rows as $res) {
switch (count($res)) {
case 1:
$keys=array_keys($res);
$array[] = $res[$keys[0]];
break;
case 2:
$keys=array_keys($res);
$array[$res[$keys[0]]] = $res[$keys[1]];
break;
}
}
}
$new = sprintf("<ul><li>%s</li></ul>",
implode("</li><li>",$array));
unset($array);
break;
}
break;
case 'form':
$token_db = $f3->get('TEMP') . "CEform/";
$form_config_file = sprintf("%s%s.cfg",
@@ -462,6 +495,7 @@ class FilesInFolders {
$formcall->token = $token;
$formcall->timestamp = $timestamp;
$formcall->form = $form_config_file;
$formcall->path = ROOT.$this->folder;
$formcall->save();
$form_view = new \Template;

Loading…
Cancel
Save