author | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2012-02-08 23:08:46 (UTC) |
---|---|---|
committer | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2012-02-08 23:08:46 (UTC) |
commit | 17efce23d9f205f56f5ebbe8e4f4ca581ea47bcb (patch) (unidiff) | |
tree | 4117988aa276fd20d624c60a37f3e05e2fa2c19b | |
parent | 67455b069c4c9ec493f9cef76017e172a430a7d4 (diff) | |
parent | 96d01919d3ff42c3fdd7f6186a0500caccd3c140 (diff) | |
download | clipperz-17efce23d9f205f56f5ebbe8e4f4ca581ea47bcb.zip clipperz-17efce23d9f205f56f5ebbe8e4f4ca581ea47bcb.tar.gz clipperz-17efce23d9f205f56f5ebbe8e4f4ca581ea47bcb.tar.bz2 |
Merge branch 'master' of github.com:gcsolaroli/password-manager into php+gamma
-rw-r--r-- | backend/php/src/setup/index.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/backend/php/src/setup/index.php b/backend/php/src/setup/index.php index 4087961..93dea6f 100644 --- a/backend/php/src/setup/index.php +++ b/backend/php/src/setup/index.php | |||
@@ -39,257 +39,257 @@ if(count($_POST) > 0 && $_SESSION['diagnosticsSuccessful']==false) | |||
39 | <div class="left"> | 39 | <div class="left"> |
40 | <div class="logo2"></div> | 40 | <div class="logo2"></div> |
41 | <div class="text"><div class="gold">POG setup diagnostics</div> | 41 | <div class="text"><div class="gold">POG setup diagnostics</div> |
42 | <br/>Setup performs unit tests on all your objects in the object directory and makes sure they're OK. <br/>This makes sure that your objects can talk to your database correctly. This can also be useful if you modify / customize the objects manually and want to make sure they still work once you're done. | 42 | <br/>Setup performs unit tests on all your objects in the object directory and makes sure they're OK. <br/>This makes sure that your objects can talk to your database correctly. This can also be useful if you modify / customize the objects manually and want to make sure they still work once you're done. |
43 | <br/><br/>The diagnostics screen on the right shows the results of those tests. If all tests pass successfully, you can be assured that all objects are working correctly. | 43 | <br/><br/>The diagnostics screen on the right shows the results of those tests. If all tests pass successfully, you can be assured that all objects are working correctly. |
44 | </div> | 44 | </div> |
45 | </div> | 45 | </div> |
46 | <div class="middle"> | 46 | <div class="middle"> |
47 | <div id="tabs"> | 47 | <div id="tabs"> |
48 | <a href="./index.php?step=diagnostics"><img src="./setup_images/tab_setup.gif"/></a> | 48 | <a href="./index.php?step=diagnostics"><img src="./setup_images/tab_setup.gif"/></a> |
49 | <img src="./setup_images/tab_separator.gif"/> | 49 | <img src="./setup_images/tab_separator.gif"/> |
50 | <img src="./setup_images/tab_diagnosticresults_on.gif"/> | 50 | <img src="./setup_images/tab_diagnosticresults_on.gif"/> |
51 | <img src="./setup_images/tab_separator.gif"/> | 51 | <img src="./setup_images/tab_separator.gif"/> |
52 | <img src="./setup_images/tab_manageobjects.gif"/> | 52 | <img src="./setup_images/tab_manageobjects.gif"/> |
53 | <img src="./setup_images/tab_separator.gif"/> | 53 | <img src="./setup_images/tab_separator.gif"/> |
54 | <img src="./setup_images/tab_manageplugins_off.gif"/> | 54 | <img src="./setup_images/tab_manageplugins_off.gif"/> |
55 | 55 | ||
56 | </div><div class="subtabs"> </div><a href="./index.php?step=diagnostics"><img src="./setup_images/setup_recheck.jpg" border="0"/></a><div class="middle2"> | 56 | </div><div class="subtabs"> </div><a href="./index.php?step=diagnostics"><img src="./setup_images/setup_recheck.jpg" border="0"/></a><div class="middle2"> |
57 | <?php | 57 | <?php |
58 | $errors = 0; | 58 | $errors = 0; |
59 | AddTrace('Initializing POG Setup....OK!'); | 59 | AddTrace('Initializing POG Setup....OK!'); |
60 | if (isset($GLOBALS['configuration']['pdoDriver'])) | 60 | if (isset($GLOBALS['configuration']['pdoDriver'])) |
61 | { | 61 | { |
62 | $errors++; | 62 | $errors++; |
63 | AddError('POG setup for PHP4/5 objects cannot be run with a PDO configuration file. Regenerate configuration.php'); | 63 | AddError('POG setup for PHP4/5 objects cannot be run with a PDO configuration file. Regenerate configuration.php'); |
64 | } | 64 | } |
65 | else | 65 | else |
66 | { | 66 | { |
67 | /** | 67 | /** |
68 | * verify file structure status | 68 | * verify file structure status |
69 | */ | 69 | */ |
70 | if(!file_exists("../objects/class.database.php")) | 70 | if(!file_exists("../objects/class.database.php")) |
71 | { | 71 | { |
72 | $errors++; | 72 | $errors++; |
73 | AddError('Database wrapper (class.database.php) is missing.'); | 73 | AddError('Database wrapper (class.database.php) is missing.'); |
74 | } | 74 | } |
75 | else | 75 | else |
76 | { | 76 | { |
77 | include "../objects/class.database.php"; | 77 | include "../objects/class.database.php"; |
78 | } | 78 | } |
79 | if(!file_exists("../objects/class.pog_base.php")) | 79 | if(!file_exists("../objects/class.pog_base.php")) |
80 | { | 80 | { |
81 | $errors++; | 81 | $errors++; |
82 | AddError('POG Base class (class.pog_base.php) is missing.'); | 82 | AddError('POG Base class (class.pog_base.php) is missing.'); |
83 | } | 83 | } |
84 | else | 84 | else |
85 | { | 85 | { |
86 | include "../objects/class.pog_base.php"; | 86 | include "../objects/class.pog_base.php"; |
87 | } | 87 | } |
88 | if (!file_exists("../configuration.php")) | 88 | if (!file_exists("../configuration.php")) |
89 | { | 89 | { |
90 | $errors++; | 90 | $errors++; |
91 | AddError('Configuration file (configuration.php) is missing'); | 91 | AddError('Configuration file (configuration.php) is missing'); |
92 | } | 92 | } |
93 | if ($GLOBALS['configuration']['plugins_path'] == '') | 93 | if ($GLOBALS['configuration']['plugins_path'] == '') |
94 | { | 94 | { |
95 | $errors++; | 95 | $errors++; |
96 | AddError('Path to plugin folder has not been specified in configuration.php'); | 96 | AddError('Path to plugin folder has not been specified in configuration.php'); |
97 | } | 97 | } |
98 | else | 98 | else |
99 | { | 99 | { |
100 | if (!file_exists($GLOBALS['configuration']['plugins_path']."/plugin.base64.php")) | 100 | if (!file_exists($GLOBALS['configuration']['plugins_path']."/plugin.base64.php")) |
101 | { | 101 | { |
102 | $errors++; | 102 | $errors++; |
103 | AddError('Base64 plugin file (plugins/plugin.base64.php) is missing'); | 103 | AddError('Base64 plugin file (plugins/plugin.base64.php) is missing'); |
104 | } | 104 | } |
105 | else | 105 | else |
106 | { | 106 | { |
107 | include_once($GLOBALS['configuration']['plugins_path']."/plugin.base64.php"); | 107 | include_once($GLOBALS['configuration']['plugins_path']."/plugin.base64.php"); |
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||
113 | //load object names to be ignored | 113 | //load object names to be ignored |
114 | $ignoreObjects = file("../objects/ignore_objects.txt"); | 114 | $ignoreObjects = file("../objects/ignore_objects.txt"); |
115 | foreach ($ignoreObjects as $key=>$ignoreObject){ | 115 | foreach ($ignoreObjects as $key=>$ignoreObject){ |
116 | $ignoreObjects[$key] = trim($ignoreObject); | 116 | $ignoreObjects[$key] = trim($ignoreObject); |
117 | } | 117 | } |
118 | 118 | ||
119 | $dir = opendir('../objects/'); | 119 | $dir = opendir('../objects/'); |
120 | $objects = array(); | 120 | $objects = array(); |
121 | while(($file = readdir($dir)) !== false) | 121 | while(($file = readdir($dir)) !== false) |
122 | { | 122 | { |
123 | if(strlen($file) > 4 && substr(strtolower($file), strlen($file) - 4) === '.php' && !is_dir($file) && $file != "class.database.php" && $file != "class.pog_base.php") | 123 | if(strlen($file) > 4 && substr(strtolower($file), strlen($file) - 4) === '.php' && !is_dir($file) && $file != "class.database.php" && $file != "class.pog_base.php") |
124 | { | 124 | { |
125 | $objects[] = $file; | 125 | $objects[] = $file; |
126 | include_once("../objects/{$file}"); | 126 | include_once("../objects/{$file}"); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | closedir($dir); | 129 | closedir($dir); |
130 | if (sizeof($objects) == 0) | 130 | if (sizeof($objects) == 0) |
131 | { | 131 | { |
132 | $errors++; | 132 | $errors++; |
133 | AddError("[objects] folder does not contain any POG object."); | 133 | AddError("[objects] folder does not contain any POG object."); |
134 | } | 134 | } |
135 | 135 | ||
136 | if ($errors == 0) | 136 | if ($errors == 0) |
137 | { | 137 | { |
138 | $dir = opendir($GLOBALS['configuration']['plugins_path']); | 138 | $dir = opendir($GLOBALS['configuration']['plugins_path']); |
139 | $plugins = array(); | 139 | $plugins = array(); |
140 | 140 | ||
141 | while(($file = readdir($dir)) !== false) | 141 | while(($file = readdir($dir)) !== false) |
142 | { | 142 | { |
143 | if(file_exists($GLOBALS['configuration']['plugins_path']."/IPlugin.php")) | 143 | if(file_exists($GLOBALS['configuration']['plugins_path']."/IPlugin.php")) |
144 | { | 144 | { |
145 | include_once($GLOBALS['configuration']['plugins_path']."/IPlugin.php"); | 145 | include_once($GLOBALS['configuration']['plugins_path']."/IPlugin.php"); |
146 | } | 146 | } |
147 | if(strlen($file) > 4 && substr(strtolower($file), strlen($file) - 4) === '.php' && !is_dir($file) && strtolower(substr($file, 0, 6)) == 'plugin') | 147 | if(strlen($file) > 4 && substr(strtolower($file), strlen($file) - 4) === '.php' && !is_dir($file) && strtolower(substr($file, 0, 6)) == 'plugin') |
148 | { | 148 | { |
149 | include_once($GLOBALS['configuration']['plugins_path']."/{$file}"); | 149 | include_once($GLOBALS['configuration']['plugins_path']."/{$file}"); |
150 | $pluginName = GetPluginName($file); | 150 | $pluginName = GetPluginName($file); |
151 | if ($pluginName != '') | 151 | if ($pluginName != '') |
152 | { | 152 | { |
153 | $plugins[] = $file; | 153 | $plugins[] = $file; |
154 | } | 154 | } |
155 | 155 | ||
156 | } | 156 | } |
157 | } | 157 | } |
158 | closedir($dir); | 158 | closedir($dir); |
159 | } | 159 | } |
160 | 160 | ||
161 | /** | 161 | /** |
162 | * verify configuration info | 162 | * verify configuration info |
163 | */ | 163 | */ |
164 | if ($errors == 0) | 164 | if ($errors == 0) |
165 | { | 165 | { |
166 | AddTrace('File Structure....OK!'); | 166 | AddTrace('File Structure....OK!'); |
167 | if (!@mysql_connect ($GLOBALS['configuration']['host'].":".$GLOBALS['configuration']['port'], $GLOBALS['configuration']['user'], $GLOBALS['configuration']['pass'])) | 167 | if (!mysql_connect ($GLOBALS['configuration']['host'].":".$GLOBALS['configuration']['port'], $GLOBALS['configuration']['user'], $GLOBALS['configuration']['pass'])) |
168 | { | 168 | { |
169 | $errors++; | 169 | $errors++; |
170 | AddError('Cannot connect to the specified database server. Edit configuration.php'); | 170 | AddError('Cannot connect to the specified database server. Edit configuration.php'); |
171 | } | 171 | } |
172 | if (isset($GLOBALS['configuration']['db_encoding']) && $GLOBALS['configuration']['db_encoding'] == 1 && !Base64::IsBase64FunctionInstalled()) | 172 | if (isset($GLOBALS['configuration']['db_encoding']) && $GLOBALS['configuration']['db_encoding'] == 1 && !Base64::IsBase64FunctionInstalled()) |
173 | { | 173 | { |
174 | $errors++; | 174 | $errors++; |
175 | AddError('$configuration[db_encoding] needs to be set to 0 until you install the base64 plugin. Set db_encoding to 0 by editing configuration.php, run setup again and go to the "Manage Plugins" tab. Install the base64 plugin. Then you can set db_encoding = 1'); | 175 | AddError('$configuration[db_encoding] needs to be set to 0 until you install the base64 plugin. Set db_encoding to 0 by editing configuration.php, run setup again and go to the "Manage Plugins" tab. Install the base64 plugin. Then you can set db_encoding = 1'); |
176 | } | 176 | } |
177 | if ($errors == 0) | 177 | if ($errors == 0) |
178 | { | 178 | { |
179 | if (!@mysql_select_db ($GLOBALS['configuration']['db'])) | 179 | if (!@mysql_select_db ($GLOBALS['configuration']['db'])) |
180 | { | 180 | { |
181 | $errors++; | 181 | $errors++; |
182 | AddError('Cannot find the specified database "'.$GLOBALS['configuration']['db'].'". Edit configuration.php'); | 182 | AddError('Cannot find the specified database "'.$GLOBALS['configuration']['db'].'". Edit configuration.php'); |
183 | } | 183 | } |
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | /** | 187 | /** |
188 | * verify storage status | 188 | * verify storage status |
189 | */ | 189 | */ |
190 | 190 | ||
191 | if ($errors == 0) | 191 | if ($errors == 0) |
192 | { | 192 | { |
193 | AddTrace("Configuration Info....OK!\n"); | 193 | AddTrace("Configuration Info....OK!\n"); |
194 | AddTrace("Storage Status"); | 194 | AddTrace("Storage Status"); |
195 | foreach($objects as $object) | 195 | foreach($objects as $object) |
196 | { | 196 | { |
197 | $objectName = GetObjectName("../objects/".$object); | 197 | $objectName = GetObjectName("../objects/".$object); |
198 | eval ('$instance = new '.$objectName.'();'); | 198 | eval ('$instance = new '.$objectName.'();'); |
199 | if (TestStorageExists($objectName, "mysql")) | 199 | if (TestStorageExists($objectName, "mysql")) |
200 | { | 200 | { |
201 | if (isset($_POST['pog_table']) && ($_POST['pog_table'] == "recreate" || $_POST['pog_table'] == "recreate_import")) | 201 | if (isset($_POST['pog_table']) && ($_POST['pog_table'] == "recreate" || $_POST['pog_table'] == "recreate_import")) |
202 | { | 202 | { |
203 | if (!TestDeleteStorage($instance)) | 203 | if (!TestDeleteStorage($instance)) |
204 | { | 204 | { |
205 | $errors++; | 205 | $errors++; |
206 | AddError("Dropping table '".strtolower($objectName)."' failed. Drop and recreate the table manually."); | 206 | AddError("Dropping table '".strtolower($objectName)."' failed. Drop and recreate the table manually."); |
207 | } | 207 | } |
208 | else | 208 | else |
209 | { | 209 | { |
210 | if (!TestCreateStorage("../objects/".$object)) | 210 | if (!TestCreateStorage("../objects/".$object)) |
211 | { | 211 | { |
212 | $errors++; | 212 | $errors++; |
213 | AddError("Creating table [".strtolower($objectName)."] failed. Create the table manually using the generated SQL query in the object header."); | 213 | AddError("Creating table [".strtolower($objectName)."] failed. Create the table manually using the generated SQL query in the object header."); |
214 | } | 214 | } |
215 | else | 215 | else |
216 | { | 216 | { |
217 | AddTrace("\tDropping & Recreating table [".strtolower($objectName)."]....OK!"); | 217 | AddTrace("\tDropping & Recreating table [".strtolower($objectName)."]....OK!"); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | } | 220 | } |
221 | else | 221 | else |
222 | { | 222 | { |
223 | if (!TestAlterStorage($instance)) | 223 | if (!TestAlterStorage($instance)) |
224 | { | 224 | { |
225 | $errors++; | 225 | $errors++; |
226 | AddError("Aligning [$objectName] with table '".strtolower($objectName)."' failed. Alter the table manually so that object attributes and table columns match."); | 226 | AddError("Aligning [$objectName] with table '".strtolower($objectName)."' failed. Alter the table manually so that object attributes and table columns match."); |
227 | } | 227 | } |
228 | else | 228 | else |
229 | { | 229 | { |
230 | AddTrace("\tAligning [$objectName] with table '".strtolower($objectName)."'....OK!"); | 230 | AddTrace("\tAligning [$objectName] with table '".strtolower($objectName)."'....OK!"); |
231 | } | 231 | } |
232 | } | 232 | } |
233 | } | 233 | } |
234 | else | 234 | else |
235 | { | 235 | { |
236 | if (!TestCreateStorage("../objects/".$object)) | 236 | if (!TestCreateStorage("../objects/".$object)) |
237 | { | 237 | { |
238 | $errors++; | 238 | $errors++; |
239 | AddError("Creating table [".strtolower($objectName)."] failed. Create the table manually using the generated SQL query in the object header."); | 239 | AddError("Creating table [".strtolower($objectName)."] failed. Create the table manually using the generated SQL query in the object header."); |
240 | } | 240 | } |
241 | else | 241 | else |
242 | { | 242 | { |
243 | AddTrace("\tCreating table [".strtolower($objectName)."]....OK!"); | 243 | AddTrace("\tCreating table [".strtolower($objectName)."]....OK!"); |
244 | } | 244 | } |
245 | } | 245 | } |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | $objectNameList = array(); | 249 | $objectNameList = array(); |
250 | 250 | ||
251 | /** | 251 | /** |
252 | * Initialize test data? | 252 | * Initialize test data? |
253 | */ | 253 | */ |
254 | if (isset($_POST['pog_table']) && $_POST['pog_table'] == 'recreate_import') | 254 | if (isset($_POST['pog_table']) && $_POST['pog_table'] == 'recreate_import') |
255 | { | 255 | { |
256 | $initialData = file_get_contents('data_initialization/data_initialization.sql'); | 256 | $initialData = file_get_contents('data_initialization/data_initialization.sql'); |
257 | PMA_splitSqlFile($statements, $initialData, 4); | 257 | PMA_splitSqlFile($statements, $initialData, 4); |
258 | if (sizeof($statements) > 0) | 258 | if (sizeof($statements) > 0) |
259 | { | 259 | { |
260 | foreach ($statements as $statement) | 260 | foreach ($statements as $statement) |
261 | { | 261 | { |
262 | if (!TestExecuteQuery($statement['query'])) | 262 | if (!TestExecuteQuery($statement['query'])) |
263 | 263 | ||
264 | { | 264 | { |
265 | $errors++; | 265 | $errors++; |
266 | AddError('Statement "'.$statement['query'].'" failed'); | 266 | AddError('Statement "'.$statement['query'].'" failed'); |
267 | } | 267 | } |
268 | } | 268 | } |
269 | } | 269 | } |
270 | $structure_changes = file_get_contents('data_initialization/additional_table_structures.sql'); | 270 | $structure_changes = file_get_contents('data_initialization/additional_table_structures.sql'); |
271 | unset($statements); | 271 | unset($statements); |
272 | PMA_splitSqlFile($statements, $structure_changes, 4); | 272 | PMA_splitSqlFile($statements, $structure_changes, 4); |
273 | if (sizeof($statements) > 0) | 273 | if (sizeof($statements) > 0) |
274 | { | 274 | { |
275 | foreach ($statements as $statement) | 275 | foreach ($statements as $statement) |
276 | { | 276 | { |
277 | if (!TestExecuteQuery($statement['query'])) | 277 | if (!TestExecuteQuery($statement['query'])) |
278 | 278 | ||
279 | { | 279 | { |
280 | $errors++; | 280 | $errors++; |
281 | AddError('Statement "'.$statement['query'].'" failed'); | 281 | AddError('Statement "'.$statement['query'].'" failed'); |
282 | } | 282 | } |
283 | } | 283 | } |
284 | } | 284 | } |
285 | } | 285 | } |
286 | 286 | ||
287 | 287 | ||
288 | /** | 288 | /** |
289 | * verify object status | 289 | * verify object status |
290 | */ | 290 | */ |
291 | $objectNameList = array(); | 291 | $objectNameList = array(); |
292 | foreach($objects as $object) | 292 | foreach($objects as $object) |
293 | { | 293 | { |
294 | $objectName = GetObjectName("../objects/".$object); | 294 | $objectName = GetObjectName("../objects/".$object); |
295 | if (isset($objectName) && array_search($objectName, $ignoreObjects) ===false) | 295 | if (isset($objectName) && array_search($objectName, $ignoreObjects) ===false) |