';
}
function rex_setup_import($import_sql, $import_archiv = null)
{
- global $REX, $I18N, $export_addon_dir;
-
- $err_msg = '';
-
- if (!is_dir($export_addon_dir))
- {
- $err_msg .= $I18N->msg('setup_03703').'
';
- }
- else
- {
- if (file_exists($import_sql) && ($import_archiv === null || $import_archiv !== null && file_exists($import_archiv)))
- {
- // Hier I18N_IM_EXPORT global definieren, damit es aus der config.inc.php übernommen
- // wird und auch in der danach includeten function verfügbar ist
- global $I18N_IM_EXPORT;
-
- $I18N->appendFile($REX['INCLUDE_PATH'].'/addons/import_export/lang/');
- require_once $export_addon_dir.'/classes/class.tar.inc.php';
- require_once $export_addon_dir.'/classes/class.rex_tar.inc.php';
-
- // DB Import
- $state_db = rex_a1_import_db($import_sql);
- if ($state_db['state'] === false)
- {
- $err_msg .= nl2br($state_db['message']) .'
';
- }
-
- // Archiv optional importieren
- if ($state_db['state'] === true && $import_archiv !== null)
- {
- $state_archiv = rex_a1_import_files($import_archiv);
- if ($state_archiv['state'] === false)
- {
- $err_msg .= $state_archiv['message'].'
';
- }
- }
- }
- else
- {
- $err_msg .= $I18N->msg('setup_03702').'
';
- }
- }
-
- return $err_msg;
+ global $REX, $I18N, $export_addon_dir;
+
+ $err_msg = '';
+
+ if (!is_dir($export_addon_dir))
+ {
+ $err_msg .= $I18N->msg('setup_03703').'
';
+ }
+ else
+ {
+ if (file_exists($import_sql) && ($import_archiv === null || $import_archiv !== null && file_exists($import_archiv)))
+ {
+ // Hier I18N_IM_EXPORT global definieren, damit es aus der config.inc.php übernommen
+ // wird und auch in der danach includeten function verfügbar ist
+ global $I18N_IM_EXPORT;
+
+ $I18N->appendFile($REX['INCLUDE_PATH'].'/addons/import_export/lang/');
+ require_once $export_addon_dir.'/classes/class.tar.inc.php';
+ require_once $export_addon_dir.'/classes/class.rex_tar.inc.php';
+
+ // DB Import
+ $state_db = rex_a1_import_db($import_sql);
+ if ($state_db['state'] === false)
+ {
+ $err_msg .= nl2br($state_db['message']) .'
';
+ }
+
+ // Archiv optional importieren
+ if ($state_db['state'] === true && $import_archiv !== null)
+ {
+ $state_archiv = rex_a1_import_files($import_archiv);
+ if ($state_archiv['state'] === false)
+ {
+ $err_msg .= $state_archiv['message'].'
';
+ }
+ }
+ }
+ else
+ {
+ $err_msg .= $I18N->msg('setup_03702').'
';
+ }
+ }
+
+ return $err_msg;
}
function rex_setup_is_writable($items)
{
- global $REX;
- $res = array();
+ global $REX;
+ $res = array();
- foreach($items as $item)
- {
- $is_writable = _rex_is_writable($item);
+ foreach($items as $item)
+ {
+ $is_writable = _rex_is_writable($item);
- // 0 => kein Fehler
- if($is_writable != 0)
- {
- $res[$is_writable][] = $item;
- }
- }
+ // 0 => kein Fehler
+ if($is_writable != 0)
+ {
+ $res[$is_writable][] = $item;
+ }
+ }
- return $res;
+ return $res;
}
-// -------------------------- System AddOns prüfen
+// -------------------------- System AddOns pr¸fen
function rex_setup_addons($uninstallBefore = false, $installDump = true)
{
- global $REX, $I18N;
+ global $REX, $I18N;
- require_once $REX['INCLUDE_PATH'].'/functions/function_rex_addons.inc.php';
+ require_once $REX['INCLUDE_PATH'].'/functions/function_rex_addons.inc.php';
- $addonErr = '';
- $ADDONS = rex_read_addons_folder();
- $addonManager = new rex_addonManager($ADDONS);
- foreach($REX['SYSTEM_ADDONS'] as $systemAddon)
- {
- $state = true;
+ $addonErr = '';
+ $ADDONS = rex_read_addons_folder();
+ $addonManager = new rex_addonManager($ADDONS);
+ foreach($REX['SYSTEM_ADDONS'] as $systemAddon)
+ {
+ $state = true;
- if($state === true && $uninstallBefore)
- $state = $addonManager->uninstall($systemAddon);
+ if($state === true && $uninstallBefore)
+ $state = $addonManager->uninstall($systemAddon);
- if($state === true && !OOAddon::isInstalled($systemAddon))
- $state = $addonManager->install($systemAddon, $installDump);
+ if($state === true && !OOAddon::isInstalled($systemAddon))
+ $state = $addonManager->install($systemAddon, $installDump);
- if($state === true && !OOAddon::isActivated($systemAddon))
- $state = $addonManager->activate($systemAddon);
+ if($state === true && !OOAddon::isActivated($systemAddon))
+ $state = $addonManager->activate($systemAddon);
- if($state !== true)
- $addonErr .= '
';
+ $dt->setQuery('DROP TABLE `'.$table.'`');
+ $err_msg .= $dt->hasError() ? rex_formated_sqlerror($dt) : '';
}
+ unset($rt,$dt);
+ return $err_msg;
+}
- // --------------------------------------------- END: SETUP FUNCTIONS
+ // --------------------------------------------- END: SETUP FUNCTIONS
- $MSG['err'] = "";
+ $MSG['err'] = "";
- $checkmodus = rex_request('checkmodus', 'float');
- $send = rex_request('send', 'string');
- $dbanlegen = rex_request('dbanlegen', 'string');
- $noadmin = rex_request('noadmin', 'string');
- $lang = rex_request('lang', 'string');
+ $checkmodus = rex_request('checkmodus', 'float');
+ $send = rex_request('send', 'string');
+ $dbanlegen = rex_request('dbanlegen', 'string');
+ $noadmin = rex_request('noadmin', 'string');
+ $lang = rex_request('lang', 'string');
- $export_addon_dir = $REX['INCLUDE_PATH'].'/addons/import_export';
- require_once $export_addon_dir.'/functions/function_folder.inc.php';
- require_once $export_addon_dir.'/functions/function_import_folder.inc.php';
- require_once $export_addon_dir.'/functions/function_import_export.inc.php';
+ $export_addon_dir = $REX['INCLUDE_PATH'].'/addons/import_export';
+ require_once $export_addon_dir.'/functions/function_folder.inc.php';
+ require_once $export_addon_dir.'/functions/function_import_folder.inc.php';
+ require_once $export_addon_dir.'/functions/function_import_export.inc.php';
- // ---------------------------------- MODUS 0 | Start
- if (!($checkmodus > 0 && $checkmodus < 10))
- {
- $langpath = $REX['INCLUDE_PATH'].'/lang';
- foreach($REX['LANGUAGES'] as $l)
- {
- $isUtf8 = substr($l, -4) == 'utf8';
- $I18N_T = rex_create_lang($l,$langpath,FALSE);
- $label = $I18N_T->msg('lang');
- if($isUtf8) $label .= ' (utf-8)';
- $langs[$l] = '
';
+ // ---------------------------------- MODUS 0 | Start
+ if (!($checkmodus > 0 && $checkmodus < 10))
+ {
+ $langpath = $REX['INCLUDE_PATH'].'/lang';
+ foreach($REX['LANGUAGES'] as $l)
+ {
+ $isUtf8 = substr($l, -4) == 'utf8';
+ $I18N_T = rex_create_lang($l,$langpath,FALSE);
+ $label = $I18N_T->msg('lang');
+ if($isUtf8) $label .= ' (utf-8)';
+ $langs[$l] = '
';
- }
- unset($I18N_T);
+ }
+ unset($I18N_T);
- // wenn nur eine Sprache -> direkte weiterleitung
- if (count($REX['LANGUAGES'])==1)
- {
- header('Location: index.php?checkmodus=0.5&lang='.key($langs));
- exit();
- }
+ // wenn nur eine Sprache -> direkte weiterleitung
+ if (count($REX['LANGUAGES'])==1)
+ {
+ header('Location: index.php?checkmodus=0.5&lang='.key($langs));
+ exit();
+ }
- rex_setup_title('SETUP: SELECT LANGUAGE');
+ rex_setup_title('SETUP: SELECT LANGUAGE');
- echo '
';
- }
+ }
- // ---------------------------------- MODUS 0 | Start
+ // ---------------------------------- MODUS 0 | Start
- if ($checkmodus == '0.5')
- {
- rex_setup_title('SETUP: START');
+ if ($checkmodus == '0.5')
+ {
+ rex_setup_title('SETUP: START');
- $REX['LANG'] = $lang;
+ $REX['LANG'] = $lang;
- echo $I18N->msg('setup_005', '
';
+ echo $I18N->msg('setup_005', '
', '
');
+ echo '
';
- echo $I18N->msg('setup_005_1', '
', '
', ' class="rex-ul1"');
- echo '
';
- $checkmodus = 0;
- }
-
- // ---------------------------------- MODUS 1 | Versionscheck - Rechtecheck
-
- if ($checkmodus == 1)
- {
- // -------------------------- VERSIONSCHECK
- if (version_compare(phpversion(), '4.3.2', '<') == 1)
- {
- $MSG['err'] .= '
'. $I18N->msg('setup_010', phpversion()).'';
- }
-
- // -------------------------- EXTENSION CHECK
- foreach(array('session', 'mysql', 'pcre') as $extension)
- {
- if(!extension_loaded($extension))
- $MSG['err'] .= '
'. $I18N->msg('setup_010_1', $extension).'';
- }
-
- // -------------------------- SCHREIBRECHTE
- $WRITEABLES = array (
- $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'master.inc.php',
- $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'addons.inc.php',
- $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'plugins.inc.php',
- $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'clang.inc.php',
- $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'generated',
- $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'generated'.DIRECTORY_SEPARATOR.'articles',
- $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'generated'.DIRECTORY_SEPARATOR.'templates',
- $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'generated'.DIRECTORY_SEPARATOR.'files',
- $REX['MEDIAFOLDER'],
- $REX['MEDIAFOLDER'] .DIRECTORY_SEPARATOR.'_readme.txt',
- getImportDir()
- );
-
- foreach($REX['SYSTEM_ADDONS'] as $system_addon)
- $WRITEABLES[] = $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'addons'.DIRECTORY_SEPARATOR. $system_addon;
-
- $res = rex_setup_is_writable($WRITEABLES);
- if(count($res) > 0)
- {
- $MSG['err'] .= '
';
- foreach($res as $type => $messages)
- {
- if(count($messages) > 0)
- {
- $MSG['err'] .= ''. _rex_is_writable_info($type) .'
';
- $MSG['err'] .= '';
- foreach($messages as $message)
- {
- $MSG['err'] .= '- '. $message .'
';
- }
- $MSG['err'] .= '
';
- }
- }
- $MSG['err'] .= '';
- }
- }
-
- if ($MSG['err'] == '' && $checkmodus == 1)
- {
- rex_setup_title($I18N->msg('setup_step1'));
-
- echo $I18N->msg('setup_016', '
', '
');
- echo '
';
-
- echo $I18N->msg('setup_016_1', ' class="rex-ul1"', '
', '');
- echo '
'. $I18N->msg('setup_security_msg') .'
+ $checkmodus = 0;
+ }
+
+ // ---------------------------------- MODUS 1 | Versionscheck - Rechtecheck
+
+ if ($checkmodus == 1)
+ {
+ // -------------------------- VERSIONSCHECK
+ if (version_compare(phpversion(), '4.3.2', '<') == 1)
+ {
+ $MSG['err'] .= '
'. $I18N->msg('setup_010', phpversion()).'';
+ }
+
+ // -------------------------- EXTENSION CHECK
+ foreach(array('session', 'mysql', 'pcre') as $extension)
+ {
+ if(!extension_loaded($extension))
+ $MSG['err'] .= '
'. $I18N->msg('setup_010_1', $extension).'';
+ }
+
+ // -------------------------- SCHREIBRECHTE
+ $WRITEABLES = array (
+ $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'master.inc.php',
+ $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'addons.inc.php',
+ $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'plugins.inc.php',
+ $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'clang.inc.php',
+ $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'generated',
+ $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'generated'.DIRECTORY_SEPARATOR.'articles',
+ $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'generated'.DIRECTORY_SEPARATOR.'templates',
+ $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'generated'.DIRECTORY_SEPARATOR.'files',
+ $REX['MEDIAFOLDER'],
+ $REX['MEDIAFOLDER'] .DIRECTORY_SEPARATOR.'_readme.txt',
+ getImportDir()
+ );
+
+ foreach($REX['SYSTEM_ADDONS'] as $system_addon)
+ $WRITEABLES[] = $REX['INCLUDE_PATH'].DIRECTORY_SEPARATOR.'addons'.DIRECTORY_SEPARATOR. $system_addon;
+
+ $res = rex_setup_is_writable($WRITEABLES);
+ if(count($res) > 0)
+ {
+ $MSG['err'] .= '
';
+ foreach($res as $type => $messages)
+ {
+ if(count($messages) > 0)
+ {
+ $MSG['err'] .= ''. _rex_is_writable_info($type) .'
';
+ $MSG['err'] .= '';
+ foreach($messages as $message)
+ {
+ $MSG['err'] .= '- '. $message .'
';
+ }
+ $MSG['err'] .= '
';
+ }
+ }
+ $MSG['err'] .= '';
+ }
+ }
+
+ if ($MSG['err'] == '' && $checkmodus == 1)
+ {
+ rex_setup_title($I18N->msg('setup_step1'));
+
+ echo $I18N->msg('setup_016', '
', '
');
+ echo '
';
+
+ echo $I18N->msg('setup_016_1', ' class="rex-ul1"', '
', '');
+ echo '
'. $I18N->msg('setup_security_msg') .'
@@ -346,13 +372,13 @@ function rex_setup_setUtf8()
';
- }
- elseif ($MSG['err'] != "")
- {
+ }
+ elseif ($MSG['err'] != "")
+ {
- rex_setup_title($I18N->msg('setup_step1'));
+ rex_setup_title($I18N->msg('setup_step1'));
- echo '
'.$I18N->msg('setup_headline1').'
+ echo '
'.$I18N->msg('setup_headline1').'
'.$I18N->msg('setup_018').'
@@ -362,80 +388,80 @@ function rex_setup_setUtf8()
» '.$I18N->msg('setup_017').'
';
- }
-
- // ---------------------------------- MODUS 2 | master.inc.php - Datenbankcheck
-
- if ($checkmodus == 2 && $send == 1)
- {
- $master_file = $REX['INCLUDE_PATH'].'/master.inc.php';
- $cont = rex_get_file_contents($master_file);
-
- // Einfache quotes nicht escapen, da der String zwischen doppelten quotes stehen wird
- $serveraddress = str_replace("\'", "'", rex_post('serveraddress', 'string'));
- $serverbezeichnung = str_replace("\'", "'", rex_post('serverbezeichnung', 'string'));
- $error_email = str_replace("\'", "'", rex_post('error_email', 'string'));
- $psw_func = str_replace("\'", "'", rex_post('psw_func', 'string'));
- $mysql_host = str_replace("\'", "'", rex_post('mysql_host', 'string'));
- $redaxo_db_user_login = str_replace("\'", "'", rex_post('redaxo_db_user_login', 'string'));
- $redaxo_db_user_pass = str_replace("\'", "'", rex_post('redaxo_db_user_pass', 'string'));
- $dbname = str_replace("\'", "'", rex_post('dbname', 'string'));
- $redaxo_db_create = rex_post('redaxo_db_create', 'boolean');
-
- $cont = preg_replace("@(REX\['SERVER'\].?\=.?\")[^\"]*@", '${1}'.$serveraddress, $cont);
- $cont = preg_replace("@(REX\['SERVERNAME'\].?\=.?\")[^\"]*@", '${1}'.$serverbezeichnung, $cont);
- $cont = preg_replace("@(REX\['LANG'\].?\=.?\")[^\"]*@", '${1}'.$lang, $cont);
- $cont = preg_replace("@(REX\['INSTNAME'\].?\=.?\")[^\"]*@", '${1}'."rex".date("YmdHis"), $cont);
- $cont = preg_replace("@(REX\['ERROR_EMAIL'\].?\=.?\")[^\"]*@", '${1}'.$error_email, $cont);
- $cont = preg_replace("@(REX\['PSWFUNC'\].?\=.?\")[^\"]*@", '${1}'.$psw_func, $cont);
- $cont = preg_replace("@(REX\['DB'\]\['1'\]\['HOST'\].?\=.?\")[^\"]*@", '${1}'.$mysql_host, $cont);
- $cont = preg_replace("@(REX\['DB'\]\['1'\]\['LOGIN'\].?\=.?\")[^\"]*@", '${1}'.$redaxo_db_user_login, $cont);
- $cont = preg_replace("@(REX\['DB'\]\['1'\]\['PSW'\].?\=.?\")[^\"]*@", '${1}'.$redaxo_db_user_pass, $cont);
- $cont = preg_replace("@(REX\['DB'\]\['1'\]\['NAME'\].?\=.?\")[^\"]*@", '${1}'.$dbname, $cont);
-
- if(rex_put_file_contents($master_file, $cont) === false)
- {
- $err_msg = $I18N->msg('setup_020', '
', '');
- }
-
- // -------------------------- DATENBANKZUGRIFF
- $err = rex_sql::checkDbConnection($mysql_host, $redaxo_db_user_login, $redaxo_db_user_pass, $dbname, $redaxo_db_create);
- if($err !== true)
- {
- $err_msg = $err;
- }
- else
- {
- $REX['DB']['1']['NAME'] = $dbname;
- $REX['DB']['1']['LOGIN'] = $redaxo_db_user_login;
- $REX['DB']['1']['PSW'] = $redaxo_db_user_pass;
- $REX['DB']['1']['HOST'] = $mysql_host;
-
- $err_msg = "";
- $checkmodus = 3;
- $send = "";
- }
- }
- else
- {
- // Allgemeine Infos
- $serveraddress = $REX['SERVER'];
- $serverbezeichnung = $REX['SERVERNAME'];
- $error_email = $REX['ERROR_EMAIL'];
- $psw_func = $REX['PSWFUNC'];
-
- // DB Infos
- $dbname = $REX['DB']['1']['NAME'];
- $redaxo_db_user_login = $REX['DB']['1']['LOGIN'];
- $redaxo_db_user_pass = $REX['DB']['1']['PSW'];
- $mysql_host = $REX['DB']['1']['HOST'];
- }
-
- if ($checkmodus == 2)
- {
- rex_setup_title($I18N->msg('setup_step2'));
-
- echo '
'.$I18N->msg('setup_023').'
+ }
+
+ // ---------------------------------- MODUS 2 | master.inc.php - Datenbankcheck
+
+ if ($checkmodus == 2 && $send == 1)
+ {
+ $master_file = $REX['INCLUDE_PATH'].'/master.inc.php';
+ $cont = rex_get_file_contents($master_file);
+
+ // Einfache quotes nicht escapen, da der String zwischen doppelten quotes stehen wird
+ $serveraddress = str_replace("\'", "'", rex_post('serveraddress', 'string'));
+ $serverbezeichnung = str_replace("\'", "'", rex_post('serverbezeichnung', 'string'));
+ $error_email = str_replace("\'", "'", rex_post('error_email', 'string'));
+ $psw_func = str_replace("\'", "'", rex_post('psw_func', 'string'));
+ $mysql_host = str_replace("\'", "'", rex_post('mysql_host', 'string'));
+ $redaxo_db_user_login = str_replace("\'", "'", rex_post('redaxo_db_user_login', 'string'));
+ $redaxo_db_user_pass = str_replace("\'", "'", rex_post('redaxo_db_user_pass', 'string'));
+ $dbname = str_replace("\'", "'", rex_post('dbname', 'string'));
+ $redaxo_db_create = rex_post('redaxo_db_create', 'boolean');
+
+ $cont = preg_replace("@(REX\['SERVER'\].?\=.?\")[^\"]*@", '${1}'.$serveraddress, $cont);
+ $cont = preg_replace("@(REX\['SERVERNAME'\].?\=.?\")[^\"]*@", '${1}'.$serverbezeichnung, $cont);
+ $cont = preg_replace("@(REX\['LANG'\].?\=.?\")[^\"]*@", '${1}'.$lang, $cont);
+ $cont = preg_replace("@(REX\['INSTNAME'\].?\=.?\")[^\"]*@", '${1}'."rex".date("YmdHis"), $cont);
+ $cont = preg_replace("@(REX\['ERROR_EMAIL'\].?\=.?\")[^\"]*@", '${1}'.$error_email, $cont);
+ $cont = preg_replace("@(REX\['PSWFUNC'\].?\=.?\")[^\"]*@", '${1}'.$psw_func, $cont);
+ $cont = preg_replace("@(REX\['DB'\]\['1'\]\['HOST'\].?\=.?\")[^\"]*@", '${1}'.$mysql_host, $cont);
+ $cont = preg_replace("@(REX\['DB'\]\['1'\]\['LOGIN'\].?\=.?\")[^\"]*@", '${1}'.$redaxo_db_user_login, $cont);
+ $cont = preg_replace("@(REX\['DB'\]\['1'\]\['PSW'\].?\=.?\")[^\"]*@", '${1}'.$redaxo_db_user_pass, $cont);
+ $cont = preg_replace("@(REX\['DB'\]\['1'\]\['NAME'\].?\=.?\")[^\"]*@", '${1}'.$dbname, $cont);
+
+ if(rex_put_file_contents($master_file, $cont) === false)
+ {
+ $err_msg = $I18N->msg('setup_020', '
', '');
+ }
+
+ // -------------------------- DATENBANKZUGRIFF
+ $err = rex_sql::checkDbConnection($mysql_host, $redaxo_db_user_login, $redaxo_db_user_pass, $dbname, $redaxo_db_create);
+ if($err !== true)
+ {
+ $err_msg = $err;
+ }
+ else
+ {
+ $REX['DB']['1']['NAME'] = $dbname;
+ $REX['DB']['1']['LOGIN'] = $redaxo_db_user_login;
+ $REX['DB']['1']['PSW'] = $redaxo_db_user_pass;
+ $REX['DB']['1']['HOST'] = $mysql_host;
+
+ $err_msg = "";
+ $checkmodus = 3;
+ $send = "";
+ }
+ }
+ else
+ {
+ // Allgemeine Infos
+ $serveraddress = $REX['SERVER'];
+ $serverbezeichnung = $REX['SERVERNAME'];
+ $error_email = $REX['ERROR_EMAIL'];
+ $psw_func = $REX['PSWFUNC'];
+
+ // DB Infos
+ $dbname = $REX['DB']['1']['NAME'];
+ $redaxo_db_user_login = $REX['DB']['1']['LOGIN'];
+ $redaxo_db_user_pass = $REX['DB']['1']['PSW'];
+ $mysql_host = $REX['DB']['1']['HOST'];
+ }
+
+ if ($checkmodus == 2)
+ {
+ rex_setup_title($I18N->msg('setup_step2'));
+
+ echo '
'.$I18N->msg('setup_023').'