phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] old/cdb/outlook2xyz test.php, 1.1 phpgwdebug.php, 1.


From: skwashd
Subject: [Phpgroupware-cvs] old/cdb/outlook2xyz test.php, 1.1 phpgwdebug.php, 1.1 index.php, 1.1
Date: Thu, 5 May 2005 02:56:00 +0200

Update of old/cdb/outlook2xyz

Added Files:
     Branch: MAIN
            test.php 
            phpgwdebug.php 
            index.php 

Log Message:
cvs clean up

====================================================
Index: test.php
<?

$a = "abcdef";
$b = "ghijkl";

echo "a=$a; pos = strpos(a, \"b\"): ".strpos($a,"b");
echo "<br>";
echo "b=$b; pos = strpos(b,\"b\"): ".strpos($b,"b");


====================================================
Index: phpgwdebug.php
<?php
  $phpgw_info["flags"]["currentapp"] = "outlook2xyz";
  $phpgw_info["server"]["site_title"] = "Import from Outlook";
 // $phpgw_info["flags"]["nonavbar"] = True;
  //$phpgw_info["flags"]["noheader"] = True;
  include("../header.inc.php");

echo '<B>$phpgw_info array</B><BR>';
 while (list($key, $val) = each($phpgw_info)) {
    if (is_array($val)) {
      while (list($key2, $val2) = each($val)) {
        if (is_array($val2)) {
          while (list($key3, $val3) = each ($val2)) {
            if (is_array($val3)) {
              while (list($key4, $val4) = each ($val3)) {
                echo "phpgw_info[$key][$key2][$key3][$key4]=$val4<br>";
              }
            } else {
              echo "phpgw_info[$key][$key2][$key3]=$val3<br>";
            }
          }
        } else {
          echo "phpgw_info[$key][$key2]=$val2<br>";
        }
      }
    } else {
      echo "phpgw_info[$key]=$val<br>";
    }
  }
  echo "<br><b>core functions</b><br>";
  echo "<pre>";
  chdir($phpgw_info["server"]["include_root"]);
  system("grep -r '^[ \t]*function' *");
  echo "</pre>";
?>

====================================================
Index: index.php
<?php
  /**************************************************************************\
  * phpGroupWare - Contact Database (cdb)                                    *
  * http://www.phpgroupware.org                                              *
  * Written by Patrick Walsh <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: index.php,v 1.1 2005/05/05 00:56:39 skwashd Exp $ */

        $GLOBALS['phpgw_info']['flags']['currentapp'] = 'cdb';
        $GLOBALS['phpgw_info']['server']['site_title'] = 'Import from Outlook';
        $GLOBALS['phpgw_info']['flags']['nonavbar'] = True;
        $GLOBALS['phpgw_info']['flags']['noheader'] = True;
        include('../../header.inc.php');

        # Construct a default basedn and context for Contacts
        $tmpbasedn = 
split(',',$GLOBALS['phpgw_info']['server']['ldap_context']);
        array_shift($tmpbasedn);
        for ($i=0;$i<count($tmpbasedn);$i++)
        {
                if($i==0)
                {
                        $fakebasedn = $tmpbasedn[$i];
                }
                else
                {
                        $fakebasedn = $fakebasedn . ',' . $tmpbasedn[$i];
                }
        }
        $fakecontext = 'ou=Contacts,' . $fakebasedn;

        if (!$convert)
        {
                $GLOBALS['phpgw']->common->phpgw_header();
                echo "\n\n" . '<CENTER><TABLE WIDTH="90%"><TR BGCOLOR="' . 
$GLOBALS['phpgw_info']['theme']['navbar_bg'].'"><TD>';
                echo '<B><FONT SIZE=+2 COLOR="' . 
$GLOBALS['phpgw_info']['theme']['navbar_text'] . '">';
                echo "\n<CENTER>Import from Outlook</CENTER>\n";
                echo "</FONT></B></TD></TR>\n";
                echo "<TR><TD>\n";
?>

<TABLE WIDTH=85%><TR><TD>
<FORM ENCTYPE="multipart/form-data" action=<?php echo 
$GLOBALS['phpgw']->link(); ?> method=post>
<OL>
        <LI>In Outlook, select your Contacts folder, select <b>Import
                        and Export...</b> from the <b>File</b>
                        menu and export your contacts into a comma separated 
text file.<P></LI>
        <LI>Enter the path to the exported file here:
                        <INPUT NAME="tsvfile" SIZE=48 TYPE="file" VALUE="<?php 
echo $tsvfile_name; ?>"><P></LI>
        <LI>Select the type of conversion (Import types will perform an actual 
import.  Debug will display output in browser or via a download.):<BR>
                        <SELECT NAME="conv_type">
                                <OPTION VALUE="none">&lt;none&gt;</OPTION>
<?php
                $dir_handle=opendir(PHPGW_APP_ROOT . SEP . 'outlook2xyz' . SEP 
. 'conv');
                $i=0; $myfilearray='';
                while ($file = readdir($dir_handle))
                {
                        echo '<!-- ' . is_file(PHPGW_APP_ROOT . SEP . 
'outlook2xyz' . SEP . 'conv' . SEP . $file) . ' -->';
                        if ((substr($file, 0, 1) != '.') && 
is_file(PHPGW_APP_ROOT . SEP . 'outlook2xyz' . SEP . 'conv' . SEP . $file) )
                        {
                                $myfilearray[$i] = $file;
                                $i++;
                        }
                }
                closedir($dir_handle);
                sort($myfilearray);
                for ($i=0;$i<count($myfilearray);$i++)
                {
                        echo '<OPTION VALUE="' . $myfilearray[$i] . '">' . 
$myfilearray[$i] . '</OPTION>';
                }
?>
                        </SELECT><P></LI>
        <LI><INPUT NAME="download" TYPE="checkbox" VALUE="Debug output in 
browser" CHECKED>Debug output in browser (Uncheck to download output.)</LI>
        <LI><INPUT NAME="private" TYPE="checkbox" VALUE="private" CHECKED>Mark 
records as private (Addressbook)</LI>
        <LI>Use this basedn (LDAP)<BR><INPUT NAME="basedn" TYPE="text" 
VALUE="<?php echo $fakebasedn?>" SIZE="48"></LI>
        <LI>Use this context for storing Contacts (LDAP)<BR><INPUT 
NAME="context" TYPE="text" VALUE="<?php echo $fakecontext?>" SIZE="48"></LI>
        <LI><INPUT NAME="convert" TYPE="submit" VALUE="Download 
Conversion"></LI>
</OL>
</FORM>
</TD></TR></TABLE></TABLE>

<?php
                $GLOBALS['phpgw']->common->phpgw_footer();
        }
        else
        {
                include (PHPGW_APP_ROOT . SEP . 'outlook2xyz' . SEP . 'conv' . 
SEP . $conv_type);

                if ($private=='')
                {
                        $private='public';
                }
                $row=0;
                $buffer='';
                $o = new outlook_conv;
                $buffer = $o->outlook_start_file($buffer,$basedn,$context);
                $fp=fopen($tsvfile,'r');
                while ($data = fgetcsv($fp,8000,','))
                {
                        $num = count($data);
                        $row++;
                        if ($row == 1)
                        {
                                $header = $data;
                        }
                        else
                        {
                                $buffer = $o->outlook_start_record($buffer);
                                for ($c=0; $c<$num; $c++ )
                                {
                                        //Send name/value pairs along with the 
buffer
                                        if ($o->outlook[$header[$c]]!='' && 
$data[$c]!='')
                                        {
                                                $buffer = 
$o->outlook_new_attrib($buffer, $o->outlook[$header[$c]],$data[$c]);
                                        }
                                }
                                $buffer = 
$o->outlook_end_record($buffer,$private);
                        }
                }
                fclose($fp);

                $buffer = $o->outlook_end_file($buffer);
                if ($download == '')
                {
                        if($conv_type=='Debug LDAP' || $conv_type=='Debug SQL' )
                        {
                                header('Content-disposition: attachment; 
filename="conversion.txt"');
                                //header('Content-type: text/plain');
                                header('Content-type: application/octetstream');
                                header('Pragma: no-cache');
                                header('Expires: 0');
                                echo $buffer;
                        }
                        else
                        {
                                $GLOBALS['phpgw']->common->phpgw_header();
                                echo parse_navbar();
                                echo '<pre>' . $buffer . '</pre>';
                                $GLOBALS['phpgw']->common->phpgw_footer();
                        }
                }
                else
                {
                        $GLOBALS['phpgw']->common->phpgw_header();
                        echo parse_navbar();
                        echo '<pre>' . $buffer . '</pre>';
                        $GLOBALS['phpgw']->common->phpgw_footer();
                }
        }
?>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]