diff --git a/scripts/game/main/links/library.inc b/scripts/game/main/links/library.inc index 6b432bd..b992b45 100644 --- a/scripts/game/main/links/library.inc +++ b/scripts/game/main/links/library.inc @@ -25,7 +25,7 @@ class main_links_library { function getCategory($id) { $q = $this->db->query("SELECT * FROM lk_category WHERE id=$id"); - if (!($q && count($q))) { + if (!$q) { return null; } return dbFetchHash($q); diff --git a/scripts/game/main/manual/library/readXMLFile.inc b/scripts/game/main/manual/library/readXMLFile.inc index 06f8460..2e1aa86 100644 --- a/scripts/game/main/manual/library/readXMLFile.inc +++ b/scripts/game/main/manual/library/readXMLFile.inc @@ -79,7 +79,7 @@ class main_manual_readXMLFile { $nFile = $node->getAttribute('file'); if ($nFile != '') { // This subsection must be read from another file - if ($nFile{0} != "/") + if ($nFile[0] != "/") $nFile = dirname($path) . "/$nFile"; $a = $this->run($nFile); if (!is_array($a)) { diff --git a/scripts/game/main/manual/library/updateSections.inc b/scripts/game/main/manual/library/updateSections.inc index 7db2b58..def0917 100644 --- a/scripts/game/main/manual/library/updateSections.inc +++ b/scripts/game/main/manual/library/updateSections.inc @@ -11,11 +11,11 @@ class main_manual_updateSections { $versions = array(); foreach ($sections as $sName => $sData) { if (is_null($versions[$sData['version']])) { - $versions[$sData['version']] = "'" . addslashes($sData['version']) . "'"; + $versions[$sData['version']] = "'" . pg_escape_string($sData['version']) . "'"; } - $this->db->query("DELETE FROM man_section WHERE name='" . addslashes($sName) + $this->db->query("DELETE FROM man_section WHERE name='" . pg_escape_string($sName) . "' AND version=" . $versions[$sData['version']] - . " AND lang='" . addslashes($sData['language']) . "'"); + . " AND lang='" . pg_escape_string($sData['language']) . "'"); } // Insert the data itself @@ -25,13 +25,13 @@ class main_manual_updateSections { continue; } $this->db->query("INSERT INTO man_section (version,lang,name,last_update,is_page,in_menu,title,contents) VALUES(" - . $versions[$sData['version']] . ",'" . addslashes($sData['language']) . "','" - . addslashes($sName) . "',$now," . dbBool($sData['is_page']) . "," - . dbBool($sData['in_menu']) . ",'" . addslashes($sData['title']) - . "','" . addslashes($sData['contents']) . "')"); - $q = $this->db->query("SELECT id FROM man_section WHERE name='" . addslashes($sName) + . $versions[$sData['version']] . ",'" . pg_escape_string($sData['language']) . "','" + . pg_escape_string($sName) . "',$now," . dbBool($sData['is_page']) . "," + . dbBool($sData['in_menu']) . ",'" . pg_escape_string($sData['title']) + . "','" . pg_escape_string($sData['contents']) . "')"); + $q = $this->db->query("SELECT id FROM man_section WHERE name='" . pg_escape_string($sName) . "' AND version=" . $versions[$sData['version']] - . " AND lang='" . addslashes($sData['language']) . "'"); + . " AND lang='" . pg_escape_string($sData['language']) . "'"); list($sections[$sName]['dbid']) = dbFetchArray($q); } @@ -61,8 +61,8 @@ class main_manual_updateSections { if (is_array($sections[$sData['linkto']])) { $this->db->query("UPDATE man_section SET link_to={$sections[$sData['linkto']]['dbid']} WHERE id={$sData['dbid']}"); } else { - $q = $this->db->query("SELECT id FROM man_section WHERE name='" . addslashes($sData['linkto']) . "' AND version=" - . $versions[$sData['version']] . " AND lang='" . addslashes($sData['language']) . "'"); + $q = $this->db->query("SELECT id FROM man_section WHERE name='" . pg_escape_string($sData['linkto']) . "' AND version=" + . $versions[$sData['version']] . " AND lang='" . pg_escape_string($sData['language']) . "'"); if ($q && dbCount($q) == 1) { list($toid) = dbFetchArray($q); $this->db->query("UPDATE man_section SET link_to=$toid WHERE id={$sData['dbid']}"); @@ -77,7 +77,7 @@ class main_manual_updateSections { if (!is_array($banwords[$sData['language']])) { $ban = array(); - $q = $this->db->query("SELECT word FROM man_index_ban WHERE lang='" . addslashes($sData['language']) . "'"); + $q = $this->db->query("SELECT word FROM man_index_ban WHERE lang='" . pg_escape_string($sData['language']) . "'"); while ($r = dbFetchArray($q)) { array_push($ban, $r[0]); } @@ -97,8 +97,8 @@ class main_manual_updateSections { } } foreach ($rtl as $word => $count) { - $this->db->query("INSERT INTO man_index(word,wcount,lang,section) VALUES ('" . addslashes($word) - . "',$count,'" . addslashes($sData['language']) . "',{$sData['dbid']})"); + $this->db->query("INSERT INTO man_index(word,wcount,lang,section) VALUES ('" . pg_escape_string($word) + . "',$count,'" . pg_escape_string($sData['language']) . "',{$sData['dbid']})"); } } } diff --git a/scripts/game/main/ticks/deathofrats/library.inc b/scripts/game/main/ticks/deathofrats/library.inc index e02e218..a7f2d37 100644 --- a/scripts/game/main/ticks/deathofrats/library.inc +++ b/scripts/game/main/ticks/deathofrats/library.inc @@ -153,7 +153,7 @@ class main_ticks_deathofrats_library { // Start with open proxies l::debug("Checking for open proxies ..."); $this->checkOpenProxies(); - if (count($this->proxiedAccounts)) { + if ($this->proxiedAccounts) { l::info("Logging " . count($this->proxiedAccounts) . " account(s) using open proxies"); $this->db->safeTransaction(array($this, 'logOpenProxies')); }