diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php
index 5e185e9c21149fa2bbd30a94369b6008a870be51..298c8e5721f340c0d456ff344c74fdc430c205d3 100644
--- a/conf/dokuwiki.php
+++ b/conf/dokuwiki.php
@@ -20,6 +20,7 @@ $conf['basedir']     = '';                //absolute dir from serveroot - blank
 $conf['baseurl']     = '';                //URL to server including protocol - blank for autodetect
 $conf['savedir']     = './data';          //where to store all the files
 $conf['allowdebug']  = 0;                 //allow debug output, enable if needed 0|1
+$conf['mediarevisions'] = 1;              //enable/disable media revisions
 
 /* Display Options */
 
diff --git a/feed.php b/feed.php
index 1b3641cff71891fd1dc2d2d248224d8560f8eaa8..298777eb9ac1e05d05f42ade89f6ad7dac45b1cd 100644
--- a/feed.php
+++ b/feed.php
@@ -410,10 +410,11 @@ function rss_buildItems(&$rss,&$data,$opt){
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function rssRecentChanges($opt){
+    global $conf;
     $flags = RECENTS_SKIP_DELETED;
     if(!$opt['show_minor']) $flags += RECENTS_SKIP_MINORS;
-    if($opt['content_type'] == 'media') $flags += RECENTS_MEDIA_CHANGES;
-    if($opt['content_type'] == 'both') $flags += RECENTS_MEDIA_PAGES_MIXED;
+    if($opt['content_type'] == 'media' && $conf['mediarevisions']) $flags += RECENTS_MEDIA_CHANGES;
+    if($opt['content_type'] == 'both' && $conf['mediarevisions']) $flags += RECENTS_MEDIA_PAGES_MIXED;
 
     $recents = getRecents(0,$opt['items'],$opt['namespace'],$flags);
     return $recents;
diff --git a/inc/html.php b/inc/html.php
index a225f850304f0d7dee127b3723747f696f99c9d9..2b4e2835e05b0a03d7446d2d7dee26c46135a9d5 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -626,11 +626,12 @@ function html_recent($first=0, $show_changes='both'){
      * decide if this is the last page or is there another one.
      * This is the cheapest solution to get this information.
      */
-    if ($show_changes == 'mediafiles') {
+    $flags = 0;
+    if ($show_changes == 'mediafiles' && $conf['mediarevisions']) {
         $flags = RECENTS_MEDIA_CHANGES;
     } elseif ($show_changes == 'pages') {
         $flags = 0;
-    } else {
+    } elseif ($conf['mediarevisions']) {
         $show_changes = 'both';
         $flags = RECENTS_MEDIA_PAGES_MIXED;
     }
@@ -656,18 +657,20 @@ function html_recent($first=0, $show_changes='both'){
     $form->addHidden('do', 'recent');
     $form->addHidden('id', $ID);
 
-    $form->addElement(form_makeListboxField(
-                'show_changes',
-                array(
-                    'pages'      => $lang['pages_changes'],
-                    'mediafiles' => $lang['media_changes'],
-                    'both'       => $lang['both_changes']),
-                $show_changes,
-                $lang['changes_type'],
-                '','',
-                array('class'=>'quickselect')));
-
-    $form->addElement(form_makeButton('submit', 'recent', $lang['btn_apply']));
+    if ($conf['mediarevisions']) {
+        $form->addElement(form_makeListboxField(
+                    'show_changes',
+                    array(
+                        'pages'      => $lang['pages_changes'],
+                        'mediafiles' => $lang['media_changes'],
+                        'both'       => $lang['both_changes']),
+                    $show_changes,
+                    $lang['changes_type'],
+                    '','',
+                    array('class'=>'quickselect')));
+
+        $form->addElement(form_makeButton('submit', 'recent', $lang['btn_apply']));
+    }
 
     $form->addElement(form_makeOpenTag('ul'));
 
diff --git a/inc/media.php b/inc/media.php
index c57afedfbc617027e71279979258ff07eeee36bc..8c23dc115cd286927c83bc0647ce5e87d1c8185d 100644
--- a/inc/media.php
+++ b/inc/media.php
@@ -331,7 +331,8 @@ function media_save($file, $id, $ow, $auth, $move) {
 
     //check for overwrite
     $overwrite = @file_exists($fn);
-    if($overwrite && (!$ow || $auth < AUTH_DELETE)) {
+    $auth_ow = (($conf['mediarevisions']) ? AUTH_UPLOAD : AUTH_DELETE);
+    if($overwrite && (!$ow || $auth < $auth_ow)) {
         return array($lang['uploadexist'], 0);
     }
     // check for valid content
@@ -426,6 +427,8 @@ function media_saveOldRevision($id){
     $oldf = mediaFN($id);
     if(!@file_exists($oldf)) return '';
     $date = filemtime($oldf);
+    if (!$conf['mediarevisions']) return $date;
+
     $newf = mediaFN($id,$date);
     io_makeFileDir($newf);
     if(copy($oldf, $newf)) {
@@ -503,7 +506,7 @@ function media_notify($id,$file,$mime,$old_rev=false){
     $text = str_replace('@MIME@',$mime,$text);
     $text = str_replace('@MEDIA@',ml($id,'',true,'&',true),$text);
     $text = str_replace('@SIZE@',filesize_h(filesize($file)),$text);
-    if ($old_rev) {
+    if ($old_rev && $conf['mediarevisions']) {
         $text = str_replace('@OLD@', ml($id, "rev=$old_rev", true, '&', true), $text);
     } else {
         $text = str_replace('@OLD@', '', $text);
@@ -593,7 +596,7 @@ function media_tabs_files($selected=false){
  * @param string $selected - opened tab
  */
 function media_tabs_details($image, $selected=false){
-    global $lang;
+    global $lang, $conf;
 
     echo '<div class="mediamanager-tabs" id="mediamanager__tabs_details">';
 
@@ -603,7 +606,9 @@ function media_tabs_details($image, $selected=false){
     if ($mime == 'image/jpeg') {
         media_tab(media_managerURL(array('tab_details' => 'edit')), 'edit', $lang['media_edittab'], $selected);
     }
-    media_tab(media_managerURL(array('tab_details' => 'history')), 'history', $lang['media_historytab'], $selected);
+    if ($conf['mediarevisions']) {
+        media_tab(media_managerURL(array('tab_details' => 'history')), 'history', $lang['media_historytab'], $selected);
+    }
 
     echo '<div class="clearer"></div>';
     echo '</div>';
@@ -849,7 +854,7 @@ function media_preview($image, $auth, $rev=false, $meta=false) {
  * @author Kate Arzamastseva <pshns@ukr.net>
  */
 function media_preview_buttons($image, $auth, $rev=false) {
-    global $lang;
+    global $lang, $conf;
 
     echo '<div id="mediamanager__preview_buttons">';
 
@@ -875,6 +880,11 @@ function media_preview_buttons($image, $auth, $rev=false) {
         $form->addElement(form_makeButton('submit','',$lang['btn_delete']));
         $form->printForm();
 
+    }
+
+    $auth_ow = (($conf['mediarevisions']) ? AUTH_UPLOAD : AUTH_DELETE);
+    if($auth >= $auth_ow && !$rev){
+
         // upload new version button
         $form = new Doku_Form(array('id' => 'mediamanager__btn_update',
             'action'=>media_managerURL(array('image' => $image, 'mediado' => 'update'), '&')));
@@ -882,7 +892,7 @@ function media_preview_buttons($image, $auth, $rev=false) {
         $form->printForm();
     }
 
-    if($auth >= AUTH_DELETE && $rev){
+    if($auth >= AUTH_DELETE && $rev && $conf['mediarevisions']){
 
         // restore button
         $form = new Doku_Form(array('id' => 'mediamanager__btn_restore',
@@ -1001,7 +1011,7 @@ function media_diff($image, $ns, $auth) {
     global $lang;
     global $conf;
 
-    if ($auth < AUTH_READ || !$image) return '';
+    if ($auth < AUTH_READ || !$image || !$conf['mediarevisions']) return '';
 
     $rev1 = (int) $_REQUEST['rev'];
 
@@ -1035,7 +1045,11 @@ function media_diff($image, $ns, $auth) {
     }else{                        // no revision was given, compare previous to current
         $r_rev = '';
         $revs = getRevisions($image, 0, 1, 8192, true);
-        $l_rev = $revs[0];
+        if (file_exists(mediaFN($image, $revs[0]))) {
+            $l_rev = $revs[0];
+        } else {
+            $l_rev = '';
+        }
     }
 
     // prepare event data
@@ -1190,7 +1204,8 @@ function media_image_diff($image, $l_rev, $r_rev, $meta, $type) {
  * @author Kate Arzamastseva <pshns@ukr.net>
  */
 function media_restore($image, $rev, $auth){
-    if ($auth < AUTH_DELETE) return false;
+    global $conf;
+    if ($auth < AUTH_DELETE || !$conf['mediarevisions']) return false;
     if (!$image || !file_exists(mediaFN($image))) return false;
     if (!$rev || !file_exists(mediaFN($image, $rev))) return false;
     list($iext,$imime,$dl) = mimetype($image);
diff --git a/inc/template.php b/inc/template.php
index a48a099e041231420167f493477eea45dab96b28..e6673c3f3b8f1edfd9ab5a7de316d4cfb8d96248 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -1140,7 +1140,7 @@ function tpl_fileList(){
     global $JUMPTO;
 
     $opened_tab = $_REQUEST['tab_files'];
-    if (!$opened_tab) $opened_tab = 'files';
+    if (!$opened_tab || !in_array($opened_tab, array('files', 'upload', 'search'))) $opened_tab = 'files';
     if ($_REQUEST['mediado'] == 'update') $opened_tab = 'upload';
 
     media_tabs_files($opened_tab);
@@ -1172,8 +1172,7 @@ function tpl_fileList(){
  * @author Kate Arzamastseva <pshns@ukr.net>
  */
 function tpl_fileDetails($image, $rev){
-    global $AUTH;
-    global $NS;
+    global $AUTH, $NS, $conf;
 
     if (!$image || !file_exists(mediaFN($image))) return '';
     if ($rev && !file_exists(mediaFN($image, $rev))) $rev = false;
@@ -1181,7 +1180,17 @@ function tpl_fileDetails($image, $rev){
     $do = $_REQUEST['mediado'];
 
     $opened_tab = $_REQUEST['tab_details'];
-    if (!$opened_tab) $opened_tab = 'view';
+
+    $tab_array = array('view');
+    list($ext, $mime) = mimetype($image);
+    if ($mime == 'image/jpeg') {
+        $tab_array[] = 'edit';
+    }
+    if ($conf['mediarevisions']) {
+        $tab_array[] = 'history';
+    }
+
+    if (!$opened_tab || !in_array($opened_tab, $tab_array)) $opened_tab = 'view';
     if ($_REQUEST['edit']) $opened_tab = 'edit';
     if ($do == 'restore') $opened_tab = 'view';
 
@@ -1197,7 +1206,7 @@ function tpl_fileDetails($image, $rev){
         media_tab_edit($image, $NS, $AUTH);
         echo '</div>';
 
-    } elseif ($opened_tab == 'history') {
+    } elseif ($opened_tab == 'history' && $conf['mediarevisions']) {
         echo '<div id="mediamanager__details">';
         media_tab_history($image,$NS,$AUTH);
         echo '</div>';
@@ -1446,7 +1455,7 @@ function tpl_getFavicon($abs=false) {
  */
 function tpl_media() {
     //
-    global $DEL, $NS, $IMG, $AUTH, $JUMPTO, $REV, $lang, $fullscreen;
+    global $DEL, $NS, $IMG, $AUTH, $JUMPTO, $REV, $lang, $fullscreen, $conf;
     $fullscreen = true;
     require_once(DOKU_INC.'lib/exe/mediamanager.php');
 
diff --git a/lib/exe/mediamanager.php b/lib/exe/mediamanager.php
index 939b5a053afc2aff88de5a0b9dba669b7c7725f4..5f09fe1f8dab79d5b9dca060719fedd59712f058 100644
--- a/lib/exe/mediamanager.php
+++ b/lib/exe/mediamanager.php
@@ -84,9 +84,9 @@
         $JUMPTO = media_metasave($IMG,$AUTH,$_REQUEST['meta']);
     }
 
-    if ($_REQUEST['rev']) $REV = (int) $_REQUEST['rev'];
+    if ($_REQUEST['rev'] && $conf['mediarevisions']) $REV = (int) $_REQUEST['rev'];
 
-    if($_REQUEST['mediado'] == 'restore'){
+    if($_REQUEST['mediado'] == 'restore' && $conf['mediarevisions']){
         $JUMPTO = media_restore($_REQUEST['image'], $REV, $AUTH);
     }