mirror of
https://github.com/Mibew/i18n.git
synced 2025-02-02 09:34:41 +03:00
format code, fix minor issues (link param, etc.)
This commit is contained in:
parent
e160af13ef
commit
693ece85fe
@ -124,7 +124,8 @@ $dbtables_can_update = array(
|
|||||||
"${mysqlprefix}chatresponses" => array(),
|
"${mysqlprefix}chatresponses" => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
function show_install_err($text) {
|
function show_install_err($text)
|
||||||
|
{
|
||||||
global $page, $version, $errors, $webimroot;
|
global $page, $version, $errors, $webimroot;
|
||||||
$page = array(
|
$page = array(
|
||||||
'version' => $version,
|
'version' => $version,
|
||||||
@ -136,11 +137,12 @@ function show_install_err($text) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_table($id,$link) {
|
function create_table($id, $link)
|
||||||
|
{
|
||||||
global $dbtables, $memtables, $dbencoding, $mysqlprefix;
|
global $dbtables, $memtables, $dbencoding, $mysqlprefix;
|
||||||
|
|
||||||
if (!isset($dbtables[$id])) {
|
if (!isset($dbtables[$id])) {
|
||||||
show_install_err("Unknown table: $id, ".mysql_error());
|
show_install_err("Unknown table: $id, " . mysql_error($link));
|
||||||
}
|
}
|
||||||
|
|
||||||
$query =
|
$query =
|
||||||
@ -158,7 +160,7 @@ function create_table($id,$link) {
|
|||||||
$query .= " TYPE=InnoDb";
|
$query .= " TYPE=InnoDb";
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_query($query,$link) or show_install_err(' Query failed: '.mysql_error());
|
mysql_query($query, $link) or show_install_err(' Query failed: ' . mysql_error($link));
|
||||||
|
|
||||||
if ($id == "${mysqlprefix}chatoperator") {
|
if ($id == "${mysqlprefix}chatoperator") {
|
||||||
create_operator_("admin", "", "", "Administrator", "Administrator", "", $link);
|
create_operator_("admin", "", "", "Administrator", "Administrator", "", $link);
|
||||||
@ -167,9 +169,10 @@ function create_table($id,$link) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_tables($link) {
|
function get_tables($link)
|
||||||
|
{
|
||||||
global $mysqldb, $errors;
|
global $mysqldb, $errors;
|
||||||
$result = mysql_query("SHOW TABLES FROM `$mysqldb`");
|
$result = mysql_query("SHOW TABLES FROM `$mysqldb`", $link);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$arr = array();
|
$arr = array();
|
||||||
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
|
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
|
||||||
@ -179,14 +182,15 @@ function get_tables($link) {
|
|||||||
return $arr;
|
return $arr;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$errors[] = "Cannot get tables from database. Error: ".mysql_error();
|
$errors[] = "Cannot get tables from database. Error: " . mysql_error($link);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_columns($tablename,$link) {
|
function get_columns($tablename, $link)
|
||||||
|
{
|
||||||
global $errors;
|
global $errors;
|
||||||
$result = mysql_query("SHOW COLUMNS FROM $tablename");
|
$result = mysql_query("SHOW COLUMNS FROM $tablename", $link);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$arr = array();
|
$arr = array();
|
||||||
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
|
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
|
||||||
@ -196,7 +200,7 @@ function get_columns($tablename,$link) {
|
|||||||
return $arr;
|
return $arr;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$errors[] = "Cannot get columns from table \"$tablename\". Error: ".mysql_error();
|
$errors[] = "Cannot get columns from table \"$tablename\". Error: " . mysql_error($link);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,29 +23,26 @@ require_once('../libs/common.php');
|
|||||||
require_once('../libs/operator.php');
|
require_once('../libs/operator.php');
|
||||||
require_once('dbinfo.php');
|
require_once('dbinfo.php');
|
||||||
|
|
||||||
function runsql($query,$link) {
|
function runsql($query, $link)
|
||||||
$res = mysql_query($query,$link)
|
{
|
||||||
or show_install_err(' Query failed: '.mysql_error());
|
$res = mysql_query($query, $link) or show_install_err(' Query failed: ' . mysql_error($link));
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
$act = verifyparam("act", "/^(silentcreateall|createdb|ct|dt|addcolumns)$/");
|
$act = verifyparam("act", "/^(silentcreateall|createdb|ct|dt|addcolumns)$/");
|
||||||
|
|
||||||
$link = @mysql_connect($mysqlhost, $mysqllogin, $mysqlpass)
|
$link = @mysql_connect($mysqlhost, $mysqllogin, $mysqlpass)
|
||||||
or show_install_err('Could not connect: ' . mysql_error());
|
or show_install_err('Could not connect: ' . mysql_error($link));
|
||||||
|
|
||||||
if ($act == "silentcreateall") {
|
if ($act == "silentcreateall") {
|
||||||
mysql_query("CREATE DATABASE $mysqldb",$link)
|
mysql_query("CREATE DATABASE $mysqldb", $link) or show_install_err(' Query failed: ' . mysql_error($link));
|
||||||
or show_install_err(' Query failed: '.mysql_error());
|
|
||||||
foreach ($dbtables as $id) {
|
foreach ($dbtables as $id) {
|
||||||
create_table($id, $link);
|
create_table($id, $link);
|
||||||
}
|
}
|
||||||
} else if ($act == "createdb") {
|
} else if ($act == "createdb") {
|
||||||
mysql_query("CREATE DATABASE $mysqldb",$link)
|
mysql_query("CREATE DATABASE $mysqldb", $link) or show_install_err(' Query failed: ' . mysql_error($link));
|
||||||
or show_install_err(' Query failed: '.mysql_error());
|
|
||||||
} else {
|
} else {
|
||||||
mysql_select_db($mysqldb,$link)
|
mysql_select_db($mysqldb, $link) or show_install_err('Could not select database');
|
||||||
or show_install_err('Could not select database');
|
|
||||||
if ($force_charset_in_connection) {
|
if ($force_charset_in_connection) {
|
||||||
mysql_query("SET character set $dbencoding", $link);
|
mysql_query("SET character set $dbencoding", $link);
|
||||||
}
|
}
|
||||||
@ -61,8 +58,7 @@ if ($act == "silentcreateall") {
|
|||||||
}
|
}
|
||||||
} else if ($act == "dt") {
|
} else if ($act == "dt") {
|
||||||
foreach (array_keys($dbtables) as $id) {
|
foreach (array_keys($dbtables) as $id) {
|
||||||
mysql_query("DROP TABLE IF EXISTS $id",$link)
|
mysql_query("DROP TABLE IF EXISTS $id", $link) or show_install_err(' Query failed: ' . mysql_error($link));
|
||||||
or show_install_err(' Query failed: '.mysql_error());
|
|
||||||
}
|
}
|
||||||
} else if ($act == "addcolumns") {
|
} else if ($act == "addcolumns") {
|
||||||
$absent = array();
|
$absent = array();
|
||||||
|
@ -33,7 +33,8 @@ $page['nextstep'] = false;
|
|||||||
$page['nextnotice'] = false;
|
$page['nextnotice'] = false;
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
function check_webimroot() {
|
function check_webimroot()
|
||||||
|
{
|
||||||
global $page, $errors, $webimroot;
|
global $page, $errors, $webimroot;
|
||||||
$requestUri = $_SERVER["REQUEST_URI"];
|
$requestUri = $_SERVER["REQUEST_URI"];
|
||||||
if (!preg_match('/^(.*)\\/install(\\/[^\\/\\\\]*)?$/', $requestUri, $matches)) {
|
if (!preg_match('/^(.*)\\/install(\\/[^\\/\\\\]*)?$/', $requestUri, $matches)) {
|
||||||
@ -52,7 +53,8 @@ function check_webimroot() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_connection() {
|
function check_connection()
|
||||||
|
{
|
||||||
global $mysqlhost, $mysqllogin, $mysqlpass, $page, $errors, $webimroot;
|
global $mysqlhost, $mysqllogin, $mysqlpass, $page, $errors, $webimroot;
|
||||||
$link = @mysql_connect($mysqlhost, $mysqllogin, $mysqlpass);
|
$link = @mysql_connect($mysqlhost, $mysqllogin, $mysqlpass);
|
||||||
if ($link) {
|
if ($link) {
|
||||||
@ -61,7 +63,7 @@ function check_connection() {
|
|||||||
$page['done'][] = getlocal2("install.1.connected", array($ver['c']));
|
$page['done'][] = getlocal2("install.1.connected", array($ver['c']));
|
||||||
mysql_free_result($result);
|
mysql_free_result($result);
|
||||||
} else {
|
} else {
|
||||||
$errors[] = "Version of your SQL server is unknown. Please check. Error: ".mysql_error();
|
$errors[] = "Version of your SQL server is unknown. Please check. Error: " . mysql_error($link);
|
||||||
mysql_close($link);
|
mysql_close($link);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -72,7 +74,8 @@ function check_connection() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_database($link) {
|
function check_database($link)
|
||||||
|
{
|
||||||
global $mysqldb, $force_charset_in_connection, $dbencoding, $page, $webimroot;
|
global $mysqldb, $force_charset_in_connection, $dbencoding, $page, $webimroot;
|
||||||
if (mysql_select_db($mysqldb, $link)) {
|
if (mysql_select_db($mysqldb, $link)) {
|
||||||
$page['done'][] = getlocal2("install.2.db_exists", array($mysqldb));
|
$page['done'][] = getlocal2("install.2.db_exists", array($mysqldb));
|
||||||
@ -88,7 +91,8 @@ function check_database($link) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_tables($link) {
|
function check_tables($link)
|
||||||
|
{
|
||||||
global $dbtables, $page, $webimroot;
|
global $dbtables, $page, $webimroot;
|
||||||
$curr_tables = get_tables($link);
|
$curr_tables = get_tables($link);
|
||||||
if ($curr_tables !== false) {
|
if ($curr_tables !== false) {
|
||||||
@ -104,7 +108,8 @@ function check_tables($link) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_columns($link) {
|
function check_columns($link)
|
||||||
|
{
|
||||||
global $dbtables, $dbtables_can_update, $errors, $page, $webimroot;
|
global $dbtables, $dbtables_can_update, $errors, $page, $webimroot;
|
||||||
|
|
||||||
$need_to_create_columns = false;
|
$need_to_create_columns = false;
|
||||||
@ -138,7 +143,8 @@ function check_columns($link) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_status() {
|
function check_status()
|
||||||
|
{
|
||||||
global $page, $webimroot, $settings, $dbversion;
|
global $page, $webimroot, $settings, $dbversion;
|
||||||
|
|
||||||
if (!check_webimroot()) {
|
if (!check_webimroot()) {
|
||||||
@ -168,7 +174,7 @@ function check_status() {
|
|||||||
$page['done'][] = getlocal("installed.message");
|
$page['done'][] = getlocal("installed.message");
|
||||||
|
|
||||||
$page['nextstep'] = getlocal("installed.login_link");
|
$page['nextstep'] = getlocal("installed.login_link");
|
||||||
$page['nextnotice'] = getlocal2("installed.notice", array($webimroot."/install/"));
|
$page['nextnotice'] = getlocal2("installed.notice", array("${webimroot}/install/"));
|
||||||
$page['nextstepurl'] = "$webimroot/";
|
$page['nextstepurl'] = "$webimroot/";
|
||||||
|
|
||||||
$page['show_small_login'] = true;
|
$page['show_small_login'] = true;
|
||||||
|
@ -335,12 +335,12 @@ function connect() {
|
|||||||
|
|
||||||
function perform_query($query,$link) {
|
function perform_query($query,$link) {
|
||||||
mysql_query($query,$link)
|
mysql_query($query,$link)
|
||||||
or die(' Query failed: '.mysql_error()/*.": ".$query*/);
|
or die(' Query failed: '.mysql_error($link)/*.": ".$query*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
function select_one_row($query,$link) {
|
function select_one_row($query,$link) {
|
||||||
$result = mysql_query($query,$link) or die(' Query failed: ' .
|
$result = mysql_query($query,$link) or die(' Query failed: ' .
|
||||||
mysql_error().": ".$query);
|
mysql_error($link) /*.": ".$query*/);
|
||||||
$line = mysql_fetch_array($result, MYSQL_ASSOC);
|
$line = mysql_fetch_array($result, MYSQL_ASSOC);
|
||||||
mysql_free_result($result);
|
mysql_free_result($result);
|
||||||
return $line;
|
return $line;
|
||||||
@ -348,7 +348,7 @@ function select_one_row($query,$link) {
|
|||||||
|
|
||||||
function select_multi_assoc($query, $link) {
|
function select_multi_assoc($query, $link) {
|
||||||
$sqlresult = mysql_query($query,$link) or die(' Query failed: ' .
|
$sqlresult = mysql_query($query,$link) or die(' Query failed: ' .
|
||||||
mysql_error().": ".$query);
|
mysql_error($link) /*.": ".$query*/);
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
while ($row = mysql_fetch_array($sqlresult, MYSQL_ASSOC)) {
|
while ($row = mysql_fetch_array($sqlresult, MYSQL_ASSOC)) {
|
||||||
@ -366,7 +366,7 @@ function db_build_select($fields, $table, $conditions, $orderandgroup) {
|
|||||||
|
|
||||||
function db_rows_count($table,$conditions,$countfields, $link) {
|
function db_rows_count($table,$conditions,$countfields, $link) {
|
||||||
$result = mysql_query(db_build_select("count(".($countfields ? $countfields : "*").")", $table, $conditions, ""),$link)
|
$result = mysql_query(db_build_select("count(".($countfields ? $countfields : "*").")", $table, $conditions, ""),$link)
|
||||||
or die(' Count query failed: '.mysql_error());
|
or die(' Count query failed: '.mysql_error($link));
|
||||||
$line = mysql_fetch_array($result, MYSQL_NUM);
|
$line = mysql_fetch_array($result, MYSQL_NUM);
|
||||||
mysql_free_result($result);
|
mysql_free_result($result);
|
||||||
return $line[0];
|
return $line[0];
|
||||||
|
@ -47,7 +47,7 @@ if( isset($_GET['act']) && $_GET['act'] == 'del' ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = mysql_query("select banid,unix_timestamp(dtmtill) as till,address,comment from ${mysqlprefix}chatban", $link)
|
$result = mysql_query("select banid,unix_timestamp(dtmtill) as till,address,comment from ${mysqlprefix}chatban", $link)
|
||||||
or die(' Query failed: ' .mysql_error());
|
or die(' Query failed: ' .mysql_error($link));
|
||||||
|
|
||||||
$blockedList = array();
|
$blockedList = array();
|
||||||
while ($ban = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
while ($ban = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
||||||
|
@ -49,7 +49,7 @@ function threads_by_userid($userid) {
|
|||||||
"from ${mysqlprefix}chatthread ".
|
"from ${mysqlprefix}chatthread ".
|
||||||
"where userid=\"$userid\" order by created DESC", $userid);
|
"where userid=\"$userid\" order by created DESC", $userid);
|
||||||
|
|
||||||
$result = mysql_query($query, $link) or die(' Query failed: ' .mysql_error().": ".$query);
|
$result = mysql_query($query, $link) or die(' Query failed: ' .mysql_error($link) /*.": ".$query*/);
|
||||||
|
|
||||||
$foundThreads = array();
|
$foundThreads = array();
|
||||||
while ($thread = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
while ($thread = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user