All pastes #436898 Raw Edit

Stuff

public php v1 · immutable
·published 2007-04-12 19:58 UTC
rendered paste body
<?php// Get all of the modsettings from a directory$array = array();$return = scandir__recursive(dirname(__FILE__));//echo var_dump($return);$array = array_unique($array);sort($array);//ksort($array);ob_start();print_r($array);$contents = ob_get_contents();$contents = str_replace('    ', '	', $contents);ob_end_clean();echo $contents;function scandir__recursive($dir){	global $array;	$return = array();	$opendir = scandir($dir);	foreach ($opendir as $file)	{		// Current directory, parent directory, and .htaccess are not useful.		if ($file == '.' || $file == '..' || $file == '.htaccess')			continue;		$full_path = $dir . '/' . $file;		// This is another directory.		if (is_dir(str_replace('\\', '/', $full_path)))		{			$return[] = scandir__recursive($full_path);		}		else		{			$return[] = $file;			$opened_file = file_get_contents($full_path);			file_put_contents($full_path, strtr($openedfile, array('include_once' => 'include', 'require_once' => 'require'));			//preg_match_all('/\$modSettings\[\'(.+?)\'\]/', $opened_file, $matches);			//preg_match_all('/\$context\[\'(.+?)\'\]/', $opened_file, $matches);			/*preg_match_all('/allowedTo\(\'(.+?)\'\)/', $opened_file, $matches);			if (!empty($matches[1]))			{				foreach ($matches[1] as $key => $match)				{					/* per file					if (!isset($array[$match]))						$array[$match] = array();					if (isset($array[$match]) && !in_array($file, $array[$match]))						$array[$match][] = $file;					*/										// all					$array[] = $match;				}			}*/		}	}	return $return;}?>