includes/template.php
changeset 571 66e14e61613e
parent 566 06d241de3151
child 573 43e7254afdb4
equal deleted inserted replaced
570:4d0d5dae61e5 571:66e14e61613e
   556     
   556     
   557     $button = $this->makeParserText($tplvars['toolbar_button']);
   557     $button = $this->makeParserText($tplvars['toolbar_button']);
   558     
   558     
   559     // Page toolbar
   559     // Page toolbar
   560     // Comments button
   560     // Comments button
   561     if ( $perms->get_permissions('read') && getConfig('enable_comments')=='1' && $local_namespace != 'Special' && $local_namespace != 'Admin' && $local_cdata['comments_on'] == 1 )
   561     if ( $perms->get_permissions('read') && getConfig('enable_comments')=='1' && $local_cdata['comments_on'] == 1 )
   562     {
   562     {
   563       
   563       
   564       $e = $db->sql_query('SELECT approved FROM '.table_prefix.'comments WHERE page_id=\''.$local_page_id.'\' AND namespace=\''.$local_namespace.'\';');
   564       $e = $db->sql_query('SELECT approved FROM '.table_prefix.'comments WHERE page_id=\''.$local_page_id.'\' AND namespace=\''.$local_namespace.'\';');
   565       if ( !$e )
   565       if ( !$e )
   566       {
   566       {
   608         ));
   608         ));
   609       
   609       
   610       $tb .= $button->run();
   610       $tb .= $button->run();
   611     }
   611     }
   612     // Edit button
   612     // Edit button
   613     if($perms->get_permissions('read') && ($local_namespace != 'Special' && $local_namespace != 'Admin' && $local_namespace != 'Anonymous') && ( $perms->get_permissions('edit_page') && ( ( $paths->page_protected && $perms->get_permissions('even_when_protected') ) || !$paths->page_protected ) ) )
   613     if($perms->get_permissions('read') && $session->check_acl_scope('edit_page', $local_namespace) && ( $perms->get_permissions('edit_page') && ( ( $paths->page_protected && $perms->get_permissions('even_when_protected') ) || !$paths->page_protected ) ) )
   614     {
   614     {
   615       $button->assign_vars(array(
   615       $button->assign_vars(array(
   616         'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxEditor()); return false; }" title="' . $lang->get('onpage_tip_edit') . '" accesskey="e"',
   616         'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxEditor()); return false; }" title="' . $lang->get('onpage_tip_edit') . '" accesskey="e"',
   617         'PARENTFLAGS' => 'id="mdgToolbar_edit"',
   617         'PARENTFLAGS' => 'id="mdgToolbar_edit"',
   618         'HREF' => makeUrl($local_page, 'do=edit', true),
   618         'HREF' => makeUrl($local_page, 'do=edit', true),
   619         'TEXT' => $lang->get('onpage_btn_edit')
   619         'TEXT' => $lang->get('onpage_btn_edit')
   620         ));
   620         ));
   621       $tb .= $button->run();
   621       $tb .= $button->run();
   622     // View source button
   622     // View source button
   623     }
   623     }
   624     else if($perms->get_permissions('view_source') && ( !$perms->get_permissions('edit_page') || !$perms->get_permissions('even_when_protected') && $paths->page_protected ) && $local_namespace != 'Special' && $local_namespace != 'Admin' && $local_namespace != 'Anonymous') 
   624     else if ( $session->check_acl_scope('view_source', $local_namespace) && $perms->get_permissions('view_source') && ( !$perms->get_permissions('edit_page') || !$perms->get_permissions('even_when_protected') && $paths->page_protected ) && $local_namespace != 'Anonymous') 
   625     {
   625     {
   626       $button->assign_vars(array(
   626       $button->assign_vars(array(
   627         'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxEditor()); return false; }" title="' . $lang->get('onpage_tip_viewsource') . '" accesskey="e"',
   627         'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxEditor()); return false; }" title="' . $lang->get('onpage_tip_viewsource') . '" accesskey="e"',
   628         'PARENTFLAGS' => 'id="mdgToolbar_edit"',
   628         'PARENTFLAGS' => 'id="mdgToolbar_edit"',
   629         'HREF' => makeUrl($local_page, 'do=viewsource', true),
   629         'HREF' => makeUrl($local_page, 'do=viewsource', true),
   630         'TEXT' => $lang->get('onpage_btn_viewsource')
   630         'TEXT' => $lang->get('onpage_btn_viewsource')
   631         ));
   631         ));
   632       $tb .= $button->run();
   632       $tb .= $button->run();
   633     }
   633     }
   634     // History button
   634     // History button
   635     if ( $perms->get_permissions('read') /* && $paths->wiki_mode */ && $local_page_exists && $local_namespace != 'Special' && $local_namespace != 'Admin' && $perms->get_permissions('history_view') )
   635     if ( $perms->get_permissions('read') && $session->check_acl_scope('history_view', $local_namespace) && $local_page_exists && $perms->get_permissions('history_view') )
   636     {
   636     {
   637       $button->assign_vars(array(
   637       $button->assign_vars(array(
   638         'FLAGS'       => 'onclick="if ( !KILL_SWITCH ) { void(ajaxHistory()); return false; }" title="' . $lang->get('onpage_tip_history') . '" accesskey="h"',
   638         'FLAGS'       => 'onclick="if ( !KILL_SWITCH ) { void(ajaxHistory()); return false; }" title="' . $lang->get('onpage_tip_history') . '" accesskey="h"',
   639         'PARENTFLAGS' => 'id="mdgToolbar_history"',
   639         'PARENTFLAGS' => 'id="mdgToolbar_history"',
   640         'HREF'        => makeUrl($local_page, 'do=history', true),
   640         'HREF'        => makeUrl($local_page, 'do=history', true),
   645     
   645     
   646     $menubtn = $this->makeParserText($tplvars['toolbar_menu_button']);
   646     $menubtn = $this->makeParserText($tplvars['toolbar_menu_button']);
   647     
   647     
   648     // Additional actions menu
   648     // Additional actions menu
   649     // Rename button
   649     // Rename button
   650     if ( $perms->get_permissions('read') && $local_page_exists && ( $perms->get_permissions('rename') && ( $paths->page_protected && $perms->get_permissions('even_when_protected') || !$paths->page_protected ) ) && $local_namespace != 'Special' && $local_namespace != 'Admin' )
   650     if ( $perms->get_permissions('read') && $session->check_acl_scope('rename', $local_namespace) && $local_page_exists && ( $perms->get_permissions('rename') && ( $paths->page_protected && $perms->get_permissions('even_when_protected') || !$paths->page_protected ) ) )
   651     {
   651     {
   652       $menubtn->assign_vars(array(
   652       $menubtn->assign_vars(array(
   653           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxRename()); return false; }" title="' . $lang->get('onpage_tip_rename') . '" accesskey="r"',
   653           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxRename()); return false; }" title="' . $lang->get('onpage_tip_rename') . '" accesskey="r"',
   654           'HREF'  => makeUrl($local_page, 'do=rename', true),
   654           'HREF'  => makeUrl($local_page, 'do=rename', true),
   655           'TEXT'  => $lang->get('onpage_btn_rename'),
   655           'TEXT'  => $lang->get('onpage_btn_rename'),
   656         ));
   656         ));
   657       $this->toolbar_menu .= $menubtn->run();
   657       $this->toolbar_menu .= $menubtn->run();
   658     }
   658     }
   659     
   659     
   660     // Vote-to-delete button
   660     // Vote-to-delete button
   661     if ( $paths->wiki_mode && $perms->get_permissions('vote_delete') && $local_page_exists && $local_namespace != 'Special' && $local_namespace != 'Admin')
   661     if ( $paths->wiki_mode && $session->check_acl_scope('vote_delete', $local_namespace) && $perms->get_permissions('vote_delete') && $local_page_exists)
   662     {
   662     {
   663       $menubtn->assign_vars(array(
   663       $menubtn->assign_vars(array(
   664           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxDelVote()); return false; }" title="' . $lang->get('onpage_tip_delvote') . '" accesskey="d"',
   664           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxDelVote()); return false; }" title="' . $lang->get('onpage_tip_delvote') . '" accesskey="d"',
   665           'HREF'  => makeUrl($local_page, 'do=delvote', true),
   665           'HREF'  => makeUrl($local_page, 'do=delvote', true),
   666           'TEXT'  => $lang->get('onpage_btn_votedelete'),
   666           'TEXT'  => $lang->get('onpage_btn_votedelete'),
   667         ));
   667         ));
   668       $this->toolbar_menu .= $menubtn->run();
   668       $this->toolbar_menu .= $menubtn->run();
   669     }
   669     }
   670     
   670     
   671     // Clear-votes button
   671     // Clear-votes button
   672     if ( $perms->get_permissions('read') && $paths->wiki_mode && $local_page_exists && $local_namespace != 'Special' && $local_namespace != 'Admin' && $perms->get_permissions('vote_reset') && $local_cdata['delvotes'] > 0)
   672     if ( $perms->get_permissions('read') && $session->check_acl_scope('vote_reset', $local_namespace) && $paths->wiki_mode && $local_page_exists && $perms->get_permissions('vote_reset') && $local_cdata['delvotes'] > 0)
   673     {
   673     {
   674       $menubtn->assign_vars(array(
   674       $menubtn->assign_vars(array(
   675           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxResetDelVotes()); return false; }" title="' . $lang->get('onpage_tip_resetvotes') . '" accesskey="y"',
   675           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxResetDelVotes()); return false; }" title="' . $lang->get('onpage_tip_resetvotes') . '" accesskey="y"',
   676           'HREF'  => makeUrl($local_page, 'do=resetvotes', true),
   676           'HREF'  => makeUrl($local_page, 'do=resetvotes', true),
   677           'TEXT'  => $lang->get('onpage_btn_votedelete_reset'),
   677           'TEXT'  => $lang->get('onpage_btn_votedelete_reset'),
   678         ));
   678         ));
   679       $this->toolbar_menu .= $menubtn->run();
   679       $this->toolbar_menu .= $menubtn->run();
   680     }
   680     }
   681     
   681     
   682     // Printable page button
   682     // Printable page button
   683     if ( $local_page_exists && $local_namespace != 'Special' && $local_namespace != 'Admin' )
   683     if ( $local_page_exists )
   684     {
   684     {
   685       $menubtn->assign_vars(array(
   685       $menubtn->assign_vars(array(
   686           'FLAGS' => 'title="' . $lang->get('onpage_tip_printable') . '"',
   686           'FLAGS' => 'title="' . $lang->get('onpage_tip_printable') . '"',
   687           'HREF'  => makeUrl($local_page, 'printable=yes', true),
   687           'HREF'  => makeUrl($local_page, 'printable=yes', true),
   688           'TEXT'  => $lang->get('onpage_btn_printable'),
   688           'TEXT'  => $lang->get('onpage_btn_printable'),
   689         ));
   689         ));
   690       $this->toolbar_menu .= $menubtn->run();
   690       $this->toolbar_menu .= $menubtn->run();
   691     }
   691     }
   692     
   692     
   693     // Protect button
   693     // Protect button
   694     if($perms->get_permissions('read') && $paths->wiki_mode && $local_page_exists && $local_namespace != 'Special' && $local_namespace != 'Admin' && $perms->get_permissions('protect'))
   694     if($perms->get_permissions('read') && $session->check_acl_scope('protect', $local_namespace) && $paths->wiki_mode && $local_page_exists && $perms->get_permissions('protect'))
   695     {
   695     {
   696       
   696       
   697       $label = $this->makeParserText($tplvars['toolbar_label']);
   697       $label = $this->makeParserText($tplvars['toolbar_label']);
   698       $label->assign_vars(array('TEXT' => $lang->get('onpage_lbl_protect')));
   698       $label->assign_vars(array('TEXT' => $lang->get('onpage_lbl_protect')));
   699       $t0 = $label->run();
   699       $t0 = $label->run();
   743           </tr>
   743           </tr>
   744         </table>';
   744         </table>';
   745     }
   745     }
   746     
   746     
   747     // Wiki mode button
   747     // Wiki mode button
   748     if($perms->get_permissions('read') && $local_page_exists && $perms->get_permissions('set_wiki_mode') && $local_namespace != 'Special' && $local_namespace != 'Admin')
   748     if($perms->get_permissions('read') && $session->check_acl_scope('set_wiki_mode', $local_namespace) && $local_page_exists && $perms->get_permissions('set_wiki_mode'))
   749     {
   749     {
   750       // label at start
   750       // label at start
   751       $label = $this->makeParserText($tplvars['toolbar_label']);
   751       $label = $this->makeParserText($tplvars['toolbar_label']);
   752       $label->assign_vars(array('TEXT' => $lang->get('onpage_lbl_wikimode')));
   752       $label->assign_vars(array('TEXT' => $lang->get('onpage_lbl_wikimode')));
   753       $t0 = $label->run();
   753       $t0 = $label->run();
   801           </tr>
   801           </tr>
   802         </table>';
   802         </table>';
   803     }
   803     }
   804     
   804     
   805     // Clear logs button
   805     // Clear logs button
   806     if ( $perms->get_permissions('read') && $perms->get_permissions('clear_logs') && $local_namespace != 'Special' && $local_namespace != 'Admin' )
   806     if ( $perms->get_permissions('read') && $session->check_acl_scope('clear_logs', $local_namespace) && $perms->get_permissions('clear_logs') )
   807     {
   807     {
   808       $menubtn->assign_vars(array(
   808       $menubtn->assign_vars(array(
   809           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxClearLogs()); return false; }" title="' . $lang->get('onpage_tip_flushlogs') . '" accesskey="l"',
   809           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxClearLogs()); return false; }" title="' . $lang->get('onpage_tip_flushlogs') . '" accesskey="l"',
   810           'HREF'  => makeUrl($local_page, 'do=flushlogs', true),
   810           'HREF'  => makeUrl($local_page, 'do=flushlogs', true),
   811           'TEXT'  => $lang->get('onpage_btn_clearlogs'),
   811           'TEXT'  => $lang->get('onpage_btn_clearlogs'),
   812         ));
   812         ));
   813       $this->toolbar_menu .= $menubtn->run();
   813       $this->toolbar_menu .= $menubtn->run();
   814     }
   814     }
   815     
   815     
   816     // Delete page button
   816     // Delete page button
   817     if ( $perms->get_permissions('read') && $perms->get_permissions('delete_page') && $local_page_exists && $local_namespace != 'Special' && $local_namespace != 'Admin' )
   817     if ( $perms->get_permissions('read') && $session->check_acl_scope('delete_page', $local_namespace) && $perms->get_permissions('delete_page') && $local_page_exists )
   818     {
   818     {
   819       $s = $lang->get('onpage_btn_deletepage');
   819       $s = $lang->get('onpage_btn_deletepage');
   820       if ( $local_cdata['delvotes'] == 1 )
   820       if ( $local_cdata['delvotes'] == 1 )
   821       {
   821       {
   822         $subst = array(
   822         $subst = array(
   842       $this->toolbar_menu .= $menubtn->run();
   842       $this->toolbar_menu .= $menubtn->run();
   843       
   843       
   844     }
   844     }
   845     
   845     
   846     // Password-protect button
   846     // Password-protect button
   847     if(isset($local_cdata['password']))
   847     if(isset($local_cdata['password']) && $session->check_acl_scope('password_set', $local_namespace) && $session->check_acl_scope('password_reset', $local_namespace))
   848     {
   848     {
   849       if ( $local_cdata['password'] == '' )
   849       if ( $local_cdata['password'] == '' )
   850       {
   850       {
   851         $a = $perms->get_permissions('password_set');
   851         $a = $perms->get_permissions('password_set');
   852       }
   852       }
   853       else
   853       else
   854       {
   854       {
   855         $a = $perms->get_permissions('password_reset');
   855         $a = $perms->get_permissions('password_reset');
   856       }
   856       }
   857     }
   857     }
       
   858     else if ( $session->check_acl_scope('password_set', $local_namespace) )
       
   859     {
       
   860       $a = $perms->get_permissions('password_set');
       
   861     }
   858     else
   862     else
   859     {
   863     {
   860       $a = $perms->get_permissions('password_set');
   864       $a = false;
   861     }
   865     }
   862     if ( $a && $perms->get_permissions('read') && $local_page_exists && $local_namespace != 'Special' && $local_namespace != 'Admin' )
   866     if ( $a && $perms->get_permissions('read') && $local_page_exists )
   863     {
   867     {
   864       // label at start
   868       // label at start
   865       $label = $this->makeParserText($tplvars['toolbar_label']);
   869       $label = $this->makeParserText($tplvars['toolbar_label']);
   866       $label->assign_vars(array('TEXT' => $lang->get('onpage_lbl_password')));
   870       $label->assign_vars(array('TEXT' => $lang->get('onpage_lbl_password')));
   867       $t0 = $label->run();
   871       $t0 = $label->run();
   875       
   879       
   876       $this->toolbar_menu .= '<table border="0" cellspacing="0" cellpadding="0"><tr><td>'.$t0.'</td><td><input type="password" id="mdgPassSetField" size="10" /></td><td>'.$t.'</td></tr></table>';
   880       $this->toolbar_menu .= '<table border="0" cellspacing="0" cellpadding="0"><tr><td>'.$t0.'</td><td><input type="password" id="mdgPassSetField" size="10" /></td><td>'.$t.'</td></tr></table>';
   877     }
   881     }
   878     
   882     
   879     // Manage ACLs button
   883     // Manage ACLs button
   880     if ( !$paths->anonymous_page && ( $perms->get_permissions('edit_acl') || ( defined('ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL') &&  $session->user_level >= USER_LEVEL_ADMIN ) ) )
   884     if ( !$paths->anonymous_page && $session->check_acl_scope('edit_acl', $local_namespace) && ( $perms->get_permissions('edit_acl') || ( defined('ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL') &&  $session->user_level >= USER_LEVEL_ADMIN ) ) )
   881     {
   885     {
   882       $menubtn->assign_vars(array(
   886       $menubtn->assign_vars(array(
   883           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { return ajaxOpenACLManager(); }" title="' . $lang->get('onpage_tip_aclmanager') . '" accesskey="m"',
   887           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { return ajaxOpenACLManager(); }" title="' . $lang->get('onpage_tip_aclmanager') . '" accesskey="m"',
   884           'HREF'  => makeUrl($local_page, 'do=aclmanager', true),
   888           'HREF'  => makeUrl($local_page, 'do=aclmanager', true),
   885           'TEXT'  => $lang->get('onpage_btn_acl'),
   889           'TEXT'  => $lang->get('onpage_btn_acl'),
   886         ));
   890         ));
   887       $this->toolbar_menu .= $menubtn->run();
   891       $this->toolbar_menu .= $menubtn->run();
   888     }
   892     }
   889     
   893     
   890     // Administer page button
   894     // Administer page button
   891     if ( $session->user_level >= USER_LEVEL_ADMIN && $local_page_exists && $local_namespace != 'Special' && $local_namespace != 'Admin' )
   895     if ( $session->user_level >= USER_LEVEL_ADMIN && $local_page_exists )
   892     {
   896     {
   893       $menubtn->assign_vars(array(
   897       $menubtn->assign_vars(array(
   894           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxAdminPage()); return false; }" title="' . $lang->get('onpage_tip_adminoptions') . '" accesskey="g"',
   898           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxAdminPage()); return false; }" title="' . $lang->get('onpage_tip_adminoptions') . '" accesskey="g"',
   895           'HREF'  => makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'PageManager', true),
   899           'HREF'  => makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'PageManager', true),
   896           'TEXT'  => $lang->get('onpage_btn_admin'),
   900           'TEXT'  => $lang->get('onpage_btn_admin'),
   938     
   942     
   939     $this->tpl_bool['fixed_menus'] = false;
   943     $this->tpl_bool['fixed_menus'] = false;
   940     /* if($this->sidebar_extra == '') $this->tpl_bool['right_sidebar'] = false;
   944     /* if($this->sidebar_extra == '') $this->tpl_bool['right_sidebar'] = false;
   941     else */ $this->tpl_bool['right_sidebar'] = true;
   945     else */ $this->tpl_bool['right_sidebar'] = true;
   942     
   946     
   943     $this->tpl_bool['auth_rename'] = ( $local_page_exists && ( $perms->get_permissions('rename') && ( $paths->page_protected && $perms->get_permissions('even_when_protected') || !$paths->page_protected ) ) && $local_namespace != 'Special' && $local_namespace != 'Admin');
   947     $this->tpl_bool['auth_rename'] = ( $local_page_exists && $session->check_acl_scope('rename', $local_namespace) && ( $perms->get_permissions('rename') && ( $paths->page_protected && $perms->get_permissions('even_when_protected') || !$paths->page_protected ) ));
   944     
   948     
   945     $this->tpl_bool['enable_uploads'] = ( getConfig('enable_uploads') == '1' && $perms->get_permissions('upload_files') ) ? true : false;
   949     $this->tpl_bool['enable_uploads'] = ( getConfig('enable_uploads') == '1' && $session->get_permissions('upload_files') ) ? true : false;
   946     
   950     
   947     $this->tpl_bool['stupid_mode'] = false;
   951     $this->tpl_bool['stupid_mode'] = false;
   948     
   952     
   949     $this->tpl_bool['in_admin'] = ( ( $local_page_id == 'Administration' && $local_namespace == 'Special' ) || $local_namespace == 'Admin' );
   953     $this->tpl_bool['in_admin'] = ( ( $local_page_id == 'Administration' && $local_namespace == 'Special' ) || $local_namespace == 'Admin' );
   950     
   954     
   999     $urlname_clean = str_replace('\'', '\\\'', str_replace('\\', '\\\\', dirtify_page_id($local_fullpage)));
  1003     $urlname_clean = str_replace('\'', '\\\'', str_replace('\\', '\\\\', dirtify_page_id($local_fullpage)));
  1000     $urlname_clean = strtr( $urlname_clean, array( '<' => '&lt;', '>' => '&gt;' ) );
  1004     $urlname_clean = strtr( $urlname_clean, array( '<' => '&lt;', '>' => '&gt;' ) );
  1001     
  1005     
  1002     $urlname_jssafe = sanitize_page_id($local_fullpage);
  1006     $urlname_jssafe = sanitize_page_id($local_fullpage);
  1003     $physical_urlname_jssafe = sanitize_page_id($paths->fullpage);
  1007     $physical_urlname_jssafe = sanitize_page_id($paths->fullpage);
       
  1008     
       
  1009     if ( $session->check_acl_scope('even_when_protected', $local_namespace) )
       
  1010     {
       
  1011       $protected = $paths->page_protected && !$perms->get_permissions('even_when_protected');
       
  1012     }
       
  1013     else
       
  1014     {
       
  1015       $protected = false;
       
  1016     }
  1004     
  1017     
  1005     // Generate the dynamic javascript vars
  1018     // Generate the dynamic javascript vars
  1006     $js_dynamic = '    <script type="text/javascript">// <![CDATA[
  1019     $js_dynamic = '    <script type="text/javascript">// <![CDATA[
  1007       // This section defines some basic and very important variables that are used later in the static Javascript library.
  1020       // This section defines some basic and very important variables that are used later in the static Javascript library.
  1008       // SKIN DEVELOPERS: The template variable for this code block is {JS_DYNAMIC_VARS}. This MUST be inserted BEFORE the tag that links to the main Javascript lib.
  1021       // SKIN DEVELOPERS: The template variable for this code block is {JS_DYNAMIC_VARS}. This MUST be inserted BEFORE the tag that links to the main Javascript lib.
  1021       var USER_LEVEL_ADMIN = ' . USER_LEVEL_ADMIN . ';
  1034       var USER_LEVEL_ADMIN = ' . USER_LEVEL_ADMIN . ';
  1022       var disable_redirect = ' . ( isset($_GET['redirect']) && $_GET['redirect'] == 'no' ? 'true' : 'false' ) . ';
  1035       var disable_redirect = ' . ( isset($_GET['redirect']) && $_GET['redirect'] == 'no' ? 'true' : 'false' ) . ';
  1023       var pref_disable_js_fx = ' . ( @$session->user_extra['disable_js_fx'] == 1 ? '1' : '0' ) . ';
  1036       var pref_disable_js_fx = ' . ( @$session->user_extra['disable_js_fx'] == 1 ? '1' : '0' ) . ';
  1024       var csrf_token = "' . $session->csrf_token . '";
  1037       var csrf_token = "' . $session->csrf_token . '";
  1025       var editNotice = \'' . ( (getConfig('wiki_edit_notice')=='1') ? str_replace("\n", "\\\n", RenderMan::render(getConfig('wiki_edit_notice_text'))) : '' ) . '\';
  1038       var editNotice = \'' . ( (getConfig('wiki_edit_notice')=='1') ? str_replace("\n", "\\\n", RenderMan::render(getConfig('wiki_edit_notice_text'))) : '' ) . '\';
  1026       var prot = ' . ( ($paths->page_protected && !$perms->get_permissions('even_when_protected')) ? 'true' : 'false' ) .'; // No, hacking this var won\'t work, it\'s re-checked on the server
  1039       var prot = ' . ( ($protected) ? 'true' : 'false' ) .'; // No, hacking this var won\'t work, it\'s re-checked on the server
  1027       var ENANO_SPECIAL_CREATEPAGE = \''. makeUrl($paths->nslist['Special'].'CreatePage') .'\';
  1040       var ENANO_SPECIAL_CREATEPAGE = \''. makeUrl($paths->nslist['Special'].'CreatePage') .'\';
  1028       var ENANO_CREATEPAGE_PARAMS = \'_do=&pagename='. $urlname_clean .'&namespace=' . $local_namespace . '\';
  1041       var ENANO_CREATEPAGE_PARAMS = \'_do=&pagename='. $urlname_clean .'&namespace=' . $local_namespace . '\';
  1029       var ENANO_SPECIAL_CHANGESTYLE = \''. makeUrlNS('Special', 'ChangeStyle') .'\';
  1042       var ENANO_SPECIAL_CHANGESTYLE = \''. makeUrlNS('Special', 'ChangeStyle') .'\';
  1030       var namespace_list = new Array();
  1043       var namespace_list = new Array();
  1031       var AES_BITS = '.AES_BITS.';
  1044       var AES_BITS = '.AES_BITS.';