Permalink
Browse files

Fixes backup subsystem for eql file import & export. Adds sample cont…

…ent option to installation theme selection. Adds an option to save the current database to the current theme as sample content. Also consolidates *.sql files in assets folders. Includes a "poor" example of sample content for the retro theme.. Cleans up the installer wording somewhat, esp. the sanity check popup explanation.

[#286 state:resolved]
  • Loading branch information...
1 parent e50767e commit 93e5ccfd6f6e47ef427b68d39e8bc7f7fcb35d95 @dleffler dleffler committed Aug 9, 2011
@@ -232,7 +232,7 @@ function exponent_backup_restoreDatabase($db,$file,&$errors,$force_version = nul
} else if ($pair[0] == 'RECORD') {
// Here we need to check the conversion scripts.
$pair[1] = str_replace('\r\n',"\r\n",$pair[1]);
- $object = expUnserialize($pair[1]);
+ $object = unserialize($pair[1]);
if (function_exists($table_function)) {
$table_function($db,$object);
} else {
@@ -3,9 +3,9 @@
return array(
'bad_eql'=>'Not a valid EQL file',
'wrong_ver'=>'EQL file was Not a valid EQL version',
- 'unreadable_definition'=>'Data definition file for %1 (%2) is not readable (line %3)',
- 'no_definition'=>'Table "%1" not found in the system (line %2)',
- 'invalid_type'=>'Invalid specifier type "%1" (line %2)',
+ 'unreadable_definition'=>'Data definition file for %s (%s) is not readable (line %d)',
+ 'no_definition'=>'Table "%s" not found in the system (line %d)',
+ 'invalid_type'=>'Invalid specifier type "%s" (line %d)',
'eql_not_r'=>'Unable to read EQL file',
);
@@ -68,7 +68,7 @@
{* <hr size="1" />*}
{if $failed == 0}
{if $warn == 1}{$_TR.overwrite_warning}<br /><br />{/if}
- <a class="awesome {$smarty.config.BTN_SIZE} {$smarty.const.BTN_COLOR}" href="{link action=finish_install_extension}">{$_TR.install}</a>
+ <a class="awesome {$smarty.const.BTN_SIZE} {$smarty.const.BTN_COLOR}" href="{link action=finish_install_extension}">{$_TR.install}</a>
{else}
{$_TR.bad_permissions}
{/if}
@@ -42,6 +42,6 @@
</tr>
{/foreach}
</table>
- <a class="awesome {$smarty.config.BTN_SIZE} {$smarty.const.BTN_COLOR}" href="{$redirect}">{$_TR.back}</a>
+ <a class="awesome {$smarty.const.BTN_SIZE} {$smarty.const.BTN_COLOR}" href="{$redirect}">{$_TR.back}</a>
{/if}
</div>
@@ -35,28 +35,41 @@
ob_end_clean();
ob_start("ob_gzhandler");
-
- // This code was lifted from phpMyAdmin, but this is Open Source, right?
-
- // 'application/octet-stream' is the registered IANA type but
- // MSIE and Opera seems to prefer 'application/octetstream'
- $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';
-
- header('Content-Type: ' . $mime_type);
- header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
- // IE need specific headers
- if (EXPONENT_USER_BROWSER == 'IE') {
- header('Content-Disposition: inline; filename="' . $filename . '"');
- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
- header('Pragma: public');
+
+ if (isset($_POST['save_sample'])) { // Save as a theme sample is checked off
+ $path = BASE . "themes/".DISPLAY_THEME_REAL."/sample.eql";
+ if (!$eql = fopen ($path, "ab")) {
+ flash('error',"Error opening eql file for writing ($path).");
+ } else {
+ $eqlfile = exponent_backup_dumpDatabase($db,array_keys($_POST['tables']));
+ if (fwrite ($eql, $eqlfile) === FALSE) {
+ flash('error',"Error writing to eql file ($path).");
+ }
+ fclose ($eql);
+ flash('message',"Sample database (eql file) saved to '".DISPLAY_THEME."' theme.");
+ expHistory::back();
+ }
} else {
- header('Content-Disposition: attachment; filename="' . $filename . '"');
- header('Pragma: no-cache');
+ // This code was lifted from phpMyAdmin, but this is Open Source, right?
+
+ // 'application/octet-stream' is the registered IANA type but
+ // MSIE and Opera seems to prefer 'application/octetstream'
+ $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';
+
+ header('Content-Type: ' . $mime_type);
+ header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
+ // IE need specific headers
+ if (EXPONENT_USER_BROWSER == 'IE') {
+ header('Content-Disposition: inline; filename="' . $filename . '"');
+ header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+ header('Pragma: public');
+ } else {
+ header('Content-Disposition: attachment; filename="' . $filename . '"');
+ header('Pragma: no-cache');
+ }
+ echo exponent_backup_dumpDatabase($db,array_keys($_POST['tables']));
+ exit(''); // Exit, since we are exporting
}
-
- echo exponent_backup_dumpDatabase($db,array_keys($_POST['tables']));
-
- exit(''); // Exit, since we are exporting
}
?>
@@ -78,22 +78,31 @@
</td>
</tr>
<tr>
- <td colspan="5"><br /></td>
+ <td colspan="5"><hr></td>
+ </tr>
+ <td colspan="1">
+ <input type="checkbox" name="save_sample" value="1" class="checkbox">
+ </td>
+ <td colspan="4" valign="top">
+ <b><label class="label ">Save as Sample Content for the '{$smarty.const.DISPLAY_THEME}' Theme?</label></b>
+ </td>
</tr>
<tr>
- <td colspan="2" valign="top"><b>{$_TR.file_template}</b></td>
- <td colspan="3">
+ <td colspan="3" valign="top"><b>{$_TR.file_template}</b></td>
+ <td colspan="2">
<input type="text" name="filename" size="20" value="database" />
</td>
</tr>
+ <tr>
<td colspan="5">
<div style="border-top: 1px solid #CCCC;">{$_TR.template_description}<br /></div>
</td>
</tr>
<tr>
+ <tr>
<td colspan="2">&nbsp;</td>
<td colspan="3">
- <input class="awesome {$smarty.config.BTN_SIZE} {$smarty.const.BTN_COLOR}" type="submit" value="{$_TR.export_data}" onclick="return isOneSelected();" />
+ <input class="awesome {$smarty.const.BTN_SIZE} {$smarty.const.BTN_COLOR}" type="submit" value="{$_TR.export_data}" onclick="return isOneSelected();" />
</td>
</tr>
</table>
@@ -63,7 +63,7 @@
<tr>
<td>&nbsp;</td>
<td>
- <input class="awesome {$smarty.config.BTN_SIZE} {$smarty.const.BTN_COLOR}" type="submit" value="{$_TR.export_files}" />
+ <input class="awesome {$smarty.const.BTN_SIZE} {$smarty.const.BTN_COLOR}" type="submit" value="{$_TR.export_files}" />
</td>
</tr>
</table>
Oops, something went wrong.

0 comments on commit 93e5ccf

Please sign in to comment.