Example #1
0
 public function index($action = '')
 {
     $folders = array('/system/cache/' => FALSE, '/system/cache/templates_c/' => FALSE, '/uploads/' => FALSE, '/uploads/images' => FALSE, '/uploads/files' => FALSE, '/uploads/media' => FALSE, '/captcha/' => FALSE);
     foreach ($folders as $k => $v) {
         $folders[$k] = is_really_writable(PUBPATH . $k);
     }
     $this->template->assign('folders', $folders);
     if ($this->db->dbdriver == 'mysql') {
         $this->load->helper('number');
         $sql = "SHOW TABLE STATUS FROM `" . $this->db->database . "`";
         $query = $this->db->query($sql)->result_array();
         // Get total DB size
         $total_size = 0;
         $total_rows = 0;
         foreach ($query as $k => $v) {
             $total_size += $v['Data_length'] + $v['Index_length'];
             $total_rows += $v['Rows'];
         }
         $sql = "SELECT VERSION()";
         $query = $this->db->query($sql);
         $version = $query->row_array();
         $this->template->add_array(array('db_version' => $version['VERSION()'], 'db_size' => byte_format($total_size), 'db_rows' => $total_rows));
     }
     $this->template->show('sys_info', FALSE);
 }
Example #2
0
	function getFileSize( $fpath ) {
		$k = "";
		if( file_exists( $fpath ) ) {
			$size = filesize( $fpath );
			$k = byte_format($size);
		}
		return $k;
	}
Example #3
0
 public function testElement()
 {
     $this->assertEquals('456 Bytes', byte_format(456));
     $this->assertEquals('4.5 KB', byte_format(4567));
     $this->assertEquals('44.6 KB', byte_format(45678));
     $this->assertEquals('447.8 KB', byte_format(456789));
     $this->assertEquals('3.3 MB', byte_format(3456789));
     $this->assertEquals('1.8 GB', byte_format(12345678912345));
     $this->assertEquals('11,228.3 TB', byte_format(123456789123456789));
     $this->assertEquals('44.61 KB', byte_format(45678, 2));
 }
Example #4
0
 function index()
 {
     // $this->output->cache(1440); // 캐시 되고 있는동안 common 작동 안함
     // 계정의 사용량을 구함
     $account_space = `du -sb`;
     $account_space = substr($account_space, 0, strlen($account_space) - 3);
     // DATA 폴더의 용량을 구함
     $data_path = DATA_PATH;
     $data_space = `du -sb {$data_path}`;
     $data_space = substr($data_space, 0, strlen($data_space) - 8);
     // GD 버젼
     $gd_support = extension_loaded('gd');
     if ($gd_support) {
         $gd_info = gd_info();
         $gd_version = $gd_info['GD Version'];
     } else {
         $gd_version = 'GD가 설치되지 않음';
     }
     // MySQL 버전
     $query = $this->db->query('select version() as ver');
     $row = $query->row_array();
     $db_version = $row['ver'];
     /*        
     // http://kr2.php.net/manual/kr/function.mysql-stat.php
     $mysql_stat = explode('  ', mysql_stat());
     $a = explode(':', $mysql_stat[0]);
     $db_date = $a[0] . ': ';
     $days = floor($a[1]/86400);
     if ($days)
         $db_date .= $days . '일 ';
     $hours = (floor($a[1]/3600)%24);
     if ($hours)
         $db_date .= $hours . '시간 ';
     $min = (floor($a[1]/60)%60);
     if ($min)
         $db_date .= $min . '분';
     
     $t = explode(':', $mysql_stat[2]);
     
     $db_status = $mysql_stat[1].'<br/>';
     $db_status .= $t[0].': '.number_format($t[1]).'<br/>';
     $db_status .= $mysql_stat[3].'<br/>';
     $db_status .= $mysql_stat[4].'<br/>';
     $db_status .= $mysql_stat[5].'<br/>';
     $db_status .= $mysql_stat[6].'<br/>';
     $db_status .= $mysql_stat[7].'<br/>';
     */
     $head = array('title' => '관리자 페이지');
     $data = array('os_version' => php_uname('r'), 'ip_addr' => gethostbyname(trim(`hostname`)), 'account_space' => byte_format($account_space), 'data_space' => byte_format($data_space), 'code_space' => byte_format($account_space - $data_space), 'php_version' => phpversion(), 'zend_version' => zend_version(), 'gd_version' => $gd_version, 'max_filesize' => get_cfg_var('upload_max_filesize'), 'db_version' => $db_version, 'db_date' => '', 'db_status' => '');
     widget::run('head', $head);
     $this->load->view(ADM_F . '/main', $data);
     widget::run('tail');
 }
Example #5
0
 public function index()
 {
     $this->load->model($this->model_path);
     $this->load->library(array('MK_Switch', 'MK_Tagger', 'MK_Category', 'Form_validation'));
     $this->load->helper('number');
     $path = $this->input->get('path');
     if ($path != '') {
         $path = $path . '/';
         $path = str_replace('//', '/', $path);
     } else {
         $path = '';
     }
     $string1 = realpath($this->base . $path);
     $string2 = realpath($this->base);
     if (strstr($string1, $string2) == false) {
         exit;
     }
     // Get popedom array
     $authority = $this->mk_users->get_popedom($this->menu_uuid, $this->menu_authorize_query);
     if (!$authority['list']) {
         //** MK-ERROR-UNAUTHORIZED **/
         show_error($this->lang_common['error_unauthorized_page'], 500);
         exit;
     }
     //load language file
     $lang_current = $this->mk_integrate->get_lang($this->lang_path);
     if ($this->base . $path == $this->base) {
         $name = array_slice(scandir($this->base . $path), 2);
     } else {
         $name = array_slice(scandir($this->base . $path), 1);
     }
     $full_path = $this->base . $path;
     $info = array();
     foreach ($name as $rows) {
         $full = $this->base . $path . $rows;
         $time = fileatime($full);
         $info[$rows][0] = $rows;
         $info[$rows][1] = date('Y-m-d H:i:s', $time);
         $info[$rows][2] = byte_format(filesize($full));
         unset($full);
     }
     $data['page_path'] = $this->page_path;
     $data['lang_common'] = $this->lang_common;
     $data['lang_current'] = $lang_current;
     $data['menu_uuid'] = $this->menu_uuid;
     $data['authority'] = $authority;
     $data['file'] = $info;
     $data['full_path'] = $full_path;
     $data['base'] = $this->base;
     $this->load->view("{$this->views_path}/file", $data);
     unset($data);
 }
Example #6
0
 public function get_byte_abbr($bytes, $precision = 2, $key = FALSE)
 {
     $this->load->helper('number');
     if ($key == FALSE) {
         $num = byte_format($bytes, $precision);
         $num = explode(" ", $num);
         $num = $num[0];
     } else {
         $num = byte_format($bytes, $precision);
         $num = $num;
     }
     return $num;
 }
Example #7
0
 public function index()
 {
     $this->load->helper('number');
     $this->user->restrict('Admin.Maintenance.Access');
     if ($this->input->post('migrate') and $this->_migrate() === TRUE) {
         redirect('maintenance');
     }
     if ($this->Maintenance_model->checkTables($this->input->post('tables'))) {
         $this->session->set_flashdata('tables', $this->input->post('tables'));
         redirect('maintenance/backup');
     }
     $this->template->setTitle($this->lang->line('text_title'));
     $this->template->setHeading($this->lang->line('text_heading'));
     $this->template->setButton($this->lang->line('button_backup'), array('class' => 'btn btn-primary', 'onclick' => '$(\'#tables-form\').submit();'));
     $this->template->setButton($this->lang->line('button_migrate'), array('class' => 'btn btn-success', 'onclick' => '$(\'#migrate-form\').submit();'));
     $data['backup_tables'] = FALSE;
     $data['db_tables'] = array();
     $db_tables = $this->Maintenance_model->getdbTables();
     foreach ($db_tables as $db_table) {
         $data['db_tables'][] = array('name' => $db_table['table_name'], 'records' => $db_table['table_rows'], 'data_length' => byte_format($db_table['data_length']), 'index_length' => byte_format($db_table['index_length']), 'data_free' => byte_format($db_table['data_free']), 'engine' => $db_table['engine'], 'browse' => site_url('maintenance/browse_table/' . $db_table['table_name']));
     }
     $data['backup_files'] = array();
     $backup_files = glob(ROOTPATH . 'assets/downloads/*.sql');
     if (count($backup_files) > 0) {
         foreach ($backup_files as $backup_file) {
             $basename = basename($backup_file);
             $data['backup_files'][] = array('filename' => $basename, 'size' => filesize($backup_file), 'download' => site_url('maintenance/backup?download=' . $basename), 'restore' => site_url('maintenance/backup?restore=' . $basename), 'delete' => site_url('maintenance/backup?delete=' . $basename));
         }
     }
     $this->load->library('migration');
     $data['installed_version'] = $this->migration->get_version();
     $data['latest_version'] = $this->migration->get_latest_version();
     $data['migration_files'] = array();
     if ($migration_files = $this->migration->find_migrations()) {
         foreach ($migration_files as $version => $migration_file) {
             $migration_file = basename($migration_file);
             $version = $this->migration->get_migration_number(basename($migration_file));
             $data['migration_files'][$version] = $migration_file;
         }
     }
     $this->template->setPartials(array('header', 'footer'));
     $this->template->render('maintenance', $data);
 }
Example #8
0
 /**
  * Manage Index
  */
 function manage()
 {
     role_or_die('streams', 'admin_streams');
     $this->_gather_stream_data();
     // Get DB table name
     $this->data->table_name = $this->data->stream->stream_prefix . $this->data->stream->stream_slug;
     // Get the table data
     $info = $this->db->query("SHOW TABLE STATUS LIKE '{$this->db->dbprefix($this->data->table_name)}'")->row();
     // Get the size of the table
     $this->load->helper('number');
     $this->data->total_size = byte_format($info->Data_length);
     // Last updated time
     $this->data->last_updated = !$info->Update_time ? $info->Create_time : $info->Update_time;
     // Get the number of rows (the table status data on this can't be trusted)
     $this->data->total_rows = $this->db->count_all($this->data->table_name);
     // Get the number of fields
     $f_obj = $this->db->select('id')->where('stream_id', $this->data->stream->id)->get(ASSIGN_TABLE);
     $this->data->num_of_fields = $f_obj->num_rows();
     $this->template->build('admin/streams/manage', $this->data);
 }
 public function statistics()
 {
     $statistics = array();
     /*
      * 重要: 为了防止与应用别名重名,“服务器信息”、“用户信息”、“开发团队”作为key前面有空格
      */
     // 服务器信息
     $site_version = model('Xdata')->get('siteopt:site_system_version');
     $serverInfo['核心版本'] = 'ThinkSNS ' . $site_version;
     $serverInfo['服务器系统及PHP版本'] = PHP_OS . ' / PHP v' . PHP_VERSION;
     $serverInfo['服务器软件'] = $_SERVER['SERVER_SOFTWARE'];
     $serverInfo['最大上传许可'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : '<font color="red">no</font>';
     $mysqlinfo = M('')->query("SELECT VERSION() as version");
     $serverInfo['MySQL版本'] = $mysqlinfo[0]['version'];
     $t = M('')->query("SHOW TABLE STATUS LIKE '" . C('DB_PREFIX') . "%'");
     foreach ($t as $k) {
         $dbsize += $k['Data_length'] + $k['Index_length'];
     }
     $serverInfo['数据库大小'] = byte_format($dbsize);
     $statistics[' 服务器信息'] = $serverInfo;
     unset($serverInfo);
     // 用户信息
     $user['当前在线'] = getOnlineUserCount();
     $user['全部用户'] = M('user')->count();
     $user['有效用户'] = M('user')->where('`is_active` = 1 AND `is_init` = 1')->count();
     $statistics[' 用户信息'] = $user;
     unset($user);
     // 应用统计
     $applist = array();
     $res = model('App')->where('`statistics_entry`<>""')->field('app_name,app_alias,statistics_entry')->order('display_order ASC')->findAll();
     foreach ($res as $v) {
         $d = explode('/', $v['statistics_entry']);
         $d[1] = empty($d[1]) ? 'index' : $d[1];
         $statistics[$v['app_alias']] = D($d[0], $v['app_name'])->{$d}[1]();
     }
     // 开发团队
     $statistics[' 开发团队'] = array('版权所有' => '<a href="http://www.zhishisoft.com" target="_blank">智士软件(北京)有限公司</a>', 'UI设计' => '<a href="http://weibo.com/wasdifferent" target="_blank">申川</a>、<a href="http://weibo.com/u/2134567607" target="_blank">马丽稳</a>', '项目经理' => '<a href="http://weibo.com/sunan" target="_blank">廖素南</a>', '前端设计' => '<a href="http://weibo.com/u/2025142915" target="_blank">牛文涛</a>、<a href="http://weibo.com/u/1087964144" target="_blank">樊翠娥</a>', '开发团队' => '<a href="http://weibo.com/sampeng" target="_blank">彭灵俊</a>、<a href="http://weibo.com/thinksns" target="_blank">刘晓庆</a>、<a href="http://weibo.com/cchhuuaann" target="_blank">陈伟川</a>、<a href="http://weibo.com/satan0714" target="_blank">王祚</a>、<a href="http://weibo.com/nonant" target="_blank">冷浩然</a>、<a href="http://weibo.com/mylovehere" target="_blank">韦新红</a>');
     $this->assign('statistics', $statistics);
     $this->display();
 }
Example #10
0
 public function index()
 {
     $this->Purview_model->checkPurview($this->tablefunc);
     $folder = $this->input->post('folder');
     if (!$folder) {
         $folder = $this->defaultfolder;
     }
     $listarr = directory_map($folder, 1);
     $folderlist = array();
     $phplist = array();
     $csslist = array();
     $jslist = array();
     foreach ($listarr as $list) {
         $thispath = $folder . '/' . $list;
         $newlist = get_file_info($thispath);
         $newlist['permissions'] = octal_permissions(fileperms($thispath));
         $newlist['name'] = $list;
         if (is_dir($thispath)) {
             $folderlist[] = $newlist;
         } else {
             $newlist['size'] = byte_format($newlist['size']);
             $ext = get_suffix($thispath);
             switch ($ext) {
                 case 'php':
                     $phplist[] = $newlist;
                     break;
                 case 'css':
                     $csslist[] = $newlist;
                     break;
                 case 'js':
                     $jslist[] = $newlist;
                     break;
                 default:
                     break;
             }
         }
     }
     $res = array('tpl' => 'list', 'tablefunc' => $this->tablefunc, 'folderlist' => $folderlist, 'phplist' => $phplist, 'csslist' => $csslist, 'jslist' => $jslist, 'defaultfolder' => $this->defaultfolder, 'folder' => $folder);
     $this->load->view($this->tablefunc, $res);
 }
Example #11
0
 public function index()
 {
     $exts = array('html', 'css', 'js');
     $type = $_GET['type'] ? $_GET['type'] : 'html';
     if ($type == 'html') {
         $path = $this->filepath;
     } else {
         $path = $this->publicpath . $type . '/';
     }
     $files = dir_list($path, $type);
     foreach ($files as $key => $file) {
         $filename = basename($file);
         $templates[$key]['value'] = substr($filename, 0, strrpos($filename, '.'));
         $templates[$key]['filename'] = $filename;
         $templates[$key]['filepath'] = $file;
         $templates[$key]['filesize'] = byte_format(filesize($file));
         $templates[$key]['filemtime'] = filemtime($file);
         $templates[$key]['ext'] = strtolower(substr($filename, strrpos($filename, '.') - strlen($filename)));
     }
     $this->assign('templates', $templates);
     $this->display();
 }
Example #12
0
 public function statistics()
 {
     $statistics = array();
     /** 为了防止与应用别名重名,“服务器信息”、“用户信息”、“开发团队”作为key前面有空格 **/
     // 服务器信息
     $serverInfo['核心版本'] = 'ThinkSNS 2.0';
     $serverInfo['服务器系统及PHP版本'] = PHP_OS . ' / PHP v' . PHP_VERSION;
     $serverInfo['服务器软件'] = $_SERVER['SERVER_SOFTWARE'];
     $serverInfo['最大上传许可'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : '<font color="red">no</font>';
     $mysqlinfo = M('')->query("SELECT VERSION() as version");
     $serverInfo['MySQL版本'] = $mysqlinfo[0]['version'];
     $t = M('')->query("SHOW TABLE STATUS LIKE '" . C('DB_PREFIX') . "%'");
     foreach ($t as $k) {
         $dbsize += $k['Data_length'] + $k['Index_length'];
     }
     $serverInfo['数据库大小'] = byte_format($dbsize);
     $statistics[' 服务器信息'] = $serverInfo;
     unset($serverInfo);
     // 用户信息
     $user['当前在线'] = getOnlineUserCount();
     $user['注册用户'] = M('user')->where('`is_active` = 1 AND `is_init` = 1')->count();
     $statistics[' 用户信息'] = $user;
     unset($user);
     // 应用统计
     $applist = array();
     $res = model('App')->where('`statistics_entry`<>""')->field('app_name,app_alias,statistics_entry')->order('display_order ASC')->findAll();
     foreach ($res as $v) {
         $d = explode('/', $v['statistics_entry']);
         $d[1] = empty($d[1]) ? 'index' : $d[1];
         $statistics[$v['app_alias']] = D($d[0], $v['app_name'])->{$d}[1]();
     }
     // 开发团队
     $statistics[' 开发团队'] = array('版权所有' => '<a href="http://www.zhishisoft.com" target="_blank">智士软件(北京)有限公司</a>', '项目经理' => '冯涛', '美工设计' => '赵杰', '开发团队' => '冷浩然、杨德升、刘晓庆、王祚、彭灵俊、韦心红、陈伟川');
     $this->assign('statistics', $statistics);
     $this->display();
 }
Example #13
0
 /**
  * Returns array of unused media files
  * (on the disk)
  *
  * @return array
  */
 public function get_unused_files()
 {
     self::$ci->load->helper('number');
     $directory = new RecursiveDirectoryIterator(FCPATH . Settings::get('files_path'), FilesystemIterator::SKIP_DOTS);
     $fc_length = strlen(FCPATH);
     $unused_size = $total_size = $nb_total = 0;
     $tb_str = Settings::get('files_path') . '/.thumbs';
     $tb_length = strlen($tb_str);
     $files = $paths = array();
     $media_paths = array();
     $medias = $this->get_all();
     foreach ($medias as $media) {
         $media_paths[] = $media['path'];
     }
     foreach (new RecursiveIteratorIterator($directory) as $filename => $current) {
         $path = substr($filename, $fc_length);
         if (substr($path, 0, $tb_length) != $tb_str) {
             $nb_total += 1;
             $size = $current->getSize();
             $total_size += $size;
             if (!in_array($path, $media_paths)) {
                 $files[] = array('path' => $path, 'size' => byte_format($size, 1));
                 $unused_size += $size;
             }
         }
     }
     // Check for articles content
     foreach ($files as $key => $file) {
         $sql = "select id_article from article_lang where content like '%" . $file['path'] . "%'";
         $query = $this->{$this->db_group}->query($sql);
         if ($query->num_rows() > 0 || in_array(basename($file['path']), self::$_UNUSED_IGNORED_FILES)) {
             unset($files[$key]);
             $nb_total -= 1;
             $unused_size -= filesize(DOCPATH . $file['path']);
         }
     }
     $return = array('nb_total' => $nb_total, 'size_total' => byte_format($total_size, 2), 'files' => $files, 'size' => byte_format($unused_size, 2));
     return $return;
 }
Example #14
0
		<?php 
    if (isset($r['files'])) {
        ?>
			<div class=-files>
			<?php 
        foreach ($r['files'] as $vs) {
            $F = dbFile($vs['file_id']);
            ?>
				<a style="display:block" target=_blank href="<?php 
            echo $F->url() . '/' . $F->name();
            ?>
"><?php 
            echo $F->vs['name'];
            ?>
 (<?php 
            echo byte_format($F->size());
            ?>
)</a>
				<?php 
            echo cutSearch1($F->vs['text'], $search, 1);
            ?>
			<?php 
        }
        ?>
			</div>
		<?php 
    }
    ?>
		
	</div>
<?php 
Example #15
0
        echo $node->disk_used;
        ?>
" aria-valuemin="0" aria-valuemax="<?php 
        echo $node->disk_total;
        ?>
" style="width: <?php 
        echo max($node->disk_used / $node->disk_total * 100, 1);
        ?>
%"></div>
                                                        </div>
                                                </td>
                                                <td class="hidden-xs">In: <?php 
        echo byte_format($node->bytes_in / 5);
        ?>
/s<br />Out: <?php 
        echo byte_format($node->bytes_out / 5);
        ?>
/s </td>
                                                <td class="hidden-xs"><?php 
        echo elapsed_time($node->uptime);
        ?>
</td>
                                        </tr>
                                        <?php 
    }
    ?>
                        
                                </table>
                        </div>
                </div>
        <?php 
        echo $F->name();
        ?>
" href="<?php 
        echo $F->url() . '/' . $F->name();
        ?>
" target=_blank><?php 
        echo preg_replace('/(.{25})(.*)(\\..{0,4})/u', '$1..$3', $F->vs['name']);
        ?>
</a></b>
			<?php 
    }
    ?>
			<br>
			<span style="font-size:11px; color:#999; font-style:italic">(<?php 
    echo $vs['pf_name'];
    ?>
)</span>
		<td style="text-align:right; width:70px; vertical-align:middle">
			<?php 
    echo $F->exists() ? byte_format($F->size()) : '';
    ?>
		<td style="min-width:16px; width:19px; background:center no-repeat url(<?php 
    echo sysURL;
    ?>
cms/pub/css/pix/arrow_up_down.png); cursor:n-resize;" class="handle">
		<td style="min-width:16px; width:19px; background:center no-repeat url(<?php 
    echo sysURL;
    ?>
cms/pub/css/pix/delete.png);" class="delete">
<?php 
}
Example #17
0
</span>
<br>




<a href="<?= $upload->URL() ?>"
	<? if($upload->filtered()) { ?>
		onMouseOver='changesrc("th<?= $upload->id()?>","<?= $upload->thumbURL() ?>")'
 		onMouseOut='changesrc("th<?= $upload->id() ?>","/offensive/graphics/th-filtered.gif")'
	<? } ?>
><img name="th<?= $upload->id()?>"
	src="<?= $upload->filtered()
		? "/offensive/graphics/th-filtered.gif" 
		: $upload->thumbURL() ?>"
 	border=0 align=left hspace=20 title="<?= byte_format(filesize($filepath)); ?>" /></a>
<?

?><a name="im<?= $upload->id() ?>"></a>
<!-- voting goes here -->
<span class="filetitle"></span> 
<span class="postername"><?= htmlEscape($upload->uploader()->username()) ?></span>&nbsp;
<?= date("m/d/y(D)H:i:s", $time) ?>
<span></span>
<span id="nothread<?= $upload->id() ?>">
	<a href="<?= Link::upload($upload) ?>" class="quotejs">No.<?= $upload->id() ?></a>
	&nbsp; [<a href="<?= Link::thread($upload) ?>">Reply</a>]
</span><br />
<!--<blockquote>So ur with ur honey and yur making out wen the phone rigns. U anser it n the vioce is &quot;wut r u doing wit my daughter?&quot; U tell ur girl n she say &quot;my dad is ded&quot;. THEN WHO WAS PHONE?
<br /><span class="abbr">Comment too long. Click <a href="res/60550329.html#60550329">here</a> to view the full text.</span></blockquote>-->
Example #18
0
 /**
  * 회원정보 수정
  * @author KangMin
  * @since  2011.11.09
  */
 public function modify()
 {
     $this->add_language_pack($this->language_pack('user_modify'));
     $assign = NULL;
     $post_success = FALSE;
     //DB insert/update 성공여부
     $assign['result_msg'] = '';
     $assign['avatar_file_fail'] = NULL;
     //로그인 상태가 아니면
     if (IS_USER_LOGIN === FALSE) {
         $this->login_view();
     } else {
         //rules
         //비밀번호 입력했으면 수정, 아니면 통과
         //각 설정 길이들은 수정시에는 다른 항목 수정에서도 걸릴 수 있지만.. 이는 정책으로다가
         if ($this->input->post('password')) {
             $this->form_validation->set_rules('password', lang('password'), 'trim|required|xss_clean|min_length[' . SETTING_user_password_length_minimum . ']|max_length[' . SETTING_user_password_length_maximum . ']');
             $this->form_validation->set_rules('password_confirm', lang('password_confirm'), 'trim|required|xss_clean|matches[password]');
         }
         $this->form_validation->set_rules('name', lang('name'), 'trim|required|xss_clean|min_length[' . SETTING_user_name_length_minimum . ']|max_length[' . SETTING_user_name_length_maximum . ']');
         $this->form_validation->set_rules('nickname', lang('nickname'), 'trim|required|xss_clean|min_length[' . SETTING_user_nickname_length_minimum . ']|max_length[' . SETTING_user_nickname_length_maximum . ']');
         $this->form_validation->set_rules('email', lang('email'), 'trim|required|htmlspecialchars|xss_clean|valid_email|max_length[128]');
         $this->form_validation->set_rules('message_receive_type', lang('message_receive_type'), 'trim|required|xss_clean|is_natural|less_than[3]');
         if (SETTING_avatar_used == 1) {
             $this->form_validation->set_rules('avatar_used', lang('avatar_used'), 'trim|required|xss_clean|is_natural|less_than[2]');
         }
         $this->form_validation->set_rules('timezones', lang('timezone'), 'trim|required|xss_clean');
         $this->form_validation->set_rules('memo', lang('memo'), 'trim|htmlspecialchars|xss_clean');
         //폼검증 성공이면
         if ($this->form_validation->run() == TRUE) {
             //request
             if ($this->input->post('password')) {
                 $req_password = $this->form_validation->set_value('password');
                 $req_password_confirm = $this->form_validation->set_value('password_confirm');
             }
             $req_name = htmlspecialchars($this->form_validation->set_value('name'));
             $req_nickname = htmlspecialchars($this->form_validation->set_value('nickname'));
             $req_email = $this->form_validation->set_value('email');
             $req_message_receive_type = $this->form_validation->set_value('message_receive_type');
             if (SETTING_avatar_used == 1) {
                 $req_avatar_used = $this->form_validation->set_value('avatar_used');
             } else {
                 $req_avatar_used = 0;
                 //설정이 사용중이 아닐때 회원수정하면 그냥 미사용으로하자... 나중에 추가된 설정이라..으.. 귀차니즘..
             }
             $req_timezones = $this->form_validation->set_value('timezones');
             $req_memo = $this->form_validation->set_value('memo');
             $req_avatar_file = $_FILES ? $_FILES['avatar_file']['name'] : NULL;
             $assign['result_msg'] = NULL;
             $modify_fail_msg = array();
             if ($req_avatar_file) {
                 $_FILES['avatar_file']['name'] = strtolower($_FILES['avatar_file']['name']);
                 //아바타 파일 업로드
                 $config['upload_path'] = './avatars/';
                 $config['allowed_types'] = 'gif';
                 $config['overwrite'] = TRUE;
                 $config['file_name'] = USER_INFO_user_id;
                 $config['max_size'] = SETTING_avatar_limit_capacity / 1024;
                 $config['max_width'] = SETTING_avatar_limit_image_size_width;
                 $config['max_height'] = SETTING_avatar_limit_image_size_height;
                 $this->load->library('upload', $config);
                 if (!$this->upload->do_upload('avatar_file')) {
                     $assign['avatar_file_fail'] = $this->upload->display_errors();
                 } else {
                     $avatar_file_data = $this->upload->data();
                     //파일명을 user_id로 올리고 체크하므로 일단 사용할 일이 없음.
                 }
             }
             //닉네임 중복 확인
             $check_nickname = $this->users_model->check('nickname', $req_nickname, ' AND idx <> ' . USER_INFO_idx);
             if ($check_nickname == TRUE) {
                 $modify_fail_msg[] = lang('nickname_duplicate');
             }
             //이메일 중복 확인
             $check_email = $this->users_model->check('email', $req_email, ' AND idx <> ' . USER_INFO_idx);
             if ($check_email == TRUE) {
                 $modify_fail_msg[] = lang('email_duplicate');
             }
             if (count($modify_fail_msg) > 0 or $assign['avatar_file_fail'] !== NULL) {
                 //닉네임, 이메일 중 1개 이상 오류
                 $assign['result_msg'] = join('<br />', $modify_fail_msg);
             } else {
                 if ($this->input->post('password')) {
                     $hash = new PasswordHash(8, FALSE);
                     $super_secured_password = $hash->HashPassword($req_password);
                 }
                 //정상 수정
                 $values = array();
                 $values['password'] = $this->input->post('password') ? $super_secured_password : '';
                 $values['name'] = $req_name;
                 $values['nickname'] = $req_nickname;
                 $values['email'] = $req_email;
                 $values['message_receive_type'] = $req_message_receive_type;
                 $values['avatar_used'] = $req_avatar_used;
                 $values['timezones'] = $req_timezones;
                 $values['memo'] = $req_memo;
                 $result = $this->users_model->modify($values);
                 if ($result == TRUE) {
                     $post_success = TRUE;
                     //최종 성공 여부
                     $assign['message'] = lang('update_success');
                     $assign['redirect'] = '/user/modify';
                     $this->alert($assign);
                 } else {
                     $assign['result_msg'] = lang('modify_fail_msg');
                 }
             }
         }
         if ($post_success == FALSE) {
             for ($i = 0; $i <= 2; $i++) {
                 $assign['message_receive_type'][$i] = array('checked' => '', 'text' => $this->assign['lang']['message_receive_type_' . $i]);
                 if (trim(set_value('message_receive_type')) !== '') {
                     $assign['message_receive_type'][$i]['checked'] = set_radio('message_receive_type', $i);
                 } else {
                     if (USER_INFO_message_receive_type == $i) {
                         $assign['message_receive_type'][$i]['checked'] = 'checked="checked"';
                     } else {
                         $assign['message_receive_type'][$i]['checked'] = '';
                     }
                 }
             }
             $assign['avatar'] = array('file' => '', 'width' => SETTING_avatar_limit_image_size_width, 'height' => SETTING_avatar_limit_image_size_height, 'capacity' => byte_format(SETTING_avatar_limit_capacity), 'used' => array());
             if (file_exists('./avatars/' . USER_INFO_user_id . '.gif') === TRUE) {
                 $assign['avatar']['file'] = BASE_URL . 'avatars/' . USER_INFO_user_id . '.gif';
             }
             for ($i = 0; $i <= 1; $i++) {
                 $assign['avatar']['used'][$i] = array('checked' => '', 'text' => $this->assign['lang']['avatar_used_' . $i]);
                 if (trim(set_value('avatar_used')) !== '') {
                     $assign['avatar']['used'][$i]['checked'] = set_radio('avatar_used', $i);
                 } else {
                     if (USER_INFO_avatar_used == $i) {
                         $assign['avatar']['used'][$i]['checked'] = 'checked="checked"';
                     } else {
                         $assign['avatar']['used'][$i]['checked'] = '';
                     }
                 }
             }
             $assign['timezone_selectbox'] = '';
             if (set_value('timezones')) {
                 $selected_timezone = set_value('timezones');
             } else {
                 $selected_timezone = USER_INFO_timezone;
             }
             $assign['timezone_selectbox'] = timezone_menu($selected_timezone);
             $assign['memo'] = '';
             if (set_value('memo')) {
                 $assign['memo'] = set_value('memo');
             } else {
                 $assign['memo'] = USER_INFO_memo;
             }
             $assign['insert_date'] = time2date(USER_INFO_timestamp_insert);
             $assign['user_id'] = defined('USER_INFO_user_id') === TRUE ? USER_INFO_user_id : '';
             $assign['name'] = set_value('name') !== '' ? set_value('name') : USER_INFO_name;
             $assign['nickname'] = set_value('nickname') !== '' ? set_value('nickname') : USER_INFO_nickname;
             $assign['email'] = set_value('email') !== '' ? set_value('email') : USER_INFO_email;
             $assign['form_null_check'] = "user_id^{$this->assign['lang']['user_id']}|password^{$this->assign['lang']['password']}|password_confirm^{$this->assign['lang']['password_confirm']}|name^{$this->assign['lang']['name']}|nickname^{$this->assign['lang']['nickname']}|email^{$this->assign['lang']['email']}|captcha^CAPTCHA";
             $assign['validation_result'] = validation_errors();
             $assign['validation_message'] = $assign['validation_result'] !== '' ? str_replace("\n", '', $assign['validation_result']) : '';
             $this->scope('contents', 'contents/user/modify', $assign);
             $this->display('layout');
         }
     }
     //로그인,권한 체크 end if
 }
Example #19
0
 private function saveInfo($upload_info, $options)
 {
     $data = array('table' => t($data['table']), 'row_id' => t($data['row_id']), 'app_name' => t($data['app_name']), 'attach_type' => t($options['attach_type']), 'uid' => (int) $data['uid'] ? $data['uid'] : $GLOBALS['ts']['mid'], 'ctime' => time(), 'private' => $data['private'] > 0 ? 1 : 0, 'is_del' => 0, 'from' => isset($data['from']) ? intval($data['from']) : getVisitorClient());
     if ($options['save_to_db']) {
         foreach ($upload_info as $u) {
             $name = t($u['name']);
             $data['name'] = $name ? $name : $u['savename'];
             $data['type'] = $u['type'];
             $data['size'] = $u['size'];
             $data['extension'] = strtolower($u['extension']);
             $data['hash'] = $u['hash'];
             $data['save_path'] = $options['custom_path'];
             $data['save_name'] = $u['savename'];
             if (in_array($data['extension'], array('jpg', 'gif', 'png', 'jpeg', 'bmp')) && !in_array($options['attach_type'], array('feed_file', 'weiba_attach'))) {
                 list($width, $height) = getImageInfo($data['save_path'] . $data['save_name']);
                 $data['width'] = $width;
                 $data['height'] = $height;
             } else {
                 $data['width'] = 0;
                 $data['height'] = 0;
             }
             $aid = $this->add($data);
             $data['attach_id'] = intval($aid);
             $data['key'] = $u['key'];
             $data['size'] = byte_format($data['size']);
             $infos[] = $data;
         }
     } else {
         foreach ($upload_info as $u) {
             $name = t($u['name']);
             $data['name'] = $name ? $name : $u['savename'];
             $data['type'] = $u['type'];
             $data['size'] = byte_format($u['size']);
             $data['extension'] = strtolower($u['extension']);
             $data['hash'] = $u['hash'];
             $data['save_path'] = $options['custom_path'];
             $data['save_name'] = $u['savename'];
             //$data['save_domain'] = C('ATTACH_SAVE_DOMAIN'); 	//如果做分布式存储,需要写方法来分配附件的服务器domain
             $data['key'] = $u['key'];
             $infos[] = $data;
         }
     }
     return $infos;
 }
Example #20
0
 function getFilesizePrefix($size)
 {
     if (!function_exists('byte_format')) {
         $ci =& get_instance();
         $ci->load->helper('number');
     }
     return byte_format($size);
 }
Example #21
0
 /**
  * swfupload上传附件
  */
 public function swfupload()
 {
     $grouplist = S('member/grouplist');
     if (isset($_POST['dosubmit'])) {
         if ($_POST['swf_auth_key'] != md5(C('config', 'auth_key') . $_POST['SWFUPLOADSESSID']) || $_POST['isadmin'] == 0 && !$grouplist[$_POST['groupid']]['allowattachment']) {
             exit;
         }
         $catid = isset($_POST['catid']) ? intval($_POST['catid']) : 0;
         $attachment = new Attachment($_POST['application'], $catid);
         $attachment->set_userid($_POST['userid']);
         $aids = $attachment->upload('Filedata', $_POST['filetype_post'], '', '', array($_POST['thumb_width'], $_POST['thumb_height']), $_POST['watermark_enable']);
         if ($aids[0]) {
             $filename = strtolower(CHARSET) != 'utf-8' ? iconv('gbk', 'utf-8', $attachment->uploadedfiles[0]['filename']) : '';
             if ($attachment->uploadedfiles[0]['isimage']) {
                 echo $aids[0] . ',' . $this->upload_url . $attachment->uploadedfiles[0]['filepath'] . ',' . $attachment->uploadedfiles[0]['isimage'] . ',' . $filename;
             } else {
                 $fileext = $attachment->uploadedfiles[0]['fileext'];
                 if ($fileext == 'zip' || $fileext == 'rar') {
                     $fileext = 'rar';
                 } elseif ($fileext == 'doc' || $fileext == 'docx') {
                     $fileext = 'doc';
                 } elseif ($fileext == 'xls' || $fileext == 'xlsx') {
                     $fileext = 'xls';
                 } elseif ($fileext == 'ppt' || $fileext == 'pptx') {
                     $fileext = 'ppt';
                 } elseif ($fileext == 'flv' || $fileext == 'swf' || $fileext == 'rm' || $fileext == 'rmvb') {
                     $fileext = 'flv';
                 } else {
                     $fileext = 'do';
                 }
                 echo $aids[0] . ',' . $this->upload_url . $attachment->uploadedfiles[0]['filepath'] . ',' . $fileext . ',' . $filename;
             }
             exit;
         } else {
             echo '0,' . $attachment->error();
             exit;
         }
     } else {
         if ($this->isadmin == 0 && !$grouplist[$this->groupid]['allowattachment']) {
             showmessage(L('att_no_permission'));
         }
         $args = $_GET['args'];
         $authkey = $_GET['authkey'];
         if (upload_key($args) != $authkey) {
             showmessage(L('attachment_parameter_error'));
         }
         extract(getswfinit($_GET['args']));
         $file_size_limit = byte_format(C('attachment', 'maxsize') * 1024);
         $att_not_used = cookie('att_json');
         if (empty($att_not_used) || !isset($att_not_used)) {
             $tab_status = ' class="on"';
         }
         if (!empty($att_not_used)) {
             $div_status = ' hidden';
         }
         // 获取临时未处理文件列表
         $att = $this->att_not_used();
         include $this->view('swfupload');
     }
 }
Example #22
0
 /**
  * 系统信息 - 管理知识 - 知识归档
  */
 public function logsArchive()
 {
     // 列表key值 DOACTION表示操作
     $this->pageKeyList = array('Name', 'Engine', 'Version', 'Rows', 'Data_length', 'Data_free', 'Create_time', 'Update_time', 'Collation', 'DOACTION');
     // Tab选项
     $this->pageTab[] = array('title' => '日志列表', 'tabHash' => 'list', 'url' => U('admin/Home/logs'));
     $this->pageTab[] = array('title' => '日志归档', 'tabHash' => 'down', 'url' => U('admin/Home/logsArchive'));
     // 列表分页栏按钮
     $this->pageButton[] = array('title' => L('PUBLIC_LOGS_REMOVE_SEX'), 'onclick' => "admin.cleanLogs(6)");
     $this->pageButton[] = array('title' => L('PUBLIC_LOGS_REMOVE_SET'), 'onclick' => "admin.cleanLogs(12)");
     $this->pageButton[] = array('title' => L('PUBLIC_LOGS_REMOVE_LOG'), 'onclick' => "admin.logsArchive()");
     $data['data'] = D('')->query("SHOW TABLE STATUS LIKE '" . C('DB_PREFIX') . "x_logs%'");
     foreach ($data['data'] as &$v) {
         foreach ($v as $vk => $vv) {
             $vk == 'Data_length' && ($v[$vk] = byte_format($vv));
         }
         $date = ltrim(str_replace(C('DB_PREFIX') . 'x_logs', '', $v['Name']), '_');
         $upTime = D('')->query('SELECT max( ctime ) AS Update_time FROM `' . $v['Name'] . '`');
         $v['Update_time'] = !empty($upTime[0]['Update_time']) ? date('Y-m-d H:i:s', $upTime[0]['Update_time']) : $v['Create_time'];
         $v['DOACTION'] = '<a href="' . U('admin/Home/logs', array('table' => $date)) . '">' . L('PUBLIC_VIEW') . '</a>';
     }
     $this->allSelected = false;
     $this->displayList($data);
 }
</a> <span class="warning"><?php 
    echo byte_format($filesize);
    ?>
</span></li>
	<?php 
}
?>
	<?php 
foreach ($filesize_range['ok'] as $link => $filesize) {
    ?>
	<li><a href="<?php 
    echo $link;
    ?>
" target="_blank"><?php 
    echo $link;
    ?>
</a> <span class="success"><?php 
    echo byte_format($filesize);
    ?>
</span></li>
	<?php 
}
?>
</ul>

	
</body>
</html>


Example #24
0
            ?>
">
							<td align="left"><?php 
            echo $benchmark['name'];
            ?>
</td>
							<td align="right"><?php 
            echo sprintf('%.2f', $benchmark['diff'] * 1000);
            ?>
 ms</td>
							<td align="right"><?php 
            echo sprintf('%.2f', $total * 1000);
            ?>
 ms</td>
							<td align="right"><?php 
            echo byte_format($benchmark['memory']);
            ?>
</td>
						</tr>
					<?php 
        }
        ?>
				<?php 
    } else {
        ?>
					<tr class="<?php 
        echo text::alternate('odd', 'even');
        ?>
">
						<td colspan="4">no benchmarks to display</td>
					</tr>
 /**
  * 检查上传的文件
  * @access private
  * @param array $file 文件信息
  * @return boolean
  */
 private function check($file)
 {
     if ($file['error'] !== 0) {
         //文件上传失败
         //捕获错误代码
         $this->error($file['error']);
         return false;
     }
     //文件上传成功,进行自定义规则检查
     //检查文件大小
     if (!$this->checkSize($file['size'])) {
         $this->error = '上传文件大小不符,文件不能超过 ' . byte_format($this->maxSize);
         return false;
     }
     //检查文件Mime类型
     if (!$this->checkType($file['type'])) {
         $this->error = '上传文件MIME类型不允许!';
         return false;
     }
     //检查文件类型
     if (!$this->checkExt($file['extension'])) {
         $this->error = '上传文件类型不允许';
         return false;
     }
     //检查是否合法上传
     if (!$this->checkUpload($file['tmp_name'])) {
         $this->error = '非法上传文件!';
         return false;
     }
     return true;
 }
Example #26
0
foreach ($tables as $table) {
    ?>
			<tr>
				<td><label><?php 
    echo form_checkbox('action_to[]', $table->Name);
    ?>
&nbsp;&nbsp;<?php 
    echo $table->Name;
    ?>
</td>
				<td><?php 
    echo number_format($table->Rows);
    ?>
</td>
				<td><?php 
    echo byte_format($table->Data_length);
    ?>
</td>
				<td><?php 
    echo $table->Comment;
    ?>
</td>
			</tr>
			<?php 
}
?>
		</tbody>
	</table>

	<p><input type="submit" class="btn btn-primary" value="<?php 
echo lang('appsdb:export');
 /**
  * 视频管理
  */
 public function video($is_del = 0)
 {
     $this->_listpk = 'video_id';
     //搜索区别
     $_POST['is_del'] = $isRec = isset($_REQUEST['is_del']) ? t($_REQUEST['is_del']) : $isRec;
     $this->pageKeyList = array('video_id', 'name', 'size', 'uid', 'ctime', 'from', 'DOACTION');
     $this->searchKey = array('video_id', 'name', 'from');
     $this->opt['from'] = array_merge(array('-1' => L('PUBLIC_ALL_STREAM')), $this->from);
     $this->pageTab[] = array('title' => '视频列表', 'tabHash' => 'list', 'url' => U('admin/Content/video'));
     $this->pageTab[] = array('title' => L('PUBLIC_RECYCLE_BIN'), 'tabHash' => 'rec', 'url' => U('admin/Content/videoRec'));
     $this->pageTab[] = array('title' => '视频配置', 'tabHash' => 'video_config', 'url' => U('admin/Content/video_config'));
     $this->pageButton[] = array('title' => L('PUBLIC_FILE_STREAM_SEARCH'), 'onclick' => "admin.fold('search_form')");
     if ($is_del == 0) {
         $this->pageButton[] = array('title' => L('PUBLIC_FILE_STREAM_DEL'), 'onclick' => "admin.ContentEdit('','delVideo','" . L('PUBLIC_STREAM_DELETE') . "','" . L('PUBLIC_FILE_STREAM') . "');");
     } else {
         $this->pageButton[] = array('title' => L('PUBLIC_REMOVE_COMPLETELY'), 'onclick' => "admin.ContentEdit('','deleteVideo','" . L('PUBLIC_REMOVE_COMPLETELY') . "','" . L('PUBLIC_FILE_STREAM') . "')");
     }
     $is_del == 1 && ($_REQUEST['tabHash'] = 'rec');
     $this->assign('pageTitle', $is_del ? L('PUBLIC_RECYCLE_BIN') : L('视频管理'));
     $map['is_del'] = $is_del == 1 ? 1 : 0;
     //未删除的
     !empty($_POST['video_id']) && ($map['video_id'] = array('in', explode(',', $_POST['video_id'])));
     $_POST['from'] > 1 && ($map['from'] = t($_POST['from']));
     !empty($_POST['name']) && ($map['name'] = array('like', '%' . t($_POST['name']) . '%'));
     // $listData = model('Attach')->getAttachList($map,'*','attach_id desc',10);
     $listData = D('video')->where($map)->findPage(20);
     foreach ($listData['data'] as &$v) {
         $user = model('User')->getUserInfo($v['uid']);
         $v['uid'] = $user['space_link'];
         $v['name'] = $v['image_path'] ? '<a target="_blank" href="' . SITE_URL . $v['video_path'] . '">' . "<img src='" . SITE_URL . $v['image_path'] . "' width='100'><br/>{$v['name']}</a>" : '<a target="_blank" href="' . SITE_URL . $v['video_path'] . '">' . $v['name'] . '</a>';
         $v['size'] = byte_format($v['size']);
         $v['from'] = $this->from[$v['from']];
         $v['ctime'] = date('Y-m-d H:i:s', $v['ctime']);
         $v['DOACTION'] = $is_del == 0 ? "<a href='javascript:void(0)' onclick='admin.ContentEdit({$v['video_id']},\"delVideo\",\"" . L('PUBLIC_STREAM_DELETE') . "\",\"" . L('PUBLIC_FILE_STREAM') . "\");'>" . L('PUBLIC_STREAM_DELETE') . "</a>" : "<a href='javascript:void(0)' onclick='admin.ContentEdit({$v['video_id']},\"VideoRecover\",\"" . L('PUBLIC_RECOVER') . "\",\"" . L('PUBLIC_FILE_STREAM') . "\")'>" . L('PUBLIC_RECOVER') . "</a>";
     }
     $this->displayList($listData);
 }
 public function block_content($context, array $blocks = array())
 {
     // line 6
     echo "<div id=\"wrap\">\n    <div class=\"container\">\n        <h1 class=\"title\">";
     // line 8
     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["materi"]) ? $context["materi"] : null, "judul"), "html", null, true);
     echo "</h1>\n        ";
     // line 9
     if (!array_key_exists("error", $context)) {
         // line 10
         echo "        <ul class=\"unstyled inline ul-top\">\n            <li><b class=\"title-info\">";
         // line 11
         echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["materi"]) ? $context["materi"] : null, "mapel"), "nama"), "html", null, true);
         echo "</b> </li>\n            ";
         // line 12
         $context['_parent'] = (array) $context;
         $context['_seq'] = twig_ensure_traversable($this->getAttribute(isset($context["materi"]) ? $context["materi"] : null, "materi_kelas"));
         foreach ($context['_seq'] as $context["_key"] => $context["mk"]) {
             // line 13
             echo "                <li>";
             echo twig_escape_filter($this->env, $this->getAttribute(isset($context["mk"]) ? $context["mk"] : null, "nama"), "html", null, true);
             echo "</li>\n            ";
         }
         $_parent = $context['_parent'];
         unset($context['_seq'], $context['_iterated'], $context['_key'], $context['mk'], $context['_parent'], $context['loop']);
         $context = array_intersect_key($context, $_parent) + $_parent;
         // line 15
         echo "            <li>Diposting oleh <a href=\"";
         echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["materi"]) ? $context["materi"] : null, "pembuat"), "link_profil"), "html", null, true);
         echo "\">";
         echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["materi"]) ? $context["materi"] : null, "pembuat"), "nama"), "html", null, true);
         echo "</a></li>\n            <li>";
         // line 16
         echo twig_escape_filter($this->env, tgl_jam_indo($this->getAttribute(isset($context["materi"]) ? $context["materi"] : null, "tgl_posting")), "html", null, true);
         echo "</li>\n        </ul>\n        ";
     }
     // line 19
     echo "        \n        <hr class=\"hr-top\">\n        <div class=\"wrap-content\">\n            <div class=\"content\">\n                ";
     // line 23
     if (!array_key_exists("error", $context)) {
         // line 24
         echo "                    ";
         if ((isset($context["type"]) ? $context["type"] : null) == "tertulis") {
             // line 25
             echo "                        ";
             echo html_entity_decode($this->getAttribute(isset($context["materi"]) ? $context["materi"] : null, "konten"));
             echo "\n                    ";
         } elseif ((isset($context["type"]) ? $context["type"] : null) == "file") {
             // line 27
             echo "                        <dl class=\"dl-horizontal\">\n                            <dt>Name</dt>\n                            <dd>";
             // line 29
             echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["materi"]) ? $context["materi"] : null, "file_info"), "name"), "html", null, true);
             echo "</dd>\n                            <dt>Size</dt>\n                            <dd>";
             // line 31
             echo twig_escape_filter($this->env, byte_format($this->getAttribute($this->getAttribute(isset($context["materi"]) ? $context["materi"] : null, "file_info"), "size")), "html", null, true);
             echo "</dd>\n                            <dt>Modified</dt>\n                            <dd>";
             // line 33
             echo twig_escape_filter($this->env, tgl_jam_indo(mdate("%Y-%m-%d %H:%i:%s", $this->getAttribute(isset($context["materifile_info"]) ? $context["materifile_info"] : null, "date"))), "html", null, true);
             echo "</dd>\n                            <dt>Mime</dt>\n                            <dd>";
             // line 35
             echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["materi"]) ? $context["materi"] : null, "file_info"), "mime"), "html", null, true);
             echo "</dd>\n                            <dt></dt>\n                            <dd><br><a href=\"";
             // line 37
             echo twig_escape_filter($this->env, $this->getAttribute(isset($context["materi"]) ? $context["materi"] : null, "download_link"), "html", null, true);
             echo "\" class=\"btn btn-warning\"><i class=\"icon-download\"></i> Download File</a></dd>\n                        </dl>\n                    ";
         }
         // line 40
         echo "                ";
     } else {
         // line 41
         echo "                    <div class=\"alert alert-danger\">\n                        <h3>";
         // line 42
         echo twig_escape_filter($this->env, isset($context["error"]) ? $context["error"] : null, "html", null, true);
         echo "</h3>\n                    </div>\n                ";
     }
     // line 45
     echo "            </div>\n        </div>\n    </div>\n</div>\n";
 }
Example #29
0
 /**
  * Get Stream Metadata
  *
  * Returns an array of the following data:
  *
  * name 			The stream name
  * slug 			The streams slug
  * namespace 		The stream namespace
  * db_table 		The name of the stream database table
  * raw_size 		Raw size of the stream database table
  * size 			Formatted size of the stream database table
  * entries_count	Number of the entries in the stream
  * fields_count 	Number of fields assigned to the stream
  * last_updated		Unix timestamp of when the stream was last updated
  *
  * @access	public
  * @param	mixed $stream object, int or string stream
  * @param	string $namespace namespace if first param is string
  * @return	object
  */
 public function get_stream_metadata($stream, $namespace = null)
 {
     $stream = $this->get_stream($stream, $namespace);
     $data = array();
     $data['name'] = $stream->stream_name;
     $data['slug'] = $stream->stream_slug;
     $data['namespace'] = $stream->stream_namespace;
     // Get DB table name
     $data['db_table'] = $stream->stream_prefix . $stream->stream_slug;
     // Get the table data
     $info = $this->CI->db->query("SHOW TABLE STATUS LIKE '" . $this->CI->db->dbprefix($data['db_table']) . "'")->row();
     // Get the size of the table
     $data['raw_size'] = $info->Data_length;
     $this->CI->load->helper('number');
     $data['size'] = byte_format($info->Data_length);
     // Last updated time
     $data['last_updated'] = !$info->Update_time ? $info->Create_time : $info->Update_time;
     $this->CI->load->helper('date');
     $data['last_updated'] = mysql_to_unix($data['last_updated']);
     // Get the number of rows (the table status data on this can't be trusted)
     $data['entries_count'] = $this->CI->db->count_all($data['db_table']);
     // Get the number of fields
     $data['fields_count'] = $this->CI->db->select('id')->where('stream_id', $stream->id)->get(ASSIGN_TABLE)->num_rows();
     return $data;
 }
Example #30
0
 /**
 * Returns the file size of an asset
 *
 	<code>
 	echo $this->asset->asset_filesize('banner.jpg');
 	// 20500
 
 	echo $this->asset->assets_path('banner.jpg', 'images', '', TRUE);
 	// 20.5 KB 
 	</code>
 
 * @access	public
 * @param	string	asset file name including extension
  	 * @param	string	subfolder to asset file (e.g. images, js, css... etc)
  	 * @param	string	module folder if any
  	 * @param	boolean	format
 * @return	string
 */
 public function asset_filesize($file = NULL, $path = NULL, $module = NULL, $format = TRUE)
 {
     $asset_file = assets_server_path($file, $path, $module);
     $filesize = 0;
     if (file_exists($asset_file)) {
         $filesize = filesize($asset_file);
     }
     if ($format) {
         if (!function_exists('byte_format')) {
             $CI = $this->_get_assets_config();
             $CI->load->helper('number');
         }
         $filesize = byte_format($filesize);
     }
     return $filesize;
 }