Roxen.git / server / modules / configuration / config_filesystem.pike

version» Context lines:

Roxen.git/server/modules/configuration/config_filesystem.pike:9:   inherit "module";      //<locale-token project="roxen_config">LOCALE</locale-token>   #define LOCALE(X,Y) _DEF_LOCALE("roxen_config",X,Y)      constant module_type = MODULE_LOCATION;   LocaleString module_name = LOCALE(165,"Configuration Filesystem");   LocaleString module_doc =    LOCALE(166,"This filesystem serves the administration interface");    + constant thread_safe = 1;   constant module_unique = 1;   constant cvs_version = -  "$Id: config_filesystem.pike,v 1.125 2012/03/13 10:40:29 grubba Exp $"; +  "$Id$";      constant path = "config_interface/";    - object charset_decoder; + Charset.Decoder charset_decoder;      // NOTE: If we ever want to support more than one template, this   // optimization has to be removed, or at least changed to index on the   // directory of f.   string ctmpl;   string template_for( string f, object id )   {    if( ctmpl ) return ctmpl;    string current_dir = query_location()+dirname(f+"foo")+"/";    array cd = current_dir / "/";
Roxen.git/server/modules/configuration/config_filesystem.pike:210:    (id->not_query != (mountpt + "change_user.pike"))) {    string redir = Roxen.http_encode_url(id->raw_url);    return Roxen.http_redirect(mountpt + "?auth_redir=" + redir, id);    }       report_notice(LOCALE(169,"Login attempt from %s")+"\n",host);    return id->conf->authenticate_throw( id, "Roxen Administration Interface",    roxen.config_userdb_module );    }    +  string wizard_id = Roxen.get_wizard_id_cookie(id); +  if (!sizeof(wizard_id || "")) { +  wizard_id = Roxen.set_wizard_id_cookie(id); +  } +  if (sizeof(id->real_variables["_roxen_wizard_id"] || ({})) > 1) { +  // Multi submit. +  id->real_variables["_roxen_wizard_id"] = +  ({ id->real_variables["_roxen_wizard_id"][0] }); +  } +  if (wizard_id != id->variables["_roxen_wizard_id"]) { +  foreach(id->real_variables; string var;) { +  m_delete(id->real_variables, var); +  } +  id->variables["_roxen_wizard_id"] = wizard_id; +  }    encoding = config_setting( "charset" );    if( encoding != "utf-8" &&    encoding != "iso-8859-1")    catch { -  charset_decoder=Locale.Charset.decoder( encoding ); +  charset_decoder = Charset.decoder( encoding );    };    else    charset_decoder = 0;    id->since = 0;    catch    {    if( !id->misc->request_charset_decoded && encoding != "iso-8859-1" )    {    id->misc->request_charset_decoded = 1;   
Roxen.git/server/modules/configuration/config_filesystem.pike:400:    id = id->misc->orig;    string url = Roxen.http_decode_string(id->raw_url);    if( id->misc->request_charset_decoded )    if( charset_decoder )    url = charset_decoder()->clear()->feed( url )->drain();    else    url = utf8_to_string( url );    url+="?rv="+random(471187)->digits(32);    if( id->real_variables->section )    url += "&section="+id->real_variables->section[0]; +  if (string wizard_id_cookie = Roxen.get_wizard_id_cookie(id)) { +  url += "&_roxen_wizard_id=" + wizard_id_cookie; +  }    retval = Roxen.http_redirect( url, id );    }    } else {    // Most likely cacheable for quite a while.    id->misc->cacheable = 100000; // 2 days, 4:46:40    }    if( stringp( retval ) )    retval = Roxen.http_string_answer( retval, type );    return retval;   }
Roxen.git/server/modules/configuration/config_filesystem.pike:429:    if( !(docs = DBManager.get( "docs", cfg ) ) ||    (err = catch( old_version = DBManager.get( "docs", cfg )    ->query("SELECT contents FROM docs where name='_version'") )) ||    ((!sizeof(old_version) || old_version[0]->contents!=roxen_version()) &&    (ver=1)) )    {    if( !err && DBManager.get( "docs" ) && !ver )    report_warning( "The database 'docs' exists, but this server can "    "not read from it.\n"    "Documentation will be unavailable.\n" ); -  else if( file_stat( "etc/docs.frm" ) ) +  else if( file_stat( "etc/docs/dump.sql" ) )    {    if( !err && ver )    {    report_notice("Removing old 'docs' database.\n");    DBManager.drop_db("docs");    }    // Restore from "backup".    if( !err )    {    report_notice("Creating the 'docs' database.\n");    DBManager.create_db( "docs", 0, 1 );    DBManager.is_module_db( this_module(), "docs", "All documentation");    foreach( roxen->configurations, Configuration c )    DBManager.set_permission( "docs", c, DBManager.READ );    } -  DBManager.restore( "docs", getcwd()+"/etc/", "docs", ({ "docs" }) ); +  DBManager.restore( "docs", getcwd()+"/etc/docs", "docs", ({ "docs" }) );    DBManager.set_permission( "docs", cfg, DBManager.WRITE );    DBManager.get( "docs", cfg )->query("REPLACE docs set name='_version', contents='"+roxen_version()+"'");    DBManager.set_permission( "docs", cfg, DBManager.READ );    docs = DBManager.get( "docs", cfg );    }    else    { -  report_warning( "There is no documentation available\n"); +  report_warning( "There is no documentation available.\n");    }    }    string am = query( "auth_method" );       foreach( ({ "auth_httpbasic", "auth_httpcookie" }), string s )    {    if( am != s )    {    m_delete( cfg->enabled_modules, s+"#0" );    if( cfg->find_module( s+"#0" ) )
Roxen.git/server/modules/configuration/config_filesystem.pike:477:    cfg->enable_module( s+"#0" );    }   #ifndef AVERAGE_PROFILING    m_delete( cfg->enabled_modules, "avg_profiling#0" );    if( cfg->find_module( "avg_profiling#0" ) )    cfg->disable_module( "avg_profiling#0" );   #endif    module_dependencies(cfg, ({    "config_tags", "contenttypes", "indexfiles", "atlas",    "gbutton", "graphic_text", "pathinfo", "javascript_support", -  "pikescript", "translation_mod", "rxmlparse", "rxmltags", -  "tablist", "cimg", "gxml", +  "rxmlparse", "rxmltags", "translation_mod", +  "tablist", "cimg", "gxml", "config_json",   #ifdef AVERAGE_PROFILING    "avg_profiling",   #endif    }));    -  +  module_dependencies(cfg, ({ "pikescript" }), 1); +     RoxenModule m;    if( m = cfg->find_module( "pikescript#0" ) )    {   #ifndef DEBUG    m->set( "autoreload", 0 );    m->set( "explicitreload", 0 );   #else    m->set( "autoreload", 1 );    m->set( "explicitreload", 1 );   #endif   #if constant(__builtin.security)    m->set( "trusted", 1 );   #endif    m->save(); // also forces call to start    }   #ifdef DEBUG    else -  report_warning( "Failed to enable the pikescript module" ); +  report_warning( "Failed to enable the pikescript module.\n" );   #endif    }    call_out( zap_old_modules, 0 );   }      void zap_old_modules()   {    if( my_configuration()->find_module("awizard#0") )    my_configuration()->disable_module( "awizard#0" );    if( my_configuration()->find_module("config_userdb#0") )
Roxen.git/server/modules/configuration/config_filesystem.pike:531:    LOCALE(219,"Authentication method"),    TYPE_STRING_LIST,    LOCALE(291,"The method to use to authenticate configuration interface "    "users." ),    ([    "auth_httpbasic":LOCALE(301,"HTTP Basic passwords" ),    "auth_httpcookie":LOCALE(325,"HTTP Cookies" ),    ]) );       roxen.add_permission( "View Settings", LOCALE(192, "View Settings")); -  roxen.add_permission( "Update", LOCALE(349, "Update Client")); +  roxen.add_permission( "Update", LOCALE(349, "Apply Patches"));    roxen.add_permission( "Edit Global Variables",    LOCALE(194, "Edit Global Variables"));    roxen.add_permission( "Tasks", LOCALE(196, "Tasks"));    roxen.add_permission( "Restart", LOCALE(197, "Restart"));    roxen.add_permission( "Shutdown", LOCALE(198, "Shutdown"));    roxen.add_permission( "Create Site", LOCALE(199, "Create Sites"));    roxen.add_permission( "Add Module", LOCALE(200, "Add Modules"));   }