Wednesday 6 March 2019

PHP Parse error: syntax error, unexpected $end in /var/www/html/utm5_web_php/lib/module.php on line 155

I have been searching for the missing bracket but cannot see it. I have not looked at code for a few years. Also used a couple of online PHP checkers but they did not see anything wrong.



I get the following error in the httpd error log when i try and access index.php. The file module.php is included in the index file. Below is the module.php file.




PHP Parse error: syntax error, unexpected $end in /var/www/html/utm5_web_php/lib/module.php on line 155




Also I am not really a PHP programmer, i have been trying to get a test program to work to see if its something we could use.





include_once dirname(__FILE__)."/../lib/table.php";
include_once dirname(__FILE__)."/../lib/form.php";
include_once dirname(__FILE__)."/../lib/lang.php";
include_once dirname(__FILE__)."/../lib/resolve.php";

class Module {
private $title;
private $group;

private $visible;
private $login;
private $menu;
private $errorMessage;
private $printMode = false;
private $invoiceMode = false;
protected $urfa;

function init($title='Unknown',$group='Default',$visible = false,$login = false) {
$this->title = str_replace(' ', ' ', $title);

$this->group = $group;
$this->visible = $visible;
$this->login = $login;
}

function writeBody() {
}

function setPrintMode($mode){
$this->printMode=$mode;

}

function setInvoiceMode($mode){
$this->invoiceMode=$mode;
}

function loadMenu() {
global $MOD_TITLE,$MOD_GROUP,$MOD_VISIBLE;
$this->menu = array();
$dir = dir(dirname(__FILE__)."/../modules");


$fileArray = array();

while(false !== ($file = $dir->read())) {
$fileArray[] = $file;
}
sort($fileArray);
foreach ($fileArray as $file) {
if(preg_match("/^([a-z0-9_]+)\.php$/",$file,$out)) {
include dirname(__FILE__)."/../modules/".$file;

if(!$MOD_VISIBLE)
continue;

if($MOD_LOGIN != $this->login)
continue;

if($MOD_LOGIN != true && isset($_COOKIE['system']) && $_COOKIE['system'] > 0)
if($MOD_SYSTEM != $_COOKIE['system'])
continue;



$this->menu[$MOD_GROUP][$out[1]] = $MOD_TITLE;
}
}
}

function writeHtml() {
global $CONF_PATH;
global $CONF_LANG;
$this->loadMenu();

if($this->invoiceMode == false){
?>


















UTM: <?=langGet($this->title)?>



printMode == false){?>








global $MOD_SUBMENU;
if($MOD_SUBMENU != true){
echo('
');
}

if($this->errorMessage) {
echo "

".$this->errorMessage."

\n";
}
$this->writeBody();
?>


$this->writeBody();
} ?>


header("Content-Type: text/html; charset=utf-8");

$this->writeBody();
}
}

function setUrfa($urfa) {
$this->urfa = $urfa;
}

function addErrorMessage($msg) {
$this->errorMessage = $msg;

}
}

?>

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...