barbcrossing 0 Report post Posted September 13, 2007 (edited) I have unexpected t_strings in 3 lines they are <?php// $Header$//this script may only be included - so its better to die if called directly.if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) { header("location: index.php"); exit;}/*A basic library to handle a cache of some Tiki Objects,usage is simple and feel free to improve it*/class Cachelib { var $folder; function Cachelib() { global $tikidomain; $this->folder = "temp/cache"; if ($tikidomain) { $this->folder.= "/$tikidomain"; } if(!is_dir($this->folder)) { mkdir($this->folder); @chmod($this->folder,"0777"); } } function cacheItem($key,$data) { $key = md5($key); $fw = fopen(($this->folder)."/".$key,"w"); fwrite($fw,$data); fclose($fw); return true; } function isCached($key) { $key = md5($key); return is_file($this->folder."/$key"); } function getCached($key) { $key = md5($key); if ( filesize($this->folder."/$key") == 0 ) { return serialize(false); } $fw = fopen($this->folder."/$key","w"); $data = fread($fw,filesize($this->folder."/$key")); fclose($fw); return $data;} /** gets the timestamp of item insertion in cache, * returns false if key doesn't exist */ function getCachedDate($key) { $key = md5($key); if( is_file($this->folder."/$key") ) { return filemtime($this->folder."/$key"); } else return false; } function invalidate($key) { $key = md5($key); @unlink($this->folder."/$key"); }}$cachelib = new Cachelib();?> The ones with the 000--numbers are the ones I need fixedPlease tell me what to do to fix this Edited September 14, 2007 by barbcrossing (see edit history) Share this post Link to post Share on other sites
reconraiders 0 Report post Posted September 13, 2007 It would help if you put the line numbers of the errors. PHP usually outputs a line number in the error message. But as far as I can see you have an extra "(". function cacheItem($key,$data) { $key = md5($key); 00033 (($fw) = fopen(($this->folder."/$key","w")); 00034 fwrite($fw,$data); 00035 fclose($fw); return true;} on the third line down it should look like this:$fw = fopen($this->folder."/$key","w"); I don't really know what all that 00033 is about... line numbers? your code is confusing But I hope that helped... if not post back and try to explain it some more. Maybe copy and paste the error message and the code. Share this post Link to post Share on other sites
barbcrossing 0 Report post Posted September 14, 2007 (edited) yes those are the lines that were messed uplines 33 34 and 35I need allll three fixed not just the 33 it is now saying that 34 is the errorRight Here Edited September 14, 2007 by barbcrossing (see edit history) Share this post Link to post Share on other sites
reconraiders 0 Report post Posted September 14, 2007 Hmm... I don't know now. It looks like it should be correct. I'm not sure what the problem is I'm sorry It should work fine just make sure line 33 looks like this... $fw = fopen($this->folder.'/'.$key,'w'); Share this post Link to post Share on other sites
barbcrossing 0 Report post Posted September 14, 2007 it is tikiwikiand line 33 is now working line 34 is now complaining of an error Share this post Link to post Share on other sites
Stenno 0 Report post Posted September 29, 2007 You scripted that function kinda weird :/ Why not a complete rewrite ??lets say:function cacheItem($key,$data) {$key = md5($key);$fw = fopen($this->folder.$key, "w");fwrite($fw, $data);fclose($fw);return true;} Share this post Link to post Share on other sites