r4360 index.php: make 'progressbar' a standalone module
authorDenis Ovsienko <infrastation@yandex.ru>
Thu, 17 Mar 2011 18:45:23 +0000 (18:45 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Thu, 17 Mar 2011 18:45:23 +0000 (18:45 +0000)
getProgressBar(): update URI
dispatchImageRequest(): dismiss 'progressbar' case

wwwroot/inc/interface.php
wwwroot/inc/solutions.php
wwwroot/index.php

index 9522d3da1d38e6d617a4a8db86496a0b82cb6d1c..4a849197126838971a4d7b32ed381a84d00ec3b8 100644 (file)
@@ -5039,7 +5039,7 @@ function renderProgressBar ($percentage = 0, $theme = '')
 function getProgressBar ($percentage = 0, $theme = '')
 {
        $done = ((int) ($percentage * 100));
-       $ret = "<img width=100 height=10 border=0 title='${done}%' src='?module=image&img=progressbar&done=${done}";
+       $ret = "<img width=100 height=10 border=0 title='${done}%' src='?module=progressbar&done=${done}";
        if ($theme != '')
                $ret .= "&theme=${theme}";
        $ret .= "'>";
index 3619aad56692bfe0376cc20175ae0c3e6f285804..d92692eb52cfca2d33b6f795f134592fa402968b 100644 (file)
@@ -23,11 +23,6 @@ function dispatchImageRequest()
                assertPermission();
                renderRackThumb (getBypassValue());
                break;
-       case 'progressbar': // no security context
-               assertUIntArg ('done', TRUE);
-               // 'progressbar's never change, make browser cache the result
-               renderProgressBarImage ($_REQUEST['done']);
-               break;
        case 'preview': // file security context
                $pageno = 'file';
                $tabno = 'download';
index 77160adf239a3022583ac994d760f053eb6e9a4e..4d04783e5fa6946f000248923848d8cda0173c71 100644 (file)
@@ -64,10 +64,6 @@ try {
                # built images, and "download" can return a full-fledged "permission
                # denied" or "exception" HTML page instead of the file requested.
                require_once 'inc/init.php'; // for authentication check
-               // 'progressbar's never change, attempt an IMS shortcut before loading init.php
-               if (@$_REQUEST['img'] == 'progressbar')
-                       if (checkCachedResponse (0, CACHE_DURATION))
-                               exit;
                require_once 'inc/solutions.php';
                try
                {
@@ -84,6 +80,17 @@ try {
                        renderErrorImage();
                }
                break;
+       case 'progressbar' == $_REQUEST['module']:
+               # Unlike images (and like static content), progress bars are processed
+               # without a permission check, but only for authenticated users.
+               require_once 'inc/init.php';
+               require_once 'inc/solutions.php';
+               genericAssertion ('done', 'uint0');
+               // 'progressbar's never change, make browser cache the result
+               if (checkCachedResponse (0, CACHE_DURATION))
+                       break;
+               renderProgressBarImage ($_REQUEST['done']);
+               break;
        case 'ajax' == $_REQUEST['module']:
                require_once 'inc/ajax-interface.php';
                require_once 'inc/init.php';