3 ******************************************************************************************************
4 ******************************************************************************************************
9 *** $Copyright:: ©2008, Profi-Concept aka Wolfgang Stelzhammer , All rights reserved. $ ***
10 *** $ License:: The BSD License $ ***
11 *** $ Redistribution and use in source and binary forms, with or without modification, $ ***
12 *** $ are permitted provided that the following conditions are met: $ ***
14 *** $ - Redistributions of source code must retain the above copyright notice, $ ***
15 *** $ this list of conditions and the following disclaimer. $ ***
16 *** $ - Redistributions in binary form must reproduce the above copyright notice, $ ***
17 *** $ this list of conditions and the following disclaimer in the documentation and/or $ ***
18 *** $ other materials provided with the distribution. $ ***
19 *** $ - Neither the name "Profi-Concept" or "Wolfgang Stelzhammer" nor the names of its $ ***
20 *** $ contributors may be used to endorse or promote products derived from this software $ ***
21 *** $ without specific prior written permission. $ ***
23 *** $ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY $ ***
24 *** $ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF $ ***
25 *** $ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL $ ***
26 *** $ THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, $ ***
27 *** $ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT $ ***
28 *** $ OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) $ ***
29 *** $ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, $ ***
30 *** $ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS $ ***
31 *** $ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $ ***
32 ******************************************************************************************************
33 *** With some XHTML hacks and mcedit ("Cool Edit") improvements by Roland Haeder ***
34 ******************************************************************************************************
35 ******************************************************************************************************
37 define('SVN_REPO_URL', "http://mxchange.org/repos/mailer/branches/0.2.1-FINAL");
38 //define('SVN_REPO_URL', "file:///E:/Webscripte/MXChange/local_mirror/branches/0.2.1-FINAL");
39 define('SVN_UUID', "");
42 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
43 "http://www.w3.org/TR/html4/loose.dtd">
47 <title>SVN-Installer --> [Mailer - Mail Exchange] v0.2.1-FINAL</title>
48 <style type="text/css">
51 background-color: #EEFFEE;
53 font-family: Verdana, Arial, Geneva, Helvetica, sans-serif;
56 scrollbar-base-color: #E9E4AE;
57 scrollbar-face-color: #CDEFCD;
58 scrollbar-highlight-color: #EEFFEE;
59 scrollbar-shadow-color: #CDEFCD;
60 scrollbar-3dlight-color: #DDDDDD;
61 scrollbar-arrow-color: #000000;
62 scrollbar-track-color: #CCEFCC;
63 scrollbar-darkshadow-color: #999999;
79 font-family: Verdana, Arial, Geneva, Helvetica, sans-serif;
80 text-decoration: none;
93 background-color: transparent;
97 background-color: transparent;
102 background-color: #EEFFEE;
103 border: 1px solid #AA0044;
104 text-decoration: none;
105 border-style: groove;
109 background-color: #EEFFEE;
110 border: solid 1px #009900;
112 text-decoration: none;
113 border-style: groove;
127 background-color: #fffff0;
133 background-color: #fffff0;
143 <h2>SVN-Installer --> [Mailer - Mail Exchange] v0.2.1-FINAL<br />
144 <span style="font-size: 8pt;">Installer-Version 0.1.1<br />
145 ©2008, Profi-Concept aka Wolfgang Stelzhammer , All rights
146 reserved.</span></h2>
148 <span class="hl">Prüfe SVN-Version: </span>
153 function doSetup () {
155 if ((isset($_GET['revision'])) && (!empty($_GET['revision']))) {
156 $rev = '-r '.$_GET['revision'];
160 switch ($_GET['type']) {
162 $befehl = 'svn checkout '.$rev.$_GET['svn_url'].' '.$_GET['path'];
165 $befehl = 'svn export --force '.$rev.$_GET['svn_url'].' '.$_GET['path'];
169 $ausg = proc_get($befehl);
170 //echo '<pre>$befehl:'.print_r($befehl, true).'</pre>';
172 //echo '<pre>$ausg:'.print_r($ausg, true).'</pre>';
173 echo '<p class="hl">Führe SVN-'.$_GET['type'].' durch ...</p>';
175 if (!isset($_GET['svn_detail']) || $_GET['svn_detail'] != '1') $t[] = $ausg[count($ausg)-1];
180 <table border="1" cellpadding="5" cellspacing="1"
181 style="margin-left: 20px;">
183 <td class="hl">SVN Ausgabe</td>
184 <td class="pos" style="border: #00000 1px solid;"><?php echo implode("<br />\n",$t) ?></td>
191 $owner = fileowner($_GET['path']);
193 mkdir($_GET['path']. $uid);
194 $nowner = fileowner($_GET['path']. $uid);
195 //$group = filegroup($_GET['path']);
196 rmdir($_GET['path']. $uid);
199 if ($owner != $nowner) {
200 //echo '<pre>$owner:'.print_r($owner, true).'</pre>';
201 //echo '<pre>$nowner:'.print_r($nowner, true).'</pre>';
202 echo '<span class="hl">Setze Dateirechte, da Webserver-Benuzter von Ordner-Eigentüber abweicht ...</span>';
203 proc_get('chmod -R 0766 '.$_GET['path']);
204 echo '<span class="pos">Dateirechte auf 0766 gesetzt</span><br /><br />';
209 <span class="pos">SVN-Installation erfolgreich abgeschlossen.</span>
213 <form action="<?php echo $_GET['mailer_url'] . "\""; ?> method="GET">
214 <div style="margin-left: 20px;"><input type="submit" name="submit"
215 value="Installations-Script von Mailer aufrufen" /></div>
221 function proc_get ($cmd) {
223 $res = popen($cmd, 'r');
225 while ($res && !feof($res)) {
226 $t = trim(fgets($res));
233 if (count($buffer) <= 0) {
240 $ausg = proc_get('svn --version --quiet');
243 echo '<h2 style="text-align:center; padding-top: 10px; padding-bottom: 10px;" class="neg">Fehler: Es konnte kein SVN-Client gefunden werden!<br />
244 Bitte installieren Sie SVN (<a href="http://http://subversion.tigris.org/">http://subversion.tigris.org/</a>).</h2>';
248 echo '<span class="hl">Installierte SVN Version: </span><span class="pos">'.$ausg[0].'</span><br />';
249 //echo '<pre>$ausg:'.print_r($ausg, true).'</pre>';
250 if (!isset($_GET['step'])) {
253 $step = $_GET['step'];
260 <form action="" method="GET">
261 <div style="margin-left: 20px;"><input type="hidden" name="step"
263 <p class="hl">Installations-Parameter</p>
264 <table border="1" cellpadding="5" cellspacing="1">
266 <td class="hl" nowrap style="border-bottom: 0px solid;">Setup-Art:</td>
267 <td colspan="2"><select name="type">
268 <option value="checkout">checkout (Standard)</option>
269 <option value="export">export</option>
273 <td style="border-top: 0px solid; border-bottom: 0px solid;"></td>
274 <td class="hl" nowrap>Chekout:<br />
276 <td width="400">Bei dieser Option wird ein Working-Direktory erstellt.
277 Hiermit kann ganz einfach mittels eines SVN-Updates das Script
278 geupdated werden.</td>
281 <td style="border-top: 0px solid;"></td>
282 <td class="hl" nowrap>Export:</td>
283 <td width="400">Hier wird nur ein "einfacher" Export
284 ausgeführt und keine Versions-Information gespeichert.</td>
287 <td class="hl" nowrap style="border-bottom: 0px solid;">Setup-Verzeichnis:</td>
288 <td colspan="2"><input size="80" maxlength="254" type="text"
290 value="<?php echo str_replace("\\", '/', dirname(__FILE__)) . "/\""; ?> /></td>
293 <td style="border-top: 0px solid;"></td>
294 <td class="hl" nowrap>Absoluter Pfad:</td>
295 <td width="400">Standardmäßig ist hier der Pfad des Scriptes angegeben. Ein nicht vorhandenes Verzeichniss wird erstellt.</td>
298 <td class="hl" nowrap style="border-bottom: 0px solid;">Mailer-URL:</td>
299 <td colspan="2"><input size="80" maxlength="254" type="text" name="mailer_url" value="<?php echo 'http://' . getenv('SERVER_NAME') . str_replace("\\", '/', dirname($_SERVER['PHP_SELF']))."/\""; ?> /></td>
302 <td style="border-top: 0px solid;"></td>
303 <td class="hl" nowrap>Mailer-URL:</td>
304 <td width="400">Dies ist die URL von wo aus der Mailer aufgerufen werden kann. Standardmäßig ist hier die URL des Scriptes angegeben.</td>
307 <td class="hl" nowrap style="border-bottom: 0px solid;">SVN-Repository:</td>
308 <td colspan="2"><input size="80" maxlength="254" type="text" name="svn_url" value="<?php echo constant('SVN_REPO_URL') . "\""; ?> /></td>
311 <td style="border-top: 0px solid;"></td>
312 <td class="hl" nowrap>SVN-Server-URL:</td>
313 <td width="400">URL zum SVN-Server von [Mailer - Mail Exchange] v0.2.1-FINAL. Standard-URL ist hier <span class="hl"><?php echo constant('SVN_REPO_URL'); ?></span>. Bitte nur ändern, wenn Sie einen lokalen SVN-Mirror erstellt haben oder eine andere Version von Mailer-Project installieren möchten.</td>
316 <td class="hl" nowrap style="border-bottom: 0px solid;">Optionen:</td>
317 <td colspan="2" class="hl">
318 Head-Revision: <input type="checkbox" name="head_revision" value="1" checked="checked"><br />
319 SVN Detail-Ausgabe: <input type="checkbox" name="svn_detail" value="1">
322 <td style="border-top: 0px solid;border-bottom: 0px solid;"></td>
323 <td class="hl" nowrap>Head-Revision:</td>
324 <td width="400">Wird diese Option gewählt, so wird automatisch die HEAD-Revision verwendet. Sonst kann in einem weiteren Schritt eine entsprechende Revision ausgewählt werden.</td>
327 <td style="border-top: 0px solid;"></td>
328 <td class="hl" nowrap>SVN Detail-Ausgabe:</td>
329 <td width="400">Aktiviert zeigt es sämtliche SVN-Detail-Ausgaben an. Sollte nur zum Debuggen aktiviert werden.</td>
334 <input type="submit" name="submit" value="Setup fortsetzen">
341 if (!preg_match('@(.*)/$@',$_GET['path'],$match)) {
342 $_GET['path'] = $_GET['path'].'/';
343 //echo '<pre>$_GET:'.print_r($_GET, true).'</pre>';
345 //echo '<pre>$_GET:'.print_r($_GET, true).'</pre>';
348 <span class="hl">Prüfe Setup-Verzeichniss <?php echo $_GET['path']; ?> ...<br /><br />
351 $erg = @mkdir($_GET['path']. $t.'/');
352 if (file_exists($_GET['path']) && $erg) {
353 echo $_GET['path'].'</span><span class="pos">vorhanden und beschreibar</span>';
354 rmdir($_GET['path']. $t.'/');
355 } elseif(file_exists($_GET['path']) && !$erg) {
356 echo '<span class="hl">'.$_GET['path'].' </span>';
357 echo '<span class="neg">Fehler</span><br /><br />';
358 echo '<h2 style="text-align:center; padding-top: 10px; padding-bottom: 10px;" class="neg">Fehler: Das Verzeichniss<br />'.$_GET['path'].'<br />hat Nicht genügende Schreibrechte.';
361 } elseif (!file_exists($_GET['path'])) {
362 //echo '<span class="neg">nicht vorhanden</span><br /><br />';
363 $t = explode('/',$_GET['path']);
364 //echo '<pre>$t:'.print_r($t, true).'</pre>';
366 foreach($t as $last) {
371 //echo '<pre>fileperms($tdir):'.print_r(fileperms($tdir), true).'</pre>';
372 //echo '<pre>fileperms($dir):'.print_r(fileperms($dir), true).'</pre>';
375 //echo '<pre>$dir:'.print_r($dir, true).'</pre>';
377 if (!file_exists($dir)) {
380 echo '<span class="hl">'.$dir.' </span>';
381 echo '<span class="neg">Fehler</span><br /><br />';
382 echo '<h2 style="text-align:center; padding-top: 10px; padding-bottom: 10px;" class="neg">Fehler: Das Verzeichniss<br />'.$tdir.'<br />hat Nicht genügende Schreibrechte.';
385 echo '<span class="hl">'.$dir.' </span>';
386 echo '<span class="pos">erstellt</span><br /><br />';
392 echo '<p class="hl">Prüfe SVN-Server '.$_GET['svn_url']. ' ...</p>';
393 echo '<span class="hl">'.$_GET['svn_url'].' </span>';
395 $svn_server_readable = proc_get('svn info '.$_GET['svn_url'].'');
396 $svn_server = proc_get('svn info --xml '.$_GET['svn_url'].'');
398 if (!$svn_server_readable) {
399 echo '<span class="neg">Fehler</span><br />';
400 echo '<h2 style="text-align:center; padding-top: 10px; padding-bottom: 10px;" class="neg">Fehler: Kann den SVN-Server<br />'.$_GET['svn_url'].'<br />nicht erreichen.';
404 $svn_ausg = implode('<br />',$svn_server_readable);
405 $svn_server = implode("\n",$svn_server);
407 <span class="pos">erreichbar</span><br /><br />
408 <table border="1" cellpadding="5" cellspacing="1" style="margin-left: 20px;">
410 <td class="hl">SVN Informationen</td>
411 <td class="pos" style="border: #00000 1px solid;"><?php echo $svn_ausg ?></td>
415 if (!isset($_GET['head_revision']) || $_GET['head_revision'] != '1') {
418 <form action="" method="GET">
419 <div style="margin-left: 20px;">
420 <input type="hidden" name="step" value="3" />
421 <input type="hidden" name="past" value="<?php echo urlencode(serialize($_GET))."\""; ?> />
422 <table border="1" cellpadding="5" cellspacing="1">
424 <td class="hl" nowrap style="border-bottom: 0px solid;">Revision:</td>
425 <td colspan="2"><input size="10" maxlength="10" type="text" name="revision" value="<?php
426 //echo '<pre>$svn_server:<textarea cols="80" rows="20" name="fgsgfsdg">'.print_r($svn_server, true).'</textarea></pre>';
429 $xml = new SimpleXMLElement($svn_server);
430 //echo '<pre>$xml:'.print_r($xml, true).'</pre>';
431 $t = $xml->entry[0]->commit[0]['revision'];
437 <td style="border-top: 0px solid;"></td>
438 <td class="hl" nowrap>Revision:</td>
439 <td width="400">Revision von [Mailer-Project - Mail Exchange] v0.2.1-FINAL die installiert werden soll. Nach möglichkeit immer die HEAD-Revison benutzen um alle Updates bereits includiert zu erhalten.</td>
443 <input type="submit" name="submit" value="Setup fortsetzen">
454 $t = unserialize(urldecode($_GET['past']));
455 unset($_GET['past']);
456 $_GET = array_merge($t, $_GET);
457 echo '<p class="hl">Prüfe SVN-Server '.$_GET['svn_url']. ' ...</p>';
458 echo '<span class="hl">'.$_GET['svn_url'].' </span>';
460 $svn_server_readable = proc_get('svn info '.$_GET['svn_url'].'');
461 $svn_server = proc_get('svn info --xml '.$_GET['svn_url'].'');
462 if (!$svn_server_readable) {
463 echo '<span class="neg">Fehler</span><br />';
464 echo '<h2 style="text-align:center; padding-top: 10px; padding-bottom: 10px;" class="neg">Fehler: Kann den SVN-Server<br />'.$_GET['svn_url'].'<br />nicht erreichen.';
467 $svn_ausg = implode('<br />',$svn_server_readable);
468 $svn_server = implode("\n",$svn_server);
470 <span class="pos">erreichbar</span><br /><br />
471 <table border="1" cellpadding="5" cellspacing="1" style="margin-left: 20px;">
473 <td class="hl">SVN Informationen</td>
474 <td class="pos" style="border: #00000 1px solid;"><?php echo $svn_ausg ?></td>