Fixes for DB IO, DB general functions, JS core updates

DB IO
- Update/Select/Insert checks are sane now and not reverse
- UPDATE can now use RETURNING
- meta table check in postgresql is supressing warning for not existing
table and just returns false

JS (edit)
- update for the html element creation functions

Basic:
- SITE LANG settings added to change default lang based on vhost
- log file id is now set more lienient via globals and not with a global
constant

DB Tables/Functions:
- fix wrong general function and set uid function was missing
This commit is contained in:
Clemens Schwaighofer
2018-09-27 17:06:32 +09:00
parent b2f5d439d5
commit c6a15506c5
8 changed files with 93 additions and 30 deletions

View File

@@ -97,6 +97,9 @@ print "DIRECT MULTIPLE INSERT STATUS: $status | PRIMARY KEYS: ".print_r($basic->
// no returning, but not needed ;
$status = $basic->dbExec("INSERT INTO foo (test) VALUES ('FOO; TEST ".time()."');");
print "DIRECT INSERT STATUS: $status | PRIMARY KEY: ".$basic->insert_id." | PRIMARY KEY EXT: ".print_r($basic->insert_id_ext, 1)."<br>";
// UPDATE WITH RETURNING
$status = $basic->dbExec("UPDATE foo SET test = 'SOMETHING DIFFERENT' WHERE foo_id = 3688452 RETURNING test");
print "UPDATE STATUS: $status | RETURNING EXT: ".print_r($basic->insert_id_ext, 1)."<br>";
# db write class test
$table = 'foo';

View File

@@ -32,7 +32,7 @@ if ($_SESSION['DEFAULT_CHARSET']) {
if ($_SESSION['DEFAULT_LANG']) {
$lang = $_SESSION['DEFAULT_LANG'];
} elseif (!$lang) {
$lang = DEFAULT_LANG;
$lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;;
}
// create the char lang encoding
$lang_short = substr($lang, 0, 2);
@@ -108,8 +108,8 @@ if (!is_dir($cms->cache_pictures)) {
// if the template_dir is != DEFAULT_TEMPLATE, then try to make a lang switch
// if the default lang is not like the lang given, switch lang
if (false === strstr(LAYOUT.DEFAULT_TEMPLATE.LANG, $cms->lang_dir) || strcasecmp(DEFAULT_LANG, $lang)) {
$cms->debug('LANG', 'Orig: '.LAYOUT.DEFAULT_TEMPLATE.LANG.', New: '.$cms->lang_dir.' | Orig Lang: '.DEFAULT_LANG.', New Lang: '.$lang);
if (false === strstr(LAYOUT.DEFAULT_TEMPLATE.LANG, $cms->lang_dir) || strcasecmp(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;, $lang)) {
$cms->debug('LANG', 'Orig: '.LAYOUT.DEFAULT_TEMPLATE.LANG.', New: '.$cms->lang_dir.' | Orig Lang: '.(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;).', New Lang: '.$lang);
$cms->l->l10nReloadMOfile($lang, $cms->lang_dir);
// if we have login class
if ($login) {