function foldersize($path)
{
    $size = 0;
    if ($handle = @opendir($path)) {
        while (($file = readdir($handle)) !== false) {
            if (is_file($path . "/" . $file)) {
                $size += filesize($path . "/" . $file);
            }
            if (is_dir($path . "/" . $file)) {
                if ($file != "." && $file != "..") {
                    $size += foldersize($path . "/" . $file);
                }
            }
        }
    }
    return $size;
}
Ejemplo n.º 2
0
function foldersize($path)
{
    $total_size = 0;
    $files = scandir($path);
    $cleanPath = rtrim($path, '/') . '/';
    foreach ($files as $t) {
        if ($t != "." && $t != "..") {
            $currentFile = $cleanPath . $t;
            if (is_dir($currentFile)) {
                $size = foldersize($currentFile);
                $total_size += $size;
            } else {
                $size = filesize($currentFile);
                $total_size += $size;
            }
        }
    }
    return $total_size;
}
Ejemplo n.º 3
0
function uploadFile($file, $cattype, $cat)
{
    global $loguserid, $uploaddirs, $goodfiles, $badfiles, $userquota, $maxSize;
    $targetdir = $uploaddirs[$cattype];
    $totalsize = foldersize($targetdir);
    $filedata = $_FILES[$file];
    $c = FetchResult("SELECT COUNT(*) FROM {uploader} WHERE filename={0} AND cattype={1} AND user={2} AND deldate=0", $filedata['name'], $cattype, $loguserid);
    if ($c > 0) {
        return "You already have a file with this name. Please delete the old copy before uploading a new one.";
    }
    if ($filedata['size'] == 0) {
        if ($filedata['tmp_name'] == '') {
            return 'No file given.';
        } else {
            return 'File is empty.';
        }
    }
    if ($filedata['size'] > $maxSize) {
        return 'File is too large. Maximum size allowed is ' . BytesToSize($maxSize) . '.';
    }
    $randomid = Shake();
    $pname = $randomid . '_' . Shake();
    $fname = $_FILES['newfile']['name'];
    $temp = $_FILES['newfile']['tmp_name'];
    $size = $_FILES['size']['size'];
    $parts = explode(".", $fname);
    $extension = end($parts);
    if ($totalsize + $size > $quot) {
        Alert(format(__("Uploading \"{0}\" would break the quota."), $fname));
    } else {
        if (in_array(strtolower($extension), $badfiles) || is_array($goodfiles) && !in_array(strtolower($extension), $goodfiles)) {
            return 'Forbidden file type.';
        } else {
            $description = $_POST['description'];
            $big_descr = $cat['showindownloads'] ? $_POST['big_description'] : '';
            Query("insert into {uploader} (id, filename, description, big_description, date, user, private, category, deldate, physicalname) values ({7}, {0}, {1}, {6}, {2}, {3}, {4}, {5}, 0, {8})", $fname, $description, time(), $loguserid, $privateFlag, $_POST['cat'], $big_descr, $randomid, $pname);
            copy($temp, $targetdir . "/" . $pname);
            Report("[b]" . $loguser['name'] . "[/] uploaded file \"[b]" . $fname . "[/]\"" . ($privateFlag ? " (privately)" : ""), $privateFlag);
            die(header("Location: " . actionLink("uploaderlist", "", "cat=" . $_POST["cat"])));
        }
    }
}
Ejemplo n.º 4
0
function folderSize($dir)
{
    $count_size = 0;
    $count = 0;
    $dir_array = scandir($dir);
    foreach ($dir_array as $key => $filename) {
        if ($filename != ".." && $filename != ".") {
            if (is_dir($dir . "/" . $filename)) {
                $new_foldersize = foldersize($dir . "/" . $filename);
                $count_size = $count_size + $new_foldersize;
            } else {
                if (is_file($dir . "/" . $filename)) {
                    $count_size = $count_size + filesize($dir . "/" . $filename);
                    $count++;
                }
            }
        }
    }
    return $count_size;
}
Ejemplo n.º 5
0
 /**
  * Get used disk space by user_id
  *
  * @param int $user_id
  * @param int $except_size Mb
  * @return int used space in Mb or false if throw exception
  */
 public function getUsedSpace($user_id, $except_size = 0)
 {
     $directory = DIR_STORAGE . $user_id . DIR_SEPARATOR;
     if (is_dir($directory)) {
         $count_size = 0;
         $dir_array = scandir($directory);
         foreach ($dir_array as $key => $filename) {
             if ($filename != '..' && $filename != '.') {
                 if (is_dir($directory . DIR_SEPARATOR . $filename)) {
                     $new_foldersize = foldersize($directory . DIR_SEPARATOR . $filename);
                     $count_size = $count_size + $new_foldersize;
                 } else {
                     if (is_file($directory . DIR_SEPARATOR . $filename)) {
                         $count_size = $count_size + filesize($directory . DIR_SEPARATOR . $filename);
                     }
                 }
             }
         }
         return $count_size / 1000000 - $except_size;
     } else {
         return 0;
     }
 }
Ejemplo n.º 6
0
function foldersize($path)
{
    $total_size = 0;
    $files = scandir($path);
    if (!function_exists('scandir')) {
        function scandir($path, $sorting_order = 0)
        {
            $dh = opendir($path);
            while (false !== ($filename = readdir($dh))) {
                $files[] = $filename;
            }
            if ($sorting_order == 0) {
                sort($files);
            } else {
                rsort($files);
            }
            return $files;
        }
    }
    foreach ($files as $t) {
        if (is_dir($t)) {
            // In case of folder
            if ($t != "." && $t != "..") {
                // Exclude self and parent folder
                $size = foldersize($path . "/" . $t);
                // print("Dir - $path/$t = $size<br>\n");
                $total_size += $size;
            }
        } else {
            // In case of file
            $size = filesize($path . "/" . $t);
            // print("File - $path/$t = $size<br>\n");
            $total_size += $size;
        }
    }
    return $total_size;
}
function foldersize($path)
{
    $total_size = 0;
    $filesCount = 0;
    $foldersCount = 0;
    $files = scandir($path);
    $cleanPath = rtrim($path, '/') . '/';
    foreach ($files as $t) {
        if ($t != "." && $t != "..") {
            $currentFile = $cleanPath . $t;
            if (is_dir($currentFile)) {
                $size = foldersize($currentFile);
                $total_size += $size[0];
                $foldersCount += $size[2] + 1;
                $filesCount += $size[1];
            } else {
                $size2 = filesize($currentFile);
                $total_size += $size2;
                $filesCount++;
            }
        }
    }
    return array($total_size, $filesCount, $foldersCount);
}
Ejemplo n.º 8
0
 /**
  * Get used disk space by user_id
  *
  * @param int $user_id
  * @param int $except_size Mb
  * @return int used space in Mb or false if throw exception
  */
 public function getUsedSpace($user_id, $except_size = 0)
 {
     $directory = DIR_STORAGE . $user_id . DIR_SEPARATOR;
     if (is_dir($directory)) {
         $count_size = 0;
         $dir_array = scandir($directory);
         foreach ($dir_array as $key => $filename) {
             // Images and temporary files will be ignored
             if ($filename != '..' && $filename != '.' && false === strpos($filename, '_') && false === strpos($filename, '.' . STORAGE_IMAGE_EXTENSION)) {
                 if (is_dir($directory . DIR_SEPARATOR . $filename)) {
                     $new_foldersize = foldersize($directory . DIR_SEPARATOR . $filename);
                     $count_size = $count_size + $new_foldersize;
                 } else {
                     if (is_file($directory . DIR_SEPARATOR . $filename)) {
                         $count_size = $count_size + filesize($directory . DIR_SEPARATOR . $filename);
                     }
                 }
             }
         }
         return $count_size / 1000000 - $except_size;
     } else {
         return 0;
     }
 }
Ejemplo n.º 9
0
function foldersize($path)
{
    $total_size = 0;
    if (!function_exists('scandir')) {
        function scandir($path)
        {
            $dh = opendir($path);
            while (false !== ($filename = readdir($dh))) {
                $files[] = $filename;
            }
            sort($files);
            //print_r($files);
            rsort($files);
            //print_r($files);
            return $files;
        }
        $files = scandir($path);
        foreach ($files as $t) {
            if (is_dir($t)) {
                // In case of folder
                if ($t != "." && $t != "..") {
                    // Exclude self and parent folder
                    $size = foldersize($path . "/" . $t);
                    //print("Dir - $path/$t = $size<br>\n");
                    $total_size += $size;
                }
            } else {
                // In case of file
                $size = @filesize($path . "/" . $t);
                //print("File - $path/$t = $size<br>\n");
                $total_size += $size;
            }
        }
        $bytes = array('B', 'KB', 'MB', 'GB', 'TB');
        foreach ($bytes as $val) {
            if ($total_size > 1024) {
                $total_size = $total_size / 1024;
            } else {
                break;
            }
        }
        return @round($total_size, 2) . " " . $val;
    } else {
        $files = @scandir($path);
        foreach ($files as $t) {
            if (is_dir($t)) {
                // In case of folder
                if ($t != "." && $t != "..") {
                    // Exclude self and parent folder
                    $size = foldersize($path . "/" . $t);
                    $total_size += $size;
                }
            } else {
                $size = @filesize($path . "/" . $t);
                $total_size += $size;
            }
        }
        $bytes = array('B', 'KB', 'MB', 'GB', 'TB');
        foreach ($bytes as $val) {
            if ($total_size > 1024) {
                $total_size = $total_size / 1024;
            } else {
                break;
            }
        }
        return @round($total_size, 2) . " " . $val;
    }
}
Ejemplo n.º 10
0
		<tr class="band">
			<td>清除RSS缓存</td>
			<td>cache/rss/</td>
			<td class="text-key"><?php 
    echo sizecount(foldersize(VI_ROOT . 'cache/rss/'));
    ?>
</td>
			<td>删除RSS内容读取缓存,RSS缓存可能在部分功能模块中有涉及和使用</td>						
			<td><input name="" type="button" class="button" value="立即使用" onclick="location.href='?action=clean&file=rss';" /></td>
		</tr>
		
		<tr class="line">
			<td>清除模板缓存</td>
			<td>static/*/*.htm.php</td>
			<td class="text-key"><?php 
    echo sizecount(foldersize(VI_ROOT . 'cache/compile/'));
    ?>
</td>
			<td>删除各前台页面由 Smarty 产生的缓存,当页面没有正常刷新时使用</td>						
			<td><input name="" type="button" class="button" value="立即使用" onclick="location.href='?action=clean&file=static';" /></td>
		</tr>
		
		</table>
        
	<?php 
}
?>
    
    <div class="item">文件对比器</div>

    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table">
Ejemplo n.º 11
0
        <tr class="line">
        	<td>VeryIDE 版本</td>
			<td class="text-yes"><?php 
echo $_G['product']['version'] . ' - ' . strtoupper($_G['product']['charset']) . ' - ' . $_G['product']['build'] . " <span class='text-key'>(" . $_G['version'][$_G['licence']['type']]["name"] . ')</span>';
?>
</td>
			<td>安装时间</td>
			<td class="text-yes"><?php 
echo date("Y-m-d", VI_START);
?>
</td>
        </tr>
        <tr class="band">
        	<td>空间占用</td>
			<td class="text-yes"><?php 
echo sizecount(foldersize(VI_ROOT));
?>
</td>
			<td>基准目录</td>
			<td class="text-yes"><?php 
echo VI_BASE;
?>
</td>
        </tr>
        <tr class="line">
        	<td>绝对地址</td>
			<td class="text-yes"><?php 
echo VI_HOST;
?>
</td>
			<td>本地目录</td>
Ejemplo n.º 12
0
function foldersize($d)
{
    $dir = dir($d);
    $size = 0;
    if ($dir) {
        while (false !== ($e = $dir->read())) {
            if ($e[0] == '.') {
                continue;
            }
            $c_dir = $d . '/' . $e;
            if (is_dir($c_dir)) {
                $size = $size + foldersize($c_dir);
            } else {
                $size = $size + filesize($c_dir);
            }
        }
        $dir->close();
    }
    return $size;
}
Ejemplo n.º 13
0
 }
 $files = scandir($current_path . $rfm_subfolder . $subdir);
 $n_files = count($files);
 //php sorting
 $sorted = array();
 $current_folder = array();
 $prev_folder = array();
 foreach ($files as $k => $file) {
     if ($file == ".") {
         $current_folder = array('file' => $file);
     } elseif ($file == "..") {
         $prev_folder = array('file' => $file);
     } elseif (is_dir($current_path . $rfm_subfolder . $subdir . $file)) {
         $date = filemtime($current_path . $rfm_subfolder . $subdir . $file);
         if ($show_folder_size) {
             $size = foldersize($current_path . $rfm_subfolder . $subdir . $file);
         } else {
             $size = 0;
         }
         $file_ext = lang_Type_dir;
         $sorted[$k] = array('file' => $file, 'file_lcase' => strtolower($file), 'date' => $date, 'size' => $size, 'extension' => $file_ext, 'extension_lcase' => strtolower($file_ext));
     } else {
         $file_path = $current_path . $rfm_subfolder . $subdir . $file;
         $date = filemtime($file_path);
         $size = filesize($file_path);
         $file_ext = substr(strrchr($file, '.'), 1);
         $sorted[$k] = array('file' => $file, 'file_lcase' => strtolower($file), 'date' => $date, 'size' => $size, 'extension' => $file_ext, 'extension_lcase' => strtolower($file_ext));
     }
 }
 function filenameSort($x, $y)
 {
Ejemplo n.º 14
0
     exit;
 }
 if (trim($_POST['path']) == '') {
     response('no path', 400)->send();
     exit;
 }
 $path = $current_path . $_POST['path'];
 if (is_dir($path)) {
     // can't copy/cut dirs
     if ($copy_cut_dirs === false) {
         response(sprintf(trans('Copy_Cut_Not_Allowed'), $_POST['sub_action'] == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut')), trans('Folders')), 403)->send();
         exit;
     }
     // size over limit
     if ($copy_cut_max_size !== false && is_int($copy_cut_max_size)) {
         if ($copy_cut_max_size * 1024 * 1024 < foldersize($path)) {
             response(sprintf(trans('Copy_Cut_Size_Limit'), $_POST['sub_action'] == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut')), $copy_cut_max_size), 400)->send();
             exit;
         }
     }
     // file count over limit
     if ($copy_cut_max_count !== false && is_int($copy_cut_max_count)) {
         if ($copy_cut_max_count < filescount($path)) {
             response(sprintf(trans('Copy_Cut_Count_Limit'), $_POST['sub_action'] == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut')), $copy_cut_max_count), 400)->send();
             exit;
         }
     }
 } else {
     // can't copy/cut files
     if ($copy_cut_files === false) {
         response(sprintf(trans('Copy_Cut_Not_Allowed'), $_POST['sub_action'] == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut')), trans('Files')), 403)->send();
Ejemplo n.º 15
0
function foldersize($path)
{
    $total_size = 0;
    $files = scandir($path);
    $files = array_slice($files, 2);
    foreach ($files as $t) {
        if (is_dir($t)) {
            //Recurse here
            $size = foldersize($path . "/" . $t);
            $total_size += $size;
        } else {
            $size = filesize($path . "/" . $t);
            $total_size += $size;
        }
    }
    return $total_size;
}
Ejemplo n.º 16
0
    function dashboard_developer_info()
    {
        do_action('nebula_developer_info');
        $domain_exp_detected = whois_info('expiration');
        $domain_exp_unix = strtotime(trim($domain_exp_detected));
        $domain_exp = date("F j, Y", $domain_exp_unix);
        $domain_exp_style = $domain_exp_unix < strtotime('+1 month') ? 'color: red; font-weight: bold;' : 'color: inherit;';
        $domain_exp_html = $domain_exp_unix > strtotime('March 27, 1986') ? ' <small style="' . $domain_exp_style . '">(Expires: ' . $domain_exp . ')</small>' : '';
        $domain_registrar_url = whois_info('registrar_url');
        $domain_registrar = whois_info('registrar');
        $domain_reseller = whois_info('reseller');
        //Construct Registrar info to be echoed
        if ($domain_registrar_url && strlen($domain_registrar_url) < 70) {
            $domain_registrar_html = $domain_registrar && strlen($domain_registrar) < 70 ? '<li><i class="fa fa-info-circle fa-fw"></i> Registrar: <strong><a href="//' . trim($domain_registrar_url) . '" target="_blank">' . $domain_registrar . '</a></strong>' : '';
        } else {
            $domain_registrar_html = $domain_registrar && strlen($domain_registrar) < 70 ? '<li><i class="fa fa-info-circle fa-fw"></i> Registrar: <strong>' . trim($domain_registrar) . '</strong>' : '';
        }
        if (trim($domain_registrar_html) != '' && $domain_reseller && strlen($domain_reseller) < 70) {
            $domain_registrar_html .= ' <small>(via ' . trim($domain_reseller) . ')</small></li>';
        } else {
            $domain_registrar_html .= '</li>';
        }
        if (nebula_option('nebula_domain_exp', 'enabled')) {
            if (get_option('nebula_domain_expiration_last') == 'Never' || get_option('nebula_domain_expiration_last') < strtotime('-2 weeks')) {
                if ($domain_exp != 'December 31, 1969' && $domain_exp_unix > strtotime("3/27/1986")) {
                    if ($domain_exp_unix < strtotime('+1 week')) {
                        //If domain is expiring within a week, email all admin users.
                        $adminUsers = get_users(array('role' => 'Administrator'));
                        $exp_notice_to = '';
                        $i = 0;
                        $exp_notice_to = array();
                        foreach ($adminUsers as $adminUser) {
                            array_push($exp_notice_to, $adminUsers[$i]->user_email);
                            $i++;
                        }
                        $exp_notice_subject = 'Domain expiration detection of ' . $domain_exp . ' for ' . nebula_url_components('domain') . ' (via ' . get_bloginfo('name') . ')!';
                        $exp_notice_message = "Your domain " . nebula_url_components('domain') . " expires on " . $domain_exp . "! The detected registrar is: " . $domain_registrar . "(" . $domain_registrar_url . ") (However, the actual reseller may be different). This notice was triggered because the expiration date is within 1 week. It has been sent to all administrators of " . get_bloginfo('name') . " (" . home_url('/') . "), and will only be sent once!";
                        wp_mail($exp_notice_to, $exp_notice_subject, $exp_notice_message);
                        update_option('nebula_domain_expiration_last', date('U'));
                    }
                }
            }
        }
        //Get last modified filename and date
        $dir = glob_r(get_template_directory() . '/*');
        $last_date = 0;
        $skip_files = array('dev.css', 'dev.scss', '/cache/', '/includes/data/', 'manifest.json');
        //Files or directories to skip. Be specific!
        foreach ($dir as $file) {
            if (is_file($file)) {
                $mod_date = filemtime($file);
                if ($mod_date > $last_date && !contains($file, $skip_files)) {
                    $last_date = $mod_date;
                    $last_filename = basename($file);
                    $last_file_path = str_replace(get_template_directory(), '', dirname($file)) . '/' . $last_filename;
                }
            }
        }
        $nebula_size = foldersize(get_template_directory());
        $upload_dir = wp_upload_dir();
        $uploads_size = foldersize($upload_dir['basedir']);
        $secureServer = '';
        if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) {
            $secureServer = '<small class="secured-connection"><i class="fa fa-lock fa-fw"></i>Secured Connection</small>';
        }
        function top_domain_name($url)
        {
            $alldomains = explode(".", $url);
            return $alldomains[count($alldomains) - 2] . "." . $alldomains[count($alldomains) - 1];
        }
        if (function_exists('gethostname')) {
            set_error_handler(function () {
                /* ignore errors */
            });
            $dnsrecord = dns_get_record(top_domain_name(gethostname()), DNS_NS) ? dns_get_record(top_domain_name(gethostname()), DNS_NS) : '';
            restore_error_handler();
        }
        function initial_install_date()
        {
            $nebula_initialized = get_option('nebula_initialized');
            if (!empty($nebula_initialized) && $nebula_initialized < getlastmod()) {
                $install_date = '<strong>' . date('F j, Y', $nebula_initialized) . '</strong> <small>@</small> <strong>' . date('g:ia', $nebula_initialized) . '</strong> <small>(Nebula Init)</small>';
            } else {
                //Use the last modified time of the admin page itself
                $install_date = '<strong>' . date("F j, Y", getlastmod()) . '</strong> <small>@</small> <strong>' . date("g:ia", getlastmod()) . '</strong> <small>(WP Detect)</small>';
            }
            return $install_date;
        }
        if (strpos(strtolower(PHP_OS), 'linux') !== false) {
            $php_os_icon = 'fa-linux';
        } else {
            if (strpos(strtolower(PHP_OS), 'windows') !== false) {
                $php_os_icon = 'fa-windows';
            } else {
                $php_os_icon = 'fa-upload';
            }
        }
        if (function_exists('wp_max_upload_size')) {
            $upload_max = '<small>(Max upload: <strong>' . strval(round((int) wp_max_upload_size() / (1024 * 1024))) . 'mb</strong>)</small>';
        } else {
            if (ini_get('upload_max_filesize')) {
                $upload_max = '<small>(Max upload: <strong>' . ini_get('upload_max_filesize') . '</strong>)</small>';
            } else {
                $upload_max = '';
            }
        }
        if (function_exists('mysqli_connect')) {
            $mysqli_connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD);
            $mysql_version = mysqli_get_server_info($mysqli_connect);
        }
        $safe_mode = ini_get('safe_mode') ? '<small><strong><em>Safe Mode</em></strong></small>' : '';
        echo '<div id="testloadcon" style="pointer-events: none; opacity: 0; visibility: hidden; display: none;"></div>';
        echo '<script id="testloadscript">
				jQuery(window).on("load", function(){
					jQuery(".loadtime").css("visibility", "visible");
					beforeLoad = (new Date()).getTime();
					var iframe = document.createElement("iframe");
					iframe.style.width = "1200px";
					iframe.style.height = "0px";
					jQuery("#testloadcon").append(iframe);
					iframe.src = "' . home_url('/') . '";
					jQuery("#testloadcon iframe").on("load", function(){
						stopTimer();
					});
				});

				function stopTimer(){
				    var afterLoad = (new Date()).getTime();
				    var result = (afterLoad - beforeLoad)/1000;
				    jQuery(".loadtime").html(result + " seconds");
				    if ( result > 5 ){ jQuery(".slowicon").addClass("fa-warning"); }
				    jQuery(".serverdetections .fa-spin, #testloadcon, #testloadscript").remove();
				}
			</script>';
        echo '<ul class="serverdetections">';
        /*
        			if ( is_debug() ){
        				echo '<li style="color: red;"><i class="fa fa-exclamation-triangle fa-fw"></i> <strong>Warning:</strong> WP_DEBUG is Enabled!</li>';
        			}
        */
        echo '<li><i class="fa fa-info-circle fa-fw"></i> <a href="http://whois.domaintools.com/' . $_SERVER['SERVER_NAME'] . '" target="_blank" title="WHOIS Lookup">Domain</a>: <strong>' . nebula_url_components('domain') . '</strong>' . $domain_exp_html . '</li>';
        echo $domain_registrar_html;
        if (function_exists('gethostname')) {
            echo '<li><i class="fa fa-hdd-o fa-fw"></i> Host: <strong>' . top_domain_name(gethostname()) . '</strong>';
            if (!empty($dnsrecord[0]['target'])) {
                echo ' <small>(' . top_domain_name($dnsrecord[0]['target']) . ')</small>';
            }
            echo '</li>';
        }
        echo '<li><i class="fa fa-upload fa-fw"></i> Server IP: <strong><a href="http://whatismyipaddress.com/ip/' . $_SERVER['SERVER_ADDR'] . '" target="_blank">' . $_SERVER['SERVER_ADDR'] . '</a></strong> ' . $secureServer . '</li>';
        echo '<li><i class="fa ' . $php_os_icon . ' fa-fw"></i> Server OS: <strong>' . PHP_OS . '</strong> <small>(' . $_SERVER['SERVER_SOFTWARE'] . ')</small></li>';
        $php_version_color = 'inherit';
        $php_version_info = '';
        $php_version_cursor = 'normal';
        $php_version_lifecycle = nebula_php_version_support();
        if ($php_version_lifecycle['lifecycle'] == 'security') {
            $php_version_color = '#ca8038';
            $php_version_info = 'This version is nearing end of life. Security updates end on ' . date('F j, Y', $php_version_lifecycle['security']) . '.';
            $php_version_cursor = 'help';
        } elseif ($php_version_lifecycle['lifecycle'] == 'end') {
            $php_version_color = '#ca3838';
            $php_version_info = 'This version no longer receives security updates! End of life occurred on ' . date('F j, Y', $php_version_lifecycle['end']) . '.';
            $php_version_cursor = 'help';
        }
        echo '<li><i class="fa fa-wrench fa-fw"></i> PHP Version: <strong style="color: ' . $php_version_color . '; cursor: ' . $php_version_cursor . ';" title="' . $php_version_info . '">' . PHP_VERSION . '</strong> ' . $safe_mode . '</li>';
        echo '<li><i class="fa fa-cogs fa-fw"></i> PHP Memory Limit: <strong>' . WP_MEMORY_LIMIT . '</strong> ' . $safe_mode . '</li>';
        echo !empty($mysql_version) ? '<li><i class="fa fa-database fa-fw"></i> MySQL Version: <strong>' . $mysql_version . '</strong></li>' : '';
        echo '<li><i class="fa fa-code"></i> Theme directory size: <strong>' . round($nebula_size / 1048576, 2) . 'mb</strong> </li>';
        echo '<li><i class="fa fa-picture-o"></i> Uploads directory size: <strong>' . round($uploads_size / 1048576, 2) . 'mb</strong> ' . $upload_max . '</li>';
        echo '<li><i class="fa fa-clock-o fa-fw"></i> <span title="' . get_home_url() . '" style="cursor: help;">Homepage</span> load time: <a href="http://developers.google.com/speed/pagespeed/insights/?url=' . home_url('/') . '" target="_blank" title="Time is specific to your current environment and therefore may be faster or slower than average."><strong class="loadtime" style="visibility: hidden;"><i class="fa fa-spinner fa-fw fa-spin"></i></strong></a> <i class="slowicon fa" style="color: maroon;"></i></li>';
        echo '<li><i class="fa fa-calendar-o fa-fw"></i> Initial Install: ' . initial_install_date() . '</li>';
        echo '<li><i class="fa fa-calendar fa-fw"></i> Last modified: <strong>' . date("F j, Y", $last_date) . '</strong> <small>@</small> <strong>' . date("g:ia", $last_date) . '</strong> <small title="' . $last_file_path . '" style="cursor: help;">(' . $last_filename . ')</small></li>';
        $scss_last_processed = get_option('nebula_scss_last_processed') ? '<strong>' . date("F j, Y", get_option('nebula_scss_last_processed')) . '</strong> <small>@</small> <strong>' . date("g:i:sa", get_option('nebula_scss_last_processed')) . '</strong>' : '<strong>Never</strong>';
        echo '<li><i class="fa fa-paint-brush fa-fw"></i> SCSS Last Processed: ' . $scss_last_processed . '</li>';
        echo '</ul>';
        echo '<i id="searchprogress" class="fa fa-search fa-fw"></i> <form id="theme" class="searchfiles"><input class="findterm" type="text" placeholder="Search files" /><select class="searchdirectory">';
        if (is_child_theme()) {
            echo '<option value="parent">Parent Theme</option><option value="child">Child Theme</option>';
        } else {
            echo '<option value="theme">Theme</option>';
        }
        echo '<option value="plugins">Plugins</option><option value="uploads">Uploads</option></select><input class="searchterm button button-primary" type="submit" value="Search" /></form><br />';
        echo '<div class="search_results"></div>';
    }
 private function foldersize($path)
 {
     $total_size = 0;
     $files = scandir($path);
     foreach ($files as $t) {
         if (is_dir(rtrim($path, '/') . '/' . $t)) {
             if ($t != "." && $t != "..") {
                 $size = foldersize(rtrim($path, '/') . '/' . $t);
                 $total_size += $size;
             }
         } else {
             $size = filesize(rtrim($path, '/') . '/' . $t);
             $total_size += $size;
         }
     }
     return $total_size;
 }
Ejemplo n.º 18
0
/**
 *  The basic php way to go through all directories and adding the file sizes.
 *  It does also check the parameters $exclude_directories and $hide_hidden_files
 */
function foldersize($p)
{
    global $exclude_directories, $hide_hidden_files;
    $size = 0;
    $fs = scandir($p);
    foreach ($fs as $f) {
        if (is_dir(rtrim($p, '/') . '/' . $f)) {
            if ($f != '.' && $f != '..') {
                $size += foldersize(rtrim($p, '/') . '/' . $f);
            }
        } else {
            if ($f != '.' && $f != '..' && !in_array($f, $exclude_directories) && !($hide_hidden_files && strpos($f, '.') === 0)) {
                $size += filesize(rtrim($p, '/') . '/' . $f);
            }
        }
    }
    return $size;
}
Ejemplo n.º 19
0
        }
        if ($width > 90) {
            $color = "orange";
        }
        if ($width > 100) {
            $width = 100;
            $color = "red;";
        }
        $alt = format("{0}&nbsp;of&nbsp;{1},&nbsp;{2}%", BytesToSize($totalsize), BytesToSize($quota), $width);
        $bar = format("<div class=\"pollbar\" style=\"width: {0}%; background: {2}\" title=\"{1}\">&nbsp;{$width}%</div>", $width, $alt, $color);
    }
}
write("\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header0\">\n\t\t\t<th colspan=\"2\">" . __("Status") . "</th>\n\t\t</tr>\n\t\t<tr class=\"cell2\">\n\t\t\t<td style=\"width:40%\">\n\t\t\t\t" . __("Public space usage: {0} of {1}") . "\n\t\t\t</td><td>\n\t\t\t\t<div class=\"pollbarContainer\" style=\"width: 90%;\">\n\t\t\t\t\t{2}\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n", BytesToSize($totalsize), BytesToSize($quota), $bar);
$bar = "&nbsp;0%";
if ($loguserid && is_dir($rootdir . "/" . $loguserid)) {
    $personalsize = foldersize($rootdir . "/" . $loguserid);
    if ($personalsize > 0) {
        $width = floor(100 * ($personalsize / $pQuota));
        if ($width > 0) {
            $color = "green";
            if ($width > 75) {
                $color = "yellow";
            }
            if ($width > 90) {
                $color = "orange";
            }
            if ($width > 100) {
                $width = 100;
                $color = "red;";
            }
            $alt = format("{0}&nbsp;of&nbsp;{1},&nbsp;{2}%", BytesToSize($personalsize), BytesToSize($pQuota), $width);
Ejemplo n.º 20
0
/**
 * Calculate the size of a folder and its files
 *
 * @author: Toni Widodo (toni.widodo@clearsyntax.com)
 *
 * @param string $dirname
 * @return int Size of the folder in bytes
 */
function foldersize($dirname)
{
    $folderSize = 0;
    // open the directory, if the script cannot open the directory then return folderSize = 0
    $dir_handle = opendir($dirname);
    if (!$dir_handle) {
        return 0;
    }
    // traversal for every entry in the directory
    while ($file = readdir($dir_handle)) {
        // ignore '.' and '..' directory
        if ($file != "." && $file != "..") {
            // if entry is directory then go recursive !
            if (is_dir($dirname . "/" . $file)) {
                $folderSize += foldersize($dirname . '/' . $file);
            } else {
                $folderSize += filesize($dirname . "/" . $file);
            }
        }
    }
    // chose the directory
    closedir($dir_handle);
    // return $dirname folder size
    return $folderSize;
}
Ejemplo n.º 21
0
}
$store = mapi_openmsgstore($session, $storeentryid);
if (!$store) {
    print "Unable to open store\n";
    exit(1);
}
$root = mapi_msgstore_openentry($store);
if (!$root) {
    print "Unable to open root folder\n";
    exit(1);
}
$folders = mapi_folder_gethierarchytable($root, CONVENIENT_DEPTH);
$total = 0;
while (1) {
    $rows = mapi_table_queryrows($folders, array(PR_DISPLAY_NAME, PR_FOLDER_TYPE, PR_ENTRYID), 0, 100);
    if (count($rows) == 0) {
        break;
    }
    foreach ($rows as $row) {
        // Skip searchfolders
        if (isset($row[PR_FOLDER_TYPE]) && $row[PR_FOLDER_TYPE] == FOLDER_SEARCH) {
            continue;
        }
        print isset($row[PR_DISPLAY_NAME]) ? $row[PR_DISPLAY_NAME] : "<Unknown>";
        print ": ";
        $size = foldersize($store, $row[PR_ENTRYID]);
        print prettyprint($size) . "\n";
        $total += $size;
    }
}
print "Total: " . prettyprint($total) . "\n";
Ejemplo n.º 22
0
        print format("\n\t\t<script type=\"text/javascript\">\n\t\t\twindow.addEventListener(\"load\", function() { hookUploadCheck(\"newfile\", 1, {1}) }, false);\n\t\t</script>\n\t\t<form action=\"" . actionLink("uploader") . "\" method=\"post\" enctype=\"multipart/form-data\">\n\t\t\t<input type='hidden' name='cat' value='{$_GET["cat"]}'>\n\t\t\t<table class=\"outline margin\">\n\t\t\t\t<tr class=\"header0\">\n\t\t\t\t\t<th colspan=\"4\">" . __("Upload") . "</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class=\"cell0\">\n\t\t\t\t\t<td>File</td><td>\n\t\t\t\t\t\t<input type=\"file\" id=\"newfile\" name=\"newfile\" style=\"width: 80%;\" />\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class=\"cell1\">\n\t\t\t\t\t<td>Description</td><td>\n\t\t\t\t\t\t<input type=\"text\" name=\"description\" style=\"width: 80%;\" />\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class=\"cell0\">\n\t\t\t\t\t<td></td><td>\n\t\t\t\t\t\t<input type=\"submit\" id=\"submit\" name=\"action\" value=\"" . __("Upload") . "\" disabled=\"disabled\" />\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class=\"cell1 smallFonts\">\n\t\t\t\t\t<td colspan=\"3\">\n\t\t\t\t\t\t" . __("The maximum upload size is {0} per file. You can upload the following types: {2}.") . "\n\t\t\t\t\t\t<div id=\"sizeWarning\" style=\"display: none; font-weight: bold\">" . __("File is too large.") . "</div>\n\t\t\t\t\t\t<div id=\"typeWarning\" style=\"display: none; font-weight: bold\">" . __("File is not an allowed type.") . "</div>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</form>\n\t\t", BytesToSize($maxSizeMult), $maxSizeMult, Settings::pluginGet('uploaderWhitelist'));
    }
} else {
    if ($_GET['action'] == __("Upload")) {
        AssertForbidden("useUploader");
        if ($loguserid) {
            $cat = getCategory($_POST["cat"]);
            $targetdir = $rootdir;
            $quot = $quota;
            $privateFlag = 0;
            if ($_POST['cat'] == -1) {
                $quot = $pQuota;
                $targetdir = $rootdir . "/" . $loguserid;
                $privateFlag = 1;
            }
            $totalsize = foldersize($targetdir);
            mkdir($targetdir);
            $files = scandir($targetdir);
            if (in_array($_FILES['newfile']['name'], $files)) {
                Alert(format(__("The file \"{0}\" already exists. Please delete the old copy before uploading a new one."), $_FILES['newfile']['name']));
            } else {
                if ($_FILES['newfile']['size'] == 0) {
                    if ($_FILES['newfile']['tmp_name'] == "") {
                        Alert(__("No file given."));
                    } else {
                        Alert(__("File is empty."));
                    }
                } else {
                    if ($_FILES['newfile']['size'] > Settings::pluginGet('uploaderMaxFileSize') * 1024 * 1024) {
                        Alert(format(__("File is too large. Maximum size is {0}."), BytesToSize(Settings::pluginGet('uploaderMaxFileSize') * 1024 * 1024)));
                    } else {
Ejemplo n.º 23
0
function foldersize($path)
{
    $override = apply_filters('pre_foldersize', false, $path);
    if ($override !== false) {
        return $override;
    }
    $total_size = 0;
    $files = scandir($path);
    $cleanPath = rtrim($path, '/') . '/';
    foreach ($files as $t) {
        if ($t != "." && $t != "..") {
            $currentFile = $cleanPath . $t;
            if (is_dir($currentFile)) {
                $size = foldersize($currentFile);
                $total_size += $size;
            } else {
                $size = filesize($currentFile);
                $total_size += $size;
            }
        }
    }
    return $total_size;
}
Ejemplo n.º 24
0
function foldersize($path)
{
    $total_size = 0;
    $files = scandir($path);
    $total_files = 0;
    foreach ($files as $t) {
        if (is_dir(rtrim($path, '/') . '/' . $t)) {
            if ($t != '.' && $t != '..') {
                $size = foldersize(rtrim($path, '/') . '/' . $t);
                $total_size += $size;
            }
        } else {
            $size = filesize(rtrim($path, '/') . '/' . $t);
            $total_size += $size;
            $total_files++;
        }
    }
    return array($total_size, $total_files);
}
Ejemplo n.º 25
0
 public static function estimated_size()
 {
     global $DB;
     global $website;
     // database
     // themes, templates and webgets
     // extensions
     // files
     // database
     $DB->query('SHOW TABLE STATUS');
     // MySQL only!
     $database = array_sum($DB->result('Data_length'));
     $templates = foldersize(NAVIGATE_PRIVATE . '/' . $website->id . '/templates');
     $webgets = foldersize(NAVIGATE_PRIVATE . '/' . $website->id . '/webgets');
     $files = foldersize(NAVIGATE_PRIVATE . '/' . $website->id . '/files');
     $themes = foldersize('themes');
     $extensions = foldersize('plugins');
     return $database + $templates + $webgets + $files + $themes + $extensions;
 }
Ejemplo n.º 26
0
    </div>
  </div>
  <button type="submit" name="Submit"  class="btn btn-default">Save</button>
</form>
<br />
<script>
    $("#rediscover").click(function() {
        var device_id = $(this).data("device_id");
        $.ajax({
            type: 'POST',
            url: 'ajax_form.php',
            data: { type: "rediscover-device", device_id: device_id },
            dataType: "json",
            success: function(data){
                if(data['status'] == 'ok') {
                    toastr.success(data['message']);
                } else {
                    toastr.error(data['message']);
                }
            },
            error:function(){
                toastr.error('An error occured setting this device to be rediscovered');
            }
        });
    });
</script>
<?php 
print_optionbar_start();
list($sizeondisk, $numrrds) = foldersize($config['rrd_dir'] . "/" . $device['hostname']);
echo "Size on Disk: <b>" . formatStorage($sizeondisk) . "</b> in <b>" . $numrrds . " RRD files</b>.";
print_optionbar_end();
Ejemplo n.º 27
0
                echo lang_Open;
                ?>
" class="folder-link" data-file="<?php 
                echo $file;
                ?>
" href="dialog.php?<?php 
                echo $get_params . $src . "&" . uniqid();
                ?>
"><?php 
                echo $file;
                ?>
</a></h4>
				    </div>
				    <?php 
                $date = filemtime($root . $cur_dir . $file);
                $size = foldersize($root . $cur_dir . $file);
                ?>
				    <input type="hidden" class="name" value=""/>
				    <input type="hidden" class="date" value="<?php 
                echo date('Y-mdHis', $date);
                ?>
"/>
				    <input type="hidden" class="size" value="<?php 
                echo $size;
                ?>
"/>
				    <input type="hidden" class="extension" value="<?php 
                echo lang_Type_dir;
                ?>
"/>
				    <div class="file-date"><?php