function csp_po_ajax_handle_dlg_rescan() {
	csp_po_check_security();
	load_plugin_textdomain(CSP_PO_TEXTDOMAIN, PLUGINDIR.'/codestyling-localization','codestyling-localization');
	require_once('includes/locale-definitions.php');	
	if ($_POST['type'] == 'wordpress') {
		$files = array();
		$excludes = array(str_replace("\\","/",WP_CONTENT_DIR));
		rscandir_php($_POST['path'], $excludes, $files);
		$excludes = array();
		rscandir_php(str_replace("\\","/",WP_CONTENT_DIR)."/themes/default/",$excludes, $files);
		rscandir_php(str_replace("\\","/",WP_CONTENT_DIR)."/themes/classic/",$excludes, $files);
		$files[] = str_replace("\\","/",WP_PLUGIN_DIR)."/akismet/akismet.php";
	}
	else{
		$files = array();
		$excludes = array();
		if (strpos($_POST['path'], '/./')) { $files[] = substr($_POST['path'].$_POST['subpath'],0,-1).'.php'; }
		else { rscandir_php($_POST['path'], $excludes, $files); }
	}
	$country_www = isset($csp_l10n_sys_locales[$_POST['language']]) ? $csp_l10n_sys_locales[$_POST['language']]['country-www'] : 'unknown';
	$lang_native = isset($csp_l10n_sys_locales[$_POST['language']]) ? $csp_l10n_sys_locales[$_POST['language']]['lang-native'] : $_POST['language'];
	$filename = $_POST['path'].$_POST['subpath'].$_POST['language'].".po";
?>	
	<input id="csp-dialog-source-file-json" type="hidden" value="{ <?php 
		echo "row: '".$_POST['row']."',";
		echo "language: '".$_POST['language']."',";
		echo "textdomain: '".$_POST['textdomain']."',";
		echo "next : 0,";
		echo "path : '".$_POST['path']."',";
		echo "pofile : '".$_POST['path'].$_POST['subpath'].$_POST['language'].".po',";
		echo "files : ['".implode("','",$files)."']"
	?>}" />
	<table class="widefat" cellspacing="2px">
		<tr>
			<td nowrap="nowrap"><strong><?php _e('Project-Id-Version',CSP_PO_TEXTDOMAIN); ?>:</strong></td>
			<td colspan="2"><?php echo rawurldecode($_POST['name']); ?><input type="hidden" name="name" value="<?php echo rawurldecode($_POST['name']); ?>" /></td>
		</tr>
		<tr>
			<td nowrap="nowrap"><strong><?php _e('Language Target',CSP_PO_TEXTDOMAIN); ?>:</strong></td>
			<td><img alt="" title="locale: <?php echo $_POST['language']; ?>" src="<?php echo CSP_PO_BASE_URL."/images/flags/".$country_www.".gif\""; ?>" /></td>			
			<td><?php echo $lang_native; ?></td>
		</tr>	
		<tr>
			<td nowrap="nowrap"><strong><?php _e('Affected Total Files',CSP_PO_TEXTDOMAIN); ?>:</strong></td>
			<td nowrap="nowrap" align="right"><?php echo count($files); ?></td>
			<td><em><?php echo "/".str_replace(str_replace("\\",'/',ABSPATH), '', $_POST['path']); ?></em></td>
		</tr>
		<tr>
			<td nowrap="nowrap" valign="top"><strong><?php _e('Scanning Progress',CSP_PO_TEXTDOMAIN); ?>:</strong></td>
			<td id="csp-dialog-progressvalue" nowrap="nowrap" valign="top" align="right">0</td>
			<td>
				<div style="height:13px;width:290px;border:solid 1px #333;"><div id="csp-dialog-progressbar" style="height: 13px;width:0%; background-color:#0073D9"></div></div>
				<div id="csp-dialog-progressfile" style="width:290px;white-space:nowrap;overflow:hidden;font-size:8px;font-family:monospace;padding-top:3px;">&nbsp;</div>
			</td>
		<tr>
	</table>
	<div style="text-align:center; padding-top: 10px"><input class="button" id="csp-dialog-rescan" type="submit" value="<?php _e('scan now',CSP_PO_TEXTDOMAIN); ?>" onclick="csp_scan_source_files(this);"/><span id="csp-dialog-scan-info" style="display:none"><?php _e('Please standby, files presently being scanned ...',CSP_PO_TEXTDOMAIN); ?></span></div>
<?php
	exit();
}
function csp_po_ajax_handle_dlg_rescan()
{
    csp_po_check_security();
    load_plugin_textdomain(CSP_PO_TEXTDOMAIN, PLUGINDIR . '/codestyling-localization/languages', 'codestyling-localization/languages');
    require_once 'includes/locale-definitions.php';
    global $wp_version;
    if ($_POST['type'] == 'wordpress') {
        $abs_root = rtrim(str_replace('\\', '/', ABSPATH), '/');
        $excludes = array();
        $files = array($abs_root . '/wp-activate.php', $abs_root . '/wp-app.php', $abs_root . '/wp-atom.php', $abs_root . '/wp-blog-header.php', $abs_root . '/wp-comments-post.php', $abs_root . '/wp-commentsrss2.php', $abs_root . '/wp-cron.php', $abs_root . '/wp-feed.php', $abs_root . '/wp-links-opml.php', $abs_root . '/wp-load.php', $abs_root . '/wp-login.php', $abs_root . '/wp-mail.php', $abs_root . '/wp-pass.php', $abs_root . '/wp-rdf.php', $abs_root . '/wp-register.php', $abs_root . '/wp-rss.php', $abs_root . '/wp-rss2.php', $abs_root . '/wp-settings.php', $abs_root . '/wp-signup.php', $abs_root . '/wp-trackback.php', $abs_root . '/xmlrpc.php', str_replace("\\", "/", WP_PLUGIN_DIR) . '/akismet/akismet.php');
        rscandir_php($abs_root . '/wp-admin/', $excludes, $files);
        rscandir_php($abs_root . '/wp-includes/', $excludes, $files);
        //do not longer rescan old themes prior hosted the the main localization file starting from WP 3.0!
        if (version_compare($wp_version, '3', '<')) {
            rscandir_php(str_replace("\\", "/", WP_CONTENT_DIR) . "/themes/default/", $excludes, $files);
            rscandir_php(str_replace("\\", "/", WP_CONTENT_DIR) . "/themes/classic/", $excludes, $files);
        }
    } elseif ($_POST['type'] == 'plugins_mu') {
        $files[] = strip_tags($_POST['simplefilename']);
    } elseif ($_POST['textdomain'] == 'buddypress') {
        $files = array();
        $excludes = array(strip_tags($_POST['path']) . 'bp-forums/bbpress');
        rscandir_php(strip_tags($_POST['path']), $excludes, $files);
    } else {
        $files = array();
        $excludes = array();
        if (isset($_POST['simplefilename']) && !empty($_POST['simplefilename'])) {
            $files[] = strip_tags($_POST['simplefilename']);
        } else {
            rscandir_php(strip_tags($_POST['path']), $excludes, $files);
        }
        if ($_POST['type'] == 'themes' && isset($_POST['themetemplate']) && !empty($_POST['themetemplate'])) {
            rscandir_php(str_replace("\\", "/", WP_CONTENT_DIR) . '/themes/' . strip_tags($_POST['themetemplate']) . '/', $excludes, $files);
        }
    }
    $country_www = isset($csp_l10n_sys_locales[$_POST['language']]) ? $csp_l10n_sys_locales[$_POST['language']]['country-www'] : 'unknown';
    $lang_native = isset($csp_l10n_sys_locales[$_POST['language']]) ? $csp_l10n_sys_locales[$_POST['language']]['lang-native'] : $_POST['language'];
    $filename = strip_tags($_POST['path'] . $_POST['subpath'] . $_POST['language']) . ".po";
    ?>
	
	<input id="csp-dialog-source-file-json" type="hidden" value="{ <?php 
    echo "name: '" . strip_tags($_POST['name']) . "',";
    echo "row: '" . strip_tags($_POST['row']) . "',";
    echo "language: '" . strip_tags($_POST['language']) . "',";
    echo "textdomain: '" . strip_tags($_POST['textdomain']) . "',";
    echo "next : 0,";
    echo "path : '" . strip_tags($_POST['path']) . "',";
    echo "pofile : '" . strip_tags($_POST['path'] . $_POST['subpath'] . $_POST['language']) . ".po',";
    echo "type : '" . strip_tags($_POST['type']) . "',";
    echo "files : ['" . implode("','", $files) . "']";
    ?>
}" />
	<table class="widefat" cellspacing="2px">
		<tr>
			<td nowrap="nowrap"><strong><?php 
    _e('Project-Id-Version', CSP_PO_TEXTDOMAIN);
    ?>
:</strong></td>
			<td colspan="2"><?php 
    echo strip_tags(rawurldecode($_POST['name']));
    ?>
<input type="hidden" name="name" value="<?php 
    echo strip_tags(rawurldecode($_POST['name']));
    ?>
" /></td>
		</tr>
		<tr>
			<td nowrap="nowrap"><strong><?php 
    _e('Language Target', CSP_PO_TEXTDOMAIN);
    ?>
:</strong></td>
			<td><img alt="" title="locale: <?php 
    echo strip_tags($_POST['language']);
    ?>
" src="<?php 
    echo CSP_PO_BASE_URL . "/images/flags/" . $country_www . ".gif\"";
    ?>
" /></td>			
			<td><?php 
    echo $lang_native;
    ?>
</td>
		</tr>	
		<tr>
			<td nowrap="nowrap"><strong><?php 
    _e('Affected Total Files', CSP_PO_TEXTDOMAIN);
    ?>
:</strong></td>
			<td nowrap="nowrap" align="right"><?php 
    echo count($files);
    ?>
</td>
			<td><em><?php 
    echo "/" . str_replace(str_replace("\\", '/', ABSPATH), '', strip_tags($_POST['path']));
    ?>
</em></td>
		</tr>
		<tr>
			<td nowrap="nowrap" valign="top"><strong><?php 
    _e('Scanning Progress', CSP_PO_TEXTDOMAIN);
    ?>
:</strong></td>
			<td id="csp-dialog-progressvalue" nowrap="nowrap" valign="top" align="right">0</td>
			<td>
				<div style="height:13px;width:290px;border:solid 1px #333;"><div id="csp-dialog-progressbar" style="height: 13px;width:0%; background-color:#0073D9"></div></div>
				<div id="csp-dialog-progressfile" style="width:290px;white-space:nowrap;overflow:hidden;font-size:8px;font-family:monospace;padding-top:3px;">&nbsp;</div>
			</td>
		<tr>
	</table>
	<div style="text-align:center; padding-top: 10px"><input class="button" id="csp-dialog-rescan" type="submit" value="<?php 
    _e('scan now', CSP_PO_TEXTDOMAIN);
    ?>
" onclick="csp_scan_source_files(this);"/><span id="csp-dialog-scan-info" style="display:none"><?php 
    _e('Please standby, files presently being scanned ...', CSP_PO_TEXTDOMAIN);
    ?>
</span></div>
<?php 
    exit;
}