BUG 9649 "Uso de palabras reservadas en la creacion de PM Tables." SOLVED

- In the creation/editing of PMTables/ReportTables, not validated the
  use of reserved words
- It has validated the use of keywords in the creation/editing of
  PMTables/ReportTables
- It has been validated using reserved words to importing a process with
  ReportTables (old version)
* Available from version 2.0.44
This commit is contained in:
Victor Saisa Lopez
2012-09-04 12:40:47 -04:00
parent ba1fab77dd
commit 68509275f3
3 changed files with 148 additions and 25 deletions

View File

@@ -235,6 +235,8 @@ class pmTablesProxy extends HttpProxyController
'protected', 'public', 'static', 'switch', 'xor', 'try', 'use', 'var', 'while'
);
$reservedWordsSql = G::reservedWordsSql();
// verify if exists.
if ($data['REP_TAB_UID'] == '' || (isset($httpData->forceUid) && $httpData->forceUid)) {
//new report table
@@ -249,16 +251,23 @@ class pmTablesProxy extends HttpProxyController
throw new Exception(G::loadTranslation('ID_PMTABLE_ALREADY_EXISTS', array($data['REP_TAB_NAME'])));
}
if (in_array(strtoupper($data['REP_TAB_NAME']), $reservedWords)) {
throw new Exception(G::loadTranslation('ID_PMTABLE_INVALID_NAME', array($data['REP_TAB_NAME'])));
if (in_array(strtoupper($data["REP_TAB_NAME"]), $reservedWords) ||
in_array(strtoupper($data["REP_TAB_NAME"]), $reservedWordsSql)
) {
throw (new Exception(G::LoadTranslation("ID_PMTABLE_INVALID_NAME", array($data["REP_TAB_NAME"]))));
}
}
//backward compatility
foreach ($columns as $i => $column) {
if (in_array(strtolower($columns[$i]->field_name), $reservedWordsPhp)) {
throw new Exception(G::loadTranslation('ID_PMTABLE_INVALID_NAME', array($columns[$i]->field_name)));
if (in_array(strtoupper($columns[$i]->field_name), $reservedWordsSql) ||
in_array(strtolower($columns[$i]->field_name), $reservedWordsPhp)
) {
throw (new Exception(
G::LoadTranslation("ID_PMTABLE_INVALID_FIELD_NAME", array($columns[$i]->field_name))
));
}
switch ($column->field_type) {
case 'INT': $columns[$i]->field_type = 'INTEGER';
break;