Roxen.git / server / config_interface / sites / create_site_with_template.pike

version» Context lines:

Roxen.git/server/config_interface/sites/create_site_with_template.pike:38:   {    if( !config_perm( "Create Site" ) )    error("No permission, dude!\n"); // This should not happen, really.    if( !id->variables->name )    error("No name for the site!\n"); // This should not happen either.       id->variables->name = decode_site_name( id->variables->name );       if (!id->variables->site_template ||    search(id->variables->site_template, "site_templates")!=-1 ) { -  foreach( glob( SITE_TEMPLATES "*.x", +  foreach( glob("*" SITE_TEMPLATES "*.x",    indices(id->variables) ), string t )    {    t = t[..sizeof(t)-3];    id->real_variables->site_template = ({ t });    id->variables->site_template = t;    }    }       License.LicenseVariable license =    License.LicenseVariable(getenv("ROXEN_LICENSEDIR") || "../license/", 0,
Roxen.git/server/config_interface/sites/create_site_with_template.pike:100:    id), id);    }    return sprintf(base,"<input name='site_template' type='hidden' "    "value='"+get_site_template(id)+"' />\n", q);    }       roxenloader.ErrorContainer e = roxenloader.ErrorContainer( );    master()->set_inhibit_compile_errors( e );    string res = "";    array sts = ({}); -  foreach( glob( "*.pike", get_dir( SITE_TEMPLATES ) | -  (get_dir( "../local/"+SITE_TEMPLATES )||({}))), -  string st ) -  { -  st = SITE_TEMPLATES+st; +  array(string) templates = ({}); +  foreach(({ "." }) + roxenloader->package_directories, +  string pkg_dir) { +  string template_dir = combine_path(pkg_dir, SITE_TEMPLATES); +  array(string) sts = get_dir(template_dir); +  if (!sts) continue; +  templates += map(glob( "*.pike", sts), +  lambda(string st, string template_dir) { +  return template_dir + st; +  }, template_dir); +  } +  +  foreach( templates, string st ) {    mixed err = catch {    program p;    object q; -  if (file_stat("../local/"+st)) -  p = (program)("../local/"+st); -  else +     p = (program)(st);    if(!p) {    report_error("Template \""+st+"\" failed to compile.\n");    continue;    }    q = p();    if( q->site_template )    {    string name, doc, group;    if( q[ "name_"+id->misc->cf_locale ] )