diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..d5177a5
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,13 @@
+
+ RewriteEngine On
+
+ # Tell PHP that the mod_rewrite module is ENABLED.
+ SetEnv HTTP_MOD_REWRITE On
+
+ # Dont redirect direct links to files or directories to the index.php
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
+
+ # Rewrite all other URLs to index.php/URL
+ RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
+
\ No newline at end of file
diff --git a/README b/README
new file mode 100644
index 0000000..faa69b3
--- /dev/null
+++ b/README
@@ -0,0 +1,2 @@
+This is a test version of the upcoming SuperSmash Framework
+This is a simple framework that works for everyone
\ No newline at end of file
diff --git a/SuperSmash_Framework.pdf b/SuperSmash_Framework.pdf
new file mode 100644
index 0000000..b617ac1
Binary files /dev/null and b/SuperSmash_Framework.pdf differ
diff --git a/applications/.htaccess b/applications/.htaccess
new file mode 100644
index 0000000..fea6261
--- /dev/null
+++ b/applications/.htaccess
@@ -0,0 +1,14 @@
+RewriteEngine on
+
+# disable directory browsing
+Options All -Indexes
+
+
+ Order Allow,Deny
+ Deny from all
+
+
+# turn off magic_quotes_gpc for PHP enabled servers
+
+ php_flag magic_quotes_gpc off
+
\ No newline at end of file
diff --git a/applications/start/.htaccess b/applications/start/.htaccess
new file mode 100644
index 0000000..fea6261
--- /dev/null
+++ b/applications/start/.htaccess
@@ -0,0 +1,14 @@
+RewriteEngine on
+
+# disable directory browsing
+Options All -Indexes
+
+
+ Order Allow,Deny
+ Deny from all
+
+
+# turn off magic_quotes_gpc for PHP enabled servers
+
+ php_flag magic_quotes_gpc off
+
\ No newline at end of file
diff --git a/applications/start/cache/.htaccess b/applications/start/cache/.htaccess
new file mode 100644
index 0000000..3418e55
--- /dev/null
+++ b/applications/start/cache/.htaccess
@@ -0,0 +1 @@
+deny from all
\ No newline at end of file
diff --git a/applications/start/configuration/.htaccess b/applications/start/configuration/.htaccess
new file mode 100644
index 0000000..3418e55
--- /dev/null
+++ b/applications/start/configuration/.htaccess
@@ -0,0 +1 @@
+deny from all
\ No newline at end of file
diff --git a/applications/start/configuration/SuperSmashconfiguration.php b/applications/start/configuration/SuperSmashconfiguration.php
new file mode 100644
index 0000000..bc63ce7
--- /dev/null
+++ b/applications/start/configuration/SuperSmashconfiguration.php
@@ -0,0 +1,16 @@
+
\ No newline at end of file
diff --git a/applications/start/configuration/configuration.php b/applications/start/configuration/configuration.php
new file mode 100644
index 0000000..ee0c489
--- /dev/null
+++ b/applications/start/configuration/configuration.php
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/applications/start/configuration/databaseconfiguration.php b/applications/start/configuration/databaseconfiguration.php
new file mode 100644
index 0000000..2c511a7
--- /dev/null
+++ b/applications/start/configuration/databaseconfiguration.php
@@ -0,0 +1,10 @@
+ 'mysql',
+ 'host' => 'localhost',
+ 'database' => 'framework',
+ 'username' => 'root',
+ 'password' => '',
+ 'port' => '3306'
+);
+?>
\ No newline at end of file
diff --git a/applications/start/controllers/index.html b/applications/start/controllers/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/applications/start/controllers/introduction.php b/applications/start/controllers/introduction.php
new file mode 100644
index 0000000..75d103f
--- /dev/null
+++ b/applications/start/controllers/introduction.php
@@ -0,0 +1,28 @@
+load->model('introduction');
+
+ // Load the data for the introduction model
+ $data = $this->IntroductionModel->introduction();
+
+ // Load the view and add the data
+ $this->load->view('introduction', $data);
+ }
+
+ function _afterAction() {
+
+ }
+}
+?>
\ No newline at end of file
diff --git a/applications/start/helpers/index.html b/applications/start/helpers/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/applications/start/library/index.html b/applications/start/library/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/applications/start/models/index.html b/applications/start/models/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/applications/start/models/introduction.php b/applications/start/models/introduction.php
new file mode 100644
index 0000000..d4517f4
--- /dev/null
+++ b/applications/start/models/introduction.php
@@ -0,0 +1,17 @@
+
+ 'Hello and welcome to the SuperSmash Framework!
+ This framework will help you while developing your application
+ ');
+ }
+}
+?>
\ No newline at end of file
diff --git a/applications/start/portal.png b/applications/start/portal.png
new file mode 100644
index 0000000..a08902d
Binary files /dev/null and b/applications/start/portal.png differ
diff --git a/applications/start/views/introduction/css/style.css b/applications/start/views/introduction/css/style.css
new file mode 100644
index 0000000..05c814d
--- /dev/null
+++ b/applications/start/views/introduction/css/style.css
@@ -0,0 +1,85 @@
+body
+{
+ margin:0 auto;
+ background-color:#000000;
+}
+
+h1 {
+ font-family: SuperSmash, serif;
+ text-transform: uppercase;
+ letter-spacing: 1px;
+ padding:10px;
+}
+
+#container
+{
+ width:600px;
+ margin: 0 auto;
+ background: #F0C74D;
+ border: 1px solid #999;
+ border-top-left-radius: 15px;
+ border-top-right-radius: 15px;
+ border-bottom-left-radius: 15px;
+ border-bottom-right-radius: 15px;
+}
+
+#header
+{
+ width: auto;
+ height:100px;
+ text-align: center;
+ color : #F0C74D;
+}
+
+#content
+{
+ width:600px;
+ padding: 20px 10px 20px 10px;
+ margin:0 auto;
+ text-align: center;
+}
+
+#footer
+{
+ width:600px;
+ margin: 0 auto;
+ background: #F0C74D;
+ border: 1px solid #999;
+ border-top-left-radius: 15px;
+ border-top-right-radius: 15px;
+ border-bottom-left-radius: 15px;
+ border-bottom-right-radius: 15px;
+ text-align: center;
+}
+
+#dynamic{
+ text-align: center;
+}
+
+#html5{
+ position:fixed;
+ top:20px;
+ right:5px;
+ }
+
+#twitter{
+ position:fixed;
+ top:60px;
+ right:5px;
+ }
+
+#w3c{
+ position:fixed;
+ top:100px;
+ right:5px;
+ }
+
+pre
+{
+ font-size: 12px;
+ padding-top: 10px;
+ background: #f0f0f0;
+ border: 1px solid #999;
+ width:400px;
+ margin: 0 auto;
+}
\ No newline at end of file
diff --git a/applications/start/views/introduction/images/favicon.ico b/applications/start/views/introduction/images/favicon.ico
new file mode 100644
index 0000000..8ca31d1
Binary files /dev/null and b/applications/start/views/introduction/images/favicon.ico differ
diff --git a/applications/start/views/introduction/images/html5.png b/applications/start/views/introduction/images/html5.png
new file mode 100644
index 0000000..f565bbd
Binary files /dev/null and b/applications/start/views/introduction/images/html5.png differ
diff --git a/applications/start/views/introduction/images/logo.png b/applications/start/views/introduction/images/logo.png
new file mode 100644
index 0000000..1aff464
Binary files /dev/null and b/applications/start/views/introduction/images/logo.png differ
diff --git a/applications/start/views/introduction/images/mvc.png b/applications/start/views/introduction/images/mvc.png
new file mode 100644
index 0000000..d39530f
Binary files /dev/null and b/applications/start/views/introduction/images/mvc.png differ
diff --git a/applications/start/views/introduction/images/twitter.png b/applications/start/views/introduction/images/twitter.png
new file mode 100644
index 0000000..8e9cad8
Binary files /dev/null and b/applications/start/views/introduction/images/twitter.png differ
diff --git a/applications/start/views/introduction/images/w3c.png b/applications/start/views/introduction/images/w3c.png
new file mode 100644
index 0000000..1acc235
Binary files /dev/null and b/applications/start/views/introduction/images/w3c.png differ
diff --git a/applications/start/views/introduction/index.php b/applications/start/views/introduction/index.php
new file mode 100644
index 0000000..7265389
--- /dev/null
+++ b/applications/start/views/introduction/index.php
@@ -0,0 +1,49 @@
+
+
+
+ /images/logo.png" alt="SuperSmash Logo" />
+ Welcome to the SuperSmash Framework!
+ /images/logo.png" alt="SuperSmash Logo" />
+
+
+
+
+
+ You can edit the Model by going here:
+
applications/start/models/welcome.php
+
+
+
+ You can edit the View by going here:
+
applications/start/views/welcome.php
+
+
+
+ You can edit the Controller by going here:
+
applications/start/controllers/welcome.php
+
+
+
+ /images/mvc.png" alt="MVC Model" />
+
+
+
+
+
+
+ /images/html5.png" alt="HTML5" />
+ /images/twitter.png" alt="Twitter" />
+
+
\ No newline at end of file
diff --git a/applications/taskmanager/.htaccess b/applications/taskmanager/.htaccess
new file mode 100644
index 0000000..fea6261
--- /dev/null
+++ b/applications/taskmanager/.htaccess
@@ -0,0 +1,14 @@
+RewriteEngine on
+
+# disable directory browsing
+Options All -Indexes
+
+
+ Order Allow,Deny
+ Deny from all
+
+
+# turn off magic_quotes_gpc for PHP enabled servers
+
+ php_flag magic_quotes_gpc off
+
\ No newline at end of file
diff --git a/applications/taskmanager/cache/.htaccess b/applications/taskmanager/cache/.htaccess
new file mode 100644
index 0000000..3418e55
--- /dev/null
+++ b/applications/taskmanager/cache/.htaccess
@@ -0,0 +1 @@
+deny from all
\ No newline at end of file
diff --git a/applications/taskmanager/configuration/.htaccess b/applications/taskmanager/configuration/.htaccess
new file mode 100644
index 0000000..3418e55
--- /dev/null
+++ b/applications/taskmanager/configuration/.htaccess
@@ -0,0 +1 @@
+deny from all
\ No newline at end of file
diff --git a/applications/taskmanager/configuration/SuperSmashconfiguration.php b/applications/taskmanager/configuration/SuperSmashconfiguration.php
new file mode 100644
index 0000000..55cd5a0
--- /dev/null
+++ b/applications/taskmanager/configuration/SuperSmashconfiguration.php
@@ -0,0 +1,16 @@
+
\ No newline at end of file
diff --git a/applications/taskmanager/configuration/configuration.php b/applications/taskmanager/configuration/configuration.php
new file mode 100644
index 0000000..7d1b9d2
--- /dev/null
+++ b/applications/taskmanager/configuration/configuration.php
@@ -0,0 +1,12 @@
+
\ No newline at end of file
diff --git a/applications/taskmanager/configuration/databaseconfiguration.php b/applications/taskmanager/configuration/databaseconfiguration.php
new file mode 100644
index 0000000..1f48189
--- /dev/null
+++ b/applications/taskmanager/configuration/databaseconfiguration.php
@@ -0,0 +1,10 @@
+ 'mysql',
+ 'host' => 'localhost',
+ 'database' => 'taskmanager',
+ 'username' => 'root',
+ 'password' => '',
+ 'port' => '3306'
+);
+?>
\ No newline at end of file
diff --git a/applications/taskmanager/controllers/index.html b/applications/taskmanager/controllers/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/applications/taskmanager/controllers/login.php b/applications/taskmanager/controllers/login.php
new file mode 100644
index 0000000..610df1f
--- /dev/null
+++ b/applications/taskmanager/controllers/login.php
@@ -0,0 +1,39 @@
+load->model('login');
+
+ // Load the data for the login model
+ $data = $this->LoginModel->login($error);
+
+ // Load the view and add the data
+ $this->load->view('login', $data);
+ }
+
+ function check(){
+ // Load the login Model
+ $this->load->model('login');
+
+ if ($this->LoginModel->check()){
+ die("ingelogd");
+ } else {
+ $this->start(true);
+ }
+ }
+
+ function _afterAction() {
+
+ }
+}
+?>
\ No newline at end of file
diff --git a/applications/taskmanager/helpers/index.html b/applications/taskmanager/helpers/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/applications/taskmanager/library/index.html b/applications/taskmanager/library/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/applications/taskmanager/models/index.html b/applications/taskmanager/models/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/applications/taskmanager/models/login.php b/applications/taskmanager/models/login.php
new file mode 100644
index 0000000..8dc4cfd
--- /dev/null
+++ b/applications/taskmanager/models/login.php
@@ -0,0 +1,58 @@
+
+ 'Use this form to login into the application.'
+ );
+
+ if ($error) {
+ $error = array('errorMessage' =>
+ 'Invalid username or password.'
+ );
+
+ $array = array_merge($array, $error);
+ }
+ return $array;
+ }
+
+ public function check(){
+ if ($_SERVER['REQUEST_METHOD'] == "POST"){
+ if (isset($_POST['username']) && isset($_POST['password'])){
+
+ // Get the database connection
+ $database = \System\SuperSmash\SuperSmash::database();
+
+ $password = $_POST['password'];
+
+ // Check if the username and password are valid
+ $query = $database->prepare("SELECT * FROM login WHERE username = ? LIMIT 1");
+ $query->execute(array($_POST['username']));
+ $result = $query->fetch();
+ $password = md5(sha1($password . $result['salt']));
+ $password = $this->encrypt_login($password, $result['salt']);
+ return $password == $result['password'];
+ }
+ }
+ }
+
+ private function encrypt_login($string, $key){
+ $r = 0;
+ for ($i = 0; $i < strlen($string); $i++)
+ $r .= substr((md5($key)), ($i % strlen(md5($key))),
+ 1) . $string[$i];
+ for ($i = 1; $i < strlen($r); $i++)
+ $string[$i - 1] = chr(ord($r[$i - 1]) + ord(substr(md5
+ ($key), ($i % strlen(md5($key))) - 1, 1)));
+ $value = 0;
+ $value = urlencode(base64_encode($string));
+ return stripslashes($value);
+ }
+ }
+?>
\ No newline at end of file
diff --git a/applications/taskmanager/views/login/css/login.css b/applications/taskmanager/views/login/css/login.css
new file mode 100644
index 0000000..c93f9d3
--- /dev/null
+++ b/applications/taskmanager/views/login/css/login.css
@@ -0,0 +1,128 @@
+body
+{
+ margin:0 auto;
+ background-color:#000000;
+}
+
+#container
+{
+ width:600px;
+ margin: 0 auto;
+}
+
+#header
+{
+ margin: 0 auto;
+ height:100px;
+ text-align: center;
+ color : #FFFFFF;
+ font: bold 20px "SuperSmash", Arial;
+}
+
+#footer
+{
+ width:600px;
+ margin: 0 auto;
+ background: #F0C74D;
+ border-top-left-radius: 15px;
+ border-top-right-radius: 15px;
+ border-bottom-left-radius: 15px;
+ border-bottom-right-radius: 15px;
+ text-align: center;
+}
+
+
+#login-box {
+ width:333px;
+ height: 352px;
+ padding: 58px 76px 0 76px;
+ margin: 0 auto;
+ color: #ebebeb;
+ font: 12px Arial, Helvetica, sans-serif;
+ background: url("../images/background.png") no-repeat left top;
+}
+
+.loginButton{
+ margin-left:90px;
+ background: url("../images/button.png") no-repeat left top;
+ width:103px;
+ height:42px;
+ border:0px;
+}
+
+#login-box img {
+ border:none;
+}
+
+#login-box h2 {
+ padding:0;
+ margin:0;
+ color: #ebebeb;
+ font: bold 44px "Calibri", Arial;
+}
+
+
+#login-box-username {
+ float: left;
+ display:inline;
+ width:80px;
+ text-align: right;
+ padding: 14px 10px 0 0;
+ margin:0 0 7px 0;
+}
+
+#login-box-usernamefield {
+ float: left;
+ display:inline;
+ width:230px;
+ margin:0;
+ margin:0 0 7px 0;
+}
+
+#login-box-password {
+ float: left;
+ display:inline;
+ width:80px;
+ text-align: right;
+ padding: 14px 10px 0 0;
+ margin:0 0 7px 0;
+}
+
+#login-box-passwordfield {
+ float: left;
+ display:inline;
+ width:230px;
+ margin:0;
+ margin:0 0 7px 0;
+}
+
+.form-login {
+ width: 205px;
+ padding: 10px 4px 6px 3px;
+ border: 1px solid #0d2c52;
+ background-color:#1e4f8a;
+ font-size: 16px;
+ color: #ebebeb;
+}
+
+
+.login-box-options {
+ clear:both;
+ padding-left:87px;
+ font-size: 11px;
+}
+
+.login-box-options a {
+ color: #ebebeb;
+ font-size: 11px;
+}
+
+pre
+{
+ font-size: 12px;
+ padding-top: 10px;
+ background: #f0f0f0;
+ border: 1px solid #999;
+ width:400px;
+ margin: 0 auto;
+}
\ No newline at end of file
diff --git a/applications/taskmanager/views/login/images/background.png b/applications/taskmanager/views/login/images/background.png
new file mode 100644
index 0000000..1259cce
Binary files /dev/null and b/applications/taskmanager/views/login/images/background.png differ
diff --git a/applications/taskmanager/views/login/images/button.png b/applications/taskmanager/views/login/images/button.png
new file mode 100644
index 0000000..9cd2421
Binary files /dev/null and b/applications/taskmanager/views/login/images/button.png differ
diff --git a/applications/taskmanager/views/login/images/favicon.ico b/applications/taskmanager/views/login/images/favicon.ico
new file mode 100644
index 0000000..8ca31d1
Binary files /dev/null and b/applications/taskmanager/views/login/images/favicon.ico differ
diff --git a/applications/taskmanager/views/login/index.php b/applications/taskmanager/views/login/index.php
new file mode 100644
index 0000000..05e7ee8
--- /dev/null
+++ b/applications/taskmanager/views/login/index.php
@@ -0,0 +1,43 @@
+
+
+
+
+ /images/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
+ /css/login.css"/>
+
+
+
+
+
SuperSmash Task manager
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..8b609ae
--- /dev/null
+++ b/index.php
@@ -0,0 +1,22 @@
+start();
+?>
\ No newline at end of file
diff --git a/system/SuperSmash/SuperSmash.php b/system/SuperSmash/SuperSmash.php
new file mode 100644
index 0000000..c8f59c1
--- /dev/null
+++ b/system/SuperSmash/SuperSmash.php
@@ -0,0 +1,108 @@
+Router = loadClass('Router');
+
+ // get the URL information to be used by the router
+ $routes = $this->Router->getUrlInformation();
+
+ // initialise some important routing variables
+ $controller = $GLOBALS['controller'] = $routes['controller'];
+ $action = $GLOBALS['action'] = $routes['action'];
+ $queryString = $GLOBALS['querystring'] = $routes['querystring'];
+
+ // Include the application controller
+ if(file_exists(settings::getFilePath() . DS . settings::getApp() . DS . 'controllers' . DS . strtolower($controller) . '.php'))
+ {
+ require_once (settings::getFilePath() . DS . settings::getApp() . DS . 'controllers' . DS . strtolower($controller) . '.php');
+ }
+ else
+ {
+ show_404();
+ }
+
+ // Create a new object for the controller
+ $this->dispatch = new $controller();
+
+ // Create a database connection object
+ if (configuration('useDatabase'))
+ {
+ if (self::$database == null)
+ {
+ self::$database = loadClass('Database','SuperSmash',configuration('database'));
+ self::$database = self::$database->open();
+ }
+ }
+
+ // Check if we need to put the session in the database
+ if (configuration('sessionDatabase'))
+ {
+ $config['database'] = self::$database;
+ new Session($config);
+ }
+
+ // After loading the controller, make sure the method exists, or we have a 404
+ if(method_exists($controller, $action))
+ {
+ // Call the beforeAction method in the controller.
+ $this->performAction($controller, "_beforeAction", $queryString);
+
+ // Call the actual action
+ $this->performAction($controller, $action, $queryString);
+
+ // Call the afterAction method in the controller.
+ $this->performAction($controller, "_afterAction", $queryString);
+ }
+ else
+ {
+ // If the method did not exist, then we have a 404
+ show_404();
+ }
+ }
+
+ // This function will perform an action on the specified controller
+ protected function performAction($controller, $action, $queryString = null)
+ {
+ if(method_exists($controller, $action))
+ {
+ return call_user_func_array( array($this->dispatch, $action), $queryString );
+ }
+ return false;
+ }
+
+ public static function database()
+ {
+ return self::$database;
+ }
+
+ public static function language()
+ {
+ // Load the language
+ $language = loadClass('Language');
+ $language->setLanguage(configuration('language', 'SuperSmash'));
+ $language->load('SuperSmash_errors');
+ $language->load('page_errors');
+ return $language;
+ }
+}
+?>
\ No newline at end of file
diff --git a/system/SuperSmash/applicationchooser/.htaccess b/system/SuperSmash/applicationchooser/.htaccess
new file mode 100644
index 0000000..fea6261
--- /dev/null
+++ b/system/SuperSmash/applicationchooser/.htaccess
@@ -0,0 +1,14 @@
+RewriteEngine on
+
+# disable directory browsing
+Options All -Indexes
+
+
+ Order Allow,Deny
+ Deny from all
+
+
+# turn off magic_quotes_gpc for PHP enabled servers
+
+ php_flag magic_quotes_gpc off
+
\ No newline at end of file
diff --git a/system/SuperSmash/applicationchooser/cache/.htaccess b/system/SuperSmash/applicationchooser/cache/.htaccess
new file mode 100644
index 0000000..3418e55
--- /dev/null
+++ b/system/SuperSmash/applicationchooser/cache/.htaccess
@@ -0,0 +1 @@
+deny from all
\ No newline at end of file
diff --git a/system/SuperSmash/applicationchooser/configuration/.htaccess b/system/SuperSmash/applicationchooser/configuration/.htaccess
new file mode 100644
index 0000000..3418e55
--- /dev/null
+++ b/system/SuperSmash/applicationchooser/configuration/.htaccess
@@ -0,0 +1 @@
+deny from all
\ No newline at end of file
diff --git a/system/SuperSmash/applicationchooser/configuration/SuperSmashconfiguration.php b/system/SuperSmash/applicationchooser/configuration/SuperSmashconfiguration.php
new file mode 100644
index 0000000..665569f
--- /dev/null
+++ b/system/SuperSmash/applicationchooser/configuration/SuperSmashconfiguration.php
@@ -0,0 +1,16 @@
+
\ No newline at end of file
diff --git a/system/SuperSmash/applicationchooser/configuration/configuration.php b/system/SuperSmash/applicationchooser/configuration/configuration.php
new file mode 100644
index 0000000..b8881da
--- /dev/null
+++ b/system/SuperSmash/applicationchooser/configuration/configuration.php
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/system/SuperSmash/applicationchooser/configuration/databaseconfiguration.php b/system/SuperSmash/applicationchooser/configuration/databaseconfiguration.php
new file mode 100644
index 0000000..2c511a7
--- /dev/null
+++ b/system/SuperSmash/applicationchooser/configuration/databaseconfiguration.php
@@ -0,0 +1,10 @@
+ 'mysql',
+ 'host' => 'localhost',
+ 'database' => 'framework',
+ 'username' => 'root',
+ 'password' => '',
+ 'port' => '3306'
+);
+?>
\ No newline at end of file
diff --git a/system/SuperSmash/applicationchooser/controllers/chooser.php b/system/SuperSmash/applicationchooser/controllers/chooser.php
new file mode 100644
index 0000000..d424a92
--- /dev/null
+++ b/system/SuperSmash/applicationchooser/controllers/chooser.php
@@ -0,0 +1,34 @@
+load->model('chooser');
+
+ // Load the data for the chooser model
+ $data = array_merge($this->ChooserModel->denyList());
+ $data += $this->ChooserModel->chooser();
+
+ // Load the view and add the data
+ $this->load->view('chooser', $data);
+ }
+
+ function _afterAction()
+ {
+
+ }
+}
+?>
\ No newline at end of file
diff --git a/system/SuperSmash/applicationchooser/controllers/index.html b/system/SuperSmash/applicationchooser/controllers/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/system/SuperSmash/applicationchooser/helpers/index.html b/system/SuperSmash/applicationchooser/helpers/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/system/SuperSmash/applicationchooser/library/index.html b/system/SuperSmash/applicationchooser/library/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/system/SuperSmash/applicationchooser/models/chooser.php b/system/SuperSmash/applicationchooser/models/chooser.php
new file mode 100644
index 0000000..fbed4ff
--- /dev/null
+++ b/system/SuperSmash/applicationchooser/models/chooser.php
@@ -0,0 +1,26 @@
+
+ 'This portal contains several websites
+ Please click on the website that you would like to visit
+
+
+
\ No newline at end of file
diff --git a/system/SuperSmash/benchmark.php b/system/SuperSmash/benchmark.php
new file mode 100644
index 0000000..3714f2c
--- /dev/null
+++ b/system/SuperSmash/benchmark.php
@@ -0,0 +1,69 @@
+start[$key] = microtime(true);
+ }
+
+ // This function will stop the specified timer
+ public function stop($key)
+ {
+ $this->stop[$key] = microtime(true);
+ }
+
+ // This function will show the specified timer
+ public function elapsed($key, $round = 3, $stop = false)
+ {
+ if(!isset($this->start[$key]))
+ {
+ return false;
+ }
+ else
+ {
+ if(!isset($this->stop[$key]) && $stop == true)
+ {
+ $this->stop[$key] = microtime(true);
+ }
+ return round((microtime(true) - $this->start[$key]), $round);
+ }
+ }
+
+ // This function will return the amount of memory the page uses while loading
+ public function usage()
+ {
+ $returnValue = '';
+ $usage = memory_get_usage(true);
+
+ if($usage < 1024)
+ {
+ $returnValue = $usage." bytes";
+ }
+ elseif($usage < 1048576)
+ {
+ $returnValue = round($usage/1024, 2)." kilobytes";
+ }
+ else
+ {
+ $returnValue = round($usage/1048576, 2)." megabytes";
+ }
+ return $returnValue;
+ }
+}
+?>
\ No newline at end of file
diff --git a/system/SuperSmash/boot/applications.php b/system/SuperSmash/boot/applications.php
new file mode 100644
index 0000000..50c7534
--- /dev/null
+++ b/system/SuperSmash/boot/applications.php
@@ -0,0 +1,135 @@
+
\ No newline at end of file
diff --git a/system/SuperSmash/boot/bootstrap.php b/system/SuperSmash/boot/bootstrap.php
new file mode 100644
index 0000000..911dd8d
--- /dev/null
+++ b/system/SuperSmash/boot/bootstrap.php
@@ -0,0 +1,25 @@
+start('system');
+
+// Load the SuperSmash Framework
+$SuperSmash = loadClass('SuperSmash');
+
+?>
\ No newline at end of file
diff --git a/system/SuperSmash/configuration.php b/system/SuperSmash/configuration.php
new file mode 100644
index 0000000..bb2d791
--- /dev/null
+++ b/system/SuperSmash/configuration.php
@@ -0,0 +1,176 @@
+load(settings::getFilePath() . DS . settings::getApp() . DS . 'configuration' . DS . 'configuration.php', 'SuperSmash');
+ }
+
+ // This function will get the specified variable from the configuration file
+ public function get($key, $type = 'SuperSmash')
+ {
+ // Check if the variable exists
+ if(isset($this->data[$type][$key]))
+ {
+ return $this->data[$type][$key];
+ }
+ return null;
+ }
+
+ // This function will return all the variables that where set in the data array
+ public function getAll($type = 'SuperSmash')
+ {
+ // Check if the variable exists
+ if(isset($this->data[$type]))
+ {
+ return $this->data[$type];
+ }
+ return null;
+ }
+
+ // This function will set a variable in the data array
+ public function set($key, $value = false, $name = 'SuperSmash')
+ {
+ // If we have array, loop through and set each
+ if(is_array($item))
+ {
+ foreach($item as $key => $value)
+ {
+ $this->data[$name][$key] = $value;
+ }
+ }
+ else
+ {
+ $this->data[$name][$item] = $value;
+ }
+ }
+
+ // This function will load a specific configuration file and will add its defined variables to the array
+ public function load($file, $name, $array = false)
+ {
+ // Include file and add it to the $files array
+ if(!file_exists($file))
+ {
+ return;
+ }
+
+ require_once ($file);
+ $this->files[$name]['filePath'] = $file;
+ $this->files[$name]['config_key'] = $array;
+
+ if($array)
+ {
+ $variables = $variables[$array];
+ }
+ else
+ {
+ $variables = get_defined_vars();
+ }
+
+ // Unset the passed variables
+ unset($variables['file'], $variables['name'], $variables['array']);
+
+ // Add the variables to the $data[$name] array
+ if(count($variables) > 0)
+ {
+ foreach($variables as $key => $value)
+ {
+ if($key != 'this' && $key != 'data')
+ {
+ $this->data[$name][$key] = $value;
+ }
+ }
+ }
+ return;
+ }
+
+ // This function will save all config variables to the config file,
+ // and makes a backup of the current config file
+ public function save($name)
+ {
+ // Convert everything to lowercase
+ $name = strtolower($name);
+
+ // Check to see if we need to put this in an array
+ $configKey = $this->files[$name]['config_key'];
+
+ if($configKey != false)
+ {
+ $Old_Data = $this->data[$name];
+ $this->data[$name] = array("$configKey" => $this->data[$name]);
+ }
+
+ // Create the new configuration file
+ $configurationContent = "data[$name] as $key => $value)
+ {
+ if(is_numeric($value))
+ {
+ $configurationContent .= "\$$key = " . $value . ";\n";
+ }
+ elseif(is_array($value))
+ {
+ $val = var_export($value, true);
+ $configurationContent .= "\$$key = " . $value . ";\n";
+ }
+ else
+ {
+ $configurationContent .= "\$$key = '" . addslashes( $value ) . "';\n";
+ }
+ }
+
+ // Close the php tag
+ $configurationContent .= "?>";
+
+ // Add the back to non array if we did put it in one
+ if($configKey != false)
+ {
+ $this->data[$name] = $Old_Data;
+ }
+
+ // Copy the current config file for backup,
+ // and write the new config values to the new config
+ copy($this->files[$name]['filePath'], $this->files[$name]['filePath'].'.bak');
+ return file_put_contents($this->files[$name]['filePath'], $configurationContent);
+ }
+
+ // This function will revert the last saved configurationFile
+ public function restore($name)
+ {
+ // Copy the backup config file nd write the config values to the current config
+ return copy($this->files[$name]['filePath'].'bak', $this->files[$name]['filePath']);
+ }
+}
+?>
\ No newline at end of file
diff --git a/system/SuperSmash/controller.php b/system/SuperSmash/controller.php
new file mode 100644
index 0000000..cec8c81
--- /dev/null
+++ b/system/SuperSmash/controller.php
@@ -0,0 +1,84 @@
+controller = $GLOBALS['controller'];
+ $this->action = $GLOBALS['action'];
+ $this->queryString = $GLOBALS['querystring'];
+
+ // Initiate the loader
+ $this->load = loadClass('Loader');
+
+ // Initiate the autoloader Helpers
+ $helpers = configuration('helpers', 'SuperSmash');
+ if(count($helpers) > 0)
+ {
+ foreach($helpers as $helper)
+ {
+ $this->load->helpers($helper);
+ }
+ }
+
+ // Intiate the autoloader Libraries
+ $libraries = configuration('libraries', 'SuperSmash');
+ if(count($libraries) > 0)
+ {
+ foreach($libraries as $library)
+ {
+ $this->load->libraries($library);
+ }
+ }
+ }
+
+ // This function will get the controller instance
+ public static function getInstance()
+ {
+ return self::$instance;
+ }
+
+ // This function will be called before an action is taken
+ public function _beforeAction()
+ {
+ // We can write some custom code here that will be taken before an action is made
+ }
+
+ // This function will be called after an action is taken
+ public function _afterAction()
+ {
+ // We can write some custom code here that will be taken after an action is made
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/system/SuperSmash/cookie.php b/system/SuperSmash/cookie.php
new file mode 100644
index 0000000..84b87dd
--- /dev/null
+++ b/system/SuperSmash/cookie.php
@@ -0,0 +1,106 @@
+ (4 * 1024))
+ {
+ trigger_error( "The cookie {$name} exceeds the specification for the maximum cookie size. Some data may be lost", E_USER_WARNING );
+ }
+ }
+
+ // Force value into superglobal
+ if ($force)
+ {
+ $_COOKIE[$name] = $value;
+ }
+
+ // Set the cookie
+ return setcookie($name, $value, (($expire) ? (time() + (int) $expire) : self::$expire), ($path) ? $path : self::$path, ($domain) ? $domain : self::$domain, ($secure) ? $secure : self::$secure, ($httponly) ? $httponly : self::$httponly);
+ }
+
+ // Check if the cookie exists
+ public static function exists($name)
+ {
+ return isset($_COOKIE[$name]);
+ }
+
+
+ // Get a cookie value
+ public static function get($name)
+ {
+ return (isset($_COOKIE[$name])) ? unserialize(base64_decode($_COOKIE[$name])) : NULL;
+ }
+
+ // Remove a cookie
+ public static function remove($name, $force = false)
+ {
+ // Check if the cookie isset
+ if (isset($_COOKIE[$name]))
+ {
+ // Remove from superglobal
+ if ($force)
+ {
+ unset($_COOKIE[$name]);
+ }
+
+ // Remove the cookie
+ return setcookie($name, '', time() - (3600 * 25), self::$path, self::$domain, self::$secure, self::$httponly);
+ }
+ }
+}
+Cookie::init();
+?>
\ No newline at end of file
diff --git a/system/SuperSmash/database.php b/system/SuperSmash/database.php
new file mode 100644
index 0000000..7c8fcc9
--- /dev/null
+++ b/system/SuperSmash/database.php
@@ -0,0 +1,852 @@
+getError();
+ *
+ * Execute a query to the database:
+ *
+ * $database->query("SELECT * FROM databaseName WHERE id = '1'";)
+ *
+ * You can also get the inserted ID of the query you executed:
+ *
+ * $insertedId = $database->insert("TABLE", "record1,record2,record3", "value1,value2,value3";)
+ * Example: INSERT INTO USERS,firstname,lastname,VALUES('Amber','Heard') WHERE ADDRESS = 'Dark avenue 2';
+ * Example: $insertedID = $database->insert("USERS","ADDRESS='Dark avenue 2','Amber',Heard'");
+ *
+ * Get the rowCount of an execute query
+ *
+ * echo $database->rowcount();
+ *
+ * Delete a row in the database
+ *
+ * $database->query("DELETE FROM USERS WHERE ID=1;");
+ *
+ * Get the affected rows affected by the delete statement
+ *
+ * $affectedRows = $database->delete("USERS", "ID=1");
+ *
+ * Update rows in the database
+ *
+ * Example: $database->query("UPDATE USERS SET firstname='Joyce' WHERE ID=1;");
+ * Example 2: $affectedRows = $database->update("USERS", "FIRSTNAME='Joyce'", "ID=1");
+ *
+ * Get the ID that was inserted last in the database
+ *
+ * $lastID = $database->getLatestId("Table","recordName");
+ *
+ * Example: $lastID = $database->getLatestId("USERS","Firstname");
+ *
+ * Create a Anti-SQL injection statement to the database
+ *
+ * $parameters = array(":id@0@INT", ":firstname@amber@STR");
+ * $ID = $database->query_secure("INSERT INTO USERS (id,firstname) VALUES(:id,:firstname);", $parameters, false);
+ * (If the last false statement in the query above is set to true the class will return the resultset of the record)
+ * (else if the last false statement in the query above is set to false you will get a true of false idenitifying if * the query was executed successfully to the database).
+ *
+ * The $ID variable will now hold the last inserted ID.
+ *
+ * Show all the table that are in your database
+ *
+ * $result = $database->ShowTables("databaseName");
+ * Example: $result = $database->ShowTables("school");
+ *
+ * Output the result to the screen in a clean way:
+ *
+ * foreach($result as $row){
+ * $i++;
+ * echo "$row[$i]" . " ";
+ *
+ * Show all the databases this class holds (get all the databases you got permissions for)
+ *
+ * $result = $database->showDatabases();
+ *
+ * Output the result to the screen in a clean way:
+ *
+ * foreach($result as $row){
+ * $i++;
+ * echo "$row[$i]" . " ";
+ *
+ * close the database connection;
+ *
+ * $database->close();
+ */
+
+class Database
+{
+
+ // Create an array with all the database types this class can connect to
+ private $database_types = array("databaselibrary", // Database Library (used by PHP)
+ "firebird", // firebird
+ "ibm", // IBM
+ "informix", // Informix
+ "mssql", // Microsoft SQL (<= 2000)
+ "mysql", // mysql
+ "odbc", // Open database connectivity (Microsoft Access)
+ "oracle", // Oracle
+ "postgre", // Postgre SQL
+ "sqlite2", // SQLite 2
+ "sqlite3", // SQLite 3
+ "sql", // Microsoft SQL
+ );
+
+ private $server; // This variable holds the host name of the server (serverName) used by the application
+ private $database; // This variable holds the databaseName of the database used by the application
+ private $user; // This variable holds the userName of the database used by the application
+ private $password; // This variable holds the password of the database used by the application
+ private $port; // This variable holds the port of the database used by the application
+ private $database_type; // This variable holds the database type of the database used by the application
+ private $root_mdb; // This variable holds the root mdb of the database used by the application
+ private $debug = false; // This variable holds the debugging state of the class
+
+ private $sql; // This variable holds all the sql connection parameters
+ private $con; // This variable holds the connection of the database used by the application
+ private $err_msg = ""; // This variable holds the error message that was trown by the database (if exists)
+
+ /**
+ * Create the constructor
+ * @param string $database_types (specify the database connection)
+ *
+ * These are the database connection that are accepted by this class:
+ *
+ * connection name - connection description
+ * --------------------------------------------
+ * databaselibrary Database Library database (used by PHP)
+ * firebird firebird database
+ * ibm IBM database
+ * informix Informix database
+ * mssql Microsoft SQL Server database (V. 2000 and lower)
+ * mysql mysql database
+ * odbc Open database connectivity (Microsoft Access)
+ * oracle Oracle database
+ * postgre postgre SQL database
+ * sqlite2 SQLite 2 database
+ * sqlite3 SQLite 3 database
+ * sql Microsoft SQL
+ *
+ * @param string $server (The server where the database is located)
+ * @param string $database (The name of the database)
+ * @param string $user (The userName of the connection to the database)
+ * @param string $password (The password of the connection to the database)
+ *
+ */
+
+ // Create the constructor and initialise the connection to the specified server
+ public function __construct($database_type,$server,$database,$user,$password,$port)
+ {
+ $this->database_type = strtolower($database_type);
+ $this->server = $server;
+ $this->database = $database;
+ $this->user = $user;
+ $this->password = $password;
+ $this->port = $port;
+ }
+
+ // initialise class and connects to the database
+ public function open()
+ {
+ if(in_array($this->database_type, $this->database_types))
+ {
+ try {
+ switch ($this->database_type)
+ {
+
+ // Database Library connection
+
+ case "databaselibrary": // default port used by database => 10060
+ $this->con = new PDO("dblib:host=".$this->server.
+ ":".$this->port.";
+ dbname=".$this->database,$this->user,$this->password
+ );
+ break;
+
+ // firebird connection
+
+ case "firebird": // default port used by database => 3050
+ $this->con = new PDO("firebird:dbname=".$this->server.
+ ":".$this->database, $this->user, $this->password
+ );
+ break;
+
+ // ibm connection
+
+ case "ibm":
+ $this->con = new PDO("ibm:DRIVER={IBM DB2 ODBC DRIVER};DATABASE=".$this->database."; HOSTNAME=".$this->host.";
+ PORT=".$this->port.";
+ PROTOCOL=TCPIP;",
+ $this->user, $this->password
+ );
+ break;
+
+ // informix connection
+
+ case "informix":
+ $this->con = new PDO("informix:DSN=InformixDB", $this->user, $this->password);
+ break;
+
+ // mssql connection
+
+ case "mssql":
+ $this->con = new PDO("mssql:host=".$this->server.";
+ dbname=".$this->database, $this->user, $this->password
+ );
+ break;
+
+ // mysql connection
+
+ case "mysql":
+ if ($this->port != "") {
+ $this->con = new PDO("mysql:host=".$this->server.";
+ port=".$this->port.";
+ dbname=".$this->database, $this->user, $this->password
+ );
+ }else{
+ $this->con = new PDO("mysql:host=".$this->server.";
+ dbname=".$this->database, $this->user, $this->password
+ );
+ }
+ break;
+
+ // open database connectivity
+
+ case "odbc":
+ $this->con = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};
+ Dbq=C:\accounts.mdb;Uid=".$this->user
+ );
+ break;
+
+ // oracle connection
+
+ case "oracle":
+ $this->con = new PDO("OCI:dbname=".$this->database.";
+ charset=UTF-8", $this->user, $this->password
+ );
+ break;
+
+ // postgre connection
+
+ case "postgre":
+
+ if($this->port!="")
+ {
+ $this->con = new PDO("pgsql:dbname=".$this->database.";
+ port=".$this->port.";
+ host=".$this->server, $this->user, $this->password
+ );
+ }
+ else
+ {
+ $this->con = new PDO("pgsql:dbname=".$this->database.";
+ host=".$this->server, $this->user, $this->password
+ );
+ }
+ break;
+
+ // sqlite2 connection
+
+ case "sqlite2":
+ $this->con = new PDO("sqlite:".$this->server);
+ break;
+
+ // sqlite3 connection
+
+ case "sqlite3":
+ $this->con = new PDO("sqlite::memory");
+ break;
+
+ // sql connection
+
+ case "sql":
+ $this->con = new PDO("sqlsrv:server=".$this->server.";
+ database=".$this->database, $this->user, $this->password
+ );
+ }
+
+ if ($this->debug)
+ {
+ $this->showDebugInformation();
+ }
+ else
+ {
+ // Create the exception that will be thrown by the PDO if there is an error
+ $this->con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ }
+ return $this->con;
+ }
+ catch(PDOException $e)
+ {
+ $this->log ("Error: ". $e->getMessage());
+ return false;
+ }
+ }
+ else
+ {
+ $this->log("The parameters that are given are invalid.
+ Possible reasons:
+ 1. The parameters that are given are invalid for the class.
+ 2. The database connection is not supported by the class.
+ Please contact the administrator of the application. => info@SuperSmash.nl"
+ );
+ return false;
+ }
+ }
+
+ private function log($message)
+ {
+ $this->err_msg = "SuperSmash Database Connection class:
+ =====================================
+ $message";
+ }
+
+ private function showDebugInformation(){
+
+ // Create the exception that will be thrown by the PDO if there is an error
+ $this->con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+ // The following extra attributes will only be shown in debugging mode
+
+ // Create the exception that will be thrown by the PDO if there is a warning
+ $this->con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+
+ // Create the exception that will be thrown by the PDO if there is an error (silent mode)
+ $this->con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
+
+ // Log all database connection information (for debugging)
+ echo "SuperSmash Database debug information:
+ ============================
";
+ echo "Status: " . $this->con->getAttribute(PDO::ATTR_CONNECTION_STATUS) . " ";
+ echo "Drivername: " . $this->con->getAttribute(PDO::ATTR_DRIVER_NAME) . " ";
+ echo "Serverversion: " . $this->con->getAttribute(PDO::ATTR_SERVER_VERSION) . " ";
+ echo "Clientversion: " . $this->con->getAttribute(PDO::ATTR_CLIENT_VERSION) . " ";
+ echo "Serverinfo: " . $this->con->getAttribute(PDO::ATTR_SERVER_INFO) . " ";
+ die();
+
+ }
+
+ // Print all the available drivers to the screen (for instant debugging off supported drivers)
+ public function drivers()
+ {
+ print_r(PDO::getAvailableDrivers());
+ }
+
+ //Execute the query to the database
+ public function query($sql_statement)
+ {
+ $this->err_msg = "";
+ if($this->con!=null)
+ {
+ try
+ {
+ $this->sql=$sql_statement;
+ return $this->con->query($this->sql);
+ }
+ catch(PDOException $e)
+ {
+ $this->log("Error: ". $e->getMessage());
+ return false;
+ }
+ }
+ else
+ {
+ $this->log("Error: Connection to database lost.");
+ return false;
+ }
+ }
+
+ //Execute queries with Anti SQL injection
+ public function query_secure($sql_statement, $params, $fetch_rows=false)
+ {
+ $this->err_msg = "";
+ if($this->con!=null)
+ {
+ $obj = $this->con->prepare($sql_statement);
+ for($i=0;$ibindParam($params_split[0], $params_split[1], PDO::PARAM_INT);
+ else
+ $obj->bindParam($params_split[0], $params_split[1], PDO::PARAM_STR);
+ }
+ try
+ {
+ $obj->execute();
+ }
+ catch(PDOException $e)
+ {
+ $this->log("Error: ". $e->getMessage());
+ return false;
+ }
+ if($fetch_rows)
+ return $obj->fetchAll();
+ if(is_numeric($this->con->lastInsertId()))
+ return $this->con->lastInsertId();
+ return true;
+ }
+ else
+ {
+ $this->log("Error: Connection to database lost.");
+ return false;
+ }
+ }
+
+ // Get the first row of a query in the database
+ public function query_first($sql_statement)
+ {
+ $this->err_msg = "";
+ if($this->con!=null)
+ {
+ try
+ {
+ $sttmnt = $this->con->prepare($sql_statement);
+ $sttmnt->execute();
+ return $sttmnt->fetch();
+ }
+ catch(PDOException $e)
+ {
+ $this->log("Error: ". $e->getMessage());
+ return false;
+ }
+ }
+ else
+ {
+ $this->log("Error: Connection to database lost.");
+ return false;
+ }
+ }
+
+ // Get the first tableCell from a query in the database
+ public function query_single($sql_statement)
+ {
+ $this->err_msg = "";
+ if($this->con!=null)
+ {
+ try
+ {
+ $sttmnt = $this->con->prepare($sql_statement);
+ $sttmnt->execute();
+ return $sttmnt->fetchColumn();
+ }
+ catch(PDOException $e)
+ {
+ $this->log("Error: ". $e->getMessage());
+ return false;
+ }
+ }
+ else
+ {
+ $this->log("Error: Connection to database lost.");
+ return false;
+ }
+ }
+
+ // Return the rowcount of a query in the database
+ public function rowcount()
+ {
+ $this->err_msg = "";
+ if($this->con!=null)
+ {
+ try
+ {
+ $stmnt_tmp = $this->stmntCount($this->sql);
+ if($stmnt_tmp!=false && $stmnt_tmp!="")
+ {
+ return $this->query_single($stmnt_tmp);
+ }
+ else
+ {
+ $this->log("Error: A few data required.");
+ return -1;
+ }
+ }
+ catch(PDOException $e)
+ {
+ $this->log("Error: ". $e->getMessage());
+ return -1;
+ }
+ }
+ else
+ {
+ $this->log("Error: Connection to database lost.");
+ return false;
+ }
+ }
+
+ // Return all the colum names in the database (as an array)
+ public function columns($table)
+ {
+ $this->err_msg = "";
+ $this->sql="Select * From $table";
+ if($this->con!=null)
+ {
+ try
+ {
+ $q = $this->con->query($this->sql);
+ $column = array();
+ foreach($q->fetch(PDO::FETCH_ASSOC) as $key=>$val)
+ {
+ $column[] = $key;
+ }
+ return $column;
+ }
+ catch(PDOException $e)
+ {
+ $this->log("Error: ". $e->getMessage());
+ return false;
+ }
+ }
+ else
+ {
+ $this->log("Error: Connection to database lost.");
+ return false;
+ }
+ }
+
+ // Insert the query and get the new ID from the database
+ public function insert($table, $data){
+ $this->err_msg = "";
+ if($this->con!=null)
+ {
+ try
+ {
+ $texto = "Insert Into $table (";
+ $texto_extra = ") Values (";
+ $texto_close = ")";
+ $data_column = explode(",", $data);
+ for($x=0;$xcon->exec("$texto $texto_extra $texto_close");
+ return $this->con->lastInsertId();
+ }
+ catch(PDOException $e)
+ {
+ $this->log("Error: ". $e->getMessage());
+ return false;
+ }
+ }
+ else
+ {
+ $this->log("Error: Connection to database lost.");
+ return false;
+ }
+ }
+
+ // Update the tables in the database
+ public function update($table, $data, $condition="")
+ {
+ $this->err_msg = "";
+ if($this->con!=null)
+ {
+ try
+ {
+ return (trim($condition)!="") ? $this->con->exec("update $table set $data where $condition") : $this->con->exec("update $table set $data");
+ }
+ catch(PDOException $e)
+ {
+ $this->err_msg = "Error: ". $e->getMessage();
+ return false;
+ }
+ }
+ else
+ {
+ $this->log("Error: Connection to database lost.");
+ return false;
+ }
+ }
+
+ // Delete a record from the database
+ public function delete($table, $condition="")
+ {
+ $this->err_msg = "";
+ if($this->con!=null)
+ {
+ try
+ {
+ return (trim($condition)!="") ? $this->con->exec("delete from $table where $condition") : $this->con->exec("delete from $table");
+ }
+ catch(PDOException $e)
+ {
+ $this->log("Error: ". $e->getMessage());
+ return false;
+ }
+ }
+ else
+ {
+ $this->log("Error: Connection to database lost.");
+ return false;
+ }
+ }
+
+ //Execute Store Procedures
+ public function execute($sp_query)
+ {
+ $this->err_msg = "";
+ if($this->con!=null)
+ {
+ try
+ {
+ $this->con->exec("$sp_query");
+ return true;
+ }
+ catch(PDOException $e)
+ {
+ $this->log("Error: ". $e->getMessage());
+ return false;
+ }
+ }
+ else
+ {
+ $this->log("Error: Connection to database lost.");
+ return false;
+ }
+ }
+
+ // Get the latest ID from the specified table in the database
+ public function getLatestId($db_table, $table_field)
+ {
+ $this->err_msg = "";
+ $sql_statement = "";
+ $dbtype = $this->database_type;
+
+ if($dbtype=="sql" || $dbtype=="mssql" || $dbtype=="ibm" || $dbtype=="databaselibrary" || $dbtype=="odbc")
+ {
+ $sql_statement = "select top 1 $table_field from $db_table order by $table_field desc";
+ }
+ if($dbtype=="oracle")
+ {
+ $sql_statement = "select $table_field from $db_table where ROWNUM<=1 order by $table_field desc";
+ }
+ if($dbtype=="informix" || $dbtype=="firebird")
+ {
+ $sql_statement = "select first 1 $table_field from $db_table order by $table_field desc";
+ }
+ if($dbtype=="mysql" || $dbtype=="sqlite2" || $dbtype=="sqlite3")
+ {
+ $sql_statement = "select $table_field from $db_table order by $table_field desc limit 1";
+ }
+ if($dbtype=="postgre")
+ {
+ $sql_statement = "select $table_field from $db_table order by $table_field desc limit 1 offset 0";
+ }
+
+ if($this->con!=null)
+ {
+ try
+ {
+ return $this->query_single($sql_statement);
+ }
+ catch(PDOException $e)
+ {
+ $this->log("Error: ". $e->getMessage());
+ return false;
+ }
+ }
+ else
+ {
+ $this->log("Error: Connection to database lost.");
+ return false;
+ }
+ }
+
+ //Get all the tables from a specified database
+ public function ShowTables($database)
+ {
+ $this->err_msg = "";
+ $complete = "";
+ $sql_statement = "";
+ $dbtype = $this->database_type;
+
+ if($dbtype=="sql" || $dbtype=="mssql" || $dbtype=="ibm" || $dbtype=="databaselibrary" || $dbtype=="odbc" || $dbtype=="sqlite2" || $dbtype=="sqlite3")
+ {
+ $sql_statement = "select name from sysobjects where xtype='U'";
+ }
+ if($dbtype=="oracle")
+ {
+ //If the query statement fail, try with uncomment the next line:
+ //$sql_statement = "SELECT table_name FROM tabs";
+ $sql_statement = "SELECT table_name FROM cat";
+ }
+ if($dbtype=="informix" || $dbtype=="firebird")
+ {
+ $sql_statement = "SELECT RDB$RELATION_NAME FROM RDB$RELATIONS WHERE RDB$SYSTEM_FLAG = 0 AND RDB$VIEW_BLR IS NULL ORDER BY RDB$RELATION_NAME";
+ }
+ if($dbtype=="mysql")
+ {
+ if($database!="")
+ {
+ $complete = " from $database";
+ }
+ $sql_statement = "show tables $complete";
+ }
+ if($dbtype=="postgre")
+ {
+ $sql_statement = "select relname as name from pg_stat_user_tables order by relname";
+ }
+
+ if($this->con!=null)
+ {
+ try
+ {
+ $this->sql=$sql_statement;
+ return $this->con->query($this->sql);
+ }
+ catch(PDOException $e)
+ {
+ $this->log("Error: ". $e->getMessage());
+ return false;
+ }
+ }
+ else
+ {
+ $this->log("Error: Connection to database lost.");
+ return false;
+ }
+ }
+
+ //Get all databases that exists on the server (and where you got permission to use them)
+ public function showDatabases()
+ {
+ $this->err_msg = "";
+ $sql_statement = "";
+ $dbtype = $this->database_type;
+
+ if($dbtype=="sql" || $dbtype=="mssql" || $dbtype=="ibm" || $dbtype=="databaselibrary" || $dbtype=="odbc" || $dbtype=="sqlite2" || $dbtype=="sqlite3")
+ {
+ $sql_statement = "SELECT name FROM sys.Databases";
+ }
+ if($dbtype=="oracle")
+ {
+ //If the query statement fail, try with uncomment the next line:
+ //$sql_statement = "select * from user_tablespaces";
+ $sql_statement = "select * from v$database";
+ }
+ if($dbtype=="informix" || $dbtype=="firebird")
+ {
+ $sql_statement = "";
+ }
+ if($dbtype=="mysql")
+ {
+ $sql_statement = "SHOW DATABASES";
+ }
+ if($dbtype=="postgre")
+ {
+ $sql_statement = "select datname as name from pg_database";
+ }
+
+ if($this->con!=null)
+ {
+ try
+ {
+ $this->sql=$sql_statement;
+ return $this->con->query($this->sql);
+ }
+ catch(PDOException $e)
+ {
+ $this->log("Error: ". $e->getMessage());
+ return false;
+ }
+ }
+ else
+ {
+ $this->log("Error: Connection to database lost.");
+ return false;
+ }
+ }
+
+ //Get the latest error ocurred in the connection
+ public function getError()
+ {
+ return trim($this->err_msg)!="" ? "".$this->err_msg." " : "";
+ }
+
+ //Disconnect from database
+ public function close()
+ {
+ $this->err_msg = "";
+ if($this->con)
+ {
+ $this->con = null;
+ return true;
+ }
+ else
+ {
+ $this->log("Error: Connection to database lost.");
+ return false;
+ }
+ }
+
+ //Build the query neccesary for the count(*) in rowcount method
+ private function stmntCount($query_stmnt)
+ {
+ if(trim($query_stmnt)!="")
+ {
+ $query_stmnt = trim($query_stmnt);
+ $query_split = explode(" ",$query_stmnt);
+ $query_flag = false;
+ $query_final = "";
+
+ for($x=0;$x
\ No newline at end of file
diff --git a/system/SuperSmash/debug.php b/system/SuperSmash/debug.php
new file mode 100644
index 0000000..c259698
--- /dev/null
+++ b/system/SuperSmash/debug.php
@@ -0,0 +1,419 @@
+logErrors = configuration('logErrors', 'SuperSmash');
+ $this->development = configuration('development', 'SuperSmash');
+
+ // Save our original settings incase we change them midscript
+ $this->originalSettings['logErrors'] = $this->logErrors;
+ $this->originalSettings['development'] = $this->development;
+
+ // Get our URL info
+ $this->urlInformation = getUrlInformation();
+ }
+
+ // This function will trigger the error
+ public function triggerError($errorNumber, $message = '', $file = '', $line = 0, $backtrace = null)
+ {
+ // Language setup
+ $this->language = strtolower(configuration('language', 'SuperSmash'));
+
+ // fill in the attributes
+ $this->errorMessage = $message;
+ $this->errorFile = $file;
+ $this->errorLine = $line;
+ $this->errorTrace = $backtrace;
+
+ // Get the error Level
+ switch($errorNumber)
+ {
+ case E_USER_ERROR:
+ $this->errorLevel = 'Error';
+ $severity = 2;
+ break;
+
+ case E_USER_WARNING:
+ $this->errorLevel = 'Warning';
+ $severity = 1;
+ break;
+
+ case E_USER_NOTICE:
+ $this->errorLevel = 'Notice';
+ $severity = 1;
+ break;
+
+ case E_ERROR:
+ $this->errorLevel = 'Error';
+ $severity = 2;
+ break;
+
+ case E_WARNING:
+ $this->errorLevel = 'Warning';
+ $severity = 1;
+ break;
+
+ case E_NOTICE:
+ $this->errorLevel = 'Notice';
+ $severity = 1;
+ break;
+
+ case E_STRICT:
+ $this->errorLevel = 'Strict';
+ $severity = 1;
+ break;
+
+ default:
+ $this->errorLevel = 'Error Code: '.$errorNumber;
+ $severity = 2;
+ break;
+ }
+
+ // Check if the error Logging is enabled
+ if ($this->logErrors)
+ {
+ $this->logError();
+ }
+
+ // Check if the error is important or the development environment is active
+ if($this->development || $severity == 2)
+ {
+ // create the error page
+ $this->createErrorPage();
+ }
+ }
+
+ // This function will show a specific error page
+ public function showError($type)
+ {
+ if (ob_get_level() != 0)
+ {
+ ob_end_clean();
+ }
+
+ // Get the language
+ $language = strtolower (configuration('language', 'SuperSmash'));
+
+ // Get the site url
+ $websiteURL = $this->urlInformation['websiteURL'];
+
+ // See if there is a custom page in the app folder
+ if(file_exists(settings::getFilePath() . DS . settings::getApp() . 'pages' . DS . $this->language . DS . $type .'.php'))
+ {
+ ob_start();
+ require_once(settings::getFilePath() . DS . settings::getApp() . 'pages' . DS . $this->language . DS . $type .'.php');
+ $page = ob_get_contents();
+ $page = str_replace("","
+
+ "
+ ,$page);
+ // Replace some footer values
+ $Benchmark = loadClass('Benchmark');
+ $page = str_replace('{elapsed}', $Benchmark->elapsed('system', 4), $page);
+ $page = str_replace('{usage}', $Benchmark->usage(), $page);
+ ob_end_clean();
+ die($page);
+ }
+ else
+ {
+ ob_start();
+ require_once(SYSTEM . DS . "SuperSmash" . DS . 'pages' . DS . $this->language . DS . $type .'.php');
+ $page = ob_get_contents();
+ $page = str_replace("","
+
+ "
+ ,$page);
+ // Replace some footer values
+ $Benchmark = loadClass('Benchmark');
+ $page = str_replace('{elapsed}', $Benchmark->elapsed('system', 4), $page);
+ $page = str_replace('{usage}', $Benchmark->usage(), $page);
+ ob_end_clean();
+ die($page);
+ }
+ }
+
+ // This function will log the error to the log file
+ protected function logError()
+ {
+
+ // Get the site url
+ $url = $this->urlInformation;
+
+ // Create the log message
+ $err_message = "| Logging started at: ". date('Y-m-d H:i:s') ."\n";
+ $err_message .= "| Error Level: ".$this->errorLevel ."\n";
+ $err_message .= "| Message: ".$this->errorMessage ."\n";
+ $err_message .= "| Reporting File: ".$this->errorFile."\n";
+ $err_message .= "| Error Line: ".$this->errorLine."\n";
+ $err_message .= "| URL When Error Occured: ". $url['websiteURL'] ."/". $url['uri'] ."\n\n";
+ $err_message .= "--------------------------------------------------------------------\n\n";
+
+ // Write to the log file
+ $log = @fopen(SYSTEM . DS . 'editable' . DS . 'logs' . DS . ERROR, 'a');
+ @fwrite($log, $err_message);
+ @fclose($log);
+ }
+
+ // This function will log the message to the debugging log
+ public function log($message, $filename = DEBUG)
+ {
+
+ // Create the log message
+ $logMessage = "(".date('Y-m-d H:i:s') .") ".$message ."\n";
+
+ // Write to the log file
+ if (file_exists(settings::getFilePath() . DS . settings::getApp() . DS . "logs"))
+ {
+ $log = @fopen(settings::getFilePath() . DS . settings::getApp() . DS . "logs" . DS . $filename, 'a');
+ }
+ else
+ {
+ $log = @fopen(SYSTEM . DS . 'editable' . DS . 'logs' . DS . $filename, 'a');
+ }
+ @fwrite($log, $logMessage);
+ @fclose($log);
+ }
+
+ // This function will enable or disable errorReporting
+ public function errorReporting($report = true)
+ {
+ if($report)
+ {
+ // Set the error reporting back to the original state
+ $this->logErrors = $this->originalSettings['logErrors'];
+ $this->development = $this->originalSettings['development'];
+ }
+ else
+ {
+ // Use the custom error reporting
+ $this->logErrors = 0;
+ $this->development = 0;
+ }
+ return true;
+ }
+
+ // This function will build the error page
+ protected function createErrorPage()
+ {
+ if (ob_get_level() != 0)
+ {
+ ob_end_clean();
+ }
+
+ // Get the site url
+ $websiteURL = $this->urlInformation['websiteURL'];
+
+ // Get the correct error message
+ ob_start();
+ if(!$this->development)
+ {
+ require_once(SYSTEM . DS . "SuperSmash" . DS . 'pages' . DS . 'error.php');
+ }
+ else
+ {
+ require_once(SYSTEM . DS . "SuperSmash" . DS . 'pages' . DS . 'debug_error.php');
+ }
+
+ $page = ob_get_contents();
+
+ // Replace some footer values
+ $Benchmark = loadClass('Benchmark');
+ $page = str_replace('{elapsed}', $Benchmark->elapsed('system', 4), $page);
+ $page = str_replace('{usage}', $Benchmark->usage(), $page);
+
+ ob_end_clean();
+
+ // If we are debugging, build the debug block
+ if($this->development)
+ {
+ // Create the regex, and search for it
+ $regex = "{DEBUG}(.*){/DEBUG}";
+ while(preg_match("~". $regex ."~iUs", $page, $match))
+ {
+ $blocks = '';
+
+ // We dont need the first trace because its in the error message
+ unset($this->errorTrace[0]);
+ $i = 1;
+
+ // Make sure we have at least 1 backtrace!
+ if(count($this->errorTrace) > 0)
+ {
+ // Loop through each level and add it to the $blocks var.
+ foreach($this->errorTrace as $key => $value)
+ {
+ $block = $match[1];
+ $block = str_replace('{#}', $key++, $block);
+
+ // Loop though each variable in the Trace level
+ foreach($value as $key => $value)
+ {
+
+ // Upper case the key
+ $key = strtoupper($key);
+
+ // If $v is an object, then go to next loop
+ if(is_object($value))
+ {
+ continue;
+ }
+
+ // If $v is an array, we need to dump it
+ if(is_array($value))
+ {
+ $value = "
\n\t\n\t", $page);
+
+ // Spit out the page
+ if(!$displayView)
+ {
+ echo $page;
+ }
+ return $page;
+ }
+ else
+ {
+ showError('view', array($viewName), E_ERROR);
+ return false;
+ }
+ }
+
+// This function will be used to call in a class from either the APP library, or the system library folders
+ public function library($name, $instance = true)
+ {
+ // Make sure periods are replaced with slahes if there is any
+ if(strpos($name, "."))
+ {
+ $name = str_replace('.', '\\', $name);
+ }
+
+ // Load the Class
+ $class = loadClass($name, 'Library');
+
+ // Do we instance this class?
+ if($instance)
+ {
+ // Allow for custom class naming
+ (!$instance) ? $name = $instance : '';
+
+ // Instance
+ $FB = getInstance();
+ if($FB)
+ {
+ (!isset($FB->$name)) ? $FB->$name = $class : '';
+ }
+ }
+ return $class;
+ }
+
+ // This function will be used to setup a database connection
+ public function database($arguments, $instance = true)
+ {
+ // Load our connection settings. We can allow custom connection arguments
+ if(!is_array($arguments))
+ {
+ // Check our registry to see if we already loaded this connection
+ $object = \Registry::singleton()->load("database".$arguments);
+ if($object != null)
+ {
+ // Skip to the instancing part unless we set instance to false
+ if($instance)
+ {
+ goto Instance;
+ }
+ return $object;
+ }
+
+ // Get the DB connection information
+ $info = configuration($arguments, 'database');
+ if($info === null)
+ {
+ showError('db_key_not_found', array($arguments), E_ERROR);
+ }
+ }
+
+ // Not in the registry, so establish a new connection
+ $dispatch = $first ."Database\\Driver";
+ $object = new $dispatch($info);
+
+ // Store the connection in the registry
+ \Registry::singleton()->store("DBC_".$arguments, $object);
+
+ // Here is our instance goto
+ Instance:
+ {
+ // If user wants to instance this, then we do that
+ if($instance && !is_numeric($arguments))
+ {
+ if($instance) $instance = $arguments;
+
+ // Easy way to instance the connection is like this
+ $FB = getInstance();
+ if($FB)
+ {
+ (!isset($FB->$instance)) ? $FB->$instance = $object : '';
+ }
+ }
+ }
+ return $object;
+ }
+
+ // This function is used to load in a helper file from either the application/helpers, or the SuperSmash/helpers folders
+ public function helper($name)
+ {
+ // Check the application/helpers folder
+ if(file_exists(settings::getFilePath() . DS . settings::getApp() . DS . 'helpers' . DS . $name . '.php'))
+ {
+ require_once(settings::getFilePath() . DS . settings::getApp() . DS . 'helpers' . DS . $name . '.php');
+ }
+ // Check the core/helpers folder
+ else
+ {
+ require_once(SYSTEM . DS . 'helpers' . DS . $name . '.php');
+ }
+ }
+}
+?>
\ No newline at end of file
diff --git a/system/SuperSmash/model.php b/system/SuperSmash/model.php
new file mode 100644
index 0000000..ba83ccf
--- /dev/null
+++ b/system/SuperSmash/model.php
@@ -0,0 +1,21 @@
+load = loadClass('Loader');
+ }
+}
+?>
diff --git a/system/SuperSmash/pages/404.php b/system/SuperSmash/pages/404.php
new file mode 100644
index 0000000..6621e90
--- /dev/null
+++ b/system/SuperSmash/pages/404.php
@@ -0,0 +1,29 @@
+
+
+
+ 404 - Not Found
+
+
+
+
+
+