Пример #1
0
}
function displayTopMenu($dblogin, $dbpass, $db)
{
    mysql_connect(localhost, $dblogin, $dbpass);
    @mysql_select_db($db) or die("Unable to select database.");
    $query = "SELECT * FROM menuItems WHERE Active = 'Y' and Top = 'Y' ORDER BY TopOrder ASC";
    $result = mysql_query($query) or die("Query failed:<BR>{$query}<BR>Error: " . mysql_error());
    mysql_close();
    for ($i = 0; $i < mysql_numrows($result); $i++) {
        $Text = mysql_result($result, $i, 'Text');
        $Link = mysql_result($result, $i, 'Link');
        echo " * <a href='{$Link}'>{$Text}</a>";
    }
}
$dblogin = '******';
$dbpass = '******';
$db = 'ticketdb';
$ACTION = trim(strtoupper($_GET['action']));
if ($ACTION == "") {
    $ACTION = trim(strtoupper($_POST['action']));
}
if ($ACTION == "TOP") {
    displayTopMenu($dblogin, $dbpass, $db);
    exit;
} elseif ($ACTION == "SIDE") {
    displaySideMenu($dblogin, $dbpass, $db);
    exit;
} else {
    echo "<B>Error displaying menu</B><BR>";
    exit;
}
Пример #2
0
function openPage($title)
{
    global $websiteName, $template, $mysqli, $emailActivation, $loggedInUser;
    echo "\n<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>\n<html xmlns='http://www.w3.org/1999/xhtml'>\n<head>\n<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\n<title>" . $websiteName . "</title>\n  <link rel='stylesheet' type='text/css' href='css/style.css' />\n<script src='models/funcs.js' type='text/javascript'>\n<!-- modernizr enables HTML5 elements and feature detects -->\n<script type='text/javascript' src='js/modernizr-1.5.min.js'></script>\n<script type='text/javascript' src='js/jquery.min.js'></script>\n<script type='text/javascript' src='js/pop.js'></script>\n\n</script>\n</head>\n\n<body>\n    <div id='main'>\n    <header>\n        <div id='logo'>\n        <div id='logo_text'>\n          <!-- class='logo_six', allows you to change the colour of the text -->\n          <h1><span class='logo_six'><a href='index.php'>{$websiteName}</a></span></a></h1>\n          <h2>Services and Knowledge Exchange Money</h2>\n        </div>\n      </div>\n";
    if (isUserLoggedIn()) {
        //Links for logged in user
        echo "<nav>\n            <div id='menu_container'>\n                <ul id='nav'>\n                    <li><a href='account.php'>Account Home</a></li>";
        if (isUserReady($loggedInUser->user_id)) {
            echo "          <li><a href='market.php'>Marketplace</a>";
            if ($loggedInUser->checkPermission(array(1))) {
                //Links for permission level 1 (student)
                echo "           <ul>\n                        <li><a href='market.php'>Vos questions (seeker)</a></li>\n                        <li><a href='market.php?cmd=bbuy'>Répondre aux questions (solver)</a></li>\n                    </ul>";
            }
            echo "           </li>\n                    <li><a href='wok.php'>WOC</a>";
            if ($loggedInUser->checkPermission(array(1))) {
                //Links for permission level 1 (student)
                echo " \n                    <ul>\n                        <li><a href='wok.php'>Vos compétences</a></li>\n                        <li><a href='wok.php?cmd=bsell'>Acheter une compétence</a></li>\n                    </ul>";
            }
            echo "           </li>";
            if ($loggedInUser->checkPermission(array(2))) {
                //Links for permission level 2 (professor)
                echo "               <li><a href='pay.php'>Paiement</a></li>";
                echo "               <li><a href='userlist.php'>Groupes</a></li>";
            }
        }
        echo "           <li><a href='user_settings.php'>User Settings</a></li>\n                    <li><a href='logout.php'>Logout</a></li>\n                    </ul>\n            </div>\n        </nav>\n        </header>\n        ";
        echo '<div id="site_content">';
        $text = "<h3>" . $loggedInUser->displayname . "</h3>" . "<h5>" . $loggedInUser->title . " (" . getRoleById($loggedInUser->role) . ")</h5>\n             <h4>Liens utiles</h4>\n             <ul>\n             <li><a target='_blank' href='http://movilab.org/index.php?title=SKEMA_BS_:_Cours_de_Performance_Durable_-_M1_-_Ann%C3%A9e_2014-2015'>Movilab</a></li>\n             </ul>";
        echo displaySideMenu($text);
        //Links for permission level 3 (default admin)
        if ($loggedInUser->checkPermission(array(3))) {
            $text = '</div>
            <h3>Admin Menu</h3>' . "<ul>\n\t<li><a href='admin_configuration.php'>Admin Configuration</a></li>\n\t<li><a href='admin_users.php'>Admin Users</a></li>\n\t<li><a href='admin_permissions.php'>Admin Permissions</a></li>\n\t<li><a href='admin_pages.php'>Admin Pages</a></li>\n\t<li><a href='admin_init.php'>Initialisation des comptes users</a></li>\n\t</ul>";
            echo displaySideMenu($text);
        }
    } else {
        //Links for users not logged in
        /*
            echo "
        	<nav>
                 <div id='menu_container'>
                  <ul class='sf-menu' id='nav'>
        	<li><a href='index.php'>Home</a></li>
        	<li><a href='login.php'>Login</a></li>
        	<li><a href='register.php'>Register</a></li>
        	<li><a href='forgot-password.php'>Forgot Password</a></li>";
        	if ($emailActivation)
        	{
                    echo "<li><a href='resend-activation.php'>Resend Activation Email</a></li>";
        	}
        	echo "</ul>
                            </div>
                </nav>
                </header>";
        */
        echo "\n\t<nav>\n         <div id='menu_container'>\n          <ul class='sf-menu' id='nav'>\n\t<li><a href='index.php'>Home</a></li>\n\t<li><a href='forgot-password.php'>Forgot Password</a></li>";
        echo "</ul>\n                    </div>\n        </nav>\n        </header>";
        echo '<div id="site_content">
      <div id="sidebar_container">
        <img class="paperclip" src="images/paperclip.png" alt="paperclip" />
        <div class="sidebar">' . "<h3>" . $loggedInUser->displayname . "</h3>" . "<h3>" . $loggedInUser->title . "</h3>\n             <h2>Liens utiles</h2>\n             <ul>\n             <li><a href='http://movilab.org/index.php?title=SKEMA_BS_:_Cours_de_Performance_Durable_-_M1_-_Ann%C3%A9e_2013-2014'>Movilab</a></li>\n             </ul>" . "<h2>Important</h2>\n          <ul>\n          <li>Au début du cours, chaque équipe dispose d'un compte crédité d'un montant de 10.000 SKEMs sur ce site.</li>\n          <li>Ce compte se gère de manière totalement collective (un compte pour une équipe).</li>\n          </ul>" . "</div>\n            ";
    }
    echo "</div>\n<div class='content'>" . '<img style="float: left; vertical-align: middle; margin: 0 10px 0 0;" src="images/examples.png" alt="examples" />
            <h1 style="margin: 15px 0 0 0;">' . $title . '</h1>';
}