renamed class DBD\locale_string to DBD\system_locale_string, qq error messae fix, qq SYS_LOG_INSERT spacing fix

This commit is contained in:
Ulf Gebhardt 2014-01-20 02:53:57 +01:00
parent b91117c927
commit 4aeddba43f
8 changed files with 35 additions and 35 deletions

View File

@ -26,6 +26,6 @@ class QP {
//override this
protected static function query(){
throw new \SYSTEM\LOG\ERROR('query function of your QQ Object not overritten!');}
throw new \SYSTEM\LOG\ERROR('query function of your QP Class not overwritten!');}
//return new QQuery();}
}

View File

@ -26,6 +26,6 @@ class QQ {
//override this
protected static function query(){
throw new \SYSTEM\LOG\ERROR('query function of your QQ Object not overritten!');}
throw new \SYSTEM\LOG\ERROR('query function of your QQ Class not overwritten!');}
//return new QQuery();}
}

View File

@ -17,14 +17,14 @@ class SYS_LOG_INSERT extends \SYSTEM\DB\QP {
'VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16);',
//mys
'INSERT INTO '.\SYSTEM\DBD\system_log::NAME_MYS.
'('.\SYSTEM\DBD\system_log::FIELD_CLASS.','.\SYSTEM\DBD\system_log::FIELD_MESSAGE.','.
\SYSTEM\DBD\system_log::FIELD_CODE.','.\SYSTEM\DBD\system_log::FIELD_FILE.','.
\SYSTEM\DBD\system_log::FIELD_LINE.','.\SYSTEM\DBD\system_log::FIELD_TRACE.','.
\SYSTEM\DBD\system_log::FIELD_IP.','.\SYSTEM\DBD\system_log::FIELD_QUERYTIME.','.
\SYSTEM\DBD\system_log::FIELD_TIME.','.\SYSTEM\DBD\system_log::FIELD_SERVER_NAME.','.
\SYSTEM\DBD\system_log::FIELD_SERVER_PORT.','.\SYSTEM\DBD\system_log::FIELD_REQUEST_URI.','.
\SYSTEM\DBD\system_log::FIELD_POST.','.\SYSTEM\DBD\system_log::FIELD_HTTP_REFERER.','.
\SYSTEM\DBD\system_log::FIELD_HTTP_USER_AGENT.','.\SYSTEM\DBD\system_log::FIELD_USER.','.
\SYSTEM\DBD\system_log::FIELD_THROWN.')'.
'VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);'
'('.\SYSTEM\DBD\system_log::FIELD_CLASS.','.\SYSTEM\DBD\system_log::FIELD_MESSAGE.','.
\SYSTEM\DBD\system_log::FIELD_CODE.','.\SYSTEM\DBD\system_log::FIELD_FILE.','.
\SYSTEM\DBD\system_log::FIELD_LINE.','.\SYSTEM\DBD\system_log::FIELD_TRACE.','.
\SYSTEM\DBD\system_log::FIELD_IP.','.\SYSTEM\DBD\system_log::FIELD_QUERYTIME.','.
\SYSTEM\DBD\system_log::FIELD_TIME.','.\SYSTEM\DBD\system_log::FIELD_SERVER_NAME.','.
\SYSTEM\DBD\system_log::FIELD_SERVER_PORT.','.\SYSTEM\DBD\system_log::FIELD_REQUEST_URI.','.
\SYSTEM\DBD\system_log::FIELD_POST.','.\SYSTEM\DBD\system_log::FIELD_HTTP_REFERER.','.
\SYSTEM\DBD\system_log::FIELD_HTTP_USER_AGENT.','.\SYSTEM\DBD\system_log::FIELD_USER.','.
\SYSTEM\DBD\system_log::FIELD_THROWN.')'.
'VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);'
);}}

View File

@ -2,7 +2,7 @@
namespace SYSTEM\DBD;
class locale_string {
class system_locale_string {
const NAME_PG = 'system.locale_string';
const NAME_MYS = 'system_locale_string';

View File

@ -12,9 +12,9 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
if(\SYSTEM\system::isSystemDbInfoPG()){
$res = $con->query('SELECT "category", COUNT(*) as "count" FROM system.locale_string GROUP BY "category" ORDER BY "category" ASC;');
$res = $con->query('SELECT "category", COUNT(*) as "count" FROM '.\SYSTEM\DBD\system_locale_string::NAME_PG.' GROUP BY "category" ORDER BY "category" ASC;');
} else {
$res = $con->query('SELECT `category`, COUNT(*) as `count` FROM system_locale_string GROUP BY `category` ORDER BY `category` ASC;');
$res = $con->query('SELECT `category`, COUNT(*) as `count` FROM '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' GROUP BY `category` ORDER BY `category` ASC;');
}
$vars['tabopts'] = '';
@ -27,9 +27,9 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
}
if(\SYSTEM\system::isSystemDbInfoPG()){
$res = $con->query('SELECT * FROM system.locale_string ORDER BY "category" ASC;');
$res = $con->query('SELECT * FROM '.\SYSTEM\DBD\system_locale_string::NAME_PG.' ORDER BY "category" ASC;');
} else {
$res = $con->query('SELECT * FROM system_locale_string ORDER BY category ASC;');
$res = $con->query('SELECT * FROM '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' ORDER BY category ASC;');
}
$langhead = '';
@ -65,9 +65,9 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
$res = null;
if(\SYSTEM\system::isSystemDbInfoPG()){
$res = $con->prepare('newText' ,'UPDATE system.locale_string SET "'.$lang.'"=$1 WHERE id=$2;', array($newtext, $id));
$res = $con->prepare('newText' ,'UPDATE '.\SYSTEM\DBD\system_locale_string::NAME_PG.' SET "'.$lang.'"=$1 WHERE id=$2;', array($newtext, $id));
} else {
$res = $con->prepare('newText' ,'UPDATE system_locale_string SET '.$lang.'=? WHERE id=?;', array($newtext, $id));
$res = $con->prepare('newText' ,'UPDATE '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' SET '.$lang.'=? WHERE id=?;', array($newtext, $id));
}
return $res->affectedRows() == 0 ? \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no rows affected")) : \SYSTEM\LOG\JsonResult::ok();
}
@ -76,9 +76,9 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
$res = null;
if(\SYSTEM\system::isSystemDbInfoPG()){
$res = $con->prepare('addText' ,'INSERT INTO system.locale_string (id, category) VALUES ($1, $2);', array($id, $category));
$res = $con->prepare('addText' ,'INSERT INTO '.\SYSTEM\DBD\system_locale_string::NAME_PG.' (id, category) VALUES ($1, $2);', array($id, $category));
} else {
$res = $con->prepare('addText' ,'INSERT INTO system_locale_string (id, category) VALUES (?, ?);', array($id, $category));
$res = $con->prepare('addText' ,'INSERT INTO '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' (id, category) VALUES (?, ?);', array($id, $category));
}
return $res->affectedRows() == 0 ? \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no data added")) : \SYSTEM\LOG\JsonResult::ok();
}
@ -91,9 +91,9 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
$res = null;
if(\SYSTEM\system::isSystemDbInfoPG()){
$res = $con->prepare('deleteText' ,'DELETE FROM system.locale_string WHERE id=$1;', array($id));
$res = $con->prepare('deleteText' ,'DELETE FROM '.\SYSTEM\DBD\system_locale_string::NAME_PG.' WHERE id=$1;', array($id));
} else {
$res = $con->prepare('deleteText' ,'DELETE FROM system_locale_string WHERE id=?;', array($id));
$res = $con->prepare('deleteText' ,'DELETE FROM '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' WHERE id=?;', array($id));
}
return $res->affectedRows() == 0 ? \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("could not delete the permitted data")) : \SYSTEM\LOG\JsonResult::ok();
}
@ -103,11 +103,11 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
$res = null;
if(\SYSTEM\system::isSystemDbInfoPG()){
$res = $con->prepare( 'edit',
'SELECT * FROM system.locale_string WHERE id = $1 ORDER BY "category" ASC;',
'SELECT * FROM '.\SYSTEM\DBD\system_locale_string::NAME_PG.' WHERE id = $1 ORDER BY "category" ASC;',
array($entry));
} else {
$res = $con->prepare( 'edit',
'SELECT * FROM system_locale_string WHERE id = ? ORDER BY "category" ASC;',
'SELECT * FROM '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' WHERE id = ? ORDER BY "category" ASC;',
array($entry));
}
if(!$r = $res->next()){

View File

@ -12,8 +12,8 @@ class saimod_sys_login extends \SYSTEM\SAI\SaiModule {
$vars['login_username_too_short'] = 'Username to short.';
$vars['login_password_too_short'] = 'Password to short.';
$vars['isadmin'] = \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI) ? "yes" : "no";
$vars = array_merge($vars, \SYSTEM\locale::getStrings(\SYSTEM\DBD\locale_string::VALUE_CATEGORY_SYSTEM_SAI));
$vars = array_merge($vars, \SYSTEM\locale::getStrings(\SYSTEM\DBD\locale_string::VALUE_CATEGORY_SYSTEM_SAI_ERROR));
$vars = array_merge($vars, \SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_SYSTEM_SAI));
$vars = array_merge($vars, \SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_SYSTEM_SAI_ERROR));
if(\SYSTEM\SECURITY\Security::isLoggedIn()){
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_login/logout.tpl'), $vars);
@ -39,8 +39,8 @@ class saimod_sys_login extends \SYSTEM\SAI\SaiModule {
}
public static function sai_mod__SYSTEM_SAI_saimod_sys_login_action_registerform(){
$vars = \SYSTEM\locale::getStrings(\SYSTEM\DBD\locale_string::VALUE_CATEGORY_SYSTEM_SAI);
$vars = array_merge($vars, \SYSTEM\locale::getStrings(\SYSTEM\DBD\locale_string::VALUE_CATEGORY_SYSTEM_SAI_ERROR));
$vars = \SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_SYSTEM_SAI);
$vars = array_merge($vars, \SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_SYSTEM_SAI_ERROR));
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_login/register.tpl'), $vars);}
public static function html_li_menu(){return '</ul><ul class="nav pull-right"><li><a href="#" saimenu=".SYSTEM.SAI.saimod_sys_login" id="sai_login_loginmenuli">'.(\SYSTEM\SECURITY\Security::isLoggedIn() ? 'Logout' : 'Login').'</a></li>';}

View File

@ -58,7 +58,7 @@ class default_page extends \SYSTEM\PAGE\Page {
$vars['title'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_TITLE); //da_sense | Developer Center
$vars['copyright'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_COPYRIGHT); //&copy; <a href="http://www.da-sense.de" target="_blank">da_sense</a>, TU Darmstadt 2013
$vars = array_merge($vars,\SYSTEM\locale::getStrings(\SYSTEM\DBD\locale_string::VALUE_CATEGORY_SYSTEM_SAI));
$vars = array_merge($vars,\SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_SYSTEM_SAI));
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'page/default_page/sai.tpl'), $vars);
}
}

View File

@ -49,29 +49,29 @@ class locale {
foreach($request as $strid){
if(!\preg_match("^[a-zA-Z0-9_]+$^", $strid) != 0){
throw new \Exception("Requested id contains inpropper symbols: ".$strid);}
$where .= 'OR '.$q.\SYSTEM\DBD\locale_string::FIELD_ID.$q.' = $1 ';
$where .= 'OR '.$q.\SYSTEM\DBD\system_locale_string::FIELD_ID.$q.' = $1 ';
}
$where = substr($where,2);
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
$res = $con->prepare( 'localeArrStmt', 'SELECT '.$q.$lang.$q.','.$q.\SYSTEM\DBD\locale_string::FIELD_ID.$q.' FROM '.(\SYSTEM\system::isSystemDbInfoPG() ? \SYSTEM\DBD\locale_string::NAME_PG : \SYSTEM\DBD\locale_string::NAME_MYS).' WHERE '.$where,
$res = $con->prepare( 'localeArrStmt', 'SELECT '.$q.$lang.$q.','.$q.\SYSTEM\DBD\system_locale_string::FIELD_ID.$q.' FROM '.(\SYSTEM\system::isSystemDbInfoPG() ? \SYSTEM\DBD\system_locale_string::NAME_PG : \SYSTEM\DBD\sytem_locale_string::NAME_MYS).' WHERE '.$where,
$request);
$result = array();
while($r = $res->next()){
$result[$r[\SYSTEM\DBD\locale_string::FIELD_ID]] = $r[$lang];}
$result[$r[\SYSTEM\DBD\system_locale_string::FIELD_ID]] = $r[$lang];}
return $result;
} else if(\intval($request)){
$cat = \intval($request);
$con = new \SYSTEM\DB\Connection( \SYSTEM\system::getSystemDBInfo());
$res = $con->prepare( 'localeStmt', 'SELECT '.$q.$lang.$q.','.$q.\SYSTEM\DBD\locale_string::FIELD_ID.$q.' FROM '.(\SYSTEM\system::isSystemDbInfoPG() ? \SYSTEM\DBD\locale_string::NAME_PG : \SYSTEM\DBD\locale_string::NAME_MYS).' WHERE '.\SYSTEM\DBD\locale_string::FIELD_CATEGORY.' = '.(\SYSTEM\system::isSystemDbInfoPG() ? '$1' : '?').';',
$res = $con->prepare( 'localeStmt', 'SELECT '.$q.$lang.$q.','.$q.\SYSTEM\DBD\system_locale_string::FIELD_ID.$q.' FROM '.(\SYSTEM\system::isSystemDbInfoPG() ? \SYSTEM\DBD\system_locale_string::NAME_PG : \SYSTEM\DBD\system_locale_string::NAME_MYS).' WHERE '.\SYSTEM\DBD\system_locale_string::FIELD_CATEGORY.' = '.(\SYSTEM\system::isSystemDbInfoPG() ? '$1' : '?').';',
array($cat));
$result = array();
while($r = $res->next()){
$result[$r[\SYSTEM\DBD\locale_string::FIELD_ID]] = $r[$lang];}
$result[$r[\SYSTEM\DBD\system_locale_string::FIELD_ID]] = $r[$lang];}
return $result;
}