includes/template.php
changeset 15 ad5986a53197
parent 13 fdd6b9dd42c3
child 16 64e0d3d4cf14
equal deleted inserted replaced
14:ce6053bb48d8 15:ad5986a53197
   468           </tr>
   468           </tr>
   469         </table>';
   469         </table>';
   470     }
   470     }
   471     
   471     
   472     // Clear logs button
   472     // Clear logs button
   473     if ( $session->get_permissions('read') && $session->get_permissions('clear_logs') && $paths->wiki_mode && $paths->namespace != 'Special' && $paths->namespace != 'Admin' )
   473     if ( $session->get_permissions('read') && $session->get_permissions('clear_logs') && $paths->namespace != 'Special' && $paths->namespace != 'Admin' )
   474     {
   474     {
   475       $menubtn->assign_vars(array(
   475       $menubtn->assign_vars(array(
   476           'FLAGS' => 'onclick="void(ajaxClearLogs()); return false;" title="Remove all edit and action logs for this page from the database. IRREVERSIBLE! (alt-l)" accesskey="l"',
   476           'FLAGS' => 'onclick="void(ajaxClearLogs()); return false;" title="Remove all edit and action logs for this page from the database. IRREVERSIBLE! (alt-l)" accesskey="l"',
   477           'HREF'  => makeUrl($paths->page, 'do=flushlogs', true),
   477           'HREF'  => makeUrl($paths->page, 'do=flushlogs', true),
   478           'TEXT'  => 'clear page logs',
   478           'TEXT'  => 'clear page logs',
   642     
   642     
   643     $theme_link = $parser->run();
   643     $theme_link = $parser->run();
   644     
   644     
   645     $SID = ($session->sid_super) ? $session->sid_super : '';
   645     $SID = ($session->sid_super) ? $session->sid_super : '';
   646     
   646     
       
   647     $urlname_clean = str_replace('\'', '\\\'', str_replace('\\', '\\\\', dirtify_page_id($paths->fullpage)));
       
   648     $urlname_clean = strtr( $urlname_clean, array( '<' => '&lt;', '>' => '&gt;' ) );
       
   649     
   647     // Generate the dynamic javascript vars
   650     // Generate the dynamic javascript vars
   648     $js_dynamic = '    <script type="text/javascript">// <![CDATA[
   651     $js_dynamic = '    <script type="text/javascript">// <![CDATA[
   649       // This section defines some basic and very important variables that are used later in the static Javascript library.
   652       // This section defines some basic and very important variables that are used later in the static Javascript library.
   650       // 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.
   653       // 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.
   651       var title=\''. str_replace('\'', '\\\'', str_replace('\\', '\\\\', $paths->fullpage)) .'\';
   654       var title=\''. $urlname_clean .'\';
   652       var page_exists='. ( ( $paths->page_exists) ? 'true' : 'false' ) .';
   655       var page_exists='. ( ( $paths->page_exists) ? 'true' : 'false' ) .';
   653       var scriptPath=\''. scriptPath .'\';
   656       var scriptPath=\''. scriptPath .'\';
   654       var contentPath=\''.contentPath.'\';
   657       var contentPath=\''.contentPath.'\';
   655       var ENANO_SID =\'' . $SID . '\';
   658       var ENANO_SID =\'' . $SID . '\';
   656       var auth_level=' . $session->auth_level . ';
   659       var auth_level=' . $session->auth_level . ';
   660       var USER_LEVEL_MOD = ' . USER_LEVEL_MOD . ';
   663       var USER_LEVEL_MOD = ' . USER_LEVEL_MOD . ';
   661       var USER_LEVEL_ADMIN = ' . USER_LEVEL_ADMIN . ';
   664       var USER_LEVEL_ADMIN = ' . USER_LEVEL_ADMIN . ';
   662       var editNotice = \'' . ( (getConfig('wiki_edit_notice')=='1') ? str_replace("\n", "\\\n", RenderMan::render(getConfig('wiki_edit_notice_text'))) : '' ) . '\';
   665       var editNotice = \'' . ( (getConfig('wiki_edit_notice')=='1') ? str_replace("\n", "\\\n", RenderMan::render(getConfig('wiki_edit_notice_text'))) : '' ) . '\';
   663       var prot = ' . ( ($paths->page_protected && !$session->get_permissions('even_when_protected')) ? 'true' : 'false' ) .'; // No, hacking this var won\'t work, it\'s re-checked on the server
   666       var prot = ' . ( ($paths->page_protected && !$session->get_permissions('even_when_protected')) ? 'true' : 'false' ) .'; // No, hacking this var won\'t work, it\'s re-checked on the server
   664       var ENANO_SPECIAL_CREATEPAGE = \''. makeUrl($paths->nslist['Special'].'CreatePage') .'\';
   667       var ENANO_SPECIAL_CREATEPAGE = \''. makeUrl($paths->nslist['Special'].'CreatePage') .'\';
   665       var ENANO_CREATEPAGE_PARAMS = \'_do=&pagename='. addslashes($paths->cpage['name']) .'&namespace=' . $paths->namespace . '\';
   668       var ENANO_CREATEPAGE_PARAMS = \'_do=&pagename='. $urlname_clean .'&namespace=' . $paths->namespace . '\';
   666       var ENANO_SPECIAL_CHANGESTYLE = \''. makeUrlNS('Special', 'ChangeStyle') .'\';
   669       var ENANO_SPECIAL_CHANGESTYLE = \''. makeUrlNS('Special', 'ChangeStyle') .'\';
   667       var namespace_list = new Array();
   670       var namespace_list = new Array();
   668       var AES_BITS = '.AES_BITS.';
   671       var AES_BITS = '.AES_BITS.';
   669       var AES_BLOCKSIZE = '.AES_BLOCKSIZE.';
   672       var AES_BLOCKSIZE = '.AES_BLOCKSIZE.';
   670       var pagepass = \''. ( ( isset($_REQUEST['pagepass']) ) ? sha1($_REQUEST['pagepass']) : '' ) .'\';
   673       var pagepass = \''. ( ( isset($_REQUEST['pagepass']) ) ? sha1($_REQUEST['pagepass']) : '' ) .'\';
   682       foreach($paths->nslist as $k => $c)
   685       foreach($paths->nslist as $k => $c)
   683       {
   686       {
   684         $js_dynamic .= "namespace_list['{$k}'] = '$c';";
   687         $js_dynamic .= "namespace_list['{$k}'] = '$c';";
   685       }
   688       }
   686       $js_dynamic .= "\n    //]]>\n    </script>";
   689       $js_dynamic .= "\n    //]]>\n    </script>";
   687     
   690       
   688     $tpl_strings = Array(
   691     $tpl_strings = Array(
   689       'PAGE_NAME'=>$paths->cpage['name'],
   692       'PAGE_NAME'=>htmlspecialchars($paths->cpage['name']),
   690       'PAGE_URLNAME'=>$paths->cpage['urlname'],
   693       'PAGE_URLNAME'=> $urlname_clean,
   691       'SITE_NAME'=>getConfig('site_name'),
   694       'SITE_NAME'=>getConfig('site_name'),
   692       'USERNAME'=>$session->username,
   695       'USERNAME'=>$session->username,
   693       'SITE_DESC'=>getConfig('site_desc'),
   696       'SITE_DESC'=>getConfig('site_desc'),
   694       'TOOLBAR'=>$tb,
   697       'TOOLBAR'=>$tb,
   695       'SCRIPTPATH'=>scriptPath,
   698       'SCRIPTPATH'=>scriptPath,