AC_4897, AC_4898, AC_4899: Multifile uploader fixes.
[acontent.git] / docs / install / include / step6.php
1 <?php
2 /************************************************************************/
3 /* AContent                                                             */
4 /************************************************************************/
5 /* Copyright (c) 2010                                                   */
6 /* Inclusive Design Institute                                           */
7 /*                                                                      */
8 /* This program is free software. You can redistribute it and/or        */
9 /* modify it under the terms of the GNU General Public License          */
10 /* as published by the Free Software Foundation.                        */
11 /************************************************************************/
12
13 if (!defined('TR_INCLUDE_PATH')) { exit; }
14
15 require('../svn.php');
16
17 $svn_data   = explode("\n", $svn_data);
18
19 if (substr($svn_data[1], 0, 1) == 'r') {
20         $svn_data = $svn_data[1];
21 } else if (substr($svn_data[2], 0, 1) == 'r') {
22         $svn_data = $svn_data[2];
23 }
24
25 if (count($svn_data) > 1) {
26         $build = 'unknown';
27         $build_date = date('Y-m-d H:i:s');
28 } else {
29         $svn_data   = explode(' ', $svn_data);
30
31         $build      = $svn_data[0];
32         $build_date = $svn_data[4] .' '. $svn_data[5];
33 }
34
35 if (!$build) {
36         $build = 'unknown';
37 }
38
39 $os = php_uname('s') . ' '. php_uname('r'). ' '. php_uname('v'). ' '. php_uname('m');
40
41
42 if (isset($_POST['submit'])) {
43         unset($_POST['submit']);
44         unset($action);
45
46         if ($_POST['log_yes']) {
47
48                 $request  = '&upgrade=' . urlencode($stripslashes($_POST['log_upgrade']));
49                 $request .= '&version=' . urlencode($stripslashes($new_version));
50                 $request .= '&build='   . urlencode($stripslashes($build));
51                 $request .= '&build_date=' . urlencode($stripslashes($build_date));
52                 $request .= '&os='      . urlencode($stripslashes($_POST['log_os']));
53                 $request .= '&server='  . urlencode($stripslashes($_POST['log_server']));
54                 $request .= '&php='     . urlencode($stripslashes($_POST['log_php']));
55                 $request .= '&mysql='   . urlencode($stripslashes($_POST['log_mysql']));
56
57                 if ($_POST['step1']['old_path'] != '') {
58                         // get some usage data from this upgrade:
59                         $db     = @mysql_connect($_POST['step1']['db_host'] . ':' . $_POST['step1']['db_port'], $_POST['step1']['db_login'], urldecode($_POST['step1']['db_password']));
60                         @mysql_select_db($_POST['step1']['db_name'], $db);
61
62                         $db_size = 0; // db size in bytes
63                         $sql = 'SHOW TABLE STATUS';
64                         $result = mysql_query($sql, $db);
65                         while ($row = mysql_fetch_assoc($result)) {
66                                 $db_size += $row['Data_length']+$row['Index_length'];
67                         }
68
69                         $request .= '&db='      . $db_size;     // db size in bytes
70                 }
71
72                 if ($_POST['log_url_yes']) {
73                         $request .= '&url=' . urlencode($stripslashes($_POST['log_url']));
74                 }
75
76 //              $header = "POST /install_log.php HTTP/1.1\r\n";
77 //              $header .= "Host: transformable.ca\r\n";
78 //              $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
79 //              $header .= "Content-Length: " . strlen($request) . "\r\n\r\n";
80 //              $fp = fsockopen('www.transformable.ca', 80, $errno, $errstr, 30);
81 //
82 //              if ($fp) {
83 //                      fputs($fp, $header . $request . "\r\n\r\n");
84 //                      fclose($fp);
85 //              }
86         }
87
88         store_steps($step);
89         $step++;
90         return;
91 }
92
93 print_progress($step);
94
95 ?>
96 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
97 <input type="hidden" name="step" value="<?php echo $step; ?>" />
98 <?php
99         if ($_POST['step1']['old_path'] != '') {
100                 echo '<input type="hidden" name="log_upgrade" value="1" />';
101         } else {
102                 echo '<input type="hidden" name="log_upgrade" value="0" />';
103         }
104                 print_hidden($step);
105         ?>
106 <br />
107         <table width="80%" class="tableborder" cellspacing="0" cellpadding="1" align="center">  
108         <tr>
109                 <td class="row1" colspan="2">Submit the following information to the atutor.ca server anonymously? The information we gather helps us plan our development resources to better suit the needs of the community. You may optionally choose to send the URL of your AContent installation.</td>
110         </tr>
111         <tr>
112                 <td class="row1" width="20%"><b>AContent Version:</b></td>
113                 <td class="row1"><?php echo $new_version; ?> (build <?php echo $build . ' - '.$build_date; ?>)</td>
114         </tr>
115         <tr>
116                 <td class="row1" nowrap="nowrap"><b>Operating System:</b></td>
117                 <td class="row1"><?php echo $os; ?> <input type="hidden" name="log_os" value="<?php echo $os; ?>" /></td>
118         </tr>
119         <tr>
120                 <td class="row1"><b>Web Server:</b></td>
121                 <td class="row1"><?php echo $_SERVER['SERVER_SOFTWARE']; ?> <input type="hidden" name="log_server" value="<?php echo $_SERVER['SERVER_SOFTWARE']; ?>" /></td>
122         </tr>
123         <tr>
124                 <td class="row1"><b>PHP Version:</b></td>
125                 <td class="row1"><?php echo phpversion(); ?> <input type="hidden" name="log_php" value="<?php echo phpversion(); ?>" /></td>
126         </tr>
127         <tr>
128                 <td class="row1"><b>MySQL Version:</b></td>
129                 <td class="row1"><?php
130
131                         if ($_POST['step1']['old_path'] != '') {
132                                 $db     = @mysql_connect($_POST['step1']['db_host'] . ':' . $_POST['step1']['db_port'], $_POST['step1']['db_login'], urldecode($_POST['step1']['db_password']));
133                         } else {
134                                 $db     = @mysql_connect($_POST['step2']['db_host'] . ':' . $_POST['step2']['db_port'], $_POST['step2']['db_login'], $_POST['step2']['db_password']);
135                         }
136
137                         $sql    = 'SELECT VERSION() AS version';
138                         $result = @mysql_query($sql, $db);
139                         $row    = @mysql_fetch_assoc($result);
140                         echo $row['version'];
141                         ?> <input type="hidden" name="log_mysql" value="<?php echo $row['version']; ?>" /></td>
142         </tr>
143         <tr>
144                 <td class="row1" valign="top"><div class="optional" title="Optional Field">?</div><b>Optional URL:</b></td>
145                 <td class="row1"><?php
146                         $url = 'http' . ((isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'on') ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, -strlen('install/install.php'));
147                         echo $url; ?><input type="hidden" name="log_url" value="<?php echo $url; ?>" /><br />
148                 <input type="checkbox" name="log_url_yes" value="1" id="url_yes" checked="checked"/><label for="url_yes">Include this URL as well.</label></td>
149         </tr>
150         </table>
151 <input type="hidden" name="log_yes" value="1" />
152 <br />
153 <p align="center"><input type="submit" class="button" value=" Next &raquo; " name="submit" /></p>
154
155 </form>