diff --git a/.php_cs b/.php_cs index 894a283..b754750 100644 --- a/.php_cs +++ b/.php_cs @@ -37,7 +37,11 @@ return PhpCsFixer\Config::create() 'visibility_required' => true, 'native_function_casing' => true, 'no_empty_comment' => true, - 'single_line_comment_style' => true + 'single_line_comment_style' => true, + 'phpdoc_add_missing_param_annotation' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_around_offset' => true, + 'no_spaces_inside_parenthesis' => true, ]) ->setFinder($finder) ->setIndent(" ") diff --git a/admin/Masmak/admin_check_update.html b/admin/Masmak/admin_check_update.html index 6634806..f9ded86 100755 --- a/admin/Masmak/admin_check_update.html +++ b/admin/Masmak/admin_check_update.html @@ -1,52 +1,137 @@ - - {lang.R_CPINDEX} {lang.R_CHECK_UPDATE} - - + + + + {lang.LOADING} + + {lang.UPDATE_KLJ_NOW} + + + + + + + + + 1 {lang.UPDATE_PROCESS_STEP1} + + + + + + + + + 2 {lang.UPDATE_PROCESS_STEP2} + + + + + + + + + 3 {lang.UPDATE_PROCESS_STEP3} + + + + + + + + + + - - - - - - - {lang.R_CPINDEX} - {lang.HOW_UPDATE_KLEEJA} - - - - {lang.HOW_UPDATE_KLEEJA_STEP1} - {lang.HOW_UPDATE_KLEEJA_STEP2} - {lang.HOW_UPDATE_KLEEJA_STEP3} - - - - - - diff --git a/admin/Masmak/admin_plugins.html b/admin/Masmak/admin_plugins.html index bfcf248..8420bb7 100755 --- a/admin/Masmak/admin_plugins.html +++ b/admin/Masmak/admin_plugins.html @@ -98,6 +98,7 @@ {{name}} + @@ -196,4 +197,4 @@ - \ No newline at end of file + diff --git a/includes/adm/j_plugins.php b/includes/adm/j_plugins.php index 8cf06c8..dffff94 100755 --- a/includes/adm/j_plugins.php +++ b/includes/adm/j_plugins.php @@ -34,10 +34,11 @@ $plugin_enable_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&am $plugin_disable_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=disable&' . $GET_FORM_KEY . '&plg='; $plugin_download_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=download&' . $GET_FORM_KEY . '&plg='; $plugin_update_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=update&' . $GET_FORM_KEY . '&plg='; +$plugin_delete_folder_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=delete_folder&' . $GET_FORM_KEY . '&plg='; //check _GET Csrf token -if (! empty($case) && in_array($case, ['install', 'uninstall', 'enable', 'disable' , 'download' , 'update'])) +if (! empty($case) && in_array($case, ['install', 'uninstall', 'enable', 'disable' , 'download' , 'update' , 'delete_folder'])) { if (! kleeja_check_form_key_get('PLUGINS_FORM_KEY')) { @@ -151,7 +152,7 @@ switch ($case): break; } - // plugins avilable in kleeja remote catalog + // plugins avilable in kleeja remote catalog if (! ($catalog_plugins = $cache->get('catalog_plugins'))) { $store_link = 'https://raw.githubusercontent.com/kleeja-official/store-catalog/master/catalog.json'; @@ -179,7 +180,7 @@ switch ($case): } // is there a new version of this in the store - elseif ($case == 'check' && (! empty($installed_plugins[$plugin_info['name']]) && + elseif ($case == 'check' && (! empty($installed_plugins[$plugin_info['name']]) && version_compare( strtolower($installed_plugins[$plugin_info['name']]['extra_info']['plugin_version']), strtolower($plugin_info['file']['version']), @@ -552,7 +553,7 @@ switch ($case): exit; } - // plugins avilable in kleeja store + // plugins avilable in kleeja store $store_link = 'https://raw.githubusercontent.com/kleeja-official/store-catalog/master/catalog.json'; $catalog_plugins = fetch_remote_file($store_link); @@ -581,7 +582,7 @@ switch ($case): // check if the version of the plugin is compatible with our kleeja version or not if ( version_compare(strtolower($store_plugins[$download_plugin]['kj_min_version']), KLEEJA_VERSION, '<=') - && version_compare(strtolower($store_plugins[$download_plugin]['kj_max_version']), KLEEJA_VERSION, '>=') + && version_compare(strtolower($store_plugins[$download_plugin]['kj_max_version']), KLEEJA_VERSION, '>=') ) { $download_plugin_link = $store_plugins[$download_plugin]['url']; @@ -610,14 +611,14 @@ switch ($case): // download or update msg kleeja_admin_info( sprintf($lang[ig('update') ? 'PLUGIN_UPDATED' : 'PLUGIN_DOWNLOADED'], $download_plugin), - ADMIN_PATH . '?cp=' . basename(__file__, '.php') + ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=local' ); exit; } else { - kleeja_admin_err($lang['EXTRACT_ZIP_FAILED']); + kleeja_admin_err(sprintf($lang['EXTRACT_ZIP_FAILED'], KLEEJA_PLUGINS_FOLDER)); } } } @@ -656,11 +657,29 @@ switch ($case): if (is_dir($plugin_folder_name)) { - delete_plugin_folder($plugin_folder_name); + kleeja_unlink($plugin_folder_name); } redirect($plugin_download_link . $update_plugin . '&update' ); break; + case 'delete_folder': + + $plugin_folder = g('plg'); + + $plugin_folder_name = PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_folder; + + if (is_dir($plugin_folder_name)) + { + kleeja_unlink($plugin_folder_name); + } + + kleeja_admin_info( + sprintf($lang['PLG_SUCSS_DEL'] , $plugin_folder), + ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=local' + ); + + break; + endswitch; diff --git a/includes/adm/p_check_update.php b/includes/adm/p_check_update.php index b72b236..344b6e1 100755 --- a/includes/adm/p_check_update.php +++ b/includes/adm/p_check_update.php @@ -13,56 +13,97 @@ if (! defined('IN_ADMIN')) exit(); } +set_time_limit(0); + +$current_version = KLEEJA_VERSION; +$new_version = unserialize($config['new_version']); +$new_version = empty($new_version['version_number']) + ? KLEEJA_VERSION + : $new_version['version_number']; +$backup_archive_path = PATH . 'cache/backup.zip'; +$GET_FORM_KEY = kleeja_add_form_key_get('UPDATER_FORM_KEY'); + +define('KLEEJA_VERSION_CHECK_LINK', 'https://api.github.com/repos/kleeja-official/kleeja/releases/latest'); +define('KLEEJA_LATEST_PACKAGE_LINK', 'https://api.github.com/repos/kleeja-official/kleeja/zipball/'); + $stylee = 'admin_check_update'; -$current_smt = preg_replace('/[^a-z0-9_]/i', '', g('smt', 'str', 'general')); +$current_smt = preg_replace('/[^a-z0-9_]/i', '', g('smt', 'str', 'general')); $update_link = $config['siteurl'] . 'install/update.php?lang=' . $config['language']; -//to prevent getting the url data for all cats -if ($current_smt == 'check'): +if (in_array($current_smt, ['update1', 'update2', 'update3'])) +{ + //only founders can do the upgrade process ... + if (intval($userinfo['founder']) !== 1) + { + header('HTTP/1.0 401 Unauthorized'); + kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS']); + } + + if (! kleeja_check_form_key_get('UPDATER_FORM_KEY')) + { + header('HTTP/1.0 401 Unauthorized'); + + kleeja_admin_err($lang['INVALID_GET_KEY']); + } +} + +//check latest version +if ($current_smt == 'check') +{ //get data from kleeja github repo if (! ($version_data = $cache->get('kleeja_repo_version'))) { - $github_data = fetch_remote_file('https://raw.githubusercontent.com/awssat/kleeja/master/includes/version.php', false, 6); + $github_data = fetch_remote_file(KLEEJA_VERSION_CHECK_LINK, false, 100); if (! empty($github_data)) { - preg_match_all('/define\(\'KLEEJA_VERSION\',\s{1,4}\'([^\']+)\'\);/', $github_data, $matches, PREG_SET_ORDER, 0); - $version_data = trim(htmlspecialchars($matches[0][1])); - $cache->save('kleeja_repo_version', $version_data, 3600 * 2); + $latest_release = json_decode($github_data, true); + $version_data = null; + + if (json_last_error() === JSON_ERROR_NONE) + { + $version_data = [ + 'version' => trim(htmlspecialchars($latest_release['tag_name'])), + 'info' => trim(htmlspecialchars($latest_release['body'])), + 'date' => trim(htmlspecialchars($latest_release['created_at'])), + ]; + $cache->save('kleeja_repo_version', $version_data, 3600 * 2); + } } } $error = 0; - if (empty($version_data)) + if (empty($version_data['version'])) { $text = $lang['ERROR_CHECK_VER']; $error = 1; } else { - if (version_compare(strtolower(KLEEJA_VERSION), strtolower($version_data), '<')) + if (version_compare(strtolower($current_version), strtolower($version_data['version']), '<')) { - $text = sprintf($lang['UPDATE_NOW_S'], KLEEJA_VERSION, strtolower($version_data)) . '' . $lang['UPDATE_KLJ_NOW']; - $error = 1; + $text = sprintf($lang['UPDATE_NOW_S'], $current_version, strtolower($version_data['version'])) . + '::--x--::' . $version_data['info'] . '::--x--::' . $version_data['date']; + $error = 2; } - elseif (version_compare(strtolower(KLEEJA_VERSION), strtolower($version_data), '=')) + elseif (version_compare(strtolower($current_version), strtolower($version_data['version']), '=')) { $text = $lang['U_LAST_VER_KLJ']; } - elseif (version_compare(strtolower(KLEEJA_VERSION), strtolower($version_data), '>')) + elseif (version_compare(strtolower($current_version), strtolower($version_data['version']), '>')) { $text = $lang['U_USE_PRE_RE']; } else { - $text = $lang['ERROR_CHECK_VER'] . ' [code: ' . htmlspecialchars($version_data) . ']'; + $text = $lang['ERROR_CHECK_VER'] . ' [code: ' . htmlspecialchars($version_data['version']) . ']'; } } $data = [ - 'version_number' => $version_data, + 'version_number' => $version_data['version'], 'last_check' => time() ]; @@ -72,14 +113,10 @@ if ($current_smt == 'check'): delete_cache('data_config'); $adminAjaxContent = $error . ':::' . $text; - -elseif ($current_smt == 'general'): - -// if(!$error) -// { - - - +} +// home of update page +elseif ($current_smt == 'general') +{ //To prevent expected error [ infinit loop ] if (ig('show_msg')) { @@ -98,18 +135,265 @@ elseif ($current_smt == 'general'): } } + $showMessage = ig('show_msg'); +} +//1. download latest kleeja version +elseif ($current_smt == 'update1') +{ + if (! class_exists('ZipArchive')) + { + $adminAjaxContent = '930:::' . $lang['NO_ZIP_ARCHIVE']; + } + elseif (! version_compare(strtolower($current_version), strtolower($new_version), '<=')) + { + $adminAjaxContent = '940:::' . $lang['U_LAST_VER_KLJ']; + } + else + { + // downloaded the last package to cache folder + fetch_remote_file(KLEEJA_LATEST_PACKAGE_LINK . $new_version , PATH . "cache/kleeja-{$new_version}.zip", 60, false, 10, true); -// } + if (file_exists(PATH . "cache/kleeja-{$new_version}.zip")) + { + $adminAjaxContent = '1:::'; + file_put_contents(PATH . 'cache/step1.done', time()); + } + else + { + $adminAjaxContent = '2:::' . $lang['UPDATE_ERR_FETCH_PACKAGE']; + } + } +} +//2. extract new kleeja package, create backup zip file +elseif ($current_smt == 'update2') +{ + if (! file_exists(PATH . 'cache/step1.done')) + { + header('HTTP/1.0 401 Unauthorized'); + kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS']); + } -$showMessage = ig('show_msg'); + kleeja_unlink(PATH . 'cache/step1.done'); + + // let's extract the zip to cache + $zip = new ZipArchive; + + if ($zip->open(PATH . "cache/kleeja-{$new_version}.zip") == true) + { + // the name of folder after extracting it + // and we are sure that there is only one folder in the zip file + $ex_folder = trim($zip->getNameIndex(0), '/'); + $zip->extractTo(PATH . 'cache/'); + $zip->close(); + if(rename( + PATH . "cache/{$ex_folder}", + PATH . "cache/kleeja-{$new_version}" + ) === false) + { + copy( + PATH . "cache/{$ex_folder}", + PATH . "cache/kleeja-{$new_version}" + ); + + kleeja_unlink(PATH . "cache/{$ex_folder}"); + } + } + + // let's check if there any update files in install folder + $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 + if(rename($update_file, PATH . 'cache/update_schema.php') === false) + { + copy($update_file, PATH . 'cache/update_schema.php'); + } + } + + // skip some folders + foreach (['cache', 'plugins', 'uploads', 'styles', 'install'] as $folder_name) + { + kleeja_unlink(PATH . "cache/kleeja-{$new_version}/{$folder_name}"); + } + + if (file_exists($backup_archive_path)) + { + kleeja_unlink($backup_archive_path); + } + + file_put_contents(PATH . 'cache/step2.done', time()); + + $adminAjaxContent = '1:::'; +} +//3. update, or rollback on failure +elseif ($current_smt == 'update3') +{ + if (! file_exists(PATH . 'cache/step2.done')) + { + header('HTTP/1.0 401 Unauthorized'); + kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS']); + } + + kleeja_unlink(PATH . 'cache/step2.done'); + + $backup = new ZipArchive; + + if ($backup->open($backup_archive_path, ZipArchive::CREATE) !== true) + { + header('HTTP/1.0 401 Unauthorized'); + kleeja_admin_err($lang['UPDATE_BACKUP_CREATE_FAILED']); + } + + // delete plugin folder function with some changes :) + $it = new RecursiveDirectoryIterator(PATH . "cache/kleeja-{$new_version}/", RecursiveDirectoryIterator::SKIP_DOTS); + $files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); + + $update_failed = false; + $failed_files = $new_folders = []; + + //maintenance mode on + update_config('siteclose', 1); + + foreach ($files as $file) + { + if ($file->isFile()) + { + $file_path = str_replace("cache/kleeja-{$new_version}/", '', $file->getPathname()); + $file_dir = str_replace("cache/kleeja-{$new_version}/", '', $file->getPath()); + + // same, no need to replace + if (file_exists($file_path) && md5_file($file_path) == md5_file($file->getPathname())) + { + continue; + } + + //no folder? + if (! file_exists($file_dir)) + { + mkdir($file_dir, K_DIR_CHMOD, true); + array_push($new_folders, $file_dir); + } + + if (! is_writable($file_path)) + { + chmod($file_path, K_FILE_CHMOD); + } + + //back up current file + $backup->addFromString( + $file_path, + file_get_contents($file_path) + ); + + //copy file + if (file_put_contents( + $file_path, + file_get_contents($file->getPathname()) + ) === false) + { + + if (copy($file->getPathname(), $file_path) === false) + { + $update_failed = true; + array_push($failed_files, $file_path); + + break; + } + } + } + elseif ($file->isDir()) + { + // here is folder , when we finish update , we will delete all folders and files + if (! file_exists($file_path)) + { + mkdir($file_path, K_DIR_CHMOD, true); + array_push($new_folders, $file_path); + } + + continue; + } + } + + $backup->close(); + + if ($update_failed) + { + //rollback to backup + $zip = new ZipArchive; + $zip->open($backup_archive_path); + $zip->extractTo(PATH); + $zip->close(); + + foreach ($new_folders as $folder) + { + kleeja_unlink($folder); + } + + //maintenance mode off + update_config('siteclose', 0); + + $adminAjaxContent = '1002:::' . $lang['UPDATE_PROCESS_FAILED'] . (defined('DEV_STAGE') ? '[failed files: ' . implode(', ', $failed_files) . ']' : ''); + } + 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_schema.php')) + { + require_once $db_update_file; + + $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)) + { + foreach ($available_db_updates as $db_update_version) + { + $SQL->show_errors = false; + + if (isset($update_schema[$db_update_version]['sql']) + && sizeof($update_schema[$db_update_version]['sql']) > 0) + { + foreach ($update_schema[$db_update_version]['sql'] as $name=>$sql_content) + { + $SQL->query($sql_content); + } + } + + 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(); + } + } + } -//end current_smt == general -endif; + $SQL->query( + "UPDATE `{$dbprefix}config` SET `value` = '" . $db_update_version . "' WHERE `name` = 'db_version'" + ); + } + } + } -//secondary menu -$go_menu = [ - 'general' => ['name'=>$lang['R_CHECK_UPDATE'], 'link'=> basename(ADMIN_PATH) . '?cp=p_check_update&smt=general', 'goto'=>'general', 'current'=> $current_smt == 'general'], - 'howto' => ['name'=>$lang['HOW_UPDATE_KLEEJA'], 'link'=> basename(ADMIN_PATH) . '?cp=p_check_update&smt=howto', 'goto'=>'howto', 'current'=> $current_smt == 'howto'], - 'site' => ['name'=>'Kleeja.com', 'link'=> 'http://www.kleeja.com', 'goto'=>'site', 'current'=> $current_smt == 'site'], -]; + //maintenance mode off + update_config('siteclose', 0); + + // after a success update, delete files and folders in cache + kleeja_unlink(PATH . "cache/kleeja-{$new_version}"); + kleeja_unlink(PATH . "cache/kleeja-{$new_version}.zip"); + delete_cache('', true); + + $adminAjaxContent = '1:::' . sprintf($lang['UPDATE_PROCESS_DONE'], $new_version); + } +} diff --git a/includes/common.php b/includes/common.php index 6da6ab9..57def01 100755 --- a/includes/common.php +++ b/includes/common.php @@ -37,7 +37,7 @@ if (! defined('PATH')) { define('__DIR__', dirname(__FILE__)); } - define('PATH', str_replace(DIRECTORY_SEPARATOR . 'includes', '', __DIR__) . DIRECTORY_SEPARATOR); + define('PATH', str_replace('/includes', '', __DIR__) . '/'); } //no config @@ -57,11 +57,15 @@ require_once PATH . KLEEJA_CONFIG_FILE; define('ADM_FILES_PATH', PATH . 'includes/adm'); //Report all errors, except notices -error_reporting( defined('DEV_STAGE') ? E_ALL : E_ALL ^ E_NOTICE); +error_reporting(defined('DEV_STAGE') ? E_ALL : E_ALL ^ E_NOTICE); /** * functions for start +* @param mixed $error_number +* @param mixed $error_string +* @param mixed $error_file +* @param mixed $error_line */ function kleeja_show_error($error_number, $error_string = '', $error_file = '', $error_line = '') { @@ -129,9 +133,9 @@ if (empty($dbname) || empty($dbuser)) exit; } -//include files .. & classes .. -$root_path = PATH; -// $db_type = isset($db_type) ? $db_type : 'mysqli'; +// solutions for hosts running under suexec, add define('HAS_SUEXEC', true) to config.php. +define('K_FILE_CHMOD', defined('HAS_SUEXEC') ? (0644 & ~umask()) : 0644); +define('K_DIR_CHMOD', defined('HAS_SUEXEC') ? (0755 & ~umask()) : 0755); include PATH . 'includes/functions_alternative.php'; include PATH . 'includes/version.php'; @@ -163,7 +167,7 @@ unset($dbpass); -$tpl = new kleeja_style; +$tpl = new kleeja_style; $usrcp = new usrcp; //then get caches @@ -310,10 +314,10 @@ if ( file_exists(PATH . 'install') && ! defined('IN_ADMIN') && ! defined('IN_LOGIN') && - ! defined('DEV_STAGE') && + ! defined('DEV_STAGE') && ! (defined('IN_GO') && in_array(g('go'), ['queue'])) && ! (defined('IN_UCP') && in_array(g('go'), ['captcha', 'login'])) - ) { +) { //Different message for admins! delete install folder kleeja_info((user_can('enter_acp') ? $lang['DELETE_INSTALL_FOLDER'] : $lang['WE_UPDATING_KLEEJA_NOW']), $lang['SITE_CLOSED']); } @@ -323,16 +327,16 @@ if ( $login_page = ''; if ( - $config['siteclose'] == '1' && - ! user_can('enter_acp') && - ! defined('IN_LOGIN') && - ! defined('IN_ADMIN') && + $config['siteclose'] == '1' && + ! user_can('enter_acp') && + ! defined('IN_LOGIN') && + ! defined('IN_ADMIN') && ! (defined('IN_GO') && in_array(g('go'), ['queue'])) && ! (defined('IN_UCP') && in_array(g('go'), ['captcha', 'login', 'register', 'logout'])) ) { //if download, images ? if ( - ( defined('IN_DOWNLOAD') && (ig('img') || ig('thmb') || ig('thmbf') || ig('imgf')) ) + (defined('IN_DOWNLOAD') && (ig('img') || ig('thmb') || ig('thmbf') || ig('imgf'))) || g('go', 'str', '') == 'queue' ) { @$SQL->close(); @@ -352,7 +356,8 @@ if ( //exceed total size if (($stat_sizes >= ($config['total_size'] *(1048576))) && ! defined('IN_LOGIN') && ! defined('IN_ADMIN')) -{// convert megabytes to bytes +{ + // convert megabytes to bytes // Send a 503 HTTP response code to prevent search bots from indexing the maintenace message header('HTTP/1.1 503 Service Temporarily Unavailable'); kleeja_info($lang['SIZES_EXCCEDED'], $lang['STOP_FOR_SIZE']); diff --git a/includes/functions.php b/includes/functions.php index ce9aaa7..9fdff49 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -22,7 +22,7 @@ if (! defined('IN_COMMON')) */ function kleeja_detecting_bots() { - global $SQL, $usrcp, $dbprefix, $config, $klj_session; + global $SQL, $dbprefix, $config; // get information .. $agent = $SQL->escape($_SERVER['HTTP_USER_AGENT']); @@ -97,7 +97,7 @@ function get_ban() // if the request is an image // if ( - ( defined('IN_DOWNLOAD') && (ig('img') || ig('thmb') || ig('thmbf') || ig('imgf')) ) + (defined('IN_DOWNLOAD') && (ig('img') || ig('thmb') || ig('thmbf') || ig('imgf'))) || g('go', 'str', '') == 'queue' ) { @$SQL->close(); @@ -271,8 +271,8 @@ function fetch_remote_file($url, $save_in = false, $timeout = 20, $head_only = f { @ini_set('default_socket_timeout', $timeout); } - $allow_url_fopen = function_exists('ini_get') - ? strtolower(@ini_get('allow_url_fopen')) + $allow_url_fopen = function_exists('ini_get') + ? strtolower(@ini_get('allow_url_fopen')) : strtolower(@get_cfg_var('allow_url_fopen')); if (function_exists('curl_init')) @@ -302,7 +302,7 @@ function fetch_remote_file($url, $save_in = false, $timeout = 20, $head_only = f @curl_exec($ch); curl_close($ch); fclose($out); - } + } if ($head_only) { @@ -548,7 +548,7 @@ function delete_cache($name, $all=false) if (file_exists($path_to_cache . '/' . $name)) { - $del = kleeja_unlink ($path_to_cache . '/' . $name, true); + $del = kleeja_unlink($path_to_cache . '/' . $name, true); } } @@ -577,23 +577,29 @@ function kleeja_unlink($filePath, $cache_file = false) //99.9% who use this if (function_exists('unlink')) { - return unlink($filePath); + if (is_dir($filePath)) + { + $it = new RecursiveDirectoryIterator($filePath, RecursiveDirectoryIterator::SKIP_DOTS); + $files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); + + foreach ($files as $file) + { + if ($file->isDir()) + { + rmdir($file->getPathname()); + } + else + { + unlink($file->getPathname()); + } + } + return rmdir($filePath); + } + else + { + return unlink($filePath); + } } - //5% only who use this - //else if (function_exists('exec')) - //{ - // $out = array(); - // $return = null; - // exec('del ' . escapeshellarg(realpath($filepath)) . ' /q', $out, $return); - // return $return; - //} - //5% only who use this - //else if (function_exists('system')) - //{ - // $return = null; - // system ('del ' . escapeshellarg(realpath($filepath)) . ' /q', $return); - // return $return; - //} //just rename cache file if there is new thing elseif (function_exists('rename') && $cache_file) { @@ -1301,12 +1307,12 @@ function klj_clean_old_files($from = 0) //delete from folder .. if (file_exists($row['folder'] . '/' . $row['name'])) { - @kleeja_unlink ($row['folder'] . '/' . $row['name']); + @kleeja_unlink($row['folder'] . '/' . $row['name']); } //delete thumb - if (file_exists($row['folder'] . '/thumbs/' . $row['name'] )) + if (file_exists($row['folder'] . '/thumbs/' . $row['name'])) { - @kleeja_unlink ($row['folder'] . '/thumbs/' . $row['name'] ); + @kleeja_unlink($row['folder'] . '/thumbs/' . $row['name']); } $ids[] = $row['id']; @@ -1496,11 +1502,11 @@ function kleeja_log($text) return; } - $log_file = PATH . 'cache/kleeja_log.log'; - $l_c = @file_get_contents($log_file); - $fp = @fopen($log_file, 'w'); - @fwrite($fp, $text . ' [time : ' . date('H:i a, d-m-Y') . "] \r\n" . $l_c); - @fclose($fp); + file_put_contents( + PATH . 'cache/kleeja_log.log', + date_format(date_create(), 'Y-m-d h:i:s.ua') . ' | INFO | ' . $text . PHP_EOL, + FILE_APPEND | LOCK_EX + ); } @@ -1717,11 +1723,11 @@ function parse_serve_rule($regex, $args, $is_unicode = false) foreach ($parsed_args as $arg_key => $arg_value) { - if ( preg_match('/^\$/', $arg_value)) + if (preg_match('/^\$/', $arg_value)) { $match_number = ltrim($arg_value, '$'); - if ( isset($matches[$match_number])) + if (isset($matches[$match_number])) { $_GET[$arg_key] = $matches[$match_number]; } diff --git a/includes/functions_adm.php b/includes/functions_adm.php index cd51fdb..f6298c8 100755 --- a/includes/functions_adm.php +++ b/includes/functions_adm.php @@ -18,6 +18,13 @@ if (! defined('IN_COMMON')) * Print cp error function handler * * For admin +* @param mixed $msg +* @param mixed $navigation +* @param mixed $title +* @param mixed $exit +* @param mixed $redirect +* @param mixed $rs +* @param mixed $style */ function kleeja_admin_err($msg, $navigation = true, $title='', $exit = true, $redirect = false, $rs = 3, $style = 'admin_err') { @@ -237,7 +244,7 @@ function build_search_query($search) global $SQL; - $search['filename'] = ! isset($search['filename']) ? '' : $search['filename']; + $search['filename'] = ! isset($search['filename']) ? '' : $search['filename']; $search['username'] = ! isset($search['username']) ? '' : $search['username']; $search['than'] = ! isset($search['than']) ? '' : $search['than']; $search['size'] = ! isset($search['size']) ? '' : $search['size']; @@ -249,8 +256,8 @@ function build_search_query($search) $search['ext'] = ! isset($search['ext']) ? '' : $search['ext']; $search['user_ip'] = ! isset($search['user_ip']) ? '' : $search['user_ip']; - $file_namee = $search['filename'] != '' ? 'AND (f.real_filename LIKE \'%' . $SQL->escape($search['filename']) . '%\' OR f.name LIKE \'%' . $SQL->escape($search['filename']) . '%\')' : ''; - $usernamee = $search['username'] != '' ? 'AND u.name LIKE \'%' . $SQL->escape($search['username']) . '%\'' : ''; + $file_namee = $search['filename'] != '' ? 'AND (f.real_filename LIKE \'%' . $SQL->escape($search['filename']) . '%\' OR f.name LIKE \'%' . $SQL->escape($search['filename']) . '%\')' : ''; + $usernamee = $search['username'] != '' ? 'AND u.name LIKE \'%' . $SQL->escape($search['username']) . '%\'' : ''; $size_than = ' f.size ' . ($search['than']!=1 ? '<=' : '>=') . (intval($search['size']) * 1024) . ' '; $ups_than = $search['ups'] != '' ? 'AND f.uploads ' . ($search['uthan']!=1 ? '<' : '>') . intval($search['ups']) . ' ' : ''; $rep_than = $search['rep'] != '' ? 'AND f.report ' . ($search['rthan']!=1 ? '<' : '>') . intval($search['rep']) . ' ' : ''; @@ -296,7 +303,7 @@ function sync_total_files($files = true, $start = false) $start = ! $start ? $min_id : $start; $end = $start + $batch_size; - //now lets get this step's files number + //now lets get this step's files number unset($v, $result); $query['SELECT'] = 'COUNT(f.id) as num_files'; @@ -322,7 +329,7 @@ function sync_total_files($files = true, $start = false) //make it zero, firstly if ($first_loop) { - $update_query['SET'] = ($files ? 'files' : 'imgs') . '= 0'; + $update_query['SET'] = ($files ? 'files' : 'imgs') . '= 0'; $SQL->build($update_query); } @@ -358,7 +365,7 @@ function get_actual_stats($name) } /** - * check wether a start box is hidden or not + * check wether a start box is hidden or not * @param string $name box name * @return bool */ @@ -386,31 +393,3 @@ function adm_is_start_box_hidden($name) return in_array($name, $boxes); } - -/** - * delete plugin folder - * @param string $dir plugin folder path - * @return void - */ -function delete_plugin_folder($dir) -{ - $it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS); - $files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); - - foreach ($files as $file) - { - if ($file->isLink()) - { - unlink($file->getPathname()); - } - elseif ($file->isDir()) - { - rmdir($file->getPathname()); - } - else - { - unlink($file->getPathname()); - } - } - rmdir($dir); -} diff --git a/includes/plugins.php b/includes/plugins.php index d0eec1d..233bc3a 100755 --- a/includes/plugins.php +++ b/includes/plugins.php @@ -36,7 +36,7 @@ class Plugins private $installed_plugins_info = []; - private $plugin_path = ''; + private $plugin_path = PATH . 'plugins'; 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 $query = [ @@ -85,7 +89,7 @@ class Plugins { $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)) { diff --git a/includes/style.php b/includes/style.php index 12f410c..bd1a1d5 100755 --- a/includes/style.php +++ b/includes/style.php @@ -140,7 +140,7 @@ class kleeja_style $html = preg_replace_callback('//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' => '', '//iU' => '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(); diff --git a/includes/version.php b/includes/version.php index 4f52189..49ec318 100755 --- a/includes/version.php +++ b/includes/version.php @@ -19,3 +19,7 @@ if (! defined('IN_COMMON')) define('KLEEJA_VERSION', '3.0.2'); define('KLEEJA_DB_VERSION', '9'); + +// Kleeja min requirements +define('MIN_PHP_VERSION', '7.0'); +define('MIN_MYSQL_VERSION', '4.2.2'); diff --git a/install/includes/default_values.php b/install/includes/default_values.php index b46d1dd..a573111 100755 --- a/install/includes/default_values.php +++ b/install/includes/default_values.php @@ -20,7 +20,7 @@ if (! defined('IN_COMMON')) $config_values = []; -// do it like this : +// do it like this : //$config_values = array('name', 'value', 'option', 'display_order', 'type', 'plg_id', 'dynamic'); // General settings @@ -45,7 +45,7 @@ $config_values[] = ['cookie_path', $cookie_data['cookie_path'], '', '15', 'advanced', 0, 0]; $config_values[] = ['cookie_secure', ($cookie_data['cookie_secure'] ? '1' : '0'), '{lang.YES} checked=\"checked\" />\r\n {lang.NO} checked=\"checked\" />', '16', 'advanced', 0, 0]; -// Upload settings +// Upload settings $config_values[] = ['total_size', '10000000000', '', 17, 'upload', 0, 0]; $config_values[] = ['foldername', 'uploads', '', 18, 'upload', 0, 0]; $config_values[] = ['prefixname', '', '', 19, 'upload', 0, 0]; @@ -68,7 +68,7 @@ $config_values[] = ['filesnum_show', '1', '{lang.YES}', '20', 'KLIVE', '0', '0'); //$config_values[] = array('imagefoldere', '1', '{lang.YES} checked=\"checked\">{lang.NO} checked=\"checked\">', '30', 'KLIVE', '0', '0'); -// Interface settings +// Interface settings $config_values[] = ['welcome_msg', $lang['INST_MSGINS'], '', 30, 'interface', 0, 0]; $config_values[] = ['allow_stat_pg', '1', '{lang.YES} checked=\"checked\" />\r\n {lang.NO} checked=\"checked\" />', 31, 'interface', 0, 0]; $config_values[] = ['allow_online', '0', '{lang.YES} checked=\"checked\" />\r\n {lang.NO} checked=\"checked\" />', 32, 'interface', 0, 0]; @@ -81,7 +81,7 @@ $config_values[] = ['enable_captcha', '1', '{lang.YES}sizeInKB); $ext_values = []; diff --git a/install/includes/functions_install.php b/install/includes/functions_install.php index b1c0e5e..4ed5156 100755 --- a/install/includes/functions_install.php +++ b/install/includes/functions_install.php @@ -7,35 +7,31 @@ * */ -// Requirements of Kleeja -define('MIN_PHP_VERSION', '7.0'); -define('MIN_MYSQL_VERSION', '4.2.2'); -//version of latest changes at db -define ('LAST_DB_VERSION', '9'); -//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')); } + // Including current language -$lang = require $_path . 'lang/' . getlang() . '/common.php'; -$lang = array_merge($lang, require $_path . 'lang/' . getlang() . '/install.php'); +$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; } @@ -46,17 +42,12 @@ if (file_exists($_path . '.svn/entries') || file_exists('dev.txt')) */ function getlang ($link = false) { - global $_path; + $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; @@ -64,85 +55,90 @@ function getlang ($link = false) function getjquerylink() { - global $_path; + if (file_exists(PATH . 'admin/Masmak/js/jquery.min.js')) + { + return 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'; - } - 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'; } /** * Parsing installing templates +* @param mixed $tplname */ function gettpl($tplname) { - global $lang, $_path; + global $lang; $tpl = preg_replace('/{{([^}]+)}}/', '', file_get_contents('style/' . $tplname)); + ob_start(); - eval('?> ' . $tpl . ' ' . $tpl . ''; - $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; } @@ -157,12 +153,13 @@ function get_microtime() /** * Get config value from database directly, if not return false. +* @param mixed $name */ function inst_get_config($name) { global $SQL, $dbprefix; - if (! $SQL) + if (empty($SQL)) { global $dbserver, $dbuser, $dbpass, $dbname; @@ -174,7 +171,7 @@ function inst_get_config($name) $SQL = new KleejaDatabase($dbserver, $dbuser, $dbpass, $dbname); } - if (! $SQL) + if (empty($SQL)) { return false; } diff --git a/install/includes/update_files/index.html b/install/includes/update_files/index.html deleted file mode 100755 index 3b794e0..0000000 --- a/install/includes/update_files/index.html +++ /dev/null @@ -1 +0,0 @@ -Powered by Kleeja 403 - Access forbidden!Powered by Kleeja >>> the best uploader ... >> Bugs | Plugins | Styles | \ No newline at end of file diff --git a/install/includes/update_files/1.7_to_2.0.php b/install/includes/update_schema.php old mode 100644 new mode 100755 similarity index 68% rename from install/includes/update_files/1.7_to_2.0.php rename to install/includes/update_schema.php index 8639c94..24aae7d --- a/install/includes/update_files/1.7_to_2.0.php +++ b/install/includes/update_schema.php @@ -1,12 +1,24 @@ "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 () { +// }, +// ]; diff --git a/install/index.php b/install/index.php index e879e27..04d5387 100755 --- a/install/index.php +++ b/install/index.php @@ -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 ''; + echo ''; 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)) { diff --git a/install/install.php b/install/install.php index 9340db0..0e0b707 100755 --- a/install/install.php +++ b/install/install.php @@ -16,52 +16,25 @@ * 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_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'; -/** - * @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')) { @@ -71,7 +44,6 @@ if (! ig('step')) exit; } - // // Kleeja must be safe .. // @@ -81,7 +53,7 @@ if (! empty($dbuser) && ! empty($dbname) && ! (ig('step') && in_array(g('step'), if (! empty($d)) { - header('Location: index.php'); + header('Location: ./index.php'); exit; } @@ -90,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 } @@ -127,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; } @@ -154,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'); @@ -198,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'); @@ -243,8 +204,8 @@ case 'data' : //connect .. for check $SQL = new KleejaDatabase($dbserver, $dbuser, $dbpass, $dbname); - include_once '../includes/usr.php'; - include_once '../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); diff --git a/install/quick.php b/install/quick.php new file mode 100644 index 0000000..a376ea1 --- /dev/null +++ b/install/quick.php @@ -0,0 +1,229 @@ +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 = ! 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 = ! 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'; +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 : ''); + $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 : ''); + $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 : ''); + $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 : ''); + $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 : ''); + $err++; + } + $it++; + } +} + + +if ($err > 0) +{ + echo CLI ? PHP_EOL : ''; + echo 'We encountered a problem during installation, see the error log:'; + echo CLI ? PHP_EOL : ''; + echo CLI ? '' : ''; + echo $errors; + echo CLI ? '' : ''; +} +else +{ + echo CLI ? '' : ''; + echo 'Kleeja has been installed successfully, enjoy ...'; + echo CLI ? PHP_EOL : ''; + echo 'Username: admin' . (CLI ? PHP_EOL : ''); + echo 'Password: ' . $password; +} diff --git a/install/style/check.html b/install/style/check.html index 6c960e7..64b1753 100755 --- a/install/style/check.html +++ b/install/style/check.html @@ -1,7 +1,7 @@ - {{echo $lang['FUNCTIONS_CHECK']}} : + {{echo $lang['FUNCTIONS_CHECK']}} : {{if(function_exists('unlink')):}} @@ -26,11 +26,11 @@ [ {{echo $lang['FUNCTION_DISC_GD']}} ] {{endif;}} - + {{if(function_exists('fopen')):}} {{echo sprintf($lang['FUNCTION_IS_EXISTS'], 'fopen')}} - [ {{echo $lang['FUNCTION_DISC_FOPEN']}} ] + [ {{echo $lang['FUNCTION_DISC_FOPEN']}} ] {{else: $GLOBALS['check_ok'] = false;}} @@ -53,21 +53,17 @@ - - {{if($GLOBALS['advices']):}} - {{echo $lang['ADVICES_CHECK']}} : - - {{if($GLOBALS['register_globals']):}} - {{echo $lang['ADVICES_REGISTER_GLOBALS']}} - {{endif;}} - {{if($GLOBALS['get_magic_quotes_gpc']):}} - {{echo $lang['ADVICES_MAGIC_QUOTES']}} + {{if($GLOBALS['advices']):}} + {{echo $lang['ADVICES_CHECK']}} : + + {{if($GLOBALS['ziparchive_lib']):}} + {{echo $lang['ZIPARCHIVE_LIB']}} {{endif;}} {{endif;}} - + {{if($GLOBALS['check_ok']):}} @@ -82,5 +78,5 @@ {{endif;}} - - \ No newline at end of file + + diff --git a/install/style/check_all.html b/install/style/check_all.html index 630d487..1a714f8 100755 --- a/install/style/check_all.html +++ b/install/style/check_all.html @@ -8,32 +8,32 @@ {{endif}} - + {{if($GLOBALS['no_connection']): $GLOBALS['submit_disabled'] = true;}} {{echo $lang['INST_CONNCET_ERR']}} {{endif}} - + {{if($GLOBALS['mysql_ver']): $GLOBALS['submit_disabled'] = true;}} {{echo sprintf($lang['INST_MYSQL_LESSMIN'], MIN_MYSQL_VERSION, $GLOBALS['mysql_ver'])}} {{endif}} - {{if(!is_writable($_path . 'cache')) : $GLOBALS['submit_disabled'] = true;}} + {{if(!is_writable(PATH . 'cache')) : $GLOBALS['submit_disabled'] = true;}} [ cache ] : {{echo $lang['INST_NO_WRTABLE']}} {{endif}} - - {{if(!is_writable($_path . 'uploads')) : $GLOBALS['submit_disabled'] = true;}} + + {{if(!is_writable(PATH . 'uploads')) : $GLOBALS['submit_disabled'] = true;}} [ uploads ] : {{echo $lang['INST_NO_WRTABLE']}} {{endif}} - {{if(!is_writable($_path . 'uploads/thumbs')) : $GLOBALS['submit_disabled'] = true;}} + {{if(!is_writable(PATH . 'uploads/thumbs')) : $GLOBALS['submit_disabled'] = true;}} [ uploads/thumbs ] : {{echo $lang['INST_NO_WRTABLE']}} @@ -51,10 +51,10 @@ {{else:}} - « {{echo $lang['INST_PREVIOUS']}} + « {{echo $lang['INST_PREVIOUS']}} {{echo $lang['RE_CHECK']}} » - + {{endif}} - + diff --git a/install/style/configs.html b/install/style/configs.html index e706ef8..a9fd344 100755 --- a/install/style/configs.html +++ b/install/style/configs.html @@ -5,17 +5,6 @@ {{echo $lang['DB_INFO']}} - {{echo $lang['DB_SERVER']}} diff --git a/install/style/header.html b/install/style/header.html index af67afa..8db7f58 100755 --- a/install/style/header.html +++ b/install/style/header.html @@ -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') ):}} - {{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');}} {{echo $file}} @@ -38,4 +38,4 @@ var PATH_SPACER = 'style/images/spacer.gif'; - \ No newline at end of file + diff --git a/install/style/lang.html b/install/style/lang.html index a334d01..80505d2 100755 --- a/install/style/lang.html +++ b/install/style/lang.html @@ -3,7 +3,7 @@ - {{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 != '.'):}} {{if(file_exists('style/images/'.$file.'.png')):}} @@ -22,4 +22,4 @@ - \ No newline at end of file + diff --git a/install/style/plugins_done.html b/install/style/plugins_done.html deleted file mode 100755 index 546913d..0000000 --- a/install/style/plugins_done.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - {{echo $lang['PLUGINS_INSTALLED'];}} - - - {{echo $lang['PLUGINS_NAME']}} - {{foreach($GLOBALS['installed_plugins'] as $plugin):}} - {{echo $plugin['p_name']}} - {{endforeach;}} - - - {{echo $lang['PLUGINS_DES']}} - {{foreach($GLOBALS['installed_plugins'] as $plugin):}} - {{echo $plugin['p_des']}} - {{endforeach;}} - - - {{echo $lang['PLUGINS_VER']}} - {{foreach($GLOBALS['installed_plugins'] as $plugin):}} - {{echo $plugin['p_ver']}} - {{endforeach;}} - - - - - {{echo $lang['INST_NEXT']}} » - - - - \ No newline at end of file diff --git a/install/style/plugins_options.html b/install/style/plugins_options.html deleted file mode 100755 index a85c3f4..0000000 --- a/install/style/plugins_options.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - {{echo $lang['PLUGINS_KLEEJA'];}} - {{echo $lang['PLUGINS_BUILT_IN'];}} - - - {{echo $lang['PLUGINS_NAME']}} - {{foreach($GLOBALS['plugins'] as $plugin):}} - {{echo $plugin['p_name']}} - {{endforeach;}} - - - {{echo $lang['PLUGINS_DES']}} - {{foreach($GLOBALS['plugins'] as $plugin):}} - {{echo $plugin['p_des']}} - {{endforeach;}} - - - {{echo $lang['PLUGINS_VER']}} - {{foreach($GLOBALS['plugins'] as $plugin):}} - {{echo $plugin['p_ver']}} - {{endforeach;}} - - - - {{foreach($GLOBALS['plugins'] as $plugin):}} - - {{endforeach;}} - - - - {{echo $lang['INST_NEXT']}} » - - - - \ No newline at end of file diff --git a/install/style/style.css b/install/style/style.css index f34cff7..ee562ad 100755 --- a/install/style/style.css +++ b/install/style/style.css @@ -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;}} -} \ No newline at end of file +} diff --git a/install/update.php b/install/update.php index e8975c0..4194835 100755 --- a/install/update.php +++ b/install/update.php @@ -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 ''; - } - } - 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[] = '' . $lang['INST_UPDATE_CUR_VER_IS_UP'] . ''; + $complete_update = false; + } + + // + //is there any sqls + // + if ($complete_update) + { + //loop through available updates + foreach ($available_db_updates as $db_update_version) { - echo ''; + $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 '' . $lang['INST_ERR_NO_SELECTED_UPFILE_GOOD'] . ' [ ' . $file_for_up . ' ]'; - } - else - { - //get it - require $file_for_up; - $complete_update = true; - $update_msgs_arr = []; - - - if ($config['db_version'] >= LAST_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[] = '' . $lang['INST_UPDATE_CUR_VER_IS_UP'] . ''; - $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[] = '' . $lang['INST_UPDATE_CUR_VER_IS_UP'] . ''; - $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` = '" . LAST_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; } diff --git a/lang/ar/acp.php b/lang/ar/acp.php index 7239fe2..247c623 100755 --- a/lang/ar/acp.php +++ b/lang/ar/acp.php @@ -123,9 +123,9 @@ return [ 'PLUGIN_EXISTS_BEFORE' => 'الاضافة هذه موجودة سابقاً بنفس الاصدار أو أعلى ولاتحتاج تحديث !', 'R_CHECK_UPDATE' => 'فحص عن تحديثات', 'ERROR_CHECK_VER' => 'خطأ: لا يمكن جلب معلومات عن آخر نسخة في هذه اللحظة، حاول مجدداً لاحقا!.', - 'UPDATE_KLJ_NOW' => 'يجب أن تقوم بتحديث نسختك إلى آخر نسخة الآن، قم بالذهاب لموقع كليجا لمعلومات أكثر .', + 'UPDATE_KLJ_NOW' => 'تحديث الآن!', 'U_LAST_VER_KLJ' => 'أنت تستخدم آخر نسخة من كليجا. شكراً لمتابعة نسختك بإستمرار.', - 'U_USE_PRE_RE' => 'أنت تستخدم نسخة تطويرية لم تصدر حتى الآن , اضغط هنا لإخبارنا بأي أخطاء برمجية وثغرات قد تقابلك.', + 'U_USE_PRE_RE' => 'أنت تستخدم نسخة تطويرية لم تصدر حتى الآن , اضغط هنا لإخبارنا بأي أخطاء برمجية وثغرات قد تقابلك.', 'STYLE_IS_DEFAULT' => 'استايل افتراضي', 'MAKE_AS_DEFAULT' => 'تعيينه افتراضي', 'STYLE_NOW_IS_DEFAULT' => 'تم تعيين الاستايل "%s" ستايل افتراضي', @@ -171,18 +171,10 @@ return [ 'ADD_HEADER_EXTRA' => 'هيدر إضافي', 'ADD_FOOTER_EXTRA' => 'فوتر إضافي', 'ADMIN_USING_IE6' => 'أنت تستخدم متصفح "انترنت اكسبلور قديم" هذا رغم انك صاحب موقع وتعرف اكثر ممايعرفه المستخدمون العاديون ! قم بترقية متصفحك او استخدم فيرفوكس الآن.', - - 'T_CLEANING_FILES_NOW' => 'جاري تنفيذ عملية حذف الملفات الخاملة حالياً على دفعات تفادياً للضغط ,وقت العملية يعتمد على عدد الملفات وحجمها ...', - - 'HOW_UPDATE_KLEEJA' => 'كيف تقوم بتحديث كليجا ؟', - 'HOW_UPDATE_KLEEJA_STEP1' => 'توجه الى موقع سكربت كليجا الرسمي Kleeja.com ثم توجه إلى صفحة التحميل وقم بتنزيل آخر تسخة صدرت من الاسكربت في حال توفر سكربت الترقية قم بتحميله', - 'HOW_UPDATE_KLEEJA_STEP2' => ' بعد ذلك قم بفك الضغط عن الملف الذي قمت بتحميله ثم رفعه الى موقعك لاستبدال الملفات القدييمة بالجديدة عدا ملف config.php.', - 'HOW_UPDATE_KLEEJA_STEP3' => 'بعد اتمام الخطوة السابقة بنجاح , قم بطلب العنوان التالي للتحديث قاعدة بيانـات الاسكربت:', - - 'DEPEND_ON_NO_STYLE_ERR' => 'هذا الستايل يعتمد على ستايل "%s" غير الموجود لديك ضمن الستايلات !.', - 'PLUGINS_REQ_NO_STYLE_ERR' => 'هذا الستايل يتطلب ان تكون الإضافة/الاضافات [ %s ] مثبتة لديك , ثبتها وحاول من جديد !.', - 'KLJ_VER_NO_STYLE_ERR' => 'هذا الستايل يتطلب على الاقل اصدار %s من كليجا .', - + 'T_CLEANING_FILES_NOW' => 'جاري تنفيذ عملية حذف الملفات الخاملة حالياً على دفعات تفادياً للضغط ,وقت العملية يعتمد على عدد الملفات وحجمها ...', + 'DEPEND_ON_NO_STYLE_ERR' => 'هذا الستايل يعتمد على ستايل "%s" غير الموجود لديك ضمن الستايلات !.', + 'PLUGINS_REQ_NO_STYLE_ERR' => 'هذا الستايل يتطلب ان تكون الإضافة/الاضافات [ %s ] مثبتة لديك , ثبتها وحاول من جديد !.', + 'KLJ_VER_NO_STYLE_ERR' => 'هذا الستايل يتطلب على الاقل اصدار %s من كليجا .', 'STYLE_DEPEND_ON' => 'يعتمد على ستايل', 'MESSAGE_NONE' => 'حتى الآن لا يوجد أي رسائل ..', 'KLEEJA_TEAM' => 'فريق تطوير كليجا', @@ -198,10 +190,8 @@ return [ 'ADM_UNWANTED_FILES' => 'يبدوا انك قمت بالترقية من نسخة سابقة وبسبب اختلاف اسماء بعض الملفات ستلاحظ وجود ازرار متكررة بلوحة التحكم . لحل المشكلة قم بإزالة كافة الملفات في المسار "includes/adm" واعادة رفعها من جديد. ايضا قم بحذف ملف admin.php من المجلد الرئيسي اذا وجد.', 'HTML_URLS_ENABLED_NO_HTCC' => 'لقد قمت بتفعيل روابط الهتمل ولكنك نسيت أن تقوم بإعادة تسمية الملف htaccess.txt في مجلد كليجا الرئيسي ليصبح ".htaccess". اذا لم تفهم شيئاً من هذا الكلام قم بالسؤال في الدعم الفني لكليجا او قم بتعطيل روابط الهتمل .', - 'PLUGIN_CONFIRM_ADD' => 'انتبه, الاضافات هي تعديلات برمجية على السكربت و قد تكون ضارة أحياناً , لذا ان كنت غير متأكد من مصدر الإضافة ولم تقم بتحميلها من موقع كليجا فالافضل ان تراجع نفسك الآن . ', - - 'LOADING' => 'جاري التنفيذ', - + 'PLUGIN_CONFIRM_ADD' => 'انتبه, الاضافات هي تعديلات برمجية على السكربت و قد تكون ضارة أحياناً , لذا ان كنت غير متأكد من مصدر الإضافة ولم تقم بتحميلها من موقع كليجا فالافضل ان تراجع نفسك الآن . ', + 'LOADING' => 'جاري التنفيذ', 'WELCOME' => 'مرحباً', 'ENABLE_CAPTCHA' => 'تفعيل كود الامان بكليجا', 'NO_THUMB_FOLDER' => 'يبدو ان المصغرات مُفعلة لديك ولكن في نفس الوقت مجلد %s غير متوفر مما يمنع عملية انشاء المصغرات, قم بإنشاء المجلد.', @@ -283,4 +273,12 @@ return [ 'VERSION' => 'الإصدار', 'DEVELOPER' => 'المطور', 'ALL_PLUGINS_UPDATED' => 'لا يوجد إضافات تحتاج تحديث حالياً ... ', + 'UPDATE_ERR_FETCH_PACKAGE' => 'واجهتنا مشكلة أثناء تحميل النسخة من الخادم!', + 'UPDATE_BACKUP_CREATE_FAILED' => 'لم نستطع إنشاء ملف النسخة الإحتياطية في مجلد الكاش!', + 'UPDATE_PROCESS_FAILED' => 'عملية التحديث فشلت!', + 'UPDATE_PROCESS_DONE' => 'تم تحديث كليجا إلى النسخة `%s` بنجاح...', + 'UPDATE_PROCESS_STEP1' => 'جلب حزمة آخر نسخة من كليجا...', + 'UPDATE_PROCESS_STEP2' => 'إنشاء وعاء نسخة إحتياطية وفك حزمة آخر نسخة ...', + 'UPDATE_PROCESS_STEP3' => 'الترقية للنسخة الجديدة (تحديث الملفات وقاعدة البيانات) ...', + 'RELEASE_NOTE' => 'معلومات الإصدار', ]; diff --git a/lang/ar/common.php b/lang/ar/common.php index a384579..ec22496 100755 --- a/lang/ar/common.php +++ b/lang/ar/common.php @@ -298,4 +298,6 @@ return [ //3.0.3 'NOTIFICATIONS' => 'تنبيهات', 'KJ_TWEETS' => 'تغريدات كليجا' , + 'PLG_SUCSS_DEL' => 'تم حذف مجلد الاضافة "%s" بنجاح!' , + 'PLG_DEL_CONFIRM' => 'سوف تقوم بحذف مجلد الاضافة' , ]; diff --git a/lang/ar/install.php b/lang/ar/install.php index 9867029..d2fe14b 100755 --- a/lang/ar/install.php +++ b/lang/ar/install.php @@ -37,7 +37,7 @@ return [ 'INST_FINISH_SQL' => 'تم تثبيت كليجا بنجاح', 'INST_NOTES' => 'ملاحظات التثبيت', 'INST_END' => 'معالج التثبيت انتهى، يجب الآن حذف مجلد INSTALL (الموقع لن يعمل في حال وجود المجلد)', - 'INST_NOTE_D' => 'أي ملاحظات أو مشاكل تتعلق بأداء كليجا، نرجوا التواصل مع مطوري كليجا!', + 'INST_NOTE_D' => 'أي ملاحظات أو مشاكل تتعلق بأداء كليجا، نرجو التبليغ عبر مركز الأخطاء', 'INST_FINISH_ERRSQL' => 'هناك مشكلة تعيق التثبيت، تأكد من حساب مستخدم القاعدة وحاول مجدداً او استفسر من مطوري كليجا', 'INST_KLEEJADEVELOPERS' => 'شكراً لإستخدامك كليجا ... مع أحلى و أطيب التمنيات .. من فريق عمل كليجا', 'SITENAME' => 'اسم الموقع', @@ -85,16 +85,10 @@ return [ 'FUNCTION_DISC_MUF' => 'دالة move_uploaded_file تستخدم لتحميل الملفات وهي اهم دالة في السكربت.', 'ADVICES_CHECK' => 'فحص متقدم (يمكن تثبيت كليجا بدون تحقق هذا الفحص , لكنه مجرد معلومات لك)', - 'ADVICES_REGISTER_GLOBALS' => 'خاصية register_globals مفعلة ! هذه الخاصية غير محبب تفعيلها ويفضل تعطيلها , ومع هذا فكليجا تحاول تعطيل أثارها برمجياً .', - 'ADVICES_MAGIC_QUOTES' => 'خاصية magic_quotes مفعله ! هذه الخاصية غير محبب تفعيلها ويفضل تعطيلها , ومع هذا فكليجا تحاول تعطيل أثارها برمجياً ..', + 'ZIPARCHIVE_LIB' => 'مكتبة ZipArchive غير متوفرة في خادمك ! هذه المكتبة مهمة لفك الإضافات والترقية لنسخ جديدة من كليجا!', //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 و متابعة عملك في كليجا .', @@ -107,7 +101,7 @@ return [ 'INST_WHAT_IS_KLEEJA_T' => 'ماهي كليجا ؟', 'INST_WHAT_IS_KLEEJA' => 'Kleeja تنطق عربياً "كليجا" ! وكتعريف مبسط "كليجا" سكربت رفع ملفات مجاني يأتي مع خصائص فريدة لمساعدة أصحاب المواقع بإمتلاك مركز تحميل قوي ويعتمد عليه , والحقيقة أن "كليجا" سكربت ضخم الامكانيات سهل الإدارة تم بناء نظام الحماية على مستوى عالي ويملك من الأنظمة المعقدة ما يؤمن لموقعك الحماية التامة بإذن الله !', 'INST_SPECIAL_KLEEJA' => 'من أهم مميزات كليجا !', - 'INST_WHAT_IS_KLEEJA_ONE' => '1. نظام أعضاء قوي تستطيع ربطه بأغلب السكربتات المستخدمة في المواقع الاجتماعية .2. لوحة تحكم مذهلة ليس فقط للتحكم بالملفات ولكن للتحكم بكل صغيرة وكبيرة .3. نظام الستايلات البسيط يجعلك تستطيع ان تصنع ستايلك بنفسك.4. مع كليجا ونظام الإضافات البرمجية تستطيع أن تقوم بتركيب الكثير من الاضافات الرائعة .5. ليس هذا فحسب بل كليجا تملك الكثير .. لتعرف أكثر رجاءاً قم بزيارة صفحه معلومات ومميزات .', + 'INST_WHAT_IS_KLEEJA_ONE' => '1. نظام أعضاء قوي تستطيع ربطه بأغلب السكربتات المستخدمة في المواقع الاجتماعية .2. لوحة تحكم مذهلة ليس فقط للتحكم بالملفات ولكن للتحكم بكل صغيرة وكبيرة .3. نظام الستايلات البسيط يجعلك تستطيع ان تصنع ستايلك بنفسك.4. مع كليجا ونظام الإضافات البرمجية تستطيع أن تقوم بتركيب الكثير من الاضافات الرائعة .5. ليس هذا فحسب بل كليجا تملك الكثير .. لتعرف أكثر رجاءاً قم بزيارة صفحه معلومات ومميزات .', 'YES' => 'نعم', 'NO' => 'لا', diff --git a/lang/en/acp.php b/lang/en/acp.php index 60426f1..4cbcd7a 100755 --- a/lang/en/acp.php +++ b/lang/en/acp.php @@ -125,9 +125,9 @@ return [ 'PLUGIN_EXISTS_BEFORE' => 'This plugin exists before with same version or above, so no need to update it!.', 'R_CHECK_UPDATE' => 'Check for updates', 'ERROR_CHECK_VER' => 'Error: cannot get any update information at this moment , try again later !', - 'UPDATE_KLJ_NOW' => 'You Have to update your version now!. visit Kleeja.com for more information', + 'UPDATE_KLJ_NOW' => 'update now!', 'U_LAST_VER_KLJ' => 'You are using the latest version of Kleeja...', - 'U_USE_PRE_RE' => 'You are using a Pre-release version, Click here to report any bugs or exploits.', + 'U_USE_PRE_RE' => 'You are using a Pre-release version, Click here to report any bugs or exploits.', 'STYLE_IS_DEFAULT' => 'Default style', 'MAKE_AS_DEFAULT' => 'Set as default', @@ -153,7 +153,6 @@ return [ 'COOKIE_NAME' => 'Cookie prefix', 'COOKIE_PATH' => 'Cookie path', 'COOKIE_SECURE' => 'Cookie secure', - //'ADMINISTRATORS' => 'Administrators', 'DELETEALLRES' => 'Delete all results', 'ADMIN_DELETE_FILES_OK' => 'File %s successfully deleted', 'ADMIN_DELETE_FILES_NOF' => 'No files to delete', @@ -174,12 +173,7 @@ return [ 'ADD_HEADER_EXTRA' => 'Extra Header', 'ADD_FOOTER_EXTRA' => 'Extra footer', 'ADMIN_USING_IE6' => 'You are using an outdated IE browser, Please update your browser or use FireFox now!', - 'T_CLEANING_FILES_NOW' => 'Deleting Un-downloaded files, The process could take a while depending on the size and number of the files.', - 'HOW_UPDATE_KLEEJA' => 'How to update Kleeja?', - 'HOW_UPDATE_KLEEJA_STEP1' => 'Visit the official website Kleeja.com then go to the Download page and download the latest version of the script, or download an upgrade copy if available.', - 'HOW_UPDATE_KLEEJA_STEP2' => 'Unzip the file and upload it to your website to replace the old files with the new ones Except config.php and uploads folder.', - 'HOW_UPDATE_KLEEJA_STEP3' => 'When done, go to the following URL to update the database.', 'DEPEND_ON_NO_STYLE_ERR' => 'This style is based on the "%s" style which you dont seem to have', 'PLUGINS_REQ_NO_STYLE_ERR' => 'This style requires the [ s% ] plugin(s), install it/them and try again.', 'KLJ_VER_NO_STYLE_ERR' => 'This style requires Kleeja version %s or above', @@ -269,16 +263,24 @@ return [ 'INSTALL' => 'Install', 'CLOSE' => 'Close', 'STATS_BOXES' => 'Stats Boxes', - 'PLUGIN_UPDATED' => 'Plugin "%s" has been updated successfully ..', + 'PLUGIN_UPDATED' => 'Plugin "%s" has been updated successfully ..', 'PLUGIN_DOWNLOADED' => 'Plugin "%s" has been downloaded successfully ..', - 'PLUGIN_FILE_NOT_FOUND' => 'The plugin file is missing!', - 'PLUGIN_REMOTE_FILE_MISSING'=> 'The plugin "%s" is not on Kleeja remote server!', - 'PLUGINS_SERVER_ERROR' => 'We encountered an error while connecting to the plugins remote server ...', + 'PLUGIN_FILE_NOT_FOUND' => 'The plugin file is missing!', + 'PLUGIN_REMOTE_FILE_MISSING' => 'The plugin "%s" is not on Kleeja remote server!', + 'PLUGINS_SERVER_ERROR' => 'We encountered an error while connecting to the plugins remote server ...', 'INSTALLED_PLUGINS' => 'Installed Plugins', - 'LOCAL_PLUGINS' => 'Local Plugins', - 'KLEEJA_STORE' => 'Kleeja Store', + 'LOCAL_PLUGINS' => 'Local Plugins', + 'KLEEJA_STORE' => 'Kleeja Store', 'KLJ_VER_NO_PLUGIN' => 'This plugin can works on Kleeja version %1$s up to version %2$s.', - 'VERSION' => 'Version', - 'DEVELOPER' => 'Developer', - 'ALL_PLUGINS_UPDATED' => 'There are no plugins that require an update currently...', + 'VERSION' => 'Version', + 'DEVELOPER' => 'Developer', + 'ALL_PLUGINS_UPDATED' => 'There are no plugins that require an update currently...', + 'UPDATE_ERR_FETCH_PACKAGE' => 'We have encountered a problem while downloading the package from the server!', + 'UPDATE_BACKUP_CREATE_FAILED' => 'We couldn\'t create a backup archive in cache folder!', + 'UPDATE_PROCESS_FAILED' => 'The update process has failed!', + 'UPDATE_PROCESS_DONE' => 'Kleeja has been updated to version `%s` successfully...', + 'UPDATE_PROCESS_STEP1' => 'Fetching the package of latest version of Kleeja ...', + 'UPDATE_PROCESS_STEP2' => 'Create a backup container and extract the new package ...', + 'UPDATE_PROCESS_STEP3' => 'Updating to new version (files & database upgrade) ...', + 'RELEASE_NOTE' => 'Release Notes', ]; diff --git a/lang/en/common.php b/lang/en/common.php index 5f48aca..e3347b0 100755 --- a/lang/en/common.php +++ b/lang/en/common.php @@ -288,4 +288,6 @@ return [ //3.0.3 'NOTIFICATIONS' => 'Notifications', 'KJ_TWEETS' => 'Kleeja Tweets' , + 'PLG_SUCSS_DEL' => 'the Folder of plugin "%s" is deleted successfuly !!' , + 'PLG_DEL_CONFIRM' => 'You will delete the plugin folder' , ]; diff --git a/lang/en/install.php b/lang/en/install.php index d1a5763..c9d308c 100755 --- a/lang/en/install.php +++ b/lang/en/install.php @@ -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' => 'register_globals function is enabled ..! its recommended that you disable it.', - 'ADVICES_MAGIC_QUOTES' => 'magic_quotes function is enabled ..! it is recommended that you disable it.', + 'ZIPARCHIVE_LIB' => 'ZipArchive Lib is not available..! 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...', @@ -107,11 +102,11 @@ return [ 'INST_WHAT_IS_KLEEJA' => 'Keeja is a free, features rich, files and images upload system. Kleeja is developed to help webmasters to provide a decent files hosting service on their sites . Kleeja comes with a simple source code and powerful User system , also with easy template system so you can easily customize your styles ', 'INST_SPECIAL_KLEEJA' => 'Some Kleeja features .. !', - 'INST_WHAT_IS_KLEEJA_ONE' => 'Kleeja has a simple and powerful user system which can be easily integrated with many boards . Kleeja provide simple admin control panel that enables you to control over everything in your site . Also you can customize Kleeja\'s style and install a lot of add-ons .... more details in Kleeja site ', + 'INST_WHAT_IS_KLEEJA_ONE' => 'Kleeja has a simple and powerful user system which can be easily integrated with many boards . Kleeja provide simple admin control panel that enables you to control over everything in your site . Also you can customize Kleeja\'s style and install a lot of add-ons .... more details in Kleeja site ', 'YES' => 'Yes', '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 Issues page", ];
+ {lang.LOADING} +
[ {{echo $lang['FUNCTION_DISC_GD']}} ]
[ {{echo $lang['FUNCTION_DISC_FOPEN']}} ]
{{echo $lang['ADVICES_REGISTER_GLOBALS']}}
{{echo $lang['ADVICES_MAGIC_QUOTES']}}
{{echo $lang['ZIPARCHIVE_LIB']}}
{{echo $lang['INST_CONNCET_ERR']}}
{{echo sprintf($lang['INST_MYSQL_LESSMIN'], MIN_MYSQL_VERSION, $GLOBALS['mysql_ver'])}}
[ cache ] : {{echo $lang['INST_NO_WRTABLE']}}
[ uploads ] : {{echo $lang['INST_NO_WRTABLE']}}
[ uploads/thumbs ] : {{echo $lang['INST_NO_WRTABLE']}}
{{echo $lang['PLUGINS_BUILT_IN'];}}