Roxen.git/server/modules/graphics/gbutton.pike:20:
// icon-data -- inline icon data
// align -- left|center|right text alignment
// align-icon -- left|center-before|center-after|right icon alignment
// valign-icon -- above|middle|below icon vertical alignment
// >Button text</gbutton>
//
// Alignment restriction: when text alignment is either left or right, icons
// must also be aligned left or right.
- constant cvs_version = "$Id: gbutton.pike,v 1.124 2010/04/27 13:36:56 grubba Exp $";
+ constant cvs_version = "$Id: gbutton.pike,v 1.125 2011/01/20 23:49:17 jonasw Exp $";
constant thread_safe = 1;
#include <module.h>
inherit "module";
roxen.ImageCache button_cache;
int do_ext;
constant module_type = MODULE_TAG;
constant module_name = "Graphics: GButton";
Roxen.git/server/modules/graphics/gbutton.pike:217: Inside #if defined(manual)
<attr name='minutes' value='number'><p>
Add this number of minutes to the time this entry is valid.</p>
</attr>
<attr name='seconds' value='number'><p>
Add this number of seconds to the time this entry is valid.</p>
</attr>";
#endif
+ // Cached copy of conf->query("compat_level"). This setting is defined
+ // to require a module reload to take effect so we only query it when
+ // the module instance is created.
+ float compat_level = (float) my_configuration()->query("compat_level");
+
function TIMER( function f )
{
#if 0
return lambda(mixed ... args) {
int h = gethrtime();
mixed res;
werror("Drawing ... ");
res = f( @args );
werror(" %.1fms\n", (gethrtime()-h)/1000000.0 );
return res;
Roxen.git/server/modules/graphics/gbutton.pike:831:
}
class ButtonFrame {
inherit RXML.Frame;
array mk_url(RequestID id)
{
// int t = gethrtime();
string fi = (args["frame-image"] ||
id->misc->defines["gbutton-frame-image"]);
- if( fi )
+ if( fi ) {
+ // Reject empty file paths for sufficiently high compat_level
+ if (fi == "" && compat_level >= 5.2)
+ RXML.parse_error("Empty frame-image attribute not allowed.");
+
fi = Roxen.fix_relative( fi, id );
-
+ }
m_delete(args, "frame-image");
// Harmonize some attribute names to RXML standards...
args->icon_src = args["icon-src"] || args->icon_src;
args->icon_data = args["icon-data"] || args->icon_data;
args->align_icon = args["align-icon"] || args->align_icon;
args->valign_icon = args["valign-icon"] || args->valign_icon;
m_delete(args, "icon-src");
m_delete(args, "icon-data");
m_delete(args, "align-icon");
-
+ if (args->icon_src == "" && compat_level >= 5.2)
+ RXML.parse_error("Empty icon-src attribute not allowed.");
+
mapping new_args =
([
"pagebg" :parse_color(args->pagebgcolor ||
id->misc->defines->theme_bgcolor ||
id->misc->defines->bgcolor ||
args->bgcolor ||
"#eeeeee"), // _page_ bg color
"bg" : parse_color(args->bgcolor ||
id->misc->defines->theme_bgcolor ||
id->misc->defines->bgcolor ||