function CheckInstall() { $sql = "SELECT * FROM joomla_users WHERE install=0"; $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_backup"); while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { unset($arrayconfig); $GLOBALS["joom_servername"] = $ligne["servername"]; set_status('{checking}'); write_events("starting installation of {$GLOBALS["joom_servername"]}"); $arrayconfig["LANG"] = $ligne["language"]; $arrayconfig["DB"] = $ligne["databasename"]; $arrayconfig["uid"] = $ligne["uid"]; $u = new user($arrayconfig["uid"]); $arrayconfig["password"] = $u->password; $root = $u->homeDirectory . "/www/{$ligne["servername"]}"; $arrayconfig["root"] = $root; if (CreateDatabase($arrayconfig)) { write_events("Database & tables are successfully created"); if (CreateMysqlAdmin($arrayconfig)) { writeconfig($arrayconfig); set_status("{installing}"); } if (CopySources($arrayconfig)) { set_status("{installed}"); set_install_status(1); shell_exec("/usr/share/artica-postfix/bin/artica-install --reload-apache-groupware"); } else { write_events("Unable to install sources"); set_status("{failed}"); } } else { continue; } } }
$dbHost = $_POST['host']; $dbName = $_POST['name']; $user = $_POST['admin_login']; $md5pass = md5($_POST['admin_pass']); if (empty($dbUser) || empty($dbPass) || empty($dbHost) || empty($dbName) || empty($user) || empty($md5pass)) { $success = false; } else { define('MYSQL_HOST', $dbHost); define('MYSQL_LOGIN', $dbUser); define('MYSQL_PASSWORD', $dbPass); define('MYSQL_DB', $dbName); define('USER', $user); define('PASS', $md5pass); define('MYSQL_DEBUG', true); define('TIME_DEBUG', true); CreateDatabase(); CreateConfigFile(); $success = true; } } function CreateConfigFile() { global $dbUser, $dbPass, $dbHost, $dbName, $user, $md5pass; $config = <<<DATA <?php define('MYSQL_HOST', '{$dbHost}'); define('MYSQL_LOGIN', '{$dbUser}'); define('MYSQL_PASSWORD', '{$dbPass}'); define('MYSQL_DB', '{$dbName}');
function Step3() { $tpl = new Template(); $tpl->set('step', '3'); $tpl->display('templates/header_install.tpl'); if (CreateConfigFile($_POST['host'], $_POST['username'], $_POST['password'], $_POST['name'], $_POST['prefix'])) { echo 'Config file created successfully'; } else { echo 'Could not create config file'; } echo '<br/>'; CreateDatabase($_POST['host'], $_POST['username'], $_POST['password'], $_POST['name'], $_POST['prefix']); echo 'Congratulations. You have successfully installed photobook.<br />Go <a href="../index.php">here</a> to see your site.'; $tpl->display('templates/footer_install.tpl'); }
$user = $options["u"]; } if (array_key_exists("p", $options)) { $pass = $options["p"]; } if (array_key_exists("h", $options)) { $hostName = $options["h"]; } $link = new mysqli($hostName, $user, $pass); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit; } else { printf("Connection to MySQL Server Succesful\n"); } CreateDatabase($link); if (array_key_exists("create_table", $options)) { DropTable($link); CreateTable($link); return; } $fileName = "users.csv"; if (array_key_exists("file", $options)) { $fileName = $options["file"]; echo "Opened file " . $fileName . "\n"; } $file = fopen($fileName, "r"); if ($file !== FALSE) { $data2DArray = array(); // create array // while there is still rows in the file