a:2:{i:0;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:13:"app_sync_apps";s:4:"nome";s:10:"onValidate";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:1192:"$dir = opendir($this->Ini->path_aplicacao . "..");
$arr_apps = array();

while ($file = readdir($dir))
{
    if ($file != '.' && $file != '..' && $file != '_lib')
    {
	$arr_apps[] = $file;
    }		
}
closedir($dir);

sc_select(rs, "SELECT app_name FROM sec_apps");

$arr_apps_db = array();
while(!$rs->EOF)
{
    $arr_apps_db[] = $rs->fields[0];
    $rs->MoveNext();
}
$rs->Close();
$arr_apps = array_diff($arr_apps, $arr_apps_db);

$arr_usr = array();
sc_select(rs, "SELECT login FROM sec_users");
while(!$rs->EOF)
{
    $arr_usr[] = $rs->fields[0];
    $rs->MoveNext();
}
$rs->Close();


foreach($arr_apps as $k => $app)
{
	$file_ini = $this->Ini->path_aplicacao. "../".$app . "/".$app ."_ini.txt";
	if(is_file($file_ini))
	{
	    $app_type = file($file_ini);
	    if(!isset($app_type[4]))
	    {
		$app_type = '';
	    }
	    else
		$app_type = trim($app_type[4]);
	}
	else
	    $app_type = '';
	    
	sc_exec_sql("INSERT INTO sec_apps(app_name, app_type) VALUES ('". $app ."', '".$app_type."')");
	foreach($arr_usr as $usr)
	{
	    sc_exec_sql("INSERT INTO sec_users_apps(app_name, login) VALUES ('". $app ."', '".$usr."')");   
	}
}";}i:1;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:13:"app_sync_apps";s:4:"nome";s:17:"onValidateSuccess";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:229:"$html = '';
if(is_array($arr_apps))
{
    $total_apps = count($arr_apps);
    foreach($arr_apps as $app)
    {
	$html .= "<br/>". $app;
    }
}

{sync} = "<br/><b>". $total_apps. "&nbsp;". {lang_syncronized_apps} . "</b>" .$html;";}}