includes/template.php
changeset 57 b354deeaa4c4
parent 54 84b56303cab5
child 59 7c4a851fb5c5
equal deleted inserted replaced
56:eb8eacb056d1 57:b354deeaa4c4
    40     $this->toolbar_menu = '';
    40     $this->toolbar_menu = '';
    41     $this->additional_headers = '';
    41     $this->additional_headers = '';
    42     $this->plugin_blocks = Array();
    42     $this->plugin_blocks = Array();
    43     $this->theme_loaded = false;
    43     $this->theme_loaded = false;
    44     
    44     
    45     $fading_button = '<a href="http://enanocms.org" onclick="window.open(this.href); return false;" style="text-align: center; margin: 0 auto; display: table; background-image: none;">
    45     $fading_button = '<a href="http://enanocms.org" onclick="if ( !KILL_SWITCH ) { window.open(this.href); return false; }" style="text-align: center; margin: 0 auto; display: table; background-image: none;">
    46                             <img alt="Powered by Enano CMS" style="border-width: 0; position: absolute;" 
    46                             <img alt="Powered by Enano CMS" style="border-width: 0; position: absolute;" 
    47                                  src="' . scriptPath . '/images/about-powered-enano.png" id="enanoFader" onmouseover="domOpacity(this, 100, 0, 500);" 
    47                                  src="' . scriptPath . '/images/about-powered-enano.png" id="enanoFader" onmouseover="domOpacity(this, 100, 0, 500);" 
    48                                  onmouseout="opacity(this.id, 0, 100, 500);" />
    48                                  onmouseout="opacity(this.id, 0, 100, 500);" />
    49                             <img alt="Powered by Enano CMS" style="border-width: 0px;" src="' . scriptPath . '/images/about-powered-enano-hover.png" />
    49                             <img alt="Powered by Enano CMS" style="border-width: 0px;" src="' . scriptPath . '/images/about-powered-enano-hover.png" />
    50                           </a>';
    50                           </a>';
   245     
   245     
   246     $btn_selected = ( isset($tplvars['toolbar_button_selected'])) ? $tplvars['toolbar_button_selected'] : $tplvars['toolbar_button'];
   246     $btn_selected = ( isset($tplvars['toolbar_button_selected'])) ? $tplvars['toolbar_button_selected'] : $tplvars['toolbar_button'];
   247     $parser = $this->makeParserText($btn_selected);
   247     $parser = $this->makeParserText($btn_selected);
   248     
   248     
   249     $parser->assign_vars(array(
   249     $parser->assign_vars(array(
   250         'FLAGS' => 'onclick="void(ajaxReset()); return false;" title="View the page contents, all of the page contents, and nothing but the page contents (alt-a)" accesskey="a"',
   250         'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxReset()); return false; }" title="View the page contents, all of the page contents, and nothing but the page contents (alt-a)" accesskey="a"',
   251         'PARENTFLAGS' => 'id="mdgToolbar_article"',
   251         'PARENTFLAGS' => 'id="mdgToolbar_article"',
   252         'HREF' => makeUrl($paths->page, null, true),
   252         'HREF' => makeUrl($paths->page, null, true),
   253         'TEXT' => $this->namespace_string
   253         'TEXT' => $this->namespace_string
   254       ));
   254       ));
   255     
   255     
   289       {
   289       {
   290         $n .= ' total/'.$nu.' unapp.';
   290         $n .= ' total/'.$nu.' unapp.';
   291       }
   291       }
   292       
   292       
   293       $button->assign_vars(array(
   293       $button->assign_vars(array(
   294           'FLAGS' => 'onclick="void(ajaxComments()); return false;" title="View the comments that other users have posted about this page (alt-c)" accesskey="c"',
   294           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxComments()); return false; }" title="View the comments that other users have posted about this page (alt-c)" accesskey="c"',
   295           'PARENTFLAGS' => 'id="mdgToolbar_discussion"',
   295           'PARENTFLAGS' => 'id="mdgToolbar_discussion"',
   296           'HREF' => makeUrl($paths->page, 'do=comments', true),
   296           'HREF' => makeUrl($paths->page, 'do=comments', true),
   297           'TEXT' => 'discussion ('.$n.')',
   297           'TEXT' => 'discussion ('.$n.')',
   298         ));
   298         ));
   299       
   299       
   301     }
   301     }
   302     // Edit button
   302     // Edit button
   303     if($session->get_permissions('read') && ($paths->namespace != 'Special' && $paths->namespace != 'Admin') && ( $session->get_permissions('edit_page') && ( ( $paths->page_protected && $session->get_permissions('even_when_protected') ) || !$paths->page_protected ) ) )
   303     if($session->get_permissions('read') && ($paths->namespace != 'Special' && $paths->namespace != 'Admin') && ( $session->get_permissions('edit_page') && ( ( $paths->page_protected && $session->get_permissions('even_when_protected') ) || !$paths->page_protected ) ) )
   304     {
   304     {
   305       $button->assign_vars(array(
   305       $button->assign_vars(array(
   306         'FLAGS' => 'onclick="void(ajaxEditor()); return false;" title="Edit the contents of this page (alt-e)" accesskey="e"',
   306         'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxEditor()); return false; }" title="Edit the contents of this page (alt-e)" accesskey="e"',
   307         'PARENTFLAGS' => 'id="mdgToolbar_edit"',
   307         'PARENTFLAGS' => 'id="mdgToolbar_edit"',
   308         'HREF' => makeUrl($paths->page, 'do=edit', true),
   308         'HREF' => makeUrl($paths->page, 'do=edit', true),
   309         'TEXT' => 'edit this page'
   309         'TEXT' => 'edit this page'
   310         ));
   310         ));
   311       $tb .= $button->run();
   311       $tb .= $button->run();
   312     // View source button
   312     // View source button
   313     }
   313     }
   314     else if($session->get_permissions('view_source') && ( !$session->get_permissions('edit_page') || !$session->get_permissions('even_when_protected') && $paths->page_protected ) && $paths->namespace != 'Special' && $paths->namespace != 'Admin') 
   314     else if($session->get_permissions('view_source') && ( !$session->get_permissions('edit_page') || !$session->get_permissions('even_when_protected') && $paths->page_protected ) && $paths->namespace != 'Special' && $paths->namespace != 'Admin') 
   315     {
   315     {
   316       $button->assign_vars(array(
   316       $button->assign_vars(array(
   317         'FLAGS' => 'onclick="void(ajaxViewSource()); return false;" title="View the source code (wiki markup) that this page uses (alt-e)" accesskey="e"',
   317         'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxViewSource()); return false; }" title="View the source code (wiki markup) that this page uses (alt-e)" accesskey="e"',
   318         'PARENTFLAGS' => 'id="mdgToolbar_edit"',
   318         'PARENTFLAGS' => 'id="mdgToolbar_edit"',
   319         'HREF' => makeUrl($paths->page, 'do=viewsource', true),
   319         'HREF' => makeUrl($paths->page, 'do=viewsource', true),
   320         'TEXT' => 'view source'
   320         'TEXT' => 'view source'
   321         ));
   321         ));
   322       $tb .= $button->run();
   322       $tb .= $button->run();
   323     }
   323     }
   324     // History button
   324     // History button
   325     if ( $session->get_permissions('read') /* && $paths->wiki_mode */ && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' && $session->get_permissions('history_view') )
   325     if ( $session->get_permissions('read') /* && $paths->wiki_mode */ && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' && $session->get_permissions('history_view') )
   326     {
   326     {
   327       $button->assign_vars(array(
   327       $button->assign_vars(array(
   328         'FLAGS'       => 'onclick="void(ajaxHistory()); return false;" title="View a log of actions taken on this page (alt-h)" accesskey="h"',
   328         'FLAGS'       => 'onclick="if ( !KILL_SWITCH ) { void(ajaxHistory()); return false; }" title="View a log of actions taken on this page (alt-h)" accesskey="h"',
   329         'PARENTFLAGS' => 'id="mdgToolbar_history"',
   329         'PARENTFLAGS' => 'id="mdgToolbar_history"',
   330         'HREF'        => makeUrl($paths->page, 'do=history', true),
   330         'HREF'        => makeUrl($paths->page, 'do=history', true),
   331         'TEXT'        => 'history'
   331         'TEXT'        => 'history'
   332         ));
   332         ));
   333       $tb .= $button->run();
   333       $tb .= $button->run();
   338     // Additional actions menu
   338     // Additional actions menu
   339     // Rename button
   339     // Rename button
   340     if ( $session->get_permissions('read') && $paths->page_exists && ( $session->get_permissions('rename') && ( $paths->page_protected && $session->get_permissions('even_when_protected') || !$paths->page_protected ) ) && $paths->namespace != 'Special' && $paths->namespace != 'Admin' )
   340     if ( $session->get_permissions('read') && $paths->page_exists && ( $session->get_permissions('rename') && ( $paths->page_protected && $session->get_permissions('even_when_protected') || !$paths->page_protected ) ) && $paths->namespace != 'Special' && $paths->namespace != 'Admin' )
   341     {
   341     {
   342       $menubtn->assign_vars(array(
   342       $menubtn->assign_vars(array(
   343           'FLAGS' => 'onclick="void(ajaxRename()); return false;" title="Change the display name of this page (alt-r)" accesskey="r"',
   343           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxRename()); return false; }" title="Change the display name of this page (alt-r)" accesskey="r"',
   344           'HREF'  => makeUrl($paths->page, 'do=rename', true),
   344           'HREF'  => makeUrl($paths->page, 'do=rename', true),
   345           'TEXT'  => 'rename',
   345           'TEXT'  => 'rename',
   346         ));
   346         ));
   347       $this->toolbar_menu .= $menubtn->run();
   347       $this->toolbar_menu .= $menubtn->run();
   348     }
   348     }
   349     
   349     
   350     // Vote-to-delete button
   350     // Vote-to-delete button
   351     if ( $paths->wiki_mode && $session->get_permissions('vote_delete') && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin')
   351     if ( $paths->wiki_mode && $session->get_permissions('vote_delete') && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin')
   352     {
   352     {
   353       $menubtn->assign_vars(array(
   353       $menubtn->assign_vars(array(
   354           'FLAGS' => 'onclick="void(ajaxDelVote()); return false;" title="Vote to have this page deleted (alt-d)" accesskey="d"',
   354           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxDelVote()); return false; }" title="Vote to have this page deleted (alt-d)" accesskey="d"',
   355           'HREF'  => makeUrl($paths->page, 'do=delvote', true),
   355           'HREF'  => makeUrl($paths->page, 'do=delvote', true),
   356           'TEXT'  => 'vote to delete this page',
   356           'TEXT'  => 'vote to delete this page',
   357         ));
   357         ));
   358       $this->toolbar_menu .= $menubtn->run();
   358       $this->toolbar_menu .= $menubtn->run();
   359     }
   359     }
   360     
   360     
   361     // Clear-votes button
   361     // Clear-votes button
   362     if ( $session->get_permissions('read') && $paths->wiki_mode && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' && $session->get_permissions('vote_reset') && $paths->cpage['delvotes'] > 0)
   362     if ( $session->get_permissions('read') && $paths->wiki_mode && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' && $session->get_permissions('vote_reset') && $paths->cpage['delvotes'] > 0)
   363     {
   363     {
   364       $menubtn->assign_vars(array(
   364       $menubtn->assign_vars(array(
   365           'FLAGS' => 'onclick="void(ajaxResetDelVotes()); return false;" title="Vote to have this page deleted (alt-y)" accesskey="y"',
   365           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxResetDelVotes()); return false; }" title="Vote to have this page deleted (alt-y)" accesskey="y"',
   366           'HREF'  => makeUrl($paths->page, 'do=resetvotes', true),
   366           'HREF'  => makeUrl($paths->page, 'do=resetvotes', true),
   367           'TEXT'  => 'reset deletion votes',
   367           'TEXT'  => 'reset deletion votes',
   368         ));
   368         ));
   369       $this->toolbar_menu .= $menubtn->run();
   369       $this->toolbar_menu .= $menubtn->run();
   370     }
   370     }
   392       if ( $paths->cpage['protected'] == 1 )
   392       if ( $paths->cpage['protected'] == 1 )
   393       {
   393       {
   394         $ctmp=' style="text-decoration: underline;"';
   394         $ctmp=' style="text-decoration: underline;"';
   395       }
   395       }
   396       $menubtn->assign_vars(array(
   396       $menubtn->assign_vars(array(
   397           'FLAGS' => 'accesskey="i" onclick="ajaxProtect(1); return false;" id="protbtn_1" title="Prevents all non-administrators from editing this page. [alt-i]"'.$ctmp,
   397           'FLAGS' => 'accesskey="i" onclick="if ( !KILL_SWITCH ) { ajaxProtect(1); return false; }" id="protbtn_1" title="Prevents all non-administrators from editing this page. [alt-i]"'.$ctmp,
   398           'HREF'  => makeUrl($paths->page, 'do=protect&level=1', true),
   398           'HREF'  => makeUrl($paths->page, 'do=protect&level=1', true),
   399           'TEXT'  => 'on'
   399           'TEXT'  => 'on'
   400         ));
   400         ));
   401       $t1 = $menubtn->run();
   401       $t1 = $menubtn->run();
   402       
   402       
   404       if ( $paths->cpage['protected'] == 0 )
   404       if ( $paths->cpage['protected'] == 0 )
   405       {
   405       {
   406         $ctmp=' style="text-decoration: underline;"';
   406         $ctmp=' style="text-decoration: underline;"';
   407       }
   407       }
   408       $menubtn->assign_vars(array(
   408       $menubtn->assign_vars(array(
   409           'FLAGS' => 'accesskey="o" onclick="ajaxProtect(0); return false;" id="protbtn_0" title="Allows everyone to edit this page. [alt-o]"'.$ctmp,
   409           'FLAGS' => 'accesskey="o" onclick="if ( !KILL_SWITCH ) { ajaxProtect(0); return false; }" id="protbtn_0" title="Allows everyone to edit this page. [alt-o]"'.$ctmp,
   410           'HREF'  => makeUrl($paths->page, 'do=protect&level=0', true),
   410           'HREF'  => makeUrl($paths->page, 'do=protect&level=0', true),
   411           'TEXT'  => 'off'
   411           'TEXT'  => 'off'
   412         ));
   412         ));
   413       $t2 = $menubtn->run();
   413       $t2 = $menubtn->run();
   414       
   414       
   416       if ( $paths->cpage['protected'] == 2 )
   416       if ( $paths->cpage['protected'] == 2 )
   417       {
   417       {
   418         $ctmp = ' style="text-decoration: underline;"';
   418         $ctmp = ' style="text-decoration: underline;"';
   419       }
   419       }
   420       $menubtn->assign_vars(array(
   420       $menubtn->assign_vars(array(
   421           'FLAGS' => 'accesskey="p" onclick="ajaxProtect(2); return false;" id="protbtn_2" title="Allows only users who have been registered for 4 days to edit this page. [alt-p]"'.$ctmp,
   421           'FLAGS' => 'accesskey="p" onclick="if ( !KILL_SWITCH ) { ajaxProtect(2); return false; }" id="protbtn_2" title="Allows only users who have been registered for 4 days to edit this page. [alt-p]"'.$ctmp,
   422           'HREF'  => makeUrl($paths->page, 'do=protect&level=2', true),
   422           'HREF'  => makeUrl($paths->page, 'do=protect&level=2', true),
   423           'TEXT'  => 'semi'
   423           'TEXT'  => 'semi'
   424         ));
   424         ));
   425       $t3 = $menubtn->run();
   425       $t3 = $menubtn->run();
   426       
   426       
   447       if ( $paths->cpage['wiki_mode'] == 1 )
   447       if ( $paths->cpage['wiki_mode'] == 1 )
   448       {
   448       {
   449         $ctmp = ' style="text-decoration: underline;"';
   449         $ctmp = ' style="text-decoration: underline;"';
   450       }
   450       }
   451       $menubtn->assign_vars(array(
   451       $menubtn->assign_vars(array(
   452           'FLAGS' => 'onclick="ajaxSetWikiMode(1); return false;" id="wikibtn_1" title="Forces wiki functions to be allowed on this page."'.$ctmp,
   452           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { ajaxSetWikiMode(1); return false; }" id="wikibtn_1" title="Forces wiki functions to be allowed on this page."'.$ctmp,
   453           'HREF' => makeUrl($paths->page, 'do=setwikimode&level=1', true),
   453           'HREF' => makeUrl($paths->page, 'do=setwikimode&level=1', true),
   454           'TEXT' => 'on'
   454           'TEXT' => 'on'
   455         ));
   455         ));
   456       $t1 = $menubtn->run();
   456       $t1 = $menubtn->run();
   457       
   457       
   460       if ( $paths->cpage['wiki_mode'] == 0 )
   460       if ( $paths->cpage['wiki_mode'] == 0 )
   461       {
   461       {
   462         $ctmp=' style="text-decoration: underline;"';
   462         $ctmp=' style="text-decoration: underline;"';
   463       }
   463       }
   464       $menubtn->assign_vars(array(
   464       $menubtn->assign_vars(array(
   465           'FLAGS' => 'onclick="ajaxSetWikiMode(0); return false;" id="wikibtn_0" title="Forces wiki functions to be disabled on this page."'.$ctmp,
   465           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { ajaxSetWikiMode(0); return false; }" id="wikibtn_0" title="Forces wiki functions to be disabled on this page."'.$ctmp,
   466           'HREF' => makeUrl($paths->page, 'do=setwikimode&level=0', true),
   466           'HREF' => makeUrl($paths->page, 'do=setwikimode&level=0', true),
   467           'TEXT' => 'off'
   467           'TEXT' => 'off'
   468         ));
   468         ));
   469       $t2 = $menubtn->run();
   469       $t2 = $menubtn->run();
   470       
   470       
   473       if ( $paths->cpage['wiki_mode'] == 2 )
   473       if ( $paths->cpage['wiki_mode'] == 2 )
   474       {
   474       {
   475         $ctmp=' style="text-decoration: underline;"';
   475         $ctmp=' style="text-decoration: underline;"';
   476       }
   476       }
   477       $menubtn->assign_vars(array(
   477       $menubtn->assign_vars(array(
   478           'FLAGS' => 'onclick="ajaxSetWikiMode(2); return false;" id="wikibtn_2" title="Causes this page to use the global wiki mode setting (default)"'.$ctmp,
   478           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { ajaxSetWikiMode(2); return false; }" id="wikibtn_2" title="Causes this page to use the global wiki mode setting (default)"'.$ctmp,
   479           'HREF' => makeUrl($paths->page, 'do=setwikimode&level=2', true),
   479           'HREF' => makeUrl($paths->page, 'do=setwikimode&level=2', true),
   480           'TEXT' => 'global'
   480           'TEXT' => 'global'
   481         ));
   481         ));
   482       $t3 = $menubtn->run();
   482       $t3 = $menubtn->run();
   483       
   483       
   494     
   494     
   495     // Clear logs button
   495     // Clear logs button
   496     if ( $session->get_permissions('read') && $session->get_permissions('clear_logs') && $paths->namespace != 'Special' && $paths->namespace != 'Admin' )
   496     if ( $session->get_permissions('read') && $session->get_permissions('clear_logs') && $paths->namespace != 'Special' && $paths->namespace != 'Admin' )
   497     {
   497     {
   498       $menubtn->assign_vars(array(
   498       $menubtn->assign_vars(array(
   499           'FLAGS' => 'onclick="void(ajaxClearLogs()); return false;" title="Remove all edit and action logs for this page from the database. IRREVERSIBLE! (alt-l)" accesskey="l"',
   499           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxClearLogs()); return false; }" title="Remove all edit and action logs for this page from the database. IRREVERSIBLE! (alt-l)" accesskey="l"',
   500           'HREF'  => makeUrl($paths->page, 'do=flushlogs', true),
   500           'HREF'  => makeUrl($paths->page, 'do=flushlogs', true),
   501           'TEXT'  => 'clear page logs',
   501           'TEXT'  => 'clear page logs',
   502         ));
   502         ));
   503       $this->toolbar_menu .= $menubtn->run();
   503       $this->toolbar_menu .= $menubtn->run();
   504     }
   504     }
   515       {
   515       {
   516         $s .= ' (<b>'.$paths->cpage['delvotes'].'</b> votes)';
   516         $s .= ' (<b>'.$paths->cpage['delvotes'].'</b> votes)';
   517       }
   517       }
   518       
   518       
   519       $menubtn->assign_vars(array(
   519       $menubtn->assign_vars(array(
   520           'FLAGS' => 'onclick="void(ajaxDeletePage()); return false;" title="Delete this page. This is always reversible unless the logs are cleared. (alt-k)" accesskey="k"',
   520           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxDeletePage()); return false; }" title="Delete this page. This is always reversible unless the logs are cleared. (alt-k)" accesskey="k"',
   521           'HREF'  => makeUrl($paths->page, 'do=deletepage', true),
   521           'HREF'  => makeUrl($paths->page, 'do=deletepage', true),
   522           'TEXT'  => $s,
   522           'TEXT'  => $s,
   523         ));
   523         ));
   524       $this->toolbar_menu .= $menubtn->run();
   524       $this->toolbar_menu .= $menubtn->run();
   525       
   525       
   547       $label = $this->makeParserText($tplvars['toolbar_label']);
   547       $label = $this->makeParserText($tplvars['toolbar_label']);
   548       $label->assign_vars(array('TEXT' => 'page password:'));
   548       $label->assign_vars(array('TEXT' => 'page password:'));
   549       $t0 = $label->run();
   549       $t0 = $label->run();
   550       
   550       
   551       $menubtn->assign_vars(array(
   551       $menubtn->assign_vars(array(
   552           'FLAGS' => 'onclick="void(ajaxSetPassword()); return false;" title="Require a password in order for this page to be viewed"',
   552           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxSetPassword()); return false; }" title="Require a password in order for this page to be viewed"',
   553           'HREF'  => '#',
   553           'HREF'  => '#',
   554           'TEXT'  => 'set',
   554           'TEXT'  => 'set',
   555         ));
   555         ));
   556       $t = $menubtn->run();
   556       $t = $menubtn->run();
   557       
   557       
   560     
   560     
   561     // Manage ACLs button
   561     // Manage ACLs button
   562     if($session->get_permissions('edit_acl') || $session->user_level >= USER_LEVEL_ADMIN)
   562     if($session->get_permissions('edit_acl') || $session->user_level >= USER_LEVEL_ADMIN)
   563     {
   563     {
   564       $menubtn->assign_vars(array(
   564       $menubtn->assign_vars(array(
   565           'FLAGS' => 'onclick="return ajaxOpenACLManager();" title="Manage who can do what with this page (alt-m)" accesskey="m"',
   565           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { return ajaxOpenACLManager(); }" title="Manage who can do what with this page (alt-m)" accesskey="m"',
   566           'HREF'  => makeUrl($paths->page, 'do=aclmanager', true),
   566           'HREF'  => makeUrl($paths->page, 'do=aclmanager', true),
   567           'TEXT'  => 'manage page access',
   567           'TEXT'  => 'manage page access',
   568         ));
   568         ));
   569       $this->toolbar_menu .= $menubtn->run();
   569       $this->toolbar_menu .= $menubtn->run();
   570     }
   570     }
   571     
   571     
   572     // Administer page button
   572     // Administer page button
   573     if ( $session->user_level >= USER_LEVEL_ADMIN && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' )
   573     if ( $session->user_level >= USER_LEVEL_ADMIN && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' )
   574     {
   574     {
   575       $menubtn->assign_vars(array(
   575       $menubtn->assign_vars(array(
   576           'FLAGS' => 'onclick="void(ajaxAdminPage()); return false;" title="Administrative options for this page" accesskey="g"',
   576           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxAdminPage()); return false; }" title="Administrative options for this page" accesskey="g"',
   577           'HREF'  => makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'PageManager', true),
   577           'HREF'  => makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'PageManager', true),
   578           'TEXT'  => 'administrative options',
   578           'TEXT'  => 'administrative options',
   579         ));
   579         ));
   580       $this->toolbar_menu .= $menubtn->run();
   580       $this->toolbar_menu .= $menubtn->run();
   581     }
   581     }
   582     
   582     
   583     if ( strlen($this->toolbar_menu) > 0 )
   583     if ( strlen($this->toolbar_menu) > 0 )
   584     {
   584     {
   585       $button->assign_vars(array(
   585       $button->assign_vars(array(
   586         'FLAGS'       => 'id="mdgToolbar_moreoptions" onclick="return false;" title="Additional options for working with this page"',
   586         'FLAGS'       => 'id="mdgToolbar_moreoptions" onclick="if ( !KILL_SWITCH ) { return false; }" title="Additional options for working with this page"',
   587         'PARENTFLAGS' => '',
   587         'PARENTFLAGS' => '',
   588         'HREF'        => makeUrl($paths->page, 'do=moreoptions', true),
   588         'HREF'        => makeUrl($paths->page, 'do=moreoptions', true),
   589         'TEXT'        => 'more options'
   589         'TEXT'        => 'more options'
   590         ));
   590         ));
   591       $tb .= $button->run();
   591       $tb .= $button->run();
   641     
   641     
   642     $parser = $this->makeParserText($tplvars['sidebar_button']);
   642     $parser = $this->makeParserText($tplvars['sidebar_button']);
   643     
   643     
   644     $parser->assign_vars(Array(
   644     $parser->assign_vars(Array(
   645         'HREF'=>makeUrlNS('Special', 'Logout'),
   645         'HREF'=>makeUrlNS('Special', 'Logout'),
   646         'FLAGS'=>'onclick="mb_logout(); return false;"',
   646         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { mb_logout(); return false; }"',
   647         'TEXT'=>'Log out',
   647         'TEXT'=>'Log out',
   648       ));
   648       ));
   649     
   649     
   650     $logout_link = $parser->run();
   650     $logout_link = $parser->run();
   651     
   651     
   652     $parser->assign_vars(Array(
   652     $parser->assign_vars(Array(
   653         'HREF'=>makeUrlNS('Special', 'Login/' . $paths->page),
   653         'HREF'=>makeUrlNS('Special', 'Login/' . $paths->page),
   654         'FLAGS'=>'onclick="ajaxStartLogin(); return false;"',
   654         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { ajaxStartLogin(); return false; }"',
   655         'TEXT'=>'Log in',
   655         'TEXT'=>'Log in',
   656       ));
   656       ));
   657     
   657     
   658     $login_link = $parser->run();
   658     $login_link = $parser->run();
   659     
   659     
   660     $parser->assign_vars(Array(
   660     $parser->assign_vars(Array(
   661         'HREF'=>makeUrlNS('Special', 'ChangeStyle/'.$paths->page),
   661         'HREF'=>makeUrlNS('Special', 'ChangeStyle/'.$paths->page),
   662         'FLAGS'=>'onclick="ajaxChangeStyle(); return false;"',
   662         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { ajaxChangeStyle(); return false; }"',
   663         'TEXT'=>'Change theme',
   663         'TEXT'=>'Change theme',
   664       ));
   664       ));
   665     
   665     
   666     $theme_link = $parser->run();
   666     $theme_link = $parser->run();
   667     
   667     
  1233   function tinymce_textarea($name, $content = '', $rows = 20, $cols = 60)
  1233   function tinymce_textarea($name, $content = '', $rows = 20, $cols = 60)
  1234   {
  1234   {
  1235     $randomid = md5(microtime() . mt_rand());
  1235     $randomid = md5(microtime() . mt_rand());
  1236     $html = '';
  1236     $html = '';
  1237     $html .= '<textarea name="' . $name . '" rows="'.$rows.'" cols="'.$cols.'" style="width: 100%;" id="toggleMCEroot_'.$randomid.'">' . $content . '</textarea>';
  1237     $html .= '<textarea name="' . $name . '" rows="'.$rows.'" cols="'.$cols.'" style="width: 100%;" id="toggleMCEroot_'.$randomid.'">' . $content . '</textarea>';
  1238     $html .= '<div style="float: right; display: table;" id="mceSwitchAgent_' . $randomid . '">text editor&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#" onclick="toggleMCE_'.$randomid.'(); return false;">graphical editor</a></div>';
  1238     $html .= '<div style="float: right; display: table;" id="mceSwitchAgent_' . $randomid . '">text editor&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#" onclick="if ( !KILL_SWITCH ) { toggleMCE_'.$randomid.'(); return false; }">graphical editor</a></div>';
  1239     $html .= '<script type="text/javascript">
  1239     $html .= '<script type="text/javascript">
  1240                 // <![CDATA[
  1240                 // <![CDATA[
  1241                 function toggleMCE_'.$randomid.'()
  1241                 function toggleMCE_'.$randomid.'()
  1242                 {
  1242                 {
  1243                   var the_obj = document.getElementById(\'toggleMCEroot_' . $randomid . '\');
  1243                   var the_obj = document.getElementById(\'toggleMCEroot_' . $randomid . '\');
  1244                   var panel = document.getElementById(\'mceSwitchAgent_' . $randomid . '\');
  1244                   var panel = document.getElementById(\'mceSwitchAgent_' . $randomid . '\');
  1245                   if ( the_obj.dnIsMCE == "yes" )
  1245                   if ( the_obj.dnIsMCE == "yes" )
  1246                   {
  1246                   {
  1247                     $dynano(the_obj).destroyMCE();
  1247                     $dynano(the_obj).destroyMCE();
  1248                     panel.innerHTML = \'text editor&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#" onclick="toggleMCE_'.$randomid.'(); return false;">graphical editor</a>\';
  1248                     panel.innerHTML = \'text editor&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#" onclick="if ( !KILL_SWITCH ) { toggleMCE_'.$randomid.'(); return false; }">graphical editor</a>\';
  1249                   }
  1249                   }
  1250                   else
  1250                   else
  1251                   {
  1251                   {
  1252                     $dynano(the_obj).switchToMCE();
  1252                     $dynano(the_obj).switchToMCE();
  1253                     panel.innerHTML = \'<a href="#" onclick="toggleMCE_'.$randomid.'(); return false;">text editor</a>&nbsp;&nbsp;|&nbsp;&nbsp;graphical editor\';
  1253                     panel.innerHTML = \'<a href="#" onclick="if ( !KILL_SWITCH ) { toggleMCE_'.$randomid.'(); return false; }">text editor</a>&nbsp;&nbsp;|&nbsp;&nbsp;graphical editor\';
  1254                   }
  1254                   }
  1255                 }
  1255                 }
  1256                 // ]]>
  1256                 // ]]>
  1257               </script>';
  1257               </script>';
  1258     return $html;
  1258     return $html;
  1383     // SourceForge/W3C buttons
  1383     // SourceForge/W3C buttons
  1384     $ob = Array();
  1384     $ob = Array();
  1385     $admintitle = ( $session->user_level >= USER_LEVEL_ADMIN ) ? 'title="You may disable this button in the admin panel under General Configuration."' : '';
  1385     $admintitle = ( $session->user_level >= USER_LEVEL_ADMIN ) ? 'title="You may disable this button in the admin panel under General Configuration."' : '';
  1386     if(getConfig('sflogo_enabled')=='1')
  1386     if(getConfig('sflogo_enabled')=='1')
  1387     {
  1387     {
  1388       $ob[] = '<a style="text-align: center;" href="http://sourceforge.net/" onclick="window.open(this.href);return false;"><img style="border-width: 0px;" alt="SourceForge.net Logo" src="http://sflogo.sourceforge.net/sflogo.php?group_id='.getConfig('sflogo_groupid').'&amp;type='.getConfig('sflogo_type').'" /></a>';
  1388       $ob[] = '<a style="text-align: center;" href="http://sourceforge.net/" onclick="if ( !KILL_SWITCH ) { window.open(this.href);return false; }"><img style="border-width: 0px;" alt="SourceForge.net Logo" src="http://sflogo.sourceforge.net/sflogo.php?group_id='.getConfig('sflogo_groupid').'&amp;type='.getConfig('sflogo_type').'" /></a>';
  1389     }
  1389     }
  1390     if(getConfig('w3c_v32')     =='1') $ob[] = '<a style="text-align: center;" href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href);return false;"><img style="border: 0px solid #FFFFFF;" alt="Valid HTML 3.2"  src="http://www.w3.org/Icons/valid-html32" /></a>';
  1390     if(getConfig('w3c_v32')     =='1') $ob[] = '<a style="text-align: center;" href="http://validator.w3.org/check?uri=referer" onclick="if ( !KILL_SWITCH ) { window.open(this.href);return false; }"><img style="border: 0px solid #FFFFFF;" alt="Valid HTML 3.2"  src="http://www.w3.org/Icons/valid-html32" /></a>';
  1391     if(getConfig('w3c_v40')     =='1') $ob[] = '<a style="text-align: center;" href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href);return false;"><img style="border: 0px solid #FFFFFF;" alt="Valid HTML 4.0"  src="http://www.w3.org/Icons/valid-html40" /></a>';
  1391     if(getConfig('w3c_v40')     =='1') $ob[] = '<a style="text-align: center;" href="http://validator.w3.org/check?uri=referer" onclick="if ( !KILL_SWITCH ) { window.open(this.href);return false; }"><img style="border: 0px solid #FFFFFF;" alt="Valid HTML 4.0"  src="http://www.w3.org/Icons/valid-html40" /></a>';
  1392     if(getConfig('w3c_v401')    =='1') $ob[] = '<a style="text-align: center;" href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href);return false;"><img style="border: 0px solid #FFFFFF;" alt="Valid HTML 4.01" src="http://www.w3.org/Icons/valid-html401" /></a>';
  1392     if(getConfig('w3c_v401')    =='1') $ob[] = '<a style="text-align: center;" href="http://validator.w3.org/check?uri=referer" onclick="if ( !KILL_SWITCH ) { window.open(this.href);return false; }"><img style="border: 0px solid #FFFFFF;" alt="Valid HTML 4.01" src="http://www.w3.org/Icons/valid-html401" /></a>';
  1393     if(getConfig('w3c_vxhtml10')=='1') $ob[] = '<a style="text-align: center;" href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href);return false;"><img style="border: 0px solid #FFFFFF;" alt="Valid XHTML 1.0" src="http://www.w3.org/Icons/valid-xhtml10" /></a>';
  1393     if(getConfig('w3c_vxhtml10')=='1') $ob[] = '<a style="text-align: center;" href="http://validator.w3.org/check?uri=referer" onclick="if ( !KILL_SWITCH ) { window.open(this.href);return false; }"><img style="border: 0px solid #FFFFFF;" alt="Valid XHTML 1.0" src="http://www.w3.org/Icons/valid-xhtml10" /></a>';
  1394     if(getConfig('w3c_vxhtml11')=='1') $ob[] = '<a style="text-align: center;" href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href);return false;"><img style="border: 0px solid #FFFFFF;" alt="Valid XHTML 1.1" src="http://www.w3.org/Icons/valid-xhtml11" /></a>';
  1394     if(getConfig('w3c_vxhtml11')=='1') $ob[] = '<a style="text-align: center;" href="http://validator.w3.org/check?uri=referer" onclick="if ( !KILL_SWITCH ) { window.open(this.href);return false; }"><img style="border: 0px solid #FFFFFF;" alt="Valid XHTML 1.1" src="http://www.w3.org/Icons/valid-xhtml11" /></a>';
  1395     if(getConfig('w3c_vcss')    =='1') $ob[] = '<a style="text-align: center;" href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href);return false;"><img style="border: 0px solid #FFFFFF;" alt="Valid CSS"       src="http://www.w3.org/Icons/valid-css" /></a>';
  1395     if(getConfig('w3c_vcss')    =='1') $ob[] = '<a style="text-align: center;" href="http://validator.w3.org/check?uri=referer" onclick="if ( !KILL_SWITCH ) { window.open(this.href);return false; }"><img style="border: 0px solid #FFFFFF;" alt="Valid CSS"       src="http://www.w3.org/Icons/valid-css" /></a>';
  1396     if(getConfig('dbd_button')  =='1') $ob[] = '<a style="text-align: center;" href="http://www.defectivebydesign.org/join/button" onclick="window.open(this.href);return false;"><img style="border: 0px solid #FFFFFF;" alt="DRM technology restricts what you can do with your computer" src="http://defectivebydesign.org/sites/nodrm.civicactions.net/files/images/dbd_sm_btn.gif" /><br /><small>Protect your freedom >></small></a>';
  1396     if(getConfig('dbd_button')  =='1') $ob[] = '<a style="text-align: center;" href="http://www.defectivebydesign.org/join/button" onclick="if ( !KILL_SWITCH ) { window.open(this.href);return false; }"><img style="border: 0px solid #FFFFFF;" alt="DRM technology restricts what you can do with your computer" src="http://defectivebydesign.org/sites/nodrm.civicactions.net/files/images/dbd_sm_btn.gif" /><br /><small>Protect your freedom >></small></a>';
  1397     
  1397     
  1398     $code = $plugins->setHook('links_widget');
  1398     $code = $plugins->setHook('links_widget');
  1399     foreach ( $code as $cmd )
  1399     foreach ( $code as $cmd )
  1400     {
  1400     {
  1401       eval($cmd);
  1401       eval($cmd);
  1546     $tplvars = $this->extract_vars('elements.tpl');
  1546     $tplvars = $this->extract_vars('elements.tpl');
  1547     $tb = '';
  1547     $tb = '';
  1548     // Get the "article" button text (depends on namespace)
  1548     // Get the "article" button text (depends on namespace)
  1549     if(defined('IN_ENANO_INSTALL')) $ns = 'installation page';
  1549     if(defined('IN_ENANO_INSTALL')) $ns = 'installation page';
  1550     else $ns = 'system error page';
  1550     else $ns = 'system error page';
  1551     $t = str_replace('{FLAGS}', 'onclick="return false;" title="Hey! A button that doesn\'t do anything. Clever..." accesskey="a"', $tplvars['toolbar_button']);
  1551     $t = str_replace('{FLAGS}', 'onclick="if ( !KILL_SWITCH ) { return false; }" title="Hey! A button that doesn\'t do anything. Clever..." accesskey="a"', $tplvars['toolbar_button']);
  1552     $t = str_replace('{HREF}', '#', $t);
  1552     $t = str_replace('{HREF}', '#', $t);
  1553     $t = str_replace('{TEXT}', $ns, $t);
  1553     $t = str_replace('{TEXT}', $ns, $t);
  1554     $tb .= $t;
  1554     $tb .= $t;
  1555     
  1555     
  1556     // Page toolbar
  1556     // Page toolbar
  1719     $text = str_replace('<script type="text/javascript" src="{SCRIPTPATH}/ajax.php?title={PAGE_URLNAME}&amp;_mode=jsres"></script>', '', $text); // Remove the AJAX code - we don't need it, and it requires a database connection
  1719     $text = str_replace('<script type="text/javascript" src="{SCRIPTPATH}/ajax.php?title={PAGE_URLNAME}&amp;_mode=jsres"></script>', '', $text); // Remove the AJAX code - we don't need it, and it requires a database connection
  1720     $text = '$tpl_code = \''.str_replace('\'', '\\\'', $text).'\'; return $tpl_code;';
  1720     $text = '$tpl_code = \''.str_replace('\'', '\\\'', $text).'\'; return $tpl_code;';
  1721     $text = preg_replace('#<!-- BEGIN (.*?) -->#is', '\'; if($this->tpl_bool[\'\\1\']) { $tpl_code .= \'', $text);
  1721     $text = preg_replace('#<!-- BEGIN (.*?) -->#is', '\'; if($this->tpl_bool[\'\\1\']) { $tpl_code .= \'', $text);
  1722     $text = preg_replace('#<!-- IFPLUGIN (.*?) -->#is', '\'; if(getConfig(\'plugin_\\1\')==\'1\') { $tpl_code .= \'', $text);
  1722     $text = preg_replace('#<!-- IFPLUGIN (.*?) -->#is', '\'; if(getConfig(\'plugin_\\1\')==\'1\') { $tpl_code .= \'', $text);
  1723     if(defined('IN_ENANO_INSTALL')) $text = str_replace('<!-- SYSMSG Sidebar -->', '<div class="slider"><div class="heading"><a class="head">Installation progress</a></div><div class="slideblock">'.$sideinfo.'</div></div>', $text);
  1723     if(defined('IN_ENANO_INSTALL')) $text = str_replace('<!-- SYSMSG Sidebar -->', '<div class="slider"><div class="heading"><a class="head">Installation progress</a></div><div class="slideblock">'.$sideinfo.'</div></div>', $text);
  1724     else $text = str_replace('<!-- SYSMSG Sidebar -->', '<div class="slider"><div class="heading"><a class="head">System error</a></div><div class="slideblock"><a href="#" onclick="return false;">Enano critical error page</a></div></div>', $text);
  1724     else $text = str_replace('<!-- SYSMSG Sidebar -->', '<div class="slider"><div class="heading"><a class="head">System error</a></div><div class="slideblock"><a href="#" onclick="return false;>Enano critical error page</a></div></div>', $text);
  1725     $text = preg_replace('#<!-- SYSMSG (.*?) -->#is', '', $text);
  1725     $text = preg_replace('#<!-- SYSMSG (.*?) -->#is', '', $text);
  1726     $text = preg_replace('#<!-- BEGINNOT (.*?) -->#is', '\'; if(!$this->tpl_bool[\'\\1\']) { $tpl_code .= \'', $text);
  1726     $text = preg_replace('#<!-- BEGINNOT (.*?) -->#is', '\'; if(!$this->tpl_bool[\'\\1\']) { $tpl_code .= \'', $text);
  1727     $text = preg_replace('#<!-- BEGINELSE (.*?) -->#is', '\'; } else { $tpl_code .= \'', $text);
  1727     $text = preg_replace('#<!-- BEGINELSE (.*?) -->#is', '\'; } else { $tpl_code .= \'', $text);
  1728     $text = preg_replace('#<!-- END (.*?) -->#is', '\'; } $tpl_code .= \'', $text);
  1728     $text = preg_replace('#<!-- END (.*?) -->#is', '\'; } $tpl_code .= \'', $text);
  1729     $text = preg_replace('#{([A-z0-9]*)}#is', '\'.$this->tpl_strings[\'\\1\'].\'', $text);
  1729     $text = preg_replace('#{([A-z0-9]*)}#is', '\'.$this->tpl_strings[\'\\1\'].\'', $text);