From 47b4a82da2a674b575335d36c9cc6aa5c0752d72 Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Sun, 2 May 2010 18:20:55 +0000 Subject: [PATCH] check webimroot variable during installation git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@804 c66351dc-e62f-0410-b875-e3a5c0b9693f --- src/messenger/webim/install/index.php | 26 ++++++++++++++++++++++- src/messenger/webim/locales/en/properties | 3 ++- src/messenger/webim/locales/ru/properties | 3 ++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/messenger/webim/install/index.php b/src/messenger/webim/install/index.php index fb3e4bb9..d159d304 100644 --- a/src/messenger/webim/install/index.php +++ b/src/messenger/webim/install/index.php @@ -33,6 +33,25 @@ $page['nextstep'] = false; $page['nextnotice'] = false; $errors = array(); +function check_webimroot() { + global $page, $errors, $webimroot; + $requestUri = $_SERVER["REQUEST_URI"]; + if(!preg_match('/^(.*)\\/install(\\/[^\\/\\\\]*)?$/', $requestUri, $matches)) { + $errors[] = "Cannot detect application location: $requestUri"; + return false; + } + $applocation = $matches[1]; + + if($applocation != $webimroot) { + $errors[] = "Please, check file ${applocation}/libs/config.php
Wrong value of \$webimroot variable, should be \"$applocation\""; + $webimroot = $applocation; + return false; + } + + $page['done'][] = getlocal2("install.0.app", array($applocation)); + return true; +} + function check_connection() { global $mysqlhost,$mysqllogin,$mysqlpass, $page, $errors, $webimroot; $link = @mysql_connect($mysqlhost,$mysqllogin,$mysqlpass); @@ -121,6 +140,11 @@ function check_columns($link) { function check_status() { global $page, $webimroot, $settings, $dbversion; + + if(!check_webimroot()) { + return; + } + $link = check_connection(); if(!$link) { return; @@ -144,7 +168,7 @@ function check_status() { $page['done'][] = getlocal("installed.message"); $page['nextstep'] = getlocal("installed.login_link"); - $page['nextnotice'] = getlocal("installed.notice"); + $page['nextnotice'] = getlocal2("installed.notice", array($webimroot."/install/")); $page['nextstepurl'] = "$webimroot/"; $page['show_small_login'] = true; diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties index 180edc52..1753d617 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -168,6 +168,7 @@ image.button.search=/locales/en/images/search.gif image.chat.history=/locales/en/images/history.gif image.chat.message=/locales/en/images/message.gif image.chat.sprite=/locales/en/images/wmchat.png +install.0.app=Application path is {0} 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. @@ -191,7 +192,7 @@ install.title=Installation install.updatedb=Please, run Update wizard to adjust your database. installed.login_link=Proceed to login page installed.message=Application installed successfully. -installed.notice=You can logon as admin with empty password.

!!! For security reasons, please change your password immediately and remove /webim/install folder from your server. +installed.notice=You can logon as admin with empty password.

!!! For security reasons, please change your password immediately and remove {0} folder from your server. lang.choose=Choose your language leavemail.body=Your have a message from {0}:\n\n{2}\n\nHis email: {1}\n{3}\n--- \nYours site messenger leavemail.subject=Question from {0} diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties index 60ace934..31f50011 100644 --- a/src/messenger/webim/locales/ru/properties +++ b/src/messenger/webim/locales/ru/properties @@ -168,6 +168,7 @@ image.button.search=/locales/ru/images/search.gif image.chat.history=/locales/ru/images/history.gif image.chat.message=/locales/ru/images/message.gif image.chat.sprite=/locales/ru/images/wmchat.png +install.0.app=Приложение найдено по адресу {0} install.1.connected=Вы подсоединены к серверу MySQL версии {0} install.2.create=Создать базу данных "{0}" install.2.db_exists=Создана база данных "{0}". @@ -191,7 +192,7 @@ install.title= install.updatedb=Пожалуйста, запустите Мастер обновления базы данных. installed.login_link=Войти в систему installed.message=Установка успешно завершена. -installed.notice=Вы можете войти в систему как admin с пустым паролем.

!!! В целях безопасности, удалите, пожалуйста, каталог /webim/install с вашего сервера и поменяйте пароль. +installed.notice=Вы можете войти в систему как admin с пустым паролем.

!!! В целях безопасности, удалите, пожалуйста, каталог {0} с вашего сервера и поменяйте пароль. lang.choose=Выберите ваш язык leavemail.body=Ваш посетитель '{0}' оставил сообщение:\n\n{2}\n\nЕmail: {1}\n{3}\n--- \nС уважением,\nВаш Веб Мессенджер leavemail.subject=Вопрос от {0}