Index: trunk/core/kernel/application.php
===================================================================
diff -u -r2322 -r2334
--- trunk/core/kernel/application.php (.../application.php) (revision 2322)
+++ trunk/core/kernel/application.php (.../application.php) (revision 2334)
@@ -235,6 +235,7 @@
$this->registerClass('kPasswordFormatter', KERNEL_PATH.'/utility/formatters.php');
$this->registerClass('kCCDateFormatter', KERNEL_PATH.'/utility/formatters.php');
$this->registerClass('kUnitFormatter', KERNEL_PATH.'/utility/formatters.php');
+ $this->registerClass('kFilesizeFormatter', KERNEL_PATH.'/utility/formatters.php');
$this->registerClass('kTempTablesHandler', KERNEL_PATH.'/utility/temp_handler.php');
Index: trunk/kernel/admin_templates/incs/grid_blocks.tpl
===================================================================
diff -u -r2308 -r2334
--- trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 2308)
+++ trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 2334)
@@ -88,6 +88,17 @@
+
+
+
+ |
+
+
Index: trunk/kernel/downloads/.htaccess
===================================================================
diff -u
--- trunk/kernel/downloads/.htaccess (revision 0)
+++ trunk/kernel/downloads/.htaccess (revision 2334)
@@ -0,0 +1 @@
+Deny from all
\ No newline at end of file
Index: trunk/core/kernel/utility/formatters.php
===================================================================
diff -u -r2331 -r2334
--- trunk/core/kernel/utility/formatters.php (.../formatters.php) (revision 2331)
+++ trunk/core/kernel/utility/formatters.php (.../formatters.php) (revision 2334)
@@ -1003,48 +1003,31 @@
}
}
}
-
- /*function Format($value, $field_name, &$object, $format=null)
+}
+
+class kFilesizeFormatter extends kFormatter {
+
+ function Format($value, $field_name, &$object, $format=null)
{
- return parent::Format($value, $field_name, $object, $format);
- }*/
-
-/* function Format($value, $field_name, &$object, $format=null)
- {
- if( isset($field_options['master_field']) )
- {
- $regional =& $this->Application->recallObject('lang.current');
- switch( $regional->GetDBField('UnitSystem') )
- {
- case 2: // US/UK
- $major = floor( $value / 0.5 );
- $minor = $value - $major;
- $major = $object->SetDBField($field_name.'_a', $major);
- $minor = $object->SetDBField($field_name.'_b', $minor);
- break;
- default:
- }
+ if ($value >= 1099511627776) {
+ $return = round($value / 1024 / 1024 / 1024 / 1024, 2);
+ $suffix = "Tb";
+ } elseif ($value >= 1073741824) {
+ $return = round($value / 1024 / 1024 / 1024, 2);
+ $suffix = "Gb";
+ } elseif ($value >= 1048576) {
+ $return = round($value / 1024 / 1024, 2);
+ $suffix = "Mb";
+ } elseif ($value >= 1024) {
+ $return = round($value / 1024, 2);
+ $suffix = "Kb";
+ } else {
+ $return = $value;
+ $suffix = "B";
}
- return parent::Format($value, $field_name, $object);
- }*/
-
- /*function Parse($value, $field_name, &$object)
- {
- $regional =& $this->Application->recallObject('lang.current');
- switch($regional->GetDBField('UnitSystem'))
- {
- case 1: // metric
- return $object->GetDBField('UnitSystem_a');
- break;
- case 2: // US/UK
- return $object->GetDBField('UnitSystem_a') * 0.5 +
- $object->GetDBField('UnitSystem_b') * 0.5 / 16;
- break;
- default:
- }
- }*/
-
+ $return .= ' '.$suffix;
+ return $return;
+ }
}
-
?>
|