user = $user; $this->userdir = USERPATH."/".$user."/"; $this->infodir = HELPPATH."INFO/"; } } /** * Add new info message and mark user dir with newInfo file */ public function addInfo($group){ // special dir for group news if ($group) $this->infodir = BASE_PATH.'help/'.$group.'_INFO/'; else $this->infodir = BASE_PATH.'help/INFO/'; $timeStamp = time(); $stringDate = date("Y-m-d",$timeStamp); if (!is_dir($this->infodir)) mkdir($this->infodir); $ff = fopen($this->infodir.'info.'.$timeStamp,'w'); $infoToWrite = $_POST['info']; if (strpos($infoToWrite," "New Info is saved", "success" => true); } /** * Concate individual info messages into one to be shown to user */ public function makeInfo($groups){ if (file_exists($this->userdir.'lastLogin')) { $timeStamp = filemtime($this->userdir.'lastLogin'); $ff = fopen($this->userdir.'INFO','w'); fwrite($ff,'

AMDA Latest News


'); fclose($ff); $userGrps = explode(',',strtoupper($groups)); foreach ($userGrps as $grp) { if (is_dir(HELPPATH.$grp."_INFO")) { $grpDir = HELPPATH.$grp."_INFO/"; $grpInfoFiles = glob($grpDir."info*"); $grpFileList = array(); foreach ($grpInfoFiles as $file) { $grpFileList[filemtime($file)] = $file; } ksort($grpFileList); $grpFileList = array_reverse($grpFileList, TRUE); foreach ($grpFileList as $info) { if (filemtime($info) > $timeStamp) { file_put_contents($this->userdir.'INFO', file_get_contents($info), FILE_APPEND); $NN++; } } } } $publicInfoFiles = glob($this->infodir."info*"); $fileList = array(); foreach ($publicInfoFiles as $file) { $fileList[filemtime($file)] = $file; } ksort($fileList); $fileList = array_reverse($fileList, TRUE); $NN = 0; foreach ($fileList as $info) { if (filemtime($info) > $timeStamp) { file_put_contents($this->userdir.'INFO', file_get_contents($info), FILE_APPEND); $NN++; } } if ($NN == 0) { unlink($this->userdir.'INFO'); // No news return 0; } else return 1; } else return 0; } } ?>