<?php


defined('WikyBlog') or die("Not an entry point...");

global $page,$langA;
switch( $page->userCmd ){
	case 'save':
	case wbStrtolower($langA['save']):
		showSyntaxErrors(false);
	break;
	default:
		showSyntaxErrors();
	break;
}


function showSyntaxErrors($check=true){
	global $page, $dbObject, $wbParser, $langA;
	
	if( $check){
		$dbObject->checkData(false);
	}
	
	//	1)	Editing Error Messages
	if( $wbParser && $wbParser->errors ){
		
		$page->contentA[$langA['syntax_warning']] = '<ul>';
		foreach( $wbParser->errors as $error ){
			$page->contentA[$langA['syntax_warning']] .= '<li>'.$error.'</li>';
		}
		$page->contentA[$langA['syntax_warning']] .= '</ul>';
		$page->contentA[$langA['syntax_warning']] = $page->contentA[$langA['syntax_warning']];
		//$page->contentA[$langA['syntax_warning']] = toEditArea($page->contentA[$langA['syntax_warning']]);
	}else{
		message('SYNTAX_FIXED');
	}
}
