Skip to content

Commit c7d5897

Browse files
committed
Change the security behaviour
.htaccess files are no longer created in each servers, but is directly used in the JSONDB servers directory.
1 parent c9b2fc5 commit c7d5897

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

src/JSONDB/JSONDB.php

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -297,20 +297,6 @@ public function createServer($name, $username, $password, $connect = FALSE)
297297

298298
chmod($path, 0777);
299299

300-
$htaccess = fopen($path . '/.htaccess', 'a+');
301-
foreach(array('<IfModule mod_rewrite.c>',
302-
'RewriteEngine On',
303-
'RewriteRule ^index\.php$ - [L]',
304-
'RewriteRule . - [f]',
305-
'</IfModule>') as $line) {
306-
fwrite($htaccess, $line . "\n");
307-
}
308-
fclose($htaccess);
309-
310-
$indexphp = fopen($path . '/index.php', 'a+');
311-
fwrite($indexphp, 'Direct Access Denied.');
312-
fclose($indexphp);
313-
314300
$this->config->addUser($name, $username, $password);
315301

316302
if ($connect) {
@@ -425,6 +411,10 @@ public function disconnect()
425411
public function createTable($name, array $prototype)
426412
{
427413
$this->benchmark->mark('jsondb_(createTable)_start');
414+
if (NULL === $this->database) {
415+
$this->benchmark->mark('jsondb_(createTable)_end');
416+
throw new Exception('JSONDB Error: Trying to create a table without using a database.');
417+
}
428418
$table_path = $this->_getTablePath($name);
429419
if (file_exists($table_path)) {
430420
$this->benchmark->mark('jsondb_(createTable)_end');

0 commit comments

Comments
 (0)