From 8ef7cea072e8ca3a508ac60b5bb0733fb51f80d0 Mon Sep 17 00:00:00 2001 From: steinm Date: Wed, 27 Jul 2011 06:22:26 +0000 Subject: [PATCH] - do not run install if ENABLE_INSTALL_TOOL is not available - do not run letodms if ENABLE_INSTALL_TOOL is available --- inc/inc.Settings.php | 3 +++ install/install.php | 55 ++++++++++++++++++++++++-------------- languages/English/lang.inc | 14 +++++++--- 3 files changed, 48 insertions(+), 24 deletions(-) diff --git a/inc/inc.Settings.php b/inc/inc.Settings.php index 3cc1a6b14..d89f8a240 100644 --- a/inc/inc.Settings.php +++ b/inc/inc.Settings.php @@ -48,6 +48,9 @@ if (file_exists("../inc/inc.Settings.old.php")) { require_once('inc.ClassSettings.php'); $settings = new Settings(); +if(!defined("LETODMS_INSTALL") && file_exists(dirname($settings->_configFilePath)."/ENABLE_INSTALL_TOOL")) { + die("LetoDMS won't run unless your remove the file ENABLE_INSTALL_TOOL from your configuration directory."); +} // ---------------------------- // Update previous version <3.0 diff --git a/install/install.php b/install/install.php index f5ec58497..5a3c88bb6 100644 --- a/install/install.php +++ b/install/install.php @@ -134,6 +134,28 @@ UI::contentContainerStart(); if (isset($_GET['phpinfo'])) { echo '' . getMLText("back") . ''; phpinfo(); + UI::contentContainerEnd(); + UI::htmlEndPage(); + exit(); +} + +/** + * Show phpinfo + */ +if (isset($_GET['disableinstall'])) { + if(file_exists($configDir."/ENABLE_INSTALL_TOOL")) { + if(unlink($configDir."/ENABLE_INSTALL_TOOL")) { + echo getMLText("settings_install_disabled"); + echo "

"; + echo '' . getMLText("settings_more_settings") .''; + } + } else { + echo getMLText("settings_cannot_disable"); + echo "

"; + echo '' . getMLText("back") . ''; + } + UI::contentContainerEnd(); + UI::htmlEndPage(); exit(); } @@ -196,11 +218,9 @@ if ($action=="setSettings") { include $settings->_ADOdbPath."adodb/adodb.inc.php"; $connTmp = ADONewConnection($settings->_dbDriver); - if ($connTmp) - { + if ($connTmp) { $connTmp->Connect($settings->_dbHostname, $settings->_dbUser, $settings->_dbPass, $settings->_dbDatabase); - if ($connTmp->IsConnected()) - { + if ($connTmp->IsConnected()) { // read SQL file if ($settings->_dbDriver=="mysql") $queries = file_get_contents("create_tables-innodb.sql"); @@ -211,17 +231,14 @@ if ($action=="setSettings") { $queries = explode(";", $queries); // execute queries - foreach($queries as $query) - { + foreach($queries as $query) { // var_dump($query); $query = trim($query); - if (!empty($query)) - { + if (!empty($query)) { $connTmp->Execute($query); - if ($connTmp->ErrorNo()<>0) - { - $errorMsg .= $connTmp->ErrorMsg() . "
"; + if ($connTmp->ErrorNo()<>0) { + $errorMsg .= $connTmp->ErrorMsg() . "
"; } } } @@ -230,32 +247,30 @@ if ($action=="setSettings") { if (empty($errorMsg)) $createOK = true; - } - else - { + } else { $errorMsg = $connTmp->ErrorMsg(); } $connTmp->Disconnect(); } // Show error - if (!$createOK) - { + if (!$createOK) { echo $errorMsg; $hasError = true; } } // create database - if (!$hasError) - { + if (!$hasError) { // Save settings $settings->save(); // Show Web page echo getMLText("settings_install_success"); - echo "

"; + echo "

"; echo getMLText("settings_delete_install_folder"); - echo "

"; + echo "

"; + echo '' . getMLText("settings_disable_install") . ''; + echo "

"; echo '' . getMLText("settings_more_settings") .''; } } diff --git a/languages/English/lang.inc b/languages/English/lang.inc index 771aa9d1a..3e38b1046 100644 --- a/languages/English/lang.inc +++ b/languages/English/lang.inc @@ -378,7 +378,7 @@ $text["set_owner"] = "Set Owner"; $text["settings_activate_module"] = "Activate module"; $text["settings_activate_php_extension"] = "Activate PHP extension"; $text["settings_adminIP"] = "Admin IP"; -$text["settings_adminIP_desc"] = "If enabled admin can login only by specified IP addres, leave empty to avoid the control. NOTE: works only with local autentication (no LDAP)"; +$text["settings_adminIP_desc"] = "If set admin can login only by specified IP addres, leave empty to avoid the control. NOTE: works only with local autentication (no LDAP)"; $text["settings_ADOdbPath"] = "ADOdb Path"; $text["settings_ADOdbPath_desc"] = "Path to adodb. This is the directory containing the adodb directory"; $text["settings_Advanced"] = "Advanced"; @@ -397,12 +397,14 @@ $text["settings_luceneClassDir"] = "Lucene LetoDMS directory"; $text["settings_luceneClassDir_desc"] = "Path to LetoDMS_Lucene (optional)"; $text["settings_luceneDir"] = "Lucene index directory"; $text["settings_luceneDir_desc"] = "Path to Lucene index"; +$text["settings_cannot_disable"] = "File ENABLE_INSTALL_TOOL could not deleted"; +$text["settings_install_disabled"] = "File ENABLE_INSTALL_TOOL was deleted. You can now log into LetoDMS and do further configuration."; $text["settings_createdatabase"] = "Create database"; $text["settings_createdirectory"] = "Create directory"; $text["settings_currentvalue"] = "Current value"; $text["settings_Database"] = "Database settings"; $text["settings_dbDatabase"] = "Database"; -$text["settings_dbDatabase_desc"] = "The name for your database entered during the installation process. Do not edit field unless absolutely necessary, for example transfer of the database to a new Host."; +$text["settings_dbDatabase_desc"] = "The name for your database entered during the installation process. Do not edit this field unless necessary, if for example the database has been moved."; $text["settings_dbDriver"] = "Database Type"; $text["settings_dbDriver_desc"] = "The type of database in use entered during the installation process. Do not edit this field unless you are having to migrate to a different type of database perhaps due to changing hosts. Type of DB-Driver used by adodb (see adodb-readme)"; $text["settings_dbHostname_desc"] = "The hostname for your database entered during the installation process. Do not edit field unless absolutely necessary, for example transfer of the database to a new Host."; @@ -411,7 +413,8 @@ $text["settings_dbPass_desc"] = "The password for access to your database entere $text["settings_dbPass"] = "Password"; $text["settings_dbUser_desc"] = "The username for access to your database entered during the installation process. Do not edit field unless absolutely necessary, for example transfer of the database to a new Host."; $text["settings_dbUser"] = "Username"; -$text["settings_delete_install_folder"] = "To use LetoDMS, you must delete the install directory"; +$text["settings_delete_install_folder"] = "In order to use LetoDMS, you must delete the file ENABLE_INSTALL_TOOL in the configuration directory"; +$text["settings_disable_install"] = "Delete file ENABLE_INSTALL_TOOL if possible"; $text["settings_disableSelfEdit_desc"] = "If checked user cannot edit his own profile"; $text["settings_disableSelfEdit"] = "Disable Self Edit"; $text["settings_Display"] = "Display settings"; @@ -427,6 +430,7 @@ $text["settings_enableEmail"] = "Enable E-mail"; $text["settings_enableFolderTree_desc"] = "False to don't show the folder tree"; $text["settings_enableFolderTree"] = "Enable Folder Tree"; $text["settings_enableFullSearch"] = "Enable Full text search"; +$text["settings_enableFullSearch_desc"] = "Enable Full text search"; $text["settings_enableGuestLogin_desc"] = "If you want anybody to login as guest, check this option. Note: guest login should be used only in a trusted environment"; $text["settings_enableGuestLogin"] = "Enable Guest Login"; $text["settings_enableUserImage_desc"] = "Enable users images"; @@ -462,7 +466,9 @@ $text["settings_maxExecutionTime_desc"] = "This sets the maximum time in seconds $text["settings_maxExecutionTime"] = "Max Execution Time (s)"; $text["settings_more_settings"] = "Configure more settings. Default login: admin/admin"; $text["settings_notfound"] = "Not found"; -$text["settings_partitionSize"] = "Size of partial files uploaded by jumploader"; +$text["settings_notwritable"] = "The configuration cannot be saved because the configuration file is not writable."; +$text["settings_partitionSize"] = "Partial filesize"; +$text["settings_partitionSize_desc"] = "Size of partial files in bytes, uploaded by jumploader. Do not set a value larger than the maximum upload size set by the server."; $text["settings_php_dbDriver"] = "PHP extension : php_'see current value'"; $text["settings_php_gd2"] = "PHP extension : php_gd2"; $text["settings_php_mbstring"] = "PHP extension : php_mbstring";