$big_size_is = isset($u_e_s[0]['size']) && $u_e_s[0]['size'] > $g_e_s[0]['size'] ? $u_e_s[0]['size'] : (isset($g_e_s[0]['size']) ? $g_e_s[0]['size'] : 0); if (!empty($upload_max_filesize) && $upload_max_filesize_s < $big_size_is) { $ADM_NOTIFICATIONS[] = array('id' => 'file_size_ini_low', 'msg_type' => 'info', 'title' => $lang['NOTE'], 'msg' => sprintf($lang['PHPINI_FILESIZE_SMALL'], Customfile_size($big_size_is), Customfile_size($upload_max_filesize_s))); } //check post_max_size if (strpos($post_max_size, 'M') !== false) { $post_max_size_s = (int) trim(str_replace('M', '', $post_max_size)) * 1048576; } else { if (strpos($post_max_size, 'G') !== false) { $post_max_size_s = (int) trim(str_replace('G', '', $post_max_size)) * 1073741824; } } $post_max_size_s_must_be = $config['filesnum'] * $big_size_is + 5242880; //+ 5 mega to make sure it's ok if (!empty($post_max_size) && $post_max_size_s < $post_max_size_s_must_be) { $ADM_NOTIFICATIONS[] = array('id' => 'post_m_size_ini_low', 'msg_type' => 'info', 'title' => $lang['NOTE'], 'msg' => sprintf($lang['PHPINI_MPOSTSIZE_SMALL'], $config['filesnum'], Customfile_size($post_max_size_s_must_be))); } } // // check for update // if 24 hours, lets chcek agian ! //rev: let's say cache is not refreshed, so we will redirect alots of time, // so update_done will be good solution // if (empty($v['last_check']) || time() - $v['last_check'] > 86400 && !$v['msg_appeared'] && $_SERVER['SERVER_NAME'] != 'localhost' && !isset($_GET['update_done'])) { redirect(ADMIN_PATH . '?cp=check_update&show_msg=1'); $SQL->close(); exit; } # show note: cached templates, deprecated #$there_is_cached = false;
kleeja_info($lang['STATS_CLOSED'], $lang['STATS_CLOSED']); } //stats of most online users if (empty($config['most_user_online_ever']) || trim($config['most_user_online_ever']) == '') { $most_online = 1; // 1 == you $on_muoe = time(); } else { list($most_online, $on_muoe) = @explode(':', $config['most_user_online_ever']); } //ok .. go on $titlee = $lang['STATS']; $stylee = 'stats'; $files_st = $stat_files; $users_st = $stat_users; $sizes_st = Customfile_size($stat_sizes); $lst_dl_st = (int) $config['del_f_day'] <= 0 ? ' [ ' . $lang['CLOSED_FEATURE'] . ' ] ' : gmdate('d-m-Y h:i a', $stat_last_f_del); $lst_reg = empty($stat_last_user) ? $lang['UNKNOWN'] : $stat_last_user; $on_muoe = date('d-m-Y h:i a', $on_muoe); ($hook = kleeja_run_hook('stats_go_page')) ? eval($hook) : null; //run hook break; // // Page for redirect to downloading a file // [!] depreacted from 1rc6+, see do.php // // // Page for redirect to downloading a file // [!] depreacted from 1rc6+, see do.php // case 'down':
} #set form ket $GET_FORM_KEY = kleeja_add_form_key_get('REPAIR_FORM_KEY'); //check _GET Csrf token if ($case && in_array($case, array('clearc', 'sync_files', 'sync_images', 'sync_users', 'tables', 'sync_sizes', 'status_file'))) { if (!kleeja_check_form_key_get('REPAIR_FORM_KEY')) { kleeja_admin_err($lang['INVALID_GET_KEY'], true, $lang['ERROR'], true, basename(ADMIN_PATH), 2); } } switch ($case) { default: # Get real number from database right now $all_files = get_actual_stats('files'); $all_images = get_actual_stats('imgs'); $all_users = get_actual_stats('users'); $all_sizes = Customfile_size(get_actual_stats('sizes')); #links $del_cache_link = basename(ADMIN_PATH) . '?cp=r_repair&case=clearc&' . $GET_FORM_KEY; $resync_files_link = $config['siteurl'] . 'go.php?go=resync&case=sync_files'; $resync_images_link = $config['siteurl'] . 'go.php?go=resync&case=sync_images'; $resync_users_link = basename(ADMIN_PATH) . '?cp=r_repair&case=sync_users&' . $GET_FORM_KEY; $resync_sizes_link = basename(ADMIN_PATH) . '?cp=r_repair&case=sync_sizes&' . $GET_FORM_KEY; $repair_tables_link = basename(ADMIN_PATH) . '?cp=r_repair&case=tables&' . $GET_FORM_KEY; $status_file_link = basename(ADMIN_PATH) . '?cp=r_repair&case=status_file&' . $GET_FORM_KEY; $stylee = "admin_repair"; break; // We, I mean developrts and support team anywhere, need sometime // some inforamtion about the status of Kleeja .. this will give // a zip file contain those data .. // We, I mean developrts and support team anywhere, need sometime // some inforamtion about the status of Kleeja .. this will give
$num = 0; #if Kleeja integtared we dont want make alot of queries $ids_and_names = array(); while ($row = $SQL->fetch_array($result)) { $userfile = $config['siteurl'] . ($config['mod_writer'] ? 'fileuser-' . $row['user'] . '.html' : 'ucp.php?go=fileuser&id=' . $row['user']); #for username in integrated user system if ($row['user'] != '-1' and (int) $config['user_system'] != 1) { if (!in_array($row['user'], $ids_and_names)) { $row['username'] = $usrcp->usernamebyid($row['user']); $ids_and_names[$row['user']] = $row['username']; } else { $row['username'] = $ids_and_names[$row['user']]; } } //make new lovely arrays !! $arr[] = array('id' => $row['id'], 'name' => "<a title=\" " . ($row['real_filename'] == '' ? $row['name'] : $row['real_filename']) . "\" href=\"./" . PATH . $row['folder'] . "/" . $row['name'] . "\" target=\"blank\">" . ($row['real_filename'] == '' ? strlen($row['name']) > 20 ? substr($row['name'], 0, 20) . '...' : $row['name'] : (strlen($row['real_filename']) > 20 ? substr($row['real_filename'], 0, 20) . '...' : $row['real_filename'])) . "</a>", 'size' => Customfile_size($row['size']), 'ups' => $row['uploads'], 'time' => date('d-m-Y H:i a', $row['time']), 'type' => $row['type'], 'folder' => $row['folder'], 'report' => $row['report'] > 4 ? "<span style=\"color:red;font-weight:bold\">" . $row['report'] . "</span>" : $row['report'], 'user' => $row['user'] == '-1' ? $lang['GUST'] : '<a href="' . $userfile . '" target="_blank">' . $row['username'] . '</a>', 'ip' => '<a href="http://www.ripe.net/whois?form_type=simple&full_query_string=&searchtext=' . $row['user_ip'] . '&do_search=Search" target="_new">' . $row['user_ip'] . '</a>', 'showfilesbyip' => basename(ADMIN_PATH) . '?cp=' . basename(__FILE__, '.php') . '&search=' . kleeja_base64_encode(serialize(array('user_ip' => $row['user_ip'])))); $del[$row['id']] = isset($_POST['del_' . $row['id']]) ? $_POST['del_' . $row['id']] : ''; //when submit if (isset($_POST['submit'])) { if ($del[$row['id']]) { //delete from folder .. @kleeja_unlink(PATH . $row['folder'] . '/' . $row['name']); //delete thumb if (is_file($row['folder'] . '/thumbs/' . $row['name'])) { @kleeja_unlink(PATH . $row['folder'] . '/thumbs/' . $row['name']); } $ids[] = $row['id']; $num++; $sizes += $row['size']; } }
} if (!empty($config['livexts'])) { $livexts = explode(',', $config['livexts']); if (in_array($type, $livexts)) { if (isset($_GET['filename'])) { $url_filex = $config['mod_writer'] ? $config['siteurl'] . "downexf-" . $fname2 . ".html" : $config['siteurl'] . "do.php?downexf=" . $fname; } else { $url_filex = $config['mod_writer'] ? $config['siteurl'] . "downex-" . $id . ".html" : $config['siteurl'] . "do.php?downex=" . $id; } redirect($url_filex, false); } } $REPORT = $config['mod_writer'] ? $config['siteurl'] . "report-" . $id . ".html" : $config['siteurl'] . "go.php?go=report&id=" . $id; $seconds_w = $config['sec_down']; $time = date("d-m-Y H:i a", $time); $size = Customfile_size($size); $file_ext_icon = file_exists('images/filetypes/' . $type . '.png') ? 'images/filetypes/' . $type . '.png' : 'images/filetypes/file.png'; $sty = 'download'; $title = $name . ' ' . $lang['DOWNLAOD']; } else { //file not exists ($hook = kleeja_run_hook('not_exists_qr_downlaod_file')) ? eval($hook) : null; //run hook kleeja_err($lang['FILE_NO_FOUNDED']); } ($hook = kleeja_run_hook('b4_showsty_downlaod_id_filename')) ? eval($hook) : null; //run hook //add http reffer to session to prevent errors with some browsers ! if (isset($_GET['filename'])) { $_SESSION['HTTP_REFERER'] = $config['siteurl'] . ($config['mod_writer'] ? "downloadf" . $fname . ".html" : "do.php?filename=" . $fname); } else {
#if Kleeja integtared we dont want make alot of queries $ids_and_names = array(); while ($row = $SQL->fetch_array($result)) { //thumb ? $is_there_thumb = file_exists(PATH . $row['folder'] . '/thumbs/' . $row['name']) ? true : false; #for username in integrated user system if ($row['user'] != '-1' and (int) $config['user_system'] != 1) { if (!in_array($row['user'], $ids_and_names)) { $row['username'] = $usrcp->usernamebyid($row['user']); $ids_and_names[$row['user']] = $row['username']; } else { $row['username'] = $ids_and_names[$row['user']]; } } //make new lovely arrays !! $arr[] = array('id' => $row['id'], 'tdnum' => $tdnum == 0 ? '<ul>' : '', 'tdnum2' => $tdnum == 4 ? '</ul>' : '', 'name' => $row['real_filename'] == '' ? strlen($row['name']) > 25 ? substr($row['name'], 0, 20) . '...' : $row['name'] : (strlen($row['real_filename']) > 20 ? str_replace('\'', "\\'", substr($row['real_filename'], 0, 20)) . '...' : str_replace('\'', "\\'", $row['real_filename'])), 'ip' => htmlspecialchars($row['user_ip']), 'href' => PATH . $row['folder'] . '/' . $row['name'], 'size' => Customfile_size($row['size']), 'ups' => $row['uploads'], '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, 'is_thumb' => $is_there_thumb, 'thumb_link' => $is_there_thumb ? PATH . $row['folder'] . '/thumbs/' . $row['name'] : PATH . $row['folder'] . '/' . $row['name']); //fix ... $tdnum = $tdnum == 4 ? 0 : $tdnum + 1; $del[$row['id']] = isset($_POST['del_' . $row['id']]) ? $_POST['del_' . $row['id']] : ''; /* //when submit !! if (isset($_POST['submit'])) { if ($del[$row['id']]) { //delete from folder .. @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'] );
/** * Processing current upload, aka 'after user click upload button to upload his files' */ function process() { global $SQL, $dbprefix, $config, $lang; ($hook = kleeja_run_hook('kljuploader_process_func')) ? eval($hook) : null; //run hook # check folder our real folder if (!file_exists($this->folder)) { if (!make_folder($this->folder)) { $this->messages[] = array($lang['CANT_DIR_CRT'], 'index_err'); } } # check the live-exts-folder, live exts plugin codes if (!empty($config['imagefolderexts']) && !file_exists($config['imagefolder'])) { if (!make_folder($config['imagefolder'])) { $this->messages[] = array($lang['CANT_DIR_CRT'], 'index_err'); } } # when uploading_type = 1, then we upload from _file input # if uploading_type = 2, then we uploading from url which is disabled by default and is buggy $uploading_type = isset($_POST['submitr']) ? 1 : (isset($_POST['submittxt']) ? 2 : false); # add your uploading_type through the hook ($hook = kleeja_run_hook('kljuploader_process_func_uploading_type')) ? eval($hook) : null; //run hook #no uploading yet, or just go to index.php, so we have make a new session if (!$uploading_type) { unset($_SESSION['FIILES_NOT_DUPLI'], $_SESSION['FIILES_NOT_DUPLI_LINKS']); } # is captcha on, and there is uploading going on if ($this->safe_code && $uploading_type) { #captcha is wrong if (!kleeja_check_captcha()) { return $this->messages[] = array($lang['WRONG_VERTY_CODE'], 'index_err'); } } # to prevent flooding, user must wait, waiting-time is grapped from Kleeja settings, admin is exceptional if (!$this->user_is_adm && user_is_flooding($this->id_user)) { return $this->messages[] = array(sprintf($lang['YOU_HAVE_TO_WAIT'], $this->id_user == '-1' ? $config['guestsectoupload'] : $config['usersectoupload']), 'index_err'); } # flooading .. if ($uploading_type == 1 && isset($_SESSION['FIILES_NOT_DUPLI'])) { for ($i = 0; $i <= $this->filesnum; $i++) { if (!empty($_SESSION['FIILES_NOT_DUPLI']['file_' . $i . '_']['name']) && !empty($_FILES['file_' . $i . '_']['name']) && $_SESSION['FIILES_NOT_DUPLI']['file_' . $i . '_']['name'] == $_FILES['file_' . $i . '_']['name']) { redirect('./'); } } } if ($uploading_type == 2 && isset($_SESSION['FIILES_NOT_DUPLI_LINKS'])) { for ($i = 0; $i <= $this->filesnum; $i++) { if (!empty($_SESSION['FIILES_NOT_DUPLI_LINKS']['file_' . $i . '_']) && !empty($_POST['file_' . $i . '_']) && trim($_POST['file_' . $i . '_']) != $lang['PAST_URL_HERE'] && trim($_SESSION['FIILES_NOT_DUPLI_LINKS']['file_' . $i . '_']) != $lang['PAST_URL_HERE'] && $_SESSION['FIILES_NOT_DUPLI_LINKS']['file_' . $i . '_'] == $_POST['file_' . $i . '_']) { redirect('./'); } } } # flooding code, making sure every ok session is cleared if (isset($_POST['submitr'])) { if (isset($_SESSION['FIILES_NOT_DUPLI'])) { unset($_SESSION['FIILES_NOT_DUPLI']); } $_SESSION['FIILES_NOT_DUPLI'] = $_FILES; } elseif (isset($_POST['submittxt'])) { if (isset($_SESSION['FIILES_NOT_DUPLI_LINKS'])) { unset($_SESSION['FIILES_NOT_DUPLI_LINKS']); } $_SESSION['FIILES_NOT_DUPLI_LINKS'] = $_POST; } #now close session to let user open any other page in Kleeja @session_write_close(); # uploading process, empty check-list for now $check = false; # add your uploading_type through the hook ($hook = kleeja_run_hook('kljuploader_process_func_uploading_type_later')) ? eval($hook) : null; //run hook # do upload switch ($uploading_type) { #uploading from a _files input case 1: ($hook = kleeja_run_hook('kljuploader_process_func_uploading_type_1')) ? eval($hook) : null; //run hook # loop the uploaded files for ($i = 0; $i <= $this->filesnum; $i++) { //no file! if (empty($_FILES['file_' . $i . '_']['tmp_name'])) { continue; } # file name $this->filename = isset($_FILES['file_' . $i . '_']['name']) ? htmlspecialchars(str_replace(array(';', ','), '', $_FILES['file_' . $i . '_']['name'])) : ''; # add the file to the check-list $check .= isset($_FILES['file_' . $i . '_']['name']) ? $_FILES['file_' . $i . '_']['name'] : ''; # get the extension of file $this->typet = strtolower(array_pop(explode('.', $this->filename))); # them the size $this->sizet = !empty($_FILES['file_' . $i . '_']['size']) ? intval($_FILES['file_' . $i . '_']['size']) : null; # get the other filename, changed depend on kleeja settings $this->filename2 = change_filename_decoding($this->filename, $i, $this->typet, $this->decode); # filename templates {rand:..}, {date:..} $this->filename2 = change_filename_templates(trim($this->prefix) . $this->filename2); ($hook = kleeja_run_hook('kljuploader_process_func_uploading_type_1_loop')) ? eval($hook) : null; //run hook # file exists before? change it a little if (file_exists($this->folder . '/' . $this->filename2)) { $this->filename2 = change_filename_decoding($this->filename2, $i, $this->typet, 'exists'); } # now, let process it if (!in_array(strtolower($this->typet), array_keys($this->types))) { # guest if ($this->id_user == '-1') { $this->messages[] = array(sprintf($lang['FORBID_EXT'], $this->typet) . '<br /> <a href="' . ($config['mod_writer'] ? "register.html" : "ucp.php?go=register") . '" title="' . htmlspecialchars($lang['REGISTER']) . '">' . $lang['REGISTER'] . '</a>', 'index_err'); } else { $this->messages[] = array(sprintf($lang['FORBID_EXT'], $this->typet), 'index_err'); } } elseif (preg_match("#[\\\\/\\:\\*\\?\\<\\>\\|\"]#", $this->filename2)) { $this->messages[] = array(sprintf($lang['WRONG_F_NAME'], htmlspecialchars($_FILES['file_' . $i . '_']['name'])), 'index_err'); } elseif (ext_check_safe($_FILES['file_' . $i . '_']['name']) == false) { $this->messages[] = array(sprintf($lang['WRONG_F_NAME'], htmlspecialchars($_FILES['file_' . $i . '_']['name'])), 'index_err'); } elseif (check_mime_type($_FILES['file_' . $i . '_']['type'], in_array(strtolower($this->typet), array('gif', 'png', 'jpg', 'jpeg', 'bmp')), $_FILES['file_' . $i . '_']['tmp_name']) == false) { $this->messages[] = array(sprintf($lang['NOT_SAFE_FILE'], htmlspecialchars($_FILES['file_' . $i . '_']['name'])), 'index_err'); } elseif ($this->types[strtolower($this->typet)] > 0 && $this->sizet >= $this->types[strtolower($this->typet)]) { $this->messages[] = array(sprintf($lang['SIZE_F_BIG'], htmlspecialchars($_FILES['file_' . $i . '_']['name']), Customfile_size($this->types[strtolower($this->typet)])), 'index_err'); } else { ($hook = kleeja_run_hook('kljuploader_process_func_uploading_type_1_loop_upload')) ? eval($hook) : null; //run hook #if this is listed as live-ext from Kleeja settings $live_exts = array_map('trim', explode(',', $config['imagefolderexts'])); $folder_to_upload = $this->folder; if (in_array(strtolower($this->typet), $live_exts)) { # live-exts folder, if empty use default folder $folder_to_upload = trim($config['imagefolder']) == '' ? trim($config['foldername']) : trim($config['imagefolder']); # change to time decoding for filename if ((int) $config['imagefoldere']) { //$this->filename2 = change_filename_decoding($this->filename2, $i, $this->typet, 'time'); } } # now, upload the file $file = move_uploaded_file($_FILES['file_' . $i . '_']['tmp_name'], $folder_to_upload . "/" . $this->filename2); if ($file) { $this->saveit($this->filename2, $folder_to_upload, $this->sizet, $this->typet, $this->filename); } else { $this->messages[] = array(sprintf($lang['CANT_UPLAOD'], $this->filename2), 'index_err'); } } } #loop # well, there is no file uploaded if (!isset($check) || empty($check)) { $this->messages[] = array($lang['CHOSE_F'], 'index_err'); } break; #uploading from a url text-input #uploading from a url text-input case 2: #if not enabled, quit it if ((int) $config['www_url'] != '1') { break; } ($hook = kleeja_run_hook('kljuploader_process_func_uploading_type_2')) ? eval($hook) : null; //run hook #loop text inputs for ($i = 0; $i <= $this->filesnum; $i++) { # get file name $this->filename = isset($_POST['file_' . $i . '_']) ? basename(htmlspecialchars($_POST['file_' . $i . '_'])) : ''; //print $this->filename; # add it to the check-list $check .= isset($_POST['file_' . $i . '_']) && trim($_POST['file_' . $i . '_']) != $lang['PAST_URL_HERE'] ? $_POST['file_' . $i . '_'] : ''; # file extension, type $this->typet = explode(".", $this->filename); if (in_array($this->typet[count($this->typet) - 1], array('html', 'php', 'html'))) { $this->typet = strtolower($this->typet[count($this->typet) - 2]); } else { $this->typet = strtolower($this->typet[count($this->typet) - 1]); } # change to another filename depend on kleeja settings $this->filename2 = change_filename_decoding($this->filename, $i, $this->typet, $this->decode); $this->filename2 = change_filename_templates(trim($this->prefix) . $this->filename2); ($hook = kleeja_run_hook('kljuploader_process_func_uploading_type_2_loop')) ? eval($hook) : null; //run hook # process is begun if (empty($_POST['file_' . $i . '_']) || trim($_POST['file_' . $i . '_']) == $lang['PAST_URL_HERE']) { #if empty is not big deal, it's a multi-text-input, remember? } elseif (!in_array(strtolower($this->typet), array_keys($this->types))) { $this->messages[] = array(sprintf($lang['FORBID_EXT'], htmlspecialchars($_POST['file_' . $i . '_']), $this->typet), 'index_err'); } elseif (file_exists($this->folder . '/' . $this->filename2)) { $this->messages[] = array(sprintf($lang['SAME_FILE_EXIST'], htmlspecialchars($this->filename2)), 'index_err'); } else { ($hook = kleeja_run_hook('kljuploader_process_func_uploading_type_2_loop_upload')) ? eval($hook) : null; //run hook #if this is listed as live-ext from Kleeja settings $live_exts = explode(',', $config['imagefolderexts']); $folder_to_upload = $this->folder; if (in_array(strtolower($this->typet), $live_exts)) { # live-exts folder, if empty use default folder $folder_to_upload = trim($config['imagefolder']) == '' ? trim($config['foldername']) : trim($config['imagefolder']); # change to time decoding for filename if ((int) $config['imagefoldere']) { //$this->filename2 = change_filename_decoding($this->filename2, $i, $this->typet, 'time'); } } #no prefix ? http or even ftp, then add one if (!in_array(substr($_POST['file_' . $i . '_'], 0, 4), array('http', 'ftp:'))) { $_POST['file_' . $i . '_'] = 'http://' . $_POST['file_' . $i . '_']; } #get size, if big quit it $this->sizet = get_remote_file_size($_POST['file_' . $i . '_']); if ($this->types[strtolower($this->typet)] > 0 && $this->sizet >= $this->types[strtolower($this->typet)]) { $this->messages[] = array(sprintf($lang['SIZE_F_BIG'], htmlspecialchars($_POST['file_' . $i . '_']), Customfile_size($this->types[strtolower($this->typet)])), 'index_err'); } else { #get remote data, if no data quit it $data = fetch_remote_file($_POST['file_' . $i . '_'], $folder_to_upload . "/" . $this->filename2, 6, false, 2, true); if ($data === false) { $this->messages[] = array($lang['URL_CANT_GET'], 'index_err'); } else { $this->saveit($this->filename2, $folder_to_upload, $this->sizet, $this->typet); } } } #else } #end loop # if not file uploaded as the check-list said, then show error if (!isset($check) || empty($check)) { $this->messages[] = array($lang['CHOSE_F'], 'index_err'); } break; default: ($hook = kleeja_run_hook('kljuploader_process_switch_default_func')) ? eval($hook) : null; //run hook } #end switch }
function process() { global $SQL, $dbprefix, $config, $lang; global $use_ftp, $ftp_server, $ftp_user, $ftp_pass, $ch; ($hook = kleeja_run_hook('start_process_kljuploader')) ? eval($hook) : null; //run hook //check prefix if (preg_match("/{rand:([0-9]+)}/i", $this->filename, $m)) { $this->filename = preg_replace("/{rand:([0-9]+)}/i", substr(md5(time()), 0, $m[1]), $this->filename); } if (preg_match("/{date:([a-zA-Z-_]+)}/i", $this->filename, $m)) { $this->filename = preg_replace("/{date:([a-zA-Z-_]+)}/i", date($m[1]), $this->filename); } ($hook = kleeja_run_hook('no_folder_check_kljuploader')) ? eval($hook) : null; //run hook // check folder if (!file_exists($this->folder)) { ($hook = kleeja_run_hook('no_uploadfolder_kljuploader')) ? eval($hook) : null; //run hook $jadid = mkdir($this->folder); $jadid2 = mkdir($this->folder . '/thumbs'); if ($jadid) { $this->errs[] = array($lang['NEW_DIR_CRT'], 'index_info'); $htaccess_data = "<Files ~ \"^.*\\.(php|php*|cgi|pl|phtml|shtml|sql|asp|aspx)\">\nOrder allow,deny\nDeny from all\n</Files>\n<IfModule mod_php4.c>\nphp_flag engine off\n</IfModule>\n<IfModule mod_php5.c>\nphp_flag engine off\n</IfModule>\nRemoveType .php .php* .phtml .pl .cgi .asp .aspx .sql"; $fo = @fopen($this->folder . "/index.html", "w"); $fo2 = @fopen($this->folder . "/thumbs/index.html", "w"); $fw = @fwrite($fo, '<a href="http://kleeja.com"><p>KLEEJA ..</p></a>'); $fw2 = @fwrite($fo2, '<a href="http://kleeja.com"><p>KLEEJA ..</p></a>'); $fi = @fopen($this->folder . "/.htaccess", "w"); $fi2 = @fopen($this->folder . "/thumbs/.htaccess", "w"); $fy = @fwrite($fi, $htaccess_data); $fy2 = @fwrite($fi2, $htaccess_data); $chmod = @chmod($this->folder, 0777); $chmod2 = @chmod($this->folder . '/thumbs/', 0777); if (!$chmod) { $this->errs[] = array($lang['PR_DIR_CRT'], 'index_err'); } } else { $this->errs[] = array($lang['CANT_DIR_CRT'], 'index_err'); } } //then wut did u click $wut = false; //clicked, _file uploading if (isset($_POST['submitr'])) { $wut = 1; } elseif (isset($_POST['submittxt'])) { $wut = 2; } //add your clicked actions ($hook = kleeja_run_hook('another_wut_kljuploader')) ? eval($hook) : null; //run hook if (!$wut) { //no uploading yet, or just go to index.php, so we have make a new session unset($_SESSION['FIILES_NOT_DUPLI'], $_SESSION['FIILES_NOT_DUPLI_LINKS']); } //safe_code .. captcha is on if ($this->safe_code && $wut) { if (!kleeja_check_captcha()) { ($hook = kleeja_run_hook('wrong_captcha_kljuploader_w1')) ? eval($hook) : null; //run hook return $this->errs[] = array($lang['WRONG_VERTY_CODE'], 'index_err'); } } if (!$this->user_is_adm && $this->user_is_flooding()) { return $this->errs[] = array(sprintf($lang['YOU_HAVE_TO_WAIT'], $this->id_user == '-1' ? $config['guestsectoupload'] : $config['usersectoupload']), 'index_err'); } if ($wut == 1 && isset($_SESSION['FIILES_NOT_DUPLI'])) { for ($i = 0; $i <= $this->filesnum; $i++) { if (!empty($_SESSION['FIILES_NOT_DUPLI']['file_' . $i . '_']['name']) && !empty($_FILES['file_' . $i . '_']['name']) && $_SESSION['FIILES_NOT_DUPLI']['file_' . $i . '_']['name'] == $_FILES['file_' . $i . '_']['name']) { redirect('./'); //return $this->errs[] = array($lang['NO_REPEATING_UPLOADING'], 'index_err'); } } } if ($wut == 2 && isset($_SESSION['FIILES_NOT_DUPLI_LINKS'])) { for ($i = 0; $i <= $this->filesnum; $i++) { if (!empty($_SESSION['FIILES_NOT_DUPLI_LINKS']['file_' . $i . '_']) && !empty($_POST['file_' . $i . '_']) && trim($_POST['file_' . $i . '_']) != $lang['PAST_URL_HERE'] && trim($_SESSION['FIILES_NOT_DUPLI_LINKS']['file_' . $i . '_']) != $lang['PAST_URL_HERE'] && $_SESSION['FIILES_NOT_DUPLI_LINKS']['file_' . $i . '_'] == $_POST['file_' . $i . '_']) { redirect('./'); //return $this->errs[] = array($lang['NO_REPEATING_UPLOADING'], 'index_err'); } } } // uploading process $check = false; //add your hook here, if wut == 'my_action' ... ($hook = kleeja_run_hook('wuts_processes_kljuploader')) ? eval($hook) : null; //run hook if ($wut == 1) { ($hook = kleeja_run_hook('submit_filesupload_kljuploader')) ? eval($hook) : null; //run hook for ($i = 0; $i <= $this->filesnum; $i++) { $check .= isset($_FILES['file_' . $i . '_']['name']) ? $_FILES['file_' . $i . '_']['name'] : ''; $this->filename2 = @explode(".", $_FILES['file_' . $i . '_']['name']); $this->filename2 = strtolower($this->filename2[sizeof($this->filename2) - 1]); $this->typet = $this->filename2; $this->sizet = !empty($_FILES['file_' . $i . '_']['size']) ? $_FILES['file_' . $i . '_']['size'] : null; ($hook = kleeja_run_hook('for_wut1_filesupload_kljuploader')) ? eval($hook) : null; //run hook // decoding if ($this->decode == "time") { $zaid = time(); $this->filename2 = $this->filename . $zaid . $i . "." . $this->filename2; } elseif ($this->decode == "md5") { $zaid = md5(time()); $zaid = substr($zaid, 0, 10); $this->filename2 = $this->filename . $zaid . $i . "." . $this->filename2; } else { //real name of file $filename = substr(@$_FILES['file_' . $i . '_']['name'], 0, -strlen($this->typet) - 1); $this->filename2 = $this->filename . preg_replace('/[,.?\\/*&^\\\\$%#@()_!|"\\~\'><=+}{; ]/', '-', $filename) . '.' . $this->typet; $this->filename2 = preg_replace('/-+/', '-', $this->filename2); ($hook = kleeja_run_hook('another_decode_type_kljuploader')) ? eval($hook) : null; //run hook } if (empty($_FILES['file_' . $i . '_']['tmp_name'])) { //if no file ? natin to do ,, why ? becuase its multiple fields } elseif (file_exists($this->folder . '/' . $this->filename2)) { $this->errs[] = array(sprintf($lang['SAME_FILE_EXIST'], htmlspecialchars($_FILES['file_' . $i . '_']['name'])), 'index_err'); } elseif (preg_match("#[\\\\/\\:\\*\\?\\<\\>\\|\"]#", $this->filename2)) { $this->errs[] = array(sprintf($lang['WRONG_F_NAME'], htmlspecialchars($_FILES['file_' . $i . '_']['name'])), 'index_err'); } elseif ($this->ext_check_safe($_FILES['file_' . $i . '_']['name']) == false) { $this->errs[] = array(sprintf($lang['WRONG_F_NAME'], htmlspecialchars($_FILES['file_' . $i . '_']['name'])), 'index_err'); } elseif (!in_array(strtolower($this->typet), array_keys($this->types))) { //guest if ($this->id_user == '-1') { $this->errs[] = array(sprintf($lang['FORBID_EXT'], $this->typet) . '<br /> <a href="' . ($config['mod_writer'] ? "register.html" : "ucp.php?go=register") . '" title="' . htmlspecialchars($lang['REGISTER']) . '">' . $lang['REGISTER'] . '</a>', 'index_err'); } else { $this->errs[] = array(sprintf($lang['FORBID_EXT'], $this->typet), 'index_err'); } } elseif (kleeja_check_mime($_FILES['file_' . $i . '_']['type'], $this->types[strtolower($this->typet)]['group_id'], $_FILES['file_' . $i . '_']['tmp_name']) == false) { $this->errs[] = array(sprintf($lang['NOT_SAFE_FILE'], htmlspecialchars($_FILES['file_' . $i . '_']['name'])), 'index_err'); } elseif ($this->types[strtolower($this->typet)]['size'] > 0 && $this->sizet >= $this->types[strtolower($this->typet)]['size']) { $this->errs[] = array(sprintf($lang['SIZE_F_BIG'], htmlspecialchars($_FILES['file_' . $i . '_']['name']), Customfile_size($this->types[strtolower($this->typet)]['size'])), 'index_err'); } else { // // no errors , so uploading // //if (!$use_ftp) //{ ($hook = kleeja_run_hook('move_uploaded_file_kljuploader')) ? eval($hook) : null; //run hook $file = move_uploaded_file($_FILES['file_' . $i . '_']['tmp_name'], $this->folder . "/" . $this->filename2); /*} else // use ftp account { ($hook = kleeja_run_hook('ftp_connect_kljuploader')) ? eval($hook) : null; //run hook // set up a connection or die $conn_id = ftp_connect($ftp_server); // Login with username and password $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass); ftp_pasv($conn_id,false); // Check the connection if ((!$conn_id) || (!$login_result)) { $this->errs[]= array($lang['CANT_CON_FTP'] . $ftp_server, 'index_err'); } //ftp method if (in_array(strtolower($this->typet), array('png','gif','jpg','jpeg','tif','tiff'))) { $ftp_method = FTP_BINARY; } else { $ftp_method = FTP_ASCII; } // Upload the file $file = ftp_put($conn_id, $this->folder . "/" . $this->filename2, $_FILES['file_' . $i . '_']['tmp_name'], $ftp_method); ftp_close($conn_id); }*/ if ($file) { $this->saveit($this->filename2, $this->folder, $this->sizet, $this->typet, $_FILES['file_' . $i . '_']['name']); } else { $this->errs[] = array(sprintf($lang['CANT_UPLAOD'], $this->filename2), 'index_err'); } } } #for ... lmean loop if (!isset($check) || empty($check)) { $this->errs[] = array($lang['CHOSE_F'], 'index_err'); } } elseif ($wut == 2 && $config['www_url'] == '1') { ($hook = kleeja_run_hook('submit_urlupload_kljuploader')) ? eval($hook) : null; //run hook //looop text inputs for ($i = 0; $i < $this->filesnum; $i++) { $check .= isset($_POST['file_' . $i . '_']) && trim($_POST['file_' . $i . '_']) != $lang['PAST_URL_HERE'] ? $_POST['file_' . $i . '_'] : ''; $filename = isset($_POST['file_' . $i . '_']) ? basename($_POST['file_' . $i . '_']) : ''; $this->filename2 = explode(".", $filename); ($hook = kleeja_run_hook('for_wut2_filesupload_kljuploader')) ? eval($hook) : null; //run hook if (in_array($this->filename2[count($this->filename2) - 1], array('html', 'php', 'html'))) { $this->filename2 = $this->typet = strtolower($this->filename2[count($this->filename2) - 2]); } else { $this->filename2 = $this->typet = strtolower($this->filename2[count($this->filename2) - 1]); } //transfer [decode] if ($this->decode == "time") { $zaid = time(); $this->filename2 = $this->filename . $zaid . $i . "." . $this->filename2; } elseif ($this->decode == "md5") { $zaid = md5(time()); $zaid = substr($zaid, 0, 10); $this->filename2 = $this->filename . $zaid . $i . "." . $this->filename2; } else { // real name of file $this->filename2 = $this->filename . preg_replace('/[,.?\\/*&^\\\\$%#@()_!|"\\~\'><=+}{; ]/', '-', $filename) . '.' . $this->typet; $this->filename2 = preg_replace('/-+/', '-', $this->filename2); ($hook = kleeja_run_hook('another_decode_type_kljuploader')) ? eval($hook) : null; //run hook } //end tashfer if (empty($_POST['file_' . $i . '_']) || trim($_POST['file_' . $i . '_']) == $lang['PAST_URL_HERE']) { //nathin } else { if (file_exists($this->folder . '/' . $filename)) { $this->errs[] = array(sprintf($lang['SAME_FILE_EXIST'], htmlspecialchars($_POST['file_' . $i . '_'])), 'index_err'); } elseif (!in_array(strtolower($this->typet), array_keys($this->types))) { $this->errs[] = array(sprintf($lang['FORBID_EXT'], htmlspecialchars($_POST['file_' . $i . '_']), $this->typet), 'index_err'); } else { ($hook = kleeja_run_hook('start_upload_wut2_kljuploader')) ? eval($hook) : null; //run hook // //end err .. start upload from url // if (!in_array(substr($_POST['file_' . $i . '_'], 0, 4), array('http', 'ftp:'))) { $_POST['file_' . $i . '_'] = 'http://' . $_POST['file_' . $i . '_']; } if (function_exists("curl_init")) { $data = fetch_remote_file($_POST['file_' . $i . '_']); if ($data != false) { $this->sizet = strlen($data); if ($this->types[strtolower($this->typet)]['size'] > 0 && $this->sizet >= $this->types[strtolower($this->typet)]['size']) { $this->errs[] = array(sprintf($lang['SIZE_F_BIG'], htmlspecialchars($_POST['file_' . $i . '_']), Customfile_size($this->types[strtolower($this->typet)]['size'])), 'index_err'); } else { //then ..write new file $fp2 = @fopen($this->folder . "/" . $this->filename2, "w"); @fwrite($fp2, $data); @fclose($fp2); $this->saveit($this->filename2, $this->folder, $this->sizet, $this->typet); } } else { $this->errs[] = array($lang['URL_CANT_GET'], 'index_err'); } } else { $this->sizet = $this->get_remote_file_size($_POST['file_' . $i . '_']); if ($this->types[strtolower($this->typet)]['size'] > 0 && $this->sizet >= $this->types[strtolower($this->typet)]['size']) { $this->errs[] = array(sprintf($lang['SIZE_F_BIG'], htmlspecialchars($_POST['file_' . $i . '_']), Customfile_size($this->types[strtolower($this->typet)]['size'])), 'index_err'); } else { $data = fetch_remote_file($_POST['file_' . $i . '_'], $this->folder . "/" . $this->filename2); if ($data === false) { $this->errs[] = array($lang['URL_CANT_GET'], 'index_err'); } else { $this->saveit($this->filename2, $this->folder, $this->sizet, $this->typet); } } } } #else } //big else } #end loop if (!isset($check) || empty($check)) { $this->errs[] = array($lang['CHOSE_F'], 'index_err'); } } #end wut2 }
$num = 0; #if Kleeja integtared we dont want make alot of queries $ids_and_names = array(); while ($row = $SQL->fetch_array($result)) { $userfile = $config['siteurl'] . ($config['mod_writer'] ? 'fileuser-' . $row['user'] . '.html' : 'ucp.php?go=fileuser&id=' . $row['user']); #for username in integrated user system if ($row['user'] != '-1' and (int) $config['user_system'] != 1) { if (!in_array($row['user'], $ids_and_names)) { $row['username'] = $usrcp->usernamebyid($row['user']); $ids_and_names[$row['user']] = $row['username']; } else { $row['username'] = $ids_and_names[$row['user']]; } } //make new lovely arrays !! $arr[] = array('id' => $row['id'], 'name' => "<a title=\" " . ($row['real_filename'] == '' ? $row['name'] : $row['real_filename']) . "\" href=\"./" . PATH . $row['folder'] . "/" . $row['name'] . "\" target=\"blank\">" . ($row['real_filename'] == '' ? strlen($row['name']) > 20 ? substr($row['name'], 0, 20) . '...' : $row['name'] : (strlen($row['real_filename']) > 20 ? substr($row['real_filename'], 0, 20) . '...' : $row['real_filename'])) . "</a>", 'size' => Customfile_size($row['size']), 'ups' => $row['uploads'], 'direct' => $row['id_form'] == 'direct' ? true : false, 'time_human' => kleeja_date($row['time']), 'time' => kleeja_date($row['time'], false), 'type' => $row['type'], 'typeicon' => file_exists(PATH . "images/filetypes/" . $row['type'] . ".png") ? PATH . "images/filetypes/" . $row['type'] . ".png" : PATH . 'images/filetypes/file.png', 'folder' => $row['folder'], 'report' => $row['report'] > 4 ? "<span style=\"color:red;font-weight:bold\">" . $row['report'] . "</span>" : $row['report'], 'user' => $row['user'] == '-1' ? $lang['GUST'] : '<a href="' . $userfile . '" target="_blank">' . $row['username'] . '</a>', 'ip' => '<a href="http://www.ripe.net/whois?form_type=simple&full_query_string=&searchtext=' . $row['user_ip'] . '&do_search=Search" target="_new">' . $row['user_ip'] . '</a>', 'showfilesbyip' => basename(ADMIN_PATH) . '?cp=h_search&s_input=1&s_value=' . $row['user_ip']); $del[$row['id']] = isset($_POST['del_' . $row['id']]) ? $_POST['del_' . $row['id']] : ''; } $SQL->freeresult($result); } else { //no result .. $no_results = true; } #update f_lastvisit if (!$is_search) { if (filter_exists('f_lastvisit', 'filter_uid')) { update_filter('f_lastvisit', time()); } else { insert_filter('lastvisit', time(), false, false, '', 'f_lastvisit'); } }
$no_results = false; $query['LIMIT'] = "{$start}, {$perpage}"; ($hook = kleeja_run_hook('qr_select_files_in_fileuser')) ? eval($hook) : null; //run hook $result = $SQL->build($query); $i = $currentPage * $perpage - $perpage; $tdnumi = $num = $files_num = $imgs_num = 0; while ($row = $SQL->fetch_array($result)) { ++$i; $file_info = array('::ID::' => $row['id'], '::NAME::' => $row['name'], '::DIR::' => $row['folder'], '::FNAME::' => $row['real_filename']); $is_image = in_array(strtolower(trim($row['type'])), array('gif', 'jpg', 'jpeg', 'bmp', 'png')) ? true : false; $url = $is_image ? kleeja_get_link('image', $file_info) : kleeja_get_link('file', $file_info); $url_thumb = $is_image ? kleeja_get_link('thumb', $file_info) : kleeja_get_link('thumb', $file_info); $url_fileuser = $is_image ? $url : (file_exists("images/filetypes/" . $row['type'] . ".png") ? "images/filetypes/" . $row['type'] . ".png" : 'images/filetypes/file.png'); //make new lovely arrays !! $arr[] = array('id' => $row['id'], 'name_img' => $row['real_filename'] == '' ? strlen($row['name']) > 40 ? substr($row['name'], 0, 40) . '...' : $row['name'] : (strlen($row['real_filename']) > 40 ? substr($row['real_filename'], 0, 40) . '...' : $row['real_filename']), 'url_thumb_img' => '<a title="' . ($row['real_filename'] == '' ? $row['name'] : $row['real_filename']) . '" href="' . $url . '" onclick="window.open(this.href,\'_blank\');return false;"><img src="' . $url_fileuser . '" alt="' . $row['type'] . '" /></a>', 'name_file' => '<a title="' . ($row['real_filename'] == '' ? $row['name'] : $row['real_filename']) . '" href="' . $url . '" onclick="window.open(this.href,\'_blank\');return false;">' . ($row['real_filename'] == '' ? strlen($row['name']) > 40 ? substr($row['name'], 0, 40) . '...' : $row['name'] : (strlen($row['real_filename']) > 40 ? substr($row['real_filename'], 0, 40) . '...' : $row['real_filename'])) . '</a>', 'url_thumb_file' => '<a title="' . ($row['real_filename'] == '' ? $row['name'] : $row['real_filename']) . '" href="' . $url . '" onclick="window.open(this.href,\'_blank\');return false;"><img src="' . $url_fileuser . '" alt="' . $row['type'] . '" /></a>', 'file_type' => $row['type'], 'uploads' => $row['uploads'], 'tdnum' => $tdnumi == 0 ? '<ul>' : '', 'tdnum2' => $tdnumi == 4 ? '</ul>' : '', 'href' => $url, 'size' => Customfile_size($row['size']), 'time' => !empty($row['time']) ? kleeja_date($row['time']) : '...', 'thumb_link' => $is_image ? $url_thumb : $url_fileuser, 'is_image' => $is_image); $tdnumi = $tdnumi == 2 ? 0 : $tdnumi + 1; if (isset($_POST['submit_files']) && $user_himself) { ($hook = kleeja_run_hook('submit_in_fileuser')) ? eval($hook) : null; //run hook //check for form key if (!kleeja_check_form_key('fileuser', 1800)) { kleeja_info($lang['INVALID_FORM_KEY']); } if ($_POST['del_' . $row['id']]) { //delete from folder .. @kleeja_unlink($row['folder'] . '/' . $row['name']); //delete thumb if (file_exists($row['folder'] . '/thumbs/' . $row['name'])) { @kleeja_unlink($row['folder'] . '/thumbs/' . $row['name']); }