Wiki engines
Есть интересные статьи? Очень буду признателен, если оставите ссылку (в комментариях к этой странице)!
Comparisons of Wiki engines
The grave disadvantage of coWiki is impossibility of attachments in articles. It's a pity...
Hack 'Attachments' for coWiki:1. {%INCLUDE%}/cowiki/plugin/class.CustomEmbed.php, line 184 (after "break;"):
// <akie>
// !!! +comment line #139 ("return true; // leave silently if unrecoginzed format")
default:
$sStr .= "Attached file: <a href=\"$sSrc\">" . basename($sSrc) . "</a> (" . number_format(filesize($sSrc)) . " bytes)";
// </akie>
2. {%INCLUDE%}/cowiki/plugin/class.PrivateFrontDocumentEditor.php, line 180 (after "$sContent = $Parser->parse($this->Request->get('content'));"):
// <akie>
// File attachment processing
$attachment = @$_FILES['attachment'];
if ($attachment['name']) {
$newFileName = $this->Env->get('DOCUMENT_ROOT') . '/upload/' . $attachment['name'];
/*if (file_exists($newFileName)) {
die("File {$attachment['name']} already exists!!!");
}*/
move_uploaded_file($attachment['tmp_name'], $newFileName);
$sTmpContent = $this->Request->get('content');
$sAddition = "\n<plugin Embed src=\"/upload/{$attachment['name']}\">";
if (strpos($sTmpContent, $sAddition) === false) {
$sTmpContent .= $sAddition;
}
$sContent = $Parser->parse($sTmpContent);
}
// </akie>
3. {%HTDOCS%}/tpl/default/plugin.front.doc.edit.tpl:
- add 'enctype="multipart/form-data"' to second line
- line 125:
<!-- <akie> -->
<tr>
<td>
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td><B>(NEW!)</B> Attach file: <input type="file" name="attachment"></td>
</tr>
</table>
</td>
</tr>
<!-- </akie> -->
4. Final steps:
cd %HTDOCS%
mkdir upload
chmod +w upload
chown nobody.nobody upload
|