X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fdbase_pgsql.phh;h=1baefa3b955d3ced3f877863fd3274fa88a33e27;hb=b5f30b4ffb453702445acadd0968712e9a0d7bfe;hp=48ca78e0c10a17c92614cbff2035ce8f97723c60;hpb=c75222f24ff3f47a664f20f5971048d58f20c492;p=brisk.git diff --git a/web/Obj/dbase_pgsql.phh b/web/Obj/dbase_pgsql.phh index 48ca78e..1baefa3 100644 --- a/web/Obj/dbase_pgsql.phh +++ b/web/Obj/dbase_pgsql.phh @@ -942,6 +942,27 @@ INSERT INTO %smails (code, ucode, type, tstamp, subj, body_txt, body_htm, hash) return ($narrowskill); } + function usersnet_partyskill($owner, $target) + { + GLOBAL $G_dbpfx; + + $partyskill = "non disponibile"; + + $pskl_sql = sprintf("SELECT * FROM %susersnet_party WHERE owner = %d AND target = %d;", + $G_dbpfx, $owner, $target); + if (($pskl_pg = $this->query($pskl_sql)) == FALSE) { + return ($partyskill); + } + + if (pg_numrows($pskl_pg) > 0) { + $pskl_obj = pg_fetch_object($pskl_pg, 0); + // TODO: UNCOMMENT IF THE NETWORK WORKS VERY WELL + // if ($wskl_obj->count >= 3) + $partyskill = sprintf("%3.2f", $pskl_obj->skill); + } + return ($partyskill); + } + function usersnet_bycode($owner, $target, $widefriend, $narrowfriend) { GLOBAL $G_dbpfx; @@ -993,7 +1014,7 @@ INSERT INTO %smails (code, ucode, type, tstamp, subj, body_txt, body_htm, hash) USING %susers as us WHERE owner = %d AND us.login = '%s' AND target = us.code;", $G_dbpfx, $G_dbpfx, - $owner_id, escsql($json->login)); + $owner_id, escsql(strtolower($json->login))); if (($net_pg = $this->query($net_sql)) == FALSE) { $ret = 5; @@ -1010,7 +1031,7 @@ INSERT INTO %smails (code, ucode, type, tstamp, subj, body_txt, body_htm, hash) $G_dbpfx, $friend, $json->skill, $json->trust, $G_dbpfx, - $owner_id, escsql($json->login)); + $owner_id, escsql(strtolower($json->login))); if (($net_pg = $this->query($net_sql)) == FALSE || pg_numrows($net_pg) == 0) { $net_sql = sprintf(" INSERT INTO %susersnet SELECT %d AS owner, us.code as target, @@ -1018,7 +1039,7 @@ INSERT INTO %smails (code, ucode, type, tstamp, subj, body_txt, body_htm, hash) FROM %susers as us WHERE us.login = '%s' RETURNING *;", $G_dbpfx, $owner_id, $friend, $json->skill, $json->trust, - $G_dbpfx, $json->login); + $G_dbpfx, escsql(strtolower($json->login))); if (($net_pg = $this->query($net_sql)) == FALSE) { log_wr('insert query failed'); $ret = 2;