Exemplo n.º 1
0
 function display($var)
 {
     if (array_search_bool($var, array('used', 'available', 'kblock'))) {
         return getGBOrMB($this->{$var});
     }
     return $this->{$var};
 }
Exemplo n.º 2
0
function get_deny_list($total)
{
    $lxgpath = "__path_home_root/lxguard";
    $rmt = lfile_get_unserialize("{$lxgpath}/config.info");
    $wht = lfile_get_unserialize("{$lxgpath}/whitelist.info");
    $wht = $wht->data;
    $disablehit = null;
    if ($rmt) {
        $disablehit = $rmt->data['disablehit'];
    }
    if (!($disablehit > 0)) {
        $disablehit = 20;
    }
    $deny = null;
    foreach ($total as $k => $v) {
        if (array_search_bool($k, $wht)) {
            dprint("{$k} found in whitelist... not blocking..\n");
            continue;
        }
        if ($v > $disablehit) {
            $deny[$k] = $v;
        }
    }
    return $deny;
}
Exemplo n.º 3
0
 function updateform($subaction, $param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $sq = new Sqlite(null, 'web');
     $list = $sq->getRowsWhere("syncserver = '{$this->syncserver}'", array('nname'));
     $dlist = get_namelist_from_arraylist($list, 'nname');
     if (!$login->isAdmin()) {
         $sq = new Sqlite(null, 'domain');
         $nlist = $sq->getRowsWhere("parent_clname = '{$login->getClName()}'", array('nname'));
         $ndlist = get_namelist_from_arraylist($nlist);
         foreach ($dlist as $k => $v) {
             if (!array_search_bool($v, $ndlist)) {
                 unset($dlist[$k]);
             }
         }
     }
     if ($dlist) {
         $dlist = add_disabled($dlist);
         $vlist['domain'] = array('s', $dlist);
     } else {
         $vlist['domain'] = array('M', "No Domain");
         $vlist['__v_button'] = array();
     }
     return $vlist;
 }
Exemplo n.º 4
0
 function isSelect()
 {
     if (if_demo()) {
         if (array_search_bool($this->nname, array('wholesale', 'reseller', 'customer'))) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 5
0
function commandline_main()
{
    global $gbl, $sgbl, $login, $ghtml;
    global $argv;
    initProgram('admin');
    $must = array('action');
    $p = parse_opt($argv);
    $pk = array_keys($p);
    foreach ($must as $m) {
        if (!array_search_bool($m, $pk)) {
            print "Need action, class and name\n";
            exit;
        }
    }
    $func = "__cmd_desc_{$p['action']}";
    try {
        $list = $func($p);
        if ($list) {
            if (isset($p['output-type'])) {
                if ($p['output-type'] === 'json') {
                    $out = json_encode($list);
                    print $out;
                } else {
                    if ($p['output-type'] === 'serialize') {
                        $out = serialize($list);
                        print $out;
                    }
                }
            } else {
                foreach ($list as $l) {
                    print "{$l}\n";
                }
            }
        } else {
            print "{$p['action']} succesfully executed\n";
        }
        exit(0);
    } catch (exception $e) {
        print $e->__full_message;
        print "\n";
        exit(8);
    }
}
Exemplo n.º 6
0
 function display($var)
 {
     if ($var === 'blocked') {
         $wht = $this->getParentO()->getList('lxguardwhitelist');
         $wht = get_namelist_from_objectlist($wht, "ipaddress");
         if (array_search_bool($this->ipaddress, $wht)) {
             return "whitelisted";
         }
         $ds = $this->getParentO()->disablehit;
         if (!$ds) {
             $ds = 20;
         }
         if ($this->failcount >= $ds) {
             return "blocked";
         }
         return null;
     }
     return $this->{$var};
 }
Exemplo n.º 7
0
    function xp_panel($object)
    {
        global $gbl, $sgbl, $login, $ghtml;
        $skincolor = $login->getSkinColor();
        $skin_name = basename($login->getSkinDir());
        if (csa($skin_name, "_")) {
            $skin_name = substr($skin_name, 0, strrpos($skin_name, "_"));
        }
        $skin_name = str_replace("_", " ", $skin_name);
        $icon_name = $login->getSpecialObject('sp_specialplay')->icon_name;
        $cl = $login->getResourceChildList();
        $qlist = $object->getList('resource');
        $skinget = $login->getSkinDir();
        ?>
	<script language="javascript" type="text/javascript" src="/htmllib/js/xpmenu/ua.js"></script>
	<script language="javascript" type="text/javascript" src="/htmllib/js/xpmenu/PanelBarOrig.js"></script>
	<script language="javascript" type="text/javascript">
		function drawMenu()
		{
			var iCntr = 0;
			var objMenu;
			var strId, strLbl;
			if (this.open) {
				visib = 'visibile';
				disp = 'block';
				menuclass = "menuHeaderExpanded";
				image = '<?php 
        echo $skinget;
        ?>
/minus.gif';
			} else {
				visib = 'hidden';
				disp = 'none';
				menuclass = "menuHeaderCollapsed";
				image = '<?php 
        echo $skinget;
        ?>
/plus.gif';
			}

			document.write("<table  border=\"0\" cellspacing=\"0\"" + " cellpadding=\"0\" style=\"padding:0 0 0 0;\" width=\"100%\">");
			document.write("<tr style=\"background:url('<?php 
        echo $skinget;
        ?>
/expand.gif')\" onMouseover=\"this.style.background='url(<?php 
        echo $skinget;
        ?>
/onexpand.gif)'\" onMouseout=\"this.style.background='url(<?php 
        echo $skinget;
        ?>
/expand.gif)'\"><td style=\"width:180px;vertical-align: center; \"><font style='font-weight:bold'>&nbsp;" + this.label + "</font></td><td class=" + menuclass + " id=\"" + this.id + "\"" + "onclick=\"toggle(this)\">");
			document.write("&nbsp;<img id=" + this.id + "_image src=" + image + "></td></tr>");
			document.write("</table>");
			document.write("<div style=\"display: " + disp + "; visibility: " + visib + ";\"" + " class=\"menuItems\" id=\"" + this.id + "_child" + "\">");
			document.write("<table border=0 style='background:white' border=0 cellspacing=1 cellpadding=0 width=100%>");
			for (iCntr = 0; iCntr < this.smcount; iCntr++) {
				this.submenu[iCntr].render();
			}
			document.write("</table></div>");
		}
		function toggle(pobjSrc)
		{
			var strCls = pobjSrc.className;
			var strId = pobjSrc.id;
			var objTmp, child;

			if (pobjSrc.id != _currMenu) {
				objTmp = document.getElementById(_currMenu);
			}

			child = document.getElementById(strId + "_child");
			ichild = document.getElementById(strId + "_image");
			if (child.style.visibility == "hidden") {
				pobjSrc.className = "menuHeaderExpanded";
				child.style.visibility = "visible";
				child.style.display = "block";
				ichild.src = "<?php 
        echo $skinget;
        ?>
/minus.gif";
			} else {
				pobjSrc.className = "menuHeaderCollapsed";
				child.style.visibility = "hidden";
				child.style.display = "none";
				ichild.src = "<?php 
        echo $skinget;
        ?>
/plus.gif";
			}
			_currMenu = pobjSrc.id;
		}

	</script>

	<script language="javascript">
		var objTmp;
			<?php 
        if (!$login->getSpecialObject('sp_specialplay')->isOn('disable_quickaction')) {
            $class = $login->getQuickClass();
            if ($class) {
                print "xpreso = createMenu('Quick Actions', '', true);";
                $rdesc = print_quick_action($class);
                print "createSubMenu(xpreso, '{$rdesc}', '', '', '', '', '');\n";
            }
        }
        $url = $this->getFullUrl("a=list&c=ndskshortcut");
        print "xxpFav = createMenu('<font color=#003360>Favorites<a href=\"{$url}\" target=mainframe>  [edit] </a>', '', true);";
        $rdesc = print_favorites();
        print "createSubMenu(xxpFav, '{$rdesc}', '', '', '', '', '');\n";
        if ($login->isLte('reseller')) {
            print "xxpDescr = createMenu('<font color=#003360>Usage', '', true);";
            $rdesc = null;
            foreach ((array) $qlist as $or) {
                if (!cse($or->vv, "usage") && !cse($or->vv, "_num")) {
                    continue;
                }
                if (cse($or->vv, "last_usage")) {
                    continue;
                }
                if (is_unlimited($or->resourcepriv)) {
                    $limit = "&#8734;";
                } else {
                    $limit = $or->display('resourcepriv');
                }
                $array = array("traffic_usage", "totaldisk_usage", "client_num", "maindomain_num", "vps_num");
                if (!array_search_bool($or->vv, $array)) {
                    continue;
                }
                $rdesc .= "<tr align=left style=\"border-width:1 ;background:url({$skinget}/a.gif)\" > <td > <img width=15 height=15 src=/img/image/collage/button/state_v_{$or->display('state')}.gif> {$or->shortdescr} </td> <td nowrap> {$or->display('resourceused')} </td> <td align=left> {$limit}&nbsp;</td> </tr>";
            }
            print "createSubMenu(xxpDescr, '{$rdesc}', '', '', '', '', '');\n";
        }
        $forumurl = "http://forum.lxcenter.org";
        if (!$login->isAdmin() && isset($login->getObject('general')->generalmisc_b->forumurl)) {
            $forumurl = $login->getObject('general')->generalmisc_b->forumurl;
        }
        ?>

		setTheme("XPClassic.css", null, null);
		initialize(<?php 
        echo $sgbl->__var_lpanelwidth - 20;
        ?>
);

	</script>


			<?php 
    }
Exemplo n.º 8
0
function backup_main()
{
    global $argc, $argv;
    global $gbl, $login, $ghtml;
    $gbl->__restore_flag = true;
    if ($argc === 1) {
        print "Usage: {$argv['0']} --restore/--list --accounts='domain-<domain1.com>,client-<client1>,domain-<domain2.com>' <backup-file> [--switchserverlist='oldserver1:newserver1,oldserver2:newserver2']\n Use --accounts=all to restore everything.\n";
        exit;
    }
    initProgram("admin");
    $object = $login;
    $opt = parse_opt($argv);
    if (isset($opt['class']) && isset($opt['name'])) {
        $object = new $opt['class'](null, null, $opt['name']);
        $object->get();
        if ($object->dbaction === 'add') {
            log_error("{$opt['class']} doesnt exist");
            print "{$opt['class']} doesnt exist\n";
            exit;
        }
    }
    $class = $opt['class'];
    $name = $opt['name'];
    if (lx_core_lock("{$class}-{$name}.restore")) {
        print "Another Restore for the same class is happening..\n";
        exit;
    }
    $backup = $object->getObject('lxbackup');
    if (isset($opt['switchserverlist'])) {
        $sq = new Sqlite(null, "pserver");
        $serverlist = $sq->getTable();
        $serverlist = get_namelist_from_arraylist($serverlist);
        $server = $opt['switchserverlist'];
        $list = explode(",", $server);
        foreach ($list as $l) {
            if (!$l) {
                continue;
            }
            $q = explode(":", $l);
            $rlist[$q[0]] = $q[1];
            if (!array_search_bool($q[1], $serverlist)) {
                print "The server {$q[1]} doesn't exist in the server system here\n";
                exit;
            }
        }
        $param['switchserverlist'] = $rlist;
        dprint("\n");
    } else {
        $param['switchserverlist'] = null;
    }
    /*
    	if (!testAllServersWithMessage()) {
    		$backup->restorestage = "Failed due to: could not connect to slave servers";
    		clearLxbackup($backup);
    		exit;
    	}
    */
    $file = $opt['final'];
    //$param = get_variable($opt);
    if (isset($opt['list'])) {
        $gbl->__var_list_flag = true;
        $param['_accountselect'] = null;
    } else {
        if (isset($opt['restore'])) {
            $gbl->__var_list_flag = false;
            if (!isset($opt['accounts'])) {
                print "Restore option needs accounts that are to be restored. --accounts='domain-domain.com,client:clientname'... Use --list to find out all the domain/clients in the backup archive.\n";
                clearLxbackup($backup);
                exit;
            }
            $account = $opt['accounts'];
            //$account = str_replace(":", "_s_vv_p_", $account);
            $account = str_replace(":", "-", $account);
            $accountlist = explode(",", $account);
            $param['_accountselect'] = $accountlist;
        } else {
            print "Usage: {$argv['0']} <--list/--restore --accounts=> <filename>\n";
            clearLxbackup($backup);
            exit;
        }
    }
    if (isset($opt['priority']) && $opt['priority'] === 'low') {
        sleep(20);
    }
    dprintr($param);
    //dprint($file);
    try {
        $backup->doUpdateRestore($file, $param);
        $backup->restorestage = 'done';
    } catch (exception $e) {
        log_error("Restore Failed. Reason: {$e->__full_message} \n");
        print "Restore Failed. Reason: {$e->__full_message} \n";
        $mess = $e->__full_message;
        mail($object->contactemail, "Restore Failed..", "Restore Failed for {$object->nname} with the Message {$mess}");
        $backup->restorestage = "Restore failed due to {$mess}";
    }
    clearLxbackup($backup);
}
Exemplo n.º 9
0
 static function is_image($path)
 {
     $ext = self::getExtension($path);
     $list = array("GIF", "JPG", "PNG", "SWF", "SWC", "PSD", "TIFF", "BMP", "IFF", "JP2", "JPX", "JB2", "JPC", "XBM");
     $ext = strtoupper($ext);
     if (array_search_bool($ext, $list)) {
         return true;
     }
     return false;
 }
Exemplo n.º 10
0
    function printSelectObjectTable($name_list, $parent, $class, $blist = array(), $display = null)
    {
        global $gbl, $sgbl, $login, $ghtml;
        print_time("{$class}.objecttable");
        if ($this->frm_accountselect !== null) {
            $sellist = explode(',', $this->frm_accountselect);
        } else {
            $sellist = null;
        }
        $classdesc = $this->get_class_description($class, $display);
        $unique_name = trim($parent->nname) . trim($class) . trim($display) . trim($classdesc[2]);
        $unique_name = fix_nname_to_be_variable($unique_name);
        $filtername = $parent->getFilterVariableForThis($class);
        $fil = $this->frm_hpfilter;
        $sortdir = null;
        $sortby = null;
        if (isset($fil[$filtername]['sortby'])) {
            $sortby = $fil[$filtername]['sortby'];
        }
        if (isset($fil[$filtername]['sortdir'])) {
            $sortdir = $fil[$filtername]['sortdir'];
        }
        $pagesize = '99999';
        $iconpath = get_image_path() . "/button";
        $nlcount = count($name_list) + 1;
        $imgheadleft = $login->getSkinDir() . "/top_lt.gif";
        $imgheadleft2 = $login->getSkinDir() . "/top_lt.gif";
        $imgheadright = $login->getSkinDir() . "/top_rt.gif";
        $imgheadbg = $login->getSkinDir() . "/top_bg.gif";
        $imgbtnbg = $login->getSkinDir() . "/btn_bg.gif";
        $imgtablerowhead = $login->getSkinDir() . "/tablerow_head.gif";
        $imgtablerowheadselect = $login->getSkinDir() . "/top_line_medium.gif";
        $imgbtncrv = $login->getSkinDir() . "/btn_crv.gif";
        $imgtopline = $login->getSkinDir() . "/top_line.gif";
        $classdesc = $this->get_class_description($class);
        $unique_name = trim($parent->nname) . trim($class) . trim($classdesc[2]);
        $unique_name = fix_nname_to_be_variable($unique_name);
        //dprint("-- ".$unique_name. " --", 2);
        ?>
<br />
      <script> var ckcount<?php 
        echo $unique_name;
        ?>
 ; </script>
<?php 
        $tsortby = $sortby;
        if (!$sortby) {
            $tsortby = exec_class_method($class, "defaultSort");
        }
        if (!$sortdir) {
            $sortdir = exec_class_method($class, "defaultSortDir");
        }
        //print_time("objecttable");
        $obj_list = $parent->getVirtualList($class, $total_num, $tsortby, $sortdir);
        //print_time("objecttable", 'objecttable');
        if (!$sellist) {
            //$total_num = $this->display_count($obj_list, $display) ;
        }
        ?>

    <table width=100%> <tr> <td align=center>
    <table cellspacing=2 cellpadding=2 width=97% align=center>
    <tr><td class=rowpoint></td><td colspan= <?php 
        echo $nlcount;
        ?>
>
    <table cellpadding=0 cellspacing=0 border=0 width=100%>
    <tr><td valign=bottom ></td>
    <td>
    <?php 
        if (isset($ghtml->__http_vars['frm_hpfilter'][$filtername]['pagenum'])) {
            $cgi_pagenum = $ghtml->__http_vars['frm_hpfilter'][$filtername]['pagenum'];
        } else {
            $cgi_pagenum = 1;
        }
        if (!$sellist) {
            $this->print_next_previous($parent, $class, "top", $cgi_pagenum, $total_num, $pagesize);
        }
        ?>
    </td>
    <td align=right valign=bottom >

    <?php 
        if (!$sellist) {
            ?>
            <table cellpadding="0" cellspacing="0" border="0" height="27" >

            <tr><td><img src="<?php 
            echo $imgheadleft;
            ?>
"></td><td nowrap valign=middle background="<?php 
            echo $imgheadbg;
            ?>
"><b><font color="#ffffff"><?php 
            echo get_plural($classdesc[2]);
            ?>
 under <?php 
            echo $parent->display("nname");
            ?>
 </b> <?php 
            echo $this->print_machine($parent);
            ?>
 <b>  (<?php 
            echo $total_num;
            ?>
)</b></font></td><td><img src="<?php 
            echo $imgheadright;
            ?>
"></td></tr>
            </table>
            </td>
            </tr>

            <tr><td colspan=3><table cellpadding=0 cellspacing=0 border=0 width=100% height=35 background="<?php 
            echo $imgbtnbg;
            ?>
">
            <tr><td><img src="<?php 
            echo $imgbtncrv;
            ?>
"></td><td width=80% align=left > <table width=100% cellpadding=0 cellspacing=0 border=0><tr><td valign=bottom><?php 
            $this->print_list_submit($class, $blist, $unique_name);
            ?>
</td></tr></table></td><td width=15% align=right><b><font color="#ffffff"><?php 
            $this->print_search($parent, $class);
            ?>
</font></b></td></tr>
            </table>
            </td></tr>
    </td></tr><tr><td height=2 colspan=2></td></tr></table>

        <?php 
        } else {
            $descr = $this->getActionDescr($_SERVER['PHP_SELF'], $this->__http_vars, $class, $var, $identity);
            ?>
<table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td width=70% valign=bottom><table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td width=100% height=2 background="<?php 
            echo $imgtopline;
            ?>
"></td></tr></table></td><td align=right><table cellpadding=0 cellspacing=0 border=0 width=100% ><tr><td><img src="<?php 
            echo $imgheadleft;
            ?>
"></td><td nowrap width=100% background="<?php 
            echo $imgheadbg;
            ?>
" ><b><font color="#ffffff">  Confirm <?php 
            echo $descr[1];
            ?>
:  </b><?php 
            echo get_plural($classdesc[2]);
            ?>
 from <?php 
            echo $parent->display("nname");
            ?>
</font></td><td><img src="<?php 
            echo $imgheadright;
            ?>
"></td></tr></table></td></tr></table>

    </td></tr><tr><td height=0 colspan=2></td></tr></table>

        <?php 
        }
        ?>

<!--    </td></tr><tr><td height=2 colspan=2></td></tr></table> -->
    <tr><td bgcolor="#ffffff"></td>
 <?php 
        $imguparrow = get_general_image_path() . "/button/uparrow.gif";
        $imgdownarrow = get_general_image_path() . "/button/downarrow.gif";
        foreach ($name_list as $name => $width) {
            $desc = "__desc_{$name}";
            $descr[$name] = get_classvar_description($class, $desc);
            if (!$descr[$name]) {
                print "Cannot access static variable {$class}::{$desc}";
                exit(0);
            }
            if (csa($descr[$name][2], ':')) {
                $_tlist = explode(':', $descr[$name][2]);
                $descr[$name][2] = $_tlist[0];
            }
            foreach ($descr[$name] as &$d) {
                if ($this->is_special_url($d)) {
                    continue;
                }
                if (strstr($d, "%v") !== false) {
                    $d = str_replace("[%v]", $classdesc[2], $d);
                }
            }
            if ($width === "100%") {
                $wrapstr = "wrap";
            } else {
                $wrapstr = "nowrap";
            }
            if ($sortby && $sortby === $name) {
                $wrapstr .= " background={$imgtablerowheadselect}";
                print "<td width={$width} {$wrapstr} ><table cellpadding=0 cellspacing=0 border=0> <tr> <td rowspan=2 {$wrapstr}>";
            } else {
                $wrapstr .= " background={$imgtablerowhead}";
                print "<td width={$width} {$wrapstr} class=col>";
            }
            ?>
        <b><?php 
            $this->print_sortby($parent, $class, $unique_name, $name, $descr[$name]);
            ?>
 </b></font>

        <?php 
            $imgarrow = $sortdir === "desc" ? $imgdownarrow : $imguparrow;
            if ($sortby && $sortby === $name) {
                print "</td> <td width=15><img src=" . $imgarrow . " ></td><td ></td></tr></table>";
            }
            ?>
 </td>

 <?php 
        }
        $count = 0;
        $rowcount = 0;
        ?>
    <td width=10 background=<?php 
        echo $imgtablerowhead;
        ?>
 >   <form name="formselectall<?php 
        echo $unique_name;
        ?>
" value=hello> <input type=checkbox name="selectall<?php 
        echo $unique_name;
        ?>
" value=on <?php 
        if ($sellist) {
            echo "checked disabled";
        }
        ?>
 onclick="javascript:calljselectall<?php 
        echo $unique_name;
        ?>
 ()"></form> </td>
    <?php 
        print "</tr> ";
        print_time('loop');
        $n = 1;
        foreach ((array) $obj_list as $okey => $obj) {
            $checked = '';
            // Fix This.
            if ($sellist) {
                $checked = "checked disabled";
                if (!array_search_bool($obj->nname, $sellist)) {
                    continue;
                }
            }
            $imgpointer = get_general_image_path() . "/button/pointer.gif";
            $imgblank = get_general_image_path() . "/button/blank.gif";
            ?>

        <script> loadImage('<?php 
            echo $imgpointer;
            ?>
') </script>
        <script> loadImage('<?php 
            echo $imgblank;
            ?>
') </script>

            <tr id=tr<?php 
            echo $unique_name . $rowcount;
            ?>
 class=tablerow<?php 
            echo $count;
            ?>
 onmouseover=" swapImage('imgpoint<?php 
            echo $rowcount;
            ?>
','','<?php 
            echo $imgpointer;
            ?>
',1);" onmouseout="swapImgRestore();">
        <td id=td<?php 
            echo $unique_name . $rowcount;
            ?>
 width=5 class=rowpoint><img name=imgpoint<?php 
            echo $rowcount;
            ?>
 src="<?php 
            echo $imgblank;
            ?>
"></td>
        <?php 
            $colcount = 1;
            foreach ($name_list as $name => $width) {
                $this->printObjectElement($parent, $class, $classdesc, $obj, $name, $width, $descr, $colcount . "_" . $rowcount);
                $colcount++;
            }
            $basename = basename($obj->nname);
            $selectshowbase = $this->frm_selectshowbase;
            // issue #609
            //      $ret = strfrom($parent->nname, $selectshowbase);
            $ret = str_replace('//', '/', strfrom($parent->nname, $selectshowbase));
            print " <td width=10 >";
            print "<a class=button href=\"javascript:callSetSelectFolder('/{$ret}/{$basename}')\">";
            print " Select </a>";
            print "</tr> ";
            if ($count === 0) {
                $count = 1;
            } else {
                $count = 0;
            }
            $rowcount++;
            if (!$sellist) {
                if ($n === $pagesize * $cgi_pagenum) {
                    break;
                }
            }
            $n++;
        }
        print_time('loop', "loop{$n}");
        print "<tr><td></td><td colspan={$nlcount}>";
        if (!$rowcount) {
            if ($ghtml->frm_searchstring) {
                ?>
            <table width=95%> <tr align=center> <td width=100%> <b>  No Matches Found  </b> </td> </tr> </table>
            <?php 
            } else {
                ?>
            <table width=95%> <tr align=center> <td width=100%> <b>  No <?php 
                echo get_plural($classdesc[2]);
                ?>
  under <?php 
                echo $parent->nname;
                ?>
   </b> </td> </tr> </table>
            <?php 
            }
        }
        print "</td></tr>";
        print "<tr><td class=rowpoint></td><td colspan=" . $nlcount . " >\n    <table cellpadding=0 cellspacing=0 border=0 width=100%>\n    <tr height=1 style='background:url({$imgtopline})'><td></td></tr>\n    <tr><td>";
        ?>
<script>ckcount<?php 
        echo $unique_name;
        ?>
 = <?php 
        echo $rowcount . ";  ";
        ?>
function calljselectall<?php 
        echo $unique_name;
        ?>
(){
    jselectall(document.formselectall<?php 
        echo $unique_name;
        ?>
.selectall<?php 
        echo $unique_name;
        ?>
,ckcount<?php 
        echo $unique_name;
        ?>
,'<?php 
        echo $unique_name;
        ?>
')
}
</script>


<?php 
        print "<table> <tr> <td >";
        print "<a class=button href=\"javascript:window.close()\"> Cancel </a> &nbsp; &nbsp;  ";
        print "</td> <td width=30> &nbsp; </td> <td >";
        print "</td> </tr> </table> ";
        print "</td></tr></table></tr></table></td> </tr> </table>";
        //else {
        //
        //      $this->print_list_submit($blist);
        //  }
        //print_time("$class.objecttable", "$class.objecttable");
        /// Important. This is to make sure that the session saving etc doesn't take place. We just need a plain and clean window without any saving. If this happens the current url gets added to the sessiona and redirection will screw up.
        exit;
    }
Exemplo n.º 11
0
<?php

include_once "htmllib/lib/include.php";
initProgram('admin');
$plist = parse_opt($argv);
$class = $argv[1];
if (!isset($argv[2])) {
    $driverapp = $gbl->getSyncClass(null, 'localhost', $class);
    print "Driver for {$class} is {$driverapp}\n";
    exit;
}
$pgm = $argv[2];
$server = $login->getFromList('pserver', 'localhost');
$os = $server->ostype;
include "../file/driver/{$os}.inc";
$dr = $server->getObject('driver');
if (!array_search_bool($pgm, $driver[$class])) {
    $str = implode(" ", $driver[$class]);
    print "The driver name isn't correct: Available drivers for {$class}: {$str}\n";
    exit;
}
$v = "pg_{$class}";
$dr->driver_b->{$v} = $pgm;
$dr->setUpdateSubaction();
$dr->write();
print "Successfully changed Driver for {$class} to {$pgm}\n";
Exemplo n.º 12
0
 static function add($parent, $class, $param)
 {
     $ticketconfig = $parent->getObject('ticketconfig');
     $cmlist = explode(',', $param['text_sent_to_cmlist']);
     $cl = $parent->getChildListFilter('L');
     foreach ($cl as &$c) {
         $c = $parent->getChildNameFromDes($c);
         $child = $parent->getList($c);
         foreach ((array) $child as $q) {
             if (!array_search_bool('--all-children--', $cmlist)) {
                 if (array_search_bool(self::getNameRep($q), $cmlist)) {
                     $list[$q->getClName()] = $q;
                 }
             } else {
                 $list[$q->getClName()] = $q;
             }
         }
     }
     $param['text_sent_to_cmlist'] = implode(',', array_keys($list));
     $param['text_sent_to_cmlist'] = "," . $param['text_sent_to_cmlist'] . ",";
     $param['ddate'] = time();
     $param['nname'] = getIncrementedValueFromTable("smessage", "nname");
     $param['made_by'] = $parent->getClName();
     $param['text_readby_cmlist'] = ",,";
     $param['name_made_by'] = $parent->nname;
     if (isOn($param['send_mail_f'])) {
         self::send_mail_to($list, $param);
     }
     return $param;
 }
Exemplo n.º 13
0
 function setFileType()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $this->base = basename($this->nname);
     $this->fullpath = $this->getFullPath();
     $sel_append = NULL;
     if (isset($gbl->c_session->ssession_vars["frm_clip_action"]) && $gbl->c_session->ssession_vars['frm_clip_root'] == $this->root && $gbl->c_session->ssession_vars['frm_clip_server'] === $this->syncserver) {
         $selaction = $gbl->c_session->ssession_vars["frm_clip_action"];
         $sellist = $gbl->c_session->ssession_vars["frm_clip_list"];
         if (array_search_bool($this->nname, $sellist)) {
             $sel_append = "_" . $selaction;
         }
     }
     if ($this->base === "..") {
         $this->ttype = "back";
         return;
     }
     if ($this->base === ".trash") {
         $this->ttype = "trash";
         $this->protect = "na";
         return;
     }
     if ($this->isInsideTrash()) {
         $this->protect = "na";
     }
     /*
     	if ($this->is_link()) {
     		$this->ttype = "link";
     		return;
     	}
     */
     $this->ttype = "{$this->ttype}{$sel_append}";
     if ($this->is_dir()) {
         if ($this->getParentO()->is__table('web')) {
             if (strpos(dirname($this->nname), '/') === false || dirname($this->nname) === '/') {
                 if ($this->base != "www") {
                     $this->protect = "na";
                 }
             }
             if (!isset($this->protect)) {
                 try {
                     $protname = $this->getParentO()->nname . "_" . coreFfile::getRealPath($this->nname);
                     $prot = $this->getParentO()->getFromList("dirprotect", $protname);
                     if ($prot->status != 'nonexistant') {
                         $this->protect = "on";
                     } else {
                         $this->protect = 'off';
                     }
                 } catch (exception $e) {
                     $this->protect = "off";
                 }
             }
         }
         return;
     }
     $this->protect = "na";
 }
Exemplo n.º 14
0
 function checkDnsTemplateConsistency($web, $mmail, $dnstemplate)
 {
     $list = getIpAddressList($web->__masterserver, $web->syncserver);
     if (!array_search_bool($dnstemplate->ipaddress, $list)) {
         throw new lxexception('dns_template_inconsistency', 'dnstemplate_f');
     }
 }
Exemplo n.º 15
0
 static function createSSlConf($iplist, $domainiplist)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $string = null;
     $alliplist = os_get_allips();
     foreach ($iplist as $ip) {
         if (!array_search_bool($ip['ipaddr'], $alliplist)) {
             continue;
         }
         // issue related to delete 'exclusive ip/domain'
         if (isset($domainiplist[$ip['ipaddr']])) {
             $v = $domainiplist[$ip['ipaddr']];
             if ($v !== '' && $v !== '--Disabled--') {
                 continue;
             }
         }
         $ssl_cert = null;
         $ssl_cert = sslcert::getSslCertnameFromIP($ip['nname']);
         $certificatef = "{$sgbl->__path_ssl_root}/{$ssl_cert}.crt";
         $keyfile = "{$sgbl->__path_ssl_root}/{$ssl_cert}.key";
         $pemfile = "{$sgbl->__path_ssl_root}/{$ssl_cert}.pem";
         $cafile = "{$sgbl->__path_ssl_root}/{$ssl_cert}.ca";
         sslcert::checkAndThrow(lfile_get_contents($certificatef), lfile_get_contents($keyfile), $ssl_cert);
         if (!lxfile_exists($pemfile)) {
             $c = lfile_get_contents($certificatef);
             $k = lfile_get_contents($keyfile);
             lfile_put_contents($pemfile, "{$c}\n{$k}");
         }
         $string .= "\$SERVER[\"socket\"] == \"{$ip['ipaddr']}:443\" {\n\n";
         $string .= "\tssl.engine = \"enable\"\n";
         $string .= "\tssl.pemfile = \"{$pemfile}\"\n";
         $string .= "\tssl.ca-file = \"{$cafile}\"\n\n";
         $string .= "}\n\n";
     }
     // issue #725, #760 - ssl.conf must be the first file in listing
     // so change name from ssl.conf to __ssl.conf
     system("rm -rf /home/lighttpd/conf/defaults/ssl.conf");
     $sslfile = "/home/lighttpd/conf/defaults/__ssl.conf";
     lfile_put_contents($sslfile, $string);
 }
Exemplo n.º 16
0
 static function getVpsOsimage($parent, $driver, $type = "add")
 {
     global $gbl, $sgbl, $login, $ghtml;
     $class = "vps__{$driver}";
     $var = "{$driver}_ostl_a";
     $list = exec_class_method($class, "getOsTemplatelist", $type);
     /*
     	$obj = new Ostemplatelist(null, null, 'admin');
     	$obj->get();
     	$ostlist = get_namelist_from_objectlist($obj->$var);
     	// Filter only if not admin.
     	if (count($ostlist) > 0 && !$login->isAdmin()) {
     		foreach($list as $k => $v) {
     			if (!array_search_bool($k, $ostlist)) {
     				unset($list[$k]);
     			}
     		}
     	}
     */
     $ostlist = "{$driver}ostemplate_list";
     if (!$login->isAdmin() && count($login->{$ostlist}) > 0) {
         foreach ($list as $k => $v) {
             if (!array_search_bool($k, $login->{$ostlist})) {
                 unset($list[$k]);
             }
         }
     }
     return $list;
 }
Exemplo n.º 17
0
function do_desc_update($object, $subaction, $param)
{
    global $gbl, $sgbl, $login, $ghtml;
    $class = lget_class($object);
    $parent = $object->getParentO();
    $qparent = $parent;
    $update_func = "update{$subaction}";
    do_actionlog($login, $object, "update", $subaction);
    //Calling the generic update first... If any class wide security checks to be made (as in the case of templates, u can do it there...
    $param = $object->update($subaction, $param);
    if (method_exists($object, $update_func)) {
        $param = $object->{$update_func}($param);
    }
    //dprintr($param['__m_group']);
    if (!$param) {
        return false;
    }
    if (array_search_bool('__Select One__', $param, true)) {
        // OA Left this here so you see why Ive added 'strict' to array_search
        // Basically 1 = '__Select One__' without strict search
        //
        // Anyone knows where else could 'strict' be needed?
        //
        //$ret = array_search('__Select One__', $param, true);
        //if($param[$ret] == '__Select One__') $str_ = $param[$ret] ."  equals __Select One__ according to php...";
        throw new lxException("Select One is not an acceptable Value", '');
    }
    $nparam[$class]['nname'] = $object->nname;
    // This code is very much suspect. Looks like I copied this from the addform and dumped it here. Should tkae a more detailed look in this. The issue is, the nnamevar is not needed, since this is inside a fully formed object, and nname need not be constructed.
    foreach ($param as $k => $v) {
        $object->resolve_class_heirarchy($class, $k, $dclass, $dk);
        $object->resolve_class_differences($class, $k, $ddclass, $ddk);
        if ($ddclass !== $class) {
            $nnamevar = get_real_class_variable($ddclass, "__rewrite_nname_const");
            if ($nnamevar) {
                $nnamelist = null;
                foreach ($nnamevar as $n) {
                    $nnamelist[] = $param[$n];
                }
                $nparam[$dclass]['nname'] = implode($sgbl->__var_nname_impstr, $nnamelist);
            }
        }
        $nparam[$dclass][$dk] = $v;
    }
    foreach ($nparam as $k => $v) {
        if ($k === $class) {
            continue;
        }
        if ($k === 'priv') {
            $pvar = $object->priv;
            $oldpvar = clone $pvar;
            check_priv($qparent, $class, $pvar, $v);
            $object->distributeChildQuota($oldpvar);
            continue;
        }
        if ($k === 'listpriv') {
            $pvar = $object->listpriv;
            check_listpriv($qparent, $class, $pvar, $v);
            continue;
        }
        // Checking for used too. Special case.... Copy the current used to __old_used. This is done so that the changes are trackable. For instance, in frontpage, you need to know if the previous state of frontpage. You cannot simply run the frontpage enabled command evertime any change is made. It should be run only if the previous state was disabled and the current state is enabled. Or vice versa. This has to be done distributechildquota too, where the 'used' is forcibly turned off to synchronize with the priv variable.
        if ($k === 'used') {
            $object->__old_used = clone $object->used;
        }
        if (cse($k, "_b") || $k === 'used') {
            $bvar = $object->{$k};
            $bvar->modify($v);
            continue;
        }
    }
    $object->modify($nparam[$class], $subaction);
    $object->postUpdate();
    if (cse($object->get__table(), "_a")) {
        $object->getParentO()->setUpdateSubaction('update_a_child');
    }
    return $param;
}
Exemplo n.º 18
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);
 }
Exemplo n.º 19
0
 static function createSSlConf($iplist, $domainiplist)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $string = null;
     $alliplist = os_get_allips();
     foreach ((array) $iplist as $ip) {
         if (!array_search_bool($ip['ipaddr'], $alliplist)) {
             continue;
         }
         // issue related to delete 'exclusive ip/domain'
         if (isset($domainiplist[$ip['ipaddr']])) {
             $v = $domainiplist[$ip['ipaddr']];
             if ($v !== '' && $v !== '--Disabled--') {
                 continue;
             }
         }
         $string .= "\n\t<Virtualhost ";
         $string .= "{$ip['ipaddr']}:443";
         $string .= ">\n\n";
         $ssl_cert = sslcert::getSslCertnameFromIP($ip['nname']);
         $ssl_root = $sgbl->__path_ssl_root;
         $certificatef = "{$ssl_root}/{$ssl_cert}.crt";
         $keyfile = "{$ssl_root}/{$ssl_cert}.key";
         $cafile = "{$ssl_root}/{$ssl_cert}.ca";
         sslcert::checkAndThrow(lfile_get_contents($certificatef), lfile_get_contents($keyfile), $ssl_cert);
         $string .= "\t\tSSLEngine On \n";
         $string .= "\t\tSSLCertificateFile {$certificatef}\n";
         $string .= "\t\tSSLCertificateKeyFile {$keyfile}\n";
         $string .= "\t\tSSLCACertificatefile {$cafile}\n\n";
         $string .= "\t</Virtualhost>\n";
     }
     // issue #725, #760 - ssl.conf must be the first file in listing
     // MR -- so change name from ssl.conf to __ssl.conf
     system("rm -rf /home/apache/conf/defaults/ssl.conf");
     $sslfile = "/home/apache/conf/defaults/__ssl.conf";
     $string = "<IfModule mod_ssl.c>\n{$string}\n</IfModule>\n\n";
     $string .= "DirectoryIndex index.php index.htm default.htm default.html\n\n";
     lfile_put_contents($sslfile, $string);
 }
Exemplo n.º 20
0
 static function VerifyString($parent, $param)
 {
     if (!self::isValidIpaddress($param['ipaddr'])) {
         throw new lxexception("ipaddress_invalid", 'ipaddr');
     }
     if ($param['gateway']) {
         if (!self::isValidIpaddress($param['gateway'])) {
             throw new lxexception("gateway_invalid", 'gateway');
         }
     }
     if (!self::isValidIpaddress($param['netmask'])) {
         throw new lxexception("netmask_invalid", 'netmask');
     }
     $sq = new Sqlite($parent->__masterserver, "ipaddress");
     $res = $sq->getRowsWhere("syncserver = '{$parent->nname}'");
     $list = get_namelist_from_arraylist($res, "ipaddr");
     if (array_search_bool($param['ipaddr'], $list)) {
         throw new lxexception("ipaddress_already_configured", 'ipaddr');
     }
     $ret = lxshell_return("ping", "-n", "-c", "1", "-w", "5", $param['ipaddr']);
     if (!$ret) {
         throw new lxexception("some_other_host_uses_this_ip", 'ipaddr');
     }
 }
Exemplo n.º 21
0
 static function VerifyString($parent, $param)
 {
     $ip = $param['ipaddr'];
     if (!self::isValidIpaddress($ip)) {
         throw new lxexception("ipaddress_invalid", 'ipaddr');
     }
     if ($param['gateway']) {
         if (!self::isValidIpaddress($param['gateway'])) {
             throw new lxexception("gateway_invalid", 'gateway');
         }
     }
     if (!self::isValidIpaddress($param['netmask'])) {
         throw new lxexception("netmask_invalid", 'netmask');
     }
     $sq = new Sqlite($parent->__masterserver, "ipaddress");
     $res = $sq->getRowsWhere("syncserver = '{$parent->nname}'");
     $list = get_namelist_from_arraylist($res, "ipaddr");
     if (array_search_bool($ip, $list)) {
         throw new lxexception("ipaddress_already_configured", 'ipaddr');
     }
     $ret = lxshell_return("ping", "-n", "-c", "1", "-w", "5", $ip);
     // If the return status is 1, the ping fail and nobody uses. But if return is 0, somebody is using the IP
     if (intval($ret) !== 1) {
         throw new lxexception($ret . 'Another host is using the IP ' . $ip . ' and it is responding to the IP ping. Please you will ensure to use an available IP to add.', 'ipaddr');
     }
 }
Exemplo n.º 22
0
 function fix_syncserver_nname_problem()
 {
     $rewrite = get_class_variable($this->get__table(), "__rewrite_nname_const");
     if ($rewrite && array_search_bool("syncserver", $rewrite)) {
         $newthis = clone $this;
         $newthis->syncserver = $newserver;
         foreach ($rewrite as $n) {
             $nnamelist[] = $newthis->{$n};
         }
         $newthis->nname = implode($sgbl->__var_nname_impstr, $nnamelist);
         $sql = new Sqlite($this->__masterserver, $this->get__table());
         $res = $sql->getRowsWhere("nname = '{$newthis->nname}'");
         if ($res) {
             throw new lxException("changed_name_already_exists", $newthis->nname, "syncserver");
         }
         $this->__real_nname = $this->nname;
         $this->nname = $newthis->nname;
         $parent = $this->getParentO();
         $list = $this->get__table() . "_l";
         $parent->{$list}[$this->__real_nname] = null;
         unset($parent->{$list}[$this->__real_nname]);
         $parent->{$list}[$this->nname] = $this;
     }
 }
Exemplo n.º 23
0
 function getIpaddress($list = null)
 {
     $retlist = null;
     if ($list && !is_array($list)) {
         $list = null;
     }
     // If the list is null then return nothing. The list is supposed to be the quota of the web servers configured. So if it doesn't exist, then we need to return nothing. Make sure we don't call it without anything.
     if (!$list) {
         return null;
     }
     if ($this->isAdmin()) {
         $iplist = $this->getList('ipaddress');
         dprintoa($iplist);
         foreach ($iplist as $ip) {
             $ipaddr = trim($ip->ipaddr);
             if (!$ipaddr) {
                 continue;
             }
             if ($list) {
                 $syncserver = $ip->syncserver ? $ip->syncserver : 'localhost';
                 if (array_search_bool($syncserver, $list)) {
                     $retlist[] = $ipaddr;
                 }
             } else {
                 $retlist[] = $ipaddr;
             }
         }
         return $retlist;
     }
     $sql = new Sqlite($this->__masterserver, "ipaddress");
     if ($this->listpriv->ipaddress_list) {
         foreach ($this->listpriv->ipaddress_list as $ip) {
             $res = $sql->getRowsWhere("ipaddr = '{$ip}'", array('syncserver'));
             foreach ($res as $a) {
                 $serv[] = $a['syncserver'] ? $a['syncserver'] : 'localhost';
             }
             foreach ($serv as $s) {
                 if (array_search_bool($s, $list)) {
                     $retlist[] = $ip;
                 }
             }
         }
     }
     if ($retlist) {
         $retlist = array_unique($retlist);
     }
     return $retlist;
 }
Exemplo n.º 24
0
 static function getVpsOsimage($parent, $driver, $type = "add")
 {
     global $gbl, $sgbl, $login, $ghtml;
     $class = "vps__{$driver}";
     $var = "{$driver}_ostl_a";
     $list = exec_class_method($class, "getOsTemplatelist", $type);
     $ostlist = "{$driver}ostemplate_list";
     if (!$login->isAdmin() && count($login->{$ostlist}) > 0) {
         foreach ($list as $k => $v) {
             if (!array_search_bool($k, $login->{$ostlist})) {
                 unset($list[$k]);
             }
         }
     }
     return $list;
 }
Exemplo n.º 25
0
 function updateform($subaction, $param)
 {
     $this->initPhpIni();
     if ($subaction === 'extraedit') {
         $totallist = $this->getExtraList();
     } else {
         $totallist = $this->getLocalList();
     }
     $inheritedlist = $this->getInheritedList();
     $adminList = $this->getAdminList();
     foreach ($totallist as $l) {
         if (!$this->getParentO()->is__table('pserver') && array_search_bool($l, $inheritedlist) || array_search_bool($l, $adminList)) {
             $vlist["phpini_flag_b-{$l}"] = array('M', null);
         } else {
             $vlist["phpini_flag_b-{$l}"] = null;
         }
     }
     $this->postUpdate();
     return $vlist;
 }
Exemplo n.º 26
0
function parse_sql_data()
{
    global $gbl, $sgbl, $argc, $argv;
    static $_quota_var, $_field_var;
    $_return_value = null;
    $majmin = $sgbl->__ver_major_minor;
    $trel = $sgbl->__ver_release;
    $rpath = "sql/full.lxsql";
    $pathc = "htmllib/sql/common.lxsql";
    include $rpath;
    include $pathc;
    $string = $gl_sql_string_common . "\n" . $gl_sql_string;
    $string = explode("\n", $string);
    foreach ($string as $__k => $res) {
        $res = trim($res);
        if (!$res) {
            continue;
        }
        if (char_search_beg($res, "//")) {
            continue;
        }
        $res = preg_replace('/\\s+/', " ", $res);
        if (csb($res, "#")) {
            $vl = explode(" ", $res);
            $name = array_shift($vl);
            $name = strfrom($name, "#");
            $nvl = null;
            $nnvl = null;
            foreach ($vl as $k => $qv) {
                if (csb($qv, "#")) {
                    $_t = strfrom($qv, "#");
                    $nvl = lx_array_merge(array($nvl, $_quota_var[$_t]));
                } else {
                    $nvl[] = $qv;
                }
            }
            foreach ($nvl as $qv) {
                $nnvl[] = "priv_q_" . $qv;
                $nnvl[] = "used_q_" . $qv;
            }
            $_quota_var[$name] = $nvl;
            $g_qvar[$name] = $nnvl;
            $list = get_class_for_table($name);
            foreach ((array) $list as $l) {
                $_quota_var[$l] = $nvl;
                $g_qvar[$l] = $nnvl;
            }
            continue;
        }
        if (csb($res, "%")) {
            $vl = explode(" ", $res);
            $name = array_shift($vl);
            $nnnnvl = null;
            foreach ($vl as $q) {
                if (csb($q, "%")) {
                    $nnnnvl = lx_array_merge(array($nnnnvl, $g_var[$q]));
                } else {
                    $nnnnvl[] = $q;
                }
            }
            $g_var[$name] = $nnnnvl;
            continue;
        }
        $list = explode(" ", $res);
        $nlist = null;
        foreach ($list as $k => $l) {
            if (csb($l, "%")) {
                $nlist = array_merge($nlist, $g_var[$l]);
            } else {
                $nlist[] = $l;
            }
        }
        //dprintr($list);
        $list = $nlist;
        $nlist = null;
        foreach ($list as $l) {
            if ($l === '__q_var') {
                if (isset($g_qvar[$list[0]])) {
                    $nlist = lx_array_merge(array($nlist, $g_qvar[$list[0]]));
                }
            } else {
                $nlist[] = $l;
            }
        }
        $list = $nlist;
        //dprintr($list);
        $name = array_shift($list);
        $fields = lx_array_merge(array(get_default_fields(), $list));
        if (array_search_bool("syncserver", $fields)) {
            $fields[] = 'oldsyncserver';
            $fields[] = 'olddeleteflag';
        }
        $fields = array_unique($fields);
        $_field_var[$name] = $fields;
        $_return_value[$name] = $fields;
    }
    foreach ($_quota_var as &$__tq) {
        $__tq = array_flip($__tq);
    }
    foreach ($_field_var as &$__tq) {
        $__tq = array_flip($__tq);
    }
    $var['quotavar'] = $_quota_var;
    $var['fieldvar'] = $_field_var;
    lfile_put_contents("__path_dbschema", serialize($var));
    return $_return_value;
}
Exemplo n.º 27
0
 function setHistory()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $ac = array('addform', 'updateform', 'list', 'show');
     if (!array_search_bool(strtolower($ghtml->__http_vars['frm_action']), $ac)) {
         return;
     }
     //$histlist = $this->getSessionV("lx_history_var");
     $histlist = $login->dskhistory;
     $buttonpath = null;
     $url = "/display.php?{$ghtml->get_get_from_current_post(array('Search', 'frm_hpfilter'))}";
     $description = $ghtml->getActionDetails($url, null, $buttonpath, $path, $post, $file, $name, $image, $__t_identity);
     if ($file === 'ffile') {
         return;
     }
     if ($file === 'dskshortcut_a') {
         return;
     }
     if (cse($file, 'installapp')) {
         return;
     }
     unset($histlist[$url]);
     $histlist[$url] = time();
     while (count($histlist) > 20) {
         array_shift($histlist);
     }
     //$this->setSessionV("lx_history_var", $histlist);
     $login->dskhistory = $histlist;
     $login->setUpdateSubaction();
     $login->write();
 }
Exemplo n.º 28
0
function notify_admin($action, $parent, $child)
{
    $cclass = $child->get__table();
    $cname = $child->nname;
    $pclass = $parent->getClass();
    $pname = $parent->nname;
    $not = new notification(null, null, 'client-admin');
    $not->get();
    if (!array_search_bool($cclass, $not->class_list)) {
        return;
    }
    $subject = "{$cclass} {$cname} was {$action} to {$pclass} {$pname} ";
    send_mail_to_admin($subject, $subject);
}
Exemplo n.º 29
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);
 }
Exemplo n.º 30
0
 static function privdisplay($name, $var, $value)
 {
     // We have to divide by 1024 * 1024 because prividsplay deals in MBs while we have got bytes.
     if ($name === 'sizeper') {
         $value = round($value / (1024 * 1024), 2);
     }
     if (array_search_bool($name, array('sizeper', 'disk_usage', "maildisk_usage", "memory_usage", "backup_num", "traffic_usage", "traffic_last_usage", "swap_usage", "guarmem_usage", "realmem_usage", "disk", "lvm", "mysqldb_usage", "clientdisk_usage", "totaldisk_usage"))) {
         if ($value === '-' || is_unlimited($value)) {
             return $value;
         }
         return getGBOrMB($value);
     }
     return $value;
 }