fix: fix more PHP issues
This commit is contained in:
parent
a4b45ddaa4
commit
dcec07be8a
4 changed files with 17 additions and 17 deletions
|
@ -25,7 +25,7 @@ class main_links_library {
|
||||||
|
|
||||||
function getCategory($id) {
|
function getCategory($id) {
|
||||||
$q = $this->db->query("SELECT * FROM lk_category WHERE id=$id");
|
$q = $this->db->query("SELECT * FROM lk_category WHERE id=$id");
|
||||||
if (!($q && count($q))) {
|
if (!$q) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return dbFetchHash($q);
|
return dbFetchHash($q);
|
||||||
|
|
|
@ -79,7 +79,7 @@ class main_manual_readXMLFile {
|
||||||
$nFile = $node->getAttribute('file');
|
$nFile = $node->getAttribute('file');
|
||||||
if ($nFile != '') {
|
if ($nFile != '') {
|
||||||
// This subsection must be read from another file
|
// This subsection must be read from another file
|
||||||
if ($nFile{0} != "/")
|
if ($nFile[0] != "/")
|
||||||
$nFile = dirname($path) . "/$nFile";
|
$nFile = dirname($path) . "/$nFile";
|
||||||
$a = $this->run($nFile);
|
$a = $this->run($nFile);
|
||||||
if (!is_array($a)) {
|
if (!is_array($a)) {
|
||||||
|
|
|
@ -11,11 +11,11 @@ class main_manual_updateSections {
|
||||||
$versions = array();
|
$versions = array();
|
||||||
foreach ($sections as $sName => $sData) {
|
foreach ($sections as $sName => $sData) {
|
||||||
if (is_null($versions[$sData['version']])) {
|
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 version=" . $versions[$sData['version']]
|
||||||
. " AND lang='" . addslashes($sData['language']) . "'");
|
. " AND lang='" . pg_escape_string($sData['language']) . "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert the data itself
|
// Insert the data itself
|
||||||
|
@ -25,13 +25,13 @@ class main_manual_updateSections {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$this->db->query("INSERT INTO man_section (version,lang,name,last_update,is_page,in_menu,title,contents) VALUES("
|
$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']) . "','"
|
. $versions[$sData['version']] . ",'" . pg_escape_string($sData['language']) . "','"
|
||||||
. addslashes($sName) . "',$now," . dbBool($sData['is_page']) . ","
|
. pg_escape_string($sName) . "',$now," . dbBool($sData['is_page']) . ","
|
||||||
. dbBool($sData['in_menu']) . ",'" . addslashes($sData['title'])
|
. dbBool($sData['in_menu']) . ",'" . pg_escape_string($sData['title'])
|
||||||
. "','" . addslashes($sData['contents']) . "')");
|
. "','" . pg_escape_string($sData['contents']) . "')");
|
||||||
$q = $this->db->query("SELECT id FROM man_section WHERE name='" . addslashes($sName)
|
$q = $this->db->query("SELECT id FROM man_section WHERE name='" . pg_escape_string($sName)
|
||||||
. "' AND version=" . $versions[$sData['version']]
|
. "' AND version=" . $versions[$sData['version']]
|
||||||
. " AND lang='" . addslashes($sData['language']) . "'");
|
. " AND lang='" . pg_escape_string($sData['language']) . "'");
|
||||||
list($sections[$sName]['dbid']) = dbFetchArray($q);
|
list($sections[$sName]['dbid']) = dbFetchArray($q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ class main_manual_updateSections {
|
||||||
if (is_array($sections[$sData['linkto']])) {
|
if (is_array($sections[$sData['linkto']])) {
|
||||||
$this->db->query("UPDATE man_section SET link_to={$sections[$sData['linkto']]['dbid']} WHERE id={$sData['dbid']}");
|
$this->db->query("UPDATE man_section SET link_to={$sections[$sData['linkto']]['dbid']} WHERE id={$sData['dbid']}");
|
||||||
} else {
|
} else {
|
||||||
$q = $this->db->query("SELECT id FROM man_section WHERE name='" . addslashes($sData['linkto']) . "' AND version="
|
$q = $this->db->query("SELECT id FROM man_section WHERE name='" . pg_escape_string($sData['linkto']) . "' AND version="
|
||||||
. $versions[$sData['version']] . " AND lang='" . addslashes($sData['language']) . "'");
|
. $versions[$sData['version']] . " AND lang='" . pg_escape_string($sData['language']) . "'");
|
||||||
if ($q && dbCount($q) == 1) {
|
if ($q && dbCount($q) == 1) {
|
||||||
list($toid) = dbFetchArray($q);
|
list($toid) = dbFetchArray($q);
|
||||||
$this->db->query("UPDATE man_section SET link_to=$toid WHERE id={$sData['dbid']}");
|
$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']])) {
|
if (!is_array($banwords[$sData['language']])) {
|
||||||
$ban = array();
|
$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)) {
|
while ($r = dbFetchArray($q)) {
|
||||||
array_push($ban, $r[0]);
|
array_push($ban, $r[0]);
|
||||||
}
|
}
|
||||||
|
@ -97,8 +97,8 @@ class main_manual_updateSections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($rtl as $word => $count) {
|
foreach ($rtl as $word => $count) {
|
||||||
$this->db->query("INSERT INTO man_index(word,wcount,lang,section) VALUES ('" . addslashes($word)
|
$this->db->query("INSERT INTO man_index(word,wcount,lang,section) VALUES ('" . pg_escape_string($word)
|
||||||
. "',$count,'" . addslashes($sData['language']) . "',{$sData['dbid']})");
|
. "',$count,'" . pg_escape_string($sData['language']) . "',{$sData['dbid']})");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ class main_ticks_deathofrats_library {
|
||||||
// Start with open proxies
|
// Start with open proxies
|
||||||
l::debug("Checking for open proxies ...");
|
l::debug("Checking for open proxies ...");
|
||||||
$this->checkOpenProxies();
|
$this->checkOpenProxies();
|
||||||
if (count($this->proxiedAccounts)) {
|
if ($this->proxiedAccounts) {
|
||||||
l::info("Logging " . count($this->proxiedAccounts) . " account(s) using open proxies");
|
l::info("Logging " . count($this->proxiedAccounts) . " account(s) using open proxies");
|
||||||
$this->db->safeTransaction(array($this, 'logOpenProxies'));
|
$this->db->safeTransaction(array($this, 'logOpenProxies'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue