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.88 2005/02/04 20:14:44 mast Exp $ + // $Id: module.pmod,v 1.89 2005/02/11 15:26:01 mast Exp $      #include <module.h>   #include <roxen.h>      // Locale macros   //<locale-token project="roxen_config"> LOCALE </locale-token>      #define LOCALE(X,Y) \    ([string](mixed)Locale.translate("roxen_config",roxenp()->locale->get(),X,Y))   
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1643:    inherit List;    constant type="PortList";       string render_row( string prefix, mixed val, int width )    {    string res = "<input type=hidden name='"+prefix+"' value='"+prefix+"' />";       Standards.URI split = Standards.URI( val );       res += "<select name='"+prefix+"prot'>"; +  int default_port;    foreach( sort(indices( roxenp()->protocols )), string p )    { -  if( p == split->scheme ) +  if( p == split->scheme ) {    res += "<option selected='t'>"+p+"</option>"; -  +  default_port = roxenp()->protocols[p]->default_port; +  }    else    res += "<option>"+p+"</option>";    }    res += "</select>";       res += "://<input type=text name='"+prefix+"host' value='"+    Roxen.html_encode_string(split->host)+"' />";    res += ":<input type=text size=5 name='"+prefix+"port' value='"+ -  split->port+"' />"; +  (split->port == default_port ? "" : split->port) +"' />";       res += "/<input type=text name='"+prefix+"path' value='"+    Roxen.html_encode_string(split->path[1..])+"' /><br />";    mapping opts = ([]);    string a,b;    foreach( (split->fragment||"")/";", string x )    {    sscanf( x, "%s=%s", a, b );    opts[a]=b;    }
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1693:    return res;    }       string transform_from_form( string v, mapping va )    {    if( v == "" ) return "http://*/";    v = v[strlen(path())..];    if( strlen( va[v+"path"] ) && va[v+"path"][-1] != '/' )    va[v+"path"]+="/";    -  return (string)Standards.URI(va[v+"prot"]+"://"+va[v+"host"]+":"+ -  va[v+"port"]+"/"+va[v+"path"]+"#" +  return (string)Standards.URI(va[v+"prot"]+"://"+va[v+"host"]+ +  (va[v+"port"] && sizeof (va[v+"port"]) ? +  ":"+ va[v+"port"] : "") +"/"+va[v+"path"]+"#"    // all options below this point    "ip="+va[v+"ip"]+";"    "nobind="+va[v+"nobind"]+";"    );    }       array verify_set_from_form( array(string) new_value )    {    string warn = "";    array res = ({});