mirror of
https://github.com/Mibew/java.git
synced 2025-01-22 17:40:35 +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(),
|
||||
);
|
||||
|
||||
function show_install_err($text) {
|
||||
function show_install_err($text)
|
||||
{
|
||||
global $page, $version, $errors, $webimroot;
|
||||
$page = array(
|
||||
'version' => $version,
|
||||
@ -136,11 +137,12 @@ function show_install_err($text) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function create_table($id,$link) {
|
||||
function create_table($id, $link)
|
||||
{
|
||||
global $dbtables, $memtables, $dbencoding, $mysqlprefix;
|
||||
|
||||
if (!isset($dbtables[$id])) {
|
||||
show_install_err("Unknown table: $id, ".mysql_error());
|
||||
show_install_err("Unknown table: $id, " . mysql_error($link));
|
||||
}
|
||||
|
||||
$query =
|
||||
@ -158,7 +160,7 @@ function create_table($id,$link) {
|
||||
$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") {
|
||||
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;
|
||||
$result = mysql_query("SHOW TABLES FROM `$mysqldb`");
|
||||
$result = mysql_query("SHOW TABLES FROM `$mysqldb`", $link);
|
||||
if ($result) {
|
||||
$arr = array();
|
||||
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
|
||||
@ -179,14 +182,15 @@ function get_tables($link) {
|
||||
return $arr;
|
||||
|
||||
} else {
|
||||
$errors[] = "Cannot get tables from database. Error: ".mysql_error();
|
||||
$errors[] = "Cannot get tables from database. Error: " . mysql_error($link);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function get_columns($tablename,$link) {
|
||||
function get_columns($tablename, $link)
|
||||
{
|
||||
global $errors;
|
||||
$result = mysql_query("SHOW COLUMNS FROM $tablename");
|
||||
$result = mysql_query("SHOW COLUMNS FROM $tablename", $link);
|
||||
if ($result) {
|
||||
$arr = array();
|
||||
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
|
||||
@ -196,7 +200,7 @@ function get_columns($tablename,$link) {
|
||||
return $arr;
|
||||
|
||||
} else {
|
||||
$errors[] = "Cannot get columns from table \"$tablename\". Error: ".mysql_error();
|
||||
$errors[] = "Cannot get columns from table \"$tablename\". Error: " . mysql_error($link);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -23,29 +23,26 @@ require_once('../libs/common.php');
|
||||
require_once('../libs/operator.php');
|
||||
require_once('dbinfo.php');
|
||||
|
||||
function runsql($query,$link) {
|
||||
$res = mysql_query($query,$link)
|
||||
or show_install_err(' Query failed: '.mysql_error());
|
||||
function runsql($query, $link)
|
||||
{
|
||||
$res = mysql_query($query, $link) or show_install_err(' Query failed: ' . mysql_error($link));
|
||||
return $res;
|
||||
}
|
||||
|
||||
$act = verifyparam("act", "/^(silentcreateall|createdb|ct|dt|addcolumns)$/");
|
||||
|
||||
$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") {
|
||||
mysql_query("CREATE DATABASE $mysqldb",$link)
|
||||
or show_install_err(' Query failed: '.mysql_error());
|
||||
mysql_query("CREATE DATABASE $mysqldb", $link) or show_install_err(' Query failed: ' . mysql_error($link));
|
||||
foreach ($dbtables as $id) {
|
||||
create_table($id, $link);
|
||||
}
|
||||
} else if ($act == "createdb") {
|
||||
mysql_query("CREATE DATABASE $mysqldb",$link)
|
||||
or show_install_err(' Query failed: '.mysql_error());
|
||||
mysql_query("CREATE DATABASE $mysqldb", $link) or show_install_err(' Query failed: ' . mysql_error($link));
|
||||
} else {
|
||||
mysql_select_db($mysqldb,$link)
|
||||
or show_install_err('Could not select database');
|
||||
mysql_select_db($mysqldb, $link) or show_install_err('Could not select database');
|
||||
if ($force_charset_in_connection) {
|
||||
mysql_query("SET character set $dbencoding", $link);
|
||||
}
|
||||
@ -61,8 +58,7 @@ if ($act == "silentcreateall") {
|
||||
}
|
||||
} else if ($act == "dt") {
|
||||
foreach (array_keys($dbtables) as $id) {
|
||||
mysql_query("DROP TABLE IF EXISTS $id",$link)
|
||||
or show_install_err(' Query failed: '.mysql_error());
|
||||
mysql_query("DROP TABLE IF EXISTS $id", $link) or show_install_err(' Query failed: ' . mysql_error($link));
|
||||
}
|
||||
} else if ($act == "addcolumns") {
|
||||
$absent = array();
|
||||
|
@ -33,7 +33,8 @@ $page['nextstep'] = false;
|
||||
$page['nextnotice'] = false;
|
||||
$errors = array();
|
||||
|
||||
function check_webimroot() {
|
||||
function check_webimroot()
|
||||
{
|
||||
global $page, $errors, $webimroot;
|
||||
$requestUri = $_SERVER["REQUEST_URI"];
|
||||
if (!preg_match('/^(.*)\\/install(\\/[^\\/\\\\]*)?$/', $requestUri, $matches)) {
|
||||
@ -52,7 +53,8 @@ function check_webimroot() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function check_connection() {
|
||||
function check_connection()
|
||||
{
|
||||
global $mysqlhost, $mysqllogin, $mysqlpass, $page, $errors, $webimroot;
|
||||
$link = @mysql_connect($mysqlhost, $mysqllogin, $mysqlpass);
|
||||
if ($link) {
|
||||
@ -61,7 +63,7 @@ function check_connection() {
|
||||
$page['done'][] = getlocal2("install.1.connected", array($ver['c']));
|
||||
mysql_free_result($result);
|
||||
} 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);
|
||||
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;
|
||||
if (mysql_select_db($mysqldb, $link)) {
|
||||
$page['done'][] = getlocal2("install.2.db_exists", array($mysqldb));
|
||||
@ -88,7 +91,8 @@ function check_database($link) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function check_tables($link) {
|
||||
function check_tables($link)
|
||||
{
|
||||
global $dbtables, $page, $webimroot;
|
||||
$curr_tables = get_tables($link);
|
||||
if ($curr_tables !== false) {
|
||||
@ -104,7 +108,8 @@ function check_tables($link) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function check_columns($link) {
|
||||
function check_columns($link)
|
||||
{
|
||||
global $dbtables, $dbtables_can_update, $errors, $page, $webimroot;
|
||||
|
||||
$need_to_create_columns = false;
|
||||
@ -138,7 +143,8 @@ function check_columns($link) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function check_status() {
|
||||
function check_status()
|
||||
{
|
||||
global $page, $webimroot, $settings, $dbversion;
|
||||
|
||||
if (!check_webimroot()) {
|
||||
@ -168,7 +174,7 @@ function check_status() {
|
||||
$page['done'][] = getlocal("installed.message");
|
||||
|
||||
$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['show_small_login'] = true;
|
||||
|
@ -335,12 +335,12 @@ function connect() {
|
||||
|
||||
function perform_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) {
|
||||
$result = mysql_query($query,$link) or die(' Query failed: ' .
|
||||
mysql_error().": ".$query);
|
||||
mysql_error($link) /*.": ".$query*/);
|
||||
$line = mysql_fetch_array($result, MYSQL_ASSOC);
|
||||
mysql_free_result($result);
|
||||
return $line;
|
||||
@ -348,7 +348,7 @@ function select_one_row($query,$link) {
|
||||
|
||||
function select_multi_assoc($query, $link) {
|
||||
$sqlresult = mysql_query($query,$link) or die(' Query failed: ' .
|
||||
mysql_error().": ".$query);
|
||||
mysql_error($link) /*.": ".$query*/);
|
||||
|
||||
$result = array();
|
||||
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) {
|
||||
$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);
|
||||
mysql_free_result($result);
|
||||
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)
|
||||
or die(' Query failed: ' .mysql_error());
|
||||
or die(' Query failed: ' .mysql_error($link));
|
||||
|
||||
$blockedList = array();
|
||||
while ($ban = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
||||
|
@ -49,7 +49,7 @@ function threads_by_userid($userid) {
|
||||
"from ${mysqlprefix}chatthread ".
|
||||
"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();
|
||||
while ($thread = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
||||
|
Loading…
Reference in New Issue
Block a user