some minor fixes in the saimods, system includes are now relative to the configurated systempath.

This commit is contained in:
Ulf Gebhardt 2013-08-01 14:41:04 +02:00
parent 020ff7b534
commit 45c3939c57
12 changed files with 36 additions and 65 deletions

View File

@ -4,7 +4,7 @@ namespace SYSTEM\LOG;
//Register this before every other handler, cuz this will need to handle every single error.
//And only the first ErrorHandler will be called if he returns true in CALL.
abstract class error_handler_dbwriter extends \SYSTEM\LOG\error_handler {
class error_handler_dbwriter extends \SYSTEM\LOG\error_handler {
public static function CALL(\Exception $E, $errno, $thrown){
try{
if(\SYSTEM\system::isSystemDbInfoPG()){
@ -14,13 +14,13 @@ abstract class error_handler_dbwriter extends \SYSTEM\LOG\error_handler {
'VALUES ($1, $2, $3, $4, $5, $6, $7, $8);',
array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(),
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5)));
} else {
} else {
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
$con->prepare( 'sysLogStmt', 'INSERT INTO system_log '.
'(class, message, code, file, line, trace, ip, querytime) '.
'VALUES (?, ?, ?, ?, ?, ?, ?, ?);',
'(class, message, code, file, line, trace, ip, querytime, time) '.
'VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);',
array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(),
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5)));
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5),microtime(true)));
}
} catch (\Exception $E){} //Error -> Ignore

View File

@ -27,9 +27,9 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
}
while($r = $res->next()){
$result .= '<tr>'.'<td>'.$r["id"].'<br><input type="submit" value="delete" delete_ID="'.$r["id"].'">'.'</td>'.'<td>'.$r["category"].'</td>';
$result .= '<tr>'.'<td>'.$r["id"].'<br><input type="submit" class="btn-danger" value="delete" delete_ID="'.$r["id"].'">'.'</td>'.'<td>'.$r["category"].'</td>';
foreach ($languages as $columns){
$result .= '<td>'.$r[$columns].'<br><input type="submit" value="edit" lang="'.$columns.'" edit_ID="'.$r["id"].'">'.'</td>';
$result .= '<td>'.$r[$columns].'<br><input type="submit" class="btn" value="edit" lang="'.$columns.'" edit_ID="'.$r["id"].'">'.'</td>';
}
$result .= '</tr>';
@ -41,7 +41,7 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
return $result;
}
public static function html_li_menu(){return '<li><a href="#" id=".SYSTEM.SAI.saimod_sys_locale">Locale</a></li>';}
public static function html_li_menu(){return '<li><a href="#" id=".SYSTEM.SAI.saimod_sys_locale">DB Text</a></li>';}
public static function right_public(){return false;}
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\system::getSystemDBInfo(), \SYSTEM\SECURITY\RIGHTS::SYS_SAI);}

View File

@ -1,3 +1,3 @@
function init__SYSTEM_SAI_saimod_sys_locale() {
alert("huhu");
//alert("huhu");
}

View File

@ -43,9 +43,12 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
$result = '<div id="table-wrapper"><table class="table table-hover table-condensed" style="overflow: auto;">'.
'<tr>'.'<th>'.'time ago in sec'.'</th>'.'<th>'.'time'.'</th>'.'<th>'.'class'.'</th>'.'<th>'.'message'.'</th>'.'<th>'.'code'.'</th>'.'<th>'.'file'.'</th>'.'<th>'.'line'.'</th>'.'<th>'.'ip'.'</th>'.'<th>'.'querytime'.'</tr>';
while($r = $res->next()){
$result .= '<tr class="'.self::tablerow_class($r['class']).'">'.'<td>'.(int)($now - strtotime($r['time'])).'</td>'.'<td>'.$r['time'].'</td>'.'<td>'.$r['class'].'</td>'.'<td>'.$r['message'].'</td>'.'<td>'.$r['code'].'</td>'.'<td style="word-break: break-all;">'.$r['file'].'</td>'.'<td>'.$r['line'].'</td>'.'<td>'.$r['ip'].'</td>'.'<td>'.$r['querytime'].'</td>'.'</tr>';
//TODO make time conversion on database
if(\SYSTEM\system::isSystemDbInfoPG()){
$result .= '<tr class="'.self::tablerow_class($r['class']).'">'.'<td>'.(int)($now - strtotime($r['time'])).'</td>'.'<td>'.$r['time'].'</td>'.'<td>'.$r['class'].'</td>'.'<td>'.$r['message'].'</td>'.'<td>'.$r['code'].'</td>'.'<td style="word-break: break-all;">'.$r['file'].'</td>'.'<td>'.$r['line'].'</td>'.'<td>'.$r['ip'].'</td>'.'<td>'.$r['querytime'].'</td>'.'</tr>';
} else {
$result .= '<tr class="'.self::tablerow_class($r['class']).'">'.'<td>'.(int)($now - $r['time']).'</td>'.'<td>'.$r['time'].'</td>'.'<td>'.$r['class'].'</td>'.'<td>'.$r['message'].'</td>'.'<td>'.$r['code'].'</td>'.'<td style="word-break: break-all;">'.$r['file'].'</td>'.'<td>'.$r['line'].'</td>'.'<td>'.$r['ip'].'</td>'.'<td>'.$r['querytime'].'</td>'.'</tr>';
}
}
$result .= '</table></div>';

View File

@ -1,6 +1,7 @@
Please login for developer access.
</br>
<div class="masthead">
<h3 class="muted">Login / Register</h3>
<h4 class="text-info">Please login for developer access (if you are a developer).</a></h4>
</div>
<form class="textbox" style="padding:10px" id="login_form">
<div class="control-group">
<div class="controls">
@ -29,4 +30,6 @@ Please login for developer access.
type="submit"
id="login_submit">${login}</button>
</div>
</form>
</form>
<a href="#" id="register_link">Register an Account</a></br>
<a href="#" id="password_link">Can't really remember your Password?</a>

View File

@ -1,32 +0,0 @@
Please login for developer access.
</br>
<form class="textbox" style="padding:10px" id="login_form">
<div class="control-group">
<div class="controls">
<input type="text"
size="30"
style="margin-bottom: 15px;"
id="bt_login_user"
placeholder="${loginUsername}"
minlength="3" data-validation-minlength-message="${login_username_too_short}"
maxlength="16" data-validation-maxlength-message="${login_username_too_long}"
required data-validation-required-message="${login_username_required}"/>
</div>
<div class="controls">
<input type="password"
size="30"
style="margin-bottom: 15px;"
id="bt_login_password"
placeholder="${loginPassword}"
minlength="5" data-validation-minlength-message="${login_password_too_short}"
maxlength="16" data-validation-maxlength-message="${login_password_too_short}"
required data-validation-required-message="${login_password_required}"/>
</div>
<div class="help-block"></div>
<input type="hidden" />
<button class="btn btn-primary" style="clear: left; height: 32px; font-size: 13px;"
type="submit"
id="login_submit">${login}</button>
</div>
</form>

View File

@ -1,6 +1,7 @@
You are logged in
</br>
<div class="masthead">
<h3 class="muted">Logout</h3>
<h4 class="text-info">You are logged in</a></h4>
</div>
<form class="textbox" style="padding:10px" id="logout_form">
<div class="control-group">
<div class="help-block"></div>

View File

@ -24,7 +24,7 @@ class saimod_sys_mod extends \SYSTEM\SAI\SaiModule {
return $result;
}
public static function html_li_menu(){return '<li><a href="#" id=".SYSTEM.SAI.saimod_sys_mod">Mods</a></li>';}
public static function html_li_menu(){return '<li><a href="#" id=".SYSTEM.SAI.saimod_sys_mod">SAI Mods</a></li>';}
public static function right_public(){return false;}
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\system::getSystemDBInfo(), \SYSTEM\SECURITY\RIGHTS::SYS_SAI);}

View File

@ -1,6 +1,6 @@
<div class="masthead">
<h3 class="muted">Design.Simple.Fast.Reliable.Innovative.</h3>
<h4 class="text-info">We write awesome code.</h4>
<h4 class="text-info">We write awesome code and we use <a href="http://getbootstrap.com/">Twitter Bootstrap.</a></h4>
</div>
<br>
<div id="myCarousel" class="carousel slide">

View File

@ -16,7 +16,7 @@ class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
$result = '<table class="table table-hover table-condensed" style="overflow: auto;">'.
'<tr>'.'<th>'.'ID'.'</th>'.'<th>'.'Username'.'</th>'.'<th>'.'E-Mail'.'</th>'.'<th>'.'JoinDate'.'</th>'.'<th>'.'Locale'.'</th>'.'<th>'.'Last Active'.'</th>'.'<th>'.'Flag'.'</th>'.'<th style="width: 110px;">'.'Rights'.'</th><th>reset password</th>'.'</tr>';
while($r = $res->next()){
$result .= '<tr class="'.self::tablerow_class($r['last_active']).'">'.'<td>'.$r['id'].'</td>'.'<td>'.$r['username'].'</td>'.'<td>'.$r['email'].'</td>'.'<td>'.$r['joindate'].'</td>'.'<td>'.$r['locale'].'</td>'.'<td>'.$r['last_active'].'</td>'.'<td>'.$r['account_flag'].'</td>'.'<td>'.'<input type="submit" class="btn" value="edit" user="'.$r['id'].'" action="edit"><input type="submit" class="btn-danger" value="delete" user="'.$r['id'].'" action="delete"></td><td><button type="submit" class="btn" value="reset_password" user="'.$r['id'].'" email="'.$r['email'].'">send</button>'.'</td>'.'</tr>';
$result .= '<tr class="'.self::tablerow_class($r['last_active']).'">'.'<td>'.$r['id'].'</td>'.'<td>'.$r['username'].' <input type="submit" class="btn-danger" value="delete" user="'.$r['id'].'" action="delete">'.'</td>'.'<td>'.$r['email'].'</td>'.'<td>'.$r['joindate'].'</td>'.'<td>'.$r['locale'].'</td>'.'<td>'.$r['last_active'].'</td>'.'<td>'.$r['account_flag'].'</td>'.'<td>'.'<input type="submit" class="btn" value="edit" user="'.$r['id'].'" action="edit"><input type="submit" class="btn-danger" value="delete" user="'.$r['id'].'" action="delete"></td><td><button type="submit" class="btn" value="reset_password" user="'.$r['id'].'" email="'.$r['email'].'">send EMail</button>'.'</td>'.'</tr>';
}
$result .= '</table>';
return $result;

View File

@ -134,7 +134,7 @@ class Security {
return self::LOGIN_FAIL;}
// set password_sha if it is empty or if it length is < 40 -> SHA1 Androidappbugfix
if(!$row[\SYSTEM\DBD\UserTable::FIELD_PASSWORD_SHA] ||strlen($row[\SYSTEM\DBD\UserTable::FIELD_PASSWORD_SHA]) < 40){
if(!$row[\SYSTEM\DBD\UserTable::FIELD_PASSWORD_SHA] || strlen($row[\SYSTEM\DBD\UserTable::FIELD_PASSWORD_SHA]) < 40){
if($password_sha_new != NULL){
$pw = $password_sha_new;

View File

@ -35,19 +35,15 @@ class system {
public static function isSystemDbInfoPG(){
return (\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_TYPE) == \SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_TYPE_PG);}
public static function include_ExceptionShortcut(){
require_once 'system/log/register_exception_shortcut.php';
}
public static function include_ExceptionShortcut(){
require_once \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_SYSTEMPATHREL).'/log/register_exception_shortcut.php';}
public static function include_ResultShortcut(){
require_once 'system/log/register_result_shortcut.php';
}
require_once \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_SYSTEMPATHREL).'/log/register_result_shortcut.php';}
public static function register_errorhandler_jsonoutput(){
require_once 'system/log/register_errorhandler_jsonoutput.php';
}
require_once \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_SYSTEMPATHREL).'/log/register_errorhandler_jsonoutput.php';}
public static function register_errorhandler_dbwriter(){
require_once 'system/log/register_errorhandler_dbwriter.php';
}
public static function register_errorhandler_dbwriter(){
require_once \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_SYSTEMPATHREL).'/log/register_errorhandler_dbwriter.php';}
}