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/dev/schema-mysql.sql b/dev/schema-mysql.sql
new file mode 100644
index 0000000..a7a7d0a
--- /dev/null
+++ b/dev/schema-mysql.sql
@@ -0,0 +1,633 @@
+-- phpMyAdmin SQL Dump
+-- version 3.3.3
+-- http://www.phpmyadmin.net
+--
+-- Serveur: localhost
+-- Généré le : Sam 17 Juillet 2010 à 19:37
+-- Version du serveur: 5.5.4
+-- Version de PHP: 5.3.2
+
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+
+--
+-- Base de données: `zed`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `api_keys`
+--
+
+CREATE TABLE IF NOT EXISTS `api_keys` (
+ `key_guid` varchar(36) NOT NULL,
+ `key_active` tinyint(1) unsigned NOT NULL DEFAULT '1',
+ `key_description` tinytext,
+ `key_hits` bigint(20) NOT NULL DEFAULT '0',
+ `key_lastcall` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`key_guid`),
+ KEY `key_active` (`key_active`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Contenu de la table `api_keys`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Doublure de structure pour la vue `content`
+--
+CREATE TABLE IF NOT EXISTS `content` (
+`content_id` mediumint(8) unsigned
+,`location_global` varchar(9)
+,`location_local` varchar(255)
+,`location_k` smallint(5) unsigned
+,`content_path` varchar(255)
+,`user_id` smallint(5)
+,`perso_id` smallint(5)
+,`content_title` varchar(255)
+);
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `content_files`
+--
+
+CREATE TABLE IF NOT EXISTS `content_files` (
+ `content_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+ `content_path` varchar(255) NOT NULL,
+ `user_id` smallint(5) NOT NULL,
+ `perso_id` smallint(5) NOT NULL,
+ `content_title` varchar(255) NOT NULL,
+ PRIMARY KEY (`content_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
+
+--
+-- Contenu de la table `content_files`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `content_locations`
+--
+
+CREATE TABLE IF NOT EXISTS `content_locations` (
+ `location_global` varchar(9) NOT NULL,
+ `location_local` varchar(255) NOT NULL,
+ `location_k` smallint(5) unsigned NOT NULL,
+ `content_id` mediumint(8) unsigned NOT NULL,
+ PRIMARY KEY (`location_global`,`location_local`,`location_k`),
+ KEY `content_id` (`content_id`),
+ KEY `location_global` (`location_global`,`location_local`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+--
+-- Contenu de la table `content_locations`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `geo_bodies`
+--
+
+CREATE TABLE IF NOT EXISTS `geo_bodies` (
+ `body_code` mediumint(5) unsigned zerofill NOT NULL AUTO_INCREMENT,
+ `body_name` varchar(31) NOT NULL,
+ `body_status` set('hypership','asteroid','moon','planet','star','orbital','hidden') DEFAULT NULL,
+ `body_location` varchar(15) DEFAULT NULL,
+ `body_description` text,
+ PRIMARY KEY (`body_code`),
+ KEY `body_status` (`body_status`),
+ FULLTEXT KEY `text` (`body_name`,`body_description`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
+
+--
+-- Contenu de la table `geo_bodies`
+--
+
+INSERT INTO `geo_bodies` (`body_code`, `body_name`, `body_status`, `body_location`, `body_description`) VALUES
+(00001, 'Hypership', 'hypership', NULL, NULL),
+(00002, 'Xen', 'asteroid', NULL, NULL),
+(00003, 'Kaos', 'asteroid', NULL, NULL);
+
+-- --------------------------------------------------------
+
+--
+-- Doublure de structure pour la vue `geo_locations`
+--
+CREATE TABLE IF NOT EXISTS `geo_locations` (
+`location_code` varchar(9)
+,`location_name` varchar(255)
+);
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `geo_places`
+--
+
+CREATE TABLE IF NOT EXISTS `geo_places` (
+ `place_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+ `body_code` mediumint(5) unsigned zerofill NOT NULL,
+ `place_code` smallint(3) unsigned zerofill NOT NULL,
+ `place_name` varchar(255) NOT NULL,
+ `place_description` longtext NOT NULL,
+ `place_status` set('start','hidden') DEFAULT NULL,
+ PRIMARY KEY (`place_id`),
+ UNIQUE KEY `body_id` (`body_code`,`place_code`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
+
+--
+-- Contenu de la table `geo_places`
+--
+
+INSERT INTO `geo_places` (`place_id`, `body_code`, `place_code`, `place_name`, `place_description`, `place_status`) VALUES
+(1, 00001, 001, 'Tour', 'Tour circulaire, surplombant l''hypership, offrant une vue circulaire sur l''espace (ou l''ultraespace, ou l''hyperespace) et une rotonde aux derniers étages.\r\n\r\n== Toponymie numérique ==\r\nChaque niveau (correspondant à un secteur, identifié par la lettre T suivi du niveau, en partant du haut) est divisé en 6 couloirs d''approximativement 60°.', NULL),
+(2, 00001, 002, 'Core', 'Le c.ur de l''hypership, son centre de gravité et les 8 cubes l''entourant.\r\n\r\n== Toponymie numérique ==\r\nLe core est divisé en 9 secteurs : C0 pour le centre de gravité, C1 à C4 pour les cubes de la couche inférieure, C5 à C8 pour les cubes de la couche supérieure.', NULL),
+(3, 00002, 001, 'Algir', '', NULL),
+(4, 00003, 001, 'Zeta', '', 'start'),
+(5, 00001, 003, 'Bays', 'Baies permettant d''accueillir divers vaisseaux au sein de l''hypership.', NULL);
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `log_smartline`
+--
+
+CREATE TABLE IF NOT EXISTS `log_smartline` (
+ `command_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `perso_id` smallint(5) unsigned DEFAULT NULL,
+ `command_time` int(10) DEFAULT NULL,
+ `command_text` varchar(255) DEFAULT NULL,
+ `isError` tinyint(1) DEFAULT '0',
+ PRIMARY KEY (`command_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Contenu de la table `log_smartline`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `messages`
+--
+
+CREATE TABLE IF NOT EXISTS `messages` (
+ `message_id` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `message_date` int(11) NOT NULL DEFAULT '0',
+ `message_from` varchar(4) NOT NULL DEFAULT '0',
+ `message_to` varchar(4) NOT NULL DEFAULT '0',
+ `message_text` longtext NOT NULL,
+ `message_flag` tinyint(4) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`message_id`),
+ KEY `message_to` (`message_to`),
+ KEY `message_flag` (`message_flag`),
+ KEY `message_date` (`message_date`),
+ KEY `inbox` (`message_to`,`message_flag`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Contenu de la table `messages`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `motd`
+--
+
+CREATE TABLE IF NOT EXISTS `motd` (
+ `motd_id` int(11) NOT NULL AUTO_INCREMENT,
+ `perso_id` int(11) NOT NULL,
+ `motd_text` varchar(255) NOT NULL,
+ `motd_date` int(10) NOT NULL,
+ PRIMARY KEY (`motd_id`),
+ KEY `perso_id` (`perso_id`),
+ KEY `motd_date` (`motd_date`),
+ FULLTEXT KEY `motd_text` (`motd_text`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=25 ;
+
+--
+-- Contenu de la table `motd`
+--
+
+INSERT INTO `motd` (`motd_id`, `perso_id`, `motd_text`, `motd_date`) VALUES
+(24, 4960, 'You''re on the *DEVELOPMENT AND TESTING server (database zed, using the repo hg)*', 1279161701);
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `pages`
+--
+
+CREATE TABLE IF NOT EXISTS `pages` (
+ `page_id` int(11) NOT NULL AUTO_INCREMENT,
+ `page_code` varchar(31) NOT NULL,
+ `page_title` varchar(255) NOT NULL,
+ `page_content` longtext NOT NULL,
+ PRIMARY KEY (`page_id`),
+ UNIQUE KEY `page_code` (`page_code`),
+ FULLTEXT KEY `page_text` (`page_code`,`page_title`,`page_content`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
+
+--
+-- Contenu de la table `pages`
+--
+
+INSERT INTO `pages` (`page_id`, `page_code`, `page_title`, `page_content`) VALUES
+(3, 'ArtworkCredits', 'Artwork credits', '<h2>Login screen</h2>\r\n<p>Wires and blocks use following tutorials:</p>\r\n<ul>\r\n <li><a href="http://www.tutorio.com/tutorial/futuristic-decay-interface">Futuristic Decay Interface</a></li>\r\n <li><a href="http://www.tutorio.com/tutorial/photoshop-wire-tutorial">Photoshop Wire Tutorial</a></li>\r\n</ul>\r\n<h2>Hypership</h2>\r\n<h3>Gallery tower</h3>\r\n<p>Technical schemas Dereckson. In the future, some could contain technical shapes Photoshop brushes, by <a href="http://scully7491.deviantart.com/">scully7491</a>.</p>\r\n<p>Portholes structure (c) Richard Carpenter, Six Revisions.<br />\r\nA <a href="http://sixrevisions.com/tutorials/photoshop-tutorials/how-to-design-a-space-futuristic-gallery-layout-in-photoshop/">tutorial is available here</a>.</p>\r\n<p>When the hypership is in hyperspace mode, portholes prints a colored background by <a href="http://www.sxc.hu/profile/ilco">ilco</a>.<br />\r\nWhen reaching a system, it prints a scene excerpt.</p>\r\n<h3>Core cancelled sector</h3>\r\n<p>Photographies: J&eacute;r&ocirc;me<br />\r\nEditing: Dereckson</p>\r\n<h2>Scenes</h2>\r\n<h3>Xen and Kaos</h3>\r\n<p>Scene composed from 2 wallpapers from Interfacelift, n&deg; 587 and 781.</p>\r\n<h2>Future sources</h2>\r\n<h3>Fasticon</h3>\r\n<p>It''s possible in the future some http://www.fasticon.com/ icons are added.</p>\r\n<h4>Comic Tiger</h4>\r\n<p>(c) <a href="mailto:dirceu@fasticon.com">Dirceu Veiga</a> - FastIcon Studio.<br />\r\n<strong>License:</strong> All Icons on the Fast Icon &quot;Download&quot; page are are FREEWARE, but to use our Icons in your software, web site, in a theme or other project, <a href="mailto:contact@fasticon.com">you need our permission first</a>. You don''t need permission for personal use our Icons on your computer.</p>');
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `pages_edits`
+--
+
+CREATE TABLE IF NOT EXISTS `pages_edits` (
+ `page_edit_id` int(11) NOT NULL AUTO_INCREMENT,
+ `page_code` varchar(255) DEFAULT NULL,
+ `page_version` smallint(6) NOT NULL DEFAULT '0',
+ `page_title` varchar(255) NOT NULL DEFAULT '',
+ `page_content` longtext,
+ `page_edit_reason` varchar(255) DEFAULT NULL,
+ `page_edit_user_id` smallint(4) unsigned DEFAULT NULL,
+ `page_edit_time` int(10) DEFAULT NULL,
+ PRIMARY KEY (`page_edit_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
+
+--
+-- Contenu de la table `pages_edits`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `persos`
+--
+
+CREATE TABLE IF NOT EXISTS `persos` (
+ `user_id` smallint(4) DEFAULT NULL,
+ `perso_id` smallint(4) NOT NULL DEFAULT '0',
+ `perso_name` varchar(255) NOT NULL DEFAULT '',
+ `perso_nickname` varchar(31) NOT NULL DEFAULT '',
+ `perso_race` varchar(31) NOT NULL DEFAULT '',
+ `perso_sex` enum('M','F','N','2') NOT NULL DEFAULT 'M',
+ `perso_avatar` varchar(255) DEFAULT NULL,
+ `location_global` varchar(9) DEFAULT 'B00001001',
+ `location_local` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`perso_id`),
+ UNIQUE KEY `nickname` (`perso_nickname`),
+ KEY `race` (`perso_race`),
+ KEY `user_id` (`user_id`),
+ KEY `location_global` (`location_global`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Contenu de la table `persos`
+--
+
+INSERT INTO `persos` (`user_id`, `perso_id`, `perso_name`, `perso_nickname`, `perso_race`, `perso_sex`, `perso_avatar`, `location_global`, `location_local`) VALUES
+(2600, 4960, 'Lorem Ipsum', 'demo', 'humanoid', 'M', '', 'B00003001', '1');
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `persos_flags`
+--
+
+CREATE TABLE IF NOT EXISTS `persos_flags` (
+ `flag_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `perso_id` smallint(6) NOT NULL DEFAULT '0',
+ `flag_key` varchar(255) NOT NULL,
+ `flag_value` varchar(512) NOT NULL,
+ PRIMARY KEY (`flag_id`),
+ UNIQUE KEY `persoflag` (`perso_id`,`flag_key`),
+ KEY `perso_id` (`perso_id`),
+ KEY `flag_key` (`flag_key`),
+ KEY `flag` (`flag_key`(127),`flag_value`(199))
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=459 ;
+
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `persos_notes`
+--
+
+CREATE TABLE IF NOT EXISTS `persos_notes` (
+ `perso_id` smallint(4) NOT NULL,
+ `note_code` varchar(63) NOT NULL,
+ `note_text` longtext NOT NULL,
+ PRIMARY KEY (`perso_id`,`note_code`),
+ KEY `perso_id` (`perso_id`),
+ KEY `note_code` (`note_code`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+--
+-- Contenu de la table `persos_notes`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `ports`
+--
+
+CREATE TABLE IF NOT EXISTS `ports` (
+ `port_id` smallint(6) NOT NULL AUTO_INCREMENT,
+ `location_global` char(9) NOT NULL,
+ `location_local` varchar(255) NOT NULL,
+ `port_name` varchar(63) NOT NULL,
+ `port_status` set('hidden','requiresPTA') NOT NULL,
+ PRIMARY KEY (`port_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
+
+--
+-- Contenu de la table `ports`
+--
+
+INSERT INTO `ports` (`port_id`, `location_global`, `location_local`, `port_name`, `port_status`) VALUES
+(1, 'B00003001', '3', 'Le Dôme de Thétys', ''),
+(2, 'B00001003', '', 'Hypership''s general bays', '');
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `profiles` (
+ `perso_id` int(11) NOT NULL,
+ `profile_text` longtext NOT NULL,
+ `profile_updated` int(10) NOT NULL,
+ `profile_fixedwidth` tinyint(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`perso_id`),
+ KEY `profile_fixedwidth` (`profile_fixedwidth`),
+ KEY `profile_updated` (`profile_updated`),
+ FULLTEXT KEY `profile` (`profile_text`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Contenu de la table `profiles`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `profiles_comments`
+--
+
+CREATE TABLE IF NOT EXISTS `profiles_comments` (
+ `comment_id` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `perso_id` smallint(5) unsigned NOT NULL,
+ `comment_author` smallint(5) unsigned NOT NULL,
+ `comment_date` int(10) NOT NULL,
+ `comment_text` text NOT NULL,
+ PRIMARY KEY (`comment_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
+
+--
+-- Contenu de la table `profiles_comments`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `profiles_photos`
+--
+
+CREATE TABLE IF NOT EXISTS `profiles_photos` (
+ `photo_id` int(11) NOT NULL AUTO_INCREMENT,
+ `perso_id` smallint(6) NOT NULL,
+ `photo_name` varchar(63) NOT NULL,
+ `photo_description` varchar(63) NOT NULL,
+ `photo_avatar` tinyint(4) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`photo_id`),
+ UNIQUE KEY `photo_name` (`photo_name`),
+ KEY `user_id` (`perso_id`),
+ KEY `photo_avatar` (`photo_avatar`),
+ KEY `user_avatar` (`perso_id`,`photo_avatar`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Contenu de la table `profiles_photos`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `profiles_tags`
+--
+
+CREATE TABLE IF NOT EXISTS `profiles_tags` (
+ `perso_id` int(11) NOT NULL,
+ `tag_code` varchar(31) NOT NULL,
+ `tag_class` varchar(15) NOT NULL DEFAULT 'music',
+ PRIMARY KEY (`perso_id`,`tag_code`),
+ KEY `tag_code` (`tag_code`),
+ KEY `tag_class` (`tag_class`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Contenu de la table `profiles_tags`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `registry`
+--
+
+CREATE TABLE IF NOT EXISTS `registry` (
+ `registry_key` varchar(63) NOT NULL,
+ `registry_value` longtext NOT NULL,
+ `registry_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`registry_key`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Contenu de la table `registry`
+--
+
+INSERT INTO `registry` (`registry_key`, `registry_value`, `registry_updated`) VALUES
+('api.ship.session.S00001.Demios0001', '1148', '2010-07-04 15:18:04');
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `sessions`
+--
+
+CREATE TABLE IF NOT EXISTS `sessions` (
+ `session_id` varchar(32) NOT NULL DEFAULT '',
+ `Where` tinyint(4) NOT NULL DEFAULT '1',
+ `IP` varchar(8) NOT NULL DEFAULT '',
+ `user_id` smallint(5) NOT NULL DEFAULT '-1',
+ `perso_id` smallint(6) DEFAULT NULL,
+ `Skin` varchar(31) NOT NULL DEFAULT 'zed',
+ `Skin_accent` varchar(31) NOT NULL DEFAULT '',
+ `online` tinyint(4) NOT NULL DEFAULT '1',
+ `HeureLimite` varchar(15) NOT NULL DEFAULT '',
+ `SessionLimite` varchar(15) NOT NULL DEFAULT '',
+ PRIMARY KEY (`session_id`),
+ KEY `Where` (`Where`),
+ KEY `HeureLimite` (`HeureLimite`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 COMMENT='Sessions @ Pluton';
+
+--
+-- Contenu de la table `sessions`
+--
+
+INSERT INTO `sessions` (`session_id`, `Where`, `IP`, `user_id`, `perso_id`, `Skin`, `Skin_accent`, `online`, `HeureLimite`, `SessionLimite`) VALUES
+('11o5p5fpacnoutbc2pgvh03ih1', 21, '0a000004', -1, NULL, 'zed', '', 1, '1279392190', '1279399090'),
+('74ue7g6k02e6k7bfirqudmhgi7', 21, '0a000004', -1, NULL, 'zed', '', 1, '1279392191', '1279399091'),
+('tu8otohbqlhknmt0atiuk850r6', 21, '0a000004', 2600, 4960, 'zed', '', 1, '1279392446', '1279399346'),
+('395f7o7pme0dkt32df8h8reo66', 21, '0a000004', -1, NULL, 'zed', '', 1, '1279392191', '1279399091'),
+('klss5iti1bf6vja6a6ibd48j02', 21, '0a000004', -1, NULL, 'zed', '', 1, '1279392193', '1279399093'),
+('ai71qqkde5hbbjc14sh4dj87o1', 21, '0a000004', -1, NULL, 'zed', '', 1, '1279392194', '1279399094');
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `ships`
+--
+
+CREATE TABLE IF NOT EXISTS `ships` (
+ `ship_id` mediumint(5) unsigned zerofill NOT NULL AUTO_INCREMENT,
+ `ship_name` varchar(63) NOT NULL,
+ `location_global` char(9) DEFAULT NULL,
+ `location_local` varchar(255) NOT NULL,
+ `api_key` varchar(36) NOT NULL,
+ `ship_description` text NOT NULL,
+ PRIMARY KEY (`ship_id`),
+ UNIQUE KEY `ship_name` (`ship_name`),
+ KEY `location` (`location_global`),
+ KEY `api_key` (`api_key`),
+ FULLTEXT KEY `ship_name_2` (`ship_name`,`ship_description`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
+
+--
+-- Contenu de la table `ships`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Doublure de structure pour la vue `ships_sessions`
+--
+CREATE TABLE IF NOT EXISTS `ships_sessions` (
+`ship_id` varchar(5)
+,`session_id` varchar(165)
+,`perso_id` longtext
+,`session_updated` bigint(10)
+);
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `users`
+--
+
+CREATE TABLE IF NOT EXISTS `users` (
+ `user_id` smallint(4) NOT NULL DEFAULT '0',
+ `username` varchar(11) NOT NULL DEFAULT '',
+ `user_password` varchar(32) NOT NULL DEFAULT '',
+ `user_active` tinyint(1) NOT NULL DEFAULT '0',
+ `user_actkey` varchar(11) DEFAULT NULL,
+ `user_email` varchar(63) NOT NULL DEFAULT '',
+ `user_regdate` int(10) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`user_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Contenu de la table `users`
+--
+-- Adds a default account with demo/demo as login/password
+--
+
+INSERT INTO `users` (`user_id`, `username`, `user_password`, `user_active`, `user_actkey`, `user_email`, `user_regdate`) VALUES
+(2600, 'demo', 'fe01ce2a7fbac8fafaed7c982a04e229', 1, NULL, 'lorem@ipsum.dol', 1279161321);
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `users_invites`
+--
+
+CREATE TABLE IF NOT EXISTS `users_invites` (
+ `invite_code` char(6) NOT NULL,
+ `invite_date` int(10) NOT NULL,
+ `invite_from_user_id` smallint(5) NOT NULL,
+ `invite_from_perso_id` smallint(5) NOT NULL,
+ `invite_to_user_id` smallint(5) DEFAULT NULL,
+ PRIMARY KEY (`invite_code`),
+ KEY `invite_to_user_id` (`invite_to_user_id`),
+ KEY `invite_from_user_id` (`invite_from_user_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Contenu de la table `users_invites`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `users_openid`
+--
+
+CREATE TABLE IF NOT EXISTS `users_openid` (
+ `openid_id` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `openid_url` varchar(255) NOT NULL,
+ `user_id` mediumint(9) NOT NULL,
+ PRIMARY KEY (`openid_id`),
+ UNIQUE KEY `openid_url` (`openid_url`),
+ KEY `user_id` (`user_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
+
+--
+-- Contenu de la table `users_openid`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la vue `content`
+--
+DROP TABLE IF EXISTS `content`;
+
+CREATE VIEW `content` AS select `cl`.`content_id` AS `content_id`,`cl`.`location_global` AS `location_global`,`cl`.`location_local` AS `location_local`,`cl`.`location_k` AS `location_k`,`cf`.`content_path` AS `content_path`,`cf`.`user_id` AS `user_id`,`cf`.`perso_id` AS `perso_id`,`cf`.`content_title` AS `content_title` from (`content_locations` `cl` join `content_files` `cf`) where (`cf`.`content_id` = `cl`.`content_id`);
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la vue `geo_locations`
+--
+DROP TABLE IF EXISTS `geo_locations`;
+
+CREATE VIEW `geo_locations` AS select concat(_utf8'B',convert(`geo_bodies`.`body_code` using utf8)) AS `location_code`,`geo_bodies`.`body_name` AS `location_name` from `geo_bodies` union select concat(_utf8'B',convert(`geo_places`.`body_code` using utf8),convert(`geo_places`.`place_code` using utf8)) AS `code`,`geo_places`.`place_name` AS `NAME` from `geo_places` union select concat(_utf8'S',convert(`ships`.`ship_id` using utf8)) AS `location_code`,`ships`.`ship_name` AS `location_name` from `ships`;
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la vue `ships_sessions`
+--
+DROP TABLE IF EXISTS `ships_sessions`;
+
+CREATE VIEW `ships_sessions` AS select substr(`registry`.`registry_key`,19,5) AS `ship_id`,substr(`registry`.`registry_key`,25) AS `session_id`,`registry`.`registry_value` AS `perso_id`,unix_timestamp(`registry`.`registry_updated`) AS `session_updated` from `registry` where (left(`registry`.`registry_key`,17) = _utf8'api.ship.session.');
+
diff --git a/includes/SmartLine/ZedCommands.php b/includes/SmartLine/ZedCommands.php
index 3bb1931..7508e3d 100644
--- a/includes/SmartLine/ZedCommands.php
+++ b/includes/SmartLine/ZedCommands.php
@@ -1,316 +1,371 @@
<?php
/*
* Zed
* (c) 2010, Dereckson, some rights reserved
* Released under BSD license
*
* SmartLine
*
* TODO: SettingsSmartLineCommand - understand why dojo floating pane isn't
* rendered if we est $controller instead to redirect
*/
///
/// Register commands
///
$smartLine->register_object('goto', 'GotoSmartLineCommand');
$smartLine->register_object('guid', 'GUIDSmartLineCommand');
$smartLine->register_object('invite', 'InviteSmartLineCommand');
$smartLine->register_object('invites', 'InviteSmartLineCommand');
$smartLine->register_object('list', 'ListSmartLineCommand');
$smartLine->register_object('requests', 'RequestsSmartLineCommand');
$smartLine->register_object('settings', 'SettingsSmartLineCommand');
$smartLine->register_object('unixtime', 'UnixTimeSmartLineCommand');
$smartLine->register_object('version', 'VersionSmartLineCommand');
$smartLine->register_object('whereami', 'WhereAmISmartLineCommand');
+///
+/// Help (todo: move $lang array in lang folder)
+///
+
+$lang['Help']['goto'] = "Go to a location";
+$lang['Help']['guid'] = "Generate a GUID";
+$lang['Help']['invite'] = "Generate an invite. To see the generated invites, invite list.";
+$lang['Help']['list'] = "Lists specified objects (bodies, locations or places)";
+$lang['Help']['requests'] = "Checks if there are waiting requests";
+$lang['Help']['unixtime'] = "Prints current unixtime (seconds elapsed since 1970-01-01 00:00, UTC) or the specified unixtime date.";
+$lang['Help']['version'] = "Gets Zed's software version info (Mercurial repository version, node id and if you're on the dev or prod site)";
+$lang['Help']['whereami'] = "Where am I?";
+
+///
+
+/*
+ * Zed
+ * (c) 2010, Dereckson, some rights reserved
+ * Released under BSD license
+ *
+ * SmartLine
+ *
+ * TODO: SettingsSmartLineCommand - understand why dojo floating pane isn't
+ * rendered if we est $controller instead to redirect
+ */
+
+///
+/// Register commands
+///
+
+$smartLine->register_object('goto', 'GotoSmartLineCommand');
+$smartLine->register_object('guid', 'GUIDSmartLineCommand');
+$smartLine->register_object('invite', 'InviteSmartLineCommand');
+$smartLine->register_object('invites', 'InviteSmartLineCommand');
+$smartLine->register_object('list', 'ListSmartLineCommand');
+$smartLine->register_object('requests', 'RequestsSmartLineCommand');
+$smartLine->register_object('settings', 'SettingsSmartLineCommand');
+$smartLine->register_object('unixtime', 'UnixTimeSmartLineCommand');
+$smartLine->register_object('version', 'VersionSmartLineCommand');
+$smartLine->register_object('whereami', 'WhereAmISmartLineCommand');
+
+
///
/// Help (todo: move $lang array in lang folder)
///
$lang['Help']['goto'] = "Go to a location";
$lang['Help']['guid'] = "Generate a GUID";
$lang['Help']['invite'] = "Generate an invite. To see the generated invites, invite list.";
$lang['Help']['list'] = "Lists specified objects (bodies, locations or places)";
$lang['Help']['requests'] = "Checks if there are waiting requests";
$lang['Help']['unixtime'] = "Prints current unixtime (seconds elapsed since 1970-01-01 00:00, UTC) or the specified unixtime date.";
$lang['Help']['version'] = "Gets Zed's software version info (Mercurial repository version, node id and if you're on the dev or prod site)";
$lang['Help']['whereami'] = "Where am I?";
///
/// goto
///
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");
+ require_once("includes/geo/location.php");
+
+ $here = new GeoLocation($CurrentPerso->location_global, $CurrentPerso->location_local);
+
try {
$place = new GeoLocation($argv[1]);
+
+ if ($place->equals($CurrentPerso->location_global)) {
+ $this->SmartLine->puts("You're already there.");
+ return;
+ }
} catch (Exception $ex) {
- $this->SmartLine->puts($ex->getMessage(), STDERR);
- return;
- }
-
- if ($place->equals($CurrentPerso->location_global)) {
- $this->SmartLine->puts("You're already there.");
- return;
- }
+ //Global location failed, trying local location
+ try {
+ $place = new GeoLocation($CurrentPerso->location_global, $argv[1]);
+ } catch (Exception $ex) {
+ $this->SmartLine->puts($ex->getMessage(), STDERR);
+ return;
+ }
+
+ if ($place->equals($here)) {
+ $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");
}
}
///
/// 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());
}
}
///
/// invite
///
class InviteSmartLineCommand extends SmartLineCommand {
public function run ($argv, $argc) {
require_once('includes/objects/invite.php');
global $CurrentUser, $CurrentPerso;
$command = ($argc > 1) ? strtolower($argv[1]) : '';
switch ($command) {
case 'list':
$codes = Invite::get_invites_from($CurrentPerso->id);
if (!count($codes)) {
$this->SmartLine->puts("No invite code.");
} else {
foreach ($codes as $code) {
$this->SmartLine->puts($code);
}
}
break;
case 'add':
case '':
$code = Invite::create($CurrentUser->id, $CurrentPerso->id);
$url = get_server_url() . get_url('invite', $code);
$this->SmartLine->puts("New invite code created: $code<br />Invite URL: $url");
break;
case 'del':
$code = $argv[2];
if (!preg_match("/^([A-Z]){3}([0-9]){3}$/i", $code)) {
$this->SmartLine->puts("Invalid code format. Use invite list to get all your invite codes.", STDERR);
} else {
$invite = new Invite($code);
if ($CurrentPerso->id == $invite->from_perso_id) {
$invite->delete();
$this->SmartLine->puts("Deleted");
} else {
$this->SmartLine->puts("Invalid code. Use invite list to get all your invite codes.", STDERR);
}
}
break;
default:
$this->SmartLine->puts("Usage: invite [add|list|del <code>]", STDERR);
break;
}
}
}
///
/// list
///
class ListSmartLineCommand extends SmartLineCommand {
public function run ($argv, $argc) {
if ($argc == 1) {
$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 cellspacing=\"8\"><thead style=\"color: white\" scope=\"row\"><tr><th>Key</th><th>Value</th></thead><tbody>$rows</tbody></table>";
}
}
///
/// Requests
///
class RequestsSmartLineCommand extends SmartLineCommand {
public function run ($argv, $argc) {
global $CurrentPerso;
$force = ($argc > 1) && ($argv[1] == "-f" || $argv[1] == "--force");
if ($force || (array_key_exists('site.requests', $CurrentPerso->flags) && $CurrentPerso->flags['site.requests'])) {
global $controller;
$controller = 'controllers/persorequest.php';
} else {
$this->SmartLine->puts("No request waiting.");
}
}
}
///
/// Settings
///
class SettingsSmartLineCommand extends SmartLineCommand {
public function run ($argv, $argc) {
if (headers_sent()) {
global $controller;
$controller = 'controllers/settings.php';
} else {
header('location: ' . get_url('settings'));
}
}
}
///
/// unixtime
///
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]));
$this->SmartLine->puts(get_hypership_time($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);
}
}
}
}
///
/// version
///
class VersionSmartLineCommand extends SmartLineCommand {
public function run ($argv, $argc) {
//Gets .hg revision
if (file_exists('.hg/tags.cache')) {
$content = file_get_contents('.hg/tags.cache');
$info = explode(' ', $content, 2);
$info[] = "development environment";
} else if (file_exists('.hg_archival.txt')) {
$content = file('.hg_archival.txt');
foreach ($content as $line) {
$items = explode(' ', $line, 2);
if ($items[0] == 'node:') $info[1] = trim($items[1]);
if ($items[0] == 'latesttagdistance:') $info[0] = trim($items[1]);
$info[2] = 'production environment';
}
} else {
$this->SmartLine->puts("No version information available.", STDERR);
return false;
}
$this->SmartLine->puts("r$info[0] ($info[2])");
$this->SmartLine->puts("Hash: $info[1]");
}
}
///
/// whereami
///
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);
}
}
?>
\ No newline at end of file
diff --git a/includes/geo/location.php b/includes/geo/location.php
index 9c592e9..c8cb188 100644
--- a/includes/geo/location.php
+++ b/includes/geo/location.php
@@ -1,340 +1,350 @@
<?php
require_once('body.php');
require_once('place.php');
require_once('point3D.php');
require_once('includes/objects/ship.php');
/*
* Geo location class
*
* 0.1 2010-01-28 18:52 DcK
*
* @package Zed
* @subpackage Geo
* @copyright Copyright (c) 2010, Dereckson
* @license Released under BSD license
* @version 0.1
*
* @todo initializes $point3D from $body or $ship own locations;
*
*/
class GeoLocation {
private $data;
/*
* @var GeoBody a body object
*/
public $body = null;
/*
* @var GeoPlace a place object
*/
public $place = null;
/*
* @var GeoPoint3D a point identified by x, y, z coordinates
*/
public $point3D = null;
/*
* @var Ship a ship object
*/
public $ship = null;
function __construct ($global = null, $local = null) {
if (!$global) {
$this->data = array();
} elseif (preg_match("/[BS][0-9]{5}[0-9]{3}/", $global)) {
$this->data[0] = $global;
} elseif (preg_match("/[BS][0-9]{5}/", $global)) {
$this->data[0] = $global;
} elseif (preg_match("/^xyz\:/", $global)) {
$coords = sscanf($global, "xyz: [%d, %d, %d]");
if (count($coords) == 3) {
$this->data[0] = $global;
} else {
throw new Exception("Invalid expression: $global");
}
} else {
global $db;
$name = $db->sql_escape($global);
$sql = "SELECT location_code FROM " . TABLE_LOCATIONS . " WHERE location_name LIKE '$name'";
$code = $db->sql_query_express($sql);
if ($code) {
$this->data[0] = $code;
return;
}
throw new Exception("Invalid expression: $global");
}
//TODO: handle $local in a better way: from the global location, gets
//a local location handler. Or a some inheriance, like a class
//HypershipGeoLocation extending GeoLocation.
if ($local !== null) $this->data[1] = $local;
$this->load_classes();
}
function load_classes () {
//No data, no class to load
if (!count($this->data))
return;
//Loads global classes
$global = $this->data[0];
$code = substr($global, 1, 5);
switch ($global[0]) {
case 'B':
switch (strlen($global)) {
case 9:
$this->place = GeoPlace::from_code($global);
case 6:
$this->body = new GeoBody($code);
break;
}
break;
case 'S':
$this->ship = new Ship($code);
break;
case 'x':
$coords = sscanf($global, "xyz: [%d, %d, %d]");
if (count($coords) == 3) {
$this->point3D = new GeoPoint3D($coords[0], $coords[1], $coords[2]);
}
break;
}
}
function __get ($variable) {
switch ($variable) {
/* main variables */
case 'global':
return $this->data[0];
break;
case 'local':
return $this->data[1];
break;
/* global location */
case 'type':
return $this->data[0][0];
case 'body_code':
if ($this->data[0][0] == 'B') {
return substr($this->data[0], 1, 5);
}
return null;
case 'place_code':
if ($this->data[0][0] == 'B') {
return substr($this->data[0], 6, 3);
}
return null;
case 'ship_code':
if ($this->data[0][0] == 'S') {
return substr($this->data[0], 1, 5);
}
return null;
case 'body_kind':
if ($this->data[0][0] == 'B' && $this->body != null) {
if ($kind = $this->body->kind()) {
return $kind;
}
} elseif ($this->data[0][0] == 'S') {
return 'ship';
}
return 'place';
case 'containsGlobalLocation':
return count($this->data) > 0;
case 'containsLocalLocation':
return count($this->data) > 1;
default:
throw new Exception("Unknown variable: $variable");
break;
}
}
/*
* Checks if the place exists
*
* @return boolean true if the place exists ; false otherwise
*/
function exists () {
$n = count($this->data);
//If not defined, it doesn't exist
if ($n == 0) return false;
//Checks global location
switch ($this->data[0][0]) {
case 'B':
switch (strlen($this->data[0])) {
case 9:
if (!$place = GeoPlace::from_code($this->data[0]))
return false;
break;
case 6:
$body = new GeoBody(substr($this->data[0], 1));
if ($body->lastError) return false;
break;
default:
message_die(GENERAL_ERROR, "Invalid global location expression size: " . $this->data[0], "GeoLocation exists method", __LINE__, __FILE__);
}
break;
case 'S':
$ship = new Ship(substr($this->data[0], 1));
if ($body->lastError) return false;
break;
default:
message_die(GENERAL_ERROR, "Invalid global location expression size: " . $this->data[0], "GeoLocation exists method", __LINE__, __FILE__);
return false;
}
if ($n > 1) {
message_die(GENERAL_ERROR, "Can't check if a local place exists yet.", "GeoLocation exists method", __LINE__, __FILE__);
}
return true;
}
+ /*
+ * Checks if the place is equals at the specified expression or place
+ *
+ * @return boolean true if the places are equals ; otherwise, false
+ */
function equals ($expression) {
//Are global location equals?
//TODO: creates a better set of rules to define when 2 locations are equa l.
if (is_a($expression, 'GeoLocation')) {
if (!$this->equals($expression->data[0])) {
return false;
}
if (count($expression->data) + count($this->data) > 2) {
return $expression->data[1] == $this->data[1];
}
}
if ($expression == $this->data[0]) return true;
$n1 = strlen($expression);
$n2 = strlen($this->data[0]);
if ($n1 > $n2) {
return substr($expression, 0, $n2) == $this->data[0];
}
return false;
}
+ /*
+ * Represents the current location instance as a string
+ *
+ * @return string a string representing the current location
+ */
function __toString () {
if (!$this->data[0])
return "";
switch ($this->data[0][0]) {
case 'S':
$ship = new Ship($this->ship_code);
$location[] = $ship->name;
break;
case 'B':
$body = new GeoBody($this->body_code);
$location[] = $body->name ? $body->name : lang_get('UnknownBody');
if (strlen($this->data[0]) == 9) {
$place = GeoPlace::from_code($this->data[0]);
$location[] = $place->name ? $place->name : lang_get('UnknownPlace');
}
break;
default:
message_die(GENERAL_ERROR, "Unknown location identifier: $type.<br />Expected: B or S.");
}
return implode(", ", array_reverse($location));
}
function __set ($variable, $value) {
switch ($variable) {
/* main variables */
case 'global':
$this->data[0] = $value;
break;
case 'local':
$this->data[1] = $value;
break;
/* global location */
case 'type':
if ($value == 'B' || $value == 'S') {
if (!$this->data[0]) {
$this->data[0] = $value;
} else {
$this->data[0][0] = $value;
}
}
break;
case 'body_code':
if (preg_match("/[0-9]{1,5}/", $value)) {
$value = sprintf("%05d", $value);
if (!$this->data[0]) {
$this->data[0] = "B" . $value;
return;
} elseif ($this->data[0][0] == 'B') {
$this->data[0] = "B" . $value . substr($this->data[0], 6);
return;
}
throw new Exception("Global location isn't a body.");
}
throw new Exception("$value isn't a valid body code");
case 'ship_code':
if (preg_match("/[0-9]{1,5}/", $value)) {
$value = sprintf("%05d", $value);
if (!$this->data[0]) {
$this->data[0] = "S" . $value;
return;
} elseif ($this->data[0][0] == 'S') {
$this->data[0] = "S" . $value . substr($this->data[0], 6);
return;
}
throw new Exception("Global location isn't a ship.");
}
throw new Exception("$value isn't a valid ship code");
case 'place_code':
if (!preg_match("/[0-9]{1,3}/", $value)) {
throw new Exception("$value isn't a valid place code");
}
$value = sprintf("%03d", $value);
if ($this->data[0][0] == 'B') {
$this->data[0] = substr($this->data[0], 0, 6) . $value;
}
throw new Exception("Global location isn't a body.");
default:
throw new Exception("Unknown variable: $variable");
break;
}
}
}
?>

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 4, 00:32 (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
21265
Default Alt Text
(46 KB)

Event Timeline