xref: /web-php/git-php.php (revision b0763029)
1<?php
2$_SERVER['BASE_PAGE'] = 'git-php.php';
3include_once __DIR__ . '/include/prepend.inc';
4include_once __DIR__ . '/include/email-validation.inc';
5include_once __DIR__ . '/include/posttohost.inc';
6
7// Force the account requests to php.net
8if (!is_primary_site()) {
9    header('Location: https://www.php.net/' . $_SERVER['BASE_PAGE']);
10    exit;
11}
12
13$SIDEBAR_DATA = '
14<h3>More about Git</h3>
15<p>
16 You can find more information about Git and download clients for most major
17 platforms at <a href="http://git-scm.com/">the official Git site</a>.
18</p>
19
20<h3>Git access</h3>
21<p>
22 If you would like to grab PHP sources or other PHP.net
23 hosted project data from PHP.net, you can also use
24 <a href="/git.php">Git</a>. No Git account is required.
25</p>
26';
27site_header("Using Git for PHP Development", ["current" => "community"]);
28
29$groups = [
30    "none" => "Choose One",
31    "php" => "PHP Group",
32    "pear" => "PEAR Group",
33    "pecl" => "PECL Group",
34    "doc" => "Doc Group",
35];
36
37?>
38
39<h1 class="content-header">Using Git for PHP Development</h1>
40
41<?php
42
43// We have a form submitted, and the user have read all the comments
44if (count($_POST) && (!isset($_POST['purpose']) || !is_array($_POST['purpose']) || !count($_POST['purpose']))) {
45    // No error found yet
46    $error = "";
47
48    // Check for errors
49    if (empty($_POST['id'])) {
50        $error .= "You must supply a desired Git user id. <br>";
51    } elseif (!preg_match('!^[a-z]\w+$!', $_POST['id']) || strlen($_POST['id']) > 16) {
52        $error .= "Your user id must be from 1-16 characters long, start with " .
53                  "a letter and contain nothing but a-z, 0-9, and _ <br>";
54    }
55    if (empty($_POST['fullname'])) {
56        $error .= "You must supply your real name. <br>";
57    }
58    if (empty($_POST['realpurpose'])) {
59        $error .= "You must supply a reason for requesting the Git account. <br>";
60    }
61    if (empty($_POST['password'])) {
62        $error .= "You must supply a desired password. <br>";
63    }
64    if (empty($_POST['email']) || !is_emailable_address($_POST['email'])) {
65        $error .= "You must supply a proper email address. <br>";
66    }
67    if (empty($_POST['yesno']) || $_POST['yesno'] != 'yes') {
68        $error .= "You did not fill the form out correctly. <br>";
69    }
70    if (empty($_POST['group']) || $_POST['group'] === 'none' || !isset($groups[$_POST['group']])) {
71        $error .= "You did not fill out where to send the request. <br>";
72    }
73    if (empty($_POST['guidelines'])) {
74        $error .= "You did not agree to follow the contribution guidelines. <br>";
75    }
76
77    // Post the request if there is no error
78    if (!$error) {
79        $error = posttohost(
80            "https://main.php.net/entry/svn-account.php",
81            [
82                "username" => $_POST['id'],
83                "name" => $_POST['fullname'],
84                "email" => $_POST['email'],
85                "passwd" => $_POST['password'],
86                "note" => $_POST['realpurpose'],
87                "yesno" => $_POST['yesno'],
88                "group" => $_POST['group'],
89            ],
90        );
91        // Error while posting
92        if ($error) {
93            $error = "An error occurred when trying to create the account: $error.";
94        }
95    }
96
97    // Some error was found, while checking or submitting the data
98    if ($error) {
99        echo "<div class=\"warning\"><p>$error</p></div>";
100    }
101    else {
102?>
103<p>
104 Thank you. Your request has been sent. You should hear something within the
105 next week or so. If you haven't heard anything by around <?php echo date('l, F jS', time() + 604800); ?>
106 then please send an email to the appropriate <a href="/mailing-lists.php">mailing list</a>:
107</p>
108<ul>
109 <li>Internals:     <a href="mailto:internals@lists.php.net">internals@lists.php.net</a></li>
110 <li>Documentation: <a href="mailto:phpdoc@lists.php.net">phpdoc@lists.php.net</a></li>
111 <li>PECL:          <a href="mailto:pecl-dev@lists.php.net">pecl-dev@lists.php.net</a></li>
112 <li>PEAR:          <a href="mailto:pear-dev@lists.php.net">pear-dev@lists.php.net</a></li>
113 <li>Other:         <a href="mailto:group@php.net">group@php.net</a></li>
114</ul>
115<p>
116 This is to let us know that we've
117 forgotten you, but you haven't forgotten us! It happens. There's several of
118 us, and sometimes we think that someone else has taken care of your request,
119 and they think that we took care of it. Sorry. You can also speed up the
120 process by having an existing Git account holder who works in the area you are
121 interested in mail us to vouch for you.
122</p>
123
124<p>
125 If you are not familiar with Git, you should have a look at the various
126 documentation resources available at
127 <a href="http://git-scm.com/">the official Git site</a>.  This is also where
128 to get the most recent version of the Git client.
129</p>
130
131<p>
132 All Git commit messages to the PHP sources get sent to the php-git mailing lists.
133 You should subscribe yourself to one or more of these mailing lists. Instructions
134 for subscribing are on the <a href="/mailing-lists.php">Mailing Lists</a> page.
135</p>
136
137<p>
138 Git itself is quite easy to use. You can follow the steps listed on the
139 <a href="/git.php">Git</a> page for checking out your tree.  Please note that
140 you do not have to log in to check out your tree; you will not be asked for
141 your username and password until you attempt to commit changes.
142</p>
143
144<p>
145 The <a href="https://wiki.php.net/vcs/gitworkflow">Git workflow</a> and
146 <a href="https://wiki.php.net/vcs/gitfaq">Git FAQ</a> pages on the Wiki are
147 good starting points to learn how we use Git to develop PHP. Beyond that, you
148 can familiarise yourself with Git in general via the
149 <a href="http://git-scm.com/documentation">Git documentation</a> and the
150 <a href="http://progit.org/">Pro Git</a> book.  They should all be executed
151 from within the checked out tree. eg.  <code>cd php-src</code>.
152</p>
153
154<?php
155        site_footer();
156        exit;
157    } // endif: no error found
158} // endif: no data or checkread not checked
159
160else {
161    if (count($_POST)) {
162        echo <<<EOT
163<div class="warning">
164<p>
165 We could not have said it more clearly. Read everything on
166 this page and look at the form you are submitting carefully.
167</p>
168</div>
169EOT;
170    }
171?>
172
173<div class="content-box">
174<p>
175 All PHP development is done through a distributed revision control system
176 called Git. This helps us track changes and it makes it possible for people
177 located in all corners of the world to collaborate on a project without
178 having to worry about stepping on each others' toes.
179</p>
180
181<p>
182 Please note that you do <strong>not</strong> need a Git account to <a
183 href="/git.php"><strong>access</strong> the Git tree</a>, to use PHP,
184 or to write PHP scripts. You only need a Git account if you will be a
185 regular contributor to the development of PHP itself.
186</p>
187
188<p>
189 And once again, since people just don't seem to understand this point:
190</p>
191</div>
192
193<table border="0" cellpadding="3" class="standard">
194 <tr>
195  <th>Does Not Require Git Account</th>
196  <th>Requires Git Account</th>
197 </tr>
198 <tr>
199  <td class="sub">Learning PHP</td>
200  <td>Developing the PHP runtime</td>
201 </tr>
202 <tr>
203  <td class="sub">Coding in PHP</td>
204  <td>Maintaining an official, bundled PHP extension</td>
205 </tr>
206 <tr>
207  <td class="sub">Reading the PHP source</td>
208  <td><a href="https://doc.php.net/guide/">Maintaining the documentation</a></td>
209 </tr>
210 <tr>
211  <td class="sub">Using PHP extensions</td>
212  <td><a href="https://doc.php.net/guide/">Translating the documentation</a></td>
213 </tr>
214 <tr>
215  <td class="sub">Creating experimental PHP extensions</td>
216  <td>Maintaining php.net</td>
217 </tr>
218 <tr>
219  <td class="sub">Submitting a patch to PHP</td>
220  <td>&nbsp;</td>
221 </tr>
222 <tr>
223  <td class="sub">Adding notes to the documentation</td>
224  <td>&nbsp;</td>
225 </tr>
226 <tr>
227  <td class="sub">Writing web pages with PHP</td>
228  <td>&nbsp;</td>
229 </tr>
230</table>
231
232<h3 class="content-header">Contributing patches</h3>
233<p class="content-box">
234 If you are contributing a patch, a small fix, or another minor change you do
235 not need to ask for a Git account before submitting it. Fork our
236 <a href="https://github.com/php/php-src">GitHub repository</a> and create a
237 <a href="https://docs.github.com/en/pull-requests">pull request</a>, attach
238 a patch to a
239 <a href="https://bugs.php.net/">bug report or feature request</a>,
240 or send your patch to
241 <a href="mailto:internals@lists.php.net">the Internals mailing list</a>. If
242 you send the patch to Internals, you should
243 <a href="mailto:internals-subscribe@lists.php.net">subscribe to that list</a>
244 to participate in any discussion your patch generates! Your patch may
245 not get noticed the first time. Make sure that when you send your patch, you
246 explain what it does. Make sure you use a clear subject when sending your
247 patch (you might even want to prefix it with <code>"[PATCH]"</code>). If nobody
248 seems to take notice after a few days, you might want to try resubmitting it.
249 Your original message might have gotten missed because of another heated
250 discussion.
251</p>
252
253<p>
254 Submitting patches and participating in the discussion on the Internals list
255 <strong>before</strong> requesting full Git access is strongly suggested, so
256 the PHP development team can get to know you and what you'll be contributing.
257 It is suggested that all PHP developers (<strong>people developing PHP
258 itself</strong>, not people developing in PHP) subscribe to this list.
259 Similarly, if you plan on contributing documentation, you should
260 <a href="mailto:phpdoc-subscribe@lists.php.net">subscribe to the
261 documentation mailing list</a>, and read the
262 <a href="https://doc.php.net/guide/">PHP Documentation contribution guide</a>.
263</p>
264
265<p>
266 If you wish to contribute to the documentation please contact the translation
267 team for the language you wish to help with. If you have trouble finding the
268 team, ask on the phpdoc mailing list. Once you have made contact you may
269 apply for a Git/SVN account here by including the name of one or more people
270 from the existing translation team that referred you and of course the
271 language you wish to translate to.
272</p>
273
274<p>
275 If you have a new PEAR package you wish to contribute, propose it
276 through the <a href="http://pear.php.net/pepr/">PEPR system</a> on
277 <a href="http://pear.php.net/">the PEAR website</a>. If you have a new PECL
278 extension you wish to contribute, bring it up on the appropriate
279 <a href="http://pecl.php.net/support.php">PECL mailing list</a> first.
280</p>
281
282<p>
283 Once your PEAR package has been approved, or you get the sense that
284 people generally agree that your PECL contribution is worthwhile, you
285 may apply for a Git account here. Specify the name of your PEAR package
286 or PECL contribution (single word Git module name) and also reference an
287 existing account holder who can vouch for your contribution, or provide
288 a link to your PEAR proposal.
289</p>
290
291<p>
292 Okay, if you are still reading, then you may actually need a Git account.
293 This is <strong>not</strong> an automatic process. Fill in the form below to
294 request an account. In the box next to "Purpose", describe what it is that
295 you intend to do with Git access. If it isn't clear from what you've
296 described already, tell us what parts of the Git repository you need access
297 to (for example, "phpdoc" is the documentation tree, "php-src/ext/readline"
298 is the PHP readline extension). If someone told you to fill out the form
299 here, make sure to mention them here!
300</p>
301
302<p>
303 The Git account, once granted and activated (which could take a while, so be
304 patient!), gives you access to a number of things. First, and most
305 importantly, it gives you access to modify those parts of the PHP Git tree for
306 which you have requested and been granted access. It also allows you to comment
307 on and close bugs in our <a href="http://bugs.php.net/">bug database</a>, and
308 allows you to modify the documentation notes in the <a href="/manual/">annotated
309 manual</a>. Your Git account also translates into a foo@php.net forwarding email
310 address where <strong>foo</strong> is your Git user id. Feel free to use it!
311</p>
312
313<p>
314 If you get no response to an account request after a while, remember this is a
315 manual process, then please contact the relevant mailing list that belongs to
316 the part of PHP you requested access to.
317</p>
318
319<h2>Request a Git account</h2>
320
321<p class="warn">
322 Please note that you do <em>NOT</em> need a Git account to study PHP. You do
323 <em>NOT</em> need a Git account to learn PHP, to use PHP or to in any way do
324 anything at all with PHP. If you are sitting there wondering if you need a
325 Git account, then you don't! If an existing Git account holder suggested you
326 request an account, please mention their Git id in the request.
327</p>
328<p class="warn">
329 Also note that information provided here will be sent to a public
330 mailing list.
331</p>
332<p class="warn">
333 Please do <strong>NOT</strong> submit account requests if you have not previously
334 contributed any work such as patches to PHP.
335</p>
336<p class="warn">
337 If someone told you to fill in an account request because you are a developer of
338 a certain extension, for example a <a href="http://pecl.php.net/">PECL</a> extension,
339 then please state who told you to submit this request in the purpose text field below.
340</p>
341
342<?php
343} // endif: no data submitted
344
345?>
346<form action="/git-php.php" method="post">
347<table border="0" class="standard" style="width: 80%;">
348<tr>
349 <th class="subr">Full Name:</th>
350 <td><input type="text" size="50" name="fullname"
351      class="max" value="<?php if (isset($_POST['fullname'])) echo clean($_POST['fullname']);?>"></td>
352</tr>
353<tr>
354 <th class="subr">Email:</th>
355 <td><input type="text" size="50" name="email"
356      class="max" value="<?php if (isset($_POST['email'])) echo clean($_POST['email']);?>"></td>
357</tr>
358<tr>
359 <th class="subr">For what purpose do you require a Git account:<br>
360 (check all that apply)</th>
361 <td>
362<?php
363$purposes = ["Learning PHP", "Coding in PHP", "Reading the PHP source",
364    "Using PHP extensions", "Creating experimental PHP extensions",
365    "Submitting a patch to PHP", "Adding notes to the documentation",
366    "Writing web pages with PHP"];
367
368foreach ($purposes as $i => $p) { ?>
369  <input type="checkbox" name="purpose[<?php echo $i?>]" value="1"
370	checked="checked" id="vcs-purpose-<?php echo $i; ?>"> <label for="vcs-purpose-<?php echo $i; ?>"><?php echo $p; ?></label><br>
371<?php } ?>
372 </td>
373</tr>
374<tr>
375 <th class="subr">If your intended purpose is not in the list, <br>please state it here:</th>
376 <td><textarea cols="50" rows="5" name="realpurpose" class="max"><?php if (isset($_POST['realpurpose'])) echo clean($_POST['realpurpose']);?></textarea></td>
377</tr>
378<tr>
379<th class="subr">Do you agree to follow the <a href="license/contrib-guidelines-code.php">contribution guidelines</a>?</th>
380<td><input type="checkbox" name="guidelines" value="1" id="vcs-guidelines"> <label for="vcs-guidelines">Check the box if you agree</label></td>
381</tr>
382<tr>
383 <th class="subr">User ID:<br> <small>(single word, lower case, max 16 characters)</small></th>
384 <td><input type="text" size="10" name="id"
385      class="max" value="<?php if (isset($_POST['id'])) echo clean($_POST['id']);?>"></td>
386</tr>
387<tr>
388 <th class="subr">Requested Password:</th>
389 <td><input type="password" size="10" name="password"
390      class="max" value="<?php if (isset($_POST['password'])) echo clean($_POST['password']);?>"></td>
391</tr>
392<tr>
393 <th class="subr">Did you fill this form out correctly (yes/no)?</th>
394 <td><input type="text" size="10" name="yesno" class="max" value="no"></td>
395</tr>
396<tr>
397 <th class="subr">Type of initial karma (who to send this request to):</th>
398 <td>
399  <select name="group">
400<?php
401foreach ($groups as $group => $name) {
402  $selected = (isset($_POST["group"]) && $_POST["group"] == $group) ? ' selected="selected"' : '';
403  echo "<option value='$group'$selected>$name</option>\n";
404}
405?>
406  </select>
407 </td>
408</tr>
409<tr>
410 <th colspan="2"><input type="submit" value="Send Request"></th>
411</tr>
412</table>
413</form>
414
415<?php site_footer();
416