includes/template.php
changeset 326 ab66d6d1f1f4
parent 314 474f8be55943
parent 322 5f1cd51bf1be
child 335 67bd3121a12e
equal deleted inserted replaced
314:474f8be55943 326:ab66d6d1f1f4
     1 <?php
     1 <?php
     2 
     2 
     3 /*
     3 /*
     4  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
     4  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
     5  * Version 1.0.2 (Coblynau)
     5  * Version 1.0.3 (Dyrad)
     6  * Copyright (C) 2006-2007 Dan Fuhry
     6  * Copyright (C) 2006-2007 Dan Fuhry
     7  *
     7  *
     8  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
     8  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
     9  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
     9  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
    10  *
    10  *
   259     // Page toolbar
   259     // Page toolbar
   260     // Comments button
   260     // Comments button
   261     if ( $session->get_permissions('read') && getConfig('enable_comments')=='1' && $paths->namespace != 'Special' && $paths->namespace != 'Admin' && $paths->cpage['comments_on'] == 1 )
   261     if ( $session->get_permissions('read') && getConfig('enable_comments')=='1' && $paths->namespace != 'Special' && $paths->namespace != 'Admin' && $paths->cpage['comments_on'] == 1 )
   262     {
   262     {
   263       
   263       
   264       $e = $db->sql_query('SELECT approved FROM '.table_prefix.'comments WHERE page_id=\''.$paths->cpage['urlname_nons'].'\' AND namespace=\''.$paths->namespace.'\';');
   264       $e = $db->sql_query('SELECT approved FROM '.table_prefix.'comments WHERE page_id=\''.$paths->page_id.'\' AND namespace=\''.$paths->namespace.'\';');
   265       if ( !$e )
   265       if ( !$e )
   266       {
   266       {
   267         $db->_die();
   267         $db->_die();
   268       }
   268       }
   269       $nc = $db->numrows();
   269       $nc = $db->numrows();
   644     
   644     
   645     $this->tpl_bool['enable_uploads'] = ( getConfig('enable_uploads') == '1' && $session->get_permissions('upload_files') ) ? true : false;
   645     $this->tpl_bool['enable_uploads'] = ( getConfig('enable_uploads') == '1' && $session->get_permissions('upload_files') ) ? true : false;
   646     
   646     
   647     $this->tpl_bool['stupid_mode'] = false;
   647     $this->tpl_bool['stupid_mode'] = false;
   648     
   648     
   649     $this->tpl_bool['in_admin'] = ( ( $paths->cpage['urlname_nons'] == 'Administration' && $paths->namespace == 'Special' ) || $paths->namespace == 'Admin' );
   649     $this->tpl_bool['in_admin'] = ( ( $paths->page_id == 'Administration' && $paths->namespace == 'Special' ) || $paths->namespace == 'Admin' );
   650     
   650     
   651     $p = ( isset($_GET['printable']) ) ? '/printable' : '';
   651     $p = ( isset($_GET['printable']) ) ? '/printable' : '';
   652     
   652     
   653     // Add the e-mail address client code to the header
   653     // Add the e-mail address client code to the header
   654     $this->add_header($email->jscode());
   654     $this->add_header($email->jscode());
   766       'LOGIN_LINK'=>$login_link,
   766       'LOGIN_LINK'=>$login_link,
   767       'LOGOUT_LINK'=>$logout_link,
   767       'LOGOUT_LINK'=>$logout_link,
   768       'ADMIN_LINK'=>$admin_link,
   768       'ADMIN_LINK'=>$admin_link,
   769       'THEME_LINK'=>$theme_link,
   769       'THEME_LINK'=>$theme_link,
   770       'SEARCH_ACTION'=>makeUrlNS('Special', 'Search'),
   770       'SEARCH_ACTION'=>makeUrlNS('Special', 'Search'),
   771       'INPUT_TITLE'=>( urlSeparator == '&' ? '<input type="hidden" name="title" value="' . htmlspecialchars( $paths->nslist[$paths->namespace] . $paths->cpage['urlname_nons'] ) . '" />' : ''),
   771       'INPUT_TITLE'=>( urlSeparator == '&' ? '<input type="hidden" name="title" value="' . htmlspecialchars( $paths->nslist[$paths->namespace] . $paths->page_id ) . '" />' : ''),
   772       'INPUT_AUTH'=>( $session->sid_super ? '<input type="hidden" name="auth"  value="' . $session->sid_super . '" />' : ''),
   772       'INPUT_AUTH'=>( $session->sid_super ? '<input type="hidden" name="auth"  value="' . $session->sid_super . '" />' : ''),
   773       'TEMPLATE_DIR'=>scriptPath.'/themes/'.$this->theme,
   773       'TEMPLATE_DIR'=>scriptPath.'/themes/'.$this->theme,
   774       'THEME_ID'=>$this->theme,
   774       'THEME_ID'=>$this->theme,
   775       'STYLE_ID'=>$this->style,
   775       'STYLE_ID'=>$this->style,
   776       'JS_DYNAMIC_VARS'=>$js_dynamic,
   776       'JS_DYNAMIC_VARS'=>$js_dynamic,
   777       'UNREAD_PMS'=>$session->unread_pms,
   777       'UNREAD_PMS'=>$session->unread_pms,
   778       'URL_ABOUT_ENANO' => makeUrlNS('Special', 'About_Enano', '', true),
   778       'URL_ABOUT_ENANO' => makeUrlNS('Special', 'About_Enano', '', true),
   779       'REPORT_URI' => makeUrl($paths->page, 'do=sql_report', true)
   779       'REPORT_URI' => makeUrl($paths->fullpage, 'do=sql_report', true)
   780       );
   780       );
   781     
   781     
   782     foreach ( $paths->nslist as $ns_id => $ns_prefix )
   782     foreach ( $paths->nslist as $ns_id => $ns_prefix )
   783     {
   783     {
   784       $tpl_strings[ 'NS_' . strtoupper($ns_id) ] = $ns_prefix;
   784       $tpl_strings[ 'NS_' . strtoupper($ns_id) ] = $ns_prefix;
  1099     //
  1099     //
  1100     // Data substitution/variables
  1100     // Data substitution/variables
  1101     //
  1101     //
  1102     
  1102     
  1103     // System messages
  1103     // System messages
  1104     $text = preg_replace('/<!-- SYSMSG ([A-z0-9\._-]+?) -->/is', '\' . $this->tplWikiFormat($pages->sysMsg(\'\\1\')) . \'', $text);
  1104     $text = preg_replace('/<!-- SYSMSG ([A-z0-9\._-]+?) -->/is', '\' . $this->tplWikiFormat($paths->sysMsg(\'\\1\')) . \'', $text);
  1105     
  1105     
  1106     // Template variables
  1106     // Template variables
  1107     $text = preg_replace('/\{([A-z0-9_-]+?)\}/is', '\' . $this->tpl_strings[\'\\1\'] . \'', $text);
  1107     $text = preg_replace('/\{([A-z0-9_-]+?)\}/is', '\' . $this->tpl_strings[\'\\1\'] . \'', $text);
  1108     
  1108     
  1109     // Reinsert PHP
  1109     // Reinsert PHP
  1762    */
  1762    */
  1763   
  1763   
  1764   function notify_unread_pms()
  1764   function notify_unread_pms()
  1765   {
  1765   {
  1766     global $db, $session, $paths, $template, $plugins; // Common objects
  1766     global $db, $session, $paths, $template, $plugins; // Common objects
  1767     if ( ( $paths->cpage['urlname_nons'] == 'PrivateMessages' || $paths->cpage['urlname_nons'] == 'Preferences' ) && $paths->namespace == 'Special' )
  1767     if ( ( $paths->page_id == 'PrivateMessages' || $paths->page_id == 'Preferences' ) && $paths->namespace == 'Special' )
  1768     {
  1768     {
  1769       return '';
  1769       return '';
  1770     }
  1770     }
  1771     $ob = '<div class="usermessage">'."\n";
  1771     $ob = '<div class="usermessage">'."\n";
  1772     $s = ( $session->unread_pms == 1 ) ? '' : 's';
  1772     $s = ( $session->unread_pms == 1 ) ? '' : 's';