This blob has been accessed 398 times via Git panel.
- <?php
- header('Content-Type: text/html; charset=UTF-8');
- header('Cache-Control: private');
- ini_set("session.use_trans_sid","0");
- ini_set("mbstring.language","Neutral");
- ini_set("mbstring.internal_encoding","UTF-8");
- ini_set("mbstring.encoding_translation","On");
- ini_set("mbstring.http_input","auto");
- ini_set("mbstring.http_output","UTF-8");
- ini_set("mbstring.detect_order","auto");
- ini_set("mbstring.substitute_character","none");
- ini_set("default_charset","UTF-8");
- error_reporting(E_ERROR);
- session_start();
- if ($_SESSION['logged_lvl'] == "subscriber") {
- $fileUsr = sha1($_SESSION['logged_uid']);
- }
- if (isset($_POST['mbox_min']) and !empty($_POST['mbox_min']) and is_numeric($_POST['mbox_min'])) {
- $mbox_min = $_POST['mbox_min'];
- }
- else {
- $mbox_min = "0";
- }
- if (isset($_POST['mbox_ppg']) and !empty($_POST['mbox_ppg']) and is_numeric($_POST['mbox_ppg'])) {
- $mbox_ppg = $_POST['mbox_ppg'];
- }
- else {
- $mbox_ppg = "14";
- }
- $mbox_max = $mbox_min + $mbox_ppg;
- function time_elapsed_string($ptime) {
- if ($etime < 1) {
- return '0 seconds';
- }
- $a = array( 12 * 30 * 24 * 60 * 60 => 'year',
- 30 * 24 * 60 * 60 => 'month',
- 7 * 24 * 60 * 60 => 'week',
- 24 * 60 * 60 => 'day',
- 60 * 60 => 'hour',
- 60 => 'minute',
- 1 => 'second'
- );
- foreach ($a as $secs => $str) {
- $d = $etime / $secs;
- if ($d >= 1) {
- $r = round($d);
- return $r . ' ' . $str . ($r > 1 ? 's' : '');
- }
- }
- }
- function HumanReadableFilesize($size) {
- $mod = 1024;
- $units = explode(' ','B KB MB GB TB PB');
- for ($i = 0; $size > $mod; $i++) {
- $size /= $mod;
- }
- return round($size, 2) . ' ' . $units[$i];
- }
- function get_mime_type(&$struct) {
- $primary_mime_type = array("TEXT", "MULTIPART","MESSAGE", "APPLICATION", "AUDIO", "IMAGE", "VIDEO", "OTHER");
- if($struct->subtype) {
- return $primary_mime_type[(int) $struct->type] . '/' .$struct->subtype;
- }
- return "TEXT/PLAIN";
- }
- function get_part($stream, $msg_number, $mime_type, $structure = false, $part_number = false) {
- if (!$structure) {
- $structure = imap_fetchstructure($stream, $msg_number);
- }
- if ($structure) {
- if ($mime_type == get_mime_type($structure)) {
- if (!$part_number) {
- $part_number = "1";
- }
- $text = imap_fetchbody($stream, $msg_number, $part_number);
- if ($structure->encoding == 3) {
- return imap_base64($text);
- }
- else if ($structure->encoding == 4) {
- return imap_qprint($text);
- }
- else {
- return $text;
- }
- }
- if ($structure->type == 1) /* multipart */ {
- while (list($index, $sub_structure) = each($structure->parts)) {
- if ($part_number) {
- $prefix = $part_number . '.';
- }
- $data = get_part($stream, $msg_number, $mime_type, $sub_structure,$prefix . ($index + 1));
- if ($data) {
- return $data;
- }
- }
- }
- }
- return false;
- }
- function extract_emails_from($string){
- preg_match_all("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $string, $matches);
- return $matches[0];
- }
- function return_bytes($val) {
- $val = trim($val);
- switch ($last) {
- case 'k':
- case 'K':
- return(int)$val * 1024;
- break;
- case 'm':
- case 'M':
- return(int)$val * 1048576;
- break;
- default:
- return $val;
- }
- }
- $server_upload_max_filesize = return_bytes(ini_get('upload_max_filesize'));
- $server_post_max_size = return_bytes(ini_get('post_max_size'));
- $server_memory_limit = return_bytes(ini_get('memory_limit'));
- $max_file_size = $server_upload_max_filesize;
- if ($server_upload_max_filesize > $server_post_max_size) {
- $max_file_size = $server_post_max_size;
- }
- if ($server_post_max_size > $server_memory_limit) {
- $max_file_size = $server_memory_limit;
- }
- function header_mime2text ($header) {
- $header_decode = imap_mime_header_decode(str_replace(array('\r\n', '\r', '\n'), ' ', $header));
- foreach ($header_decode as $header_decoded) {
- $header_text = $header_text . $header_decoded->text;
- }
- $header_text = mb_convert_encoding($header_text,"UTF-8","auto");
- $header_text = mb_convert_encoding($header_text,"UTF-8","UTF-8");
- return ($header_text);
- }
- function is_image($path) {
- $a = getimagesize($path);
- $image_type = $a[2];
- if (in_array($image_type, array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG , IMAGETYPE_BMP))) {
- return true;
- }
- return false;
- }
- ?>