mirror of
https://github.com/kleeja-official/kleeja.git
synced 2025-12-16 04:59:42 +01:00
moved to update page and make it better
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
define('MIN_PHP_VERSION', '7.0');
|
||||
define('MIN_MYSQL_VERSION', '4.2.2');
|
||||
//version of latest changes at db
|
||||
define ('LAST_DB_VERSION', '9');
|
||||
define('LAST_DB_VERSION', '9');
|
||||
//set no errors
|
||||
define('MYSQL_NO_ERRORS', true);
|
||||
|
||||
@@ -74,6 +74,7 @@ function getjquerylink()
|
||||
|
||||
/**
|
||||
* Parsing installing templates
|
||||
* @param mixed $tplname
|
||||
*/
|
||||
function gettpl($tplname)
|
||||
{
|
||||
@@ -90,6 +91,11 @@ function gettpl($tplname)
|
||||
|
||||
/**
|
||||
* Export config
|
||||
* @param mixed $srv
|
||||
* @param mixed $usr
|
||||
* @param mixed $pass
|
||||
* @param mixed $nm
|
||||
* @param mixed $prf
|
||||
*/
|
||||
function do_config_export($srv, $usr, $pass, $nm, $prf)
|
||||
{
|
||||
@@ -100,32 +106,22 @@ function do_config_export($srv, $usr, $pass, $nm, $prf)
|
||||
$data .= '$dbname = \'' . str_replace("'", "\'", $nm) . "'; // database name \n";
|
||||
$data .= '$dbprefix = \'' . str_replace("'", "\'", $prf) . "'; // if you use prefix for tables , fill it \n";
|
||||
|
||||
|
||||
$written = false;
|
||||
|
||||
if (is_writable(PATH))
|
||||
if (file_put_contents(PATH . 'config.php', $data, LOCK_EX) !== false)
|
||||
{
|
||||
$fh = @fopen(PATH . 'config.php', 'wb');
|
||||
|
||||
if ($fh)
|
||||
{
|
||||
fwrite($fh, $data);
|
||||
fclose($fh);
|
||||
|
||||
$written = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! $written)
|
||||
if (defined('CLI') && CLI)
|
||||
{
|
||||
header('Content-Type: text/x-delimtext; name="config.php"');
|
||||
header('Content-disposition: attachment; filename=config.php');
|
||||
echo $data;
|
||||
|
||||
exit;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
//
|
||||
header('Content-Type: text/x-delimtext; name="config.php"');
|
||||
header('Content-disposition: attachment; filename=config.php');
|
||||
echo $data;
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@@ -140,6 +136,7 @@ function get_microtime()
|
||||
|
||||
/**
|
||||
* Get config value from database directly, if not return false.
|
||||
* @param mixed $name
|
||||
*/
|
||||
function inst_get_config($name)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,15 @@ include_once PATH . 'includes/mysqli.php';
|
||||
|
||||
include_once 'includes/functions_install.php';
|
||||
|
||||
//cli options
|
||||
$cli_options = [];
|
||||
|
||||
if (CLI)
|
||||
{
|
||||
$cli_options = getopt('', ['password::', 'link::']);
|
||||
}
|
||||
|
||||
|
||||
if (file_exists(PATH . 'config.php'))
|
||||
{
|
||||
include_once PATH . 'config.php';
|
||||
@@ -80,15 +89,17 @@ include_once PATH . 'includes/usr.php';
|
||||
include_once PATH . 'includes/functions_alternative.php';
|
||||
|
||||
$usrcp = new usrcp;
|
||||
$password = mt_rand();
|
||||
$password = ! empty($cli_options['password']) ? $cli_options['password'] : mt_rand();
|
||||
$user_salt = substr(kleeja_base64_encode(pack('H*', sha1(mt_rand()))), 0, 7);
|
||||
$user_pass = $usrcp->kleeja_hash_password($password . $user_salt);
|
||||
$user_name = $clean_name = 'admin';
|
||||
$user_mail = $config_sitemail = 'admin@example.com';
|
||||
$config_urls_type = 'id';
|
||||
$config_sitename = 'Yet Another Kleeja';
|
||||
$config_siteurl = 'http://' . $_SERVER['HTTP_HOST'] . str_replace('install', '', dirname($_SERVER['PHP_SELF']));
|
||||
$config_time_zone = '3';
|
||||
$config_siteurl = ! empty($cli_options['link'])
|
||||
? $cli_options['link']
|
||||
: 'http://' . $_SERVER['HTTP_HOST'] . str_replace('install', '', dirname($_SERVER['PHP_SELF']));
|
||||
$config_time_zone = 'Asia/Buraydah';
|
||||
|
||||
// Queries
|
||||
include 'includes/install_sqls.php';
|
||||
|
||||
Reference in New Issue
Block a user