True, 'action' => True, 'help' => True, 'history' => True, 'view' => True, 'view_file' => True ); var $bo; var $nextmatchs; var $browser; var $tempalte_dir; var $help_info; function uiphpwebhosting() { $this->bo = CreateObject('phpwebhosting.bophpwebhosting'); $this->nextmatchs = CreateObject('phpgwapi.nextmatchs'); $this->browser = CreateObject('phpgwapi.browser'); $this->template_dir = $GLOBALS['phpgw']->common->get_tpl_dir($GLOBALS['phpgw_info']['flags']['currentapp']); $this->load_header(); $this->check_access(); $this->create_home_dir(); $this->verify_path(); $this->update(); } function load_header() { if(($this->bo->download && (count($this->bo->fileman) > 0)) || ($this->bo->op == 'view' && $this->bo->file) || ($this->bo->op == 'history' && $this->bo->file) || ($this->bo->op == 'help' && $this->bo->help_name) || ($this->bo->delete && count($this->bo->fileman) > 0) || ($this->bo->go && isset($this->bo->todir))) { } else { unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']); unset($GLOBALS['phpgw_info']['flags']['noappheader']); unset($GLOBALS['phpgw_info']['flags']['noappfooter']); $GLOBALS['phpgw']->common->phpgw_header(); } } function check_access() { if($this->bo->path != $this->bo->homedir && $this->bo->path != $this->bo->fakebase && $this->bo->path != '/' && !$this->bo->vfs->acl_check($this->bo->path,Array(RELATIVE_NONE),PHPGW_ACL_READ)) { $this->no_access_exists(lang('You do not have access to X',$this->bo->path)); } $this->bo->userinfo['working_id'] = $this->bo->vfs->working_id; $this->bo->userinfo['working_lid'] = $GLOBALS['phpgw']->accounts->id2name($this->bo->userinfo['working_id']); } function no_access_exists($error_msg) { if($this->bo->debug) { echo 'DEBUG: ui.no_access_exists: you do not have access to this directory
'."\n"; } $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_unknowns('remove'); $p->set_file( Array( '_errors' => 'errors.tpl' ) ); $p->set_block('_errors','error_page','error_page'); $p->set_block('_errors','ind_error','ind_error'); $p->set_var('error',$error_msg); $p->parse('errors','ind_error',True); $p->set_var('error','

Go to your Home directory' ); $p->parse('errors','ind_error',True); $p->pfp('output','error_page'); $GLOBALS['phpgw']->common->phpgw_exit(); } function create_home_dir() { ### # If their home directory doesn't exist, we create it # Same for group directories ### if($this->bo->debug) { echo 'DEBUG: ui.create_home_dir: PATH = '.$this->bo->path.'
'."\n"; echo 'DEBUG: ui.create_home_dir: PATH = '.urlencode($this->bo->path).'
'."\n"; } if(($this->bo->path == $this->bo->homedir) && !$this->bo->vfs->file_exists($this->bo->homedir,Array(RELATIVE_NONE))) { //$this->bo->vfs->override_acl = 1; $this->bo->vfs->mkdir($this->bo->homedir,Array(RELATIVE_NONE)); //$this->bo->vfs->override_acl = 0; } // elseif(preg_match("|^".$this->bo->fakebase."\/(.*)$|U",$this->bo->path,$this->bo->matches)) // { // if (!$this->bo->vfs->file_exists($this->bo->path,Array(RELATIVE_NONE))) // { // //$this->bo->vfs->override_acl = 1; // $this->bo->vfs->mkdir($this->bo->path,Array(RELATIVE_NONE)); // //$this->bo->vfs->override_acl = 0; // // if($this->bo->debug) // { // echo 'DEBUG: ui.create_home_dir: PATH = '.$this->bo->path.'
'."\n"; // echo 'DEBUG: ui.create_home_dir(): matches[1] = '.$this->bo->matches[1].'
'."\n"; // } // // $group_id = $GLOBALS['phpgw']->accounts->name2id($this->bo->matches[1]); // if($group_id) // { // $this->bo->vfs->set_attributes($this->bo->path,Array(RELATIVE_NONE),Array('owner_id' => $group_id, 'createdby_id' => $group_id)); // } // } // } } function verify_path() { ### # Verify path is real ### if($this->bo->debug) { echo 'DEBUG: ui.verify_path: PATH = '.$this->bo->path.'
'."\n"; echo 'DEBUG: ui.verify_path: exists = '.$this->bo->vfs->file_exists($this->bo->path,Array(RELATIVE_NONE)).'
'."\n"; } if($this->bo->path != $this->bo->homedir && $this->bo->path != '/' && $this->bo->path != $this->bo->fakebase && !$this->bo->vfs->file_exists($this->bo->path,Array(RELATIVE_NONE))) { $this->no_access_exists(lang('Directory '.$this->bo->path.' does not exist')); } } function update() { /* Update if they request it, or one out of 20 page loads */ srand ((double) microtime() * 1000000); if($this->bo->update || rand(0, 19) == 4) { $this->bo->vfs->update_real($this->bo->path,Array(RELATIVE_NONE)); } if($this->bo->update) { // This needs to redirect to the index after the user issues an update..... } } function action() { $actions = Array( 'delete' => lang('Delete'), 'go' => lang('Go To') ); @reset($actions); while(list($function,$text) = each($actions)) { if(isset($this->bo->$function) && !empty($this->bo->$function) && trim($this->bo->$function) == $text) { if($this->bo->$function == 'go') { echo 'To Dir = '.$this->bo->todir.'
'."\n"; } $this->bo->$function(); } } } function help() { $this->bo->load_help_info(); @reset($this->bo->help_info); while(list($num,$help_array) = each($this->bo->help_info)) { if ($help_array[0] != $this->bo->help_name) { continue; } $help_array[1] = preg_replace("/\[(.*)\|(.*)\]/Ue","\$this->build_help('\\1','\\2')",$help_array[1]); $help_array[1] = preg_replace("/\[(.*)\]/Ue","\$this->build_help('\\1','\\1')",$help_array[1]); echo ''."\n".ucwords(str_replace('_',' ',$help_array[0]))."\n".'
'."\n"; echo ''."\n".$help_array[1].''; } $GLOBALS['phpgw']->common->phpgw_exit (); } function build_help($help_option,$text='') { if($this->bo->settings['show_help']) { $help = ($text?'':''."\n"); $help .= ' '; $help .= ($text?$text:'[?]'); $help .= ''; $help .= ($text?'':"\n".' '); return $help; } else { return ''; } } function image($image,$alt) { return ''.$alt.''; } function link($array_params,$text) { return ''.$text.''; } function build_upload_choices($number) { return $this->link( Array( 'menuaction' => $GLOBALS['HTTP_GET_VARS']['menuaction'], 'path' => $this->bo->path, 'show_upload_boxes' => $number ), $number).'  '; } function column_header($internal,$displayed,$link=True) { if($link) { $header_str = ''.lang($displayed).''.$this->build_help(ereg_replace(' ','_',$displayed)); } else { $header_str = $displayed.$this->build_help(ereg_replace(' ','_',$displayed)); } return Array( 'td_extras' => '', 'column_header' => $header_str ); } function display_buttons() { $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_file( Array( '_buttons' => 'small_table.tpl' ) ); $p->set_block('_buttons','table','table'); $p->set_block('_buttons','column_headers','column_headers'); $p->set_block('_buttons','column_headers_normal','column_headers_normal'); $p->set_block('_buttons','column_rows','column_rows'); $var = Array( 'table_extras' => '', 'tr_extras' => '', 'td_extras' => ' align="center" width="25%"' ); $var['column_header'] = ''.$this->build_help('edit'); $p->set_var($var); $p->parse('col_headers','column_headers',False); $var['column_header'] = ''.$this->build_help('rename'); $p->set_var($var); $p->parse('col_headers','column_headers',True); $var['column_header'] = ''.$this->build_help('delete'); $p->set_var($var); $p->parse('col_headers','column_headers',True); $var['column_header'] = ''.$this->build_help('edit_comments'); $p->set_var($var); $p->parse('col_headers','column_headers',True); $p->parse('list','column_rows',True); $var['column_header'] = ''.$this->build_help('go_to'); $p->set_var($var); $p->parse('col_headers','column_headers',False); $var['column_header'] = ''.$this->build_help('copy_to'); $p->set_var($var); $p->parse('col_headers','column_headers',True); $var['column_header'] = ''.$this->build_help('move_to'); $p->set_var($var); $p->parse('col_headers','column_headers',True); ### # First we get the directories in their home directory ### $dirs[] = Array( 'directory' => $this->bo->fakebase, 'name' => $this->bo->userinfo['account_lid'] ); $ls_array = $this->bo->vfs->ls($this->bo->homedir,Array(RELATIVE_NONE),True,'Directory'); while(list($num,$dir) = each($ls_array)) { $dirs[] = $dir; } ### # Then we get the directories in their membership's home directories ### reset($this->bo->memberships); while(list($num,$group_array) = each($this->bo->memberships)) { ### # Don't list directories for groups that don't have access ### if(!$this->bo->membership_applications[$group_array['account_name']][$this->bo->appname]['enabled']) { continue; } $dirs[] = Array( 'directory' => $this->bo->fakebase, 'name' => $group_array['account_name'] ); $ls_array = $this->bo->vfs->ls($this->bo->fakebase.SEP.$group_array['account_name'],Array(RELATIVE_NONE),True,'Directory'); while(list($num,$dir) = each($ls_array)) { $dirs[] = $dir; } } $dir_list = ''; reset($dirs); while(list($num, $dir) = each($dirs)) { if(!$dir['directory']) { continue; } ### # So we don't display // ### if($dir['directory'] != '/') { $dir['directory'] .= SEP; } $selected = ''; if($num == 0) { $selected = ' selected'; } ### # No point in displaying the current directory, or a directory that doesn't exist ### if((($dir['directory'].$dir['name']) != $this->bo->path) && $this->bo->vfs->file_exists($dir['directory'].$dir['name'],Array(RELATIVE_NONE))) { $dir_list .= ''; } } $var['column_header'] = ''.$this->build_help('directory_list'); $p->set_var($var); $p->parse('col_headers','column_headers',True); $p->parse('list','column_rows',True); $p->set_var('col_headers',''); $var = Array( 'tr_extras' => '', 'td_extras' => ' colspan="2" align="center" width="50%"' ); if($this->bo->path != '/' && $this->bo->path != $this->bo->fakebase) { $var['column_header'] = ''.$this->build_help('download'); $p->set_var($var); $p->parse('col_headers','column_headers',True); $var['column_header'] = '    '.$this->build_help('create_folder'); $p->set_var($var); $p->parse('col_headers','column_headers',True); $p->parse('list','column_rows',True); } $var['column_header'] = ''.$this->build_help('update'); $p->set_var($var); $p->parse('col_headers','column_headers',False); if($this->bo->path != '/' && $this->bo->path != $this->bo->fakebase) { $var['column_header'] = '    '.$this->build_help('create_file'); } else { $var['column_header'] = ' '; } $p->set_var($var); $p->parse('col_headers','column_headers',True); $p->parse('list','column_rows',True); $p->set_var('col_headers',''); if($this->bo->settings['show_command_line']) { $var = Array( 'tr_extras' => '', 'td_extras' => ' colspan="4" align="center" width="100%"', 'column_header' => ''.$this->build_help('command_line').'
'.$this->build_help('execute') ); $p->set_var($var); $p->parse('col_headers','column_headers',True); $p->parse('list','column_rows',True); $p->set_var('col_headers',''); } return $p->fp('output','table'); } function display_summary_info($numoffiles,$usedspace) { $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_file( Array( '_info' => 'small_table.tpl' ) ); $p->set_block('_info','table','table'); $p->set_block('_info','column_headers','column_headers'); $p->set_block('_info','column_headers_normal','column_headers_normal'); $p->set_block('_info','column_rows','column_rows'); $this_homedir = ($this->bo->path == $this->bo->homedir || $this->bo->path == $this->bo->fakedir); $info_columns = 4 + ($this_homedir?2:0); $var = Array( 'table_extras' => ' cols="'.$info_columns.'"', 'tr_extras' => '', 'td_extras' => ' colspan="'.$info_columns.'" align="center" width="100%"', 'column_header' => $this->build_help('file_stats') ); $p->set_var($var); $p->parse('col_headers','column_headers',False); $p->parse('list','column_rows',True); $p->set_var('col_headers',''); $var = Array( 'tr_extras' => '', 'td_extras' => ' align="right"' ); $var['column_header'] = ''.lang('Files').':'; $p->set_var($var); $p->parse('col_headers','column_headers_normal',False); $var['td_extras'] = ' align="left"'; $var['column_header'] = $numoffiles; $p->set_var($var); $p->parse('col_headers','column_headers_normal',True); $var['td_extras'] = ' align="right"'; $var['column_header'] = ''.lang('Used Space').':'; $p->set_var($var); $p->parse('col_headers','column_headers_normal',True); $var['td_extras'] = ' align="left"'; $var['column_header'] = $this->bo->borkb($usedspace); $p->set_var($var); $p->parse('col_headers','column_headers_normal',True); if($this_homedir) { $var['td_extras'] = ' align="right"'; $var['column_header'] = ''.lang('Unused space').':'; $p->set_var($var); $p->parse('col_headers','column_headers_normal',True); $var['td_extras'] = ' align="left"'; $var['column_header'] = $this->bo->borkb($this->bo->userinfo['hdspace'] - $usedspace); $p->set_var($var); $p->parse('col_headers','column_headers_normal',True); } $p->parse('list','column_rows',True); $p->set_var('col_headers',''); if($this_homedir) { $var['td_extras'] = ' colspan="'.($info_columns / 2).'" align="right" width="50%"'; $var['column_header'] = ''.lang('Total Files').':'; $p->set_var($var); $p->parse('col_headers','column_headers_normal',False); $var['td_extras'] = ' colspan="'.($info_columns / 2).'" align="left" width="50%"'; $var['column_header'] = count($this->bo->vfs->ls($this->bo->path,Array(RELATIVE_NONE))); $p->set_var($var); $p->parse('col_headers','column_headers_normal',True); $p->parse('list','column_rows',True); $p->set_var('col_headers',''); } return $p->fp('output','table'); } function display_uploads() { $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_file( Array( '_uploads' => 'small_table.tpl' ) ); $p->set_block('_uploads','table','table'); $p->set_block('_uploads','column_headers','column_headers'); $p->set_block('_uploads','column_headers_normal','column_headers_normal'); $p->set_block('_uploads','column_rows','column_rows'); $var = Array( 'table_extras' => ' cols="3"', 'tr_extras' => '' ); $var['td_extras'] = ' align="right" width="45%"'; $var['column_header'] = ''.lang('File').''.$this->build_help('upload_file'); $p->set_var($var); $p->parse('col_headers','column_headers_normal',False); $var['td_extras'] = ' align="center" width="10%"'; $var['column_header'] = ' '; $p->set_var($var); $p->parse('col_headers','column_headers_normal',True); $var['td_extras'] = ' align="left" width="45%"'; $var['column_header'] = ''.lang('Comment').''.$this->build_help('upload_comment'); $p->set_var($var); $p->parse('col_headers','column_headers_normal',True); $p->parse('list','column_rows',True); $input_file = ''; $input_comment = ''; $var['tr_extras'] = ''; $var['td_extras'] = ' colspan="3" align="center"'; $var['column_header'] = ''."\n".$input_file.$input_comment; $p->set_var($var); $p->parse('col_headers','column_headers_normal',False); $p->parse('list','column_rows',True); for($i=1;$i<$this->bo->show_upload_boxes;$i++) { $var['column_header'] = $input_file.$input_comment; $p->set_var($var); $p->parse('col_headers','column_headers_normal',False); $p->parse('list','column_rows',True); } $var['column_header'] = ''.$this->build_help('upload_files'); $p->set_var($var); $p->parse('col_headers','column_headers_normal',False); $p->parse('list','column_rows',True); $var['column_header'] = lang('Show').'  '.$this->build_upload_choices(5).$this->build_upload_choices(10).$this->build_upload_choices(20).$this->build_upload_choices(30).lang('upload fields').$this->build_help('show_upload_fields'); $p->set_var($var); $p->parse('col_headers','column_headers_normal',False); $p->parse('list','column_rows',True); return '
'."\n".$p->fp('output','table').'
'."\n"; } function index() { $files_array = $this->bo->load_files(); if(count($files_array) || $this->bo->cwd) { $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_unknowns('remove'); $p->set_file( Array( '_index' => 'index.tpl' ) ); $p->set_block('_index','index','index'); $p->set_block('_index','column_headers','column_headers'); $p->set_block('_index','column_headers_normal','column_headers_normal'); $p->set_block('_index','column_rows','column_rows'); $GLOBLAS['tr_color'] = $GLOBALS['phpgw_info']['theme']['row_off']; $p->set_var('tr_extras',' bgcolor="'.$this->nextmatchs->alternate_row_color().'" border="0"'); $var = Array( 'form_action' => $GLOBALS['phpgw']->link('/index.php', Array( 'menuaction' => $this->bo->appname.'.ui'.$this->bo->appname.'.action', 'path' => urlencode($this->bo->path) ) ), 'img_up' => $this->link(Array( 'menuaction' => $this->bo->appname.'.ui'.$this->bo->appname.'.index', 'path' => urlencode($this->bo->lesspath) ), $this->image('folder_up.gif',lang('Up'))), 'help_up' => $this->build_help('up'), 'img_home' => $this->image('folder_home.gif',lang('Folder')), 'dir' => ''."\n" . ' '.strtoupper($this->bo->path).''."\n" . ' ', 'help_home' => $this->build_help('home'), ); $p->set_var($var); $p->set_var($this->column_header('','Sort By:',False)); $p->parse('col_headers','column_headers',True); $columns = 1; reset($this->bo->file_attributes); while(list($internal,$displayed) = each($this->bo->file_attributes)) { if ($this->bo->settings[$internal]) { $p->set_var($this->column_header($internal,$displayed,True)); $p->parse('col_headers','column_headers',True); $columns++; } } $p->set_var('tr_extras',' bgcolor="'.$this->nextmatchs->alternate_row_color().'" border="0"'); $p->parse('col_row','column_rows',True); $p->set_var('colspan',$columns); if($this->bo->settings['dotdot'] && $this->bo->settings['name'] && $this->bo->path != '/') { $var = Array( 'col_headers' => '', 'td_extras' => '', 'column_header' => ' ' ); $p->set_var($var); $p->parse('col_headers','column_headers',True); $var = Array( 'td_extras' => '', 'column_header' => $this->image('folder.gif','folder') .$this->link( Array( 'menuaction' => $this->bo->appname.'.ui'.$this->bo->appname.'.index', 'path' => $this->bo->lesspath ), '..' ) ); $p->set_var($var); $p->parse('col_headers','column_headers',True); $loop_cntr = 2; if($this->bo->settings['mime_type']) { $var = Array( 'td_extras' => '', 'column_header' => 'Directory' ); $loop_cntr++; } $p->set_var($var); $p->parse('col_headers','column_headers',True); $var = Array( 'td_extras' => '', 'column_header' => ' ' ); for($i=$loop_cntr;$i<$columns;$i++) { $p->set_var($var); $p->parse('col_headers','column_headers',True); } $p->set_var('tr_extras',' bgcolor="'.$this->nextmatchs->alternate_row_color().'" border="0"'); $p->parse('col_row','column_rows',True); $p->set_var('col_headers',''); } $usedspace = 0; reset($files_array); $numoffiles = count($files_array); for($i=0;$i!=$numoffiles;$i++) { $files = $files_array[$i]; $var = Array( 'td_extras' => '', 'column_header' => '' ); $p->set_var($var); $p->parse('col_headers','column_headers'); $usedspace += $files['size']; reset($this->bo->file_attributes); while(list($internal,$displayed) = each($this->bo->file_attributes)) { if($this->bo->settings[$internal]) { $var = Array( 'td_extras' => '' ); switch($internal) { case 'name': switch($files['mime_type']) { case 'Directory': $var['column_header'] = $this->image('folder.gif','folder') .$this->link( Array( 'menuaction' => $this->bo->appname.'.ui'.$this->bo->appname.'.index', 'path' => $this->bo->path.$this->bo->dispsep.$files['name'] ), ''.$files['name'].'' ); break; default: $var['column_header'] = $this->link( Array( 'menuaction' => $this->bo->appname.'.ui'.$this->bo->appname.'.view', 'path' => urlencode($this->bo->path), 'file' => urlencode($files['name']) ), ''.$files['name'].'' ); break; } break; case 'deletable': if ($files['deleteable'] == 'N') { $var['column_header'] = $this->image('locked.gif','locked'); } else { $var['column_header'] = ' '; } break; case 'size': $var['column_header'] = $this->bo->borkb($files['size']); $var['td_extras'] = ' align="right"'; break; case 'version': $var['column_header'] = $this->link( Array( 'menuaction' => $this->bo->appname.'.ui'.$this->bo->appname.'.history', 'path' => $this->bo->path, 'file' => $files['name'] ), $files['version'] ); break; case 'modified': case 'created': if($files[$internal] && $files[$internal] != '0000-00-00') { $year = substr($files[$internal],0,4); $month = substr($files[$internal],5,2); $day = substr($files[$internal],8,2); // echo $files['name'].' : '.$internal.' : '.$year.'.'.$month.'.'.$day.'
'."\n"; $datetime = mktime(0,0,0,$month,$day,$year); $var['column_header'] = date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$datetime); } else { $var['column_header'] = ' '; } break; case 'owner': case 'createdby_id': case 'modifiedby_id': switch($internal) { case 'owner': $ivar = 'owner_id'; break; default: $ivar = $internal; break; } $var['column_header'] = ($files[$ivar]?$GLOBALS['phpgw']->accounts->id2name($files[$ivar]):' '); break; default: $var['column_header'] = ($files[$internal]?$files[$internal]:' '); break; } $p->set_var($var); $p->parse('col_headers','column_headers',True); } } $p->set_var('tr_extras',' bgcolor="'.$this->nextmatchs->alternate_row_color().'" border="0"'); $p->parse('col_row','column_rows',True); $p->set_var('col_headers',''); } $p->set_var('buttons',$this->display_buttons()); $p->set_var('info',$this->display_summary_info($numoffiles,$usedspace)); $p->set_var('uploads',$this->display_uploads()); $p->pfp('output','index'); } } function view() { if($this->bo->vfs->file_exists($this->bo->path.'/'.$this->bo->file,Array(RELATIVE_NONE))) { $content_type = $this->bo->vfs->file_type($this->bo->path.$this->bo->dispsep.$this->bo->file,Array(RELATIVE_NONE)); if($content_type) { $cont_type = explode('/',$content_type); $content_type = $cont_type[1]; } else { } switch($content_type) { case 'jpeg': case 'gif': case 'bmp': case 'png': $alignment = 'center'; $file_content = ''."\n"; break; default: $alignment = 'left'; $file_content = nl2br($this->bo->vfs->read($this->bo->path.$this->bo->dispsep.$this->bo->file,Array(RELATIVE_NONE))); break; } $file = $this->bo->path.$this->bo->dispsep.$this->bo->file; $GLOBALS['tr_color'] = $GLOBALS['phpgw_info']['theme']['row_off']; echo ''."\n" . ' '."\n" . ' '."\n" . ' '."\n" . ' '."\n" . ' '."\n" . ' '."\n" . ' '."\n" . ' '."\n" . ' '."\n" . ' '."\n" . ' '."\n" . ' '."\n" . '
'."\n" . ' TYPE: '.$this->bo->vfs->file_type($file,Array(RELATIVE_NONE)).'
'."\n" . '
'."\n" . ' FILENAME: '.$file."\n" . '
'."\n" . ' VERSION: '.$this->bo->vfs->get_version($file,Array(RELATIVE_NONE))."\n" . '
'."\n" . $file_content."\n" . '
'."\n"; } } function history() { $file = $this->bo->path.$this->bo->dispsep.$this->bo->file; if($this->bo->vfs->file_exists($file,Array(RELATIVE_NONE))) { $col_headers = Array( 'Date' => 'created', 'Version' => 'version', 'Action Performed by' => 'owner_id', 'Operation' => 'comment' ); $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_unknowns('remove'); $p->set_file( Array( '_history' => 'history.tpl' ) ); $p->set_block('_history','history','history'); $p->set_block('_history','column_headers','column_headers'); $p->set_block('_history','column_rows','column_rows'); $var = Array( 'path' => $this->link( Array( 'menuaction' => $this->bo->appname.'.ui'.$this->bo->appname.'.index', 'path' => urlencode($this->bo->path) ), $this->bo->path ), 'filename' => $this->link( Array( 'menuaction' => $this->bo->appname.'.ui'.$this->bo->appname.'.view', 'path' => urlencode($this->bo->path), 'file' => urlencode($this->bo->file) ), $this->bo->file ) ); $p->set_var($var); $GLOBALS['tr_color'] = $GLOBALS['phpgw_info']['theme']['row_off']; $var = Array( 'td_extras' => '' ); @reset($col_headers); while(list($label,$field)= each($col_headers)) { $var['column_header'] = ''.$label.''; $p->set_var($var); $p->parse('col_headers','column_headers',True); } $p->set_var('tr_extras',' bgcolor="'.$this->nextmatchs->alternate_row_color().'" border="0"'); $p->parse('col_row','column_rows',True); $p->set_var('col_headers',''); $journal_array = $this->bo->vfs->get_journal($file,Array(RELATIVE_NONE)); while(list($num,$journal_entry) = each($journal_array)) { @reset($col_headers); while(list($label,$field)= each($col_headers)) { switch($field) { case 'owner_id': $var['column_header'] = ''.$GLOBALS['phpgw']->accounts->id2name($journal_entry[$field]).''; break; case 'created': if($journal_entry[$field] && $journal_entry[$field] != '0000-00-00') { $year = substr($journal_entry[$field],0,4); $month = substr($journal_entry[$field],5,2); $day = substr($journal_entry[$field],8,2); $datetime = mktime(0,0,0,$month,$day,$year); $var['column_header'] = ''.date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$datetime).''; } else { $var['column_header'] = ' '; } break; default: $var['column_header'] = ''.$journal_entry[$field].''; break; } $p->set_var($var); $p->parse('col_headers','column_headers',True); } $p->set_var('tr_extras',' bgcolor="'.$this->nextmatchs->alternate_row_color().'" border="0"'); $p->parse('col_row','column_rows',True); $p->set_var('col_headers',''); } $p->pfp('output','history'); } } function view_file() { $file = $this->bo->path.$this->bo->dispsep.$this->bo->file; if($this->bo->vfs->file_exists($file,Array(RELATIVE_NONE))) { Header('Content-length: '.$this->bo->vfs->get_size($file,Array(RELATIVE_NONE))); Header('Content-type: '.$this->bo->vfs->file_type($file,Array(RELATIVE_NONE))); Header('Content-disposition: attachment; filename="'.$this->bo->file.'"'); echo $this->bo->vfs->read($file,Array(RELATIVE_ALL)); flush(); } $GLOBALS['phpgw']->common->phpgw_exit (); } }