1
|
DEVELOPER INFO
|
2
|
--------------
|
3
|
|
4
|
phpPgAdmin is Open Source, so you're invited to contribute to it.
|
5
|
Many great features have been written by other people and you too
|
6
|
can help to make phpPgAdmin a useful tool.
|
7
|
|
8
|
phpPgAdmin 3 has its roots in the phpPgAdmin 2.4 software. A complete
|
9
|
rewrite was necessary to support PostgreSQL 7.3 and to address problems
|
10
|
in the phpPgAdmin 2.4 codebase.
|
11
|
|
12
|
If you're planning to contribute source code, please read the following
|
13
|
information:
|
14
|
|
15
|
The following method is preferred for new developers:
|
16
|
- fetch the current CVS tree over anonymous CVS:
|
17
|
|
18
|
cvs -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/phppgadmin login
|
19
|
[Password: ] simply press the Enter key!
|
20
|
|
21
|
cvs -z3 -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/phppgadmin co -d phpPgAdmin webdb
|
22
|
[This will create a new sub-directory named phpPgAdmin]
|
23
|
|
24
|
- Add your stuff
|
25
|
- Send us the file(s) you've modified or send us a patch (preferred). To generate a patch, do this
|
26
|
in your 'phpPgAdmin' directory:
|
27
|
|
28
|
cvs diff -c > file.txt
|
29
|
|
30
|
Then, just send us the file.txt
|
31
|
|
32
|
Please note submitting code is considered a transfer of copyright to the phpPgAdmin project.
|
33
|
|
34
|
Only project developers can access the CVS tree via ssh and SSH1 must
|
35
|
be installed on your client machine.
|
36
|
|
37
|
export CVS_RSH=ssh
|
38
|
|
39
|
login once with ssh to developername@cvs.phppgadmin.sourceforge.net to create required
|
40
|
user directories on the server.
|
41
|
|
42
|
cvs -z3 -d developername@cvs.sourceforge.net:/cvsroot/phppgadmin co -d phpPgAdmin webdb
|
43
|
|
44
|
Write access to the CVS tree is granted only to developers who have already
|
45
|
contributed something useful to phpPgAdmin. If you're interested in that,
|
46
|
please contact us.
|
47
|
|
48
|
TIPS FOR DEVELOPERS
|
49
|
-------------------
|
50
|
|
51
|
When you submit code to phpPgAdmin, we do expect it to adhere to the existing
|
52
|
coding standards in the source. So, instead of using your personal favourite
|
53
|
code layout style, please format it to look like surrounding code.
|
54
|
|
55
|
Test your code properly! Say you are developing a feature to create domains.
|
56
|
Try naming your domain all of the following:
|
57
|
|
58
|
* "
|
59
|
* '
|
60
|
* \
|
61
|
* words with spaces
|
62
|
* <br><br><br>
|
63
|
|
64
|
If you are adding a new class function, be sure to use the "clean",
|
65
|
"fieldClean", "arrayClean" and "fieldArrayClean" functions to properly escape
|
66
|
odd characters in user input. Examine existing functions that do similar
|
67
|
things to yours to get yours right.
|
68
|
|
69
|
When writing data to the display, you should always urlencode() variables in
|
70
|
HREFs and htmlspecialchars() variables in forms.
|
71
|
|
72
|
COMMON VARIABLES
|
73
|
----------------
|
74
|
|
75
|
$data - A data connection to the current or default database.
|
76
|
$misc - Contains miscellaneous functions. eg. printing headers and footers, etc.
|
77
|
$lang - Global array containing translated strings. The strings in this array have already
|
78
|
been converted to HTML, so you should not htmlspecialchars() them.
|
79
|
$conf - Global array of configuration options.
|
80
|
|
81
|
WORKING WITH RECORDSETS
|
82
|
-----------------------
|
83
|
|
84
|
phpPgAdmin uses the ADODB database library for all its database access. We have
|
85
|
also written our own wrapper around the ADODB library to make it more object
|
86
|
oriented (ADODB_base.pclass).
|
87
|
|
88
|
This is the general form for looping over a recordset:
|
89
|
|
90
|
$rs = $class->getResults();
|
91
|
if (is_object($rs) && $rs->recordCount() > 0) {
|
92
|
while (!$rs->EOF) {
|
93
|
echo $rs->f['field'];
|
94
|
$rs->moveNext();
|
95
|
}
|
96
|
}
|
97
|
else echo "No results.";
|
98
|
|