improve update system

This commit is contained in:
Abdulrahman
2019-05-13 00:03:24 +03:00
parent a8139b03b4
commit 3f95076b81
21 changed files with 253 additions and 415 deletions

View File

@@ -15,7 +15,7 @@ if (! defined('IN_ADMIN'))
set_time_limit(0);
$current_version = '3.0';
$current_version = KLEEJA_VERSION;
$new_version = unserialize($config['new_version']);
$new_version = empty($new_version['version_number'])
? KLEEJA_VERSION
@@ -167,13 +167,13 @@ elseif ($current_smt == 'update2')
}
// let's check if there any update files in install folder
$update_file = PATH . "cache/kleeja-{$new_version}/install/includes/update_files/{$old_version}_to_{$new_version}.php";
$update_file = PATH . "cache/kleeja-{$new_version}/install/includes/update_schema.php";
if (file_exists($update_file))
{
// move the update file from install folder to cache folder to include it later and delete install folder
// becuse if install folder is exists , it can make some problems if dev mode is not active
rename($update_file, PATH . "cache/update_{$old_version}_to_{$new_version}.php");
rename($update_file, PATH . "cache/update_schema.php");
}
// skip some folders
@@ -299,36 +299,51 @@ elseif ($current_smt == 'update3')
else
{
// we will include what we want to do in this file , and kleeja will done
if (file_exists($db_update_file = PATH . "cache/update_{$old_version}_to_{$new_version}.php"))
if (file_exists($db_update_file = PATH . "cache/update_schema.php"))
{
require_once $db_update_file;
if($config['db_version'] < UPDATE_DB_VERSION)
$all_db_updates = array_keys($update_schema);
$available_db_updates = array_filter($all_db_updates, function ($v) use ($config) {
return $v > $config['db_version'];
});
sort($available_db_updates);
if(sizeof($available_db_updates))
{
$SQL->show_errors = false;
if (isset($update_sqls) && sizeof($update_sqls) > 0)
foreach ($available_db_updates as $db_update_version)
{
foreach ($update_sqls as $name=>$sql_content)
{
$SQL->query($sql_content);
}
}
$SQL->show_errors = false;
if (isset($update_functions) && sizeof($update_functions) > 0)
{
foreach ($update_functions as $n)
if (isset($update_schema[$db_update_version]['sql'])
&& sizeof($update_schema[$db_update_version]['sql']) > 0)
{
if (is_callable($n))
foreach ($update_schema[$db_update_version]['sql'] as $name=>$sql_content)
{
$n();
$SQL->query($sql_content);
}
}
}
$SQL->query(
"UPDATE `{$dbprefix}config` SET `value` = '" . UPDATE_DB_VERSION . "' WHERE `name` = 'db_version'"
);
if (isset($update_schema[$db_update_version]['functions'])
&& sizeof($update_schema[$db_update_version]['functions']) > 0)
{
foreach ($update_schema[$db_update_version]['functions'] as $n)
{
if (is_callable($n))
{
$n();
}
}
}
$SQL->query(
"UPDATE `{$dbprefix}config` SET `value` = '" . $db_update_version . "' WHERE `name` = 'db_version'"
);
}
}
}

View File

@@ -140,7 +140,7 @@ class kleeja_style
$html = preg_replace_callback('/<LOOP\s+NAME\s*=\s*(\"|)+([a-z0-9_\.]{1,})+(\"|)\s*>/i', ['kleeja_style', '_loop_callback'], $html);
$html = preg_replace_callback(kleeja_style::reg('var'), ['kleeja_style', '_vars_callback'], $html);
$rep =
$rep =
[
'/<\/(LOOP|IF|END|IS_BROWSER|UNLESS)>/i' => '<?php } ?>',
'/<INCLUDE(\s+NAME|)\s*=*\s*"(.+)"\s*>/iU' => '<?php echo $this->display("\\2"); ?>',
@@ -364,8 +364,24 @@ class kleeja_style
{
$this->vars = &$GLOBALS;
$eval_on = false;
eval('$eval_on = true;');
$parsed_html = trim($this->_parse($html));
ob_start();
eval(' ?' . '>' . trim($this->_parse($html)) . '<' . '?php ');
if($eval_on)
{
eval(' ?' . '>' . $parsed_html . '<' . '?php ');
}
else
{
$path = PATH . 'cache/tpl_' . md5($parsed_html) . '.php';
file_put_contents($path, $parsed_html);
include_once $path;
}
$page = ob_get_contents();
ob_end_clean();

View File

@@ -19,3 +19,7 @@ if (! defined('IN_COMMON'))
define('KLEEJA_VERSION', '3.0.3');
define('KLEEJA_DB_VERSION', '9');
// Kleeja min requirements
define('MIN_PHP_VERSION', '7.0');
define('MIN_MYSQL_VERSION', '4.2.2');

View File

@@ -1,28 +0,0 @@
<?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 [];
}
}

View File

@@ -7,36 +7,31 @@
*
*/
// Requirements of Kleeja
define('MIN_PHP_VERSION', '7.0');
define('MIN_MYSQL_VERSION', '4.2.2');
//set no errors
// get version info and min requirement values
require PATH . 'includes/version.php';
//set mysql to show no errors
define('MYSQL_NO_ERRORS', true);
define('EVAL_IS_ON', is_eval_is_on());
// Detect choosing another lang while installing
if (ig('change_lang'))
if (ig('change_lang') && ip('lang'))
{
if (ip('lang'))
{
header('Location: ' . $_SERVER['PHP_SELF'] . '?step=' . p('step_is') . '&lang=' . p('lang'));
}
header('Location: ' . $_SERVER['PHP_SELF'] . '?step=' . p('step_is') . '&lang=' . p('lang'));
}
require PATH . 'includes/version.php';
// Including current language
$lang = require PATH . 'lang/' . getlang() . '/common.php';
$lang = array_merge($lang, require PATH . 'lang/' . getlang() . '/install.php');
$IN_DEV = false;
// Exceptions for development
if (file_exists(PATH . '.svn/entries') || file_exists('dev.txt'))
if (file_exists(PATH . '.git'))
{
define('DEV_STAGE', true);
$IN_DEV = true;
}
@@ -47,15 +42,12 @@ if (file_exists(PATH . '.svn/entries') || file_exists('dev.txt'))
*/
function getlang ($link = false)
{
$ln = 'en';
if (ig('lang'))
{
$lang = preg_replace('/[^a-z0-9]/i', '', g('lang', 'str', 'en'));
$ln = file_exists(PATH . 'lang/' . $lang . '/install.php') ? $lang : 'en';
}
else
{
$ln = 'en';
$ln = file_exists(PATH . 'lang/' . $lang . '/install.php') ? $lang : 'en';
}
return $link ? 'lang=' . $ln : $ln;
@@ -67,10 +59,8 @@ function getjquerylink()
{
return PATH . 'admin/Masmak/js/jquery.min.js';
}
else
{
return 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js';
}
return 'http://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js';
}
/**
@@ -82,14 +72,40 @@ function gettpl($tplname)
global $lang;
$tpl = preg_replace('/{{([^}]+)}}/', '<?php \\1 ?>', file_get_contents('style/' . $tplname));
ob_start();
eval('?> ' . $tpl . '<?php ');
if (EVAL_IS_ON)
{
eval('?> ' . $tpl . '<?php ');
}
else
{
include_once kleeja_eval($tpl);
}
$stpl = ob_get_contents();
ob_end_clean();
return $stpl;
}
function is_eval_is_on()
{
$eval_on = false;
eval('$eval_on = true;');
return $eval_on;
}
function kleeja_eval($code)
{
$path = PATH . 'cache/' . md5($code) . '.php';
file_put_contents($path, $code);
return $path;
}
/**
* Export config
* @param mixed $srv
@@ -117,7 +133,7 @@ function do_config_export($srv, $usr, $pass, $nm, $prf)
return true;
}
//
header('Content-Type: text/x-delimtext; name="config.php"');
header('Content-disposition: attachment; filename=config.php');
echo $data;
@@ -143,7 +159,7 @@ function inst_get_config($name)
{
global $SQL, $dbprefix;
if (! $SQL)
if (empty($SQL))
{
global $dbserver, $dbuser, $dbpass, $dbname;
@@ -155,7 +171,7 @@ function inst_get_config($name)
$SQL = new KleejaDatabase($dbserver, $dbuser, $dbpass, $dbname);
}
if (! $SQL)
if (empty($SQL))
{
return false;
}

View File

@@ -1 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1256" /><title>Powered by Kleeja</title><style type="text/css">* {font-size: 100%;margin:0;padding: 0; color:#CECFCE;}body { font-family: Tahoma ,Arial, sans-serif;font-size: 100%;color: #69788E; margin: 10px 30px;background: #F7F7F7;}a:link, a:visited {text-decoration: none;color:#CECFCE;}a:active, a:hover {text-decoration: underline;color: #111;}h1 {font-family: "Trebuchet MS", Helvetica, sans-serif; font-size: 1.70em;font-weight: normal;color: #333333;margin-top: 0; margin-bottom: 10px;}.content_box {border: 1px dashed #CECFCE;background: #FFFFFF;padding: 10px;margin-right: auto;margin-left: auto;}</style> </head> <body title="&#1603;&#1604;&#1610;&#1580;&#1575;"><br /><div class="content_box"><p><a target="_blank" href="http://www.kleeja.com" title="kleeja"><img border="0" src="http://kleeja.com/index.png"></a></p><br /><h1><span style="font-size:250%;color:#D80000;">403 - Access forbidden!</span></h1></div><br /><div class="content_box"><span style="font-size: 140%">Powered by Kleeja &gt;&gt;&gt; the best uploader ...</span > >> <a target="_blank" href="http://www.kleeja.com/bugs/ar/">Bugs</a> | <a target="_blank" href="http://www.kleeja.com/plugins/">Plugins</a> | <a target="_blank" href="http://www.kleeja.com/styles/">Styles</a> | </div></body></html>

View File

@@ -1,12 +1,24 @@
<?php
//
// Kleeja database version : 9
//
/**
*
* @package install
* @copyright (c) 2007 Kleeja.com
* @license ./docs/license.txt
*
*/
define('UPDATE_DB_VERSION', '9');
// not for directly open
if (! defined('IN_COMMON'))
{
exit();
}
$update_sqls =
[
// drop older versions update support after 2 year of release or as appropriate in order to
// make this file smaller in size.
$update_schema = [];
$update_schema[9]['sql'] = [
'files_size_big' => "ALTER TABLE `{$dbprefix}files` CHANGE `size` `size` BIGINT(20) NOT NULL DEFAULT '0';",
'group_size_big' => "ALTER TABLE `{$dbprefix}groups_exts` CHANGE `size` `size` BIGINT(20) NOT NULL DEFAULT '0';",
'files_index_type' => "ALTER TABLE `{$dbprefix}files` ADD INDEX `type` (`type`);",
@@ -14,19 +26,9 @@ $update_sqls =
];
//$update_functions = array
//(
// function () {
//
// },
// function () {
//
// },
//);
//$update_notes = array
//(
// 'note .......',
// 'note 2 .......',
//);
// $update_schema[9]['functions'] = [
// function () {
// },
// function () {
// },
// ];

View File

@@ -17,8 +17,7 @@ error_reporting(E_ALL ^ E_NOTICE);
define('IN_COMMON', true);
//path to this file from Kleeja root folder
$_path = '../';
define('PATH', $_path);
define('PATH', '../');
//before anything check PHP version compatibility
@@ -42,14 +41,14 @@ if (! function_exists('mysqli_connect'))
if (file_exists($_path . 'config.php'))
if (file_exists(PATH . 'config.php'))
{
include_once $_path . 'config.php';
include_once PATH . 'config.php';
}
include_once $_path . 'includes/functions.php';
include_once PATH . 'includes/functions.php';
include_once $_path . 'includes/mysqli.php';
include_once PATH . 'includes/mysqli.php';
include_once 'includes/functions_install.php';
@@ -72,10 +71,9 @@ switch (g('step', 'str'))
default:
case 'language':
if (ig('ln') && g('ln', 'str', '') !== '')
if (ig('ln'))
{
// header('Location: ./?step=official&lang=' . g('ln'));
echo '<meta http-equiv="refresh" content="0;url=./?step=what_is_kleeja&lang=' . g('ln') . '">';
echo '<meta http-equiv="refresh" content="0;url=./?step=what_is_kleeja&lang=' . g('ln', 'str', 'en') . '">';
exit;
}
@@ -100,16 +98,16 @@ case 'choose' :
$install_or_no = $php_ver = true;
//check version of PHP
//check version of PHP
if (! function_exists('version_compare')
|| version_compare(PHP_VERSION, MIN_PHP_VERSION, '<'))
{
$php_ver = false;
}
if (file_exists($_path . 'config.php'))
if (file_exists(PATH . 'config.php'))
{
include_once $_path . 'config.php';
include_once PATH . 'config.php';
if (! empty($dbuser) && ! empty($dbname))
{

View File

@@ -16,19 +16,21 @@
* include important files
*/
define('IN_COMMON', true);
$_path = '../';
define('PATH', $_path);
define('STOP_PLUGINS', true);
define('PATH', '../');
if (file_exists($_path . 'config.php'))
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_alternative.php';
include_once $_path . 'includes/functions.php';
include_once $_path . 'includes/mysqli.php';
include_once PATH . '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';
@@ -60,7 +62,7 @@ if (! empty($dbuser) && ! empty($dbname) && ! (ig('step') && in_array(g('step'),
/**
* Print header
*/
if (ip('dbsubmit') && ! is_writable($_path))
if (ip('dbsubmit') && ! is_writable(PATH))
{
// soon
}
@@ -97,20 +99,14 @@ break;
case 'f':
$check_ok = true;
$advices = $register_globals = $get_magic_quotes_gpc = false;
$advices = $ziparchive_lib = false;
if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
if(! class_exists( 'ZipArchive'))
{
$register_globals = true;
$ziparchive_lib = true;
}
if ( (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) ||
(@ini_get('magic_quotes_sybase') && (strtolower(@ini_get('magic_quotes_sybase')) != 'off')) )
{
$get_magic_quotes_gpc = true;
}
if ($register_globals || $get_magic_quotes_gpc)
if ($ziparchive_lib)
{
$advices = true;
}
@@ -124,18 +120,13 @@ case 'c':
// after submit, generate config file
if (ip('dbsubmit'))
{
//lets do it
do_config_export(
p('db_server'),
p('db_user'),
p('db_pass'),
p('db_name'),
p('db_prefix')
);
//create config file, or export it to browser on failure
do_config_export(p('db_server'), p('db_user'), p('db_pass'), p('db_name'), p('db_prefix'));
}
$no_config = ! file_exists($_path . 'config.php') ? false : true;
$writeable_path = is_writable($_path) ? true : false;
$no_config = ! file_exists(PATH . 'config.php') || ig('force') ? false : true;
$writeable_path = is_writable(PATH) ? true : false;
echo gettpl('configs.html');
@@ -168,9 +159,9 @@ case 'check':
//try to chmod them
if (function_exists('chmod'))
{
@chmod($_path . 'cache', 0755);
@chmod($_path . 'uploads', 0755);
@chmod($_path . 'uploads/thumbs', 0755);
@chmod(PATH . 'cache', 0755);
@chmod(PATH . 'uploads', 0755);
@chmod(PATH . 'uploads/thumbs', 0755);
}
echo gettpl('check_all.html');
@@ -213,8 +204,8 @@ case 'data' :
//connect .. for check
$SQL = new KleejaDatabase($dbserver, $dbuser, $dbpass, $dbname);
include_once $_path . 'includes/usr.php';
include_once $_path . 'includes/functions_alternative.php';
include_once PATH . 'includes/usr.php';
include_once PATH . 'includes/functions_alternative.php';
$usrcp = new usrcp;
$user_salt = substr(kleeja_base64_encode(pack('H*', sha1(mt_rand()))), 0, 7);

View File

@@ -16,16 +16,15 @@
* include important files
*/
define('IN_COMMON', true);
$_path = '../';
define('STOP_PLUGINS', true);
define('PATH', __DIR__ . '/../');
define('CLI', PHP_SAPI === 'cli');
include_once 'includes/plugins.php';
include_once PATH . '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';
@@ -45,15 +44,9 @@ if (file_exists(PATH . 'config.php'))
}
else
{
do_config_export(
'localhost',
'root',
'',
'kleeja',
'klj_'
);
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.');
exit('`config.php` was missing! so we created one for you, kindly edit the file with database information.');
}
$SQL = new KleejaDatabase($dbserver, $dbuser, $dbpass, $dbname);

View File

@@ -1,7 +1,7 @@
<div class="BoxInner"><div class="BoxTopImg"></div><div class="BoxBody"><div class="inner">
<div class="clr"></div>
<h2><img src="style/images/k_info.png" class="img" alt=" " /> {{echo $lang['FUNCTIONS_CHECK']}} :</h2>
<h2><img src="style/images/k_info.png" class="img" alt=" " /> {{echo $lang['FUNCTIONS_CHECK']}} :</h2>
<ul class="F_Check">
{{if(function_exists('unlink')):}}
<li class="YesCheck">
@@ -26,11 +26,11 @@
<p>[ {{echo $lang['FUNCTION_DISC_GD']}} ]</p>
</li>
{{endif;}}
{{if(function_exists('fopen')):}}
<li class="YesCheck">
<h3><img src="style/images/ok.png" alt=" " class="img" /> {{echo sprintf($lang['FUNCTION_IS_EXISTS'], 'fopen')}}</h3>
<p>[ {{echo $lang['FUNCTION_DISC_FOPEN']}} ]</p>
<p>[ {{echo $lang['FUNCTION_DISC_FOPEN']}} ]</p>
</li>
{{else: $GLOBALS['check_ok'] = false;}}
<li class="NoCheck">
@@ -53,21 +53,17 @@
</ul>
<div class="hr"></div>
{{if($GLOBALS['advices']):}}
<h2 style="font-size:100%;"><img src="style/images/k_info.png" class="img" alt=" " /> {{echo $lang['ADVICES_CHECK']}} :</h2>
<ul class="F_Check">
{{if($GLOBALS['register_globals']):}}
<li class="NoCheck"><p style="text-indent:0;"><img src="style/images/surprised.png" alt=" " class="img" />{{echo $lang['ADVICES_REGISTER_GLOBALS']}}</p></li>
{{endif;}}
{{if($GLOBALS['get_magic_quotes_gpc']):}}
<li class="NoCheck"><p style="text-indent:0;"><img src="style/images/surprised.png" alt=" " class="img" />{{echo $lang['ADVICES_MAGIC_QUOTES']}}</p></li>
{{if($GLOBALS['advices']):}}
<h2 style="font-size:100%;"><img src="style/images/k_info.png" class="img" alt=" " /> {{echo $lang['ADVICES_CHECK']}} :</h2>
<ul class="F_Check">
{{if($GLOBALS['ziparchive_lib']):}}
<li class="NoCheck"><p style="text-indent:0;"><img src="style/images/surprised.png" alt=" " class="img" />{{echo $lang['ZIPARCHIVE_LIB']}}</p></li>
{{endif;}}
</ul>
<div class="hr"></div>
{{endif;}}
<center>
{{if($GLOBALS['check_ok']):}}
<form method="post" action="{{echo './install.php?step=c&amp;' . getlang(1)}}">
@@ -82,5 +78,5 @@
{{endif;}}
</center>
<div class="clr"></div>
</div></div><div class="BoxBottomImg"></div></div>
<div class="clr"></div>
</div></div><div class="BoxBottomImg"></div></div>

View File

@@ -8,32 +8,32 @@
{{endif}}
{{if($GLOBALS['no_connection']): $GLOBALS['submit_disabled'] = true;}}
<div class="notice">
<p class="error2"><img src="style/images/k_info.png" class="img" alt=" " />{{echo $lang['INST_CONNCET_ERR']}}</p>
</div>
{{endif}}
{{if($GLOBALS['mysql_ver']): $GLOBALS['submit_disabled'] = true;}}
<div class="notice">
<p class="error2"><img src="style/images/k_info.png" class="img" alt=" " />{{echo sprintf($lang['INST_MYSQL_LESSMIN'], MIN_MYSQL_VERSION, $GLOBALS['mysql_ver'])}}</p>
</div>
{{endif}}
{{if(!is_writable($_path . 'cache')) : $GLOBALS['submit_disabled'] = true;}}
{{if(!is_writable(PATH . 'cache')) : $GLOBALS['submit_disabled'] = true;}}
<div class="notice">
<p class="error2"><img src="style/images/k_info.png" class="img" alt=" " />[ cache ] : {{echo $lang['INST_NO_WRTABLE']}}</p>
</div>
{{endif}}
{{if(!is_writable($_path . 'uploads')) : $GLOBALS['submit_disabled'] = true;}}
{{if(!is_writable(PATH . 'uploads')) : $GLOBALS['submit_disabled'] = true;}}
<div class="notice">
<p class="error2"><img src="style/images/k_info.png" class="img" alt=" " />[ uploads ] : {{echo $lang['INST_NO_WRTABLE']}}</p>
</div>
{{endif}}
{{if(!is_writable($_path . 'uploads/thumbs')) : $GLOBALS['submit_disabled'] = true;}}
{{if(!is_writable(PATH . 'uploads/thumbs')) : $GLOBALS['submit_disabled'] = true;}}
<div class="notice">
<p class="error2"><img src="style/images/k_info.png" class="img" alt=" " />[ uploads/thumbs ] : {{echo $lang['INST_NO_WRTABLE']}}</p>
</div>
@@ -51,10 +51,10 @@
</form>
{{else:}}
<form method="post" action="{{echo './install.php?step=check&amp;' . getlang(1)}}">
<button onclick="window.location.href='./install.php?step=c&amp;{{echo getlang(1)}}';return false;" name="previous" type="submit" id="submit" class="btn"><span>&laquo; {{echo $lang['INST_PREVIOUS']}}</span></button>
<button onclick="window.location.href='./install.php?step=c&amp;force=1&amp;{{echo getlang(1)}}';return false;" name="previous" type="submit" id="submit" class="btn"><span>&laquo; {{echo $lang['INST_PREVIOUS']}}</span></button>
<button name="agres" type="submit" class="btn"><span>{{echo $lang['RE_CHECK']}} &raquo;</span></button>
</form>
</form>
{{endif}}
<div class="clr"></div>
<div class="clr"></div>
</div></div><div class="BoxBottomImg"></div></div>

View File

@@ -5,17 +5,6 @@
<form method="post" action="{{echo './install.php?step=c&amp;' . getlang(1)}}" onsubmit="javascript:return formCheck(this, Array('db_server','db_user' ,'db_name'));">
<h2><img src="style/images/klj_info.png" class="img" alt="!" />{{echo $lang['DB_INFO']}}</h2>
<table class="TableConf" dir="{{echo $lang['DIR']}}">
<!--tr>
<td class="TdConf">{{echo $lang['DB_TYPE']}}</td>
<td class="TdInput">
<select name="db_type" >
{{if (function_exists('mysqli_connect')):}}
<option value="mysqli">{{echo $lang['DB_TYPE_MYSQLI']}}</option>
{{endif;}}
<option value="mysql">{{echo $lang['DB_TYPE_MYSQL']}}</option>
</select>
</td>
</tr-->
<tr>
<td class="TdConf">{{echo $lang['DB_SERVER']}}</td>
<td class="TdInput"><input name="db_server" type="text" value="localhost" class="InputConf" /></td>

View File

@@ -23,7 +23,7 @@ var PATH_SPACER = 'style/images/spacer.gif';
{{if(((ig('step') && g('step') != 'language') && (strpos('index.php', $_SERVER['PHP_SELF'])=== false && ig('step'))) OR (ig('step') && g('step') == 'license' || g('step') == 'action_file') ):}}
<form action="?step={{echo g('step')}}&amp;change_lang=1" method="post">
<select name="lang" id="lang" class="Lang" onchange="submit()">
{{if($dh = opendir($_path . 'lang')):}}
{{if($dh = opendir(PATH . 'lang')):}}
{{while (($file = readdir($dh)) !== false): if(strpos($file, '.') === false && $file != '..' && $file != '.'):}}
{{$current_icon=file_exists('style/images/'.$file.'_16.png') ? 'style/images/'.$file.'_16.png' : (file_exists('../lang/'.$file.'/icon_16.png') ? '../lang/'.$file.'/icon_16.png' : 'style/images/zz_flag.png');}}
<option value="{{echo $file}}" title="{{echo $current_icon}}" {{echo ig('lang') && $file==g('lang') || (!ig('lang') && $file=='en') ?'selected="selected"':''}}>{{echo $file}}</option>
@@ -38,4 +38,4 @@ var PATH_SPACER = 'style/images/spacer.gif';
</div>
<div class="clr"></div>
<div class="wrapper">
<div class="clr"></div><br />
<div class="clr"></div><br />

View File

@@ -3,7 +3,7 @@
<div class="language_choose">
<ul id="LangChoose">
{{if($dh = @opendir($_path . 'lang')): while (($file = readdir($dh)) !== false): if(strpos($file, '.') === false && $file != '..' && $file != '.'):}}
{{if($dh = @opendir(PATH . 'lang')): while (($file = readdir($dh)) !== false): if(strpos($file, '.') === false && $file != '..' && $file != '.'):}}
<li>
<a href="{{echo './?step=language&amp;ln=' . $file}}">
{{if(file_exists('style/images/'.$file.'.png')):}}
@@ -22,4 +22,4 @@
</div>
<div class="clr"></div>
</div></div><div class="BoxBottomImg"></div></div>
</div></div><div class="BoxBottomImg"></div></div>

View File

@@ -1,31 +0,0 @@
<div class="BoxInner"><div class="BoxTopImg"></div><div class="BoxBody"><div class="inner">
<div class="clr"></div>
<h2 class="h2"><img src="style/images/ok_Plugin.png" alt="" /><br />{{echo $lang['PLUGINS_INSTALLED'];}}<br /></h2>
<table class="DataTable Plugins" dir="{{echo $lang['DIR']}}">
<tr>
<td class="tdd Pl">{{echo $lang['PLUGINS_NAME']}}</td>
{{foreach($GLOBALS['installed_plugins'] as $plugin):}}
<td style="color:green;"><b><img src="style/images/ok.png" class="img" alt="" />{{echo $plugin['p_name']}}</b></td>
{{endforeach;}}
</tr>
<tr>
<td class="tdd Pl">{{echo $lang['PLUGINS_DES']}}</td>
{{foreach($GLOBALS['installed_plugins'] as $plugin):}}
<td style="white-space:nowrap;">{{echo $plugin['p_des']}}</td>
{{endforeach;}}
</tr>
<tr>
<td class="tdd Pl">{{echo $lang['PLUGINS_VER']}}</td>
{{foreach($GLOBALS['installed_plugins'] as $plugin):}}
<td>{{echo $plugin['p_ver']}}</td>
{{endforeach;}}
</tr>
</table>
<div class="hr"></div>
<form method="post" action="{{echo $_SERVER['PHP_SELF'] . '?step=end&' . getlang(1)}}">
<button name="agres" type="submit" class="btn"><span>{{echo $lang['INST_NEXT']}} &raquo;</span></button>
</form>
<div class="clr"></div>
</div></div><div class="BoxBottomImg"></div></div>

View File

@@ -1,38 +0,0 @@
<div class="BoxInner"><div class="BoxTopImg"></div><div class="BoxBody"><div class="inner">
<div class="clr"></div>
<form method="post" action="{{echo './install.php?step=plugins&amp;' . getlang(1)}}">
<h2><img src="style/images/plugin.png" class="img" alt="" />{{echo $lang['PLUGINS_KLEEJA'];}}</h2>
<p class="justify">{{echo $lang['PLUGINS_BUILT_IN'];}}</p>
<table class="DataTable Plugins" dir="{{echo $lang['DIR']}}">
<tr>
<td class="tdd Pl">{{echo $lang['PLUGINS_NAME']}}</td>
{{foreach($GLOBALS['plugins'] as $plugin):}}
<td style="color:green;"><b>{{echo $plugin['p_name']}}</b></td>
{{endforeach;}}
</tr>
<tr>
<td class="tdd Pl">{{echo $lang['PLUGINS_DES']}}</td>
{{foreach($GLOBALS['plugins'] as $plugin):}}
<td style="white-space:nowrap;">{{echo $plugin['p_des']}}</td>
{{endforeach;}}
</tr>
<tr>
<td class="tdd Pl">{{echo $lang['PLUGINS_VER']}}</td>
{{foreach($GLOBALS['plugins'] as $plugin):}}
<td>{{echo $plugin['p_ver']}}</td>
{{endforeach;}}
</tr>
<tr>
<td class="tdd Pl"></td>
{{foreach($GLOBALS['plugins'] as $plugin):}}
<td><input type="checkbox" name="plugin_file[]" value="{{echo $plugin['p_file']}}" checked="checked" /></td>
{{endforeach;}}
</tr>
</table>
<div class="hr"></div>
<button name="datasubmit" type="submit" class="btn"><span>{{echo $lang['INST_NEXT']}} &raquo;</span></button>
</form>
<div class="clr"></div>
</div></div><div class="BoxBottomImg"></div></div>

View File

@@ -604,7 +604,7 @@ li.NoCheck {
.ins_klj {
{{if($GLOBALS['IN_DEV']): echo "
{{if(defined('DEV_STAGE')): echo "
width: 50px;
height: 350px;
position: fixed;
@@ -612,4 +612,4 @@ li.NoCheck {
left: 10px;
background: url('style/images/dev_mode.gif') no-repeat left center;
";endif;}}
}
}

View File

@@ -16,31 +16,28 @@
* include important files
*/
define('IN_COMMON', true);
$_path = '../';
define('PATH', $_path);
define('STOP_PLUGINS', true);
define('PATH', '../');
if (file_exists($_path . 'config.php'))
if (file_exists(PATH . 'config.php'))
{
include_once $_path . 'config.php';
include_once PATH . 'config.php';
}
include_once $_path . 'includes/functions.php';
include_once $_path . 'includes/functions_alternative.php';
include_once PATH . 'includes/plugins.php';
include_once PATH . 'includes/functions.php';
include_once PATH . 'includes/functions_alternative.php';
include_once $_path . 'includes/mysqli.php';
include_once PATH . 'includes/mysqli.php';
include_once 'includes/functions_install.php';
include_once 'includes/update_schema.php';
$order_update_files = [
'1.7_to_2.0' => 9,
// filename => db_version
];
$SQL = new KleejaDatabase($dbserver, $dbuser, $dbpass, $dbname);
//
// Is current db is up-to-date ?
// fix missing db_version
//
$config['db_version'] = inst_get_config('db_version');
@@ -62,121 +59,69 @@ if (! ip('action_file_do'))
}
/**
* Navigation ..
*/
switch (g('step', 'str', 'action_file'))
{
default:
case 'action_file':
if (ip('action_file_do'))
{
if (p('action_file_do', 'str', '') !== '')
{
echo '<meta http-equiv="refresh" content="0;url=' . $_SERVER['PHP_SELF'] . '?step=update_now&action_file_do=' . p('action_file_do') . '&amp;' . getlang(1) . '">';
}
}
else
{
//get fles
$s_path = 'includes/update_files';
$dh = opendir($s_path);
$upfiles = [];
while (($file = readdir($dh)) !== false)
{
if (substr($file, -3) == 'php')
{
$file = str_replace('.php', '', $file);
$db_ver = $order_update_files[$file];
// var_dump($db_ver);
if ((empty($config['db_version']) || $db_ver > $config['db_version']))
{
$upfiles[$db_ver] = $file;
}
}
}
@closedir($dh);
ksort($upfiles);
echo gettpl('update_list.html');
}
break;
case 'update_now':
if (! ig('action_file_do'))
$complete_update = true;
$update_msgs_arr = [];
$current_db_version = $config['db_version'];
$all_db_updates = array_keys($update_schema);
$available_db_updates = array_filter($all_db_updates, function ($v) use ($current_db_version) {
return $v > $current_db_version;
});
sort($available_db_updates);
if (! sizeof($available_db_updates))
{
$update_msgs_arr[] = '<span style="color:green;">' . $lang['INST_UPDATE_CUR_VER_IS_UP'] . '</span>';
$complete_update = false;
}
//
//is there any sqls
//
if ($complete_update)
{
//loop through available updates
foreach ($available_db_updates as $db_update_version)
{
echo '<meta http-equiv="refresh" content="0;url=' . $_SERVER['PHP_SELF'] . '?step=action_file&' . getlang(1) . '">';
$SQL->show_errors = false;
exit();
}
if (ig('complet_up_func'))
{
define('C_U_F', true);
}
$file_for_up = 'includes/update_files/' . preg_replace('/[^a-z0-9_\-\.]/i', '', g('action_file_do')) . '.php';
if (! file_exists($file_for_up))
{
echo '<span style="color:red;">' . $lang['INST_ERR_NO_SELECTED_UPFILE_GOOD'] . ' [ ' . $file_for_up . ' ]</span><br />';
}
else
{
//get it
require $file_for_up;
$complete_update = true;
$update_msgs_arr = [];
if ($config['db_version'] >= UPDATE_DB_VERSION && ! defined('DEV_STAGE'))
//sqls
if (isset($update_schema[$db_update_version]['sql'])
&& sizeof($update_schema[$db_update_version]['sql']) > 0)
{
$update_msgs_arr[] = '<span style="color:green;">' . $lang['INST_UPDATE_CUR_VER_IS_UP'] . '</span>';
$complete_update = false;
}
$err = '';
//
//is there any sqls
//
if (($complete_update || (defined('DEV_STAGE')) && ! defined('C_U_F')))
{
$SQL->show_errors = false;
$complete_update = true;
if (isset($update_sqls) && sizeof($update_sqls) > 0)
foreach ($update_schema[$db_update_version]['sql'] as $name=>$sql_content)
{
$err = '';
$SQL->query($sql_content);
$err = $SQL->get_error();
foreach ($update_sqls as $name=>$sql_content)
if (strpos($err[1], 'Duplicate') !== false || $err[0] == '1062' || $err[0] == '1060')
{
$err = '';
$SQL->query($sql_content);
$err = $SQL->get_error();
if (strpos($err[1], 'Duplicate') !== false || $err[0] == '1062' || $err[0] == '1060')
{
$update_msgs_arr[] = '<span style="color:green;">' . $lang['INST_UPDATE_CUR_VER_IS_UP'] . '</span>';
$complete_update = false;
}
$complete_update = false;
}
}
}
//
//is there any functions
//
if ($complete_update || defined('DEV_STAGE') || defined('C_U_F'))
//functions
if ($complete_update)
{
if (isset($update_functions) && sizeof($update_functions) > 0)
if (isset($update_schema[$db_update_version]['functions']) && sizeof($update_schema[$db_update_version]['functions']) > 0)
{
foreach ($update_functions as $n)
foreach ($update_schema[$db_update_version]['functions'] as $n)
{
if (is_callable($n))
{
@@ -186,31 +131,13 @@ case 'update_now':
}
}
//
//is there any notes
//
$NOTES_CUP = false;
if ($complete_update || defined('DEV_STAGE'))
{
if (isset($update_notes) && sizeof($update_notes) > 0)
{
$i =1;
$NOTES_CUP = [];
foreach ($update_notes as $n)
{
$NOTES_CUP[$i] = $n;
++$i;
}
}
$sql = "UPDATE `{$dbprefix}config` SET `value` = '" . UPDATE_DB_VERSION . "' WHERE `name` = 'db_version'";
$SQL->query($sql);
}
echo gettpl('update_end.html');
$sql = "UPDATE `{$dbprefix}config` SET `value` = '" . UPDATE_DB_VERSION . "' WHERE `name` = 'db_version'";
$SQL->query($sql);
}
}
echo gettpl('update_end.html');
break;
}

View File

@@ -37,7 +37,7 @@ return [
'INST_FINISH_SQL' => 'تم تثبيت كليجا بنجاح',
'INST_NOTES' => 'ملاحظات التثبيت',
'INST_END' => 'معالج التثبيت انتهى، يجب الآن حذف مجلد INSTALL <span style="color:red">(الموقع لن يعمل في حال وجود المجلد)</span>',
'INST_NOTE_D' => 'أي ملاحظات أو مشاكل تتعلق بأداء كليجا، نرجوا التواصل مع مطوري كليجا!',
'INST_NOTE_D' => 'أي ملاحظات أو مشاكل تتعلق بأداء كليجا، نرجو التبليغ عبر <a href="https://github.com/kleeja-official/kleeja/issues">مركز الأخطاء</a>',
'INST_FINISH_ERRSQL' => 'هناك مشكلة تعيق التثبيت، تأكد من حساب مستخدم القاعدة وحاول مجدداً او استفسر من مطوري كليجا',
'INST_KLEEJADEVELOPERS' => 'شكراً لإستخدامك كليجا ... مع أحلى و أطيب التمنيات .. من فريق عمل كليجا',
'SITENAME' => 'اسم الموقع',
@@ -85,16 +85,10 @@ return [
'FUNCTION_DISC_MUF' => 'دالة move_uploaded_file تستخدم لتحميل الملفات وهي اهم دالة في السكربت.',
'ADVICES_CHECK' => 'فحص متقدم (يمكن تثبيت كليجا بدون تحقق هذا الفحص , لكنه مجرد معلومات لك)',
'ADVICES_REGISTER_GLOBALS' => '<span style="color:red;padding:0 6px">خاصية register_globals مفعلة !</span><br /> هذه الخاصية غير محبب تفعيلها ويفضل تعطيلها , ومع هذا فكليجا تحاول تعطيل أثارها برمجياً .',
'ADVICES_MAGIC_QUOTES' => '<span style="color:red;padding:0 6px">خاصية magic_quotes مفعله !</span><br /> هذه الخاصية غير محبب تفعيلها ويفضل تعطيلها , ومع هذا فكليجا تحاول تعطيل أثارها برمجياً ..',
'ZIPARCHIVE_LIB' => '<span style="color:red;padding:0 6px">مكتبة ZipArchive غير متوفرة في خادمك !</span><br /> هذه المكتبة مهمة لفك الإضافات والترقية لنسخ جديدة من كليجا!',
//UPDATOR
'INST_CHOOSE_UPDATE_FILE' => 'قم بإختيار التحديث المناسب لك ومن ثم تابع التحديث ..',
'INST_ERR_NO_SELECTED_UPFILE_GOOD' => 'ملف التحديث غير مناسب أو أنه غير موجود من الأساس ! ..',
'INST_UPDATE_CUR_VER_IS_UP' => 'نسختك الحالية محدثة لهذا التحديث المحدد.',
'INST_NOTES_UPDATE' => 'ملاحظات التحديث',
'INST_UPDATE_CUR_VER_IS_UP' => 'نسختك الحالية محدثة لآخر نسخة ... رائع!',
'INST_UPDATE_IS_FINISH' => 'معالج التحديث انتهى .. يجب الآن حذف مجلد INSTALL و متابعة عملك في كليجا .',

View File

@@ -85,15 +85,10 @@ return [
'FUNCTION_DISC_MUF' => 'The function move_uploaded_file is used to upload files and it\'s the most important function in the script.',
'ADVICES_CHECK' => 'Advanced check (Optional)',
'ADVICES_REGISTER_GLOBALS' => '<span style="color:red;padding:0 6px;">register_globals function is enabled ..!</span><br /> its recommended that you disable it.',
'ADVICES_MAGIC_QUOTES' => '<span style="color:red;padding:0 6px;">magic_quotes function is enabled ..!</span><br /> it is recommended that you disable it.',
'ZIPARCHIVE_LIB' => '<span style="color:red;padding:0 6px">ZipArchive Lib is not available..!</span><br /> It is required to install plugins, styles and to upgrade to newer Kleeja versions!',
//UPDATE
'INST_CHOOSE_UPDATE_FILE' => 'Choose the appropriate update file',
'INST_ERR_NO_SELECTED_UPFILE_GOOD' => 'Inappropriate update file, or it is missing!',
'INST_UPDATE_CUR_VER_IS_UP' => 'Your current version is newer than this update.',
'INST_NOTES_UPDATE' => 'Update Notes',
'INST_UPDATE_CUR_VER_IS_UP' => 'Your current version database is up-to-date ... hooray!',
'INST_UPDATE_IS_FINISH' => 'Installation completed! you can now delete the INSTALL directory...',
@@ -112,6 +107,6 @@ return [
'NO' => 'No',
'KLEEJA_TEAM_MSG_NAME' => 'Kleeja Development Team',
'KLEEJA_TEAM_MSG_TEXT' => "Thank you for choosing Kleeja to empower your website,\n We really hope you enjoy the unique experience that Kleeja offers to you.\nDon't forget to visit http://kleeja.com for future updates.",
'KLEEJA_TEAM_MSG_TEXT' => "Thank you for choosing Kleeja to empower your website,\n We really hope you enjoy the unique experience that Kleeja offers to you.\nDon't forget to visit http://kleeja.com for future updates, to report bugs/issues kindly visit our <a href=\"https://github.com/kleeja-official/kleeja/issues\">Issues page</a>",
];