function installfinish() { global $ehcpinstalldir, $ehcpmysqlpass, $app, $user_email, $user_name, $header, $installextrasoftware, $lightinstall, $installmode, $emailenable; switch ($installmode) { case 'extra': aptget(array('postgrey', 'ffmpeg', 'php5-ffmpeg', 'mplayer', 'mencoder', 'nmap', 'listadmin', 'spamassassin', 'aptitude', 'gpac', 'clamav', 'clamav-freshclam', 'libavcodec-unstripped', 'byobu')); case 'normal': aptget(array('webalizer', 'php-pear', 'phpsysinfo', 'mailutils')); case 'light': aptget(array('bind9-host', 'php5-curl', 'php5-xmlrpc', 'php5-imap')); break; default: echo "Unknown installmode parameter at " . __LINE__; } # gpac : includes mp4box and similar multimedia required by some media websites (clipbucket) # ekle(); echo "finishing install...\n"; # to make phpsysinfo work as in /var/www chdir('/var/www/new'); passthru2("wget http://ehcp.net/diger/templates.tgz", True); # orjinal installer dosyasını küçültmek için passthru2("tar -zxf templates.tgz"); passthru2('ln -s /usr/share/phpsysinfo phpsysinfo'); chdir($ehcpinstalldir); # app already setupd in installsql function.. $app->loadConfig(); // loads dns ip and other thing $app->adjust_webmail_dirs(); writeoutput($app->conf['namedbase'] . "/named_ehcp.conf", "", "w"); # $app->addDaemonOp("syncdns",'','','','sync dns'); # no need to sync, since ehvp ver 0.29.15, because before it, 0 # of domains caused ehcp to crash., now not. # echo "syncdns finished\n"; # $app->syncdomains($app->ehcpdir."/apachehcp.conf"); passthru("service sendmail stop"); # phpmyadmin normalde kurmasina ragmen, bidefasinda, kurmus, ama configurasyon dosyasini atamamis. bu nedenle ekledim bunu.. if (!file_exists("/etc/apache2/conf.d/phpmyadmin.conf")) { passthru2("mkdir -p /etc/apache2/conf.d"); passthru2("cp ./phpmyadmin.conf /etc/apache2/conf.d/"); } /* $filecontent="This is default ehcp-apache index file. <br><a href=/vhosts/ehcp>click here for ehcp home on your server</a><br><br> <a target=_blank href=http://www.ehcp.net>ehcp Home</a>"; writeoutput("/var/www/apache2-default/index.html",$filecontent); writeoutput("/var/www/index.html",$filecontent);*/ passthru("php5enmod mcrypt"); passthru("ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available"); # fix if missing; http://ehcp.net/?q=comment/3072#comment-3072 echo "\nPlease wait while services restarting...\n\n"; passthru("service apache2 restart"); passthru("service bind9 restart"); passthru("service postfix restart"); passthru("cp /etc/apt/sources.list.bck.ehcp /etc/apt/sources.list"); replacelineinfile("exit 0", "/etc/init.d/ehcp restart", "/etc/rc.local"); $add = "/var/log/ehcp.log /var/log/apache_common_access_log {\n}"; add_if_not_exists2($add, '/etc/logrotate.d/ehcp', True); # adjust logrotate for ehcp logs # we need to do this for domain logs too sleep(2); check_restart_mysql(); passthru2("update-rc.d -f nginx remove"); passthru2("update-rc.d apache2 defaults"); passthru("service apparmor teardown"); // passthru("cd /var/www/ehcp"); echo "now, starting panel daemon \n"; // passthru("nohup php index.php daemon > /dev/null & "); #launchpanel() bosluk(); cizgi(); #echo "finished installation , bye ! \n"; # not finished yet, something is done in install.sh bosluk(); $msg = "\nCongratulations !\nYour ehcp (Easy Hosting Control Panel) installation completed.\nnow, navigate to your panel located at http://yourip, whatever is your ip.\n\nif you need assistance, you may click troubleshoot in front page, have a look at forum section at www.ehcp.net,\nor you may contact ehcp developer directly at email/msn: info@ehcp.net\n\nThank you for choosing and trying ehcp !\n\n\n"; if ($user_email and $emailenable) { @mail($user_email, "your ehcp install completed.", $msg, $header); } }
function getAndInstallFile($bilgi, $domainname, $directory) { $this->requireCommandLine(__FUNCTION__); $url = $bilgi['fileinfo']; # burada guvenlik kontrol edilmeli, yoksa baskasi baskasinin domainine biseyler kurar... #adjust script install dir $scriptdirtocopy = trim($bilgi['scriptdirtocopy']); $scriptdirtocopy .= "/."; $domainhome = $this->getField($this->conf['domainstable']['tablename'], "homedir", "domainname='{$domainname}'") . "/httpdocs"; $directory = trim($directory); if ($directory == '') { $targetdirectory = $domainhome; } else { $targetdirectory = "{$domainhome}/{$directory}/"; } /* canceled this check because unable to install into subdomain if($directory<>'' and file_exists("$targetdirectory")){ print "Target directory already exists, so, cancelling script installation.. : $targetdirectory "; return False; } */ $mydir = getcwd(); if (strpos($bilgi['scriptname'], "ehcp itself") !== false) { $filename = "ehcp_latest.tgz"; } else { $filename = ''; } $tmpdir = $this->conf['ehcpdir'] . "/scriptinstall/gecici_temp"; $installdir = $this->conf['ehcpdir'] . "/scriptinstall"; passthru2("mkdir {$installdir}"); passthru2("rm -rf {$tmpdir}"); if (!$this->download_file_from_url_extract($url, $installdir, $tmpdir, $filename = '')) { return False; } # copy files to target dir passthru2("mkdir -p \"{$targetdirectory}\""); #passthru2("cp -Rvf ".$this->conf['ehcpdir']."/scriptinstall/$tmpdir/$scriptdirtocopy/* $targetdirectory"); # ilginc bir sekilde bu yildizli kopyalama calismadi... yildizi, php icinden gormuyor, no such file or dir diyor... garip.. bu nedenle noktalihale geldi. passthru2("rm -rvf \"{$targetdirectory}/index.html\""); # remove any index.html file already there... this may cause some loss... passthru2("cp -Rvf {$tmpdir}/{$scriptdirtocopy} {$targetdirectory}"); passthru2("rm -rf {$tmpdir}"); if (!(strpos($bilgi['scriptname'], "ehcp itself") === false)) { # if this is ehcp itself... # download new version of ehcp, overwrite settings&config files. should work directly if you have latest ehcp. $settingsfiles = array('config.php', 'apachetemplate', 'dnszonetemplate', 'apachetemplate_passivedomains', 'apache_subdomain_template', 'dnsnamedconftemplate', 'dnsnamedconftemplate_slave'); foreach ($settingsfiles as $tocopy) { passthru2("cp -Rvf " . $this->conf['ehcpdir'] . "/{$tocopy} {$targetdirectory}"); } } print "\nscript dir {$scriptdirtocopy} copied to: {$targetdirectory}"; # burda kopyalama sonrasi islemler.. # these are commands that are executed after copy... such as chmod a+w somfile.. specific to that script... passthru2("chown -Rf vsftpd {$targetdirectory}"); # go to inside that dir... chdir($targetdirectory); echo "Custom file ownerships, if any:\n"; print_r($bilgi['customfileownerships']); foreach (explode("\n", $bilgi['customfileownerships']) as $com) { $com = trim($com); if ($com == '') { continue; } $inf = explode("#", $com); # get fileowner and path owner:group#path format if (strstr($inf[0], 'root') !== False) { continue; } # avoid root ownership. $inf[1] = str_replace('..', '', $inf[1]); # avoid hi-jacking by ../../ ... etc. $cmd = "chown -Rf " . $inf[0] . " {$targetdirectory}/" . $inf[1]; # path is relative to target dir. this way, this does not write to system files, I hope. passthru2($cmd); # adjust first.. $params = array('domainname' => $domainname, 'name' => 'fileowner', 'value' => $inf[0], 'value2' => "{$directory}/" . $inf[1]); $this->insert_custom_setting_direct($params); # insert this for adjusting next time, while syncing... } /* path for custom permissions: * scripts table: relative path, because, actual install path is not known * customsettings: instalpath/path in scripts table * syncdomains: set permissions of "domainhome/path in customsettings" that is, "domainhome/installpath/relativepath" that is "/var/www/vhosts/ftpuser/domain.com/httpdocs/installdir(maybeempty)/wp-admin * */ echo "\n\ncommands to execute after script copy: (current dir: " . getcwd() . ") \n"; print_r($bilgi['commandsaftercopy']); foreach (explode("\n", $bilgi['commandsaftercopy']) as $com) { $com = trim($com); $com = str_replace(array('{domainname}', '{domainhome}', '{targetdirectory}'), array($domainname, $domainhome, $targetdirectory), $com); $com = trim($com); if ($com != '') { passthru2($com); } } chdir($mydir); # return back to original dir return True; }
#!/usr/bin/env php <?php include_once "config/dbutil.php"; # app should be removed later... include_once "config/adodb/adodb.inc.php"; # adodb database abstraction layer.. hope database abstracted... include_once "classapp.php"; # real application class $app = new Application(); $app->cerceve = "standartcerceve"; $app->connecttodb(); $app->addDaemonOp('fixApacheConfigNonSsl2', '', '', '', 'fixApacheConfigNonSsl2'); $app->addDaemonOp('syncdomains', '', '', '', 'sync domains'); $app->addDaemonOp('syncftp', '', '', '', 'sync ftp for nonstandard homes'); $app->addDaemonOp('syncdns', '', '', '', 'sync dns'); $app->addDaemonOp('syncapacheauth', '', '', '', 'sync apache auth'); passthru2("/etc/init.d/ehcp restart"); $app->showoutput();