diff --git a/.htaccess b/.htaccess
index cfffd1b..369eb63 100644
--- a/.htaccess
+++ b/.htaccess
@@ -1,8 +1,8 @@
-RewriteEngine On
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
-RewriteRule . index.php [L]
+ RewriteEngine On
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteRule . index.php [L]
# Prevent file browsing
diff --git a/README.md b/README.md
index 5416c52..443b91e 100644
--- a/README.md
+++ b/README.md
@@ -1,27 +1,31 @@
#PIP
-PIP is a tiny application framework built for people who use a LAMP stack. PIP aims to be as simple as possible to set up and use.
+PIP is a tiny application framework built for people who use a LAMP stack. PIP aims to be as simple as possible to setup and use.
+
+This is Dushan's fork which features:
+
+* Security fix for a Local File Inclusion (credit LB)
+* Removal of redundant/legacy code
+* Cleanup of directory structure
+* Upgraded database handling (using PDO)
+* Various minor upgrades
Visit [http://gilbitron.github.com/PIP](http://gilbitron.github.com/PIP/) for more information and documentation.
## Requirements
-* PHP 5.1 or greater
-* MySQL 4.1.2 or greater
-* The mod_rewrite Apache module
+* A recent version of PHP (with PDO support)
+* A recent version of MySQL or MariaDB
+* A recent version of Apache with mod_rewrite and htaccess enabled (or another compatible web server such as Nginx)
## Installation
-* Download PIP and extract
-* Navigate to `application/config/config.php` and fill in your `base_url`
-* You are ready to rock! Point your browser to your `base_url` and hopefully see a welcome message.
-
-## Documentation
-
-Visit [http://gilbitron.github.com/PIP](http://gilbitron.github.com/PIP/) to see the documentation.
+* Download PIP and extract to your web root
+* Navigate to `system/` and edit `db.php`, `config.php` and `controllers.php` as needed
+* Point your browser to your `base_url`
## License
PIP is released under the MIT license.
-Want to say thanks? [Consider tipping me](https://www.gittip.com/gilbitron).
+Credit to original author [http://gilbitron.github.com/PIP](http://gilbitron.github.com/PIP/)
diff --git a/application/config/config.php b/application/config/config.php
deleted file mode 100644
index d34579b..0000000
--- a/application/config/config.php
+++ /dev/null
@@ -1,13 +0,0 @@
-
\ No newline at end of file
diff --git a/application/controllers/error.php b/application/controllers/error.php
index 99d72f7..56d8f1c 100644
--- a/application/controllers/error.php
+++ b/application/controllers/error.php
@@ -1,18 +1,11 @@
error404();
- }
-
- function error404()
- {
- echo '
404 Error
';
- echo 'Looks like this page doesn\'t exist
';
- }
-
-}
-
+ class Error extends Controller {
+ function index() {
+ $this->errorMsg();
+ }
+
+ function errorMsg() {
+ echo 'There is an error, that is all we know...';
+ }
+ }
?>
diff --git a/application/controllers/main.php b/application/controllers/main.php
index b1c40ac..b87b9a1 100644
--- a/application/controllers/main.php
+++ b/application/controllers/main.php
@@ -1,13 +1,10 @@
loadView('main_view');
- $template->render();
- }
-
-}
-
+ class Main extends Controller {
+ function index() {
+ $data = $this->loadModel('example');
+ $template = $this->loadView('view');
+ $template->set('data', 'Hello World');
+ $template->render();
+ }
+ }
?>
diff --git a/application/helpers/session_helper.php b/application/helpers/session_helper.php
deleted file mode 100644
index 5322e9c..0000000
--- a/application/helpers/session_helper.php
+++ /dev/null
@@ -1,22 +0,0 @@
-
\ No newline at end of file
diff --git a/application/helpers/url_helper.php b/application/helpers/url_helper.php
deleted file mode 100644
index c9caf98..0000000
--- a/application/helpers/url_helper.php
+++ /dev/null
@@ -1,21 +0,0 @@
-
\ No newline at end of file
diff --git a/application/models/example.php b/application/models/example.php
new file mode 100644
index 0000000..cd8e657
--- /dev/null
+++ b/application/models/example.php
@@ -0,0 +1,15 @@
+getDB();
+ $stmt = $db->prepare($sql);
+ $stmt->bindParam('id', $id, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (PDOException $e) {
+ echo $e->getMessage();
+ }
+ }
+ }
+?>
diff --git a/application/models/example_model.php b/application/models/example_model.php
deleted file mode 100644
index 18c960a..0000000
--- a/application/models/example_model.php
+++ /dev/null
@@ -1,14 +0,0 @@
-escapeString($id);
- $result = $this->query('SELECT * FROM something WHERE id="'. $id .'"');
- return $result;
- }
-
-}
-
-?>
diff --git a/application/plugins/.gitignore b/application/plugins/.gitkeep
similarity index 100%
rename from application/plugins/.gitignore
rename to application/plugins/.gitkeep
diff --git a/application/views/footer.php b/application/views/footer.php
deleted file mode 100644
index 691287b..0000000
--- a/application/views/footer.php
+++ /dev/null
@@ -1,2 +0,0 @@
-