* re tag it.

This commit is contained in:
wangchunsheng
2012-09-03 06:29:33 +00:00
parent 5c4c146bac
commit 4fb6c17d96
1260 changed files with 130022 additions and 0 deletions

145
trunk/Makefile Normal file
View File

@@ -0,0 +1,145 @@
VERSION=$(shell head -n 1 VERSION)
all: tgz
sae: tgz build4sina build4sae
syun: tgz build4sina build4yunshangdian
edu: tgz build4edu
linux: tgz build4linux
clean:
rm -fr zentaopms
rm -fr *.tar.gz
rm -fr *.zip
rm -fr api*
rm -fr build/linux/lampp
rm -fr sae
rm -fr syun
tgz:
# make the directories.
mkdir -p zentaopms/lib
mkdir -p zentaopms/db
mkdir -p zentaopms/bin
mkdir -p zentaopms/config
mkdir -p zentaopms/www/data/upload
# copy files.
cp -fr framework zentaopms/
cp -fr lib/ zentaopms/
cp -fr config/config.php zentaopms/config/
cp -fr module zentaopms/
cp -fr www/*.ico www/fusioncharts www/*.php www/js www/*.txt www/theme www/.htaccess www/.ztaccess zentaopms/www
cp bin/ztc* bin/computeburn.php bin/getbugs.php bin/initext.php bin/todo.php bin/backup.php bin/checkdb.php bin/minifyfront.php zentaopms/bin
cp -fr db zentaopms/
cp -fr doc/* zentaopms/
cp -fr tmp zentaopms/
cp VERSION zentaopms/
# combine js and css files.
cd zentaopms/bin/ && php ./minifyfront.php
# create the restart file for svn.
touch zentaopms/module/svn/restart
# touch the front.class.php to make it's mtime to new.
touch zentaopms/lib/front/front.class.php
# delee the unused files.
find zentaopms -name .svn |xargs rm -fr
find zentaopms -name tests |xargs rm -fr
# change mode.
chmod 777 -R zentaopms/tmp/
chmod 777 -R zentaopms/www/data
chmod 777 -R zentaopms/config
chmod 777 zentaopms/module
chmod a+rx zentaopms/bin/*
find zentaopms/ -name ext |xargs chmod -R 777
# zip it.
zip -r -9 ZenTaoPMS.$(VERSION).zip zentaopms
rm -fr zentaopms
patchphpdoc:
sudo cp misc/doc/phpdoc/*.tpl /usr/share/php/data/PhpDocumentor/phpDocumentor/Converters/HTML/frames/templates/phphtmllib/templates/
phpdoc:
phpdoc -d bin,framework,config,lib,module,www -t api -o HTML:frames:phphtmllib -ti ZenTaoPMSAPI<50>ο<EFBFBD><CEBF>ֲ<EFBFBD> -s on -pp on -i *test*
phpdoc -d bin,framework,config,lib,module,www -t api.chm -o chm:default:default -ti ZenTaoPMSAPI<50>ο<EFBFBD><CEBF>ֲ<EFBFBD> -s on -pp on -i *test*
doxygen:
doxygen misc/doc/doxygen/doxygen.conf
build4sina:
# unzip the zentaopms packae.
unzip ZenTaoPMS.$(VERSION).zip
rm -fr ZenTaoPMS.$(VERSION).zip
# move the files under www to zentaopms/
mv zentaopms/www/* zentaopms
# replace the directory of index.php, install.php, upgrade.php.
sed -e 's/..\/framework/framework/g' zentaopms/index.php |sed -e "s/dirname(//" |sed -e 's/)))/))/' >zentaopms/index.php.new
sed -e 's/..\/framework/framework/g' zentaopms/install.php |sed -e "s/dirname(//" |sed -e 's/)))/))/' >zentaopms/install.php.new
grep -v myConfig zentaopms/upgrade.php | grep -v '{' | grep -v '}' | grep -v 'exit' | grep -v checkUpgradeStatus | grep -v debug> zentaopms/upgrade.php.new # remove the checking of myConfig.
sed -e 's/..\/framework/framework/g' zentaopms/upgrade.php.new | sed -e "s/dirname(//" |sed -e 's/)))/))/' > zentaopms/upgrade.php.new
mv zentaopms/index.php.new zentaopms/index.php
mv zentaopms/upgrade.php.new zentaopms/upgrade.php
build4sae:
# remove the data and tmp directory for sae.
rm -fr zentaopms/data zentaopms/www zentaopms/tmp
# process the install.php.
cat zentaopms/install.php.new |grep -v 'setDebug' > zentaopms/install.php
rm -fr zentaopms/install.php.new
# replace the error_log to sae_debug
sed -e 's/error_log/sae_debug/g' zentaopms/framework/router.class.php | sed -e "s/saveSQL/saveSQL4SAE/" >zentaopms/framework/router.class.php.new
mv zentaopms/framework/router.class.php.new zentaopms/framework/router.class.php
# append the savesql.php.
cat build/sae/savesql.php >> zentaopms/framework/helper.class.php
# change the logic of merge model file in helper.class.php.
sed -e 's/\$$app->getTmpRoot/"saemc:\/\/" . \$$app\-\>getTmpRoot/g' zentaopms/framework/helper.class.php >zentaopms/framework/helper.class.new
mv zentaopms/framework/helper.class.new zentaopms/framework/helper.class.php
cp build/sae/mysae.php zentaopms/config/my.php
cp build/sae/sae_app_wizard.xml zentaopms/
# get the extension files.
svn export https://svn.cnezsoft.com/easysoft/trunk/zentaoext/sae
mv sae/lib/saestorage zentaopms/lib/
cp -fr sae/* zentaopms/module/
# create the package.
cp build/sae/config.yaml zentaopms/
cd zentaopms && zip -r -9 ../ZenTaoPMS.$(VERSION).sae.zip * && cd -
rm -fr sae
rm -fr zentaopms
build4yunshangdian:
# rename the install.php.
mv zentaopms/install.php.new zentaopms/install.php
# move the .htaccess to zentaopms/
mv zentaopms/www/.htaccess zentaopms/htaccess
# remove tmp, www, data, init them in my.php
rm -fr zentaopms/www
rm -fr zentaopms/tmp
rm -fr zentaopms/data
# copy the my.php
mkdir zentaopms/config/ext
cp build/sae/mysyun.php zentaopms/config/ext/syun.php
# copy the wizard.xml.
grep -v 'Storage' build/sae/sae_app_wizard.xml | grep -v 'Memcache' > zentaopms/sae_app_wizard.xml
# get the extension files.
svn export https://svn.cnezsoft.com/easysoft/trunk/zentaoext/syun
cp -fr syun/* zentaopms/module/
# create the package.
cd zentaopms && zip -r -9 ../ZenTaoPMS.$(VERSION).syun.zip * && cd -
#rm -fr syun
#rm -fr zentaopms
build4linux:
unzip ZenTaoPMS.$(VERSION).zip
rm -fr ZenTaoPMS.$(VERSION).zip
sed -e 's/index.php/\/zentao\/index.php/g' zentaopms/www/.htaccess >zentaopms/www/.htaccess.new
mv zentaopms/www/.htaccess.new zentaopms/www/.htaccess
# build xmapp.
cd ./build/linux/ && ./buildxmapp.sh $(xampp)
mv ./build/linux/lampp ./
saas:
mkdir backup
mkdir tmp/model
mkdir tmp/extension
mkdir www/data/upload -p
chmod 777 backup
chmod 777 -R tmp
chmod 777 -R www/data
build4edu:
unzip ZenTaoPMS.$(VERSION).zip
rm -fr ZenTaoPMS.$(VERSION).zip
# get the extension files.
svn export https://svn.cnezsoft.com/easysoft/trunk/zentaoext/edu
cp -fr edu/* zentaopms/
# create the package.
zip -rm -9 ZenTaoPMS.$(VERSION).edu.zip zentaopms
rm -fr edu

1
trunk/VERSION Normal file
View File

@@ -0,0 +1 @@
3.3.stable

66
trunk/bin/backup.php Executable file
View File

@@ -0,0 +1,66 @@
<?php
/* Backup the db. */
error_reporting(E_ERROR);
/* Include my.php and pclzip class. */
$pmsRoot = dirname(dirname(__FILE__));
include $pmsRoot . '/config/my.php';
include $pmsRoot . '/lib/pclzip/pclzip.class.php';
/* Judge mysqldump cmd setted or not. */
if(!isset($config->mysqldump))
{
echo "Please set the mysqldump in my.php:\n";
echo "Just like: \n";
echo '$config->mysqldump = \'/usr/bin/mysqldump\'; for linux' . "\n";
echo '$config->mysqldump = \'D:\xampp\mysql\bin\mysqldump.exe\'; for windows' . "\n";
exit;
}
/* Init the backupRoot and dest directory. */
$backupRoot = $pmsRoot . "/backup";
$destDir = $backupRoot . "/" . date('Ym');
if(!file_exists($backupRoot)) mkdir($backupRoot, 0777);
if(!file_exists($destDir)) mkdir($destDir, 0777);
/* Backup database. */
$dbRawFile = "db." . date('Ymd') . ".sql";
if($config->db->password)
{
$command = "{$config->mysqldump} -u{$config->db->user} -p{$config->db->password} -P {$config->db->port} {$config->db->name} > {$dbRawFile}";
}
else
{
$command = "{$config->mysqldump} -u{$config->db->user} -P {$config->db->port} {$config->db->name} > {$dbRawFile}";
}
echo "Backuping database,";
system($command, $return);
if(!$return)
{
$dbZipFile = $destDir . "/" . str_replace("sql", "zip", $dbRawFile);
$archive = new pclzip($dbZipFile);
if($archive->create($dbRawFile))
{
unlink($dbRawFile);
echo " successfully saved to $dbZipFile\n";
}
else
{
die("Error : " . $archive->errorInfo(true));
}
}
else
{
echo "Failed to backup database!\n";
}
/* Backup the data. */
chdir(dirname(dirname(__FILE__)) . "/www");
if(!is_dir('data/upload')) die(" No files needed backup.\n");
$dataFile = $destDir . "/" . "file." . date('Ymd', time()) . ".zip";
$archive = new pclzip($dataFile);
echo "Backuping files,";
if($archive->create("data/upload", PCLZIP_OPT_REMOVE_PATH, "data")) die(" successfully saved to $dataFile\n");
die("Error : ".$archive->errorInfo(true));

45
trunk/bin/build.php Normal file
View File

@@ -0,0 +1,45 @@
<?php
/**
1. 修改zentaophp中的version number打tag。
2. 修改ZenTaoPMS中的version
config.php中的version.
install中的version。
3. 修改升级程序。(版本列表。)
4. 打包ZenTaoPMS。
5. 合并目录。
6. 修改www/index.php中的包含路径。
7. 导出新的数据库。 grep -v '\-\-' /mnt/c/zentao.sql |grep -v ^$ |sed "s/DROP/\-\- DROP/" >zentao.sql
8. zip包。
9. windows包。
10. 上传文件。
11. 撰写升级声明。
*/
$phpURL = 'http://zentaophp.googlecode.com/svn/tags/';
$pmsURL = 'http://ZenTaoPMS.googlecode.com/svn/tags/';
$phpTag = getLatestTag($phpURL);
$pmsTag = getLatestTag($pmsURL);
$phpTagURL = $phpURL . $phpTag;
$pmsTagURL = $pmsURL . $pmsTag;
echo $phpTag . "'\t" . $pmsTag . "\n";
chdir('../release/');
echo `svn export $phpTagURL`;
echo `svn export $pmsTagURL`;
/* Get the latest tag under a url. */
function getLatestTag($url)
{
$lines = file($url);
$latestTag = '';
foreach($lines as $line)
{
if(strpos($line, '<li>') !== false) $latestTag = $line;
}
$latestTag = explode('"', $latestTag);
$latestTag = $latestTag[1];
return $latestTag;
}

126
trunk/bin/check.php Executable file
View File

@@ -0,0 +1,126 @@
<?php
/**
* This file is used to check the language items and actions.
*/
/* Define an emtpty control class as the base class of every module. */
class control {}
/* set module root path and included the resource of group module. */
$moduleRoot = '../module/';
include $moduleRoot . '/group/lang/resource.php';
$whiteList[] = 'api-getsessionid';
$whiteList[] = 'bug-buildtemplates';
$whiteList[] = 'bug-exportdata';
$whiteList[] = 'company-create';
$whiteList[] = 'company-delete';
$whiteList[] = 'file-buildform';
$whiteList[] = 'file-printfiles';
$whiteList[] = 'file-export2csv';
$whiteList[] = 'file-export2xml';
$whiteList[] = 'file-export2html';
$whiteList[] = 'file-senddownheader';
$whiteList[] = 'help-field';
$whiteList[] = 'index-testext';
$whiteList[] = 'productplan-commonaction';
$whiteList[] = 'project-managechilds';
$whiteList[] = 'project-tips';
$whiteList[] = 'release-commonaction';
$whiteList[] = 'task-commonaction';
$whiteList[] = 'user-login';
$whiteList[] = 'user-deny';
$whiteList[] = 'user-logout';
$whiteList[] = 'mail-set';
$whiteList[] = 'mail-save';
$whiteList[] = 'svn-run';
$whiteList[] = 'admin-ignore';
$whiteList[] = 'admin-register';
$whiteList[] = 'admin-bind';
$whiteList[] = 'admin-checkdb';
$whiteList[] = 'admin-cleardata';
$whiteList[] = 'bug-sendmail';
$whiteList[] = 'project-commonaction';
$whiteList[] = 'project-sendmail';
$whiteList[] = 'story-commonaction';
$whiteList[] = 'story-sendmail';
$whiteList[] = 'task-sendmail';
$whiteList[] = 'user-setreferer';
$whiteList[] = 'mail-index';
$whiteList[] = 'mail-detect';
$whiteList[] = 'mail-edit';
$whiteList[] = 'mail-test';
/* checking actions of every module. */
echo '-------------action checking-----------------' . "\n";
foreach(glob($moduleRoot . '*') as $modulePath)
{
$moduleName = basename($modulePath);
if(strpos('install|upgrade|convert|common|misc|editor', $moduleName) !== false) continue;
$controlFile = $modulePath . '/control.php';
if(file_exists($controlFile))
{
include $controlFile;
if(class_exists($moduleName))
{
$class = new ReflectionClass($moduleName);
$methods = $class->getMethods();
foreach($methods as $method)
{
$methodRef = new ReflectionMethod($method->class, $method->name);
if($methodRef->isPublic() and strpos($method->name, '__') === false)
{
$methodName = $method->name;
if(in_array($moduleName . '-' . strtolower($method->name), $whiteList)) continue;
$exits = false;
foreach($lang->resource->$moduleName as $key => $label)
{
if(strtolower($methodName) == strtolower($key)) $exits = true;
}
if(!$exits) echo $moduleName . "\t" . $methodName . " not in the list. \n";
}
}
}
}
}
/* checking actions of every module. */
echo '-------------lang checking-----------------' . "\n";
include '../config/config.php';
foreach(glob($moduleRoot . '*') as $modulePath)
{
unset($lang);
$moduleName = basename($modulePath);
$mainLangFile = $modulePath . '/lang/zh-cn.php';
if(!file_exists($mainLangFile)) continue;
$mainLines = file($mainLangFile);
foreach($config->langs as $langKey => $langName)
{
if($langKey == 'zh-cn' or $langKey == 'zh-tw') continue;
$langFile = $modulePath . '/lang/' . $langKey . '.php';
if(!file_exists($langFile)) continue;
$lines = file($langFile);
foreach($mainLines as $lineNO => $line)
{
if(strpos($line, '$lang') === false)
{
//if($line != $lines[$lineNO]) echo $moduleName . ' ' . $langKey . ' ' . $lineNO . "\n";
}
else
{
list($mainKey, $mainValue) = explode('=', $line);
list($key, $value) = explode('=', $lines[$lineNO]);
if(trim($mainKey) != trim($key))
{
$key = trim($key);
$lineNO = $lineNO + 1;
echo "module $moduleName need checking, command is:";
echo " vim -O +$lineNO ../module/$moduleName/lang/zh-cn.php +$lineNO ../module/$moduleName/lang/en.php \n";
break;
}
}
}
}
}
?>

14
trunk/bin/checkDemoData.php Executable file
View File

@@ -0,0 +1,14 @@
<?php
include("../config/my.php");
$demoSql = file("../db/demo.sql");
$output = '';
foreach($demoSql as $sql)
{
if(strpos($sql, 'INSERT') !== false and
strpos($sql, $config->db->prefix . 'config') === false and
strpos($sql, $config->db->prefix . 'company') === false and
strpos($sql, $config->db->prefix . 'group') === false
) $output .= $sql;
}
file_put_contents("../db/demo.sql", $output);

16
trunk/bin/checkdb.php Executable file
View File

@@ -0,0 +1,16 @@
<?php
include dirname(dirname(__FILE__)) . "/config/my.php";
if($config->requestType == 'PATH_INFO')
{
system('php ztcli "http://localhost/admin-checkdb"', $requestVar);
}
elseif($config->requestType == 'GET')
{
system('php ztcli "http://localhost/?m=admin&f=checkdb"', $requestVar);
}
if(!$requestVar)
{
echo "Check DataBase successfully!\n";
}

28
trunk/bin/checkyaml.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
/* Get the yaml file and parse it. */
if(count($argv) != 2) die("please set the yaml file.\n");
$filename = $argv[1];
if(!is_file($filename)) die("the yaml file doesn't exit\n");
include '../lib/spyc/spyc.class.php';
$extension = Spyc::YAMLLoadString(file_get_contents($filename));
/* Basic info checking. */
if(empty($extension['name'])) die("name field must be set\n");
if(empty($extension['code'])) die("code field must be set\n");
if(!preg_match('/^[a-zA-Z0-9_]{1}[a-zA-Z0-9_]{1,}[a-zA-Z0-9_]{1}$/', $extension['code'])) die("code shoulde be letter, nubmer and _\n");
if(!preg_match('/^(extension|patch|theme)$/', $extension['type'])) die("type shoulde be extension, patch or theme\n");
if(empty($extension['abstract'])) die("abstract field must be set\n");
/* desc and install fields checking. */
if(is_array($extension['desc'])) die("desc should be a string, please check your yaml synatax\n");
if(is_array($extension['install'])) die("install should be a string, please check your yaml synatax\n");
/* release checking. */
if(!is_array($extension['releases'])) die("releases should be set.\n");
foreach($extension['releases'] as $version => $release)
{
if(empty($release['zentaoversion'])) die("version $version should set the compatible zentao versions\n");
if(!preg_match('/^(free|share|opensource|business)$/', $release['charge'])) die("version $version's charge field shoulde be free, share, opensource or business\n");
if(empty($release['license'])) die("version $version 's license should be set\n");
if(empty($release['date']) ) die("version $version 's date field should be set\n");
}

18
trunk/bin/cn2tw.php Normal file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env php
<?php
$langType = 'zh-tw';
$langDesc = 'zh-tw';
if(empty($langType)) die('lang') . "\n";
foreach(glob('../module/*') as $moduleName)
{
$moduleLangPath = realpath($moduleName) . '/lang/';
$defaultLangFile = $moduleLangPath . 'zh-cn.php';
$targetLangFile = $moduleLangPath . $langType . '.php';
if(!file_exists($defaultLangFile)) continue;
system("cconv -f utf-8 -t UTF8-TW $defaultLangFile > $targetLangFile");
$defaultLang = file_get_contents($targetLangFile);
$targetLang = str_replace('zh-cn', $langDesc, $defaultLang);
file_put_contents($targetLangFile, $targetLang);
}
?>

49
trunk/bin/computeburn.php Executable file
View File

@@ -0,0 +1,49 @@
#!/usr/bin/env php
<?php
include dirname(dirname(__FILE__)) . '/lib/api/api.class.php';
$config->zentao->root = ""; // 禅道访问的完整路径包括后面的斜线。比如http://pms.zentao.net/
$config->zentao->account = ""; // 可以访问禅道的帐号需要有超级model调用接口的访问权限。
$config->zentao->password = ""; // 密码。
class computeburn
{
public $config; // the config var.
public $zentao; // the zentao client.
public function __construct($config)
{
$this->initConfig($config);
$this->initZenTao();
}
/* run. */
public function run()
{
$result = $this->zentao->fetchModel('project', 'computeburn');
if(empty($result)) return;
foreach($result as $burns)
{
echo $burns->project . "\t";
echo $burns->projectName . "\t";
echo $burns->date . "\t";
echo $burns->left . "\n";
}
}
/* Init the config. */
private function initConfig($config)
{
$this->config = $config;
}
/* Init the client of zentao api. */
private function initZenTao()
{
$this->zentao = new ztclient($this->config->zentao->root, $this->config->zentao->account, $this->config->zentao->password);
}
}
$computeburn = new computeburn($config);
$computeburn->run();
?>

17
trunk/bin/copylang.php Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env php
<?php
$langType = $argv[1];
$langDesc = $argv[2];
if(empty($langType)) die('lang') . "\n";
foreach(glob('../module/*') as $moduleName)
{
$moduleLangPath = realpath($moduleName) . '/lang/';
$defaultLangFile = $moduleLangPath . 'zh-cn.php';
$targetLangFile = $moduleLangPath . $langType . '.php';
if(!file_exists($defaultLangFile)) continue;
$defaultLang = file_get_contents($defaultLangFile);
$targetLang = str_replace('zh-cn', $langDesc, $defaultLang);
file_put_contents($targetLangFile, $targetLang);
}
?>

29
trunk/bin/exportactions.php Executable file
View File

@@ -0,0 +1,29 @@
<?php
class control {}
$moduleRoot = rtrim($argv[1], '/') . '/';
foreach(glob($moduleRoot . '*') as $modulePath)
{
$moduleName = basename($modulePath);
$controlFile = $modulePath . '/control.php';
if(file_exists($controlFile))
{
include $controlFile;
$lines = explode("\n", file_get_contents($controlFile));
if(class_exists($moduleName))
{
$class = new ReflectionClass($moduleName);
$methods = $class->getMethods();
foreach($methods as $method)
{
$methodRef = new ReflectionMethod($method->class, $method->name);
if($methodRef->isPublic() and strpos($method->name, '__') === false)
{
echo "\$lang['action']['$moduleName']['$method->name'] = '$method->name';\n";
}
}
echo "\n";
}
}
}
?>

View File

@@ -0,0 +1,28 @@
<?php
error_reporting(E_ALL);
$langType = empty($argv[1]) ? 'zh-cn' : $argv[1];
$modules = glob('../module/*');
$maxLength = 0;
foreach($modules as $modulePath)
{
$moduleName = basename($modulePath);
if(strlen($moduleName) > $maxLength) $maxLength = strlen($moduleName);
}
foreach($modules as $modulePath)
{
$moduleName = basename($modulePath);
if($moduleName == 'help' or $moduleName == 'editor') continue;
$langFile = $modulePath . "/lang/$langType.php";
if(!file_exists($langFile)) continue;
include $langFile;
$moduleTitle = '';
if(isset($lang->$moduleName->common))
{
$moduleTitle = $lang->$moduleName->common;
}
echo "\$lang->editor->modules['$moduleName'] " . str_pad('', $maxLength - strlen($moduleName)) . "= '$moduleTitle';\n";
}

77
trunk/bin/getbugs.php Executable file
View File

@@ -0,0 +1,77 @@
#!/usr/bin/env php
<?php
/* 包含http客户端类snoopy。在禅道lib/snoopy里面可以找到。*/
include dirname(dirname(__FILE__)) . '/lib/snoopy/snoopy.class.php';
/* 用来登录的地址,用户名和密码。*/
$zentaoRoot = "http://demo.zentao.net/"; // 请根据实际的情况进行修改。
$account = "demo";
$password = "123456";
$requestType = 'PATH_INFO'; // 可选值: GET|PATH_INFO。
/* 设置API地址。*/
if($requestType == 'GET')
{
/* API地址以GET方式为例。*/
$loginAPI = $zentaoRoot . "?m=user&f=login";
$sessionAPI = $zentaoRoot . "?m=api&f=getSessionID&t=json";
$myBugAPI = $zentaoRoot . "?m=my&f=bug&t=json";
$superMyBugAPI = $zentaoRoot . "?m=api&f=getModel&module=bug&methodName=getUserBugPairs&params=account=$account";
}
elseif($requestType == 'PATH_INFO')
{
/* API地址以PATH_INFO方式为例。*/
$loginAPI = $zentaoRoot . "user-login.json?a=1";
$sessionAPI = $zentaoRoot . "api-getsessionid.json?a=1";
$myBugAPI = $zentaoRoot . "my-bug.json?a=1";
$superMyBugAPI = $zentaoRoot . "api-getmodel-bug-getUserBugPairs-account=$account.json?a=1";
}
/* 获取session. */
$snoopy = new Snoopy;
$snoopy->fetch($sessionAPI);
$session = json_decode($snoopy->results);
$session = json_decode($session->data);
/*用户登录*/
$authHash = md5(md5($password) . $session->rand);
$submitVars["account"] = $account;
$submitVars["password"] = $authHash;
$snoopy->cookies[$session->sessionName] = $session->sessionID;
$snoopy->submit($loginAPI, $submitVars);
/* 直接调用my模块的bugs页面。*/
$snoopy->fetch($myBugAPI . "&$session->sessionName=$session->sessionID");
$result = json_decode($snoopy->results);
if($result->status == 'success' && md5($result->data) == $result->md5)
{
$bugs = json_decode($result->data)->bugs;
}
else
{
echo "called failed or transfered not complete.";
exit;
}
if($bugs)
{
foreach($bugs as $bug) echo $bug->id . "\t" . $bug->title . "\n";
}
else
{
echo 'no bugs' . "\n";
}
/* 通过超级model调用。*/
$snoopy->fetch($superMyBugAPI . "&$session->sessionName=$session->sessionID");
$result = json_decode($snoopy->results);
if(is_object($result))
{
foreach($result as $id=>$bug) echo $id . "\t" . $bug . "\n";
}
else
{
echo 'no bugs' . "\n";
}
?>

60
trunk/bin/initext.php Normal file
View File

@@ -0,0 +1,60 @@
<?php
/**
* The control file of common module of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 QingDao Nature Easy Soft Network Technology Co,LTD (www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chen congzhi <congzhi@cnezsoft.com>
* @package common
* @version $Id$
* @link http://www.zentao.net
*/
include '../config/config.php';
$modules = array();
$moduleRoot = realpath('../module/') . '/';
if(is_dir($moduleRoot))
{
if($dh = opendir($moduleRoot))
{
while($module = readdir($dh))
{
if(strpos(basename($module), '.') === false) $modules[] = $module;
}
closedir($dh);
}
}
else
{
die("The module you input does not exist. \n");
}
foreach($modules as $module)
{
/* 设定各个目录。*/
$extRoot = $moduleRoot . DIRECTORY_SEPARATOR. $module . DIRECTORY_SEPARATOR . 'ext';
$extControl = $extRoot . DIRECTORY_SEPARATOR . 'control';
$extModel = $extRoot . DIRECTORY_SEPARATOR . 'model';
$extView = $extRoot . DIRECTORY_SEPARATOR . 'view';
$extConfig = $extRoot . DIRECTORY_SEPARATOR . 'config';
$extLang = $extRoot . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR;
/* 建立各个扩展目录 */
if(!file_exists($extRoot)) mkdir($extRoot, 0777);
if(!file_exists($extControl)) mkdir($extControl, 0777);
if(!file_exists($extModel)) mkdir($extModel, 0777);
if(!file_exists($extView)) mkdir($extView, 0777);
if(!file_exists($extConfig)) mkdir($extConfig, 0777);
if(!file_exists($extLang)) mkdir($extLang, 0777);
/* 创建语言目录。*/
$langs = array_keys($config->langs);
foreach($langs as $lang)
{
$langPath = $extLang . $lang;
if(!file_exists($langPath)) mkdir($langPath, 0777);
}
echo "init $module ... \n";
}

70
trunk/bin/minifyfront.php Normal file
View File

@@ -0,0 +1,70 @@
<?php
/**
* This file is used to compress css and js files.
*/
$baseDir = dirname(dirname(__FILE__));
//--------------------------------- PROCESS JS FILES ------------------------------ //
/* Set jsRoot and jqueryRoot. */
$jsRoot = $baseDir . '/www/js/';
$jqueryRoot = $jsRoot . 'jquery/';
/* Set js files to combined. */
$jsFiles[] = $jqueryRoot . 'lib.js';
$jsFiles[] = $jsRoot . 'my.full.js';
$jsFiles[] = $jqueryRoot . 'colorbox/min.js';
$jsFiles[] = $jqueryRoot . 'chosen/chosen.min.js';
$jsFiles[] = $jqueryRoot . 'treeview/min.js';
$jsFiles[] = $jqueryRoot . 'datepicker/date.js';
$jsFiles[] = $jqueryRoot . 'datepicker/min.js';
$jsFiles[] = $jqueryRoot . 'alert/min.js';
$jsFiles[] = $jqueryRoot . 'colorize/min.js';
/* Combine these js files. */
$allJSFile = $jsRoot . 'all.js';
$jsCode = '';
foreach($jsFiles as $jsFile) $jsCode .= "\n". file_get_contents($jsFile);
file_put_contents($allJSFile, $jsCode);
/* Compress it. */
`java -jar ~/bin/yuicompressor/build/yuicompressor.jar --type js $allJSFile -o $allJSFile`;
//-------------------------------- PROCESS CSS FILES ------------------------------ //
/* Define the themeRoot. */
$themeRoot = $baseDir . '/www/theme/';
/* Iinclude config and lang file to get langs and themes. */
include $baseDir . '/config/config.php';
include $baseDir . '/module/common/lang/zh-cn.php';
$langs = array_keys($config->langs);
$themes = array_keys($lang->themes);
/* Create css files for every them and every lang. */
foreach($langs as $lang)
{
foreach($themes as $theme)
{
/* Common css files. */
$cssCode = file_get_contents($themeRoot . 'default/yui.css');
$cssCode .= file_get_contents($themeRoot . 'default/style.css');
$cssCode .= file_get_contents($themeRoot . 'default/colorbox.css');
$cssCode .= file_get_contents($themeRoot . 'default/chosen.css');
$cssCode .= file_get_contents($themeRoot . 'default/treeview.css');
$cssCode .= file_get_contents($themeRoot . 'default/datepicker.css');
$cssCode .= file_get_contents($themeRoot . 'default/alert.css');
/* Css file for current lang and current them. */
$cssCode .= file_get_contents($themeRoot . "lang/$lang.css");
if($theme != 'default') $cssCode .= file_get_contents($themeRoot . $theme . '/style.css');
/* Combine them. */
$cssFile = $themeRoot . "default/$lang.$theme.css";
file_put_contents($cssFile, $cssCode);
/* Compress it. */
`java -jar ~/bin/yuicompressor/build/yuicompressor.jar --type css $cssFile -o $cssFile`;
}
}

60
trunk/bin/preparetest.php Normal file
View File

@@ -0,0 +1,60 @@
<?php
include '../config/config.php';
connectDB();
$databases[] = 'zentao_03';
$databases[] = 'zentao_04';
$databases[] = 'zentao_05';
$databases[] = 'zentao_06';
$databases[] = 'zentao_10';
$databases[] = 'zentao_101';
$databases[] = 'zentao_11';
$databases[] = 'zentao_12';
$databases[] = 'zentao_13';
$databases[] = 'zentao_14';
$databases[] = 'zentao_15';
if(!isset($argv[1])) die(__FILE__ . ' restore' . "\n");
$cmd = $argv[1];
if($cmd == 'backup') backupDB();
if($cmd == 'restore') restore();
/* Backup new installed database. */
function backupDB()
{
global $databases;
foreach($databases as $database)
{
$backupDatabase = "back_$database";
mysql_query("DROP DATABASE $backupDatabase");
mysql_query("CREATE DATABASE $backupDatabase");
$cmd = "mysqldump -u root $database > $database.sql;\n";
$cmd .= "mysql -uroot $backupDatabase < $database.sql;\n";
$cmd .= "rm -fr $database.sql";
system($cmd);
}
}
/* Restore stored backup databases. */
function restore()
{
global $databases;
foreach($databases as $database)
{
$backupDatabase = "back_$database";
mysql_query("DROP DATABASE $database");
mysql_query("CREATE DATABASE $database");
$cmd = "mysqldump -u root $backupDatabase > $database.sql;\n";
$cmd .= "mysql -uroot $database < $database.sql;\n";
$cmd .= "rm -fr $database.sql";
system($cmd);
}
}
/* Connect to database. */
function connectDB()
{
global $config;
mysql_connect($config->db->host, $config->db->user, $config->db->password);
}

100
trunk/bin/syncext.php Normal file
View File

@@ -0,0 +1,100 @@
#!/usr/bin/env php
<?php
/**
* This file is used to sync extension files to the target pms directory.
*
* @author chunsheng wang chunsheng@cnezsoft.com
* @version $Id$
*/
//sudo pecl install channel://pecl.php.net/inotify-0.1.5
//extension=inotify.so" to php.ini
/* Get params from argvs. */
if(!isset($argv[1])) die("php syncext.php from target sleep\n");
$from = $argv[1];
$target = isset($argv[2]) ? $argv[2] : '/home/z/zentaopms';
$sleep = isset($argv[3]) ? $argv[3] : 5;
/* sync files. */
while(true)
{
syncFiles(getFiles($from), $from, $target);
sleep($sleep);
}
/**
* Get files under a directory recursive.
*
* @param string $dir
* @param array $exceptions
* @access private
* @return array
*/
function getFiles($dir, $exceptions = array())
{
static $files = array();
if(!is_dir($dir)) return $files;
$dir = realpath($dir) . '/';
$entries = scandir($dir);
foreach($entries as $entry)
{
if($entry == '.' or $entry == '..' or $entry == '.svn') continue;
if(in_array($entry, $exceptions)) continue;
$fullEntry = $dir . $entry;
if(is_file($fullEntry))
{
$files[] = $dir . $entry;
}
else
{
$nextDir = $dir . $entry;
getFiles($nextDir);
}
}
return $files;
}
/**
* Sync extension files to target.
*
* @param array $files
* @param string $from
* @param string $target
* @access public
* @return void
*/
function syncFiles($files, $from, $target)
{
$from = realpath($from);
$target = realpath($target);
static $copied = array();
foreach($files as $file)
{
$relativePath = str_replace($from, '', $file);
$targetFile = $target . $relativePath;
$targetPath = dirname($targetFile);
/* If file not exists, remove the target. */
if(!is_file($file))
{
@unlink($targetFile);
continue;
}
if(!is_dir($targetPath)) mkdir($targetPath, 0755, true);
$ctime = filectime($file);
if(!isset($copied[$file]) or $copied[$file] != $ctime)
{
copy($file, $targetFile);
$copied[$file] = $ctime;
echo "$file copyed\n";
}
}
}

22
trunk/bin/tags.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
/* This file is used to crete a tag of subverion. */
$config->zentaophp->svnRoot = 'https://zentaophp.googlecode.com/svn/';
$config->zentaophp->svnTrunk = 'trunk/';
$config->zentaophp->svnTags = 'tags/';
$config->zentaopms->svnRoot = 'https://ZenTaoPMS.googlecode.com/svn/';
$config->zentaopms->svnTrunk = 'trunk/';
$config->zentaopms->svnTags = 'tags/';
if(count($argv) != 4) die(__FILE__ . " repo version releasetype:beta|alpa|stable\n");
$repo = $argv[1];
$version = $argv[2];
$release = $argv[3];
$sourceURL = $config->$repo->svnRoot . $config->$repo->svnTrunk;
$targetURL = $config->$repo->svnRoot . $config->$repo->svnTags . $repo . '_' . $version . '_' . $release . '_' . date('Ymd');
$svnCMD = "svn rm $targetURL -m 'remove it'; svn cp $sourceURL $targetURL -m 'tag $version of $repo'";
system($svnCMD);

72
trunk/bin/todo.php Executable file
View File

@@ -0,0 +1,72 @@
#!/usr/bin/env php
<?php
/* 包含http客户端类snoopy。在禅道lib/snoopy里面可以找到。*/
include dirname(dirname(__FILE__)) . '/lib/snoopy/snoopy.class.php';
/* 用来登录的地址,用户名和密码。*/
$zentaoRoot = "http://pms.easysoft.com/";
$account = ""; // 需要设置用户名和密码。
$password = "";
$requestType = "PATH_INFO"; // 禅道系统访问方式,请根据实际的配置进行修改。
if($account == '' and $password == '') die("Must set account and password.\n");
/* 设置API地址。*/
if($requestType == 'GET')
{
/* API地址以GET方式为例。*/
$loginAPI = $zentaoRoot . "?m=user&f=login";
$sessionAPI = $zentaoRoot . "?m=api&f=getSessionID&t=json";
$myTodoAPI = $zentaoRoot . "?m=my&f=todo&t=json";
}
elseif($requestType == 'PATH_INFO')
{
/* API地址以PATH_INFO方式为例。*/
$loginAPI = $zentaoRoot . "user-login.json?a=1";
$sessionAPI = $zentaoRoot . "api-getsessionid.json?a=1";
$myTodoAPI = $zentaoRoot . "my-todo.json?a=1";
}
/* 获取session。 */
$snoopy = new Snoopy;
$snoopy->fetch($sessionAPI);
$session = json_decode($snoopy->results);
$session = json_decode($session->data);
/*用户登录,加密验证。*/
$authHash = md5(md5($password) . $session->rand);
$submitVars["account"] = $account;
$submitVars["password"] = $authHash;
$snoopy->cookies[$session->sessionName] = $session->sessionID;
$snoopy->submit($loginAPI, $submitVars);
/* 直接调用my模块的todo页面。*/
$snoopy->fetch($myTodoAPI . "&$session->sessionName=$session->sessionID");
$result = json_decode($snoopy->results);
if($result->status == 'success' && md5($result->data) == $result->md5)
{
$todos = json_decode($result->data)->todos;
}
else
{
echo "called failed or transfered not complete.";
exit;
}
if($todos)
{
foreach($todos as $todo)
{
echo $todo->id . "\t" .
$todo->type . "\t" .
$todo->pri . "\t" .
$todo->name . "\t" .
$todo->status . "\n";
}
}
else
{
echo "no todos.\n";
}
?>

46
trunk/bin/ztcli Executable file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/env php
<?php
/**
* The cli router file of zentaopms.
*
* @copyright Copyright 2009-2012 QingDao Nature Easy Soft Network Technology Co,LTD (www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package bin
* @version $Id$
* @link http://www.ZenTaoPMS.com
*/
//error_reporting(0);
define('IN_SHELL', true);
/* Judge the args. */
if($argc != 2) die('Usage: ' . basename(__FILE__) . " <request>\n");
/* Parse the request into params. */
$request = parse_url(trim($argv[1]));
$_SERVER['HTTP_HOST'] = $request['host'];
/* Load the framework. */
chdir(dirname(__FILE__));
include '../framework/router.class.php';
include '../framework/control.class.php';
include '../framework/model.class.php';
include '../framework/helper.class.php';
include '../config/config.php';
if($config->requestType == 'PATH_INFO')
{
$_SERVER['PATH_INFO'] = str_replace($config->webRoot, '', $request['path']);
}
else
{
parse_str($request['query'], $_GET);
$_SERVER['SCRIPT_NAME'] = $_SERVER['HTTP_HOST'] . 'index.php';
$_SERVER['REQUEST_URI'] = isset($request['query']) ? $request['query'] : '';
}
/* Instance the app and run it. */
$app = router::createApp('pms', dirname(dirname(__FILE__)));
$common = $app->loadCommon();
$app->parseRequest();
$app->loadModule();

1
trunk/bin/ztcli.bat Normal file
View File

@@ -0,0 +1 @@
php ztcli %*

1
trunk/bin/ztcli.sh Executable file
View File

@@ -0,0 +1 @@
php ztcli $*

View File

@@ -0,0 +1,20 @@
VERSION=$(shell head -n 1 zentao/VERSION)
all: 7z
7z:
sudo ./lampp stop
sudo rm -fr logs/*
sudo rm -fr var/mysql/*.err
sudo rm -fr var/mysql/ib*
sudo mkdir .package
sudo mv * .package
sudo mv .package lampp
sudo mv lampp/Makefile .
sudo chmod a+rx lampp/start*
sudo chmod a+rx lampp/start88
sudo 7z a -sfx ZenTaoPMS.${VERSION}.linux.7z lampp
clean:
sudo mv lampp lampp.bak
sudo mv lampp.bak/* .
sudo rm -fr *.7z
sudo rm -fr lampp.bak

268
trunk/build/linux/buildxmapp.sh Executable file
View File

@@ -0,0 +1,268 @@
tar zxvf $1/xampp.tar.gz
cd lampp
# rm useless files.
rm -fr RELEASENOTES
rm -fr error
rm -fr icons
rm -fr logs/*
rm -fr htdocs/*
rm -fr phpmyadmin
rm -fr cgi-bin
rm -fr libexec
rm -fr tmp/*
chmod -R 777 tmp
# rm useless settings.
rm -fr etc/proftpd.conf
rm -fr etc/webalizer.conf*
rm -fr etc/freetds.conf
rm -fr etc/openssl.cnf
rm -fr etc/php.ini-pre1.7.2
rm -fr etc/pear.conf
rm -fr etc/pool.conf
rm -fr etc/openldap
rm -fr etc/original
rm -fr etc/httpd.conf.bak
rm -fr etc/lampp/startftp
rm -fr etc/ssl*
rm -fr etc/extra/httpd-dav.conf
rm -fr etc/extra/httpd-info.conf
rm -fr etc/extra/httpd-manual.conf
rm -fr etc/extra/httpd-ssl.conf
rm -fr etc/extra/httpd-manual.conf
rm -fr etc/extra/httpd-userdir.conf
rm -fr etc/extra/httpd-multilang-errordoc.conf
rm -fr etc/lampp/startssl
# process httpd conf
grep -v '#' etc/httpd.conf | \
grep -v '^$' | \
grep -v 'mod_actions.so' | \
grep -v 'authn_dbm' | \
grep -v 'authn_anon' | \
grep -v 'authn_dbd' | \
grep -v 'authn_default' | \
grep -v 'authz_groupfile' | \
grep -v 'authz_dbm' | \
grep -v 'authz_owner' | \
grep -v 'authnz_ldap' | \
grep -v 'authz_default' | \
grep -v 'auth_digest_module' | \
grep -v 'cache.so' | \
grep -v 'mod_bucketeer' | \
grep -v 'mod_dumpio' | \
grep -v 'mod_echo' | \
grep -v 'mod_case*' | \
grep -v 'mod_ext_filter*' | \
grep -v 'mod_include' | \
grep -v 'mod_filter' | \
grep -v 'mod_charset_lite' | \
grep -v 'mod_ldap' | \
grep -v 'mod_log_config' | \
grep -v 'mod_logio' | \
grep -v 'mod_cern_meta' | \
grep -v 'mod_headers' | \
grep -v 'mod_ident' | \
grep -v 'mod_usertrack' | \
grep -v 'mod_unique_id' | \
grep -v 'mod_proxy*' | \
grep -v 'mod_dav*' | \
grep -v 'mod_status' | \
grep -v 'mod_asis' | \
grep -v 'mod_info' | \
grep -v 'mod_suexec' | \
grep -v 'mod_cgi*' | \
grep -v 'mod_negotiation' | \
grep -v 'mod_imagemap' | \
grep -v 'mod_speling' | \
grep -v 'mod_userdir' | \
grep -v 'mod_apreq2' | \
grep -v 'mod_ssl' | \
grep -v 'multilang-errordoc' > etc/httpd.conf.lite
mv etc/httpd.conf.lite etc/httpd.conf
# process my.cnf
grep -v '^innodb' etc/my.cnf| \
sed -e 's/#skip-innodb/default-storage-engine=MyISAM\nskip-innodb/' | \
grep -v '^#' | \
grep -v '^$' > etc/my.cnf.new
mv etc/my.cnf.new etc/my.cnf
# process php.ini
echo 'zend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/ioncube_loader_lin_5.3.so' > etc/php.ini.new
grep -v '^;' etc/php.ini |\
grep -v '^$' |\
grep -v 'sqlite.so' |\
grep -v 'radius.so' |\
grep -v 'pgsql.so' |\
grep -v 'ming.so' |\
grep -v 'ncurses.so' >> etc/php.ini.new
mv etc/php.ini.new etc/php.ini
# rm useless binaries.
mv bin bin.bak
mkdir bin
cd bin.bak
cp htpasswd apachectl apxs my_print_defaults mysql mysql.server mysqld_safe mysqldump php php-config phpize httpd ../bin/
cd ../
rm -fr bin.bak
# fix bug of the mysqld_safe
sed -e 's/\/opt\/lampp\/\/opt\/lampp\/sbin/\/opt\/lampp\/sbin/g' bin/mysqld_safe > bin/mysqld_safe.new
mv bin/mysqld_safe.new bin/mysqld_safe
chmod a+rx bin/mysqld_safe
# rm useless binaries at sbin directory, keep mysqld.
mv sbin sbin.bak
mkdir sbin
mv sbin.bak/mysqld sbin/
rm -fr sbin.bak
# process share directory. keep english and lampp directory.
mv share share.bak
mkdir share
mv share.bak/english share/
mv share.bak/lampp share
echo >share/lampp/allons
rm -fr share.bak
rm -fr share/lampp/alladdons
touch share/lampp/alladdons
chmod a+rx share/lampp/alladdons
# process lib directory.
mv lib/php/extensions lib/phpextensions
rm -fr lib/php
mkdir lib/php
mv lib/phpextensions lib/php/extensions
rm -fr lib/php/extensions/no-debug-non-zts-20090626/interbase.so
rm -fr lib/php/extensions/no-debug-non-zts-20090626/ming.so
rm -fr lib/php/extensions/no-debug-non-zts-20090626/ncurses.so
rm -fr lib/php/extensions/no-debug-non-zts-20090626/oci8.so
rm -fr lib/php/extensions/no-debug-non-zts-20090626/pgsql.so
rm -fr lib/php/extensions/no-debug-non-zts-20090626/radius.so
rm -fr lib/php/extensions/no-debug-non-zts-20090626/sqlite.so
rm -fr lib/perl5
rm -fr lib/proftpd
rm -fr lib/fonts
rm -fr apr-util-1
rm -fr apr.exp
rm -fr aprutil.exp
rm -fr engines
rm -fr fips_premain.c
rm -fr fips_premain.c.sha1
rm -fr gettext
rm -fr icu
rm -fr libapr-1*
rm -fr libapreq2*
rm -fr libdb.so.3
rm -fr libform.so*
rm -fr libicule.so*
rm -fr libiculx.*
rm -fr libicutu.*
rm -fr liblber*
rm -fr libldap_r*
rm -fr libmcrypt
rm -fr libmenu.so*
rm -fr libming.so*
rm -fr libmysqlclient.*
rm -fr libncurses.so*
rm -fr libpanel.so*
rm -fr libpbmscl.so*
rm -fr libpng.so*
rm -fr libsablot.so*
rm -fr libsqlite*
rm -fr libtds.so*
rm -fr libtdssrv.so*
rm -fr libxslt-plugins
rm -fr libzzip-0*
rm -fr libzzipwrap*
rm -fr pkgconfig
rm -fr plugin
rm -fr stjR6sfX
rm -fr terminfo
rm -fr xml2Conf.sh
rm -fr xsltConf.sh
# process var directory.
rm -fr var/perl
rm -fr var/proftpd*
rm -fr var/mysql/cdcol
rm -fr var/mysql/*.err
rm -fr var/mysql/ib*
rm -fr var/mysql/phpmyadmin
rm -fr var/mysql/test
chmod -R 777 var/mysql
# process modules directory.
rm -fr modules/mod_perl.so
rm -fr modules/mod_actions.so
rm -fr modules/mod_asis.so
rm -fr modules/mod_authn_dbm
rm -fr modules/mod_authn_anon
rm -fr modules/mod_authn_dbd
rm -fr modules/mod_authn_default
rm -fr modules/mod_authz_dbm.so
rm -fr modules/mod_authz_default.so
rm -fr modules/mod_authz_groupfile.so
rm -fr modules/mod_authz_owner.so
rm -fr modules/mod_bucketeer.so
rm -fr modules/mod_cache*
rm -fr modules/mod_case**
rm -fr modules/mod_cern_meta.so
rm -fr modules/mod_cgi*
rm -fr modules/mod_charset_lite.so
rm -fr modules/mod_dav*.so
rm -fr modules/mod_dbd.so
rm -fr modules/mod_disk_cache.so
rm -fr modules/mod_dumpio.so
rm -fr modules/mod_ext_filter.so
rm -fr modules/mod_file_cache.so
rm -fr modules/mod_filter.so
rm -fr modules/mod_headers.so
rm -fr modules/mod_ident.so
rm -fr modules/mod_imagemap.so
rm -fr modules/mod_include.so
rm -fr modules/mod_info.so
rm -fr modules/mod_ldap.so
rm -fr modules/mod_log*.so
rm -fr modules/mod_mem_cache.so
rm -fr modules/mod_negotiation.so
rm -fr modules/mod_proxy*
rm -fr modules/mod_reqtimeout.so
rm -fr modules/mod_speling.so
rm -fr modules/mod_ssl.so
rm -fr modules/mod_status.so
rm -fr modules/mod_substitute.so
rm -fr modules/mod_suexec.so
rm -fr modules/mod_unique_id.so
rm -fr modules/mod_userdir.so
rm -fr modules/mod_usertrack.so
rm -fr modules/mod_version.so
# copy customized xmapp config to etc/extra
cp ../zentao.conf etc/extra/httpd-xampp.conf
# copy the zentao code.
mv ../../../zentaopms ./zentao
# copy needed files.
cp ../Makefile .
cp ../start .
cp ../start88 .
cp ../stop .
cp ../../windows/xampp/index.php htdocs/
# copy sqlbuddy.
mkdir admin
unzip $1/sqlbuddy.zip
mv sqlbuddy admin/
# make the auth file
mkdir auth
touch auth/users
echo 'use htpasswd users username password to add a new user.' > auth/readme
# copy the ioncube loader.
cp ../ioncube_loader_lin_5.3.so lib/php/extensions/no-debug-non-zts-20090626/

Binary file not shown.

24
trunk/build/linux/start Normal file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
if test "`id -u`" -ne 0
then
echo "You need to start XAMPP as root!"
exit
fi
sed -e 's/88/80/g' etc/httpd.conf > etc/httpd.conf.80
mv etc/httpd.conf.80 etc/httpd.conf
sed -e 's/88/80/g' etc/extra/httpd-vhosts.conf > etc/extra/httpd-vhosts.conf.80
mv etc/extra/httpd-vhosts.conf.80 etc/extra/httpd-vhosts.conf
sed -e 's/3308/3306/g' etc/my.cnf > etc/my.cnf.3306
mv etc/my.cnf.3306 etc/my.cnf
sed -e 's/3308/3306/g' zentao/config/my.php > zentao/config/my.php.3306
mv zentao/config/my.php.3306 zentao/config/my.php
chown nobody -R var/mysql
chmod 777 tmp
chmod 777 -R zentao/tmp
chmod 777 -R zentao/www/data/upload
./lampp start

24
trunk/build/linux/start88 Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
if test "`id -u`" -ne 0
then
echo "You need to start XAMPP as root!"
exit
fi
sed -e 's/80/88/g' etc/httpd.conf > etc/httpd.conf.88
mv etc/httpd.conf.88 etc/httpd.conf
sed -e 's/80/88/g' etc/extra/httpd-vhosts.conf > etc/extra/httpd-vhosts.conf.88
mv etc/extra/httpd-vhosts.conf.88 etc/extra/httpd-vhosts.conf
sed -e 's/3306/3308/g' etc/my.cnf > etc/my.cnf.3308
mv etc/my.cnf.3308 etc/my.cnf
sed -e 's/3306/3308/g' zentao/config/my.php > zentao/config/my.php.3308
mv zentao/config/my.php.3308 zentao/config/my.php
chown nobody -R var/mysql
chmod 777 tmp
chmod 777 -R zentao/tmp
chmod 777 -R zentao/www/data/upload
./lampp start

8
trunk/build/linux/stop Normal file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
if test "`id -u`" -ne 0
then
echo "You need to start XAMPP as root!"
exit
fi
./lampp stop

View File

@@ -0,0 +1,37 @@
# add support for php.
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .php3 .php4
# adjust the mime settings.
AddType image/x-icon .ico
AddType image/gif .ico
AddType image/jpeg .jpg .jpeg
AddType image/png .png
AddType application/javascript .js
# setting for zentao.
Alias /zentao "/opt/lampp/zentao/www/"
<Directory "/opt/lampp/zentao/www">
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
</Directory>
# setting for admin
Alias /sqlbuddy "/opt/lampp/admin/sqlbuddy"
<Directory "/opt/lampp/admin">
#Order allow,deny
#Allow from 127.0.0.1
AuthName 'zentao admin'
AuthType Basic
AuthUserFile /opt/lampp/auth/users
require valid-user
</Directory>
# setting of gzip.
<IfModule mod_deflate.c>
DeflateCompressionLevel 9
AddOutputFilterByType DEFLATE text/html text/css application/javascript
</IfModule>
# turn off etag.
FileEtag none

View File

@@ -0,0 +1,17 @@
name: zentao
version: 1
cron:
- description: cron
url: project-computeburn-admin.html
schedule: every day of month 00:00
timezone: Beijing
handle:
- rewrite: if(!is_dir() && !is_file()) goto "index.php/%{REQUEST_URI}"
- compress: if(out_header["Content-Type"] ~ "text") compress
- compress: if(out_header["Content-Type"] ~ "javascript") compress
- expire: if(path ~ "\.js$") time 360000
- expire: if(path ~ "\.css$") time 360000
- expire: if(path ~ "\.gif$") time 360000
- expire: if(path ~ "\.png$") time 360000
- expire: if(path ~ "\.ico$") time 360000
- expire: if(path ~ "\.jpg$") time 360000

31
trunk/build/sae/mysae.php Executable file
View File

@@ -0,0 +1,31 @@
<?php
$config->installed = false;
$config->debug = false;
$config->requestType = 'PATH_INFO';
$config->db->host = SAE_MYSQL_HOST_M;
$config->db->slaveHost = SAE_MYSQL_HOST_S;
$config->db->port = SAE_MYSQL_PORT;
$config->db->name = SAE_MYSQL_DB;
$config->db->user = SAE_MYSQL_USER;
$config->db->password = SAE_MYSQL_PASS;
$config->db->prefix = 'zt_';
$config->db->checkCentOS = false;
$config->slaveDB->host = SAE_MYSQL_HOST_S;
$config->slaveDB->port = SAE_MYSQL_PORT;
$config->slaveDB->name = SAE_MYSQL_DB;
$config->slaveDB->user = SAE_MYSQL_USER;
$config->slaveDB->password = SAE_MYSQL_PASS;
$config->slaveDB->checkCentOS = false;
$config->webRoot = '/';
$config->default->domain = $_SERVER['HTTP_HOST'];
$config->default->lang = 'zh-cn';
$config->sae->storage->domain = 'zentao';
$saeDB = new saemysql();
$saeSQL = "SELECT COUNT(`id`) FROM `" . $config->db->prefix . "config` WHERE 1 LIMIT 0,10";
if($saeDB->getData($saeSQL)) $config->installed = true;
$saeDB->closeDb();

28
trunk/build/sae/mysyun.php Executable file
View File

@@ -0,0 +1,28 @@
<?php
$appRoot = dirname(dirname(dirname(__FILE__))) . '/' ;
$sourceHtaccessFile = $appRoot . 'htaccess';
$targetHtaccessFile = $appRoot . '.htaccess';
if(file_exists($sourceHtaccessFile))
{
$targetHtaccessCode = str_replace('index.php', $config->webRoot . 'index.php', file_get_contents($sourceHtaccessFile));
file_put_contents($targetHtaccessFile, $targetHtaccessCode);
}
$tmpRoot = $appRoot . '/tmp/';
if(!is_dir($tmpRoot))
{
mkdir($tmpRoot, 0777);
mkdir($tmpRoot . 'cache', 0777);
mkdir($tmpRoot . 'extension', 0777);
mkdir($tmpRoot . 'log', 0777);
mkdir($tmpRoot . 'model', 0777);
mkdir($tmpRoot . 'svn', 0777);
}
$dataRoot = $appRoot . 'data/';
if(!is_dir($dataRoot))
{
mkdir($dataRoot, 0777);
mkdir($dataRoot . 'upload', 0777);
}

View File

@@ -0,0 +1,47 @@
<appwizard>
<introduction>
<name>禅道项目管理软件SAE版本</name>
<author>青岛易软天创网络科技有限公司</author>
<icon>default_app_icon</icon>
<homepage>http://www.zentao.net/</homepage>
<description>
<![CDATA[
<p>禅道项目管理软件(ZenTaoPMS)是一款国产的基于LGPL协议开源免费的项目管理软件它集产品管理、项目管理、测试管理于一体同时还包含了事务管理、组织管理等诸多功能是中小型企业项目管理的首选。禅道项目管理软件使用PHP + MySQL开发基于自主的PHP开发框架──ZenTaoPHP而成。第三方开发者或者企业可以非常方便的开发插件或者进行定制。</p>
]]>
</description>
</introduction>
<platform>
<services>
<service name="zentao" params="禅道数据存储">Storage</service>
<service size="12M">Memcache</service>
<service>Mysql</service>
</services>
<appconfig>
<tpl>
<![CDATA[
name: <<appname>>
version: <<version>>
cron:
- description: cron
url: project-computeburn-admin.html
schedule: every day of month 00:00
timezone: Beijing
handle:
- rewrite: if(!is_dir() && !is_file()) goto "index.php/%{REQUEST_URI}"
- compress: if(out_header["Content-Type"] ~ "text") compress
- compress: if(out_header["Content-Type"] ~ "javascript") compress
- expire: if(path ~ "\.js$") time 360000
- expire: if(path ~ "\.css$") time 360000
- expire: if(path ~ "\.gif$") time 360000
- expire: if(path ~ "\.png$") time 360000
- expire: if(path ~ "\.ico$") time 360000
- expire: if(path ~ "\.jpg$") time 360000
]]>
</tpl>
</appconfig>
</platform>
<code>
<initScript>index.php</initScript>
</code>
</appwizard>

View File

@@ -0,0 +1,8 @@
function saveSQL4SAE()
{
if(!class_exists('dao')) return;
global $app;
$log = date('Ymd H:i:s') . ": " . $app->getURI() . "; ";
foreach(dao::$querys as $query) $log .= $query . "; ";
sae_debug($log);
}

View File

@@ -0,0 +1,411 @@
<?php
/*
####################################################################
# Name: The Uniform Server Language System Array 1.1
# Developed By: The Uniform Server Development Team
# Modified Last By: Olajide Olaolorun (empirex)
# Web: http://www.uniformserver.com
####################################################################
*/
# Beta Feature, Currently For Debugging Only
#require_once 'array.php';
$US = array(
'title' => 'Uniform Server',
'apanel' => '管理面板',
'dev-team' => 'The Uniform Server Development Team',
//--------------------------------------------------------------------------------------------
// Source Code
//--------------------------------------------------------------------------------------------
'code-show' => '查看源代码',
'code-source' => '查看源代码',
'code-back' => '关闭查看',
//--------------------------------------------------------------------------------------------
// Navigation
//--------------------------------------------------------------------------------------------
// Basic
'nav-home' => '主页',
'nav-web' => 'Uniform Server Website',
'nav-secure' => '服务器安全性',
'nav-phpinfo' => 'PHP信息',
'nav-cgienv' => 'Perl环境',
'nav-status' => 'Apache运行状态',
'nav-info' => 'Apache信息',
'nav-update' => '检查更新',
// Server Control
'nav-start' => '服务器控制面板',
// Server Control - Service
'nav-uservers' => '卸载服务',
'nav-rapaches' => '重新启动Apache服务',
'nav-rmysqls' => '重新启动MySQL服务',
// Server Control - Standard Program
'nav-sserver' => '关闭所有服务',
'nav-rmysql' => '运行MySQL',
'nav-smysql' => '关闭MySQL',
// 配置s
'nav-config' => '配置',
'nav-aconfig' => 'Apache 配置',
'nav-pconfig' => 'PHP 配置',
'nav-vhost' => '管理虚拟机',
'nav-apsetup' => '管理面板配置',
'nav-psetup' => 'Private Server 配置',
'nav-sslpsetup' => 'Private Secure Server Config',
'nav-mqsetup' => 'MySQL Server 配置',
// Tools Navigation
'nav-tools' => '工具',
'nav-pma' => 'phpMyAdmin',
'nav-elog' => '错误日志查看器',
'nav-u2w' => 'windows到unix转换器',
'nav-smig' => 'Server Migration',
'nav-key' => '服务器私钥和证书生成',
'nav-mysqlrestore' => '重置MySQL密码',
// Plugins Navigation
'nav-plugins' => '插件管理',
'nav-pear' => '安装Pear',
'nav-eaccelerator' => 'eAccelerator控制面板',
// Misc Navigation
'nav-misc' => '其他杂项',
'nav-sup' => '在线支持',
// Documentation
'nav-docs1' => '文档',
'nav-sdoc' => '本机文档',
'nav-docs2' => '在线文档',
'nav-udoc' => '用户指南',
'nav-wiki' => 'WIKI',
'nav-phdoc' => 'PHP文档',
'nav-mydoc' => 'MySQL文档',
'nav-pedoc' => 'Perl文档',
// Languages
'nav-langs' => 'Languages',
//--------------------------------------------------------------------------------------------
// Home
//--------------------------------------------------------------------------------------------
'main-head' => '管理面板'. $us_apanel_version .'',
'main-text' => '
欢迎使用 Uniform Server '. $us_version .'!. <br />
您现在访问的是管理面板通过它你可以控制你的Apache、PHP、MySQL服务。虽然我们一直持续的为它增加新的功能改进并修复Bug但它是稳定并且功能完整的使用起来也非常的简单友好。
<br />
如果发现了Bug请反馈给我们<a href="http://forum.uniformserver.com/" target="_forum">forum</a>.
<br />
<br />
鸣谢:
<br />
<a href="http://www.uniformserver.com/" target="_home">Uniform Server开发团队</a>',
'main-secure' => '系统安全检查列表',
'main-text-0' => '修改管理面板的用户名和密码<a href="apsetup.php">点击这里</a>',
'main-text-1' => 'Change the username/password for the server <a href="psetup.php">点击这里</a>',
'main-text-2' => 'Change the root password for mysql by editing <a href="mqsetup.php">点击这里</a>',
'main-text-3' => 'Run the <a href="security.php">Security Console</a> and see if everything is OK.',
'main-text-4' => 'Change the username/password for the SSL server <a href="sslpsetup.php">点击这里</a>',
//--------------------------------------------------------------------------------------------
// Update
//--------------------------------------------------------------------------------------------
'update-head' => 'Uniform Server Version Check',
'update-check' => 'Checking Version...',
'update-notfound' => '
Version file could not be found on the Uniform Server!
<br />
Or
<br />
The Unifrom Server is off-line!
<br />
Or
<br />
You are not connected to the Internet!
<br />',
'update-true' => '
Installed version of the Uniform Server is the latest one.
<br />
You don\'t need to update it.
<br />',
'update-false' => 'A Newer version of the Uniform Server is available!',
'update-new' => 'New Version',
'update-yours' => 'Installed Version',
'update-get' => 'You can get the newer version from our website by clicking the link below.',
//--------------------------------------------------------------------------------------------
// Server Control - Standard program
//--------------------------------------------------------------------------------------------
'server-stop-head1' => 'Stop Servers',
'server-stop-head2' => 'Stopping servers',
'server-stop-txt1' => 'This script will stop Apache and MySQL servers',
'server-stop-txt2' => 'The Servers are stopping please wait for a beep to confirm!',
'server-stop-txt3' => 'Thank you for using <a href="http://www.uniformserver.com/">The Uniform Server</a>.',
'server-confirm-button' => 'Confirm',
'start-mysql-head1' => 'Start MySQL Server',
'start-mysql-head2' => 'Starting the MySQL server.',
'start-mysql-txt1' => 'This script will start the MySQL server.',
'start-mysql-txt2' => 'MySQL server already running.',
'start-mysql-txt3' => 'The MySQL server was started you can continue using the server.',
'start-mysql-button' => 'Start MySQL Server',
'stop-mysql-head1' => 'Stop MySQL Server',
'stop-mysql-head2' => 'Stopping the MySQL server.',
'stop-mysql-txt1' => 'This script will stop the MySQL server.',
'stop-mysql-txt2' => 'The MySQL server was stopped.',
'stop-mysql-txt3' => 'MySQL server not running.',
'stop-mysql-button' => 'Stop MySQL Server',
//--------------------------------------------------------------------------------------------
// Server Control - Services
//--------------------------------------------------------------------------------------------
'service-apache-head1' => 'Restart Apache Service',
'service-apache-head2' => 'Restarting Apache service',
'service-apache-txt1' => 'This script will restart the Apache service.',
'service-apache-txt2' => 'It will take a some time',
'service-apache-txt3' => 'The Apache service is restarting please wait <br /> Between 2-10 seconds!' ,
'service-apache-txt4' => 'Apanel will reload to reflect any server configuration changes.',
'service-mysql-head1' => 'Restart MySQL Service',
'service-mysql-head2' => 'The MySQL service was restarted.',
'service-mysql-txt1' => 'This script will restart the MySQL service.',
'service-mysql-txt2' => 'It will take some time',
'service-mysql-txt3' => 'The MySQL service was restarted you can continue using the server.',
'service-confirm-button' => 'Confirm',
//--------------------------------------------------------------------------------------------
// Apache 配置
//--------------------------------------------------------------------------------------------
'aconfig-head' => 'Apache 配置',
'aconfig-conf' => 'Configure Apache',
'aconfig-sname' => 'Server Name',
'aconfig-wemail' => 'Server Admin Email',
'aconfig-difiles' => 'Directory Index Files',
'aconfig-ssi' => 'Server Side Includes',
'aconfig-ssig' => 'Server Signature',
'aconfig-listen' => 'Listen',
'aconfig-text-0' => 'something',
'aconfig-text-1' => '
The changes have been successfully saved. <br /> Changes will take effect after server restart!',
'aconfig-save' => 'Save',
'aconfig-module' => 'At the moment PHP is loaded as Apache module.',
'aconfig-cgi' => 'At the moment PHP scripts are executed though Apache CGI interface.',
'aconfig-help' => '?',
//--------------------------------------------------------------------------------------------
// PHP 配置
//--------------------------------------------------------------------------------------------
'pconfig-head' => 'PHP 配置',
'pconfig-conf' => 'Configure PHP',
'pconfig-smode' => 'Safe Mode',
'pconfig-rg' => 'Register Globals',
'pconfig-mtexec' => 'Maximum Script Execute Time (s.)',
'pconfig-mmexec' => 'Maximum Memory Amount (MB)',
'pconfig-ssig' => 'Show PHP In Server Signature',
'pconfig-perror' => 'Print Errors',
'pconfig-mpsize' => 'Maximum Post Size',
'pconfig-musize' => 'Maximum Upload Size',
'pconfig-text-0' => 'something',
'pconfig-text-1' => '
The changes have been successfully saved. <br /> Changes will take effect after server restart!',
'pconfig-save' => 'Save',
'pconfig-module' => 'At the moment PHP is loaded as Apache module.',
'pconfig-cgi' => 'At the moment PHP scripts are executed though Apache CGI interface.',
'pconfig-help' => '?',
//--------------------------------------------------------------------------------------------
// VHost Manager
//--------------------------------------------------------------------------------------------
'vhost-head' => 'Virtual Host',
'vhost-setup' => 'Virtual Host Setup',
'vhost-settings' => 'Virtual Host Settings',
'vhost-text-0' => 'You have',
'vhost-text-1' => 'hosts in your httpd.conf file:',
'vhost-text-2' => 'Error in hosts file:',
'vhost-text-3' => 'All hostnames exist in hosts file!',
'vhost-new' => '
Use this new and cool tool to add more virtual hosts to your server without having to edit
the httpd.conf file yourself.',
'vhost-new-ex' => '(ex. newhost.localhost)',
'vhost-name' => 'Name:',
'vhost-path' => 'Path to DocumentRoot:',
'vhost-path-ex' => '(ex. c:/www/newhost)',
'vhost-opt' => 'Optional additions:',
'vhost-opt-ex' => '(ex. error_log etc.)',
'vhost-dne' => 'does not exist',
'vhost-make' => 'Create VHost',
'vhost-error-1' => 'Error in path to your hosts-file!',
'vhost-error-2' => 'Error in path to your httpd.conf!',
'vhost-text-4' => 'Safe_mode is On, so restart Apache manually!',
'vhost-credit' => 'Script By Sukos',
//--------------------------------------------------------------------------------------------
// Error Log Viewer
//--------------------------------------------------------------------------------------------
'elog-viewer-head1' => 'Error Log Viewer',
'elog-viewer-head2' => 'Viewing Error Log File',
//--------------------------------------------------------------------------------------------
// Win to Unix Converter
//--------------------------------------------------------------------------------------------
'w2u-head1' => 'Windows to Unix Converter',
'w2u-head2' => 'Convert Windows Perl Files',
'w2u-head3' => 'Converted Windows Perl Files',
'w2u-txt1' => 'If you have problems executing your cgi scripts on Unix.<br />
This program will convert cgi scripts from Windows to Unix format Dec(#10#13=>#13).<br>Hex 0D0A to 0A',
'w2u-txt2' => 'Instruction: <br />After execution you can pick up scripts ready for execution
on a Unix machine from the \\cgi-bin-unix\\ directory.<br />',
'w2u-txt3' => 'Files converted: <br />They are located in folder \\cgi-bin-unix\\ ',
'w2u-convert-button' => 'Convert',
//--------------------------------------------------------------------------------------------
// Server Certificate and Key Generation
//--------------------------------------------------------------------------------------------
'cert-head1' => 'Server Certificate and Key Generation',
'cert-head2' => 'Verify Generation',
'cert-head3' => 'Unable to run Certificate and Key Generation.',
'cert-head4' => 'Certificate and Key Generation Complete.',
'cert-txt1' => 'Click on Generate! and follow instructions.',
'cert-txt2' => 'Services are not allowed to interact with the desktop. <br />You need to run this script manually:',
'cert-txt3' => 'Alternatively use UniTray.',
'cert-txt4' => 'Cirtificate location:',
'cert-txt5' => 'Key location:',
'cert-confirm-button' => 'Generate',
//--------------------------------------------------------------------------------------------
// MySQL restore password
//--------------------------------------------------------------------------------------------
'mysql-head1' => 'MySQL restore password',
'mysql-head2' => 'Verify Restore',
'mysql-head3' => 'MySQL password restored.',
'mysql-txt1' => 'Click on Restore! Restore will take several seconds.',
'mysql-txt2' => 'Password restored you can continue using the server..',
'mysql-confirm-button' => 'Restore MySQL Password',
//--------------------------------------------------------------------------------------------
// Server Security Console
//--------------------------------------------------------------------------------------------
'secure1-head' => 'Security Alert!',
'secure1-sub' => 'Possible Attack',
'secure1-text-0' => 'IP ADDRESS is not 127.0.0.1, but',
'secure1-text-1' => 'Note: HTTP_REFERER is',
'secure1-text-2' => 'To disable this warning set $unisecure to 0 in: /home/admin/www/includes/config.inc.php',
//--------------------------------------------------------------------------------------------
// Admin Panel Setup
//--------------------------------------------------------------------------------------------
'apsetup-head' => 'Admin Panel 配置',
'apsetup-sub-0' => 'User Management',
'apsetup-text-0' => 'Setup the username and password for the Admin Panel here. Please note that you might have
to activate this feature in the /home/admin/www/.htaccess file.',
'apsetup-user' => 'Username',
'apsetup-pass' => 'Password',
'apsetup-change' => 'Change',
'apsetup-success' => 'The Admin Panel username/password has been changed to the new values:',
//--------------------------------------------------------------------------------------------
// Private Server Setup
//--------------------------------------------------------------------------------------------
'psetup-head' => 'Private Server 配置',
'psetup-sub-0' => 'User Management',
'psetup-text-0' => 'Setup the username and password for your Private Server here. Please note that you might have
to activate this feature in the /www/.htaccess file.',
'psetup-user' => 'Username',
'psetup-pass' => 'Password',
'psetup-change' => 'Change',
'psetup-success' => 'Your Private Server username/password has been changed to the new values:',
//--------------------------------------------------------------------------------------------
// Private Secure Server Setup (SSL)
//--------------------------------------------------------------------------------------------
'sslpsetup-head' => 'Private Secure Server 配置 (SSL)',
'sslpsetup-sub-0' => 'User Management',
'sslpsetup-text-0' => 'Setup the username and password for your Private Secure Server here. Please note that you might have
to activate this feature in the /ssl/.htaccess file.',
'sslpsetup-user' => 'Username',
'sslpsetup-pass' => 'Password',
'sslpsetup-change' => 'Change',
'sslpsetup-success' => 'Your Private Secure Server username/password has been changed to the new values:',
//--------------------------------------------------------------------------------------------
// MySQL Setup
//--------------------------------------------------------------------------------------------
'mqsetup-head' => 'MySQL Server 配置',
'mqsetup-sub-0' => 'User Management',
'mqsetup-text-0' => 'Setup the MySQL password here. After changing the MySQL password, please note that you <b>
must shutdown the server using the Stop.bat</b> file and then start the server over again.',
'mqsetup-pass' => 'MySQL Password',
'mqsetup-change' => 'Change',
'mqsetup-success' => 'Your MySQL password has been changed to the new value:',
//--------------------------------------------------------------------------------------------
// Server Security Center
//--------------------------------------------------------------------------------------------
'secure-head' => 'Security Center',
'secure-sub-0' => 'User Management Security',
'secure-sub-1' => 'Server Security',
'secure-text-0' => 'This part of the security center will check all user management settings to make sure that
everything is set. It will tell you if something needs to be changed.',
'secure-text-1' => 'SECURITY MSG',
'secure-text-2' => 'STATUS',
'secure-text-3' => 'Admin Panel',
'secure-text-X' => 'If the username/password is still set to root, then you probably need to change this
by clicking the UNSECURE link.',
'secure-text-sslX' => 'Unsecure indicates you do not have a server certificate or key. Create new ones by clicking the UNSECURE link.',
'secure-secure' => 'SECURE',
'secure-unsecure' => 'UNSECURE',
'secure-text-7' => 'If the password is still set to root, then you probably need to change this by clicking the UNSECURE link.',
'secure-text-8' => 'This part of the security center will check and make sure the server settings are appropriate and set corectly.',
'secure-text-9' => 'PHP Safe Mode',
'secure-text-10' => 'This checks to see if PHP is running in SAFE MODE. Now, PHP does not have to run in SAFE MODE, but
if you want the extra security, you can set it by clicking on the UNSECURE link.',
'secure-text-p' => 'Personal Server',
'secure-text-sslp' => 'Personal Secure Server (SSL)',
'secure-text-sslcertp' => 'Server Certificate and Key (SSL)',
'secure-text-s' => 'MySQL Server',
'secure-text-11' => 'Admin Panel Access',
'secure-text-12' => 'Server Access',
'secure-text-12ssl' => 'Server Access (SSL)',
'secure-text-13' => 'While this is another feature that is not throughly important as other features are in place against
outside access to the Admin Panel, this checks to see if your Admin Panel is secured using the Auth method. Please change this
by editing the '.$us_apanel.'/.htaccess file.',
'secure-text-14' => 'If you are running your server in Production Mode, Skip this one. If not and you would like to
add more security to the server by blocking it using the Auth method, then change this in by editing the '.$us_www.'/.htaccess file.',
'secure-text-14ssl' => 'If you are running your server in Production Mode, Skip this one. If not and you would like to
add more security to the server by blocking it using the Auth method, then change this in by editing the '.$us_ssl.'/.htaccess file.',
'secure-view' => 'Local View',
'secure-look' => 'Due to the fact that some PC\'s have a different hostname set rather than localhost, we use the IP method here. This
checks to make sure that you are viewing the Admin Panel (this) from local.',
);
# Beta Feature, Currently For Debugging Only
#array2table($US, true);
?>

View File

@@ -0,0 +1,7 @@
Options +FollowSymLinks +SymLinksIfOwnerMatch
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*)$ /zentao/index.php/$1 [L]
</IfModule>

View File

@@ -0,0 +1,14 @@
使用注意事项:
1. 不能解压缩到含有中文和空格的路径中。
2. 启动:
2.1 双击运行start.exe。 软件会有一个提示,然后缩放到桌面的右下角,为一个蓝色的图标。
2.2 左键单击该图标,然后选择第一个菜单,"启动Apache和MySQL进程"。
2.3 如果想开机自动运行则可以选择“将apache和mysql安装为服务运行”。
3. 访问: http://localhost/zentao/ 管理用户admin密码 123456
如果你下载的88端口的包请使用http://localhost:88/zentao来访问。
4. 数据库的用户名和密码为root root
5. apache的配置文件在usr/local/apache2/conf/httpd.conf
6. mysql的数据库文件在usr/local/mysql/data/zentao
7. zentao的程序文件在home/zentao/
8. 如何备份:将整个禅道目录备份即可。

View File

@@ -0,0 +1,165 @@
[Config]
ID=UniTrayController1
ImageList=menu_icons.dat
ServiceGlyphRunning=2
ServiceGlyphPaused=18
ServiceGlyphStopped=18
;TrayIconAllRunning=9
;TrayIconSomeRunning=10
;TrayIconNoneRunning=11
AboutHeader=UniTray UniServer V5-Nano
AboutVersion=V5.0
;TrayIcon=tray_image_1.dat
TrayIcon=zentao.dat
[AboutText]
UniTray is a small tray icon for the Uniform Server. The main system, Aestan Tray Icon was developed by Onno Broekmans using Borland Delphi for another server and as since then being licensed under the Creative Commons for Public Domain.
UniTray packs most of the functionality that Admin Panel provides into a single Tray Icon! UniTray is fully customisable allowing you to tailor it to your own requirements.
[Variables]
;Type: prompt; Name: PUserName; PromptCaption: "Uniform Server"; PromptText: "Please enter the name of the user whose credentials you want to change/add:"; DefaultValue: "Guest"
; The next line contains the declaration of the %USRoot% variable; it should
; point to the root directory of the Uniform Server package
; Gets the root path as specified on the command line
Type: commandline; Name: top; ParamName: "ustop"
Type: static; Name: USRoot; Value: "%top%"; Flags: ispath
Type: static; Name: LocalRoot; Value: "%top%\usr\local"
Type: static; Name: UsrRoot; Value: "%top%\usr"
Type: static; Name: ServerRoot; Value: "%top%\www"
Type: static; Name: PHP; Value: "%top%\usr\local\php"
Type: static; Name: ServerCon; Value: "%top%\unicon"
Type: static; Name: ServerConMain; Value: "%top%\unicon\main"
Type: static; Name: UniTray; Value: "%top%\unicon\tray_menu"
[Menu.Left.Settings]
AutoLineReduction=no
AutoHotKeys=no
BarVisible=yes
BarPictureHorzAlignment=center
BarPictureOffsetX=0
BarPictureOffsetY=0
BarPicturePicture=menu_image_left.dat
BarPictureTransparent=no
BarPictureVertAlignment=middle
BarBorder=clNone
BarSide=left
BarSpace=0
BarWidth=50
SeparatorsAlignment=center
[Menu.Right.Settings]
AutoLineReduction=no
AutoHotKeys=no
BarVisible=yes
BarPictureHorzAlignment=center
BarPictureOffsetX=0
BarPictureOffsetY=0
BarPicturePicture=menu_image_right.dat
BarPictureTransparent=no
BarPictureVertAlignment=middle
BarBorder=clNone
BarSide=left
BarSpace=0
BarWidth=50
SeparatorsAlignment=center
[DoubleClickAction]
Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %UniTray%\unitray_info.php 1";
;=== LEFT MENU ============
[Menu.Left]
Type: item; Caption: "<22><><EFBFBD><EFBFBD>Apache<68><65>MySQL<51><4C><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %ServerConMain%\start_servers.php 7";ShowCmd: hidden; Glyph: 9
Type: item; Caption: "ֹͣApache<68><65>MySQL<51><4C><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %ServerConMain%\stop_servers.php 7";ShowCmd: hidden; Glyph: 11
Type: separator
Type: item; Caption: "<22><>װApache<68><65>MySQLΪ<4C><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %ServerConMain%\service_install_run.php 7";ShowCmd: hidden; Glyph: 0
Type: item; Caption: "ֹͣApache<68><65>MySQL<51><4C><EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %ServerConMain%\service_stop_uninstall.php 7";ShowCmd: hidden; Glyph: 1
Type: separator
Type: item; Caption: "<22><><EFBFBD><EFBFBD>UniServer<65><72><EFBFBD><EFBFBD>״̬"; Action: multi; Actions: ServerStatus; Glyph: 14
Type: submenu; Caption: "Apache<68><65>MySQL<51>߼<EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD>"; SubMenu: Individual_unicontrol; Glyph: 3
Type: submenu; Caption: "Apache<68><65>MySQL<51><4C>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>־"; SubMenu: ServerInfo; Glyph: 14
Type: submenu; Caption: "Apache<68><65>MySQL<51><4C>PHP<48><50><EFBFBD><EFBFBD>"; SubMenu: Advanced; Glyph: 7
Type: separator
Type: item; Caption: "<22><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %UniTray%\unitray_info.php 8";ShowCmd: hidden; Glyph: 4
Type: item; Caption: "<22><><EFBFBD><EFBFBD><EFBFBD>ٷ<EFBFBD><D9B7><EFBFBD>վ"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %UniTray%\unitray_info.php 9";ShowCmd: hidden; Glyph: 4
Type: separator
Type: item; Caption: "<22><><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %UniTray%\unitray_info.php 1";ShowCmd: hidden; Glyph: 4
Type: item; Caption: "<22><><EFBFBD><EFBFBD>phpMyAdmin"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %UniTray%\unitray_info.php 2";ShowCmd: hidden; Glyph: 4
Type: item; Caption: "<22><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ҳ"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %UniTray%\unitray_info.php 3";ShowCmd: hidden; Glyph: 4
Type: separator
Type: item; Caption: "<22><><EFBFBD>ؼ<EFBFBD><D8BC>ز˵<D8B2>"; Action: readconfig; Glyph: 15
Type: item; Caption: "UniServer<65><72><EFBFBD><EFBFBD>"; Action: run; FileName: "%ServerCon%\docs\Run.bat"; ShowCmd: hidden; Glyph: 18
Type: item; Caption: "<22><><EFBFBD><EFBFBD>UniServer"; Action: about; Glyph: 14
Type: separator
Type: item; Caption: "<22>˳<EFBFBD>"; Action: exit; Glyph: 16
[Individual_unicontrol]
Type: item; Caption: "<22><><EFBFBD><EFBFBD>Apache<68><65><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%PHP%\php-win.exe"; Parameters: " -n %ServerConMain%\start_servers.php 1"; Glyph: 9
Type: item; Caption: "ֹͣApache<68><65><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%PHP%\php-win.exe"; Parameters: " -n %ServerConMain%\stop_servers.php 1"; Glyph: 11
Type: separator
Type: item; Caption: "<22><><EFBFBD><EFBFBD>MySQL<51><4C><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%PHP%\php-win.exe"; Parameters: " -n %ServerConMain%\start_servers.php 2"; Glyph: 9
Type: item; Caption: "ֹͣMySQL<51><4C><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%PHP%\php-win.exe"; Parameters: " -n %ServerConMain%\stop_servers.php 2"; Glyph: 11
Type: separator
Type: item; Caption: "<22><>װApacheΪ<65><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %ServerConMain%\service_install_run.php 1"; Glyph: 0
Type: item; Caption: "ֹͣApache<68><65><EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %ServerConMain%\service_stop_uninstall.php 1"; Glyph: 1
Type: separator
Type: item; Caption: "<22><>װMySQLΪ<4C><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %ServerConMain%\service_install_run.php 2"; Glyph: 0
Type: item; Caption: "ֹͣMySQL<51><4C><EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %ServerConMain%\service_stop_uninstall.php 2"; Glyph: 1
;=== RIGHT MENU ============
[Menu.Right]
Type: item; Caption: "<22>˳<EFBFBD>"; Action: exit; Glyph: 16
;=== COMMON LEFT RIGHT =======
[Advanced]
Type: item; Caption: "<22><><EFBFBD><EFBFBD>Apache<68><65><EFBFBD><EFBFBD>"; Action: multi; Actions: ApacheSyntaxCheck; Glyph: 14
Type: item; Caption: "<22>޸<EFBFBD>Apache<68><65><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%Windows%\Notepad.exe"; Parameters: "%LocalRoot%\apache2\conf\httpd.conf"; Glyph: 7
Type: separator
Type: item; Caption: "<22>ָ<EFBFBD>MySQL<51><4C><EFBFBD><EFBFBD>"; Action: run; FileName: "%ServerCon%\restore_mysql_password\Run_restore.bat"; Glyph: 9
Type: item; Caption: "<22>޸<EFBFBD>MySQL<51><4C><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%Windows%\Notepad.exe"; Parameters: "%LocalRoot%\mysql\my.ini"; Glyph: 7
Type: separator
Type: item; Caption: "<22>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>php.ini"; Action: shellexecute; FileName: "%Windows%\Notepad.exe"; Parameters: "%LocalRoot%\php\php.ini_production_nano"; Glyph: 7
Type: item; Caption: "<22>޸Ŀ<DEB8><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>php.ini"; Action: shellexecute; FileName: "%Windows%\Notepad.exe"; Parameters: "%LocalRoot%\php\php.ini_delvelopment_nano"; Glyph: 7
Type: separator
Type: item; Caption: "<22>л<EFBFBD>php<68><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%ServerCon%\php_dev_production\Switch_production.bat"; Parameters: " pro"; Glyph: 9
Type: item; Caption: "<22>л<EFBFBD>php<68><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; Action: shellexecute; FileName: "%ServerCon%\php_dev_production\Switch_Development.bat"; Parameters: " dev"; Glyph: 9
;Type: separator
;Type: item; Caption: "Start Portable Cron"; Action: shellexecute; FileName: "%PHP%\php-win.exe"; Parameters: " -n %ServerConMain%\start_servers.php 16"; Glyph: 9
;Type: item; Caption: "Stop Portable Cron"; Action: shellexecute; FileName: "%PHP%\php-win.exe"; Parameters: " -n %ServerConMain%\stop_servers.php 16"; Glyph: 11
; Server information and Logs
[ServerInfo]
Type: item; Caption: "Apache<68><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %UniTray%\unitray_info.php 5";ShowCmd: hidden; Glyph: 4
Type: item; Caption: "Apache<68><65><EFBFBD><EFBFBD>״̬"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %UniTray%\unitray_info.php 6";ShowCmd: hidden; Glyph: 4
Type: item; Caption: "PHP<48><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %UniTray%\unitray_info.php 7";ShowCmd: hidden; Glyph: 4
Type: separator
Type: item; Caption: "Apache<68><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־"; Action: shellexecute; FileName: "%Windows%\Notepad.exe"; Parameters: "%LocalRoot%\apache2\logs\error.log"; Glyph: 18
Type: item; Caption: "Apache<68><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־"; Action: shellexecute; FileName: "%Windows%\Notepad.exe"; Parameters: "%LocalRoot%\apache2\logs\access.log"; Glyph: 18
;Type: separator
;Type: item; Caption: "Apache SSL Error Log"; Action: shellexecute; FileName: "%Windows%\Notepad.exe"; Parameters: "%LocalRoot%\apache2\logs\error_ssl.log"; Glyph: 18
;Type: item; Caption: "Apache SSL Access Log"; Action: shellexecute; FileName: "%Windows%\Notepad.exe"; Parameters: "%LocalRoot%\apache2\logs\access_ssl.log"; Glyph: 18
Type: separator
Type: item; Caption: "MySQL<51><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־"; Action: shellexecute; FileName: "%Windows%\Notepad.exe"; Parameters: "%LocalRoot%\mysql\data\mysql.err"; Glyph: 18
[ServerStatus]
Action: run; FileName: "%ServerConMain%\server_status.bat"
[ApacheSyntaxCheck]
Action: run; FileName: "%ServerConMain%\apache_syntax_check.bat"

View File

@@ -0,0 +1,98 @@
<?php
/*
###############################################################################
# Name: unitray_info.php
# Developed By: The Uniform Server Development Team
# Modified Last By: Mike Gleaves (Ric)
# Unitray Support file
# Displays server information. Ports read from configuration files
# V1.0 3-12-2009
###############################################################################
*/
//error_reporting(0); // Disable PHP errors and warnings
// Comment to Enable for testing
chdir(dirname(__FILE__)); // Change wd to this files location
include_once "../main/includes/config.inc.php";
include_once "../main/includes/functions.php";
run_location_tracker(); // Have servers moved if moved update configuration
print"\n";
//=== If no parameters passed use defaults from config.inc.php
if($argc == 2){ // Was a parameter passed
$information = $argv[1] ; // yes:
}
else{
exit; // no: Give up
}
$mysql_port = get_mysql_port();
$apache_port = get_apache_port();
$ssl_port = get_apache_ssl_port();
//=== Display Admin Panel in browser ==========================================
if($information == 1){
$command = "start http://localhost:$apache_port/apanel/"; // display index page
exec($command,$dummy,$return); // run command
exit;
}
//=== Display phpMyAdmin in browser ==========================================
if($information == 2){
$command = "start http://localhost:$apache_port/apanel/phpmyadmin/"; // display index page
exec($command,$dummy,$return); // run command
exit;
}
//=== Display WWW Root in browser ==============================================
if($information == 3){
$command = "start http://localhost:$apache_port/"; // display index page
exec($command,$dummy,$return); // run command
exit;
}
//=== Display SSL Root in browser ==============================================
if($information == 4){
$command = "start https://localhost:$ssl_port/"; // display index page
exec($command,$dummy,$return); // run command
exit;
}
//=== Display Apache Server Information in browser ============================
if($information == 5){
$command = "start http://localhost:$apache_port/server-info"; // display index page
exec($command,$dummy,$return); // run command
exit;
}
//=== Display Apache Server Status in browser =================================
if($information == 6){
$command = "start http://localhost:$apache_port/server-status"; // display index page
exec($command,$dummy,$return); // run command
exit;
}
//=== Display PHP Info in browser =================================
if($information == 7){
$command = "start http://localhost:$apache_port/apanel/phpinfo.php"; // display index page
exec($command,$dummy,$return); // run command
exit;
}
//=== Display ZenTao browser =================================
if($information == 8){
$command = "start http://localhost:$apache_port/zentao/"; //
exec($command,$dummy,$return); // run command
exit;
}
//=== Display ZenTao site browser =================================
if($information == 9){
$command = "start http://www.ZenTaoPMS.com/"; //
exec($command,$dummy,$return); // run command
exit;
}
exit;
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
@echo off
if "%OS%" == "Windows_NT" goto WinNT
:Win9X
echo Don't be stupid! Win9x don't know Services
echo Please use apache_start.bat instead
goto exit
:WinNT
echo Installing Apache2.2 as an Service
apache\bin\httpd -k install -n apachezt
echo Now we Start Apache
net start apachezt
:exit
pause

View File

@@ -0,0 +1,18 @@
@echo off
if "%OS%" == "Windows_NT" goto WinNT
:Win9X
echo Don't be stupid! Win9x don't know Services
echo Please use apache_stop.bat instead
goto exit
:WinNT
echo Are you sure you wan't this?
echo now stopping Apache2.2 when it runs
net stop apachezt
echo Time to say good bye to apache2.2 :(
apache\bin\httpd -k uninstall -n apachezt
:exit
pause

View File

@@ -0,0 +1,336 @@
<?php
$buildDir = dirname(__FILE__);
chdir($buildDir);
/* include the file class. */
include '../../../lib/file/file.class.php';
$file = new file();
/* set xampp package and 7-zip command. */
if(count($argv) != 3) die("please specify the package directory and 7z command.\n");
$xampp = $argv[1] . '/xampp.7z';
$sqlbuddy = $argv[1] . '/sqlbuddy.zip';
$sevenz = $argv[2];
chdir('c:/');
/* extract the xampp package. */
echo "extracting xampp package ...";
echo `$sevenz x -y $xampp`;
/* rm useless files. */
error_reporting(E_ALL);
$file->removeDir('./xampp/anonymous');
$file->removeDir('./xampp/cgi-bin');
$file->removeDir('./xampp/contrib');
$file->removeDir('./xampp/contrib');
$file->removeDir('./xampp/install');
$file->removeDir('./xampp/nsi');
$file->removeDir('./xampp/perl');
$file->removeDir('./xampp/phpmyadmin');
$file->removeDir('./xampp/sendmail');
$file->removeDir('./xampp/security');
$file->removeDir('./xampp/src');
$file->batchRemoveFile('./xampp/tmp/*');
$file->removeDir('./xampp/webdav');
$file->removeFile('./xampp/setup_xampp.bat');
$file->batchRemoveFile('./xampp/*.txt');
/* Process apache module. */
$file->batchRemoveFile('./xampp/apache/*.txt');
$file->batchRemoveFile('./xampp/apache/*.bat');
$file->rename('./xampp/apache/modules', './xampp/apache/modulesold');
$file->mkdir('./xampp/apache/modules');
$file->copyFile('./xampp/apache/modulesold/mod_auth_basic.so', './xampp/apache/modules/mod_auth_basic.so');
$file->copyFile('./xampp/apache/modulesold/mod_mime_magic.so', './xampp/apache/modules/mod_mime_magic.so');
$file->copyFile('./xampp/apache/modulesold/mod_mime.so', './xampp/apache/modules/mod_mime.so');
$file->copyFile('./xampp/apache/modulesold/mod_expires.so', './xampp/apache/modules/mod_expires.so');
$file->copyFile('./xampp/apache/modulesold/mod_env.so', './xampp/apache/modules/mod_env.so');
$file->copyFile('./xampp/apache/modulesold/mod_rewrite.so', './xampp/apache/modules/mod_rewrite.so');
$file->copyFile('./xampp/apache/modulesold/mod_vhost_alias.so','./xampp/apache/modules/mod_vhost_alias.so');
$file->copyFile('./xampp/apache/modulesold/mod_setenvif.so', './xampp/apache/modules/mod_setenvif.so');
$file->copyFile('./xampp/apache/modulesold/mod_autoindex.so', './xampp/apache/modules/mod_autoindex.so');
$file->copyFile('./xampp/apache/modulesold/mod_authz_user.so', './xampp/apache/modules/mod_authz_user.so');
$file->copyFile('./xampp/apache/modulesold/mod_authz_host.so', './xampp/apache/modules/mod_authz_host.so');
$file->copyFile('./xampp/apache/modulesold/mod_alias.so', './xampp/apache/modules/mod_alias.so');
$file->copyFile('./xampp/apache/modulesold/mod_dir.so', './xampp/apache/modules/mod_dir.so');
$file->copyFile('./xampp/apache/modulesold/mod_deflate.so', './xampp/apache/modules/mod_deflate.so');
$file->removeDir('./xampp/apache/modulesold');
/* Remove apache's error, icons, include, lib, logs directory. */
$file->removeDir('./xampp/apache/error');
$file->removeDir('./xampp/apache/icons');
$file->removeDir('./xampp/apache/include');
$file->removeDir('./xampp/apache/lib');
$file->batchRemoveFile('./xampp/apache/logs/*.log');
$file->rename('./xampp/apache/bin', './xampp/apache/binold');
$file->mkdir('./xampp/apache/bin');
$file->copyFile('./xampp/apache/binold/htpasswd.exe', './xampp/apache/bin/htpasswd.exe');
$file->copyFile('./xampp/apache/binold/httpd.exe', './xampp/apache/bin/httpd.exe');
$file->copyFile('./xampp/apache/binold/libapr-1.dll', './xampp/apache/bin/libapr-1.dll');
$file->copyFile('./xampp/apache/binold/libapriconv-1.dll', './xampp/apache/bin/libapriconv-1.dll');
$file->copyFile('./xampp/apache/binold/libaprutil-1.dll', './xampp/apache/bin/libaprutil-1.dll');
$file->copyFile('./xampp/apache/binold/libhttpd.dll', './xampp/apache/bin/libhttpd.dll');
$file->copyFile('./xampp/apache/binold/zlib1.dll', './xampp/apache/bin/zlib1.dll');
$file->copyFile('./xampp/apache/binold/pv.exe', './xampp/apache/bin/pv.exe');
$file->copyFile('./xampp/apache/binold/libeay32.dll', './xampp/apache/bin/libeay32.dll');
$file->copyFile('./xampp/apache/binold/ssleay32.dll', './xampp/apache/bin/ssleay32.dll');
$file->removeDir('./xampp/apache/binold');
/* Process the apache's config file. */
$httpdConf = file_get_contents('./xampp/apache/conf/httpd.conf');
$httpdConf = str_replace('LoadModule actions_module modules/mod_actions.so', '#LoadModule actions_module modules/mod_actions.so', $httpdConf);
$httpdConf = str_replace('LoadModule actions_module modules/mod_actions.so', '#LoadModule actions_module modules/mod_actions.so', $httpdConf);
$httpdConf = str_replace('LoadModule actions_module modules/mod_actions.so', '#LoadModule actions_module modules/mod_actions.so', $httpdConf);
$httpdConf = str_replace('LoadModule asis_module modules/mod_asis.so', '#LoadModule asis_module modules/mod_asis.so', $httpdConf);
$httpdConf = str_replace('LoadModule auth_digest_module modules/mod_auth_digest.so', '#LoadModule auth_digest_module modules/mod_auth_digest.so', $httpdConf);
$httpdConf = str_replace('LoadModule authn_default_module modules/mod_authn_default.so', '#LoadModule authn_default_module modules/mod_authn_default.so', $httpdConf);
$httpdConf = str_replace('LoadModule authn_file_module modules/mod_authn_file.so', '#LoadModule authn_file_module modules/mod_authn_file.so', $httpdConf);
$httpdConf = str_replace('LoadModule authz_default_module modules/mod_authz_default.so', '#LoadModule authz_default_module modules/mod_authz_default.so', $httpdConf);
$httpdConf = file_get_contents('./xampp/apache/conf/httpd.conf');
$httpdConf = str_replace('LoadModule actions_module modules/mod_actions.so', '#LoadModule actions_module modules/mod_actions.so', $httpdConf);
$httpdConf = str_replace('LoadModule actions_module modules/mod_actions.so', '#LoadModule actions_module modules/mod_actions.so', $httpdConf);
$httpdConf = str_replace('LoadModule actions_module modules/mod_actions.so', '#LoadModule actions_module modules/mod_actions.so', $httpdConf);
$httpdConf = str_replace('LoadModule asis_module modules/mod_asis.so', '#LoadModule asis_module modules/mod_asis.so', $httpdConf);
$httpdConf = str_replace('LoadModule auth_digest_module modules/mod_auth_digest.so', '#LoadModule auth_digest_module modules/mod_auth_digest.so', $httpdConf);
$httpdConf = str_replace('LoadModule authn_default_module modules/mod_authn_default.so', '#LoadModule authn_default_module modules/mod_authn_default.so', $httpdConf);
$httpdConf = str_replace('LoadModule authn_file_module modules/mod_authn_file.so', '#LoadModule authn_file_module modules/mod_authn_file.so', $httpdConf);
$httpdConf = str_replace('LoadModule authz_default_module modules/mod_authz_default.so', '#LoadModule authz_default_module modules/mod_authz_default.so', $httpdConf);
$httpdConf = str_replace('LoadModule authz_groupfile_module modules/mod_authz_groupfile.so','#LoadModule authz_groupfile_module modules/mod_authz_groupfile.so', $httpdConf);
$httpdConf = str_replace('LoadModule cgi_module modules/mod_cgi.so', '#LoadModule cgi_module modules/mod_cgi.so', $httpdConf);
$httpdConf = str_replace('LoadModule dav_lock_module modules/mod_dav_lock.so', '#LoadModule dav_lock_module modules/mod_dav_lock.so', $httpdConf);
$httpdConf = str_replace('LoadModule headers_module modules/mod_headers.so', '#LoadModule headers_module modules/mod_headers.so', $httpdConf);
$httpdConf = str_replace('LoadModule include_module modules/mod_include.so', '#LoadModule include_module modules/mod_include.so', $httpdConf);
$httpdConf = str_replace('LoadModule info_module modules/mod_info.so', '#LoadModule info_module modules/mod_info.so', $httpdConf);
$httpdConf = str_replace('LoadModule isapi_module modules/mod_isapi.so', '#LoadModule isapi_module modules/mod_isapi.so', $httpdConf);
$httpdConf = str_replace('LoadModule log_config_module modules/mod_log_config.so', '#LoadModule log_config_module modules/mod_log_config.so', $httpdConf);
$httpdConf = str_replace('LoadModule negotiation_module modules/mod_negotiation.so', '#LoadModule negotiation_module modules/mod_negotiation.so', $httpdConf);
$httpdConf = str_replace('LoadModule proxy_module modules/mod_proxy.so', '#LoadModule proxy_module modules/mod_proxy.so', $httpdConf);
$httpdConf = str_replace('LoadModule proxy_ajp_module modules/mod_proxy_ajp.so', '#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so', $httpdConf);
$httpdConf = str_replace('LoadModule ssl_module modules/mod_ssl.so', '#LoadModule ssl_module modules/mod_ssl.so', $httpdConf);
$httpdConf = str_replace('LoadModule status_module modules/mod_status.so', '#LoadModule status_module modules/mod_status.so', $httpdConf);
$httpdConf = str_replace('#LoadModule deflate_module modules/mod_deflate.so', 'LoadModule deflate_module modules/mod_deflate.so', $httpdConf);
$httpdConf = str_replace('#LoadModule expires_module modules/mod_expires.so', 'LoadModule expires_module modules/mod_expires.so', $httpdConf);
$httpdConf = str_replace('Include "conf/extra/httpd-perl.conf"', '#Include "conf/extra/httpd-perl.conf"', $httpdConf);
$httpdConf = str_replace('Include "conf/extra/httpd-multilang-errordoc.conf"', '#Include "conf/extra/httpd-multilang-errordoc.conf"', $httpdConf);
$httpdConf = str_replace('Include "conf/extra/httpd-userdir.conf"', '#Include "conf/extra/httpd-userdir.conf"', $httpdConf);
$httpdConf = str_replace('Include "conf/extra/httpd-info.conf"', '#Include "conf/extra/httpd-info.conf"', $httpdConf);
$httpdConf = str_replace('Include "conf/extra/httpd-proxy.conf"', '#Include "conf/extra/httpd-proxy.conf"', $httpdConf);
$httpdConf = str_replace('Include "conf/extra/httpd-ssl.conf"', '#Include "conf/extra/httpd-ssl.conf"', $httpdConf);
$httpdConf = explode("\n", $httpdConf);
foreach($httpdConf as $key => $line)
{
$line = trim($line);
if(empty($line) or substr($line, 0, 1) == '#') unset($httpdConf[$key]);
}
$httpdConf = join("\n", $httpdConf);
file_put_contents('./xampp/apache/conf/httpd.conf', str_replace('88', '80', $httpdConf));
file_put_contents('./xampp/apache/conf/httpd80.conf', str_replace('88', '80', $httpdConf));
file_put_contents('./xampp/apache/conf/httpd88.conf', str_replace('80', '88', $httpdConf));
/* Move .htacces to .ztaccess. */
$httpdDefaultConfig = './xampp/apache/conf/extra/httpd-default.conf';
file_put_contents($httpdDefaultConfig, str_replace('.htaccess', '.ztaccess', file_get_contents($httpdDefaultConfig)));
/* Remove useless config files. */
$file->removeDir('./xampp/apache/conf/ssl.crl');
$file->removeDir('./xampp/apache/conf/ssl.crt');
$file->removeDir('./xampp/apache/conf/ssl.csr');
$file->removeDir('./xampp/apache/conf/ssl.key');
$file->removeFile('./xampp/apache/conf/extra/httpd-ajp.conf');
$file->removeFile('./xampp/apache/conf/extra/httpd-proxy.conf');
$file->removeFile('./xampp/apache/conf/extra/httpd-perl.conf');
$file->removeFile('./xampp/apache/conf/extra/httpd-dav.conf');
$file->removeFile('./xampp/apache/conf/extra/httpd-info.conf');
$file->removeFile('./xampp/apache/conf/extra/httpd-multilang-errordoc.conf');
$file->removeFile('./xampp/apache/conf/extra/httpd-ssl.conf');
$file->removeFile('./xampp/apache/conf/extra/httpd-userdir.conf');
/* Empty the htdocs directory. */
$file->removeDir('./xampp/htdocs');
$file->mkdir('./xampp/htdocs');
/* Process mysql. */
$file->removeDir('./xampp/mysql/backup');
$file->removeDir('./xampp/mysql/include');
$file->removeDir('./xampp/mysql/lib');
$file->removeDir('./xampp/mysql/scripts');
$file->removeDir('./xampp/mysql/sql-bench');
/* Process mysql's bin directory. */
$file->rename('./xampp/mysql/bin', './xampp/mysql/binold');
$file->mkdir('./xampp/mysql/bin');
$file->copyFile('./xampp/mysql/binold/mysql.exe', './xampp/mysql/bin/mysql.exe');
$file->copyFile('./xampp/mysql/binold/mysqld.exe', './xampp/mysql/bin/mysqld.exe');
$file->copyFile('./xampp/mysql/binold/mysqldump.exe', './xampp/mysql/bin/mysqldump.exe');
$file->copyFile('./xampp/mysql/binold/myisamchk.exe', './xampp/mysql/bin/myisamchk.exe');
$file->copyFile('./xampp/mysql/binold/my.ini', './xampp/mysql/bin/my.ini');
$file->removeDir('./xampp/mysql/binold');
/* Process mysql's share diectory. */
$file->rename('./xampp/mysql/share', './xampp/mysql/shareold');
$file->mkdir('./xampp/mysql/share');
$file->mkdir('./xampp/mysql/share/english');
$file->copyFile('./xampp/mysql/shareold/english/errmsg.sys', './xampp/mysql/share/english/errmsg.sys');
$file->removeDir('../xampp/mysql/shareold');
/* Process mysql's data directory. */
$file->removeDir('./xampp/mysql/data/phpmyadmin');
$file->removeDir('./xampp/mysql/data/test');
$file->removeDir('./xampp/mysql/data/webauth');
$file->removeDir('./xampp/mysql/data/cdcol');
$file->batchRemoveFile('./xampp/mysql/data/ib*');
$file->batchRemoveFile('./xampp/mysql/data/mysql*');
/* Remove mysql's useless config files. */
$file->batchRemoveFile('./xampp/mysql/*.ini');
$file->removeFile('./xampp/mysql/README');
$file->removeFile('./xampp/mysql/COPYING');
/* Process mysql's conf file. */
$myConf = file_get_contents('./xampp/mysql/bin/my.ini');
$myConf = str_replace('#bind-address="127.0.0.1"', 'bind-address="127.0.0.1"', $myConf);
$myConf = str_replace('#skip-innodb', "default-storage-engine=MyISAM\nskip-innodb\n", $myConf);
$myConf = explode("\n", $myConf);
foreach($myConf as $key => $line)
{
$line = trim($line);
if(empty($line) or substr($line, 0, 1) == '#') unset($myConf[$key]);
if(stripos($line, 'innodb') === 0) unset($myConf[$key]);
}
$myConf = join("\n", $myConf);
$myConf = str_replace('
', '', $myConf);
file_put_contents('./xampp/mysql/bin/my.ini', str_replace('3308', '3306', $myConf));
file_put_contents('./xampp/mysql/bin/my3306.ini', str_replace('3308', '3306', $myConf));
file_put_contents('./xampp/mysql/bin/my3308.ini', str_replace('3306', '3308', $myConf));
/* Processing php. */
$file->removeDir('./xampp/php/cfg');
$file->removeDir('./xampp/php/data');
$file->removeDir('./xampp/php/DB');
$file->removeDir('./xampp/php/dev');
$file->removeDir('./xampp/php/docs');
$file->removeDir('./xampp/php/PEAR');
$file->removeDir('./xampp/php/tests');
$file->removeDir('./xampp/php/Text');
$file->removeDir('./xampp/php/tmp');
$file->removeDir('./xampp/php/www');
$file->batchRemoveFile('./xampp/php/dbunit*');
$file->batchRemoveFile('./xampp/php/*.bat');
$file->batchRemoveFile('./xampp/php/*.txt');
$file->batchRemoveFile('./xampp/php/php.ini-*');
$file->batchRemoveFile('./xampp/php/*.reg');
$file->batchRemoveFile('./xampp/php/pci*');
$file->batchRemoveFile('./xampp/php/*.phar');
$file->batchRemoveFile('./xampp/php/php-*.exe');
$file->batchRemoveFile('./xampp/php/phpcov');
$file->batchRemoveFile('./xampp/php/phptok');
$file->batchRemoveFile('./xampp/php/phpunit');
$file->batchRemoveFile('./xampp/php/*.php');
$file->rename('./xampp/php/php5apache2_2.dll', './xampp/php/php5apache2_2.bak');
$file->rename('./xampp/php/php5ts.dll', './xampp/php/php5ts.bak');
$file->rename('./xampp/php/ssleay32.dll', './xampp/php/ssleay32.dll.bak');
$file->rename('./xampp/php/libeay32.dll', './xampp/php/libeay32.dll.bak');
$file->rename('./xampp/php/libsasl.dll', './xampp/php/libsasl.dll.bak');
$file->batchRemoveFile('./xampp/php/*.dll');
$file->rename('./xampp/php/php5apache2_2.bak', './xampp/php/php5apache2_2.dll');
$file->rename('./xampp/php/php5ts.bak', './xampp/php/php5ts.dll');
$file->rename('./xampp/php/ssleay32.dll.bak', './xampp/php/ssleay32.dll');
$file->rename('./xampp/php/libeay32.dll.bak', './xampp/php/libeay32.dll');
$file->rename('./xampp/php/libsasl.dll.bak', './xampp/apache/bin/libsasl.dll');
/* Process php ini file. */
$phpConfig = file_get_contents('./xampp/php/php.ini');
$phpConfig = str_replace('extension=php_curl.dll',';extension=php_curl.dll', $phpConfig);
$phpConfig = str_replace('extension=php_exif.dll',';extension=php_exif.dll', $phpConfig);
$phpConfig = str_replace('extension=php_gettext.dll',';extension=php_gettext.dll', $phpConfig);
$phpConfig = str_replace('extension=php_pdo_odbc.dll',';extension=php_pdo_odbc.dll', $phpConfig);
$phpConfig = str_replace('extension=php_pdo_sqlite.dll',';extension=php_pdo_sqlite.dll', $phpConfig);
$phpConfig = str_replace('extension=php_soap.dll',';extension=php_soap.dll', $phpConfig);
$phpConfig = str_replace('extension=php_sqlite.dll',';extension=php_sqlite.dll', $phpConfig);
$phpConfig = str_replace('extension=php_sqlite3.dll','extension=php_ldap.dll', $phpConfig); // load ldap extension.
$phpConfig = str_replace('extension=php_xmlrpc.dll','extension=php_openssl.dll', $phpConfig); // load openssl extension.
/* Remove empty and comment lines. */
$phpConfig = explode("\n", $phpConfig);
foreach($phpConfig as $key => $line)
{
$line = trim($line);
if(empty($line)) unset($phpConfig[$key]);
if(substr($line, 0, 1) == ';') unset($phpConfig[$key]);
if(stripos($line, 'odbc') !== false) unset($phpConfig[$key]);
if(stripos($line, 'interbase') !== false) unset($phpConfig[$key]);
if(stripos($line, 'ibase') !== false) unset($phpConfig[$key]);
if(stripos($line, 'oci8') !== false) unset($phpConfig[$key]);
if(stripos($line, 'postgresql') !== false) unset($phpConfig[$key]);
if(stripos($line, 'pgsql') !== false) unset($phpConfig[$key]);
if(stripos($line, 'sybase') !== false) unset($phpConfig[$key]);
if(stripos($line, 'sybct') !== false) unset($phpConfig[$key]);
if(stripos($line, 'mssql') !== false) unset($phpConfig[$key]);
if(stripos($line, 'soap') !== false) unset($phpConfig[$key]);
if(stripos($line, 'eaccelerator') !== false) unset($phpConfig[$key]);
if(stripos($line, 'xdebug') !== false) unset($phpConfig[$key]);
}
$phpConfig = join("\n", $phpConfig);
$phpConfig = 'zend_extension = "\xampp\php\ext\ioncube_loader_win_5.3.dll"' . "\n" . $phpConfig;
file_put_contents('./xampp/php/php.ini', str_replace('
', '', $phpConfig));
/* Process php's ext directory. */
$file->rename('./xampp/php/ext', './xampp/php/extold');
$file->mkdir('./xampp/php/ext');
$file->copyFile('./xampp/php/extold/php_bz2.dll', './xampp/php/ext/php_bz2.dll');
$file->copyFile('./xampp/php/extold/php_gd2.dll', './xampp/php/ext/php_gd2.dll');
$file->copyFile('./xampp/php/extold/php_imap.dll', './xampp/php/ext/php_imap.dll');
$file->copyFile('./xampp/php/extold/php_mbstring.dll', './xampp/php/ext/php_mbstring.dll');
$file->copyFile('./xampp/php/extold/php_mysql.dll', './xampp/php/ext/php_mysql.dll');
$file->copyFile('./xampp/php/extold/php_mysqli.dll', './xampp/php/ext/php_mysqli.dll');
$file->copyFile('./xampp/php/extold/php_pdo_mysql.dll', './xampp/php/ext/php_pdo_mysql.dll');
$file->copyFile('./xampp/php/extold/php_sockets.dll', './xampp/php/ext/php_sockets.dll');
$file->copyFile('./xampp/php/extold/php_openssl.dll', './xampp/php/ext/php_openssl.dll');
$file->copyFile('./xampp/php/extold/php_ldap.dll', './xampp/php/ext/php_ldap.dll');
$file->removeDir('./xampp/php/extold');
/* Process sqlbuddy. */
if(!is_dir('./xampp/admin/')) $file->mkdir('./xampp/admin/');
if(!is_dir('./xampp/admin/sqlbuddy'))
{
echo `$sevenz x -y $sqlbuddy`;
$file->rename('./sqlbuddy', './xampp/admin/sqlbuddy');
$file->copyFile($buildDir . '/sqlbuddyconfig.php', './xampp/admin/sqlbuddy/config.php');
}
/* Process control panel. */
if(file_exists('./xampp/xampp-control.exe')) $file->rename('./xampp/xampp-control.exe', './xampp/zentaoamp-control-en.exe');
$file->copyFile($buildDir . '/zentaoamp.exe', './xampp/zentaoamp-control-cn.exe');
$file->batchRemoveFile('./xampp/xampp_s*');
/* Copy index.php. */
$file->copyFile($buildDir . '/index.php', './xampp/htdocs/index.php');
/* Copy zentao.conf. */
$file->copyFile($buildDir . '/zentao.conf', './xampp/apache/conf/extra/httpd-xampp.conf');
/* Copy ioncube loader. */
$file->copyFile($buildDir . '/ioncube_loader_win_5.3.dll', './xampp/php/ext/ioncube_loader_win_5.3.dll');
/* Copy serive bat file. */
$file->copyFile($buildDir . '/apache_installservice.bat', './xampp/apache_installservice.bat');
$file->copyFile($buildDir . '/apache_uninstallservice.bat', './xampp/apache_uninstallservice.bat');
$file->copyFile($buildDir . '/mysql_installservice.bat', './xampp/mysql_installservice.bat');
$file->copyFile($buildDir . '/mysql_uninstallservice.bat', './xampp/mysql_uninstallservice.bat');
/* Copy the src of control panel and readme files. */
$file->mkdir('./xampp/source');

View File

@@ -0,0 +1,83 @@
<?php
error_reporting(0);
$config->langs['cn'] = '中文简体';
$config->langs['en'] = 'EN';
$lang->cn->title = '欢迎使用禅道集成运行环境!';
$lang->cn->poweredBy = "由<a href='http://www.apachefriends.org/' target='_blank'>xampp</a>精简而来";
$lang->cn->links['zentao']['link'] = '/zentao/';
$lang->cn->links['zentao']['text'] = '访问禅道';
$lang->cn->links['zentao']['target'] = '_self';
$lang->cn->links['official']['link'] = 'http://www.zentao.net/';
$lang->cn->links['official']['text'] = '禅道官网';
$lang->cn->links['official']['target'] = '_blank';
$lang->cn->links['sqlbudyy']['link'] = '/sqlbuddy/';
$lang->cn->links['sqlbudyy']['text'] = '数据库管理';
$lang->cn->links['sqlbudyy']['target'] = '_blank';
$lang->cn->links['phpinfo']['link'] = '?mode=phpinfo';
$lang->cn->links['phpinfo']['text'] = 'PHP信息';
$lang->cn->links['phpinfo']['target'] = '_blank';
$lang->en->title = 'Welcome to use zentao!';
$lang->en->poweredBy = "reduced from <a href='http://www.apachefriends.org/' target='_blank'>xampp</a>";
$lang->en->links['zentao']['link'] = '/zentao/';
$lang->en->links['zentao']['text'] = 'ZenTao';
$lang->en->links['zentao']['target'] = '_self';
$lang->en->links['official']['link'] = 'http://www.zentao.net/';
$lang->en->links['official']['text'] = 'Community';
$lang->en->links['official']['target'] = '_blank';
$lang->en->links['sqlbudyy']['link'] = '/sqlbuddy/';
$lang->en->links['sqlbudyy']['text'] = 'MySQL';
$lang->en->links['sqlbudyy']['target'] = '_blank';
$lang->en->links['phpinfo']['link'] = '?mode=phpinfo';
$lang->en->links['phpinfo']['text'] = 'PHP';
$lang->en->links['phpinfo']['target'] = '_blank';
if(is_file('./my.php')) include './my.php';
$acceptLang = stripos($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'zh-CN') !== false ? 'cn' : 'en';
$acceptLang = isset($_GET['lang']) ? $_GET['lang'] : $acceptLang;
$clientLang = $lang->$acceptLang;
?>
<?php if(isset($_GET['mode']) and $_GET['mode'] == 'phpinfo') die(phpinfo());?>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<meta http-equiv="refresh" content="5; url=/zentao/" />
<title><?php echo $clientLang->title;?></title>
<link href="/zentao/theme/default/style.css" rel="stylesheet" type="text/css">
<link href="/zentao/theme/default/yui.css" rel="stylesheet" type="text/css">
<style>
html {background-color:#06294e;}
table{margin-top:200px; background:white; border:none}
tr, th, td{border:none}
#welcome{font-size:20px}
#logo{width:120px; border-right:1px solid #efefef}
#links{padding-left:25px}
#links a{display:block; width:100px; height:25px; line-height:25px; float:left; margin-right:5px; border:1px solid gray; background:#efefef; text-decoration:none; text-align:center}
#links #zentao{background:green; color:#efefef}
#power{background:#efefef}
.button-c{width:100px}
</style>
</head>
<body>
<table class='table-5' align='center'>
<tr class='colhead'><th colspan='2' id='welcome'><?php echo $clientLang->title;?></th></tr>
<tr>
<td id='logo'><img src='/zentao/theme/default/images/main/logo2.png' /></td>
<td id='links'><?php foreach($clientLang->links as $linkID => $link) echo "<a id='$linkID' href='$link[link]' target='$link[target]'>$link[text]</a>";?></td>
</tr>
<tr id='power'>
<td class='a-right' colspan='2'>
<?php
echo $clientLang->poweredBy . ' ';
foreach($config->langs as $langCode => $langName) echo "<a href='?lang=$langCode'>$langName</a>";
?>
</td>
</tr>
</table>
</body>
</html>

Binary file not shown.

View File

@@ -0,0 +1,17 @@
@echo off
if "%OS%" == "Windows_NT" goto WinNT
:Win9X
echo Don't be stupid! Win9x don't know Services
echo Please use mysql_start.bat instead
goto exit
:WinNT
echo Installing mysql as an Service
mysql\bin\mysqld.exe --install mysqlzt
echo Now we Start mysql :)
net start mysqlzt
:exit
pause

View File

@@ -0,0 +1,17 @@
@echo off
if "%OS%" == "Windows_NT" goto WinNT
:Win9X
echo Don't be stupid! Win9x don't know Services
echo Please use mysql_stop.bat instead
goto exit
:WinNT
echo Are you sure you wan't this?
echo now stopping mysql when it runs
net stop mysqlzt
mysql\bin\mysqld.exe --remove mysqlzt
:exit
pause

View File

@@ -0,0 +1,14 @@
Ϊ<EFBFBD>˱<EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<EFBFBD><EFBFBD>ϸ<EFBFBD>Ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
1. <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD>벿<EFBFBD><EBB2BF><EFBFBD><EFBFBD>ijһ<C4B3><D2BB><EFBFBD>̷<EFBFBD><CCB7>ĸ<EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD><E6A3AC><EFBFBD><EFBFBD>c:\xampp<70><70><EFBFBD><EFBFBD>d:\xampp<70><70><EFBFBD>ǿ<EFBFBD><C7BF>Եġ<D4B5>
2. <20><>Ҫ<EFBFBD>Ķ<EFBFBD>xampp<70><70>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
3. zentaoamp-control-cn.exe<78>Ǹ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>壬zentaoamp-control-en.exe<78><65>Ӣ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5A1A3><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣapache, mysql<71><6C>
4. <20><><EFBFBD><EFBFBD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>apache<68><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ں<CBBF><DABA>Ƿ<EFBFBD><C7B7><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ڳ<CBBF>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>88<38>˿ڡ<CBBF><DAA1><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>ϲ<EFBFBD><CFB2>Ƕ˿ڳ<CBBF>ͻ<EFBFBD><CDBB><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>װvc<76><63><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD>
32λϵͳ<CFB5><CDB3><EFBFBD>أ<EFBFBD>http://www.microsoft.com/downloads/details.aspx?FamilyID=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF
64λϵͳ<CFB5><CDB3><EFBFBD>أ<EFBFBD>http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=15336
5. <20><><EFBFBD><EFBFBD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>mysql<71><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ں<CBBF><DABA>Ƿ<EFBFBD><C7B7><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3308<30>˿ڡ<CBBF>
6. <20><><EFBFBD><EFBFBD>ϵͳĬ<CDB3>ϵĹ<CFB5><C4B9><EFBFBD>Ա<EFBFBD>ʺ<EFBFBD><CABA><EFBFBD>admin<69><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>123456<35><36>
7. <20><><EFBFBD>ݿ<EFBFBD>Ĭ<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>root<6F><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ա<EFBFBD>
8. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBBFAA><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5A3AC>mysql<71><6C>apache<68><65>װΪ<D7B0><CEAA><EFBFBD>񣬷<EFBFBD><F1A3ACB7><EFBFBD><EFBFBD><EFBFBD>Ϊapachezt, mysqlzt<7A><74>
<EFBFBD><EFBFBD>ϸ<EFBFBD>Ľ<EFBFBD><EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>http://www.zentao.net/help-read-79597.html

View File

@@ -0,0 +1,14 @@
<?php
$sbconfig['DefaultAdapter'] = "mysql";
$sbconfig['DefaultHost'] = "localhost:" . getPortOfMySQL();
$sbconfig['DefaultUser'] = "root";
$sbconfig['EnableUpdateCheck'] = true;
$sbconfig['RowsPerPage'] = 100;
$sbconfig['EnableGzip'] = true;
function getPortOfMySQL()
{
$mysqlConfig = file_get_contents('../../mysql/bin/my.ini');
if(strpos($mysqlConfig, '3308')) return '3308';
return '3306';
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,14 @@
[exclude-form-class-property]
TDBGrid.*.FieldName
*.Origin
[exclude-form-class]
TIBSQL
TIBDataSet
TIBQuery
TIBStoredProc
TIntegerField
TLargeintField
TFloatField
TIBStringField
TDateTimeField

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,278 @@
unit uApache;
interface
uses GnuGettext, uBaseModule, SysUtils, Classes, Windows, ExtCtrls, StdCtrls, Buttons,
uNetstatTable, uTools, uProcesses, Messages, uServices;
type
tApacheLogType = (altAccess, altError);
tApache = class(tBaseModule)
OldPIDs, OldPorts: string;
procedure ServiceInstall; override;
procedure ServiceUnInstall; override;
procedure Start; override;
procedure Stop; override;
procedure Admin; override;
procedure UpdateStatus; override;
procedure CheckIsService; reintroduce;
procedure EditConfig(ConfigFile: string); reintroduce;
procedure ShowLogs(LogType: tApacheLogType); reintroduce;
procedure AddLog(Log: string; LogType: tLogType=ltDefault); reintroduce;
constructor Create(pbbService: TBitBtn; pStatusPanel: tPanel; pPIDLabel, pPortLabel: tLabel; pStartStopButton, pAdminButton: tBitBtn);
destructor Destroy; override;
end;
implementation
const
cServiceName = 'Apache2.2';
cModuleName = 'apache';
{ tApache }
procedure tApache.AddLog(Log: string; LogType: tLogType=ltDefault);
begin
inherited AddLog(cModuleName, Log, LogType);
end;
procedure tApache.Admin;
var
App, Param: string;
begin
inherited;
Param:='http://localhost/xampp/';
if Config.BrowserApp<>'' then begin
App:=Config.BrowserApp;
ExecuteFile(App,Param,'',SW_SHOW);
Addlog(Format(_('Executing "%s" "%s"'),[App,Param]),ltDebug);
end else begin
ExecuteFile(Param,'','',SW_SHOW);
Addlog(Format(_('Executing "%s"'),[Param]),ltDebug);
end;
end;
procedure tApache.CheckIsService;
var
s: string;
begin
inherited CheckIsService(cServiceName);
if isService then s:=_('Service installed')
else s:=_('Service not installed');
AddLog(Format(_('Checking for service (name="%s"): %s'),[cServiceName,s]),ltDebug);
end;
constructor tApache.Create;
const Ports:array[0..1] of integer=(80,443);
var
PortBlocker: string;
ServerApp: string;
p: integer;
begin
inherited;
ModuleName:=cModuleName;
AddLog(_('Initializing module...'),ltDebug);
ServerApp:=basedir+'apache\bin\httpd.exe';
if not FileExists(ServerApp) then
AddLog(Format(_('Possible problem detected: file "%s" not found - run this program from your XAMPP root directory!'),[ServerApp]),ltError);
CheckIsService;
if Config.CheckDefaultPorts then begin
AddLog(_('Checking default ports...'),ltDebug);
for p:=Low(Ports) to High(Ports) do begin
PortBlocker:=NetStatTable.isPortInUse(Ports[p]);
if (PortBlocker<>'') then begin
if (LowerCase(PortBlocker)=LowerCase(ServerApp)) then begin
AddLog(Format(_('"%s" seems to be running on port %d?'),[ServerApp,Ports[p]]),ltError);
end else begin
AddLog(Format(_('Possible problem detected: Port %d in use by "%s"!'),[Ports[p],PortBlocker]),ltError);
end;
end;
end;
end;
end;
destructor tApache.Destroy;
begin
inherited;
end;
procedure tApache.EditConfig(ConfigFile: string);
var
App, Param: string;
begin
App:=Config.EditorApp;
Param:=BaseDir+ConfigFile;
Addlog(Format(_('Executing %s %s'),[App,Param]),ltDebug);
ExecuteFile(app,param,'',SW_SHOW);
end;
procedure tApache.ServiceInstall;
var
App, Param: string;
RC: Integer;
begin
App:=BaseDir+'apache\bin\httpd.exe';
Param:='-k install';
AddLog(_('Installing service...'));
AddLog(Format(_('Executing "%s %s"'),[App, Param]),ltDebug);
RC:=RunAsAdmin(App,Param,SW_HIDE);
if RC=0 then AddLog(Format(_('Return code: %d'),[RC]),ltDebug)
else AddLog(Format(_('There may be an error, return code: %d - %s'),[RC,SystemErrorMessage(RC)]),ltError);
end;
procedure tApache.ServiceUnInstall;
var
App, Param: string;
RC: Cardinal;
begin
App:=BaseDir+'apache\bin\httpd.exe';
Param:='-k uninstall';
AddLog(_('Uninstalling service...'));
AddLog(Format(_('Executing "%s %s"'),[App, Param]),ltDebug);
RC:=RunAsAdmin(App,Param,SW_HIDE);
if RC=0 then AddLog(Format(_('Return code: %d'),[RC]),ltDebug)
else AddLog(Format(_('There may be an error, return code: %d - %s'),[RC,SystemErrorMessage(RC)]),ltError);
end;
procedure tApache.ShowLogs(LogType: tApacheLogType);
var
App, Param: string;
begin
App:=Config.EditorApp;
if LogType=altAccess then
Param:=BaseDir+'apache\logs\access.log';
if LogType=altError then
Param:=BaseDir+'apache\logs\error.log';
AddLog(Format(_('Executing "%s %s"'),[App,Param]),ltDebug);
ExecuteFile(app,param,'',SW_SHOW);
end;
procedure tApache.Start;
var
App: string;
RC: Cardinal;
begin
if isService then begin
AddLog(Format(_('Starting %s service...'),[cModuleName]));
App:=Format('start "%s"',[cServiceName]);
AddLog(Format(_('Executing "%s"'),['net '+App]),ltDebug);
RC:=RunAsAdmin('net',App,SW_HIDE);
if RC=0 then AddLog(Format(_('Return code: %d'),[RC]),ltDebug)
else AddLog(Format(_('There may be an error, return code: %d - %s'),[RC,SystemErrorMessage(RC)]),ltError);
end else begin
AddLog(Format(_('Starting %s app...'),[cModuleName]));
App:=BaseDir+'apache\bin\httpd.exe';
AddLog(Format(_('Executing "%s"'),[App]),ltDebug);
RunProcess(App,SW_HIDE,false);
end;
end;
procedure tApache.Stop;
var
i, pPID: Integer;
App: string;
RC: Cardinal;
begin
if isService then begin
AddLog(Format(_('Stopping %s service...'),[cModuleName]));
App:=Format('stop "%s"',[cServiceName]);
AddLog(Format(_('Executing "%s"'),['net '+App]),ltDebug);
RC:=RunAsAdmin('net',App,SW_HIDE);
if RC=0 then AddLog(Format(_('Return code: %d'),[RC]),ltDebug)
else AddLog(Format(_('There may be an error, return code: %d - %s'),[RC,SystemErrorMessage(RC)]),ltError);
end else begin
if PIDList.Count>0 then begin
for i:=0 to PIDList.Count-1 do begin
pPID:=Integer(PIDList[i]);
AddLog(_('Stopping')+' '+cModuleName+' '+Format('(PID: %d)',[pPID]));
App:=Format(BaseDir+'apache\bin\pv.exe -f -k -q -i %d',[pPID]);
AddLog(Format(_('Executing "%s"'),[App]),ltDebug);
RunProcess(App,SW_HIDE,false);
end;
end else begin
AddLog(_('No PIDs found?!'));
end;
end;
end;
procedure tApache.UpdateStatus;
var
p: Integer;
ProcInfo: TProcInfo;
s: string;
ports: string;
begin
isRunning:=false;
PIDList.Clear;
for p:=0 to Processes.ProcessList.Count-1 do begin
ProcInfo:=Processes.ProcessList[p];
if { (pos(BaseDir,ProcInfo.ExePath)=1) and } (pos('httpd.exe',ProcInfo.Module)=1) then begin
isRunning:=true;
PIDList.Add(Pointer(ProcInfo.PID));
end;
end;
// Checking processes
s:='';
for p:=0 to PIDList.Count-1 do begin
if p=0 then s:=IntToStr(Integer(PIDList[p]))
else s:=s+#13+IntToStr(Integer(PIDList[p]));
end;
if s<>OldPIDs then begin
lPID.Caption:=s;
OldPIDs:=s;
end;
// Checking netstats
s:='';
for p:=0 to PIDList.Count-1 do begin
ports:=NetStatTable.GetPorts4PID(Integer(PIDList[p]));
if ports<>'' then begin
if s='' then s:=ports
else s:=s+', '+ports;
end;
end;
if s<>OldPorts then begin
lPort.Caption:=s;
OldPorts:=s;
end;
if byte(isRunning)<>oldIsRunningByte then begin
if oldIsRunningByte<>2 then begin
if isRunning then s:=_('running')
else s:=_('stopped');
AddLog(_('Status change detected:')+' '+s);
end;
oldIsRunningByte:=byte(isRunning);
if isRunning then begin
pStatus.Color:=cRunningColor;
bStartStop.Caption:=_('Stop');
bAdmin.Enabled:=true;
end else begin
pStatus.Color:=cStoppedColor;
bStartStop.Caption:=_('Start');
bAdmin.Enabled:=false;
end;
end;
if AutoStart then begin
AutoStart:=false;
if isRunning then begin
AddLog(_('Autostart active: modul is already running - aborted'),ltError);
end else begin
AddLog(_('Autostart active: starting...'));
Start;
end;
end;
end;
end.

View File

@@ -0,0 +1,93 @@
unit uBaseModule;
interface
uses GnuGettext, Classes, ExtCtrls, StdCtrls, Buttons, SysUtils, uTools, uServices;
type
tBaseModule = class
public
bbService: TBitBtn;
pStatus: tPanel;
lPID: tLabel;
lPort: tLabel;
bStartStop: tBitBtn;
bAdmin: TBitBtn;
AutoStart: boolean;
oldIsRunningByte: byte;
isRunning: boolean;
isService: boolean;
PIDList: tList;
ModuleName: string;
procedure Start; virtual; abstract;
procedure Stop; virtual; abstract;
procedure Admin; virtual; abstract;
procedure UpdateStatus; virtual; abstract;
procedure ServiceInstall; virtual; abstract;
procedure ServiceUnInstall; virtual; abstract;
procedure SetServiceButton(isActive: boolean);
procedure CheckIsService(ServiceName: string);
procedure AddLog(module,log: string; LogType: tLogType);
constructor Create(pbbService: TBitBtn; pStatusPanel: tPanel; pPIDLabel, pPortLabel: tLabel; pStartStopButton, pAdminButton: tBitBtn);
destructor Destroy; override;
end;
implementation
uses uMain;
{ tBaseModule }
procedure tBaseModule.Addlog(module, log: string; LogType: tLogType);
begin
fMain.AddLog(module,log,LogType);
end;
procedure tBaseModule.CheckIsService(ServiceName: string);
var
ServiceStatus: TServiceStatus;
begin
ServiceStatus:=GetServiceStatus(ServiceName);
isService:=ServiceStatus in [ssRunning, ssStopped];
SetServiceButton(isService);
end;
constructor tBaseModule.Create(pbbService: TBitBtn; pStatusPanel: tPanel; pPIDLabel, pPortLabel: tLabel; pStartStopButton, pAdminButton: tBitBtn);
begin
PIDList:=TList.Create;
isRunning:=false;
isService:=false;
bbService:=pbbService;
pStatus:=pStatusPanel;
lPID:=pPIDLabel;
lPort:=pPortLabel;
bStartStop:=pStartStopButton;
bAdmin:=pAdminButton;
oldIsRunningByte:=2;
AutoStart:=false;
end;
destructor tBaseModule.Destroy;
begin
PIDList.Free;
inherited;
end;
procedure tBaseModule.SetServiceButton(isActive: boolean);
begin
bbService.Glyph:=nil;
if isActive then
fMain.ImageList.GetBitmap(0, bbService.Glyph) ;
if not isActive then
fMain.ImageList.GetBitmap(1, bbService.Glyph) ;
end;
end.

View File

@@ -0,0 +1,341 @@
object fConfig: TfConfig
Left = 463
Top = 124
Caption = 'Configuration of Control Panel'
ClientHeight = 404
ClientWidth = 343
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
KeyPreview = True
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate
OnKeyPress = FormKeyPress
OnShow = FormShow
DesignSize = (
343
404)
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 8
Top = 8
Width = 32
Height = 13
Caption = 'Editor:'
end
object Label2: TLabel
Left = 8
Top = 56
Width = 165
Height = 13
Caption = 'Browser (empty = system default)'
end
object bSelectEditor: TBitBtn
Left = 308
Top = 22
Width = 26
Height = 25
Anchors = [akTop, akRight]
DoubleBuffered = True
Glyph.Data = {
20050000424D2005000000000000360400002800000010000000100000000100
080001000000EA000000130B0000130B000000010000000100004E525300585B
5D006B6F7100187A9B00197A9D000C72A500187DA1001889B1002899BF00189A
C600199AC6001B9CC70020A0C90021A2CE0025A2CF003FB8D7005BBCCE0042B2
DE006BBFDA0042B3E20042BAEF0052BEE7004FC1E2005AC7FF006BD7FF006FD5
FD007BDFFF0079E4F0007BE3FF00909699009AA0A300A3AAAD00ADB3B700BFC7
CB0084D7FF0084E7FF0084EBFF0089F0F7008CF3FF0094F7FF009CF3FF0096F9
FB009CFFFF00A5FFFF00C8D0D400F7FBFF00FFFFFF0000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000102C00000003
2C2120000A1F000320212C0000000003211E02000A010003021E210000000120
0C0500030002200000000003090B2A00091800040805011F00000004090A1B2A
071C00051A1104001D0000000004090E0F2A0724000523140900020000000004
09130C2B08270004151005010000000409190925082A00041729030100000007
092209122E2E2D00052E0004232E060200000003092416000B090107011E0000
010901280526052E000409041E2100000109012E042A012E0609000320212C00
0000012C010D042E0003091E2100072C0000012C012C040D01200121082C0000
102C0001}
ParentDoubleBuffered = False
TabOrder = 0
OnClick = bSelectEditorClick
end
object eEditor: TEdit
Left = 8
Top = 24
Width = 294
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 1
end
object bSave: TBitBtn
Left = 260
Top = 371
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = 'Save'
DoubleBuffered = True
Glyph.Data = {
DE010000424DDE01000000000000760000002800000024000000120000000100
0400000000006801000000000000000000001000000000000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
3333333333333333333333330000333333333333333333333333F33333333333
00003333344333333333333333388F3333333333000033334224333333333333
338338F3333333330000333422224333333333333833338F3333333300003342
222224333333333383333338F3333333000034222A22224333333338F338F333
8F33333300003222A3A2224333333338F3838F338F33333300003A2A333A2224
33333338F83338F338F33333000033A33333A222433333338333338F338F3333
0000333333333A222433333333333338F338F33300003333333333A222433333
333333338F338F33000033333333333A222433333333333338F338F300003333
33333333A222433333333333338F338F00003333333333333A22433333333333
3338F38F000033333333333333A223333333333333338F830000333333333333
333A333333333333333338330000333333333333333333333333333333333333
0000}
ModalResult = 1
NumGlyphs = 2
ParentDoubleBuffered = False
TabOrder = 2
OnClick = bSaveClick
ExplicitTop = 335
end
object bAbort: TBitBtn
Left = 179
Top = 371
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = 'Abort'
DoubleBuffered = True
Kind = bkAbort
ParentDoubleBuffered = False
TabOrder = 3
OnClick = bAbortClick
ExplicitTop = 335
end
object bSelectBrowser: TBitBtn
Left = 308
Top = 69
Width = 26
Height = 25
Anchors = [akTop, akRight]
DoubleBuffered = True
Glyph.Data = {
20050000424D2005000000000000360400002800000010000000100000000100
080001000000EA000000130B0000130B000000010000000100004E525300585B
5D006B6F7100187A9B00197A9D000C72A500187DA1001889B1002899BF00189A
C600199AC6001B9CC70020A0C90021A2CE0025A2CF003FB8D7005BBCCE0042B2
DE006BBFDA0042B3E20042BAEF0052BEE7004FC1E2005AC7FF006BD7FF006FD5
FD007BDFFF0079E4F0007BE3FF00909699009AA0A300A3AAAD00ADB3B700BFC7
CB0084D7FF0084E7FF0084EBFF0089F0F7008CF3FF0094F7FF009CF3FF0096F9
FB009CFFFF00A5FFFF00C8D0D400F7FBFF00FFFFFF0000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000102C00000003
2C2120000A1F000320212C0000000003211E02000A010003021E210000000120
0C0500030002200000000003090B2A00091800040805011F00000004090A1B2A
071C00051A1104001D0000000004090E0F2A0724000523140900020000000004
09130C2B08270004151005010000000409190925082A00041729030100000007
092209122E2E2D00052E0004232E060200000003092416000B090107011E0000
010901280526052E000409041E2100000109012E042A012E0609000320212C00
0000012C010D042E0003091E2100072C0000012C012C040D01200121082C0000
102C0001}
ParentDoubleBuffered = False
TabOrder = 4
OnClick = bSelectBrowserClick
end
object eBrowser: TEdit
Left = 8
Top = 71
Width = 294
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 5
end
object cbDebug: TCheckBox
Left = 8
Top = 260
Width = 149
Height = 17
Caption = 'Show debug stuff'
TabOrder = 6
OnClick = cbDebugClick
end
object cbDebugDetails: TComboBox
Left = 179
Top = 258
Width = 126
Height = 21
Style = csDropDownList
ItemHeight = 13
TabOrder = 7
Items.Strings = (
'Details'
'Very many details')
end
object GroupBox1: TGroupBox
Left = 8
Top = 98
Width = 327
Height = 95
Anchors = [akLeft, akTop, akRight]
Caption = ' Autostart of modules '
TabOrder = 8
DesignSize = (
327
95)
object Label3: TLabel
Left = 8
Top = 65
Width = 309
Height = 28
Anchors = [akLeft, akTop, akRight]
AutoSize = False
Caption = 'Selected modules will be started on next launch of this program.'
Font.Charset = DEFAULT_CHARSET
Font.Color = clInactiveCaptionText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
WordWrap = True
end
object cbASApache: TCheckBox
Left = 8
Top = 20
Width = 97
Height = 17
Caption = 'Apache'
TabOrder = 0
end
object cbASMySQL: TCheckBox
Left = 8
Top = 43
Width = 97
Height = 17
Caption = 'MySQL'
TabOrder = 1
end
object cbASFileZilla: TCheckBox
Left = 145
Top = 22
Width = 97
Height = 17
Caption = 'FileZilla'
TabOrder = 2
end
object cbASMercury: TCheckBox
Left = 145
Top = 45
Width = 97
Height = 17
Caption = 'Mercury'
TabOrder = 3
end
end
object cbCheckDefaultPorts: TCheckBox
Left = 8
Top = 231
Width = 221
Height = 17
AllowGrayed = True
Caption = 'Check default ports on startup'
TabOrder = 9
OnClick = cbDebugClick
end
object BitBtn1: TBitBtn
Left = 8
Top = 292
Width = 149
Height = 25
Caption = 'Change language'
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 10
OnClick = BitBtn1Click
end
object bConfigUserdefined: TBitBtn
Left = 8
Top = 323
Width = 149
Height = 25
Cancel = True
Caption = 'User defined files'
DoubleBuffered = True
ModalResult = 7
NumGlyphs = 2
ParentDoubleBuffered = False
TabOrder = 11
OnClick = bConfigUserdefinedClick
end
object cbTomcatVisible: TCheckBox
Left = 8
Top = 199
Width = 221
Height = 17
AllowGrayed = True
Caption = 'Tomcat output window visible'
TabOrder = 12
OnClick = cbDebugClick
end
object OpenDialog1: TOpenDialog
DefaultExt = 'exe'
Filter = 'Executables (*.exe)|*.exe|All files (*.*)|*.*'
Options = [ofHideReadOnly, ofPathMustExist, ofFileMustExist, ofEnableSizing]
Left = 136
Top = 4
end
end

View File

@@ -0,0 +1,142 @@
unit uConfig;
interface
uses
GnuGettext, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, uTools;
type
TfConfig = class(TForm)
bSelectEditor: TBitBtn;
eEditor: TEdit;
OpenDialog1: TOpenDialog;
Label1: TLabel;
bSave: TBitBtn;
bAbort: TBitBtn;
Label2: TLabel;
bSelectBrowser: TBitBtn;
eBrowser: TEdit;
cbDebug: TCheckBox;
cbDebugDetails: TComboBox;
GroupBox1: TGroupBox;
cbASApache: TCheckBox;
cbASMySQL: TCheckBox;
cbASFileZilla: TCheckBox;
cbASMercury: TCheckBox;
Label3: TLabel;
cbCheckDefaultPorts: TCheckBox;
BitBtn1: TBitBtn;
bConfigUserdefined: TBitBtn;
cbTomcatVisible: TCheckBox;
procedure bAbortClick(Sender: TObject);
procedure bSaveClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bSelectEditorClick(Sender: TObject);
procedure bSelectBrowserClick(Sender: TObject);
procedure cbDebugClick(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure bConfigUserdefinedClick(Sender: TObject);
private
{ Private-Deklarationen }
public
end;
var
fConfig: TfConfig;
implementation
uses uMain, uLanguage, uConfigUserDefined;
{$R *.dfm}
procedure TfConfig.bSelectBrowserClick(Sender: TObject);
var dp: string;
begin
dp:=ExtractFilePath(eBrowser.Text);
if dp<>'' then begin
OpenDialog1.InitialDir:=dp;
OpenDialog1.FileName:=ExtractFileName(eBrowser.Text);
end;
if OpenDialog1.Execute then eBrowser.Text:=OpenDialog1.FileName;
end;
procedure TfConfig.bSelectEditorClick(Sender: TObject);
var dp: string;
begin
dp:=ExtractFilePath(eEditor.Text);
if dp<>'' then begin
OpenDialog1.InitialDir:=dp;
OpenDialog1.FileName:=ExtractFileName(eEditor.Text);
end;
if OpenDialog1.Execute then eEditor.Text:=OpenDialog1.FileName;
end;
procedure TfConfig.cbDebugClick(Sender: TObject);
begin
cbDebugDetails.Visible:=cbDebug.Checked;
end;
procedure TfConfig.BitBtn1Click(Sender: TObject);
begin
fLanguage.ShowModal;
end;
procedure TfConfig.bConfigUserdefinedClick(Sender: TObject);
begin
fConfigUserDefined.ShowModal;
end;
procedure TfConfig.bSaveClick(Sender: TObject);
begin
Config.EditorApp:=Trim(eEditor.Text);
Config.BrowserApp:=Trim(eBrowser.Text);
Config.ShowDebug:=cbDebug.Checked;
Config.DebugLevel:=cbDebugDetails.ItemIndex;
Config.CheckDefaultPorts:=cbCheckDefaultPorts.Checked;
Config.TomcatVisible:=cbTomcatVisible.Checked;
Config.ASApache:=cbASApache.Checked;
Config.ASMySQL:=cbASMySQL.Checked;
Config.ASFileZilla:=cbASFileZilla.Checked;
Config.ASMercury:=cbASMercury.Checked;
SaveSettings;
Close;
end;
procedure TfConfig.bAbortClick(Sender: TObject);
begin
Close;
end;
procedure TfConfig.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
end;
procedure TfConfig.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#27 then begin key:=#0; bAbort.Click; end;
end;
procedure TfConfig.FormShow(Sender: TObject);
begin
eEditor.Text:=Config.EditorApp;
eBrowser.Text:=Config.BrowserApp;
cbDebug.Checked:=Config.ShowDebug;
cbDebugDetails.Visible:=cbDebug.Checked;
cbDebugDetails.ItemIndex:=Config.DebugLevel;
cbCheckDefaultPorts.Checked:=Config.CheckDefaultPorts;
cbTomcatVisible.Checked:=Config.TomcatVisible;
cbASApache.Checked:=Config.ASApache;
cbASMySQL.Checked:=Config.ASMySQL;
cbASFileZilla.Checked:=Config.ASFileZilla;
cbASMercury.Checked:=Config.ASMercury;
end;
end.

View File

@@ -0,0 +1,231 @@
object fConfigUserDefined: TfConfigUserDefined
Left = 487
Top = 248
Caption = 'User-defined log/config-files'
ClientHeight = 689
ClientWidth = 557
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate
OnKeyPress = FormKeyPress
OnShow = FormShow
DesignSize = (
557
689)
PixelsPerInch = 96
TextHeight = 13
object lHeader1: TLabel
Left = 8
Top = 8
Width = 310
Height = 13
Caption =
'Enter user defined files. Files must be relative to xampp-basedi' +
'r!'
end
object lHeader2: TLabel
Left = 8
Top = 27
Width = 222
Height = 13
Caption = 'Example: "apache\conf\extra\httpd-info.conf"'
end
object lConfig: TLabel
Left = 17
Top = 60
Width = 35
Height = 13
Caption = 'Config'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
end
object lLogs: TLabel
Left = 280
Top = 60
Width = 26
Height = 13
Caption = 'Logs'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
end
object bSave: TBitBtn
Left = 474
Top = 656
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = 'Save'
DoubleBuffered = True
Glyph.Data = {
DE010000424DDE01000000000000760000002800000024000000120000000100
0400000000006801000000000000000000001000000000000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
3333333333333333333333330000333333333333333333333333F33333333333
00003333344333333333333333388F3333333333000033334224333333333333
338338F3333333330000333422224333333333333833338F3333333300003342
222224333333333383333338F3333333000034222A22224333333338F338F333
8F33333300003222A3A2224333333338F3838F338F33333300003A2A333A2224
33333338F83338F338F33333000033A33333A222433333338333338F338F3333
0000333333333A222433333333333338F338F33300003333333333A222433333
333333338F338F33000033333333333A222433333333333338F338F300003333
33333333A222433333333333338F338F00003333333333333A22433333333333
3338F38F000033333333333333A223333333333333338F830000333333333333
333A333333333333333338330000333333333333333333333333333333333333
0000}
ModalResult = 1
NumGlyphs = 2
ParentDoubleBuffered = False
TabOrder = 0
OnClick = bSaveClick
ExplicitTop = 544
end
object bAbort: TBitBtn
Left = 393
Top = 656
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = 'Abort'
DoubleBuffered = True
Kind = bkAbort
ParentDoubleBuffered = False
TabOrder = 1
OnClick = bAbortClick
ExplicitTop = 544
end
object gbApache: TGroupBox
Left = 8
Top = 79
Width = 541
Height = 110
Caption = 'Apache'
TabOrder = 2
object mConfigApache: TMemo
Left = 9
Top = 17
Width = 261
Height = 85
ScrollBars = ssBoth
TabOrder = 0
end
object mLogsApache: TMemo
Left = 272
Top = 17
Width = 261
Height = 85
ScrollBars = ssBoth
TabOrder = 1
end
end
object gbMySQL: TGroupBox
Left = 8
Top = 195
Width = 541
Height = 110
Caption = 'MySQL'
TabOrder = 3
object mConfigMySQL: TMemo
Left = 9
Top = 17
Width = 261
Height = 85
ScrollBars = ssBoth
TabOrder = 0
end
object mLogsMySQL: TMemo
Left = 272
Top = 17
Width = 261
Height = 85
ScrollBars = ssBoth
TabOrder = 1
end
end
object gbFileZilla: TGroupBox
Left = 8
Top = 311
Width = 541
Height = 110
Caption = 'FileZilla'
TabOrder = 4
object mConfigFilezilla: TMemo
Left = 9
Top = 17
Width = 261
Height = 85
ScrollBars = ssBoth
TabOrder = 0
end
object mLogsFileZilla: TMemo
Left = 272
Top = 17
Width = 261
Height = 85
ScrollBars = ssBoth
TabOrder = 1
end
end
object gbMercury: TGroupBox
Left = 8
Top = 427
Width = 541
Height = 110
Caption = 'Mercury'
TabOrder = 5
object mConfigMercury: TMemo
Left = 9
Top = 17
Width = 261
Height = 85
ScrollBars = ssBoth
TabOrder = 0
end
object mLogsMercury: TMemo
Left = 272
Top = 17
Width = 261
Height = 85
ScrollBars = ssBoth
TabOrder = 1
end
end
object gbTomcat: TGroupBox
Left = 8
Top = 543
Width = 541
Height = 110
Caption = 'Mercury'
TabOrder = 6
object mConfigTomcat: TMemo
Left = 9
Top = 17
Width = 261
Height = 85
ScrollBars = ssBoth
TabOrder = 0
end
object mLogsTomcat: TMemo
Left = 272
Top = 17
Width = 261
Height = 85
ScrollBars = ssBoth
TabOrder = 1
end
end
end

View File

@@ -0,0 +1,115 @@
unit uConfigUserDefined;
interface
uses
GnuGettext, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, uTools;
type
TfConfigUserDefined = class(TForm)
lHeader1: TLabel;
bSave: TBitBtn;
bAbort: TBitBtn;
gbApache: TGroupBox;
mConfigApache: TMemo;
mLogsApache: TMemo;
lHeader2: TLabel;
lConfig: TLabel;
lLogs: TLabel;
gbMySQL: TGroupBox;
mConfigMySQL: TMemo;
mLogsMySQL: TMemo;
gbFileZilla: TGroupBox;
mConfigFilezilla: TMemo;
mLogsFileZilla: TMemo;
gbMercury: TGroupBox;
mConfigMercury: TMemo;
mLogsMercury: TMemo;
gbTomcat: TGroupBox;
mConfigTomcat: TMemo;
mLogsTomcat: TMemo;
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bAbortClick(Sender: TObject);
procedure bSaveClick(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
procedure Memo2Config;
procedure Config2Memo;
public
{ Public-Deklarationen }
end;
var
fConfigUserDefined: TfConfigUserDefined;
implementation
{$R *.dfm}
{ TfConfigUserDefined }
procedure TfConfigUserDefined.bAbortClick(Sender: TObject);
begin
Close;
end;
procedure TfConfigUserDefined.bSaveClick(Sender: TObject);
begin
Memo2Config;
SaveSettings;
end;
procedure TfConfigUserDefined.Memo2Config;
begin
Config.UserConfig.Apache.Text:=mConfigApache.Text;
Config.UserConfig.MySQL.Text:=mConfigMySQL.Text;
Config.UserConfig.FileZilla.Text:=mConfigFilezilla.Text;
Config.UserConfig.Mercury.Text:=mConfigMercury.Text;
Config.UserConfig.Tomcat.Text:=mConfigTomcat.Text;
Config.UserLogs.Apache.Text:=mLogsApache.Text;
Config.UserLogs.MySQL.Text:=mLogsMySQL.Text;
Config.UserLogs.FileZilla.Text:=mLogsFileZilla.Text;
Config.UserLogs.Mercury.Text:=mLogsMercury.Text;
Config.UserLogs.Tomcat.Text:=mLogsTomcat.Text;
end;
procedure TfConfigUserDefined.Config2Memo;
begin
mConfigApache.Text:=Config.UserConfig.Apache.Text;
mConfigMySQL.Text:=Config.UserConfig.MySQL.Text;
mConfigFilezilla.Text:=Config.UserConfig.FileZilla.Text;
mConfigMercury.Text:=Config.UserConfig.Mercury.Text;
mConfigTomcat.Text:=Config.UserConfig.Tomcat.Text;
mLogsApache.Text:=Config.UserLogs.Apache.Text;
mLogsMySQL.Text:=Config.UserLogs.MySQL.Text;
mLogsFileZilla.Text:=Config.UserLogs.FileZilla.Text;
mLogsMercury.Text:=Config.UserLogs.Mercury.Text;
mLogsTomcat.Text:=Config.UserLogs.Tomcat.Text;
end;
procedure TfConfigUserDefined.FormCreate(Sender: TObject);
begin
TranslateComponent(self);
end;
procedure TfConfigUserDefined.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#27 then begin
key:=#0;
close;
exit;
end;
end;
procedure TfConfigUserDefined.FormShow(Sender: TObject);
begin
Config2Memo;
end;
end.

View File

@@ -0,0 +1,226 @@
unit uFileZilla;
interface
uses GnuGettext, uBaseModule, SysUtils, Classes, Windows, ExtCtrls, StdCtrls, Buttons,
uNetstatTable, uTools, uProcesses;
type
tFileZilla = class(tBaseModule)
OldPIDs, OldPorts: string;
procedure ServiceInstall; override;
procedure ServiceUnInstall; override;
procedure Start; override;
procedure Stop; override;
procedure Admin; override;
procedure UpdateStatus; override;
procedure CheckIsService; reintroduce;
procedure AddLog(Log: string; LogType: tLogType=ltDefault); reintroduce;
constructor Create(pbbService: TBitBtn; pStatusPanel: tPanel; pPIDLabel, pPortLabel: tLabel; pStartStopButton, pAdminButton: tBitBtn);
destructor Destroy; override;
end;
implementation
const cServiceName = 'FileZilla Server';
cModuleName = 'FileZilla';
{ tFileZilla }
procedure tFileZilla.AddLog(Log: string; LogType: tLogType);
begin
inherited AddLog('filezilla', Log, LogType);
end;
procedure tFileZilla.Admin;
var
App: string;
begin
App:=BaseDir+'filezillaftp\filezilla server interface.exe';
Addlog(Format(_('Executing "%s"'),[App]),ltDebug);
ExecuteFile(App,'','',SW_SHOW);
end;
procedure tFileZilla.CheckIsService;
var
s: string;
begin
inherited CheckIsService(cServiceName);
if isService then s:=_('Service installed')
else s:=_('Service not installed');
AddLog(Format(_('Checking for service (name="%s"): %s'),[cServiceName,s]),ltDebug);
end;
constructor tFileZilla.Create;
var
PortBlocker: string;
ServerApp: string;
ServerPort: Integer;
begin
inherited;
ModuleName:=cModuleName;
isService:=false;
AddLog(_('Initializing module...'),ltDebug);
ServerApp:=basedir+'FileZillaFTP\FileZillaServer.exe';
ServerPort:=21;
if not FileExists(ServerApp) then
AddLog(Format(_('Possible problem detected: file "%s" not found - run this program from your XAMPP root directory!'),[ServerApp]),ltError);
CheckIsService;
if Config.CheckDefaultPorts then begin
AddLog(_('Checking default ports...'),ltDebug);
PortBlocker:=NetStatTable.isPortInUse(ServerPort);
if (PortBlocker<>'') then begin
if (LowerCase(PortBlocker)=LowerCase(ServerApp)) then begin
AddLog(Format(_('"%s" seems to be running on port %d?'),[ServerApp,ServerPort]),ltError);
end else begin
AddLog(Format(_('Possible problem detected: Port %d in use by "%s"!'),[ServerPort,PortBlocker]),ltError);
end;
end;
end;
end;
destructor tFileZilla.Destroy;
begin
inherited;
end;
procedure tFileZilla.ServiceInstall;
var
App, Param: string;
RC: Integer;
begin
App:=BaseDir+'filezillaftp\filezillaserver.exe';
AddLog(_('Installing service...'));
Addlog(Format(_('Executing "%s"'),[App]),ltDebug);
RC:=RunAsAdmin(App,Param,SW_HIDE);
if RC=0 then AddLog(Format(_('Return code: %d'),[RC]),ltDebug)
else AddLog(Format(_('There may be an error, return code: %d - %s'),[RC,SystemErrorMessage(RC)]),ltError);
end;
procedure tFileZilla.ServiceUnInstall;
var
App, Param: string;
RC: Cardinal;
begin
App:='sc';
Param:='delete "'+cServiceName+'"';
AddLog('Uninstalling service...');
Addlog(Format(_('Executing "%s" "%s"'),[App,Param]),ltDebug);
RC:=RunAsAdmin(App,Param,SW_HIDE);
if RC=0 then AddLog(Format(_('Return code: %d'),[RC]),ltDebug)
else AddLog(Format(_('There may be an error, return code: %d - %s'),[RC,SystemErrorMessage(RC)]),ltError);
end;
procedure tFileZilla.Start;
var
App: string;
RC: Cardinal;
begin
if isService then begin
AddLog(Format(_('Starting %s service...'),[cModuleName]));
App:=Format('start "%s"',[cServiceName]);
Addlog(Format(_('Executing "%s"'),['net '+App]),ltDebug);
RC:=RunAsAdmin('net',App,SW_HIDE);
if RC=0 then AddLog(Format(_('Return code: %d'),[RC]),ltDebug)
else AddLog(Format(_('There may be an error, return code: %d - %s'),[RC,SystemErrorMessage(RC)]),ltError);
end else begin
AddLog(_('FileZilla must be run as service!'));
end;
end;
procedure tFileZilla.Stop;
var
App: string;
RC: Cardinal;
begin
if isService then begin
AddLog(Format(_('Stopping %s service...'),[cModuleName]));
App:=Format('stop "%s"',[cServiceName]);
Addlog(Format(_('Executing "%s"'),['net '+App]),ltDebug);
RC:=RunAsAdmin('net',App,SW_HIDE);
if RC=0 then AddLog(Format(_('Return code: %d'),[RC]),ltDebug)
else AddLog(Format(_('There may be an error, return code: %d - %s'),[RC,SystemErrorMessage(RC)]),ltError);
end else begin
AddLog(_('FileZilla must be run as service!'));
end;
end;
procedure tFileZilla.UpdateStatus;
var
p: Integer;
ProcInfo: TProcInfo;
s: string;
ports: string;
begin
isRunning:=false;
PIDList.Clear;
for p:=0 to Processes.ProcessList.Count-1 do begin
ProcInfo:=Processes.ProcessList[p];
if { (pos(BaseDir,ProcInfo.ExePath)=1) and } (pos('filezillaserver.exe',ProcInfo.Module)=1) then begin
isRunning:=true;
PIDList.Add(Pointer(ProcInfo.PID));
end;
end;
// Checking processes
s:='';
for p:=0 to PIDList.Count-1 do begin
if p=0 then s:=IntToStr(Integer(PIDList[p]))
else s:=s+#13+IntToStr(Integer(PIDList[p]));
end;
if s<>OldPIDs then begin
lPID.Caption:=s;
OldPIDs:=s;
end;
// Checking netstats
s:='';
for p:=0 to PIDList.Count-1 do begin
ports:=NetStatTable.GetPorts4PID(Integer(PIDList[p]));
if ports<>'' then begin
if s='' then s:=ports
else s:=s+', '+ports;
end;
end;
if s<>OldPorts then begin
lPort.Caption:=s;
OldPorts:=s;
end;
if byte(isRunning)<>oldIsRunningByte then begin
if oldIsRunningByte<>2 then begin
if isRunning then s:=_('running')
else s:=_('stopped');
AddLog(_('Status change detected:')+' '+s);
end;
oldIsRunningByte:=byte(isRunning);
if isRunning then begin
pStatus.Color:=cRunningColor;
bStartStop.Caption:=_('Stop');
bAdmin.Enabled:=true;
end else begin
pStatus.Color:=cStoppedColor;
bStartStop.Caption:=_('Start');
bAdmin.Enabled:=false;
end;
end;
if AutoStart then begin
AutoStart:=false;
if isRunning then begin
AddLog(_('Autostart active: modul is already running - aborted'),ltError);
end else begin
AddLog(_('Autostart active: starting...'));
Start;
end;
end;
end;
end.

View File

@@ -0,0 +1,53 @@
object fHelp: TfHelp
Left = 356
Top = 94
Caption = 'Help'
ClientHeight = 116
ClientWidth = 256
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate
DesignSize = (
256
116)
PixelsPerInch = 96
TextHeight = 13
object lAbout: TLabel
Left = 8
Top = 12
Width = 233
Height = 19
Caption = 'programmed by Steffen Strueber'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
end
object Label1: TLabel
Left = 8
Top = 64
Width = 105
Height = 13
Caption = 'Uhm, did this help? :-)'
end
object BitBtn1: TBitBtn
Left = 173
Top = 83
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = 'Close'
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 0
OnClick = BitBtn1Click
end
end

View File

@@ -0,0 +1,39 @@
unit uHelp;
interface
uses
GnuGettext, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TfHelp = class(TForm)
lAbout: TLabel;
Label1: TLabel;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
fHelp: TfHelp;
implementation
{$R *.dfm}
procedure TfHelp.BitBtn1Click(Sender: TObject);
begin
Close;
end;
procedure TfHelp.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
end;
end.

View File

@@ -0,0 +1,205 @@
object fLanguage: TfLanguage
Left = 471
Top = 128
BorderStyle = bsToolWindow
Caption = 'Language'
ClientHeight = 136
ClientWidth = 213
Color = clWhite
DoubleBuffered = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
KeyPreview = True
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate
OnKeyPress = FormKeyPress
OnShow = FormShow
DesignSize = (
213
136)
PixelsPerInch = 96
TextHeight = 13
object GroupBox1: TGroupBox
Left = 8
Top = 8
Width = 197
Height = 89
TabOrder = 0
object ImgEn: TImage
Left = 12
Top = 16
Width = 80
Height = 42
AutoSize = True
Picture.Data = {
0A544A504547496D6167654A070000FFD8FFE000104A46494600010101004800
480000FFDB0043000503040404030504040405050506070C08070707070F0B0B
090C110F1212110F111113161C1713141A1511111821181A1D1D1F1F1F131722
24221E241C1E1F1EFFDB0043010505050706070E08080E1E1411141E1E1E1E1E
1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E
1E1E1E1E1E1E1E1E1E1E1E1E1EFFC0001108002A005003012200021101031101
FFC4001F0000010501010101010100000000000000000102030405060708090A
0BFFC400B5100002010303020403050504040000017D01020300041105122131
410613516107227114328191A1082342B1C11552D1F02433627282090A161718
191A25262728292A3435363738393A434445464748494A535455565758595A63
6465666768696A737475767778797A838485868788898A92939495969798999A
A2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6
D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F01000301
01010101010101010000000000000102030405060708090A0BFFC400B5110002
0102040403040705040400010277000102031104052131061241510761711322
328108144291A1B1C109233352F0156272D10A162434E125F11718191A262728
292A35363738393A434445464748494A535455565758595A636465666768696A
737475767778797A82838485868788898A92939495969798999AA2A3A4A5A6A7
A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3
E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9FAFFDA000C03010002110311003F00F13B
3B589EC7497BBB2B48E764CE9EB185617EFF0068C1170778D800C8CF1C01F5A9
CD9D9E752FF46B6CFF00CC57089FF12FFF00490BFE8DF3FEF38C0EFC13F5A6E8
E863D1E348EDA7B44BB8156E2290B16D5C7DA06120F90ED2300707F84FAE2AD9
1266118907D8B3F651F37FC48BFD2BFE5E7E4F9FBF5F51E9B6BED9B77FEBFAFE
BE47CE25FD7F5FD7E656167679D3716D6D9FF9856513FE261FE9257FD27E7FDD
F191DB803EB505E5AC4963AB3DA595A493AA67505902A8B07FB4600B73BCEF04
60679E09FAD688126661890FDB71F6A1F37FC4F7FD2BFE5DFE4F93B74F43EB8A
A7AC2193489124B69EED2D2065B78A32C1B4806E0E527F906E2724727F887A62
84DDFF00AFEBFAF9034BFAFEBFAFC4F7FF00F857FF00017FE8A7DE7FDF49FF00
C6E8FF00857FF017FE8A7DE7FDF49FFC6E9FFF00099FECFDFF0044EB51FF00BE
7FFB6D1FF099FECFDFF44EB51FFBE7FF00B6D7E7DEEF91FBB7363BFE9FFF00E5
319FF0AFFE02FF00D14FBCFF00BE93FF008DD1FF000AFF00E02FFD14FBCFFBE9
3FF8DD3FFE133FD9FBFE89D6A3FF007CFF00F6DA3FE133FD9FBFE89D6A3FF7CF
FF006DA3DDF20E6C77FD3FFF00CA633FE15FFC05FF00A29F79FF007D27FF001B
A3FE15FF00C05FFA29F79FF7D27FF1BA7FFC267FB3F7FD13AD47FEF9FF00EDB4
7FC267FB3F7FD13AD47FEF9FFEDB47BBE41CD8EFFA7FFF0094CF27B3F867F106
DACACEDFFE109F13CC658C25C3CBA6B3358E26DDBAD8E78240C9E9C923DEA63F
0EBE20667FF8A0FC49FE8DFF001EFF00F12C6FF898FEFF007FFA573CFCBE99E8
07BD7D11FF0008BFED17FF0043DE93F927FF0019A3FE117FDA2FFE87BD27F24F
FE335EF7F6DD5FE43F3BFF0055F0FF00F4170FBDFF00F227CEE3E1D7C40CC19F
01F893FD27FE3E3FE258DFF12EFDFEFF00F45E78F97D71D48F7A86F3E19FC41B
9B2BCB7FF8423C4F098A3296EF169ACAD7D99B76EB939E480723AF200F7AFA3B
FE117FDA2FFE87BD27F24FFE3347FC22FF00B45FFD0F7A4FE49FFC668FEDBABF
C81FEABE1FFE82E1F7BFFE4487FE13FF008C1FF44760FF00BF0FFE347FC27FF1
83FE88EC1FF7E1FF00C6A6FF00845FF68BFF00A1EF49FC93FF008CD1FF0008BF
ED17FF0043DE93F927FF0019AF13DEF3FC0FABB60BFE9C7FE055087FE13FF8C1
FF0044760FFBF0FF00E347FC27FF00183FE88EC1FF007E1FFC6A6FF845FF0068
BFFA1EF49FC93FF8CD1FF08BFED17FF43DE93F927FF19A3DEF3FC02D82FF00A7
1FF815421FF84FFE307FD11D83FEFC3FF8D1FF0009FF00C60FFA23B07FDF87FF
001A9BFE117FDA2FFE87BD27F24FFE3347FC22FF00B45FFD0F7A4FE49FFC668F
7BCFF00B60BFE9C7FE0550E4FF00E15FFC36FF00A2E47FF02E3FFE2A8FF857FF
000DBFE8B91FFC0B8FFF008AAF9EA8AC39D763ECBFB1F13FF4152FFC061FE47D
0BFF000AFF00E1B7FD1723FF008171FF00F1547FC2BFF86DFF0045C8FF00E05C
7FFC557CF5451CEBB07F63E27FE82A5FF80C3FC8FA17FE15FF00C36FFA2E47FF
0002E3FF00E2A8FF00857FF0DBFE8B91FF00C0B8FF00F8AAF9EA8A39D760FEC7
C4FF00D054BFF0187F91F42FFC2BFF0086DFF45C8FFE05C7FF00C551FF000AFF
00E1B7FD1723FF008171FF00F155F3D51473AEC1FD8F89FF00A0A97FE030FF00
23E85FF857FF000DBFE8B91FFC0B8FFF008AA3FE15FF00C36FFA2E47FF0002E3
FF00E2ABE7AA28E75D83FB1F13FF004152FF00C061FE47FFD9}
OnClick = RadioGroup1Click
end
object ImgDe: TImage
Left = 104
Top = 16
Width = 80
Height = 42
AutoSize = True
Picture.Data = {
0A544A504547496D6167658F040000FFD8FFE000104A46494600010101004800
480000FFDB0043000503040404030504040405050506070C08070707070F0B0B
090C110F1212110F111113161C1713141A1511111821181A1D1D1F1F1F131722
24221E241C1E1F1EFFDB0043010505050706070E08080E1E1411141E1E1E1E1E
1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E
1E1E1E1E1E1E1E1E1E1E1E1E1EFFC0001108002A005003012200021101031101
FFC4001F0000010501010101010100000000000000000102030405060708090A
0BFFC400B5100002010303020403050504040000017D01020300041105122131
410613516107227114328191A1082342B1C11552D1F02433627282090A161718
191A25262728292A3435363738393A434445464748494A535455565758595A63
6465666768696A737475767778797A838485868788898A92939495969798999A
A2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6
D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F01000301
01010101010101010000000000000102030405060708090A0BFFC400B5110002
0102040403040705040400010277000102031104052131061241510761711322
328108144291A1B1C109233352F0156272D10A162434E125F11718191A262728
292A35363738393A434445464748494A535455565758595A636465666768696A
737475767778797A82838485868788898A92939495969798999AA2A3A4A5A6A7
A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3
E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9FAFFDA000C03010002110311003F00F8CA
8ADBFF0084575FFF009F0FFC8C9FFC551FF08AEBFF00F3E1FF009193FF008AAC
3EB543F9D7DE8F5BFB0335FF00A06A9FF804BFC8C4A2B6FF00E115D7FF00E7C3
FF002327FF001547FC22BAFF00FCF87FE464FF00E2A8FAD50FE75F7A0FEC0CD7
FE81AA7FE012FF0023128ADBFF0084575FFF009F0FFC8C9FFC551FF08AEBFF00
F3E1FF009193FF008AA3EB543F9D7DE83FB0335FFA06A9FF00804BFC8C4A2B6F
FE115D7FFE7C3FF2327FF1547FC22BAFFF00CF87FE464FFE2A8FAD50FE75F7A0
FEC0CD7FE81AA7FE012FF23128ADBFF84575FF00F9F0FF00C8C9FF00C551FF00
08AEBFFF003E1FF9193FF8AA3EB543F9D7DE83FB0335FF00A06A9FF804BFC8F4
FA2BDA7FE1447FD4D5FF0094FF00FED947FC288FFA9ABFF29FFF00DB2BF2DFF5
9B2BFF009FBF84BFC8FDFBFD63CB7FE7E7E12FF23C5A8AF69FF8511FF5357FE5
3FFF00B651FF000A23FEA6AFFCA7FF00F6CA3FD66CAFFE7EFE12FF0020FF0058
F2DFF9F9F84BFC8F16A2BDA7FE1447FD4D5FF94FFF00ED947FC288FF00A9ABFF
0029FF00FDB28FF59B2BFF009FBF84BFC83FD63CB7FE7E7E12FF0023C5A8AF69
FF008511FF005357FE53FF00FB651FF0A23FEA6AFF00CA7FFF006CA3FD66CAFF
00E7EFE12FF20FF58F2DFF009F9F84BFC8F16A2BDA7FE1447FD4D5FF0094FF00
FED947FC288FFA9ABFF29FFF00DB28FF0059B2BFF9FBF84BFC83FD63CB7FE7E7
E12FF23DA28A28AFC98FCB428A28A0028A28A0028A28A0028A28A00FFFD9}
OnClick = RadioGroup1Click
end
object rbEn: TRadioButton
Left = 46
Top = 64
Width = 30
Height = 17
TabOrder = 0
end
object rbDe: TRadioButton
Left = 138
Top = 64
Width = 30
Height = 17
TabOrder = 1
end
end
object bOkay: TBitBtn
Left = 130
Top = 103
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = 'OK'
DoubleBuffered = True
Glyph.Data = {
DE010000424DDE01000000000000760000002800000024000000120000000100
0400000000006801000000000000000000001000000000000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
3333333333333333333333330000333333333333333333333333F33333333333
00003333344333333333333333388F3333333333000033334224333333333333
338338F3333333330000333422224333333333333833338F3333333300003342
222224333333333383333338F3333333000034222A22224333333338F338F333
8F33333300003222A3A2224333333338F3838F338F33333300003A2A333A2224
33333338F83338F338F33333000033A33333A222433333338333338F338F3333
0000333333333A222433333333333338F338F33300003333333333A222433333
333333338F338F33000033333333333A222433333333333338F338F300003333
33333333A222433333333333338F338F00003333333333333A22433333333333
3338F38F000033333333333333A223333333333333338F830000333333333333
333A333333333333333338330000333333333333333333333333333333333333
0000}
ModalResult = 1
NumGlyphs = 2
ParentDoubleBuffered = False
TabOrder = 1
OnClick = bOkClick
end
object bAbort: TBitBtn
Left = 49
Top = 104
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = 'Abort'
DoubleBuffered = True
Kind = bkAbort
ParentDoubleBuffered = False
TabOrder = 2
OnClick = bAbortClick
end
end

View File

@@ -0,0 +1,86 @@
unit uLanguage;
interface
uses
GnuGettext, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, jpeg, ExtCtrls, Registry;
type
TfLanguage = class(TForm)
GroupBox1: TGroupBox;
ImgEn: TImage;
ImgDe: TImage;
rbEn: TRadioButton;
rbDe: TRadioButton;
bOkay: TBitBtn;
bAbort: TBitBtn;
procedure bOkClick(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure RadioGroup1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure bAbortClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private
OldLang: string;
public
end;
var
fLanguage: TfLanguage;
implementation
uses uTools, uMain;
{$R *.dfm}
procedure TfLanguage.bAbortClick(Sender: TObject);
begin
ModalResult:=mrAbort;
end;
procedure TfLanguage.bOkClick(Sender: TObject);
begin
if rbEn.Checked then Config.Language:='en'
else if rbde.Checked then Config.Language:='de'
else Config.Language:='en';
ModalResult:=mrOk;
if (OldLang<>'') and (OldLang<>Config.Language) then
MessageDlg('Restart application to apply changes!',mtInformation,[mbOk],0);
end;
procedure TfLanguage.FormCreate(Sender: TObject);
begin
TranslateComponent(self);
end;
procedure TfLanguage.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#27 then begin
key:=#0;
ModalResult:=mrAbort;
Close;
end;
end;
procedure TfLanguage.FormShow(Sender: TObject);
begin
OldLang:=Config.Language;
if Config.Language='en' then rbEn.Checked:=true
else if Config.Language='de' then rbDe.Checked:=true
else rbEn.Checked:=true;
end;
procedure TfLanguage.RadioGroup1Click(Sender: TObject);
begin
if (Sender=rbEn) or (Sender=ImgEn) then rbEn.Checked:=true;
if (Sender=rbDe) or (Sender=ImgDe) then rbDe.Checked:=true;
end;
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,909 @@
(*
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or
send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
Programmed by Steffen Strueber,
Updates:
3.0.2: May 10th 2011, Steffen Strueber
*)
unit uMain;
interface
uses
GnuGettext, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, Buttons, uTools, uTomcat,
uApache, uMySQL, uFileZilla, uMercury, uNetstat, uNetstatTable, Menus,
IniFiles, uProcesses, AppEvnts, ImgList, JCLDebug ;
type
TfMain = class(TForm)
imgXAMPP: TImage;
lHeader: TLabel;
bConfig: TBitBtn;
bSCM: TBitBtn;
gbModules: TGroupBox;
bApacheAction: TBitBtn;
bApacheAdmin: TBitBtn;
bMySQLAction: TBitBtn;
bMySQLAdmin: TBitBtn;
bFileZillaAction: TBitBtn;
bFileZillaAdmin: TBitBtn;
bMercuryAction: TBitBtn;
bMercuryAdmin: TBitBtn;
sbMain: TStatusBar;
bQuit: TBitBtn;
bHelp: TBitBtn;
bExplorer: TBitBtn;
pApacheStatus: TPanel;
TimerUpdateStatus: TTimer;
TrayIcon1: TTrayIcon;
bNetstat: TBitBtn;
puSystray: TPopupMenu;
miShowHide: TMenuItem;
miTerminate: TMenuItem;
N1: TMenuItem;
bApacheConfig: TBitBtn;
lPIDs: TLabel;
lPorts: TLabel;
lApachePIDs: TLabel;
bApacheLogs: TBitBtn;
lApachePorts: TLabel;
bMySQLConfig: TBitBtn;
bMySQLLogs: TBitBtn;
bFileZillaConfig: TBitBtn;
bFileZillaLogs: TBitBtn;
bMercuryConfig: TBitBtn;
reLog: TRichEdit;
lMySQLPIDs: TLabel;
lMySQLPorts: TLabel;
lFileZillaPorts: TLabel;
lFileZillaPIDs: TLabel;
lMercuryPorts: TLabel;
lMercuryPIDs: TLabel;
pMySQLStatus: TPanel;
pFileZillaStatus: TPanel;
pMercuryStatus: TPanel;
ApplicationEvents1: TApplicationEvents;
ImageList: TImageList;
bMySQLService: TBitBtn;
bFileZillaService: TBitBtn;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
bApacheService: TBitBtn;
bMercurylogs: TBitBtn;
puGeneral: TPopupMenu;
lTomcatPorts: TLabel;
lTomcatPIDs: TLabel;
bTomcatAction: TBitBtn;
bTomcatAdmin: TBitBtn;
bTomcatConfig: TBitBtn;
pTomcatStatus: TPanel;
bTomcatLogs: TBitBtn;
bTomcatService: TBitBtn;
bMercuryService: TBitBtn;
bXamppShell: TBitBtn;
puTomcatAction: TPopupMenu;
miActionTomcatAuto: TMenuItem;
N2: TMenuItem;
Statuserkennungnichtsicher1: TMenuItem;
miActionTomcatStop: TMenuItem;
miActionTomcatStart: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure bApacheActionClick(Sender: TObject);
procedure TimerUpdateStatusTimer(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure bNetstatClick(Sender: TObject);
procedure miTerminateClick(Sender: TObject);
procedure bQuitClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure miShowHideClick(Sender: TObject);
procedure TrayIcon1DblClick(Sender: TObject);
procedure bExplorerClick(Sender: TObject);
procedure bSCMClick(Sender: TObject);
procedure bApacheAdminClick(Sender: TObject);
procedure bApacheConfigClick(Sender: TObject);
procedure miGeneralClick(Sender: TObject);
procedure bConfigClick(Sender: TObject);
procedure bApacheLogsClick(Sender: TObject);
procedure miApacheLogsAccessClick(Sender: TObject);
procedure miApacheLogsErrorClick(Sender: TObject);
procedure bMySQLActionClick(Sender: TObject);
procedure bMySQLAdminClick(Sender: TObject);
procedure bMySQLConfigClick(Sender: TObject);
procedure bMySQLLogsClick(Sender: TObject);
procedure bFileZillaActionClick(Sender: TObject);
procedure bFileZillaAdminClick(Sender: TObject);
procedure bFileZillaConfigClick(Sender: TObject);
procedure bFileZillaLogsClick(Sender: TObject);
procedure bMercuryActionClick(Sender: TObject);
procedure bMercuryAdminClick(Sender: TObject);
procedure bMercuryConfigClick(Sender: TObject);
procedure bHelpClick(Sender: TObject);
procedure bApacheServiceClick(Sender: TObject);
procedure bMySQLServiceClick(Sender: TObject);
procedure bFileZillaServiceClick(Sender: TObject);
procedure bMercuryServiceClick(Sender: TObject);
procedure bMercurylogsClick(Sender: TObject);
procedure bXamppShellClick(Sender: TObject);
procedure bTomcatConfigClick(Sender: TObject);
procedure bTomcatLogsClick(Sender: TObject);
procedure bTomcatActionClick(Sender: TObject);
procedure bTomcatAdminClick(Sender: TObject);
procedure miActionTomcatAutoClick(Sender: TObject);
procedure miActionTomcatStopClick(Sender: TObject);
procedure miActionTomcatStartClick(Sender: TObject);
procedure ApplicationEvents1Exception(Sender: TObject; E: Exception);
private
Apache: tApache;
MySQL: tMySQL;
FileZilla: tFileZilla;
Mercury: tMercury;
Tomcat: tTomcat;
WindowsShutdownInProgress: boolean;
procedure UpdateStatusAll;
function TryGuessXamppVersion:string;
procedure EditConfigLogs(ConfigFile: string);
procedure GeneralPUClear;
procedure GeneralPUAdd(text: string=''; hint: string=''; tag: integer=0);
procedure GeneralPUAddUser(text: string; hint: string='');
procedure GeneralPUAddUserFromSL(sl: tStringList);
procedure WMQueryEndSession(var Msg: TWMQueryEndSession); message WM_QueryEndSession; // detect Windows shutdown message
procedure SaveLogFile;
public
procedure AddLog(module,log: string; LogType: tLogType=ltDefault); overload;
procedure AddLog(log: string; LogType: tLogType=ltDefault); overload;
end;
var
fMain: TfMain;
implementation
uses uConfig, uHelp;
{$R *.dfm}
procedure TfMain.miShowHideClick(Sender: TObject);
begin
if Visible then begin
Hide;
if fMain.WindowState=wsMinimized then fMain.WindowState:=wsNormal;
end else begin
Show;
if fMain.WindowState=wsMinimized then fMain.WindowState:=wsNormal;
Application.BringToFront;
end;
end;
procedure TfMain.miGeneralClick(Sender: TObject);
var
mi: TMenuItem;
App: string;
begin
if not (Sender is TMenuItem) then exit;
mi:=Sender as tMenuItem;
if mi.Tag=0 then
EditConfigLogs(mi.Hint);
if mi.Tag=1 then begin
App:=BaseDir+mi.Hint;
ExecuteFile(App,'','',SW_SHOW);
Addlog(Format(_('Executing "%s"'),[App]));
end;
end;
procedure TfMain.AddLog(module, log: string; LogType: tLogType=ltDefault);
begin
if (not Config.ShowDebug) and (LogType=ltDebug) or (LogType=ltDebugDetails) then exit;
if (LogType=ltDebugDetails) and (Config.DebugLevel=0) then exit;
with reLog do begin
SelStart := GetTextLen;
SelAttributes.Color := clGray;
SelText := TimeToStr(Now)+' ';
SelAttributes.Color := clBlack;
SelText := '[';
SelAttributes.Color := clBlue;
SelText := module;
SelAttributes.Color := clBlack;
SelText := '] '+#9;
case logtype of
ltDefault: SelAttributes.Color := clBlack;
ltInfo: SelAttributes.Color := clBlue;
ltError: SelAttributes.Color := clRed;
ltDebug: SelAttributes.Color := clGray;
ltDebugDetails: SelAttributes.Color := clSilver;
end;
SelText := Log+#13;
// SelStart := GetTextLen;
SendMessage(Handle, EM_SCROLLCARET,0,0);
end;
end;
procedure TfMain.AddLog(log: string; LogType: tLogType=ltDefault);
begin
AddLog('main',log,LogType);
end;
procedure TfMain.ApplicationEvents1Exception(Sender: TObject; E: Exception);
var ts:tSTringList;
i:integer;
begin
// GlobalAddLog(Format('Exception in thread: %d / %s', [Thread.ThreadID, JclDebugThreadList.ThreadClassNames[Thread.ThreadID]]),0,'LogException');
// Note: JclLastExceptStackList always returns list for *current* thread ID. To simplify getting the
// stack of thread where an exception occured JclLastExceptStackList returns stack of the thread instead
// of current thread when called *within* the JclDebugThreadList.OnSyncException handler. This is the
// *only* exception to the behavior of JclLastExceptStackList described above.
ts:=TStringList.Create;
AddLog('EXCEPTION',E.Message,ltError);
JclLastExceptStackList.AddToStrings(ts, True, True, True);
for i:=0 to ts.count-1 do
AddLog('EXCEPTION',ts[i],ltError);
ts.Free;
end;
procedure TfMain.miActionTomcatAutoClick(Sender: TObject);
begin
if Tomcat.isRunning then Tomcat.Stop
else Tomcat.Start;
end;
procedure TfMain.miActionTomcatStartClick(Sender: TObject);
begin
Tomcat.Start;
end;
procedure TfMain.miActionTomcatStopClick(Sender: TObject);
begin
Tomcat.Stop
end;
procedure TfMain.bApacheActionClick(Sender: TObject);
begin
if Apache.isRunning then Apache.Stop
else Apache.Start;
end;
procedure TfMain.miTerminateClick(Sender: TObject);
begin
Application.Terminate;
end;
procedure TfMain.SaveLogFile;
var
en: string;
LogFileName: string;
f: TextFile;
i: Integer;
begin
en:=ExtractFileName(Application.ExeName);
while (length(en)>0) and (en[length(en)]<>'.') do en:=copy(en,1,length(en)-1);
LogFileName:=Basedir+en+'log';
AssignFile(f,LogFileName);
if FileExists(LogFileName) then Append(f)
else Rewrite(f);
for i:=0 to reLog.Lines.Count-1 do
Writeln(f,reLog.Lines[i]);
Writeln(f,'');
CloseFile(f);
end;
procedure TfMain.miApacheLogsAccessClick(Sender: TObject);
begin
Apache.ShowLogs(altAccess);
end;
procedure TfMain.miApacheLogsErrorClick(Sender: TObject);
begin
Apache.ShowLogs(altError);
end;
procedure TfMain.bQuitClick(Sender: TObject);
begin
miTerminateClick(Sender);
end;
procedure TfMain.bExplorerClick(Sender: TObject);
var
App: string;
begin
App:=BaseDir;
ExecuteFile(App,'','',SW_SHOW);
Addlog(Format(_('Executing "%s"'),[App]));
end;
procedure TfMain.bFileZillaActionClick(Sender: TObject);
begin
if FileZilla.isService then begin
if FileZilla.isRunning then FileZilla.Stop
else FileZilla.Start;
end else begin
MessageDlg(_('FileZilla must be run as service!'),mtInformation,[mbOK],0);
end;
end;
procedure TfMain.bFileZillaAdminClick(Sender: TObject);
begin
FileZilla.Admin;
end;
procedure TfMain.bFileZillaConfigClick(Sender: TObject);
begin
GeneralPUClear;
GeneralPUAdd('FileZilla Server.xml','FileZillaFTP\FileZilla Server.xml');
GeneralPUAddUserFromSL(Config.UserConfig.FileZilla);
GeneralPUAdd();
GeneralPUAdd(_('<Browse>'),'FileZillaFTP',1);
puGeneral.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y);
end;
procedure TfMain.bFileZillaLogsClick(Sender: TObject);
begin
GeneralPUClear;
// GeneralPUAdd('error.log','mysql\data\mysql_error.log');
GeneralPUAddUserFromSL(Config.UserLogs.FileZilla);
puGeneral.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y);
end;
procedure TfMain.bFileZillaServiceClick(Sender: TObject);
var oldIsService: boolean;
begin
oldIsService:=FileZilla.isService;
if FileZilla.isRunning then begin
MessageDlg(_('Services cant be installed or uninstalled while service is running!'),mtError,[mbOk],0);
exit;
end;
if FileZilla.isService then begin
if MessageDlg(Format(_('Click Yes to uninstall the %s service'),[FileZilla.ModuleName]),mtConfirmation,[mbYes, mbNo],0)=mrYes then
FileZilla.ServiceUnInstall
else
exit;
end else begin
if MessageDlg(Format(_('Click Yes to install the "%s" service'),[FileZilla.ModuleName]),mtConfirmation,[mbYes, mbNo],0)=mrYes then
FileZilla.ServiceInstall
else
exit;
end;
FileZilla.CheckIsService;
if (oldIsService=FileZilla.isService) then begin
FileZilla.AddLog(_('Service was NOT (un)installed!'),ltError);
if (WinVersion.Major=5) then // WinXP
FileZilla.AddLog(_('One possible reason for failure: On windows security box you !!!MUST UNCHECK!!! that "Protect my computer and data from unauthorized program activity" checkbox!!!'),ltError);
end;
end;
procedure TfMain.bHelpClick(Sender: TObject);
begin
fHelp.Show;
end;
procedure TfMain.bApacheServiceClick(Sender: TObject);
var oldIsService: boolean;
begin
oldIsService:=Apache.isService;
if Apache.isRunning then begin
MessageDlg(_('Services cant be installed or uninstalled while service is running!'),mtError,[mbOk],0);
exit;
end;
if Apache.isService then begin
if MessageDlg(Format(_('Click Yes to uninstall the %s service'),[Apache.ModuleName]),mtConfirmation,[mbYes, mbNo],0)=mrYes then
Apache.ServiceUnInstall
else
exit;
end else begin
if MessageDlg(Format(_('Click Yes to install the "%s" service'),[Apache.ModuleName]),mtConfirmation,[mbYes, mbNo],0)=mrYes then
Apache.ServiceInstall
else
exit;
end;
Apache.CheckIsService;
if (oldIsService=Apache.isService) then begin
Apache.AddLog(_('Service was NOT (un)installed!'),ltError);
if (WinVersion.Major=5) then // WinXP
Apache.AddLog(_('One possible reason for failure: On windows security box you !!!MUST UNCHECK!!! that "Protect my computer and data from unauthorized program activity" checkbox!!!'),ltError);
end else begin
Apache.AddLog(_('Successful!'));
end;
end;
procedure TfMain.bMercuryActionClick(Sender: TObject);
begin
if Mercury.isRunning then Mercury.Stop
else Mercury.Start;
end;
procedure TfMain.bMercuryAdminClick(Sender: TObject);
begin
Mercury.Admin;
end;
procedure TfMain.bMercuryConfigClick(Sender: TObject);
begin
GeneralPUClear;
GeneralPUAdd('mercury.ini','MercuryMail\mercury.ini');
GeneralPUAddUserFromSL(Config.UserConfig.Mercury);
GeneralPUAdd();
GeneralPUAdd(_('<Browse>'),'MercuryMail',1);
puGeneral.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y);
end;
procedure TfMain.bMercurylogsClick(Sender: TObject);
begin
GeneralPUClear;
// GeneralPUAdd('error.log','mysql\data\mysql_error.log');
GeneralPUAddUserFromSL(Config.UserLogs.Mercury);
puGeneral.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y);
end;
procedure TfMain.bMercuryServiceClick(Sender: TObject);
begin
MessageDlg(_('Mercury cant be run as service!'),mtError,[mbOk],0);
end;
procedure TfMain.bMySQLActionClick(Sender: TObject);
begin
if MySQL.isRunning then MySQL.Stop
else MySQL.Start;
end;
procedure TfMain.bMySQLAdminClick(Sender: TObject);
begin
MySQL.Admin;
end;
procedure TfMain.bMySQLConfigClick(Sender: TObject);
begin
GeneralPUClear;
GeneralPUAdd('my.ini','mysql\bin\my.ini');
GeneralPUAddUserFromSL(Config.UserConfig.MySQL);
GeneralPUAdd();
GeneralPUAdd(_('<Browse>'),'mysql',1);
puGeneral.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y);
end;
procedure TfMain.bMySQLLogsClick(Sender: TObject);
begin
GeneralPUClear;
GeneralPUAdd('error.log','mysql\data\mysql_error.log');
GeneralPUAddUserFromSL(Config.UserLogs.MySQL);
GeneralPUAdd();
GeneralPUAdd(_('<Browse>'),'mysql\data',1);
puGeneral.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y);
end;
procedure TfMain.bMySQLServiceClick(Sender: TObject);
var oldIsService: boolean;
begin
oldIsService:=Apache.isService;
if MySQL.isRunning then begin
MessageDlg(_('Services cant be installed or uninstalled while service is running!'),mtError,[mbOk],0);
exit;
end;
if MySQL.isService then begin
if MessageDlg(Format(_('Click Yes to uninstall the %s service'),[MySQL.ModuleName]),mtConfirmation,[mbYes, mbNo],0)=mrYes then
MySQL.ServiceUnInstall
else
exit;
end else begin
if MessageDlg(Format(_('Click Yes to install the "%s" service'),[MySQL.ModuleName]),mtConfirmation,[mbYes, mbNo],0)=mrYes then
MySQL.ServiceInstall
else
exit;
end;
MySQL.CheckIsService;
if (oldIsService=MySQL.isService) then begin
MySQL.AddLog(_('Service was NOT (un)installed!'),ltError);
if (WinVersion.Major=5) then // WinXP
MySQL.AddLog(_('One possible reason for failure: On windows security box you !!!MUST UNCHECK!!! that "Protect my computer and data from unauthorized program activity" checkbox!!!'),ltError);
end;
end;
procedure TfMain.bConfigClick(Sender: TObject);
begin
fConfig.Show;
end;
procedure TfMain.bSCMClick(Sender: TObject);
var
App: string;
begin
App:='services.msc';
ExecuteFile(App,'','',SW_SHOW);
Addlog(Format(_('Executing "%s"'),[App]));
end;
procedure TfMain.bTomcatActionClick(Sender: TObject);
begin
if Tomcat.isRunning then begin
miActionTomcatAuto.Caption:='Stop';
miActionTomcatStop.Visible:=false;
miActionTomcatStart.Visible:=true;
end else begin
miActionTomcatAuto.Caption:='Start';
miActionTomcatStop.Visible:=true;
miActionTomcatStart.Visible:=false;
end;
puTomcatAction.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y);
// if Tomcat.isRunning then Tomcat.Stop
// else Tomcat.Start;
end;
procedure TfMain.bTomcatAdminClick(Sender: TObject);
begin
Tomcat.Admin;
end;
procedure TfMain.bTomcatConfigClick(Sender: TObject);
begin
GeneralPUClear;
GeneralPUAdd('server.xml','Tomcat\conf\server.xml');
GeneralPUAdd('tomcat-users.xml','Tomcat\conf\tomcat-users.xml');
GeneralPUAdd('web.xml','Tomcat\conf\web.xml');
GeneralPUAdd('context.xml','Tomcat\conf\context.xml');
GeneralPUAddUserFromSL(Config.UserConfig.Tomcat);
GeneralPUAdd();
GeneralPUAdd(_('<Browse>'),'Tomcat\conf',1);
puGeneral.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y);
end;
procedure TfMain.bTomcatLogsClick(Sender: TObject);
begin
GeneralPUClear;
GeneralPUAddUserFromSL(Config.UserLogs.Tomcat);
GeneralPUAdd();
GeneralPUAdd(_('<Browse>'),'tomcat\logs',1);
puGeneral.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y);
end;
procedure TfMain.bXamppShellClick(Sender: TObject);
const
cBatchFileContents=
'@ECHO OFF'+cr+
''+cr+
'GOTO weiter'+cr+
':setenv'+cr+
'SET "MIBDIRS=%~dp0php\extras\mibs"'+cr+
'SET "MIBDIRS=%MIBDIRS:\=/%"'+cr+
'SET "MYSQL_HOME=%~dp0mysql\bin"'+cr+
'SET "OPENSSL_CONF=%~dp0apache\bin\openssl.cnf"'+cr+
'SET "OPENSSL_CONF=%OPENSSL_CONF:\=/%"'+cr+
'SET "PHP_PEAR_SYSCONF_DIR=%~dp0php"'+cr+
'SET "PHPRC=%~dp0php"'+cr+
'SET "TMP=%~dp0tmp"'+cr+
'SET "PERL5LIB="'+cr+
'SET "Path=%~dp0;%~dp0php;%~dp0perl\site\bin;%~dp0perl\bin;%~dp0apache\bin;%~dp0mysql\bin;%~dp0FileZillaFTP;%~dp0MercuryMail;%~dp0sendmail;%~dp0webalizer;%~dp0tomcat\bin;%Path%"'+cr+
'GOTO :EOF'+cr+
':weiter'+cr+
''+cr+
'IF "%1" EQU "setenv" ('+cr+
' ECHO.'+cr+
' ECHO Setting environment for using XAMPP for Windows.'+cr+
' CALL :setenv'+cr+
') ELSE ('+cr+
' SETLOCAL'+cr+
' TITLE XAMPP for Windows'+cr+
' PROMPT %username%@%computername%$S$P$_#$S'+cr+
' START "" /B %COMSPEC% /K "%~f0" setenv'+cr+
')';
cFilename = 'xampp_shell.bat';
var
ts: TStringList;
batchfile: string;
begin
batchfile:=BaseDir+cFilename;
if not fileexists(BatchFile) then begin
if MessageDlg(Format(_('File "%s" not found. Should it be created now?'),[BatchFile]),mtConfirmation,[mbYes, mbAbort],0)<>mrYes then exit;
ts:=TStringList.Create;
ts.Text:=cBatchFileContents;
try
ts.SaveToFile(batchfile);
except
on e:exception do begin
MessageDlg(_('Error')+': '+E.Message,mtError,[mbOK],0);
end;
end;
ts.Free;
end;
ExecuteFile(batchfile,'','',SW_SHOW);
end;
procedure TfMain.GeneralPUAdd(text: string=''; hint: string=''; tag: integer=0);
var
mi: TMenuItem;
begin
mi:=TMenuItem.Create(puGeneral);
mi.Caption:=text;
if text='' then begin
mi.Caption:='-';
end else begin
mi.Hint:=hint;
mi.Tag:=tag;
mi.OnClick:=miGeneralClick;
end;
puGeneral.Items.Add(mi);
end;
procedure TfMain.GeneralPUAddUser(text: string; hint: string='');
var
myCaption: TranslatedUnicodeString;
mi, miMain: TMenuItem;
begin
myCaption:=_('User defined');
miMain:=puGeneral.Items.Find(myCaption);
if miMain=nil then begin
GeneralPUAdd();
miMain:=TMenuItem.Create(puGeneral);
miMain.Caption:=myCaption;
puGeneral.Items.Add(miMain);
end;
mi:=TMenuItem.Create(miMain);
mi.Caption:=text;
if hint<>'' then mi.Hint:=hint
else mi.Hint:=text;
mi.OnClick:=miGeneralClick;
miMain.Add(mi);
end;
procedure TfMain.GeneralPUAddUserFromSL(sl: tStringList);
var
i: Integer;
begin
for i:=0 to sl.Count-1 do
GeneralPUAddUser(sl[i]);
end;
procedure TfMain.GeneralPUClear;
begin
puGeneral.Items.Clear;
end;
procedure TfMain.EditConfigLogs(ConfigFile: string);
var
App, Param: string;
begin
App:=Config.EditorApp;
Param:=BaseDir+ConfigFile;
Addlog(Format(_('Executing %s %s'),[App,Param]),ltDebug);
ExecuteFile(app,param,'',SW_SHOW);
end;
procedure TfMain.bNetstatClick(Sender: TObject);
begin
fNetStat.Show;
fNetstat.RefreshTable(true);
end;
procedure TfMain.bApacheAdminClick(Sender: TObject);
begin
Apache.Admin;
end;
procedure TfMain.bApacheConfigClick(Sender: TObject);
begin
GeneralPUClear;
GeneralPUAdd('Apache (httpd.conf)','apache/conf/httpd.conf');
GeneralPUAdd('PHP (php.ini)','php/php.ini');
GeneralPUAddUserFromSL(Config.UserConfig.Apache);
GeneralPUAdd();
GeneralPUAdd(_('<Browse>')+' [Apache]','apache',1);
GeneralPUAdd(_('<Browse>')+' [PHP]','php',1);
puGeneral.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y);
end;
procedure TfMain.bApacheLogsClick(Sender: TObject);
begin
GeneralPUClear;
GeneralPUAdd('access.log','apache\logs\access.log');
GeneralPUAdd('error.log','apache\logs\access.log');
GeneralPUAddUserFromSL(Config.UserLogs.Apache);
GeneralPUAdd();
GeneralPUAdd(_('<Browse>'),'apache\logs',1);
puGeneral.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y);
end;
procedure TfMain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caHide;
end;
procedure TfMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if WindowsShutdownInProgress then begin
CanClose:=true;
end else begin
CanClose:=false;
Hide;
end;
end;
procedure TfMain.FormCreate(Sender: TObject);
var
isAdmin: Boolean;
xamppVersion: string;
CCVersion: string;
begin
TranslateComponent(Self);
BaseDir:=LowerCase(ExtractFilePath(Application.ExeName));
if GetComputerName='STRUEBER' then BaseDir:='c:\xampp';
AddLog(_('Initializing main'));
left:=screen.WorkAreaWidth-Width;
top:=screen.WorkAreaHeight-Height;
WinVersion:=GetWinVersion;
WindowsShutdownInProgress:=false;
AddLog(Format(_('Windows version: %s'),[WinVersion.WinVersion]));
xamppVersion:=TryGuessXamppVersion;
AddLog('Xampp version: '+xamppVersion);
if cCompileDate<>'' then CCVersion:=GlobalProgramversion+Format(' [ Compiled: %s ]',[cCompileDate])
else CCVersion:=GlobalProgramversion;
AddLog('Control center version: '+CCVersion);
Caption:='XAMPP Control Panel v'+GlobalProgramversion+Format(' [ Compiled: %s ]',[cCompileDate]);
lHeader.Caption:='XAMPP Control Panel v'+GlobalProgramversion;
CurrentUser:=GetCurrentUserName;
isAdmin:=IsWindowsAdmin;
if isAdmin then begin
AddLog(_('Running as admin - good!'));
end else begin
AddLog(_('Running not as admin! This will work for all application stuff, but whenever you do'),ltInfo);
AddLog(_('something with services there will be a security dialogue! So think about running'),ltInfo);
AddLog(_('this application with administrator rights!'),ltInfo);
end;
AddLog(Format(_('Working with basedir: "%s"'),[BaseDir]));
if BaseDir[length(BaseDir)]<>'\' then BaseDir:=BaseDir+'\';
NetStatTable.UpdateTable;
Processes.Update;
AddLog(_('Initializing moduls'));
Apache:=tApache.Create( bApacheService, pApacheStatus, lApachePIDs, lApachePorts, bApacheAction, bApacheAdmin);
MySQL:=tMySQL.Create( bMySQLService, pMySQLStatus, lMySQLPIDs, lMySQLPorts, bMySQLAction, bMySQLAdmin);
FileZilla:=tFileZilla.Create( bFileZillaService, pFileZillaStatus, lFileZillaPIDs, lFileZillaPorts, bFileZillaAction, bFileZillaAdmin);
Mercury:=tMercury.Create( bMercuryService, pMercuryStatus, lMercuryPIDs, lMercuryPorts, bMercuryAction, bMercuryAdmin);
Tomcat:=tTomcat.Create( bTomcatService, pTomcatStatus, lTomcatPIDs, lTomcatPorts, bTomcatAction, bTomcatAdmin);
if Config.ASApache then begin
Apache.AutoStart:=true;
AddLog(Format(_('Enabling autostart for module "%s"'),[Apache.ModuleName]));
end;
if Config.ASMySQL then begin
MySQL.AutoStart:=true;
AddLog(Format(_('Enabling autostart for module "%s"'),[MySQL.ModuleName]));
end;
if Config.ASFileZilla then begin
FileZilla.AutoStart:=true;
AddLog(Format(_('Enabling autostart for module "%s"'),[FileZilla.ModuleName]));
end;
if Config.ASMercury then begin
Mercury.AutoStart:=true;
AddLog(Format(_('Enabling autostart for module "%s"'),[Mercury.ModuleName]));
end;
if Config.ASTomcat then begin
Tomcat.AutoStart:=true;
AddLog(Format(_('Enabling autostart for module "%s"'),[Tomcat.ModuleName]));
end;
AddLog(_('Starting')+' check-timer');
TimerUpdateStatus.Enabled:=true;
// UpdateStatusAll;
end;
procedure TfMain.FormDestroy(Sender: TObject);
begin
AddLog(_('Deinitializing moduls'));
Apache.Free;
MySQL.Free;
FileZilla.Free;
Mercury.Free;
AddLog(_('Deinitializing main'));
SaveLogFile;
end;
procedure TfMain.TimerUpdateStatusTimer(Sender: TObject);
begin
UpdateStatusAll;
end;
procedure TfMain.TrayIcon1DblClick(Sender: TObject);
begin
miShowHideClick(nil);
end;
function TfMain.TryGuessXamppVersion: string;
var ts: TStringList;
s: string;
p: Integer;
begin
result:='???';
ts:=TStringList.Create;
try
ts.LoadFromFile(BaseDir+'\readme_de.txt');
if ts.Count<1 then exit;
s:=LowerCase(ts[0]);
p:=pos('version',s);
if p=0 then exit;
delete(s,1,p+7);
p:=pos(' ',s);
if p=0 then exit;
result:=copy(s,1,p-1);
except
end;
ts.Free;
end;
procedure DumpProcesses;
var ProcInfo: TProcInfo;
p: Integer;
s: string;
begin
for p:=0 to Processes.ProcessList.Count-1 do begin
ProcInfo:=Processes.ProcessList[p];
s:=Format('%d %s',[ProcInfo.PID,ProcInfo.ExePath]);
fMain.reLog.Lines.Add(s)
end;
end;
procedure TfMain.UpdateStatusAll;
begin
Processes.Update;
NetStatTable.UpdateTable;
// DumpProcesses;
// 1. Check Apache
Apache.UpdateStatus;
// 2. Check MySql
MySQL.UpdateStatus;
// 3. Check Filezilla
FileZilla.UpdateStatus;
// 4. Check Mercury
Mercury.UpdateStatus;
// 5. Check Mercury
Tomcat.UpdateStatus;
end;
procedure TfMain.WMQueryEndSession(var Msg: TWMQueryEndSession);
begin
WindowsShutdownInProgress:=true;
inherited;
end;
end.

View File

@@ -0,0 +1,233 @@
unit uMercury;
interface
uses GnuGettext, uBaseModule, SysUtils, Classes, Windows, ExtCtrls, StdCtrls, Buttons,
uNetstatTable, uTools, uProcesses;
type
tMercury = class(tBaseModule)
OldPIDs, OldPorts: string;
procedure ServiceInstall; override;
procedure ServiceUnInstall; override;
procedure Start; override;
procedure Stop; override;
procedure Admin; override;
procedure UpdateStatus; override;
procedure AddLog(Log: string; LogType: tLogType=ltDefault); reintroduce;
constructor Create(pbbService: TBitBtn; pStatusPanel: tPanel; pPIDLabel, pPortLabel: tLabel; pStartStopButton, pAdminButton: tBitBtn);
destructor Destroy; override;
end;
implementation
uses uMain;
const
// cServiceName = 'Mercury';
cModuleName = 'Mercury';
var hWindow: HWND;
{ tMercury }
procedure tMercury.AddLog(Log: string; LogType: tLogType);
begin
inherited AddLog('mercury', Log, LogType);
end;
function EnumProcess(hHwnd: HWND; lParam : integer): boolean; stdcall;
var
pPid : DWORD;
title, ClassName : string;
begin
if (hHwnd=0) then begin
result := false;
end else begin
GetWindowThreadProcessId(hHwnd,pPid);
SetLength(ClassName, 255);
SetLength(ClassName, GetClassName(hHwnd, PChar(className), Length(className)));
SetLength(title, 255);
SetLength(title, GetWindowText(hHwnd, PChar(title), Length(title)));
// fMain.Addlog(
// 'Class Name = ' + className +
// '; Title = ' + title +
// '; HWND = ' + IntToStr(hHwnd) +
// '; Pid = ' + IntToStr(pPid)
// );
if title='Mercury/32' then begin
hWindow:=hHwnd;
end;
Result := true;
end;
end;
procedure tMercury.Admin;
begin
hWindow:=0;
EnumWindows(@EnumProcess,0);
if hWindow<>0 then
ShowWindow(hWindow,SW_SHOW);
end;
constructor tMercury.Create;
const Ports:array[0..6] of integer=(25,79,105,106,110,143,2224);
var
PortBlocker: string;
ServerApp: string;
p: Integer;
// DidShowRunningWarn: Boolean;
BlockedPorts: string;
begin
inherited;
ModuleName:=cModuleName;
isService:=false;
// DidShowRunningWarn:=false;
AddLog(_('Initializing module...'),ltDebug);
ServerApp:=basedir+'MercuryMail\mercury.exe';
if not FileExists(ServerApp) then
AddLog(Format(_('Possible problem detected: file "%s" not found - run this program from your XAMPP root directory!'),[ServerApp]),ltError);
if Config.CheckDefaultPorts then begin
AddLog(_('Checking default ports...'),ltDebug);
for p:=Low(Ports) to High(Ports) do begin
PortBlocker:=NetStatTable.isPortInUse(Ports[p]);
if (PortBlocker<>'') then begin
if (LowerCase(PortBlocker)=LowerCase(ServerApp)) then begin
// if NOT DidShowRunningWarn then
// AddLog(Format(_('"%s" seems to be running on port %d?'),[ServerApp,Ports[p]]),ltError);
// DidShowRunningWarn:=true;
if BlockedPorts='' then BlockedPorts:=InttoStr(Ports[p])
else BlockedPorts:=BlockedPorts+', '+InttoStr(Ports[p]);
end else begin
AddLog('Possible problem detected: Port '+IntToStr(Ports[p])+' in use by "'+PortBlocker+'"!',ltError);
AddLog(Format(_('Possible problem detected: Port %d in use by "%s"!'),[Ports[p],PortBlocker]),ltError);
end;
end;
end;
if BlockedPorts<>'' then
AddLog(Format(_('"%s" seems to be running on port(s) %s?'),[ServerApp,BlockedPorts]),ltError);
end;
end;
destructor tMercury.Destroy;
begin
inherited;
end;
procedure tMercury.ServiceInstall;
begin
inherited;
end;
procedure tMercury.ServiceUnInstall;
begin
inherited;
end;
procedure tMercury.Start;
var
App: string;
begin
App:=BaseDir+'MercuryMail\mercury.exe';
AddLog(Format(_('Starting %s app...'),[cModuleName]));
Addlog(Format(_('Executing "%s"'),[App]),ltDebug);
RunProcess(App,SW_HIDE,false);
AddLog('Starting Mercury...');
end;
procedure tMercury.Stop;
var
App: string;
begin
AddLog('Stopping Mercury');
Admin;
AddLog(_('Stopping')+' '+cModuleName);
App:=BaseDir+'apache\bin\pv.exe -f -c mercury.exe -q -e';
Addlog(Format(_('Executing "%s"'),[App]),ltDebug);
RunProcess(App,SW_HIDE,false);
end;
procedure tMercury.UpdateStatus;
var
p: Integer;
ProcInfo: TProcInfo;
s: string;
ports: string;
begin
if IsService then begin
end else begin
isRunning:=false;
PIDList.Clear;
for p:=0 to Processes.ProcessList.Count-1 do begin
ProcInfo:=Processes.ProcessList[p];
if (pos(BaseDir,ProcInfo.ExePath)=1) and (pos('mercury.exe',ProcInfo.Module)=1) then begin
isRunning:=true;
PIDList.Add(Pointer(ProcInfo.PID));
end;
end;
end;
s:='';
// Checking processes
for p:=0 to PIDList.Count-1 do begin
if p=0 then s:=IntToStr(Integer(PIDList[p]))
else s:=s+#13+IntToStr(Integer(PIDList[p]));
end;
if s<>OldPIDs then begin
lPID.Caption:=s;
OldPIDs:=s;
end;
// Checking netstats
s:='';
for p:=0 to PIDList.Count-1 do begin
ports:=NetStatTable.GetPorts4PID(Integer(PIDList[p]));
if ports<>'' then begin
if s='' then s:=ports
else s:=s+', '+ports;
end;
end;
if s<>OldPorts then begin
lPort.Caption:=s;
OldPorts:=s;
end;
if byte(isRunning)<>oldIsRunningByte then begin
if oldIsRunningByte<>2 then begin
if isRunning then s:=_('running')
else s:=_('stopped');
AddLog(_('Status change detected:')+' '+s);
end;
oldIsRunningByte:=byte(isRunning);
if isRunning then begin
pStatus.Color:=cRunningColor;
bStartStop.Caption:=_('Stop');
bAdmin.Enabled:=true;
end else begin
pStatus.Color:=cStoppedColor;
bStartStop.Caption:=_('Start');
bAdmin.Enabled:=false;
end;
end;
if AutoStart then begin
AutoStart:=false;
if isRunning then begin
AddLog(_('Autostart active: modul is already running - aborted'),ltError);
end else begin
AddLog(_('Autostart active: starting...'));
Start;
end;
end;
end;
end.

View File

@@ -0,0 +1,245 @@
unit uMySQL;
interface
uses GnuGettext, uBaseModule, SysUtils, Classes, Windows, ExtCtrls, StdCtrls, Buttons,
uNetstatTable, uTools, uProcesses;
type
tMySQL = class(tBaseModule)
OldPIDs, OldPorts: string;
procedure ServiceInstall; override;
procedure ServiceUnInstall; override;
procedure Start; override;
procedure Stop; override;
procedure Admin; override;
procedure UpdateStatus; override;
procedure CheckIsService; reintroduce;
procedure AddLog(Log: string; LogType: tLogType=ltDefault); reintroduce;
constructor Create(pbbService: TBitBtn; pStatusPanel: tPanel; pPIDLabel, pPortLabel: tLabel; pStartStopButton, pAdminButton: tBitBtn);
destructor Destroy; override;
end;
implementation
const cServiceName = 'mysql';
cModuleName = 'mysql';
{ tMySQL }
procedure tMySQL.AddLog(Log: string; LogType: tLogType);
begin
inherited AddLog('mysql', Log, LogType);
end;
procedure tMySQL.Admin;
var
App, Param: string;
begin
Param:='http://localhost/phpmyadmin/';
if Config.BrowserApp<>'' then begin
App:=Config.BrowserApp;
ExecuteFile(App,Param,'',SW_SHOW);
Addlog(Format(_('Executing "%s" "%s"'),[App,Param]),ltDebug);
end else begin
ExecuteFile(Param,'','',SW_SHOW);
Addlog(Format(_('Executing "%s"'),[Param]),ltDebug);
end;
end;
procedure tMySQL.CheckIsService;
var
s: string;
begin
inherited CheckIsService(cServiceName);
if isService then s:=_('Service installed')
else s:=_('Service not installed');
AddLog(Format(_('Checking for service (name="%s"): %s'),[cServiceName,s]),ltDebug);
end;
constructor tMySQL.Create;
var
PortBlocker: string;
ServerApp: string;
ServerPort: Integer;
begin
inherited;
ModuleName:=cModuleName;
AddLog(_('Initializing module...'),ltDebug);
ServerApp:=basedir+'mysql\bin\mysqld.exe';
if not FileExists(ServerApp) then
AddLog(Format(_('Possible problem detected: file "%s" not found - run this program from your XAMPP root directory!'),[ServerApp]),ltError);
CheckIsService;
if Config.CheckDefaultPorts then begin
ServerPort:=3306;
AddLog(_('Checking default ports...'),ltDebug);
PortBlocker:=NetStatTable.isPortInUse(ServerPort);
if (PortBlocker<>'') then begin
if (LowerCase(PortBlocker)=LowerCase(ServerApp)) then begin
AddLog(Format(_('"%s" seems to be running on port %d?'),[ServerApp,ServerPort]),ltError);
end else begin
AddLog(Format(_('Possible problem detected: Port %d in use by "%s"!'),[ServerPort,PortBlocker]),ltError);
end;
end;
end;
end;
destructor tMySQL.Destroy;
begin
inherited;
end;
procedure tMySQL.ServiceInstall;
var
App, Param: string;
RC: Integer;
begin
App:=BaseDir+'\mysql\bin\mysqld.exe';
Param:='--install mysql --defaults-file='+BaseDir+'\mysql\bin\my.ini';
AddLog(_('Installing service...'));
Addlog(Format(_('Executing %s %s'),[App,Param]),ltDebug);
RC:=RunAsAdmin(App,Param,SW_HIDE);
if RC=0 then AddLog(Format(_('Return code: %d'),[RC]),ltDebug)
else AddLog(Format(_('There may be an error, return code: %d - %s'),[RC,SystemErrorMessage(RC)]),ltError);
end;
procedure tMySQL.ServiceUnInstall;
var
App, Param: string;
RC: Cardinal;
begin
App:=BaseDir+'\mysql\bin\mysqld.exe';
Param:='--remove mysql';
AddLog('Uninstalling service...');
Addlog(Format(_('Executing %s %s'),[App,Param]),ltDebug);
RC:=RunAsAdmin(App,Param,SW_HIDE);
if RC=0 then AddLog(Format(_('Return code: %d'),[RC]),ltDebug)
else AddLog(Format(_('There may be an error, return code: %d - %s'),[RC,SystemErrorMessage(RC)]),ltError);
end;
procedure tMySQL.Start;
var
App: string;
RC: Cardinal;
begin
if isService then begin
AddLog(Format(_('Starting %s service...'),[cModuleName]));
App:=Format('start "%s"',[cServiceName]);
Addlog(Format(_('Executing "%s"'),['net '+App]),ltDebug);
RC:=RunAsAdmin('net',App,SW_HIDE);
if RC=0 then AddLog(Format(_('Return code: %d'),[RC]),ltDebug)
else AddLog(Format(_('There may be an error, return code: %d - %s'),[RC,SystemErrorMessage(RC)]),ltError);
end else begin
AddLog(Format(_('Starting %s app...'),[cModuleName]));
App:=BaseDir+'mysql\bin\mysqld.exe --defaults-file='+BaseDir+'mysql\bin\my.ini --standalone';
Addlog(Format(_('Executing "%s"'),[App]),ltDebug);
RunProcess(App,SW_HIDE,false);
end;
end;
procedure tMySQL.Stop;
var
i, pPID: Integer;
App: string;
RC: Cardinal;
begin
if isService then begin
AddLog(Format(_('Stopping %s service...'),[cModuleName]));
App:=Format('stop "%s"',[cServiceName]);
Addlog(Format(_('Executing "%s"'),['net '+App]),ltDebug);
RC:=RunAsAdmin('net',App,SW_HIDE);
if RC=0 then AddLog(Format(_('Return code: %d'),[RC]),ltDebug)
else AddLog(Format(_('There may be an error, return code: %d - %s'),[RC,SystemErrorMessage(RC)]),ltError);
end else begin
if PIDList.Count>0 then begin
for i:=0 to PIDList.Count-1 do begin
pPID:=Integer(PIDList[i]);
AddLog(_('Stopping')+' '+cModuleName+' '+Format('(PID: %d)',[pPID]));
App:=Format(BaseDir+'apache\bin\pv.exe -f -k -q -i %d',[pPID]);
Addlog(Format(_('Executing "%s"'),[App]),ltDebug);
RunProcess(App,SW_HIDE,false);
end;
end else begin
AddLog(_('No PIDs found?!'));
end;
end;
end;
procedure tMySQL.UpdateStatus;
var
p: Integer;
ProcInfo: TProcInfo;
s: string;
ports: string;
begin
isRunning:=false;
PIDList.Clear;
for p:=0 to Processes.ProcessList.Count-1 do begin
ProcInfo:=Processes.ProcessList[p];
if { (pos(BaseDir,ProcInfo.ExePath)=1) and } (pos('mysqld.exe',ProcInfo.Module)=1) then begin
isRunning:=true;
PIDList.Add(Pointer(ProcInfo.PID));
end;
end;
// Checking processes
s:='';
for p:=0 to PIDList.Count-1 do begin
if p=0 then s:=IntToStr(Integer(PIDList[p]))
else s:=s+#13+IntToStr(Integer(PIDList[p]));
end;
if s<>OldPIDs then begin
lPID.Caption:=s;
OldPIDs:=s;
end;
// Checking netstats
s:='';
for p:=0 to PIDList.Count-1 do begin
ports:=NetStatTable.GetPorts4PID(Integer(PIDList[p]));
if ports<>'' then begin
if s='' then s:=ports
else s:=s+', '+ports;
end;
end;
if s<>OldPorts then begin
lPort.Caption:=s;
OldPorts:=s;
end;
if byte(isRunning)<>oldIsRunningByte then begin
if oldIsRunningByte<>2 then begin
if isRunning then s:=_('running')
else s:=_('stopped');
AddLog(_('Status change detected:')+' '+s);
end;
oldIsRunningByte:=byte(isRunning);
if isRunning then begin
pStatus.Color:=cRunningColor;
bStartStop.Caption:=_('Stop');
bAdmin.Enabled:=true;
end else begin
pStatus.Color:=cStoppedColor;
bStartStop.Caption:=_('Start');
bAdmin.Enabled:=false;
end;
end;
if AutoStart then begin
AutoStart:=false;
if isRunning then begin
AddLog(_('Autostart active: modul is already running - aborted'),ltError);
end else begin
AddLog(_('Autostart active: starting...'));
Start;
end;
end;
end;
end.

View File

@@ -0,0 +1,134 @@
object fNetstat: TfNetstat
Left = 394
Top = 196
BorderStyle = bsSizeToolWin
Caption = 'Netstat - TCP Listening sockets'
ClientHeight = 580
ClientWidth = 632
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnClose = FormClose
OnCreate = FormCreate
OnDestroy = FormDestroy
OnShow = FormShow
DesignSize = (
632
580)
PixelsPerInch = 96
TextHeight = 13
object ListView1: TListView
Left = 4
Top = 28
Width = 624
Height = 529
Anchors = [akLeft, akTop, akRight, akBottom]
Columns = <
item
Caption = 'Address'
Width = 100
end
item
Alignment = taRightJustify
Caption = 'Port'
end
item
Alignment = taRightJustify
Caption = 'PID'
end
item
Caption = 'Name'
Width = 400
end>
DoubleBuffered = True
OwnerData = True
ReadOnly = True
RowSelect = True
ParentDoubleBuffered = False
TabOrder = 0
ViewStyle = vsReport
OnColumnClick = ListView1ColumnClick
OnCustomDrawItem = ListView1CustomDrawItem
OnData = ListView1Data
end
object BitBtn1: TBitBtn
Left = 549
Top = 4
Width = 75
Height = 21
Anchors = [akTop, akRight]
Caption = 'Refresh'
DoubleBuffered = True
ModalResult = 4
NumGlyphs = 2
ParentDoubleBuffered = False
TabOrder = 1
OnClick = BitBtn1Click
end
object StatusBar1: TStatusBar
Left = 0
Top = 561
Width = 632
Height = 19
Panels = <>
end
object Panel1: TPanel
Left = 4
Top = 4
Width = 80
Height = 18
Caption = 'Active socket'
Color = clWindow
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentBackground = False
ParentFont = False
TabOrder = 3
end
object Panel2: TPanel
Left = 176
Top = 4
Width = 80
Height = 18
Caption = 'Old socket'
Color = clMaroon
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentBackground = False
ParentFont = False
TabOrder = 4
end
object Panel3: TPanel
Left = 90
Top = 4
Width = 80
Height = 18
Caption = 'New socket'
Color = clLime
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentBackground = False
ParentFont = False
TabOrder = 5
end
object TimerUpdate: TTimer
Interval = 500
OnTimer = TimerUpdateTimer
Left = 20
Top = 84
end
end

View File

@@ -0,0 +1,255 @@
unit uNetstat;
interface
uses
GnuGettext, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, Buttons, uNetstatTable, uTools, ExtCtrls, uProcesses;
type
tNetState = (nsActive, nsOld, nsNew, nsUpdatingActive, nsUpdatingNew);
tNetEntry = class
AddrStr: string;
AddrR: Cardinal;
Port: integer;
PID: integer;
ProcName: string;
State:tNetState;
end;
TfNetstat = class(TForm)
ListView1: TListView;
BitBtn1: TBitBtn;
StatusBar1: TStatusBar;
TimerUpdate: TTimer;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
procedure BitBtn1Click(Sender: TObject);
procedure ListView1ColumnClick(Sender: TObject; Column: TListColumn);
procedure FormCreate(Sender: TObject);
procedure TimerUpdateTimer(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure ListView1Data(Sender: TObject; Item: TListItem);
procedure ListView1CustomDrawItem(Sender: TCustomListView; Item: TListItem;
State: TCustomDrawState; var DefaultDraw: Boolean);
procedure cbShowCSRSSClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
NetEntryList: tList;
procedure ClearnetEntryList;
function FindNetEntry(AddrR: Cardinal; Port,PID: integer; ProcName: string): tNetEntry;
public
procedure RefreshTable(ResetStates: boolean);
end;
var
fNetstat: TfNetstat;
implementation
uses uMain;
const cModuleName = 'netstat';
var LastSortID: integer;
{$R *.dfm}
procedure TfNetstat.BitBtn1Click(Sender: TObject);
begin
RefreshTable(true);
end;
procedure TfNetstat.cbShowCSRSSClick(Sender: TObject);
begin
RefreshTable(true);
end;
procedure TfNetstat.ClearnetEntryList;
var i:integer;
NE: tNetEntry;
begin
ListView1.Items.Count:=0;
for i:=0 to NetEntryList.Count-1 do begin
NE:=NetEntryList[i];
NE.Free;
end;
NetEntryList.Clear;
end;
function TfNetstat.FindNetEntry(AddrR: Cardinal; Port, PID: integer; ProcName: string): tNetEntry;
var i:integer;
NE: tNetEntry;
begin
for i:=0 to NetEntryList.Count-1 do begin
NE:=NetEntryList[i];
if (NE.AddrR=AddrR) and (NE.Port=Port) and (NE.PID=PID) and (NE.ProcName=ProcName) then begin
result:=NE;
exit;
end;
end;
result:=nil;
end;
procedure TfNetstat.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ClearnetEntryList;
end;
procedure TfNetstat.FormCreate(Sender: TObject);
begin
TranslateComponent(Self);
NetEntryList:=TList.Create;
LastSortID:=0;
end;
procedure TfNetstat.FormDestroy(Sender: TObject);
begin
NetEntryList.Free;
end;
procedure TfNetstat.FormShow(Sender: TObject);
begin
TimerUpdate.Enabled:=true;
end;
function smallnumber(i: Int64):integer;
begin
if i>0 then result:=1
else if i<0 then result:=-1
else result:=0;
end;
function CustomSortProc(Item1, Item2: Pointer): integer; // stdcall;
var NE1, NE2: tNetEntry;
begin
NE1:=Item1;
NE2:=Item2;
case LastSortID of
0: Result := smallnumber(Int64(NE1.AddrR)-Int64(NE2.AddrR))*4+smallnumber(NE1.Port-NE2.Port)*2+smallnumber(NE1.PID-NE2.PID)*1;
1: Result := smallnumber(Int64(NE1.AddrR)-Int64(NE2.AddrR))*2+smallnumber(NE1.Port-NE2.Port)*4+smallnumber(NE1.PID-NE2.PID)*1;
2: Result := smallnumber(Int64(NE1.AddrR)-Int64(NE2.AddrR))*2+smallnumber(NE1.Port-NE2.Port)*1+smallnumber(NE1.PID-NE2.PID)*4;
3: Result := smallnumber(CompareText(NE1.ProcName, NE2.ProcName))*8+smallnumber(Int64(NE1.AddrR)-Int64(NE2.AddrR))*4+smallnumber(NE1.Port-NE2.Port)*2+smallnumber(NE1.PID-NE2.PID)*1;
else Result:=0;
end;
end;
procedure TfNetstat.ListView1ColumnClick(Sender: TObject; Column: TListColumn);
begin
LastSortID:=Column.Index;
NetEntryList.Sort(CustomSortProc);
ListView1.Refresh;
end;
procedure TfNetstat.ListView1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
var NE: tNetEntry;
begin
NE:=NetEntryList[Item.Index];
case NE.State of
nsActive: begin ListView1.Canvas.Font.Color := clWindowText; ListView1.Canvas.Brush.Color:=clWindow; end;
// nsOld: begin ListView1.Canvas.Font.Color := clGrayText; ListView1.Canvas.Brush.Color:=clWindow; end;
nsOld: begin ListView1.Canvas.Font.Color := clWhite; ListView1.Canvas.Brush.Color:=clMaroon; end;
nsNew: begin ListView1.Canvas.Font.Color := clWindowText; ListView1.Canvas.Brush.Color:=clLime; end;
nsUpdatingActive, nsUpdatingNew: begin ListView1.Canvas.Font.Color := clGrayText; ListView1.Canvas.Brush.Color:=clBlue; end;
end;
end;
procedure TfNetstat.ListView1Data(Sender: TObject; Item: TListItem);
var NE: tNetEntry;
begin
NE:=NetEntryList[Item.Index];
Item.Caption:=NE.AddrStr;
Item.SubItems.Add(IntToStr(NE.Port));
Item.SubItems.Add(IntToStr(NE.PID));
Item.SubItems.Add(NE.ProcName);
end;
procedure TfNetstat.RefreshTable(ResetStates: boolean);
var
i: integer;
NE: tNetEntry;
ProcInfo: tProcInfo;
PID, Addr, AddrR, Port: Cardinal;
PIDName: string;
AddrStr: string;
begin
NetStatTable.UpdateTable;
ListView1.Items.BeginUpdate;
if ResetStates then ClearnetEntryList;
for i:=0 to NetEntryList.Count-1 do begin
NE:=NetEntryList[i];
if NE.State=nsActive then NE.State:=nsUpdatingActive;
if NE.State=nsNew then NE.State:=nsUpdatingNew;
end;
for i:=0 to NetStatTable.pTcpTable.dwNumEntries-1 do begin
if NetStatTable.pTcpTable.table[i].dwOwningPid<>0 then begin
PID:=NetStatTable.pTcpTable.table[i].dwOwningPid;
Addr:=NetStatTable.pTcpTable.table[i].dwLocalAddr;
AddrR:=
((Addr and $FF000000) shr 24) or
((Addr and $00FF0000) shr 08) or
((Addr and $0000FF00) shl 08) or
((Addr and $000000FF) shl 24);
AddrStr:=Cardinal2IP(Addr);
Port:=NetStatTable.pTcpTable.table[i].dwLocalPort;
ProcInfo:=Processes.GetProcInfo(PID);
if ProcInfo<>nil then begin
PIDName:=ProcInfo.ExePath;
NE:=FindNetEntry(AddrR, Port, PID, PIDName);
if NE=nil then begin
NE:=tNetEntry.Create;
NE.AddrStr:=AddrStr;
NE.AddrR:=AddrR;
NE.Port:=Port;
NE.PID:=PID;
NE.ProcName:=PIDName;
NE.State:=nsNew;
NetEntryList.Add(NE);
ListView1.Items.Count:=ListView1.Items.Count+1;
fMain.AddLog(cModuleName,Format(_('New listening socket: %s:%d'),[NE.AddrStr,NE.Port]),ltDebug);
end else begin
if NE.State=nsUpdatingActive then NE.State:=nsActive;
if NE.State=nsUpdatingNew then NE.State:=nsNew;
end;
end;
end;
end;
for i:=0 to NetEntryList.Count-1 do begin
NE:=NetEntryList[i];
if ResetStates then NE.State:=nsActive;
if (NE.State=nsUpdatingActive) or (NE.State=nsUpdatingNew) then begin
NE.State:=nsOld;
fMain.AddLog(cModuleName,Format(_('Listening socket closed: %s:%d'),[NE.AddrStr,NE.Port]),ltDebug);
end;
end;
NetEntryList.Sort(CustomSortProc);
ListView1.Items.EndUpdate;
ListView1.Refresh;
end;
procedure TfNetstat.TimerUpdateTimer(Sender: TObject);
begin
if Visible then begin
RefreshTable(false);
end else begin
TimerUpdate.Enabled:=false;
end;
end;
end.

View File

@@ -0,0 +1,192 @@
unit uNetstatTable;
interface
uses GnuGettext, SysUtils, Classes, Windows, Dialogs, uProcesses;
const
MIB_TCP_STATE_LISTEN = 2;
type
MIB_TCPROW_OWNER_PID = packed record
dwState: DWORD;
dwLocalAddr: DWORD;
dwLocalPort: DWORD;
dwRemoteAddr: DWORD;
dwRemotePort: DWORD;
dwOwningPid: DWORD;
end;
// PMIB_TCPROW_OWNER_PID = ^MIB_TCPROW_OWNER_PID;
MIB_TCPTABLE_OWNER_PID = packed record
dwNumEntries: DWord;
table: array [0..99999] of MIB_TCPROW_OWNER_PID ;
end;
PMIB_TCPTABLE_OWNER_PID = ^MIB_TCPTABLE_OWNER_PID;
tNetstatTable = class
private
hLibModule: THandle;
DLLProcPointer: Pointer;
procedure LoadExIpHelperProcedures;
procedure UnLoadExIpHelperProcedures;
public
pTcpTable: PMIB_TCPTABLE_OWNER_PID;
procedure UpdateTable;
function GetPorts4PID(pid: integer):string;
function GetPortCount4PID(pid: integer):integer;
function isPortInUse(port: integer): string;
constructor Create;
destructor Destroy; override;
end;
var
NetStatTable: tNetstatTable;
implementation
uses uMain, uTools;
const
TCP_TABLE_OWNER_PID_ALL = 5;
AF_INET = 2;
type
TCP_TABLE_CLASS = Integer;
ULONG = Integer;
TGetExtendedTcpTable = function(pTcpTable: Pointer; dwSize: PDWORD; bOrder: BOOL; lAf: ULONG; TableClass: TCP_TABLE_CLASS; Reserved: ULONG): DWord;stdcall;
{ tNetStatTable }
constructor tNetstatTable.Create;
begin
DLLProcPointer:=nil;
hLibModule:=0;
pTCPTable:=nil;
try
LoadExIpHelperProcedures;
except
end;
end;
destructor tNetstatTable.Destroy;
begin
try
UnLoadExIpHelperProcedures;
except
end;
inherited;
end;
function tNetstatTable.GetPortCount4PID(pid: integer): integer;
var i: integer;
port: string;
begin
result:=0;
for i:=0 to NetStatTable.pTcpTable.dwNumEntries-1 do
if NetStatTable.pTcpTable.table[i].dwOwningPid=Cardinal(pid) then
result:=result+1;
end;
function tNetstatTable.GetPorts4PID(pid: integer): string;
var i: integer;
port: string;
begin
result:='';
for i:=0 to NetStatTable.pTcpTable.dwNumEntries-1 do begin
if NetStatTable.pTcpTable.table[i].dwOwningPid=Cardinal(pid) then begin
port:=IntToStr(NetStatTable.pTcpTable.table[i].dwLocalPort);
if result='' then result:=port
else result:=result+', '+port;
end;
end;
end;
function tNetstatTable.isPortInUse(port: integer): string;
var i: integer;
ProcInfo: TProcInfo;
pid: Cardinal;
begin
result:='';
for i:=0 to NetStatTable.pTcpTable.dwNumEntries-1 do begin
if NetStatTable.pTcpTable.table[i].dwLocalPort=Cardinal(port) then begin
pid:=NetStatTable.pTcpTable.table[i].dwOwningPid;
ProcInfo:=Processes.GetProcInfo(pid);
if ProcInfo<>nil then result:=ProcInfo.ExePath
else result:=_('unknown program');
exit;
end;
end;
end;
procedure tNetstatTable.LoadExIpHelperProcedures;
begin
hLibModule:=LoadLibrary('iphlpapi.dll');
if hLibModule=0 then exit;
DLLProcPointer:=GetProcAddress(hLibModule,'GetExtendedTcpTable');
if not Assigned(DLLProcPointer) then begin
ShowMessage(IntToStr(GetLastError));
end;
end;
procedure tNetstatTable.UnLoadExIpHelperProcedures;
begin
if hLibModule>HINSTANCE_ERROR then
FreeLibrary(hLibModule);
end;
procedure tNetstatTable.UpdateTable;
var
dwSize: DWord;
Res: Dword;
GetExtendedTcpTable: TGetExtendedTcpTable;
i: integer;
begin
if pTcpTable<>nil then begin
FreeMem(pTcpTable);
pTCPTable:=nil;
end;
if (DLLProcPointer=nil) or (hLibModule<HINSTANCE_ERROR) then begin
exit;
end;
GetExtendedTcpTable:=DLLProcPointer;
Try
dwSize:=0;
Res := GetExtendedTcpTable(pTcpTable, @dwSize, False, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0);
If (Res = ERROR_INSUFFICIENT_BUFFER) Then Begin
GetMem(pTCPTable,dwSize); // das API hat die "gew<65>nschte" Gr<47>sse gesetzt
Res := GetExtendedTcpTable(pTcpTable, @dwSize, False, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0);
end;
If (Res = NO_ERROR) then begin
for i := 0 to pTcpTable.dwNumEntries-1 do begin
pTcpTable.table[i].dwLocalPort:=
((pTcpTable.table[i].dwLocalPort and $FF00) shr 8) or
((pTcpTable.table[i].dwLocalPort and $00FF) shl 8);
pTcpTable.table[i].dwRemotePort:=
((pTcpTable.table[i].dwRemotePort and $FF00) shr 8) or
((pTcpTable.table[i].dwRemotePort and $00FF) shl 8);
end;
end else begin
raiseLastOSError(); // Error-Handling
end;
Finally
// If (pTcpTable <> Nil) Then FreeMem(pTcpTable);
end;
end;
initialization
NetStatTable:=tNetstatTable.Create;
finalization
NetStatTable.Free;
end.

View File

@@ -0,0 +1,147 @@
unit uProcesses;
interface
uses GnuGettext, TlHelp32, uTools, Classes, SysUtils, Windows;
type
TProcInfo = class
PID: integer;
Module, ExePath: String;
CanDelete: boolean;
end;
tProcesses = class
public
ProcessList: tList;
function GetProcInfo(PID: integer):TProcInfo;
procedure Update;
constructor Create;
destructor Destroy; override;
end;
var
Processes: tProcesses;
implementation
uses uMain;
const cModuleName = 'procs';
{ tProcessList }
constructor tProcesses.Create;
begin
ProcessList:=TList.Create;
end;
destructor tProcesses.Destroy;
var
ProcInfo: TProcInfo;
p: Integer;
begin
for p:=0 to ProcessList.Count-1 do begin
ProcInfo:=ProcessList[p];
FreeAndNil(ProcInfo);
end;
FreeAndNil(ProcessList);
inherited;
end;
function tProcesses.GetProcInfo(PID: integer): TProcInfo;
var
ProcInfo: TProcInfo;
p: Integer;
begin
for p:=0 to ProcessList.Count-1 do begin
ProcInfo:=ProcessList[p];
if ProcInfo.PID=pid then begin
result:=ProcInfo;
exit;
end;
end;
Result:=nil;
end;
procedure tProcesses.Update;
var hProcessSnap: tHandle;
TProcessEntry: TProcessEntry32;
ProcInfo: TProcInfo;
hModuleSnap: tHandle;
ModuleEntry: MODULEENTRY32;
i: Integer;
PID: Cardinal;
begin
// fMain.AddLog('processes', 'Checking processes...', ltDebugDetails);
for i:=0 to ProcessList.Count-1 do begin
ProcInfo:=ProcessList[i];
ProcInfo.CanDelete:=true;
// FreeAndNil(ProcInfo);
end;
// ProcessList.Clear;
hProcessSnap := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hProcessSnap = INVALID_HANDLE_VALUE) then exit;
TProcessEntry.dwSize := SizeOf(TProcessEntry);
if (Process32First(hProcessSnap, TProcessEntry)) then begin
repeat
PID:=TProcessEntry.th32ProcessID;
ProcInfo:=GetProcInfo(PID);
if ProcInfo<>nil then begin
ProcInfo.CanDelete:=false
end else begin
// hModuleSnap := INVALID_HANDLE_VALUE;
hModuleSnap := CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, TProcessEntry.th32ProcessID );
if (hModuleSnap <> INVALID_HANDLE_VALUE) then begin
ModuleEntry.dwSize := sizeof(MODULEENTRY32);
if (Module32First(hModuleSnap, &ModuleEntry)) then begin
ProcInfo:=TProcInfo.Create;
ProcInfo.Module:=LowerCase(ModuleEntry.szModule);
ProcInfo.ExePath:=LowerCase(ModuleEntry.szExePath);
ProcInfo.PID:=TProcessEntry.th32ProcessID;
ProcInfo.CanDelete:=false;
ProcessList.Add(ProcInfo);
end else begin
ProcInfo:=nil;
end;
end else begin
ProcInfo:=TProcInfo.Create;
ProcInfo.Module:=LowerCase(TProcessEntry.szExeFile);
ProcInfo.ExePath:=LowerCase(TProcessEntry.szExeFile);
ProcInfo.PID:=TProcessEntry.th32ProcessID;
ProcInfo.CanDelete:=false;
ProcessList.Add(ProcInfo);
end;
if ProcInfo<>nil then
fMain.AddLog(cModuleName,Format(_('Creating PID-entry %d: %s'),[ProcInfo.PID,ProcInfo.ExePath]),ltDebugDetails);
CloseHandle(hModuleSnap);
end;
until not (Process32Next(hProcessSnap, TProcessEntry));
end;
CloseHandle(hProcessSnap);
i:=0;
while i<ProcessList.Count do begin
ProcInfo:=ProcessList[i];
if ProcInfo.CanDelete then begin
fMain.AddLog(cModuleName,Format(_('Deleting PID-entry %d: %s'),[ProcInfo.PID,ProcInfo.ExePath]),ltDebugDetails);
FreeAndNil(ProcInfo);
ProcessList.Delete(i);
end else begin
inc(i);
end;
end;
end;
initialization
Processes:=tProcesses.Create;
finalization
Processes.Free;
end.

View File

@@ -0,0 +1,78 @@
unit uServices;
interface
uses
GnuGettext, WinSvc, Windows, uTools;
type
TServiceStatus=(ssError, ssNotFound, ssUnknown, ssRunning, ssStopped);
TStartStopService=(ssStart, ssStop);
function GetServiceStatus(name: string):TServiceStatus;
//function StartStopService(name: string; StartStopService: TStartStopService):boolean;
implementation
uses uMain;
function GetServiceStatus(name: string):TServiceStatus;
var
hSCM: THandle;
hService: THandle;
ServiceStatus: _SERVICE_STATUS;
begin
hSCM:=OpenSCManager(nil,nil,SC_MANAGER_CONNECT);
if (hSCM = 0) then begin
result:=ssError;
exit;
end;
hService:=OpenService(hSCM, @name[1], SERVICE_QUERY_STATUS);;
if (hService = 0) then begin
CloseServiceHandle(hSCM);
result:=ssNotFound;
exit;
end;
// The SERVICE exists and we have access
if (QueryServiceStatus(hService, ServiceStatus)) then begin
result := ssUnknown;
if (ServiceStatus.dwCurrentState = SERVICE_RUNNING) then result := ssRunning;
if (ServiceStatus.dwCurrentState = SERVICE_STOPPED) then result := ssStopped;
end else begin
result := ssError;
end;
CloseServiceHandle(hService);
CloseServiceHandle(hSCM);
end;
function ServiceDelete(name: string): boolean;
var
hSCM: THandle;
hService: THandle;
begin
result:=false;
hSCM:=OpenSCManager(nil,nil,SC_MANAGER_CONNECT);
if (hSCM = 0) then exit;
hService:=OpenService(hSCM, @name[1], SERVICE_QUERY_STATUS);;
if (hService = 0) then begin
CloseServiceHandle(hSCM);
exit;
end;
// The SERVICE exists and we have access
result:=(DeleteService(hService));
CloseServiceHandle(hService);
CloseServiceHandle(hSCM);
end;
end.

View File

@@ -0,0 +1,217 @@
unit uTomcat;
interface
uses GnuGettext, uBaseModule, SysUtils, Classes, Windows, ExtCtrls, StdCtrls, Buttons,
uNetstatTable, uTools, uProcesses;
type
tTomcat = class(tBaseModule)
OldPIDs, OldPorts: string;
procedure ServiceInstall; override;
procedure ServiceUnInstall; override;
procedure Start; override;
procedure Stop; override;
procedure Admin; override;
procedure UpdateStatus; override;
procedure CheckIsService; reintroduce;
procedure AddLog(Log: string; LogType: tLogType=ltDefault); reintroduce;
constructor Create(pbbService: TBitBtn; pStatusPanel: tPanel; pPIDLabel, pPortLabel: tLabel; pStartStopButton, pAdminButton: tBitBtn);
destructor Destroy; override;
end;
implementation
const cModuleName = 'tomcat';
{ tTomcat }
procedure tTomcat.AddLog(Log: string; LogType: tLogType);
begin
inherited AddLog(cModuleName, Log, LogType);
end;
procedure tTomcat.Admin;
var
App, Param: string;
begin
Param:='http://localhost:8080/';
if Config.BrowserApp<>'' then begin
App:=Config.BrowserApp;
ExecuteFile(App,Param,'',SW_SHOW);
Addlog(Format(_('Executing "%s" "%s"'),[App,Param]),ltDebug);
end else begin
ExecuteFile(Param,'','',SW_SHOW);
Addlog(Format(_('Executing "%s"'),[Param]),ltDebug);
end;
end;
procedure tTomcat.CheckIsService;
begin
isService:=false;
end;
constructor tTomcat.Create(pbbService: TBitBtn; pStatusPanel: tPanel; pPIDLabel,
pPortLabel: tLabel; pStartStopButton, pAdminButton: tBitBtn);
const Ports:array[0..2] of integer=(1,2,3);
var
PortBlocker: string;
ServerApp1, ServerApp2: string;
p: integer;
begin
inherited;
ModuleName:=cModuleName;
AddLog(_('Initializing module...'),ltDebug);
ServerApp1:=basedir+'tomcat\bin\tomcat6.exe';
ServerApp2:=basedir+'tomcat\bin\tomcat7.exe';
if ((not FileExists(ServerApp1)) and (not FileExists(ServerApp2))) then
AddLog(Format(_('Possible problem detected: file "%s" not found - run this program from your XAMPP root directory!'),[ServerApp1+'/'+ServerApp2]),ltError);
CheckIsService;
if Config.CheckDefaultPorts then begin
AddLog(_('Checking default ports...'),ltDebug);
for p:=Low(Ports) to High(Ports) do begin
PortBlocker:=NetStatTable.isPortInUse(Ports[p]);
if (PortBlocker<>'') then begin
if (LowerCase(PortBlocker)=LowerCase(ServerApp1)) then begin
AddLog(Format(_('"%s" seems to be running on port %d?'),[ServerApp1,Ports[p]]),ltError);
end else if (LowerCase(PortBlocker)=LowerCase(ServerApp2)) then begin
AddLog(Format(_('"%s" seems to be running on port %d?'),[ServerApp2,Ports[p]]),ltError);
end else begin
AddLog(Format(_('Possible problem detected: Port %d in use by "%s"!'),[Ports[p],PortBlocker]),ltError);
end;
end;
end;
end;
end;
destructor tTomcat.Destroy;
begin
inherited;
end;
procedure tTomcat.ServiceInstall;
begin
inherited;
end;
procedure tTomcat.ServiceUnInstall;
begin
inherited;
end;
procedure tTomcat.Start;
var
App, Param: string;
begin
AddLog(Format(_('Starting %s app...'),[cModuleName]));
Param:='/c '+BaseDir+'catalina_start.bat';
if FileExists('c:\Windows\sysnative\cmd.exe') then app:='c:\Windows\sysnative\cmd.exe' // 64 bit? dann DIESE shell starten!
else app:='cmd';
Addlog(Format(_('Executing "%s" "%s"'),[App,Param]),ltDebug);
if Config.TomcatVisible then
ExecuteFile(App,Param,BaseDir,SW_MINIMIZE)
else
ExecuteFile(App,Param,BaseDir,SW_HIDE)
end;
procedure tTomcat.Stop;
var
App, Param: string;
begin
AddLog(_('Stopping'));
Param:='/c '+BaseDir+'catalina_stop.bat';
if FileExists('c:\Windows\sysnative\cmd.exe') then app:='c:\Windows\sysnative\cmd.exe' // 64 bit? dann DIESE shell starten!
else app:='cmd';
Addlog(Format(_('Executing "%s" "%s"'),[App,Param]),ltDebug);
ExecuteFile(App,Param,BaseDir,SW_HIDE);
end;
procedure tTomcat.UpdateStatus;
var
p: Integer;
ProcInfo: TProcInfo;
s: string;
ports: string;
begin
isRunning:=false;
PIDList.Clear;
for p:=0 to Processes.ProcessList.Count-1 do begin
ProcInfo:=Processes.ProcessList[p];
if { (pos(BaseDir,ProcInfo.ExePath)=1) and } (pos('java.exe',ProcInfo.Module)=1) then begin
// Sind genau 3 Ports offen?
if NetStatTable.GetPortCount4PID(ProcInfo.PID)=3 then begin
isRunning:=true;
PIDList.Add(Pointer(ProcInfo.PID));
end;
end;
end;
// Checking processes
s:='';
for p:=0 to PIDList.Count-1 do begin
if p=0 then s:=IntToStr(Integer(PIDList[p]))
else s:=s+#13+IntToStr(Integer(PIDList[p]));
end;
if s<>OldPIDs then begin
lPID.Caption:=s;
OldPIDs:=s;
end;
// Checking netstats
s:='';
for p:=0 to PIDList.Count-1 do begin
ports:=NetStatTable.GetPorts4PID(Integer(PIDList[p]));
if ports<>'' then begin
if s='' then s:=ports
else s:=s+', '+ports;
end;
end;
if s<>OldPorts then begin
lPort.Caption:=s;
OldPorts:=s;
end;
if byte(isRunning)<>oldIsRunningByte then begin
if oldIsRunningByte<>2 then begin
if isRunning then s:=_('running')
else s:=_('stopped');
AddLog(_('Status change detected:')+' '+s);
end;
oldIsRunningByte:=byte(isRunning);
if isRunning then begin
pStatus.Color:=cRunningColor;
bStartStop.Caption:=_('Stop');
bAdmin.Enabled:=true;
end else begin
pStatus.Color:=cStoppedColor;
bStartStop.Caption:=_('Start');
bAdmin.Enabled:=false;
end;
end;
if AutoStart then begin
AutoStart:=false;
if isRunning then begin
AddLog(_('Autostart active: modul is already running - aborted'),ltError);
end else begin
AddLog(_('Autostart active: starting...'));
Start;
end;
end;
end;
end.

View File

@@ -0,0 +1,437 @@
unit uTools;
interface
uses GnuGettext, Classes, Graphics, Windows, SysUtils, TlHelp32, ShellAPI, Forms, Dialogs, IniFiles, VersInfo;
const
// cIdxApache = 1;
// cIdxMySQL = 2;
// cIdxFileZilla = 3;
// cIdxMercury = 4;
cRunningColor = 200 * $10000 + 255*$100 + 200;
cStoppedColor = clBtnFace;
// SW_HIDE = Windows.SW_HIDE;
cCompileDate='May 14th 2011 - build #1';
cr=#13#10;
type
tLogType = (ltDefault, ltInfo, ltError, ltDebug, ltDebugDetails);
TWinVersion = record
WinPlatForm: Byte; // VER_PLATFORM_WIN32_NT, VER_PLATFORM_WIN32_WINDOWS
WinVersion: string;
Major: Cardinal;
Minor: Cardinal;
end;
tConfig = class
EditorApp: string;
BrowserApp: string;
ShowDebug: boolean;
DebugLevel: integer;
CheckDefaultPorts: boolean;
Language: string;
TomcatVisible: boolean;
ASApache: boolean;
ASMySQL: boolean;
ASFileZilla: boolean;
ASMercury: boolean;
ASTomcat: boolean;
UserLogs: record
Apache: tStringList;
MySQL: tStringList;
FileZilla: tStringList;
Mercury: tStringList;
Tomcat: tStringList;
end;
UserConfig: record
Apache: tStringList;
MySQL: tStringList;
FileZilla: tStringList;
Mercury: tStringList;
Tomcat: tStringList;
end;
constructor Create;
destructor Destroy; override;
end;
var
WinVersion: TWinVersion;
CurrentUser: string;
BaseDir: string;
CachedComputerName: string;
Config: tConfig;
IniFileName: string;
dfsVersionInfoResource1: TdfsVersionInfoResource;
GlobalProgramversion: string;
procedure LoadSettings;
procedure SaveSettings;
function IsWindowsAdmin: Boolean;
function IntToServiceApp(b: boolean):string;
function GetCurrentUserName: string;
function GetWinVersion: TWinVersion;
function RunProcess(FileName: string; ShowCmd: DWORD; wait: Boolean; ProcID: PCardinal=nil): Longword;
function ExecuteFile(FileName, Params, DefaultDir: string; ShowCmd: Integer): THandle;
function RunAsAdmin(filename, parameters: string; ShowCmd: Integer): Cardinal;
function Cardinal2IP(C: Cardinal):string;
function GetComputerName:string;
function SystemErrorMessage(WinErrorCode: Cardinal): string;
function GetSystemLangShort:string;
implementation
procedure LoadSettings;
var mi: TMemIniFile;
begin
// fMain.AddLog('Loading settings from configurationfile: "'+IniFileName+'"',ltDebug);
mi:=nil;
try
mi:=TMemIniFile.Create(IniFileName);
Config.EditorApp:=mi.ReadString('Common','Editor','notepad.exe');
Config.BrowserApp:=mi.ReadString('Common','Browser','');
Config.ShowDebug:=mi.ReadBool('Common','Debug',false);
Config.DebugLevel:=mi.ReadInteger('Common','Debuglevel',0);
Config.CheckDefaultPorts:=mi.ReadBool('Common','CheckDefaultPorts',true);
Config.Language:=mi.ReadString('Common','Language','');
Config.TomcatVisible:=mi.ReadBool('Common','TomcatVisible',true);
Config.ASApache:=mi.ReadBool('Autostart','Apache',false);
Config.ASMySQL:=mi.ReadBool('Autostart','MySQL',false);
Config.ASFileZilla:=mi.ReadBool('Autostart','FileZilla',false);
Config.ASMercury:=mi.ReadBool('Autostart','Mercury',false);
Config.ASTomcat:=mi.ReadBool('Autostart','Tomcat',false);
Config.UserConfig.Apache.DelimitedText:=mi.ReadString('UserConfigs','Apache','');
Config.UserConfig.MySQL.DelimitedText:=mi.ReadString('UserConfigs','MySQL','');
Config.UserConfig.FileZilla.DelimitedText:=mi.ReadString('UserConfigs','FileZilla','');
Config.UserConfig.Mercury.DelimitedText:=mi.ReadString('UserConfigs','Mercury','');
Config.UserConfig.Tomcat.DelimitedText:=mi.ReadString('UserConfigs','Tomcat','');
Config.UserLogs.Apache.DelimitedText:=mi.ReadString('UserLogs','Apache','');
Config.UserLogs.MySQL.DelimitedText:=mi.ReadString('UserLogs','MySQL','');
Config.UserLogs.FileZilla.DelimitedText:=mi.ReadString('UserLogs','FileZilla','');
Config.UserLogs.Mercury.DelimitedText:=mi.ReadString('UserLogs','Mercury','');
Config.UserLogs.Tomcat.DelimitedText:=mi.ReadString('UserLogs','Tomcat','');
except
on e:exception do begin
MessageDlg(_('Error')+': '+E.Message,mtError,[mbOK],0);
end;
end;
mi.Free;
end;
procedure SaveSettings;
var mi: TMemIniFile;
begin
mi:=nil;
try
mi:=TMemIniFile.Create(IniFileName);
mi.WriteString('Common','Editor',Config.EditorApp);
mi.WriteString('Common','Browser',Config.BrowserApp);
mi.WriteBool('Common','Debug',Config.ShowDebug);
mi.WriteInteger('Common','Debuglevel',Config.DebugLevel);
mi.WriteBool('Common','CheckDefaultPorts',Config.CheckDefaultPorts);
mi.WriteString('Common','Language',Config.Language);
mi.WriteBool('Common','TomcatVisible',Config.TomcatVisible);
mi.WriteBool('Autostart','Apache',Config.ASApache);
mi.WriteBool('Autostart','MySQL',Config.ASMySQL);
mi.WriteBool('Autostart','FileZilla',Config.ASFileZilla);
mi.WriteBool('Autostart','Mercury',Config.ASMercury);
mi.WriteBool('Autostart','Tomcat',Config.ASTomcat);
mi.WriteString('UserConfigs','Apache',Config.UserConfig.Apache.DelimitedText);
mi.WriteString('UserConfigs','MySQL',Config.UserConfig.MySQL.DelimitedText);
mi.WriteString('UserConfigs','FileZilla',Config.UserConfig.FileZilla.DelimitedText);
mi.WriteString('UserConfigs','Mercury',Config.UserConfig.Mercury.DelimitedText);
mi.WriteString('UserConfigs','Tomcat',Config.UserConfig.Tomcat.DelimitedText);
mi.WriteString('UserLogs','Apache',Config.UserLogs.Apache.DelimitedText);
mi.WriteString('UserLogs','MySQL',Config.UserLogs.MySQL.DelimitedText);
mi.WriteString('UserLogs','FileZilla',Config.UserLogs.FileZilla.DelimitedText);
mi.WriteString('UserLogs','Mercury',Config.UserLogs.Mercury.DelimitedText);
mi.WriteString('UserLogs','Tomcat',Config.UserLogs.Tomcat.DelimitedText);
mi.UpdateFile;
except
on e:exception do begin
MessageDlg(_('Error')+': '+E.Message,mtError,[mbOK],0);
end;
end;
mi.Free;
end;
function IsWindowsAdmin:boolean;
type
TIsUserAnAdminFunc = function (): BOOL; stdcall;
var
Shell32DLL: THandle;
IsUserAnAdminFunc: TIsUserAnAdminFunc;
begin
result:=true;
if WinVersion.Major<6 then exit; // older than vista? just return TRUE
Shell32DLL := LoadLibrary('shell32.dll');
try
if Shell32DLL <> 0 then begin
@IsUserAnAdminFunc := GetProcAddress(Shell32DLL, 'IsUserAnAdmin');
if Assigned(@IsUserAnAdminFunc) then
result := IsUserAnAdminFunc();
end;
except
end;
FreeLibrary(Shell32DLL);
end;
function IntToServiceApp(b: boolean):string;
begin
if b then result:=_('Service')
else result:=_('Application')
end;
function SystemErrorMessage(WinErrorCode: Cardinal): string;
var
P: PChar;
begin
if FormatMessage(Format_Message_Allocate_Buffer + Format_Message_From_System,
nil,
WinErrorCode,
0,
@P,
0,
nil) <> 0 then
begin
Result := trim(P);
LocalFree(Integer(P));
end else begin
Result := '';
end;
end;
function GetCurrentUserName: string;
const
cnMaxUserNameLen = 254;
var
sUserName: string;
dwUserNameLen: DWORD;
begin
dwUserNameLen := cnMaxUserNameLen - 1;
SetLength(sUserName, cnMaxUserNameLen);
GetUserName(PChar(sUserName), dwUserNameLen);
SetLength(sUserName, dwUserNameLen);
Result := sUserName;
end;
function GetWinVersion: TWinVersion;
var
osVerInfo: TOSVersionInfo;
s: string;
begin
osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo) ;
if GetVersionEx(osVerInfo) then
begin
result.WinPlatForm:=osVerInfo.dwPlatformId;
result.Major:=osVerInfo.dwMajorVersion;
result.Minor:=osVerInfo.dwMinorVersion;
s:=osVerInfo.szCSDVersion;
if s<>'' then s:=' - '+s;
result.WinVersion:=Format('%d.%d (build %d)%s',[osVerInfo.dwMajorVersion,osVerInfo.dwMinorVersion,osVerInfo.dwBuildNumber,s]);
end;
end;
function RunProcess(FileName: string; ShowCmd: DWORD; wait: Boolean; ProcID: PCardinal=nil): Longword;
var
StartupInfo: TStartupInfo;
ProcessInfo: TProcessInformation;
begin
FillChar(StartupInfo, SizeOf(StartupInfo), #0);
StartupInfo.cb := SizeOf(StartupInfo);
StartupInfo.dwFlags := STARTF_USESHOWWINDOW or STARTF_FORCEONFEEDBACK;
StartupInfo.wShowWindow := ShowCmd;
if not CreateProcess(nil,
@Filename[1],
nil,
nil,
False,
CREATE_NEW_CONSOLE or
NORMAL_PRIORITY_CLASS,
nil,
nil,
StartupInfo,
ProcessInfo)
then
Result := WAIT_FAILED
else
begin
if wait = FALSE then
begin
if ProcID <> nil then ProcID^ := ProcessInfo.dwProcessId;
exit;
end;
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
GetExitCodeProcess(ProcessInfo.hProcess, Result);
end;
if ProcessInfo.hProcess <> 0 then
CloseHandle(ProcessInfo.hProcess);
if ProcessInfo.hThread <> 0 then
CloseHandle(ProcessInfo.hThread);
end;
function ExecuteFile(FileName, Params, DefaultDir: string; ShowCmd: Integer): THandle;
var zFileName, zParams, zDir: array[0..255] of Char;
begin
if DefaultDir='' then DefaultDir:=BaseDir;
Result := ShellExecute(Application.MainForm.Handle, 'open', StrPCopy(zFileName, FileName), StrPCopy(zParams, Params), StrPCopy(zDir, DefaultDir), ShowCmd);
end;
function RunAsAdmin(filename, parameters: string; ShowCmd: Integer): Cardinal;
var
Info: TShellExecuteInfo;
pInfo: PShellExecuteInfo;
begin
pInfo := @Info;
with Info do
begin
cbSize := SizeOf(Info);
fMask := SEE_MASK_NOCLOSEPROCESS;
wnd := application.Handle;
lpVerb := PChar('runas');
lpFile := PChar(filename);
lpParameters := PChar(parameters + #0);
lpDirectory := NIL;
nShow := ShowCmd;
hInstApp := 0;
end;
if not ShellExecuteEx(pInfo) then begin
result:=GetLastError;
exit;
end;
{Wait to finish}
repeat
result := WaitForSingleObject(Info.hProcess, 500);
Application.ProcessMessages;
until (result <> WAIT_TIMEOUT);
end;
function Cardinal2IP(C: Cardinal):string;
begin
result:=
inttostr((c and $000000FF) )+'.'+
inttostr((c and $0000FF00) shr 08)+'.'+
inttostr((c and $00FF0000) shr 16)+'.'+
inttostr((c and $FF000000) shr 24);
end;
function GetComputerName:string;
const MAX_COMPUTERNAME_LENGTH=100;
var ComputerName: array[0..MAX_COMPUTERNAME_LENGTH + 1] of Char;
//var ComputerName: array[0..50 + 1] of Char;
size:cardinal;
LE: Cardinal;
begin
try
if CachedComputerName='' then begin
size:=MAX_COMPUTERNAME_LENGTH;
if Windows.GetComputerName(ComputerName, size) then begin
result:=ComputerName;
CachedComputerName:=ComputerName;
end else begin
LE:=GetLastError;
MessageDlg(Format('GetComputerName failed, Code: %d - %s',[LE,SystemErrorMessage(LE)]),mtError,[mbOK],0);
result:='';
end;
end else begin
result:=CachedComputerName;
end;
except
result:='';
end;
end;
function GetSystemLangShort:string;
var bla:array[0..1023] of Char;
s: string;
begin
GetLocaleInfo(GetSystemDefaultLCID, LOCALE_SENGLANGUAGE, @bla, sizeof(bla));
s:=uppercase(bla);
if s='GERMAN' then result:='de'
else if s='ENGLISH' then result:='en'
else if s='FRENCH' then result:='fr'
else if s='ITALIAN' then result:='it'
else result:='en';
end;
{ tConfig }
constructor tConfig.Create;
begin
UserLogs.Apache:=TStringList.Create;
UserLogs.MySQL:=TStringList.Create;
UserLogs.FileZilla:=TStringList.Create;
UserLogs.Mercury:=TStringList.Create;
UserLogs.Tomcat:=TStringList.Create;
UserConfig.Apache:=TStringList.Create;
UserConfig.MySQL:=TStringList.Create;
UserConfig.FileZilla:=TStringList.Create;
UserConfig.Mercury:=TStringList.Create;
UserConfig.Tomcat:=TStringList.Create;
UserLogs.Apache.Delimiter:='|';
UserLogs.MySQL.Delimiter:='|';
UserLogs.FileZilla.Delimiter:='|';
UserLogs.Mercury.Delimiter:='|';
UserLogs.Tomcat.Delimiter:='|';
UserConfig.Apache.Delimiter:='|';
UserConfig.MySQL.Delimiter:='|';
UserConfig.FileZilla.Delimiter:='|';
UserConfig.Mercury.Delimiter:='|';
UserConfig.Tomcat.Delimiter:='|';
end;
destructor tConfig.Destroy;
begin
FreeAndNil(UserLogs.Apache);
FreeAndNil(UserLogs.MySQL);
FreeAndNil(UserLogs.FileZilla);
FreeAndNil(UserLogs.Mercury);
FreeAndNil(UserLogs.Tomcat);
FreeAndNil(UserConfig.Apache);
FreeAndNil(UserConfig.MySQL);
FreeAndNil(UserConfig.FileZilla);
FreeAndNil(UserConfig.Mercury);
FreeAndNil(UserConfig.Tomcat);
inherited;
end;
initialization
Config:=tConfig.Create;
CachedComputerName:='';
dfsVersionInfoResource1:=TdfsVersionInfoResource.Create();
dfsVersionInfoResource1.Filename:=Application.ExeName;
with dfsVersionInfoResource1.FileVersion do
GlobalProgramversion:=IntToStr(Major)+'.'+IntToStr(Minor)+'.'+IntToStr(Release);
dfsVersionInfoResource1.Free;
finalization
Config.Free;
end.

View File

@@ -0,0 +1,63 @@
program xampp_control3;
uses
Forms,
ExtCtrls,
Controls,
Graphics,
uMain in 'uMain.pas' {fMain},
uApache in 'uApache.pas',
uBaseModule in 'uBaseModule.pas',
uTools in 'uTools.pas',
uNetstatTable in 'uNetstatTable.pas',
uNetstat in 'uNetstat.pas' {fNetstat},
uConfig in 'uConfig.pas' {fConfig},
uMySQL in 'uMySQL.pas',
uFileZilla in 'uFileZilla.pas',
uMercury in 'uMercury.pas',
uProcesses in 'uProcesses.pas',
uHelp in 'uHelp.pas' {fHelp},
uServices in 'uServices.pas',
gnugettext in 'gnugettext.pas',
uLanguage in 'uLanguage.pas' {fLanguage},
VersInfo in 'VersInfo.pas',
uConfigUserDefined in 'uConfigUserDefined.pas' {fConfigUserDefined},
uTomcat in 'uTomcat.pas';
{$R *.res}
begin
AddDomainForResourceString ('delphi2006_de_en');
AddDomainForResourceString('xampp_control');
gnugettext.textdomain('xampp_control');
TP_GlobalIgnoreClassProperty(TControl,'HelpKeyword');
TP_GlobalIgnoreClassProperty(TNotebook,'Pages');
TP_GlobalIgnoreClassProperty(TControl,'ImeName');
TP_GlobalIgnoreClass(TFont);
IniFileName:=Application.ExeName;
IniFileName:=copy(IniFileName,1,length(IniFileName)-3)+'ini';
LoadSettings;
if Config.Language='' then begin
Config.Language:=GetSystemLangShort;
Application.CreateForm(TfLanguage, fLanguage);
fLanguage.ShowModal;
fLanguage.Free;
SaveSettings;
end;
UseLanguage(Config.Language);
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TfMain, fMain);
Application.CreateForm(TfNetstat, fNetstat);
Application.CreateForm(TfConfig, fConfig);
Application.CreateForm(TfHelp, fHelp);
Application.CreateForm(TfLanguage, fLanguage);
Application.CreateForm(TfConfigUserDefined, fConfigUserDefined);
Application.Run;
end.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,29 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__202939CE_5B83_453D_A1C9_63457E43CBB0__INCLUDED_)
#define AFX_STDAFX_H__202939CE_5B83_453D_A1C9_63457E43CBB0__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//#define STRICT
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#ifdef UNICODE
#define stristr stristrW
#else
#define stristr stristrA
#endif
char* __fastcall stristrA(const char* psz1, const char* psz2);
WCHAR* __fastcall stristrW(const WCHAR* pszMain, const WCHAR* pszSub);
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__202939CE_5B83_453D_A1C9_63457E43CBB0__INCLUDED_)

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -0,0 +1,19 @@
[START]
hide = 1
apache = 1
mysql = 1
tomcat = 1
[EXIT]
apache = 1
mysql = 1
tomcat = 1
[PORTS]
apache = 80
mysql = 3306
tomcat = 8080
[XAMPP]
setup = 1

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="CompanyName.ProductName.XAMPP"
type="win32"
/>
<description>XAMPP Control Utility</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

View File

@@ -0,0 +1,2 @@
zip xampp.zip *.exe
move xampp.zip c:\ftproot

Some files were not shown because too many files have changed in this diff Show More