Initial commit

master
NightBits 5 years ago
parent b680b82039
commit 878eda33b8

@ -0,0 +1,13 @@
<IfModule mod_rewrite.c>
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]
</IfModule>

@ -0,0 +1,2 @@
This is a test version of the upcoming SuperSmash Framework
This is a simple framework that works for everyone

Binary file not shown.

@ -0,0 +1,14 @@
RewriteEngine on
# disable directory browsing
Options All -Indexes
<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$">
Order Allow,Deny
Deny from all
</FilesMatch>
# turn off magic_quotes_gpc for PHP enabled servers
<ifmodule mod_php4.c>
php_flag magic_quotes_gpc off
</ifmodule>

@ -0,0 +1,14 @@
RewriteEngine on
# disable directory browsing
Options All -Indexes
<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$">
Order Allow,Deny
Deny from all
</FilesMatch>
# turn off magic_quotes_gpc for PHP enabled servers
<ifmodule mod_php4.c>
php_flag magic_quotes_gpc off
</ifmodule>

@ -0,0 +1 @@
deny from all

@ -0,0 +1,16 @@
<?php
$defaultController = 'introduction';
$defaultAction = 'start';
$language = 'english';
$controllerParameter = 'c';
$actionParameter = 'a';
$development = true;
$logErrors = true;
$urlParameters = false;
$sessionDatabase = false;
$libraries = array();
$helpers = array();
?>

@ -0,0 +1,11 @@
<?php
$applicationName = 'start';
$websiteTitle = 'SuperSmash framework | Start';
$webmasterEmail = 'info@SuperSmash.nl';
// Include the database configuration file
include_once ('databaseconfiguration.php');
// Include the SuperSmash framework configuration file
include_once ('SuperSmashconfiguration.php');
?>

@ -0,0 +1,10 @@
<?php
$database = array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'framework',
'username' => 'root',
'password' => '',
'port' => '3306'
);
?>

@ -0,0 +1,28 @@
<?php
class Introduction extends System\SuperSmash\Controller {
// Create the constructor
function __construct() {
parent::__construct();
}
function _beforeAction() {
}
function start() {
// Load the introduction Model
$this->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() {
}
}
?>

@ -0,0 +1,17 @@
<?php
class IntroductionModel extends System\SuperSmash\Model {
// Create the constructor
public function __construct() {
parent::__construct();
}
public function introduction() {
return array('introductionMessage' =>
'Hello and welcome to the SuperSmash Framework! <br />
This framework will help you while developing your application <br /><br />
');
}
}
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

@ -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;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
<title><?php echo configuration('websiteTitle');?></title>
<link href="<?php echo $websiteURL . "/" . "applications" . "/" . configuration('applicationName') . $viewPath;?>/images/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="<?php echo $websiteURL . "/" . "applications" . "/" . configuration('applicationName') . $viewPath;?>/css/style.css"/>
</head>
<body>
<div id="header">
<h1>
<img src="<?php echo $websiteURL . "/" . "applications" . "/" . configuration('applicationName') . $viewPath;?>/images/logo.png" alt="SuperSmash Logo" />
Welcome to the SuperSmash Framework!
<img src="<?php echo $websiteURL . "/" . "applications" . "/" . configuration('applicationName') . $viewPath;?>/images/logo.png" alt="SuperSmash Logo" />
</h1>
</div>
<div id="container">
<div id="content">
<div id="dynamic"><?php echo $introductionMessage; ?></div>
You can edit the <b>Model</b> by going here:
<pre>applications/start/models/welcome.php
</pre>
<br />
You can edit the <b>View</b> by going here:
<pre>applications/start/views/welcome.php
</pre>
<br />
You can edit the <b>Controller</b> by going here:
<pre>applications/start/controllers/welcome.php
</pre>
<br /><img src="<?php echo $websiteURL . "/" . "applications" . "/" . configuration('applicationName') . $viewPath;?>/images/mvc.png" alt="MVC Model" /><br />
</div>
</div> <br /><br />
<div id="footer">
<small>
Page rendered in {elapsed} seconds, using {usage}<br />
</small>
</div>
<!-- Show some items -->
<a target="_blank" href="http://www.HTML5.com"><img id="html5" src="<?php echo $websiteURL . "/" . "applications" . "/" . configuration('applicationName') . $viewPath;?>/images/html5.png" alt="HTML5" /></a>
<a target="_blank" href="http://twitter.com/#!/SuperSmash007"><img id="twitter" src="<?php echo $websiteURL . "/" . "applications" . "/" . configuration('applicationName') . $viewPath;?>/images/twitter.png" alt="Twitter" /></a>
</body>
</html>

@ -0,0 +1,14 @@
RewriteEngine on
# disable directory browsing
Options All -Indexes
<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$">
Order Allow,Deny
Deny from all
</FilesMatch>
# turn off magic_quotes_gpc for PHP enabled servers
<ifmodule mod_php4.c>
php_flag magic_quotes_gpc off
</ifmodule>

@ -0,0 +1,16 @@
<?php
$defaultController = 'login';
$defaultAction = 'start';
$language = 'english';
$controllerParameter = 'c';
$actionParameter = 'a';
$development = false;
$logErrors = true;
$urlParameters = false;
$sessionDatabase = false;
$libraries = array();
$helpers = array();
?>

@ -0,0 +1,12 @@
<?php
$applicationName = 'taskmanager';
$websiteTitle = 'SuperSmash Taskmanager';
$webmasterEmail = 'info@SuperSmash.nl';
$useDatabase = true;
// Include the database configuration file
include_once ('databaseconfiguration.php');
// Include the SuperSmash framework configuration file
include_once ('SuperSmashconfiguration.php');
?>

@ -0,0 +1,10 @@
<?php
$database = array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'taskmanager',
'username' => 'root',
'password' => '',
'port' => '3306'
);
?>

@ -0,0 +1,39 @@
<?php
class Login extends System\SuperSmash\Controller {
// Create the constructor
function __construct() {
parent::__construct();
}
function _beforeAction() {
}
function start($error = false) {
// Load the login Model
$this->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() {
}
}
?>

@ -0,0 +1,58 @@
<?php
class LoginModel extends System\SuperSmash\Model {
// Create the constructor
public function __construct() {
parent::__construct();
}
public function login($error = false) {
$array = array('loginMessage' =>
'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);
}
}
?>

@ -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;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<title><?php echo configuration('websiteTitle');?></title>
<link href="<?php echo $websiteURL . "/" . "applications" . "/" . configuration('applicationName') . $viewPath;?>/images/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="<?php echo $websiteURL . "/" . "applications" . "/" . configuration('applicationName') . $viewPath;?>/css/login.css"/>
</head>
<body>
<div id="header">
<br/><br/><h1>SuperSmash Task manager</h1>
</div>
<div id="container">
<div id="content">
<form action="<?php echo "$websiteURL/login/check"; ?>" method="post">
<div id="login-box">
<?php echo $loginMessage; ?>
<br />
<?php if(isset($errorMessage)) echo "<font color=\"red\">" . $errorMessage . "</font><br />"; ?>
<div id="login-box-username" style="margin-top:20px;">Username:</div>
<div id="login-box-usernamefield" style="margin-top:20px;">
<input name="username" class="form-login" title="Username" value="" size="30" maxlength="50" />
</div>
<div id="login-box-password">Password:</div>
<div id="login-box-passwordfield">
<input name="password" type="password" class="form-login" title="Password" value="" size="30" maxlength="50" />
</div>
<br />
<span class="login-box-options"><input type="checkbox" name="1" value="1"> Remember Me <a href="forget.php" style="margin-left:30px;">Forgot password?</a>
<br />
<br />
</span>
<button class="loginButton" type="submit">&nbsp;</button>
</div>
</form>
</div>
</div>
<div id="footer"></div>
</body>
</html>

@ -0,0 +1,22 @@
<?php
/**************************************/
/**** SuperSmash Framework ****/
/**** Created By SuperSmash ****/
/**** Started on: 25-04-2012 ****/
/**************************************/
use settings\settings;
// We need to include all the custom editable settings // PLEASE DO NOT EDIT ANYTHING BUT FRAMEWORK CONTENT INSIDE THIS FOLDER !!!
require_once("system/editable/constants.php");
// We need to include all the available applications that are using the SuperSmash Framework
require_once ("system/SuperSmash/boot/applications.php");
// We need to bootstrap the SuperSmash Framework
require_once("system/SuperSmash/boot/bootstrap.php");
// Finally we need to start the SuperSmash Framework
$SuperSmash->start();
?>

@ -0,0 +1,108 @@
<?php
/**************************************/
/**** SuperSmash Framework ****/
/**** Created By SuperSmash ****/
/**** Started on: 25-04-2012 ****/
/**************************************/
namespace system\SuperSmash;
use settings\settings;
if (!defined("SUPERSMASH_FRAMEWORK")){die("You cannot access this page directly!");}
class SuperSmash
{
protected $Router;
protected $dispatch;
public static $database;
// This function will start the SuperSmash Framework
public function start()
{
// initialise the router
$this->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;
}
}
?>

@ -0,0 +1,14 @@
RewriteEngine on
# disable directory browsing
Options All -Indexes
<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$">
Order Allow,Deny
Deny from all
</FilesMatch>
# turn off magic_quotes_gpc for PHP enabled servers
<ifmodule mod_php4.c>
php_flag magic_quotes_gpc off
</ifmodule>

@ -0,0 +1,16 @@
<?php
$defaultController = 'chooser';
$defaultAction = 'start';
$language = 'english';
$controllerParameter = 'c';
$actionParameter = 'a';
$development = true;
$logErrors = true;
$urlParameters = true;
$sessionDatabase = false;
$libraries = array();
$helpers = array();
?>

@ -0,0 +1,11 @@
<?php
$applicationName = 'applicationChooser';
$websiteTitle = 'Choose your website';
$webmasterEmail = 'info@SuperSmash.nl';
// Include the database configuration file
include_once ('databaseconfiguration.php');
// Include the SuperSmash framework configuration file
include_once ('SuperSmashconfiguration.php');
?>

@ -0,0 +1,10 @@
<?php
$database = array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'framework',
'username' => 'root',
'password' => '',
'port' => '3306'
);
?>

@ -0,0 +1,34 @@
<?php
class Chooser extends system\SuperSmash\Controller
{
// Create the constructor
function __construct()
{
parent::__construct();
}
function _beforeAction()
{
}
function start()
{
// Load the chooser Model
$this->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()
{
}
}
?>

@ -0,0 +1,26 @@
<?php
class ChooserModel extends system\SuperSmash\Model
{
// Create the constructor
public function __construct()
{
parent::__construct();
}
public function chooser()
{
return array('chooserMessage' =>
'This portal contains several websites <br />
Please click on the website that you would like to visit <br /><br />
');
}
public function denyList()
{
return array('denyList' =>
'.htaccess');
}
}
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

@ -0,0 +1,93 @@
body
{
margin:0 auto;
}
h1 {
font-family: SuperSmash, serif;
text-transform: uppercase;
letter-spacing: 1px;
padding:10px;
}
#container
{
width:600px;
margin: 0 auto;
background: gray;
border: 1px solid #999;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
}
.button{
font-size:16px;
font-family:Arial,sans-serif;
height:100px;
width:100px;
border-width:0px;
cursor:pointer;
}
#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: white;
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;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<title><?php echo configuration('websiteTitle');?></title>
<link href="<?php echo $websitePath . $viewPath;?>/images/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="<?php echo $websitePath . $viewPath;?>/css/style.css"/>
</head>
<body style="background:transparent url(<?php echo $websitePath . $viewPath;?>/images/background.png) scroll; background-color:#0a0a0a; text-align:center; margin:0px; padding:0px;">
<div id="header"></div>
<div id="container">
<div id="content">
<div id="dynamic"><?php echo $chooserMessage; ?></div>
<?php
foreach ($applications as &$application){
$application = str_replace(" ", "&nbsp", $application);
// Check if there is an application in the denyList
if (strlen(strstr($denyList,$application))>0)
{
continue;
}
echo " <form action=\"$websiteURL/index.php\" method=\"POST\">";
if (file_exists(ROOT . "/applications/$application/portal.png")){
echo "<button class=\"button\" name=\"changepage\" type=\"submit\" style=\"background-color:transparent; background-image:url($websiteURL/applications/" . "$application" . "/portal.png)\" value=\"$application\" title=\"$application\"></button>";
} else {
echo "<button class=\"button\" name=\"changepage\" type=\"submit\" style=\"background-color:transparent; background-image:url($websitePath/portal.png)\" value=\"$application\" title=\"$application\"></button>";
}
echo " <br />$application
</form>
<br />";
};
?>
</div>
</div> <br /><br />
<div id="footer">
<small>
Page rendered in {elapsed} seconds, using {usage}<br />
</small>
</div>
</body>
</html>

@ -0,0 +1,69 @@
<?php
/**************************************/
/**** SuperSmash Framework ****/
/**** Created By SuperSmash ****/
/**** Started on: 25-04-2012 ****/
/**************************************/
namespace system\SuperSmash;
if (!defined("SUPERSMASH_FRAMEWORK")){die("You cannot access this page directly!");}
class Benchmark
{
// Create the arrays that holds the timers
protected $start = array();
protected $stop = array();
// This function will start a new timer
public function start($key)
{
$this->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;
}
}
?>

@ -0,0 +1,135 @@
<?php
/**************************************/
/**** SuperSmash Framework ****/
/**** Created By SuperSmash ****/
/**** Started on: 25-04-2012 ****/
/**************************************/
namespace settings;
// Define the directory seperator (Check for Linux or Windows)
$operatingSystem = PHP_OS;
switch($operatingSystem)
{
case "Linux": define("DS", "/"); break;
case "Windows": define("DS", "\\"); break;
default: define("DS", "/"); break;
}
// Define the root path
define('ROOT', dirname(dirname(dirname(dirname(__FILE__)))));
class settings
{
private static $application;
private static $applications = array();
private static $filePath;
private static $applicationPath;
static function getApplicationPath()
{
return self::$applicationPath;
}
static function getFilePath()
{
return self::$filePath;
}
static function getApps()
{
return self::$applications;
}
static function getApp()
{
return self::$application;
}
static function setApps($value)
{
self::$applications = $value;
}
static function set($value)
{
if ($value == "applicationchooser")
{
self::$filePath = ROOT . DS . "system" . DS . 'SuperSmash';
self::$applicationPath = DS . "system" . DS . 'SuperSmash';
}
else
{
self::$filePath = ROOT . DS . "applications";
self::$applicationPath = DS . "applications";
}
self::$application = $value;
if (!is_dir(self::$filePath . DS . self::$application))
{
self::$filePath = ROOT . DS . "system" . DS . 'SuperSmash';
self::$applicationPath = DS . "system" . DS . 'SuperSmash';
self::$application = "applicationchooser";
}
}
}
// Create a constant for the debug FileName
define("DEBUG", $debugLog);
// Create a constant for the error FileName
define("ERROR", $errorLog);
// Scan all the available applications
$temporary = scandir(ROOT . DS . "applications");
$applications = array();
foreach ($temporary as $application)
{
if ($application == "." || $application == "..")
continue;
array_push($applications, $application);
}
settings::setApps($applications);
require_once(dirname(dirname(dirname(__FILE__))) . DS . "SuperSmash" . DS . "cookie.php");
if (isset($_POST['changepage']))
{
ob_start();
include dirname(__FILE__) . DS . "SuperSmash" . DS . "applicationchooser" . DS . "configuration" . DS . "SuperSmashconfiguration.php";
ob_end_clean();
if (isset($sessionDatabase))
{
$_SESSION['changedPage'] = $_POST['changepage'];
}
else
{
\system\SuperSmash\Cookie::set("changedPage", $_POST['changepage'], false, 3600);
header("Location: index.php");
}
}
if (\system\SuperSmash\Cookie::exists("changedPage"))
{
settings::set(\system\SuperSmash\Cookie::get("changedPage"));
}
else if (isset($_SESSION['changedPage']))
{
settings::set($_SESSION['changedPage']);
}
else if ($applicationChooser)
{
settings::set("applicationchooser");
}
// Define the system path
define('SYSTEM', ROOT . DS . 'system');
// Define the access variable
define('SUPERSMASH_FRAMEWORK', true);
// Load the default application
if (!$applicationChooser)
{
settings::set($applications[$applicationNumber]);
}
?>

@ -0,0 +1,25 @@
<?php
/**************************************/
/**** SuperSmash Framework ****/
/**** Created By SuperSmash ****/
/**** Started on: 25-04-2012 ****/
/**************************************/
// Require the global settings
require (SYSTEM . DS . 'SuperSmash' . DS . 'global.php');
// Require the registry
require (SYSTEM . DS . 'SuperSmash' . DS . 'registry.php');
// Register the SuperSmash framework to process errors through a custom error handling system
set_error_handler( 'errorHandler' , E_ALL | E_STRICT );
// Initiate the system start time
$Benchmark = loadClass('Benchmark');
$Benchmark->start('system');
// Load the SuperSmash Framework
$SuperSmash = loadClass('SuperSmash');
?>

@ -0,0 +1,176 @@
<?php
/**************************************/
/**** SuperSmash Framework ****/
/**** Created By SuperSmash ****/
/**** Started on: 25-04-2012 ****/
/**************************************/
namespace system\SuperSmash;
use settings\settings;
if (!defined("SUPERSMASH_FRAMEWORK")){die("You cannot access this page directly!");}
class Configuration {
// This array will hold all the settings
protected $data = array();
// Create the constructor
public function __construct()
{
// Load the default configuration file
$this->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 = "<?php\n\n";
$configurationContent .= "
/**************************************/
/**** SuperSmash Framework ****/
/**** Created By SuperSmash ****/
/**** Started on: 25-04-2012 ****/
/**************************************/
/**** This file has been generated ****/
/***** by the SuperSmash Framework ****/
/**************************************/
\n\n
";
// Loop through each var and write it
foreach($this->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']);
}
}
?>

@ -0,0 +1,84 @@
<?php
/**************************************/
/**** SuperSmash Framework ****/
/**** Created By SuperSmash ****/
/**** Started on: 25-04-2012 ****/
/**************************************/
namespace system\SuperSmash;
if (!defined("SUPERSMASH_FRAMEWORK")){die("You cannot access this page directly!");}
class Controller
{
// This variable will hold the controllerName
public $controller;
// This variable will hold the action taken
public $action;
// This variable will hold the queryString
public $queryString;
// This variable will hold the queryString
public static $database;
// This variable will hold the instance of the class
private static $instance;
// Create the constructor
public function __construct()
{
// Set the instance of the controller