Exemplo n.º 1
0
    function print_include_jscript($header = NULL)
    {
        global $gbl, $sgbl, $login;
        ?>
	<meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">

		<?php 
        $this->print_refresh_key();
        $this->print_jscript_source("/htmllib/js/lxa.js");
        $this->print_jscript_source("/htmllib/js/helptext.js");
        $this->print_jscript_source("/htmllib/js/preop.js");
        if (!$login->getSpecialObject('sp_specialplay')->isOn('enable_ajax') && $header !== 'left_panel') {
        } else {
            $this->print_jscript_source("/htmllib/extjs/adapter/yui/yui-utilities.js");
            $this->print_jscript_source("/htmllib/extjs/adapter/yui/ext-yui-adapter.js");
            $this->print_jscript_source("/htmllib/extjs/ext-all.js");
            $this->print_jscript_source("/htmllib/yui-dragdrop/dragdrop.js");
        }
        $this->print_jscript_source("/htmllib/js/drag.js");
        $func = null;
        if (!$header) {
            $func = "onLoad='lxLoadBody();'";
        }
        if (!$header) {
            $descr = $this->getActionDescr($_SERVER['PHP_SELF'], $this->__http_vars, $class, $var, $identity);
            $help = $this->get_full_help($descr[2]);
            $help = $this->get_action_or_display_help($help, "display");
            $this->print_defintion($help);
        }
        $skin = $login->getSkinDir();
        $css = "{$skin}/css.css";
        if (!lfile_exists(getreal($css))) {
            $css = "/htmllib/css/skin/base.css";
        }
        $this->print_css_source("/htmllib/css/common.css");
        $this->print_css_source($css);
        $this->print_css_source("/htmllib/css/ext-all.css");
        $l = @getdate();
        $hours = $l['hours'];
        $minutes = $l['minutes'];
        if ($header === 'left_panel') {
            ?>
		<script type="text/javascript">
			var gl_helpUrl;
			gl_tDate = new Date();
			var clockTimeZoneMinutes = <?php 
            echo $l['minutes'];
            ?>
 - gl_tDate.getMinutes();
			var clockTimeZoneHours =   <?php 
            echo $l['hours'];
            ?>
 - gl_tDate.getHours();

			function program_help()
			{
				window.open(top.mainframe.jsFindHelpUrl());
			}
			function lxCallEnd()
			{
			}

		</script>
		</head>
			<?php 
        }
        ?>
	<script>
		function jsFindFilterVar()
		{
			gl_filtervar = '<?php 
        echo $this->get_filter_var();
        ?>
';
			return gl_filtervar;
		}

		function jsFindHelpUrl()
		{
			if (document.all || document.getElementById) {
				gl_helpUrl = '<?php 
        echo $this->get_help_url();
        ?>
';
				return gl_helpUrl;
			}
		}
		function lxLoadBody()
		{
			if (top.topframe && typeof top.topframe.changeLogo == 'function') {
				top.topframe.changeLogo(0);
			}
			changeContent('help', 'helparea');
		}
	</script>
		<?php 
        ?>
	<script>
		var gl_skin_directory = '<?php 
        echo $login->getSkinDir();
        ?>
';
	</script>
		<?php 
        if ($header === 'left_panel') {
            echo "<script>lxCallEnd();</script>";
        }
        #[FIXME] This call a lxCallEnd a empty function
    }
Exemplo n.º 2
0
function getDownloadServer()
{
    global $gbl, $sgbl, $login, $ghtml;
    static $local;
    $progname = $sgbl->__var_program_name;
    $maj = $sgbl->__ver_major_minor;
    if (!$local) {
        if (lfile_exists("__path_program_etc/.local_download")) {
            $local = 'on';
        } else {
            $local = 'off';
        }
    }
    if (isOn($local)) {
        $server = "http://192.168.1.100/download/{$progname}/{$maj}";
    } else {
        $server = "http://download.lxcenter.org/download/{$progname}/{$maj}";
    }
    /*
    	if ($sgbl->dbg < 0) {
    		$server = "http://download.lxlabs.com/download/$progname/$maj";
    	}
    */
    return $server;
}
Exemplo n.º 3
0
 static function checkOwnership($username, $path)
 {
     // When creating new files, must not check owner
     if (!lfile_exists($path)) {
         return true;
     }
     $owner = posix_getpwuid(fileowner(expand_real_root($path)));
     if ($owner['name'] !== $username) {
         log_log("fileacc_hacking", "{$username} tried to access {$owner['name']}'s file: {$path}");
         throw new lxexception('file_bad_owner_logged', '');
     }
     return true;
 }
Exemplo n.º 4
0
 function syncToSystemCommon()
 {
     global $gbl, $sgbl, $login, $ghtml;
     if ($login->isDemo()) {
         if ($this->get__table() !== 'ssession') {
             throw new lxexception('login_is_demo', '');
         }
     }
     // Don't sync if there is no subactiion for update..
     if ($this->dbaction === 'update' && !$this->subaction) {
         dprint("No subaction for update not syncing anymore {$this->get__table()}\n <br> ");
         return false;
     }
     if (lfile_exists("__path_program_etc/.writeonly")) {
         dprintr("Global Writonly Mode... Not syncing... <br> \n");
         return false;
     }
     if ($this->isDisabled('syncserver')) {
         dprint("syncserver disabled syncing anymore\n");
         return false;
     }
     return $this->isSync();
 }
Exemplo n.º 5
0
function lx_phpdebug()
{
    global $gbl, $sgbl;
    if ($sgbl->dbg <= 0) {
        return;
    }
    if (!lfile_exists("/tmp/.php_debug")) {
        return;
    }
    $fp = lfopen("/tmp/.php_debug", "r");
    $s = fgets($fp, 1024);
    fclose($fp);
    $s = preg_replace("/--noraise /i", "", $s);
    $arr = parse_url($s);
    parse_str($arr['query'], $out);
    $ghtml->print_input("hidden", "start_debug", "1");
    $ghtml->print_input("hidden", "debug_port", $out['debug_port']);
    $ghtml->print_input("hidden", "debug_text_mode", "1");
    $ghtml->print_input("hidden", "debug_no_cache", "1095197145");
}
Exemplo n.º 6
0
 static function getFile($stat, $file, $lines = null)
 {
     if (!lfile_exists($file)) {
         $stat['not_full_size'] = 'off';
         $stat['content'] = null;
         return $stat;
     }
     $size = lxfile_size($file);
     if ($size > 1000 * 1000) {
         $lines = 20;
     }
     if ($lines) {
         $getsize = $lines * 1000;
         $stat['not_full_size'] = 'on';
         $stat['content'] = lxfile_tail($file, $getsize);
         $stat['numlines'] = $lines;
     } else {
         $stat['not_full_size'] = 'off';
         $stat['content'] = lfile_get_contents($file);
     }
     return $stat;
 }
Exemplo n.º 7
0
function install_main()
{
    global $installcomp;
    global $argv;
    $comp = array("web", "mail", "dns", "database");
    $list = parse_opt($argv);
    if ($list['server-list']) {
        $serverlist = implode(",", $list['server-list']);
    } else {
        $serverlist = $comp;
    }
    foreach ($comp as $c) {
        flush();
        if (array_search($c, $serverlist) !== false) {
            print "Installing {$c} Components....";
            $req = $installcomp[$c];
            $func = "installcomp_{$c}";
            if (function_exists($func)) {
                $func();
            }
            install_general_mine($req);
            print "\n";
        }
    }
    $pattern = "Include /etc/httpd/conf/kloxo/kloxo.conf";
    $file = "/etc/httpd/conf/httpd.conf";
    $comment = "#Kloxo";
    addLineIfNotExist($file, $pattern, $comment);
    mkdir("/etc/httpd/conf/kloxo/");
    $dir_path = dirname(__FILE__);
    copy("{$dir_path}/kloxo.conf", "/etc/httpd/conf/kloxo/kloxo.conf");
    touch("/etc/httpd/conf/kloxo/virtualhost.conf");
    touch("/etc/httpd/conf/kloxo/webmail.conf");
    touch("/etc/httpd/conf/kloxo/init.conf");
    mkdir("/etc/httpd/conf/kloxo/forward/");
    touch("/etc/httpd/conf/kloxo/forward/forwardhost.conf");
    $options_file = "/var/named/chroot/etc/global.options.named.conf";
    $example_options = "acl \"lxcenter\" {\n";
    $example_options .= " localhost;\n";
    $example_options .= "};\n\n";
    $example_options .= "options {\n";
    $example_options .= " max-transfer-time-in 60;\n";
    $example_options .= " transfer-format many-answers;\n";
    $example_options .= " transfers-in 60;\n";
    $example_options .= " auth-nxdomain yes;\n";
    $example_options .= " allow-transfer { \"lxcenter\"; };\n";
    $example_options .= " allow-recursion { \"lxcenter\"; };\n";
    $example_options .= " recursion no;\n";
    $example_options .= " version \"LxCenter-1.0\";\n";
    $example_options .= "};\n\n";
    $example_options .= "# Remove # to see all DNS queries\n";
    $example_options .= "#logging {\n";
    $example_options .= "# channel query_logging {\n";
    $example_options .= "# file \"/var/log/named_query.log\";\n";
    $example_options .= "# versions 3 size 100M;\n";
    $example_options .= "# print-time yes;\n";
    $example_options .= "# };\n\n";
    $example_options .= "# category queries {\n";
    $example_options .= "# query_logging;\n";
    $example_options .= "# };\n";
    $example_options .= "#};\n";
    if (!lfile_exists($options_file)) {
        touch($options_file);
        chown($options_file, "named");
    }
    $cont = lfile_get_contents($options_file);
    $pattern = "options";
    if (!preg_match("+{$pattern}+i", $cont)) {
        file_put_contents($options_file, "{$example_options}\n");
    }
    $pattern = 'include "/etc/kloxo.named.conf";';
    $file = "/var/named/chroot/etc/named.conf";
    $comment = "//Kloxo";
    addLineIfNotExist($file, $pattern, $comment);
    touch("/var/named/chroot/etc/kloxo.named.conf");
    chown("/var/named/chroot/etc/kloxo.named.conf", "named");
}
Exemplo n.º 8
0
 function dbactionUpdate($subaction)
 {
     // issue #571 - add httpd-worker and httpd-event for suphp
     // issue #566 - Mod_ruid2 on Kloxo
     // issue #567 - httpd-itk for kloxo
     //	lxshell_return("service", "httpd", "stop");
     // 	system("/etc/init.d/httpd stop");
     $ret = lxshell_return("service", "httpd", "stop");
     if ($ret) {
         throw new lxexception('httpd_stop_failed', 'parent');
     }
     //-- old structure
     system("rm -rf /etc/httpd/conf/kloxo");
     system("rm -rf /home/httpd/conf");
     //-- new structure
     lxfile_mkdir("/home/apache/conf");
     lxfile_mkdir("/home/apache/conf/defaults");
     lxfile_mkdir("/home/apache/conf/domains");
     lxfile_mkdir("/home/apache/conf/redirects");
     lxfile_mkdir("/home/apache/conf/webmails");
     lxfile_mkdir("/home/apache/conf/wildcards");
     lxfile_mkdir("/home/apache/conf/exclusive");
     //--- some vps include /etc/httpd/conf.d/swtune.conf
     system("rm -f /etc/httpd/conf.d/swtune.conf");
     if (!lfile_exists("/etc/httpd/conf.d/~lxcenter.conf")) {
         copy("/usr/local/lxlabs/kloxo/file/apache/~lxcenter.conf", "/etc/httpd/conf.d/~lxcenter.conf");
         copy("/usr/local/lxlabs/kloxo/file/centos-5/httpd.conf", "/etc/httpd/conf/httpd.conf");
     }
     lxfile_rm("/etc/sysconfig/httpd");
     $t = $this->main->php_type;
     $a = $this->main->apache_optimize;
     $m = $this->main->mysql_convert;
     $f = $this->main->fix_chownchmod;
     if ($f === 'fix-ownership') {
         system("lphp.exe /usr/local/lxlabs/kloxo/bin/fix/fix-chownchmod.php --select=chown");
         //	setFixChownChmod('chown');
     } else {
         if ($f === 'fix-permissions') {
             system("lphp.exe /usr/local/lxlabs/kloxo/bin/fix/fix-chownchmod.php --select=chmod");
             //	setFixChownChmod('chmod');
         } else {
             if ($f === 'fix-ALL') {
                 system("lphp.exe /usr/local/lxlabs/kloxo/bin/fix/fix-chownchmod.php --select=all");
                 //	setFixChownChmod('all');
             }
         }
     }
     if ($m === 'to-myisam') {
         system("lphp.exe /usr/local/lxlabs/kloxo/bin/fix/mysql-convert.php --engine=myisam");
         //	setMysqlConvert('myisam');
     } else {
         if ($m === 'to-innodb') {
             system("lphp.exe /usr/local/lxlabs/kloxo/bin/fix/mysql-convert.php --engine=innodb");
             //	setMysqlConvert('innodb');
         }
     }
     //--- don't use '=== true' but '!== false'
     if (strpos($t, 'mod_php') !== false) {
         lxfile_mv("/etc/httpd/conf.d/php.nonconf", "/etc/httpd/conf.d/php.conf");
         lxfile_mv("/etc/httpd/conf.d/fastcgi.conf", "/etc/httpd/conf.d/fastgi.nonconf");
         lxfile_mv("/etc/httpd/conf.d/fcgid.conf", "/etc/httpd/conf.d/fcgid.nonconf");
         lxfile_mv("/etc/httpd/conf.d/ruid2.conf", "/etc/httpd/conf.d/ruid2.nonconf");
         lxfile_mv("/etc/httpd/conf.d/suphp.conf", "/etc/httpd/conf.d/suphp.nonconf");
         //	lxfile_cp("../file/httpd.prefork", "/etc/sysconfig/httpd");
         //	lxfile_rm("/etc/sysconfig/httpd");
         // use > that equal to lxfile_rm + echo >>
         system("echo 'HTTPD=/usr/sbin/httpd' >/etc/sysconfig/httpd");
         if ($t === 'mod_php') {
             // nothing
         } else {
             if ($t === 'mod_php_ruid2') {
                 system("yum -y install mod_ruid2");
                 system("yum -y update mod_ruid2");
                 lxfile_mv("/etc/httpd/conf.d/ruid2.nonconf", "/etc/httpd/conf.d/ruid2.conf");
                 lxfile_cp("../file/ruid2.conf", "/etc/httpd/conf.d/ruid2.conf");
             } else {
                 if ($t === 'mod_php_itk') {
                     system("echo 'HTTPD=/usr/sbin/httpd.itk' >/etc/sysconfig/httpd");
                 }
             }
         }
     } else {
         if (strpos($t, 'suphp') !== false) {
             system("yum -y install mod_suphp");
             system("yum -y update mod_suphp");
             lxfile_mv("/etc/httpd/conf.d/php.conf", "/etc/httpd/conf.d/php.nonconf");
             lxfile_mv("/etc/httpd/conf.d/fastcgi.conf", "/etc/httpd/conf.d/fastgi.nonconf");
             lxfile_mv("/etc/httpd/conf.d/fcgid.conf", "/etc/httpd/conf.d/fcgid.nonconf");
             lxfile_mv("/etc/httpd/conf.d/ruid2.conf", "/etc/httpd/conf.d/ruid2.nonconf");
             lxfile_mv("/etc/httpd/conf.d/suphp.nonconf", "/etc/httpd/conf.d/suphp.conf");
             lxfile_cp("../file/suphp.conf", "/etc/httpd/conf.d/suphp.conf");
             lxfile_cp("../file/etc_suphp.conf", "/etc/suphp.conf");
             //		lxfile_rm("/etc/sysconfig/httpd");
             if ($t === 'suphp') {
                 system("echo 'HTTPD=/usr/sbin/httpd' >/etc/sysconfig/httpd");
             } else {
                 if ($t === 'suphp_worker') {
                     system("echo 'HTTPD=/usr/sbin/httpd.worker' >/etc/sysconfig/httpd");
                 } else {
                     if ($t === 'suphp_event') {
                         system("echo 'HTTPD=/usr/sbin/httpd.event' >/etc/sysconfig/httpd");
                     }
                 }
             }
         } else {
             if (strpos($t, 'suexec') !== false) {
                 // work in progress...
             }
         }
     }
     //--- change to ~lxcenter.conf from the first idea
     //	lxfile_cp("../file/mpm.conf", "/etc/httpd/conf.d/mpm.conf");
     // Fixed issue #515 - returned due to accidentally deleted
     // enough handle by fix-chownchmod
     //	lxfile_generic_chmod("/home/admin", "0770");
     //	change to 'stop-start' instead 'restart' because problem when change prefork/worker/event/itk to other
     //	createRestartFile("httpd");
     //	lxshell_return("service", "httpd", "start");
     //	system("/etc/init.d/httpd start");
     $ret = lxshell_return("service", "httpd", "start");
     if ($ret) {
         throw new lxexception('httpd_start_failed', 'parent');
     }
     if ($a === 'optimize') {
         system("lphp.exe /usr/local/lxlabs/kloxo/bin/fix/apache-optimize.php --select=optimize");
     }
 }
Exemplo n.º 9
0
 function getNewSerial($fname, $ddate)
 {
     if (!lfile_exists($fname)) {
         return 0;
     }
     $fd = @fopen($fname, "r");
     if ($fd === false) {
         return 0;
     }
     while ($line = fgets($fd)) {
         if (preg_match("/(\\d*).*serial/", $line, $match)) {
             // If dates do not math, we reset serial
             $date = substr($match[1], 0, 8);
             if ($ddate == $date) {
                 // else we increment it
                 $ser = substr($match[1], 8, 2);
                 $ser += 1;
             } else {
                 $ser = 0;
             }
             fclose($fd);
             return $ser;
         }
     }
     fclose($fd);
     return -0;
 }
Exemplo n.º 10
0
function lxfile_cp_rec($dirsource, $dirdest)
{
    dprint("<b> I am here </b> ");
    $obj = new COM("Scripting.FilesystemObject");
    $username = "******";
    $dirdest = expand_real_root($dirdest);
    $dirsource = expand_real_root($dirsource);
    if (lfile_exists($dirdest) && is_dir($dirdest)) {
        $dirdest = $dirdest . "/" . basename($dirsource);
    }
    if (is_dir($dirsource)) {
        log_filesys("copyFolder {$dirsource} {$dirdest}");
        $obj->CopyFolder($dirsource, $dirdest);
    } else {
        log_filesys("copyFile {$dirsource} {$dirdest}");
        $obj->CopyFile($dirsource, $dirdest);
    }
}
Exemplo n.º 11
0
 function isExist($name)
 {
     if (lfile_exists($name)) {
         return true;
     }
     return false;
 }
Exemplo n.º 12
0
 function dbactionUpdate($subaction)
 {
     if_demo_throw_exception('ffile');
     if ($this->main->isOn('readonly')) {
         throw new lxexception('file_manager_is_readonly', '');
     }
     switch ($subaction) {
         case "edit":
             lfile_put_contents($this->main->getFullPath(), $this->main->content);
             break;
         case "upload":
             $filename = $this->main->getFullPath() . "/{$this->main->upload_file_name}";
             dprintr($this->main->upload_overwrite_f);
             if (!$this->main->isOn('upload_overwrite_f')) {
                 if (lfile_exists($filename)) {
                     throw new lxexception('file_exists_upload', 'upload_name_f');
                 }
             }
             getFromFileserv($this->main->__var_upload_tmp_server, $this->main->__var_upload_filepass, $filename);
             break;
         case "rename":
             $directory = dirname($this->main->fullpath);
             $new = $directory . "/" . $this->main->newname;
             if (lfile_exists($new)) {
                 throw new lxexception('file_exists_rename', '');
             }
             lxfile_mv_rec($this->main->fullpath, $new);
             //lxfile_unix_chown($new, $this->main->__username_o);
             break;
         case "paste":
             if ($this->main->paste_list) {
                 // Hack... SPecifically checking for pasteaction. Should just use it directly in the command.
                 $arglist[] = $this->main->__username_o;
                 foreach ($this->main->paste_list as &$_tl) {
                     $_tl = $this->main->root . $_tl;
                 }
                 //$arglist = array_merge($arglist, $this->main->paste_list);
                 $arglist[] = $this->main->paste_list;
                 $arglist[] = $this->main->fullpath;
                 if ($this->main->pasteaction === 'copy') {
                     foreach ($this->main->paste_list as $p) {
                         lxfile_cp_rec($p, $this->main->fullpath);
                     }
                 } else {
                     foreach ($this->main->paste_list as $p) {
                         lxfile_mv_rec($p, $this->main->fullpath);
                     }
                 }
                 //lxfile_unix_chown_rec($this->main->fullpath, $this->main->__username_o);
             }
             break;
         case "perm":
             throw new lxexception('no_perm_setting', '');
             break;
         case "newdir":
             $i = 1;
             $rpath = $this->main->fullpath;
             $name = "/" . $this->main->newfolder_f;
             $path = $rpath . $name;
             if (lxfile_exists($path)) {
                 throw new lxexception('file_exists', '');
             }
             lxfile_mkdir($path);
             break;
         case "zip_file":
             foreach ($this->main->zip_file_list as &$_t_f) {
                 $_t_f = coreFfile::removeLeadingSlash($_t_f);
                 $_t_f = basename($_t_f);
                 $_t_f = "\"{$_t_f}\"";
             }
             $list = implode(" ", $this->main->zip_file_list);
             $oldir = getcwd();
             $fullpath = expand_real_root($this->main->fullpath);
             do_exec_system($this->main->__username_o, $fullpath, "c:/Progra~1/7-Zip/7z a NewArchive.zip {$list}", $out, $err, $ret, null);
             break;
         case "filedelete":
             foreach ($this->main->filedelete_list as $f) {
                 ffile__common::moveToTrash($this->main->root, $f);
             }
             break;
         case "restore_trash":
             foreach ($this->main->restore_trash_list as $f) {
                 ffile__common::restoreFromTrash($this->main->root, $f);
             }
             break;
         case "clear_trash":
             foreach ($this->main->clear_trash_list as $f) {
                 ffile__common::clearFromTrash($this->main->root, $f);
             }
             break;
         case "zipextract":
             $fulzippath = $this->main->root . $this->main->zip_extract_dir_f;
             if (!lxfile_exists(null, $fulzippath)) {
                 lxfile_mkdir($fulzippath);
             } else {
                 $zipdir = new Ffile("localhost", "localhost", $this->main->root, $this->main->zip_extract_dir_f, $this->main->__username_o);
                 $zipdir->get();
                 if (!$zipdir->is_dir()) {
                     throw new lxexception("file_exists_but_not_dir", 'unzippath', $this->main->zip_extract_dir_f);
                 }
             }
             $command = "c:/Progra~1/7-zip/7z x -y";
             $dir = expand_real_root($fulzippath);
             $file = expand_real_root($this->main->getFullPath());
             if (!csa($file, ":")) {
                 $fullpath = getcwd() . "/{$file}";
             } else {
                 $fullpath = $file;
             }
             $oldir = getcwd();
             $fullpath = expand_real_root($fullpath);
             do_exec_system($this->main->__username_o, $dir, "{$command} {$fullpath}", $out, $err, $ret, null);
             break;
     }
 }
Exemplo n.º 13
0
function print_meta_css()
{
    global $gbl, $sgbl, $login, $ghtml;
    $skin = $login->getSkinDir();
    // Load theme CSS
    $cssTheme = $skin . "theme.css";
    $cssCommon = $skin . "common.css";
    $cssEXTjs = $skin . "ext-js.css";
    if (!lfile_exists(getreal($cssTheme))) {
        $cssTheme = "/htmllib/css/skin/default/missing-theme.css";
    }
    if (!lfile_exists(getreal($cssCommon))) {
        $cssCommon = "/htmllib/css/skin/default/missing-common.css";
    }
    if (!lfile_exists(getreal($cssEXTjs))) {
        $cssEXTjs = "/htmllib/css/skin/default/missing-ext-js.css";
    }
    // Load Common CSS
    $ghtml->print_css_source($cssCommon);
    // Load EXTJS CSS
    $ghtml->print_css_source($cssEXTjs);
    // Load Theme CSS
    $ghtml->print_css_source($cssTheme);
    if (!$login->isDefaultSkin()) {
        $cssThemeFeather = $skin . "feather.css";
        if (!lfile_exists(getreal($cssThemeFeather))) {
            $cssThemeFeather = "/htmllib/css/skin/feather/missing-feather.css";
        }
        // Load Theme CSS
        $ghtml->print_css_source($cssThemeFeather);
    }
}
Exemplo n.º 14
0
Arquivo: lib.php Projeto: zseand/kloxo
function installinstallapp()
{
    global $gbl, $sgbl, $login, $ghtml;
    // Install/Update installapp if needed or remove installapp when installapp is disabled.
    // Added in Kloxo 6.1.4
    log_cleanup("Initialize InstallApp");
    //--- trick for no install on kloxo install process
    if (lxfile_exists("/var/cache/kloxo/kloxo-install-disableinstallapp.flg")) {
        log_cleanup("- InstallApp is disabled by InstallApp Flag");
        system("echo 1 > /usr/local/lxlabs/kloxo/etc/flag/disableinstallapp.flg");
        return;
    }
    /*
    	if ($sgbl->is_this_master()) {
    		$gen = $login->getObject('general')->generalmisc_b;
    		$diflag = $gen->isOn('disableinstallapp');
    		log_cleanup("- InstallApp is disabled by InstallApp Flag");
    		system("echo 1 > /usr/local/lxlabs/kloxo/etc/flag/disableinstallapp.flg");
    	} else {
    		$diflag = false;
    		log_cleanup("- InstallApp is not disabled by InstallApp Flag");
    		lxfile_rm("/usr/local/lxlabs/kloxo/etc/flag/disableinstallapp.flg");
    	}
    */
    if (lxfile_exists("/usr/local/lxlabs/kloxo/etc/flag/disableinstallapp.flg")) {
        log_cleanup("- InstallApp is disabled, removing InstallApp");
        lxfile_rm_rec("/home/kloxo/httpd/installapp/");
        lxfile_rm_rec("/home/kloxo/httpd/installappdata/");
        system("cd /var/cache/kloxo/ ; rm -f installapp*.tar.gz;");
        return;
    } else {
        if (!lxfile_exists("__path_kloxo_httpd_root/installappdata")) {
            log_cleanup("- Updating InstallApp data");
            installapp_data_update();
        }
        if (lfile_exists("../etc/remote_installapp")) {
            log_cleanup("- Remote InstallApp detected, removing InstallApp");
            lxfile_rm_rec("/home/kloxo/httpd/installapp/");
            system("cd /var/cache/kloxo/ ; rm -f installapp*.tar.gz;");
            return;
        }
        // Line below Removed in Kloxo 6.1.4
        return;
        /*
        	log_cleanup("- Creating installapp dir");
        	lxfile_mkdir("__path_kloxo_httpd_root/installapp");
        
        	if (!lxfile_exists("__path_kloxo_httpd_root/installapp/wordpress")) {
        		log_cleanup("- Installing/Updating InstallApp");
        		lxshell_php("../bin/installapp-update.phps");
        	}
        	return;
        */
    }
}
Exemplo n.º 15
0
 function syncPasswordCommon()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $login->password = $this->password;
     if (!lfile_exists('__path_slave_db')) {
         return;
     }
     $rmt = unserialize(lfile_get_contents('__path_slave_db'));
     $rmt->password = $this->password;
     //$rmt->realpass = $this->realpass;
     lfile_put_contents('__path_slave_db', serialize($rmt));
 }
Exemplo n.º 16
0
 static function removeOtherDriver($driverapp)
 {
     global $gbl, $sgbl, $login, $ghtml;
     if ($driverapp === 'bind') {
         lxshell_return("service", "djbdns", "stop");
         lxshell_return("chkconfig", "named", "on");
         $pattern = 'include "/etc/global.options.named.conf";';
         $file = "/var/named/chroot/etc/named.conf";
         $comment = "//Global_options_file";
         addLineIfNotExist($file, $pattern, $comment);
         $options_file = "/var/named/chroot/etc/global.options.named.conf";
         $example_options = "acl \"lxcenter\" {\n";
         $example_options .= " localhost;\n";
         $example_options .= "};\n\n";
         $example_options .= "options {\n";
         $example_options .= " max-transfer-time-in 60;\n";
         $example_options .= " transfer-format many-answers;\n";
         $example_options .= " transfers-in 60;\n";
         $example_options .= " auth-nxdomain yes;\n";
         $example_options .= " allow-transfer { \"lxcenter\"; };\n";
         $example_options .= " allow-recursion { \"lxcenter\"; };\n";
         $example_options .= " recursion no;\n";
         $example_options .= " version \"LxCenter - 1.0\";\n";
         $example_options .= "};\n\n";
         $example_options .= "# Remove # to see all DNS queries\n";
         $example_options .= "#logging {\n";
         $example_options .= "# channel query_logging {\n";
         $example_options .= "# file \" /var/log / named_query . log\";\n";
         $example_options .= "# versions 3 size 100M;\n";
         $example_options .= "# print-time yes;\n";
         $example_options .= "# };\n\n";
         $example_options .= "# category queries {\n";
         $example_options .= "# query_logging;\n";
         $example_options .= "# };\n";
         $example_options .= "#};\n";
         if (!lfile_exists($options_file)) {
             touch($options_file);
             chown($options_file, "named");
         }
         $cont = lfile_get_contents($options_file);
         $pattern = "options";
         if (!preg_match("+{$pattern}+i", $cont)) {
             file_put_contents($options_file, "{$example_options}\n");
         }
         $pattern = 'include "/etc/kloxo.named.conf";';
         $file = "/var/named/chroot/etc/named.conf";
         $comment = "//Kloxo";
         addLineIfNotExistInside($file, $pattern, $comment);
         touch("/var/named/chroot/etc/kloxo.named.conf");
         chown("/var/named/chroot/etc/kloxo.named.conf", "named");
         lxshell_return("rpm", "-e", "djbdns");
         lunlink("/etc/init.d/djbdns");
     } else {
         lxshell_return("service", "named", "stop");
         lxshell_return("rpm", "-e", "--nodeps", "bind");
         lxshell_return("rpm", "-e", "--nodeps", "bind-chroot");
         lxshell_return("chkconfig", "djbdns", "on");
     }
 }
Exemplo n.º 17
0
function lxfile_exists($file)
{
    return lfile_exists($file);
}
Exemplo n.º 18
0
function show_help_file($hhelp_file)
{
    global $gbl, $login, $ghtml;
    $help_file = getreal($hhelp_file);
    if (!lfile_exists($help_file)) {
        dprint("Debug Message: File <h3> <font color=red> {$hhelp_file}  Doesn't Exist </font> </h3> . Showing default</h1> ");
        lfile_put_contents("missing.txt", $hhelp_file . "\n", FILE_APPEND);
        return 0;
    }
    dprint("  Debug Message: Showing <h3>  {$hhelp_file}  </h3> ");
    $fp = lfopen($help_file, "r");
    if (!$fp) {
        print "cannot open {$help_file} <br> ";
        return 0;
    }
    $last = "";
    $inblock = "out";
    while (!feof($fp)) {
        $buf = fgets($fp, 1024);
        $buf = trim($buf);
        if (preg_match("/<reseller>/", $buf)) {
            $inblock = "reseller";
            continue;
        }
        if (preg_match("/<notlogin>/", $buf)) {
            $inblock = "notlogin";
            continue;
        }
        if (preg_match("/<admin>/", $buf)) {
            $inblock = "admin";
            continue;
        }
        if (preg_match("/<lximg:\\s*([^>]*)>/", $buf, $matches)) {
            $img = $matches[1];
            $buf = preg_replace("/<lximg:\\s*([^>]*)>/", "<img src=/img/image/collage/\$1>", $buf);
            print $buf . "\n<br>";
            continue;
        }
        $buf = preg_replace("/<\\/link>/", "</a>", $buf);
        if (preg_match("/.*<link:\\s*([^>]*)>.*/", $buf, $matches)) {
            $url = $matches[1];
            $url = str_replace(".dart", "", $url);
            $buf = preg_replace("/<link:\\s*([^>]*)>/", "<a href=/htmllib/mibin/help.php?frm_action=show&frm_q={$url}>", $buf);
            print $buf . "<br> ";
            continue;
        }
        if (preg_match("/<\\/reseller>/", $buf) || preg_match("/<\\/admin>/", $buf)) {
            $inblock = "out";
            continue;
        }
        if (preg_match("/<\\/notlogin>/", $buf)) {
            $inblock = "out";
            continue;
        }
        if ($login->isGte('reseller') && $inblock === "admin") {
            continue;
        }
        if ($login->isLogin() && $inblock === 'notlogin') {
            continue;
        }
        if ($login->isGte('customer') && ($inblock === "reseller" || $inblock === "admin")) {
            continue;
        }
        $buf = preg_replace("/href=(\\S*).dart/i", "href=/htmllib/mibin/help.php?frm_q=/\$1", $buf);
        if (preg_match("/:\\[.*\\]:/", $buf)) {
            $buttonpath = get_image_path() . "/button/";
            $value = preg_replace("/.*:\\[(.*)\\]:.*/", "\$1", $buf);
            $rest = preg_replace("/.*:\\[.*\\]:/", "", $buf);
            $ghtml->get_post_from_get(trim($value), $path, $post);
            $descr = $ghtml->get_action_descr($path, $post, $class, $name);
            $image = $ghtml->get_image($buttonpath, $class, $name, ".gif");
            print "<img src={$image}> <b> {$descr['1']}: </b> {$rest} <br> <br>  ";
            continue;
        }
        if ($buf === '') {
            if ($last === "blank") {
                continue;
            }
            $last = "blank";
            $buf = "</p> <p> ";
        } else {
            if ($last === "blank") {
                $last = "";
            }
            $buf = $buf . "<br> \n";
        }
        print $buf;
    }
    return 1;
}
Exemplo n.º 19
0
 function reName()
 {
     $directory = dirname($this->main->fullpath);
     $new = $directory . "/" . $this->main->newname;
     if (lfile_exists($new)) {
         throw new lxexception('file_exists_rename', '');
     }
     new_process_mv_rec($this->main->__username_o, $this->main->fullpath, $new);
 }
Exemplo n.º 20
0
 function save_non_existant_image($path)
 {
     global $gbl, $sgbl, $login, $ghtml;
     return;
     #[FIXME]
     // We need only the form images, and the normal non form action images need not be saved.
     if (!csa($path, "list") && !csa($path, "form")) {
         return;
     }
     if ($sgbl->dbg <= 1) {
         return;
     }
     if (lfile_exists(getreal($path))) {
         return;
     }
     $cont = null;
     $icon = $login->getSpecialObject('sp_specialplay')->icon_name;
     $file = "__path_program_htmlbase/{$icon}.missing_image.txt";
     if (lfile_exists($file)) {
         $cont = lfile($file);
         foreach ($cont as $k => &$__c) {
             $__c = trim($__c);
             if (!$__c) {
                 unset($cont[$k]);
             }
         }
     }
     $cont = array_push_unique($cont, $path);
     $cont = implode("\n", $cont);
     $cont .= "\n";
     lfile_put_contents($file, $cont);
 }