1#LyX 1.1 created this file. For more info see http://www.lyx.org/
2\lyxformat 218
3\textclass article
4\begin_preamble
5
6\usepackage{fullpage, graphicx, url}
7\setlength{\parskip}{1ex}
8\setlength{\parindent}{0ex}
9\title{ phpGroupWare Application Development}
10\end_preamble
11\language english
12\inputencoding default
13\fontscheme default
14\graphics default
15\paperfontsize 10
16\spacing single
17\papersize Default
18\paperpackage a4
19\use_geometry 0
20\use_amsmath 0
21\paperorientation portrait
22\secnumdepth 3
23\tocdepth 3
24\paragraph_separation indent
25\defskip smallskip
26\quotes_language english
27\quotes_times 2
28\papercolumns 1
29\papersides 1
30\paperpagestyle default
31
32\layout Title
33
34phpGroupWare Application Development
35\layout Author
36
37Dan Kuykendall <dan@kuykendall.org>
38\layout Date
39
40v0.9 29 September 2000
41\layout Quote
42
43
44\emph on
45This document explains phpGroupWare's infrastructure and API, along with
46 what is required to integrate applications into it.
47\layout Standard
48
49
50\begin_inset LatexCommand \tableofcontents{}
51
52\end_inset
53
54
55\layout Section
56
57Introduction
58\layout Standard
59
60phpGroupWare is a web based groupware application framework (API), for writing
61 applications.
62 Integrated applications such as email, calendar, todo list, address book,
63 and file manager are included.
64
65\layout Subsection
66
67Overview of application writing
68\layout Standard
69
70We have attempted to make writing application for phpGroupWare as painless
71 as possible.
72 We hope any pain and suffering is cause by making your application work,
73 but not dealing with phpGroupWare itself.
74
75\layout Subsection
76
77What does the phpGroupWare API provide?
78\layout Standard
79
80The phpGroupWare API handles session management, user/group management,
81 has support for multiple databases, using the PHPLIB database abstraction
82 method, we support templates using the PHPLIB Templates class, a file system
83 interface, and even a network i/o interface.
84
85\layout Standard
86
87On top of these standard functions, phpGroupWare provides several functions
88 to give you the information you need about the users environment, and to
89 properly plug into phpGroupWare.
90
91\layout Section
92
93Guidelines
94\layout Subsection
95
96Requirements
97\layout Standard
98
99These guidelines must be followed for any application that wants considered
100 for inclusion into phpGroupWare deluxe:
101\layout Itemize
102
103It must run on PHP3 and PHP4.
104
105\layout Itemize
106
107SQL statements must be compatible with both MySQL and PostgreSQL.
108
109\layout Itemize
110
111It must use our default header.inc.php include.
112
113\layout Itemize
114
115It must use our $phpgw_link($url) for all links (this is for session support).
116
117\layout Itemize
118
119It must use
120\begin_inset Quotes eld
121\end_inset
122
123post
124\begin_inset Quotes erd
125\end_inset
126
127 for forms.
128
129\layout Itemize
130
131It must respect phpGW group rights and phpGW user permissions.
132
133\layout Itemize
134
135It must use our directory structure, template support and lang (multi-language)
136 support.
137
138\layout Itemize
139
140Where possible it should run on both Unix and NT platforms.
141\layout Itemize
142
143For applications that do not meet these requirements, they can be available
144 to users via the phpGroupWare Apps project, or whatever means the developers
145 decide.
146 If you need help converting your application to templates and our lang
147 support, we will try to connect you with someone to help.
148
149\layout Subsection
150
151Writing/porting your application
152\layout Subsubsection*
153
154Include files
155\layout Standard
156
157Each PHP page you write will need to include the header.inc.php along with
158 a few variables.
159\newline
160 This is done by putting this at the top of each PHP page.
161
162\latex latex
163
164\backslash
165begin{verbatim}
166\newline
167
168\newline
169  <?php
170\newline
171  $phpgw_info["flags"]["currentapp"] = "appname";
172\newline
173  include("../header.inc.php");
174\newline
175  ?>
176\newline
177
178\newline
179
180\backslash
181end{verbatim}
182\latex default
183Of course change application name to fit.
184\newline
185 This include will provide the following things:
186\layout Itemize
187
188The phpgwAPI - The phpGroupWare API will be loaded.
189
190\layout Itemize
191
192The phpGW navbar will be loaded (by default, but can be disabled until a
193 later point.
194
195\layout Itemize
196
197appname/inc/functions.inc.php - This file is loaded just after the phpgwAPI
198 and before any HTML code is generated.
199 This file should include all your application specific functions..
200 You are welcome to include any additional files you need from within this
201 file.
202
203\layout Itemize
204
205appname/inc/header.inc.php - This file is loaded just after the system header/navb
206ar, and allows developers to use it for whatever they need to load.
207
208\layout Itemize
209
210appname/inc/footer.inc.php - This file is loaded just before the system footer,
211 allowing developers to close connections and whatever else they need.
212
213\layout Itemize
214
215The phpGW footer will be loaded, which closes several connections.
216\layout Section
217
218Installing your application
219\layout Subsection
220
221Overview
222\layout Standard
223
224It is fairly simple to add and delete applications to/from phpGroupWare.
225
226\layout Subsection
227
228Automatic features
229\layout Standard
230
231To make things easy for developers we go ahead and load the following files.
232
233\layout Itemize
234
235appname/inc/functions.inc.php - This file should include all your application
236 specific functions.
237
238\layout Itemize
239
240appname/inc/header.inc.php - This file is loaded by $phpgw->common->header
241 just after the system header/navbar, and allows developers to use it for
242 whatever they need to load.
243
244\layout Itemize
245
246appname/inc/footer.inc.php - This file is loaded by $phpgw->common->footer
247 just before the system footer, allowing developers to close connections
248 and whatever else they need.
249\layout Subsection
250
251Adding files, directories and icons.
252\layout Standard
253
254You will need to create the following directories for your code
255\newline
256 (replace 'appname' with your application name)
257\newline
258
259\layout Standard
260\noindent
261
262\family typewriter
263`--appname
264\layout Standard
265\noindent
266
267\family typewriter
268\SpecialChar ~
269\SpecialChar ~
270|--inc
271\layout Standard
272\noindent
273
274\family typewriter
275\SpecialChar ~
276\SpecialChar ~
277|\SpecialChar ~
278\SpecialChar ~
279 |--functions.inc.php
280\layout Standard
281\noindent
282
283\family typewriter
284\SpecialChar ~
285\SpecialChar ~
286|\SpecialChar ~
287 \SpecialChar ~
288|--header.inc.php
289\layout Standard
290\noindent
291
292\family typewriter
293\SpecialChar ~
294\SpecialChar ~
295|\SpecialChar ~
296 \SpecialChar ~
297|--hook_preferences.inc.php
298\layout Standard
299\noindent
300
301\family typewriter
302\SpecialChar ~
303\SpecialChar ~
304|\SpecialChar ~
305 \SpecialChar ~
306|--hook_admin.inc.php
307\layout Standard
308\noindent
309
310\family typewriter
311\SpecialChar ~
312\SpecialChar ~
313|\SpecialChar ~
314 \SpecialChar ~
315`--footer.inc.php
316\layout Standard
317\noindent
318
319\family typewriter
320\SpecialChar ~
321\SpecialChar ~
322`--templates
323\layout Standard
324\noindent
325
326\family typewriter
327\SpecialChar ~
328\SpecialChar ~
329|\SpecialChar ~
330\SpecialChar ~
331 `--default
332\layout LyX-Code
333\noindent \bibitem {dummy}
334
335\layout LyX-Code
336\bibitem {dummy}
337
338\layout LyX-Code
339\bibitem {dummy}
340
341\layout LyX-Code
342\bibitem {dummy}
343
344\layout LyX-Code
345\bibitem {dummy}
346
347\layout Subsection
348
349Making phpGroupWare aware of your application
350\layout Standard
351
352To make the application aware of your application, add your application
353 details to the applications table.
354 This can be done via the GUI administration screen, or via a SQL script.
355
356\latex latex
357
358\backslash
359begin{verbatim}
360\newline
361
362\newline
363  insert into applications (app_name, app_title, app_enabled) values ('appname',
364 'The App name', 1);
365\newline
366
367\newline
368
369\backslash
370end{verbatim}
371\layout Subsection
372
373Hooking into Administration page
374\layout Standard
375
376When a user goes to the Administration page, it starts appname/inc/hook_admin.inc.
377php for each application that is enabled, in alphabetical order of application
378 title.
379 If the file exists, it is include()d in the hopes it will display a selection
380 of links to configure that application.
381\layout Standard
382
383Simple Example:
384\latex latex
385
386\backslash
387begin{verbatim}
388\newline
389
390\newline
391<?php
392\newline
393  $img = "/" .
394 $appname .
395 "/images/navbar.gif";
396\newline
397  section_start("My Application",$img);
398\newline
399  echo "<a HREF=
400\backslash
401"" .
402 $phpgw->link("myAdminPage.php") .
403 "
404\backslash
405">";
406\newline
407  echo lang("Change myApp settings") .
408 "</a>";
409\newline
410  section_end();
411\newline
412?>
413\newline
414
415\newline
416
417\backslash
418end{verbatim}
419\latex default
420Look at headlines/inc/hook_admin.inc.php and admin/inc/hook_admin.inc.php for
421 more examples.
422\layout Standard
423
424Things to note:
425\layout Itemize
426
427Links are relative to the admin/index.php file, not your application's base
428 directory.
429 (so use $appname in your link() calls)
430\layout Itemize
431
432The file is brought in with include() so be careful to not pollute the name-spac
433e too much
434\layout Standard
435
436The standard $phpgw and $phpgw_info variables are in-scope, as is $appname
437 which corresponds to the application name in the path.
438\layout Standard
439
440There are 2 functions to coordinate the display of each application's links,
441 section_start() and section_end()
442\layout Subsubsection*
443
444section_start
445\layout Standard
446
447section_start($title,$icon_url) starts the section for your application.
448 $title is passed through lang() for you.
449 $icon_url should be page-relative to admin/index.php or an absolute URL.
450
451\layout Subsubsection*
452
453section_end
454\layout Standard
455
456section_end() closes the section that was started with section_start().
457
458\layout Subsection
459
460Hooking into Preferences page
461\layout Standard
462
463The mechanism to hook into the preferences page is identical to the one
464 used to hook into the administration page, however it looks for appname/inc/hoo
465k_preferences.inc.php instead of appname/inc/hook_admin.inc.php.
466 The same functions and variables are defined.
467
468\layout Section
469
470Infrastructure
471\layout Subsection
472
473Overview
474\layout Standard
475
476phpGroupWare attempts to provide developers with a sound directory structure
477 to work from.
478\newline
479 The directory layout may seem complex at first, but after some use, you
480 will see that it is designed to accommodate a large number of applications
481 and functions.
482
483\layout Subsection
484
485Directory tree
486\layout Standard
487
488
489\family typewriter
490.--appname
491\layout Standard
492
493
494\family typewriter
495|\SpecialChar ~
496\SpecialChar ~
497 |--inc
498\layout Standard
499
500
501\family typewriter
502|\SpecialChar ~
503\SpecialChar ~
504 |\SpecialChar ~
505\SpecialChar ~
506 |--functions.inc.php
507\layout Standard
508
509
510\family typewriter
511|\SpecialChar ~
512\SpecialChar ~
513 |\SpecialChar ~
514\SpecialChar ~
515 |--header.inc.php
516\layout Standard
517
518
519\family typewriter
520|\SpecialChar ~
521\SpecialChar ~
522 |\SpecialChar ~
523\SpecialChar ~
524 |--hook_preferences.ini.php
525\layout Standard
526
527
528\family typewriter
529|\SpecialChar ~
530\SpecialChar ~
531 |\SpecialChar ~
532\SpecialChar ~
533 |--hook_home.inc.php
534\layout Standard
535
536
537\family typewriter
538|\SpecialChar ~
539\SpecialChar ~
540 |\SpecialChar ~
541\SpecialChar ~
542 `--footer.inc.php
543\layout Standard
544
545
546\family typewriter
547|\SpecialChar ~
548\SpecialChar ~
549 |--manual
550\layout Standard
551
552
553\family typewriter
554|\SpecialChar ~
555\SpecialChar ~
556 |--setup
557\layout Standard
558
559
560\family typewriter
561|\SpecialChar ~
562\SpecialChar ~
563 |\SpecialChar ~
564\SpecialChar ~
565 |--baseline.inc.php
566\layout Standard
567
568
569\family typewriter
570|\SpecialChar ~
571\SpecialChar ~
572 |\SpecialChar ~
573\SpecialChar ~
574 |--droptables.inc.php
575\layout Standard
576
577
578\family typewriter
579|\SpecialChar ~
580\SpecialChar ~
581 |\SpecialChar ~
582\SpecialChar ~
583 |--newtables.inc.php
584\layout Standard
585
586
587\family typewriter
588|\SpecialChar ~
589\SpecialChar ~
590 |\SpecialChar ~
591\SpecialChar ~
592 |--upgradetables.inc.php
593\layout Standard
594
595
596\family typewriter
597|\SpecialChar ~
598\SpecialChar ~
599 |\SpecialChar ~
600\SpecialChar ~
601 |--config.inc.php
602\layout Standard
603
604
605\family typewriter
606|\SpecialChar ~
607\SpecialChar ~
608 |\SpecialChar ~
609\SpecialChar ~
610 `--register.inc.php
611\layout Standard
612
613
614\family typewriter
615|\SpecialChar ~
616\SpecialChar ~
617 `--templates
618\layout Standard
619
620
621\family typewriter
622|\SpecialChar ~
623\SpecialChar ~
624 |\SpecialChar ~
625\SpecialChar ~
626 `--default
627\layout Standard
628
629
630\family typewriter
631|\SpecialChar ~
632\SpecialChar ~
633\SpecialChar ~
634|\SpecialChar ~
635\SpecialChar ~
636\SpecialChar ~
637\SpecialChar ~
638\SpecialChar ~
639 `--images
640\layout Standard
641
642
643\family typewriter
644|\SpecialChar ~
645\SpecialChar ~
646\SpecialChar ~
647|\SpecialChar ~
648\SpecialChar ~
649\SpecialChar ~
650\SpecialChar ~
651\SpecialChar ~
652\SpecialChar ~
653\SpecialChar ~
654 `--navbar.gif
655\layout Standard
656
657
658\family typewriter
659|\SpecialChar ~
660\SpecialChar ~
661 |--preferences.php
662\layout Standard
663
664
665\family typewriter
666|--docs (installation docs)
667\layout Standard
668
669
670\family typewriter
671|--files
672\layout Standard
673
674
675\family typewriter
676|\SpecialChar ~
677\SpecialChar ~
678 |--groups
679\layout Standard
680
681
682\family typewriter
683|\SpecialChar ~
684\SpecialChar ~
685 `--users
686\layout Standard
687
688
689\family typewriter
690`--phpgwapi
691\layout Standard
692
693
694\family typewriter
695\SpecialChar ~
696\SpecialChar ~
697\SpecialChar ~
698|--cron (phpgroupware's optional daemons)
699\layout Standard
700
701
702\family typewriter
703\SpecialChar ~
704\SpecialChar ~
705\SpecialChar ~
706|--doc (developers docs)
707\layout Standard
708
709
710\family typewriter
711\SpecialChar ~
712\SpecialChar ~
713\SpecialChar ~
714|--inc
715\layout Standard
716
717
718\family typewriter
719\SpecialChar ~
720\SpecialChar ~
721\SpecialChar ~
722|\SpecialChar ~
723\SpecialChar ~
724 |--phpgw.inc.php
725\layout Standard
726
727
728\family typewriter
729\SpecialChar ~
730\SpecialChar ~
731\SpecialChar ~
732|\SpecialChar ~
733\SpecialChar ~
734 |--phpgw_info.inc.php
735\layout Standard
736
737
738\family typewriter
739\SpecialChar ~
740\SpecialChar ~
741\SpecialChar ~
742|\SpecialChar ~
743\SpecialChar ~
744 |--phpgw_common.inc.php
745\layout Standard
746
747
748\family typewriter
749\SpecialChar ~
750\SpecialChar ~
751\SpecialChar ~
752|\SpecialChar ~
753\SpecialChar ~
754 `--etc..
755\layout Standard
756
757
758\family typewriter
759\SpecialChar ~
760\SpecialChar ~
761\SpecialChar ~
762|--manual
763\layout Standard
764
765
766\family typewriter
767\SpecialChar ~
768\SpecialChar ~
769\SpecialChar ~
770|--setup
771\layout Standard
772
773
774\family typewriter
775\SpecialChar ~
776\SpecialChar ~
777\SpecialChar ~
778|\SpecialChar ~
779\SpecialChar ~
780 |--baseline.inc.php
781\layout Standard
782
783
784\family typewriter
785\SpecialChar ~
786\SpecialChar ~
787\SpecialChar ~
788|\SpecialChar ~
789\SpecialChar ~
790 |--droptables.inc.php
791\layout Standard
792
793
794\family typewriter
795\SpecialChar ~
796\SpecialChar ~
797\SpecialChar ~
798|\SpecialChar ~
799\SpecialChar ~
800 |--newtables.inc.php
801\layout Standard
802
803
804\family typewriter
805\SpecialChar ~
806\SpecialChar ~
807\SpecialChar ~
808|\SpecialChar ~
809\SpecialChar ~
810 |--upgradetables.inc.php
811\layout Standard
812
813
814\family typewriter
815\SpecialChar ~
816\SpecialChar ~
817\SpecialChar ~
818|\SpecialChar ~
819\SpecialChar ~
820 |--config.inc.php
821\layout Standard
822
823
824\family typewriter
825\SpecialChar ~
826\SpecialChar ~
827\SpecialChar ~
828|\SpecialChar ~
829\SpecialChar ~
830 `--register.inc.php
831\layout Standard
832
833
834\family typewriter
835\SpecialChar ~
836\SpecialChar ~
837\SpecialChar ~
838|--templates
839\layout Standard
840
841
842\family typewriter
843\SpecialChar ~
844\SpecialChar ~
845\SpecialChar ~
846|\SpecialChar ~
847\SpecialChar ~
848 |--default
849\layout Standard
850
851
852\family typewriter
853\SpecialChar ~
854\SpecialChar ~
855\SpecialChar ~
856|\SpecialChar ~
857\SpecialChar ~
858 |\SpecialChar ~
859\SpecialChar ~
860 `--images
861\layout Standard
862
863
864\family typewriter
865\SpecialChar ~
866\SpecialChar ~
867\SpecialChar ~
868|\SpecialChar ~
869\SpecialChar ~
870 |\SpecialChar ~
871\SpecialChar ~
872 |--home.gif
873\layout Standard
874
875
876\family typewriter
877\SpecialChar ~
878\SpecialChar ~
879\SpecialChar ~
880|\SpecialChar ~
881\SpecialChar ~
882 |\SpecialChar ~
883\SpecialChar ~
884 `--preferences.gif
885\layout Standard
886
887
888\family typewriter
889\SpecialChar ~
890\SpecialChar ~
891\SpecialChar ~
892|\SpecialChar ~
893\SpecialChar ~
894 `--verilak
895\layout Standard
896
897
898\family typewriter
899\SpecialChar ~
900\SpecialChar ~
901\SpecialChar ~
902|\SpecialChar ~
903\SpecialChar ~
904\SpecialChar ~
905\SpecialChar ~
906\SpecialChar ~
907 `--images
908\layout Standard
909
910
911\family typewriter
912\SpecialChar ~
913\SpecialChar ~
914\SpecialChar ~
915\SpecialChar ~
916\SpecialChar ~
917\SpecialChar ~
918\SpecialChar ~
919\SpecialChar ~
920\SpecialChar ~
921\SpecialChar ~
922 |--home.gif
923\layout Standard
924
925
926\family typewriter
927\SpecialChar ~
928\SpecialChar ~
929\SpecialChar ~
930\SpecialChar ~
931\SpecialChar ~
932\SpecialChar ~
933\SpecialChar ~
934\SpecialChar ~
935\SpecialChar ~
936\SpecialChar ~
937 `--preferences.gif
938\layout Standard
939
940
941\family typewriter
942\SpecialChar ~
943\SpecialChar ~
944\SpecialChar ~
945`--themes
946\layout Standard
947
948
949\family typewriter
950\SpecialChar ~
951\SpecialChar ~
952\SpecialChar ~
953\SpecialChar ~
954\SpecialChar ~
955\SpecialChar ~
956`--default.theme
957\layout LyX-Code
958\bibitem {dummy}
959
960\layout Subsection
961
962Translations
963\layout Standard
964
965The translations are now being done thru the database, and will be configurable
966 to use other mechanisms.
967
968\layout Standard
969
970We are completing a program called Transy, which will provide developers/transla
971tors a nice GUI for building and updating translations.
972
973\layout Standard
974
975In the mean time you will need to create a SQL script yourself and name
976 it lang.sql.
977 You can copy the one in doc/lang.sql and use it as a template.
978
979\layout Section
980
981The API
982\layout Subsection
983
984Introduction
985\layout Standard
986
987phpGroupWare attempts to provide developers with a useful API to handle
988 common tasks.
989
990\layout Standard
991
992To do this we have created a multi-dimensional class $phpgw->.
993
994\layout Standard
995
996This allows for terrific code organization, and help developers easily identify
997 the file that the function is in.
998 All the files that are part of this class are in the inc/core directory
999 and are named to match the sub-class.
1000
1001\layout Standard
1002
1003Example: $phpgw->send->msg() is in the inc/phpgwapi/phpgw_send.inc.php file.
1004
1005\layout Subsection
1006
1007Basic functions
1008\layout Subsubsection*
1009
1010$phpgw->link
1011\layout Standard
1012
1013$phpgw->link($url)
1014\newline
1015 Add support for session management.
1016 ALL links must use this, that includes href's form actions and header location'
1017s.
1018
1019\layout Standard
1020
1021If you are just doing a form action back to the same page, you can use it
1022 without any parameters.
1023
1024\layout Standard
1025
1026This function is right at the core of the class because it is used so often,
1027 we wanted to save developers a few keystrokes.
1028 Example:
1029\latex latex
1030
1031\backslash
1032begin{verbatim}
1033\newline
1034
1035\newline
1036<form name=copy method=post action="<?php echo $phpgw->link();?>">
1037\newline
1038/* If session management is done via passing url parameters */
1039\newline
1040/* The the result would be */
1041\newline
1042/* <form name=copy method=post action="somepage.php?sessionid=87687693276?kp3=kjh
104398u80"> */
1044\newline
1045
1046\newline
1047
1048\backslash
1049end{verbatim}
1050\layout Subsection
1051
1052Application Functions
1053\layout Subsubsection*
1054
1055$phpgw->common->phpgw_header
1056\layout Standard
1057
1058$phpgw->phpgw_header()
1059\newline
1060 Print out the start of the HTML page, including the navigation bar and
1061 includes appname/inc/header.php
1062\layout Subsubsection*
1063
1064$phpgw->common->phpgw_footer
1065\layout Standard
1066
1067$phpgw->phpgw_footer()
1068\newline
1069 Prints the system footer, and includes appname/inc/footer.php
1070\layout Subsubsection*
1071
1072$phpgw->common->appsession
1073\layout Standard
1074
1075$phpgw->common->appsession($data)
1076\newline
1077 Store important information session information that your application needs.
1078\newline
1079 $phpgw->appsession will return the value of your session data is you leave
1080 the parameter empty [i.e.
1081 $phpgw->appsession(
1082\begin_inset Quotes eld
1083\end_inset
1084
1085
1086\begin_inset Quotes erd
1087\end_inset
1088
1089)], otherwise it will store whatever data you send to it.
1090\newline
1091 You can also store a comma delimited string and use explode() to turn it
1092 back into an array when you receive the value back.
1093
1094\layout Standard
1095
1096Example:
1097\latex latex
1098
1099\backslash
1100begin{verbatim}
1101\newline
1102
1103\newline
1104  $phpgw->common->appsession("/path/to/something");
1105\newline
1106  echo "Dir: " .
1107 $phpgw->common->appsession();
1108\newline
1109
1110\newline
1111
1112\backslash
1113end{verbatim}
1114\layout Subsection
1115
1116File functions
1117\layout Subsubsection*
1118
1119$phpgw->vfs->read_file
1120\layout Standard
1121
1122$phpgw->vfs->read_file($file)
1123\newline
1124 Returns the data from $file.
1125\newline
1126 You must send the complete path to the file.
1127\newline
1128 Example:
1129\latex latex
1130
1131\backslash
1132begin{verbatim}
1133\newline
1134
1135\newline
1136$data = $phpgw->vfs->read_file("/some/dir/to/file.txt");
1137\newline
1138
1139\newline
1140
1141\backslash
1142end{verbatim}
1143\layout Subsubsection*
1144
1145$phpgw->vfs->write_file
1146\layout Standard
1147
1148$phpgw->vfs->write_file($file, $contents)
1149\newline
1150 Write data to $file.
1151\newline
1152 You must send the complete path to the file.
1153\newline
1154 Example:
1155\latex latex
1156
1157\backslash
1158begin{verbatim}
1159\newline
1160
1161\newline
1162$data = $phpgw->vfs->write_file("/some/dir/to/file.txt");
1163\newline
1164
1165\newline
1166
1167\backslash
1168end{verbatim}
1169\layout Subsubsection*
1170
1171$phpgw->vfs->read_userfile
1172\layout Standard
1173
1174$phpgw->vfs->read_userfile($file)
1175\newline
1176 Returns the data from $file, which resides in the users private dir.
1177\newline
1178 Example:
1179\latex latex
1180
1181\backslash
1182begin{verbatim}
1183\newline
1184
1185\newline
1186$data = $phpgw->vfs->read_userfile("file.txt");
1187\newline
1188
1189\newline
1190
1191\backslash
1192end{verbatim}
1193\layout Subsubsection*
1194
1195$phpgw->vfs->write_userfile
1196\layout Standard
1197
1198$phpgw->write_userfile($file, $contents)
1199\newline
1200 Writes data to $file, which resides in the users private dir.
1201\newline
1202 Example:
1203\latex latex
1204
1205\backslash
1206begin{verbatim}
1207\newline
1208
1209\newline
1210$data = $phpgw->vfs->write_userfile("file.txt");
1211\newline
1212
1213\newline
1214
1215\backslash
1216end{verbatim}
1217\layout Subsubsection*
1218
1219$phpgw->vfs->list_userfiles
1220\layout Standard
1221
1222$phpgw->vfs->list_userfiles()
1223\newline
1224 Returns an array which has the list of files in the users private dir.
1225\newline
1226 Example:
1227\latex latex
1228
1229\backslash
1230begin{verbatim}
1231\newline
1232
1233\newline
1234$filelist = array();
1235\newline
1236$filelist = $phpgw->vfs->list_userfiles();
1237\newline
1238
1239\newline
1240
1241\backslash
1242end{verbatim}
1243\layout Subsection
1244
1245Email/NNTP Functions
1246\layout Subsubsection*
1247
1248$phpgw->send->msg
1249\layout Standard
1250
1251$phpgw->send->msg($service, $to, $subject, $body, $msgtype, $cc, $bcc)
1252\newline
1253 Send a message via email or NNTP and returns any error codes.
1254\newline
1255 Example:
1256\latex latex
1257
1258\backslash
1259begin{verbatim}
1260\newline
1261
1262\newline
1263$to = "someuser@domain.com";
1264\newline
1265$subject = "Hello buddy";
1266\newline
1267$body = "Give me a call
1268\backslash
1269n Been wondering what your up to.";
1270\newline
1271$errors = $phpgw->send->msg("email", $to, $subject, $body);
1272\newline
1273
1274\newline
1275
1276\backslash
1277end{verbatim}
1278\layout Section
1279
1280Configuration Variables
1281\layout Subsection
1282
1283Introduction
1284\layout Standard
1285
1286phpGroupWare attempt to provide developers with as much information about
1287 the user, group, server, and application configuration as possible.
1288
1289\layout Standard
1290
1291To do this we provide a multi-dimensional array called '$phpgw_info[]',
1292 which includes all the information about your environment.
1293
1294\layout Standard
1295
1296Due to the multi-dimensional array approach.
1297 getting these values is easy.
1298
1299\layout Standard
1300
1301Here are some examples:
1302\latex latex
1303
1304\backslash
1305begin{verbatim}
1306\newline
1307
1308\newline
1309  <?php
1310\newline
1311  // To do a hello username
1312\newline
1313  echo "Hello " .
1314 $phpgw_info["user"]["fullname"];
1315\newline
1316  //If username first name is John and last name is Doe, prints: 'Hello
1317 John Doe'
1318\newline
1319  ?>
1320\newline
1321  <?php
1322\newline
1323  // To find out the location of the imap server
1324\newline
1325  echo "IMAP Server is named: " .
1326 $phpgw_info["server"]["imap_server"];
1327\newline
1328  //If imap is running on localhost, prints: 'IMAP Server is named: localhost'
1329\newline
1330  ?>
1331\newline
1332
1333\newline
1334
1335\newline
1336
1337\backslash
1338end{verbatim}
1339\layout Subsection
1340
1341User information
1342\layout Standard
1343
1344
1345\family typewriter
1346\size small
1347$phpgw_info[
1348\begin_inset Quotes eld
1349\end_inset
1350
1351user
1352\begin_inset Quotes erd
1353\end_inset
1354
1355][
1356\begin_inset Quotes eld
1357\end_inset
1358
1359userid
1360\begin_inset Quotes erd
1361\end_inset
1362
1363] = The user ID.
1364
1365\layout Standard
1366
1367
1368\family typewriter
1369\size small
1370$phpgw_info[
1371\begin_inset Quotes eld
1372\end_inset
1373
1374user
1375\begin_inset Quotes erd
1376\end_inset
1377
1378][
1379\begin_inset Quotes eld
1380\end_inset
1381
1382sessionid
1383\begin_inset Quotes erd
1384\end_inset
1385
1386] = The session ID
1387\layout Standard
1388
1389
1390\family typewriter
1391\size small
1392$phpgw_info[
1393\begin_inset Quotes eld
1394\end_inset
1395
1396user
1397\begin_inset Quotes erd
1398\end_inset
1399
1400][
1401\begin_inset Quotes eld
1402\end_inset
1403
1404theme
1405\begin_inset Quotes erd
1406\end_inset
1407
1408] = Selected theme
1409\layout Standard
1410
1411
1412\family typewriter
1413\size small
1414$phpgw_info[
1415\begin_inset Quotes eld
1416\end_inset
1417
1418user
1419\begin_inset Quotes erd
1420\end_inset
1421
1422][
1423\begin_inset Quotes eld
1424\end_inset
1425
1426private_dir
1427\begin_inset Quotes erd
1428\end_inset
1429
1430] = Users private dir.
1431 Use phpGroupWare core functions for access to the files.
1432
1433\layout Standard
1434
1435
1436\family typewriter
1437\size small
1438$phpgw_info[
1439\begin_inset Quotes eld
1440\end_inset
1441
1442user
1443\begin_inset Quotes erd
1444\end_inset
1445
1446][
1447\begin_inset Quotes eld
1448\end_inset
1449
1450firstname
1451\begin_inset Quotes erd
1452\end_inset
1453
1454] = Users first name
1455\layout Standard
1456
1457
1458\family typewriter
1459\size small
1460$phpgw_info[
1461\begin_inset Quotes eld
1462\end_inset
1463
1464user
1465\begin_inset Quotes erd
1466\end_inset
1467
1468][
1469\begin_inset Quotes eld
1470\end_inset
1471
1472lastname
1473\begin_inset Quotes erd
1474\end_inset
1475
1476] = Users last name
1477\layout Standard
1478
1479
1480\family typewriter
1481\size small
1482$phpgw_info[
1483\begin_inset Quotes eld
1484\end_inset
1485
1486user
1487\begin_inset Quotes erd
1488\end_inset
1489
1490][
1491\begin_inset Quotes eld
1492\end_inset
1493
1494fullname
1495\begin_inset Quotes erd
1496\end_inset
1497
1498] = Users Full Name
1499\layout Standard
1500
1501
1502\family typewriter
1503\size small
1504$phpgw_info[
1505\begin_inset Quotes eld
1506\end_inset
1507
1508user
1509\begin_inset Quotes erd
1510\end_inset
1511
1512][
1513\begin_inset Quotes eld
1514\end_inset
1515
1516groups
1517\begin_inset Quotes erd
1518\end_inset
1519
1520] = Groups the user is a member of
1521\layout Standard
1522
1523
1524\family typewriter
1525\size small
1526$phpgw_info[
1527\begin_inset Quotes eld
1528\end_inset
1529
1530user
1531\begin_inset Quotes erd
1532\end_inset
1533
1534][
1535\begin_inset Quotes eld
1536\end_inset
1537
1538app_perms
1539\begin_inset Quotes erd
1540\end_inset
1541
1542] = If the user has access to the current application
1543\layout Standard
1544
1545
1546\family typewriter
1547\size small
1548$phpgw_info[
1549\begin_inset Quotes eld
1550\end_inset
1551
1552user
1553\begin_inset Quotes erd
1554\end_inset
1555
1556][
1557\begin_inset Quotes eld
1558\end_inset
1559
1560lastlogin
1561\begin_inset Quotes erd
1562\end_inset
1563
1564] = Last time the user logged in.
1565
1566\layout Standard
1567
1568
1569\family typewriter
1570\size small
1571$phpgw_info[
1572\begin_inset Quotes eld
1573\end_inset
1574
1575user
1576\begin_inset Quotes erd
1577\end_inset
1578
1579][
1580\begin_inset Quotes eld
1581\end_inset
1582
1583lastloginfrom
1584\begin_inset Quotes erd
1585\end_inset
1586
1587] = Where they logged in from the last time.
1588
1589\layout Standard
1590
1591
1592\family typewriter
1593\size small
1594$phpgw_info[
1595\begin_inset Quotes eld
1596\end_inset
1597
1598user
1599\begin_inset Quotes erd
1600\end_inset
1601
1602][
1603\begin_inset Quotes eld
1604\end_inset
1605
1606lastpasswd_change
1607\begin_inset Quotes erd
1608\end_inset
1609
1610] = Last time they changed their password.
1611
1612\layout Standard
1613
1614
1615\family typewriter
1616\size small
1617$phpgw_info[
1618\begin_inset Quotes eld
1619\end_inset
1620
1621user
1622\begin_inset Quotes erd
1623\end_inset
1624
1625][
1626\begin_inset Quotes eld
1627\end_inset
1628
1629passwd
1630\begin_inset Quotes erd
1631\end_inset
1632
1633] = Hashed password.
1634
1635\layout Standard
1636
1637
1638\family typewriter
1639\size small
1640$phpgw_info[
1641\begin_inset Quotes eld
1642\end_inset
1643
1644user
1645\begin_inset Quotes erd
1646\end_inset
1647
1648][
1649\begin_inset Quotes eld
1650\end_inset
1651
1652status
1653\begin_inset Quotes erd
1654\end_inset
1655
1656] = If the user is enabled.
1657
1658\layout Standard
1659
1660
1661\family typewriter
1662\size small
1663$phpgw_info[
1664\begin_inset Quotes eld
1665\end_inset
1666
1667user
1668\begin_inset Quotes erd
1669\end_inset
1670
1671][
1672\begin_inset Quotes eld
1673\end_inset
1674
1675logintime
1676\begin_inset Quotes erd
1677\end_inset
1678
1679] = Time they logged into their current session.
1680
1681\layout Standard
1682
1683
1684\family typewriter
1685\size small
1686$phpgw_info[
1687\begin_inset Quotes eld
1688\end_inset
1689
1690user
1691\begin_inset Quotes erd
1692\end_inset
1693
1694][
1695\begin_inset Quotes eld
1696\end_inset
1697
1698session_dla
1699\begin_inset Quotes erd
1700\end_inset
1701
1702] = Last time they did anything in their current session
1703\layout Standard
1704
1705
1706\family typewriter
1707\size small
1708$phpgw_info[
1709\begin_inset Quotes eld
1710\end_inset
1711
1712user
1713\begin_inset Quotes erd
1714\end_inset
1715
1716][
1717\begin_inset Quotes eld
1718\end_inset
1719
1720session_ip
1721\begin_inset Quotes erd
1722\end_inset
1723
1724] = Current IP address
1725\layout Subsection
1726
1727Group information
1728\layout Standard
1729
1730
1731\family typewriter
1732\size small
1733$phpgw_info[
1734\begin_inset Quotes eld
1735\end_inset
1736
1737group
1738\begin_inset Quotes erd
1739\end_inset
1740
1741][
1742\begin_inset Quotes eld
1743\end_inset
1744
1745group_names
1746\begin_inset Quotes erd
1747\end_inset
1748
1749] = List of groups.
1750\layout Subsection
1751
1752Server information
1753\layout Standard
1754
1755
1756\family typewriter
1757\size small
1758$phpgw_info[
1759\begin_inset Quotes eld
1760\end_inset
1761
1762server
1763\begin_inset Quotes erd
1764\end_inset
1765
1766][
1767\begin_inset Quotes eld
1768\end_inset
1769
1770server_root
1771\begin_inset Quotes erd
1772\end_inset
1773
1774] = Main installation directory
1775\layout Standard
1776
1777
1778\family typewriter
1779\size small
1780$phpgw_info[
1781\begin_inset Quotes eld
1782\end_inset
1783
1784server
1785\begin_inset Quotes erd
1786\end_inset
1787
1788][
1789\begin_inset Quotes eld
1790\end_inset
1791
1792include_root
1793\begin_inset Quotes erd
1794\end_inset
1795
1796] = Location of the 'inc' directory.
1797
1798\layout Standard
1799
1800
1801\family typewriter
1802\size small
1803$phpgw_info[
1804\begin_inset Quotes eld
1805\end_inset
1806
1807server
1808\begin_inset Quotes erd
1809\end_inset
1810
1811][
1812\begin_inset Quotes eld
1813\end_inset
1814
1815temp_dir
1816\begin_inset Quotes erd
1817\end_inset
1818
1819] = Directory that can be used for temporarily storing files
1820\layout Standard
1821
1822
1823\family typewriter
1824\size small
1825$phpgw_info[
1826\begin_inset Quotes eld
1827\end_inset
1828
1829server
1830\begin_inset Quotes erd
1831\end_inset
1832
1833][
1834\begin_inset Quotes eld
1835\end_inset
1836
1837files_dir
1838\begin_inset Quotes erd
1839\end_inset
1840
1841] = Directory er and group files are stored
1842\layout Standard
1843
1844
1845\family typewriter
1846\size small
1847$phpgw_info[
1848\begin_inset Quotes eld
1849\end_inset
1850
1851server
1852\begin_inset Quotes erd
1853\end_inset
1854
1855][
1856\begin_inset Quotes eld
1857\end_inset
1858
1859common_include_dir
1860\begin_inset Quotes erd
1861\end_inset
1862
1863] = Location of the core/shared include files.
1864
1865\layout Standard
1866
1867
1868\family typewriter
1869\size small
1870$phpgw_info[
1871\begin_inset Quotes eld
1872\end_inset
1873
1874server
1875\begin_inset Quotes erd
1876\end_inset
1877
1878][
1879\begin_inset Quotes eld
1880\end_inset
1881
1882template_dir
1883\begin_inset Quotes erd
1884\end_inset
1885
1886] = Active template files directory.
1887 This is defaulted by the server, and changeable by the user.
1888
1889\layout Standard
1890
1891
1892\family typewriter
1893\size small
1894$phpgw_info[
1895\begin_inset Quotes eld
1896\end_inset
1897
1898server
1899\begin_inset Quotes erd
1900\end_inset
1901
1902][
1903\begin_inset Quotes eld
1904\end_inset
1905
1906dir_separator
1907\begin_inset Quotes erd
1908\end_inset
1909
1910] = Allows compatibility with WindowsNT directory format,
1911\layout Standard
1912
1913
1914\family typewriter
1915\size small
1916$phpgw_info[
1917\begin_inset Quotes eld
1918\end_inset
1919
1920server
1921\begin_inset Quotes erd
1922\end_inset
1923
1924][
1925\begin_inset Quotes eld
1926\end_inset
1927
1928encrpytkey
1929\begin_inset Quotes erd
1930\end_inset
1931
1932] = Key used for encryption functions
1933\layout Standard
1934
1935
1936\family typewriter
1937\size small
1938$phpgw_info[
1939\begin_inset Quotes eld
1940\end_inset
1941
1942server
1943\begin_inset Quotes erd
1944\end_inset
1945
1946][
1947\begin_inset Quotes eld
1948\end_inset
1949
1950site_title
1951\begin_inset Quotes erd
1952\end_inset
1953
1954] = Site Title will show in the title bar of each webpage.
1955
1956\layout Standard
1957
1958
1959\family typewriter
1960\size small
1961$phpgw_info[
1962\begin_inset Quotes eld
1963\end_inset
1964
1965server
1966\begin_inset Quotes erd
1967\end_inset
1968
1969][
1970\begin_inset Quotes eld
1971\end_inset
1972
1973webserver_url
1974\begin_inset Quotes erd
1975\end_inset
1976
1977] = URL to phpGroupWare installation.
1978
1979\layout Standard
1980
1981
1982\family typewriter
1983\size small
1984$phpgw_info[
1985\begin_inset Quotes eld
1986\end_inset
1987
1988server
1989\begin_inset Quotes erd
1990\end_inset
1991
1992][
1993\begin_inset Quotes eld
1994\end_inset
1995
1996hostname
1997\begin_inset Quotes erd
1998\end_inset
1999
2000] = Name of the server phpGroupWare is installed upon.
2001
2002\layout Standard
2003
2004
2005\family typewriter
2006\size small
2007$phpgw_info[
2008\begin_inset Quotes eld
2009\end_inset
2010
2011server
2012\begin_inset Quotes erd
2013\end_inset
2014
2015][
2016\begin_inset Quotes eld
2017\end_inset
2018
2019charset
2020\begin_inset Quotes erd
2021\end_inset
2022
2023] = default charset, default:iso-8859-1
2024\layout Standard
2025
2026
2027\family typewriter
2028\size small
2029$phpgw_info[
2030\begin_inset Quotes eld
2031\end_inset
2032
2033server
2034\begin_inset Quotes erd
2035\end_inset
2036
2037][
2038\begin_inset Quotes eld
2039\end_inset
2040
2041version
2042\begin_inset Quotes erd
2043\end_inset
2044
2045] = phpGroupWare version.
2046\layout Subsection
2047
2048Database information
2049\layout Standard
2050
2051It is unlikely you will need these, because $phpgw_info_db will already
2052 be loaded as a database for you to use.
2053
2054\layout Standard
2055
2056
2057\family typewriter
2058\size small
2059$phpgw_info[
2060\begin_inset Quotes eld
2061\end_inset
2062
2063server
2064\begin_inset Quotes erd
2065\end_inset
2066
2067][
2068\begin_inset Quotes eld
2069\end_inset
2070
2071db_host
2072\begin_inset Quotes erd
2073\end_inset
2074
2075] = Address of the database server.
2076 Usually this is set to localhost.
2077
2078\layout Standard
2079
2080
2081\family typewriter
2082\size small
2083$phpgw_info[
2084\begin_inset Quotes eld
2085\end_inset
2086
2087server
2088\begin_inset Quotes erd
2089\end_inset
2090
2091][
2092\begin_inset Quotes eld
2093\end_inset
2094
2095db_name
2096\begin_inset Quotes erd
2097\end_inset
2098
2099] = Database name.
2100
2101\layout Standard
2102
2103
2104\family typewriter
2105\size small
2106$phpgw_info[
2107\begin_inset Quotes eld
2108\end_inset
2109
2110server
2111\begin_inset Quotes erd
2112\end_inset
2113
2114][
2115\begin_inset Quotes eld
2116\end_inset
2117
2118db_user
2119\begin_inset Quotes erd
2120\end_inset
2121
2122] = User name.
2123
2124\layout Standard
2125
2126
2127\family typewriter
2128\size small
2129$phpgw_info[
2130\begin_inset Quotes eld
2131\end_inset
2132
2133server
2134\begin_inset Quotes erd
2135\end_inset
2136
2137][
2138\begin_inset Quotes eld
2139\end_inset
2140
2141db_pass
2142\begin_inset Quotes erd
2143\end_inset
2144
2145] = Password
2146\layout Standard
2147
2148
2149\family typewriter
2150\size small
2151$phpgw_info[
2152\begin_inset Quotes eld
2153\end_inset
2154
2155server
2156\begin_inset Quotes erd
2157\end_inset
2158
2159][
2160\begin_inset Quotes eld
2161\end_inset
2162
2163db_type
2164\begin_inset Quotes erd
2165\end_inset
2166
2167] = Type of database.
2168 Currently MySQL and PostgreSQL are supported.
2169\layout Subsection
2170
2171Mail information
2172\layout Standard
2173
2174It is unlikely you will need these, because most email needs are services
2175 thru core phpGroupWare functions.
2176
2177\layout Standard
2178
2179
2180\family typewriter
2181\size small
2182$phpgw_info[
2183\begin_inset Quotes eld
2184\end_inset
2185
2186server
2187\begin_inset Quotes erd
2188\end_inset
2189
2190][
2191\begin_inset Quotes eld
2192\end_inset
2193
2194mail_server
2195\begin_inset Quotes erd
2196\end_inset
2197
2198] = Address of the IMAP server.
2199 Usually this is set to localhost.
2200
2201\layout Standard
2202
2203
2204\family typewriter
2205\size small
2206$phpgw_info[
2207\begin_inset Quotes eld
2208\end_inset
2209
2210server
2211\begin_inset Quotes erd
2212\end_inset
2213
2214][
2215\begin_inset Quotes eld
2216\end_inset
2217
2218mail_server_type
2219\begin_inset Quotes erd
2220\end_inset
2221
2222] = IMAP or POP3
2223\layout Standard
2224
2225
2226\family typewriter
2227\size small
2228$phpgw_info[
2229\begin_inset Quotes eld
2230\end_inset
2231
2232server
2233\begin_inset Quotes erd
2234\end_inset
2235
2236][
2237\begin_inset Quotes eld
2238\end_inset
2239
2240imap_server_type
2241\begin_inset Quotes erd
2242\end_inset
2243
2244] = Cyrus or Uwash
2245\layout Standard
2246
2247
2248\family typewriter
2249\size small
2250$phpgw_info[
2251\begin_inset Quotes eld
2252\end_inset
2253
2254server
2255\begin_inset Quotes erd
2256\end_inset
2257
2258][
2259\begin_inset Quotes eld
2260\end_inset
2261
2262imap_port
2263\begin_inset Quotes erd
2264\end_inset
2265
2266] = This is usually 143, and should only be changed if there is a good reason.
2267
2268\layout Standard
2269
2270
2271\family typewriter
2272\size small
2273$phpgw_info[
2274\begin_inset Quotes eld
2275\end_inset
2276
2277server
2278\begin_inset Quotes erd
2279\end_inset
2280
2281][
2282\begin_inset Quotes eld
2283\end_inset
2284
2285mail_suffix] = This is the domain name, used to add to email address
2286\layout Standard
2287
2288
2289\family typewriter
2290\size small
2291$phpgw_info[
2292\begin_inset Quotes eld
2293\end_inset
2294
2295server
2296\begin_inset Quotes erd
2297\end_inset
2298
2299][
2300\begin_inset Quotes eld
2301\end_inset
2302
2303mail_login_type
2304\begin_inset Quotes erd
2305\end_inset
2306
2307] = This adds support for VMailMgr.
2308 Generally this should be set to 'standard'.
2309
2310\layout Standard
2311
2312
2313\family typewriter
2314\size small
2315$phpgw_info[
2316\begin_inset Quotes eld
2317\end_inset
2318
2319server
2320\begin_inset Quotes erd
2321\end_inset
2322
2323][
2324\begin_inset Quotes eld
2325\end_inset
2326
2327smtp_server
2328\begin_inset Quotes erd
2329\end_inset
2330
2331] = Address of the SMTP server.
2332 Usually this is set to localhost.
2333
2334\layout Standard
2335
2336
2337\family typewriter
2338\size small
2339$phpgw_info[
2340\begin_inset Quotes eld
2341\end_inset
2342
2343server
2344\begin_inset Quotes erd
2345\end_inset
2346
2347][
2348\begin_inset Quotes eld
2349\end_inset
2350
2351smtp_port
2352\begin_inset Quotes erd
2353\end_inset
2354
2355] = This is usually 25, and should only be changed if there is a good reason
2356\layout Subsection
2357
2358NNTP information
2359\layout Standard
2360
2361
2362\family typewriter
2363\size small
2364$phpgw_info[
2365\begin_inset Quotes eld
2366\end_inset
2367
2368server
2369\begin_inset Quotes erd
2370\end_inset
2371
2372][
2373\begin_inset Quotes eld
2374\end_inset
2375
2376nntp_server
2377\begin_inset Quotes erd
2378\end_inset
2379
2380] = Address of the NNTP server.
2381
2382\layout Standard
2383
2384
2385\family typewriter
2386\size small
2387$phpgw_info[
2388\begin_inset Quotes eld
2389\end_inset
2390
2391server
2392\begin_inset Quotes erd
2393\end_inset
2394
2395][
2396\begin_inset Quotes eld
2397\end_inset
2398
2399nntp_port
2400\begin_inset Quotes erd
2401\end_inset
2402
2403] = This is usually XX, and should only be changed if there is a good reason.
2404
2405\layout Standard
2406
2407
2408\family typewriter
2409\size small
2410$phpgw_info[
2411\begin_inset Quotes eld
2412\end_inset
2413
2414server
2415\begin_inset Quotes erd
2416\end_inset
2417
2418][
2419\begin_inset Quotes eld
2420\end_inset
2421
2422nntp_sender
2423\begin_inset Quotes erd
2424\end_inset
2425
2426] = Unknown
2427\layout Standard
2428
2429
2430\family typewriter
2431\size small
2432$phpgw_info[
2433\begin_inset Quotes eld
2434\end_inset
2435
2436server
2437\begin_inset Quotes erd
2438\end_inset
2439
2440][
2441\begin_inset Quotes eld
2442\end_inset
2443
2444nntp_organization
2445\begin_inset Quotes erd
2446\end_inset
2447
2448] = Unknown
2449\layout Standard
2450
2451
2452\family typewriter
2453\size small
2454$phpgw_info[
2455\begin_inset Quotes eld
2456\end_inset
2457
2458server
2459\begin_inset Quotes erd
2460\end_inset
2461
2462][
2463\begin_inset Quotes eld
2464\end_inset
2465
2466nntp_admin
2467\begin_inset Quotes erd
2468\end_inset
2469
2470] = Unknown
2471\layout Subsection
2472
2473Application information
2474\layout Standard
2475
2476Each application has the following information available.
2477
2478\layout Standard
2479
2480
2481\family typewriter
2482\size small
2483$phpgw_info[
2484\begin_inset Quotes eld
2485\end_inset
2486
2487apps
2488\begin_inset Quotes erd
2489\end_inset
2490
2491][
2492\begin_inset Quotes eld
2493\end_inset
2494
2495appname
2496\begin_inset Quotes erd
2497\end_inset
2498
2499][
2500\begin_inset Quotes eld
2501\end_inset
2502
2503title
2504\begin_inset Quotes erd
2505\end_inset
2506
2507] = The title of the application.
2508
2509\layout Standard
2510
2511
2512\family typewriter
2513\size small
2514$phpgw_info[
2515\begin_inset Quotes eld
2516\end_inset
2517
2518apps
2519\begin_inset Quotes erd
2520\end_inset
2521
2522][
2523\begin_inset Quotes eld
2524\end_inset
2525
2526appname
2527\begin_inset Quotes erd
2528\end_inset
2529
2530][
2531\begin_inset Quotes eld
2532\end_inset
2533
2534enabled
2535\begin_inset Quotes erd
2536\end_inset
2537
2538] = If the application is enabled.
2539 True or False.
2540
2541\layout Standard
2542
2543
2544\family typewriter
2545\size small
2546$phpgw_info[
2547\begin_inset Quotes eld
2548\end_inset
2549
2550server
2551\begin_inset Quotes erd
2552\end_inset
2553
2554][
2555\begin_inset Quotes eld
2556\end_inset
2557
2558app_include_dir
2559\begin_inset Quotes erd
2560\end_inset
2561
2562] = Location of the current application include files.
2563
2564\layout Standard
2565
2566
2567\family typewriter
2568\size small
2569$phpgw_info[
2570\begin_inset Quotes eld
2571\end_inset
2572
2573server
2574\begin_inset Quotes erd
2575\end_inset
2576
2577][
2578\begin_inset Quotes eld
2579\end_inset
2580
2581app_template_dir
2582\begin_inset Quotes erd
2583\end_inset
2584
2585] = Location of the current application tpl files.
2586
2587\layout Standard
2588
2589
2590\family typewriter
2591\size small
2592$phpgw_info[
2593\begin_inset Quotes eld
2594\end_inset
2595
2596server
2597\begin_inset Quotes erd
2598\end_inset
2599
2600][
2601\begin_inset Quotes eld
2602\end_inset
2603
2604app_lang_dir
2605\begin_inset Quotes erd
2606\end_inset
2607
2608] = Location of the current lang directory.
2609
2610\layout Standard
2611
2612
2613\family typewriter
2614\size small
2615$phpgw_info[
2616\begin_inset Quotes eld
2617\end_inset
2618
2619server
2620\begin_inset Quotes erd
2621\end_inset
2622
2623][
2624\begin_inset Quotes eld
2625\end_inset
2626
2627app_auth
2628\begin_inset Quotes erd
2629\end_inset
2630
2631] = If the server and current user have access to current application
2632\layout Standard
2633
2634
2635\family typewriter
2636\size small
2637$phpgw_info[
2638\begin_inset Quotes eld
2639\end_inset
2640
2641server
2642\begin_inset Quotes erd
2643\end_inset
2644
2645][
2646\begin_inset Quotes eld
2647\end_inset
2648
2649app_current
2650\begin_inset Quotes erd
2651\end_inset
2652
2653] = name of the current application.
2654\layout Section
2655
2656Using Language Support
2657\layout Subsection
2658
2659Overview
2660\layout Standard
2661
2662phpGroupWare is built using a multi-language support scheme.
2663 This means the pages can be translated to other languages very easily.
2664 Translations of text strings are stored in the phpGroupWare database, and
2665 can be modified by the phpGroupWare administrator.
2666
2667\layout Subsection
2668
2669How to use lang support
2670\layout Standard
2671
2672The lang() function is your application's interface to phpGroupWare's internatio
2673nalization support.
2674\layout Standard
2675
2676While developing your application, just wrap all your text output with calls
2677 to lang(), as in the following code:
2678\latex latex
2679
2680\backslash
2681begin{verbatim}
2682\newline
2683
2684\newline
2685  $x = 42;
2686\newline
2687  echo lang("The counter is %1",$x)."<br />";
2688\newline
2689
2690\newline
2691
2692\backslash
2693end{verbatim}
2694\latex default
2695This will attempt to translate
2696\begin_inset Quotes eld
2697\end_inset
2698
2699The counter is %1
2700\begin_inset Quotes erd
2701\end_inset
2702
2703, and return a translated version based on the current application and language
2704 in use.
2705 Note how the position that $x will end up is controlled by the format string,
2706
2707\series bold
2708not
2709\series default
2710 by building up the string in your code.
2711 This allows your application to be translated to languages where the actual
2712 number is not placed at the end of the string.
2713\layout Standard
2714
2715When a translation is not found, the original text will be returned with
2716 a * after the string.
2717 This makes it easy to develop your application, then go back and add missing
2718 translations (identified by the *) later.
2719\layout Standard
2720
2721Without a specific translation in the lang table, the above code will print:
2722
2723\latex latex
2724
2725\backslash
2726begin{verbatim}
2727\newline
2728
2729\newline
2730The counter is 42*<br />
2731\newline
2732
2733\newline
2734
2735\backslash
2736end{verbatim}
2737\latex default
2738 If the current user speaks Italian, they string returned may instead be:
2739
2740\latex latex
2741
2742\backslash
2743begin{verbatim}
2744\newline
2745
2746\newline
2747il contatore � 42<br />
2748\newline
2749
2750\newline
2751
2752\backslash
2753end{verbatim}
2754\layout Subsubsection*
2755
2756The lang function
2757\layout Standard
2758
2759
2760\latex latex
2761
2762\backslash
2763begin{verbatim}
2764\newline
2765
2766\newline
2767lang($key, $m1="", $m2="", $m3="", $m4="", $m5="",
2768\newline
2769          $m6="", $m7="", $m8="", $m9="", $m10="")
2770\newline
2771
2772\newline
2773
2774\backslash
2775end{verbatim}
2776\layout Description
2777
2778
2779\series bold
2780$key
2781\series default
2782\SpecialChar ~
2783
2784\begin_deeper
2785\layout Standard
2786
2787is the string to translate and may contain replacement directives of the
2788 form %n.
2789\newline
2790
2791\end_deeper
2792\layout Description
2793
2794
2795\series bold
2796$m1
2797\series default
2798\SpecialChar ~
2799
2800\begin_deeper
2801\layout Standard
2802
2803is the first replacement value or may be an array of replacement values
2804 (in which case $m2 and above are ignored).
2805\end_deeper
2806\layout Description
2807
2808
2809\series bold
2810$m2\SpecialChar ~
2811-\SpecialChar ~
2812$m10
2813\series default
2814\SpecialChar ~
2815
2816\begin_deeper
2817\layout Standard
2818
2819the 2nd through 10th replacement values if $m1 is not an array.
2820\end_deeper
2821\layout Standard
2822
2823The database is searched for rows with a lang.message_id that matches $key.
2824 If a translation is not found, the original $key is used.
2825 The translation engine then replaces all tokens of the form %N with the
2826 Nth parameter (either $m1[N] or $mN).
2827
2828\layout Subsubsection*
2829
2830Adding translation data
2831\layout Standard
2832
2833An application called
2834\series bold
2835Transy
2836\series default
2837 is being developed to make this easier, until then you can create the translati
2838on data manually.
2839
2840\layout Subsubsection*
2841
2842The lang table
2843\layout Standard
2844
2845The translation class uses the lang table for all translations.
2846 We are concerned with 4 of the columns to create a translation:
2847\layout Description
2848
2849
2850\series bold
2851message_id
2852\series default
2853\SpecialChar ~
2854
2855\begin_deeper
2856\layout Standard
2857
2858The key to identify the message (the $key passed to the lang() function).
2859 This is written in English.
2860\end_deeper
2861\layout Description
2862
2863
2864\series bold
2865app_name
2866\series default
2867\SpecialChar ~
2868
2869\begin_deeper
2870\layout Standard
2871
2872The application the translation applies to, or common if it is common across
2873 multiple applications.
2874\end_deeper
2875\layout Description
2876
2877
2878\series bold
2879lang
2880\series default
2881\SpecialChar ~
2882
2883\begin_deeper
2884\layout Standard
2885
2886The code for the language the translation is in.
2887\end_deeper
2888\layout Description
2889
2890
2891\series bold
2892content
2893\series default
2894\SpecialChar ~
2895
2896\begin_deeper
2897\layout Standard
2898
2899The translated string.
2900\end_deeper
2901\layout Subsubsection*
2902
2903lang.sql
2904\layout Standard
2905
2906Currently all applications, and the core phpGroupWare source tree have a
2907 lang.sql file.
2908 This is the place to add translation data.
2909 Just add lines of the form:
2910\latex latex
2911
2912\backslash
2913begin{verbatim}
2914\newline
2915
2916\newline
2917REPLACE INTO lang (message_id, app_name, lang, content)
2918\newline
2919VALUES( 'account has been deleted','common','en','Account has been deleted');
2920\newline
2921
2922\newline
2923
2924\backslash
2925end{verbatim}
2926\latex default
2927translating the content to reflect the message_id string in the lang language.
2928 If the string is specific to your application, put your application name
2929 in for app_name otherwise use the name common.
2930 The message_id should be in lower case for a small increase in speed.
2931
2932\layout Subsection
2933
2934Common return codes
2935\layout Standard
2936
2937If you browse through the phpGroupWare sources, you may notice a pattern
2938 to the return codes used in the higher-level functions.
2939 The codes used are partially documented in the doc/developers/CODES file.
2940\layout Standard
2941
2942Codes are used as a simple way to communicate common error and progress
2943 conditions back to the user.
2944 They are mapped to a text string through the check_code() function, which
2945 passes the strings through lang() before returning.
2946\layout Standard
2947
2948For example, calling
2949\latex latex
2950
2951\backslash
2952begin{verbatim}
2953\newline
2954
2955\newline
2956echo check_code(13);
2957\newline
2958
2959\newline
2960
2961\backslash
2962end{verbatim}
2963\latex default
2964Would print
2965\latex latex
2966
2967\backslash
2968begin{verbatim}
2969\newline
2970
2971\newline
2972Your message has been sent
2973\newline
2974
2975\newline
2976
2977\backslash
2978end{verbatim}
2979\latex default
2980 translated into the current language.
2981\layout Section
2982
2983Using Templates
2984\layout Subsection
2985
2986Overview
2987\layout Standard
2988
2989phpGroupWare is built using a templates based design.
2990 This means the display pages, stored in tpl files, can be translated to
2991 other languages, made to look completely different.
2992
2993\layout Subsection
2994
2995How to use templates
2996\layout Standard
2997
2998Some instructions on using templates:
2999\layout Standard
3000
3001For Further info read the PHPLIBs documentation for their template class.
3002
3003\begin_inset LatexCommand \url{http://phplib.netuse.de}
3004
3005\end_inset
3006
3007
3008\layout Section
3009
3010About this document
3011\layout Subsection
3012
3013New versions
3014\layout Standard
3015
3016The newest version of this document can be found on our website
3017\latex latex
3018
3019\backslash
3020url{http://www.phpgroupware.org}
3021\latex default
3022 as lyx source, HTML, and text.
3023\layout Subsection
3024
3025Comments
3026\layout Standard
3027
3028Comments on this HOWTO should be directed to the phpGroupWare developers
3029 mailing list phpgroupware-developers@lists.sourceforge.net
3030\layout Standard
3031
3032To subscribe, go to
3033\latex latex
3034
3035\backslash
3036url{http://sourceforge.net/mail/?group}
3037\latex default
3038_id=7305
3039\layout Subsection
3040
3041History
3042\layout Standard
3043
3044This document was written by Dan Kuykendall.
3045\layout Standard
3046
30472000-09-25 documentation on lang(), codes, administration and preferences
3048 extension added by Steve Brown.
3049
3050\layout Standard
3051
30522001-01-08 fixed directory structure, minor layout changes, imported to
3053 lyx source - Darryl VanDorp
3054\layout Subsection
3055
3056Copyrights and Trademarks
3057\layout Standard
3058
3059Copyright (c) Dan Kuykendall.
3060 Permission is granted to copy, distribute and/or modify this document under
3061 the terms of the GNU Free Documentation License, Version 1.1 or any later
3062 version published by the Free Software Foundation.
3063
3064\layout Standard
3065
3066A copy of the license is available at
3067\begin_inset LatexCommand \url{http://www.gnu.org/copyleft/gpl.html}
3068
3069\end_inset
3070
3071
3072\layout Subsection
3073
3074Acknowledgments and Thanks
3075\layout Standard
3076
3077Thanks to Joesph Engo for starting phpGroupWare (at the time called webdistro).
3078 Thanks to all the developers and users who contribute to making phpGroupWare
3079 such a success.
3080
3081\the_end
3082