Diffstat (limited to 'backend/php/src/setup/index.php') (more/less context) (ignore whitespace changes)
-rw-r--r-- | backend/php/src/setup/index.php | 717 |
1 files changed, 717 insertions, 0 deletions
diff --git a/backend/php/src/setup/index.php b/backend/php/src/setup/index.php new file mode 100644 index 0000000..4087961 --- a/dev/null +++ b/backend/php/src/setup/index.php | |||
@@ -0,0 +1,717 @@ | |||
1 | <?php | ||
2 | /** | ||
3 | * @author Joel Wan & Mark Slemko. Designs by Jonathan Easton | ||
4 | * @link http://www.phpobjectgenerator.com | ||
5 | * @copyright Offered under the BSD license | ||
6 | * | ||
7 | * This setup file does the following: | ||
8 | * 1. Checks if configuration file is present | ||
9 | * 2. Checks if the data in the configuration file is correct | ||
10 | * 3. Checks if the database and table exist | ||
11 | * 4. Create table if not present | ||
12 | * 5. Tests 5 CRUD functions and determine if everything is OK for all objects within the current directory | ||
13 | * 6. When all tests pass, provides an interface to the database and a way to manage objects. | ||
14 | */ | ||
15 | if (!isset($_SESSION)) | ||
16 | { | ||
17 | session_start(); | ||
18 | } | ||
19 | if(file_exists("../configuration.php")) | ||
20 | { | ||
21 | include_once("../configuration.php"); | ||
22 | } | ||
23 | include_once("setup_library/authentication.php"); | ||
24 | include_once("setup_library/setup_misc.php"); | ||
25 | include_once("data_initialization/read_dump_lib.php"); | ||
26 | if(!isset($_SESSION['diagnosticsSuccessful']) || (isset($_GET['step']) && $_GET['step']=="diagnostics")) | ||
27 | { | ||
28 | $_SESSION['diagnosticsSuccessful'] = false; | ||
29 | } | ||
30 | ?> | ||
31 | <?php include "setup_library/inc.header.php";?> | ||
32 | <?php | ||
33 | ini_set("max_execution_time", 0); | ||
34 | if(count($_POST) > 0 && $_SESSION['diagnosticsSuccessful']==false) | ||
35 | { | ||
36 | ?> | ||
37 | <form action="./index.php" method="POST"> | ||
38 | <div class="container"> | ||
39 | <div class="left"> | ||
40 | <div class="logo2"></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. | ||
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> | ||
45 | </div> | ||
46 | <div class="middle"> | ||
47 | <div id="tabs"> | ||
48 | <a href="./index.php?step=diagnostics"><img src="./setup_images/tab_setup.gif"/></a> | ||
49 | <img src="./setup_images/tab_separator.gif"/> | ||
50 | <img src="./setup_images/tab_diagnosticresults_on.gif"/> | ||
51 | <img src="./setup_images/tab_separator.gif"/> | ||
52 | <img src="./setup_images/tab_manageobjects.gif"/> | ||
53 | <img src="./setup_images/tab_separator.gif"/> | ||
54 | <img src="./setup_images/tab_manageplugins_off.gif"/> | ||
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"> | ||
57 | <?php | ||
58 | $errors = 0; | ||
59 | AddTrace('Initializing POG Setup....OK!'); | ||
60 | if (isset($GLOBALS['configuration']['pdoDriver'])) | ||
61 | { | ||
62 | $errors++; | ||
63 | AddError('POG setup for PHP4/5 objects cannot be run with a PDO configuration file. Regenerate configuration.php'); | ||
64 | } | ||
65 | else | ||
66 | { | ||
67 | /** | ||
68 | * verify file structure status | ||
69 | */ | ||
70 | if(!file_exists("../objects/class.database.php")) | ||
71 | { | ||
72 | $errors++; | ||
73 | AddError('Database wrapper (class.database.php) is missing.'); | ||
74 | } | ||
75 | else | ||
76 | { | ||
77 | include "../objects/class.database.php"; | ||
78 | } | ||
79 | if(!file_exists("../objects/class.pog_base.php")) | ||
80 | { | ||
81 | $errors++; | ||
82 | AddError('POG Base class (class.pog_base.php) is missing.'); | ||
83 | } | ||
84 | else | ||
85 | { | ||
86 | include "../objects/class.pog_base.php"; | ||
87 | } | ||
88 | if (!file_exists("../configuration.php")) | ||
89 | { | ||
90 | $errors++; | ||
91 | AddError('Configuration file (configuration.php) is missing'); | ||
92 | } | ||
93 | if ($GLOBALS['configuration']['plugins_path'] == '') | ||
94 | { | ||
95 | $errors++; | ||
96 | AddError('Path to plugin folder has not been specified in configuration.php'); | ||
97 | } | ||
98 | else | ||
99 | { | ||
100 | if (!file_exists($GLOBALS['configuration']['plugins_path']."/plugin.base64.php")) | ||
101 | { | ||
102 | $errors++; | ||
103 | AddError('Base64 plugin file (plugins/plugin.base64.php) is missing'); | ||
104 | } | ||
105 | else | ||
106 | { | ||
107 | include_once($GLOBALS['configuration']['plugins_path']."/plugin.base64.php"); | ||
108 | } | ||
109 | } | ||
110 | |||
111 | |||
112 | |||
113 | //load object names to be ignored | ||
114 | $ignoreObjects = file("../objects/ignore_objects.txt"); | ||
115 | foreach ($ignoreObjects as $key=>$ignoreObject){ | ||
116 | $ignoreObjects[$key] = trim($ignoreObject); | ||
117 | } | ||
118 | |||
119 | $dir = opendir('../objects/'); | ||
120 | $objects = array(); | ||
121 | while(($file = readdir($dir)) !== false) | ||
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") | ||
124 | { | ||
125 | $objects[] = $file; | ||
126 | include_once("../objects/{$file}"); | ||
127 | } | ||
128 | } | ||
129 | closedir($dir); | ||
130 | if (sizeof($objects) == 0) | ||
131 | { | ||
132 | $errors++; | ||
133 | AddError("[objects] folder does not contain any POG object."); | ||
134 | } | ||
135 | |||
136 | if ($errors == 0) | ||
137 | { | ||
138 | $dir = opendir($GLOBALS['configuration']['plugins_path']); | ||
139 | $plugins = array(); | ||
140 | |||
141 | while(($file = readdir($dir)) !== false) | ||
142 | { | ||
143 | if(file_exists($GLOBALS['configuration']['plugins_path']."/IPlugin.php")) | ||
144 | { | ||
145 | include_once($GLOBALS['configuration']['plugins_path']."/IPlugin.php"); | ||
146 | } | ||
147 | if(strlen($file) > 4 && substr(strtolower($file), strlen($file) - 4) === '.php' && !is_dir($file) && strtolower(substr($file, 0, 6)) == 'plugin') | ||
148 | { | ||
149 | include_once($GLOBALS['configuration']['plugins_path']."/{$file}"); | ||
150 | $pluginName = GetPluginName($file); | ||
151 | if ($pluginName != '') | ||
152 | { | ||
153 | $plugins[] = $file; | ||
154 | } | ||
155 | |||
156 | } | ||
157 | } | ||
158 | closedir($dir); | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * verify configuration info | ||
163 | */ | ||
164 | if ($errors == 0) | ||
165 | { | ||
166 | AddTrace('File Structure....OK!'); | ||
167 | if (!@mysql_connect ($GLOBALS['configuration']['host'].":".$GLOBALS['configuration']['port'], $GLOBALS['configuration']['user'], $GLOBALS['configuration']['pass'])) | ||
168 | { | ||
169 | $errors++; | ||
170 | AddError('Cannot connect to the specified database server. Edit configuration.php'); | ||
171 | } | ||
172 | if (isset($GLOBALS['configuration']['db_encoding']) && $GLOBALS['configuration']['db_encoding'] == 1 && !Base64::IsBase64FunctionInstalled()) | ||
173 | { | ||
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'); | ||
176 | } | ||
177 | if ($errors == 0) | ||
178 | { | ||
179 | if (!@mysql_select_db ($GLOBALS['configuration']['db'])) | ||
180 | { | ||
181 | $errors++; | ||
182 | AddError('Cannot find the specified database "'.$GLOBALS['configuration']['db'].'". Edit configuration.php'); | ||
183 | } | ||
184 | } | ||
185 | } | ||
186 | |||
187 | /** | ||
188 | * verify storage status | ||
189 | */ | ||
190 | |||
191 | if ($errors == 0) | ||
192 | { | ||
193 | AddTrace("Configuration Info....OK!\n"); | ||
194 | AddTrace("Storage Status"); | ||
195 | foreach($objects as $object) | ||
196 | { | ||
197 | $objectName = GetObjectName("../objects/".$object); | ||
198 | eval ('$instance = new '.$objectName.'();'); | ||
199 | if (TestStorageExists($objectName, "mysql")) | ||
200 | { | ||
201 | if (isset($_POST['pog_table']) && ($_POST['pog_table'] == "recreate" || $_POST['pog_table'] == "recreate_import")) | ||
202 | { | ||
203 | if (!TestDeleteStorage($instance)) | ||
204 | { | ||
205 | $errors++; | ||
206 | AddError("Dropping table '".strtolower($objectName)."' failed. Drop and recreate the table manually."); | ||
207 | } | ||
208 | else | ||
209 | { | ||
210 | if (!TestCreateStorage("../objects/".$object)) | ||
211 | { | ||
212 | $errors++; | ||
213 | AddError("Creating table [".strtolower($objectName)."] failed. Create the table manually using the generated SQL query in the object header."); | ||
214 | } | ||
215 | else | ||
216 | { | ||
217 | AddTrace("\tDropping & Recreating table [".strtolower($objectName)."]....OK!"); | ||
218 | } | ||
219 | } | ||
220 | } | ||
221 | else | ||
222 | { | ||
223 | if (!TestAlterStorage($instance)) | ||
224 | { | ||
225 | $errors++; | ||
226 | AddError("Aligning [$objectName] with table '".strtolower($objectName)."' failed. Alter the table manually so that object attributes and table columns match."); | ||
227 | } | ||
228 | else | ||
229 | { | ||
230 | AddTrace("\tAligning [$objectName] with table '".strtolower($objectName)."'....OK!"); | ||
231 | } | ||
232 | } | ||
233 | } | ||
234 | else | ||
235 | { | ||
236 | if (!TestCreateStorage("../objects/".$object)) | ||
237 | { | ||
238 | $errors++; | ||
239 | AddError("Creating table [".strtolower($objectName)."] failed. Create the table manually using the generated SQL query in the object header."); | ||
240 | } | ||
241 | else | ||
242 | { | ||
243 | AddTrace("\tCreating table [".strtolower($objectName)."]....OK!"); | ||
244 | } | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | |||
249 | $objectNameList = array(); | ||
250 | |||
251 | /** | ||
252 | * Initialize test data? | ||
253 | */ | ||
254 | if (isset($_POST['pog_table']) && $_POST['pog_table'] == 'recreate_import') | ||
255 | { | ||
256 | $initialData = file_get_contents('data_initialization/data_initialization.sql'); | ||
257 | PMA_splitSqlFile($statements, $initialData, 4); | ||
258 | if (sizeof($statements) > 0) | ||
259 | { | ||
260 | foreach ($statements as $statement) | ||
261 | { | ||
262 | if (!TestExecuteQuery($statement['query'])) | ||
263 | |||
264 | { | ||
265 | $errors++; | ||
266 | AddError('Statement "'.$statement['query'].'" failed'); | ||
267 | } | ||
268 | } | ||
269 | } | ||
270 | $structure_changes = file_get_contents('data_initialization/additional_table_structures.sql'); | ||
271 | unset($statements); | ||
272 | PMA_splitSqlFile($statements, $structure_changes, 4); | ||
273 | if (sizeof($statements) > 0) | ||
274 | { | ||
275 | foreach ($statements as $statement) | ||
276 | { | ||
277 | if (!TestExecuteQuery($statement['query'])) | ||
278 | |||
279 | { | ||
280 | $errors++; | ||
281 | AddError('Statement "'.$statement['query'].'" failed'); | ||
282 | } | ||
283 | } | ||
284 | } | ||
285 | } | ||
286 | |||
287 | |||
288 | /** | ||
289 | * verify object status | ||
290 | */ | ||
291 | $objectNameList = array(); | ||
292 | foreach($objects as $object) | ||
293 | { | ||
294 | $objectName = GetObjectName("../objects/".$object); | ||
295 | if (isset($objectName) && array_search($objectName, $ignoreObjects) ===false) | ||
296 | { | ||
297 | $objectNameList[] = $objectName; | ||
298 | } | ||
299 | } | ||
300 | |||
301 | if ($errors == 0) | ||
302 | { | ||
303 | $pluginNameList = array(); | ||
304 | foreach($plugins as $plugin) | ||
305 | { | ||
306 | $pluginName = GetPluginName($plugin); | ||
307 | if ($pluginName != '') | ||
308 | { | ||
309 | $pluginNameList[] = $pluginName; | ||
310 | } | ||
311 | } | ||
312 | } | ||
313 | |||
314 | |||
315 | if ($errors == 0 && isset($_POST['pog_test']) && $_POST['pog_test'] == 'yes') | ||
316 | { | ||
317 | AddTrace("\nPOG Essentials"); | ||
318 | |||
319 | $_SESSION['links'] = array(); | ||
320 | |||
321 | $objectCount = 1; | ||
322 | foreach($objects as $object) | ||
323 | { | ||
324 | $objectName = GetObjectName("../objects/".$object); | ||
325 | if (isset($objectName) && array_search($objectName, $ignoreObjects) ===false) | ||
326 | { | ||
327 | eval('$instance = new '.$objectName.'();'); | ||
328 | AddTrace("\t[".$objectName."]"); | ||
329 | |||
330 | $link = GetAtLink("../objects/".$object); | ||
331 | $_SESSION['links'][$objectName] = $link; | ||
332 | |||
333 | if (!TestEssentials($instance)) | ||
334 | { | ||
335 | $errors++; | ||
336 | AddError("Object $objectName failed essential tests"); | ||
337 | } | ||
338 | if ($objectCount != sizeof($objects)) | ||
339 | { | ||
340 | AddTrace("\t***"); | ||
341 | } | ||
342 | } | ||
343 | $objectCount++; | ||
344 | } | ||
345 | } | ||
346 | |||
347 | |||
348 | if ($errors == 0 && isset($_POST['pog_test']) && $_POST['pog_test'] == 'yes') | ||
349 | { | ||
350 | AddTrace("\nPOG Relations PreRequisites"); | ||
351 | $objectCount = 1; | ||
352 | foreach ($objects as $object) | ||
353 | { | ||
354 | $objectName = GetObjectName("../objects/".$object); | ||
355 | if (isset($objectName) && array_search($objectName, $ignoreObjects) ===false) | ||
356 | { | ||
357 | eval('$instance = new '.$objectName.'();'); | ||
358 | AddTrace("\t[".$objectName."]"); | ||
359 | if (!TestRelationsPreRequisites($instance, $objectNameList, $objectName, $ignoreObjects)) | ||
360 | { | ||
361 | $errors++; | ||
362 | } | ||
363 | if ($objectCount != sizeof($objects)) | ||
364 | { | ||
365 | AddTrace("\t***"); | ||
366 | } | ||
367 | } | ||
368 | $objectCount++; | ||
369 | } | ||
370 | } | ||
371 | |||
372 | |||
373 | if ($errors == 0 && isset($_POST['pog_test']) && $_POST['pog_test'] == 'yes') | ||
374 | { | ||
375 | AddTrace("\nPOG Relations"); | ||
376 | $objectCount = 1; | ||
377 | foreach ($objects as $object) | ||
378 | { | ||
379 | $objectName = GetObjectName("../objects/".$object); | ||
380 | if (isset($objectName) && array_search($objectName, $ignoreObjects) ===false) | ||
381 | { | ||
382 | eval('$instance = new '.$objectName.'();'); | ||
383 | AddTrace("\t[".$objectName."]"); | ||
384 | if (!TestRelations($instance, $objectNameList, $ignoreObjects)) | ||
385 | { | ||
386 | $errors++; | ||
387 | AddError("Object $objectName failed relations tests"); | ||
388 | } | ||
389 | if ($objectCount != sizeof($objects)) | ||
390 | { | ||
391 | AddTrace("\t***"); | ||
392 | } | ||
393 | } | ||
394 | $objectCount++; | ||
395 | } | ||
396 | } | ||
397 | if ($errors == 0) | ||
398 | { | ||
399 | $_SESSION['diagnosticsSuccessful'] = true; | ||
400 | } | ||
401 | if(isset($_POST['pog_test']) && $_POST['pog_test'] == 'no') | ||
402 | { | ||
403 | AddTrace("\nUNIT TESTS NOT PERFORMED. FOUND $errors ERROR(S)"); | ||
404 | } | ||
405 | else | ||
406 | { | ||
407 | AddTrace("\nCHECKED ".count($objectNameList)." OBJECT(S). FOUND $errors ERROR(S)".($errors == 0 ? ". HURRAY!" : ":")); | ||
408 | } | ||
409 | AddTrace("---------------------------------------------------"); | ||
410 | if (isset($_SESSION['errorMessages'])) | ||
411 | { | ||
412 | $errorMessages = unserialize($_SESSION['errorMessages']); | ||
413 | } | ||
414 | $traceMessages = unserialize($_SESSION['traceMessages']); | ||
415 | $diagnostics = ''; | ||
416 | foreach ($traceMessages as $traceMessage) | ||
417 | { | ||
418 | $diagnostics .= "\n$traceMessage"; | ||
419 | } | ||
420 | if (isset($errorMessages)) | ||
421 | { | ||
422 | foreach ($errorMessages as $errorMessage) | ||
423 | { | ||
424 | $diagnostics .= "\n$errorMessage\n"; | ||
425 | } | ||
426 | } | ||
427 | $_SESSION['fileNames'] = serialize($objects); | ||
428 | $_SESSION['objectNameList'] = serialize($objectNameList); | ||
429 | if (isset($pluginNameList)) | ||
430 | { | ||
431 | $_SESSION['pluginNameList'] = serialize($pluginNameList); | ||
432 | } | ||
433 | } | ||
434 | echo "<textarea>".$diagnostics."</textarea><br/><br/><br/></div>"; | ||
435 | if ($_SESSION['diagnosticsSuccessful']) | ||
436 | { | ||
437 | echo '<input type="image" src="./setup_images/setup_proceed.gif" name="submit"/>'; | ||
438 | } | ||
439 | unset($_POST, $instanceId, $_SESSION['traceMessages'], $_SESSION['errorMessages']); | ||
440 | ?> | ||
441 | </div></div> | ||
442 | </form> | ||
443 | <?php | ||
444 | } | ||
445 | else if($_SESSION['diagnosticsSuccessful'] == true && (!isset($_GET['plugins']) || $_GET['plugins'] != true) ) | ||
446 | { | ||
447 | $pluginNameList = unserialize($_SESSION['pluginNameList']); | ||
448 | ?> | ||
449 | <form action="./index.php" method="POST"> | ||
450 | <div class="container"> | ||
451 | <div class="left"> | ||
452 | <div class="logo3"></div> | ||
453 | <div class="text"><div class="gold">POG documentation summary</div> | ||
454 | <br/><br/>The following 3 documents summarize what POG is all about:<br/><br/> | ||
455 | 1. <a href="http://www.phpobjectgenerator.com/plog/file_download/15">POG Essentials</a><br/><br/> | ||
456 | 2. <a href="http://www.phpobjectgenerator.com/plog/file_download/21">POG Object Relations</a><br/><br/> | ||
457 | 3. <a href="http://www.phpobjectgenerator.com/plog/file_download/18">POG SOAP API</a> | ||
458 | </div><!--text--> | ||
459 | </div><!--left--> | ||
460 | <div class="middle33"> | ||
461 | <div id="tabs3"> | ||
462 | <a href="./index.php?step=diagnostics"><img src="./setup_images/tab_setup.gif"/></a> | ||
463 | <img src="./setup_images/tab_separator.gif"/> | ||
464 | <img src="./setup_images/tab_diagnosticresults.gif"/> | ||
465 | <img src="./setup_images/tab_separator.gif"/> | ||
466 | <a href="./index.php"><img src="./setup_images/tab_manageobjects_on.gif"/></a> | ||
467 | <img src="./setup_images/tab_separator.gif"/> | ||
468 | <?php | ||
469 | if (sizeof($pluginNameList) > 0) | ||
470 | { | ||
471 | ?> | ||
472 | <a href="./index.php?plugins=true"><img src="./setup_images/tab_manageplugins_off.gif" border="0"/></a> | ||
473 | <?php | ||
474 | } | ||
475 | ?> | ||
476 | </div><!--tabs3--><div class="subtabs"> | ||
477 | <?php | ||
478 | //provide interface to the database | ||
479 | include "./setup_library/xPandMenu.php"; | ||
480 | $root = new XMenu(); | ||
481 | if(file_exists("configuration.php")) | ||
482 | { | ||
483 | include "../configuration.php"; | ||
484 | } | ||
485 | if(file_exists("../objects/class.database.php")) | ||
486 | { | ||
487 | include "../objects/class.database.php"; | ||
488 | } | ||
489 | |||
490 | $fileNames = unserialize($_SESSION['fileNames']); | ||
491 | foreach($fileNames as $filename) | ||
492 | { | ||
493 | include_once("../objects/{$filename}"); | ||
494 | } | ||
495 | $objectNameList = unserialize($_SESSION['objectNameList']); | ||
496 | if (isset($_GET['objectName'])) | ||
497 | { | ||
498 | $_SESSION['objectName'] = $_GET['objectName']; | ||
499 | } | ||
500 | $objectName = (isset($_SESSION['objectName'])?$_SESSION['objectName']:$objectNameList[0]); | ||
501 | |||
502 | ?> | ||
503 | <div id="header"> | ||
504 | <ul> | ||
505 | <li id='inactive'>My Objects:</li> | ||
506 | <?php | ||
507 | if (!isset($_SESSION['objectName'])) | ||
508 | { | ||
509 | $_SESSION['objectName'] = $objectNameList[0]; | ||
510 | } | ||
511 | for($i=0; $i<count($objectNameList); $i++) | ||
512 | { | ||
513 | $name = $objectNameList[$i]; | ||
514 | eval('$instance = new '.$name.'();'); | ||
515 | if (!TestIsMapping($instance)) | ||
516 | { | ||
517 | echo "<li ".($_SESSION['objectName']==$objectNameList[$i]?"id='current'":'')."><a href='./index.php?objectName=".$objectNameList[$i]."'>".$objectNameList[$i]."</a></li>"; | ||
518 | //echo "<a href='./index.php?objectName=".$objectNameList[$i]."'".(isset($_SESSION['objectName']) && $_SESSION['objectName']==$objectNameList[$i]?"class='activetab'":(!isset($_SESSION['objectName'])&&$i==0?"class='activetab'":"inactivetab")).">".$objectNameList[$i]."</a> "; | ||
519 | } | ||
520 | } | ||
521 | ?> | ||
522 | </ul> | ||
523 | </div><!--header--> | ||
524 | </div><!--subtabs--> | ||
525 | <div class="toolbar"><a href="<?php echo $_SESSION['links'][$_SESSION['objectName']]?>" target="_blank" title="modify and regenerate object"><img src="./setup_images/setup_regenerate.jpg" border="0"/></a><a href="#" title="Delete all objects" onclick="if (confirm('Are you sure you want to delete all objects in this table? TPress OK to Delete.')){window.location='./?thrashall=true';}else{alert('Phew, nothing was deleted ;)');}"><img src='./setup_images/setup_deleteall.jpg' alt='delete all' border="0"/></a><a href="#" onclick="javascript:expandAll();return false;" title="expand all nodes"><img src='./setup_images/setup_expandall.jpg' alt='expand all' border="0"/></a><a href="#" onclick="javascript:collapseAll();return false;" title="collapse all nodes"><img src='./setup_images/setup_collapseall.jpg' alt='collapse all' border="0"/></a><a href="#" title="update all objects to newest POG version" onclick="if (confirm('Setup will now attempt to upgrade your objects by contacting the POG SOAP server. Would you like to continue?')){window.location='./setup_library/upgrade.php';}else{alert('Upgrade aborted');}"><img src='./setup_images/setup_updateall.jpg' alt='update all objects' border='0'/></a></div><div class="middle3"> | ||
526 | <?php | ||
527 | //is there an action to perform? | ||
528 | if (isset($_GET['thrashall'])) | ||
529 | { | ||
530 | eval('$instance = new '.$objectName.'();'); | ||
531 | $instanceId = strtolower(get_class($instance))."Id"; | ||
532 | $instanceList = $instance->GetList(array(array($instanceId, ">", "0"))); | ||
533 | foreach ($instanceList as $instance) | ||
534 | { | ||
535 | $instance->Delete(); | ||
536 | } | ||
537 | unset($_GET); | ||
538 | } | ||
539 | echo '<div id="container"></div>'; | ||
540 | $_SESSION['fileNames'] = serialize($fileNames); | ||
541 | $_SESSION['objectNameList'] = serialize($objectNameList); | ||
542 | ?> | ||
543 | <b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b> | ||
544 | </div><!--middle3--> | ||
545 | </div><!--middle33--> | ||
546 | </div><!--container--> | ||
547 | </form> | ||
548 | <?php | ||
549 | echo "<script>sndReq('GetList', '', '$objectName', '', '', '', '$objectName');</script>"; | ||
550 | } | ||
551 | else if ($_SESSION['diagnosticsSuccessful'] && $_GET['plugins']) | ||
552 | { | ||
553 | ?> | ||
554 | <form action="./index.php?plugins=true" method="POST"> | ||
555 | <div class="container"> | ||
556 | <div class="left"> | ||
557 | <div class="logo3"></div> | ||
558 | <div class="text"><div class="gold">POG documentation summary</div> | ||
559 | <br/><br/>The following 3 documents summarize what POG is all about:<br/><br/> | ||
560 | 1. <a href="http://www.phpobjectgenerator.com/plog/file_download/15">POG Essentials</a><br/><br/> | ||
561 | 2. <a href="http://www.phpobjectgenerator.com/plog/file_download/21" target="_blank">POG Object Relations</a><br/><br/> | ||
562 | 3. <a href="http://www.phpobjectgenerator.com/plog/file_download/18">POG SOAP API</a> | ||
563 | </div><!--text--> | ||
564 | </div><!--left--> | ||
565 | <div class="middle33"> | ||
566 | <div id="tabs3"> | ||
567 | <a href="./index.php?step=diagnostics"><img src="./setup_images/tab_setup.gif"/></a> | ||
568 | <img src="./setup_images/tab_separator.gif"/> | ||
569 | <img src="./setup_images/tab_diagnosticresults.gif"/> | ||
570 | <img src="./setup_images/tab_separator.gif"/> | ||
571 | <a href="./index.php"><img src="./setup_images/tab_manageobjects.gif"/></a> | ||
572 | <img src="./setup_images/tab_separator.gif"/> | ||
573 | <img src="./setup_images/tab_manageplugins_on.gif"/> | ||
574 | </div><!--tabs3--><div class="subtabs"> | ||
575 | <?php | ||
576 | //provide interface to the database | ||
577 | include "./setup_library/xPandMenu.php"; | ||
578 | $root = new XMenu(); | ||
579 | if(file_exists("configuration.php")) | ||
580 | { | ||
581 | include "../configuration.php"; | ||
582 | } | ||
583 | if(file_exists("../objects/class.database.php")) | ||
584 | { | ||
585 | include "../objects/class.database.php"; | ||
586 | } | ||
587 | include_once('../objects/class.pog_base.php'); | ||
588 | if(file_exists($GLOBALS['configuration']['plugins_path']."/IPlugin.php")) | ||
589 | { | ||
590 | include_once($GLOBALS['configuration']['plugins_path'].'/IPlugin.php'); | ||
591 | } | ||
592 | $pluginNameList = unserialize($_SESSION['pluginNameList']); | ||
593 | foreach($pluginNameList as $pluginName) | ||
594 | { | ||
595 | include_once($GLOBALS['configuration']['plugins_path']."/plugin.".$pluginName.".php"); | ||
596 | } | ||
597 | |||
598 | ?> | ||
599 | <div id="header"> | ||
600 | <ul> | ||
601 | <li id='inactive'>My Plugins:</li> | ||
602 | <?php | ||
603 | if (isset($_GET['pluginName'])) | ||
604 | { | ||
605 | $_SESSION['pluginName'] = $_GET['pluginName']; | ||
606 | } | ||
607 | $pluginName = (isset($_SESSION['pluginName'])?$_SESSION['pluginName']:$pluginNameList[0]); | ||
608 | $_SESSION['pluginName'] = $pluginName; | ||
609 | for($i=0; $i<count($pluginNameList); $i++) | ||
610 | { | ||
611 | $name = $pluginNameList[$i]; | ||
612 | echo "<li ".($_SESSION['pluginName']==$pluginNameList[$i]?"id='current'":'')."><a href='./index.php?plugins=true&pluginName=".$pluginNameList[$i]."'>".$pluginNameList[$i]."</a></li>"; | ||
613 | } | ||
614 | $pluginInstance = new $_SESSION['pluginName']('', ''); | ||
615 | ?> | ||
616 | </ul> | ||
617 | </div><!--header--> | ||
618 | </div><!--subtabs--> | ||
619 | <div class="toolbar"><img src="setup_images/button_toolbar_left.gif"/> | ||
620 | <a href='http://plugins.phpobjectgenerator.com/?id=<?=get_class($pluginInstance)?>' target="_blank"><img src="setup_images/button_toolbar_homepage.gif" border='0'/></a> | ||
621 | <img src="setup_images/toolbar_separator.gif"/> | ||
622 | <?php | ||
623 | if ($pluginInstance->AuthorPage() != null) | ||
624 | { | ||
625 | ?> | ||
626 | <a href='<?php echo $pluginInstance->AuthorPage();?>' target="_blank"><img src="setup_images/button_toolbar_author.gif" border='0'/></a> | ||
627 | <img src="setup_images/toolbar_separator.gif"/> | ||
628 | <?php | ||
629 | } | ||
630 | ?> | ||
631 | <a href='http://plugins.phpobjectgenerator.com/?id=<?=get_class($pluginInstance)?>&help' target="_blank"><img src="setup_images/button_toolbar_help.gif" border='0'/></a> | ||
632 | </div><div class="middle3"> | ||
633 | <?php | ||
634 | echo '<div id="container"><div style="padding:30px;">'; | ||
635 | $pluginInstance->SetupRender(); | ||
636 | echo '</div></div>'; | ||
637 | $_SESSION['pluginNameList'] = serialize($pluginNameList); | ||
638 | ?> | ||
639 | <b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b> | ||
640 | </div><!--middle3--> | ||
641 | </div><!--middle33--> | ||
642 | </div><!--container--> | ||
643 | </form> | ||
644 | <?php | ||
645 | } | ||
646 | else | ||
647 | { | ||
648 | unset($_SESSION['objectNameList'], $_SESSION['fileNames'], $_SESSION['links'], $_SESSION['pluginNameList']); | ||
649 | //welcome screen | ||
650 | ?> | ||
651 | <form action="./index.php" method="POST"> | ||
652 | <div class="container"> | ||
653 | <div class="left"> | ||
654 | <div class="logo"></div> | ||
655 | <div class="text"><div class="gold">What is POG Setup?</div>POG Setup is an extension of the online Php Object Generator. It is meant to help the veteran POG user and the novice alike. | ||
656 | <br/><br/>POG Setup is a 3 step process which:<br/><br/> | ||
657 | 1. Creates tables for your generated objects.<br/><br/> | ||
658 | 2. Performs diagnostics tests on all objects within your 'objects' directory.<br/><br/> | ||
659 | 3. Provides a light interface to your object tables.</div> | ||
660 | </div> | ||
661 | <div class="middle"> | ||
662 | <div id="tabs"> | ||
663 | <img src="./setup_images/tab_setup_on.gif"/> | ||
664 | <img src="./setup_images/tab_separator.gif" height="20px" width="17px"/> | ||
665 | <img src="./setup_images/tab_diagnosticresults.gif" height="20px" width="137px"/> | ||
666 | <img src="./setup_images/tab_separator.gif" height="20px" width="17px"/> | ||
667 | <img src="./setup_images/tab_manageobjects.gif" height="20px" width="129px"/> | ||
668 | <img src="./setup_images/tab_separator.gif"/> | ||
669 | <img src="./setup_images/tab_manageplugins_off.gif"/> | ||
670 | </div> | ||
671 | <div id="nifty"> | ||
672 | <div style="height:500px"> | ||
673 | <img src="./setup_images/setup_welcome.jpg" height="47px" width="617px"/> | ||
674 | <div class="col1"><img src="./setup_images/pog_setup_closed.jpg"/><div class="gold">What is POG?</div>POG generates PHP objects with integrated CRUD methods to dramatically accelerate web application development in PHP. <br/> | ||
675 | <br/>POG allows developers to easily map object attributes onto columns of a database table without having to write SQL queries.</div> | ||
676 | <div class="col2"><img src="./setup_images/pog_setup_open.jpg"/><div class="gold">What is POG Setup?</div>You've generated one or more objects using Php Object Generator ... Now what?<br/> | ||
677 | <br/>POG SETUP is an answer to this question and takes the POG experience one step further. The Setup process automates <b>table creation</b>, <b>unit testing</b> and provides a light <b>scaffolding</b> environment.</div> | ||
678 | <div class="col3"> | ||
679 | <div class="gold">If you are ready to get POG'd up, click on thebutton below to proceed. Doing this will:</div><br/> | ||
680 | <table> | ||
681 | <tr> | ||
682 | <td>TABLES:</td> | ||
683 | <td> | ||
684 | <select class="ss" name="pog_table"> | ||
685 | <option value="align">Align tables with objects (default)</option> | ||
686 | <option value="recreate">Recreate tables</option> | ||
687 | <option value="recreate_import">Recreate tables and initialize data</option> | ||
688 | </select> | ||
689 | </td> | ||
690 | </tr> | ||
691 | <tr> | ||
692 | <td>TESTS:</td> | ||
693 | <td> | ||
694 | <select class="ss" name="pog_test"> | ||
695 | <option value="yes">Perform unit tests (default)</option> | ||
696 | <option value="no">Bypass unit tests</option> | ||
697 | </select> | ||
698 | </td> | ||
699 | </tr> | ||
700 | </table><br/> | ||
701 | <br/><input type="image" onclick="PleaseWait('');" src="./setup_images/setup_pogmeup.gif" name="submit"/> | ||
702 | <div align="center" id="pleasewait" style="display:none;"><img src="./setup_images/loading.gif"/></div> | ||
703 | </div> | ||
704 | </div> | ||
705 | <b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b> | ||
706 | </div> | ||
707 | </div> | ||
708 | </div> | ||
709 | </form> | ||
710 | <?php | ||
711 | } | ||
712 | ?> | ||
713 | <div class="footer"> | ||
714 | <?php include "setup_library/inc.footer.php";?> | ||
715 | </div> | ||
716 | </body> | ||
717 | </html> | ||