Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/mm/uprtou2/
Upload File :
Current File : /var/www/html/mmishra/mm/uprtou2/menus.inc.php

<?php

function hmenus($webid, $user='guest', $parentid=0) {
	//$role = authenticate($webid, $user);
	$role = $HTTP_SESSION_VARS['role'];
        $contentcategories = array(0=>'Webpage',99990=>'Orphan',99995=>'Format',99996=>'Tender',99997=>'Profile',99998=>'Advertisement',99999=>'Announcement');
        $tbl = 'webpages';
        //$sql = "select * from $tbl where webid='$webid' and status='online' and parentid=$parentid and pageaccess='public' order by hits desc, hypertext";
        $sql = "select * from $tbl where webid='$webid' and status='online' and parentid=$parentid and pageaccess='public' order by rowid";
        $rs = mysql_query($sql);

        if (!$parentid) $str .= "<ul>\n<li><a href='/' title='Back to Homepage'>Home</a></li>\n";
        else if (!mysql_num_rows($rs)) return '';
        else $str = "<ul>\n";

        while ($o = mysql_fetch_object($rs)) {
                $dropdownmenu = hmenus($webid, $user, $o->rowid);
                if ($dropdownmenu)
                        $str .= "<li><a href='#'>$o->hypertext</a>$dropdownmenu</li>\n";
                else {
                        $str .= "<li><a href='inner.php?conf=$o->rowid' title='Dated $o->datecreation, Expiry $o->dateexpiry'>$o->hypertext</a>\n";
                        if ($role == 'admin' && !$o->pagecontent) {
                                $id = innerconf('webpage');
                                if ($id) $str .= "<ul><li><a href='admin.php?conf=$id&parentid=$o->rowid' title='New page'>Add New...</a></li></ul>\n";
                        }
                        $str .= "</li>\n";
                }
        }

        if (!$parentid) {
                if ($role == 'admin') {
                        $id = innerconf('webpage');
                        if ($id) $str .= "<li><a href='admin.php?conf=$id&parentid=$parentid' title='New page'>Add New...</a></li>\n";
                        $str .= "<li><a href='#'>Edit</a><ul>\n";
                        $rs1 = mysql_query("select * from $tbl where pageaccess='admin' order by hits desc, hypertext");
                        while ($q = mysql_fetch_object($rs1)) {
                                if ($id == $q->rowid) {
                                        //$str .= "<li><a href='#'>$q->hypertext ($q->hits)</a><ul>\n";
                                        $str .= "<li><a href='#'>Content</a><ul>\n";
                                        foreach ($contentcategories as $key => $cc) {
                                                $str .= "<li><a href='admin.php?conf=$q->rowid&parentid=$key' title='Create page'>$cc</a></li>\n";
                                        }
                                        $str .= "</ul></li>\n";
                                } else
                                        $str .= "<li><a href='admin.php?conf=$q->rowid' title='ICDP $q->hypertext'>$q->hypertext</a></li>\n";
                        }
                        $str .= "</ul></li>\n";
                }
                /*
                $str .= "<li><a href='#'>Web Profiles</a><ul>\n";
                $rs1 = mysql_query("select * from $tbl where webid='$webid' and parentid='99997' and status='online' order by dateupdation");
                if (mysql_num_rows($rs1)) {
                        while ($o = mysql_fetch_object($rs1)) {
                                $str .= "<li><a href='inner.php?conf=$o->rowid'>$o->hypertext</a></li>\n";
                        }
                } else $str .= "<li><a href='#'>None</a></li>\n";

                $str .= "</ul></li></ul></li>\n";
                */
        } else if ($role == 'admin') {
                $id = innerconf('webpage');
                $str .= "<li><a href='admin.php?conf=$id&parentid=$parentid' title='New page'>Add New...</a></li>\n";
        }
        $str .= "</ul>\n";
        return $str;
}

function vmenus($webid, $user='guest', $parentid=0, $role) {
	//$role = $HTTP_SESSION_VARS['role'];
	//$role = authenticate($webid, $user);
        $id = innerconf('webpage');
        $tbl = 'webpages';
        //$sql = "select * from $tbl where webid='$webid' and status='online' and parentid=$parentid and pageaccess='public' order by hits desc, hypertext";
        $sql = "select * from $tbl where webid='$webid' and status='online' and parentid=$parentid and pageaccess='public' order by rowid";
        $rs = mysql_query($sql);

        if (!$parentid) $str .= "<ul id='vmenu'><li><a href='/' title='Back to Homepage'>Home</a></li>\n";
        else if (!mysql_num_rows($rs)) return '';
        else $str = "<ul>\n";

        while ($o = mysql_fetch_object($rs)) {
                $submenu = vmenus($webid, $user, $o->rowid, $role);
                if ($submenu)
                        $str .= "<li><a href='#'>$o->hypertext</a>$submenu</li>\n";
                else {
                        $str .= "<li><a href='inner.php?conf=$o->rowid' title='Dated $o->datecreation, Expiry $o->dateexpiry'>$o->hypertext</a>\n";
                        if ($o->pagetype == 'menu') {
                        	if ($role == 'admin') 
                                	$str .= "<ul><li><a href='admin.php?conf=$id&parentid=$o->rowid' title='New page'>Add New...</a></li></ul>\n";
                        	else if ($role == 'webmaster' && $o->userid == $user) 
                                	$str .= "<ul><li><a href='admin.php?conf=$id&parentid=$o->rowid' title='New page'>Add New...</a></li></ul>\n";
                        }
                        $str .= "</li>\n";
                }
		$userid = $o->userid;
        }

        if ($role == 'admin')  
                $str .= "<li><a href='admin.php?conf=$id&parentid=$parentid' title='New page'>Add New...</a></li>\n";
        else if ($role == 'webmaster' && $userid == $user) 
              	$str .= "<li><a href='admin.php?conf=$id&parentid=$parentid' title='New page'>Add New...</a></li>\n";
         
        $str .= "</ul>\n";
        return $str;
}

function amenus1($webid) {
        $tbl = 'websites';
        $rs = mysql_query("select features from $tbl where webids='$webid' and pageaccess='admin'");
        if (mysql_num_rows($rs)) {
		$o = mysql_fetch_object($rs);
		$features = $o->features;
	
                $contentcategories = array(0=>'Webpage',99990=>'Orphan',99995=>'Format',99996=>'Tender',99997=>'',99998=>'Advertisement',99999=>'Announcement');
                $tbl = 'adminpages';
                $str = "<ul id='amenu'><li><a href='#' title='Back to Homepage'>Site Management</a><ul>\n";
                $rs = mysql_query("select * from $tbl where status='online' order by hits desc, hypertext");
                while ($q = mysql_fetch_object($rs)) {
                        if ($id == $q->rowid) {
                                //$str .= "<li><a href='#'>$q->hypertext ($q->hits)</a><ul>\n";
                                $str .= "<li><a href='#'>Content</a><ul>\n";
                                foreach ($contentcategories as $key => $cc) {
                                        $str .= "<li><a href='admin.php?conf=$q->rowid&parentid=$key' title='Create page'>$cc</a></li>\n";
                                }
                                $str .= "</ul></li>\n";
                        } else
                                $str .= "<li><a href='admin.php?conf=$q->rowid' title='ICDP $q->hypertext'>$q->hypertext</a></li>\n";
                }
                $str .= "</ul></li></ul>\n";
        }
        return $str;
}

function amenus($webid, $user='guest', $role) {
	//$role = $HTTP_SESSION_VARS['role'];
	//$role = authenticate($webid, $user);
        $id = innerconf('webpage');
        if ($role == 'admin') {
		$contentcategories = array(0=>'Webpage',99990=>'Orphan',99995=>'Format',99996=>'Tender',99997=>'profile',99998=>'Advertisement',99999=>'Announcement');
        	$tbl = 'webpages';
        	$str = "<ul id='amenu'><li><a href='#' title='Back to Homepage'>Site Management</a><ul>\n";
                $rs1 = mysql_query("select * from $tbl where pageaccess='admin' order by hits desc, hypertext");
                while ($q = mysql_fetch_object($rs1)) {
                        if ($id == $q->rowid) {
                                $str .= "<li><a href='#'>Content Management</a><ul>\n";
                                foreach ($contentcategories as $key => $cc) {
                                        $str .= "<li><a href='admin.php?conf=$q->rowid&parentid=$key' title='Create page'>$cc</a></li>\n";
                                }
                                $str .= "</ul></li>\n";
                        } else
                                $str .= "<li><a href='admin.php?conf=$q->rowid' title='ICDP $q->hypertext'>$q->hypertext</a></li>\n";
                }
                $str .= "</ul></li></ul>\n";
        }
        return $str;
}



function hmenusxx($webid, $user='guest', $role='public', $parentid=0) {
	$contentcategories = array(0 => 'Webpage',99995=>'Format',99996=>'Tender',99997 =>'Profile',99998=>'Advertisement',99999=>'Announcement');
        $tbl = 'webpages';
	//$sql = "select * from $tbl where webid='$webid' and status='online' and parentid=$parentid and pageaccess='public' order by hits desc, hypertext";
	$sql = "select * from $tbl where webid='$webid' and status='online' and parentid=$parentid and pageaccess='public' order by rowid";
	$rs = mysql_query($sql);
        
	if (!$parentid) $str .= "<ul>\n<li><a href='./' title='Back to Homepage'>Home</a></li>\n";
	else if (!mysql_num_rows($rs)) return '';
	else $str = "<ul>\n";

        while ($o = mysql_fetch_object($rs)) {
                $dropdownmenu = hmenus($webid, $user, $role, $o->rowid);
                if ($dropdownmenu) 
			$str .= "<li><a href='#'>$o->hypertext</a>$dropdownmenu</li>\n";
                else {
			$str .= "<li><a href='inner.php?conf=$o->rowid' title='Dated $o->datecreation, Expiry $o->dateexpiry'>$o->hypertext</a>\n";
			if ($role == 'admin' && !$o->pagecontent) {
                		$id = innerconf('webpage');
                		if ($id) $str .= "<ul><li><a href='admin.php?conf=$id&parentid=$o->rowid' title='New page'>Add New...</a></li></ul>\n";
			}
			$str .= "</li>\n";
		}
	}
        
	if (!$parentid) {
		if ($role == 'admin') {
                	$id = innerconf('webpage');
                	if ($id) $str .= "<li><a href='admin.php?conf=$id&parentid=$parentid' title='New page'>Add New...</a></li>\n";
		}
                $str .= "<li><a href='#'>Extra</a><ul>\n";
		if ($user) {
			$str .= "<li><a href='inner.php?logout=1' title='Session: $user as $role'>Sign Out [$user]</a></li>\n";
			if ($role == 'admin') {
				$str .= "<li><a href='#'>Configuration</a><ul>\n";
				$rs1 = mysql_query("select * from $tbl where pageaccess='admin' order by hits desc, hypertext");
        			while ($q = mysql_fetch_object($rs1)) {
					if ($id == $q->rowid) {
						$str .= "<li><a href='#'>$q->hypertext ($q->hits)</a><ul>\n";
						foreach ($contentcategories as $key => $cc) {
							$str .= "<li><a href='admin.php?conf=$q->rowid&parentid=$key' title='Create page'>$cc</a></li>\n";
						}
						$str .= "</ul></li>";
					} else
						$str .= "<li><a href='admin.php?conf=$q->rowid' title='ICDP $q->hypertext'>$q->hypertext</a></li>\n";
				
				}
				$str .= "</ul></li>";
			}
		} else {
			$id = innerconf('login');
			$str .= "<li><a href='admin.php?conf=$id' title='For content management'>Sign In</a></li>\n";
		}
		$str .= "<li><a href='#'>Web Profiles</a><ul>\n";
                $rs1 = mysql_query("select * from $tbl where webid='$webid' and parentid='99997' and status='online' order by dateupdation");
                if (mysql_num_rows($rs1)) {
                        while ($o = mysql_fetch_object($rs1)) {
                                $str .= "<li><a href='inner.php?conf=$o->rowid'>$o->hypertext</a></li>\n";
                        }
                } else $str .= "<li><a href='#'>None</a></li>\n";
		$str .= "</ul></li>";

		$tbl = 'webusers';
		$str .= "<li><a href='#'>Online Users</a><ul>\n";
		$rs1 = mysql_query("select * from $tbl where webid='$webid' and sessionid>'' order by datesession");
		if (mysql_num_rows($rs1)) {
			while ($o = mysql_fetch_object($rs1)) {
				$str .= "<li><a href='inner.php?conf=webusers&uid=$o->userid'>$o->userid from $o->sessionip</a></li>\n";
			}
		} else $str .= "<li><a href='#'>None</a></li>\n";
			
                $str .= "</ul></li></ul></li>\n";
       		
        } else if ($role == 'admin') {
		$id = innerconf('webpage');
                $str .= "<li><a href='admin.php?conf=$id&parentid=$parentid' title='New page'>Add New...</a></li>\n";
	}
	$str .= "</ul>\n";
	return $str;
}

?>