Ejemplo n.º 1
0
 function dbactionAdd()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $dir = $this->main->__var_full_directory;
     $dir = expand_real_root($dir);
     $pass = $this->main->realpass;
     if (!$pass) {
         $pass = randomString(8);
     }
     lxshell_input("{$pass}\n{$pass}\n", "pure-pw", "useradd", $this->main->nname, "-u", $this->main->__var_username, "-d", $dir, "-m");
     if (!lxfile_exists($dir)) {
         lxfile_mkdir($dir);
         lxfile_unix_chown($dir, $this->main->__var_username);
     }
     $this->setQuota();
     // If the user is added is fully formed, this makes sure that all his properties are synced.
     $this->toggleStatus();
 }
Ejemplo n.º 2
0
 function createUser()
 {
     global $gbl, $sgbl, $login, $ghtml;
     if (!$sgbl->isKloxo()) {
         return;
     }
     $password = $this->main->password;
     $cmd = "useradd";
     $shell = fix_disabled("--Disabled--", $sgbl->__var_noaccess_shell);
     $username = $this->main->getPathFromName();
     if (is_numeric($username[0])) {
         $username = "******";
     }
     $username = os_create_system_user($username, $password, $this->main->nname, $shell, "__path_customer_root/{$this->main->getPathFromName()}/");
     lxfile_unix_chown("__path_customer_root/{$this->main->getPathFromName()}", "{$username}:apache");
     lxfile_unix_chmod("__path_customer_root/{$this->main->getPathFromName()}", "750");
     $this->main->username = $username;
     $this->setQuota();
     $ret = array("__syncv_username" => $username);
     return $ret;
 }
Ejemplo n.º 3
0
 static function readAuthorizedKey($username)
 {
     $p = os_get_home_dir($username);
     if ($p === '/tmp' && $username) {
         if (!lxfile_exists("/home/{$username}")) {
             lxfile_mkdir("/home/{$username}");
             lxshell_return("usermod", "-d", "/home/{$username}", $username);
             lxfile_unix_chown("/home/{$username}", "{$username}:{$username}");
             $p = "/home/{$username}";
         }
     }
     if (!$p) {
         return;
     }
     $f = "{$p}/.ssh/authorized_keys";
     if (lxfile_exists("{$f}2")) {
         $s = lfile_get_contents("{$f}2");
         $s = "\n{$s}\n";
         lxuser_put_contents($username, $f, $s, FILE_APPEND);
         lunlink("{$f}2");
     }
     return lfile_get_contents($f);
 }
Ejemplo n.º 4
0
 function fullUpdate()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $domname = $this->main->nname;
     $uname = $this->main->username;
     $hroot = $sgbl->__path_httpd_root;
     $droot = $this->main->getFullDocRoot();
     lxfile_mkdir("{$hroot}/{$domname}/webstats");
     $this->main->createPhpInfo();
     web::createstatsConf($domname, $this->main->stats_username, $this->main->stats_password);
     self::createSSlConf($this->main->__var_ipssllist, $this->main->__var_domainipaddress);
     $this->createConffile();
     // Removed recursive
     lxfile_unix_chown("{$droot}/", "{$uname}:{$uname}");
     lxfile_unix_chmod("{$droot}/", "0755");
     lxfile_unix_chmod("{$droot}", "0755");
     lxfile_unix_chown("{$hroot}/{$domname}", "{$uname}:apache");
 }
Ejemplo n.º 5
0
 static function setProgramSsl($contentpem, $contentsca)
 {
     lfile_put_contents("../etc/program.pem", $contentpem);
     if ($contentsca) {
         lfile_put_contents("../etc/program.ca", $contentsca);
     }
     lxfile_unix_chown("../etc/program.pem", "lxlabs:lxlabs");
     lxfile_unix_chown("../etc/program.ca", "lxlabs:lxlabs");
 }
Ejemplo n.º 6
0
function createHtpasswordFile($object, $sdir, $list)
{
    $dir = "__path_httpd_root/{$object->main->getParentName()}/{$sdir}/";
    $loc = $object->main->directory;
    $file = get_file_from_path($loc);
    $dirfile = "{$dir}/{$file}";
    if (!lxfile_exists($dir)) {
        lxfile_mkdir($dir);
        lxfile_unix_chown($dir, $object->main->__var_username);
    }
    $fstr = null;
    foreach ($list as $k => $p) {
        $cr = crypt($p);
        $fstr .= "{$k}:{$cr}\n";
    }
    dprint($fstr);
    lfile_write_content($dirfile, $fstr, $object->main->__var_username);
    lxfile_unix_chmod($dirfile, "0755");
}
Ejemplo n.º 7
0
 function dbactionUpdate($subaction)
 {
     global $gbl, $sgbl, $login, $ghtml;
     if_demo_throw_exception('ffile');
     $this->aux = new Ffile__common(null, null, $this->nname);
     $this->aux->main = $this->main;
     if ($this->main->isOn('readonly')) {
         throw new lxexception('file_manager_is_readonly', '');
     }
     $chownug = "{$this->main->__username_o}:{$this->main->__username_o}";
     switch ($subaction) {
         case "fancyedit":
         case "edit":
             lxuser_put_contents($chownug, $this->main->getFullPath(), $this->main->content);
             lxuser_return($chownug, "dos2unix", $this->main->getFullPath());
             lxuser_chmod($chownug, $this->main->getFullPath(), "0644");
             break;
         case "upload_s":
             $filename = $this->aux->uploadDirect();
             lxuser_chmod($chownug, $filename, "0644");
             lxfile_generic_chown($filename, $chownug);
             break;
         case "rename":
             $this->aux->reName();
             break;
         case "paste":
             $this->aux->filePaste();
             break;
         case "perm":
             $arg = null;
             $perm = $this->main->newperm;
             $perm = 0 . $perm;
             if ($this->main->isOn('recursive_f')) {
                 new_process_chmod_rec($this->main->__username_o, $this->main->fullpath, $perm);
             } else {
                 lxfile_unix_chmod($this->main->fullpath, "{$perm}");
             }
             break;
         case "newdir":
             $path = $this->aux->newDir();
             lxfile_unix_chown($path, $chownug);
             break;
         case "content":
             if ($this->main->is_image()) {
                 $this->aux->resizeImage();
             } else {
                 throw new lxexception('cannot_save_content', '');
             }
             break;
         case "thumbnail":
             $this->aux->createThumbnail();
             break;
         case "convert_image":
             $this->aux->convertImage();
             break;
         case "zip_file":
             $zipfile = $this->aux->zipFile();
             break;
         case "filedelete":
             $this->aux->moveAllToTrash();
             break;
         case "filerealdelete":
             $this->aux->fileRealDelete();
             break;
         case "restore_trash":
             $this->aux->restoreTrash();
             break;
         case "clear_trash":
             $this->aux->clearTrash();
             break;
         case "download_from_http":
             $fullpath = $this->aux->downloadFromHttp();
             lxfile_unix_chown($fullpath, $chownug);
             break;
         case "download_from_ftp":
             $fullpath = $this->aux->downloadFromFtp();
             lxfile_unix_chown($fullpath, $chownug);
             break;
         case "zipextract":
             $dir = $this->aux->zipExtract();
             break;
     }
 }
Ejemplo n.º 8
0
function lxfile_generic_chown($file, $mod)
{
    lxfile_unix_chown($file, $mod);
}
Ejemplo n.º 9
0
 function syncCreateConf()
 {
     global $gbl, $sgbl, $login, $ghtml;
     //	$host = `hostname`;
     $dlistv = "__var_domainlist_{$this->main->__var_syncserver}";
     $result = $this->main->{$dlistv};
     $nameduser = "******";
     $dnsfile = "/var/tinydns/root/data";
     //dprintr($result);
     $result = merge_array_object_not_deleted($result, $this->main);
     if (!$this->main->isDeleted()) {
         foreach ((array) $this->main->__var_addonlist as $d) {
             $result = merge_array_object_not_deleted($result, $d);
         }
     }
     $cdata = null;
     foreach ((array) $result as $value) {
         $cdata .= " {$value['nname']}.data ";
     }
     $cdata = trim($cdata);
     if ($cdata) {
         $cmd = "cd /var/tinydns/root/kloxo/ ; cat {$cdata} > ../data";
         log_log("dns_log", $cmd);
         system($cmd);
     } else {
         system("rm /var/tinydns/root/data");
     }
     lxfile_unix_chown($dnsfile, $nameduser);
     lxshell_directory("/var/tinydns/root/", "make");
     lxshell_directory("/var/tinydns/root/", "tinydns-data");
 }
Ejemplo n.º 10
0
 function updateupload_Logo($param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $progname = $sgbl->__var_program_name;
     $parent = $this->getParentO();
     $imgname = $parent->getClName();
     //	$param['specialplay_b-logo_image'] = "/img/logo/$imgname.gif";
     //	$param['specialplay_b-logo_image_loading'] = "/img/logo/$imgname-loading.gif";
     //	make_sure_directory_is_lxlabs("__path_program_htmlbase/img/logo");
     $param['specialplay_b-logo_image'] = "/img/user-logo.png";
     $fullpath_logo_image = __path_program_htmlbase . $param['specialplay_b-logo_image'];
     // temporary only for admin - 6.1.7
     if ($_FILES['logo_image_f']['tmp_name']) {
         lxfile_mv($_FILES['logo_image_f']['tmp_name'], $fullpath_logo_image);
     }
     /*
     	else {
     		lxfile_cp("__path_program_htmlbase/img/$progname-logo.gif", "__path_program_htmlbase" . $param['specialplay_b-logo_image']);
     	}
     */
     lxfile_cp($fullpath_logo_image, "/usr/local/lxlabs/kloxo/file/user-logo.png");
     // must chown to lxlabs for successful display on 'Upload Logo'
     lxfile_unix_chown($fullpath_logo_image, "lxlabs");
     passthru("lxphp.exe /usr/local/lxlabs/kloxo/bin/fix/fix-userlogo.php --select=all");
     /*
     	if ($_FILES['logo_image_loading_f']['tmp_name']) {
     		lxfile_mv($_FILES['logo_image_loading_f']['tmp_name'], "__path_program_htmlbase" .$param['specialplay_b-logo_image_loading']);
     	} else {
     		lxfile_cp("__path_program_htmlbase/img/$progname-splash.gif", "__path_program_htmlbase" . $param['specialplay_b-logo_image_loading']);
     	}
     */
     $tsp = $parent->getObject("sp_childspecialplay");
     $tsp->specialplay_b->logo_image = $param['specialplay_b-logo_image'];
     //	$tsp->specialplay_b->logo_image_loading = $param['specialplay_b-logo_image_loading'];
     $tsp->setUpdateSubaction('upload_logo');
     $this->setUpdateSubaction('upload_logo');
     return $param;
 }
Ejemplo n.º 11
0
 function fullUpdate()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $this->createConffile();
     $this->createSuexec();
     //	$this->updateMainConfFile();
     self::createSSlConf($this->main->__var_ipssllist, $this->main->__var_domainipaddress);
     //	self::createWebDefaultConfig();
     web::createstatsConf($this->main->nname, $this->main->stats_username, $this->main->stats_password);
     $log_path = "/home/httpd/{$this->main->nname}/stats";
     lxfile_unix_chown_rec($log_path, "{$this->main->username}:apache");
     lxfile_unix_chmod_rec($log_path, "770");
     $this->main->createPhpInfo();
     lxfile_unix_chown("__path_httpd_root/{$this->main->nname}", "{$this->main->username}:apache");
     lxfile_unix_chmod("__path_httpd_root/{$this->main->nname}", "0755");
     lxfile_unix_chmod("{$this->main->getFullDocRoot()}", "0755");
 }
Ejemplo n.º 12
0
 function syncCreateConf()
 {
     global $gbl, $sgbl, $login, $ghtml;
     //	$host = `hostname`;
     $result = $this->main->__var_domainlist;
     $fdata = null;
     $dnsfile = "{$sgbl->__path_mara_conf}";
     $nameduser = $sgbl->__var_programuser_dns;
     $iplist = os_get_allips();
     $iplist[] = "127.0.0.1";
     $iplist = implode(",", $iplist);
     $fdata = "csv2 = {}\n";
     $fdata .= "chroot_dir = \"/etc/maradns\"\n";
     $fdata .= "ipv4_bind_addresses=\"{$iplist}\"\n";
     $fdata .= "recursive_acl=\"0.0.0.0/0\"\n";
     $result = merge_array_object_not_deleted($result, $this->main);
     if (!$this->main->isDeleted()) {
         foreach ((array) $this->main->__var_addonlist as $d) {
             $result = merge_array_object_not_deleted($result, $d);
         }
     }
     foreach ((array) $result as $value) {
         $tmp = "csv2[\"{$value['nname']}.\"] = \"{$value['nname']}\"\n";
         $fdata .= $tmp;
     }
     lfile_put_contents($dnsfile, $fdata);
     lxfile_unix_chown($dnsfile, $nameduser);
 }
Ejemplo n.º 13
0
 function createIniFile()
 {
     $pclass = $this->main->getParentClass();
     $ver = find_php_version();
     $this->initString($ver);
     $header = lfile_get_contents("../file/phpini/php.ini.template-{$ver}");
     $cont = lfile_get_contents("../file/phpini/php.ini.temp");
     $htcont = lfile_get_contents("../file/phpini/htaccesstemp");
     $vlist = array("enable_zend_val", "enable_ioncube_val", "enable_xcache_val");
     $l1 = $this->main->getInheritedList();
     $l2 = $this->main->getLocalList();
     $l3 = $this->main->getExtraList();
     $ll = lx_array_merge(array($l1, $l2, $l3));
     $list = array_unique($ll);
     foreach ($list as $l) {
         $vl = strtil($l, "_flag") . "_val";
         if (array_search_bool($vl, $vlist)) {
             continue;
         }
         list($cont, $htcont) = $this->replacestr(array($cont, $htcont), $l);
     }
     foreach ($vlist as $vl) {
         list($cont) = $this->replacestr(array($cont), $vl);
     }
     $stlist[] = "###Start Kloxo PHP config Area";
     $stlist[] = "###Start Lxdmin Area";
     $stlist[] = "###Start Kloxo Area";
     $stlist[] = "###Start Lxadmin PHP config Area";
     $endlist[] = "###End Kloxo PHP config Area";
     $endlist[] = "###End Kloxo Area";
     $endlist[] = "###End Lxadmin PHP config Area";
     $endstring = $endlist[0];
     $startstring = $stlist[0];
     if ($pclass === 'pserver') {
         $file = "/etc/php.ini";
         if (!lxfile_exists("__path_kloxo_back_phpini")) {
             lxfile_cp("/etc/php.ini", "__path_kloxo_back_phpini");
         }
         $this->enableDisableModule("enable_xcache_flag", "xcache");
         $htfile = null;
         $extrafile = "/etc/custom.php.ini";
         if (lxfile_exists($extrafile)) {
             $extrastring = lfile_get_contents($extrafile);
             $cont = "{$extrastring}\n{$cont}";
         } else {
             $cont = "{$cont}";
         }
     } else {
         $dname = $this->main->getParentName();
         $elogfile = "/home/{$this->main->__var_customer_name}/__processed_stats/{$this->main->getParentName()}.phplog";
         $file = "__path_httpd_root/{$this->main->getParentName()}/php.ini";
         $extrafile = "__path_httpd_root/{$this->main->getParentName()}/custom.php.ini";
         if (lxfile_exists($extrafile)) {
             $extrastring = lfile_get_contents($extrafile);
         } else {
             $extrastring = "";
         }
         // ToDo #590 - disable appear on .htaccess
         // REVERT - back to enable because mod_php tend to share-based php.ini
         // and some parameters of domain specific must be declare inside .htaccess
         $htfile = "{$this->main->__var_docrootpath}/.htaccess";
         $ht1file = "/home/{$this->main->__var_customer_name}/kloxoscript/.htaccess";
         $htcont = "php_value error_log \"{$elogfile}\"\n{$htcont}";
         $htcont = str_replace("\n", "\n\t", $htcont);
         $htcont = str_replace($htcont, "\t" . $htcont, $htcont);
         $htcont = "\n<Ifmodule mod_php4.c>\n{$htcont}\n</Ifmodule>\n\n<Ifmodule mod_php5.c>\n{$htcont}\n</Ifmodule>\n";
         file_put_between_comments("{$this->main->__var_web_user}:apache", $stlist, $endlist, $startstring, $endstring, $htfile, $htcont);
         file_put_between_comments("{$this->main->__var_web_user}:apache", $stlist, $endlist, $startstring, $endstring, $ht1file, $htcont);
         lxfile_unix_chown($htfile, "{$this->main->__var_web_user}:apache");
         // MR --- set the same like AddOpenBaseDir() on web__apachelib.php
         $clname = $this->main->__var_customer_name;
         $adminbasedir = trim($this->main->__var_extrabasedir);
         if ($adminbasedir) {
             $adminbasedir .= ":";
         }
         if (!$this->main->isOn('__var_disable_openbasedir')) {
             $path = "{$adminbasedir}";
             $path .= "/home/{$clname}:";
             $path .= "/home/{$clname}/kloxoscript:";
             $path .= "/home/httpd/{$dname}:";
             $path .= "/home/httpd/{$dname}/httpdocs:";
             $path .= "/tmp:";
             $path .= "/usr/share/pear:";
             $path .= "/var/lib/php/session:";
             $path .= "/home/kloxo/httpd/script";
             $cont = "open_basedir = \"{$path}\"\n\n{$cont}";
         }
         $cont = "error_log = \"{$elogfile}\"\n{$cont}";
         $cont = "{$extrastring}\n{$cont}";
     }
     lxfile_rm($file);
     lfile_put_contents($file, "{$header}\n{$cont}\n");
     createRestartFile($this->main->__var_webdriver);
 }
Ejemplo n.º 14
0
Archivo: lib.php Proyecto: zseand/kloxo
function setSomePermissions()
{
    log_cleanup("Install/Fix Services/Permissions/Configfiles");
    if (!lxfile_exists("/usr/bin/lxphp.exe")) {
        log_cleanup("- Create lxphp.exe Symlink");
        lxfile_symlink("__path_php_path", "/usr/bin/lxphp.exe");
    }
    log_cleanup("- Set permissions for /usr/bin/php-cgi");
    lxfile_unix_chmod("/usr/bin/php-cgi", "0755");
    log_cleanup("- Set permissions for closeallinput binary");
    lxfile_unix_chmod("../cexe/closeallinput", "0755");
    log_cleanup("- Set permissions for lxphpsu binary");
    lxfile_unix_chown("../cexe/lxphpsu", "root:root");
    lxfile_unix_chmod("../cexe/lxphpsu", "0755");
    lxfile_unix_chmod("../cexe/lxphpsu", "ug+s");
    log_cleanup("- Set permissions for phpsuexec.sh script");
    lxfile_unix_chmod("../file/phpsuexec.sh", "0755");
    log_cleanup("- Set permissions for /home/kloxo/httpd/lighttpd/ dir");
    system("chown -R apache:apache /home/kloxo/httpd/lighttpd/");
    log_cleanup("- Set permissions for /var/lib/php/session/ dir");
    system("chmod 777 /var/lib/php/session/");
    system("chmod o+t /var/lib/php/session/");
    log_cleanup("- Set permissions for /var/bogofilter/ dir");
    system("chmod 777 /var/bogofilter/");
    system("chmod o+t /var/bogofilter/");
    log_cleanup("- Kill sisinfoc system process");
    system("pkill -f sisinfoc");
}
Ejemplo n.º 15
0
                if ($drec->param === $oldip) {
                    $drec->param = $newip;
                }
            }
        }
        $dns->was();
    }
}
$list = lscandir_without_dot("/home/httpd");
foreach ($list as $l) {
    if (!is_dir("/home/httpd/{$l}")) {
        continue;
    }
    lxfile_unix_chown_rec("/home/httpd/{$l}/stats/", "apache");
}
$driverapp = $gbl->getSyncClass(null, 'localhost', 'web');
if ($driverapp === 'apache') {
    // --- issue #589
    //	addLineIfNotExistInside("/etc/httpd/conf/httpd.conf", "Include /etc/httpd/conf/kloxo/kloxo.conf", "");
    lxshell_return("__path_php_path", "../bin/misc/installsuphp.php");
} else {
    lxfile_cp("../file/lighttpd/lighttpd.conf", "/etc/lighttpd/lighttpd.conf");
    // --- issue #598
    //	lxfile_cp("../file/lighttpd/conf/kloxo/kloxo.conf", "/etc/lighttpd/conf/kloxo/kloxo.conf");
    //	lxfile_cp("../file/lighttpd/conf/kloxo/webmail.conf", "/etc/lighttpd/conf/kloxo/webmail.conf");
    lxfile_cp("../file/lighttpd/~lxcenter.conf", "/etc/lighttpd/conf.d/~lxcenter.conf");
    lxfile_cp("../file/lighttpd/conf/kloxo/webmail.conf", "/home/lighttpd/conf/defaults/webmail.conf");
    lxfile_mkdir("/home/kloxo/httpd/lighttpd");
    lxfile_unix_chown("/home/kloxo/httpd/lighttpd", "apache");
}
print "\n\n";
Ejemplo n.º 16
0
<?php

include_once "htmllib/lib/include.php";
initProgram('admin');
$login->loadAllObjects('client');
$list = $login->getList('client');
foreach ($list as $l) {
    lxfile_unix_chown("__path_customer_root/{$l->getPathFromName('nname')}", "{$l->username}:apache");
    lxfile_unix_chmod("__path_customer_root/{$l->getPathFromName('nname')}", "0750");
}
Ejemplo n.º 17
0
 static function switchProgramPre($old, $new)
 {
     // issue #589 - Change httpd config structure
     if ($new === 'apache') {
         lxfile_cp("/etc/sysconfig/httpd", "/etc/sysconfig/httpd.bck");
         $ret = lxshell_return("yum", "-y", "install", "httpd", "mod_ssl");
         if ($ret) {
             throw new lxexception('install_httpd_failed', 'parent');
         }
         lxfile_rm("/etc/sysconfig/httpd");
         lxfile_mv("/etc/sysconfig/httpd.bck", "/etc/sysconfig/httpd");
         lxshell_return("service", "lighttpd", "stop");
         lxshell_return("rpm", "-e", "--nodeps", "lighttpd");
         lunlink("/etc/init.d/lighttpd");
         lxshell_return("chkconfig", "httpd", "on");
     } else {
         $ret = lxshell_return("yum", "-y", "install", "lighttpd", "lighttpd-fastcgi");
         if ($ret) {
             throw new lxexception('install_lighttpd_failed', 'parent');
         }
         lxfile_unix_chmod("/etc/init.d/lighttpd", "0755");
         lxshell_return("service", "httpd", "stop");
         lxshell_return("rpm", "-e", "--nodeps", "httpd");
         lxshell_return("chkconfig", "lighttpd", "on");
     }
     if ($new === 'apache') {
         //		addLineIfNotExistInside("/etc/httpd/conf/httpd.conf", "Include /etc/httpd/conf/kloxo/kloxo.conf", "");
         lxshell_return("__path_php_path", "../bin/misc/installsuphp.php");
         //lxshell_return("__path_php_path", "../bin/fix/fixfrontpage.php");
     } else {
         lxfile_mkdir("/etc/lighttpd/");
         lxfile_mkdir("/etc/lighttpd/conf/kloxo");
         lxfile_cp("../file/lighttpd/lighttpd.conf", "/etc/lighttpd/lighttpd.conf");
         //		lxfile_cp("../file/lighttpd/conf/kloxo/kloxo.conf", "/etc/lighttpd/conf/kloxo/kloxo.conf");
         //		lxfile_cp("../file/lighttpd/conf/kloxo/webmail.conf", "/etc/lighttpd/conf/kloxo/webmail.conf");
         lxfile_cp("../file/lighttpd/etc_init.d", "/etc/init.d/lighttpd");
         lxfile_unix_chmod("/etc/init.d/lighttpd", "0755");
         lxfile_mkdir("/home/kloxo/httpd/lighttpd");
         lxfile_unix_chown("/home/kloxo/httpd/lighttpd", "apache");
     }
 }
Ejemplo n.º 18
0
function lfile_write_content($file, $data, $user)
{
    if (csa($user, ":")) {
        $realuser = strtil($user, ":");
    } else {
        $realuser = $user;
    }
    if (!check_file_if_owned_by($file, $realuser)) {
        return;
    }
    lfile_put_contents($file, $data);
    lxfile_unix_chown($file, $user);
}
Ejemplo n.º 19
0
 function zipExtract()
 {
     $extractdir = coreFfile::getRealPath($this->main->zip_extract_dir_f);
     $fulzippath = "{$this->main->root}/{$extractdir}";
     $zipd = trim($this->main->zip_extract_dir_f);
     $zipd = trim($this->main->zip_extract_dir_f, "/");
     if (!$zipd) {
         throw new lxexception('cannot_unzip_in_root', '', '');
     }
     if (lxfile_exists($fulzippath) && $this->main->__username_o === 'root') {
         throw new lxexception("root_cannot_extract_to_existing_dir", 'unzippath', $this->main->zip_extract_dir_f);
     }
     lxfile_mkdir($fulzippath);
     lxfile_unix_chown($fulzippath, $this->main->__username_o);
     $dir = expand_real_root($fulzippath);
     $file = expand_real_root($this->main->getFullPath());
     if ($file[0] !== '/') {
         $fullpath = getcwd() . "/{$file}";
     } else {
         $fullpath = $file;
     }
     $fullpath = expand_real_root($fullpath);
     if ($this->main->ttype === "zip") {
         $cmd = "/usr/bin/unzip -oq {$fullpath}";
     } else {
         $cmd = "/bin/tar -xzf {$fullpath}";
     }
     new_process_cmd($this->main->__username_o, $dir, $cmd);
     return $dir;
 }
Ejemplo n.º 20
0
 function createIniFile()
 {
     $pclass = $this->main->getParentClass();
     $ver = find_php_version();
     //dprintr($this->main->phpini_flag_b);
     $this->initString($ver);
     //dprintr($this->main->phpini_flag_b);
     $header = lfile_get_contents("../file/phpini/php.ini.template-{$ver}");
     $cont = lfile_get_contents("../file/phpini/php.ini.temp");
     $htcont = lfile_get_contents("../file/phpini/htaccesstemp");
     $vlist = array("enable_zend_val", "enable_ioncube_val", "enable_xcache_val");
     $l1 = $this->main->getInheritedList();
     $l2 = $this->main->getLocalList();
     $l3 = $this->main->getExtraList();
     $ll = lx_array_merge(array($l1, $l2, $l3));
     $list = array_unique($ll);
     foreach ($list as $l) {
         $vl = strtil($l, "_flag") . "_val";
         if (array_search_bool($vl, $vlist)) {
             continue;
         }
         list($cont, $htcont) = $this->replacestr(array($cont, $htcont), $l);
     }
     foreach ($vlist as $vl) {
         list($cont) = $this->replacestr(array($cont), $vl);
     }
     /*
     list($cont) = $this->replacestr(array($cont), 'enable_zend_val');
     list($cont) = $this->replacestr(array($cont), 'enable_ioncube_val');
     list($cont) = $this->replacestr(array($cont), 'enable_xcache_val');
     
     
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'register_global_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'output_compression_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'display_error_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'file_uploads_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'upload_max_filesize');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'log_errors_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'upload_tmp_dir_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'output_buffering_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'register_argc_argv_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'magic_quotes_gpc_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'variables_order_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'magic_quotes_runtime_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'magic_quotes_sybase_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'gpc_order_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'extension_dir_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'enable_dl_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'mysql_allow_persistent_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'disable_functions_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'max_execution_time_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'max_input_time_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'memory_limit_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'post_max_size_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'register_long_arrays_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'allow_url_fopen_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'allow_url_include_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'session_save_path_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'cgi_force_redirect_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'safe_mode_flag');
     */
     $stlist[] = "###Start Kloxo PHP config Area";
     $stlist[] = "###Start Lxdmin Area";
     $stlist[] = "###Start Kloxo Area";
     $stlist[] = "###Start Lxadmin PHP config Area";
     $endlist[] = "###End Kloxo PHP config Area";
     $endlist[] = "###End Kloxo Area";
     $endlist[] = "###End Lxadmin PHP config Area";
     $endstring = $endlist[0];
     $startstring = $stlist[0];
     if ($pclass === 'pserver') {
         $file = "/etc/php.ini";
         if (!lxfile_exists("__path_kloxo_back_phpini")) {
             lxfile_cp("/etc/php.ini", "__path_kloxo_back_phpini");
         }
         $this->enableDisableModule("enable_xcache_flag", "xcache");
         $htfile = null;
         $extrafile = "/etc/custom.php.ini";
         $extrastring = lfile_get_contents("/etc/custom.php.ini");
         $cont = "{$extrastring}\n{$cont}";
     } else {
         $dname = $this->main->getParentName();
         $elogfile = "/home/{$this->main->__var_customer_name}/__processed_stats/{$this->main->getParentName()}.phplog";
         $file = "__path_httpd_root/{$this->main->getParentName()}/php.ini";
         $extrafile = "__path_httpd_root/{$this->main->getParentName()}/custom.php.ini";
         $extrastring = lfile_get_contents($extrafile);
         $htfile = "{$this->main->__var_docrootpath}/.htaccess";
         $ht1file = "/home/httpd/{$this->main->getParentName()}/kloxoscript/.htaccess";
         $htcont = "php_value error_log {$elogfile}\n{$htcont}";
         $htcont = "<Ifmodule mod_php4.c>\n{$htcont}\n</Ifmodule>\n<Ifmodule mod_php5.c>\n{$htcont}\n</Ifmodule>\n";
         file_put_between_comments($stlist, $endlist, $startstring, $endstring, $htfile, $htcont);
         file_put_between_comments($stlist, $endlist, $startstring, $endstring, $ht1file, $htcont);
         lxfile_unix_chown($htfile, "{$this->main->__var_web_user}:apache");
         $adminbasedir = trim($this->main->__var_extrabasedir);
         if (!$this->main->isOn('__var_disable_openbasedir')) {
             $cont = "open_basedir = /home/{$this->main->__var_customer_name}:{$adminbasedir}:/tmp:/usr/share/pear:/home/httpd/{$dname}:/var/lib/php/session:/home/kloxo/httpd/script:/home/httpd/{$dname}/kloxoscript/\n{$cont}";
         }
         $cont = "error_log = {$elogfile}\n{$cont}";
         $cont = "{$extrastring}\n{$cont}";
     }
     lxfile_rm($file);
     lfile_put_contents($file, "{$header}\n{$cont}\n");
     createRestartFile($this->main->__var_webdriver);
 }