From cfc27c9b764985f707e8ca8d5ba663b6e4b01ecc Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 30 Jul 2012 04:00:35 -0400
Subject: [PATCH] Keep some resource files (images) in separate directory

---
 program/steps/settings/folders.inc               |    2 +-
 program/resources/blank.tif                      |    0 
 program/steps/mail/compose.inc                   |    8 ++++----
 program/steps/addressbook/func.inc               |    4 ++--
 program/steps/mail/show.inc                      |    2 +-
 tests/mailfunc.php                               |    2 +-
 program/resources/blocked.gif                    |    0 
 plugins/managesieve/managesieve.php              |    2 +-
 skins/default/pngbehavior.htc                    |    2 +-
 /dev/null                                        |    0 
 program/resources/blank.gif                      |    0 
 plugins/enigma/lib/enigma_ui.php                 |    2 +-
 program/steps/mail/func.inc                      |    4 ++--
 program/steps/settings/func.inc                  |    2 +-
 program/.htaccess                                |    2 +-
 program/steps/addressbook/show.inc               |    2 +-
 plugins/enigma/skins/default/templates/keys.html |    2 +-
 program/js/app.js                                |    6 +++---
 18 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/plugins/enigma/lib/enigma_ui.php b/plugins/enigma/lib/enigma_ui.php
index 5901b58..9c32f2f 100644
--- a/plugins/enigma/lib/enigma_ui.php
+++ b/plugins/enigma/lib/enigma_ui.php
@@ -129,7 +129,7 @@
 
         $this->rc->output->set_env('contentframe', $attrib['name']);
         $this->rc->output->set_env('blankpage', $attrib['src'] ? 
-            $this->rc->output->abs_url($attrib['src']) : 'program/blank.gif');
+            $this->rc->output->abs_url($attrib['src']) : 'program/resources/blank.gif');
 
         return html::tag('iframe', $attrib);
     }
diff --git a/plugins/enigma/skins/default/templates/keys.html b/plugins/enigma/skins/default/templates/keys.html
index 810c4a2..4271ecc 100644
--- a/plugins/enigma/skins/default/templates/keys.html
+++ b/plugins/enigma/skins/default/templates/keys.html
@@ -6,7 +6,7 @@
 <link rel="stylesheet" type="text/css" href="/this/enigma.css" />
 <script type="text/javascript" src="/functions.js"></script>
 <script type="text/javascript" src="/splitter.js"></script>
-<style type="text/css">                                                                                                                      
+<style type="text/css">
 #enigmakeyslist { width: <roundcube:exp expression="!empty(cookie:enigmaviewsplitter) ? cookie:enigmaviewsplitter-5 : 210" />px; }
 #enigmacontent-box { left: <roundcube:exp expression="!empty(cookie:enigmaviewsplitter) ? cookie:enigmaviewsplitter+5 : 220" />px;
 <roundcube:exp expression="browser:ie ? ('width:expression((parseInt(this.parentNode.offsetWidth)-'.(!empty(cookie:enigmaeviewsplitter) ? cookie:enigmaviewsplitter+5 : 220).')+\\'px\\');') : ''" />
diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php
index 8ef5f3f..3fb63cd 100644
--- a/plugins/managesieve/managesieve.php
+++ b/plugins/managesieve/managesieve.php
@@ -1026,7 +1026,7 @@
 
         $this->rc->output->set_env('contentframe', $attrib['name']);
         $this->rc->output->set_env('blankpage', $attrib['src'] ?
-        $this->rc->output->abs_url($attrib['src']) : 'program/blank.gif');
+        $this->rc->output->abs_url($attrib['src']) : 'program/resources/blank.gif');
 
         return html::tag('iframe', $attrib);
     }
diff --git a/program/.htaccess b/program/.htaccess
index 8114af6..c4f456c 100644
--- a/program/.htaccess
+++ b/program/.htaccess
@@ -1,4 +1,4 @@
 <IfModule mod_rewrite.c>
 RewriteEngine On
-RewriteRule !^js|.*\.[gt]if$ - [F]
+RewriteRule !^js|resources$ - [F]
 </IfModule>
diff --git a/program/blank.gif b/program/blank.gif
deleted file mode 100644
index ea83374..0000000
--- a/program/blank.gif
+++ /dev/null
Binary files differ
diff --git a/program/js/app.js b/program/js/app.js
index b1f563c..4662105 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -48,7 +48,7 @@
   this.env.request_timeout = 180;  // seconds
   this.env.draft_autosave = 0;     // seconds
   this.env.comm_path = './';
-  this.env.blankpage = 'program/blank.gif';
+  this.env.blankpage = 'program/resources/blank.gif';
 
   // set jQuery ajax options
   $.ajaxSetup({
@@ -6210,7 +6210,7 @@
     // have to do it this way for IE
     // otherwise the form will be posted to a new window
     if (document.all) {
-      var html = '<iframe name="'+frame_name+'" src="program/blank.gif" style="width:0;height:0;visibility:hidden;"></iframe>';
+      var html = '<iframe name="'+frame_name+'" src="program/resources/blank.gif" style="width:0;height:0;visibility:hidden;"></iframe>';
       document.body.insertAdjacentHTML('BeforeEnd', html);
     }
     else { // for standards-compilant browsers
@@ -6548,7 +6548,7 @@
 
     img.onload = function() { rcmail.env.browser_capabilities.tif = 1; };
     img.onerror = function() { rcmail.env.browser_capabilities.tif = 0; };
-    img.src = 'program/blank.tif';
+    img.src = 'program/resources/blank.tif';
   };
 
   this.pdf_support_check = function()
diff --git a/skins/default/images/blank.gif b/program/resources/blank.gif
similarity index 100%
rename from skins/default/images/blank.gif
rename to program/resources/blank.gif
Binary files differ
diff --git a/program/blank.tif b/program/resources/blank.tif
similarity index 100%
rename from program/blank.tif
rename to program/resources/blank.tif
Binary files differ
diff --git a/program/blocked.gif b/program/resources/blocked.gif
similarity index 100%
rename from program/blocked.gif
rename to program/resources/blocked.gif
Binary files differ
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index a612d7c..8abf061 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -368,7 +368,7 @@
     $attrib['name'] = $attrib['id'];
 
     $OUTPUT->set_env('contentframe', $attrib['name']);
-    $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/blank.gif');
+    $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/resources/blank.gif');
 
     return html::iframe($attrib);
 }
@@ -705,7 +705,7 @@
     if ($result = $CONTACTS->get_result())
         $record = $result->first();
 
-    $photo_img = $attrib['placeholder'] ? $CONFIG['skin_path'] . $attrib['placeholder'] : 'program/blank.gif';
+    $photo_img = $attrib['placeholder'] ? $CONFIG['skin_path'] . $attrib['placeholder'] : 'program/resources/blank.gif';
     $RCMAIL->output->set_env('photo_placeholder', $photo_img);
     unset($attrib['placeholder']);
 
diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc
index d7f6f8f..48e3725 100644
--- a/program/steps/addressbook/show.inc
+++ b/program/steps/addressbook/show.inc
@@ -85,7 +85,7 @@
         $RCMAIL->output->future_expire_header(86400);
 
     header('Content-Type: ' . rc_image_content_type($data));
-    echo $data ? $data : file_get_contents('program/blank.gif');
+    echo $data ? $data : file_get_contents('program/resources/blank.gif');
     exit;
 }
 
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index ccb7226..0b06389 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -663,10 +663,10 @@
   unset($plugin);
 
   // add blocked.gif attachment (#1486516)
-  if ($isHtml && preg_match('#<img src="\./program/blocked\.gif"#', $body)) {
-    if ($attachment = rcmail_save_image('program/blocked.gif', 'image/gif')) {
+  if ($isHtml && preg_match('#<img src="\./program/resources/blocked\.gif"#', $body)) {
+    if ($attachment = rcmail_save_image('program/resources/blocked.gif', 'image/gif')) {
       $COMPOSE['attachments'][$attachment['id']] = $attachment;
-      $body = preg_replace('#\./program/blocked\.gif#',
+      $body = preg_replace('#\./program/resources/blocked\.gif#',
         $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'].'&_id='.$COMPOSE['id'],
         $body);
     }
@@ -860,7 +860,7 @@
     $OUTPUT->set_env('spellcheck_langs', join(',', $editor_lang_set));
   }
 
-  $out .= "\n".'<iframe name="savetarget" src="program/blank.gif" style="width:0;height:0;border:none;visibility:hidden;"></iframe>';
+  $out .= "\n".'<iframe name="savetarget" src="program/resources/blank.gif" style="width:0;height:0;border:none;visibility:hidden;"></iframe>';
 
   return $out;
 }
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 21fa3e8..ddd3431 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -398,7 +398,7 @@
 
   if ($RCMAIL->config->get('preview_pane'))
     $OUTPUT->set_env('contentframe', $attrib['id']);
-  $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/blank.gif');
+  $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/resources/blank.gif');
 
   return html::iframe($attrib);
 }
@@ -610,7 +610,7 @@
   $wash_opts = array(
     'show_washed' => false,
     'allow_remote' => $p['safe'],
-    'blocked_src' => "./program/blocked.gif",
+    'blocked_src' => "./program/resources/blocked.gif",
     'charset' => RCMAIL_CHARSET,
     'cid_map' => $cid_replaces,
     'html_elements' => array('body'),
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 9f0f7ba..82c8261 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -274,7 +274,7 @@
   if ($MESSAGE->sender)
     $photo_img = $RCMAIL->url(array('_task' => 'addressbook', '_action' => 'photo', '_email' => $MESSAGE->sender['mailto'], '_alt' => $placeholder));
   else
-    $photo_img = $placeholder ? $placeholder : 'program/blank.gif';
+    $photo_img = $placeholder ? $placeholder : 'program/resources/blank.gif';
 
   return html::img(array('src' => $photo_img) + $attrib);
 }
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc
index e4e9f31..2691a6e 100644
--- a/program/steps/settings/folders.inc
+++ b/program/steps/settings/folders.inc
@@ -363,7 +363,7 @@
     $attrib['name'] = $attrib['id'];
 
     $OUTPUT->set_env('contentframe', $attrib['name']);
-    $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/blank.gif');
+    $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/resources/blank.gif');
 
     return html::iframe($attrib);
 }
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index f44a96d..3f5ef53 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -34,7 +34,7 @@
   $attrib['name'] = $attrib['id'];
 
   $OUTPUT->set_env('contentframe', $attrib['name']);
-  $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/blank.gif');
+  $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/resources/blank.gif');
 
   return html::iframe($attrib);
 }
diff --git a/skins/default/pngbehavior.htc b/skins/default/pngbehavior.htc
index fb5f1c8..6f892df 100644
--- a/skins/default/pngbehavior.htc
+++ b/skins/default/pngbehavior.htc
@@ -24,7 +24,7 @@
 
 var supported = /MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32",
   realSrc,
-  blankSrc = "skins/default/images/blank.gif",
+  blankSrc = "program/resources/blank.gif",
   isPrinting = false;
 
 if (supported) fixImage();
diff --git a/tests/mailfunc.php b/tests/mailfunc.php
index ed63788..493ce94 100644
--- a/tests/mailfunc.php
+++ b/tests/mailfunc.php
@@ -48,7 +48,7 @@
     $html = rcmail_html4inline(rcmail_print_body($part, array('safe' => false)), 'foo');
 
     $this->assertPattern('/src="'.$part->replaces['ex1.jpg'].'"/', $html, "Replace reference to inline image");
-    $this->assertPattern('#background="./program/blocked.gif"#', $html, "Replace external background image");
+    $this->assertPattern('#background="./program/resources/blocked.gif"#', $html, "Replace external background image");
     $this->assertNoPattern('/ex3.jpg/', $html, "No references to external images");
     $this->assertNoPattern('/<meta [^>]+>/', $html, "No meta tags allowed");
     //$this->assertNoPattern('/<style [^>]+>/', $html, "No style tags allowed");

--
Gitblit v1.9.1