function cpg_versioncheckCreateXml($file_data_array) { global $textFileExtensions_array, $lang_versioncheck_php, $displayOption_array, $LINEBREAK; $loopCounter = 0; print <<<EOT <script type="text/javascript"> document.write('<a href="javascript:HighlightAll(\\'versioncheckdisplay.versioncheck_text\\')" class="admin_menu">'); document.write('{$lang_versioncheck_php['select_all']}'); document.write('</a>'); document.write('<br />'); </script> EOT; print '<form name="versioncheckdisplay"><textarea name="versioncheck_text" rows="20" class="textinput debug_text" style="width:98%;font-family:\'Courier New\',Courier,monospace;font-size:9px;height:auto;overflow:auto;">'; print '<?xml version="1.0" encoding="ISO-8859-1"?>' . $LINEBREAK; print '<file_data>' . $LINEBREAK; $loopCounter++; foreach ($file_data_array as $file_data_key => $file_data_values) { print ' <element>' . $LINEBREAK; $loopCounter++; // populate the path and file from the fullpath $tempArray = cpg_get_path_and_file($file_data_values['fullpath']); $file_data_array[$file_data_key]['folder'] = $tempArray['path']; $file_data_array[$file_data_key]['file'] = $tempArray['file']; $file_data_array[$file_data_key]['extension'] = ltrim(substr($file_data_array[$file_data_key]['file'], strrpos($file_data_array[$file_data_key]['file'], '.')), '.'); print " <fullpath>" . $file_data_values['fullpath'] . "</fullpath>" . $LINEBREAK; $loopCounter++; if (in_array($file_data_array[$file_data_key]['extension'], $textFileExtensions_array) == TRUE) { // the file is not binary --- start $handle = @fopen($file_data_values['fullpath'], 'r'); $blob = ''; $blob = @fread($handle, filesize($file_data_values['fullpath'])); @fclose($handle); $revision_string = '$' . 'Revision' . ':'; $cpg_version_determination = 'Coppermine' . ' ' . 'version:'; $blob = str_replace('<?php', '', $blob); // Determine the cpg version $file_data_array[$file_data_key]['version'] = substr($blob, strpos($blob, $cpg_version_determination)); // chop off the first bit up to the string $cpg_version_determination $double_slash_position = strpos($file_data_array[$file_data_key]['version'], '//'); if ($double_slash_position) { $file_data_array[$file_data_key]['version'] = substr($file_data_array[$file_data_key]['version'], 0, $double_slash_position); } $file_data_array[$file_data_key]['version'] = trim(str_replace($cpg_version_determination, '', $file_data_array[$file_data_key]['version'])); $file_data_array[$file_data_key]['version'] = trim(str_replace('#', '', $file_data_array[$file_data_key]['version'])); $file_data_array[$file_data_key]['version'] = trim(substr($file_data_array[$file_data_key]['version'], 0, strpos($file_data_array[$file_data_key]['version'], '$'))); if (strlen($file_data_array[$file_data_key]['version']) > 6) { $file_data_array[$file_data_key]['version'] = $lang_versioncheck_php['not_applicable']; } // Determine file revision $file_data_array[$file_data_key]['revision'] = str_replace($revision_string, '', substr($blob, strpos($blob, $revision_string), 25)); $file_data_array[$file_data_key]['revision'] = trim(substr($file_data_array[$file_data_key]['revision'], 0, strpos($file_data_array[$file_data_key]['revision'], '$'))); if (strlen($file_data_array[$file_data_key]['revision']) > 6) { $file_data_array[$file_data_key]['revision'] = $lang_versioncheck_php['not_applicable']; } } else { // the file is not binary --- end $file_data_array[$file_data_key]['version'] = ''; $file_data_array[$file_data_key]['revision'] = ''; } if ($file_data_array[$file_data_key]['version'] != '') { print " <version>" . $file_data_array[$file_data_key]['version'] . "</version>" . $LINEBREAK; $loopCounter++; } if ($file_data_array[$file_data_key]['revision'] != '') { print " <revision>" . $file_data_array[$file_data_key]['revision'] . "</revision>" . $LINEBREAK; $loopCounter++; } if ($file_data_array[$file_data_key]['status'] != '') { $status = $file_data_array[$file_data_key]['status']; } else { $status = 'mandatory'; } print " <status>" . $status . "</status>" . $LINEBREAK; $loopCounter++; if ($file_data_array[$file_data_key]['permission'] != '') { $permission = $file_data_array[$file_data_key]['permission']; } else { $permission = 'read'; } if ($file_data_array[$file_data_key]['status'] != 'remove') { print " <permission>" . $permission . "</permission>" . $LINEBREAK; } $loopCounter++; if ($file_data_array[$file_data_key]['file'] != '' && $file_data_array[$file_data_key]['status'] != 'remove' && $file_data_array[$file_data_key]['extension'] != 'xml') { $hash = md5_file($file_data_values['fullpath']); } else { $hash = ''; } if ($hash != '') { print " <hash>" . $hash . "</hash>" . $LINEBREAK; $loopCounter++; } print " </element>" . $LINEBREAK; $loopCounter++; } print '</file_data>' . $LINEBREAK; // display formatted footer data if ($displayOption_array['output'] == 'textarea' || $displayOption_array['output'] == 'create') { print <<<EOT </textarea> </form> EOT; } $loopCounter++; return $loopCounter; }
<h2>{$lang_versioncheck_php['version_comparison']}</h2> </td> </tr> <tr> <td class="tablef"><b>{$lang_versioncheck_php['file']}</b></td> <td class="tablef"><b>{$lang_versioncheck_php['coppermine_version']}</b></td> <td class="tablef"><b>{$lang_versioncheck_php['file_version']}</b></td> <!--<td class="tablef"><b>{$lang_versioncheck_php['writable']}</b></td>--> </tr> EOT; // step three: go through all files that exist in the repository and check if they're on the webserver as well $dir = '../' . cpg_get_coppermine_path() . '/'; // this is the place to start browsing foreach ($repository_filename as $rep_file) { $counter_total_files++; $file_info = cpg_get_path_and_file($rep_file); cpg_output_version_row(cpg_get_fileversion($dir . $file_info['path'], $file_info['file']), $file_info, $file_info['file']); } // show summary echo <<<EOT <tr> <td colspan="3" class="tableh2"> <h2>{$lang_versioncheck_php['summary']}</h2> </td> </tr> <tr> <td class="tableb"> {$lang_versioncheck_php['total']}: </td> <td colspan="2" class="tableb"> {$counter_total_files}