fixed several login/security related sql problems, fixed dbd definitions, sai update

This commit is contained in:
Ulf Gebhardt 2013-05-16 05:28:21 +02:00
parent 925d4ce4e2
commit 6a8ae5479a
106 changed files with 132 additions and 106 deletions

View File

@ -20,13 +20,13 @@ class apiloginclass extends \SYSTEM\API\apiclass {
*/
public static function call_account_action_login($username, $password_sha, $password_md5){
return \SYSTEM\SECURITY\Security::login(new \SYSTEM\DBD\systemPostgres(), $username, $password_sha, $password_md5);}
return \SYSTEM\SECURITY\Security::login(\SYSTEM\system::getSystemDBInfo(), $username, $password_sha, $password_md5);}
public static function call_account_action_logout(){
return \SYSTEM\SECURITY\Security::logout();}
public static function call_account_action_isloggedin(){
return \SYSTEM\SECURITY\Security::isLoggedIn();}
public static function call_account_action_check($rightid){
return \SYSTEM\SECURITY\Security::check(new \SYSTEM\DBD\systemPostgres(),$rightid);}
return \SYSTEM\SECURITY\Security::check(\SYSTEM\system::getSystemDBInfo(),$rightid);}
public static function call_account_action_create($username, $password_sha, $email, $locale){
return \SYSTEM\SECURITY\Security::create(new \SYSTEM\DBD\systemPostgres(), $username, $password_sha, $email, $locale);}
return \SYSTEM\SECURITY\Security::create(\SYSTEM\system::getSystemDBInfo(), $username, $password_sha, $email, $locale);}
}

View File

@ -16,4 +16,7 @@ class config_ids {
const SYS_CONFIG_DB_USER = 14;
const SYS_CONFIG_DB_PASSWORD = 15;
const SYS_CONFIG_DB_DBNAME = 16;
const SYS_SAI_CONFIG_BASEURL = 50;
const SYS_SAI_CONFIG_NAVIMG = 51;
}

View File

@ -4,7 +4,8 @@ namespace SYSTEM\DBD;
class UserRightsTable {
const NAME = 'system_user_to_rights';
const NAME_PG = 'system.user_to_rights';
const NAME_MYS = 'system_user_to_rights';
const FIELD_USERID = 'userID';
const FIELD_RIGHTID = 'rightID';

View File

@ -4,7 +4,8 @@ namespace SYSTEM\DBD;
class UserTable {
const NAME = 'system_user';
const NAME_PG = 'system.user';
const NAME_MYS = 'system_user';
const FIELD_ID = 'id';
const FIELD_USERNAME = 'username';

View File

@ -1,10 +0,0 @@
<?php
namespace SYSTEM\SAI;
abstract class SaiModule {
public static abstract function html_js();
public static abstract function html_css();
public static abstract function html_content();
public static abstract function html_li_menu();
}

View File

@ -1,7 +1,7 @@
<?php
$autoload = SYSTEM\autoload::getInstance();
$autoload->registerFolder(dirname(__FILE__),'SYSTEM\SAI');
$autoload->registerFolder(dirname(__FILE__).'/sai','SYSTEM\SAI');
$autoload->registerFolder(dirname(__FILE__).'/page','SYSTEM\SAI');
$autoload->registerFolder(dirname(__FILE__).'/page/default_page','SYSTEM\SAI');

View File

@ -1,9 +0,0 @@
<?php
require_once 'saigui.php';
//TODO database
new \SYSTEM\LOG\DEPRECATED("database");
$sai = new \SYSTEM\SAI\saigui(/*new \DBD\system()*/ new \DBD\dasenseuser());
echo $sai->html();

View File

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -26,12 +26,12 @@ class default_page extends \SYSTEM\PAGE\Page {
\array_search($this->module, $mods) !== false){
return \call_user_func(array($this->module, 'html_content'),array($this->pg));}
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'sai/page/default_page/carousel.tpl'), array());
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'page/default_page/carousel.tpl'), array());
}
private function css(){
$result = '<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/css/libs/bootstrap.min.css').'" type="text/css" />'.
'<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/css/index.css').'" type="text/css" />';;
$result = '<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/css/libs/bootstrap.min.css').'" type="text/css" />'.
'<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/css/index.css').'" type="text/css" />';
$mods = \SYSTEM\SAI\sai::getInstance()->getModules();
if( $this->module &&
@ -42,9 +42,9 @@ class default_page extends \SYSTEM\PAGE\Page {
}
private function js(){
$result = '<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/js/libs/jquery.min.js').'" type="text/javascript"></script>'.
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/js/libs/bootstrap.min.js').'" type="text/javascript"></script>'.
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/js/index.js').'" type="text/javascript"></script>';
$result = '<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/js/libs/jquery.min.js').'" type="text/javascript"></script>'.
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/js/libs/bootstrap.min.js').'" type="text/javascript"></script>'.
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/js/index.js').'" type="text/javascript"></script>';
$mods = \SYSTEM\SAI\sai::getInstance()->getModules();
if( $this->module &&
@ -61,6 +61,7 @@ class default_page extends \SYSTEM\PAGE\Page {
$vars['js'] = $this->js();
$vars['menu'] = $this->menu();
$vars['navimg'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_NAVIMG);
//TODO
new \SYSTEM\LOG\DEPRECATED();
@ -71,6 +72,6 @@ class default_page extends \SYSTEM\PAGE\Page {
//$vars['PATH_LIB'] = SYSTEM\WEBPATH(new PLIB());
//$vars['PATH_JS'] = SYSTEM\WEBPATH(new PJS());
//$vars = array_merge($vars, SYSTEM\locale::getStrings(\SYSTEM\DBD\locale_string::VALUE_CATEGORY_DASENSE));
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'sai/page/default_page/sai.tpl'), $vars);
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'page/default_page/sai.tpl'), $vars);
}
}

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 420 KiB

After

Width:  |  Height:  |  Size: 420 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 204 B

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 783 B

After

Width:  |  Height:  |  Size: 783 B

View File

Before

Width:  |  Height:  |  Size: 363 B

After

Width:  |  Height:  |  Size: 363 B

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 233 KiB

After

Width:  |  Height:  |  Size: 233 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -3,7 +3,7 @@
$(document).ready(function() {
// initialize content
$('div#content-wrapper').load('./?action=module&module=SAI', function() {
$('div#content-wrapper').load('./?action=developer&sai_mod=SAI', function() {
$('.carousel').carousel();
});
@ -30,7 +30,7 @@ $(document).ready(function() {
});
function loadModuleContent(id){
$('div#content-wrapper').load('./?action=module&module='+id, function(){
$('div#content-wrapper').load('./?action=developer&sai_mod='+id, function(){
init();
});
}

View File

@ -1,14 +1,10 @@
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<title>da_sense | Developer Center</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" type="image/png" href="${PATH_IMG}logo.png" />
<link rel="icon" type="image/png" href="${navimg}" />
${css}
${js}
</head>
@ -17,7 +13,7 @@ and open the template in the editor.
<div id="developer-navbar" class="navbar">
<div class="navbar-inner">
<div class="brand-logo">
<img src="${PATH_IMG}logo.png" height="24" width="24">
<img src="${navimg}" height="24" width="24">
</div>
<a class="brand" href="#">developer</a>
<ul id="developer-nav" class="nav">

View File

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<title>da_sense | Developer Center</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" type="image/png" href="${navimg}" />
${css}
${js}
</head>
<body>
<div id="developer-navbar" class="navbar">
<div class="navbar-inner">
<div class="brand-logo">
<img src="${navimg}" height="24" width="24">
</div>
<a class="brand" href="#">developer</a>
</div>
</div>
<div id="content">
<div id="content-wrapper">
Not logged in or missing rights. Please login a valid account!
<form id='login' action='#' method='post' accept-charset='UTF-8'>
<fieldset>
<legend>Login</legend>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<label for='username' >UserName:</label>
<input type='text' name='username' id='username' maxlength="50" />
<label for='password' >Password:</label>
<input type='password' name='password' id='password' maxlength="50" />
<input type='submit' name='Submit' value='Submit' />
</fieldset>
</form>
</div>
<hr>
<div class="footer">
<p>&copy; <a href="http://www.da-sense.de" target="_blank">da_sense</a>, TU Darmstadt 2013</p>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,24 @@
<?php
namespace SYSTEM\SAI;
class login_page extends \SYSTEM\PAGE\Page {
public function html(){
if( isset($_POST['username']) && isset($_POST['password']) &&
\SYSTEM\SECURITY\Security::login(\SYSTEM\system::getSystemDBInfo(), $_POST['username'], sha1($_POST['password']), md5($_POST['password']))){
//TODO connection
new \SYSTEM\LOG\DEPRECATED("connection");
$default = new \SYSTEM\SAI\default_page();
return $default->html();
}
$vars = array();
$vars['js'] = '<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/css/libs/bootstrap.min.css').'" type="text/css" />'.
'<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/css/index.css').'" type="text/css" />';
$vars['css'] = '<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/js/libs/jquery.min.js').'" type="text/javascript"></script>'.
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/js/libs/bootstrap.min.js').'" type="text/javascript"></script>';
$vars['navimg'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_NAVIMG);
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'page/login_page/login.tpl'), $vars);
}
}

19
sai/sai/SaiModule.php Normal file
View File

@ -0,0 +1,19 @@
<?php
namespace SYSTEM\SAI;
abstract class SaiModule {
public static function html_js(){
throw new RuntimeException("Unimplemented!");}
public static function html_css(){
throw new RuntimeException("Unimplemented!");}
public static function html_content(){
throw new RuntimeException("Unimplemented!");}
public static function html_li_menu(){
throw new RuntimeException("Unimplemented!");}
public static function right_public(){
throw new RuntimeException("Unimplemented!");}
public static function right_right(){
throw new RuntimeException("Unimplemented!");}
}

Some files were not shown because too many files have changed in this diff Show More