diff --git a/inc/func.php b/inc/func.php index 3d643cc..cb1380e 100644 --- a/inc/func.php +++ b/inc/func.php @@ -294,3 +294,25 @@ function prepareArrFiles($arrFiles, $name) { return $arrFiles; } + + +/** + * Преобразует байты в человекопонятный вид + * + * @param $bytes + * @return string + */ +function bytesToString($bytes) { + if ($bytes < 1000 * 1024) { + return number_format($bytes / 1024, 2) . ' KB'; + } + elseif ($bytes < 1000 * 1048576) { + return number_format( $bytes / 1048576, 2) . ' MB'; + } + elseif ($bytes < 1000 * 1073741824) { + return number_format($bytes / 1073741824, 2) . ' GB'; + } + else { + return number_format($bytes / 1099511627776, 2) . ' TB'; + } +} diff --git a/inc/lib/CCron.class.php b/inc/lib/CCron.class.php index 23a452d..acc9ea7 100644 --- a/inc/lib/CCron.class.php +++ b/inc/lib/CCron.class.php @@ -179,7 +179,7 @@ class CCron { if (!isset($id) or empty($id)) return false; $res = self::$DB->remove(self::$table, array('id' => $id)); - CEvents::add('Задание с ID: ' . $id . '. было удалено', 'info', 'cron'); + CEvents::add('Задание с ID: ' . $id . ' было удалено', 'info', 'cron'); return true; } diff --git a/inc/lib/CUser.class.php b/inc/lib/CUser.class.php index 8fe309a..8818c70 100644 --- a/inc/lib/CUser.class.php +++ b/inc/lib/CUser.class.php @@ -102,8 +102,8 @@ class CUser { * @param string $name * @param string $image */ - public static function Registration($login, $password, $level = 'user', $name = '', $image = ''):void { - self::$DB->addItem(self::$table, array('login' => $login, 'password' => $password, 'access_level' => $level, 'name' => $name,'image' => $image, 'last_active' => time())); + public static function Registration($login, $password, $email, $level = 'user', $name = '', $image = ''):void { + self::$DB->addItem(self::$table, array('login' => $login, 'password' => $password, 'access_level' => $level, 'name' => $name,'image' => $image, 'email' => $email, 'last_active' => time())); $result = self::$DB->getItem(self::$table, array('login'=>$login, 'password' => $password)); self::$id = $result['id']; diff --git a/users.php b/users.php index 26bcb20..c4ab46b 100644 --- a/users.php +++ b/users.php @@ -25,6 +25,7 @@