This commit is contained in:
Abdulrahman
2019-05-18 01:47:17 +03:00
parent b9fcd4b575
commit d1481940a4
120 changed files with 5969 additions and 6185 deletions

View File

@@ -12,8 +12,8 @@
* @ignore
*/
define('IN_KLEEJA', true);
define ('PATH', '../');
define ('IN_ADMIN', true);
define('PATH', '../');
define('IN_ADMIN', true);
require_once PATH . 'includes/common.php';

2
do.php
View File

@@ -13,7 +13,7 @@
* @ignore
*/
define('IN_KLEEJA', true);
define ('IN_DOWNLOAD', true);
define('IN_DOWNLOAD', true);
require_once 'includes/common.php';

8
go.php
View File

@@ -53,10 +53,10 @@ switch ($current_go_case)
'ext' => $ext,
'size' => readable_size($size),
'group' => $gid,
'group_name'=> str_replace(['{lang.ADMINS}', '{lang.USERS}', '{lang.GUESTS}'],
'group_name' => str_replace(['{lang.ADMINS}', '{lang.USERS}', '{lang.GUESTS}'],
[$lang['ADMINS'], $lang['USERS'], $lang['GUESTS']],
$d_groups[$gid]['data']['group_name']),
'most_firstrow'=> $same_group == 0 ? true : false,
'most_firstrow' => $same_group == 0 ? true : false,
'firstrow' => $same_group ==0 or $same_group != $gid ? true : false,
'rando' => $rando,
];
@@ -280,7 +280,7 @@ switch ($current_go_case)
$ERRORS['captcha'] = $lang['WRONG_VERTY_CODE'];
}
if ((empty(p('cname')) && $NOT_USER) || empty(p('ctext')) )
if ((empty(p('cname')) && $NOT_USER) || empty(p('ctext')))
{
$ERRORS['cname'] = $lang['EMPTY_FIELDS'] . ' : ' . (empty(p('cname')) && $NOT_USER ? ' [ ' . $lang['YOURNAME'] . ' ] ' : '')
. (empty(p('ctext')) ? ' [ ' . $lang['TEXT'] . ' ] ': '');
@@ -361,7 +361,7 @@ switch ($current_go_case)
if (ig('sure') && g('sure') == 'ok')
{
$query = [
'SELECT'=> 'f.id, f.name, f.folder, f.size, f.type',
'SELECT' => 'f.id, f.name, f.folder, f.size, f.type',
'FROM' => "{$dbprefix}files f",
'WHERE' => "f.code_del='" . $cd . "'",
'LIMIT' => '1',

View File

@@ -86,8 +86,7 @@ interface KleejaUploader
/**
* here happens the magic, call this on upload submit
* @param int $uploadType upload from files input or links
* @return void
*/
public function upload($uploadType);
public function upload();
}

View File

@@ -236,7 +236,7 @@ while ($row=$SQL->fetch_array($result))
{
rename(PATH . 'htaccess.txt', PATH . '.htaccess');
if(! file_exists(PATH . '.htaccess'))
if (! file_exists(PATH . '.htaccess'))
{
chmod(PATH . '.htaccess', K_FILE_CHMOD);
}

View File

@@ -75,11 +75,11 @@ if (ip('submit'))
while ($row=$SQL->fetch_array($result))
{
//delete from folder ..
@kleeja_unlink (PATH . $row['folder'] . '/' . $row['name']);
@kleeja_unlink(PATH . $row['folder'] . '/' . $row['name']);
//delete thumb
if (file_exists(PATH . $row['folder'] . '/thumbs/' . $row['name'] ))
if (file_exists(PATH . $row['folder'] . '/thumbs/' . $row['name']))
{
@kleeja_unlink (PATH . $row['folder'] . '/thumbs/' . $row['name'] );
@kleeja_unlink(PATH . $row['folder'] . '/thumbs/' . $row['name']);
}
$is_image = in_array(strtolower(trim($row['type'])), ['gif', 'jpg', 'jpeg', 'bmp', 'png']) ? true : false;
@@ -168,12 +168,12 @@ else
while ($row=$SQL->fetch_array($result))
{
//delete from folder ..
@kleeja_unlink (PATH . $row['folder'] . '/' . $row['name']);
@kleeja_unlink(PATH . $row['folder'] . '/' . $row['name']);
//delete thumb
if (file_exists(PATH . $row['folder'] . '/thumbs/' . $row['name']))
{
@kleeja_unlink (PATH . $row['folder'] . '/thumbs/' . $row['name']);
@kleeja_unlink(PATH . $row['folder'] . '/thumbs/' . $row['name']);
}
$is_image = in_array(strtolower(trim($row['type'])), ['gif', 'jpg', 'jpeg', 'bmp', 'png']) ? true : false;
@@ -304,7 +304,7 @@ else
//pager
$currentPage= ig('page') ? g('page', 'int') : 1;
$currentPage = ig('page') ? g('page', 'int') : 1;
$Pager = new Pagination($files_acp_perpage, $nums_rows, $currentPage);
$start = $Pager->getStartRow();

View File

@@ -64,9 +64,9 @@ if (ip('submit'))
//delete from folder ..
@kleeja_unlink(PATH . $row['folder'] . '/' . $row['name']);
//delete thumb
if (file_exists(PATH . $row['folder'] . '/thumbs/' . $row['name'] ))
if (file_exists(PATH . $row['folder'] . '/thumbs/' . $row['name']))
{
@kleeja_unlink(PATH . $row['folder'] . '/thumbs/' . $row['name'] );
@kleeja_unlink(PATH . $row['folder'] . '/thumbs/' . $row['name']);
}
$ids[] = $row['id'];
$num++;
@@ -172,7 +172,7 @@ else
}
//pager
$currentPage= ig('page') ? g('page', 'int') : 1;
$currentPage = ig('page') ? g('page', 'int') : 1;
$Pager = new Pagination($images_acp_perpage, $nums_rows, $currentPage);
$start = $Pager->getStartRow();
@@ -228,7 +228,7 @@ else
'time' => date('d-m-Y h:i a', $row['time']),
'user' => (int) $row['user'] == -1 ? $lang['GUST'] : $row['username'],
'is_user' => (int) $row['user'] == -1 ? 0 : 1,
'thumb_link'=> $url_thumb
'thumb_link' => $url_thumb
];
//fix ...

View File

@@ -86,7 +86,7 @@ if ($nums_rows > 0)
'name' => $row['name'],
'mail' => $row['mail'],
'text' => htmlspecialchars($row['text']),
'human_time'=> kleeja_date($row['time']),
'human_time' => kleeja_date($row['time']),
'time' => kleeja_date($row['time'], false),
'ip' => $row['ip'],
'sent' => $row['id'] == $msg_sent,

View File

@@ -86,7 +86,7 @@ if ($nums_rows > 0)
'mail' => $row['mail'],
'url' => $row['url'],
'text' => $row['text'],
'human_time'=> kleeja_date($row['time']),
'human_time' => kleeja_date($row['time']),
'time' => kleeja_date($row['time'], false),
'ip' => $row['ip'],
'sent' => $row['id'] == $msg_sent,

View File

@@ -135,11 +135,11 @@ if (ig('deleteuserfile'))
while ($row=$SQL->fetch_array($result))
{
//delete from folder ..
kleeja_unlink (PATH . $row['folder'] . '/' . $row['name']);
kleeja_unlink(PATH . $row['folder'] . '/' . $row['name']);
//delete thumb
if (file_exists(PATH . $row['folder'] . '/thumbs/' . $row['name']))
{
kleeja_unlink (PATH . $row['folder'] . '/thumbs/' . $row['name']);
kleeja_unlink(PATH . $row['folder'] . '/thumbs/' . $row['name']);
}
$num++;
@@ -716,7 +716,7 @@ case 'group_acl':
}
$acls[] = [
'acl_title' => ! empty( $lang['ACLS_' . strtoupper($row['acl_name'])] ) ? $lang['ACLS_' . strtoupper($row['acl_name'])] : $olang['ACLS_' . strtoupper($row['acl_name'])],
'acl_title' => ! empty($lang['ACLS_' . strtoupper($row['acl_name'])]) ? $lang['ACLS_' . strtoupper($row['acl_name'])] : $olang['ACLS_' . strtoupper($row['acl_name'])],
'acl_name' => $row['acl_name'],
'acl_can' => (int) $row['acl_can']
];

View File

@@ -17,9 +17,9 @@ if (! defined('IN_ADMIN'))
//for style ..
$stylee = 'admin_extra';
$current_smt= preg_replace('/[^a-z0-9_]/i', '', g('smt', 'str', 'he'));
$current_smt = preg_replace('/[^a-z0-9_]/i', '', g('smt', 'str', 'he'));
$action = basename(ADMIN_PATH) . '?cp=' . basename(__file__, '.php') . '&smt=' . $current_smt;
$H_FORM_KEYS= kleeja_add_form_key('adm_extra');
$H_FORM_KEYS = kleeja_add_form_key('adm_extra');
//
// Check form key

View File

@@ -151,7 +151,7 @@ elseif ($current_smt == 'update1')
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);
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"))
{
@@ -185,7 +185,8 @@ elseif ($current_smt == 'update2')
$ex_folder = trim($zip->getNameIndex(0), '/');
$zip->extractTo(PATH . 'cache/');
$zip->close();
if(rename(
if (rename(
PATH . "cache/{$ex_folder}",
PATH . "cache/kleeja-{$new_version}"
) === false)
@@ -206,7 +207,7 @@ elseif ($current_smt == 'update2')
{
// 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)
if (rename($update_file, PATH . 'cache/update_schema.php') === false)
{
copy($update_file, PATH . 'cache/update_schema.php');
}
@@ -293,7 +294,6 @@ elseif ($current_smt == 'update3')
file_get_contents($file->getPathname())
) === false)
{
if (copy($file->getPathname(), $file_path) === false)
{
$update_failed = true;

View File

@@ -31,7 +31,7 @@ $last_del_fles = (int) $config['del_f_day'] <= 0 ? $lang['CLOSED_FEATURE']
$php_version = isset($NO_PHPINFO) || ! function_exists('phpinfo') ? phpversion() : 'PHP ' . phpversion();
$mysql_version = 'MySQL ' . $SQL->mysql_version();
$max_execution_time = function_exists('ini_get') ? @ini_get('max_execution_time') : @get_cfg_var('max_execution_time');
$upload_max_filesize= function_exists('ini_get') ? @ini_get('upload_max_filesize') : @get_cfg_var('upload_max_filesize');
$upload_max_filesize = function_exists('ini_get') ? @ini_get('upload_max_filesize') : @get_cfg_var('upload_max_filesize');
$post_max_size = function_exists('ini_get') ? @ini_get('post_max_size') : @get_cfg_var('post_max_size');
$memory_limit = function_exists('ini_get') ? @ini_get('memory_limit') : @get_cfg_var('memory_limit');
$s_last_google = $stat_last_google == 0 ? '[ ? ]' : kleeja_date($stat_last_google);

View File

@@ -208,12 +208,14 @@ function kleeja_auth_login ($name, $pass, $hashed = false, $expire, $loginadm =
function kleeja_auth_username ($user_id)
{
return kleeja_auth_login ($user_id, false, false, 0, false, true);
return kleeja_auth_login($user_id, false, false, 0, false, true);
}
/**
* Check for correct password
* @param mixed $password
* @param mixed $hash
*/
function phpbb_check_hash($password, $hash)
{
@@ -229,6 +231,9 @@ function phpbb_check_hash($password, $hash)
/**
* Generate salt for hash generation
* @param mixed $input
* @param mixed $itoa64
* @param mixed $iteration_count_log2
*/
function _hash_gensalt_private($input, &$itoa64, $iteration_count_log2 = 6)
{
@@ -246,6 +251,9 @@ function _hash_gensalt_private($input, &$itoa64, $iteration_count_log2 = 6)
/**
* Encode hash
* @param mixed $input
* @param mixed $count
* @param mixed $itoa64
*/
function _hash_encode64($input, $count, &$itoa64)
{
@@ -289,6 +297,9 @@ function _hash_encode64($input, $count, &$itoa64)
/**
* The crypt function/replacement
* @param mixed $password
* @param mixed $setting
* @param mixed $itoa64
*/
function _hash_crypt_private($password, $setting, &$itoa64)
{

View File

@@ -60,7 +60,7 @@ function kleeja_auth_login ($name, $pass, $hashed = false, $expire, $loginadm =
$forum_db = $config['Database']['dbname'];
$forum_user = $config['MasterServer']['username'];
$forum_pass = $config['MasterServer']['password'];
$forum_prefix= $config['Database']['tableprefix'];
$forum_prefix = $config['Database']['tableprefix'];
if ($config['MasterServer']['port'] != 3306)
{
@@ -233,5 +233,5 @@ function kleeja_auth_login ($name, $pass, $hashed = false, $expire, $loginadm =
function kleeja_auth_username ($user_id)
{
return kleeja_auth_login ($user_id, false, true, 0, false, true);
return kleeja_auth_login($user_id, false, true, 0, false, true);
}

View File

@@ -68,12 +68,12 @@ function kleeja_cpatcha_image()
// We figure a bug that happens when you add font name without './' before it ..
// he search in the Linux fonts cache , but when you add './' he will know it's our font.
//
imagettftext ($image, 16, $angle, rand(50, $x), $y+rand(1, 3), $white, dirname(__FILE__) . '/arial.ttf', $security_code);
imagettftext($image, 16, $angle, rand(50, $x), $y+rand(1, 3), $white, dirname(__FILE__) . '/arial.ttf', $security_code);
//imagettftext ($image, 7, 0, $width-30, $height-4, $white,'./arial.ttf', 'Kleeja');
}
else
{
imagestring ($image, imageloadfont(dirname(__FILE__) . '/arial.gdf'), $x+rand(10, 15), $y-rand(10, 15), $security_code, $white);
imagestring($image, imageloadfont(dirname(__FILE__) . '/arial.gdf'), $x+rand(10, 15), $y-rand(10, 15), $security_code, $white);
//imagestring ($image, 1, $width-35, $height-10, 'Kleeja', ImageColorAllocate($image, 200, 200, 200));
}

View File

@@ -121,7 +121,7 @@ function Saafooter()
$hksys = ! defined('STOP_PLUGINS') ? 'Enabled' : 'Disabled';
$endtime = get_microtime();
$loadtime = number_format($endtime - $starttm, 4);
$queries_num= $SQL->query_num;
$queries_num = $SQL->query_num;
$time_sql = round($SQL->query_num / $loadtime);
$page_url = preg_replace(['/([\&\?]+)debug/i', '/&amp;/i'], ['', '&'], kleeja_get_page());
$link_dbg = user_can('enter_acp') && defined('DEV_STAGE') ? '[ <a href="' . str_replace('&', '&amp;', $page_url) . (strpos($page_url, '?') === false ? '?' : '&amp;') . 'debug">Debug Info ... </a> ]' : '';

View File

@@ -43,7 +43,7 @@ class KleejaDatabase
$this->db_name = $db_name;
$this->db_password = 'hidden';
$this->connect_id = @mysqli_connect($this->host, $this->db_username, $db_password, $this->db_name, (! $this->port ? 3306 : $this->port ));
$this->connect_id = @mysqli_connect($this->host, $this->db_username, $db_password, $this->db_name, (! $this->port ? 3306 : $this->port));
//no error
if (defined('MYSQL_NO_ERRORS'))
@@ -178,7 +178,7 @@ class KleejaDatabase
}
else
{
if ( $transaction == 2 && $this->in_transaction )
if ($transaction == 2 && $this->in_transaction)
{
$this->result = mysqli_commit($this->connect_id);
}

View File

@@ -24,6 +24,7 @@ class kleeja_style
/**
* Function to load a template file.
* @param $template_name
* @param null|mixed $style_path
*/
protected function _load_template($template_name, $style_path = null)
{
@@ -118,6 +119,8 @@ class kleeja_style
/**
* Function to parse the Template Tags
* @param mixed $html
* @param mixed $template_name
*/
protected function _parse($html, $template_name = '')
{
@@ -360,7 +363,7 @@ class kleeja_style
ob_start();
if($eval_on)
if ($eval_on)
{
eval(' ?' . '>' . $parsed_html . '<' . '?php ');
}
@@ -380,6 +383,7 @@ class kleeja_style
/**
* change name of template to be valid
* @param $name
* @param null|mixed $style_path
* @return mixed
*/
protected function re_name_tpl($name, $style_path = null)

View File

@@ -101,7 +101,7 @@ function imagecreatefrombmp($filename)
//read header
$header = fread($f, 54);
$header = unpack( 'c2identifier/Vfile_size/Vreserved/Vbitmap_data/Vheader_size/' .
$header = unpack('c2identifier/Vfile_size/Vreserved/Vbitmap_data/Vheader_size/' .
'Vwidth/Vheight/vplanes/vbits_per_pixel/Vcompression/Vdata_size/' .
'Vh_resolution/Vv_resolution/Vcolors/Vimportant_colors', $header);

View File

@@ -18,6 +18,7 @@ if (! defined('IN_COMMON'))
/**
* checking the safety and validity of sub-extension of given file
*
* @param mixed $filename
*/
function ext_check_safe($filename)
{
@@ -49,6 +50,7 @@ function ext_check_safe($filename)
/**
* create htaccess files for uploading folder
* @param mixed $folder
*/
function generate_safety_htaccess($folder)
{
@@ -123,6 +125,10 @@ function make_folder($folder)
/**
* Change the file name depend on given decoding type
* @param mixed $filename
* @param mixed $i_loop
* @param mixed $ext
* @param mixed $decoding_type
*/
function change_filename_decoding($filename, $i_loop, $ext, $decoding_type = '')
{
@@ -151,7 +157,7 @@ function change_filename_decoding($filename, $i_loop, $ext, $decoding_type = '')
// exists before, change it a little
elseif ($decoding_type == 'exists')
{
$return = substr($filename, 0, -(strlen($ext)+1)) . '_' . substr(md5( microtime(true) . $i_loop), rand(0, 20), 5) . '.' . $ext;
$return = substr($filename, 0, -(strlen($ext)+1)) . '_' . substr(md5(microtime(true) . $i_loop), rand(0, 20), 5) . '.' . $ext;
}
//nothing
else
@@ -168,6 +174,7 @@ function change_filename_decoding($filename, $i_loop, $ext, $decoding_type = '')
/**
* Change the file name depend on used templates {rand:..} {date:..}
* @param mixed $filename
*/
function change_filename_templates($filename)
{
@@ -191,6 +198,9 @@ function change_filename_templates($filename)
/**
* check mime type of uploaded file
* @return bool
* @param mixed $given_file_mime
* @param mixed $file_ext
* @param mixed $file_path
*/
function check_mime_type($given_file_mime, $file_ext, $file_path)
{
@@ -276,6 +286,7 @@ function check_mime_type($given_file_mime, $file_ext, $file_path)
/**
* to prevent flooding at uploading
* @param mixed $user_id
*/
function user_is_flooding($user_id = '-1')
{

View File

@@ -19,11 +19,15 @@ if (! defined('IN_COMMON'))
/**
* bring the file size from remote file; aka url
* @param mixed $url
* @param mixed $method
* @param mixed $data
* @param mixed $redirect
*/
function get_remote_file_size($url, $method = 'GET', $data = '', $redirect = 10)
{
$url = parse_url($url);
$fp = @fsockopen ($url['host'], (! empty($url['port']) ? (int) $url['port'] : 80), $errno, $errstr, 30);
$fp = @fsockopen($url['host'], (! empty($url['port']) ? (int) $url['port'] : 80), $errno, $errstr, 30);
if ($fp)
{
@@ -35,12 +39,12 @@ function get_remote_file_size($url, $method = 'GET', $data = '', $redirect = 10)
$header .= "\r\nContent-Length: " . strlen($data);
}
fputs ($fp, $method . ' ' . $path . ' HTTP/1.0' . $header . "\r\n\r\n" . ('post' == strtolower($method) ? $data : ''));
fputs($fp, $method . ' ' . $path . ' HTTP/1.0' . $header . "\r\n\r\n" . ('post' == strtolower($method) ? $data : ''));
if (! feof($fp))
{
$scheme = fgets($fp);
list(, $code ) = explode(' ', $scheme);
list(, $code) = explode(' ', $scheme);
$headers = ['Scheme' => $scheme];
}

View File

@@ -76,18 +76,18 @@ function helper_thumb($source_path, $ext, $dest_image, $dw, $dh)
switch ($ext)
{
case 'gif':
$source_gdim = imagecreatefromgif( $source_path );
$source_gdim = imagecreatefromgif($source_path);
break;
case 'jpg':
case 'jpeg':
$source_gdim = imagecreatefromjpeg( $source_path );
$source_gdim = imagecreatefromjpeg($source_path);
break;
case 'png':
$source_gdim = imagecreatefrompng( $source_path );
$source_gdim = imagecreatefrompng($source_path);
break;
@@ -98,7 +98,7 @@ function helper_thumb($source_path, $ext, $dest_image, $dw, $dh)
define('BMP_CLASS_INCLUDED', true);
}
$source_gdim = imagecreatefrombmp( $source_path );
$source_gdim = imagecreatefrombmp($source_path);
break;
}
@@ -123,7 +123,7 @@ function helper_thumb($source_path, $ext, $dest_image, $dw, $dh)
}
// Resize the image into a temporary GD image
$temp_gdim = imagecreatetruecolor( $temp_width, $temp_height );
$temp_gdim = imagecreatetruecolor($temp_width, $temp_height);
imagecopyresampled(
$temp_gdim,
@@ -189,6 +189,10 @@ function helper_thumb($source_path, $ext, $dest_image, $dw, $dh)
/**
* generating thumb from image using Imagick
*
* @param mixed $x
* @param mixed $y
* @param mixed $cx
* @param mixed $cy
*/
function scale_image_imagick($x, $y, $cx, $cy)
{

View File

@@ -146,9 +146,9 @@ function helper_watermark_imagick($name, $ext, $logo)
//how big are the images?
$iWidth = $im->getImageWidth();
$iHeight= $im->getImageHeight();
$iHeight = $im->getImageHeight();
$wWidth = $watermark->getImageWidth();
$wHeight= $watermark->getImageHeight();
$wHeight = $watermark->getImageHeight();
if ($iHeight < $wHeight || $iWidth < $wWidth)
{

View File

@@ -260,8 +260,8 @@ class defaultUploader implements KleejaUploader
$img_html_result .= get_up_tpl_box('image_thumb',
[
'b_title' => $lang['URL_F_THMB'],
'b_url_link'=> kleeja_get_link('image', $file_info),
'b_img_link'=> kleeja_get_link('thumb', $file_info)
'b_url_link' => kleeja_get_link('image', $file_info),
'b_img_link' => kleeja_get_link('thumb', $file_info)
]
);
@@ -276,7 +276,7 @@ class defaultUploader implements KleejaUploader
$img_html_result .= get_up_tpl_box('image',
[
'b_title' => $lang['URL_F_IMG'],
'b_bbc_title'=> $lang['URL_F_BBC'],
'b_bbc_title' => $lang['URL_F_BBC'],
'b_url_link' => kleeja_get_link('image', $file_info),
]
);
@@ -300,7 +300,7 @@ class defaultUploader implements KleejaUploader
$else_html_result = get_up_tpl_box('file',
[
'b_title' => $lang['URL_F_FILE'],
'b_bbc_title'=> $lang['URL_F_BBC'],
'b_bbc_title' => $lang['URL_F_BBC'],
'b_url_link' => kleeja_get_link('file', $file_info),
]
);
@@ -328,14 +328,10 @@ class defaultUploader implements KleejaUploader
* here happens the magic, call this on upload submit
* @param int $uploadType upload from files input or links
*/
public function upload($uploadType)
public function upload()
{
global $usrcp, $config, $lang;
// when $uploadType = 1, then we upload from _file input
// if $uploadType = 2, then we uploading from url which is disabled by default and is buggy
//upload to this folder
$current_uploading_folder = $config['foldername'];
@@ -366,15 +362,8 @@ class defaultUploader implements KleejaUploader
return;
}
//no uploading yet, or just go to index.php, so we have make a new session
if (! $uploadType)
{
unset($_SESSION['FIILES_NOT_DUPLI'], $_SESSION['FIILES_NOT_DUPLI_LINKS']);
}
// is captcha on, and there is uploading going on
if ($captcha_enabled && $uploadType)
if ($captcha_enabled)
{
//captcha is wrong
if (! kleeja_check_captcha())
@@ -394,60 +383,27 @@ class defaultUploader implements KleejaUploader
//detect flooding, TODO fix it or remove it
if ($uploadType == 1 && isset($_SESSION['FIILES_NOT_DUPLI']))
if (isset($_SESSION['FIILES_NOT_DUPLI']))
{
if (! empty($_SESSION['FIILES_NOT_DUPLI']) && $_SESSION['FIILES_NOT_DUPLI'] == sha1(serialize(array_column($_FILES, 'name'))))
{
unset($_SESSION['FIILES_NOT_DUPLI']);
// if(!ip('ajax'))
// {
// redirect('./');
// }
$this->addErrorMessage($lang['U_R_FLOODER']);
return;
}
}
if ($uploadType == 2 && isset($_SESSION['FIILES_NOT_DUPLI_LINKS']))
{
if ($_SESSION['FIILES_NOT_DUPLI_LINKS'] == sha1(serialize($_POST)))
{
unset($_SESSION['FIILES_NOT_DUPLI_LINKS']);
if (! ip('ajax'))
{
redirect('./');
}
$this->addErrorMessage($lang['U_R_FLOODER']);
return;
}
}
// flooding code, making sure every ok session is cleared
if ($uploadType == 1 && sizeof($_FILES) > 0)
if (sizeof($_FILES) > 0)
{
$_SESSION['FIILES_NOT_DUPLI'] = sha1(serialize(array_column($_FILES, 'name')));
}
elseif ($uploadType == 2)
{
$_SESSION['FIILES_NOT_DUPLI_LINKS'] = sha1(serialize($_POST));
}
//now close session to let user open any other page in Kleeja
session_write_close();
// do upload
switch ($uploadType)
{
//uploading from a _files input
default:
case 1:
if (! empty($_FILES['file']['tmp_name']))
{
$_FILES['file'][0] = $_FILES['file'];
@@ -527,28 +483,6 @@ class defaultUploader implements KleejaUploader
$this->uploadTypeFile($i, $current_uploading_folder, $current_user_id);
}
break;
//uploading from a url text-input
case 2:
//if not enabled, quit it
if ($config['www_url'] != 1)
{
break;
}
//loop text inputs
for ($i=0; $i<=$this->getUploadFieldsLimit(); $i++)
{
$this->uploadTypeUrl($i, $current_uploading_folder, $current_user_id);
}
break;
}
// well, no file uploaded, ask user to choose a file before submit
if ($this->total_uploaded_files == 0 && sizeof($this->messages) == 0)
@@ -648,7 +582,7 @@ class defaultUploader implements KleejaUploader
}
}
// bad chars in the filename
elseif (preg_match ("#[\\\/\:\*\?\<\>\|\"]#", $fileInfo['generatedFileName']))
elseif (preg_match("#[\\\/\:\*\?\<\>\|\"]#", $fileInfo['generatedFileName']))
{
$this->addErrorMessage(sprintf($lang['WRONG_F_NAME'], htmlspecialchars($_FILES['file_' . $fieldNumber . '_']['name'])));
}
@@ -689,134 +623,4 @@ class defaultUploader implements KleejaUploader
}
}
}
/**
* upload a file from a URL
* @param $fieldNumber
* @param $current_uploading_folder
* @param $current_user_id
*/
public function uploadTypeUrl($fieldNumber, $current_uploading_folder, $current_user_id)
{
global $config, $lang;
$fileInfo = [
'saveToFolder',
'originalFileName',
'generatedFileName',
'fileSize',
'currentUserId',
'fileExtension'
];
$fileInfo['saveToFolder'] = $current_uploading_folder;
$fileInfo['currentUserId'] = $current_user_id;
if (p('file_' . $fieldNumber . '_') == '' || p('file_' . $fieldNumber . '_') == $lang['PAST_URL_HERE'])
{
return;
}
// get file name
$fileInfo['originalFileName'] = basename(p('file_' . $fieldNumber . '_'));
// file extension, type
$fileExtensions = array_map('strtolower', explode('.', $fileInfo['originalFileName']));
if (sizeof($fileExtensions) > 1 && in_array($fileExtensions[sizeof($fileExtensions)-1], ['html', 'php', 'html']))
{
$fileInfo['fileExtension'] = strtolower($fileExtensions[sizeof($fileExtensions)-2]);
}
elseif (sizeof($fileExtensions) > 0)
{
$fileInfo['fileExtension'] = strtolower($fileExtensions[sizeof($fileExtensions)-1]);
}
else
{
$fileInfo['fileExtension'] = ''; //what to do?
}
// change to another filename depend on kleeja settings
$fileInfo['generatedFileName'] = change_filename_decoding($fileInfo['originalFileName'], $fieldNumber, $fileInfo['fileExtension']);
$fileInfo['generatedFileName'] = change_filename_templates(trim($config['prefixname']) . $fileInfo['generatedFileName']);
is_array($plugin_run_result = Plugins::getInstance()->run('defaultUploader_uploadTypeUrl_1st', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
//forbbiden type ? quit it
if (! in_array(strtolower($fileInfo['fileExtension']), array_keys($this->getAllowedFileExtensions())))
{
if ($current_user_id == '-1')
{
$this->addErrorMessage(
sprintf($lang['FORBID_EXT'], $fileInfo['fileExtension']) .
'<br> <a href="' . ($config['mod_writer'] ? 'register.html' : 'ucp.php?go=register') . '">' .
$lang['REGISTER'] . '</a>'
);
}
// a member
else
{
$this->addErrorMessage(sprintf($lang['FORBID_EXT'], $fileInfo['fileExtension']));
}
}
// file exists before ? quit it
elseif (file_exists($current_uploading_folder . '/' . $fileInfo['generatedFileName']))
{
$this->addErrorMessage(sprintf($lang['SAME_FILE_EXIST'], htmlspecialchars($fileInfo['generatedFileName'])));
}
// no errors, ok, lets upload now
else
{
is_array($plugin_run_result = Plugins::getInstance()->run('defaultUploader_uploadTypeUrl_2nd', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
//no prefix ? http or even ftp, then add one
if (! in_array(strtolower(substr(p('file_' . $fieldNumber . '_'), 0, 4)), ['http', 'ftp:']))
{
$_POST['file_' . $fieldNumber . '_'] = 'http://' . p('file_' . $fieldNumber . '_');
}
//get size, if big quit it
$fileInfo['fileSize'] = get_remote_file_size(p('file_' . $fieldNumber . '_'));
if ($this->getAllowedFileExtensions()[$fileInfo['fileExtension']] > 0 && $fileInfo['fileSize'] >= $this->getAllowedFileExtensions()[$fileInfo['fileExtension']])
{
$this->addErrorMessage(sprintf(
$lang['SIZE_F_BIG'],
p('file_' . $fieldNumber . '_'),
readable_size($this->getAllowedFileExtensions()[$fileInfo['fileExtension']])
));
}
else
{
//get remote data, if no data quit it
$data = fetch_remote_file(
p('file_' . $fieldNumber . '_'),
$current_uploading_folder . '/' . $fileInfo['generatedFileName'],
15,
false,
2,
true
);
if ($data === false)
{
$this->addErrorMessage($lang['URL_CANT_GET']);
}
else
{
$this->saveToDatabase($fileInfo);
}
}
}
}
}

View File

@@ -58,11 +58,11 @@ $uploader->setAllowedFileExtensions($d_groups[$userinfo['group_id']]['exts']);
$uploader->setUploadFieldsLimit($config['filesnum']);
$uploading_type = ip('submitr') ? 1 : (ip('submittxt') ? 2 : false);
if ($uploading_type)
if(ip('submitr'))
{
$uploader->upload($uploading_type);
$uploader->upload();
}

View File

@@ -101,7 +101,7 @@ case 'f':
$check_ok = true;
$advices = $ziparchive_lib = false;
if(! class_exists( 'ZipArchive'))
if (! class_exists('ZipArchive'))
{
$ziparchive_lib = true;
}
@@ -178,7 +178,7 @@ case 'data' :
//check data ...
if (empty(p('sitename')) || empty(p('siteurl')) || empty(p('sitemail'))
|| empty(p('username')) || empty(p('password')) || empty(p('password2')) || empty(p('email')) )
|| empty(p('username')) || empty(p('password')) || empty(p('password2')) || empty(p('email')))
{
echo $lang['EMPTY_FIELDS'];
echo $footer_inst;

View File

@@ -161,7 +161,7 @@ return [
'CONFIG_KLJ_MENUS_GENERAL' => 'خيارات عامة',
'CONFIG_KLJ_MENUS_ALL' => 'عرض كل الخيارات',
'CONFIG_KLJ_MENUS_UPLOAD' => 'اعدادات التحميل',
'CONFIG_KLJ_MENUS_INTERFACE'=> 'خيارات الواجهة والتصميم',
'CONFIG_KLJ_MENUS_INTERFACE' => 'خيارات الواجهة والتصميم',
'CONFIG_KLJ_MENUS_ADVANCED' => 'خيارات متقدمة',
'DELF_CAUTION' => '<small class="delf_caution">تحذير : هذه الخاصية قد تكون خطرة عند وضع ارقام صغيرة أو عند إستخدام الروابط المباشرة.</small>',
'PACKAGE_N_CMPT_KLJ' => 'هذه الإضافة/الستايل غيره متوافقة مع إصدار كليجا الذي تستخدمه ! .',

View File

@@ -163,7 +163,7 @@ return [
'CONFIG_KLJ_MENUS_GENERAL' => 'General settings',
'CONFIG_KLJ_MENUS_ALL' => 'Display all the settings',
'CONFIG_KLJ_MENUS_UPLOAD' => 'Upload settings',
'CONFIG_KLJ_MENUS_INTERFACE'=> 'Interface and design settings',
'CONFIG_KLJ_MENUS_INTERFACE' => 'Interface and design settings',
'CONFIG_KLJ_MENUS_ADVANCED' => 'Advanced settings',
'DELF_CAUTION' => '<small class="delf_caution">Caution: might be dangerous when using small numbers or using direct form of URLS.</small>',
'PACKAGE_N_CMPT_KLJ' => 'This plugin/style is not compatible with your current version of Kleeja.',

View File

@@ -8,7 +8,7 @@
return [
'DIR' => 'ltr',
'INST_INSTALL_WIZARD' => 'Kleeja installing wizard',
'INST_INSTALL_CLEAN_VER'=> 'New Installation',
'INST_INSTALL_CLEAN_VER' => 'New Installation',
'INST_UPDATE_P_VER' => 'Update ',
'INST_AGR_LICENSE' => 'I agree to terms and agreements',
'INST_NEXT' => 'Next',

View File

@@ -43,11 +43,6 @@
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#fileUpload" role="tab">{lang.DOWNLOAD_F}</a>
</li>
<IF NAME="config.www_url == 1">
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#linkUpload" role="tab">{lang.DOWNLOAD_T}</a>
</li>
</IF>
</ul>
</div>
<div class="card-body tab-content">
@@ -67,7 +62,7 @@
</IF>
<!-- files upload tab -->
<!-- files upload -->
<div class="tab-pane active" id="fileUpload" role="tabpanel">
<LOOP NAME=FILES_NUM_LOOP>
@@ -92,25 +87,6 @@
</div>
</div>
<IF NAME="config.www_url == 1">
<!-- links upload tab -->
<div class="tab-pane" id="linkUpload" role="tabpanel">
<LOOP NAME=FILES_NUM_LOOP>
<input class="url form-control mb-2" type="text" name="file_{{i}}_" style="{{show}}" size="70" placeholder="{lang.PAST_URL_HERE}">
</LOOP>
<div>
<br>
<div class="agree text-muted"><small>{terms_msg}</small></div>
<input type="submit" id="submittxt" name="submittxt" value="{lang.DOWNLOAD_T}" class="btn btn-outline-primary">
</div>
</div>
</IF>
</div>
</div>
@@ -123,8 +99,6 @@
<br>
<img src="{STYLE_PATH}images/loading.gif" alt="{lang.LOADING}" />
</div>
</div>
@@ -145,7 +119,4 @@
</IF>
</div>
</IF>
</div>

View File

@@ -32,14 +32,7 @@
<li title="{lang.DOWNLOAD_F}">{lang.DOWNLOAD_F}</li>
<!-- @First-Tab -->
<!-- Second-Tab -->
<IF NAME="config.www_url">
<li title="{lang.DOWNLOAD_T}">{lang.DOWNLOAD_T}</li>
</IF>
<!-- @Second-Tab -->
<!--you-can-add-another-tab-here-->
</ul>
<!-- First-Box -->
@@ -57,23 +50,6 @@
</div>
<!-- @First-Box -->
<!-- Second-Box -->
<IF NAME="config.www_url">
<div class="tabcon" title="{lang.DOWNLOAD_T}">
<div class="go_up">
<!-- upload URL -->
<LOOP NAME=FILES_NUM_LOOP>
<input class="url" type="text" name="file_{{i}}_" style="{{show}}" size="70" value="{lang.PAST_URL_HERE}" />
</LOOP>
<div class="agree"><span>{terms_msg}</span></div>
<div class="bn_up"><input type="submit" id="submittxt" name="submittxt" value="{lang.DOWNLOAD_T}" /> </div>
<div class="clr"></div>
<!-- @upload URL -->
</div>
</div>
</IF>
<!-- @Second-Box -->
<!--you-can-add-another-box-here-->
</div>

22
ucp.php
View File

@@ -371,7 +371,7 @@ switch (g('go'))
$linkgoto = $config['siteurl'] . (
$config['mod_writer']
? 'fileuser-' . $user_id . ($currentPage > 1 && $currentPage <= $total_pages ? '-' . $currentPage : '') . '.html'
: 'ucp.php?go=fileuser' . ( ig('id') ? ( g('id', 'int') == $usrcp->id() ? '' : '&amp;id=' . g('id') ) : null )
: 'ucp.php?go=fileuser' . (ig('id') ? (g('id', 'int') == $usrcp->id() ? '' : '&amp;id=' . g('id')) : null)
);
$page_nums = $Pager->print_nums(str_replace('.html', '', $linkgoto));
@@ -430,7 +430,7 @@ switch (g('go'))
'href' => $url,
'size' => readable_size($row['size']),
'time' => ! empty($row['time']) ? kleeja_date($row['time']) : '...',
'thumb_link'=> $is_image ? $url_thumb : $url_fileuser,
'thumb_link' => $is_image ? $url_thumb : $url_fileuser,
'is_image' => $is_image,
];
@@ -449,12 +449,12 @@ switch (g('go'))
if ($_POST['del_' . $row['id']])
{
//delete from folder ..
@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'];
@@ -479,12 +479,12 @@ switch (g('go'))
//delete all files
foreach ($arr as $row)
{
@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'];
@@ -778,7 +778,7 @@ switch (g('go'))
$npass = $npass['new_password'];
//password now will be same as new password
$update_query = [
'UPDATE'=> "{$dbprefix}users",
'UPDATE' => "{$dbprefix}users",
'SET' => "password = '" . $npass . "', new_password = '', hash_key = ''",
'WHERE' => 'id=' . $u_id,
];
@@ -850,7 +850,7 @@ switch (g('go'))
if (empty($ERRORS))
{
$query = [
'SELECT'=> 'u.*',
'SELECT' => 'u.*',
'FROM' => "{$dbprefix}users u",
'WHERE' => "u.mail='" . $SQL->escape(strtolower(trim(p('rmail')))) . "'"
];
@@ -877,7 +877,7 @@ switch (g('go'))
$message = "\n " . $lang['WELCOME'] . ' ' . $row['name'] . "\r\n " . sprintf($lang['GET_LOSTPASS_MSG'], $activation_link, $newpass) . "\r\n\r\n kleeja.com";
$update_query = [
'UPDATE'=> "{$dbprefix}users",
'UPDATE' => "{$dbprefix}users",
'SET' => "new_password = '" . $SQL->escape($pass) . "', hash_key = '" . $hash_key . "'",
'WHERE' => 'id=' . $row['id'],
];