Esempio n. 1
0
function postfwd2_item_list()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql();
    $sql = "SELECT * FROM postfwd2 WHERE instance='{$_GET["instance"]}' AND ID={$_GET["ID"]}";
    $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
    if (!$q->ok) {
        echo $q->mysql_error;
    }
    $rules = unserialize(base64_decode($ligne["rule"]));
    $add = imgtootltip("plus-24.png", "{add_rule}", "postfwdAdditem('')");
    $instance = $_GET["instance"];
    $ID = $_GET["ID"];
    $item_id = $_GET["itemid"];
    $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t<th>{$add}</th>\n\t<th>{rule}</th>\n\t<th>&nbsp;</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>\n";
    if (is_array($rules)) {
        while (list($num, $array) = each($rules)) {
            if ($classtr == "oddRow") {
                $classtr = null;
            } else {
                $classtr = "oddRow";
            }
            $delete = imgtootltip("delete-32.png", "{delete}", "Postfwd2DeleteItem({$num})");
            if ($num > 0) {
                $and = "{and}";
            } else {
                $and = "&nbsp;";
            }
            if ($array["item"] == "object") {
                $sql = "SELECT ObjectName FROM postfwd2_objects WHERE ID='{$array["item_data"]}'";
                $ligne3 = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
                $sql = "SELECT COUNT(ID) as tcount FROM postfwd2_items WHERE objectID={$array["item_data"]}";
                $ligne4 = mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
                $array["item_data"] = "{$ligne3["ObjectName"]} {with} {$ligne4["tcount"]} rules";
            }
            $html = $html . "\n\t\t\t<tr class={$classtr}>\n\t\t\t\t<td width=1% align='center' style='font-size:14px;font-weight:bold'>{$num}</td>\n\t\t\t\t<td width=99% style='font-size:14px;'>{$and} " . item_to_text($array) . "</td>\n\t\t\t\t<td width=1%>{$delete}</td>\n\t\t\t</tr>\n\t\t\t";
        }
    }
    if ($classtr == "oddRow") {
        $classtr = null;
    } else {
        $classtr = "oddRow";
    }
    $text_action = action_to_text($ligne["action"]);
    $html = $html . "\n\t\t\t<tr class={$classtr}>\n\t\t\t<td width=1% align='center' style='font-size:14px;font-weight:bold'>&nbsp;</td>\n\t\t\t<td width=99% style='font-size:14px;' colspan=2>{then} {$text_action}</td>\n\t\t\t\n\t\t</tr>\n\t\n\t\n\t</table>\n\t\t<script>\n\t\tvar x_Postfwd2DeleteItem= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue);}\t\n\t\t\tRefreshTab('main_config_postfwd2');\n\t\t\tpostfwd2ReloadItemsList();\n\t\t}\t\t\n\t\n\t\tfunction Postfwd2DeleteItem(num){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('postfwd2-delete-item','yes');\t\n\t\t\tXHR.appendData('instance','{$instance}');\n\t\t\tXHR.appendData('ID','{$ID}');\n\t\t\tXHR.appendData('itemid',num);\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_Postfwd2DeleteItem);\n\t\t\t}\t\t\t\t\t\n\t\t\t\n\t\t</script>\n\t\t\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Esempio n. 2
0
function postfwd2_item_list(){
	$page=CurrentPageName();
	$tpl=new templates();		
	$q=new mysql();
	$sql="SELECT * FROM postfwd2 WHERE instance='{$_GET["instance"]}' AND ID={$_GET["ID"]}";
	$ligne=@mysql_fetch_array($q->QUERY_SQL($sql,'artica_backup'));
	if(!$q->ok){echo $q->mysql_error;}
	$rules=unserialize(base64_decode($ligne["rule"]));	
	$add=imgtootltip("plus-24.png","{add_rule}","postfwdAdditem('')");
	$instance=$_GET["instance"];
	$ID=$_GET["ID"];
	$item_id=$_GET["itemid"];		

	
	
	
	$html="
<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>
<thead class='thead'>
	<tr>
	<th>$add</th>
	<th>{rule}</th>
	<th>&nbsp;</th>
	</tr>
</thead>
<tbody class='tbody'>
";	

	if(is_array($rules)){
		while (list ($num, $array) = each ($rules) ){
			if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";}
			$delete=imgtootltip("delete-32.png","{delete}","Postfwd2DeleteItem($num)");
			if($num>0){$and="{and}";}else{$and="&nbsp;";}
			$html=$html."
			<tr class=$classtr>
				<td width=1% align='center' style='font-size:14px;font-weight:bold'>$num</td>
				<td width=99% style='font-size:14px;'>$and ". item_to_text($array)."</td>
				<td width=1%>$delete</td>
			</tr>
			";
			
		}
	}
	
	if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";}
	$text_action=action_to_text($ligne["action"]);
	$html=$html."
			<tr class=$classtr>
			<td width=1% align='center' style='font-size:14px;font-weight:bold'>&nbsp;</td>
			<td width=99% style='font-size:14px;' colspan=2>{then} $text_action</td>
			
		</tr>
	
	
	</table>
		<script>
		var x_Postfwd2DeleteItem= function (obj) {
			var tempvalue=obj.responseText;
			if(tempvalue.length>0){alert(tempvalue);}	
			RefreshTab('main_config_postfwd2');
			postfwd2ReloadItemsList();
		}		
	
		function Postfwd2DeleteItem(num){
			var XHR = new XHRConnection();
			XHR.appendData('postfwd2-delete-item','yes');	
			XHR.appendData('instance','$instance');
			XHR.appendData('ID','$ID');
			XHR.appendData('itemid',num);
			XHR.sendAndLoad('$page', 'GET',x_Postfwd2DeleteItem);
			}					
			
		</script>
		
	
	";
	echo $tpl->_ENGINE_parse_body($html);
	
}