[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: email addressbook.php,1.36,1.37 attach_file.php,
From: |
Dave Hall <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: email addressbook.php,1.36,1.37 attach_file.php,1.26,1.27 index.php,1.88,1.89 view_image.php,1.14,1.15 |
Date: |
Fri, 25 Oct 2002 08:45:54 -0400 |
Update of /cvsroot/phpgroupware/email
In directory subversions:/tmp/cvs-serv3749
Modified Files:
addressbook.php attach_file.php index.php view_image.php
Log Message:
ported anglemail - used anglemail-1.1-pre5-12 release - finally :)
Index: addressbook.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/addressbook.php,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -r1.36 -r1.37
*** addressbook.php 28 Sep 2002 20:01:43 -0000 1.36
--- addressbook.php 25 Oct 2002 12:45:52 -0000 1.37
***************
*** 1,220 ****
! <?php
!
/**************************************************************************\
! * phpGroupWare - email/addressbook
*
! * http://www.phpgroupware.org
*
! * Written by Bettina Gille address@hidden *
! * -----------------------------------------------
*
! * This program is free software; you can redistribute it and/or modify
it *
! * under the terms of the GNU General Public License as published by
the *
! * Free Software Foundation; either version 2 of the License, or (at
your *
! * option) any later version.
*
!
\**************************************************************************/
!
! /* $Id$ */
!
! $GLOBALS['phpgw_info']['flags'] = array(
! 'noheader' => True,
! 'nonavbar' => True,
! 'currentapp' => 'email',
! 'enable_nextmatchs_class' => True
! );
!
! include('../header.inc.php');
!
! $GLOBALS['phpgw']->template->set_file(array(
! 'addressbook_list_t' => 'addressbook.tpl',
! 'addressbook_list' => 'addressbook.tpl'
! ));
!
$GLOBALS['phpgw']->template->set_block('addressbook_list_t','addressbook_list','list');
!
! $d = CreateObject('phpgwapi.contacts');
! $c = CreateObject('phpgwapi.categories');
! $c->app_name = 'addressbook';
!
! $include_personal = True;
! //$include_personal = False;
!
! $charset = $GLOBALS['phpgw']->translation->translate('charset');
! $GLOBALS['phpgw']->template->set_var('charset',$charset);
!
$GLOBALS['phpgw']->template->set_var('title',$GLOBALS['phpgw_info']['site_title']);
!
$GLOBALS['phpgw']->template->set_var('bg_color',$GLOBALS['phpgw_info']['theme']['bg_color']);
!
$GLOBALS['phpgw']->template->set_var('lang_addressbook_action',lang('Address
book'));
!
$GLOBALS['phpgw']->template->set_var('font',$GLOBALS['phpgw_info']['theme']['font']);
!
! $GLOBALS['phpgw']->template->set_var('lang_search',lang('Search'));
!
$GLOBALS['phpgw']->template->set_var('search_action',$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php'));
! $GLOBALS['phpgw']->template->set_var('lang_select_cats',lang('Select
category'));
!
! if (! $start)
! {
! $start = 0;
! }
!
! if (!$filter)
! {
! $filter = 'none';
! }
!
! if (!$cat_id)
! {
! if ($filter == 'none')
! {
! $qfilter = 'tid=n';
! }
! elseif ($filter == 'private')
! {
! $qfilter =
'tid=n,owner='.$GLOBALS['phpgw_info']['user']['account_id'];
! }
! else
! {
! $qfilter = 'tid=n,owner='.$filter;
! }
! }
! else
! {
! if ($filter == 'none')
! {
! $qfilter = 'tid=n,cat_id='.$cat_id;
! }
! elseif ($filter == 'private')
! {
! $qfilter =
'tid=n,owner='.$GLOBALS['phpgw_info']['user']['account_id'].',cat_id='.$cat_id;
! }
! else
! {
! $qfilter = 'tid=n,owner='.$filter.'cat_id='.$cat_id;
! }
! }
!
! if
(($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) &&
! ($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] >
0))
! {
! $offset =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
! }
! else
! {
! $offset = 15;
! }
!
! $account_id = $GLOBALS['phpgw_info']['user']['account_id'];
!
! $cols = array (
! 'n_given' => 'n_given',
! 'n_family' => 'n_family',
! 'email' => 'email',
! 'email_home' => 'email_home'
! );
!
! $entries =
$d->read($start,$offset,$cols,$query,$qfilter,$sort,$order,$account_id);
!
! //------------------------------------------- nextmatch
--------------------------------------------
! $left =
$GLOBALS['phpgw']->nextmatchs->left('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',$start,$d->total_records,"&order=$order&filter=$filter&sort=$sort&query=$query");
! $right =
$GLOBALS['phpgw']->nextmatchs->right('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',$start,$d->total_records,"&order=$order&filter=$filter&sort=$sort&query=$query");
! $GLOBALS['phpgw']->template->set_var('left',$left);
! $GLOBALS['phpgw']->template->set_var('right',$right);
!
! if ($d->total_records >
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'])
! {
!
$GLOBALS['phpgw']->template->set_var('lang_showing',lang('showing x - x of
x',($start + 1),($start +
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']),$d->total_records));
! }
! else
! {
!
$GLOBALS['phpgw']->template->set_var('lang_showing',lang('showing
x',$d->total_records));
! }
! // --------------------------------------- end nextmatch
------------------------------------------
!
! // ------------------- list header variable template-declaration
-----------------------
!
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
!
$GLOBALS['phpgw']->template->set_var('sort_firstname',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'n_given',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Firstname')));
!
$GLOBALS['phpgw']->template->set_var('sort_lastname',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'n_family',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Lastname')));
! $GLOBALS['phpgw']->template->set_var('lang_email',lang('Select work
email address'));
! $GLOBALS['phpgw']->template->set_var('lang_hemail',lang('Select home
email address'));
! //
$GLOBALS['phpgw']->template->set_var('cats_action',$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
!
$GLOBALS['phpgw']->template->set_var('cats_action',$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',"sort=$sort&order=$order&filter=$filter&start=$start&query=$query"));
!
$GLOBALS['phpgw']->template->set_var('cats_list',$c->formated_list('select','all',$cat_id,'True'));
! $GLOBALS['phpgw']->template->set_var('lang_select',lang('Select'));
!
! // --------------------------- end header declaration
----------------------------------
! for ($i=0;$i<count($entries);$i++)
! {
! $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
! $GLOBALS['phpgw']->template->set_var(tr_color,$tr_color);
! $firstname = $entries[$i]['n_given'];
! if (!$firstname)
! {
! $firstname = ' ';
! }
! $lastname = $entries[$i]['n_family'];
! if (!$lastname)
! {
! $lastname = ' ';
! }
!
! $personal_firstname = '';
! $personal_lastname = '';
! $personal_part = '';
! if ((isset($firstname)) &&
! ($firstname != '') &&
! ($firstname != ' '))
! {
! $personal_firstname = $firstname.' ';
! }
! if ((isset($lastname)) &&
! ($lastname != '') &&
! ($lastname != ' '))
! {
! $personal_lastname = $lastname;
! }
! $personal_part = $personal_firstname.$personal_lastname;
!
! if (($personal_part == '') ||
! ($include_personal == False))
! {
! $id = $entries[$i]['id'];
! $email = $entries[$i]['email'];
! $hemail = $entries[$i]['email_home'];
! }
! else
! {
! $id = $entries[$i]['id'];
! if ((isset($entries[$i]['email'])) &&
! (trim($entries[$i]['email']) != ''))
! {
! $email = '"'.$personal_part.'"
<'.$entries[$i]['email'].'>';
! }
! else
! {
! $email = $entries[$i]['email'];
! }
! if ((isset($entries[$i]['email_home'])) &&
! (trim($entries[$i]['email_home']) != ''))
! {
! $hemail = '"'.$personal_part.'"
<'.$entries[$i]['email_home'].'>';
! }
! else
! {
! $hemail = $entries[$i]['email_home'];
! }
! }
!
! // --------------------- template declaration for list records
--------------------------
! $GLOBALS['phpgw']->template->set_var(array(
! 'firstname' => $firstname,
! 'lastname' => $lastname
! ));
!
! $GLOBALS['phpgw']->template->set_var('id',$id);
! $GLOBALS['phpgw']->template->set_var('email',$email);
! $GLOBALS['phpgw']->template->set_var('hemail',$hemail);
!
!
$GLOBALS['phpgw']->template->parse('list','addressbook_list',True);
! }
! // --------------------------- end record declaration
---------------------------
!
! $GLOBALS['phpgw']->template->set_var('lang_done',lang('Done'));
! $GLOBALS['phpgw']->template->parse('out','addressbook_list_t',True);
! $GLOBALS['phpgw']->template->p('out');
!
! $GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
! exit;
! ?>
--- 1,229 ----
! <?php
!
/**************************************************************************\
! * phpGroupWare - email/addressbook
*
! * http://www.phpgroupware.org
*
! * Written by Bettina Gille address@hidden *
! * -----------------------------------------------
*
! * This program is free software; you can redistribute it and/or modify
it *
! * under the terms of the GNU General Public License as published by
the *
! * Free Software Foundation; either version 2 of the License, or (at
your *
! * option) any later version.
*
!
\**************************************************************************/
!
! /* $Id$ */
!
! $GLOBALS['phpgw_info']['flags'] = array(
! 'noheader' => True,
! 'nonavbar' => True,
! 'currentapp' => 'email',
! 'enable_nextmatchs_class' => True
! );
!
! include('../header.inc.php');
!
! $GLOBALS['phpgw']->template->set_file(array(
! 'addressbook_list_t' => 'addressbook.tpl',
! 'addressbook_list' => 'addressbook.tpl'
! ));
!
$GLOBALS['phpgw']->template->set_block('addressbook_list_t','addressbook_list','list');
!
! $d = CreateObject('phpgwapi.contacts');
! $c = CreateObject('phpgwapi.categories');
! $c->app_name = 'addressbook';
!
! $include_personal = True;
!
! $charset = $GLOBALS['phpgw']->translation->translate('charset');
! $GLOBALS['phpgw']->template->set_var('charset',$charset);
!
$GLOBALS['phpgw']->template->set_var('title',$GLOBALS['phpgw_info']['site_title']);
!
$GLOBALS['phpgw']->template->set_var('bg_color',$GLOBALS['phpgw_info']['theme']['bg_color']);
!
$GLOBALS['phpgw']->template->set_var('lang_addressbook_action',lang('Address
book'));
!
$GLOBALS['phpgw']->template->set_var('font',$GLOBALS['phpgw_info']['theme']['font']);
!
! $GLOBALS['phpgw']->template->set_var('lang_search',lang('Search'));
!
$GLOBALS['phpgw']->template->set_var('search_action',$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php'));
! $GLOBALS['phpgw']->template->set_var('lang_select_cats',lang('Select
category'));
!
! if (! $start)
! {
! $start = 0;
! }
!
! if (!$filter)
! {
! $filter = 'none';
! }
!
! if (!$cat_id)
! {
! if ($filter == 'none')
! {
! $qfilter = 'tid=n';
! }
! elseif ($filter == 'private')
! {
! $qfilter =
'tid=n,owner='.$GLOBALS['phpgw_info']['user']['account_id'];
! }
! else
! {
! $qfilter = 'tid=n,owner='.$filter;
! }
! }
! else
! {
! if ($filter == 'none')
! {
! $qfilter = 'tid=n,cat_id='.$cat_id;
! }
! elseif ($filter == 'private')
! {
! $qfilter =
'tid=n,owner='.$GLOBALS['phpgw_info']['user']['account_id'].',cat_id='.$cat_id;
! }
! else
! {
! $qfilter = 'tid=n,owner='.$filter.'cat_id='.$cat_id;
! }
! }
!
! if
(($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) &&
! ($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] >
0))
! {
! $offset =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
! }
! else
! {
! $offset = 15;
! }
!
! $account_id = $GLOBALS['phpgw_info']['user']['account_id'];
!
! $cols = array (
! 'n_given' => 'n_given',
! 'n_family' => 'n_family',
! 'org_name' => 'org_name',
! 'email' => 'email',
! 'email_home' => 'email_home'
! );
!
! $entries =
$d->read($start,$offset,$cols,$query,$qfilter,$sort,$order,$account_id);
!
! //------------------------------------------- nextmatch
--------------------------------------------
! $left =
$GLOBALS['phpgw']->nextmatchs->left('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',$start,$d->total_records,"&order=$order&filter=$filter&sort=$sort&query=$query");
! $right =
$GLOBALS['phpgw']->nextmatchs->right('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',$start,$d->total_records,"&order=$order&filter=$filter&sort=$sort&query=$query");
! $GLOBALS['phpgw']->template->set_var('left',$left);
! $GLOBALS['phpgw']->template->set_var('right',$right);
!
! if ($d->total_records >
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'])
! {
!
$GLOBALS['phpgw']->template->set_var('lang_showing',lang('showing x - x of
x',($start + 1),($start +
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']),$d->total_records));
! }
! else
! {
!
$GLOBALS['phpgw']->template->set_var('lang_showing',lang('showing
x',$d->total_records));
! }
! // --------------------------------------- end nextmatch
------------------------------------------
!
! // ------------------- list header variable template-declaration
-----------------------
!
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
!
$GLOBALS['phpgw']->template->set_var('sort_firstname',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'n_given',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Firstname')));
!
$GLOBALS['phpgw']->template->set_var('sort_lastname',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'n_family',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Lastname')));
!
$GLOBALS['phpgw']->template->set_var('sort_company',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'org_name',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Company')));
! $GLOBALS['phpgw']->template->set_var('lang_email',lang('Select work
email address'));
! $GLOBALS['phpgw']->template->set_var('lang_hemail',lang('Select home
email address'));
!
$GLOBALS['phpgw']->template->set_var('cats_list',$c->formated_list('select','all',$cat_id,'True'));
! $GLOBALS['phpgw']->template->set_var('lang_select',lang('Select'));
!
!
//$GLOBALS['phpgw']->template->set_var('cats_action',$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
! // thanks to address@hidden for fixing drop down list filtering by
categories
!
$GLOBALS['phpgw']->template->set_var('cats_action',$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',"sort=$sort&order=$order&filter=$filter&start=$start&query=$query"));
!
! // --------------------------- end header declaration
----------------------------------
! for ($i=0;$i<count($entries);$i++)
! {
! $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
! $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
! $firstname = $entries[$i]['n_given'];
! if (!$firstname)
! {
! $firstname = ' ';
! }
! $lastname = $entries[$i]['n_family'];
! if (!$lastname)
! {
! $lastname = ' ';
! }
! // thanks to address@hidden for adding company
! $company = $entries[$i]['org_name'];
! if (!$company)
! {
! $company = ' ';
! }
!
! $personal_firstname = '';
! $personal_lastname = '';
! $personal_part = '';
! if ((isset($firstname)) &&
! ($firstname != '') &&
! ($firstname != ' '))
! {
! $personal_firstname = $firstname.' ';
! }
! if ((isset($lastname)) &&
! ($lastname != '') &&
! ($lastname != ' '))
! {
! $personal_lastname = $lastname;
! }
! $personal_part = $personal_firstname.$personal_lastname;
!
! if (($personal_part == '') ||
! ($include_personal == False))
! {
! $id = $entries[$i]['id'];
! $email = $entries[$i]['email'];
! $hemail = $entries[$i]['email_home'];
! }
! else
! {
! $id = $entries[$i]['id'];
! if ((isset($entries[$i]['email'])) &&
! (trim($entries[$i]['email']) != ''))
! {
! $email = '"'.$personal_part.'"
<'.$entries[$i]['email'].'>';
! }
! else
! {
! $email = $entries[$i]['email'];
! }
! if ((isset($entries[$i]['email_home'])) &&
! (trim($entries[$i]['email_home']) != ''))
! {
! $hemail = '"'.$personal_part.'"
<'.$entries[$i]['email_home'].'>';
! }
! else
! {
! $hemail = $entries[$i]['email_home'];
! }
! }
!
! // --------------------- template declaration for list records
--------------------------
! $GLOBALS['phpgw']->template->set_var(array(
! 'firstname' => $firstname,
! 'lastname' => $lastname,
! 'company' => $company
! ));
!
! $GLOBALS['phpgw']->template->set_var('id',$id);
! $GLOBALS['phpgw']->template->set_var('email',$email);
! $GLOBALS['phpgw']->template->set_var('hemail',$hemail);
!
!
$GLOBALS['phpgw']->template->parse('list','addressbook_list',True);
! }
! // --------------------------- end record declaration
---------------------------
!
! $GLOBALS['phpgw']->template->set_var('lang_done',lang('Done'));
! $GLOBALS['phpgw']->template->parse('out','addressbook_list_t',True);
! $GLOBALS['phpgw']->template->p('out');
!
! $GLOBALS['phpgw']->common->phpgw_exit();
! ?>
Index: attach_file.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/attach_file.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** attach_file.php 28 Sep 2002 20:01:43 -0000 1.26
--- attach_file.php 25 Oct 2002 12:45:52 -0000 1.27
***************
*** 1,280 ****
! <?php
! /**************************************************************************\
! * phpGroupWare - E-Mail *
! * http://www.phpgroupware.org *
! * This file written by Joseph Engo <address@hidden> *
! * -------------------------------------------- *
! * This program is free software; you can redistribute it and/or modify it *
! * under the terms of the GNU General Public License as published by the *
! * Free Software Foundation; either version 2 of the License, or (at your *
! * option) any later version. *
! \**************************************************************************/
!
! /* $Id$ */
!
! $phpgw_flags = Array(
! 'currentapp' => 'email',
! 'enable_network_class' => True,
! 'noheader' => True,
! 'nonavbar' => True
! );
!
! $GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
!
! include('../header.inc.php');
!
! $GLOBALS['phpgw']->template->set_file(
! Array(
! 'T_attach_file' => 'attach_file.tpl',
! 'T_attach_file_blocks' => 'attach_file_blocks.tpl'
! )
! );
!
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_alert_msg','V_alert_msg');
!
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_attached_list','V_attached_list');
!
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_attached_none','V_attached_none');
!
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_delete_btn','V_delete_btn');
!
! // initialize some variables
! $alert_msg = '';
! $totalfiles = 0;
!
! // ensure existance of PHPGROUPWARE temp dir
! // note: this is different from apache temp dir, and different from any
other temp file location set in php.ini
! if (!file_exists($GLOBALS['phpgw_info']['server']['temp_dir']))
! {
! mkdir($GLOBALS['phpgw_info']['server']['temp_dir'],0700);
! }
!
! // if we were NOT able to create this temp directory, then make an
ERROR report
! if (!file_exists($GLOBALS['phpgw_info']['server']['temp_dir']))
! {
! $alert_msg .= 'Error:'.'<br>'
! .'Server is unable to access phpgw tmp directory'.'<br>'
! .$GLOBALS['phpgw_info']['server']['temp_dir'].'<br>'
! .'Please check your configuration'.'<br>'
! .'<br>';
! }
!
! if (!file_exists($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP .
$GLOBALS['phpgw_info']['user']['sessionid']))
! {
! mkdir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP .
$GLOBALS['phpgw_info']['user']['sessionid'],0700);
! }
!
! //$uploaddir = $GLOBALS['phpgw_info']['server']['temp_dir'] . SEP .
$GLOBALS['phpgw_info']['user']['sessionid'] . SEP;
! $uploaddir = $GLOBALS['phpgw']->msg->att_files_dir;
!
! // if we were NOT able to create this temp directory, then make an
ERROR report
! if (!file_exists($uploaddir))
! {
! $alert_msg .= 'Error:'.'<br>'
! . 'Server is unable to access phpgw email tmp
directory'.'<br>'
! . $uploaddir.'<br>'
! . 'Please check your configuration'.'<br>'
! . '<br>';
! }
!
! /*
! //PHP VARIABLES NOTES:
! // $uploadedfile was the name of the file box in the submitted form,
and php3 gives it additional properties:
! // $uploadedfile_name $uploadedfile_size $uploadedfile_type
! // php4 also does this, but the preffered way is to use the new (for
php4) $HTTP_POST_FILES global array
! // $HTTP_POST_FILES['uploadedfile']['name'] .. .['type'] ...
['size'] ... ['tmp_name']
! // note that $uploadedfile_type and
$HTTP_POST_FILES['uploadedfile']['type'] *may* not be correct filled
! //
! // FILE SIZE NOTES:
! // file size limits may depend on: (a) <input type="hidden"
name="MAX_FILE_SIZE" value="whatever">
! // (b) these values in php.ini: "post_max_size" "upload_max_filesize"
"memory_limit" "max_execution_time"
! // also see http://www.php.net/bugs.php?id=8377 for the status of an
upload bug not fixed as of 4.0.4
! // also note that uploading file to *memory* is wasteful
! */
!
! // clean / prepare PHP provided file info
! if(floor(phpversion()) >= 4)
! {
! $file_tmp_name =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($HTTP_POST_FILES['uploadedfile']['tmp_name']));
! $file_name =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($HTTP_POST_FILES['uploadedfile']['name']));
! $file_size =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($HTTP_POST_FILES['uploadedfile']['size']));
! $file_type =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($HTTP_POST_FILES['uploadedfile']['type']));
! }
! else
! {
! $file_tmp_name =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($uploadedfile));
! $file_name =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($uploadedfile_name));
! $file_size =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($uploadedfile_size));
! $file_type =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($uploadedfile_type));
! }
!
! // sometimes PHP is very clue-less about MIME types, and gives NO
file_type
! // rfc default for unknown MIME type is:
! $mime_type_default = 'application/octet-stream';
! // so if PHP did not pass any file_type info, then substitute the rfc
default value
! if (trim($file_type) == '')
! {
! $file_type = $mime_type_default;
! }
!
! // Netscape 6 passes file_name with a full path, we need to extract
just the filename
! function wbasename($input)
! {
! if (strstr($input, SEP) == False)
! {
! // no filesystem seperator is present
! return $input;
! }
!
! for($i=0; $i < strlen($input); $i++ )
! {
! $pos = strpos($input, SEP, $i);
! if ($pos != false)
! {
! $lastpos = $pos;
! }
! }
! return substr($input, $lastpos + 1, strlen($input));
! }
! //$debuginfo = 'file_name (pre-wbasename): ' .$file_name .'<br>';
! // Netscape 6 passes file_name with a full path, we need to extract
just the filename
! $file_name = wbasename($file_name);
!
! // Some of the methods were borrowed from
! // Squirrelmail <Luke Ehresman> http://www.squirrelmail.org
! if ($action == lang('Delete'))
! {
! for ($i=0; $i<count($delete); $i++)
! {
! unlink($uploaddir.SEP.$delete[$i]);
! unlink($uploaddir.SEP.$delete[$i] . '.info');
! }
! }
!
! //if ($action == 'Attach File')
! if (($action == lang('Attach File')) &&
! ($file_tmp_name != '') &&
! ($file_tmp_name != 'none'))
! {
! srand((double)microtime()*1000000);
! $random_number = rand(100000000,999999999);
! $newfilename = md5($file_tmp_name.', '.$file_name.',
'.$GLOBALS['phpgw_info']['user']['sessionid'].time().getenv('REMOTE_ADDR').$random_number);
!
! // Check for uploaded file of 0-length, or no file (patch from
Zone added by Milosch)
! //if ($file_tmp_name == "none" && $file_size == 0) This could
work also
! if ($file_size == 0)
! {
! touch ($uploaddir.SEP.$newfilename);
! }
! else
! {
! copy($file_tmp_name, $uploaddir.SEP.$newfilename);
! }
!
! $ftp = fopen($uploaddir.SEP.$newfilename . '.info','wb');
! fputs($ftp,$file_type."\n".$file_name."\n");
! fclose($ftp);
! }
! elseif (($action == lang('Attach File')) &&
! (($file_tmp_name == '') || ($file_tmp_name == 'none')))
! {
! $langed_attach_file = lang("Attach File");
! $alert_msg = lang('Input Error:').'<br>'
! . lang('Please submit a filename to attach').'<br>'
! . lang('You must click').' "'.lang('Attach File').'"
'.lang('for the file to actually upload').'<br>'
! . '<br>';
! }
!
! $dh = opendir($uploaddir);
! while ($file = readdir($dh))
! {
! if (($file != '.') &&
! ($file != '..') &&
! (ereg("\.info",$file)))
! {
! $file_info = file($uploaddir.SEP.$file);
! // for every file, fill the file list template with it
!
$GLOBALS['phpgw']->template->set_var('ckbox_delete_name','delete[]');
!
$GLOBALS['phpgw']->template->set_var('ckbox_delete_value',substr($file,0,-5));
!
$GLOBALS['phpgw']->template->set_var('ckbox_delete_filename',$file_info[1]);
!
$GLOBALS['phpgw']->template->parse('V_attached_list','B_attached_list',True);
! $totalfiles++;
! }
! }
! closedir($dh);
! if ($totalfiles == 0)
! {
! // there is no list of files, clear that block
! $GLOBALS['phpgw']->template->set_var('V_attached_list','');
! // there is no delete button because there are no files to
delete, clear that block
! $GLOBALS['phpgw']->template->set_var('V_delete_btn','');
! // show the none block
! $GLOBALS['phpgw']->template->set_var('text_none',lang('None'));
!
$GLOBALS['phpgw']->template->parse('V_attached_none','B_attached_none');
! }
! else
! {
! // we have files, clear the "no files" block
! $GLOBALS['phpgw']->template->set_var('V_attached_none','');
! // fill the delete sublit form
!
$GLOBALS['phpgw']->template->set_var('btn_delete_name','action');
!
$GLOBALS['phpgw']->template->set_var('btn_delete_value',lang('Delete'));
!
$GLOBALS['phpgw']->template->parse('V_delete_btn','B_delete_btn');
! }
!
! $body_tags = 'bgcolor="'.$GLOBALS['phpgw_info']['theme']['bg_color'].'"
alink="'.$GLOBALS['phpgw_info']['theme']['alink'].'"
link="'.$GLOBALS['phpgw_info']['theme']['link'].'"
vlink="'.$GLOBALS['phpgw_info']['theme']['vlink'].'"';
! if (!$GLOBALS['phpgw_info']['server']['htmlcompliant'])
! {
! $body_tags .= ' topmargin="0" marginheight="0" marginwidth="0"
leftmargin="0"';
! }
!
! /*
! // begin DEBUG INFO
! $debuginfo .= '--uploadedfile info: <br>'
! .'$GLOBALS[phpgw_info][server][temp_dir]:
'.$GLOBALS['phpgw_info']['server']['temp_dir'].'<br>'
! .'$GLOBALS[phpgw_info][user][sessionid]:
'.$GLOBALS['phpgw_info']['user']['sessionid'].'<br>'
! .'uploaddir: '.$uploaddir.'<br>'
! .'file_tmp_name: ' .$file_tmp_name .'<br>'
! .'file_name: ' .$file_name .'<br>'
! .'file_size: ' .$file_size .'<br>'
! .'file_type: ' .$file_type .'<br>'
! .'<br>'
! .'totalfiles: ' .$totalfiles .'<br>'
! .'file_info_count: '.count($file_info) .'<br>'
! .'<br>';
! if (count($file_info) > 0)
! {
! $debuginfo .= '<br> file_info[0]='.$file_info[0] .'<br>
file_info[1]='.$file_info[1];
! }
! $debuginfo .= '<br>';
! echo $debuginfo;
! // end DEBUG INFO
! */
!
! $charset = lang('charset');
! $GLOBALS['phpgw']->template->set_var('charset',$charset);
!
$GLOBALS['phpgw']->template->set_var('page_title',$GLOBALS['phpgw_flags']['currentapp']
. ' - ' .lang('File attachment'));
!
$GLOBALS['phpgw']->template->set_var('font_family',$GLOBALS['phpgw_info']['theme']['font']);
! $GLOBALS['phpgw']->template->set_var('body_tags',$body_tags);
! if ($alert_msg != '')
! {
! $GLOBALS['phpgw']->template->set_var('alert_msg',$alert_msg);
! $GLOBALS['phpgw']->template->parse('V_alert_msg','B_alert_msg');
! }
! else
! {
! $GLOBALS['phpgw']->template->set_var('V_alert_msg','');
! }
! $GLOBALS['phpgw']->template->set_var('form_method','POST');
!
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/attach_file.php'));
! $GLOBALS['phpgw']->template->set_var('text_attachfile',lang('Attach
file'));
! $GLOBALS['phpgw']->template->set_var('text_currattached',lang('Current
attachments'));
! $GLOBALS['phpgw']->template->set_var('txtbox_upload_desc',lang('File'));
!
$GLOBALS['phpgw']->template->set_var('txtbox_upload_name','uploadedfile');
! $GLOBALS['phpgw']->template->set_var('btn_attach_name','action');
! $GLOBALS['phpgw']->template->set_var('btn_attach_value',lang('Attach
File'));
! $GLOBALS['phpgw']->template->set_var('btn_done_name','done');
! $GLOBALS['phpgw']->template->set_var('btn_done_value',lang('Done'));
! $GLOBALS['phpgw']->template->set_var('btn_done_js','window.close()');
!
! $GLOBALS['phpgw']->template->pparse('out','T_attach_file');
!
! $GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
! exit;
! ?>
--- 1,368 ----
! <?php
! /**************************************************************************\
! * phpGroupWare - E-Mail *
! * http://www.phpgroupware.org *
! * This file written by Joseph Engo <address@hidden> *
! * -------------------------------------------- *
! * This program is free software; you can redistribute it and/or modify it *
! * under the terms of the GNU General Public License as published by the *
! * Free Software Foundation; either version 2 of the License, or (at your *
! * option) any later version. *
! \**************************************************************************/
!
! /* $Id$ */
!
! /*!
! @function attach_file.php_the_file
! @abstract attach_file.php is DEPRECIATED, use menuaction
"email.boattach_file.attach" instead.
! */
!
! $phpgw_flags = Array(
! 'currentapp' => 'email',
! 'enable_network_class' => True,
! 'noheader' => True,
! 'nonavbar' => True
! );
!
! $GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
!
! include('../header.inc.php');
!
! $fup_debug=0;
! //$fup_debug=2;
!
! // #### TESTING BO OBJECT, BYPASSES BYPASS THIS FILE
! echo 'this file "attach_file.php" is depreciated, use the BO class
instead<br>';
! $GLOBALS['phpgw']->common->phpgw_exit(False);
! return;
! // #### TESTING BO OBJECT, BYPASSES BYPASS THIS FILE
!
!
! // we need a msg object BUT NO LOGIN IS NEEDED
! $my_msg_bootstrap = '';
! $my_msg_bootstrap = CreateObject("email.msg_bootstrap");
! $my_msg_bootstrap->set_do_login(False);
! $my_msg_bootstrap->ensure_mail_msg_exists('email: attach_file.php', 0);
!
! $GLOBALS['phpgw']->template->set_file(
! Array(
! 'T_attach_file' => 'attach_file.tpl',
! 'T_attach_file_blocks' => 'attach_file_blocks.tpl'
! )
! );
!
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_alert_msg','V_alert_msg');
!
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_attached_list','V_attached_list');
!
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_attached_none','V_attached_none');
!
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_delete_btn','V_delete_btn');
!
! // initialize some variables
! $alert_msg = '';
! $totalfiles = 0;
!
! // ensure existance of PHPGROUPWARE temp dir
! // note: this is different from apache temp dir, and different from any
other temp file location set in php.ini
! if (!file_exists($GLOBALS['phpgw_info']['server']['temp_dir']))
! {
! mkdir($GLOBALS['phpgw_info']['server']['temp_dir'],0700);
! }
!
! // if we were NOT able to create this temp directory, then make an
ERROR report
! if (!file_exists($GLOBALS['phpgw_info']['server']['temp_dir']))
! {
! $alert_msg .= 'Error:'.'<br>'
! . 'Server is unable to access phpgw tmp
directory'.'<br>'
! . $GLOBALS['phpgw_info']['server']['temp_dir'].'<br>'
! . 'Please check your configuration'.'<br>'
! . '<br>';
! }
!
! if (!file_exists($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP .
$GLOBALS['phpgw_info']['user']['sessionid']))
! {
! mkdir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP .
$GLOBALS['phpgw_info']['user']['sessionid'],0700);
! }
!
! //$uploaddir = $GLOBALS['phpgw_info']['server']['temp_dir'] . SEP .
$GLOBALS['phpgw_info']['user']['sessionid'] . SEP;
! $uploaddir = $GLOBALS['phpgw']->msg->att_files_dir;
!
! // if we were NOT able to create this temp directory, then make an
ERROR report
! if (!file_exists($uploaddir))
! {
! $alert_msg .= 'Error:'.'<br>'
! . 'Server is unable to access phpgw email tmp
directory'.'<br>'
! . $uploaddir.'<br>'
! . 'Please check your configuration'.'<br>'
! . '<br>';
! }
!
! /*
! //PHP VARIABLES NOTES:
! // $uploadedfile was the name of the file box in the submitted form,
and php3 gives it additional properties:
! // $uploadedfile_name $uploadedfile_size $uploadedfile_type
! // php4 also does this, but the preffered way is to use the new (for
php4) $HTTP_POST_FILES global array
! // $HTTP_POST_FILES['uploadedfile']['name'] .. .['type'] ...
['size'] ... ['tmp_name']
! // note that $uploadedfile_type and
$HTTP_POST_FILES['uploadedfile']['type'] *may* not be correct filled
! // UPDATE: php > 4.2 prefers "superglobal" $_FILES, actually 4.1+ can
use that $_FILES
! //
! // FILE SIZE NOTES:
! // file size limits may depend on: (a) <input type="hidden"
name="MAX_FILE_SIZE" value="whatever">
! // (b) these values in php.ini: "post_max_size" "upload_max_filesize"
"memory_limit" "max_execution_time"
! // also see http://www.php.net/bugs.php?id=8377 for the status of an
upload bug not fixed as of 4.0.4
! // also note that uploading file to *memory* is wasteful
! */
!
! // probably UNNECESSARY debug code, delete it after this is all stable
! if (($GLOBALS['phpgw']->msg->minimum_version("4.1.0"))
! && (!isset($GLOBALS['phpgw']->msg->ref_FILES)))
! {
! echo 'file attach_file ('.__LINE__.') ERROR:
$GLOBALS[phpgw]->msg->ref_FILES should be set here, but it IS NOT set<br>';
! }
!
! // the following code only applies to php < 4.1.0 where that
superglobal was not available
! // thanks Dave Hall for this code suggestion
! if (
! (! (isset($HTTP_POST_FILES) || isset($GLOBALS['HTTP_POST_FILES'])) )
! && ($GLOBALS['phpgw']->msg->minimum_version("4.1.0") == False)
! )
! {
! $_FILES = $GLOBALS['HTTP_POST_FILES'];
! global $_FILES;
! // REDEFINE THE REFERENCE TO THE FILES DATA
! $GLOBALS['phpgw']->msg->ref_FILES = &$_FILES;
! }
! // yes I am aware that the above code and the below code kind of deal
with the same thing
! // if the above code still does not give a good reference to FILES
data, below there is "oldschool" fallback code
! // also I do not want to force global something every script run when
it is only needed here
!
!
! // clean / prepare PHP provided file info
! // note that "uploadedfile" is the POST submit form identification for
the file
! if ( ($GLOBALS['phpgw']->msg->minimum_version("4.1.0"))
! // or we may have otherwise obtained a good reference above
! || (isset($GLOBALS['phpgw']->msg->ref_FILES['uploadedfile'])) )
! {
! $file_tmp_name =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($GLOBALS['phpgw']->msg->ref_FILES['uploadedfile']['tmp_name']));
! $file_name =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($GLOBALS['phpgw']->msg->ref_FILES['uploadedfile']['name']));
! $file_size =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($GLOBALS['phpgw']->msg->ref_FILES['uploadedfile']['size']));
! $file_type =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($GLOBALS['phpgw']->msg->ref_FILES['uploadedfile']['type']));
! if ($fup_debug > 1) { echo 'ref_FILE dump:
'.htmlspecialchars(serialize($GLOBALS['phpgw']->msg->ref_FILES)).'<br>'; }
! }
! else
! {
! // php less then 4.1 uses these pre-superglobals enviornment
vars
! $file_tmp_name =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($uploadedfile));
! $file_name =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($uploadedfile_name));
! $file_size =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($uploadedfile_size));
! $file_type =
$GLOBALS['phpgw']->msg->stripslashes_gpc(trim($uploadedfile_type));
! }
!
! // sometimes PHP is very clue-less about MIME types, and gives NO
file_type
! // rfc default for unknown MIME type is:
! $mime_type_default = 'application/octet-stream';
! // so if PHP did not pass any file_type info, then substitute the rfc
default value
! if (trim($file_type) == '')
! {
! $file_type = $mime_type_default;
! }
!
! // Netscape 6 sometimes passes file_name with a full path, we need to
extract just the filename
! function wbasename($input)
! {
! if (strstr($input, SEP) == False)
! {
! // no filesystem seperator is present
! return $input;
! }
!
! for($i=0; $i < strlen($input); $i++ )
! {
! $pos = strpos($input, SEP, $i);
! if ($pos != false)
! {
! $lastpos = $pos;
! }
! }
! return substr($input, $lastpos + 1, strlen($input));
! }
! // now use that function to get a clean file name
! if ($fup_debug > 1) { echo 'file_name (pre-wbasename): ' .$file_name
.'<br>'; }
! // Netscape 6 passes file_name with a full path, we need to extract
just the filename
! $file_name = wbasename($file_name);
!
! // Some server side attachment upload handling code is borrowed from
! // Squirrelmail <Luke Ehresman> http://www.squirrelmail.org
! // particularly the moving, temporary naming, and the ".info" file code.
! if ($action == lang('Delete'))
! {
! for ($i=0; $i<count($delete); $i++)
! {
! unlink($uploaddir.SEP.$delete[$i]);
! unlink($uploaddir.SEP.$delete[$i] . '.info');
! }
! }
!
! //if ($action == 'Attach File')
! if (($action == lang('Attach File'))
! && ($file_tmp_name != '')
! && ($file_tmp_name != 'none'))
! {
! srand((double)microtime()*1000000);
! $random_number = rand(100000000,999999999);
! $newfilename = md5($file_tmp_name.', '.$file_name.',
'.$GLOBALS['phpgw_info']['user']['sessionid'].time().getenv('REMOTE_ADDR').$random_number);
!
! // Check for uploaded file of 0-length, or no file (patch from
Zone added by Milosch)
! //if ($file_tmp_name == "none" && $file_size == 0) This could
work also
! if ($file_size == 0)
! {
! touch ($uploaddir.SEP.$newfilename);
! }
! else
! {
! copy($file_tmp_name, $uploaddir.SEP.$newfilename);
! }
!
! $ftp = fopen($uploaddir.SEP.$newfilename . '.info','wb');
! fputs($ftp,$file_type."\n".$file_name."\n");
! fclose($ftp);
! }
! elseif (($action == lang('Attach File')) &&
! (($file_tmp_name == '') || ($file_tmp_name == 'none')))
! {
! $langed_attach_file = lang("Attach File");
! $alert_msg = lang('Input Error:').'<br>'
! . lang('Please submit a filename to attach').'<br>'
! . lang('You must click').' "'.lang('Attach File').'"
'.lang('for the file to actually upload').'<br>'
! . '<br>';
! }
!
! $dh = opendir($uploaddir);
! //while ($file = readdir($dh)) //
http://www.php.net/manual/en/function.readdir.php says this is wrong ...
! while (false !== ($file = readdir($dh))) // is correct according to the
manual but only works with 4.0.0RC2+
! {
! if (($file != '.')
! && ($file != '..')
! && (ereg("\.info",$file)))
! {
! $file_info = file($uploaddir.SEP.$file);
!
! //get filesize in kb, but do not tell user a file is
0kb, because it is probably closer to 1kb
! $real_file = str_replace('.info','',$file);
! $real_file_size = ((int)
(@filesize($uploaddir.SEP.$real_file)/1024));
! if ($real_file_size < 1)
! {
! $real_file_size = 1;
! }
!
! if ($fup_debug > 2) { echo 'FILE contents DUMP: <pre>';
print_r(file($uploaddir.SEP.$real_file)); echo '</pre>'; }
! // for every file, fill the file list template with it
!
$GLOBALS['phpgw']->template->set_var('ckbox_delete_name','delete[]');
!
$GLOBALS['phpgw']->template->set_var('ckbox_delete_value',substr($file,0,-5));
!
$GLOBALS['phpgw']->template->set_var('hidden_delete_name',substr($file,0,-5));
!
$GLOBALS['phpgw']->template->set_var('hidden_delete_filename',
! $file_info[1]);
!
$GLOBALS['phpgw']->template->set_var('ckbox_delete_filename',
! //$file_info[1].' ('.((int)
(@filesize($uploaddir.SEP.$real_file)/1024)).'k)'); //also shows file size in kb
! $file_info[1].'
('.$real_file_size.'k)'); //also shows file size in kb
!
$GLOBALS['phpgw']->template->parse('V_attached_list','B_attached_list',True);
! $totalfiles++;
! }
! }
! closedir($dh);
! if ($totalfiles == 0)
! {
! // there is no list of files, clear that block
! $GLOBALS['phpgw']->template->set_var('V_attached_list','');
! // there is no delete button because there are no files to
delete, clear that block
! $GLOBALS['phpgw']->template->set_var('V_delete_btn','');
! // show the none block
! $GLOBALS['phpgw']->template->set_var('text_none',lang('None'));
!
$GLOBALS['phpgw']->template->parse('V_attached_none','B_attached_none');
! }
! else
! {
! // we have files, clear the "no files" block
! $GLOBALS['phpgw']->template->set_var('V_attached_none','');
! // fill the delete sublit form
!
$GLOBALS['phpgw']->template->set_var('btn_delete_name','action');
!
$GLOBALS['phpgw']->template->set_var('btn_delete_value',lang('Delete'));
!
$GLOBALS['phpgw']->template->parse('V_delete_btn','B_delete_btn');
! }
!
! $body_tags = 'bgcolor="'.$GLOBALS['phpgw_info']['theme']['bg_color'].'"
alink="'.$GLOBALS['phpgw_info']['theme']['alink'].'"
link="'.$GLOBALS['phpgw_info']['theme']['link'].'"
vlink="'.$GLOBALS['phpgw_info']['theme']['vlink'].'"';
! if (!$GLOBALS['phpgw_info']['server']['htmlcompliant'])
! {
! $body_tags .= ' topmargin="0" marginheight="0" marginwidth="0"
leftmargin="0"';
! }
!
! // begin DEBUG INFO
! $debuginfo .= '--uploadedfile info: <br>'
! . '$GLOBALS[phpgw_info][server][temp_dir]:
'.$GLOBALS['phpgw_info']['server']['temp_dir'].'<br>'
! . '$GLOBALS[phpgw_info][user][sessionid]:
'.$GLOBALS['phpgw_info']['user']['sessionid'].'<br>'
! . 'uploaddir: '.$uploaddir.'<br>'
! . 'file_tmp_name: ' .$file_tmp_name .'<br>'
! . 'file_name: ' .$file_name .'<br>'
! . 'file_size: ' .$file_size .'<br>'
! . 'file_type: ' .$file_type .'<br>'
! . '<br>'
! . 'totalfiles: ' .$totalfiles .'<br>'
! . 'file_info_count: '.count($file_info) .'<br>'
! . '<br>';
! if (count($file_info) > 0)
! {
! $debuginfo .= '<br> file_info[0]='.$file_info[0] .'<br>
file_info[1]='.$file_info[1];
! }
! $debuginfo .= '<br>';
! //print_debug('$debuginfo', $debuginfo);
! if ($fup_debug > 1) { echo '$debuginfo: '.$debuginfo.'<br>'; }
! // end DEBUG INFO
!
! $charset = lang('charset');
! $GLOBALS['phpgw']->template->set_var('charset',$charset);
!
$GLOBALS['phpgw']->template->set_var('page_title',$GLOBALS['phpgw_flags']['currentapp']
. ' - ' .lang('File attachment'));
!
$GLOBALS['phpgw']->template->set_var('font_family',$GLOBALS['phpgw_info']['theme']['font']);
! $GLOBALS['phpgw']->template->set_var('body_tags',$body_tags);
! if ($alert_msg != '')
! {
! $GLOBALS['phpgw']->template->set_var('alert_msg',$alert_msg);
! $GLOBALS['phpgw']->template->parse('V_alert_msg','B_alert_msg');
! }
! else
! {
! $GLOBALS['phpgw']->template->set_var('V_alert_msg','');
! }
! $GLOBALS['phpgw']->template->set_var('form_method','POST');
!
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/attach_file.php'));
! $GLOBALS['phpgw']->template->set_var('text_attachfile',lang('Attach
file'));
! $GLOBALS['phpgw']->template->set_var('text_currattached',lang('Current
attachments (%1)',$totalfiles));
! $GLOBALS['phpgw']->template->set_var('txtbox_upload_desc',lang('File'));
!
$GLOBALS['phpgw']->template->set_var('txtbox_upload_name','uploadedfile');
! $GLOBALS['phpgw']->template->set_var('btn_attach_name','action');
! $GLOBALS['phpgw']->template->set_var('btn_attach_value',lang('Attach
File'));
! $GLOBALS['phpgw']->template->set_var('btn_done_name','done');
! $GLOBALS['phpgw']->template->set_var('btn_done_value',lang('Done'));
! $GLOBALS['phpgw']->template->set_var('btn_done_js','copyback()');
! $GLOBALS['phpgw']->template->set_var('form1_name','doit');
!
! $GLOBALS['phpgw']->template->pfp('out','T_attach_file');
!
! //$GLOBALS['phpgw']->common->phpgw_exit();
! if (is_object($GLOBALS['phpgw']->msg))
! {
! $terminate = True;
! }
! else
! {
! $terminate = False;
! }
!
! if ($terminate == True)
! {
! // close down ALL mailserver streams
! $GLOBALS['phpgw']->msg->end_request();
! // destroy the object
! $GLOBALS['phpgw']->msg = '';
! unset($GLOBALS['phpgw']->msg);
! }
!
! // shut down this transaction
! $GLOBALS['phpgw']->common->phpgw_exit(False);
! ?>
Index: index.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/index.php,v
retrieving revision 1.88
retrieving revision 1.89
diff -C2 -r1.88 -r1.89
*** index.php 24 May 2002 19:15:24 -0000 1.88
--- index.php 25 Oct 2002 12:45:52 -0000 1.89
***************
*** 1,70 ****
! <?php
!
/**************************************************************************\
! * phpGroupWare - E-Mail
*
! * http://www.phpgroupware.org
*
! * Based on Aeromail by Mark C3ushman <address@hidden>
*
! * http://the.cushman.net/
*
! * Currently maintained by Angles <address@hidden> *
! * --------------------------------------------
*
! * This program is free software; you can redistribute it and/or modify
it *
! * under the terms of the GNU General Public License as published by
the *
! * Free Software Foundation; either version 2 of the License, or (at
your *
! * option) any later version.
*
!
\**************************************************************************/
!
! /* $Id$ */
!
! Header('Cache-Control: no-cache');
! Header('Pragma: no-cache');
! Header('Expires: Sat, Jan 01 2000 01:01:01 GMT');
!
! $GLOBALS['phpgw_info']['flags'] = array(
! 'currentapp' => 'email',
! 'noheader' => True,
! 'nofooter' => True,
! 'nonavbar' => True,
! 'noappheader' => True,
! 'noappfooter' => True
! );
! include('../header.inc.php');
! // time limit should be controlled elsewhere
! //@set_time_limit(0);
!
! // this index page is acting like a calling app which wants the HTML
produced by mail.uiindex.index
! // but DOES NOT want mail.uiindex.index to actually echo or print out
any HTML
! // we, the calling app, will handle the outputting of the HTML
! //$is_modular = True;
! $is_modular = False;
!
! header('Location: ' . $GLOBALS['phpgw']->link(
! '/index.php',
! 'menuaction=email.uiindex.index'
! )
! );
! return;
! /*
! if ($is_modular == True)
! {
! // pretend we are a calling app outputting some HTML, including
the header and navbar
! $GLOBALS['phpgw']->common->phpgw_header();
! // retrieve the html data from class uiindex
! $obj = CreateObject('email.uiindex');
! $obj->set_is_modular(True);
! $retured_html = $obj->index();
! // time for us to output the returned html data
! echo $retured_html;
! // now as the calling app, it's time to output the bottom of
the page
! $GLOBALS['phpgw']->common->phpgw_footer();
! }
! else
! {
! // this NON-modular usage will have class uiindex itself output
the header, navbar, class HTML data, and footer
! $obj = CreateObject('email.uiindex');
! $obj->index();
! // STRANGEly enough, menuaction=email.uiindex.index as
non-module STILL requires an
! // outside-the-class entity to call common->phpgw_footer(),
eventhough the class itself will
! // output the header and navbar, but it may not output
common->phpgw_footer() else page gets 2 footers
! $GLOBALS['phpgw']->common->phpgw_footer();
! }
! */
! ?>
--- 1,101 ----
! <?php
!
/**************************************************************************\
! * phpGroupWare - E-Mail
*
! * http://www.phpgroupware.org
*
! * Based on Aeromail by Mark C3ushman <address@hidden>
*
! * http://the.cushman.net/
*
! * Currently maintained by Angles <address@hidden> *
! *
------------------------------------------------------------------------ *
! * This program is free software; you can redistribute it and/or modify
it *
! * under the terms of the GNU General Public License as published by
the *
! * Free Software Foundation; either version 2 of the License, or (at
your *
! * option) any later version.
*
!
\**************************************************************************/
!
! /* $Id$ */
!
! Header('Cache-Control: no-cache');
! Header('Pragma: no-cache');
! Header('Expires: Sat, Jan 01 2000 01:01:01 GMT');
!
! $GLOBALS['phpgw_info']['flags'] = array(
! 'currentapp' => 'email',
! 'noheader' => True,
! 'nofooter' => True,
! 'nonavbar' => True,
! 'noappheader' => True,
! 'noappfooter' => True
! );
! include('../header.inc.php');
!
! /*
! time limit should be controlled elsewhere
! @set_time_limit(0);
!
! this index page is acting like a calling app which wants the HTML
produced by mail.uiindex.index
! but DOES NOT want mail.uiindex.index to actually echo or print out any
HTML
! we, the calling app, will handle the outputting of the HTML
! $is_modular = True;
! */
!
! $simple_redirect = True;
! //$simple_redirect = False;
!
! if ($simple_redirect == True)
! {
! //header('Location:
'.$GLOBALS['phpgw']->link('/index.php','menuaction=email.uiindex.index'));
!
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=email.uiindex.index'));
! if (is_object($GLOBALS['phpgw']->msg))
! {
! // close down ALL mailserver streams
! $GLOBALS['phpgw']->msg->end_request();
! // destroy the object
! $GLOBALS['phpgw']->msg = '';
! unset($GLOBALS['phpgw']->msg);
! }
! // shut down this transaction
! $GLOBALS['phpgw']->common->phpgw_exit(False);
! }
! else
! {
! /*
! // OBSOLETED CODE
! // pretend we are a calling app outputting some HTML, including
the header and navbar
! $GLOBALS['phpgw']->common->phpgw_header();
! echo parse_navbar();
! // retrieve the html data from class uiindex
! $obj = CreateObject('email.uiindex');
! $obj->set_is_modular(True);
! $retured_html = $obj->index();
! // time for us to output the returned html data
! echo $retured_html;
! // now as the calling app, it's time to output the bottom of
the page
! $GLOBALS['phpgw']->common->phpgw_footer();
! */
!
! /*
! // NOTE: this does NOT WORK
! // make a uiinex object and make it do its job
! // it will output the header, navbar, class HTML data, and
footer
! class uiindex_holder
! {
! var $uiindex_obj = '';
! }
!
! $my_msg_bootstrap = '';
! $my_msg_bootstrap = CreateObject('email.msg_bootstrap');
! $my_msg_bootstrap->ensure_mail_msg_exists('index.php', 3);
!
! echo 'calling CreateObject email.uiindex <br>';
! $GLOBALS['phphw_uiindex'] = new uiindex_holder;
! $GLOBALS['phphw_uiindex']->uiindex_obj =
CreateObject('email.uiindex');
! echo 'done calling CreateObject email.uiindex <br>';
! $GLOBALS['phphw_uiindex']->uiindex_obj->index();
! // STRANGEly enough, menuaction=email.uiindex.index as
non-module STILL requires an
! // outside-the-class entity to call common->phpgw_footer(),
eventhough the class itself will
! // output the header and navbar, but it may not output
common->phpgw_footer() else page gets 2 footers
! //$GLOBALS['phpgw']->common->phpgw_footer();
! */
! }
!
! ?>
Index: view_image.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/view_image.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** view_image.php 26 Mar 2002 02:34:38 -0000 1.14
--- view_image.php 25 Oct 2002 12:45:52 -0000 1.15
***************
*** 1,49 ****
! <?php
! /**************************************************************************\
! * phpGroupWare - E-Mail *
! * http://www.phpgroupware.org *
! * Based on Aeromail by Mark Cushman <address@hidden> *
! * http://the.cushman.net/ *
! * -------------------------------------------- *
! * This program is free software; you can redistribute it and/or modify it *
! * under the terms of the GNU General Public License as published by the *
! * Free Software Foundation; either version 2 of the License, or (at your *
! * option) any later version. *
! \**************************************************************************/
!
! /* $Id$ */
!
! $GLOBALS['phpgw_info']['flags'] = array(
! 'currentapp' => 'email',
! 'enable_network_class' => True,
! 'noheader' => True,
! 'nonavbar' => True
! );
! include('../header.inc.php');
!
! // if (isset($GLOBALS['phpgw_info']['flags']['newsmode']) &&
$GLOBALS['phpgw_info']['flags']['newsmode'])
! // $GLOBALS['phpgw']->common->read_preferences('nntp');
! // @set_time_limit(0);
!
! // // echo 'Mailbox = '.$mailbox.'<br>'."\n";
! // echo 'Mailbox =
'.$GLOBALS['phpgw']->msg->mailsvr_stream.'<br>'."\n";
! // echo 'Msgnum = '.$m.'<br>'."\n";
! // echo 'Part Number = '.$p.'<br>'."\n";
! // echo 'Subtype = '.$s.'<br>'."\n";
!
! //$data =
$GLOBALS['phpgw']->dcom->fetchbody($GLOBALS['phpgw']->msg->mailsvr_stream, $m,
$p);
! $data = $GLOBALS['phpgw']->msg->phpgw_fetchbody($p);
! //$picture = $GLOBALS['phpgw']->dcom->base64($data);
! $picture = $GLOBALS['phpgw']->msg->de_base64($data);
!
! // echo strlen($picture)."<br>\n";
! // echo $data;
!
! Header('Content-length: '.strlen($picture));
! Header('Content-type: image/'.$s);
! Header('Content-disposition: attachment; filename="'.urldecode($n).'"');
! echo $picture;
! flush();
!
! $GLOBALS['phpgw']->msg->end_request();
! ?>
--- 1,70 ----
! <?php
! /**************************************************************************\
! * phpGroupWare - E-Mail *
! * http://www.phpgroupware.org *
! * Based on Aeromail by Mark Cushman <address@hidden> *
! * http://the.cushman.net/ *
! * -------------------------------------------- *
! * This program is free software; you can redistribute it and/or modify it *
! * under the terms of the GNU General Public License as published by the *
! * Free Software Foundation; either version 2 of the License, or (at your *
! * option) any later version. *
! \**************************************************************************/
!
! /* $Id$ */
!
! $GLOBALS['phpgw_info']['flags'] = array(
! 'currentapp' => 'email',
! 'enable_network_class' => True,
! 'noheader' => True,
! 'nonavbar' => True
! );
! include('../header.inc.php');
! /*
! if (isset($GLOBALS['phpgw_info']['flags']['newsmode']) &&
$GLOBALS['phpgw_info']['flags']['newsmode'])
! {
! $GLOBALS['phpgw']->common->read_preferences('nntp');
! }
! @set_time_limit(0);
!
! echo 'Mailbox = '.$mailbox.'<br>'."\n";
! echo 'Mailbox = '.$GLOBALS['phpgw']->msg->mailsvr_stream.'<br>'."\n";
! echo 'Msgnum = '.$m.'<br>'."\n";
! echo 'Part Number = '.$p.'<br>'."\n";
! echo 'Subtype = '.$s.'<br>'."\n";
! */
! //$data =
$GLOBALS['phpgw']->dcom->fetchbody($GLOBALS['phpgw']->msg->mailsvr_stream, $m,
$p);
! $data = $GLOBALS['phpgw']->msg->phpgw_fetchbody($p);
! //$picture = $GLOBALS['phpgw']->dcom->base64($data);
! $picture = $GLOBALS['phpgw']->msg->de_base64($data);
!
! // echo strlen($picture)."<br>\n";
! // echo $data;
!
! Header('Content-length: '.strlen($picture));
! Header('Content-type: image/'.$s);
! Header('Content-disposition: attachment; filename="'.urldecode($n).'"');
! echo $picture;
! flush();
!
! // IS THIS FILE EVER USED ANYMORE?
! if (is_object($GLOBALS['phpgw']->msg))
! {
! $terminate = True;
! }
! else
! {
! $terminate = False;
! }
!
! if ($terminate == True)
! {
! // close down ALL mailserver streams
! $GLOBALS['phpgw']->msg->end_request();
! // destroy the object
! $GLOBALS['phpgw']->msg = '';
! unset($GLOBALS['phpgw']->msg);
! }
! // shut down this transaction
! $GLOBALS['phpgw']->common->phpgw_exit(False);
! ?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: email addressbook.php,1.36,1.37 attach_file.php,1.26,1.27 index.php,1.88,1.89 view_image.php,1.14,1.15,
Dave Hall <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: email/templates/default OLD-preferences.tpl,1.1,1.2 addressbook.tpl,1.8,1.9 attach_file.tpl,1.1,1.2 attach_file_blocks.tpl,1.1,1.2 class_prefs_blocks.tpl,1.4,1.5 class_prefs_ex_accounts.tpl,1.2,1.3 class_prefs_ui.tpl,1.2,1.3 compose.tpl,1.3,1.4 config.tpl,1.6,1.7 filters.tpl,1.9,1.10 filters_blocks.tpl,1.5,1.6 filters_list.tpl,1.3,1.4 folder.tpl,1.7,1.8 index_blocks.tpl,1.4,1.5 index_main_b0_l1.tpl,1.9,1.10 index_main_b0_l2.tpl,1.15,1.16 index_mlist.tpl,1.1,1.2 message_echo_dump.tpl,1.1,1.2 message_main.tpl,1.9,1.10
- Next by Date:
[Phpgroupware-cvs] CVS: email/doc copyright.gpl,1.1,1.2
- Previous by thread:
[Phpgroupware-cvs] CVS: email/templates/default OLD-preferences.tpl,1.1,1.2 addressbook.tpl,1.8,1.9 attach_file.tpl,1.1,1.2 attach_file_blocks.tpl,1.1,1.2 class_prefs_blocks.tpl,1.4,1.5 class_prefs_ex_accounts.tpl,1.2,1.3 class_prefs_ui.tpl,1.2,1.3 compose.tpl,1.3,1.4 config.tpl,1.6,1.7 filters.tpl,1.9,1.10 filters_blocks.tpl,1.5,1.6 filters_list.tpl,1.3,1.4 folder.tpl,1.7,1.8 index_blocks.tpl,1.4,1.5 index_main_b0_l1.tpl,1.9,1.10 index_main_b0_l2.tpl,1.15,1.16 index_mlist.tpl,1.1,1.2 message_echo_dump.tpl,1.1,1.2 message_main.tpl,1.9,1.10
- Next by thread:
[Phpgroupware-cvs] CVS: email/doc copyright.gpl,1.1,1.2
- Index(es):