Exemplo n.º 1
0
function dirsize($dir)
{
    foreach (glob($dir . "/*") as $f) {
        $d += is_file($f) ? filesize($f) : dirsize($f);
    }
    return round($d / 1024, 3);
}
Exemplo n.º 2
0
function dirsize($directory)
{
    if (!is_dir($directory)) {
        return -1;
    }
    $size = 0;
    if ($DIR = opendir($directory)) {
        while (($dirfile = readdir($DIR)) !== false) {
            if (@is_link($directory . '/' . $dirfile) || $dirfile == '.' || $dirfile == '..') {
                continue;
            }
            if (@is_file($directory . '/' . $dirfile)) {
                $size += filesize($directory . '/' . $dirfile);
            } else {
                if (@is_dir($directory . '/' . $dirfile)) {
                    $dirSize = dirsize($directory . '/' . $dirfile);
                    if ($dirSize >= 0) {
                        $size += $dirSize;
                    } else {
                        return -1;
                    }
                }
            }
        }
        closedir($DIR);
    }
    return $size;
}
Exemplo n.º 3
0
function _dirsize($dirName)
{
    $dirsize = 0;
    $dir = opendir($dirName);
    while ($fileName = readdir($dir)) {
        $file = $dirName . "/" . $fileName;
        if ($fileName != "." && $fileName != "..") {
            if (is_dir($file)) {
                $dirsize += dirsize($file);
            } else {
                $dirsize += filesize($file);
            }
        }
    }
    closedir($dir);
    return $dirsize;
}
Exemplo n.º 4
0
function dir_size($dir)
{
    $dh = opendir($dir);
    $size = 0;
    while ($file = readdir($dh)) {
        if ($file != '.' and $file != '..') {
            $path = $dir . "/" . $file;
            if (@is_dir($path)) {
                $size += dirsize($path);
            } else {
                $size += filesize($path);
            }
        }
    }
    @closedir($dh);
    return $size;
}
function dirsize($dir)
{
    @($dh = opendir($dir));
    $size = 0;
    while ($file = @readdir($dh)) {
        if ($file != "." and $file != "..") {
            $path = $dir . "/" . $file;
            if (is_dir($path)) {
                $size += dirsize($path);
                // recursive in sub-folders
            } elseif (is_file($path)) {
                $size += filesize($path);
                // add file
            }
        }
    }
    @closedir($dh);
    return $size;
}
Exemplo n.º 6
0
function xhelpDirsize($dirName = '.', $getResolved = false)
{
    $dir = dir($dirName);
    $size = 0;
    if ($getResolved) {
        $hTicket =& xhelpGetHandler('ticket');
        $hFile =& xhelpGetHandler('file');
        $tickets =& $hTicket->getObjectsByState(1);
        $aTickets = array();
        foreach ($tickets as $ticket) {
            $aTickets[$ticket->getVar('id')] = $ticket->getVar('id');
        }
        // Retrieve all unresolved ticket attachments
        $crit = new Criteria('ticketid', "(" . implode($aTickets, ',') . ")", "IN");
        $files = $hFile->getObjects($crit);
        $aFiles = array();
        foreach ($files as $f) {
            $aFiles[$f->getVar('id')] = $f->getVar('filename');
        }
    }
    while ($file = $dir->read()) {
        if ($file != '.' && $file != '..') {
            if (is_dir($file)) {
                $size += dirsize($dirName . '/' . $file);
            } else {
                if ($getResolved) {
                    if (!in_array($file, $aFiles)) {
                        // Skip unresolved files
                        $size += filesize($dirName . '/' . $file);
                    }
                } else {
                    $size += filesize($dirName . '/' . $file);
                }
            }
        }
    }
    $dir->close();
    return xhelpPrettyBytes($size);
}
Exemplo n.º 7
0
function dirsize($dir)
{
    if (!is_dir($dir) or !is_readable($dir)) {
        return false;
    }
    $size = 0;
    $dh = opendir($dir);
    while (($entry = readdir($dh)) !== false) {
        if ($entry == "." or $entry == "..") {
            continue;
        }
        if (is_file($dir . "/" . $entry)) {
            $size += filesize($dir . "/" . $entry);
        } elseif (is_dir($dir . "/" . $entry)) {
            $size += dirsize($dir . "/" . $entry);
        } else {
            continue;
        }
    }
    closedir($dh);
    return $size;
}
Exemplo n.º 8
0
function dirsize($dir)
{
    if (is_file($dir)) {
        return array('size' => filesize($dir), 'howmany' => 0);
    }
    if ($dh = opendir($dir)) {
        $size = 0;
        $n = 0;
        while (($file = readdir($dh)) !== false) {
            if ($file == '.' || $file == '..') {
                continue;
            }
            $n++;
            $data = dirsize($dir . '/' . $file);
            $size += $data['size'];
            $n += $data['howmany'];
        }
        closedir($dh);
        return array('size' => $size, 'howmany' => $n);
    }
    return array('size' => 0, 'howmany' => 0);
}
Exemplo n.º 9
0
 function dirsize($dir)
 {
     $f = $s = 0;
     $dh = @opendir($dir);
     while ($file = @readdir($dh)) {
         if ($file !== '.' && $file !== '..') {
             $path = $dir . DS . $file;
             if (@is_dir($path)) {
                 $tmp = dirsize($path);
                 $f = $f + $tmp['f'];
                 $s = $s + $tmp['s'];
             } else {
                 $f++;
                 $s += @filesize($path);
             }
         }
     }
     @closedir($dh);
     return array('f' => $f, 's' => $s);
 }
function dirsize($dir)
{
    if (is_file($dir)) {
        return array("size" => filesize($dir), "count" => 1);
    }
    $total_size = 0;
    $files = scandir($dir);
    $total_count = count($files) - 2;
    //do not count . and ..
    foreach ($files as $t) {
        if (is_dir(rtrim($dir, '/') . '/' . $t)) {
            if ($t != "." && $t != "..") {
                $data = dirsize(rtrim($dir, '/') . '/' . $t);
                $size = $data["size"];
                $count = $data["count"];
                $total_size += $size;
                $total_count += $count;
            }
        } else {
            $size = filesize(rtrim($dir, '/') . '/' . $t);
            $total_size += $size;
        }
    }
    return array("size" => $total_size, "count" => $total_count);
}
Exemplo n.º 11
0
 function getTotalFileSize($directory = WP_CONTENT_DIR)
 {
     try {
         if (MainWP_Helper::function_exists('popen')) {
             $uploadDir = MainWP_Helper::getMainWPDir();
             $uploadDir = $uploadDir[0];
             $popenHandle = @popen('du -s ' . $directory . ' --exclude "' . str_replace(ABSPATH, '', $uploadDir) . '"', 'r');
             if ('resource' === gettype($popenHandle)) {
                 $size = @fread($popenHandle, 1024);
                 @pclose($popenHandle);
                 $size = substr($size, 0, strpos($size, "\t"));
                 if (ctype_digit($size)) {
                     return $size / 1024;
                 }
             }
         }
         if (MainWP_Helper::function_exists('shell_exec')) {
             $uploadDir = MainWP_Helper::getMainWPDir();
             $uploadDir = $uploadDir[0];
             $size = @shell_exec('du -s ' . $directory . ' --exclude "' . str_replace(ABSPATH, '', $uploadDir) . '"', 'r');
             if (null !== $size) {
                 $size = substr($size, 0, strpos($size, "\t"));
                 if (ctype_digit($size)) {
                     return $size / 1024;
                 }
             }
         }
         if (class_exists('COM')) {
             $obj = new COM('scripting.filesystemobject');
             if (is_object($obj)) {
                 $ref = $obj->getfolder($directory);
                 $size = $ref->size;
                 $obj = null;
                 if (ctype_digit($size)) {
                     return $size / 1024;
                 }
             }
         }
         function dirsize($dir)
         {
             $dirs = array($dir);
             $size = 0;
             while (isset($dirs[0])) {
                 $path = array_shift($dirs);
                 if (stristr($path, WP_CONTENT_DIR . '/uploads/mainwp')) {
                     continue;
                 }
                 $uploadDir = MainWP_Helper::getMainWPDir();
                 $uploadDir = $uploadDir[0];
                 if (stristr($path, $uploadDir)) {
                     continue;
                 }
                 $res = @glob($path . '/*');
                 if (is_array($res)) {
                     foreach ($res as $next) {
                         if (is_dir($next)) {
                             $dirs[] = $next;
                         } else {
                             $fs = filesize($next);
                             $size += $fs;
                         }
                     }
                 }
             }
             return $size / 1024 / 1024;
         }
         return dirsize($directory);
     } catch (Exception $e) {
         return 0;
     }
 }
Exemplo n.º 12
0
function cron_site_data_daily()
{
    require_once get_config('libroot') . 'registration.php';
    $current = site_data_current();
    $time = db_format_timestamp(time());
    // Total users
    insert_record('site_data', (object) array('ctime' => $time, 'type' => 'user-count-daily', 'value' => $current['users']));
    // Logged-in users
    $interval = is_postgres() ? "'1 day'" : '1 day';
    $where = "lastaccess >= DATE(?) AND lastaccess < DATE(?)+ INTERVAL {$interval}";
    insert_record('site_data', (object) array('ctime' => $time, 'type' => 'loggedin-users-daily', 'value' => count_records_select('usr', $where, array($time, $time))));
    // Process log file containing view visits
    $viewlog = get_config('dataroot') . 'log/views.log';
    if (@rename($viewlog, $viewlog . '.temp') and $fh = @fopen($viewlog . '.temp', 'r')) {
        // Read the new stuff out of the file
        $latest = get_config('viewloglatest');
        $visits = array();
        while (!feof($fh)) {
            $line = fgets($fh, 1024);
            if (preg_match('/^\\[(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})\\] (\\d+)$/', $line, $m) && $m[1] > $latest) {
                $visits[] = (object) array('ctime' => $m[1], 'view' => $m[2]);
            }
        }
        fclose($fh);
        // Get per-view counts for the view table.
        $visitcounts = array();
        foreach ($visits as &$v) {
            if (!isset($visitcounts[$v->view])) {
                $visitcounts[$v->view] = 0;
            }
            $visitcounts[$v->view]++;
        }
        // Add visit records to view_visit
        foreach ($visits as &$v) {
            if (record_exists('view', 'id', $v->view)) {
                insert_record('view_visit', $v);
            }
        }
        // Delete view_visit records > 1 week old
        delete_records_select('view_visit', 'ctime < CURRENT_DATE - INTERVAL ' . (is_postgres() ? "'1 week'" : '1 WEEK'));
        // Update view counts
        foreach ($visitcounts as $viewid => $newvisits) {
            execute_sql("UPDATE {view} SET visits = visits + ? WHERE id = ?", array($newvisits, $viewid));
        }
        set_config('viewloglatest', $time);
        unlink($viewlog . '.temp');
    }
    require_once 'function.dirsize.php';
    if ($diskusage = dirsize(get_config('dataroot'))) {
        // Currently there is no need to track disk usage
        // over time, so delete old records first.
        delete_records('site_data', 'type', 'disk-usage');
        insert_record('site_data', (object) array('ctime' => $time, 'type' => 'disk-usage', 'value' => $diskusage));
    }
    graph_site_data_daily();
}
Exemplo n.º 13
0
function import_validate(Pieform $form, $values)
{
    global $USER, $TRANSPORTER;
    if (!isset($values['leap2afile'])) {
        $form->set_error('leap2afile', $form->i18n('rule', 'required', 'required'));
        return;
    }
    if ($values['leap2afile']['type'] == 'application/octet-stream') {
        require_once 'file.php';
        $mimetype = file_mime_type($values['leap2afile']['tmp_name']);
    } else {
        $mimetype = trim($values['leap2afile']['type'], '"');
    }
    $date = time();
    $niceuser = preg_replace('/[^a-zA-Z0-9_-]/', '-', $USER->get('username'));
    safe_require('import', 'leap');
    $fakeimportrecord = (object) array('data' => array('importfile' => $values['leap2afile']['tmp_name'], 'importfilename' => $values['leap2afile']['name'], 'importid' => $niceuser . '-' . $date, 'mimetype' => $mimetype));
    $TRANSPORTER = new LocalImporterTransport($fakeimportrecord);
    try {
        $TRANSPORTER->extract_file();
        PluginImportLeap::validate_transported_data($TRANSPORTER);
    } catch (Exception $e) {
        $form->set_error('leap2afile', $e->getMessage());
        $TRANSPORTER->cleanup();
    }
    // Check if import data may exceed the user's file quota
    $importdata = $TRANSPORTER->files_info();
    require_once 'function.dirsize.php';
    $importdatasize = dirsize($importdata['tempdir'] . 'extract/files');
    if ($USER->get('quotaused') + $importdatasize > $USER->get('quota')) {
        $form->set_error('leap2afile', get_string('importexceedquota', 'import'));
        $TRANSPORTER->cleanup();
    }
}
Exemplo n.º 14
0
function CleanOldInstall()
{
    foreach (glob("/root/APP_*", GLOB_ONLYDIR) as $dirname) {
        if (!is_dir($dirname)) {
            return;
        }
        $time = file_get_time_min($dirname);
        if ($time > 2880) {
            echo "Removing {$dirname}\n";
            $GLOBALS["DELETED_SIZE"] = $GLOBALS["DELETED_SIZE"] + dirsize($dirname);
            shell_exec("/bin/rm -rf {$dirname}");
        }
    }
}
Exemplo n.º 15
0
function dirsize($dir)
{
    $size = 0;
    $dirp = @opendir($dir);
    if (!$dirp) {
        return 0;
    }
    while (($file = readdir($dirp)) !== false) {
        if ($file[0] == '.') {
            continue;
        }
        if (is_dir("{$dir}/{$file}")) {
            $size += dirsize("{$dir}/{$file}");
        } else {
            $size += filesize("{$dir}/{$file}");
        }
    }
    closedir($dirp);
    return $size;
}
Exemplo n.º 16
0
     $errors = array('FILE_ILLEGAL', $ext);
     $msg->addError($errors);
     handleAjaxUpload(500);
     header('Location: index.php?pathext=' . $_POST['pathext'] . SEP . 'framed=' . $framed . SEP . 'cp=' . $_GET['cp'] . SEP . 'pid=' . $_GET['pid'] . SEP . 'cid=' . $_GET['cid'] . SEP . 'a_type=' . $_GET['a_type']);
     exit;
 }
 /* also have to handle the 'application/x-zip-compressed'  case	*/
 if ($_FILES['uploadedfile']['type'] == 'application/x-zip-compressed' || $_FILES['uploadedfile']['type'] == 'application/zip' || $_FILES['uploadedfile']['type'] == 'application/x-zip') {
     $is_zip = true;
 }
 /* anything else should be okay, since we're on *nix.. hopefully */
 $_FILES['uploadedfile']['name'] = str_replace(array(' ', ',', '/', '\\', ':', ';', '*', '?', '"', '<', '>', '|', '\''), '', $_FILES['uploadedfile']['name']);
 /* if the file size is within allowed limits */
 if ($_FILES['uploadedfile']['size'] > 0 && $_FILES['uploadedfile']['size'] <= $my_MaxFileSize) {
     /* if adding the file will not exceed the maximum allowed total */
     $course_total = dirsize($path);
     if ($course_total + $_FILES['uploadedfile']['size'] <= $my_MaxCourseSize + $MaxCourseFloat || $my_MaxCourseSize == AT_COURSESIZE_UNLIMITED) {
         /* check if this file exists first */
         if (file_exists($path . $_FILES['uploadedfile']['name'])) {
             /* this file already exists, so we want to prompt for override */
             /* save it somewhere else, temporarily first			*/
             /* file_name.time ? */
             $_FILES['uploadedfile']['name'] = substr(time(), -4) . '.' . $_FILES['uploadedfile']['name'];
             $f = array('FILE_EXISTS', substr($_FILES['uploadedfile']['name'], 5), $_FILES['uploadedfile']['name'], $_POST['pathext'], $_GET['popup'], SEP);
             $msg->addFeedback($f);
         }
         /* copy the file in the directory */
         $result = move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $path . $_FILES['uploadedfile']['name']);
         if (!$result) {
             require AT_INCLUDE_PATH . 'header.inc.php';
             $msg->printErrors('FILE_NOT_SAVED');
Exemplo n.º 17
0
    echo _AT('course_quota');
    ?>
<br />
		<?php 
    if ($this->row['max_quota'] == AT_COURSESIZE_UNLIMITED) {
        $c_unlim = ' checked="checked" ';
        $c_oth2 = ' disabled="disabled" ';
    } elseif ($this->row['max_quota'] == AT_COURSESIZE_DEFAULT) {
        $c_def = ' checked="checked" ';
        $c_oth2 = ' disabled="disabled" ';
    } else {
        $c_oth = ' checked="checked" ';
        $c_oth2 = '';
    }
    if ($this->course > 0) {
        $course_size = dirsize(AT_CONTENT_DIR . $this->course . '/');
    } else {
        $course_size = 0;
    }
    if ($this->course) {
        echo _AT('current_course_size') . ': ' . get_human_size($course_size) . '<br />';
    }
    ?>

		<input type="radio" id="c_default" name="quota" value="<?php 
    echo AT_COURSESIZE_DEFAULT;
    ?>
" onclick="disableOther();" <?php 
    echo $c_def;
    ?>
 /><label for="c_default"> <?php 
Exemplo n.º 18
0
$hiddencomtotal = $DB->result($DB->query("SELECT COUNT(commentid) FROM {$db_prefix}comments WHERE visible='0'"), 0);
$tagtotal = $DB->result($DB->query("SELECT COUNT(mid) FROM {$db_prefix}metas WHERE type='tag'"), 0);
$linktotal = $DB->result($DB->query("SELECT COUNT(linkid) FROM {$db_prefix}links"), 0);
$server['datetime'] = sadate('Y-m-d H:i:s');
$server['software'] = $_SERVER['SERVER_SOFTWARE'];
if (function_exists('memory_get_usage')) {
    $server['memory_info'] = get_real_size(memory_get_usage());
}
$mysql_version = mysql_get_server_info();
$mysql_runtime = '';
$query = $DB->query("SHOW STATUS");
while ($r = $DB->fetch_array($query)) {
    if (eregi("^uptime", $r['Variable_name'])) {
        $mysql_runtime = $r['Value'];
    }
}
$mysql_runtime = format_timespan($mysql_runtime);
require_once SABLOG_ROOT . 'include/func/attachment.func.php';
$attachdir = SABLOG_ROOT . $options['attachments_dir'];
$attachsize = dirsize($attachdir);
$dircount = dircount($attachdir);
$realattachsize = is_numeric($attachsize) ? sizecount($attachsize) : '不详';
$stats = $DB->fetch_one_array("SELECT count(attachmentid) as count, sum(filesize) as sum FROM {$db_prefix}attachments");
$stats['count'] = $stats['count'] != 0 ? $stats['count'] : 0;
$stats['sum'] = $stats['count'] == 0 ? '0 KB' : sizecount($stats['sum']);
$now_version = rawurlencode($SABLOG_VERSION);
$now_release = rawurlencode($SABLOG_RELEASE);
$now_hostname = rawurlencode($_SERVER['HTTP_HOST']);
$now_url = rawurlencode($options['url']);
cpheader();
include template('main');
function dirsize($cwd)
{
    $dh = @opendir($cwd);
    $size = 0;
    while ($file = @readdir($dh)) {
        if ($file != '.' && $file != '..') {
            $path = $cwd . '/' . $file;
            $size += @is_dir($path) ? dirsize($path) : sprintf("%u", @filesize($path));
        }
    }
    @closedir($dh);
    return $size;
}
Exemplo n.º 20
0
 function restore_files()
 {
     $sql = "SELECT max_quota FROM " . TABLE_PREFIX . "courses WHERE course_id={$this->course_id}";
     $result = mysql_query($sql, $this->db);
     $row = mysql_fetch_assoc($result);
     if ($row['max_quota'] != AT_COURSESIZE_UNLIMITED) {
         global $MaxCourseSize, $MaxCourseFloat;
         if ($row['max_quota'] == AT_COURSESIZE_DEFAULT) {
             $row['max_quota'] = $MaxCourseSize;
         }
         $totalBytes = dirsize($this->import_dir . 'content/');
         $course_total = dirsize(AT_CONTENT_DIR . $this->course_id . '/');
         $total_after = $row['max_quota'] - $course_total - $totalBytes + $MaxCourseFloat;
         if ($total_after < 0) {
             //debug('not enough space. delete everything');
             // remove the content dir, since there's no space for it
             clr_dir($this->import_dir);
             return FALSE;
         }
     }
     copys($this->import_dir . 'content/', AT_CONTENT_DIR . $this->course_id);
 }
Exemplo n.º 21
0
            $val = $lang['correct'];
        } else {
            $val = '<span style="background-color: #f00;">' . $lang['incorrect'] . '</span>';
        }
        $tpl->set("val", $val);
        $tpl->out(3);
    }
    $tpl->out(2);
    // Server
    $result = db_query("SHOW TABLE STATUS");
    $dbsize = 0;
    while ($row = mysql_fetch_assoc($result)) {
        $dbsize += $row['Data_length'];
    }
    $tpl->set_out('head', 'Informationen', 1);
    $infos = array('Serversoftware' => $_SERVER["SERVER_SOFTWARE"], 'Server (PHP) Zeit' => date('Y-m-d H:i:s'), 'SQL Zeit' => db_result(db_query("SELECT NOW()")), 'MySQL-Version' => db_result(db_query("SELECT VERSION()")), 'Datenbankgr&ouml;&szlig;e' => nicebytes($dbsize), 'Linkusordnergr&ouml;&szlig;e' => nicebytes(dirsize('include/images/linkus/')), 'Avatarordnergr&ouml;&szlig;e' => nicebytes(dirsize('include/images/avatars/')), 'Galleryordnergr&ouml;&szlig;e' => nicebytes(dirsize('include/images/gallery/')), 'Usergalleryordnergr&ouml;&szlig;e' => nicebytes(dirsize('include/images/usergallery/')), 'Gegnerordnergr&ouml;&szlig;e' => nicebytes(dirsize('include/images/opponents/')));
    foreach ($infos as $k => $str) {
        if ($class == 'Cmite') {
            $class = 'Cnorm';
        } else {
            $class = 'Cmite';
        }
        $tpl->set("class", $class);
        $tpl->set("opt", $k);
        $tpl->set("val", $str);
        $tpl->out(3);
    }
    $tpl->out(2);
    $tpl->out(4);
    $design->footer();
}
Exemplo n.º 22
0
function dirsize($id)
{
    $total = 0;
    foreach ($GLOBALS["db"]->select("file", array('owner' => $_SESSION["username"], 'dir' => $id, 'recycle' => '0')) as $d) {
        $total += $d["size"];
    }
    foreach ($GLOBALS["db"]->select("dir", array('owner' => $_SESSION["username"], 'parent' => $id, 'recycle' => '0')) as $d) {
        $total += dirsize($d["id"]);
    }
    return $total;
}
Exemplo n.º 23
0
			echo "<td class='bartop' align='left'>Type</td>";
			echo "<td class='bartop' align='center' >Modified</td>";
			echo "<td class='bartop' align='center' >Attributes</td>";
			echo "<td class='bartop' >Actions</td></tr>";
			
//echo"<table width='100%' border='0' cellspacing='1' cellpadding = '2' class = 'outer'>";
	if ($root != $dirpath) {
		echo "<tr><td width='4%' align='center'><a href='".$urlpath."?rootpath=".substr($dirpath, 0, strrpos($dirpath, "/"))."'><img src=".XOOPS_URL."/modules/".$xoopsModule->dirname()."/images/icon/back.gif></td><td align='left'><a href='".$urlpath."?rootpath=".substr($dirpath, 0, strrpos($dirpath, "/"))."'>Parent Directory</td></tr>";
	}
//Get folder info and details
	
	for ($i=0;$i<Count($dirlist);$i++) {
    	echo "<tr>";
		echo "<td width='4%' align='center'>$folderimg</td>";
		echo "<td class='filemantext' style='white-space:nowrap' onmouseover='this.style.cursor=\"hand\";'><a href='".$urlpath."?rootpath=".$dirpath."/".$dirlist[$i]."'>".$dirlist[$i]."</a></td>";
		echo "<td align='left' class='filemantext'>".dirsize($dirpath."/".$dirlist[$i])."</td>";
		echo "<td align='left' class='filemantext'>Folder</td>";
		echo "<td align='left' class='filemantext'>".lastaccess($dirpath."/".$dirlist[$i], "E1")."</td>";
	    echo "<td align='center' class='filemantext' >".get_perms($dirpath."/".$dirlist[$i])."</td>";
		echo "<td align='left' class='filemantext'>";
		echo "<a href='".$urlpath."?action=delete&workpath=".$dirpath."&file=".$dirpath."/".$dirlist[$i]."'>$deleteimg</a>";        
		echo "<a href='".$urlpath."?action=rename&workpath=".$dirpath."&file=".$dirpath."/".$dirlist[$i]."'>$renameimg</a> ";
		//echo "<a href='".$urlpath."?rootpath=".$dirpath."/".$dirlist[$i]."'>ChDr</a> ";
		echo "</td></tr>";
	}
//Get file info and details
	for ($i=0;$i<Count($filelist);$i++) {
		echo "<tr>";
		$file = $dirpath."/".$filelist[$i];
		$icon = get_icon($dirpath."/".$filelist[$i]);
		echo "<td width='4%' align='center'><img src=$pathtoimages$icon></td>";
Exemplo n.º 24
0
        $info = DB::fetch_row($q_info);
        $totalDownloads = (int) $info[0];
        $q_info = DB::query("SELECT sum(`Size`) FROM `" . DCRM_CON_PREFIX . "Packages`");
        $info = DB::fetch_row($q_info);
        $poolSize = (int) $info[0];
        $poolSize_withext = sizeext($poolSize);
        $q_info = DB::query("SELECT count(*) FROM `" . DCRM_CON_PREFIX . "Packages`");
        $info = DB::fetch_row($q_info);
        $num[0] = (int) $info[0];
        $q_info = DB::query("SELECT count(*) FROM `" . DCRM_CON_PREFIX . "Packages` WHERE `Stat` != '-1'");
        $info = DB::fetch_row($q_info);
        $num[1] = (int) $info[0];
        $q_info = DB::query("SELECT count(*) FROM `" . DCRM_CON_PREFIX . "Sections`");
        $info = DB::fetch_row($q_info);
        $num[2] = (int) $info[0];
        $tmpSize = dirsize("../tmp");
        $tmpSize_withext = sizeext($tmpSize);
        $content = "\t\t\t\t\t\t" . __('Total download times: ') . $totalDownloads . '<br />' . __('Number of packages: ') . $num[0] . '<br />' . __('Number of non-hidden packages: ') . $num[1] . '<br />' . __('Number of sections: ') . $num[2] . '<br />' . __('Download pool size: ') . $poolSize_withext . '<br /><span>' . __('Cache pool size: ') . $tmpSize_withext . '</span> <span><a href="stats.php?action=clean">' . __('Clean cache') . "</span></a>\n";
        echo $content;
        ?>
						<br />
						<!-- Statistics Start -->
<?php 
        if (defined("AUTOFILL_STATISTICS_INFO")) {
            echo "\t\t\t\t\t\t" . AUTOFILL_STATISTICS_INFO . "\n";
        }
        ?>
						<!-- Statistics End -->
					</div>
				</div>
<?php 
Exemplo n.º 25
0
function dirsize($dir)
{
    $_SERVER["DOCUMENT_ROOT"] . e_HTTP . $dir;
    $dh = @opendir($_SERVER["DOCUMENT_ROOT"] . e_HTTP . $dir);
    $size = 0;
    while ($file = @readdir($dh)) {
        if ($file != "." and $file != "..") {
            $path = $dir . "/" . $file;
            if (is_file($_SERVER["DOCUMENT_ROOT"] . e_HTTP . $path)) {
                $size += filesize($_SERVER["DOCUMENT_ROOT"] . e_HTTP . $path);
            } else {
                $size += dirsize($path . "/");
            }
        }
    }
    @closedir($dh);
    return parsesize($size);
}
Exemplo n.º 26
0
function home()
{
    require_once BASE_DIR_CMS . "Mail.php";
    // Testmail schicken und gleich raus hier
    if (false !== ($test_mail_adresse = getRequestValue('test_mail_adresse', 'post')) and $test_mail_adresse != "") {
        header('content-type: text/html; charset=' . CHARSET . '');
        global $specialchars;
        $test_mail_adresse = $specialchars->rebuildSpecialChars($test_mail_adresse, false, false);
        if (isMailAddressValid($test_mail_adresse)) {
            sendMail(getLanguageValue("home_mailtest_mailsubject"), getLanguageValue("home_mailtest_mailcontent"), $test_mail_adresse, $test_mail_adresse);
            ajax_return("success", true, returnMessage(true, getLanguageValue("home_messages_test_mail") . "<br /><br /><b>" . $test_mail_adresse . '</b>'), true, true);
        } else {
            ajax_return("error", true, returnMessage(false, getLanguageValue("home_error_test_mail") . "<br /><br /><b>" . $test_mail_adresse . '</b>'), true, true);
        }
        exit;
    }
    global $CMS_CONF;
    if ($CMS_CONF->get('usesitemap') == "true") {
        global $message;
        if (!is_file(BASE_DIR . 'robots.txt')) {
            if (true !== ($error_message = write_robots())) {
                $message .= $error_message;
            }
        }
        if (!is_file(BASE_DIR . 'sitemap.xml')) {
            if (true != ($error_message = write_xmlsitmap())) {
                $message .= $error_message;
            }
        }
    }
    // CMS-Hilfe
    $titel = "home_help";
    if (file_exists(BASE_DIR . "docu/index.php")) {
        $error[$titel][] = false;
        $template[$titel][] = getLanguageValue("home_help_text_docu") . '&nbsp;&nbsp;<a href="' . URL_BASE . 'docu/index.php" target="_blank" class="mo-butten-a-img"><img class="mo-icons-icon mo-icons-docu" src="' . ICON_URL_SLICE . '" alt="docu" hspace="0" vspace="0" border="0" /></a>';
        $error[$titel][] = false;
        $template[$titel][] = getLanguageValue("home_help_text_info") . '&nbsp;&nbsp;<a href="' . URL_BASE . 'docu/index.php?menu=false&amp;artikel=start" target="_blank" class="js-docu-link mo-butten-a-img"><img class="mo-icons-icon mo-icons-help" src="' . ICON_URL_SLICE . '" alt="help" hspace="0" vspace="0" border="0" /></a>';
    } else {
        $error[$titel][] = true;
        $template[$titel][] = getLanguageValue("home_no_help");
    }
    // Zeile "Multiuser Reset"
    if (defined('MULTI_USER') and MULTI_USER) {
        $titel = "home_multiuser";
        $error[$titel][] = false;
        $template[$titel][] = array(getLanguageValue("home_multiuser_text"), '<form action="index.php?action=' . ACTION . '" method="post">' . '<input type="hidden" name="logout_other_users" value="true" />' . '<input type="submit" name="submitlogout_other_users" value="' . getLanguageValue("home_multiuser_button") . '" />' . '</form>');
    }
    // CMS-INFOS
    $titel = "home_cmsinfo";
    // Zeile "CMS-VERSION"
    $error[$titel][] = false;
    $template[$titel][] = array(getLanguageValue("home_cmsversion_text"), CMSVERSION . ' ("' . CMSNAME . '")<br />' . getLanguageValue("home_cmsrevision_text") . ' ' . CMSREVISION);
    // Zeile "Gesamtgröße des CMS"
    $cmssize = convertFileSizeUnit(dirsize(BASE_DIR));
    if ($cmssize === false) {
        $error[$titel][] = true;
        $cmssize = "0";
    } else {
        $error[$titel][] = false;
    }
    $template[$titel][] = array(getLanguageValue("home_cmssize_text"), $cmssize);
    // Zeile "Installationspfad" und alle 40 Zeichen einen Zeilenumbruch einfügen
    $path = BASE_DIR;
    if (strlen($path) >= 40) {
        $path = explode("/", $path);
        if (is_array($path)) {
            if (empty($path[count($path) - 1])) {
                unset($path[count($path) - 1]);
            }
            $i = 0;
            $new_path[$i] = "";
            foreach ($path as $string) {
                $string = $string . "/";
                if (strlen($new_path[$i] . $string) <= 40) {
                    $new_path[$i] = $new_path[$i] . $string;
                } else {
                    $i++;
                    $new_path[$i] = $string;
                }
            }
        }
        $path = implode("<br />", $new_path);
    }
    $error[$titel][] = false;
    $template[$titel][] = array(getLanguageValue("home_installpath_text"), $path);
    // SERVER-INFOS
    $titel = "home_serverinfo";
    // Aktueles Datum
    $error[$titel][] = false;
    $time_zone = date("T");
    if (function_exists('date_default_timezone_get')) {
        $time_zone = @date_default_timezone_get();
    }
    $template[$titel][] = array(getLanguageValue("home_date_text"), date("Y-m-d H.i.s") . " " . $time_zone);
    // Sprache
    $error[$titel][] = false;
    if (false !== ($locale = @setlocale(LC_TIME, "0"))) {
        $template[$titel][] = array(getLanguageValue("home_text_locale"), $locale);
    } else {
        $template[$titel][] = array(getLanguageValue("home_text_locale"), getLanguageValue("home_text_nolocale"));
    }
    // Zeile "PHP-Version"
    if (version_compare(PHP_VERSION, MIN_PHP_VERSION) >= 0) {
        $error[$titel][] = "ok";
        $template[$titel][] = array(getLanguageValue("home_phpversion_text"), phpversion());
    } else {
        $error[$titel][] = getLanguageValue("home_error_phpversion_text");
        $template[$titel][] = array(getLanguageValue("home_phpversion_text"), phpversion());
    }
    // Zeile "Safe Mode"
    if (ini_get('safe_mode')) {
        $error[$titel][] = getLanguageValue("home_error_safe_mode");
        $template[$titel][] = array(getLanguageValue("home_text_safemode"), getLanguageValue("yes"));
    } else {
        $error[$titel][] = "ok";
        $template[$titel][] = array(getLanguageValue("home_text_safemode"), getLanguageValue("no"));
    }
    // Zeile "GDlib installiert"
    if (!extension_loaded("gd")) {
        $error[$titel][] = getLanguageValue("home_error_gd");
        $template[$titel][] = array(getLanguageValue("home_text_gd"), getLanguageValue("no"));
    } else {
        $error[$titel][] = "ok";
        $template[$titel][] = array(getLanguageValue("home_text_gd"), getLanguageValue("yes"));
    }
    if ($CMS_CONF->get('modrewrite') == "true") {
        # mod_rewrite wird mit javascript ermitelt und ausgetauscht
        $error[$titel][] = getLanguageValue("home_error_mod_rewrite");
        $template[$titel][] = array('<span id="mod-rewrite-false">' . getLanguageValue("home_mod_rewrite") . '</span>', getLanguageValue("no"));
    } else {
        $error[$titel][] = false;
        $template[$titel][] = array('<span id="mod-rewrite-false">' . getLanguageValue("home_mod_rewrite") . '</span>', getLanguageValue("home_mod_rewrite_deact"));
    }
    # backupsystem
    if (function_exists('gzopen')) {
        $error[$titel][] = "ok";
        $template[$titel][] = array(getLanguageValue("home_text_backupsystem"), getLanguageValue("yes"));
    } else {
        $error[$titel][] = true;
        $template[$titel][] = array(getLanguageValue("home_error_backupsystem"), getLanguageValue("no"));
    }
    # MULTI_USER
    if (defined('MULTI_USER') and MULTI_USER) {
        $mu_string = "";
        $rest_time = MULTI_USER_TIME;
        if ($rest_time >= 86400) {
            $mu_string .= floor(MULTI_USER_TIME / 86400) . " " . (floor(MULTI_USER_TIME / 86400) > 1 ? getLanguageValue("days") : getLanguageValue("day")) . " ";
            $rest_time = $rest_time - floor(MULTI_USER_TIME / 86400) * 86400;
        }
        if ($rest_time >= 3600) {
            $mu_string .= floor($rest_time / 3600) . " " . (floor($rest_time / 3600) > 1 ? getLanguageValue("hours") : getLanguageValue("hour")) . " ";
            $rest_time = $rest_time - floor($rest_time / 3600) * 3600;
        }
        if ($rest_time >= 60) {
            $mu_string .= floor($rest_time / 60) . " " . (floor($rest_time / 60) > 1 ? getLanguageValue("minutes") : getLanguageValue("minute")) . " ";
            $rest_time = $rest_time - floor($rest_time / 60) * 60;
        }
        if ($rest_time > 0) {
            $mu_string .= $rest_time . " " . ($rest_time > 1 ? getLanguageValue("seconds") : getLanguageValue("second"));
        }
        $error[$titel][] = "ok";
        $template[$titel][] = array(getLanguageValue("home_multiuser_mode_text"), $mu_string);
    } else {
        $error[$titel][] = true;
        $template[$titel][] = array(getLanguageValue("home_multiuser_mode_text"), getLanguageValue("no"));
    }
    // E-Mail test
    if (isMailAvailable()) {
        $titel = "home_titel_test_mail";
        $error[$titel][] = false;
        $template[$titel][] = array(getLanguageValue("home_text_test_mail"), '<input type="text" class="mo-input-text" name="test_mail_adresse" value="" />');
    } else {
        $titel = "home_titel_test_mail";
        $error[$titel][] = true;
        $template[$titel][] = getLanguageValue("home_messages_no_mail");
    }
    return contend_template($template, $error);
}
Exemplo n.º 27
0
function dirsize($dir){
	$dh = @opendir($dir);
	$size = 0;
	while($file = @readdir($dh)) {
		if($file != '.' && $file != '..') {
			$path = $dir.'/'.$file;
			if(@is_dir($path)) {
				$size += dirsize($path);
			} else {
				$size += @filesize($path);
			}
		}
	}
	@closedir($dh);
	return $size;
}
Exemplo n.º 28
0
<div class="container-fluid full-height">
    <div class="row full-height">
        <div class="col-md-12 full-height main-frame-container">
            <div class="panel panel-primary main-frame">
                <div class="panel-heading">Package Manager</div>
                <div class="panel-body">
                    <div class="file-detail full-height col-md-4"></div>
                    <div class="file-manager scroll-pane full-height col-md-12">
                        <?php 
$files_array = array();
$dir = new DirectoryIterator(dirname(__FILE__) . "/packages");
while ($dir->valid()) {
    if (!$dir->isDot() && $dir->isDir()) {
        // sort key, ie. modified timestamp
        $key = $dir->getCTime();
        $data = array($dir->getFilename(), dirsize($dir->getPathname()));
        $files_array[$key] = $data;
    }
    $dir->next();
}
ksort($files_array);
$files_array = array_reverse($files_array, true);
foreach ($files_array as $key => $fileinfo) {
    ?>
                                <div class="dir-item" data-package="<?php 
    echo $fileinfo[0];
    ?>
"><a href="?package=<?php 
    echo $fileinfo[0];
    ?>
" onClick="return false;">
Exemplo n.º 29
0
function dirsize($dir) {
  $size = 0;
  $dirp = @opendir($dir);
  if (!$dirp) return 0;
  while (($file=readdir($dirp)) !== false) {
    if ($file[0]=='.') continue;
    if (is_dir("$dir/$file")) $size+=dirsize("$dir/$file");
    else $size+=filesize("$dir/$file");
  }
  closedir($dirp);
  return $size;
}
Exemplo n.º 30
0
        clr_dir($import_path);
        header('Location: question_db.php');
        exit;
    }
    error_reporting(AT_ERROR_REPORTING);
}
/* get the course's max_quota */
$sql = "SELECT max_quota FROM " . TABLE_PREFIX . "courses WHERE course_id={$_SESSION['course_id']}";
$result = mysql_query($sql, $db);
$q_row = mysql_fetch_assoc($result);
if ($q_row['max_quota'] != AT_COURSESIZE_UNLIMITED) {
    if ($q_row['max_quota'] == AT_COURSESIZE_DEFAULT) {
        $q_row['max_quota'] = $MaxCourseSize;
    }
    $totalBytes = dirsize($import_path);
    $course_total = dirsize(AT_CONTENT_DIR . $_SESSION['course_id'] . '/');
    $total_after = $q_row['max_quota'] - $course_total - $totalBytes + $MaxCourseFloat;
    if ($total_after < 0) {
        /* remove the content dir, since there's no space for it */
        $errors = array('NO_CONTENT_SPACE', number_format(-1 * ($total_after / AT_KBYTE_SIZE), 2));
        $msg->addError($errors);
        clr_dir($import_path);
        if (isset($_GET['tile'])) {
            header('Location: ' . $_base_path . 'mods/_standard/tile/index.php');
        } else {
            header('Location: question_db.php');
        }
        exit;
    }
}
$ims_manifest_xml = @file_get_contents($import_path . 'imsmanifest.xml');