includes/template.php
changeset 581 5e8fd89c02ea
parent 579 6e23d8a99616
child 582 a38876c0793c
equal deleted inserted replaced
580:41c45314ac27 581:5e8fd89c02ea
    45   var $fading_button = '';
    45   var $fading_button = '';
    46   
    46   
    47   function __construct()
    47   function __construct()
    48   {
    48   {
    49     global $db, $session, $paths, $template, $plugins; // Common objects
    49     global $db, $session, $paths, $template, $plugins; // Common objects
       
    50     
    50     $this->tpl_bool    = Array();
    51     $this->tpl_bool    = Array();
    51     $this->tpl_strings = Array();
    52     $this->tpl_strings = Array();
    52     $this->sidebar_extra = '';
    53     $this->sidebar_extra = '';
    53     $this->toolbar_menu = '';
    54     $this->toolbar_menu = '';
    54     $this->additional_headers = '';
    55     $this->additional_headers = '';
  1162     
  1163     
  1163     // I feel awful doing this.
  1164     // I feel awful doing this.
  1164     if ( preg_match('/^W3C_Validator/', @$_SERVER['HTTP_USER_AGENT']) )
  1165     if ( preg_match('/^W3C_Validator/', @$_SERVER['HTTP_USER_AGENT']) )
  1165     {
  1166     {
  1166       header('Content-type: application/xhtml+xml');
  1167       header('Content-type: application/xhtml+xml');
  1167     }
       
  1168     
       
  1169     // Reassign one important variable that can need to be changed after init_vars(): ADDITIONAL_HEADERS
       
  1170     if ( !empty($this->additional_headers) )
       
  1171     {
       
  1172       $this->assign_vars(array(
       
  1173           'ADDITIONAL_HEADERS' => $this->additional_headers
       
  1174         ));
       
  1175     }
  1168     }
  1176     
  1169     
  1177     $headers_sent = true;
  1170     $headers_sent = true;
  1178     if(!defined('ENANO_HEADERS_SENT'))
  1171     if(!defined('ENANO_HEADERS_SENT'))
  1179       define('ENANO_HEADERS_SENT', '');
  1172       define('ENANO_HEADERS_SENT', '');
  1823    */
  1816    */
  1824    
  1817    
  1825   function username_field($name, $value = false)
  1818   function username_field($name, $value = false)
  1826   {
  1819   {
  1827     $randomid = md5( time() . microtime() . mt_rand() );
  1820     $randomid = md5( time() . microtime() . mt_rand() );
  1828     $text = '<input name="'.$name.'" onkeyup="new AutofillUsername(this);" autocomplete="off" type="text" size="30" id="userfield_'.$randomid.'"';
  1821     $text = '<input name="'.$name.'" class="autofill username" type="text" size="30" id="userfield_'.$randomid.'"';
  1829     if($value) $text .= ' value="'.$value.'"';
  1822     if($value) $text .= ' value="'.$value.'"';
  1830     $text .= ' />';
  1823     $text .= ' />';
  1831     return $text;
  1824     return $text;
  1832   }
  1825   }
  1833   
  1826   
  1838    */
  1831    */
  1839    
  1832    
  1840   function pagename_field($name, $value = false)
  1833   function pagename_field($name, $value = false)
  1841   {
  1834   {
  1842     $randomid = md5( time() . microtime() . mt_rand() );
  1835     $randomid = md5( time() . microtime() . mt_rand() );
  1843     $text = '<input name="'.$name.'" onkeyup="ajaxPageNameComplete(this)" type="text" size="30" id="pagefield_'.$randomid.'"';
  1836     $text = '<input name="'.$name.'" class="autofill page" type="text" size="30" id="pagefield_'.$randomid.'"';
  1844     if($value) $text .= ' value="'.$value.'"';
  1837     if($value) $text .= ' value="'.$value.'"';
  1845     $text .= ' />';
  1838     $text .= ' />';
  1846     $text .= '<script type="text/javascript">
       
  1847         var inp = document.getElementById(\'pagefield_' . $randomid . '\');
       
  1848         var f = get_parent_form(inp);
       
  1849         if ( f )
       
  1850         {
       
  1851           if ( typeof(f.onsubmit) != \'function\' )
       
  1852           {
       
  1853             f.onsubmit = function() {
       
  1854               if ( !submitAuthorized )
       
  1855               {
       
  1856                 return false;
       
  1857               }
       
  1858             }
       
  1859           }
       
  1860         }</script>';
       
  1861     return $text;
  1839     return $text;
  1862   }
  1840   }
  1863   
  1841   
  1864   /**
  1842   /**
  1865    * Sends a textarea that can be converted to and from a TinyMCE widget on the fly.
  1843    * Sends a textarea that can be converted to and from a TinyMCE widget on the fly.