Location: PHPKode > projects > WebSecurityTester > php-gtk/security/gtk/main.php
<?
error_reporting(E_ALL);
if(!isset($argv)) die('register_argc_argv directive ini php.ini must be On');

$os = strtoupper(substr(PHP_OS, 0,3) == 'WIN')?'WIN':'UX';
$scriptFile = basename($argv[0]);
$currentDirectory = substr($argv[0],0,strlen($argv[0])-strlen($scriptFile));
$lfcr=strstr(PHP_OS,'WIN')?"\r\n":"\n";

define('CONF_DIR','conf/');
define('CACHE_DIR','.cache/');
define('DICTIONARIES_DIR','dictionaries/');
define('WST_LIB_PATH','../lib/');
define('GTK_LIB_PATH','lib/');
define('FILES_PATH','../web/upload/');
define('APP_PATH',$currentDirectory);
define('PWD',$currentDirectory);
define('APP_NAME','WST');
define('APP_VERSION','1.0');
define('LFCR',$lfcr);
define('BUILD','0');
define('OS' ,$os);
define('FILE_GLADE' ,APP_PATH.'gtk_project.glade');
define('WST_METHOD_GET',0);
define('WST_METHOD_POST',1);

if(!file_exists(FILES_PATH)) mkdir(FILES_PATH,0777);
if(!file_exists(CACHE_DIR)) mkdir(CACHE_DIR,0777);
if(!file_exists(DICTIONARIES_DIR)) mkdir(DICTIONARIES_DIR,0777);

/* INCLUDE all WST framework */
if(!file_exists(WST_LIB_PATH) || !is_dir(WST_LIB_PATH)) die(WST_LIB_PATH.' not found');
$handle = opendir(WST_LIB_PATH); while(false !== ($file = readdir($handle))){ if ($file != "." && $file != ".." && is_file(WST_LIB_PATH.$file)) include(WST_LIB_PATH.$file); }

if(!file_exists(GTK_LIB_PATH) || !is_dir(GTK_LIB_PATH)) die(GTK_LIB_PATH.' not found');
$handle = opendir(GTK_LIB_PATH); while(false !== ($file = readdir($handle))){ if ($file != "." && $file != ".." && is_file(GTK_LIB_PATH.$file)) include(GTK_LIB_PATH.$file); }

if (!class_exists('gtk')) {
    if (OS=='WIN'){
		ini_set('extension_dir',APP_PATH.'php4');
        if(!dl('php_gtk.dll')) dl(PWD.'php4'.BAR.'php_gtk.dll') or die("Unable to load php_gtk.dll");
    }else{
        if(!dl('php_gtk.so')) dl(ini_get("extension_dir").BAR.'php_gtk.so') or die("Unable to load php_gtk.so");
    }
}
putenv('LANG='.'en_EN');
setlocale(LC_ALL,'en_EN');


//var_dump(get_loaded_extensions()); exit;

if(file_exists(FILE_GLADE)){
	$interface = &new GladeXML(FILE_GLADE);
	$interface->signal_autoconnect();
	$widgets = array();
	
	$xml_doc = &new xml_doc(FileRead(FILE_GLADE));
	$xml_doc->parse();
	interface_get_widgets(&$xml_doc->xml_index[0]);
	
	$myHttpRequest = new HttpRequest();
	$myHtmlParser = new HtmlParser();
	$myWebAnalizer = new WebAnalizer();
	
	$current = null;
	$resources_analized = array();
	$tree_selection = '';
	
	$windows['winProgress'] = &new GtkWindow();
	$windows['winProgress']->connect('destroy', 'stop_analizing');
	$windows['winProgress']->set_modal(true);
	$adj = &new GtkAdjustment(0, 0, 100, 1, 1, 1);
	$winProgress['bar'] = &new GtkProgressBar($adj);
	$winProgress['bar']->set_activity_mode(false);
	$winProgress['button'] = &new GtkButton("Stop!");
	$winProgress['label'] = &new GtkLabel("Analizing ...");
	$winProgress['button']->connect('clicked', 'stop_analizing');
	$vbox = &new GtkVBox();
	$vbox->pack_start($winProgress['label'], true, false);
	$vbox->pack_start($winProgress['bar'], true, true);
	$vbox->pack_start($winProgress['button'], false, false);
	$windows['winProgress']->add($vbox);
	$windows['winProgress']->set_position(GTK_WIN_POS_CENTER);
	$windows['winProgress']->set_default_size(300,80);
	$windows['winProgress']->set_title(APP_NAME." Please wait ...");
	
	$tid = array();
	
	open_window('winSplash');
	
	$xpm = create_xpm();
	$transparent = &new GdkColor(0, 0, 0);
	list($ctree_data['pixmap1'], $ctree_data['mask1']) = Gdk::pixmap_create_from_xpm_d($widgets['winSplash']->window, $transparent, $xpm['book_closed']);
	list($ctree_data['pixmap2'], $ctree_data['mask2']) = Gdk::pixmap_create_from_xpm_d($widgets['winSplash']->window, $transparent, $xpm['book_open']);
	list($ctree_data['pixmap3'], $ctree_data['mask3']) = Gdk::pixmap_create_from_xpm_d($widgets['winSplash']->window, $transparent, $xpm['mini_page']);

	gtk::rc_parse(PWD.'gtk_project.rc');
	gtk::timeout_add(2000, 'gtk_main', &$widgets['winSplash']);

	gtk::main();
}
?>
Return current item: WebSecurityTester