mirror of
https://github.com/kleeja-official/kleeja.git
synced 2025-12-16 04:59:42 +01:00
fixes
This commit is contained in:
@@ -14,7 +14,10 @@ if (! defined('IN_ADMIN'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$old_version = KLEEJA_VERSION;
|
$old_version = KLEEJA_VERSION;
|
||||||
$new_version = unserialize($config['new_version'])['version_number'];
|
$new_version = unserialize($config['new_version']);
|
||||||
|
$new_version = empty($new_version['version_number'])
|
||||||
|
? KLEEJA_VERSION
|
||||||
|
: $new_version['version_number'];
|
||||||
|
|
||||||
|
|
||||||
// he can reinstall kleeja if he want by $_GET['install_again'] => for developers only
|
// he can reinstall kleeja if he want by $_GET['install_again'] => for developers only
|
||||||
@@ -24,7 +27,7 @@ if (! ig('install_again'))
|
|||||||
if (! version_compare(strtolower($old_version), strtolower($new_version), '<'))
|
if (! version_compare(strtolower($old_version), strtolower($new_version), '<'))
|
||||||
{
|
{
|
||||||
// kleeja doesn't need to update
|
// kleeja doesn't need to update
|
||||||
kleeja_admin_info('there is no update for your version', ADMIN_PATH);
|
kleeja_admin_info('there is no update for your version!', ADMIN_PATH);
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -102,47 +105,36 @@ if ($down_new_pack)
|
|||||||
/**
|
/**
|
||||||
* we will build rollback as zip file , and import the local version in it
|
* we will build rollback as zip file , and import the local version in it
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$localVersion = PATH . 'cache/old_kj.zip';
|
|
||||||
|
|
||||||
if (file_exists($localVersion))
|
$localVersion = PATH . 'cache/old_kj.zip';
|
||||||
{
|
|
||||||
kleeja_unlink($localVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
$oldKjZip = new ZipArchive;
|
if (file_exists($localVersion))
|
||||||
$oldKjZip->open($localVersion, ZipArchive::CREATE);
|
{
|
||||||
|
kleeja_unlink($localVersion);
|
||||||
|
}
|
||||||
|
|
||||||
$it = new RecursiveDirectoryIterator(PATH , RecursiveDirectoryIterator::SKIP_DOTS);
|
$oldKjZip = new ZipArchive;
|
||||||
|
$oldKjZip->open($localVersion, ZipArchive::CREATE);
|
||||||
|
|
||||||
|
$it = new RecursiveDirectoryIterator(PATH, RecursiveDirectoryIterator::SKIP_DOTS);
|
||||||
$pathFiles = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
$pathFiles = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
||||||
|
|
||||||
// we will not import all files , only what we want to update
|
// we will not import all files , only what we want to update
|
||||||
foreach ($pathFiles as $pathFile)
|
foreach ($pathFiles as $pathFile)
|
||||||
{
|
{
|
||||||
// only files , i like the zip file becuse i don't need to create multi folders inside
|
// only files , i like the zip file becuse i don't need to create multi folders inside
|
||||||
if ($pathFile->isFile())
|
if ($pathFile->isFile())
|
||||||
{
|
{
|
||||||
if (strpos($pathFile->getPathname() , '../cache') !== false)
|
if (preg_match('/^\.\.\/(plugins|styles|cache|uploads)/', $pathFile->getPathname()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
elseif (strpos($pathFile->getPathname() , '../plugins') !== false)
|
|
||||||
{
|
// it's make a folder with name (..) , we don't want it
|
||||||
continue;
|
$oldKjZip->addFromString(
|
||||||
}
|
preg_replace('/^\.\.\//', '', $pathFile->getPathname()),
|
||||||
elseif (strpos($pathFile->getPathname() , '../styles') !== false)
|
file_get_contents($pathFile->getPathname())
|
||||||
{
|
);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
elseif (strpos($pathFile->getPathname() , '../uploads') !== false)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
// it's make a folder with name (..) , we don't want it
|
|
||||||
$oldKjZip->addFromString(str_replace('../' , '' , $pathFile->getPathname() )
|
|
||||||
, file_get_contents($pathFile->getPathname()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$oldKjZip->close();
|
$oldKjZip->close();
|
||||||
@@ -210,7 +202,7 @@ if ($down_new_pack)
|
|||||||
|
|
||||||
if ($update_failed)
|
if ($update_failed)
|
||||||
{
|
{
|
||||||
kleeja_admin_err('update filed ');
|
kleeja_admin_err('updating process has failed...');
|
||||||
$zip = new ZipArchive;
|
$zip = new ZipArchive;
|
||||||
$zip->open($localVersion);
|
$zip->open($localVersion);
|
||||||
$zip->extractTo(PATH);
|
$zip->extractTo(PATH);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class Plugins
|
|||||||
private $installed_plugins_info = [];
|
private $installed_plugins_info = [];
|
||||||
|
|
||||||
|
|
||||||
private $plugin_path = '';
|
private $plugin_path = PATH . 'plugins';
|
||||||
|
|
||||||
|
|
||||||
private static $instance;
|
private static $instance;
|
||||||
@@ -55,7 +55,11 @@ class Plugins
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->plugin_path = PATH . KLEEJA_PLUGINS_FOLDER;
|
|
||||||
|
if (defined('KLEEJA_PLUGINS_FOLDER'))
|
||||||
|
{
|
||||||
|
$this->plugin_path = PATH . KLEEJA_PLUGINS_FOLDER;
|
||||||
|
}
|
||||||
|
|
||||||
// Get installed plugins
|
// Get installed plugins
|
||||||
$query = [
|
$query = [
|
||||||
@@ -85,7 +89,7 @@ class Plugins
|
|||||||
{
|
{
|
||||||
$dh = opendir($this->plugin_path);
|
$dh = opendir($this->plugin_path);
|
||||||
|
|
||||||
while (false !== ($folder_name = readdir($dh)))
|
while ($dh !== false and false !== ($folder_name = readdir($dh)))
|
||||||
{
|
{
|
||||||
if (is_dir($this->plugin_path . '/' . $folder_name) && preg_match('/[a-z0-9_.]{3,}/', $folder_name))
|
if (is_dir($this->plugin_path . '/' . $folder_name) && preg_match('/[a-z0-9_.]{3,}/', $folder_name))
|
||||||
{
|
{
|
||||||
|
|||||||
28
install/includes/Plugins.php
Normal file
28
install/includes/Plugins.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore an alias class for plugins class, during installation or updating.
|
||||||
|
*/
|
||||||
|
class Plugins
|
||||||
|
{
|
||||||
|
private static $instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Plugins
|
||||||
|
*/
|
||||||
|
public static function getInstance()
|
||||||
|
{
|
||||||
|
if (is_null(self::$instance)) {
|
||||||
|
self::$instance = new self();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function run($name)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,13 +26,13 @@ if (ig('change_lang'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Including current language
|
// Including current language
|
||||||
$lang = require $_path . 'lang/' . getlang() . '/common.php';
|
$lang = require PATH . 'lang/' . getlang() . '/common.php';
|
||||||
$lang = array_merge($lang, require $_path . 'lang/' . getlang() . '/install.php');
|
$lang = array_merge($lang, require PATH . 'lang/' . getlang() . '/install.php');
|
||||||
|
|
||||||
|
|
||||||
$IN_DEV = false;
|
$IN_DEV = false;
|
||||||
// Exceptions for development
|
// Exceptions for development
|
||||||
if (file_exists($_path . '.svn/entries') || file_exists('dev.txt'))
|
if (file_exists(PATH . '.svn/entries') || file_exists('dev.txt'))
|
||||||
{
|
{
|
||||||
define('DEV_STAGE', true);
|
define('DEV_STAGE', true);
|
||||||
$IN_DEV = true;
|
$IN_DEV = true;
|
||||||
@@ -46,13 +46,11 @@ if (file_exists($_path . '.svn/entries') || file_exists('dev.txt'))
|
|||||||
*/
|
*/
|
||||||
function getlang ($link = false)
|
function getlang ($link = false)
|
||||||
{
|
{
|
||||||
global $_path;
|
|
||||||
|
|
||||||
if (ig('lang'))
|
if (ig('lang'))
|
||||||
{
|
{
|
||||||
$lang = preg_replace('/[^a-z0-9]/i', '', g('lang', 'str', 'en'));
|
$lang = preg_replace('/[^a-z0-9]/i', '', g('lang', 'str', 'en'));
|
||||||
|
|
||||||
$ln = file_exists($_path . 'lang/' . $lang . '/install.php') ? $lang : 'en';
|
$ln = file_exists(PATH . 'lang/' . $lang . '/install.php') ? $lang : 'en';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -64,11 +62,9 @@ function getlang ($link = false)
|
|||||||
|
|
||||||
function getjquerylink()
|
function getjquerylink()
|
||||||
{
|
{
|
||||||
global $_path;
|
if (file_exists(PATH . 'admin/Masmak/js/jquery.min.js'))
|
||||||
|
|
||||||
if (file_exists($_path . 'admin/Masmak/js/jquery.min.js'))
|
|
||||||
{
|
{
|
||||||
return $_path . 'admin/Masmak/js/jquery.min.js';
|
return PATH . 'admin/Masmak/js/jquery.min.js';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -81,7 +77,7 @@ function getjquerylink()
|
|||||||
*/
|
*/
|
||||||
function gettpl($tplname)
|
function gettpl($tplname)
|
||||||
{
|
{
|
||||||
global $lang, $_path;
|
global $lang;
|
||||||
|
|
||||||
$tpl = preg_replace('/{{([^}]+)}}/', '<?php \\1 ?>', file_get_contents('style/' . $tplname));
|
$tpl = preg_replace('/{{([^}]+)}}/', '<?php \\1 ?>', file_get_contents('style/' . $tplname));
|
||||||
ob_start();
|
ob_start();
|
||||||
@@ -95,34 +91,21 @@ function gettpl($tplname)
|
|||||||
/**
|
/**
|
||||||
* Export config
|
* Export config
|
||||||
*/
|
*/
|
||||||
function do_config_export($srv, $usr, $pass, $nm, $prf, $fpath = '')
|
function do_config_export($srv, $usr, $pass, $nm, $prf)
|
||||||
{
|
{
|
||||||
global $_path;
|
|
||||||
|
|
||||||
if (! in_array($type, ['mysql', 'mysqli']))
|
|
||||||
{
|
|
||||||
$type = 'mysql';
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = '<?php' . "\n\n" . '//fill these variables with your data' . "\n";
|
$data = '<?php' . "\n\n" . '//fill these variables with your data' . "\n";
|
||||||
//$data .= '$db_type = \'' . $type . "'; //mysqli or mysql \n";
|
|
||||||
$data .= '$dbserver = \'' . str_replace("'", "\'", $srv) . "'; //database server \n";
|
$data .= '$dbserver = \'' . str_replace("'", "\'", $srv) . "'; //database server \n";
|
||||||
$data .= '$dbuser = \'' . str_replace("'", "\'", $usr) . "' ; // database user \n";
|
$data .= '$dbuser = \'' . str_replace("'", "\'", $usr) . "' ; // database user \n";
|
||||||
$data .= '$dbpass = \'' . str_replace("'", "\'", $pass) . "'; // database password \n";
|
$data .= '$dbpass = \'' . str_replace("'", "\'", $pass) . "'; // database password \n";
|
||||||
$data .= '$dbname = \'' . str_replace("'", "\'", $nm) . "'; // database name \n";
|
$data .= '$dbname = \'' . str_replace("'", "\'", $nm) . "'; // database name \n";
|
||||||
$data .= '$dbprefix = \'' . str_replace("'", "\'", $prf) . "'; // if you use prefix for tables , fill it \n";
|
$data .= '$dbprefix = \'' . str_replace("'", "\'", $prf) . "'; // if you use prefix for tables , fill it \n";
|
||||||
//$data .= '$adminpath = \'admin.php\';// if you renamed your acp file , please fill the new name here \n';
|
|
||||||
//$data .= "\n\n\n";
|
|
||||||
//$data .= "//for integration with script must change user systen from admin cp \n";
|
|
||||||
//$data .= '$script_path = \'' . str_replace("'", "\'", $fpath) . "'; // path of script (./forums) \n";
|
|
||||||
//$data .= "\n\n";
|
|
||||||
//$data .= '?'.'>';
|
|
||||||
|
|
||||||
$written = false;
|
$written = false;
|
||||||
|
|
||||||
if (is_writable($_path))
|
if (is_writable(PATH))
|
||||||
{
|
{
|
||||||
$fh = @fopen($_path . 'config.php', 'wb');
|
$fh = @fopen(PATH . 'config.php', 'wb');
|
||||||
|
|
||||||
if ($fh)
|
if ($fh)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ if (file_exists($_path . 'config.php'))
|
|||||||
{
|
{
|
||||||
include_once $_path . 'config.php';
|
include_once $_path . 'config.php';
|
||||||
}
|
}
|
||||||
|
include_once 'includes/plugins.php';
|
||||||
include_once $_path . 'includes/functions_display.php';
|
include_once $_path . 'includes/functions_display.php';
|
||||||
include_once $_path . 'includes/functions_alternative.php';
|
include_once $_path . 'includes/functions_alternative.php';
|
||||||
include_once $_path . 'includes/functions.php';
|
include_once $_path . 'includes/functions.php';
|
||||||
@@ -32,36 +33,6 @@ include_once $_path . 'includes/mysqli.php';
|
|||||||
include_once 'includes/functions_install.php';
|
include_once 'includes/functions_install.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ignore an alias class for plugins class
|
|
||||||
*/
|
|
||||||
class Plugins
|
|
||||||
{
|
|
||||||
private static $instance;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Plugins
|
|
||||||
*/
|
|
||||||
public static function getInstance()
|
|
||||||
{
|
|
||||||
if (is_null(self::$instance))
|
|
||||||
{
|
|
||||||
self::$instance = new self();
|
|
||||||
}
|
|
||||||
return self::$instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function run($name)
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (! ig('step'))
|
if (! ig('step'))
|
||||||
{
|
{
|
||||||
@@ -71,7 +42,6 @@ if (! ig('step'))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Kleeja must be safe ..
|
// Kleeja must be safe ..
|
||||||
//
|
//
|
||||||
@@ -81,7 +51,7 @@ if (! empty($dbuser) && ! empty($dbname) && ! (ig('step') && in_array(g('step'),
|
|||||||
|
|
||||||
if (! empty($d))
|
if (! empty($d))
|
||||||
{
|
{
|
||||||
header('Location: index.php');
|
header('Location: ./index.php');
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -243,8 +213,8 @@ case 'data' :
|
|||||||
//connect .. for check
|
//connect .. for check
|
||||||
$SQL = new KleejaDatabase($dbserver, $dbuser, $dbpass, $dbname);
|
$SQL = new KleejaDatabase($dbserver, $dbuser, $dbpass, $dbname);
|
||||||
|
|
||||||
include_once '../includes/usr.php';
|
include_once $_path . 'includes/usr.php';
|
||||||
include_once '../includes/functions_alternative.php';
|
include_once $_path . 'includes/functions_alternative.php';
|
||||||
$usrcp = new usrcp;
|
$usrcp = new usrcp;
|
||||||
|
|
||||||
$user_salt = substr(kleeja_base64_encode(pack('H*', sha1(mt_rand()))), 0, 7);
|
$user_salt = substr(kleeja_base64_encode(pack('H*', sha1(mt_rand()))), 0, 7);
|
||||||
|
|||||||
225
install/quick.php
Normal file
225
install/quick.php
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package install
|
||||||
|
* @copyright (c) 2007 Kleeja.com
|
||||||
|
* @license ./docs/license.txt
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// Report all errors, except notices
|
||||||
|
@error_reporting(E_ALL ^ E_NOTICE);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* include important files
|
||||||
|
*/
|
||||||
|
define('IN_COMMON', true);
|
||||||
|
$_path = '../';
|
||||||
|
define('PATH', __DIR__ . '/../');
|
||||||
|
define('CLI', PHP_SAPI === 'cli');
|
||||||
|
|
||||||
|
|
||||||
|
include_once 'includes/plugins.php';
|
||||||
|
include_once PATH . 'includes/functions_display.php';
|
||||||
|
include_once PATH . 'includes/functions_alternative.php';
|
||||||
|
include_once PATH . 'includes/functions.php';
|
||||||
|
|
||||||
|
include_once PATH . 'includes/mysqli.php';
|
||||||
|
|
||||||
|
include_once 'includes/functions_install.php';
|
||||||
|
|
||||||
|
if (file_exists(PATH . 'config.php'))
|
||||||
|
{
|
||||||
|
include_once PATH . 'config.php';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
do_config_export(
|
||||||
|
'localhost',
|
||||||
|
'root',
|
||||||
|
'',
|
||||||
|
'kleeja',
|
||||||
|
'klj_'
|
||||||
|
);
|
||||||
|
|
||||||
|
exit('`config.php` was missing! so we created one for you, now go fill it with database information.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$SQL = new KleejaDatabase($dbserver, $dbuser, $dbpass, $dbname);
|
||||||
|
|
||||||
|
if (! $SQL->is_connected())
|
||||||
|
{
|
||||||
|
exit('Can not connect to database, please make sure the data in `config.php` is correct!');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($SQL->mysql_version()) && version_compare($SQL->mysql_version(), MIN_MYSQL_VERSION, '<'))
|
||||||
|
{
|
||||||
|
exit('The required MySQL version is `' . MIN_MYSQL_VERSION . '` and yours is `' . $SQL->mysql_version() . '`!');
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (['cache', 'uploads', 'uploads/thumbs'] as $folder)
|
||||||
|
{
|
||||||
|
if (! is_writable(PATH . $folder))
|
||||||
|
{
|
||||||
|
@chmod(PATH . $folder, 0755);
|
||||||
|
|
||||||
|
if (! is_writable(PATH . $folder))
|
||||||
|
{
|
||||||
|
exit('The folder `' . $folder . '` has to be writable!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//install
|
||||||
|
$SQL = new KleejaDatabase($dbserver, $dbuser, $dbpass, $dbname);
|
||||||
|
|
||||||
|
include_once PATH . 'includes/usr.php';
|
||||||
|
include_once PATH . 'includes/functions_alternative.php';
|
||||||
|
|
||||||
|
$usrcp = new usrcp;
|
||||||
|
$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';
|
||||||
|
|
||||||
|
// Queries
|
||||||
|
include 'includes/install_sqls.php';
|
||||||
|
include 'includes/default_values.php';
|
||||||
|
|
||||||
|
$SQL->query($install_sqls['ALTER_DATABASE_UTF']);
|
||||||
|
|
||||||
|
|
||||||
|
$err = 0;
|
||||||
|
$errors = '';
|
||||||
|
|
||||||
|
foreach ($install_sqls as $name => $sql_content)
|
||||||
|
{
|
||||||
|
if ($name == 'DROP_TABLES' || $name == 'ALTER_DATABASE_UTF')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $SQL->query($sql_content))
|
||||||
|
{
|
||||||
|
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
|
||||||
|
echo $lang['INST_SQL_ERR'] . ' : ' . $name . '[basic]' . (CLI ? PHP_EOL : '<br>');
|
||||||
|
$err++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($err == 0)
|
||||||
|
{
|
||||||
|
//add configs
|
||||||
|
foreach ($config_values as $cn)
|
||||||
|
{
|
||||||
|
if (empty($cn[6]))
|
||||||
|
{
|
||||||
|
$cn[6] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "INSERT INTO `{$dbprefix}config` (`name`, `value`, `option`, `display_order`, `type`, `plg_id`, `dynamic`) VALUES ('$cn[0]', '$cn[1]', '$cn[2]', '$cn[3]', '$cn[4]', '$cn[5]', '$cn[6]');";
|
||||||
|
|
||||||
|
if (! $SQL->query($sql))
|
||||||
|
{
|
||||||
|
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
|
||||||
|
echo $lang['INST_SQL_ERR'] . ' : [configs_values] ' . $cn . (CLI ? PHP_EOL : '<br>');
|
||||||
|
$err++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//add groups configs
|
||||||
|
foreach ($config_values as $cn)
|
||||||
|
{
|
||||||
|
if ($cn[4] != 'groups' or ! $cn[4])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$itxt = '';
|
||||||
|
|
||||||
|
foreach ([1, 2, 3] as $im)
|
||||||
|
{
|
||||||
|
$itxt .= ($itxt == '' ? '' : ',') . "($im, '$cn[0]', '$cn[1]')";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "INSERT INTO `{$dbprefix}groups_data` (`group_id`, `name`, `value`) VALUES " . $itxt . ';';
|
||||||
|
|
||||||
|
if (! $SQL->query($sql))
|
||||||
|
{
|
||||||
|
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
|
||||||
|
echo $lang['INST_SQL_ERR'] . ' : [groups_configs_values] ' . $cn . (CLI ? PHP_EOL : '<br>');
|
||||||
|
$err++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//add exts
|
||||||
|
foreach ($ext_values as $gid => $exts)
|
||||||
|
{
|
||||||
|
$itxt = '';
|
||||||
|
|
||||||
|
foreach ($exts as $t => $v)
|
||||||
|
{
|
||||||
|
$itxt .= ($itxt == '' ? '' : ',') . "('$t', $gid, $v)";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "INSERT INTO `{$dbprefix}groups_exts` (`ext`, `group_id`, `size`) VALUES " . $itxt . ';';
|
||||||
|
|
||||||
|
if (! $SQL->query($sql))
|
||||||
|
{
|
||||||
|
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
|
||||||
|
echo $lang['INST_SQL_ERR'] . ' : [ext_values] ' . $gid . (CLI ? PHP_EOL : '<br>');
|
||||||
|
$err++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//add acls
|
||||||
|
foreach ($acls_values as $cn => $ct)
|
||||||
|
{
|
||||||
|
$it = 1;
|
||||||
|
$itxt = '';
|
||||||
|
|
||||||
|
foreach ($ct as $ctk)
|
||||||
|
{
|
||||||
|
$itxt .= ($itxt == '' ? '' : ',') . "('$cn', '$it', '$ctk')";
|
||||||
|
$it++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "INSERT INTO `{$dbprefix}groups_acl` (`acl_name`, `group_id`, `acl_can`) VALUES " . $itxt . ';';
|
||||||
|
|
||||||
|
if (! $SQL->query($sql))
|
||||||
|
{
|
||||||
|
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
|
||||||
|
echo $lang['INST_SQL_ERR'] . ' : [acl_values] ' . $cn . (CLI ? PHP_EOL : '<br>');
|
||||||
|
$err++;
|
||||||
|
}
|
||||||
|
$it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($err > 0)
|
||||||
|
{
|
||||||
|
echo CLI ? PHP_EOL : '<br><span style="color:red">';
|
||||||
|
echo 'We encountered a problem during installation, see the error log:';
|
||||||
|
echo CLI ? PHP_EOL : '</span><br>';
|
||||||
|
echo CLI ? '' : '<textarea rows="10" style="width:100%">';
|
||||||
|
echo $errors;
|
||||||
|
echo CLI ? '' : '</textarea>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo CLI ? '' : '<span style="color:green">';
|
||||||
|
echo 'Kleeja has been installed successfully, enjoy ...';
|
||||||
|
echo CLI ? PHP_EOL : '</span><br><br>';
|
||||||
|
echo 'Username: admin' . (CLI ? PHP_EOL : '<br>');
|
||||||
|
echo 'Password: ' . $password;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user