Ticket #329: 080511_default_theme_fix_frontpage.diff

File 080511_default_theme_fix_frontpage.diff, 2.8 kB (added by rho, 5 months ago)
  • a/mod/elggadmin/lib/elggadmin.inc.php

    old new  
    499499 
    500500function elggadmin_loadtpl($tplname) { 
    501501    global $CFG; 
    502     $tpl = $CFG->templatesroot . 'Default_Template/' . $tplname; 
     502    $tpl = $CFG->templatesroot . $CFG->default_template . '/' . $tplname; 
    503503    if (!is_writable($tpl)) { 
    504504        elgg_messages_add(__gettext("Please specify that <code>$tpl</code> is world-writable in order to use this administration panel.")); 
    505505    } 
     
    508508 
    509509function elggadmin_savetpl($tplname, $content) { 
    510510    global $CFG; 
    511     $tpl = $CFG->templatesroot . 'Default_Template/' . $tplname; 
     511    $tpl = $CFG->templatesroot . $CFG->default_template . '/' . $tplname; 
    512512    if (elggadmin_writefile($tpl, $content)) { 
    513513        return true; 
    514514    } else { 
  • a/mod/template/lib/default_template.php

    old new  
    22    global $CFG; 
    33    global $template; 
    44    global $template_definition; 
     5    global $messages; 
     6 
    57    $sitename = $CFG->sitename; 
    68     
    79    $template_definition[] = array( 
     
    3133     
    3234    templates_add_context('pageshell', $CFG->templatesroot . $CFG->default_template . '/pageshell'); 
    3335     
    34     templates_add_context('frontpage_loggedout', $CFG->templatesroot . $CFG->default_template . '/frontpage_loggedout'); 
    35     templates_add_context('frontpage_loggedin', $CFG->templatesroot . $CFG->default_template . '/frontpage_loggedin'); 
     36    if (file_exists($CFG->templatesroot . $CFG->default_template . '/frontpage_loggedout')) { 
     37        templates_add_context('frontpage_loggedout', $CFG->templatesroot . $CFG->default_template . '/frontpage_loggedout'); 
     38    } else { 
     39        templates_add_context('frontpage_loggedout', $CFG->templatesroot . 'Default_Template/frontpage_loggedout'); 
     40        if (isadmin()) { 
     41            $messages[] = sprintf(__gettext('The default theme selected (%s) does not have <code>frontpage_loggedout</code> template. Using default template.'), $CFG->default_template); 
     42        } 
     43    }  
     44 
     45    if (file_exists($CFG->templatesroot . $CFG->default_template . '/frontpage_loggedin')) { 
     46        templates_add_context('frontpage_loggedin', $CFG->templatesroot . $CFG->default_template . '/frontpage_loggedin'); 
     47    } else { 
     48        templates_add_context('frontpage_loggedin', $CFG->templatesroot . 'Default_Template/frontpage_loggedin'); 
     49        if (isadmin()) { 
     50            $messages[] = sprintf(__gettext('The default theme selected (%s) does not have <code>frontpage_loggedin</code> template. Using default template.'), $CFG->default_template); 
     51        } 
     52 
     53    } 
    3654 
    3755    $template_definition[] = array( 
    3856                                    'id' => 'contentholder',