/** * Method to determine if script owns the path. * * @param string $path Path to check ownership. * * @return boolean True if the php script owns the path passed. */ public static function isOwner($path) { if (!self::$owner) { $dir = JFactory::getConfig()->get('tmp_path'); $tmp = 'jj'.md5(mt_rand()); $test = $dir . '/' . $tmp; // Create the test file $content = 'test'; $success = KunenaFile::write($test, $content, false); if (!$success) { return false; } self::$owner = fileowner($test); // Delete the test file KunenaFile::delete($test); } // Test ownership return (self::$owner == fileowner($path)); }