mirror of
				https://github.com/Mibew/i18n.git
				synced 2025-10-31 17:31:05 +03:00 
			
		
		
		
	install/update wizard
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@28 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
		
							parent
							
								
									f168f1baaf
								
							
						
					
					
						commit
						c827a85198
					
				| @ -1,5 +1,5 @@ | |||||||
| 
 | 
 | ||||||
| Web Instant Messenger 1.0.7 | Web Instant Messenger 1.0.8 | ||||||
| Copyright (c) 2005-2007 Internet Services Ltd. | Copyright (c) 2005-2007 Internet Services Ltd. | ||||||
| 
 | 
 | ||||||
| This program and the accompanying materials are made available under | This program and the accompanying materials are made available under | ||||||
|  | |||||||
							
								
								
									
										135
									
								
								src/webim/install/dbinfo.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										135
									
								
								src/webim/install/dbinfo.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,135 @@ | |||||||
|  | <?php | ||||||
|  | /* | ||||||
|  |  * This file is part of Web Instant Messenger project. | ||||||
|  |  * | ||||||
|  |  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||||
|  |  * All rights reserved. This program and the accompanying materials | ||||||
|  |  * are made available under the terms of the Eclipse Public License v1.0 | ||||||
|  |  * which accompanies this distribution, and is available at | ||||||
|  |  * http://www.eclipse.org/legal/epl-v10.html | ||||||
|  |  * | ||||||
|  |  * Contributors: | ||||||
|  |  *    Evgeny Gryaznov - initial API and implementation | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | $dbtables = array( | ||||||
|  | 	"chatthread" => array( | ||||||
|  | 		"threadid" => "int NOT NULL auto_increment PRIMARY KEY", | ||||||
|  | 		"userName" => "varchar(64) NOT NULL", | ||||||
|  | 		"agentName" => "varchar(64)", | ||||||
|  | 		"agentId" => "int NOT NULL DEFAULT 0", | ||||||
|  | 		"dtmcreated" => "datetime DEFAULT 0", | ||||||
|  | 		"dtmmodified" => "datetime DEFAULT 0", | ||||||
|  | 		"lrevision" => "int NOT NULL DEFAULT 0", | ||||||
|  | 		"istate" => "int NOT NULL DEFAULT 0", | ||||||
|  | 		"ltoken" => "int NOT NULL", | ||||||
|  | 		"remote" => "varchar(255)", | ||||||
|  | 		"referer" => "text", | ||||||
|  | 		"locale" => "varchar(8)", | ||||||
|  | 		"lastpinguser" => "datetime DEFAULT 0", | ||||||
|  | 		"lastpingagent" => "datetime DEFAULT 0" | ||||||
|  | 	), | ||||||
|  | 
 | ||||||
|  | 	"chatmessage" => array( | ||||||
|  | 		"messageid" => "int NOT NULL auto_increment PRIMARY KEY", | ||||||
|  | 		"threadid" => "int NOT NULL references chatthread(threadid)", | ||||||
|  | 		"ikind" => "int NOT NULL", | ||||||
|  | 		"agentId" => "int NOT NULL DEFAULT 0", | ||||||
|  | 		"tmessage" => "text NOT NULL", | ||||||
|  | 		"dtmcreated" => "datetime DEFAULT 0", | ||||||
|  | 		"tname" => "varchar(64)" | ||||||
|  | 	), | ||||||
|  | 
 | ||||||
|  | 	"chatoperator" => array( | ||||||
|  | 		"operatorid" => "int NOT NULL auto_increment PRIMARY KEY", | ||||||
|  | 		"vclogin" => "varchar(64) NOT NULL", | ||||||
|  | 		"vcpassword" => "varchar(64) NOT NULL", | ||||||
|  | 		"vclocalename" => "varchar(64) NOT NULL", | ||||||
|  | 		"vccommonname" => "varchar(64) NOT NULL", | ||||||
|  | 		"dtmlastvisited" => "datetime DEFAULT 0", | ||||||
|  | 	), | ||||||
|  | 	 | ||||||
|  | 	"chatrevision" => array( | ||||||
|  | 		"id" => "INT NOT NULL" | ||||||
|  | 	) | ||||||
|  | ); | ||||||
|  | 
 | ||||||
|  | $dbtables_can_update = array( | ||||||
|  | 	"chatthread" => array("agentId"), | ||||||
|  | 	"chatmessage" => array("agentId") | ||||||
|  | ); | ||||||
|  | 
 | ||||||
|  | function show_install_err($text) { | ||||||
|  | 	global $page, $version, $errors; | ||||||
|  | 	$page = array(  | ||||||
|  | 		'version' => $version, | ||||||
|  | 		'localeLinks' => get_locale_links("/webim/install/index.php") | ||||||
|  | 	); | ||||||
|  | 	$errors = array($text); | ||||||
|  | 	start_html_output(); | ||||||
|  | 	require('view_installerr.php'); | ||||||
|  | 	exit;	 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function create_table($id,$link) { | ||||||
|  | 	global $dbtables, $dbencoding; | ||||||
|  | 	 | ||||||
|  | 	if(!isset($dbtables[$id])) { | ||||||
|  | 		show_install_err("Unknown table: $id, ".mysql_error()); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	$query =  | ||||||
|  | 		"CREATE TABLE $id\n". | ||||||
|  | 		"(\n"; | ||||||
|  | 	foreach( $dbtables[$id] as $k => $v ) { | ||||||
|  | 		$query .= "	$k $v,\n";  | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	$query = preg_replace("/,\n$/", "", $query); | ||||||
|  | 	$query .= ") charset $dbencoding\n"; | ||||||
|  | 	mysql_query($query,$link)  | ||||||
|  | 		or show_install_err(' Query failed: '.mysql_error()); | ||||||
|  | 	 | ||||||
|  | 	// post create
 | ||||||
|  | 	if( $id == 'chatoperator' ) { | ||||||
|  | 		create_operator_("admin", "", "Administrator", "Administrator", $link);	 | ||||||
|  | 	} else if( $id == 'chatrevision' ) { | ||||||
|  | 		perform_query("INSERT INTO chatrevision VALUES (1)",$link); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function get_tables($link) { | ||||||
|  | 	global $mysqldb, $errors; | ||||||
|  | 	$result = mysql_query("SHOW TABLES FROM $mysqldb"); | ||||||
|  | 	if( $result ) { | ||||||
|  | 		$arr = array(); | ||||||
|  | 		while ($row = mysql_fetch_array($result, MYSQL_NUM)) { | ||||||
|  | 			$arr[] = $row[0]; | ||||||
|  | 		} | ||||||
|  | 		mysql_free_result($result); | ||||||
|  | 		return $arr; | ||||||
|  | 
 | ||||||
|  | 	} else { | ||||||
|  | 		$errors[] = "Cannot get tables from database. Error: ".mysql_error(); | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function get_columns($tablename,$link) { | ||||||
|  | 	global $errors; | ||||||
|  | 	$result = mysql_query("SHOW COLUMNS FROM $tablename"); | ||||||
|  | 	if( $result ) { | ||||||
|  | 		$arr = array(); | ||||||
|  | 		while ($row = mysql_fetch_array($result, MYSQL_NUM)) { | ||||||
|  | 			$arr[] = $row[0]; | ||||||
|  | 		} | ||||||
|  | 		mysql_free_result($result); | ||||||
|  | 		return $arr; | ||||||
|  | 
 | ||||||
|  | 	} else { | ||||||
|  | 		$errors[] = "Cannot get columns from table \"$tablename\". Error: ".mysql_error();
 | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | ?>
 | ||||||
							
								
								
									
										80
									
								
								src/webim/install/dbperform.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								src/webim/install/dbperform.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,80 @@ | |||||||
|  | <?php | ||||||
|  | /* | ||||||
|  |  * This file is part of Web Instant Messenger project. | ||||||
|  |  * | ||||||
|  |  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||||
|  |  * All rights reserved. This program and the accompanying materials | ||||||
|  |  * are made available under the terms of the Eclipse Public License v1.0 | ||||||
|  |  * which accompanies this distribution, and is available at | ||||||
|  |  * http://www.eclipse.org/legal/epl-v10.html | ||||||
|  |  * | ||||||
|  |  * Contributors: | ||||||
|  |  *    Evgeny Gryaznov - initial API and implementation | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | require('../libs/common.php'); | ||||||
|  | require('../libs/operator.php'); | ||||||
|  | require('dbinfo.php'); | ||||||
|  | 
 | ||||||
|  | function runsql($query,$link) { | ||||||
|  | 	mysql_query($query,$link) | ||||||
|  | 		or show_install_err(' Query failed: '.mysql_error()); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | $act = verifyparam( "act", "/^(createdb|createtables|droptables|addcolumns)$/"); | ||||||
|  | $link = @mysql_connect($mysqlhost,$mysqllogin ,$mysqlpass ) | ||||||
|  | 	or show_install_err('Could not connect: ' . mysql_error()); | ||||||
|  | 
 | ||||||
|  | if($act == "createdb") { | ||||||
|  | 	mysql_query("CREATE DATABASE $mysqldb",$link)  | ||||||
|  | 		or show_install_err(' Query failed: '.mysql_error()); | ||||||
|  | } else { | ||||||
|  | 	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); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	if( $act == "createtables") { | ||||||
|  | 		$curr_tables = get_tables($link); | ||||||
|  | 		if( $curr_tables === false) { | ||||||
|  | 			show_install_err($errors[0]); | ||||||
|  | 		} | ||||||
|  | 		$tocreate = array_diff(array_keys($dbtables), $curr_tables); | ||||||
|  | 		foreach( $tocreate as $id) { | ||||||
|  | 			create_table($id, $link); | ||||||
|  | 		} | ||||||
|  | 	} else if( $act == "droptables") { | ||||||
|  | 		foreach( array_keys($dbtables) as $id) { | ||||||
|  | 			mysql_query("DROP TABLE IF EXISTS $id",$link) | ||||||
|  | 				or show_install_err(' Query failed: '.mysql_error()); | ||||||
|  | 		}	 | ||||||
|  | 	} else if( $act == "addcolumns") { | ||||||
|  | 		$absent = array(); | ||||||
|  | 		foreach( $dbtables as $id => $columns) { | ||||||
|  | 			$curr_columns = get_columns($id, $link); | ||||||
|  | 			if( $curr_columns === false ) { | ||||||
|  | 				show_install_err($errors[0]);	 | ||||||
|  | 			} | ||||||
|  | 			$tocreate = array_diff(array_keys($columns), $curr_columns); | ||||||
|  | 			foreach($tocreate as $v) { | ||||||
|  | 				$absent[] = "$id.$v"; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
|  | 		if( in_array("chatmessage.agentId", $absent) ) { | ||||||
|  | 			runsql("ALTER TABLE chatmessage ADD agentId int NOT NULL DEFAULT 0 AFTER ikind", $link); | ||||||
|  | 			runsql("update chatmessage,chatoperator set agentId = operatorid where agentId = 0 AND ikind = 2 AND (vclocalename = tname OR vccommonname = tname)", $link);  | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
|  | 		if( in_array("chatthread.agentId", $absent) ) { | ||||||
|  | 			runsql("ALTER TABLE chatthread ADD agentId int NOT NULL DEFAULT 0 AFTER agentName", $link); | ||||||
|  | 			runsql("update chatthread,chatoperator set agentId = operatorid where agentId = 0 AND (vclocalename = agentName OR vccommonname = agentName)", $link);  | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | mysql_close($link); | ||||||
|  | header("Location: ".dirname($_SERVER['PHP_SELF'])."/index.php"); | ||||||
|  | exit; | ||||||
|  | ?>
 | ||||||
| @ -13,7 +13,138 @@ | |||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| require('../libs/common.php'); | require('../libs/common.php'); | ||||||
|  | require('dbinfo.php'); | ||||||
|  | 
 | ||||||
|  | $page = array( | ||||||
|  | 	'version' => $version, | ||||||
|  | 	'localeLinks' => get_locale_links("/webim/install/index.php") | ||||||
|  | ); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | $page['done'] = array(); | ||||||
|  | $page['nextstep'] = false; | ||||||
|  | $page['nextnotice'] = false; | ||||||
|  | $errors = array(); | ||||||
|  | 
 | ||||||
|  | function check_connection() { | ||||||
|  | 	global $mysqlhost,$mysqllogin,$mysqlpass, $page, $errors; | ||||||
|  | 	$link = @mysql_connect($mysqlhost,$mysqllogin,$mysqlpass); | ||||||
|  | 	if ($link) { | ||||||
|  | 		$result = mysql_query("SELECT VERSION() as c", $link); | ||||||
|  | 		if( $result && $ver = mysql_fetch_array($result, MYSQL_ASSOC)) { | ||||||
|  | 			$page['done'][] = getstring2("install.1.connected", array($ver['c'])); | ||||||
|  | 			mysql_free_result($result); | ||||||
|  | 		} else { | ||||||
|  | 			$errors[] = "Version of your SQL server is unknown. Please check. Error: ".mysql_error(); | ||||||
|  | 			mysql_close($link); | ||||||
|  | 			return null; | ||||||
|  | 		} | ||||||
|  | 		return $link; | ||||||
|  | 	} else { | ||||||
|  | 		$errors[] = getstring2("install.connection.error", array(mysql_error())); | ||||||
|  | 		return null; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function check_database($link) { | ||||||
|  | 	global $mysqldb, $force_charset_in_connection, $dbencoding, $page; | ||||||
|  | 	if(mysql_select_db($mysqldb,$link)) { | ||||||
|  | 		$page['done'][] = getstring2("install.2.db_exists", array($mysqldb)); | ||||||
|  | 		if( $force_charset_in_connection ) { | ||||||
|  | 			mysql_query("SET character set $dbencoding", $link); | ||||||
|  | 		} | ||||||
|  | 		return true; | ||||||
|  | 	} else { | ||||||
|  | 		$page['nextstep'] = getstring2("install.2.create", array($mysqldb)); | ||||||
|  | 		$page['nextnotice'] = getstring("install.2.notice"); | ||||||
|  | 		$page['nextstepurl'] = "dbperform.php?act=createdb"; | ||||||
|  | 	} | ||||||
|  | 	return false; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function check_tables($link) { | ||||||
|  | 	global $dbtables, $page; | ||||||
|  | 	$curr_tables = get_tables($link); | ||||||
|  | 	if( $curr_tables !== false) { | ||||||
|  | 		$tocreate = array_diff(array_keys($dbtables), $curr_tables); | ||||||
|  | 		if( count($tocreate) == 0 ) { | ||||||
|  | 			$page['done'][] = getstring("install.3.tables_exist"); | ||||||
|  | 			return true; | ||||||
|  | 		} else { | ||||||
|  | 			$page['nextstep'] = getstring("install.3.create"); | ||||||
|  | 			$page['nextstepurl'] = "dbperform.php?act=createtables"; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	return false; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function check_columns($link) { | ||||||
|  | 	global $dbtables, $dbtables_can_update, $errors, $page; | ||||||
|  | 
 | ||||||
|  | 	$need_to_create_columns = false; | ||||||
|  | 	foreach( $dbtables as $id => $columns) { | ||||||
|  | 		$curr_columns = get_columns($id, $link); | ||||||
|  | 		if( $curr_columns === false ) { | ||||||
|  | 			return false; | ||||||
|  | 		} | ||||||
|  | 		$tocreate = array_diff(array_keys($columns), $curr_columns); | ||||||
|  | 		if( count($tocreate) != 0 ) { | ||||||
|  | 			$cannot_update = array_diff($tocreate, $dbtables_can_update[$id]); | ||||||
|  | 			if( count($cannot_update) != 0) { | ||||||
|  | 				$errors[] = "Key columns are absent in table `$id'. Unable to continue installation."; | ||||||
|  | 				$page['nextstep'] = getstring("install.kill_tables"); | ||||||
|  | 				$page['nextstepurl'] = "dbperform.php?act=droptables"; | ||||||
|  | 				$page['nextnotice'] = getstring("install.kill_tables.notice"); | ||||||
|  | 				return false; | ||||||
|  | 			} | ||||||
|  | 			$need_to_create_columns = true; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if( $need_to_create_columns ) { | ||||||
|  | 		$page['nextstep'] = getstring("install.4.create"); | ||||||
|  | 		$page['nextstepurl'] = "dbperform.php?act=addcolumns"; | ||||||
|  | 		$page['nextnotice'] = getstring("install.4.notice"); | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	$page['done'][] = getstring("install.4.done"); | ||||||
|  | 	return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function check_status() { | ||||||
|  | 	global $page; | ||||||
|  | 	$link = check_connection(); | ||||||
|  | 	if(!$link) { | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if( !check_database($link)) { | ||||||
|  | 		mysql_close($link); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if( !check_tables($link)) { | ||||||
|  | 		mysql_close($link); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if( !check_columns($link)) { | ||||||
|  | 		mysql_close($link); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	$page['done'][] = getstring("installed.message"); | ||||||
|  | 
 | ||||||
|  | 	$page['nextstep'] = getstring("installed.login_link"); | ||||||
|  | 	$page['nextnotice'] = getstring("installed.notice"); | ||||||
|  | 	$page['nextstepurl'] = "/webim/"; | ||||||
|  | 
 | ||||||
|  | 	mysql_close($link); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | check_status(); | ||||||
| 
 | 
 | ||||||
| start_html_output(); | start_html_output(); | ||||||
| require('view_index.php'); | require('view_index.php'); | ||||||
| ?>
 | ?>
 | ||||||
| @ -1,98 +0,0 @@ | |||||||
| <?php |  | ||||||
| /* |  | ||||||
|  * This file is part of Web Instant Messenger project. |  | ||||||
|  * |  | ||||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. |  | ||||||
|  * All rights reserved. This program and the accompanying materials |  | ||||||
|  * are made available under the terms of the Eclipse Public License v1.0 |  | ||||||
|  * which accompanies this distribution, and is available at |  | ||||||
|  * http://www.eclipse.org/legal/epl-v10.html |  | ||||||
|  * |  | ||||||
|  * Contributors: |  | ||||||
|  *    Evgeny Gryaznov - initial API and implementation |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| require('../libs/common.php'); |  | ||||||
| require('../libs/operator.php'); |  | ||||||
| 
 |  | ||||||
| function drop_tables() { |  | ||||||
| 	$link = connect(); |  | ||||||
| 	perform_query("DROP TABLE IF EXISTS chatthread",$link); |  | ||||||
| 	perform_query("DROP TABLE IF EXISTS chatmessage",$link); |  | ||||||
| 	perform_query("DROP TABLE IF EXISTS chatrevision",$link); |  | ||||||
| 	perform_query("DROP TABLE IF EXISTS chatoperator",$link); |  | ||||||
| 	mysql_close($link); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| function create_tables() { |  | ||||||
| 	global $dbencoding; |  | ||||||
| 	$link = connect(); |  | ||||||
| 
 |  | ||||||
| 	// to update from v1
 |  | ||||||
| 	// ALTER TABLE chatthread ADD agentId int NOT NULL DEFAULT 0 AFTER agentName
 |  | ||||||
| 	// update chatthread,chatoperator set agentId = operatorid where agentId = 0 AND (vclocalename = agentName OR vccommonname = agentName) 
 |  | ||||||
| 	// ALTER TABLE chatmessage ADD agentId int NOT NULL DEFAULT 0 AFTER ikind
 |  | ||||||
| 	// update chatmessage,chatoperator set agentId = operatorid where agentId = 0 AND ikind = 2 AND (vclocalename = tname OR vccommonname = tname) 
 |  | ||||||
| 	 |  | ||||||
| 	$query =  |  | ||||||
| 		"CREATE TABLE chatthread (\n". |  | ||||||
| 		"	threadid int NOT NULL auto_increment PRIMARY KEY ,\n". |  | ||||||
| 		"	userName varchar(64) NOT NULL,\n". |  | ||||||
| 		"	agentName varchar(64),\n". |  | ||||||
| 		"   agentId int NOT NULL DEFAULT 0,\n". |  | ||||||
| 		"	dtmcreated datetime DEFAULT 0,\n". |  | ||||||
| 		"	dtmmodified datetime DEFAULT 0,\n". |  | ||||||
| 		"	lrevision int NOT NULL DEFAULT 0,\n". |  | ||||||
| 		"	istate int NOT NULL DEFAULT 0,\n". |  | ||||||
| 		"	ltoken int NOT NULL,\n". |  | ||||||
| 		"	remote varchar(255),\n". |  | ||||||
| 		"	referer text,\n". |  | ||||||
| 		"	locale varchar(8),\n". |  | ||||||
| 		"	lastpinguser datetime DEFAULT 0,\n". |  | ||||||
| 		"	lastpingagent datetime DEFAULT 0\n". |  | ||||||
| 		") charset $dbencoding\n"; |  | ||||||
| 
 |  | ||||||
| 	perform_query($query,$link);	 |  | ||||||
| 
 |  | ||||||
| 	$query =  |  | ||||||
| 		"CREATE TABLE chatmessage\n". |  | ||||||
| 		"(\n". |  | ||||||
| 		"	messageid int NOT NULL auto_increment PRIMARY KEY,\n". |  | ||||||
| 		"	threadid int NOT NULL references chatthread(threadid),\n". |  | ||||||
| 		"	ikind int NOT NULL,\n". |  | ||||||
| 		"   agentId int NOT NULL DEFAULT 0,\n". |  | ||||||
| 		"	tmessage text NOT NULL,\n". |  | ||||||
| 		"	dtmcreated datetime DEFAULT 0,\n". |  | ||||||
| 		"	tname varchar(64)\n". |  | ||||||
| 		") charset $dbencoding\n"; |  | ||||||
| 
 |  | ||||||
| 	perform_query($query,$link);	 |  | ||||||
| 
 |  | ||||||
| 	perform_query("CREATE TABLE chatrevision (id INT NOT NULL)",$link);	 |  | ||||||
| 	perform_query("INSERT INTO chatrevision VALUES (1)",$link);	 |  | ||||||
| 
 |  | ||||||
| 	$query =  |  | ||||||
| 		"CREATE TABLE chatoperator\n". |  | ||||||
| 		"(\n". |  | ||||||
| 		"	operatorid int NOT NULL auto_increment PRIMARY KEY,\n". |  | ||||||
| 		"	vclogin varchar(64) NOT NULL,\n". |  | ||||||
| 		"	vcpassword varchar(64) NOT NULL,\n". |  | ||||||
| 		"	vclocalename varchar(64) NOT NULL,\n". |  | ||||||
| 		"	vccommonname varchar(64) NOT NULL,\n". |  | ||||||
| 		"	dtmlastvisited datetime DEFAULT 0\n". |  | ||||||
| 		") charset $dbencoding\n"; |  | ||||||
| 
 |  | ||||||
| 	perform_query($query,$link);	 |  | ||||||
| 
 |  | ||||||
| 	mysql_close($link); |  | ||||||
| 
 |  | ||||||
| 	create_operator("admin", "", "Administrator", "Administrator"); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| drop_tables(); |  | ||||||
| create_tables(); |  | ||||||
| 
 |  | ||||||
| start_html_output(); |  | ||||||
| require('view_install.php'); |  | ||||||
| 
 |  | ||||||
| ?>
 |  | ||||||
| @ -39,15 +39,66 @@ | |||||||
| 	 | 	 | ||||||
| 
 | 
 | ||||||
| 	<?php echo getstring("install.message") ?>
 | 	<?php echo getstring("install.message") ?>
 | ||||||
| <br/> | <br /> | ||||||
| <br/> | <br /> | ||||||
|  | <?php if( isset($errors) && count($errors) > 0 ) { ?>
 | ||||||
|  | 		<table cellspacing="0" cellpadding="0" border="0"> | ||||||
|  | 		<tr> | ||||||
|  | 	    <td valign="top"><img src='/webim/images/icon_err.gif' width="40" height="40" border="0" alt="" /></td> | ||||||
|  | 	    <td width="10"></td> | ||||||
|  | 	    <td class="text"> | ||||||
|  | 		    <?php	if( isset($errors) && count($errors) > 0 ) { | ||||||
|  | 		print getstring("errors.header"); | ||||||
|  | 		foreach( $errors as $e ) { | ||||||
|  | 			print getstring("errors.prefix"); | ||||||
|  | 			print $e; | ||||||
|  | 			print getstring("errors.suffix"); | ||||||
|  | 		} | ||||||
|  | 		print getstring("errors.footer"); | ||||||
|  | 	} ?>
 | ||||||
| 
 | 
 | ||||||
| <a href="install.php"><?php echo getstring("install.create_db_link") ?></a>
 | 		</td> | ||||||
|  | 		</tr> | ||||||
|  | 		</table> | ||||||
|  | 	<?php } ?>
 | ||||||
| 
 | 
 | ||||||
| <br/> | <?php if( $page['done'] ) { ?>
 | ||||||
| <br/> | <table cellspacing='0' cellpadding='0' border='0'><tr><td background='/webim/images/loginbg.gif'><table cellspacing='0' cellpadding='0' border='0'><tr><td><img src='/webim/images/logincrnlt.gif' width='16' height='16' border='0' alt=''></td><td></td><td><img src='/webim/images/logincrnrt.gif' width='16' height='16' border='0' alt=''></td></tr><tr><td></td><td align='center'><table border='0' cellspacing='0' cellpadding='0'><tr><td align="left" class="text"> | ||||||
|  | <?php echo getstring("install.done") ?>
 | ||||||
|  | <ul> | ||||||
|  | <?php foreach( $page['done'] as $info ) { ?>
 | ||||||
|  | <li><?php echo $info ?></li>
 | ||||||
|  | <?php } ?>
 | ||||||
|  | </ul> | ||||||
|  | </td></tr> | ||||||
|  | <?php if( $page['nextstep'] ) { ?>
 | ||||||
|  | <tr><td align="left" class="text"> | ||||||
|  | <?php echo getstring("install.next") ?>
 | ||||||
|  | <ul> | ||||||
|  | <li> | ||||||
|  | <?php if( $page['nextnotice'] ) { ?><?php echo $page['nextnotice'] ?><br/><br/><?php } ?>
 | ||||||
|  | <a href="<?php echo $page['nextstepurl'] ?>"><?php echo $page['nextstep'] ?></a>
 | ||||||
|  | </li> | ||||||
|  | </ul> | ||||||
|  | </td></tr> | ||||||
|  | <?php } ?>
 | ||||||
|  | </table></td><td></td></tr><tr><td><img src='/webim/images/logincrnlb.gif' width='16' height='16' border='0' alt=''></td><td></td><td><img src='/webim/images/logincrnrb.gif' width='16' height='16' border='0' alt=''></td></tr></table></td></tr></table> | ||||||
|  | <?php } ?>
 | ||||||
|  | 
 | ||||||
|  | <table width="200" cellspacing="0" cellpadding="0" border="0"> | ||||||
|  | <tr> | ||||||
|  |   <td height="20"></td> | ||||||
|  | </tr> | ||||||
|  | <tr> | ||||||
|  |   <td bgcolor="#D6D6D6"><img src="/webim/images/free.gif" height="1" width="1" border="0" alt=""></td> | ||||||
|  | </tr> | ||||||
|  | <tr> | ||||||
|  |   <td height="7"></td> | ||||||
|  | </tr> | ||||||
|  | </table> | ||||||
|  | 
 | ||||||
|  | Web Messenger/<?php echo $page['version'] ?> • <?php echo $page['localeLinks'] ?> • <a href="/webim/epl-v10.html" target="_blank"><?php echo getstring("install.license") ?></a>
 | ||||||
| 
 | 
 | ||||||
| <a href="/webim/epl-v10.html" target="_blank"><?php echo getstring("install.license") ?></a>
 |  | ||||||
| </td> | </td> | ||||||
| </tr> | </tr> | ||||||
| </table> | </table> | ||||||
|  | |||||||
| @ -22,7 +22,7 @@ | |||||||
| 
 | 
 | ||||||
| <link rel="shortcut icon" href="/webim/images/favicon.ico" type="image/x-icon"/> | <link rel="shortcut icon" href="/webim/images/favicon.ico" type="image/x-icon"/> | ||||||
| <title> | <title> | ||||||
| 	<?php echo getstring("app.title") ?>	- <?php echo getstring("installed.title") ?>
 | 	<?php echo getstring("app.title") ?>	- <?php echo getstring("install.err.title") ?>
 | ||||||
| </title> | </title> | ||||||
| 
 | 
 | ||||||
| <meta http-equiv="keywords" content="<?php echo getstring("page.main_layout.meta_keyword") ?>"> | <meta http-equiv="keywords" content="<?php echo getstring("page.main_layout.meta_keyword") ?>"> | ||||||
| @ -35,19 +35,47 @@ | |||||||
| <tr> | <tr> | ||||||
| <td valign="top" class="text"> | <td valign="top" class="text"> | ||||||
| 	 | 	 | ||||||
| 		<h1><?php echo getstring("installed.title") ?></h1>
 | 		<h1><?php echo getstring("install.err.title") ?></h1>
 | ||||||
| 	 | 	 | ||||||
| 
 | 
 | ||||||
| 	<?php echo getstring("installed.message") ?>
 | 	<?php if( isset($errors) && count($errors) > 0 ) { ?>
 | ||||||
| <br/> | 		<table cellspacing="0" cellpadding="0" border="0"> | ||||||
| <br/> | 		<tr> | ||||||
|  | 	    <td valign="top"><img src='/webim/images/icon_err.gif' width="40" height="40" border="0" alt="" /></td> | ||||||
|  | 	    <td width="10"></td> | ||||||
|  | 	    <td class="text"> | ||||||
|  | 		    <?php	if( isset($errors) && count($errors) > 0 ) { | ||||||
|  | 		print getstring("errors.header"); | ||||||
|  | 		foreach( $errors as $e ) { | ||||||
|  | 			print getstring("errors.prefix"); | ||||||
|  | 			print $e; | ||||||
|  | 			print getstring("errors.suffix"); | ||||||
|  | 		} | ||||||
|  | 		print getstring("errors.footer"); | ||||||
|  | 	} ?>
 | ||||||
| 
 | 
 | ||||||
| <a href="/webim/operator/login.php"><?php echo getstring("installed.login_link") ?></a>
 | 		</td> | ||||||
|  | 		</tr> | ||||||
|  | 		</table> | ||||||
|  | 	<?php } ?>
 | ||||||
| 
 | 
 | ||||||
| <br/> | <br/> | ||||||
| <br/> | <?php echo getstring("install.err.back") ?>
 | ||||||
|  | 
 | ||||||
|  | <table width="200" cellspacing="0" cellpadding="0" border="0"> | ||||||
|  | <tr> | ||||||
|  |   <td height="20"></td> | ||||||
|  | </tr> | ||||||
|  | <tr> | ||||||
|  |   <td bgcolor="#D6D6D6"><img src="/webim/images/free.gif" height="1" width="1" border="0" alt=""></td> | ||||||
|  | </tr> | ||||||
|  | <tr> | ||||||
|  |   <td height="7"></td> | ||||||
|  | </tr> | ||||||
|  | </table> | ||||||
|  | 
 | ||||||
|  | Web Messenger/<?php echo $page['version'] ?> • <?php echo $page['localeLinks'] ?> • <a href="/webim/epl-v10.html" target="_blank"><?php echo getstring("install.license") ?></a>
 | ||||||
| 
 | 
 | ||||||
| <a href="/webim/LICENSE.html" target="_blank"><?php echo getstring("install.license") ?></a>
 |  | ||||||
| </td> | </td> | ||||||
| </tr> | </tr> | ||||||
| </table> | </table> | ||||||
| @ -1,4 +1,9 @@ | |||||||
| 
 | 
 | ||||||
|  |   1.0.8 | ||||||
|  |   ----- | ||||||
|  | 
 | ||||||
|  |   [+] install/update wizard | ||||||
|  | 
 | ||||||
|   1.0.7 |   1.0.7 | ||||||
|   ----- |   ----- | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -18,6 +18,7 @@ require(dirname(__FILE__).'/converter.php'); | |||||||
| require(dirname(__FILE__).'/config.php'); | require(dirname(__FILE__).'/config.php'); | ||||||
| 
 | 
 | ||||||
| $webimroot = "/webim";                      # absolute path on server
 | $webimroot = "/webim";                      # absolute path on server
 | ||||||
|  | $version = 'v1.0.8 pre1'; | ||||||
| 
 | 
 | ||||||
| function myiconv($in_enc, $out_enc, $string) { | function myiconv($in_enc, $out_enc, $string) { | ||||||
| 	global $_utf8win1251, $_win1251utf8; | 	global $_utf8win1251, $_win1251utf8; | ||||||
| @ -120,6 +121,20 @@ function set_locale($locale) { | |||||||
| $current_locale = get_locale(); | $current_locale = get_locale(); | ||||||
| $messages = array(); | $messages = array(); | ||||||
| 
 | 
 | ||||||
|  | function get_locale_links($href) { | ||||||
|  | 	global $available_locales, $current_locale; | ||||||
|  | 	$localeLinks = ""; | ||||||
|  | 	foreach($available_locales as $k) { | ||||||
|  | 		if( strlen($localeLinks) > 0 ) | ||||||
|  | 			$localeLinks .= " • "; | ||||||
|  | 		if( $k == $current_locale ) | ||||||
|  | 			$localeLinks .= $k; | ||||||
|  | 		else | ||||||
|  | 			$localeLinks .= "<a href=\"$href?locale=$k\">$k</a>";
 | ||||||
|  | 	} | ||||||
|  | 	return $localeLinks; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| function load_messages($locale) { | function load_messages($locale) { | ||||||
| 	global $messages; | 	global $messages; | ||||||
| 	$hash = array(); | 	$hash = array(); | ||||||
| @ -167,17 +182,18 @@ function getstring2($text,$params) { | |||||||
| 
 | 
 | ||||||
| function connect() { | function connect() { | ||||||
| 	global $mysqlhost, $mysqllogin, $mysqlpass, $mysqldb, $dbencoding, $force_charset_in_connection; | 	global $mysqlhost, $mysqllogin, $mysqlpass, $mysqldb, $dbencoding, $force_charset_in_connection; | ||||||
| 	$link = mysql_connect($mysqlhost,$mysqllogin ,$mysqlpass ) | 	$link = @mysql_connect($mysqlhost,$mysqllogin ,$mysqlpass ) | ||||||
| 		or die('Could not connect: ' . mysql_error()); | 		or die('Could not connect: ' . mysql_error()); | ||||||
| 	mysql_select_db($mysqldb) or die('Could not select database'); | 	mysql_select_db($mysqldb,$link) or die('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); | ||||||
|  | 	} | ||||||
| 	return $link; | 	return $link; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function perform_query($query,$link) { | function perform_query($query,$link) { | ||||||
| 	mysql_query($query,$link) or die(' Query failed: ' .  | 	mysql_query($query,$link)  | ||||||
| 		mysql_error().": ".$query); | 		or die(' Query failed: '.mysql_error()/*.": ".$query*/); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function select_one_row($query,$link) { | function select_one_row($query,$link) { | ||||||
|  | |||||||
| @ -62,9 +62,7 @@ function update_operator($operatorid,$login,$password,$localename,$commonname) { | |||||||
| 	mysql_close($link); | 	mysql_close($link); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function create_operator($login,$password,$localename,$commonname) { | function create_operator_($login,$password,$localename,$commonname,$link) { | ||||||
| 	$link = connect(); |  | ||||||
| 
 |  | ||||||
| 	$query = sprintf( | 	$query = sprintf( | ||||||
| 		"insert into chatoperator (vclogin,vcpassword,vclocalename,vccommonname) values ('%s','%s','%s','%s')", | 		"insert into chatoperator (vclogin,vcpassword,vclocalename,vccommonname) values ('%s','%s','%s','%s')", | ||||||
| 			mysql_real_escape_string($login), | 			mysql_real_escape_string($login), | ||||||
| @ -75,7 +73,12 @@ function create_operator($login,$password,$localename,$commonname) { | |||||||
| 	perform_query($query,$link); | 	perform_query($query,$link); | ||||||
| 	$id = mysql_insert_id($link); | 	$id = mysql_insert_id($link); | ||||||
| 
 | 
 | ||||||
| 	$newop = select_one_row("select * from chatoperator where operatorid = $id", $link ); | 	return select_one_row("select * from chatoperator where operatorid = $id", $link ); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function create_operator($login,$password,$localename,$commonname) { | ||||||
|  | 	$link = connect(); | ||||||
|  | 	$newop = create_operator_($login,$password,$localename,$commonname,$link); | ||||||
| 	mysql_close($link); | 	mysql_close($link); | ||||||
| 	return $newop; | 	return $newop; | ||||||
| } | } | ||||||
|  | |||||||
| @ -19,21 +19,10 @@ $operator = check_login(); | |||||||
| 
 | 
 | ||||||
| $page = array(  | $page = array(  | ||||||
| 	'operator' => get_operator_name($operator), | 	'operator' => get_operator_name($operator), | ||||||
| 	'version' => 'v1.0.7' | 	'version' => $version, | ||||||
|  | 	'localeLinks' => get_locale_links("/webim/operator/index.php") | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| $localeLinks = ""; |  | ||||||
| foreach($available_locales as $k) { |  | ||||||
| 	if( strlen($localeLinks) > 0 ) |  | ||||||
| 		$localeLinks .= " • "; |  | ||||||
| 	if( $k == $current_locale ) |  | ||||||
| 		$localeLinks .= $k; |  | ||||||
| 	else |  | ||||||
| 		$localeLinks .= "<a href=\"/webim/operator/index.php?locale=$k\">$k</a>";
 |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| $page['localeLinks'] = $localeLinks; |  | ||||||
| 
 |  | ||||||
| start_html_output(); | start_html_output(); | ||||||
| require('../view/menu.php'); | require('../view/menu.php'); | ||||||
| ?>
 | ?>
 | ||||||
| @ -131,13 +131,28 @@ content.history=Search the dialogs history | |||||||
| content.logoff=Log out of the system. | content.logoff=Log out of the system. | ||||||
| form.field.agent_commonname=International name (Latin) | form.field.agent_commonname=International name (Latin) | ||||||
| form.field.agent_commonname.description=This name will be seen by your visitors | form.field.agent_commonname.description=This name will be seen by your visitors | ||||||
| install.create_db_link=Create tables in MySQL database | install.1.connected=You are connected to MySQL server version {0} | ||||||
|  | install.2.create=Create database "{0}" | ||||||
|  | install.2.db_exists=Database "{0}" is created. | ||||||
|  | install.2.notice=Database was not found on server. If you have permissions to create<br/> it now, click on the following link. | ||||||
|  | install.3.create=Create required tables. | ||||||
|  | install.3.tables_exist=Requred tables are created. | ||||||
|  | install.4.create=Update tables | ||||||
|  | install.4.done=Tables structure is up to date. | ||||||
|  | install.4.notice=Structure of your tables should be adjusted for new version of Messenger.  | ||||||
|  | install.connection.error=Could not connect, please check server settings in config.php. Error: {0} | ||||||
|  | install.done=Completed: | ||||||
|  | install.err.back=Resvole problem and try again. Press <a>back</a> to return to wizard. | ||||||
|  | install.err.title=Problem | ||||||
|  | install.kill_tables=Drop existing tables from database | ||||||
|  | install.kill_tables.notice=Impossible to update tables structure. Try to do it manually or recreate all tables (warning: all your data will be lost). | ||||||
| install.license=Software license agreement | install.license=Software license agreement | ||||||
| install.message=We are ready to complete installation by creating tables. | install.message=Follow the wizard to setup your database.  | ||||||
| install.title=System setup | install.next=Next step: | ||||||
|  | install.title=Installation | ||||||
| installed.login_link=Proceed to login page | installed.login_link=Proceed to login page | ||||||
| installed.message=Tables were created successfully. You can logon as admin with empty password. For security reasons, please <br/>change your password immediately and remove /webim/install folder from your server. | installed.message=<b>Application installed successfully.</b> | ||||||
| installed.title=Application installed successfully | installed.notice=You can logon as admin with empty password. For security reasons, please <br/>change your password immediately and remove /webim/install folder from your server. | ||||||
| menu.agents=Agents list | menu.agents=Agents list | ||||||
| menu.main=Main | menu.main=Main | ||||||
| menu.operator=You are {0} | menu.operator=You are {0} | ||||||
|  | |||||||
| @ -131,13 +131,28 @@ content.history= | |||||||
| content.logoff=Ïîêèíóòü ñèñòåìó. | content.logoff=Ïîêèíóòü ñèñòåìó. | ||||||
| form.field.agent_commonname=Èíòåðíàöèîíàëüíîå èìÿ (ëàòèíèöåé) | form.field.agent_commonname=Èíòåðíàöèîíàëüíîå èìÿ (ëàòèíèöåé) | ||||||
| form.field.agent_commonname.description=Ïîä ýòèì èìåíåì Âàñ óâèäÿò âàøè ïîñåòèòåëè èç äðóãèõ ñòðàí | form.field.agent_commonname.description=Ïîä ýòèì èìåíåì Âàñ óâèäÿò âàøè ïîñåòèòåëè èç äðóãèõ ñòðàí | ||||||
| install.create_db_link=Создать необходимые таблицы в базе данных | install.1.connected=Вы подсоединены к серверу MySQL версии {0}. | ||||||
|  | install.2.create=Создать базу данных "{0}" | ||||||
|  | install.2.db_exists=Создана база данных "{0}". | ||||||
|  | install.2.notice=База, которую вы выбрали не существует на сервере. Если у вас есть права <br/>на ее создание, ее можно создать сейчас.  | ||||||
|  | install.3.create=Создать необходимые таблицы. | ||||||
|  | install.3.tables_exist=Необходимые таблицы созданы. | ||||||
|  | install.4.create=Обновить  | ||||||
|  | install.4.done=Структура таблиц готова к использованию. | ||||||
|  | install.4.notice=Необходимо обновить структуру таблиц для корректной работы Вэб Мессенджера. | ||||||
|  | install.connection.error=Нет доступа к MySQL серверу, проверьте настройки в config.php. Ошибка: {0} | ||||||
|  | install.done=Выполнено: | ||||||
|  | install.err.back=Исправьте проблему и попробуйте еще раз. Нажмите <a>назад</a> чтобы вернуться к мастеру установки. | ||||||
|  | install.err.title=Ошибка | ||||||
|  | install.kill_tables=Удалить существующие таблицы | ||||||
|  | install.kill_tables.notice=Невозможно обновить структуру таблиц. Попробуйте сделать это вручную или пересоздайте все таблицы заново. | ||||||
| install.license=Ëèöåíçèîííîå ñîãëàøåíèå î ïðîãðàììíîì îáåñïå÷åíèè | install.license=Ëèöåíçèîííîå ñîãëàøåíèå î ïðîãðàììíîì îáåñïå÷åíèè | ||||||
| install.message=Для окончания установки необходимо создать таблицы. | install.message=Следуйте указаниям мастера для правильной настройки базы данных. | ||||||
|  | install.next=Следующий шаг: | ||||||
| install.title=Óñòàíîâêà | install.title=Óñòàíîâêà | ||||||
| installed.login_link=Âîéòè â ñèñòåìó | installed.login_link=Âîéòè â ñèñòåìó | ||||||
| installed.message=Необходимые таблицы были созданы. Вы можете войти в систему как admin с пустым паролем.<br/>В целях безопасности, удалите, пожалуйста, каталог /webim/install с вашего сервера и поменяйте пароль. | installed.message=<b>Установка успешно завершена. </b> | ||||||
| installed.title=Установка завершена | installed.notice=Вы можете войти в систему как admin с пустым паролем.<br/>В целях безопасности, удалите, пожалуйста, каталог /webim/install с вашего сервера и поменяйте пароль. | ||||||
| menu.agents=Ñïèñîê àãåíòîâ | menu.agents=Ñïèñîê àãåíòîâ | ||||||
| menu.main=Ãëàâíàÿ | menu.main=Ãëàâíàÿ | ||||||
| menu.operator=Âû {0} | menu.operator=Âû {0} | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user