Z€ddix: unexpected $end, aber wo ist der Fehler?

Beitrag lesen

Hello there,

Heute bin ich über einen komischen Fehler gestolpert:

Parse error: syntax error, unexpected $end in C:\xampp\htdocs\test\header.php(412) : eval()'d code on line 74

Komisch is nicht der Fehler, aber die Stelle wo er auftritt.
Bis jetzt konnte ich keinen Klammer Fehler ausmachen, vielleicht bin ich aber auch blind.....
Wäre toll wen jemand mal drüberschauen könnte.

<?php  
	/* Pages - Functions  
		001. pages_edit  
		002. pages_edit_display  
	*/  
//------------------------------------------------------------------  
//	001. pages_edit  
//------------------------------------------------------------------  
	function pages_edit($id) {  
		global $cache;  
		global $db;  
		global $permission;  
		$result = $cache->mysql('pages_list_'.$id,'SELECT * FROM `pages_list` WHERE `id`='.$id);  
		// Display UPDATE  
		$result['title'] = $db->escape_string($_POST['title']);  
		$result['describtion'] = str_replace(array('\r\n','\n'),'',$db->escape_string($_POST['describtion']));  
		// Rights  
		if ( (isset($_POST['rights'])) AND ($permission->user('pages_'.$id,'EE') OR ((int)$result['owner'] === $_SESSION['userid']))) {  
			foreach ( $_POST['rights'] as $group => $array ) $rights['pages_'.$id][$group] = $array['read'].$array['edit'].$array['delete'];  
			newrights($rights);  
		}  
		// Link  
		$link = $db->escape_string($_POST['link']);  
		$check = $db->query('SELECT `link_request` FROM `main_link_table` WHERE `link_request` = "'.$link.'"');  
		if ( $check->num_rows === 0 ) {  
			$db->query('UPDATE `main_link_table` SET `link_request` = "'.$link.'" WHERE `file` = "pages:pages.php" AND `parameter` = "'.$id.'"');  
			$output['link'] = $link;  
			$cache->flush('main_link_table');  
			  
		}  
		$sql = 'UPDATE `pages_list` SET ';  
		// Owner  
		if ( (isset($_POST['owner'])) AND ((int)$result['owner'] === $_SESSION['userid'])) {  
			$newowner = $cache->user($_POST['owner']);  
			if ( (int)$newowner[0] !== $_SESSION['userid'] ) $sql .= '`owner`="'.$newowner[0].'", ';  
		}  
		$a = 0;  
		$list = array('php','html','css','js');  
		while ( isset($list[$a]) ) {  
			$path = $db->escape_string(trim($_POST[$list[$a]]['path']));  
			$path = (strpos($path,'/') === 0) ? $path: '/'.$path;  
			$content = trim($_POST[$list[$a]]['content']);  
			$path_new = ($_POST[$list[$a]]['pathtyp'] === 'file') ?'/module/pages/pages/'.$id.$path: $path;  
			$sql .= '`'.$list[$a].'`="'.$path_new.'", ';  
			$result[$list[$a]] = $path_new;  
			if ($_POST[$list[$a]]['pathtyp'] === 'file') {  
				// File  
				$path_old = $db->query('SELECT `'.$list[$a].'` FROM `pages_list` WHERE `id`='.$id);  
				$path_old = $path_old->fetch_row();  
				$realpath = realpath('');  
				$path_old = $realpath.$path_old[0];  
				$path_new = $realpath.$path_new;  
				if ( (file_exists($path_old)) && (strpos($path_old,'/module/pages/pages/'.$id) === 0) ) rename($path_old,$path_new.'.bak');  
				if ( file_exists($path_new) ) unlink($path_new);  
				file_put_contents($path_new,html_entity_decode($content,ENT_QUOTES, 'UTF-8'));  
			}  
			++$a;  
		}  
		$sql .= '`title`="'.$result['title'].'", `describtion`="'.$result['describtion'].'" WHERE `id`='.$id.';';  
		$db->query($sql);  
		$cache->flush('pages_list');  
		return $result;  
	}  
//------------------------------------------------------------------  
//	002. pages_edit_display  
//------------------------------------------------------------------  
	function pages_edit_display($id) {  
		global $db;  
		global $cache;  
		global $permission;  
		$output['id'] = $result['id'];  
		if ( $result['id'] === 'new' ) {  
			// NEW  
			$output['title'] = '';  
			$output['describtion'] = '';  
			$output['path'] = '/module/pages/pages/ID';  
			$output['link'] = '" disabled=disabled"';  
			$output['owner'] = $cache->user($_SESSION['userid']);  
			$output['owner'] = $output['owner'][1];  
			$a = 0;  
			while ( isset($list[$a]) ) {  
				$output[$list[$a]]['path'] = '';  
				$output[$list[$a]]['content'] = '';  
				$output[$list[$a]]['input']['search'] = '';  
				$output[$list[$a]]['input']['replace'] = '';  
				$output[$list[$a]]['input']['path'] = '';  
				++$a;  
			}  
			$result = $cache->mysql('main_groups_langname','SELECT * FROM `main_groups` WHERE name="langname"');  
			array_shift($result);  
			array_shift($result);  
			$x = 0;  
			foreach ( $result as $grpid => $langname ) {  
				$output['rights'][$x]['id'] = $grpid;  
				$read = 'RR';  
				$edit = 'E';  
				$delete = 'D';  
				$output['rights'][$x]['name'] = (defined($langname)) ? constant($langname) : $langname;  
				$output['rights'][$x]['search'] = array('value="'.$read.'"','value="'.$edit.'"','value="'.$delete.'"');  
				$output['rights'][$x]['replace'] = array('value="'.$read.'" selected="selected"','value="'.$edit.'" selected="selected"','value="'.$delete.'" selected="selected"');  
				++$x;  
			}  
		} else {  
			// EDIT  
			$output['title'] = $result['title'];  
			$output['describtion'] = $result['describtion'];  
			$output['path'] = '/module/pages/pages/'.$result['id'];  
			if ( isset($output['link']) === FALSE ) {  
				$output['link'] = $cache->mysql('main_link_table_pages_'.$result['id'],'SELECT `link_request` FROM `main_link_table` WHERE `file` = "pages:pages.php" AND `parameter` = "'.$result['id'].'"');  
				$output['link'] = $output['link']['link_request'];  
			}  
			$check =  
			$a = 0;  
			while (isset($list[$a])) {  
				$path = $result[$list[$a]];  
				if ( is_file(realpath('').$path) ) {  
					$output[$list[$a]]['path'] = $path;  
					$intern = (strpos($path,'/module/pages/pages/'.$result['id']) === 0) ? TRUE: FALSE;  
					$output[$list[$a]]['input']['search'] = ($intern) ? 'value="file"': 'value="link"';  
					$output[$list[$a]]['input']['replace'] = ($intern) ? 'value="file" selected="selected"': 'value="link" selected="selected"';  
					$output[$list[$a]]['input']['path'] = (strpos($path,'/module/pages/pages/'.$result['id']) === 0) ? str_replace('/module/pages/pages/'.$result['id'],'',$path):$path;  
					$output[$list[$a]]['content'] = htmlentities(file_get_contents(realpath('').$path),ENT_QUOTES, 'UTF-8');  
				} else {  
					$output[$list[$a]]['path'] = '';  
					$output[$list[$a]]['input']['search'] = '';  
					$output[$list[$a]]['input']['replace'] = '';  
					$output[$list[$a]]['input']['path'] = '';  
					$output[$list[$a]]['content'] = '';  
				}  
				++$a;  
			}  
			if ( $permission->user('pages_'.$result['id'],'EE') OR ((int)$result['owner'] === $_SESSION['userid'])) {  
				$rights = $cache->mysql('main_groups_rights_pages_'.$result['id'],'SELECT * FROM `main_groups_rights` WHERE name="pages_'.$result['id'].'";');  
				array_shift($rights);  
				array_shift($rights);  
				$x = 0;  
				foreach ( $rights as $grpid => $value ) {  
					$group = $cache->group($grpid);  
					$read = (strpos($value,'R') !== FALSE) ? ((strpos($value,'RR') !== FALSE) ? 'RR' : 'R') : '';  
					$edit = (strpos($value,'E') !== FALSE) ? ((strpos($value,'EE') !== FALSE) ? 'EE' : 'E') : '';  
					$delete = (strpos($value,'D') !== FALSE) ? ((strpos($value,'DD') !== FALSE) ? 'DD' : 'D') : '';  
					$output['rights'][$x]['id'] = $grpid;  
					$output['rights'][$x]['name'] = (defined($group['langname'])) ? constant($group['langname']) : $group['langname'];  
					$output['rights'][$x]['search'] = array('value="'.$read.'"','value="'.$edit.'"','value="'.$delete.'"');  
					$output['rights'][$x]['replace'] = array('value="'.$read.'" selected="selected"','value="'.$edit.'" selected="selected"','value="'.$delete.'" selected="selected"');  
					++$x;  
				}  
			}  
			$output['owner'] = $cache->user($result['owner']);  
			if ((int)$result['owner'] === $_SESSION['userid']) {  
				$output['owner'] = $output['owner'][1];  
			} else {  
				$output['owner'] = $output['owner'][1].'" disabled="disabled';  
			}  
		}  
		return $output;  
	}  
?>

Hier nochmal die Stelle.

69		global $cache;  
70		global $permission;  
71		$output['id'] = $result['id'];  
72		if ( $result['id'] === 'new' ) {  
73			// NEW  
74			$output['title'] = '';

Der Fehler verschwindet, sobald ich die If Anweisung entferne(was zwar für einen Klammerfehler spricht, ich ihn aber dennoch nicht finde.)

Gruß und Danke
Zeddix