Roxen.git / server / etc / modules / Variable.pmod / module.pmod

version» Context lines:

Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1: - // $Id: module.pmod,v 1.16 2000/09/17 22:29:25 per Exp $ + // $Id: module.pmod,v 1.17 2000/09/19 10:34:38 per Exp $      #include <module.h>   #include <roxen.h>      // Locale macros   static inline string getloclang() {    return roxenp()->locale->get();   }      //<locale-token project="roxen_config"> LOCALE </locale-token>
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:16:   #else /* !Locale.DeferredLocale */   #define LOCALE(X,Y) \    ([string](mixed)RoxenLocale.DeferredLocale("roxen_config",getloclang,X,Y))   #endif /* Locale.DeferredLocale */      // Increased for each variable, used to index the mappings below.   static int unique_vid;      // The theory is that most variables (or at least a sizable percentage   // of all variables) does not have these members. Thus this saves - // quite a respectable amount of memory, the cost is speed. But not - // all that great a percentage of speed. + // quite a respectable amount of memory, the cost is speed. But + // hopefully not all that great a percentage of speed.   static mapping(int:mixed) changed_values = ([]);   static mapping(int:function(object:void)) changed_callbacks = ([]);   static mapping(int:int) all_flags = ([]);   static mapping(int:string) all_warnings = ([]);   static mapping(int:function(RequestID,object:int))    invisibility_callbacks = set_weak_flag( ([]), 1 );      class Variable   //! The basic variable type in Roxen. All other variable types should   //! inherit this class.
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:870:    return what;    }       static int _current_count = time()*100+(gethrtime()/10000);    void set_from_form(RequestID id)    {    int rn, do_goto;    array l = query();    mapping vl = get_form_vars(id);    // first do the assign... -  +     if( (int)vl[".count"] != _current_count )    return;    _current_count++;       foreach( indices( vl ), string vv )    if( sscanf( vv, ".set.%d", rn ) )    {    m_delete( id->variables, path()+vv );    l[rn] = transform_from_form( vl[vv] );    m_delete( vl, vv );
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:918:    {    do_goto = 1;    m_delete( id->variables, path()+vv );    l = l[..rn-1] + l[rn+1..];    }    if( do_goto )    {    if( !id->misc->do_not_goto )    {    id->misc->moreheads = ([ -  "Location":id->raw_url+"?random="+random(4949494)+"#"+path(), +  "Location":Roxen.http_encode_string(id->raw_url+"?random="+ +  random(4949494)+ +  "&section="+ +  id->variables->section+ +  "#"+path()),    ]);    if( id->misc->defines )    id->misc->defines[ " _error" ] = 302;    }    }    set( l ); // We are done. :-)    }       string render_form( RequestID id, void|mapping additional_args )    {    string prefix = path()+".";    int i;    -  _current_count++; -  +     string res = "<a name='"+path()+"'>\n</a><table>\n"    "<input type='hidden' name='"+prefix+"count' value='"+_current_count+"' />\n";       foreach( map(query(), transform_to_form), string val )    {    res += "<tr>\n<td><font size='-1'>"+ input( prefix+"set."+i, val, width) + "</font></td>\n";   #define BUTTON(X,Y) ("<submit-gbutton2 name='"+X+"'>"+Y+"</submit-gbutton2>")   #define REORDER(X,Y) ("<submit-gbutton2 name='"+X+"' icon-src='"+Y+"'></submit-gbutton2>")    if( i )    res += "\n<td>"+
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1142:    return res+"</select>";    }   }               // =================================================================   // Utility functions used in multiple variable classes above   // ================================================================= -  +    static array(string) verify_port( string port, int nofhttp )   {    if(!strlen(port))    return ({ 0, port });    string warning="";    if( (int)port )    {    warning += "Assuming http://*:"+port+"/ for "+port+"\n";    port = "http://*:"+port+"/";    }
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1168:    if(sscanf( port, "%[^:]://%[^/]%s", protocol, host, path ) != 3)    return ({""+port+" does not conform to URL syntax\n", port });       if( path == "" )    {    warning += "Added / to the end of "+port+"\n";    path = "/";    }    int pno;    if( sscanf( host, "%s:%d", host, pno ) == 2) -  { +     if( roxenp()->protocols[ lower_case( protocol ) ]    && (pno == roxenp()->protocols[ lower_case( protocol ) ]->default_port ))    warning += "Removed the "    "default port number ("+pno+") from "+port+"\n";    else    host = host+":"+pno; -  } +     if( nofhttp && protocol == "fhttp" )    {    warning += "Changed " + protocol + " to http\n";    protocol = "http";    }    if( protocol != lower_case( protocol ) )    {    warning += "Changed "+protocol+" to "+ lower_case( protocol )+"\n"; -  +  protocol = lower_case( protocol );    } -  +  if(!nofhttp) // it's a port, not a URL +  { + #if constant(Crypto) && constant(Crypto.rsa) && constant(Standards) && constant(Standards.PKCS.RSA) && constant(SSL) && constant(SSL.sslfile) +  /* All is A-OK */ + #else +  if( (protocol == "https" || protocol == "ftps") ) +  { +  warning += +  "SSL support not available in this pike version." +  "Transformed "+protocol+" to"; +  protocol = protocol[ ..strlen(protocol)-2 ]; +  warning += protocol+"\n"; +  } + #endif +  }    -  port = lower_case( protocol )+"://"+host+path; +  port = protocol+"://"+host+path;    -  if( !roxenp()->protocols[ lower_case( protocol ) ] ) -  warning += "Warning: The protocol "+lower_case(protocol)+" is unknown\n"; +  if( !roxenp()->protocols[ protocol ] ) +  warning += "Warning: The protocol "+protocol+" is unknown\n";    return ({ (strlen(warning)?warning:0), port });   }      static string input(string name, string value, int size,    void|mapping(string:string) args, void|int noxml)   {    if(!args)    args=([]);    else    args+=([]);