#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\..\..\..\1900\Framakey\FramaKiosk\PortableKioskCode\FramaKiosk.ico #AutoIt3Wrapper_Outfile=Framakey-WebAppManager.exe #AutoIt3Wrapper_Res_Description=Framakey Portable WebApp Manager #AutoIt3Wrapper_Res_Fileversion=1.0.0.35 #AutoIt3Wrapper_Res_FileVersion_AutoIncrement=y #AutoIt3Wrapper_Res_LegalCopyright=pyg for Framakey Team #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- # Copyright 2009 Pierre-Yves Gosset. # # This copyrighted material is made available to anyone wishing to use, modify, # copy, or redistribute it subject to the terms and conditions of the GNU # General Public License v.2. This program is distributed in the hope that it # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU General Public License for more details. You should have # received a copy of the GNU General Public License along with this program; if # not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth # Floor, Boston, MA 02110-1301, USA. # # Author(s): Pierre-Yves Gosset #ce ---------------------------------------------------------------------------- #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include Opt("GUIOnEventMode", 1) Opt("TrayOnEventMode", 1) Opt("TrayMenuMode", 1) Opt("GUIDataSeparatorChar", "|") AutoItSetOption("TCPTimeout", 100) ; ================== Variables ================== Dim $ZMWS_INIT_PID, $ZMWS_INIT_HTTP_PORT, $ZMWS_INIT_HTTPS_PORT, $ZMWS_INIT_DOCUMENT_ROOT, $ZMWS_INIT_IP, $HTTP_HOST, $HTTP_VHOST, $APP_ACCESS_PATH, $MYSQLPORT Dim $root_path_absolute, $r_p_a_backslashes, $WAMlang, $display_help, $WAMLog, $Logfile, $WAMSplashTimeout, $startup_file, $DisplayHelp, $restart Dim $appname, $appinfo_path, $appinfo_file, $appicon_file, $appscripts_file, $generic_scripts_file, $session_file, $config_file, $heidisql_file, $ApplicationURL Dim $mysql_bin_path, $mysql_bin_name, $mysqladmin_bin_name, $mysql_cmd, $mysql_user_option, $mysql_user, $mysql_shutdown_option, $mysql_no_default_option, $mysql_skip_innodb_option, $mysql_datadir_option, $mysql_pid_file_option, $mysql_port_option, $mysql_datadir, $mysql_port, $mysql_default_port Dim $zmws_path, $zmws_bin_name, $zmws_options, $zmws_port, $zmws_port_option, $zmws_browse, $zmws_browse_option, $zmws_unique_port, $zmws_unique_port_option, $zmws_quiet, $zmws_quiet_option, $zmws_nolog, $zmws_nolog_option, $zmws_closebrowser, $zmws_closebrowser_option, $zmws_noindex, $zmws_noindex_option, $zmws_webdir, $zmws_webdir_option, $zmws_stops, $zmws_stops_option, $zmws_bind, $zmws_bind_option Dim $InputZmwsPort, $CbxZmwsNolog, $CbxZmwsBrowse, $CbxZmwsClosebrowser, $CbxZmwsQuiet, $CbxZmwsNoIndex, $CbxZmwsUniqueport, $CbxZmwsBind, $InputZmwsWebdir, $CbxZmwsWebdir, $CbxZmwsPort, $ZmwsIPAddressBind, $InputMysqLPort, $CbxMysqlPort, $ComboLang, $CbxDisplayHelp Dim $SCRIPT[20] Global $commands[50][10] Global $trans, $oIE Global $WAMLog = False Global $DisplayHelp = False Global $InputMysqLPort = "Auto" Global $NeedMySQL = "True" Global $mysql_port_set = False $root_path_absolute = Root_Path_Absolute() ; return an absolute root path like I:\framakey_work\webapps\PortableWordPress-fr $r_p_a_backslashes = StringReplace($root_path_absolute, "\", "\\") $Logfile = @ScriptDir & "\WAMLog.txt" $zmws_path = $root_path_absolute & "\ZMWS" $zmws_default_webdir = "../App/" $appinfo_path = $root_path_absolute & "\App\AppInfo" $appinfo_file = $appinfo_path & "\appinfo.ini" $appicon_file = $appinfo_path & "\appicon.ico" $startup_file = $appinfo_path & "\startup.ini" $appscripts_file = $appinfo_path & "\scripts.ini" $generic_scripts_file = @ScriptDir & "\scripts.generic.ini" $session_file = $appinfo_path & "\session.lock" $config_file = @ScriptDir & "\Framakey-WebAppManager-config.ini" $heidisql_file = $zmws_path & "\HeidiSQL\heidisql.exe" $GuessLang = GUESSLANG() $HTTP_LOOPBACK = "127.0.0.1" $HTTP_VHOST = "127.0.0.2" $UPDATE_TIME = _NowCalc() $CurrentDate = @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & "-" & @SEC $mysql_bin_path = $zmws_path & "\mysql\bin" $mysql_bin_name = "mysqld.exe" $mysqladmin_bin_name = "mysqladmin.exe" $mysql_no_default_option = " --no-defaults" $mysql_skip_innodb_option = " --skip-innodb" $mysql_datadir = "..\..\..\App\data" $mysql_user = "root" $mysql_user_option = " --user=" & $mysql_user $mysql_shutdown_option = " shutdown" $mysql_datadir_option = " --datadir=" & $mysql_datadir $mysql_pid_file_option = " --pid-file=NUL" $mysql_default_port = "3306" $mysql_port = $mysql_default_port $mysql_port_option = " --port=" & $mysql_port ; ================== Test files ================== If Not FileExists($appinfo_file) Then MsgBox(4096, "ERROR", $appinfo_path & " does NOT exists.") Exit EndIf If Not FileExists($config_file) Then MsgBox(4096, "ERROR", $config_file & " does NOT exists.") Exit EndIf ; ================== Start reading INIs ================== $appname = IniRead($appinfo_file, "Details", "Name", @error) $appVersion = IniRead($appinfo_file, "Version", "DisplayVersion", @error) $appDescription = IniRead($appinfo_file, "Details", "Description", @error) $Category = IniRead($appinfo_file, "Details", "Category", @error) $ApplicationPath = IniRead($appinfo_file, "WebAppSpecific", "ApplicationPath", @error) $appShortName = IniRead($appinfo_file, "WebAppSpecific", "ShortName", @error) $DatabaseName = IniRead($appinfo_file, "WebAppSpecific", "DatabaseName", @error) $Website = IniRead($appinfo_file, "WebAppSpecific", "Website", @error) $Support = IniRead($appinfo_file, "WebAppSpecific", "Support", @error) $FramasoftURL = IniRead($appinfo_file, "WebAppSpecific", "Framasoft", @error) $FramasoftSupportURL = IniRead($appinfo_file, "WebAppSpecific", "FramasoftSupport", @error) $appLogo = IniRead($appinfo_file, "WebAppSpecific", "Logo", @ScriptDir & "NotFound") $NeedMySQL = IniRead($appinfo_file, "WebAppSpecific", "NeedMySQL", "True") ; we want mysql to start by default $systrayLaunchDate = _NowCalc() ; ================== Languages ================== Global $lngfile = @ScriptDir & '\Lang.' & IniRead($config_file, "Config", "Lang", GUESSLANG()) & '.ini' Global $trans _FileReadToArray($lngfile, $trans) If @error = 1 Then MsgBox(64, "ERROR", "Error when trying to open Language file " & @CRLF & $lngfile & @CRLF & @CRLF & "I must quit, sorry!") EndIf ; ================== Include Config Panel ================== #include GET_WAM_CONFIG_VARIABLES() ; very important : reads all variables in config.ini (default or defined by user) ; ================= Create Systray ================== TraySetClick("9") $LAUNCH = TrayCreateItem(l("Launch") & $appShortName) TrayItemSetOnEvent(-1, "LAUNCH") $HELP = TrayCreateItem(l("Help")) TrayItemSetOnEvent(-1, "HELP") $CFGWINDOW = TrayCreateItem(l("AdvancedConfig")) TrayItemSetOnEvent(-1, "CONFIGWINDOW") TrayCreateItem("") $APPLICATIONMENU = TrayCreateMenu(l("Application")) $SCRIPTSMENU = TrayCreateMenu(l("Scripts")) $DEFAULTSCRIPTSMENU = TrayCreateMenu(l("DefaultScripts"), $SCRIPTSMENU) $SPECIFICSCRIPTSMENU = TrayCreateMenu(l("SpecificScripts"), $SCRIPTSMENU) $OWEBSITE = TrayCreateItem(l("OfficialWebSite"), $APPLICATIONMENU) TrayItemSetOnEvent(-1, "OWEBSITE") $OSUPPORT = TrayCreateItem(l("OfficialSupport"), $APPLICATIONMENU) TrayItemSetOnEvent(-1, "OSUPPORT") $FWEBSITE = TrayCreateItem(l("FramasoftEntry"), $APPLICATIONMENU) TrayItemSetOnEvent(-1, "FWEBSITE") $FSUPPORT = TrayCreateItem(l("FramasoftSupport"), $APPLICATIONMENU) TrayItemSetOnEvent(-1, "FSUPPORT") TrayCreateItem("") $INFOS = TrayCreateItem(l("Infos")) TrayItemSetOnEvent(-1, "INFOS") $MYSQLMENU = TrayCreateMenu(l("MySQL")) $MYSQL_STATUS = TrayCreateItem(l("Status"), $MYSQLMENU) TrayItemSetOnEvent(-1, "MYSQL_STATUS") $MYSQL_START = TrayCreateItem(l("Re_start"), $MYSQLMENU) TrayItemSetOnEvent(-1, "MYSQL_RESTART") $MYSQL_STOP = TrayCreateItem(l("Stop"), $MYSQLMENU) TrayItemSetOnEvent(-1, "MYSQL_STOP") $HEIDISQL = TrayCreateItem(l("HeidiSQL"), $MYSQLMENU) TrayItemSetOnEvent(-1, "HeidiSQL") $ESKUEL = TrayCreateItem(l("Eskuel"), $MYSQLMENU) TrayItemSetOnEvent(-1, "Eskuel") $ZMWSMENU = TrayCreateMenu(l("ZMWS")) $ZMWS_STATUS = TrayCreateItem(l("Status"), $ZMWSMENU) TrayItemSetOnEvent(-1, "ZMWS_STATUS") $ZMWS_START = TrayCreateItem(l("Re_start"), $ZMWSMENU) TrayItemSetOnEvent(-1, "ZMWS_START") $ZMWS_STOP = TrayCreateItem(l("Stop"), $ZMWSMENU) TrayItemSetOnEvent(-1, "ZMWS_STOP") TrayCreateItem("") $WAMHELP = TrayCreateItem(l("WAMHelp")) TrayItemSetOnEvent(-1, "WAMHELP") $ABOUT = TrayCreateItem(l("About")) TrayItemSetOnEvent(-1, "ABOUT") $QUIT = TrayCreateItem(l("Quit")) TrayItemSetOnEvent(-1, "QUIT") TraySetState() TraySetIcon($appicon_file) ; ================== Create Info Window ================== $InfoWindow = GUICreate(l("Informations"), 570, 380) $InfoArea = GUICtrlCreateEdit("", 0, 0, 569, 337, BitOR($ES_WANTRETURN, $WS_VSCROLL)) $InfoCloseButton = GUICtrlCreateButton(l("InfoClose"), 232, 344, 105, 25, 0) GUISetOnEvent($GUI_EVENT_CLOSE, "InfoWindowClose") GUICtrlSetFont($InfoArea, 10, 400, 0, "Courier New") GUICtrlSetData($InfoArea, "InfoArea") GUICtrlSetOnEvent($InfoCloseButton, "InfoCloseButtonClick") ; ================== Create Splash ================== #Region ### START Koda GUI section ### Form= If ($appLogo <> "NotFound" And FileExists($appinfo_path & "\" & $appLogo)) Then $appLogoFile = $appinfo_path & "\" & $appLogo Else $appLogoFile = @ScriptDir & "\Logo_generic.gif" EndIf $Splash = GUICreate("Splash", 498, 343, (@DesktopWidth / 2) - 498 / 2, (@DesktopHeight / 2) - 343 / 2, $WS_POPUP) $SplashPic2 = GUICtrlCreatePic($appLogoFile, 176, 88, 128, 128, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS)) $SplashPic1 = GUICtrlCreatePic(@ScriptDir & "\empty_splash.jpg", 0, 0, 497, 341, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS)) $SplashLabel1 = GUICtrlCreateLabel($appShortName, 0, 16, 495, 64, $SS_CENTER) GUICtrlSetFont($SplashLabel1, 38, 800, 0, "Arial") GUICtrlSetBkColor($SplashLabel1, $GUI_BKCOLOR_TRANSPARENT) GUISetState(@SW_HIDE) #EndRegion ### END Koda GUI section ### ; ================== Let's rock ================== START_ALL() $scripts_menu = CREATE_SCRIPTSMENU() While 1 Sleep(20) WEnd