/* DIRECTORY IMAGE VIEWER - PHP UTILITY FOR EASY BROWSING IN DIRECTORIES * CONTAINING MANY IMAGE FILES THAT CAN BE DISTINGUISHED BY FILENAME * * V.FIller 2003-2005 * * Allows make selection from images in current directory by the fragment of filename * Allows view all or only few selected files from this selection. * For file selection allows use a Regular expressions (in the PHP version) * LATEST MODIFICATIONS: 18.5.2005: Added fourth parameter "default" in definition of selected value, thus the default value is not obliged to stay on the top of the list 18.5.2005: The script is able to present not only figures, but also: - text files (opens in IFRAME) - subdirectories (as links) 18.5.2005: Added possiblity to set default valueso of variables new section [default_start] which sets variables only if they are undefined. 18.5.2005: Added possibility to choose if in the default opening (without parameters) will be open all or no file from default selection. section [appearance], new line view=all/none All these changes keeps backward compatibility of index.dat file * 10.6.2005: Added possibility to load the configuration from different file than index.dat in first calling use parameter &config=... * * 11.8.2005: Added possibility to include text before, into and after the dynamic page: - header_text - dynamic page content (with side_text under menu) - footer_text Texts are defined in sections of index.dat Extensions of the text: - Line begining with '!' : Include file named in the line. IT CAN BE PHP SCRIPT! - Line begining with '>' : Eval line Warning: to access the main script variables, they must be defined as "global" in the included file or in the first of eval commands (reason: script uses a function to process the text, and PHP has global variables defaultly inacessible inside the function bodies) Change of backward compatibility: Scripts which were using external_table function (SYS directory) must call it externaly - the function was exluded from the script! (it is reasonable). There is necessary: 1. to define using the function in index.dat (add [side_text] section with line "!externaltable.php") 2. to make this script accessible from current directory (e.g. by link to ~/monitor/www/externaltable.php) * * * STRONGLY CONFIGURABLE : - number, variables and values in the select fields - composition of the values from the select fields to the regular expression mask - appearance settings - links up/prev/next, position of menu, buttons presence, etc. * BEHAVIOUR MUST BE DEFINED IN FILE 'index.dat', without this file, the script cannot work. * The format of the configuraton file is described in the following example: # # PHP image browser configuration file # Lines begining with '#' are comments # [appearance] stylefile:page.css form_position:down # can be up / down / left / right columns:3 Selections:1 Regular:0 Selfiles:1 # List_sel:1 View_sel:1 List_reg:1 View_reg:1 # [appearance_dynamic] header_label:Computer state plots page_comment:Selection : |$plottype_comment| in |$computer_comment| computer(s), last |$timespan_comment|. prev_pg:0 next_pg:0 up:../moni_overview.php?timespan=|$timespan| mask_definition:$plottype|_|$computer|_.*|$timespan # NOT IMPLEMENTED: label_definition:$plottype| on computer |$computer|, last |$timespan|. # [header_text]
This text would be printed above the dynamic page content.
[footer_text]This text would be printed under the dynamic page content.
[side_text] # FOLLOWING COMMAND REPLACES FUNCITON external_table used till now in the script!!! !externaltable.phpThis text would be printed on the side (only if position is left/right)
# Access to script variables using eval: >global $computer; echo "Computer:'$computer'" [extensions] jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF # [select_values] !computer_array:computer:Computer:pecny.asu.cas.cz! all=.* Pecny=pecny.asu.cas.cz Pecny0=pecny0.asu.cas.cz Pecny1=pecny1.asu.cas.cz Pecny2=pecny2.asu.cas.cz GOP=gop.asu.cas.cz GOP1=gop1.asu.cas.cz GOP2=gop2.asu.cas.cz GOPA=gopa.asu.cas.cz GOPB=gopb.asu.cas.cz Athena=athena.fsv.cvut.cz !time_array:timespan:Time span:.*! all=.* day=day week=week month=month year=year !type_array:plottype:Plot type! all=.* Cpu load + users #=Cpuload Memory load=Memload Disks=Drives Traffic=Traffic Processes=Process # # FILE FORMAT REMARKS: # 1. In an appearance section, all variables mentioned shall be filled # # 2. In dynamic variables can be added link to values unknown in the # configuration file, but supposed to be known as a variables in the script. # The format is # text....text|$variable_name|text...text # - zero value disables link. # - in this section, all variables are obligatory. # - There are important variables: # a) header_label : Header of the page # b) mask_definition : Here is defined, how the mask for file selection is composed # from select variables. Segments are divided by '|' # The result is used as regular expression, so '.' means any char, '*' repeating, etc. # $plottype|_|$computer|_.*|$timespan => Memload_Pecny.asu.cas.cz_.*day # # 3. Extensions section lists allowed file extensions divided by '|' # # 4. last section defines SELECT fields. # - If the parameter is not set in calling, the value is set to the defined default, if no default is defined, then to the first. # - Fields are ordered by order shown in form that can differ from mask order. # - Values in one field description are separated by ':' char # 1. Name of array with possible settings stored # 2. Name of variable that sets the value in calling from url parameters # 3. Array description to label SELECT # 4. Default value of parameter (IN PROGRESS!) # - Values of select options are dividet bu '=' character, the fist is the label, # the second is the variable value that is used in composing of view mask. # # 5. Sections "header_text", "side_text" and "footer_text": # Text is ouptutted direclty to the desired position in the script (begining, under menu and in the end) # Lines begining with '!' provides including the filename on the line (e.g. !header.php or !http://neco.nekde/x.html) # Lines begining with '>" are proceeded by function eval. # Warning: To access variables of the main script, name them as global first in the included file or eval command! * */ // OBEJITI register_globals = Off while (list($index,$hodnota) = Each($_COOKIE)){ $$index = $_COOKIE[$index]; # echo " COOKIE > ".$index." = ".$HTTP_COOKIE_VARS[$index]."
$selfiles[$i]
prev | "; } if ($up!="0") { echo "up | "; } if ($next_pg!="0") { echo "next | "; } ?>
'.$page_comment."
"; } } // headers // Processing of texts in header, footer and side. // Planned performance: Processing of PHP code, including external files function process($text){ $textarr=Explode("\n",$text); for ($i=0; $i\n"; Listfiles($selfiles); echo " | |||
";
}
elseif( $form_position == "left") {
Headers($prev_pg, $up, $next_pg, $header_label, $page_comment);
process($header_text);
echo "
\n"; */ echo " |