Changeset 560 in t29-www
- Timestamp:
- May 30, 2014, 2:35:27 AM (9 years ago)
- Location:
- lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/cache.php
r516 r560 39 39 private $is_valid = null; // cache output value 40 40 41 function __construct($debug=false, $verbose=false ) {41 function __construct($debug=false, $verbose=false, $skip=false) { 42 42 // default values 43 $this->skip = isset($_GET['skip_cache']) ;43 $this->skip = isset($_GET['skip_cache']) || $skip; 44 44 $this->purge = isset($_GET['purge_cache']); 45 45 $this->debug = isset($_GET['debug_cache']) || $debug; … … 274 274 if($this->skip) { 275 275 $this->print_info('skipped cache and cache saving.'); 276 return; // do not save anything.277 } 278 279 if(!file_exists($this->cache_file)) {280 if(!self::mkdir_recursive(dirname($this->cache_file)))281 $this->print_error('Could not create recursive caching directories');282 }283 284 if(@file_put_contents($this->cache_file, $content))285 $this->print_info('Wrote output cache successfully');286 else287 $this->print_error('Could not write page output cache to '.$this->cache_file);276 //return; // do not save anything. 277 } else { 278 if(!file_exists($this->cache_file)) { 279 if(!self::mkdir_recursive(dirname($this->cache_file))) 280 $this->print_error('Could not create recursive caching directories'); 281 } 282 283 if(@file_put_contents($this->cache_file, $content)) 284 $this->print_info('Wrote output cache successfully'); 285 else 286 $this->print_error('Could not write page output cache to '.$this->cache_file); 287 } 288 288 289 289 if($clear_ob_cache) -
lib/technikum29.php
r516 r560 9 9 if(defined('T29')) return false; // no nesting 10 10 define('T29', true); 11 12 // is it an external call? 13 $external = isset($external); 11 14 12 15 // at least the $seiten_id must be defined … … 35 38 } 36 39 37 // check for url rewriting neccessarity 40 // check for url rewriting neccessarity (skip at external calls) 38 41 if($host->check_url_rewrite()) exit; 39 42 … … 51 54 52 55 // try to determine the language from the file path 53 $lang = substr($file, 1, 2);56 if(!isset($lang)) $lang = substr($file, 1, 2); 54 57 if(!in_array($lang, array_keys($languages))) $lang = "de"; # check if language exists 55 58 $lang_path = $languages[$lang][1]; # shorthand, relative to webroot. use "$webroot$lang_path" for local. … … 57 60 // "AJAX" calls are our meaning for pages without chrome 58 61 $ajax = isset($_GET['ajax']); 59 if( $ajax) {62 if(!$external && $ajax) { 60 63 // print only a minimal chrome, no caching. 61 64 require "$lib/ajax-template.php"; 62 65 $ajax_tmpl = new t29AJAXTemplate($GLOBALS); 63 66 $ajax_tmpl->print_page(); 64 // important: do not execute bottom code67 // important: do not execute code further down (Templating stuff) 65 68 return true; 66 69 } 67 70 68 71 require "$lib/cache.php"; 72 73 // "External" pages which are not part of the t29 website 74 if($external) { 75 // skip caching stuff. External pages don't get in touch with 76 // any navigation.xml or news.php etc. 77 require "$lib/template.php"; 78 $header_cache = new t29Cache(/*debug*/false, /*verbose*/true, /*skip=memory only*/true); 79 $footer_cache = new t29Cache(/*debug*/false, /*verbose*/true, /*skip=memory only*/true); 80 $tmpl = new t29Template($GLOBALS); 81 $tmpl->create_separate_caches($header_cache, $footer_cache); 82 // important: do not execute caching stuff below 83 return true; 84 } 69 85 70 86 $page_cache = new t29Cache(false, true); // debug, verbose -
lib/template.php
r541 r560 52 52 $this->log = t29Log::get(); 53 53 54 // create a menu :54 // create a menu, if not given: 55 55 require_once $this->conf['lib'].'/menu.php'; 56 $this->menu = new t29Menu($this->conf);56 $this->menu = isset($this->conf['menu']) ? $this->conf['menu'] : new t29Menu($this->conf); 57 57 58 58 // create localisation class: … … 71 71 if(!isset($this->conf['header_prepend'])) 72 72 $this->conf['header_prepend'] = array(); // list 73 elseif(is_string($this->conf['header_prepend'])) 74 $this->conf['header_prepend'] = array($this->conf['header_prepend']); // string to list 73 75 74 76 // ask t29Host for configuration fillup … … 229 231 foreach($this->conf['header_prepend'] as $h) print $h."\n "; 230 232 231 if($this->conf['ajax']) print "\n <meta name='t29.ajax' content='true'>"; 233 $indicators = array('ajax', 'external'); 234 foreach($indicators as $key) 235 if($this->conf[$key]) print "\n <meta name='t29.$key' content='true'>"; 232 236 233 237 if(isset($this->conf['version'])) printf('<meta name="t29.version" content="%s">', $this->conf['version']); … … 311 315 312 316 <h2 class="visuallyhidden"><?php $p("sidebar-h2-tour"); ?></h2> 313 <nav class="side"> 314 <?php $this->menu->print_menu(t29Menu::sidebar_menu, $this->conf['host']); ?> 317 <?php 318 $sidebar_contains_menu = !isset($this->conf['sidebar_content']); 319 ?> 320 <nav class="side <?php print $sidebar_contains_menu ? 'contains-menu' : 'contains-custom'; ?>"> 321 <?php 322 if(!$sidebar_contains_menu) 323 // used in external page calls 324 print $this->conf['sidebar_content']; 325 else 326 $this->menu->print_menu(t29Menu::sidebar_menu, $this->conf['host']); 327 ?> 315 328 </nav> 316 <!-- menu changing buttons are made with javascript -->329 <!-- menu changing buttons are made with javascript, but --> 317 330 </section> 318 331 <section class="sidebar bottom"> … … 324 337 <h2 class="visuallyhidden"><?php $p("sidebar-h2-mainnav"); ?></h2> 325 338 <nav class="horizontal"> 326 <?php $this->menu->print_menu(t29Menu::horizontal_menu, $this->conf['host']); ?> 339 <?php 340 if(isset($this->conf['mainnav_content'])) 341 // used in external page calls 342 print $this->conf['mainnav_content']; 343 else 344 $this->menu->print_menu(t29Menu::horizontal_menu, $this->conf['host']); 345 ?> 327 346 </nav> 328 347 <nav class="top"> … … 365 384 <span class="no-js"><?php $p('topnav-search-label'); ?>:</span> 366 385 <input type="text" value="" data-defaultvalue="<?php $p('topnav-search-label'); ?>" name="q" class="text"> 367 <input type="submit" value="<? $p('topnav-search-label'); ?>" class="button">386 <input type="submit" value="<?php $p('topnav-search-label'); ?>" class="button"> 368 387 </form> 369 388 </nav> … … 381 400 382 401 ?> 383 <footer class="in-sheet <? if(!$print_footer_menu) print "empty-footer"; ?>">402 <footer class="in-sheet <?php if(!$print_footer_menu) print "empty-footer"; ?>"> 384 403 <nav class="guide"> 385 404 <!-- hier wird nav.side die Liste per JS reinkopiert --> … … 438 457 </div><!-- end of div id="footer-background-container" helper --> 439 458 440 <? /* JavaScript at the bottom for fast page loading */ ?>459 <?php /* JavaScript at the bottom for fast page loading */ ?> 441 460 <script src="/shared/js-v6/libs/jquery-1.7.2.min.js"></script> 442 461 <script>window.t29={'conf': <?php print json_encode($this->javascript_config); ?>};</script> … … 444 463 $this->print_ressourceloader_links('js', ' <script src="%s"></script>'.PHP_EOL); 445 464 ?> 446 <? /* Piwik Noscript, Script selbst wird asynchron im JS-Bereich aufgerufen */ ?> 447 <noscript><img src="<? $p("js-piwik-noscript-imgsrc"); ?>" alt="" /></noscript> 465 <?php /* Piwik Noscript, Script selbst wird asynchron im JS-Bereich aufgerufen */ ?> 466 <noscript><img src="<?php $p("js-piwik-noscript-imgsrc"); ?>" alt="" /></noscript> 467 <?php 468 if(isset($this->conf['body_append'])) 469 print $this->conf['body_append']; 470 ?> 448 471 </body> 449 472 </html>
Note: See TracChangeset
for help on using the changeset viewer.