| 388 |
388 |
|
| 389 |
389 |
// Print a success message which then automatically redirects the user to another page
|
| 390 |
390 |
function print_success( $message, $redirect = 'index.php' ) {
|
| 391 |
|
global $TEXT;
|
|
391 |
$oTrans = Translate::getInstance();
|
|
392 |
$oTrans->disableAddon();
|
| 392 |
393 |
if(is_array($message)) {
|
| 393 |
394 |
$message = implode ('<br />',$message);
|
| 394 |
395 |
}
|
| ... | ... | |
| 403 |
404 |
$tpl->set_var( 'MESSAGE', $message );
|
| 404 |
405 |
$tpl->set_var( 'REDIRECT', $redirect );
|
| 405 |
406 |
$tpl->set_var( 'REDIRECT_TIMER', $redirect_timer );
|
| 406 |
|
$tpl->set_var( 'NEXT', $TEXT['NEXT'] );
|
| 407 |
|
$tpl->set_var( 'BACK', $TEXT['BACK'] );
|
|
407 |
$tpl->set_var( 'NEXT', $oTrans->TEXT_NEXT);
|
|
408 |
$tpl->set_var( 'BACK', $oTrans->TEXT_BACK);
|
| 408 |
409 |
if ($redirect_timer == -1) {
|
| 409 |
410 |
$tpl->set_block( 'show_redirect', '' );
|
| 410 |
411 |
}
|
| ... | ... | |
| 417 |
418 |
|
| 418 |
419 |
// Print an error message
|
| 419 |
420 |
function print_error($message, $link = 'index.php', $auto_footer = true) {
|
| 420 |
|
global $TEXT;
|
|
421 |
$oTrans = Translate::getInstance();
|
|
422 |
$oTrans->disableAddon();
|
| 421 |
423 |
if(is_array($message)) {
|
| 422 |
424 |
$message = implode ('<br />',$message);
|
| 423 |
425 |
}
|
| ... | ... | |
| 427 |
429 |
$success_template->set_block('page', 'main_block', 'main');
|
| 428 |
430 |
$success_template->set_var('MESSAGE', $message);
|
| 429 |
431 |
$success_template->set_var('LINK', $link);
|
| 430 |
|
$success_template->set_var('BACK', $TEXT['BACK']);
|
|
432 |
$success_template->set_var('BACK', $oTrans->TEXT_BACK);
|
| 431 |
433 |
$success_template->parse('main', 'main_block', false);
|
| 432 |
434 |
$success_template->pparse('output', 'page');
|
| 433 |
435 |
if ( $auto_footer == true ) {
|
| ... | ... | |
| 622 |
624 |
}
|
| 623 |
625 |
}
|
| 624 |
626 |
|
| 625 |
|
/**
|
| 626 |
|
* checks if there is an alternative Theme template
|
| 627 |
|
*
|
| 628 |
|
* @param string $sThemeFile set the template.htt
|
| 629 |
|
* @return string the relative theme path
|
| 630 |
|
*
|
| 631 |
|
*/
|
|
627 |
/**
|
|
628 |
* checks if there is an alternative Theme template
|
|
629 |
*
|
|
630 |
* @param string $sThemeFile set the template.htt
|
|
631 |
* @return string the relative theme path
|
|
632 |
*
|
|
633 |
*/
|
| 632 |
634 |
function correct_theme_source($sThemeFile = 'start.htt') {
|
| 633 |
635 |
$sRetval = $sThemeFile;
|
| 634 |
636 |
if (file_exists(THEME_PATH.'/templates/'.$sThemeFile )) {
|
| ... | ... | |
| 643 |
645 |
return $sRetval;
|
| 644 |
646 |
}
|
| 645 |
647 |
|
| 646 |
|
/**
|
| 647 |
|
* Check if a foldername doesn't have invalid characters
|
| 648 |
|
*
|
| 649 |
|
* @param String $str to check
|
| 650 |
|
* @return Bool
|
| 651 |
|
*/
|
|
648 |
/**
|
|
649 |
* Check if a foldername doesn't have invalid characters
|
|
650 |
*
|
|
651 |
* @param String $str to check
|
|
652 |
* @return Bool
|
|
653 |
*/
|
| 652 |
654 |
function checkFolderName($str){
|
| 653 |
655 |
return !( preg_match('#\^|\\\|\/|\.|\?|\*|"|\'|\<|\>|\:|\|#i', $str) ? TRUE : FALSE );
|
| 654 |
656 |
}
|
| 655 |
657 |
|
| 656 |
|
/**
|
| 657 |
|
* Check the given path to make sure current path is within given basedir
|
| 658 |
|
* normally document root
|
| 659 |
|
*
|
| 660 |
|
* @param String $sCurrentPath
|
| 661 |
|
* @param String $sBaseDir
|
| 662 |
|
* @return $sCurrentPath or FALSE
|
| 663 |
|
*/
|
|
658 |
/**
|
|
659 |
* Check the given path to make sure current path is within given basedir
|
|
660 |
* normally document root
|
|
661 |
*
|
|
662 |
* @param String $sCurrentPath
|
|
663 |
* @param String $sBaseDir
|
|
664 |
* @return $sCurrentPath or FALSE
|
|
665 |
*/
|
| 664 |
666 |
function checkpath($sCurrentPath, $sBaseDir = WB_PATH){
|
| 665 |
667 |
// Clean the cuurent path
|
| 666 |
668 |
$sCurrentPath = rawurldecode($sCurrentPath);
|
| ... | ... | |
| 678 |
680 |
}
|
| 679 |
681 |
}
|
| 680 |
682 |
|
| 681 |
|
/**
|
| 682 |
|
*
|
| 683 |
|
* remove <?php code ?>, [[text]], link, script, scriptblock and styleblock from a given string
|
| 684 |
|
* and return the cleaned string
|
| 685 |
|
*
|
| 686 |
|
* @param string $sValue
|
| 687 |
|
* @returns
|
| 688 |
|
* false: if @param is not a string
|
| 689 |
|
* string: cleaned string
|
| 690 |
|
*/
|
|
683 |
/**
|
|
684 |
* remove <?php code ?>, [[text]], link, script, scriptblock and styleblock from a given string
|
|
685 |
* and return the cleaned string
|
|
686 |
*
|
|
687 |
* @param string $sValue
|
|
688 |
* @returns
|
|
689 |
* false: if @param is not a string
|
|
690 |
* string: cleaned string
|
|
691 |
*/
|
| 691 |
692 |
public function StripCodeFromText($sValue, $bPHPCode=false){
|
| 692 |
693 |
if(!is_string($sValue)) { return false; }
|
| 693 |
694 |
$sValue = ( ($bPHPCode==true) ? preg_replace ('/\[\[.*?\]\]\s*?|<\?php\s+.*\?>\s*?/isU', '', $sValue ) : $sValue );
|
| ... | ... | |
| 695 |
696 |
return (preg_replace ($sPattern, '', $sValue));
|
| 696 |
697 |
}
|
| 697 |
698 |
|
|
699 |
/**
|
|
700 |
* ReplaceAbsoluteMediaUrl
|
|
701 |
* @param string $sContent
|
|
702 |
* @return string
|
|
703 |
* @description Replace URLs witch are pointing into MEDIA_DIRECTORY with an URL
|
|
704 |
* independend placeholder
|
|
705 |
*/
|
|
706 |
public function ReplaceAbsoluteMediaUrl($sContent){
|
|
707 |
if(ini_get('magic_quotes_gpc')==true){
|
|
708 |
$sContent = $this->strip_slashes($sContent);
|
|
709 |
}
|
|
710 |
if(is_string($sContent)) {
|
|
711 |
$sMediaUrl = WB_URL.MEDIA_DIRECTORY;
|
|
712 |
$searchfor = '@(<[^>]*=\s*")('.preg_quote($sMediaUrl).')([^">]*".*>)@siU';
|
|
713 |
$sContent = preg_replace($searchfor, '$1{SYSVAR:MEDIA_REL}$3', $sContent );
|
|
714 |
}
|
|
715 |
return $sContent;
|
|
716 |
}
|
| 698 |
717 |
|
|
718 |
|
|
719 |
|
| 699 |
720 |
}
|
add new method wb::ReplaceAbsoluteMediaUrl()
class wb: added Translate::disableAddon() in print_error() and print_success()