* @package Kernel * @version $Id: VCDConfig.php 1062 2007-07-05 15:10:11Z konni $ * @since 0.990 */ ?> 0) { $base = substr($base,0,strpos($base,'admin')); } elseif (strpos($base,'setup')>0) { $base = substr($base,0,strpos($base,'setup')); } $htaccess = sprintf($fileContents, $base); // Check for the .htaccess in the document root $htaccessFile = VCDDB_BASE.DIRECTORY_SEPARATOR.'.htaccess'; if (!file_exists($htaccessFile)) { throw new VCDProgramException('The file .htaccess does not exist in the document root. Please create it.'); } if (is_readable($htaccessFile) && is_writable($htaccessFile)) { $byteCount = file_put_contents($htaccessFile,$htaccess); if (is_numeric($byteCount) && $byteCount > 0) { return true; } else { throw new VCDException('Could not write to file, please check permissions.'); } } else { throw new VCDException('The file .htaccess not writeable, please fix the file permissions.'); } } /** * Check if specified string ends with certain character * * @param string $str | The needle * @param string $sub | The haystack * @return bool */ private static function endsWith($str, $sub) { return (substr($str, strlen($str) - strlen($sub)) === $sub ); } /** * Check if specified string begins with certain character * * @param string $str | The needle * @param string $sub | The haustack * @return bool */ private static function beginsWith($str, $sub) { return (substr($str, 0, strlen($sub)) === $sub); } } ?>