Page MenuHomeCode

No OneTemporary

This document is not UTF8. It was detected as ISO-8859-1 (Latin 1) and converted to UTF8 for display.
diff --git a/controllers/footer.php b/controllers/footer.php
index ccf9502..605b863 100644
--- a/controllers/footer.php
+++ b/controllers/footer.php
@@ -1,18 +1,27 @@
<?php
/*
* Zed
* (c) 2010, Dereckson, some rights reserved
* Released under BSD license
*
* Footer
*/
+///
+/// Tutorials div
+///
+if ($CurrentPerso->flags['hypership.reached'] < 1) {
+ if (!DOJO) $smarty->display('tutorial/dojo.tpl');
+ lang_load("tutorials.conf", "ReachHypership");
+ $smarty->display('tutorial/hypership_reach.tpl');
+}
+
///
/// HTML output
///
lang_load('footer.conf');
$smarty->display('footer.tpl');
?>
\ No newline at end of file
diff --git a/controllers/header.php b/controllers/header.php
index 712b4d2..ced0ca6 100644
--- a/controllers/header.php
+++ b/controllers/header.php
@@ -1,28 +1,35 @@
<?php
/*
* Zed
* (c) 2010, Dereckson, some rights reserved
* Released under BSD license
*
* Header
*/
//
// Graffiti wall
//
//TODO: this is a potentially very intensive SQL query
$sql = 'SELECT p.perso_nickname as username, m.motd_text FROM ' . TABLE_PERSOS . ' p, ' . TABLE_MOTD . ' m WHERE p.perso_id = m.perso_id ORDER BY rand() LIMIT 1';
if (!$result = $db->sql_query($sql)) message_die(SQL_ERROR, "Can't query MOTD", '', __LINE__, __FILE__, $sql);
$row = $db->sql_fetchrow($result);
$smarty->assign('WALL_TEXT', $row['motd_text']);
$smarty->assign('WALL_USER', $row['username']);
$smarty->assign('WALL_USER_URL', get_url('user', $row['username']));
//
// HTML output
//
+//Defines DOJO if needed, and assigns DOJO/DIJIT smarty variables
+if (!defined('DOJO')) define('DOJO', defined('DIJIT'));
+if (defined('DIJIT')) $smarty->assign('DIJIT', true);
+$smarty->assign('DOJO', DOJO);
+
+//Prints the template
$smarty->display('header.tpl');
+
define('HEADER_PRINTED', true);
?>
\ No newline at end of file
diff --git a/includes/SmartLine/SmartLine.php b/includes/SmartLine/SmartLine.php
index 77b8eee..8d370fe 100644
--- a/includes/SmartLine/SmartLine.php
+++ b/includes/SmartLine/SmartLine.php
@@ -1,328 +1,332 @@
<?php
/*
SmartLine 0.1
http://www.espace-win.org/EWOSP/SmartLine
(c) 2007 Espace Win Open Source Project, some rights reserved.
Released under BSD License
Developer leader: Sébastien Santoro aka Dereckson
http://purl.espace-win.org/Who/Dereckson
Support: http://purl.espace-win.org/EWOSP/Support
0.1 2007-07-28 01:36 [DcK] Initial release
*/
///////////////////////////////////////////////////////////////////////////////
// SECTION I - INITIALIZATION
///////////////////////////////////////////////////////////////////////////////
//Constants
if (!defined('STDOUT')) define('STDOUT', 1, true);
if (!defined('STDERR')) define('STDERR', -1, true);
///////////////////////////////////////////////////////////////////////////////
// SECTION Ibis - L10n
///////////////////////////////////////////////////////////////////////////////
//Assumes $lang is a standard array
if (empty($lang) || !is_array($lang)) {
$lang = array();
}
$lang = array_merge($lang, array(
//Errors
'InvalidCommand' => "Invalid command %s. Use <strong>showcommands</strong> to show all commands.",
'RegisteredButNotExistingCommand' => "[CRITICAL ERROR] The command %s has correctly been registered but its method or class doesn't exist.",
'NotYetHelpForThiscommand' => "This command hasn't been documented yet.",
//Help
'DefaultHelp' => "This SmartLine is a command line interface.
<br /><br /><strong>showcommands</strong> prints the list.
<br /><strong>help &lt;command&gt;</strong> prints help for this command.",
'Help' => array(
'help' => "<strong>help &lt;command&gt;</strong> prints command help.",
'showcommands' => 'show available commands'
)
));
///////////////////////////////////////////////////////////////////////////////
// SECTION II - HELPERS FUNCTIONS
///////////////////////////////////////////////////////////////////////////////
//Error Handler
function SmartLineHandler($level, $error, $file, $line) {
switch ($level) {
case E_NOTICE:
$type = 'Notice';
break;
CASE E_WARNING:
$type = 'Warning';
break;
CASE E_ERROR:
$type = 'Error';
break;
default:
$type = "#$level";
}
$_SESSION['SmartLineOutput'][STDERR][] = "[PHP $type] $error ";
return true;
}
///////////////////////////////////////////////////////////////////////////////
// SECTION III - BASE CLASSES
///////////////////////////////////////////////////////////////////////////////
//SmartLineCommand is a class implemanting a SmartLine command.
//If you want to create a more complex command, extends this class.
class SmartLineCommand {
public function __construct ($SmartLine) {
$this->SmartLine = $SmartLine;
}
//Gets command help
//Returns help text to print
//Returns false for default behavior
//(ie prints $lang['Help'][$command])
public function help () {
return false;
}
//Runs command
//$argv is an array containing args, $argc = count($argv)
public function run ($argv, $argc) {
}
//Gets the SmartLine where this instance of the command is registered
public $SmartLine;
}
//This class represents a SmartLine instance.
//If you use only register_object, you can use it directly
//If you use register_method, extends this class in your SmartLine.
class SmartLine {
public function __construct () {
//Assumes we've an empty array where store registered commands.
$this->commands = array();
//Let's register standard commands
$this->register_object('showcommands', 'ShowCommandsSmartLineCommand');
$this->register_object('help', 'HelpSmartLineCommand');
}
//Registers a private method as command
public function register_method ($command, $function = null, $useArgvArgc = false) {
if (is_null($function)) $function = $command;
if (!method_exists($this, $function)) {
$this->lastError = "Registration failed. Unknown method $function";
return false;
}
$className = ucfirst($function) . 'SmartLineCommand';
//If class exists, add a uniqid after function
while (class_exists($className)) {
$className = uniqid(ucfirst($function)) . 'SmartLineCommand';
}
//Creates the class
if ($useArgvArgc) {
$call = "$this->SmartLine->$function(\$argv, \$argc);";
} else {
//We don't know how many args we've, so we use call_user_func_array
$call = "array_shift(\$argv);
call_user_func_array(
array(&\$this->SmartLine, '$function'),
\$argv
);";
}
$code = "class $className extends SmartLineCommand {
public function run (\$argv, \$argc) {
$call
}
}";
eval($code);
$this->register_object($command, $className);
return true;
}
//Registers an object extending SmartLineCommand as command
public function register_object ($command, $object) {
if (is_object($object)) {
//Sets SmartLine property
$object->SmartLine = $this;
} elseif (is_string($object)) {
//Creates a new instance of $object
$object = new $object($this);
} else {
$this->lastError = "Registration failed. register_object second parameter must be a class name (string) or an already initialized instance of such class (object) and not a " . gettype($object);
return false;
}
if (!$this->caseSensitive) $command = strtolower($command);
$this->commands[$command] = $object;
return true;
}
//Returns true if $command has been registred
public function isRegistered ($command) {
if (!$this->caseSensitive) $command = strtolower($command);
return array_key_exists($command, $this->commands);
}
//Executes an expression
public function execute ($expression) {
//Does nothing if blank line
if (!$expression) return;
//Prepares $argv and $argc
$argv = $this->expression2argv($expression);
$argc = count($argv);
//Gets command
$command = $this->caseSensitive ? $argv[0] : strtolower($argv[0]);
//If command doesn't exist, throws an error
if (!array_key_exists($command, $this->commands)) {
global $lang;
$this->puts(sprintf($lang['InvalidCommand'], $command), STDERR);
return false;
}
//Executes command, intercepting error and returns result
set_error_handler("SmartLineHandler");
- $result = $this->commands[$command]->run($argv, $argc);
+ try {
+ $result = $this->commands[$command]->run($argv, $argc);
+ } catch (Exception $ex) {
+ $this->puts("<pre>$ex</pre>", STDERR);
+ }
restore_error_handler();
return $result;
}
public function puts ($message, $output = STDOUT) {
//Adds message to current output queue
$_SESSION['SmartLineOutput'][$output][] = $message;
}
public function truncate ($output = STDOUT) {
unset($_SESSION['SmartLineOutput'][$output]);
}
public function gets ($output = STDOUT) {
if (count($_SESSION['SmartLineOutput'][$output] > 0))
return array_pop($_SESSION['SmartLineOutput'][$output]);
}
public function count ($output = STDOUT) {
return count($_SESSION['SmartLineOutput'][$output]);
}
public function gets_all ($output = STDOUT, $prefix = '<p>', $suffix = '</p>') {
$count = count($_SESSION['SmartLineOutput'][$output]);
if ($count == 0) return;
for ($i = 0 ; $i < $count ; $i++)
$buffer .= $prefix . $_SESSION['SmartLineOutput'][$output][$i] . $suffix;
unset ($_SESSION['SmartLineOutput'][$output]);
return $buffer;
}
public function prints_all ($output = STDOUT, $prefix = '<p>', $suffix = '</p>') {
$count = count($_SESSION['SmartLineOutput'][$output]);
if ($count == 0) return;
for ($i = 0 ; $i < $count ; $i++)
echo $prefix, $_SESSION['SmartLineOutput'][$output][$i], $suffix;
unset ($_SESSION['SmartLineOutput'][$output]);
}
public function gethelp ($command) {
return $this->commands[$command]->help();
}
private function expression2argv ($expression) {
//Checks if expression contains "
$pos1 = strpos($expression, '"');
//We isolate "subexpression"
if ($pos1 !== false) {
$pos2 = $pos1;
do {
$pos2 = strpos($expression, '"', $pos2 + 1);
} while ($pos2 !== false && ($expression[$pos2 - 1] == "\\" && $expression[$pos2 - 2] != "\\"));
if ($pos2 === false) {
//If final quote is missing, throws a warning and autoadds it.
$this->puts("[Warning] Final \" missing in $expression.", STDERR);
$argv = $this->expression2argv(substr($expression, 0, $pos1));
$argv[] = substr($expression, $pos1 + 1);
return $argv;
}
return array_merge(
$this->expression2argv(substr($expression, 0, $pos1)),
array(substr($expression, $pos1 + 1, $pos2 - $pos1 - 1)),
$this->expression2argv(substr($expression, $pos2 + 1))
);
}
//Standard expression (ie without ")
$argv = array();
$items = explode(' ', $expression);
foreach ($items as $item) {
$item = trim($item);
if (!$item) {
//blank, we ignore
continue;
}
$argv[] = $item;
}
return $argv;
}
//Contains last error
public $lastError = '';
//If true, command isn't equal to Command
public $caseSensitive = true;
}
///////////////////////////////////////////////////////////////////////////////
// SECTION IV - STANDARD COMMANDS
///////////////////////////////////////////////////////////////////////////////
/*
* These commands are availaible in all default smartlines instance
*/
//Standard command "showcommands"
class ShowCommandsSmartLineCommand extends SmartLineCommand {
public function run ($argv, $argc) {
$commands = array_keys($this->SmartLine->commands);
sort($commands);
$this->SmartLine->puts(implode(' ', $commands));
}
}
//Standard command "help"
class HelpSmartLineCommand extends SmartLineCommand {
public function run ($argv, $argc) {
global $lang;
if ($argc == 1) {
$this->SmartLine->puts($lang['DefaultHelp']);
} elseif (!$this->SmartLine->isRegistered($argv[1])) {
$this->SmartLine->puts(sprintf($lang['InvalidCommand'], str_replace(' ', '&nbsp;', $argv[1])), STDERR);
} else {
$command = strtolower($argv[1]);
if (!$help = $this->SmartLine->gethelp($command)) {
if (array_key_exists($command, $lang['Help'])) {
$help = $lang['Help'][$command];
} else {
$help = $lang['NotYetHelpForThiscommand'];
}
}
$this->SmartLine->puts($help);
}
}
}
///////////////////////////////////////////////////////////////////////////////
?>
\ No newline at end of file
diff --git a/includes/SmartLine/ZedCommands.php b/includes/SmartLine/ZedCommands.php
index d82f8fb..cb79b24 100644
--- a/includes/SmartLine/ZedCommands.php
+++ b/includes/SmartLine/ZedCommands.php
@@ -1,110 +1,190 @@
<?php
/*
* Zed
* (c) 2010, Dereckson, some rights reserved
* Released under BSD license
*
* SmartLine
*
*/
///
/// Register commands
///
-$smartLine->register_object('goto', 'GotoLineCommand');
+$smartLine->register_object('goto', 'GotoSmartLineCommand');
+$smartLine->register_object('guid', 'GUIDSmartLineCommand');
$smartLine->register_object('list', 'ListSmartLineCommand');
$smartLine->register_object('unixtime', 'UnixTimeSmartLineCommand');
+$smartLine->register_object('whereami', 'WhereAmISmartLineCommand');
+
+///
+/// whereami
+///
+
+$lang['Help']['whereami'] = "Where am I?";
+
+class WhereAmISmartLineCommand extends SmartLineCommand {
+ public function run ($argv, $argc) {
+ global $CurrentPerso;
+ require_once("includes/geo/location.php");
+ $place = new GeoLocation($CurrentPerso->location_global);
+ $this->SmartLine->puts($CurrentPerso->location_global . ' - ' . $place);
+ }
+}
+
+///
+/// GUID
+///
+
+$lang['Help']['GUID'] = "Generate a GUID";
+
+class GUIDSmartLineCommand extends SmartLineCommand {
+ public function run ($argv, $argc) {
+ if ($argc > 1 && is_numeric($argv[1])) {
+ for ($i = 0 ; $i < $argv[1] ; $i++) {
+ $this->SmartLine->puts(new_guid());
+ }
+ return;
+ }
+
+ $this->SmartLine->puts(new_guid());
+
+ }
+}
+
+///
+/// goto
+///
+
+$lang['Help']['goto'] = "Go to a location";
+
+class GotoSmartLineCommand extends SmartLineCommand {
+ public function run ($argv, $argc) {
+ global $CurrentPerso;
+
+ if ($argc == 1) {
+ $this->SmartLine->puts("Where do you want to go?", STDERR);
+ return;
+ }
+
+ require_once("includes/geo/location.php");
+ try {
+ $place = new GeoLocation($argv[1]);
+ } catch (Exception $ex) {
+ $this->SmartLine->puts($ex->getMessage(), STDERR);
+ return;
+ }
+
+ if ($place->equals($CurrentPerso->location_global)) {
+ $this->SmartLine->puts("You're already there.");
+ return;
+ }
+
+ if (!$place->exists()) {
+ $this->SmartLine->puts("This place doesn't seem to exist.");
+ return;
+ }
+
+ $this->SmartLine->puts("TODO: code travel assistant");
+ }
+}
///
/// list
///
-$lang['Help']['list'] = "Lists specified objects (bodies)";
+
+$lang['Help']['list'] = "Lists specified objects (bodies, locations or places)";
class ListSmartLineCommand extends SmartLineCommand {
public function run ($argv, $argc) {
if ($argc == 1) {
- $this->SmartLine->puts("Available lists: bodies");
+ $this->SmartLine->puts("Available lists: bodies, locations, places");
return;
}
switch ($objects = $argv[1]) {
case 'bodies':
$list = $this->get_list(TABLE_BODIES, "CONCAT('B', body_code)", "body_name");
$this->SmartLine->puts($list);
break;
+
+ case 'locations':
+ $list = $this->get_list(TABLE_LOCATIONS, "location_code", "location_name");
+ $this->SmartLine->puts($list);
+ break;
case 'places':
if ($argv[2] == "-a" || $argv[2] == "--all") {
//Global bodies places list
$list = $this->get_list(TABLE_PLACES, "CONCAT('B', body_code, place_code)", "place_name");
} else {
//Local places (or equivalent) list
global $CurrentPerso;
switch ($CurrentPerso->location_global[0]) {
case 'B':
$body_code = substr($CurrentPerso->location_global, 1, 5);
$list = $this->get_list(TABLE_PLACES, "CONCAT('B', body_code, place_code)", "place_name", "body_code = $body_code");
break;
case 'S':
$this->SmartLine->puts("I don't have a map of the spaceship.", STDERR);
return;
default:
$this->SmartLine->puts("Unknown location type. Can only handle B or S.", STDERR);
return;
}
}
$this->SmartLine->puts($list);
break;
default:
$this->SmartLine->puts("Unknown objects to list: $objects", STDERR);
}
}
public function get_list ($table, $key, $value, $where = null) {
global $db;
$sql = "SELECT $key as `key`, $value as value FROM $table ";
if ($where) $sql .= "WHERE $where ";
$sql .= "ORDER BY `key` ASC";
if (!$result = $db->sql_query($sql)) {
message_die(SQL_ERROR, "Unable to fetch list", '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result)) {
$rows .= "<tr><td>$row[key]</td><td>$row[value]</td></tr>";
}
$this->SmartLine->truncate(STDERR);
- return "<table cellpadding=4><thead scope=\"row\"><tr><th>Key</th><th>Value</th></thead><tbody>$rows</tbody></table>";
+ return "<table cellspacing=\"8\"><thead style=\"color: white\" scope=\"row\"><tr><th>Key</th><th>Value</th></thead><tbody>$rows</tbody></table>";
}
}
///
/// unixtime
///
$lang['Help']['unixtime'] = "Prints current unixtime (seconds elapsed since 1970-01-01 00:00, UTC) or the specified unixtime date.";
class UnixTimeSmartLineCommand extends SmartLineCommand {
public function run ($argv, $argc) {
date_default_timezone_set('UTC');
if ($argc == 1) {
$this->SmartLine->puts(time());
} elseif ($argc == 2 && is_numeric($argv[1])) {
$this->SmartLine->puts(strftime("%Y-%m-%d %X", $argv[1]));
} else {
array_shift($argv);
$date = implode(' ', $argv);
if ($time = strtotime($date) !== false) {
$this->SmartLine->puts("Unixtime from $date: <span class=\"highlight\">$time</span>");
} else {
$this->SmartLine->puts("$date isn't a unixtime nor a valid date strtotime is able to parse.", STDERR);
}
}
}
}
?>
\ No newline at end of file
diff --git a/includes/core.php b/includes/core.php
index 2ac511a..e6e4fb7 100644
--- a/includes/core.php
+++ b/includes/core.php
@@ -1,224 +1,240 @@
<?php
//No register globals
ini_set('register_globals', 'off');
+//error_reporting(E_ALL & ~E_NOTICE);
error_reporting(E_ALL & ~E_NOTICE);
//Load libraries
include_once("config.php"); //Site config
include_once("error.php"); //Error management
include_once("mysql.php"); //MySQL layer
include_once("sessions.php"); //Sessions handler
//Helpers
//Gets username from specified user_id
function get_name ($id) {
global $db;
$sql = 'SELECT perso_nickname FROM '. TABLE_PERSOS . " WHERE perso_id = '$id'";
if (!$result = $db->sql_query($sql)) message_die(SQL_ERROR, "Can't query persos table.", '', __LINE__, __FILE__, $sql);
$row = $db->sql_fetchrow($result);
return $row['perso_nickname'];
}
//Gets user_id from specified username
function get_userid ($username) {
global $db;
$username = $db->sql_escape($username);
$sql = 'SELECT user_id FROM '. TABLE_USERS . " WHERE username LIKE '$username'";
if (!$result = $db->sql_query($sql)) message_die(SQL_ERROR, "Can't query users table.", '', __LINE__, __FILE__, $sql);
$row = $db->sql_fetchrow($result);
return $row['user_id'];
}
// ------------------------------------------------------------------------- //
// Chaîne aléatoire //
// ------------------------------------------------------------------------- //
// Auteur: Pierre Habart //
// Email: p.habart@ifrance.com //
// Web: //
// ------------------------------------------------------------------------- //
function genereString($format)
{
mt_srand((double)microtime()*1000000);
$str_to_return="";
$t_alphabet=explode(",","A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z");
$t_number=explode(",","1,2,3,4,5,6,7,8,9,0");
for ($i=0;$i<strlen($format);$i++)
{
if (ereg("^[a-zA-Z]",$format[$i]))
{
$add=$t_alphabet[mt_rand() % sizeof($t_alphabet)];
if (ereg("^[a-z]",$format[$i]))
$add=strtolower($add);
}
elseif(ereg("^[0-9]",$format[$i]))
$add=$t_number[mt_rand() % sizeof($t_number)];
else $add="?";
$str_to_return.=$add;
}
return $str_to_return;
}
function generer_hexa($longueur) {
mt_srand((double)microtime()*1000000);
$str_to_return="";
$t_number=explode(",","1,2,3,4,5,6,7,8,9,0,A,B,C,D,E,F");
for ($i = 0 ; $i < $longueur ; $i++) {
$str_to_return .= $t_number[mt_rand() % sizeof($t_number)];
}
return $str_to_return;
}
//Plural management
function s ($amount) {
if ($amount > 1) return "s";
}
function x ($amount) {
if ($amount > 1) return "x";
}
//Debug
function dprint_r ($mixed) {
echo "<pre>", print_r($mixed, true), "</pre>";
}
//GUID
function new_guid() {
$characters = explode(",","a,b,c,d,e,f,0,1,2,3,4,5,6,7,8,9");
$guid = "";
for ($i = 0 ; $i < 36 ; $i++) {
if ($i == 8 || $i == 13 || $i == 18 || $i == 23) {
$guid .= "-";
} else {
$guid .= $characters[mt_rand() % sizeof($characters)];
}
}
return $guid;
}
function is_guid ($expression) {
//We avoid regexp to speed up the check
//A guid is a 36 characters string
if (strlen($expression) != 36) return false;
$expression = strtolower($expression);
for ($i = 0 ; $i < 36 ; $i++) {
if ($i == 8 || $i == 13 || $i == 18 || $i == 23) {
//with dashes
if ($expression[$i] != "-") return false;
} else {
//and numbers
if (!is_numeric($expression[$i]) && $expression[$i] != 'a' && $expression[$i] != 'b' && $expression[$i] != 'c' && $expression[$i] != 'd' && $expression[$i] != 'e' && $expression[$i] != 'f' ) return false;
}
}
return true;
}
//Gets file extension
function get_extension ($file) {
$dotPosition = strrpos($file, ".");
return substr($file, $dotPosition + 1);
}
/*
* Loads specified language Smarty configuration file
*
* @param string $file the file to load
+ * @param mixed $sections array of section names, single section or null
*/
-function lang_load ($file) {
+function lang_load ($file, $sections = null) {
global $smarty;
//Loads English file as fallback if some parameters are missing
if (file_exists("lang/en/$file"))
- $smarty->config_load("lang/en/$file");
+ $smarty->config_load("lang/en/$file", $sections);
//Loads wanted file
if (LANG != 'en' && file_exists('lang/' . LANG . '/' . $file))
- $smarty->config_load('lang/' . LANG . '/' . $file);
+ $smarty->config_load('lang/' . LANG . '/' . $file, $sections);
}
/*
* Gets a specified language expression defined in configuration file
*
* @param string $key the configuration key matching the value to get
* @return string The value in the configuration file
*/
function lang_get ($key) {
global $smarty;
$smartyConfValue = $smarty->config_vars[$key];
return $smartyConfValue ? $smartyConfValue : "#$key#";
}
/*
* Converts a YYYYMMDD or YYYY-MM-DD timestamp to unixtime
*/
function to_unixtime ($timestamp) {
switch (strlen($timestamp)) {
case 8:
//YYYYMMDD
return mktime(0, 0, 0, substr($timestamp, 4, 2), substr($timestamp, 6, 2), substr($timestamp, 0, 4));
case 10:
//YYYY-MM-DD
return mktime(0, 0, 0, substr($timestamp, 5, 2), substr($timestamp, 8, 2), substr($timestamp, 0, 4));
default:
throw new Exception("timestamp is not a valid YYYYMMDD or YYYY-MM-DD timestamp: $timestamp");
}
}
/*
* Converts a unixtime to the YYYYMMDD or YYYY-MM-DD timestamp format
*
* @param int $unixtime the time to convert
* @param int $format 8 or 10. If 8 (default), will output YYYYMMDD. If 10, YYYY-MM-DD.
*/
function to_timestamp ($unixtime = null, $format = 8) {
//If no parameter is specified (or null, or false), current time is used
//==== allows to_timestamp(0) to return correct 1970-1-1 value.
if ($unixtime === null || $unixtime === false) $unixtime = time();
switch ($format) {
case 8:
//YYYYMMDD
return date('Ymd', $unixtime);
case 10:
//YYYY-MM-DD
return date('Y-m-d', $unixtime);
default:
throw new Exception("format must be 8 (YYYYMMDD) or 10 (YYYY-MM-DD) and not $format.");
}
}
/*
* Converts a unixtime to the Hypership time format.
*/
function get_hypership_time ($unixtime = null) {
+ //If unixtime is not specified, it's now
if ($unixtime === null) $unixtime = time();
- $days = floor(($unixtime - 1264377600) / 86400);
- return sprintf("%d.%03d", $days, idate('B', $unixtime));
+
+ //Hypership time is a count of days since launch @ 2010-01-25 00:00:00
+ //Followed by a fraction of the current day /1000, like the internet time
+ //but in UTC timezone and not Switzerland CET/CEST.
+ //We don't need to use floor(), as we output the result at int, truncating
+ //automatically decimal values instead of round it (like in C).
+ $seconds = $unixtime - 1264377600;
+ $days = $seconds / 86400;
+ $fraction = ($seconds % 86400) / 86.4;
+ return sprintf("%d.%03d", $days, $fraction);
}
/*
* Gets URL
*/
function get_url () {
global $Config;
- $pieces = func_get_args();
- return $Config['BaseURL'] . '/' . implode('/', $pieces);
+ if (func_num_args() > 0) {
+ $pieces = func_get_args();
+ return $Config['BaseURL'] . '/' . implode('/', $pieces);
+ } elseif ($Config['BaseURL'] == "" || $Config['BaseURL'] == "/index.php") {
+ return "/";
+ } else {
+ return $Config['BaseURL'];
+ }
}
-
?>
\ No newline at end of file
diff --git a/includes/error.php b/includes/error.php
index 6a9c2b3..9dba3cb 100644
--- a/includes/error.php
+++ b/includes/error.php
@@ -1,164 +1,165 @@
<?php
// Gestionnaire d'erreur
//
// SQL_ERROR : Erreur de requêtes SQL
// HACK_ERROR : Appel d'une page où l'utilisateur n'a pas accès
//Constantes
define ("SQL_ERROR", 65);
define ("HACK_ERROR", 99);
define ("GENERAL_ERROR", 117);
function dieprint_r ($var, $title = '') {
if (!$title) $title = 'Debug';
message_die(GENERAL_ERROR, '<pre>' . print_r($var, true) .'</pre>', $title);
}
function message_die ($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '') {
global $smarty, $db;
+
if ($smarty) {
$debug_text = $msg_text;
if ($err_line && $err_file)
$debug_text .= ' &mdash; ' . $err_file. ', ' . lang_get('line') . ' ' . $err_line ;
switch ($msg_code) {
case HACK_ERROR:
$smarty->assign('TITLE', lang_get('UnauthorizedAccess'));
break;
case SQL_ERROR:
$smarty->assign('TITLE', lang_get('SQLError'));
$sql_error = $db->sql_error();
if ($sql_error['message'] != '') {
$debug_text .= '<br />' . lang_get('Error') . ' n° ' . $sql_error['code'] . lang_get('_t') .
' ' .$sql_error['message'];
}
$debug_text .= "</p><h2>Query:</h2><p>$sql";
break;
default:
$smarty->assign('WAP', "Message code error.<br />Expected: HACK_ERROR, SQL_ERROR, GENERAL_ERROR");
//Falls to GENERAL_ERROR
case GENERAL_ERROR:
if ($msg_title)
$smarty->assign('TITLE', $msg_title);
else
$smarty->assign('TITLE', lang_get('GeneralError'));
break;
}
$smarty->assign('ERROR_TEXT', $debug_text);
- $template = defined(HEADER_PRINTED) && HEADER_PRINTED ? "error_block.tpl" : "error.tpl";
+ $template = (defined('HEADER_PRINTED') && HEADER_PRINTED) ? "error_block.tpl" : "error.tpl";
$smarty->display($template);
exit;
} else {
old_message_die($msg_code, $msg_text, $msg_title, $err_line, $err_file, $sql);
}
}
function old_message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '')
{
global $db, $Utilisateur;
$sql_store = $sql;
if ($msg_code == HACK_ERROR && $Utilisateur[user_id] < 1000) {
global $LoginResult;
foreach ($_POST as $name => $value) {
$champs .= "<input type=hidden name=$name value=\"$value\" />";
}
$titre = "Qui êtes-vous ?";
$debug_text = "Vous devez être authentifié pour accéder à cette page.";
$debug_text .= "
<FORM method='post'>
$champs
<table border='0'>
<tr>
<td><STRONG>Login</STRONG></td>
<td><input name='Login' type='text' id='Login' value='$_POST[Login]' size='10' /></td>
<td><STRONG>Mot de passe</STRONG></td>
<td>
<input name='MotDePasse' type='password' id='MotDePasse' size='10' />
<input type='submit' name='LoginBox' value='Connexion' />
</td>
</tr>
<tr>
<td align=center COLSPAN=4><a href='/?Topic=My&Article=Enregistrer'>Je d&eacute;sire ouvrir un compte</a></td>
</tr>
</TABLE><span class=error>$LoginResult</span>
</FORM>
";
} elseif ($msg_code == HACK_ERROR) {
$titre = "Accès non autorisé";
$debug_text = $msg_text;
} elseif ($msg_code == SQL_ERROR) {
$titre = "Erreur dans la requête SQL";
$sql_error = $db->sql_error();
$debug_text = $msg_text;
if ( $err_line != '' && $err_file != '') $debug_text .= ' dans ' . $err_file. ', ligne ' . $err_line ;
if ( $sql_error['message'] != '' ) $debug_text .= '<br />Erreur n° ' . $sql_error['code'] . ' : ' . $sql_error['message'];
if ( $sql_store != '' ) $debug_text .= "<br /><strong>$sql_store</strong>";
} elseif ($msg_code == GENERAL_ERROR) {
$titre = $msg_title;
- $debug_text = $msg_text;
- if ($err_line && $err_file) {
- $debug_text .= "<BR />$err_file, ligne $err_line";
- }
+ $debug_text = $msg_text;
+ if ($err_line && $err_file) {
+ $debug_text .= "<BR />$err_file, ligne $err_line";
+ }
}
echo "
<TABLE height='100%' cellSpacing=0 cellPadding=0 width='100%' border=0>
<TBODY>
<TR>
<TD vAlign=top align=middle>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD vAlign=top rowSpan=5><IMG height=177 alt=''
src='/_pict/error/notfound.jpg' width=163 border=0></TD>
<TD colSpan=4><IMG height=2 alt='' src='/_pict/error/mrblue.gif'
width=500 border=0></TD>
<TD><IMG height=2 alt='' src='/_pict/error/undercover.gif' width=1
border=0></TD></TR>
<TR>
<TD vAlign=bottom rowSpan=4 bgcolor='#FFFFFF'><IMG height=43 alt=''
src='/_pict/error/ecke.gif' width=14 border=0></TD>
<TD vAlign=center align=middle rowSpan=2 bgcolor='#FFFFFF'>
<TABLE cellSpacing=1 cellPadding=0 width=470 border=0>
<TBODY>
<TR>
<TD><FONT face='Verdana, Helvetica, sans-serif' color=red
size=4><B>$titre</B></FONT><BR>
<IMG height=5 alt=''
src='/_pict/error/undercover.gif' width=14 border=0><BR></TD></TR>
<TR>
<TD><FONT face='Verdana, Helvetica, sans-serif' color=black
size=2>$debug_text</FONT></TD></TR></TBODY></TABLE></TD>
<TD align=right width=2 rowSpan=2 bgcolor='#FFFFFF'><IMG height=146 alt=''
src='/_pict/error/mrblue.gif' width=2 border=0></TD>
<TD bgcolor='#FFFFFF'><IMG height=132 alt='' src='/_pict/error/undercover.gif' width=1
border=0></TD>
</TR>
<TR>
<TD><IMG height=14 alt='' src='/_pict/error/undercover.gif' width=1
border=0></TD></TR>
<TR>
<TD colSpan=2><IMG height=2 alt='' src='/_pict/error/mrblue.gif'
width=486 border=0></TD>
<TD><IMG height=2 alt='' src='/_pict/error/undercover.gif' width=1
border=0></TD></TR>
<TR>
<TD colSpan=2><IMG height=27 alt='' src='/_pict/error/undercover.gif'
width=486 border=0></TD>
<TD><IMG height=27 alt='' src='/_pict/error/undercover.gif' width=1
border=0></TD></TR></TBODY></TABLE>
<P>&nbsp;</P>
</TD></TR></TBODY></TABLE>
";
exit;
}
?>
\ No newline at end of file
diff --git a/includes/mysql.php b/includes/mysql.php
index 22d56aa..32782b4 100644
--- a/includes/mysql.php
+++ b/includes/mysql.php
@@ -1,368 +1,97 @@
<?php
-/***************************************************************************
- * mysql.php
- * -------------------
- * begin : Saturday, Feb 13, 2001
- * copyright : (C) 2001 The phpBB Group
- * email : support@phpbb.com
- *
- * $Id: mysql.php,v 1.16 2002/03/19 01:07:36 psotfx Exp $
- *
- ***************************************************************************/
-/***************************************************************************
+/*
+ * MySQL layer and helper class
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * @package Zed
+ * @subpackage Pluton
+ * @copyright Copyright (c) 2010, Dereckson
+ * @license Released under BSD license
+ * @version 0.1
*
- ***************************************************************************/
-
-if(!defined("SQL_LAYER"))
-{
-
-define("SQL_LAYER","mysql");
-
-class sql_db
-{
-
- var $db_connect_id;
- var $query_result;
- var $row = array();
- var $rowset = array();
- var $num_queries = 0;
-
- //
- // Constructor
- //
- function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
- {
-
- $this->persistency = $persistency;
- $this->user = $sqluser;
- $this->password = $sqlpassword;
- $this->server = $sqlserver;
- $this->dbname = $database;
-
- if($this->persistency)
- {
- $this->db_connect_id = @mysql_pconnect($this->server, $this->user, $this->password);
- }
- else
- {
- $this->db_connect_id = @mysql_connect($this->server, $this->user, $this->password);
- }
- if($this->db_connect_id)
- {
- if($database != "")
- {
- $this->dbname = $database;
- $dbselect = @mysql_select_db($this->dbname);
- if(!$dbselect)
- {
- @mysql_close($this->db_connect_id);
- $this->db_connect_id = $dbselect;
- }
- }
- return $this->db_connect_id;
- }
- else
- {
- return false;
- }
- }
-
- //
- // Other base methods
- //
- function sql_close()
- {
- if($this->db_connect_id)
- {
- if($this->query_result)
- {
- @mysql_free_result($this->query_result);
- }
- $result = @mysql_close($this->db_connect_id);
- return $result;
- }
- else
- {
- return false;
- }
- }
-
- //
- // Base query method
- //
- function sql_query($query = "", $transaction = FALSE)
- {
- // Remove any pre-existing queries
- unset($this->query_result);
- if($query != "")
- {
- $this->num_queries++;
- //echo "[DEBUG] $query<br>";
- $this->query_result = @mysql_query($query, $this->db_connect_id);
- }
- if($this->query_result)
- {
- unset($this->row[$this->query_result]);
- unset($this->rowset[$this->query_result]);
- return $this->query_result;
- }
- else
- {
- return ( $transaction == END_TRANSACTION ) ? true : false;
- }
- }
-
- //
- // Express query method ==> return an immediate and unique result
- //
- function sql_query_express($query = '', $erreur = "Impossible d'exécuter cette requête.", $returnString = 1)
- {
- if ($query == '') {
- return;
- } else {
- if (!$result = $this->sql_query($query)) message_die(SQL_ERROR, $erreur, '', __LINE__, __FILE__, $query);
- $row = $this->sql_fetchrow($result);
- return ($returnString ? $row[0] : $row);
- }
- }
-
- //
- // Other query methods
- //
- function sql_num_rows($query_id = 0) {
- return $this->sql_numrows($query_id);
- }
-
- function sql_numrows($query_id = 0)
- {
- if(!$query_id)
- {
- $query_id = $this->query_result;
- }
- if($query_id)
- {
- $result = @mysql_num_rows($query_id);
- return $result;
- }
- else
- {
- return false;
- }
- }
- function sql_affectedrows()
- {
- if($this->db_connect_id)
- {
- $result = @mysql_affected_rows($this->db_connect_id);
- return $result;
- }
- else
- {
- return false;
- }
- }
- function sql_numfields($query_id = 0)
- {
- if(!$query_id)
- {
- $query_id = $this->query_result;
- }
- if($query_id)
- {
- $result = @mysql_num_fields($query_id);
- return $result;
- }
- else
- {
- return false;
- }
- }
- function sql_fieldname($offset, $query_id = 0)
- {
- if(!$query_id)
- {
- $query_id = $this->query_result;
- }
- if($query_id)
- {
- $result = @mysql_field_name($query_id, $offset);
- return $result;
- }
- else
- {
- return false;
- }
- }
- function sql_fieldtype($offset, $query_id = 0)
- {
- if(!$query_id)
- {
- $query_id = $this->query_result;
- }
- if($query_id)
- {
- $result = @mysql_field_type($query_id, $offset);
- return $result;
- }
- else
- {
- return false;
- }
- }
- function sql_fetchrow($query_id = 0)
- {
- if(!$query_id)
- {
- $query_id = $this->query_result;
- }
- if($query_id)
- {
- $this->row[$query_id] = @mysql_fetch_array($query_id);
- return $this->row[$query_id];
- }
- else
- {
- return false;
- }
- }
- function sql_fetchrowset($query_id = 0)
- {
- if(!$query_id)
- {
- $query_id = $this->query_result;
- }
- if($query_id)
- {
- unset($this->rowset[$query_id]);
- unset($this->row[$query_id]);
- while($this->rowset[$query_id] = @mysql_fetch_array($query_id))
- {
- $result[] = $this->rowset[$query_id];
- }
- return $result;
- }
- else
- {
- return false;
- }
- }
- function sql_fetchfield($field, $rownum = -1, $query_id = 0)
- {
- if(!$query_id)
- {
- $query_id = $this->query_result;
- }
- if($query_id)
- {
- if($rownum > -1)
- {
- $result = @mysql_result($query_id, $rownum, $field);
- }
- else
- {
- if(empty($this->row[$query_id]) && empty($this->rowset[$query_id]))
- {
- if($this->sql_fetchrow())
- {
- $result = $this->row[$query_id][$field];
- }
- }
- else
- {
- if($this->rowset[$query_id])
- {
- $result = $this->rowset[$query_id][$field];
- }
- else if($this->row[$query_id])
- {
- $result = $this->row[$query_id][$field];
- }
- }
- }
- return $result;
- }
- else
- {
- return false;
- }
- }
- function sql_rowseek($rownum, $query_id = 0){
- if(!$query_id)
- {
- $query_id = $this->query_result;
- }
- if($query_id)
- {
- $result = @mysql_data_seek($query_id, $rownum);
- return $result;
- }
- else
- {
- return false;
- }
- }
- function sql_nextid(){
- if($this->db_connect_id)
- {
- $result = @mysql_insert_id($this->db_connect_id);
- return $result;
- }
- else
- {
- return false;
- }
- }
- function sql_freeresult($query_id = 0){
- if(!$query_id)
- {
- $query_id = $this->query_result;
- }
-
- if ( $query_id )
- {
- unset($this->row[$query_id]);
- unset($this->rowset[$query_id]);
-
- @mysql_free_result($query_id);
-
- return true;
- }
- else
- {
- return false;
- }
- }
- function sql_error($query_id = 0)
- {
- $result["message"] = @mysql_error($this->db_connect_id);
- $result["code"] = @mysql_errno($this->db_connect_id);
-
- return $result;
- }
-
- function sql_escape($query)
- {
- return mysql_real_escape_string($query, $this->db_connect_id);
- }
+ */
+
+if (!defined('SQL_LAYER')) {
+ define('SQL_LAYER', 'mysql');
+
+ class sql_db {
+ private $id;
+
+ function __construct($host = 'localhost', $username = 'root', $password = '' , $database = '') {
+ $this->id = mysql_connect($host, $username, $password);
+ if ($database != '') {
+ mysql_select_db($database, $this->id);
+ }
+ }
+
+ function sql_query ($query) {
+ return mysql_query($query, $this->id);
+ }
+
+ function sql_fetchrow ($result) {
+ return mysql_fetch_array($result);
+ }
+
+ function sql_error () {
+ $error['code'] = mysql_errno($this->id);
+ $error['message'] = mysql_error($this->id);
+ return $error;
+ }
+
+ function sql_numrows ($result) {
+ return mysql_num_rows($result);
+ }
+
+ function sql_nextid () {
+ return mysql_insert_id($this->id);
+ }
+
+ /*
+ * Express query method, returns an immediate and unique result
+ *
+ * @param string $query the query to execute
+ * @param string $error_message the error message
+ * @param boolean $return_as_string return result as string, and not as an array
+ *
+ * @return mixed the row or the scalar result
+ */
+ function sql_query_express ($query = '', $error_message = "Impossible d'exécuter cette requête.", $return_as_string = true) {
+ if (!$query) {
+ return '';
+ } elseif (!$result = $this->sql_query($query)) {
+ message_die(SQL_ERROR, $error_message, '', __LINE__, __FILE__, $query);
+ } else {
+ $row = $this->sql_fetchrow($result);
+ return $return_as_string ? $row[0] : $row;
+ }
+ }
+
+ /*
+ * Escapes a SQL expression
+ *
+ * @param string expression The expression to escape
+ * @return string The escaped expression
+ */
+ function sql_escape ($expression) {
+ return mysql_real_escape_string($expression);
+ }
+
+ function set_charset ($encoding) {
+ mysql_set_charset('utf8', $this->id);
+ }
+ }
+}
-} // class sql_db
-} // if ... define
-$db = new sql_db($Config['sql']['host'], $Config['sql']['username'], $Config['sql']['password'], $Config['sql']['database'], false);
+$db = new sql_db($Config['sql']['host'], $Config['sql']['username'], $Config['sql']['password'], $Config['sql']['database']);
unset($Config['sql']);
-if (!$db->db_connect_id) {
- die(mysql_error());
+
+if ($db->lastError) {
+ die($db->lastError);
}
//Sets SQL connexion in UTF8. PHP 5.2.3+
-mysql_set_charset('utf8', $db->db_connect_id);
-
+$db->set_charset('utf8');
?>
\ No newline at end of file
diff --git a/includes/sessions.php b/includes/sessions.php
index 2ad02d5..3630837 100644
--- a/includes/sessions.php
+++ b/includes/sessions.php
@@ -1,96 +1,96 @@
<?php
function decode_ip ($int_ip) {
$hexipbang = explode('.', chunk_split($int_ip, 2, '.'));
return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
}
function encode_ip ($dotquad_ip) {
$ip_sep = explode('.', $dotquad_ip);
return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
}
function session_update () {
global $db, $IP, $Config;
//Nettoyage de la session
/* Initialisation */
$time_online = 5 * 60; // Temps après lequel l'utilisateur n'est plus considéré comme online
$time_session = 2 * 60 * 60; // Durée de vie de la session
$heureActuelle = time(); //Timestamp UNIX et non MySQL
/* On fait le ménage */
$sql = "UPDATE " . TABLE_SESSIONS . " SET online=0 WHERE HeureLimite < $heureActuelle";
if ( !($result = $db->sql_query($sql)) ) message_die(SQL_ERROR, 'Impossible de mettre à jour les sessions (utilisateurs offline)', '', __LINE__, __FILE__, $sql);
$sql = "DELETE FROM " . TABLE_SESSIONS . " WHERE SessionLimite < $heureActuelle";
if ( !($result = $db->sql_query($sql)) ) message_die(SQL_ERROR, "Impossible d'effacer les sessions expirées", '', __LINE__, __FILE__, $sql);
/* Création / mise à jour de la session utilisateur */
if (!$_SESSION[ID]) {
$_SESSION[ID] = md5(genereString("AAAA1234"));
}
$sql = "SELECT * FROM " . TABLE_SESSIONS . " WHERE session_id LIKE '$_SESSION[ID]'";
if ( !($result = $db->sql_query($sql)) ) message_die(SQL_ERROR, "Problème critique avec les sessions.", '', __LINE__, __FILE__, $sql);
if ($db->sql_numrows($result) == 0) {
$sql = "INSERT INTO " . TABLE_SESSIONS . " (IP, session_id, `Where`, HeureLimite, SessionLimite) VALUES ('$IP', '$_SESSION[ID]', $Config[ResourceID], $heureActuelle + $time_online, $heureActuelle + $time_session)";
if ( !($result = $db->sql_query($sql)) ) message_die(SQL_ERROR, "Impossible de créer une nouvelle session", '', __LINE__, __FILE__, $sql);
} else {
$sql = "UPDATE " . TABLE_SESSIONS . " SET online=1, HeureLimite = $heureActuelle + $time_online, SessionLimite= $heureActuelle + $time_session WHERE session_id = '$_SESSION[ID]'";
if ( !($result = $db->sql_query($sql)) ) message_die(SQL_ERROR, "Impossible de mettre à jour la session", '', __LINE__, __FILE__, $sql);
- }
+ }
}
function nbc () {
//Renvoi du nombre d'usagers connectés
global $db, $Config;
$sql = "SELECT count(*) FROM " . TABLE_SESSIONS . " WHERE online=1 AND `Where` = $Config[ResourceID]";
if ( !($result = $db->sql_query($sql)) ) message_die(SQL_ERROR, "Impossible d'obtenir le nombre d'utilisateurs connectés sur le site web", '', __LINE__, __FILE__, $sql);
$row = $db->sql_fetchrow($result);
return $row[0];
}
function get_info ($info)
//Renvoie une variable de la session
{
global $db;
$sql = "SELECT $info FROM " . TABLE_SESSIONS . " WHERE session_id LIKE '$_SESSION[ID]'";
if ( !($result = $db->sql_query($sql)) ) message_die(SQL_ERROR, "Impossible d'obtenir $info", '', __LINE__, __FILE__, $sql);
$row = $db->sql_fetchrow($result);
return $row[$info];
}
function get_logged_user ()
//Renvoie toutes les informations d'un utilisateur
{
global $db;
$sql = "SELECT * FROM " . TABLE_SESSIONS . " WHERE session_id LIKE '$_SESSION[ID]'";
if ( !($result = $db->sql_query($sql)) ) message_die(SQL_ERROR, "Impossible d'obtenir les informations de l'utilisateur", '', __LINE__, __FILE__, $sql);
$row = $db->sql_fetchrow($result);
require_once('includes/objects/user.php');
$user = new User($row['user_id']);
$user->session = $row;
return $user;
}
function set_info ($info, $value)
//Définit une variable session
{
global $db;
$value = $db->sql_escape($value);
$sql = "UPDATE " . TABLE_SESSIONS . " SET $info = '$value' WHERE session_id LIKE '$_SESSION[ID]'";
if ( !($db->sql_query($sql)) ) message_die(SQL_ERROR, "Impossible de définir $info", '', __LINE__, __FILE__, $sql);
}
function logout () {
global $db;
$sql = "UPDATE " . TABLE_SESSIONS . " SET user_id = '-1' WHERE session_id LIKE '$_SESSION[ID]'";
if ( !($result = $db->sql_query($sql)) ) message_die(SQL_ERROR, "Impossible de procéder à la déconnexion", '', __LINE__, __FILE__, $sql);
}
?>
\ No newline at end of file
diff --git a/index.php b/index.php
index fd10649..96db3ed 100644
--- a/index.php
+++ b/index.php
@@ -1,160 +1,165 @@
<?php
/*
* Zed
* (c) 2010, Dereckson, some rights reserved
* Released under BSD license
*
* Application entry point
*/
////////////////////////////////////////////////////////////////////////////////
///
/// Initialization
///
//Pluton library
include('includes/core.php');
//Session
$IP = encode_ip($_SERVER["REMOTE_ADDR"]);
session_start();
$_SESSION[ID] = session_id();
session_update(); //updates or creates the session
+
include("includes/login.php"); //login/logout
$CurrentUser = get_logged_user(); //Gets current user infos
//Gets current perso
require_once('includes/objects/perso.php');
if ($perso_id = $CurrentUser->session['perso_id']) {
$CurrentPerso = new Perso($perso_id);
}
//Skin and accent to load
define('THEME', $CurrentUser->session['Skin']);
define('ACCENT', $CurrentUser->session['Skin_accent']);
//Loads Smarty
require('includes/Smarty/Smarty.class.php');
$smarty = new Smarty();
$current_dir = dirname(__FILE__);
$smarty->template_dir = $current_dir . '/skins/' . THEME;
+
$smarty->compile_dir = $current_dir . '/cache/compiled';
$smarty->cache_dir = $current_dir . '/cache';
$smarty->config_dir = $current_dir;
//Loads language files
define('LANG', 'fr');
lang_load('core.conf');
if ($CurrentUser->id < 1000) {
//Anonymous user, proceed to login
$smarty->assign('LoginError', $LoginError);
$smarty->display('login.tpl');
exit;
}
////////////////////////////////////////////////////////////////////////////////
///
/// Perso selector
///
//Handles form
if ($_POST['form'] == 'perso.create') {
$perso = new Perso();
$perso->load_from_form();
$perso->user_id = $CurrentUser->id;
//Validates forms
if (!$perso->name) $errors[] = lang_get("NoFullnameSpecified");
if (!$perso->race) {
$errors[] = lang_get("NoRaceSpecified");
$perso->race = "being";
}
if (!$perso->sex) $errors[] = lang_get("NoSexSpecified");
if (!$perso->nickname) {
$errors[] = lang_get("NoNicknameSpecified");
} else if (!Perso::is_available_nickname($perso->nickname)) {
$errors[] = lang_get("UnavailableNickname");
}
//Save or prints again forms
if (!$errors) {
$perso->save_to_database();
$smarty->assign('NOTIFY', lang_get('NewCharacterCreated'));
$CurrentPerso = $perso;
set_info('perso_id', $perso->id);
+ $CurrentPerso->setflag("site.lastlogin", $_SERVER['REQUEST_TIME']);
} else {
$smarty->assign('WAP', join("<br />", $errors));
$smarty->assign('perso', $perso);
}
}
if (!$CurrentPerso) {
if ($_GET['action'] == 'perso.select') {
//Users have selected a perso
$CurrentPerso = new Perso($_GET['perso_id']);
- set_info('perso_id', $CurrentPerso->id);
if ($CurrentPerso->user_id != $CurrentUser->id) {
//Hack
message_die(HACK_ERROR, "This isn't your perso.");
}
+ set_info('perso_id', $CurrentPerso->id);
+ $CurrentPerso->setflag("site.lastlogin", $_SERVER['REQUEST_TIME']);
}
switch ($count = Perso::get_persos_count($CurrentUser->id)) {
case 0:
//Create a perso
$smarty->display("perso_create.tpl");
exit;
case 1:
//Autoselect
$CurrentPerso = Perso::get_first_perso($CurrentUser->id);
set_info('perso_id', $CurrentPerso->id);
+ $CurrentPerso->setflag("site.lastlogin", $_SERVER['REQUEST_TIME']);
break;
default:
//Pick a perso
$smarty->display("perso_select.tpl");
exit;
}
}
//Assigns current perso object as Smarty variable
$smarty->assign('CurrentPerso', $CurrentPerso);
////////////////////////////////////////////////////////////////////////////////
///
/// Tasks to execute before calling the URL controller:
/// - assert the perso is somewhere
/// - executes the smartline
///
//If the perso location is unknown, ejects it to an asteroid
if (!$CurrentPerso->location_global) {
- require_once('includes/objects/place.php');
+ require_once('includes/geo/place.php');
$smarty->assign('NOTIFY', lang_get('NewLocationNotify'));
- $CurrentPerso->location_global = GeoPlace::get_start_location();
- $CurrentPerso->save_field('location_global');
+ $CurrentPerso->move_to(GeoPlace::get_start_location());
}
//SmartLine
include("includes/SmartLine/ZedSmartLine.php");
////////////////////////////////////////////////////////////////////////////////
///
/// Calls the specific controller to serve the requested page
///
$url = explode('/', substr($_SERVER['PATH_INFO'], 1));
switch ($controller = $url[0]) {
case '':
include('controllers/home.php');
break;
default:
//TODO: returns a 404 error
dieprint_r($url, 'Unknown URL');
}
+
?>
\ No newline at end of file
diff --git a/js/misc.js b/js/misc.js
index 1f8d7c1..e46e2c5 100644
--- a/js/misc.js
+++ b/js/misc.js
@@ -1,107 +1,140 @@
/* SmartLine */
function UpdateSmartLine() {
document.forms.SmartLine.C.value = document.forms.SmartLine.SmartLineHistory.value;
document.forms.SmartLine.C.focus();
}
+/* Hypership time */
+function get_hypership_time () {
+ date = new Date();
+ unixtime = Math.floor(date.getTime() / 1000);
+ seconds = unixtime - 1264377600;
+ days = Math.floor(seconds / 86400);
+ fraction = Math.floor((seconds % 86400) / 86.4);
+ return days + "." + fraction;
+}
+
+/* We need to trigger an update in ... ms */
+function next_hypership_increase_in () {
+ date = new Date();
+ unixtime = Math.floor(date.getTime() / 1000);
+ seconds = unixtime - 1264377600;
+ days = Math.floor(seconds / 86400);
+ fraction1 = (seconds % 86400) / 86.4;
+ fraction2 = Math.floor(fraction1);
+ return (fraction1 - fraction2) * 86400;
+}
+
+//Autoupdates every 20 seconds
+//(should be every 86.4 seconds, after first timed call)
+function update_hypership_time () {
+ var item = document.getElementById("HypershipTime");
+ if (item != undefined) {
+ item.innerHTML = get_hypership_time();
+ setTimeout('update_hypership_time()', 86400);
+ }
+}
+
+setTimeout('update_hypership_time()', next_hypership_increase_in());
+
/* Dumps a variable */
function dump(arr,level) {
var dumped_text = "";
if(!level) level = 0;
//The padding given at the beginning of the line.
var level_padding = "";
for(var j=0;j<level+1;j++) level_padding += " ";
if(typeof(arr) == 'object') { //Array/Hashes/Objects
for(var item in arr) {
var value = arr[item];
if(typeof(value) == 'object') { //If it is an array,
dumped_text += level_padding + "'" + item + "' ...\n";
//dumped_text += dump(value,level+1);
} else {
dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
}
}
} else { //Stings/Chars/Numbers etc.
dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
}
return dumped_text;
}
/* A code for an hidden function */
var ar2215 = {
input: "",
pattern: "38384040373937396665",
clear: setTimeout('ar2215.clear_input()', 2000),
load: function () {
window.document.onkeydown = function (e) {
ar2215.input += e ? e.keyCode : event.keyCode;
if (ar2215.input == ar2215.pattern) {
ar2215.code("/index.php/push");
clearTimeout(ar2215.clear);
return;
}
clearTimeout(ar2215.clear);
ar2215.clear = setTimeout("ar2215.clear_input()", 2000);
}
this.iphone.load("/index.php/push");
},
code: function (link) {
window.location = link;
},
clear_input: function () {
ar2215.input = "";
clearTimeout(ar2215.clear);
},
iphone:{
start_x: 0,
start_y: 0,
stop_x: 0,
stop_y: 0,
tap: false,
capture: false,
keys: ["UP","UP","DOWN","DOWN","LEFT","RIGHT","LEFT","RIGHT","TAP","TAP"],
code: function (link) { window.location = link },
load: function (link) {
document.ontouchmove = function (e) {
if (e.touches.length == 1 && ar2215.iphone.capture == true) {
var touch = e.touches[0];
ar2215.iphone.stop_x = touch.pageX;
ar2215.iphone.stop_y = touch.pageY;
ar2215.iphone.tap = false;
ar2215.iphone.capture = false;
ar2215.iphone.check_direction();
}
}
document.ontouchend = function (evt) {
if (ar2215.iphone.tap == true)
ar2215.iphone.check_direction();
}
document.ontouchstart = function(evt) {
ar2215.iphone.start_x = evt.changedTouches[0].pageX;
ar2215.iphone.start_y = evt.changedTouches[0].pageY;
ar2215.iphone.tap = true;
ar2215.iphone.capture = true;
}
},
check_direction: function () {
x_magnitude = Math.abs(this.start_x - this.stop_x);
y_magnitude = Math.abs(this.start_y - this.stop_y);
x = ((this.start_x - this.stop_x) < 0) ? "RIGHT": "LEFT";
y = ((this.start_y - this.stop_y) < 0) ? "DOWN" : "UP";
result = (x_magnitude > y_magnitude) ? x : y;
result = (this.tap == true) ? "TAP" : result;
if (result == this.keys[0])
this.keys = this.keys.slice(1, this.keys.length);
if (this.keys.length == 0)
this.code(this.link)
}
}
}
ar2215.load();
\ No newline at end of file
diff --git a/js/tour.js b/js/tour.js
index 4aa3efc..d9738e5 100644
--- a/js/tour.js
+++ b/js/tour.js
@@ -1,105 +1,134 @@
- var tour = {
- //Lang
+ var tour = {
+ //Default language
lang: "en",
+ //Translated in
+ langs: "en,fr",
+
//Current highlight showed
current: -1,
//File extension
extension: "png",
//Highlights files and position
//File: /img/tour/{filename}.{extension}
highlights: [
["create", 13, 18],
["lounge", 339, 107],
["play", 22, 345],
["explore", 325, 373]
],
//The center x, y coordinate
//It's used to determinate what highlight to print
center: [368, 390],
//Gets the highlight index, from position
where: function(x, y) {
if (x < this.center[0]) {
//We're at left from center point
return (y < this.center[1]) ? 0 : 2;
} else {
//We're at right from center point
return (y < this.center[1]) ? 1 : 3;
}
},
+ //Determines if we're inside the #Tour id
isInside: function (pageX, pageY) {
var tourOffset = $("#Tour").offset();
return pageX >= tourOffset.left && pageY >= tourOffset.top
&& pageX <= tourOffset.left + $("#Tour").width()
&& pageY <= tourOffset.top + $("#Tour").height();
},
//Shows the highlight at specified the page position
showAt: function (pageX, pageY) {
var tourOffset = $("#Tour").offset();
this.show(
this.where(pageX - tourOffset.left , pageY - tourOffset.top)
);
},
//Shows the specified highlight
show: function (i) {
if (this.current != i) {
var filename = this.highlights[i][0] + "_" + this.lang + "." + this.extension;
var code = '<img src="/img/tour/' + filename + '" alt="' + this.highlights[i][0] + '" />';
$('#TourHighlight').empty().html(code);
var o = document.getElementById("TourHighlight");
o.style.left = this.highlights[i][1] + "px";
o.style.top = this.highlights[i][2] + "px";
this.current = i;
}
},
+ //Hides highlight
hideall: function () {
if (this.current > -1) {
this.current = -1;
$('#TourHighlight').empty();
}
},
//Runs the animation
run: function (delay) {
- this.show(0);
+ //Highlight order
+ //[0, 1, 3, 2] is a counterwise move
+ var order = [0, 1, 3, 2];
+
+ //Prints first hightlight
+ this.show(order[0]);
+ //Prints next highlights
n = this.highlights.length;
- order = [0, 1, 3, 2];
for (i = 1 ; i < n ; i++) {
setTimeout('tour.show(' + order[i] + ')', delay * i);
}
- setTimeout('tour.show(0)', delay * n);
+
+ //Prints back the first, and enables rollover
+ setTimeout('tour.show(' + order[0] + ')', delay * n);
setTimeout('tour.enableRollover()', delay * n);
},
- //Enable rollovers
+ //Enables rollovers
enableRollover: function () {
//Enables panel on click
- $('#Tour').bind("mousemove", function(e) {
+ $('#Tour').bind("mousemove mouseout", function(e) {
if (tour.isInside(e.pageX, e.pageY)) {
tour.showAt(e.pageX, e.pageY);
} else {
tour.hideall();
}
});
},
+ //Gets client language
+ getLanguage: function () {
+ var lang = navigator.language;
+ if (lang == undefined) lang = navigator.userLanguage;
+ if (lang == undefined) return "";
+
+ //fr-be -> fr
+ var pos = lang.indexOf('-');
+ if (pos > -1) lang = lang.substring(0, pos);
+
+ return lang.toLowerCase();
+ },
+
//Initializes tour
init: function () {
- //this.enableRollover();
+ //Tries to localize
+ var lang = this.getLanguage();
+ if (this.langs.indexOf(lang) > -1) this.lang = lang;
+
+ //Runs tour animation
+ //The rollover will be enabled at anim end
this.run(900);
}
}
$(document).ready(function() {
- tour.lang = 'fr';
- tour.init();
+ tour.init();
});
\ No newline at end of file
diff --git a/lang/en/core.conf b/lang/en/core.conf
index d09fa46..1c54265 100644
--- a/lang/en/core.conf
+++ b/lang/en/core.conf
@@ -1,93 +1,102 @@
#Zed language config file
#Language: English
#Code: fr
#Author: Dereckson
###
-### General stuff
+### Site configuration
###
SiteTitle = Zed
Product = "<strong>Zed 0.1</strong>, alpha technical preview"
###
### General stuff
###
_t = ":"
###
### Login
###
Login = Login
Password = Password
OK = OK
LoginNotFound = Login not found.
IncorrectPassword = Incorrect password.
JaMata = Ja mata!
WelcomeBack = Welcome back.
OpenID = OpenID
Logout = Logout
###
### Errors
###
UnauthorizedAccess = "Unauthorized access"
SQLError = "SQL Error"
line = line
Error = Error
BackToHome = "Back to homepage"
FatalErrorScreen = Fatal error screen
FatalErrorInterrupt = Fatal error breaking screen
GeneralError = General error
###
### Homepage
###
Welcome = Welcome
+WelcomeText = "<p>Welcome to the Zed alpha technical preview. Zed, it's a mix between a gallery, a place to meet new and existing friends, with some RPG inspiration.<br />
+The concept is to have each information stored at physical places in a virtual world, like the 80s cyberspace vision. Another goal is to build a community sharing values like cooperation, freedom, ethic.</p>"
###
### Homepage - messages
###
#messages.tpl, Reply
Reply = Reply
#messages.tpl, the X link title
DeleteThisMessage = Delete this message
#home.php, messages error
MessageDeleted = Message deleted.
NotYourMessage = This message is not one of yours.
MessageAlreadyDeleted = Message already deleted.
###
### Perso create/select
###
NewCharacterCreated = New character created
CreateCharacter = Create a character
EditCharacter = Edit %s information
NoSexSpecified = "Pick a sex, or '<em>Neutral</em>' if you don't want to tell it."
NoNicknameSpecified = "You must pick a nickname, it's like your login to identify your character."
NoFullnameSpecified = "All beings must have a name."
NoRaceSpecified = "You've to specify a race: '<em>humanoid</em>' for human and co.<br />If you don't want to specify a race, use the generic '<em>being</em>'."
NicknameUnavailable = "This nickname is already used.<br />Choose a more original one."
NewLocationNotify = "You're slowly awaking in a place you don't recognize."
###
### Places
###
UnknownBody = "Unknown asteroid"
UnknownPlace = "Unknown place"
-WherePlace = "%s @ %s"
\ No newline at end of file
+WherePlace = "%s @ %s"
+
+hypership = hypership
+asteroid = asteroid
+moon = moon
+planet = planet
+star = star
+orbital = orbital
\ No newline at end of file
diff --git a/lang/en/tutorials.conf b/lang/en/tutorials.conf
new file mode 100644
index 0000000..ca5bd3f
--- /dev/null
+++ b/lang/en/tutorials.conf
@@ -0,0 +1,7 @@
+[ReachHypership]
+WhereYouAre = You're on %1$s, a desolate %2$s in the galaxy.
+WhereTheHypershipIs = After some investigation, you learn the hypership is in a far galaxy spiral.
+HowToJoinIt = "To reach it, you can: <ul><li>hitchhike, if there are other people around going to the hypership.</li>
+ <li>try to <a href=/index.php/request/B00001/aid.reach>contact the hypership and ask a shuttle</a></li>
+ <li>hire a ship</li>
+</ul>"
\ No newline at end of file
diff --git a/lang/fr/core.conf b/lang/fr/core.conf
index a057e78..1791980 100644
--- a/lang/fr/core.conf
+++ b/lang/fr/core.conf
@@ -1,91 +1,101 @@
#Zed language config file
#Language: English
#Code: fr
#Author: Dereckson
###
### Site configuration
###
SiteTitle = Zed
Product = "<strong>Zed 0.1</strong>, alpha technical preview"
###
### General stuff
###
_t = " :"
###
### Login
###
Login = Login
Password = Password
OK = OK
LoginNotFound = Login introuvable.
IncorrectPassword = Mot de passe incorrect.
JaMata = Ja mata!
WelcomeBack = Welcome back.
OpenID = OpenID
Logout = Déconnexion
###
### Homepage
###
Welcome = Bienvenue
+WelcomeText = "<p>Bienvenue sur la version alpha de Zed, un hybride un peu étrange entre une galerie, un endroit où rencontrer ses amis ou s'en faire de nouveaux, avec une légère inspiration RPG, dans un environnement galactique inspiré des romans de la Culture de Iain M. Banks.</p>
+<p>Le concept est d'expérimenter ce qui se passe lorsque chaque information est dans un espace précis, un peu comme la vision cyberpunk des années 80 du cyberespace. Un autre but est de créer une communauté partagant des valeurs de respect, de coopération, de liberté et d'éthique.</p>"
+
###
### Homepage - Messages
###
#messages.tpl, Reply
Reply = Répondre
#messages.tpl, the X link title
DeleteThisMessage = Effacer ce message
#home.php, messages error
MessageDeleted = Message effacé.
NotYourMessage = Hey, ce message appartient à autrui !
MessageAlreadyDeleted = Message déjà effacé
###
### Errors
###
UnauthorizedAccess = "Accès non autorisé"
SQLError = "Erreur dans la requête SQL"
line = ligne
Error = Erreur
BackToHome = "Retour à la page d'accueil"
FatalErrorScreen = Fatal error screen
FatalErrorInterrupt = Fatal error screen (interruption)
GeneralError = "Erreur"
###
### Perso create/select
###
NewCharacterCreated = Nouveau perso créé.
CreateCharacter = Nouveau perso
EditCharacter = Éditer les infos de %s
NoSexSpecified = "Pick a sex, or '<em>Neutral</em>' if you don't want to tell it."
NoNicknameSpecified = "You must pick a nickname, it's like your login to identify your character."
NoFullnameSpecified = "All beings must have a name."
NoRaceSpecified = "You've to specify a race: '<em>humanoid</em>' for human and co.<br />If you don't want to specify a race, use the generic '<em>being</em>'."
NicknameUnavailable = "This nickname is already used.<br />Choose a more original one."
###
### Places
###
UnknownBody = "Astéroïde inconnu"
UnknownPlace = "Endroit inconnu"
-WherePlace = "%2$s, %1$s."
\ No newline at end of file
+WherePlace = "%2$s, %1$s."
+
+hypership = hypership
+asteroid = astéroïde
+moon = lune
+planet = planète
+star = étoile
+orbital = orbitale
\ No newline at end of file
diff --git a/skins/zed/error.tpl b/skins/zed/error.tpl
index 2d47b8e..8407f81 100644
--- a/skins/zed/error.tpl
+++ b/skins/zed/error.tpl
@@ -1,41 +1,43 @@
<!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">
<head>
<title>{#SiteTitle#}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/css/960.css" media="screen" />
<link rel="stylesheet" href="/css/zed/theme.css" />
</head>
<body>
<div class="container_16">
{if $WAP}
<!-- WAP -->
<div class="grid_16 alpha omega">
<div class="wap">{$WAP}</div>
</div>
{/if}
{if $NOTIFY}
<!-- Notify -->
<div class="grid_16 alpha omega">
<div class="notify">{$NOTIFY}</div>
</div>
{/if}
<div class="grid_16 alpha omega">
<h1>{$TITLE}</h1>
<p>{$ERROR_TEXT}</p>
<p><a href="/">{#BackToHome#}</a></p>
</div>
<div class="clear"></div>
<hr />
- <div class="grid_12 alpha">
- <p>[ {#Product#} / {#FatalErrorScreen#} ]</p>
- </div>
- <div class="grid_4 omega">
- <p style="text-align: right">[ <a href="/?action=user.logout">{#Logout#}</a> ]</p>
+ <div id="footer">
+ <div class="grid_12 alpha">
+ <p>[ {#Product#} / {#FatalErrorScreen#} ]</p>
+ </div>
+ <div class="grid_4 omega">
+ <p style="text-align: right">[ <a href="/?action=user.logout">{#Logout#}</a> ]</p>
+ </div>
</div>
</div>
</body>
</html>
\ No newline at end of file
diff --git a/skins/zed/footer.tpl b/skins/zed/footer.tpl
index 75a2a35..e867665 100644
--- a/skins/zed/footer.tpl
+++ b/skins/zed/footer.tpl
@@ -1,12 +1,14 @@
<div class="clear"></div>
{include file="smartline.tpl"}
<hr />
- <div class="grid_12 alpha">
- <p>[ {#Product#} / {$CurrentPerso->location_global} / {if $screen}{$screen}{else}Untitled screen{/if} ]</p>
- </div>
- <div class="grid_4 omega" style="float: right">
- <p style="text-align: right">[ <a href="/?action=user.logout">{#Logout#}</a> ]</p>
+ <div id="footer">
+ <div class="grid_12 alpha">
+ <p>[ {#Product#} / {$CurrentPerso->location_global} {$CurrentPerso->location_local} / {if $screen}{$screen}{else}Untitled screen{/if} ]</p>
+ </div>
+ <div class="grid_4 omega" style="float: right">
+ <p style="text-align: right">[ <a href="/?action=user.logout">{#Logout#}</a> ]</p>
+ </div>
</div>
</div>
</body>
</html>
\ No newline at end of file
diff --git a/skins/zed/header.tpl b/skins/zed/header.tpl
index f742a78..cc6b2cd 100644
--- a/skins/zed/header.tpl
+++ b/skins/zed/header.tpl
@@ -1,38 +1,44 @@
<!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">
<head>
<title>{$PAGE_TITLE} - {#SiteTitle#}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/css/960.css" media="screen" />
<link rel="stylesheet" href="/css/zed/theme.css" />
<script src="/js/misc.js"></script>
</head>
<body>
<div class="container_16">
<!-- Header -->
<div class="grid_16">
<div class="wall">
<p>
{$WALL_TEXT}
<br /><span class="wall_info">-- <a href="{$WALL_USER_URL}">{$WALL_USER}</a></span>
</p>
</div>
</div>
<div class="clear"></div>
{if $WAP}
<!-- WAP -->
<div class="grid_16 alpha omega">
<div class="wap">{$WAP}</div>
</div>
+ <div class="clear"></div>
{/if}
{if $NOTIFY}
<!-- Notify -->
<div class="grid_16 alpha omega">
<div class="notify">{$NOTIFY}</div>
</div>
+ <div class="clear"></div>
{/if}
+<p class="info">
+ <strong>Current location</strong> {$CurrentPerso->where()}<br />
+ <strong>Hypership time</strong> <span id="HypershipTime">{get_hypership_time()}</span>
+</p>
{if $SmartLine_STDOUT || $SmartLine_STDERR}
{include file="smartline_results.tpl"}
{/if}
\ No newline at end of file
diff --git a/skins/zed/home.tpl b/skins/zed/home.tpl
index cd41ec7..4891b30 100644
--- a/skins/zed/home.tpl
+++ b/skins/zed/home.tpl
@@ -1,2 +1,2 @@
-<p><strong>Current location:</strong> {$CurrentPerso->where()}</p>
-<p><strong>Hypership time:</strong> {get_hypership_time()}</p>
\ No newline at end of file
+<h1>{#Welcome#}</h1>
+<div style="text-align: justify; text-indent: 2em;">{#WelcomeText#}</div>
\ No newline at end of file
diff --git a/skins/zed/smartline.tpl b/skins/zed/smartline.tpl
index eb9c9de..37f84f2 100644
--- a/skins/zed/smartline.tpl
+++ b/skins/zed/smartline.tpl
@@ -1,23 +1,23 @@
<!-- SmartLine -->
<div class="grid_16 alpha omega" id="SmartLine">
<!-- SmartLine line -->
- <form method="post" name="SmartLine">
+ <form method="post" name="SmartLine" action="{get_url()}">
{if $SmartLineHistory}
<div class="grid_4 left alpha">
<select name="SmartLineHistory" id="SmartLineHistory" class="black" onChange=UpdateSmartLine()>
<option value="">[ {#SmartLineHistory#} ]</option>
{foreach from=$SmartLineHistory item=command}
<option value="{$command->text|escape}">{$command->time} | {$command->text|escape}</option>
{/foreach}
</select>
</div>
<div class="grid_12 right omega">
{else}
<div class="grid_16 alpha omega left" style="width: 100.2%">
{/if}
<input name="C" type="text" id="SmartLineBar" maxlength=255 class="black" style="text-align: left;">
</div>
</form>
</div>
<div class="clear"></div>
\ No newline at end of file
diff --git a/skins/zed/tutorial/dojo.tpl b/skins/zed/tutorial/dojo.tpl
new file mode 100644
index 0000000..f160ae1
--- /dev/null
+++ b/skins/zed/tutorial/dojo.tpl
@@ -0,0 +1,2 @@
+ <!-- DOJO -->
+ <script type="text/javascript" src="/js/dojo/dojo/dojo.js" djConfig="isDebug:false, parseOnLoad: true" ></script>
\ No newline at end of file
diff --git a/skins/zed/tutorial/hypership_reach.tpl b/skins/zed/tutorial/hypership_reach.tpl
new file mode 100644
index 0000000..1d84fb1
--- /dev/null
+++ b/skins/zed/tutorial/hypership_reach.tpl
@@ -0,0 +1,18 @@
+ <!-- Floating panes -->
+ <script type="text/javascript" src="/js/dojo/dojox/layout/FloatingPane.js"></script>
+ <link rel="stylesheet" type="text/css" href="/js/dojo/dojox/layout/resources/FloatingPane.css" />
+ <link rel="stylesheet" type="text/css" href="/js/dojo/dojox/layout/resources/ResizeHandle.css" />
+
+ <!-- Dock -->
+ <style type="text/css">
+ @import "/js/dojo/dojo/resources/dojo.css";
+ @import "/js/dojo/dijit/themes/dijit.css";
+ @import "/js/dojo/dijit/themes/tundra/tundra.css";
+ </style>
+
+ <!-- Help to reach the hypership -->
+ <div dojoType="dojox.layout.FloatingPane" title="Join the hypership" resizable="true" id="floaterHypershipReach" class="floatingPaneTutorial" duration="300">
+ <p>{sprintf(#WhereYouAre#, $CurrentPerso->where(), lang_get($CurrentPerso->location->body_kind))}</p>
+ <p>{#WhereTheHypershipIs#}</p>
+ <p>{#HowToJoinIt#}</p>
+ </div>
\ No newline at end of file
diff --git a/tour.html b/tour.html
index c8617dd..2c0c1da 100644
--- a/tour.html
+++ b/tour.html
@@ -1,48 +1,46 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Enter</title>
<link rel="stylesheet" type="text/css" href="/css/grid.css" media="screen" />
- <script src="/js/misc.js"></script>
<script src="/js/jquery-1.3.2.min.js"></script>
<script src="/js/dimensions.js"></script>
<script src="/js/tour.js"></script>
<script>
</script>
<style>
body {
background-color: #343434;
}
H1 {
font-family: Helvetica, Arial;
}
#Tour {
background-image: url(img/tour/bg.jpg);
height: 748px;
width: 748px;
margin: auto auto auto auto;
z-index: 20;
}
#TourHighlight {
position: relative;
z-index: 50;
}
</style>
</head>
<body>
<div class="container_16">
<div class="grid_16">
<div id="Tour">
- <!-- <div id="TourMenu"><img src="/img/tour/bg.jpg" /></div> -->
<div id="TourHighlight"></div>
</div>
</div>
<div class="clear"></div>
</div>
</body>
</html>
\ No newline at end of file

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 23, 09:17 (1 d, 7 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
20826
Default Alt Text
(80 KB)

Event Timeline