not all requests have remote_addr
This commit is contained in:
parent
a70ca33f96
commit
0ef8db8371
2 changed files with 10 additions and 5 deletions
|
@ -146,7 +146,12 @@ class PostgreSQL extends DBEngine {
|
||||||
* @param \PDO $db
|
* @param \PDO $db
|
||||||
*/
|
*/
|
||||||
public function init($db) {
|
public function init($db) {
|
||||||
|
if(array_key_exists('REMOTE_ADDR', $_SERVER)) {
|
||||||
$db->exec("SET application_name TO 'shimmie [{$_SERVER['REMOTE_ADDR']}]';");
|
$db->exec("SET application_name TO 'shimmie [{$_SERVER['REMOTE_ADDR']}]';");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$db->exec("SET application_name TO 'shimmie [local]';");
|
||||||
|
}
|
||||||
$db->exec("SET statement_timeout TO 10000;");
|
$db->exec("SET statement_timeout TO 10000;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +179,7 @@ class PostgreSQL extends DBEngine {
|
||||||
*/
|
*/
|
||||||
public function create_table_sql($name, $data) {
|
public function create_table_sql($name, $data) {
|
||||||
$data = $this->scoreql_to_sql($data);
|
$data = $this->scoreql_to_sql($data);
|
||||||
return 'CREATE TABLE '.$name.' ('.$data.')';
|
return "CREATE TABLE $name ($data)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class LinkImage extends Extension {
|
||||||
return array(
|
return array(
|
||||||
'thumb_src' => make_http($image->get_thumb_link()),
|
'thumb_src' => make_http($image->get_thumb_link()),
|
||||||
'image_src' => make_http($image->get_image_link()),
|
'image_src' => make_http($image->get_image_link()),
|
||||||
'post_link' => make_http($_SERVER["REQUEST_URI"]),
|
'post_link' => make_http(make_link("post/view/{$image->id}")),
|
||||||
'text_link' => $text_link);
|
'text_link' => $text_link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue