/**
 * Transverse the content tree structure, and reconstruct it with the IMS spec.  
 * This tree has the structure of [order=>array(id)], so the first layer is its order, second is the id
 * if param merge is true, if node!=null, merge it to top layer, and + offset to all others
 * @param	mixed	Tree from the buildTree() function, or sub-tree
 * @param	mixed	the current tree.
 * @return	A new content tree that meets the IMS specification.
 * @author	Harris Wong 
 */
function rebuild($tree, $node = '')
{
    $order_offset = 0;
    $folder = array();
    if (!is_array($tree)) {
        return $tree;
    }
    if ($node != '') {
        $tree['order_0'] = $node;
        $order_offset += 1;
    }
    //go through the tree
    foreach ($tree as $k => $v) {
        if (preg_match('/order\\_([\\d]+)/', $k, $match) == 1) {
            //if this is the order layer
            $folder['order_' . ($match[1] + $order_offset)] = rebuild($v);
        } else {
            //if this is the content layer
            if (is_array($v)) {
                $folder[$k] = rebuild($v, $k);
            }
        }
    }
    return $folder;
}
示例#2
0
文件: xamp.php 项目: vectart/xamp
function prepare()
{
    require_once 'config.php';
    //file_put_contents(CONTROLLER_PATH.'xamp.log', "------------------------------------\n\n", FILE_APPEND);
    header("Content-type: text/" . (XML_SOURCE == true ? 'xml' : 'html') . "; charset=utf-8");
    speedAnalyzer('Подключаем ядро');
    if (!XAMP_REBUILD) {
        require_once CONTROLLER_PATH . 'kernel.php';
    }
    if (!class_exists('xamp') || XAMP_REBUILD) {
        speedAnalyzer('Пересобираем XAMP');
        $result = rebuild(PLUGIN_PATH);
        $result = "<?php \n class xamp \n { \n {$result}  \n } \n ?>";
        $result .= rebuild(CLASS_PATH, false);
        file_put_contents(CONTROLLER_PATH . 'kernel.php', $result);
        require_once CONTROLLER_PATH . 'kernel.php';
    }
    speedAnalyzer('Чистим переменные');
    cleanup();
    session_start();
}
print '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css"></link>
</head>
<body>
<div style="clear: both"></div>

<div class="content1">
';
?>
<p>

<form action="rebuild_ip.php" method="post">
<strong><font color="#0570b9">Rebuild Varnish Configuration file and IP address pool</font></strong> <input type="submit" name="submit" value="Rebuild Now">
</form>
<?php 
if (isset($_POST['submit'])) {
    echo "Rebuilding IP pool.....Done";
    rebuild("/scripts/genevarnishconf");
}
?>
</p>
<br /><br /><br /><br /><br />
<?php 
include 'footer.php';
?>

示例#4
0
include_once 'ressources/class.ldap.inc';
include_once 'ressources/class.users.menus.inc';
include_once 'ressources/class.artica.inc';
include_once 'ressources/class.mysql.inc';
include_once 'ressources/class.ini.inc';
include_once 'ressources/class.cyrus.inc';
if (isset($_GET["popup"])) {
    popup();
    exit;
}
if (isset($_GET["rebuild"])) {
    rebuild();
    exit;
}
if (isset($_GET["restart"])) {
    rebuild();
    exit;
}
js();
function js()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $title = $tpl->_ENGINE_parse_body('{REBUILD_CYRUS}');
    $users = new usersMenus();
    if (!$users->AsMailBoxAdministrator) {
        $error = $tpl->_ENGINE_parse_body("{ERROR_NO_PRIVS}");
        echo "alert('{$error}')";
        die;
    }
    $html = "\n\tvar rebuild_timeout=0;\n\tvar tmpresrebuildcyrus='';\n\tfunction CyrusRebuildLoadPage(){\n\t\tRTMMail(700,'{$page}?popup=yes','{$title}');\n\t\tsetTimeout(\"CyrusRebuilStart()\",500);\n\t\n\t}\n\t\nvar X_CyrusRestart= function (obj) {\n\tvar results=obj.responseText;\n\tdocument.getElementById('cyrusRebuild').innerHTML=tmpresrebuildcyrus+results;\n\ttmpresrebuildcyrus=results;\t\n}\n\t\nvar X_CyrusRebuilStart= function (obj) {\n\tvar results=obj.responseText;\n\tdocument.getElementById('cyrusRebuild').innerHTML=results;\n\ttmpresrebuildcyrus=results;\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('restart','yes');\n\tdocument.getElementById('cyrusRebuild').innerHTML='<center><img src=img/wait_verybig.gif></center>';\n\tXHR.sendAndLoad('{$page}', 'GET',X_CyrusRestart);\t\t\n\t}\t\t\n\t\nfunction CyrusRebuilStart(){\n\t\trebuild_timeout=rebuild_timeout+1;\n\t\tif(rebuild_timeout>10){return;}\n\t\tif(!document.getElementById('cyrusRebuild')){setTimeout(\"CyrusRebuilStart()\",500);return;}\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('rebuild','yes');\n\t\tdocument.getElementById('cyrusRebuild').innerHTML='<center><img src=img/wait_verybig.gif></center>';\n\t\tXHR.sendAndLoad('{$page}', 'GET',X_CyrusRebuilStart);\t\n\t\t\n\t}\n\t\n\n\t\nvar X_SaveReplicaInfos= function (obj) {\n\tvar results=obj.responseText;\n\talert(results);\n\tAddCyrusReplica();\n\t}\t\n\t\t\n\tfunction SaveReplicaInfos(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('SaveReplicaInfos','yes');\n\t\tXHR.appendData('servername',document.getElementById('servername').value);\n\t\tXHR.appendData('artica_port',document.getElementById('artica_port').value);\n\t\tXHR.appendData('username',document.getElementById('username').value);\n\t\tXHR.appendData('password',document.getElementById('password').value);\n\t\tXHR.appendData('master_ip',document.getElementById('master_ip').value);\n\t\tdocument.getElementById('form_replica_div').innerHTML='<img src=img/wait_verybig.gif>';\n\t\tXHR.sendAndLoad('{$page}', 'GET',X_SaveReplicaInfos);\t\t\t\t\n\t}\n\t\n\t\nvar X_EnableCyrusMasterCluster= function (obj) {\n\tvar results=obj.responseText;\n\tCyrusCLusterLoadPage();\n\t}\t\t\n\t\n\tfunction EnableCyrusMasterCluster(){\n\t\tvar XHR = new XHRConnection();\n\t\tvar EnableCyrusMasterCluster=document.getElementById('EnableCyrusMasterCluster').value;\n\t\tvar CyrusClusterPort=document.getElementById('CyrusClusterPort').value;\n\t\tvar CyrusClusterID=document.getElementById('CyrusClusterID').value;\n\t\tXHR.appendData('EnableCyrusMasterCluster',EnableCyrusMasterCluster);\n\t\tXHR.appendData('CyrusClusterPort',CyrusClusterPort);\n\t\tdocument.getElementById('wizard_zone').innerHTML='<img src=img/wait_verybig.gif>';\n\t\tXHR.sendAndLoad('{$page}', 'GET',X_EnableCyrusMasterCluster);\t\n\t\n\t\n\t}\n\t\n\t\n\tCyrusRebuildLoadPage();\n\n";
示例#5
0
文件: admin.php 项目: Bossgod/3ch
 case 'more':
     echo $table->moreInfo($_GET['no']);
     break;
 case "modify":
     require_once CORE_DIR . "/admin/modify.php";
     $modify = new Modify();
     echo $modify->mod($_GET['no'], $_GET['action']);
     break;
 case 'logout':
     setcookie('saguaro_apass', '0', 1);
     setcookie('saguaro_auser', '0', 1);
     echo "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=" . PHP_SELF2_ABS . "\">";
     break;
 case 'rebuild':
     require_once CORE_DIR . "/log/rebuild.php";
     rebuild(1);
     break;
 case 'reports':
     head(0);
     require_once CORE_DIR . "/admin/report.php";
     $getReport = new Report();
     if (isset($_GET['no'])) {
         $getReport->reportClear($_GET['no']);
     }
     $active = $getReport->reportGetAllBoard();
     echo $getReport->reportList();
     break;
 case 'news':
     head(0);
     if (!valid('admin')) {
         error(S_NOPERM);
print '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css"></link>
</head>
<body>
<div style="clear: both"></div>

<div class="content1">
';
?>
<p>

<form action="rebuild_vhost.php" method="post">
<strong><font color="#0570b9">Rebuild Nginx Vhost configuration and Restart Nginx server </font></strong> <input type="submit" name="submit" value="Rebuild Now">
</form>
<?php 
if (isset($_POST['submit'])) {
    echo "Rebuilding Nginx vhost";
    rebuild("/scripts/createvhost.pl");
}
?>
</p>
<br /><br /><br /><br /><br />
<?php 
include 'footer.php';
?>

function optimizeFile($filepath, array $options = array())
{
    global $optimizer;
    $old = file_get_contents($filepath);
    $changed = false;
    $new = $optimizer->optimize($old);
    if ($new !== $old) {
        $changed = true;
    }
    $tokens = token_get_all($new);
    foreach ($tokens as $i => &$token) {
        if ($token[0] !== '.') {
            continue;
        }
        if ($tokens[$i - 2][0] === T_CONSTANT_ENCAPSED_STRING && $tokens[$i - 1][0] === T_WHITESPACE && $tokens[$i + 1][0] === T_WHITESPACE && $tokens[$i + 2][0] === T_CONSTANT_ENCAPSED_STRING) {
            $left = $tokens[$i - 2][1];
            $right = $tokens[$i + 2][1];
            if ($left[0] === $right[0]) {
                $tokens[$i + 2][1] = substr($left, 0, -1) . substr($right, 1);
                $changed = true;
                unset($tokens[$i - 2]);
                unset($tokens[$i - 1]);
                unset($tokens[$i]);
                unset($tokens[$i + 1]);
            }
        }
    }
    unset($token);
    if ($changed) {
        $tokens = array_values($tokens);
    }
    // strpos() => \strpos()
    foreach ($tokens as $i => &$token) {
        if ($token !== '(') {
            continue;
        }
        if ($tokens[$i - 1][0] !== T_STRING) {
            continue;
        }
        // Skip if preceded by \ -> or ::
        if ($tokens[$i - 2][0] === T_NS_SEPARATOR || $tokens[$i - 2][0] === T_OBJECT_OPERATOR || $tokens[$i - 2][0] === T_PAAMAYIM_NEKUDOTAYIM) {
            continue;
        }
        // Skip if preceded by function or new
        if ($tokens[$i - 3][0] === T_FUNCTION || $tokens[$i - 3][0] === T_NEW) {
            continue;
        }
        $tokens[$i - 1][1] = '\\' . $tokens[$i - 1][1];
        $changed = true;
    }
    unset($token);
    // PREG_SET_ORDER => \PREG_SET_ORDER
    // PREG_SET_ORDER => 2
    foreach ($tokens as $i => &$token) {
        if ($token[0] !== T_STRING || !defined($token[1])) {
            continue;
        }
        // Skip if preceded by \ -> or ::
        if ($tokens[$i - 1][0] === T_NS_SEPARATOR || $tokens[$i - 1][0] === T_OBJECT_OPERATOR || $tokens[$i - 1][0] === T_PAAMAYIM_NEKUDOTAYIM) {
            continue;
        }
        // Skip if preceded by class, const, function, interface, new, trait or use
        if ($tokens[$i - 2][0] === T_CLASS || $tokens[$i - 2][0] === T_CONST || $tokens[$i - 2][0] === T_FUNCTION || $tokens[$i - 2][0] === T_INTERFACE || $tokens[$i - 2][0] === T_NEW || $tokens[$i - 2][0] === T_TRAIT || $tokens[$i - 2][0] === T_USE) {
            continue;
        }
        if (!empty($options['foldGlobalConstants']) && $token[1] !== 'false' && $token[1] !== 'null' && $token[1] !== 'true' && strpos($token[1], 'VERSION') === false && substr($token[1], 0, 2) !== 'T_' && substr($token[1], 0, 2) !== '__') {
            $value = constant($token[1]);
            if (is_integer($value)) {
                $token = array(T_LNUMBER, $value);
            } elseif (is_float($value)) {
                $token = array(T_DNUMBER, $value);
            } elseif (is_string($value)) {
                $token = array(T_CONSTANT_ENCAPSED_STRING, var_export($value, true));
            } else {
                $token = array(T_STRING, var_export($value, true));
            }
        } else {
            $token[1] = '\\' . $token[1];
        }
        $changed = true;
    }
    unset($token);
    if (!empty($options['removeComments'])) {
        foreach ($tokens as $i => &$token) {
            if ($token[0] === T_DOC_COMMENT) {
                if (empty($options['removeDocblock'])) {
                    continue;
                }
            } elseif ($token[0] !== T_COMMENT) {
                continue;
            }
            if (empty($options['removeLicense']) && strpos($token[1], '@license') !== false) {
                continue;
            }
            if ($tokens[$i + 1][0] === T_WHITESPACE) {
                $tokens[$i + 1][1] = '';
            }
            $token = array(T_WHITESPACE, '');
            $changed = true;
        }
        unset($token);
    }
    if (!empty($options['convertDocblock'])) {
        foreach ($tokens as $i => &$token) {
            if ($token[0] !== T_DOC_COMMENT) {
                continue;
            }
            $token[1] = '/' . substr($token[1], 2);
            $changed = true;
        }
        unset($token);
    }
    if (!empty($options['removeWhitespace'])) {
        if ($changed) {
            $tokens = token_get_all(rebuild($tokens));
        }
        foreach ($tokens as $i => &$token) {
            if ($token[0] !== T_WHITESPACE) {
                continue;
            }
            $before = is_array($tokens[$i - 1]) ? $tokens[$i - 1][1] : $tokens[$i - 1];
            $after = is_array($tokens[$i + 1]) ? $tokens[$i + 1][1] : $tokens[$i + 1];
            $token[1] = preg_match('/\\w$/', $before) && preg_match('/^\\w/', $after) ? "\n" : '';
            $changed = true;
        }
        unset($token);
    } elseif (!empty($options['removeBlankLines'])) {
        foreach ($tokens as $i => &$token) {
            if ($token[0] === T_WHITESPACE) {
                $token[1] = str_replace("\n\n", "\n", $token[1]);
            }
        }
        unset($token);
        $changed = true;
    }
    if ($changed) {
        file_put_contents($filepath, rebuild($tokens));
        echo "Optimized {$filepath}\r";
    }
}
示例#8
0
	if($user->AsSystemAdministrator==false){
		$tpl=new templates();
		echo "alert('". $tpl->javascript_parse_text("{ERROR_NO_PRIVS}")."');";
		die();exit();
	}

	if(isset($_GET["popup"])){popup();exit;}
	if(isset($_GET["add-form"])){popup_add();exit;}
	if(isset($_POST["ip_addr"])){host_add();exit;}
	if(isset($_GET["refresh"])){echo getlist();exit;}
	if(isset($_POST["host-delete"])){popup_delete();exit;}
	if(isset($_GET["table"])){table();exit;}
	if(isset($_GET["add-etc-hosts-p"])){Paragraphe_add();exit;}
	if(isset($_GET["DisableEtcHosts"])){DisableEtcHosts_save();exit;}
	if(isset($_GET["hosts-search"])){hosts_search();exit;}
	if(isset($_POST["rebuild"])){rebuild();exit;}
	js();
	
	
function js(){
	$page=CurrentPageName();
	$tpl=new templates();
	header("content-type: application/x-javascript");
	$title=$tpl->_ENGINE_parse_body("{etc_hosts}");
	echo "YahooWin3(800,'$page?popup=yes','$title',true);";
	
}

function rebuild(){
	
	$sock=new sockets();
示例#9
0
/**
 * Run action for virtual machine
 */
function _actions_vm($action)
{
    global $_ONAPPVARS, $_LANG;
    $action = $_ONAPPVARS['action'];
    if (!is_null($action)) {
        switch ($action) {
            case 'create':
                _action_vm_create();
                break;
            case 'unlock':
                $_ONAPPVARS['vm']->unlock();
                break;
            case 'build':
                _action_update_res();
                $_ONAPPVARS['vm']->build();
                break;
            case 'rebuild':
                rebuild();
                break;
            case 'start':
                _action_update_res();
                $_ONAPPVARS['vm']->startup();
                break;
            case 'stop':
                $_ONAPPVARS['vm']->shutdown();
                break;
            case 'reboot':
                _action_update_res();
                $_ONAPPVARS['vm']->reboot();
                break;
            case 'delete':
                _action_vm_delete();
                break;
            case 'reset_pass':
                $_ONAPPVARS['vm']->reset_password();
                break;
            case 'rebuild_network':
                $_ONAPPVARS['vm']->rebuild_network();
                break;
            default:
                $_ONAPPVARS['error'] = sprintf($_LANG["onappactionnotfound"], $action);
                break;
        }
    }
    unset($_ONAPPVARS['action']);
    if (isset($_ONAPPVARS['vm']) && !is_null($_ONAPPVARS['vm']->error)) {
        $_ONAPPVARS['error'] = is_array($_ONAPPVARS['vm']->error) ? implode('.<br>', $_ONAPPVARS['vm']->error) : $_ONAPPVARS['vm']->error;
    } elseif (isset($_ONAPPVARS['vm']) && !is_null($_ONAPPVARS['vm']->_obj->error)) {
        $_ONAPPVARS['error'] = is_array($_ONAPPVARS['vm']->_obj->error) ? implode('.<br>', $_ONAPPVARS['vm']->_obj->error) : $_ONAPPVARS['vm']->_obj->error;
    }
    if (!isset($_ONAPPVARS['error'])) {
        redirect(ONAPP_FILE_NAME . "?page=productdetails&id=" . $_ONAPPVARS['id']);
    } else {
        productdetails();
    }
}
示例#10
0
		$sql = 'SELECT distinct course_id FROM '.$_POST['step1']['tb_prefix'].'content';
		$result_course = mysql_query($sql, $db);
		while ($row_course = mysql_fetch_assoc($result_course)){
			
			$sql = 'SELECT * FROM '.$_POST['step1']['tb_prefix'].'content WHERE course_id='.$row_course['course_id'];
			$result = mysql_query($sql, $db);
			$content_array = array(); 
	
			while ($row = mysql_fetch_assoc($result)){
				$content_array[$row['content_parent_id']][$row['ordering']] = $row['content_id'];
			}

			$tree = buildTree($content_array[0], $content_array);

			/* Restructure the tree */
			$tree = rebuild($tree);

			
			/* Update the Db based on this new tree */
			reconstruct($tree, '', 0, $_POST['step1']['tb_prefix']);
		}
	}

	/* deal with the extra modules: */
	/* for each module in the modules table check if that module still exists in the mod directory. */
	/* if that module does not exist then check the old directory and prompt to have it copied */
	/* or delete it from the modules table. or maybe disable it instead? */
	if (version_compare($_POST['step1']['old_version'], '1.5.1', '>')) {
		define('TABLE_PREFIX', $_POST['step1']['tb_prefix']);
		require(AT_INCLUDE_PATH . '../mods/_core/modules/classes/Module.class.php');
		$moduleFactory = new ModuleFactory(FALSE);
示例#11
0
 function rebuild(array $a, &$r, $key = null)
 {
     foreach ($a as $k => $v) {
         if (!is_array($v)) {
             $r[$key ? $key . \Application\PHPRoll::KEY_SEPARATOR . $k : $k] = $v;
         } else {
             rebuild($v, $r, $key ? $key . \Application\PHPRoll::KEY_SEPARATOR . $k : $k);
         }
     }
 }
    }
    pclose($handle);
}
print '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css"></link>
</head>
<body>
<div style="clear: both"></div>

<div class="content1">
';
?>
<p>

<form action="rebuild_nginx.php" method="post">
<strong><font color="#0570b9">Rebuild Nginx configuration file and Restart Nginx server </font></strong> <input type="submit" name="submit" value="Rebuild Now">
</form>
<?php 
if (isset($_POST['submit'])) {
    echo "Rebuilding Nginx conf";
    rebuild("/scripts/rebuildnginxconf");
}
?>
</p>
<br /><br /><br /><br /><br />
<?php 
include 'footer.php';
示例#13
0
if(isset($_GET["status"])){kavmilterd_status();exit;}
if(isset($_GET["main"])){switchTab();exit;}
if(isset($_GET["kavmilterd_save_standard"])){kavmilterd_save_standard();exit;}
if(isset($_GET["KavMilterdDeleteNotify"])){PageGroupRule_Notify_delete();exit;}
if(isset($_GET["DEST"])){PageGroupRule_Notify_save();exit;}
if(isset($_GET["SavePolicyRule"])){PageGroupRule_save();exit;}
if(isset($_GET["PolicyRule"])){echo PageGroupRule();exit;}
if(isset($_GET["kavmilter_events"])){echo kavmilter_events_page();exit;}
if(isset($_GET["KavMilterAddkey"])){echo Kavmilter_Addkey();exit;}
if(isset($_GET["iframe_addkey"])){echo Kavmilter_Addkey_form();exit;}
if(isset($_GET["stats"])){echo kavmilter_stats_generate();exit;}
if(isset($_GET["kavmilter_select_notify_action"])){PageGroupRule_Notify_select_action();exit();}
if(isset($_GET["enable_kavmilter"])){kavmilter_save_enable();exit;}
if(isset($_GET["ajax"])){ajaxmode();exit;}
if(isset($_GET["ajax-pop"])){popup();exit;}
if(isset($_GET["rebuild"])){rebuild();exit;}
if(isset($_GET["UseUpdateServerUrl"])){save_update();exit;}
if(isset($_GET["UseAVBasesSet"])){save_general();exit;}



function ajaxmode(){
	$data=file_get_contents("js/kavmilterd.js");
	$html="
	$data
	YahooWin(745,'milter.index.php?ajax-pop=yes','Kaspersky Antivirus (milter edition)')
	
	";
	echo $html;
	
}