Example #1
0
 function index()
 {
     if ($this->is_login()) {
         //$this->load->view('welcome_message');
         $this->load->helper('comm');
         $data['user_name'] = $this->session->userdata('s_username');
         $data['gravatar'] = get_gravatar($this->session->userdata('s_email'));
         $this->load->view('user/user_header');
         $this->load->view('user/user_nav', $data);
         $side_data = $this->sidebar();
         $side_data['index_active'] = (bool) TRUE;
         $this->load->view('user/user_sidebar', $side_data);
         $user_info = $this->user_model->u_info($data['user_name']);
         $data['transfers'] = $user_info->u + $user_info->d;
         $data['all_transfer'] = $user_info->transfer_enable;
         $data['unused_transfer'] = human_file_size($data['all_transfer'] - $data['transfers']);
         if ($data['all_transfer'] == 0) {
             $data['used_100'] = 0;
         } else {
             $data['used_100'] = round($data['transfers'] / $data['all_transfer'] * 100, 2);
         }
         $data['transfers'] = human_file_size($data['transfers']);
         $data['all_transfer'] = human_file_size($data['all_transfer']);
         $data['passwd'] = $user_info->passwd;
         $data['plan'] = $user_info->plan;
         $data['port'] = $user_info->port;
         $data['last_check_in_time'] = $user_info->last_check_in_time;
         $data['unix_time'] = $user_info->t;
         $data['is_able_to_check_in'] = is_able_to_check_in($user_info->last_check_in_time);
         $data['enable'] = $user_info->enable;
         $this->load->view('user/user_index', $data);
         $this->load->view('user/user_footer');
     } else {
         redirect(site_url('user/login'));
     }
     return;
 }
Example #2
0
        ?>
</td>
                                        <td><?php 
        echo human_file_size($user->u);
        ?>
</td>
                                        <td><?php 
        echo human_file_size($user->d);
        ?>
</td>
                                        <td><?php 
        echo $user->plan;
        ?>
</td>
                                        <td><?php 
        echo human_file_size($user->transfer_enable);
        ?>
</td>
                                        <td><?php 
        echo $user->port;
        ?>
</td>
                                        <td><?php 
        echo date("m-j G:i", $user->last_check_in_time);
        ?>
</td>
                                        <td><?php 
        echo $user->reg_date;
        ?>
</td>
                                        <td>
Example #3
0
        ?>
                                <tr>
                                    <td><?php 
        echo $log->user_name;
        ?>
</td>
                                    <td><?php 
        echo $log->good_name;
        ?>
</td>
                                    <td><?php 
        printf("%01.2f", $log->old_money - $log->new_money);
        ?>
</td>
                                    <td><?php 
        echo human_file_size($log->new_transfer - $log->old_transfer);
        ?>
</td>
                                    <td><?php 
        echo date("m-j G:i", $log->time);
        ?>
</td>
                                </tr>
                            <?php 
    }
}
?>
                            </tbody>
                        </table>
                    </div><!-- /.box-body -->
                </div><!-- /.box -->
        ?>
							<?php 
        echo htmlspecialchars($file['basename']);
        ?>
<span class='extention'><?php 
        echo $file['extention'];
        ?>
</span>
						<?php 
    }
    ?>
					</span>
					</a>
				</td>
				<td class="filesize" title="<?php 
    echo human_file_size($file['size']);
    ?>
" style="color:rgb(<?php 
    echo $simple_size_color . ',' . $simple_size_color . ',' . $simple_size_color;
    ?>
)"><?php 
    echo $simple_file_size;
    ?>
</td>
				<td class="date"><span class="modified" title="<?php 
    echo $file['date'];
    ?>
" style="color:rgb(<?php 
    echo $relative_date_color . ',' . $relative_date_color . ',' . $relative_date_color;
    ?>
)"><?php 
Example #5
0
 /**
  * Make OC_Helper::humanFileSize available as a simple function
  * Example: 2048 to 2 kB.
  *
  * @param int $bytes in bytes
  * @return string size as string
  * @since 8.0.0
  */
 public static function human_file_size($bytes)
 {
     return \human_file_size($bytes);
 }
/**
 * @brief make OC_Helper::humanFileSize available as a simple function
 * Makes 2048 to 2 kB.
 * @param $bytes size in bytes
 * @returns size as string
 */
function human_file_size($bytes)
{
    return \human_file_size($bytes);
}
Example #7
0
 function system_info()
 {
     if ($this->is_login()) {
         //$this->load->view('welcome_message');
         $this->load->helper('comm');
         $data['user_name'] = $this->session->userdata('s_admin_username');
         $data['gravatar'] = get_gravatar($this->session->userdata('s_admin_email'));
         $this->load->view('admin/admin_header');
         $this->load->view('admin/admin_nav', $data);
         $data['index_active'] = (bool) false;
         $data['user_active'] = (bool) false;
         $data['node_active'] = (bool) false;
         $data['code_active'] = (bool) false;
         $data['system_active'] = (bool) true;
         $data['config_active'] = (bool) false;
         $this->load->view('admin/admin_sidebar', $data);
         $data['all_user'] = $this->admin_model->c_users();
         $data['active_user'] = $this->admin_model->c_active_users();
         $data['user_time_count_3600'] = $this->admin_model->c_user_time(3600);
         $data['user_time_count_300'] = $this->admin_model->c_user_time(300);
         $data['user_time_count_60'] = $this->admin_model->c_user_time(60);
         $data['user_time_count_10'] = $this->admin_model->c_user_time(10);
         $data['user_time_count_24'] = $this->admin_model->c_user_time(3600 * 24);
         $data['mt'] = human_file_size($this->admin_model->get_month_traffic());
         $data['version'] = $this->admin_model->get_version();
         $this->load->view('admin/admin_sysinfo', $data);
         $this->load->view('admin/admin_footer');
     } else {
         redirect(site_url('admin/login'));
     }
     return;
 }
Example #8
0
function output_file($file_item, $current_path, $type)
{
    global $ignore_files, $template_exts, $total_reduce_size;
    if ($current_path !== '') {
        foreach ((array) $file_item['file'] as $file_name => $file_info) {
            if (false === strpos($current_path, 'views') && $file_name[0] === '_' || $file_name[0] == '.') {
                continue;
            }
            if (in_array($file_name, $ignore_files)) {
                continue;
            }
            $file_path = $current_path . '/' . $file_name;
            $result = true;
            $file_skiped = false;
            $ext = get_ext($file_name);
            if ('all' != $type && $ext != $type) {
                continue;
            }
            if ($ext == 'css') {
                if (strpos($file_name, 'min.') === 0) {
                    $result = compress_css($file_path);
                } else {
                    $file_skiped = true;
                }
            } elseif ($ext == 'js') {
                if (strpos($file_name, 'min.') === 0) {
                    $result = compress_js($file_path);
                } else {
                    $file_skiped = true;
                }
            } elseif ($ext == 'png') {
                compress_png($file_path);
            } elseif (in_array($ext, $template_exts)) {
                compress_template($file_path);
            } else {
                copy(ROOT_PATH . $file_path, OUTPUT_DIR . $file_path);
            }
            $file_size = 0;
            if ($file_skiped === false) {
                if (file_exists(OUTPUT_DIR . $file_path)) {
                    $file_size = filesize(OUTPUT_DIR . $file_path);
                    $total_reduce_size += $file_info['infor']['file_size'] - $file_size;
                    if ($file_size <= 0) {
                        $file_size = 'b style="color:#ff0000">' . $file_size . '</b>';
                    } else {
                        $file_size = human_file_size($file_size);
                    }
                } else {
                    $result = false;
                }
            }
            if (false === $result) {
                echo '<p style="color:#ff0000;font-weight:bold">' . $file_path . ' Error</p>';
            } else {
                if ($file_skiped === false) {
                    echo $file_path . ' <b style="color:#1EBC16">OK</b> <span style="color:#888">(' . human_file_size($file_info['infor']['file_size']) . ' → ' . $file_size . ')</span><br />';
                } else {
                    echo '<span style="color:#aaa">' . $file_path . ' <b>Skiped</b></span><br />';
                }
            }
        }
    }
    foreach ((array) $file_item['dir'] as $dir_name => $dir) {
        if ($dir_name[0] === '_' || $dir_name[0] == '.') {
            continue;
        }
        if (in_array($dir_name, $ignore_files)) {
            continue;
        }
        $dir_path = $current_path . '/' . $dir_name;
        echo '<h2>' . $dir_path . '</h2>';
        make_dir($dir_path, OUTPUT_DIR);
        output_file($dir, $dir_path, $type);
    }
}
Example #9
0
    $uri = substr($uri, 0, $pos);
}
$temp_array = array();
$is_html = (bool) preg_match('/^.+\\.js\\.html(\\?.*)?$/i', $uri, $temp_array);
if (preg_match('/^.+\\.(js|css)/i', $uri, $temp_array)) {
    $static_type = $temp_array[1];
    /* scripts || styles */
    $file_path = $temp_array[0];
    $file_path = preg_replace('/\\.min/', '', $file_path);
    $static_contents = get_static_content($file_path);
    $compressed_result = compress_js($file_path, true, !$is_html);
    $compressed_contents = $compressed_result['output'];
    $origin_size = strlen($static_contents);
    $compressed_size = strlen($compressed_contents);
    $origin_size_label = human_file_size($origin_size);
    $compressed_size_label = human_file_size($compressed_size);
    $compress_saving = 100 - (int) ($compressed_size / $origin_size * 10000) / 100;
}
if (!$is_html) {
    @header('Content-Type: application/x-javascript');
    die($compressed_contents);
}
?>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><?php 
echo $file_path;
?>
</title>
<style type="text/css">
	body,td,th{
		font-family:verdana;
Example #10
0
    p($l->t('Size of stored data:'));
    ?>
&nbsp;&nbsp;&nbsp;
        <?php 
    $size = \OCA\mozilla_sync\Storage::getSyncSize();
    if ($size === false) {
        p($l->t('No data stored yet.'));
    } else {
        $quota = \OCA\mozilla_sync\User::getQuota();
        if ($quota === 0) {
            $quotaString = "(unlimited quota)";
        } else {
            $percentage = 100.0 * (double) $size / (double) $quota;
            $quotaString = "(" . number_format($percentage, 1) . "% used of quota " . human_file_size($quota * 1024) . ")";
        }
        p(human_file_size($size * 1024) . " " . $quotaString);
    }
    ?>
    </p>
    <p>
        <?php 
    p($l->t('Number of synced devices:'));
    ?>
&nbsp;&nbsp;&nbsp;
        <code><?php 
    p(\OCA\mozilla_sync\Storage::getNumClients());
    ?>
</code>
    </p>

    <br/>