mirror of
https://github.com/kleeja-official/kleeja.git
synced 2025-12-16 04:59:42 +01:00
IDEAS
This commit is contained in:
6
.php_cs
6
.php_cs
@@ -37,7 +37,11 @@ return PhpCsFixer\Config::create()
|
|||||||
'visibility_required' => true,
|
'visibility_required' => true,
|
||||||
'native_function_casing' => true,
|
'native_function_casing' => true,
|
||||||
'no_empty_comment' => 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)
|
->setFinder($finder)
|
||||||
->setIndent(" ")
|
->setIndent(" ")
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ switch ($case):
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// plugins avilable in kleeja remote catalog
|
// plugins avilable in kleeja remote catalog
|
||||||
if (! ($catalog_plugins = $cache->get('catalog_plugins')))
|
if (! ($catalog_plugins = $cache->get('catalog_plugins')))
|
||||||
{
|
{
|
||||||
$store_link = 'https://raw.githubusercontent.com/kleeja-official/store-catalog/master/catalog.json';
|
$store_link = 'https://raw.githubusercontent.com/kleeja-official/store-catalog/master/catalog.json';
|
||||||
@@ -179,7 +179,7 @@ switch ($case):
|
|||||||
}
|
}
|
||||||
|
|
||||||
// is there a new version of this in the store
|
// 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(
|
version_compare(
|
||||||
strtolower($installed_plugins[$plugin_info['name']]['extra_info']['plugin_version']),
|
strtolower($installed_plugins[$plugin_info['name']]['extra_info']['plugin_version']),
|
||||||
strtolower($plugin_info['file']['version']),
|
strtolower($plugin_info['file']['version']),
|
||||||
@@ -552,7 +552,7 @@ switch ($case):
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// plugins avilable in kleeja store
|
// plugins avilable in kleeja store
|
||||||
$store_link = 'https://raw.githubusercontent.com/kleeja-official/store-catalog/master/catalog.json';
|
$store_link = 'https://raw.githubusercontent.com/kleeja-official/store-catalog/master/catalog.json';
|
||||||
|
|
||||||
$catalog_plugins = fetch_remote_file($store_link);
|
$catalog_plugins = fetch_remote_file($store_link);
|
||||||
@@ -581,7 +581,7 @@ switch ($case):
|
|||||||
// check if the version of the plugin is compatible with our kleeja version or not
|
// check if the version of the plugin is compatible with our kleeja version or not
|
||||||
if (
|
if (
|
||||||
version_compare(strtolower($store_plugins[$download_plugin]['kj_min_version']), KLEEJA_VERSION, '<=')
|
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'];
|
$download_plugin_link = $store_plugins[$download_plugin]['url'];
|
||||||
|
|
||||||
@@ -656,7 +656,7 @@ switch ($case):
|
|||||||
|
|
||||||
if (is_dir($plugin_folder_name))
|
if (is_dir($plugin_folder_name))
|
||||||
{
|
{
|
||||||
delete_plugin_folder($plugin_folder_name);
|
kleeja_unlink($plugin_folder_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect($plugin_download_link . $update_plugin . '&update' );
|
redirect($plugin_download_link . $update_plugin . '&update' );
|
||||||
|
|||||||
@@ -8,39 +8,41 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// not for directly open
|
// not for directly open
|
||||||
if (!defined('IN_ADMIN'))
|
if (! defined('IN_ADMIN'))
|
||||||
{
|
{
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$new_version = unserialize( $config['new_version'] )['version_number'];
|
$new_version = unserialize($config['new_version'])['version_number'];
|
||||||
|
|
||||||
|
|
||||||
// he can reinstall kleeja if he want by $_GET['install_again'] => for developers only
|
// he can reinstall kleeja if he want by $_GET['install_again'] => for developers only
|
||||||
if (!ig('install_again'))
|
if (! ig('install_again'))
|
||||||
{
|
{
|
||||||
// not reinstall , he want to update , => check if kleeja need or not
|
// not reinstall , he want to update , => check if kleeja need or not
|
||||||
if ( ! version_compare(strtolower(KLEEJA_VERSION), strtolower($new_version), '<') )
|
if (! version_compare(strtolower(KLEEJA_VERSION), strtolower($new_version), '<'))
|
||||||
{
|
{
|
||||||
// kleeja doesn't need to update
|
// kleeja doesn't need to update
|
||||||
kleeja_admin_info('there is no update for your version' , ADMIN_PATH );
|
kleeja_admin_info('there is no update for your version', ADMIN_PATH);
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
} // $_GET['install_again'] is set => reinstall kleeja => check if he is a developer
|
} // $_GET['install_again'] is set => reinstall kleeja => check if he is a developer
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// please no .
|
// please no .
|
||||||
if ( ! defined('DEV_STAGE') )
|
if (! defined('DEV_STAGE'))
|
||||||
{
|
{
|
||||||
kleeja_admin_err(":( NOOO!!");
|
kleeja_admin_err(':( NOOO!!');
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* we will download the last version from github and extract it in cache folder
|
* we will download the last version from github and extract it in cache folder
|
||||||
* then scan the new version files , and put it to the PATH
|
* then scan the new version files , and put it to the PATH
|
||||||
* we don't need to create the folders again in PATH
|
* we don't need to create the folders again in PATH
|
||||||
* and if we have to update the DB or removing some old files ,
|
* and if we have to update the DB or removing some old files ,
|
||||||
* we can check if there any update file of this version from the new install folder
|
* we can check if there any update file of this version from the new install folder
|
||||||
@@ -50,90 +52,124 @@ else
|
|||||||
$kj_new_pack_link = 'https://github.com/kleeja-official/kleeja/archive/';
|
$kj_new_pack_link = 'https://github.com/kleeja-official/kleeja/archive/';
|
||||||
|
|
||||||
$old_version = KLEEJA_VERSION;
|
$old_version = KLEEJA_VERSION;
|
||||||
$new_version = unserialize( $config['new_version'] )['version_number'];
|
$new_version = unserialize($config['new_version'])['version_number'];
|
||||||
|
|
||||||
|
// downloaded the last version to cache folder
|
||||||
$down_new_pack = fetch_remote_file($kj_new_pack_link . $new_version . '.zip', PATH . 'cache/kleeja.zip', 60, false, 10, true);
|
$down_new_pack = fetch_remote_file($kj_new_pack_link . $new_version . '.zip', PATH . 'cache/kleeja.zip', 60, false, 10, true);
|
||||||
|
|
||||||
if ($down_new_pack) // we connected to github & downloaded the last version to cache folder
|
if ($down_new_pack)
|
||||||
{
|
{
|
||||||
// let's extract the zip to cache
|
// let's extract the zip to cache
|
||||||
$zip = new ZipArchive;
|
$zip = new ZipArchive;
|
||||||
|
|
||||||
if ($zip->open( PATH . 'cache/kleeja.zip' ) == TRUE)
|
if ($zip->open(PATH . 'cache/kleeja.zip') == true)
|
||||||
{
|
{
|
||||||
$zip->extractTo( PATH . 'cache/' );
|
$zip->extractTo(PATH . 'cache/');
|
||||||
$zip->close();
|
$zip->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// some folder don't need it
|
// some folder don't need it
|
||||||
$no_need = array(
|
$no_need = [
|
||||||
'cache', // delete_cache() function
|
'cache', // delete_cache() function
|
||||||
'plugins', // kleeja now support plugins update
|
'plugins', // kleeja now support plugins update
|
||||||
'uploads',
|
'uploads',
|
||||||
'styles', // kleeja will support style_update soon
|
'styles', // kleeja will support style_update soon
|
||||||
'install' // befor removing install folder , we will take what we want from it
|
'install' // befor removing install folder , we will take what we want from it
|
||||||
);
|
];
|
||||||
|
|
||||||
// let's check if there any update files in install folder
|
// 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_files/{$old_version}_to_{$new_version}.php";
|
||||||
if (file_exists($update_file))
|
|
||||||
|
if (file_exists($update_file))
|
||||||
{
|
{
|
||||||
// move the update file from install folder to cache folder to include it later and delete install folder
|
// 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
|
// 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_{$old_version}_to_{$new_version}.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($no_need as $folderName)
|
foreach ($no_need as $folderName)
|
||||||
{
|
{
|
||||||
delete_plugin_folder( PATH . "cache/kleeja-{$new_version}/{$folderName}" );
|
kleeja_unlink(PATH . "cache/kleeja-{$new_version}/{$folderName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete plugin folder function with some changes :)
|
// delete plugin folder function with some changes :)
|
||||||
$it = new RecursiveDirectoryIterator(PATH . "cache/kleeja-{$new_version}/", RecursiveDirectoryIterator::SKIP_DOTS);
|
$it = new RecursiveDirectoryIterator(PATH . "cache/kleeja-{$new_version}/", RecursiveDirectoryIterator::SKIP_DOTS);
|
||||||
$files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
$files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
||||||
|
|
||||||
foreach ($files as $file)
|
//rollback settings
|
||||||
|
mkdir(PATH . 'cache/rollback');
|
||||||
|
$update_failed = false;
|
||||||
|
|
||||||
|
foreach ($files as $file)
|
||||||
{
|
{
|
||||||
if ($file->isLink())
|
if ($file->isFile())
|
||||||
{
|
{
|
||||||
file_put_contents(
|
$file_path = str_replace("cache/kleeja-{$new_version}/", '', $file->getPathname());
|
||||||
str_replace("cache/kleeja-{$new_version}/", '' , $file->getPathname()) ,
|
|
||||||
file_get_contents( $file->getPathname() )
|
// same, no need to replace
|
||||||
);
|
if (file_exists($file_path) && md5_file($file_path) != md5_file($file->getPathname()))
|
||||||
unlink($file->getPathname());
|
{
|
||||||
}
|
continue;
|
||||||
else if ($file->isDir())
|
}
|
||||||
{
|
|
||||||
|
//backup for rollback
|
||||||
|
if (! file_put_contents(
|
||||||
|
'cache/rollback/' . ltrim($file_path, '/'),
|
||||||
|
file_get_contents($file_path)
|
||||||
|
))
|
||||||
|
{
|
||||||
|
$update_failed = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//copy file
|
||||||
|
if (! file_put_contents(
|
||||||
|
$file_path,
|
||||||
|
file_get_contents($file->getPathname())
|
||||||
|
))
|
||||||
|
{
|
||||||
|
$update_failed = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($file->isDir())
|
||||||
|
{
|
||||||
// here is folder , when we finish update , we will delete all folders and files
|
// here is folder , when we finish update , we will delete all folders and files
|
||||||
|
//TODO if folder is new, then mkdir it.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
file_put_contents(
|
// not file or folder ?
|
||||||
str_replace("cache/kleeja-{$new_version}/", '' , $file->getPathname()) ,
|
|
||||||
file_get_contents( $file->getPathname() )
|
|
||||||
);
|
|
||||||
unlink($file->getPathname());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists( $updateFiles = PATH . "cache/update_{$old_version}_to_{$new_version}.php"))
|
if ($update_failed)
|
||||||
{
|
{
|
||||||
require_once $updateFiles; // we will include what we want to do in this file , and kleeja will done
|
//rollback to backup cache/rollback
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we will include what we want to do in this file , and kleeja will done
|
||||||
|
if (file_exists($updateFiles = PATH . "cache/update_{$old_version}_to_{$new_version}.php"))
|
||||||
|
{
|
||||||
|
require_once $updateFiles;
|
||||||
|
}
|
||||||
|
|
||||||
// after we made success update , let's delete files and folders incache
|
// after we made success update , let's delete files and folders incache
|
||||||
|
|
||||||
// kleeja new version files
|
// kleeja new version files
|
||||||
delete_plugin_folder(PATH . "cache/kleeja-{$new_version}");
|
kleeja_unlink(PATH . "cache/kleeja-{$new_version}");
|
||||||
|
|
||||||
// delete old cache files
|
// delete old cache files
|
||||||
delete_cache('' , true);
|
delete_cache('', true);
|
||||||
|
|
||||||
/**
|
|
||||||
* DDISPLAY SUCCESS MSG HERE , AND ALSO WE CAN INCLUDE SUCCESS MSG ON UPDATE FILE
|
|
||||||
* OR WE CAN INCLUDE UPDATE FILES IN GITHUB , AND DOWNLOAD IT IN CACHE FOLDER WHEN IT REQUEST
|
|
||||||
* AND DELETE AFTER WE FINISH ;
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DDISPLAY SUCCESS MSG HERE , AND ALSO WE CAN INCLUDE SUCCESS MSG ON UPDATE FILE
|
||||||
|
* OR WE CAN INCLUDE UPDATE FILES IN GITHUB , AND DOWNLOAD IT IN CACHE FOLDER WHEN IT REQUEST
|
||||||
|
* AND DELETE AFTER WE FINISH ;
|
||||||
|
*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ function get_ban()
|
|||||||
// if the request is an image
|
// if the request is an image
|
||||||
//
|
//
|
||||||
if (
|
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'
|
|| g('go', 'str', '') == 'queue'
|
||||||
) {
|
) {
|
||||||
@$SQL->close();
|
@$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);
|
@ini_set('default_socket_timeout', $timeout);
|
||||||
}
|
}
|
||||||
$allow_url_fopen = function_exists('ini_get')
|
$allow_url_fopen = function_exists('ini_get')
|
||||||
? strtolower(@ini_get('allow_url_fopen'))
|
? strtolower(@ini_get('allow_url_fopen'))
|
||||||
: strtolower(@get_cfg_var('allow_url_fopen'));
|
: strtolower(@get_cfg_var('allow_url_fopen'));
|
||||||
|
|
||||||
if (function_exists('curl_init'))
|
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_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
fclose($out);
|
fclose($out);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($head_only)
|
if ($head_only)
|
||||||
{
|
{
|
||||||
@@ -548,7 +548,7 @@ function delete_cache($name, $all=false)
|
|||||||
|
|
||||||
if (file_exists($path_to_cache . '/' . $name))
|
if (file_exists($path_to_cache . '/' . $name))
|
||||||
{
|
{
|
||||||
$del = kleeja_unlink ($path_to_cache . '/' . $name, true);
|
$del = kleeja_unlink($path_to_cache . '/' . $name, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,7 +577,32 @@ function kleeja_unlink($filePath, $cache_file = false)
|
|||||||
//99.9% who use this
|
//99.9% who use this
|
||||||
if (function_exists('unlink'))
|
if (function_exists('unlink'))
|
||||||
{
|
{
|
||||||
return unlink($filePath);
|
if (is_dir($filePath))
|
||||||
|
{
|
||||||
|
$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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rmdir($dir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return unlink($filePath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//5% only who use this
|
//5% only who use this
|
||||||
//else if (function_exists('exec'))
|
//else if (function_exists('exec'))
|
||||||
@@ -1301,12 +1326,12 @@ function klj_clean_old_files($from = 0)
|
|||||||
//delete from folder ..
|
//delete from folder ..
|
||||||
if (file_exists($row['folder'] . '/' . $row['name']))
|
if (file_exists($row['folder'] . '/' . $row['name']))
|
||||||
{
|
{
|
||||||
@kleeja_unlink ($row['folder'] . '/' . $row['name']);
|
@kleeja_unlink($row['folder'] . '/' . $row['name']);
|
||||||
}
|
}
|
||||||
//delete thumb
|
//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'];
|
$ids[] = $row['id'];
|
||||||
@@ -1717,11 +1742,11 @@ function parse_serve_rule($regex, $args, $is_unicode = false)
|
|||||||
|
|
||||||
foreach ($parsed_args as $arg_key => $arg_value)
|
foreach ($parsed_args as $arg_key => $arg_value)
|
||||||
{
|
{
|
||||||
if ( preg_match('/^\$/', $arg_value))
|
if (preg_match('/^\$/', $arg_value))
|
||||||
{
|
{
|
||||||
$match_number = ltrim($arg_value, '$');
|
$match_number = ltrim($arg_value, '$');
|
||||||
|
|
||||||
if ( isset($matches[$match_number]))
|
if (isset($matches[$match_number]))
|
||||||
{
|
{
|
||||||
$_GET[$arg_key] = $matches[$match_number];
|
$_GET[$arg_key] = $matches[$match_number];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,13 @@ if (! defined('IN_COMMON'))
|
|||||||
* Print cp error function handler
|
* Print cp error function handler
|
||||||
*
|
*
|
||||||
* For admin
|
* 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')
|
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;
|
global $SQL;
|
||||||
|
|
||||||
$search['filename'] = ! isset($search['filename']) ? '' : $search['filename'];
|
$search['filename'] = ! isset($search['filename']) ? '' : $search['filename'];
|
||||||
$search['username'] = ! isset($search['username']) ? '' : $search['username'];
|
$search['username'] = ! isset($search['username']) ? '' : $search['username'];
|
||||||
$search['than'] = ! isset($search['than']) ? '' : $search['than'];
|
$search['than'] = ! isset($search['than']) ? '' : $search['than'];
|
||||||
$search['size'] = ! isset($search['size']) ? '' : $search['size'];
|
$search['size'] = ! isset($search['size']) ? '' : $search['size'];
|
||||||
@@ -249,8 +256,8 @@ function build_search_query($search)
|
|||||||
$search['ext'] = ! isset($search['ext']) ? '' : $search['ext'];
|
$search['ext'] = ! isset($search['ext']) ? '' : $search['ext'];
|
||||||
$search['user_ip'] = ! isset($search['user_ip']) ? '' : $search['user_ip'];
|
$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']) . '%\')' : '';
|
$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']) . '%\'' : '';
|
$usernamee = $search['username'] != '' ? 'AND u.name LIKE \'%' . $SQL->escape($search['username']) . '%\'' : '';
|
||||||
$size_than = ' f.size ' . ($search['than']!=1 ? '<=' : '>=') . (intval($search['size']) * 1024) . ' ';
|
$size_than = ' f.size ' . ($search['than']!=1 ? '<=' : '>=') . (intval($search['size']) * 1024) . ' ';
|
||||||
$ups_than = $search['ups'] != '' ? 'AND f.uploads ' . ($search['uthan']!=1 ? '<' : '>') . intval($search['ups']) . ' ' : '';
|
$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']) . ' ' : '';
|
$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;
|
$start = ! $start ? $min_id : $start;
|
||||||
$end = $start + $batch_size;
|
$end = $start + $batch_size;
|
||||||
|
|
||||||
//now lets get this step's files number
|
//now lets get this step's files number
|
||||||
unset($v, $result);
|
unset($v, $result);
|
||||||
|
|
||||||
$query['SELECT'] = 'COUNT(f.id) as num_files';
|
$query['SELECT'] = 'COUNT(f.id) as num_files';
|
||||||
@@ -322,7 +329,7 @@ function sync_total_files($files = true, $start = false)
|
|||||||
//make it zero, firstly
|
//make it zero, firstly
|
||||||
if ($first_loop)
|
if ($first_loop)
|
||||||
{
|
{
|
||||||
$update_query['SET'] = ($files ? 'files' : 'imgs') . '= 0';
|
$update_query['SET'] = ($files ? 'files' : 'imgs') . '= 0';
|
||||||
$SQL->build($update_query);
|
$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
|
* @param string $name box name
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@@ -386,31 +393,3 @@ function adm_is_start_box_hidden($name)
|
|||||||
|
|
||||||
return in_array($name, $boxes);
|
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);
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user