includes/template.php
changeset 650 e45183014778
parent 615 8eed90734867
child 655 b2c51a68209b
equal deleted inserted replaced
649:74e03196fd43 650:e45183014778
    54     $this->toolbar_menu = '';
    54     $this->toolbar_menu = '';
    55     $this->additional_headers = '';
    55     $this->additional_headers = '';
    56     $this->plugin_blocks = Array();
    56     $this->plugin_blocks = Array();
    57     $this->theme_loaded = false;
    57     $this->theme_loaded = false;
    58     
    58     
    59     $this->fading_button = '<div style="background-image: url('.scriptPath.'/images/about-powered-enano-hover.png); background-repeat: no-repeat; width: 88px; height: 31px; margin: 0 auto 5px auto;">
    59     $this->fading_button = '<div style="background-image: url('.cdnPath.'/images/about-powered-enano-hover.png); background-repeat: no-repeat; width: 88px; height: 31px; margin: 0 auto 5px auto;">
    60                               <a style="background-image: none; padding-right: 0;" href="http://enanocms.org/" onclick="window.open(this.href); return false;"><img style="border-width: 0;" alt=" " src="'.scriptPath.'/images/about-powered-enano.png" onmouseover="domOpacity(this, 100, 0, 500);" onmouseout="domOpacity(this, 0, 100, 500);" /></a>
    60                               <a style="background-image: none; padding-right: 0;" href="http://enanocms.org/" onclick="window.open(this.href); return false;"><img style="border-width: 0;" alt=" " src="'.cdnPath.'/images/about-powered-enano.png" onmouseover="domOpacity(this, 100, 0, 500);" onmouseout="domOpacity(this, 0, 100, 500);" /></a>
    61                             </div>';
    61                             </div>';
    62     
    62     
    63     $this->theme_list = Array();
    63     $this->theme_list = Array();
    64     $this->named_theme_list = Array();
    64     $this->named_theme_list = Array();
    65     
    65     
   984     foreach ( $code as $cmd )
   984     foreach ( $code as $cmd )
   985     {
   985     {
   986       eval($cmd);
   986       eval($cmd);
   987     }
   987     }
   988     
   988     
       
   989     // Set up javascript includes
       
   990     // these depend heavily on whether we have a CDN to work with or not
       
   991     if ( getConfig('cdn_path') )
       
   992     {
       
   993       // we're on a CDN, point to static includes
       
   994       // probably should have a way to compress stuff like this before uploading to CDN
       
   995       $js_head = '<script type="text/javascript" src="' . cdnPath . '/includes/clientside/static/enano-lib-basic.js"></script>';
       
   996       $js_foot = <<<JSEOF
       
   997     <script type="text/javascript">
       
   998       // This initializes the Javascript runtime when the DOM is ready - not when the page is
       
   999       // done loading, because enano-lib-basic still has to load some 15 other script files
       
  1000       // check for the init function - this is a KHTML fix
       
  1001       // This doesn't seem to work properly in IE in 1.1.x - there are some problems with
       
  1002       // tinyMCE and l10n.
       
  1003       if ( typeof ( enano_init ) == 'function' && !IE )
       
  1004       {
       
  1005         enano_init();
       
  1006         window.onload = function(e) {  };
       
  1007       }
       
  1008     </script>
       
  1009 JSEOF;
       
  1010     }
       
  1011     else
       
  1012     {
       
  1013       $cdnpath = cdnPath;
       
  1014       // point to jsres compressor
       
  1015       $js_head = <<<JSEOF
       
  1016       <!-- Only load a basic set of functions for now. Let the rest of the API load when the page is finished. -->
       
  1017       <script type="text/javascript" src="$cdnpath/includes/clientside/jsres.php?early"></script>
       
  1018 JSEOF;
       
  1019       $js_foot = <<<JSEOF
       
  1020     <!-- jsres.php is a wrapper script that compresses and caches single JS files to minimize requests -->
       
  1021     <script type="text/javascript" src="$cdnpath/includes/clientside/jsres.php"></script>
       
  1022     <script type="text/javascript">
       
  1023       // This initializes the Javascript runtime when the DOM is ready - not when the page is
       
  1024       // done loading, because enano-lib-basic still has to load some 15 other script files
       
  1025       // check for the init function - this is a KHTML fix
       
  1026       // This doesn't seem to work properly in IE in 1.1.x - there are some problems with
       
  1027       // tinyMCE and l10n.
       
  1028       if ( typeof ( enano_init ) == 'function' && !IE )
       
  1029       {
       
  1030         enano_init();
       
  1031         window.onload = function(e) {  };
       
  1032       }
       
  1033     </script>
       
  1034 JSEOF;
       
  1035     }
       
  1036     
   989     // Some additional sidebar processing
  1037     // Some additional sidebar processing
   990     if ( $this->sidebar_extra != '' )
  1038     if ( $this->sidebar_extra != '' )
   991     {
  1039     {
   992       $se = $this->sidebar_extra;
  1040       $se = $this->sidebar_extra;
   993       $parser = $this->makeParserText($tplvars['sidebar_section_raw']);
  1041       $parser = $this->makeParserText($tplvars['sidebar_section_raw']);
  1075       // This section defines some basic and very important variables that are used later in the static Javascript library.
  1123       // This section defines some basic and very important variables that are used later in the static Javascript library.
  1076       // 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.
  1124       // 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.
  1077       var title = \''. $urlname_jssafe .'\';
  1125       var title = \''. $urlname_jssafe .'\';
  1078       var physical_title = \'' . $physical_urlname_jssafe . '\';
  1126       var physical_title = \'' . $physical_urlname_jssafe . '\';
  1079       var page_exists = '. ( ( $local_page_exists) ? 'true' : 'false' ) .';
  1127       var page_exists = '. ( ( $local_page_exists) ? 'true' : 'false' ) .';
  1080       var scriptPath = \''. scriptPath .'\';
  1128       var scriptPath = \'' . addslashes(scriptPath) . '\';
  1081       var contentPath = \''.contentPath.'\';
  1129       var contentPath = \'' . addslashes(contentPath) . '\';
       
  1130       var cdnPath = \'' . addslashes(cdnPath) . '\';
  1082       var ENANO_SID = \'' . $SID . '\';
  1131       var ENANO_SID = \'' . $SID . '\';
  1083       var user_level = ' . $session->user_level . ';
  1132       var user_level = ' . $session->user_level . ';
  1084       var auth_level = ' . $session->auth_level . ';
  1133       var auth_level = ' . $session->auth_level . ';
  1085       var USER_LEVEL_GUEST = ' . USER_LEVEL_GUEST . ';
  1134       var USER_LEVEL_GUEST = ' . USER_LEVEL_GUEST . ';
  1086       var USER_LEVEL_MEMBER = ' . USER_LEVEL_MEMBER . ';
  1135       var USER_LEVEL_MEMBER = ' . USER_LEVEL_MEMBER . ';
  1126       'USERNAME'=>$session->username,
  1175       'USERNAME'=>$session->username,
  1127       'SITE_DESC'=>htmlspecialchars(getConfig('site_desc')),
  1176       'SITE_DESC'=>htmlspecialchars(getConfig('site_desc')),
  1128       'TOOLBAR'=>$tb,
  1177       'TOOLBAR'=>$tb,
  1129       'SCRIPTPATH'=>scriptPath,
  1178       'SCRIPTPATH'=>scriptPath,
  1130       'CONTENTPATH'=>contentPath,
  1179       'CONTENTPATH'=>contentPath,
       
  1180       'CDNPATH' => cdnPath,
  1131       'ADMIN_SID_QUES'=>$asq,
  1181       'ADMIN_SID_QUES'=>$asq,
  1132       'ADMIN_SID_AMP'=>$asa,
  1182       'ADMIN_SID_AMP'=>$asa,
  1133       'ADMIN_SID_AMP_HTML'=>$ash,
  1183       'ADMIN_SID_AMP_HTML'=>$ash,
  1134       'ADMIN_SID_AUTO'=>$as2,
  1184       'ADMIN_SID_AUTO'=>$as2,
  1135       'ADMIN_SID_RAW'=> ( is_string($session->sid_super) ? $session->sid_super : '' ),
  1185       'ADMIN_SID_RAW'=> ( is_string($session->sid_super) ? $session->sid_super : '' ),
  1145       'INPUT_TITLE'=>( urlSeparator == '&' ? '<input type="hidden" name="title" value="' . htmlspecialchars( $paths->nslist[$local_namespace] . $local_page_id ) . '" />' : ''),
  1195       'INPUT_TITLE'=>( urlSeparator == '&' ? '<input type="hidden" name="title" value="' . htmlspecialchars( $paths->nslist[$local_namespace] . $local_page_id ) . '" />' : ''),
  1146       'INPUT_AUTH'=>( $session->sid_super ? '<input type="hidden" name="auth"  value="' . $session->sid_super . '" />' : ''),
  1196       'INPUT_AUTH'=>( $session->sid_super ? '<input type="hidden" name="auth"  value="' . $session->sid_super . '" />' : ''),
  1147       'TEMPLATE_DIR'=>scriptPath.'/themes/'.$this->theme,
  1197       'TEMPLATE_DIR'=>scriptPath.'/themes/'.$this->theme,
  1148       'THEME_ID'=>$this->theme,
  1198       'THEME_ID'=>$this->theme,
  1149       'STYLE_ID'=>$this->style,
  1199       'STYLE_ID'=>$this->style,
       
  1200       'JS_HEADER' => $js_head,
       
  1201       'JS_FOOTER' => $js_foot,
  1150       'JS_DYNAMIC_VARS'=>$js_dynamic,
  1202       'JS_DYNAMIC_VARS'=>$js_dynamic,
  1151       'UNREAD_PMS'=>$session->unread_pms,
  1203       'UNREAD_PMS'=>$session->unread_pms,
  1152       'URL_ABOUT_ENANO' => makeUrlNS('Special', 'About_Enano', '', true),
  1204       'URL_ABOUT_ENANO' => makeUrlNS('Special', 'About_Enano', '', true),
  1153       'REPORT_URI' => makeUrl($local_fullpage, 'do=sql_report', true)
  1205       'REPORT_URI' => makeUrl($local_fullpage, 'do=sql_report', true)
  1154       );
  1206       );
  2442     $this->sidebar_extra = '';
  2494     $this->sidebar_extra = '';
  2443     $this->sidebar_widgets = '';
  2495     $this->sidebar_widgets = '';
  2444     $this->toolbar_menu = '';
  2496     $this->toolbar_menu = '';
  2445     $this->additional_headers = '<style type="text/css">div.pagenav { border-top: 1px solid #CCC; padding-top: 7px; margin-top: 10px; }</style>';
  2497     $this->additional_headers = '<style type="text/css">div.pagenav { border-top: 1px solid #CCC; padding-top: 7px; margin-top: 10px; }</style>';
  2446     
  2498     
  2447     $this->fading_button = '<div style="background-image: url('.scriptPath.'/images/about-powered-enano-hover.png); background-repeat: no-repeat; width: 88px; height: 31px; margin: 0 auto 5px auto;">
  2499     $this->fading_button = '<div style="background-image: url('.cdnPath.'/images/about-powered-enano-hover.png); background-repeat: no-repeat; width: 88px; height: 31px; margin: 0 auto 5px auto;">
  2448                               <a href="http://enanocms.org/" onclick="window.open(this.href); return false;"><img style="border-width: 0;" alt=" " src="'.scriptPath.'/images/about-powered-enano.png" onmouseover="domOpacity(this, 100, 0, 500);" onmouseout="domOpacity(this, 0, 100, 500);" /></a>
  2500                               <a href="http://enanocms.org/" onclick="window.open(this.href); return false;"><img style="border-width: 0;" alt=" " src="'.cdnPath.'/images/about-powered-enano.png" onmouseover="domOpacity(this, 100, 0, 500);" onmouseout="domOpacity(this, 0, 100, 500);" /></a>
  2449                             </div>';
  2501                             </div>';
  2450     
  2502     
  2451     // get list of themes
  2503     // get list of themes
  2452     $this->theme_list = array();
  2504     $this->theme_list = array();
  2453     $this->named_theme_list = array();
  2505     $this->named_theme_list = array();