Beispiel #1
0
 function tokenize($source)
 {
     $result = new TokenStream();
     $pos = 0;
     $matches = array();
     preg_match_all($this->pattern, $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
     if (preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR) {
         throw new TemplateSyntaxError('Template too large, PCRE backtrack limit reached');
     }
     foreach ($matches as $match) {
         if (!isset($match["match"])) {
             throw new TemplateSyntaxError('Template error');
         }
         $tagpos = $match["match"][1];
         if ($tagpos > 0) {
             $text = substr($source, $pos, $tagpos - $pos);
             $result->feed('text', $text, $pos);
         }
         if (isset($match["block"]) && $match["block"][1] != -1) {
             $result->feed('block', trim($match["block"][0]), $tagpos);
         } elseif (isset($match["variable"]) && $match["variable"][1] != -1) {
             $result->feed('variable', trim($match["variable"][0]), $tagpos);
         } elseif (iset($match["comment"]) && $match["comment"][1] != -1) {
             $result->feed('comment', trim($match["comment"][0]), $tagpos);
         }
         $pos = $tagpos + strlen($match["match"][0]);
     }
     if ($pos < strlen($source)) {
         $result->feed('text', substr($source, $pos), $pos);
     }
     $result->close();
     return $result;
 }
function login()
{
    //this function draws a complete login form
    global $user, $HTTP_POST_VARS;
    //lets make sure that if our user is logged in or logging in that we know it.
    if (!isset($user)) {
        $user = getuserinfo();
    }
    if (0 == strcmp($user['username'], "anonymous") && isset($HTTP_POST_VARS['user'])) {
        $user = userlogin($HTTP_POST_VARS['user'], $HTTP_POST_VARS['pass'], $HTTP_POST_VARS['automatic']);
    }
    //lets see if we need to present the user with a login box
    if (0 == strcmp($user['username'], "anonymous")) {
        if (iset($_SERVER["QUERY_STRING"])) {
            $url = $_SERVER["SCRIPT_NAME"] . "?" . $_SERVER["QUERY_STRING"] . "&login=1";
        } else {
            $url = $_SERVER["SCRIPT_NAME"] . "?login=1";
        }
        $WORK = "Please Enter your username and password to login:<BR>\r\n";
        $WORK .= "<form method='post' action='" . $url . "'>\r\n";
        $WORK .= "Username: <input type='text' name='user' size='20'><BR>\r\n";
        $WORK .= "Password: <input type='password' name='pass' size='20'><BR>\r\n";
        $WORK .= "Log me on automatically each visit: <input type='checkbox' name='automatic' checked><BR>\r\n";
        $WORK .= "<input type='submit' value='Login'>\r\n";
        $WORK .= "</form>\r\n";
    } else {
        $WORK = "You are currently logged in as " . $user['username'] . ".<BR>\r\n";
    }
    return $WORK;
}
Beispiel #3
0
						<form action="Media.php" method="post" enctype="multipart/form-data">
							<label for="file">Filename:</label>
							<input type="file" name="img" id="file"/><br>
							File Size: <div style="display:inline-block" id ="filesize">0</div><br>
							<input type ="submit" value="Upload Image">
						</form>
					</fieldset>
				</td>
			<?php 
}
if (isset($_FILES["img"])) {
    ?>
		<tr>
			<td colspan="2" style="text-align:center;">
			<?php 
    echo iset();
    ?>
		</tr> 
			<?php 
}
getpics();
?>
 
		</tr>
					<?php 
if ($username !== "Guest") {
    ?>
				<td>
					<fieldset>
						<legend><h3>Upload Videos</h3></legend>
						<form action="Media.php" method="post" enctype="multipart/form-data">
/**
 * ShowTopNavigationBar.php
 *
 * @version 1
 * @copyright 2008 By Chlorel for XNova
 */
function ShowTopNavigationBar($CurrentUser, $CurrentPlanet)
{
    global $lang, $_GET;
    if ($CurrentUser) {
        if (!$CurrentPlanet) {
            $CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $CurrentUser['current_planet'] . "';", 'planets', true);
        }
        // Actualisation des ressources de la planete
        PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time());
        $NavigationTPL = gettemplate('topnav');
        $dpath = !$CurrentUser["dpath"] ? DEFAULT_SKINPATH : $CurrentUser["dpath"];
        $parse = $lang;
        $parse['dpath'] = $dpath;
        $parse['image'] = $CurrentPlanet['image'];
        // Genearation de la combo des planetes du joueur
        $parse['planetlist'] = '';
        $ThisUsersPlanets = SortUserPlanets($CurrentUser);
        while ($CurPlanet = mysql_fetch_array($ThisUsersPlanets)) {
            if (isset($CurPlanet["destruyed"]) && $CurPlanet["destruyed"] == 0) {
                $parse['planetlist'] .= "\n<option ";
                if ($CurPlanet['id'] == $CurrentUser['current_planet']) {
                    // Bon puisque deja on s'y trouve autant le marquer
                    $parse['planetlist'] .= "selected=\"selected\" ";
                }
                $parse['planetlist'] .= "value=\"?cp=" . $CurPlanet['id'] . "";
                if (iset($_GET['mode'])) {
                    $parse['planetlist'] .= "&amp;mode=" . $_GET['mode'];
                }
                $parse['planetlist'] .= "&amp;re=0\">";
                // Nom et coordonnées de la planete
                $parse['planetlist'] .= "" . $CurPlanet['name'];
                $parse['planetlist'] .= "&nbsp;[" . $CurPlanet['galaxy'] . ":";
                $parse['planetlist'] .= "" . $CurPlanet['system'] . ":";
                $parse['planetlist'] .= "" . $CurPlanet['planet'];
                $parse['planetlist'] .= "]&nbsp;&nbsp;</option>";
            }
        }
        $energy = pretty_number($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) . "/" . pretty_number($CurrentPlanet["energy_max"]);
        // Energie
        if ($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"] < 0) {
            $parse['energy'] = colorRed($energy);
        } else {
            $parse['energy'] = $energy;
        }
        // Metal
        $metal = pretty_number($CurrentPlanet["metal"]);
        if ($CurrentPlanet["metal"] > $CurrentPlanet["metal_max"]) {
            $parse['metal'] = colorRed($metal);
        } else {
            $parse['metal'] = $metal;
        }
        // Cristal
        $crystal = pretty_number($CurrentPlanet["crystal"]);
        if ($CurrentPlanet["crystal"] > $CurrentPlanet["crystal_max"]) {
            $parse['crystal'] = colorRed($crystal);
        } else {
            $parse['crystal'] = $crystal;
        }
        // Deuterium
        $deuterium = pretty_number($CurrentPlanet["deuterium"]);
        if ($CurrentPlanet["deuterium"] > $CurrentPlanet["deuterium_max"]) {
            $parse['deuterium'] = colorRed($deuterium);
        } else {
            $parse['deuterium'] = $deuterium;
        }
        // Message
        if ($CurrentUser['new_message'] > 0) {
            $parse['message'] = "<a href=\"messages.php\">[ " . $CurrentUser['new_message'] . " ]</a>";
        } else {
            $parse['message'] = "0";
        }
        // Le tout passe dans la template
        $TopBar = parsetemplate($NavigationTPL, $parse);
    } else {
        $TopBar = "";
    }
    return $TopBar;
}