Project

General

Profile

« Previous | Next » 

Revision 1625

Added by Dietmar over 12 years ago

! update correct_theme_source and fixed the call in all files

View differences:

class.wb.php
346 346
	    $redirect_timer = ((defined( 'REDIRECT_TIMER' )) && (REDIRECT_TIMER <= 10000)) ? REDIRECT_TIMER : 0;
347 347
	    // add template variables
348 348
		// Setup template object, parse vars to it, then parse it
349
		$ThemePath = realpath(WB_PATH.$this->correct_theme_source('success.htt'));
350
		$tpl = new Template($ThemePath);
349
		$tpl = new Template(dirname($this->correct_theme_source('success.htt')));
351 350
	    $tpl->set_file( 'page', 'success.htt' );
352 351
	    $tpl->set_block( 'page', 'main_block', 'main' );
353 352
	    $tpl->set_block( 'main_block', 'show_redirect_block', 'show_redirect' );
......
373 372
           $message = implode ('<br />',$message);
374 373
        }
375 374
		// Setup template object, parse vars to it, then parse it
376
		$ThemePath = realpath(WB_PATH.$this->correct_theme_source('error.htt'));
377
		$success_template = new Template($ThemePath);
375
		$success_template = new Template(dirname($this->correct_theme_source('error.htt')));
378 376
		$success_template->set_file('page', 'error.htt');
379 377
		$success_template->set_block('page', 'main_block', 'main');
380 378
		$success_template->set_var('MESSAGE', $message);
......
429 427
		}
430 428
	}
431 429

  
432
	/**
433
	 * checks if there is an alternative Theme template
434
	 *
435
	 * @access public
436
	 * @param string : set the template.htt
437
	 * @return string: the relative theme path
438
	 *
439
	 */
440
	function correct_theme_source($sThemeFile = 'start.htt'){
441
		$sThemePath = ADMIN_URL.'/themes/templates';
442
		if ( file_exists( THEME_PATH.'/templates/'.$sThemeFile ) ){
443
			$sThemePath = THEME_URL.'/templates';
444
	}
445
		return str_replace(WB_URL,'',$sThemePath);
446
	}
430
	 /**
431
	  * checks if there is an alternative Theme template
432
	  *
433
	  * @param string $sThemeFile set the template.htt
434
	  * @return string the relative theme path
435
	  *
436
	  */
437
        function correct_theme_source($sThemeFile = 'start.htt') {
438
		$sRetval = $sThemeFile;
439
		if (file_exists(THEME_PATH.'/templates/'.$sThemeFile )) {
440
			$sRetval = THEME_PATH.'/templates/'.$sThemeFile;
441
		} else {
442
			if (file_exists(ADMIN_PATH.'/themes/templates/'.$sThemeFile ) ) {
443
			$sRetval = ADMIN_PATH.'/themes/templates/'.$sThemeFile;
444
			} else {
445
				throw new InvalidArgumentException('missing template file '.$sThemeFile);
446
			}
447
		}
448
		return $sRetval;
449
        }
447 450

  
448 451
	/**
449 452
	 * Check if a foldername doesn't have invalid characters

Also available in: Unified diff