Warning: session_start(): open(/var/lib/php/sessions/sess_fiamf5onnolitir5d0l1mfeskc, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sS exportSnippetID;
svoid swingExportConcepts(S desc) {
thread "Exporting" {
pcall-messagebox {
loading {
try {
swingExportConcepts_impl(desc);
} catch e {
if (containsIC(str(e), "Not your snippet")) {
if (!confirmOKCancel("Snippet " + exportSnippetID + " does not seem to belong to you. Maybe you're not logged in. Do you want to export to a new snippet?")) ret;
exportSnippetID = null;
save("exportSnippetID");
swingExportConcepts_impl(desc);
} else rethrow(e);
}
}
}
}
}
svoid swingExportConcepts_impl(S desc) {
if (mainConcepts.countConcepts() == 0) fail("Nothing to export (concepts not loaded?)");
S text = mainConcepts.xfullgrab();
if (match("exportable=f", text)) fail("Non-exportable concepts found");
print(javaTokWordWrap(text));
print("Size: " + l(utf8(text)));
print();
load("exportSnippetID");
if (empty(exportSnippetID)) {
infoBox("Creating a snippet for you...");
exportSnippetID = createSnippet(text, desc + " from " + computerID(), 53);
infoBox("Your snippet ID: " + exportSnippetID);
save("exportSnippetID");
} else {
S oldMD5 = getSnippetMD5(exportSnippetID);
S newMD5 = md5(text);
if (eq(oldMD5, newMD5))
infoBox("Snippet " + exportSnippetID + " already up to date!");
else {
infoBox("Updating snippet: " + exportSnippetID);
editSnippet(exportSnippetID, text);
S actualMD5 = getSnippetMD5(exportSnippetID);
if (eq(actualMD5, newMD5))
infoBox("Export to " + exportSnippetID + " complete (" + n(lUtf8(text), "bytes") + ").");
else if (eq(actualMD5, oldMD5))
infoBox("Export failed for unknown reason");
else
infoBox("Hm. Export did something, but MD5 mismatch occurred.");
}
}
}