mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
create table
This commit is contained in:
@@ -385,3 +385,30 @@ function arr_set(&$array, $key, $value)
|
|||||||
|
|
||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getSchemaAndHttpHost()
|
||||||
|
{
|
||||||
|
$isHttps = !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) !== 'off');
|
||||||
|
$protocol = $isHttps ? 'https' : 'http';
|
||||||
|
$port = $_SERVER['SERVER_PORT'];
|
||||||
|
$result = "$protocol://" . $_SERVER['HTTP_HOST'];
|
||||||
|
if ($port != 80) {
|
||||||
|
$result .= ":$port";
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBaseUrl()
|
||||||
|
{
|
||||||
|
$url = getSchemaAndHttpHost();
|
||||||
|
$requestUri = $_SERVER['REQUEST_URI'];
|
||||||
|
$pos = strpos($requestUri, '?');
|
||||||
|
if ($pos !== false) {
|
||||||
|
$url .= substr($requestUri, 0, $pos);
|
||||||
|
} else {
|
||||||
|
$url .= $requestUri;
|
||||||
|
}
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|||||||
+4
-2
@@ -8,6 +8,7 @@ parked();
|
|||||||
if (get_user_class() < UC_SYSOP)
|
if (get_user_class() < UC_SYSOP)
|
||||||
permissiondenied();
|
permissiondenied();
|
||||||
|
|
||||||
|
$datetimeNow = date('Y-m-d H:i:s');
|
||||||
function go_back()
|
function go_back()
|
||||||
{
|
{
|
||||||
global $lang_settings;
|
global $lang_settings;
|
||||||
@@ -22,13 +23,14 @@ function yesorno($title, $name, $value, $note="")
|
|||||||
|
|
||||||
function saveSetting($prefix, $nameAndValue)
|
function saveSetting($prefix, $nameAndValue)
|
||||||
{
|
{
|
||||||
$sql = "insert into settings (name, value) values ";
|
global $datetimeNow;
|
||||||
|
$sql = "insert into settings (name, value, created_at, updated_at) values ";
|
||||||
$data = [];
|
$data = [];
|
||||||
foreach ($nameAndValue as $name => $value) {
|
foreach ($nameAndValue as $name => $value) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
$value = json_encode($value);
|
$value = json_encode($value);
|
||||||
}
|
}
|
||||||
$data[] = sprintf("(%s, %s)", sqlesc("$prefix.$name"), sqlesc($value));
|
$data[] = sprintf("(%s, %s, %s, %s)", sqlesc("$prefix.$name"), sqlesc($value), sqlesc($datetimeNow), sqlesc($datetimeNow));
|
||||||
}
|
}
|
||||||
$sql .= implode(",", $data) . " on duplicate key update value = values(value)";
|
$sql .= implode(",", $data) . " on duplicate key update value = values(value)";
|
||||||
sql_query($sql) or sqlerr(__FILE__, __LINE__);
|
sql_query($sql) or sqlerr(__FILE__, __LINE__);
|
||||||
|
|||||||
Reference in New Issue
Block a user