<?php if(!strlen($filepath)) { $ado =& inst_GetADODBConnection(); $sql = "SELECT VariableValue FROM ".$g_TablePrefix."ConfigurationValues WHERE VariableName = 'Backup_Path'"; $rs = $ado->Execute($sql); $filepath = $rs->fields['VariableValue']; if (!strlen($filepath)) { $filepath = $pathtoroot.$admin.$path_char.'backupdata'; } } function getRestoreDirList($dirName) { global $objSession, $path_char; $filedates = array(); $d = @dir($dirName); if (!$d) { $restore_error = 'Cannot open backup directory!'; return; } while($entry = $d->read()) { if ($entry != "." && $entry != "..") { if (!is_dir($dirName.$path_char.$entry) && eregi("dump",$entry)) { $shortversion=chopchop($entry); $filedate[]=$shortversion; } } } $d->close(); rsort($filedate); return $filedate; } function chopchop ($filename) { eregi(BACKUP_NAME, $filename, $rets); return $rets[1]; } ?> <?php $datearray=getRestoreDirList($filepath); $count = 0; if (count($datearray) != 0) { $options = ''; foreach($datearray as $key => $value) { $sel = ($value == $_REQUEST['backupdate']) ? ' checked' : ''; $options .= "<TR class=\"table_color2\">"; $options .= "<TD class=\"txt\" size=40><input id=\"$key\" type=radio NAME=\"backupdate\" VALUE=\"$value\" $sel>"; $options .= '<label for="'.$key.'">'.date("F j, Y, g:i a",$value)."</label></TD></TR>"; $count++; if($count>10) break; } } else { $tmp_step = 2; $next_step = 3; $restore_error = "No backup files found or directory does not exist!"; } if ($_POST["state"]=="restore_select") { $tmp_step = 2; $next_step = 3; } ?> <td> <img src="images/icon_install.gif" width="46" height="46" alt="" align="absmiddle"> <span class="admintitle">Select Backup File</span><br><br> <!-- toolbar buttons //--> <?php section_header('Step '.$tmp_step.' - Select Backup File'); ?> <table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar"> <?php include("install/toolbar.php"); ?> </table> <!-- toolbar button \\--> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder"> <tr valign="top"> <td width="60%" bgcolor="#F0F0F0"> <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4"> <tr class="table_color2"> <td ALIGN="left" WIDTH="100%" class="txt"> <b>Backup Directory:</b> <INPUT TYPE="text" NAME="backupdir" VALUE="<?php echo $filepath; ?>"> <input type="button" NAME="update" VALUE="Update" class="button" ONCLICK="this.form.state.value='restore_select'; this.form.submit();"> </td> </tr> <?php echo $options;?> <tr class="table_color2"> <td colspan="2"><p class="error"><?php echo $restore_error; ?></p><br/></td> </tr> <td> <br> <input TYPE="hidden" NAME ="state" VALUE="restore_file"> <input type="hidden" name="next_step" value="<?php echo $next_step;?>"> <input type="hidden" name="install_type" value="<?php echo $install_type;?>"> <input type="submit" name="submit_form" value="Continue" class="button"> <input type="reset" name="Cancel" value="Cancel" class="button" ONCLICK = "history.go(-1);"> </td> </tr> </table> </td>