2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2010 */
7 /* This program is free software. You can redistribute it and/or */
8 /* modify it under the terms of the GNU General Public License */
9 /* as published by the Free Software Foundation. */
10 /************************************************************************/
13 if (!defined('AT_INCLUDE_PATH')) { exit; }
15 require('../svn.php');
17 if ($svn_data <> '') $svn_data = explode("\n", $svn_data);
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];
25 if (count($svn_data) > 1) {
27 $build_date = date('Y-m-d H:i:s');
29 $svn_data = explode(' ', $svn_data);
31 $build = $svn_data[0];
32 $build_date = $svn_data[4] .' '. $svn_data[5];
39 $os = php_uname('s') . ' '. php_uname('r'). ' '. php_uname('v'). ' '. php_uname('m');
42 if (isset($_POST['submit'])) {
43 unset($_POST['submit']);
46 if ($_POST['log_yes']) {
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']));
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);
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'];
69 $sql = "SELECT COUNT(*) AS cnt FROM ".$_POST['step1']['tb_prefix']."courses";
70 $result = mysql_query($sql, $db);
71 $row = mysql_fetch_assoc($result);
72 $num_courses = $row['cnt'];
74 $sql = "SELECT COUNT(*) AS cnt FROM ".$_POST['step1']['tb_prefix']."members";
75 $result = mysql_query($sql, $db);
76 $row = mysql_fetch_assoc($result);
77 $num_users = $row['cnt'];
79 $sql = "SELECT COUNT(*) AS cnt FROM ".$_POST['step1']['tb_prefix']."admins";
80 $result = mysql_query($sql, $db);
81 $row = mysql_fetch_assoc($result);
82 $num_users += $row['cnt'];
84 $sql = "SELECT GROUP_CONCAT(language_code) AS langs FROM ".$_POST['step1']['tb_prefix']."languages";
85 $result = mysql_query($sql, $db);
86 $row = mysql_fetch_assoc($result);
87 $languages = $row['langs'];
89 $request .= '&db=' . $db_size; // db size in bytes
90 $request .= '&courses=' . $num_courses; // number of courses
91 $request .= '&users=' . $num_users; // number of users (including admins)
92 $request .= '&langs=' . $languages; // comma separated list of installed languages
95 if ($_POST['log_url_yes']) {
96 $request .= '&url=' . urlencode($stripslashes($_POST['log_url']));
99 $header = "POST /install_log.php HTTP/1.1\r\n";
100 $header .= "Host: atutor.ca\r\n";
101 $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
102 $header .= "Content-Length: " . strlen($request) . "\r\n\r\n";
103 $fp = fsockopen('www.atutor.ca', 80, $errno, $errstr, 30);
106 fputs($fp, $header . $request . "\r\n\r\n");
116 print_progress($step);
119 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
120 <input type="hidden" name="step" value="<?php echo $step; ?>" />
122 if ($_POST['step1']['old_path'] != '') {
123 echo '<input type="hidden" name="log_upgrade" value="1" />';
125 echo '<input type="hidden" name="log_upgrade" value="0" />';
130 <table width="80%" class="tableborder" cellspacing="0" cellpadding="1" align="center">
132 <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 ATutor installation.</td>
135 <td class="row1" width="20%"><b>ATutor Version:</b></td>
136 <td class="row1"><?php echo $new_version; ?> (Git build date<?php echo ' - '. $build_date; ?>)</td>
139 <td class="row1" nowrap="nowrap"><b>Operating System:</b></td>
140 <td class="row1"><?php echo $os; ?> <input type="hidden" name="log_os" value="<?php echo $os; ?>" /></td>
143 <td class="row1"><b>Web Server:</b></td>
144 <td class="row1"><?php echo $_SERVER['SERVER_SOFTWARE']; ?> <input type="hidden" name="log_server" value="<?php echo $_SERVER['SERVER_SOFTWARE']; ?>" /></td>
147 <td class="row1"><b>PHP Version:</b></td>
148 <td class="row1"><?php echo phpversion(); ?> <input type="hidden" name="log_php" value="<?php echo phpversion(); ?>" /></td>
151 <td class="row1"><b>MySQL Version:</b></td>
152 <td class="row1"><?php
154 if ($_POST['step1']['old_path'] != '') {
155 $db = @mysql_connect($_POST['step1']['db_host'] . ':' . $_POST['step1']['db_port'], $_POST['step1']['db_login'], urldecode($_POST['step1']['db_password']));
157 $db = @mysql_connect($_POST['step2']['db_host'] . ':' . $_POST['step2']['db_port'], $_POST['step2']['db_login'], $_POST['step2']['db_password']);
160 $sql = 'SELECT VERSION() AS version';
161 $result = @mysql_query($sql, $db);
162 $row = @mysql_fetch_assoc($result);
163 echo $row['version'];
164 ?> <input type="hidden" name="log_mysql" value="<?php echo $row['version']; ?>" /></td>
167 <td class="row1" valign="top"><div class="optional" title="Optional Field">?</div><b>Optional URL:</b></td>
168 <td class="row1"><?php
169 $url = 'http' . ((isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'on') ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, -strlen('install/install.php'));
170 echo $url; ?><input type="hidden" name="log_url" value="<?php echo $url; ?>" /><br />
171 <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>
174 <td class="row1" colspan="2">
176 <div class="optional" title="Optional Field">?</div><input type="checkbox" name="log_yes" value="1" checked="checked" id="yes_send" /><label for="yes_send">Yes, send this information to atutor.ca.</label>
177 <input type="hidden" name="log_yes" value="1" />
181 <input type="hidden" name="log_yes" value="1" />
183 <p align="center"><input type="submit" class="button" value=" Next » " name="submit" /></p>