/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk

« back to all changes in this revision

Viewing changes to services/info.php

  • Committer: Suren A. Chilingaryan
  • Date: 2019-01-06 00:17:58 UTC
  • Revision ID: csa@suren.me-20190106001758-e13n7p3i6n2bwt5x
Provide information about admin scripts in 'info' service

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
global $ADEI;
4
4
global $ADEI_SETUP;
 
5
global $TMP_PATH;
5
6
global $fix_time;
6
7
 
7
8
if (strtolower($_REQUEST['encoding']=='text')) $text = true;
152
153
        $error = xml_escape($ex->getInfo());
153
154
    }
154
155
 break;
 
156
 case "scripts":
 
157
    $scripts = array();
 
158
    $scripts_dir = "$TMP_PATH/adminscripts";
 
159
    if (is_dir($scripts_dir)) {
 
160
        if ($dh = @opendir($scripts_dir)) {
 
161
            while (($f = readdir($dh)) !== false) {
 
162
                if (($f == ".")||($f == "..")) continue;
 
163
                $info = stat("$scripts_dir/$f");
 
164
                $info['name'] = $f;
 
165
                $scripts[$f] = $info;
 
166
            }
 
167
            closedir($dh);
 
168
        }
 
169
    }
 
170
 break;
155
171
 default:
156
172
    if (isset($_GET['target'])) $error = translate("Unknown info target (%s) is specified", $_GET['target']);
157
173
    else $error = translate("The info target is not specified");
213
229
}
214
230
 
215
231
 
 
232
function OutputScript($out, $item) {
 
233
    $extra = "";
 
234
    $properties = array("name","mtime","size");
 
235
    foreach ($item as $prop => $value) {
 
236
        if (!in_array("$prop", $properties)) continue;
 
237
        $extra .= " $prop=\"" . xml_escape($value) . "\"";
 
238
    }
 
239
    fwrite($out, " <Value$extra/>\n");
 
240
}
 
241
 
216
242
if ($text) {
217
243
    header("Content-type: text/plain");
218
244
    header("Cache-Control: no-cache, must-revalidate");
287
313
                OutputCacheLog($out, $log);
288
314
            }
289
315
         break;
 
316
         case "scripts":
 
317
            foreach($scripts as $script) {
 
318
                OutputScript($out, $script);
 
319
            }
 
320
         break;
290
321
        }
291
322
        fwrite($out, "</result>");
292
323
    }