Loading...
 
Skip to main content

Features / Usability


Wiki pictures can be wiped by anonymous users

Is there a workaround for this situation:

1. A user uploads a picture to a Wiki page, called "foo.jpg"
2. An anonymous user enters the SandBox, selects to upload an image called "foo.jpg" and previews the page.
3. Anonymous user cancels their edit.

Now, the anonymous user has destroyed the original image, foo,jpg and there is no log of it, i.e. it doesn't appear in the list of edits to the site as it was only a page preview.

How can this be prevented? Please no one say, "disable the SandBox" as the same problem occurs with registered users. A registered user can destory an image in the Wiki unknowingly when editing any Wiki page.

Surely someone has a fix? I'm using 1.8.5 cvs.

Regards,
Gray

I take the stoney silence as a sign that this issue has been brought up many, many times in the past and everyone is bored of hearing about it...

...Which I've found to be the case. As there is a fixQuestion for this issue dated over a year ago, it begs the question why this hasn't been applied to the 1.8.5 stable branch?

Is there some reason I shouldn't apply this patch to my 1.8.5 cvs installation?

- Gray


Although... I didn't really like that patch. I want uploaded pictures to never be overwritten and just to build up a history of images such as: foo.jpg, foo_v2.jpg, foo_v3.jpg, etc, etc.

So I used the patch (in tiki 1.8.5: tiki-editpage.php): -

Copy to clipboard
// Upload pictures here if (($feature_wiki_pictures == 'y') && (isset($tiki_p_upload_picture)) && ($tiki_p_upload_picture == 'y')) { if (isset($_FILES['picfile1']) && is_uploaded_file($_FILES['picfile1']['tmp_name'])) { $picname = $_FILES['picfile1']['name']; $fext = array_pop(explode('.', $picname)); $fname = basename($picname, '.'.$fext); // if filename not exists behave like before, if not: // if filename exists already on other page create new filename filename_xxx.extension with xxx is a number if (preg_match('/\.(gif|png|jpe?g)$/i',$picname)) { if ( is_file("img/wiki_up/$tikidomain" . $picname) ) { //file already there $tmp_counter = 2; do { $new_picname = $fname.'_v'.$tmp_counter.'.'.$fext; $tmp_counter++; } while ( is_file("img/wiki_up/$tikidomain". $new_picname) ); move_uploaded_file($_FILES['picfile1']['tmp_name'], "img/wiki_up/$tikidomain" . $new_picname); $_REQUEST["edit"] = $_REQUEST["edit"] . "{picture file=img/wiki_up/$tikidomain$new_picname}"; } else { //new file move_uploaded_file($_FILES['picfile1']['tmp_name'], "img/wiki_up/$tikidomain" . $picname); $_REQUEST["edit"] = $_REQUEST["edit"] . "{picture file=img/wiki_up/$tikidomain$picname}"; } } } }