# | Web http://www.artlantis.net | # +------------------------------------------------------------------------+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'lethe.php'; /* Auth Control */ include_once LETHE . DIRECTORY_SEPARATOR . '/lib/lethe.class.php'; include_once LETHE_ADMIN . DIRECTORY_SEPARATOR . '/inc/inc_auth.php'; include_once LETHE_ADMIN . DIRECTORY_SEPARATOR . '/inc/org_set.php'; /* Permissions */ $LEUPLOAD_MIMES = array(); $LEUPLOAD_MAX_UPL = 2097152; # 2MB /* Listing */ $LEUPLOAD_PERPAGE_LIST = 7; /* Upload Area */ define('LEUPLOAD_STORE', set_org_resource); if (!file_exists(LEUPLOAD_STORE)) { die('Organization Folder is Not Exists!'); } /* Storage Size */ define('LEUPLOAD_STORAGE_SIZE', GetDirectorySize(LEUPLOAD_STORE)); define('LEUPLOAD_STORAGE_FILE_COUNT', count(glob(LEUPLOAD_STORE . "/*", GLOB_BRACE))); /* Allowed Image File List */ $LEUPLOAD_UPLOAD_LIST = array('jpg' => array('image/jpeg'), 'bmp' => array('image/x-ms-bmp'), 'gif' => array('image/gif'), 'png' => array('image/png'), 'doc' => array('application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'), 'pdf' => array('application/pdf'), 'xls' => array('application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'), 'zip' => array('application/zip'), 'txt' => array('text/plain')); /* Full Doc List */ $LEUPLOAD_INFO_FILES = array_merge(array_keys($LEUPLOAD_UPLOAD_LIST)); /* Load Mime Types */ foreach ($LEUPLOAD_UPLOAD_LIST as $k => $v) { foreach ($v as $b => $a) { $LEUPLOAD_MIMES[] = $a; } }
elseif ($modality == "mr") { /* if its a zip file, unzip it (without paths) */ chdir($uploadpath); $zips = glob("$uploadpath*.zip"); //print_r($zips); foreach ($zips as $zip) { $systemstring = "unzip -j '$zip'"; `$systemstring`; $systemstring = "rm '$zip'"; `$systemstring`; } } else { /* update the DB with the files that were uploaded */ $filecount = count(glob("$uploadpath*")); $filesize = GetDirectorySize($uploadpath); $systemstring = "chmod -R 777 $uploadpath"; $output = `$systemstring`; $sqlstring = "update $modality" . "_series set series_numfiles = $filecount, series_size = $filesize where $modality" . "series_id = $seriesid"; //echo "$sqlstring"; $result3 = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>"); } } // to pass data through iframe you will need to encode all html tags echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); /* functions must be at the end of the script, classes at the beginning, eh? */ function GetDirectorySize($dirname) {
function GetDirectorySize($dirname) { //echo "Checking $dirname<br>"; // open the directory, if the script cannot open the directory then return folderSize = 0 $dir_handle = opendir($dirname); if (!$dir_handle) return 0; $folderSize = 0; // traversal for every entry in the directory while ($file = readdir($dir_handle)){ //echo "$dirname/$file<br>"; // ignore '.' and '..' directory if ($file != "." && $file != "..") { // if entry is directory then go recursive ! if (is_dir($dirname."/".$file)){ $folderSize += GetDirectorySize($dirname.'/'.$file); // if file then accumulate the size } else { $folderSize += filesize($dirname."/".$file); } } } // chose the directory closedir($dir_handle); // return $dirname folder size return $folderSize ; }
</div> </div> </div> <hr> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-3"> <h3><?php echo organizations_organization; ?> </h3><hr> <ul class="list-group"> <li class="list-group-item"><?php echo organizations_disk_usage; ?> <span class="badge"><?php echo formatBytes(GetDirectorySize(set_org_resource)); ?> </span></li> <li class="list-group-item"><?php echo organizations_users; ?> <span class="badge"><?php echo calcSource(set_org_id, 'users'); ?> </span></li> <li class="list-group-item"><?php echo newsletter_newsletter; ?> <span class="badge"><?php echo calcSource(set_org_id, 'newsletters'); ?>
function DisplayFileList($seriesid, $modality, $datatype) { $modality = strtolower($modality); $sqlstring = "select a.*, b.study_num, b.study_id, d.uid, d.subject_id from $modality" . "_series a left join studies b on a.study_id = b.study_id left join enrollment c on b.enrollment_id = c.enrollment_id left join subjects d on c.subject_id = d.subject_id left join projects e on c.project_id = e.project_id where a.$modality" . "series_id = $seriesid"; $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>"); $row = mysql_fetch_array($result, MYSQL_ASSOC); $subjectid = $row['subject_id']; $uid = $row['uid']; $study_num = $row['study_num']; $studyid = $row['study_id']; $series_datetime = date('g:ia',strtotime($row['series_datetime'])); $protocol = $row['series_desc']; $sequence = $row['series_sequencename']; $series_num = $row['series_num']; $series_tr = $row['series_tr']; $series_te = $row['series_te']; $series_flip = $row['series_flip']; $series_spacingx = $row['series_spacingx']; $series_spacingy = $row['series_spacingy']; $series_spacingz = $row['series_spacingz']; $series_fieldstrength = $row['series_fieldstrength']; $img_rows = $row['img_rows']; $img_cols = $row['img_cols']; $img_slices = $row['img_slices']; $bold_reps = $row['bold_reps']; $numfiles = $row['numfiles']; $series_size = $row['series_size']; $series_status = $row['series_status']; $series_notes = $row['series_notes']; $urllist['Subject List'] = "subjects.php"; $urllist[$uid] = "subjects.php?action=display&id=$subjectid"; $urllist["Study " . $study_num] = "studies.php?id=$studyid"; NavigationBar("Manage files", $urllist); $datadir = GetDataDir($seriesid, $modality, $datatype); $files = scandir($datadir); /* update the DB with the files that actually exist */ $filecount = count(glob("$datadir/*")); $filesize = GetDirectorySize($datadir); $sqlstring = "update mr_series set numfiles_beh = $filecount, beh_size = $filesize where mrseries_id = $seriesid"; //echo "$sqlstring"; $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>"); ?> <b>Displaying files for</b> <br><br> <div style="padding: 1px 10px"> <b>Subject ID:</b> <?php echo $uid; ?> <br> <b>Study #:</b> <?php echo $study_num; ?> <br> <b>Series #:</b> <?php echo $series_num; ?> <br> <b>Datatype:</b> <?php echo $datatype; ?> <br> <b>Protocol:</b> <?php echo $protocol; ?> </div> <br><br> <table class="graydisplaytable"> <thead> <tr> <th>Filename</th> <th>Type</th> <th>Size <span class="tiny">(bytes)</span></th> <th>Date created</th> <th>Date accessed</th> <th>Date modified</th> <th>Delete</th> </tr> </thead> <tbody> <? foreach ($files as $file) { if (($file != ".") && ($file != "..")) { $size = number_format(filesize("$datadir/$file"),0); $pathparts = pathinfo("$datadir/$file"); $atime = date('M j, Y g:ia', fileatime("$datadir/$file")); $ctime = date('M j, Y g:ia', filectime("$datadir/$file")); $mtime = date('M j, Y g:ia', filemtime("$datadir/$file")); switch (strtolower($pathparts['extension'])) { case "edat2": $filetype = "ePrime 2 data file"; break; case "edat": $filetype = "ePrime data file"; break; case "txt": $filetype = "Text file"; break; case "cir": $filetype = "CIRC experiment file"; break; case "vap": $filetype = "VAPP experiment file"; break; case "csv": $filetype = "CSV file"; break; case "log": $filetype = "CIRC binary (or other) log file"; break; case "cnt": $filetype = "Neuroscan file"; break; case "3dd": $filetype = "Polhemus file"; break; case "dat": $filetype = "Polhemus file"; break; case "flv": $filetype = "Flash Video"; break; case "ogg": $filetype = "Ogg Theora Video"; break; case "mp4": $filetype = "MPEG4 Video"; break; case "ogv": $filetype = "Ogg Theora Video"; break; case "wmv": $filetype = "Windows Media Video"; break; default: $filetype = ""; } ?> <tr style="font-size: 10pt"> <td><a href="getfile.php?action=download&file=<? echo "$datadir/$file"; ?>" style="color: darkblue; font-weight: bold"><?php echo $file; ?> </a> <? if ($datatype == "VIDEO") { if ($filetype == "Flash Video") { ?> <!--<object> <param name="movie" value="getfile.php?file=<? echo "$datadir/$file"; ?>"></param> <embed src="getfile.php?file=<? echo "$datadir/$file"; ?>" type="application/x-shockwave-flash" > </embed> </object>--> <object type="application/x-shockwave-flash" width="320" height="260" wmode="transparent" data="flvplayer.swf?file=getfile.php%3Ffile%3D<? echo "$datadir/$file"; ?>&autoStart=false"> <param name="movie" value="flvplayer.swf?file=getfile.php%3Ffile%3D<? echo "$datadir/$file"; ?>&autoStart=false" /> <param name="wmode" value="transparent" /> </object> <? } else { ?> <video controls="controls"> <source src="getfile.php?file=<? echo "$datadir/$file"; ?>"> </video> <? } } ?> </td> <td><?php echo $filetype; ?> </td> <td><?php echo $size; ?> </td> <td><?php echo $ctime; ?> </td> <td><?php echo $atime; ?> </td> <td><?php echo $mtime; ?> </td> <td><a href="managefiles.php?action=delete&seriesid=<?php echo $seriesid; ?> &modality=<?php echo $modality; ?> &datatype=<?php echo $datatype; ?> &filename=<?php echo $file; ?> " style="color: white; background-color: darkred; padding: 1px 5px; font-weight: bold">X</a></td> </tr> <? } } ?> </tbody> </table> <? }
<a href="<?php echo SITEURL; ?> admin_index.php?page=maintenance&action=clear_lang_cache#tab_cache"> <?php echo $h->lang("admin_theme_maintenance_lang_cache"); ?> </a> - <?php echo $h->lang("admin_theme_maintenance_lang_cache_desc"); ?> <?php echo GetDirectorySize(CACHE . 'lang_cache'); ?> </li> <li> <a href="<?php echo SITEURL; ?> admin_index.php?page=maintenance&action=clear_rss_cache#tab_cache"> <?php echo $h->lang("admin_theme_maintenance_rss_cache"); ?> </a> - <?php echo $h->lang("admin_theme_maintenance_rss_cache_desc"); ?> <?php echo GetDirectorySize(CACHE . 'rss_cache'); ?> </li> </ul>