Example #1
0
// copy content of folder adm_my_files to productive folder
$srcFolder = SERVER_PATH . '/demo_data/adm_my_files';
$newFolder = SERVER_PATH . '/adm_my_files';
$myFilesFolder = new Folder($srcFolder);
$b_return = $myFilesFolder->delete($newFolder . '/backup');
$b_return = $myFilesFolder->delete($newFolder . '/download');
$b_return = $myFilesFolder->delete($newFolder . '/photos');
$b_return = $myFilesFolder->copy($newFolder);
if (!$b_return) {
    echo '<p style="color: #cc0000;">Folder <strong>adm_my_files</strong> is not writable.<br />
    No files could be copied to that folder.</p>';
    exit;
}
echo 'Folder <strong>adm_my_files</strong> was successfully copied.<br />';
// connect to database
$db = Database::createDatabaseObject($gDbType);
$connection = $db->connect($g_adm_srv, $g_adm_usr, $g_adm_pw, $g_adm_db);
if ($gDbType === 'mysql') {
    // disable foreign key checks for mysql, so tables can easily deleted
    $sql = 'SET foreign_key_checks = 0 ';
    $db->query($sql);
}
$filename = 'db.sql';
$file = fopen($filename, 'r') or die('<p style="color: #cc0000;">File <strong>db.sql</strong> could not be found in folder <strong>demo_data</strong>.</p>');
$content = fread($file, filesize($filename));
$sql_arr = explode(';', $content);
fclose($file);
echo 'Read file db.sql ...<br />';
foreach ($sql_arr as $sql) {
    if (trim($sql) !== '') {
        // set prefix for all tables and execute sql statement
Example #2
0
     }
 }
 // Zugangsdaten der DB in Sessionvariablen gefiltert speichern
 $_SESSION['db_type'] = strStripTags($_POST['db_type']);
 $_SESSION['db_server'] = strStripTags($_POST['db_server']);
 $_SESSION['db_user'] = strStripTags($_POST['db_user']);
 $_SESSION['db_password'] = strStripTags($_POST['db_password']);
 $_SESSION['db_database'] = strStripTags($_POST['db_database']);
 $_SESSION['prefix'] = strStripTags($_POST['db_prefix']);
 if ($_SESSION['db_type'] === '' || $_SESSION['db_server'] === '' || $_SESSION['db_user'] === '' || $_SESSION['db_database'] === '') {
     showNotice($gL10n->get('INS_MYSQL_LOGIN_NOT_COMPLETELY'), 'installation.php?mode=3', $gL10n->get('SYS_BACK'), 'layout/back.png');
 }
 // for security reasons only check database connection if no config file exists
 if (!file_exists('../../adm_my_files/config.php')) {
     // check database connections
     $db = Database::createDatabaseObject($_SESSION['db_type']);
     if ($db->connect($_SESSION['db_server'], $_SESSION['db_user'], $_SESSION['db_password'], $_SESSION['db_database']) == false) {
         showNotice($gL10n->get('INS_DATABASE_NO_LOGIN'), 'installation.php?mode=3', $gL10n->get('SYS_BACK'), 'layout/back.png');
     }
     // check database version
     $message = checkDatabaseVersion($db);
     if ($message !== '') {
         showNotice($message, 'installation.php?mode=3', $gL10n->get('SYS_BACK'), 'layout/back.png');
     }
     // now check if a valid installation exists.
     $sql = 'SELECT org_id FROM ' . TBL_ORGANIZATIONS;
     $db->query($sql, false);
     $count = $db->num_rows();
     if ($count > 0) {
         // valid installation exists -> exit installation
         showNotice($gL10n->get('INS_INSTALLATION_EXISTS'), '../index.php', $gL10n->get('SYS_OVERVIEW'), 'layout/application_view_list.png');