function system_statistics() { $content_template = $this->load_template($this->_template_root . 'system_statistics.xml'); $sm = vivvo_lite_site::get_instance(); $user_mng = $sm->get_user_manager(); $user_list = $user_mng->get_user_list(); $content_template->assign('system_staff', strval($user_list->get_count(array('search_user_type' => 'staff')))); $fm = $sm->get_file_manager(); $tpl_dir = new dir_list(null, VIVVO_TEMPLATE_DIR, '', VIVVO_FS_TEMPLATE_ROOT); $tpl_dir->allowed_ext = array('tpl'); $content_template->assign('system_templates', strval($tpl_dir->get_total_number())); $content_template->assign('system_templates_size', number_format($tpl_dir->get_total_file_size() / (1024 * 1024), 2, '.', ' ')); $tpl_dir->set__root_dir(VIVVO_FS_ROOT); $tpl_dir->set_dir(VIVVO_FS_FILES_DIR); $tpl_dir->allowed_ext = array(); $content_template->assign('system_files', strval($tpl_dir->get_total_number())); $content_template->assign('system_files_size', number_format($tpl_dir->get_total_file_size() / (1024 * 1024), 2, '.', ' ')); $tpl_dir->set__root_dir(VIVVO_FS_ROOT); $tpl_dir->set_dir('backup/'); $tpl_dir->allowed_ext = array('sql', 'gz'); $content_template->assign('system_backup', strval($tpl_dir->get_total_number())); $content_template->assign('system_backup_size', number_format($tpl_dir->get_total_file_size() / (1024 * 1024), 2, '.', ' ')); $tpl_dir->set__root_dir(VIVVO_FS_ROOT); $tpl_dir->set_dir('cache/'); $tpl_dir->allowed_ext = array(); $content_template->assign('system_cache_size', number_format($tpl_dir->get_total_file_size() / (1024 * 1024), 2, '.', ' ')); $db = $sm->get_db(); $res = $db->query("SHOW TABLE STATUS"); $db_size = 0; if (!PEAR::isError($res)) { while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) { $db_size += $row['data_length'] + $row['index_length']; } } $content_template->assign('system_database', number_format($db_size / (1024 * 1024), 2, '.', ' ')); return $content_template->get_output(); }
function set_dir($dir) { if (file_exists($this->_root_dir . $dir) && is_dir($this->_root_dir . $dir)) { $this->dir = dir_list::cleanPath($dir); $this->dir = $dir; if (substr($dir, -1, 1) != '/' && substr($dir, -1, 1) != '\\') { $this->dir .= '/'; } } }
/** * Generate box output * * @param array $params Parameters */ function generate_output($params) { $this->set_template($params); require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/framework/vivvo_file.php'; if ($params['fs_root']) { $dir = new dir_list(null, $params['dir'], $params['ext'], $params['fs_root'], false); } else { $dir = new dir_list(null, $params['dir'], $params['ext'], '', false); } if ($params['ext'] === 'dirext') { $dir->get_dirs(); } else { $dir->get_files(); } if (isset($params['template_string'])) { $this->_template->assign('template_string', $params['template_string']); } if (isset($params['parent_dir'])) { $this->_template->assign('parent_dir', $params['parent_dir']); } $this->_template->assign('dir', $params['dir']); $this->_template->assign('file_list_object', $dir); $this->_template->assign('file_list', $dir->list); $this->_template->assign('box_id', $params['box_id']); $this->_template->assign('prefix', $params['prefix']); }