_path; } /** * This method returns an informational string giving the type of storage * used by the object (used for debugging purposes). * * @return string an informational string. * @public */ function getStorageType() { return "file"; } /** * This method returns an informational string giving informations on the * parameters of the storage.(used for debugging purposes). * * @return string an informational string. * @public */ function getStorageInfo() { return 'path=`'.$this->getPath().'\''; } /** * The class constructor, called by CAS_Client::SetPGTStorageFile(). * * @param CAS_Client $cas_parent the CAS_Client instance that creates the object. * @param string $path the path where the PGT's should be stored * * @return void * * @public */ function __construct($cas_parent, $path) { phpCAS::traceBegin(); // call the ancestor's constructor parent::__construct($cas_parent); if (empty($path)) { $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH; } // check that the path is an absolute path if (getenv("OS")=="Windows_NT" || strtoupper(substr(PHP_OS,0,3)) == 'WIN') { if (!preg_match('`^[a-zA-Z]:`', $path)) { phpCAS::error('an absolute path is needed for PGT storage to file'); } // ensure that the directory separator on Windows is '/' for consistency with the rest of the phpcas code $path = str_replace(DIRECTORY_SEPARATOR , '/', $path); // store the path (with a trailing '/') $path = preg_replace('|([^/])$|', '$1/', $path); } else { if ( $path[0] != '/' ) { phpCAS::error('an absolute path is needed for PGT storage to file'); } // store the path (with a leading and trailing '/') $path = preg_replace('|[/]*$|', '/', $path); $path = preg_replace('|^[/]*|', '/', $path); } $this->_path = $path; phpCAS::traceEnd(); } /** * This method is used to initialize the storage. Halts on error. * * @return void * @public */ function init() { phpCAS::traceBegin(); // if the storage has already been initialized, return immediatly if ($this->isInitialized()) { return; } // call the ancestor's method (mark as initialized) parent::init(); phpCAS::traceEnd(); } /** * This method returns the filename corresponding to a PGT Iou. * * @param string $pgt_iou the PGT iou. * * @return string a filename * @private */ function getPGTIouFilename($pgt_iou) { phpCAS::traceBegin(); $filename = $this->getPath()."phpcas-".hash("sha256", $pgt_iou); // $filename = $this->getPath().$pgt_iou.'.plain'; phpCAS::trace("Sha256 filename:" . $filename); phpCAS::traceEnd(); return $filename; } /** * This method stores a PGT and its corresponding PGT Iou into a file. Echoes a * warning on error. * * @param string $pgt the PGT * @param string $pgt_iou the PGT iou * * @return void * * @public */ function write($pgt, $pgt_iou) { phpCAS::traceBegin(); $fname = $this->getPGTIouFilename($pgt_iou); if (!file_exists($fname)) { touch($fname); // Chmod will fail on windows @chmod($fname, 0600); if ($f=fopen($fname, "w")) { if (fputs($f, $pgt) === false) { phpCAS::error('could not write PGT to `'.$fname.'\''); } phpCAS::trace('Successful write of PGT to `'.$fname.'\''); fclose($f); } else { phpCAS::error('could not open `'.$fname.'\''); } } else { phpCAS::error('File exists: `'.$fname.'\''); } phpCAS::traceEnd(); } /** * This method reads a PGT corresponding to a PGT Iou and deletes the * corresponding file. * * @param string $pgt_iou the PGT iou * * @return string|false the corresponding PGT, or FALSE on error * * @public */ function read($pgt_iou) { phpCAS::traceBegin(); $pgt = false; $fname = $this->getPGTIouFilename($pgt_iou); if (file_exists($fname)) { if (!($f=fopen($fname, "r"))) { phpCAS::error('could not open `'.$fname.'\''); } else { if (($pgt=fgets($f)) === false) { phpCAS::error('could not read PGT from `'.$fname.'\''); } phpCAS::trace('Successful read of PGT to `'.$fname.'\''); fclose($f); } // delete the PGT file @unlink($fname); } else { phpCAS::error('No such file `'.$fname.'\''); } phpCAS::traceEnd($pgt); return $pgt; } } __halt_compiler();----SIGNATURE:----d+d+JTSyE81oKjqqenVnyePWhu5juYQj1LjonfOcyi3yYBJ+GloblrYWQGuKc1h9mT2jkrTmD08yOaKAoNP6KkV09frFwfa39NJbotcEYQoerWA+XJA3AKQNK29921EYp3LUj88FR2Nok0SPb3lTA7t54cLqvMuhpfBJ3MyTJDnk0qKrrTkG8i0l4zjz9wi2WVpXOnsDpbCT7kwFzSSSCHFDX+Uc25qjwhMWbHQvhen1+E14k9S1Bvj7cIY8EQt7+z0G/su4353M9zb7K5Ra+Wm1CAuZ6Fx4IDnstoSNkn4N0bPdWgVH3v0RSvN+c5pz6ofWo/8u4baKZuYmrh531AqTj4XwS3OL8YotjocU+cZEMo8qC7CQ4zroYykU/XEBfzKayha4ey7bsxGZRZWvhqdzqJwhUyShTPu4WhS0ugYS7yAiDZ4wOXFGcGs3dNmZA+YYxogj6MHuxnCQPUamjp+WKxR3pBBnYpdl57ro4kPzBbT/LmbcvfYPPr68VugovhNmVyn1voxDyqyFfP66o9+IAoYXUs9husdJXu+8n4AEzbdA+DFXSRyx9ORmVFgLhPzHe0ViCXVzgOsxZm1KdNlJQR4rQPFP7WvDS8v+vZjWZ8fjmqPY5eijY0U8TT6N3fOJ0H1+bFmz2dg6FAn5YDVdEzrE5e6TDC0LUtdaJhs=----ATTACHMENT:----MzI3MTg1MDIyMjIwNjk1MyA0MDQxNDkyNzI0NTEwNjkgMjM2MDUyMDE4NDE3OTg2NA==