Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> T_string Error Please Assist
barbcrossing
post Sep 13 2007, 04:03 PM
Post #1


Newbie
*

Group: Members
Posts: 3
Joined: 13-September 07
Member No.: 49,914



I have unexpected t_strings in 3 lines they are

CODE
<?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 fixed

Please tell me what to do to fix this

This post has been edited by barbcrossing: Sep 14 2007, 04:37 PM
Go to the top of the page
 
+Quote Post
reconraiders
post Sep 13 2007, 04:42 PM
Post #2


Super Member
*********

Group: Members
Posts: 221
Joined: 6-June 07
Member No.: 44,288



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 "(".

QUOTE
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:

CODE
$fw = fopen($this->folder."/$key","w");


I don't really know what all that 00033 is about... line numbers? your code is confusing sad.gif 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.
Go to the top of the page
 
+Quote Post
barbcrossing
post Sep 14 2007, 04:02 PM
Post #3


Newbie
*

Group: Members
Posts: 3
Joined: 13-September 07
Member No.: 49,914



yes those are the lines that were messed up

lines 33 34 and 35

I need allll three fixed not just the 33 it is now saying that 34 is the error

Right Here

This post has been edited by barbcrossing: Sep 14 2007, 04:04 PM
Go to the top of the page
 
+Quote Post
reconraiders
post Sep 14 2007, 04:27 PM
Post #4


Super Member
*********

Group: Members
Posts: 221
Joined: 6-June 07
Member No.: 44,288



Hmm... I don't know now. It looks like it should be correct. I'm not sure what the problem is sad.gif I'm sorry It should work fine just make sure line 33 looks like this...

CODE
$fw = fopen($this->folder.'/'.$key,'w');
Go to the top of the page
 
+Quote Post
barbcrossing
post Sep 14 2007, 04:35 PM
Post #5


Newbie
*

Group: Members
Posts: 3
Joined: 13-September 07
Member No.: 49,914



it is tikiwiki

and line 33 is now working line 34 is now complaining of an error
Go to the top of the page
 
+Quote Post
Stenno
post Sep 29 2007, 10:49 AM
Post #6


Newbie [Level 1]
*

Group: [HOSTED]
Posts: 21
Joined: 29-September 07
Member No.: 50,836



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;
}

Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. What Does This Error Mean?(3)
  2. Session Start() Problem(5)
  3. Trouble With Emailer.php(6)
  4. Php Parse Error(2)
  5. Fatal Error(3)
  6. Error When Using file_put_contents()(4)
  7. Weird Error Messages In Opera(2)
  8. Validation Error No Insert(3)
  9. Phpbb Install Error(2)
  10. Parse Error(1)
  11. Parse: Error Unexpected T_lnumber(4)
  12. Suppressing Mysql Error In Php(4)
  13. Php Error When Running Script(3)
  14. Php Form Help!(3)
  15. Freetype, Gd And An Error(1)
  1. Uglymonkey Toplist Script(7)
  2. Detect Image Resolution Without Gd(1)
  3. Help Needed With Silly Error(8)
  4. Error Importing Sql Query Via Php(6)
  5. [forum] Double Posting Happening By An Error(3)
  6. Error With Joomla Template(1)
  7. Error On Emailer.php & Smtp.php At Phpbb(2)
  8. Php Fsockopen() Error(14)
  9. Phpbb2 Error(4)
  10. Php Objects: Catchable Fatal Error(4)
  11. Mysql Error(3)
  12. Linux/ Apache /mod_rewrite Issue(4)


 



- Lo-Fi Version Time is now: 12th October 2008 - 07:36 AM