Page MenuHomeCode

No OneTemporary

diff --git a/controllers/persorequest.php b/controllers/persorequest.php
--- a/controllers/persorequest.php
+++ b/controllers/persorequest.php
@@ -1,182 +1,182 @@
<?php
/**
* Persos' requests
-
+ *
* Zed. The immensity of stars. The HyperShip. The people.
- *
+ *
* (c) 2010, Dereckson, some rights reserved.
* Released under BSD license.
*
* This controller handle the /requests URL.
*
* It can also be called with the requests SmartLine command.
*
* It allows to prints a content page.
*
* This controllers uses the persorequests.tpl view.
*
* This controller offer AJAX capabilities but degrades gracefully in JS.
*
* @package Zed
* @subpackage Controllers
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @copyright 2010 Sébastien Santoro aka Dereckson
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version 0.1
* @link http://scherzo.dereckson.be/doc/zed
* @link http://zed.dereckson.be/
* @filesource
*
* @todo move the get_ship function to a Ship::from_code method
* @todo Document the request system in the API documentation
*/
///
/// Helper class and method
///
/**
* A perso request
*/
class PersoRequest {
public $message;
public $requestFlag;
public $flag;
public $store = 'perso';
public $value_allow = 1;
public $value_deny = 0;
/**
* Initialies a perso request
*
* @param string $requestFlag the request's flag
* @param string $message the message to print
* @param string $message the flag to set, according the request approve/denial
*/
function __construct ($requestFlag, $message, $flag) {
$this->requestFlag = $requestFlag;
$this->message = $message;
$this->flag = $flag;
}
}
/**
* Gets ship from specified S00001 code
*
* @param string $ship_code the ship code (e.g. S00001)
* @return Ship the Ship class instance
*/
function get_ship ($ship_code) {
require_once('includes/objects/ship.php');
static $ships;
$ship_id = substr($ship_code, 1);
if (!$ships[$ship_id]) $ships[$ship_id] = new Ship($ship_id);
return $ships[$ship_id];
}
/**
* Gets request allow URL
*
* @param PersoRequest $request the perso request to confirm
* @return string the URL to allow the request
*/
function get_request_allow_url ($request) {
return get_request_url($request->requestFlag, $request->store, $request->flag, $request->value_allow);
}
/**
* Gets request deny URL
*
* @param PersoRequest $request the perso request to confirm
* @return string the URL to deny the request
*/
function get_request_deny_url ($request) {
return get_request_url($request->requestFlag, $request->store, $request->flag, $request->value_deny);
}
/**
* Gets request URL
*
* @param string $store 'perso' or 'registry'
* @param string $key the perso flag or registry key
* @param string $value the value to store
* @return the request URL
*/
function get_request_url ($requestFlag, $store, $key, $value) {
global $Config;
$hash = md5($_SESSION['ID'] . $Config['SecretKey'] . $requestFlag . $store . $key . $value);
return "$Config[DoURL]/perso_request/$requestFlag/$store/$key/$value/$hash";
}
///
/// Get requests
///
//Loads perso request language file
lang_load('persorequest.conf');
//The array request will be passed to Smarty and will contain PersoRequest items.
$requests = array();
foreach ($CurrentPerso->flags as $flag => $value) {
if ($value && substr($flag, 0, 8) == "request.") {
if (string_starts_with($flag, 'request.api.ship.auth.')) {
//Gets ship
$ship_code = substr($flag, 22);
$ship = get_ship($ship_code);
//Adds request
$message = sprintf(lang_get('RequestShipAPIAuthenticate'), $ship->name);
$requests[] = new PersoRequest($flag, $message, substr($flag, 8));
} elseif (string_starts_with($flag, 'request.api.ship.session.')) {
//Gets ship
$ship_code = substr($flag, 25, 6);
$ship = get_ship($ship_code);
//Adds request
$message = sprintf(lang_get('RequestShipAPISessionConfirm'), $ship->name);
$request = new PersoRequest($flag, $message, substr($flag, 8));
$request->value_allow = $CurrentPerso->id;
$request->value_deny = -1;
$request->store = 'registry';
$requests[] = $request;
} else {
message_die(GENERAL_ERROR, "Unknown request flag: $flag. Please report this bug.");
}
}
}
///
/// Requests handling
///
if (count($requests) == 0) {
//If site.requests flag is at 1 but we don't have request, ignore processing
$CurrentPerso->set_flag('site.requests', 0);
//We don't die, so next controller takes relay
} else {
///
/// HTML output
///
//Serves header
define('DOJO', true);
$smarty->assign('PAGE_TITLE', lang_get('PersoRequests'));
include('header.php');
//Serves content
$smarty->assign('requests', $requests);
$smarty->display('persorequests.tpl');
//Serves footer
$smarty->assign("screen", "Perso requests");
include('footer.php');
//Dies
exit;
}
?>
\ No newline at end of file
diff --git a/controllers/request.php b/controllers/request.php
--- a/controllers/request.php
+++ b/controllers/request.php
@@ -1,70 +1,95 @@
<?php
/**
* Requests controller
*
* Zed. The immensity of stars. The HyperShip. The people.
- *
+ *
* (c) 2010, Dereckson, some rights reserved.
* Released under BSD license.
*
- * This controller allows the perso to send requests to the HyperShip, to a
- * specified ship, or to a specify port requiring PTA.
- * It handle all the forms output, handling and notifications
+ * This controller allows the perso to send requests to the HyperShip,
+ * to a specified ship, or to a specify port requiring PTA.
+ *
+ * It handles all the forms output, handling and notifications
* for queries from users to users.
*
- * It handles /request URL, is called from tutoriald.
+ * It handles /request URL, is called from tutorial.
*
* @package Zed
* @subpackage Controllers
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @copyright 2010 Sébastien Santoro aka Dereckson
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version 0.1
* @link http://scherzo.dereckson.be/doc/zed
* @link http://zed.dereckson.be/
* @filesource
*
* @todo complete requests implementation
* @todo call this controller from Ship fly out if port is a PTA
- * @todo call this controller from HyperShip entrance pero request
+ * @todo call this controller from HyperShip entrance perso request
+ * @todo add hook to launch some events on a new request, reply or status change.
*/
//
// Prepare fields
//
if (count($url) < 3) message_die(HACK_ERROR, "Expected URL: /request/code_to/code_object");
-$request->to = $url[1];
-$request->obj = $url[2];
+
+//
+// Handles or print form
+//
+if (false) {
+ //Saves the request reply
+} elseif ($_POST['title'] || $_POST['message']) {
+ //Saves the request
+ require_once('includes/objects/request.php');
+ $request = new Request();
+ $request->load_from_form();
+ $request->author = $CurrentPerso->id;
+ $request->to = $url[1];
+ $request->code = $url[2];
+ $request->location_global = $CurrentPerso->location_global;
+ $request->location_local = $CurrentPerso->location_local;
+ $request->save_to_database();
-//Checks if the request template exists
-if (!file_exists(sprintf("skins/%s/requests/%s.tpl", THEME, $request->obj))) {
- message_die(HACK_ERROR, "$url[2] isn't a valid request object code");
-}
+ //Confirmation
+ $template = "requests/confirm.tpl";
+} else {
+ $request->to = $url[1];
+ $request->obj = $url[2];
-switch ($request->obj) {
- case "aid.reach":
- if ($request->to == "B00001")
- $request->title = "Shuttle pick up request";
- break;
+ //Checks if the request template exists
+ if (!file_exists(sprintf("skins/%s/requests/%s.tpl", THEME, $request->obj))) {
+ message_die(HACK_ERROR, "$url[2] isn't a valid request object code");
+ }
+
+ $template = "requests/$request->obj.tpl";
+ switch ($request->obj) {
+ case "aid.reach":
+ if ($request->to == "B00001")
+ $request->title = "Shuttle pick up request";
+ break;
+ }
}
//
// HTML output
//
//Serves header
define('DIJIT', true);
$smarty->assign('PAGE_TITLE', lang_get('Request'));
include('header.php');
//Serves content
$smarty->assign('request', $request);
-$smarty->display("requests/$request->obj.tpl");
+$smarty->display($template);
//Serves footer
$smarty->assign("screen", "$url[2] request");
include('footer.php');
?>
\ No newline at end of file
diff --git a/includes/config.php b/includes/config.php
--- a/includes/config.php
+++ b/includes/config.php
@@ -1,261 +1,263 @@
<?php
/**
* Autogenerable configuration file
*
* Zed. The immensity of stars. The HyperShip. The people.
*
* (c) 2010, Dereckson, some rights reserved.
* Released under BSD license.
*
* @package Zed
* @subpackage Keruald
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @copyright 2010 Sébastien Santoro aka Dereckson
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version 0.1
* @link http://scherzo.dereckson.be/doc/zed
* @link http://zed.dereckson.be/
* @filesource
*/
////////////////////////////////////////////////////////////////////////////////
/// ///
/// I. SQL configuration ///
/// ///
////////////////////////////////////////////////////////////////////////////////
//SQL configuration
$Config['sql']['product'] = 'MySQL'; //Only MySQL is currently implemented
$Config['sql']['host'] = 'localhost';
$Config['sql']['username'] = 'zed';
$Config['sql']['password'] = 'zed';
$Config['sql']['database'] = 'zed';
//SQL tables
$prefix = '';
define('TABLE_API_KEYS', $prefix . 'api_keys');
define('TABLE_COMMENTS', $prefix . 'comments');
define('TABLE_CONTENT_FILES', $prefix . 'content_files');
define('TABLE_CONTENT_LOCATIONS', $prefix . 'content_locations');
define('TABLE_CONTENT_ZONES', $prefix . 'content_zones');
define('TABLE_CONTENT_ZONES_LOCATIONS', $prefix . 'content_zones_locations');
define('TABLE_LOG', $prefix . 'log');
define('TABLE_LOG_SMARTLINE', $prefix . 'log_smartline');
define('TABLE_MESSAGES', $prefix . 'messages');
define('TABLE_MOTD', $prefix . 'motd');
define('TABLE_PAGES', $prefix . 'pages');
define('TABLE_PAGES_EDITS', $prefix . 'pages_edits');
define('TABLE_PERSOS', $prefix . 'persos');
define('TABLE_PERSOS_FLAGS', $prefix . 'persos_flags');
define('TABLE_PERSOS_NOTES', $prefix . 'persos_notes');
define('TABLE_PORTS', $prefix . 'ports');
define('TABLE_PROFILES', $prefix . 'profiles');
define('TABLE_PROFILES_COMMENTS', $prefix . 'profiles_comments');
define('TABLE_PROFILES_PHOTOS', $prefix . 'profiles_photos');
define('TABLE_PROFILES_TAGS', $prefix . 'profiles_tags');
define('TABLE_REGISTRY', $prefix . 'registry');
+define('TABLE_REQUESTS', $prefix . 'requests');
+define('TABLE_REQUESTS_REPLIES', $prefix . 'requests_replies');
define('TABLE_SESSIONS', $prefix . 'sessions');
define('TABLE_SHIPS', $prefix . 'ships');
define('TABLE_USERS', $prefix . 'users');
define('TABLE_USERS_INVITES', $prefix . 'users_invites');
define('TABLE_USERS_OPENID', $prefix . 'users_openid');
//Geo tables
define('TABLE_BODIES', $prefix . 'geo_bodies');
define('TABLE_LOCATIONS', $prefix . 'geo_locations'); //Well... it's a view
define('TABLE_PLACES', $prefix . 'geo_places');
////////////////////////////////////////////////////////////////////////////////
/// ///
/// II. Site configuration ///
/// ///
////////////////////////////////////////////////////////////////////////////////
//Default theme
$Config['DefaultTheme'] = "Zed";
//Dates
date_default_timezone_set("UTC");
//Secret key, used for some verification hashes in URLs or forms.
$Config['SecretKey'] = 'Lorem ipsum dolor';
//When reading files, buffer size
define('BUFFER_SIZE', 4096);
////////////////////////////////////////////////////////////////////////////////
/// ///
/// III. Script URLs ///
/// ///
////////////////////////////////////////////////////////////////////////////////
/*
* Apache httpd, without mod_rewrite:
*
* Subdirectory:
* - $Config['SiteURL'] = 'http://zed.dereckson.be/hypership/index.php';
* - $Config['BaseURL'] = '/hypership/index.php';
*
* Root directory:
* - $Config['SiteURL'] = 'http://zed.dereckson.be/index.php';
* - $Config['BaseURL'] = '/index.php';
*
* Apache httpd, with mod_rewrite:
*
* Subdirectory:
* - $Config['SiteURL'] = 'http://zed.dereckson.be/hypership';
* - $Config['BaseURL'] = '/hypership';
*
* In .htaccess or your vhost definition:
* RewriteEngine On
* RewriteBase /hypership/
* RewriteCond %{REQUEST_FILENAME} !-f
* RewriteCond %{REQUEST_FILENAME} !-d
* RewriteRule . /hypership/index.php [L]
*
* Root directory:
* - $Config['SiteURL'] = 'http://zed.dereckson.be';
* - $Config['BaseURL'] = '';
*
* In .htaccess or your vhost definition:
* RewriteEngine On
* RewriteBase /
* RewriteCond %{REQUEST_FILENAME} !-f
* RewriteCond %{REQUEST_FILENAME} !-d
* RewriteRule . /index.php [L]
*
* nginx:
*
* Use same config.php settings than Apache httpd, with mod_rewrite.
*
* In your server block:
* location / {
* #Serves static files if they exists, with one month cache
* if (-f $request_filename) {
* expires 30d;
* break;
* }
*
* #Sends all non existing file or directory requests to index.php
* if (!-e request_filename) {
* rewrite ^(.+)$ /index.php last;
* #Or if you use a subdirectory:
* #rewrite ^(.+)$ /hypership/index.php last;
* }
* }
*
* location ~ \.php$ {
* #Your instructions to pass query to your FastCGI process, like:
* fastcgi_pass 127.0.0.1:9000;
* fastcgi_param SCRIPT_FILENAME /var/www/zed$fastcgi_script_name;
* include fastcgi_params;
* }
*
*
* If you don't want to specify the server domain, you can use get_server_url:
* $Config['SiteURL'] = get_server_url() . '/hypership';
* $Config['SiteURL'] = get_server_url();
*
*
*
* !!! No trailing slash !!!
*
*/
$Config['SiteURL'] = get_server_url();
$Config['BaseURL'] = '';
//AJAX callbacks URL
$Config['DoURL'] = $Config['SiteURL'] . "/do.php";
////////////////////////////////////////////////////////////////////////////////
/// ///
/// IV. Static content ///
/// ///
////////////////////////////////////////////////////////////////////////////////
//Where the static content is located?
//Static content = 4 directories: js, css, img and content
//On default installation, those directories are at site root.
//To improve site performance, you can use a CDN for that.
//
//Recommanded setting: $Config['StaticContentURL'] = $Config['SiteURL'];
//Or if Zed is the site root: $Config['StaticContentURL'] = '';
//With CoralCDN: $Config['StaticContentURL'] = . '.nyud.net';
//
$Config['StaticContentURL'] = '';
//$Config['StaticContentURL'] = get_server_url() . '.nyud.net';
//Scenes
define('SCENE_DIR', 'content/scenes');
define('SCENE_URL', $Config['StaticContentURL'] . '/' . SCENE_DIR);
//Stories
define('STORIES_DIR', "content/stories");
//Profile's photos
define('PHOTOS_DIR', 'content/users/_photos');
define('PHOTOS_URL', $Config['StaticContentURL'] . '/' . PHOTOS_DIR);
//ImageMagick paths
//Be careful on Windows platform convert could match the NTFS convert command.
$Config['ImageMagick']['convert'] = 'convert';
$Config['ImageMagick']['mogrify'] = 'mogrify';
$Config['ImageMagick']['composite'] = 'composite';
$Config['ImageMagick']['identify'] = 'identify';
////////////////////////////////////////////////////////////////////////////////
/// ///
/// V. Caching ///
/// ///
////////////////////////////////////////////////////////////////////////////////
/*
* Some data (Smarty, OpenID and sessions) are cached in the cache directory.
*
* Security tip: you can move this cache directory outside the webserver tree.
*/
define('CACHE_DIR', 'cache');
/*
* Furthermore, you can also enable a cache engine, like memcached, to store
* data from heavy database queries, or frequently accessed stuff.
*
* To use memcached:
* - $Config['cache']['engine'] = 'memcached';
* - $Config['cache']['server'] = 'localhost';
* - $Config['cache']['port'] = 11211;
*
* To disable cache:
* - $Config['cache']['engine'] = 'void';
* (or don't write nothing at all)
*/
$Config['cache']['engine'] = 'void';
////////////////////////////////////////////////////////////////////////////////
/// ///
/// VI. Sessions ///
/// ///
////////////////////////////////////////////////////////////////////////////////
//If you want to use a common table of sessions / user handling
//with several websites, specify a different resource id for each site.
$Config['ResourceID'] = 21;
//PHP variables
ini_set('session.serialize_handler', 'wddx');
ini_set('session.save_path', CACHE_DIR . '/sessions');
ini_set('session.gc_maxlifetime', 345600); //4 days, for week-end story pause and continue url
////////////////////////////////////////////////////////////////////////////////
/// ///
/// VII. Builder ///
/// ///
////////////////////////////////////////////////////////////////////////////////
//Zed can invoke a slighty modified version of HOTGLUE to build zones.
$Config['builder']['hotglue']['enable'] = true;
$Config['builder']['hotglue']['URL'] = '/apps/hotglue/index.php';
?>
diff --git a/includes/objects/request.php b/includes/objects/request.php
new file mode 100644
--- /dev/null
+++ b/includes/objects/request.php
@@ -0,0 +1,125 @@
+<?php
+
+/**
+ * Request class
+ *
+ * Zed. The immensity of stars. The HyperShip. The people.
+ *
+ * (c) 2011, Dereckson, some rights reserved.
+ * Released under BSD license.
+ *
+ * 0.1 2011-06-13 21:16 Autogenerated by Pluton Scaffolding
+ *
+ * @package Zed
+ * @subpackage Model
+ * @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
+ * @copyright 2011 Sébastien Santoro aka Dereckson
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD
+ * @version 0.1
+ * @link http://scherzo.dereckson.be/doc/zed
+ * @link http://zed.dereckson.be/
+ * @filesource
+ */
+
+/**
+ * Request class
+ *
+ * This class maps the requests table.
+ */
+class Request {
+
+ public $id;
+ public $code;
+ public $title;
+ public $date;
+ public $author;
+ public $to;
+ public $message;
+ public $location_global;
+ public $location_local;
+ public $status;
+
+ /**
+ * Initializes a new instance
+ * @param int $id the primary key
+ */
+ function __construct ($id = NULL) {
+ if ($id) {
+ $this->id = $id;
+ $this->load_from_database();
+ } else {
+ $this->date = time();
+ $this->status = 'NEW';
+ }
+ }
+
+ /**
+ * Loads the object Request (ie fill the properties) from the $_POST array
+ */
+ function load_from_form () {
+ if (array_key_exists('code', $_POST)) $this->code = $_POST['code'];
+ if (array_key_exists('title', $_POST)) $this->title = $_POST['title'];
+ if (array_key_exists('date', $_POST)) $this->date = $_POST['date'];
+ if (array_key_exists('author', $_POST)) $this->author = $_POST['author'];
+ if (array_key_exists('to', $_POST)) $this->to = $_POST['to'];
+ if (array_key_exists('message', $_POST)) $this->message = $_POST['message'];
+ if (array_key_exists('location_global', $_POST)) $this->location_global = $_POST['location_global'];
+ if (array_key_exists('location_local', $_POST)) $this->location_local = $_POST['location_local'];
+ if (array_key_exists('status', $_POST)) $this->status = $_POST['status'];
+ }
+
+ /**
+ * Loads the object Request (ie fill the properties) from the database
+ */
+ function load_from_database () {
+ global $db;
+ $id = $db->sql_escape($this->id);
+ $sql = "SELECT * FROM " . TABLE_REQUESTS . " WHERE request_id = '" . $id . "'";
+ if (!$result = $db->sql_query($sql)) message_die(SQL_ERROR, "Unable to query requests", '', __LINE__, __FILE__, $sql);
+ if (!$row = $db->sql_fetchrow($result)) {
+ $this->lastError = "Request unkwown: " . $this->id;
+ return false;
+ }
+ $this->code = $row['request_code'];
+ $this->title = $row['request_title'];
+ $this->date = $row['request_date'];
+ $this->author = $row['request_author'];
+ $this->message = $row['request_message'];
+ $this->to = $row['request_to'];
+ $this->location_global = $row['location_global'];
+ $this->location_local = $row['location_local'];
+ $this->status = $row['request_status'];
+ return true;
+ }
+
+ /**
+ * Saves to database
+ */
+ function save_to_database () {
+ global $db;
+
+ $id = $this->id ? "'" . $db->sql_escape($this->id) . "'" : 'NULL';
+ $code = $db->sql_escape($this->code);
+ $title = $db->sql_escape($this->title);
+ $date = $db->sql_escape($this->date);
+ $author = $db->sql_escape($this->author);
+ $message = $db->sql_escape($this->message);
+ $to = $db->sql_escape($this->to);
+ $location_global = $db->sql_escape($this->location_global);
+ $location_local = $db->sql_escape($this->location_local);
+ $status = $db->sql_escape($this->status);
+
+ //Updates or inserts
+ $sql = "REPLACE INTO " . TABLE_REQUESTS . " (`request_id`, `request_code`, `request_title`, `request_date`, `request_author`, `request_message`, `request_to`, `location_global`, `location_local`, `request_status`) VALUES ('$id', '$code', '$title', '$date', '$author', '$message', '$to', '$location_global', '$location_local', '$status')";
+ if (!$db->sql_query($sql)) {
+ message_die(SQL_ERROR, "Unable to save", '', __LINE__, __FILE__, $sql);
+ }
+
+ if (!$this->id) {
+ //Gets new record id value
+ $this->id = $db->sql_nextid();
+ }
+ }
+}
+
+?>
diff --git a/includes/objects/requestreply.php b/includes/objects/requestreply.php
new file mode 100644
--- /dev/null
+++ b/includes/objects/requestreply.php
@@ -0,0 +1,102 @@
+<?php
+
+/**
+ * RequestReply class
+ *
+ * Zed. The immensity of stars. The HyperShip. The people.
+ *
+ * (c) 2011, Dereckson, some rights reserved.
+ * Released under BSD license.
+ *
+ * 0.1 2011-06-13 21:20 Autogenerated by Pluton Scaffolding
+ *
+ * @package Zed
+ * @subpackage Model
+ * @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
+ * @copyright 2011 Sébastien Santoro aka Dereckson
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD
+ * @version 0.1
+ * @link http://scherzo.dereckson.be/doc/zed
+ * @link http://zed.dereckson.be/
+ * @filesource
+ */
+
+/**
+ * RequestReply class
+ *
+ * This class maps the requests_replies table.
+ */
+class RequestReply {
+
+ public $id;
+ public $request_id;
+ public $author;
+ public $date;
+ public $text;
+
+ /**
+ * Initializes a new instance
+ * @param int $id the primary key
+ */
+ function __construct ($id = NULL) {
+ if ($id) {
+ $this->id = $id;
+ $this->load_from_database();
+ }
+ }
+
+ /**
+ * Loads the object RequestReply (ie fill the properties) from the $_POST array
+ */
+ function load_from_form () {
+ if (array_key_exists('request_id', $_POST)) $this->request_id = $_POST['request_id'];
+ if (array_key_exists('author', $_POST)) $this->author = $_POST['author'];
+ if (array_key_exists('date', $_POST)) $this->date = $_POST['date'];
+ if (array_key_exists('text', $_POST)) $this->text = $_POST['text'];
+ }
+
+ /**
+ * Loads the object RequestReply (ie fill the properties) from the database
+ */
+ function load_from_database () {
+ global $db;
+ $id = $db->sql_escape($this->id);
+ $sql = "SELECT * FROM " . TABLE_REQUESTS_REPLIES . " WHERE request_reply_id = '" . $id . "'";
+ if (!$result = $db->sql_query($sql)) message_die(SQL_ERROR, "Unable to query requests_replies", '', __LINE__, __FILE__, $sql);
+ if (!$row = $db->sql_fetchrow($result)) {
+ $this->lastError = "RequestReply unkwown: " . $this->id;
+ return false;
+ }
+ $this->request_id = $row['request_id'];
+ $this->author = $row['request_reply_author'];
+ $this->date = $row['request_reply_date'];
+ $this->text = $row['request_reply_text'];
+ return true;
+ }
+
+ /**
+ * Saves to database
+ */
+ function save_to_database () {
+ global $db;
+
+ $id = $this->id ? "'" . $db->sql_escape($this->id) . "'" : 'NULL';
+ $request_id = $db->sql_escape($this->request_id);
+ $author = $db->sql_escape($this->author);
+ $date = $db->sql_escape($this->date);
+ $text = $db->sql_escape($this->text);
+
+ //Updates or inserts
+ $sql = "REPLACE INTO " . TABLE_REQUESTS_REPLIES . "(`request_reply_id`, `request_id`, `request_reply_author`, `request_reply_date`, `request_reply_text`) VALUES ('$id', '$request_id', '$author', '$date', '$text')";
+ if (!$db->sql_query($sql)) {
+ message_die(SQL_ERROR, "Unable to save", '', __LINE__, __FILE__, $sql);
+ }
+
+ if (!$this->id) {
+ //Gets new record id value
+ $this->id = $db->sql_nextid();
+ }
+ }
+}
+
+?>
diff --git a/lang/en/core.conf b/lang/en/core.conf
--- a/lang/en/core.conf
+++ b/lang/en/core.conf
@@ -1,187 +1,195 @@
#Zed language config file
#Language: English
#Code: en
#Author: Dereckson
###
### Site configuration
###
SiteTitle = Zed
Product = "<strong>Zed 0.1</strong>, alpha technical preview"
###
### General stuff
###
_t = ":"
Save = Save
###
### 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"
+
GeneralError = General error
PageNotFound = "Page not found"
#Keep those two lines in English, to help to identify error screens in any lang
FatalErrorScreen = Fatal error screen
FatalErrorInterrupt = Fatal error breaking screen
###
### 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
###
#NOTIFY if new messages
NewMessages = "You've got %d new message%s"
#messages.tpl, Reply
Reply = Reply
#messages.tpl, the X link title
DeleteThisMessage = Delete this message
#messages.tpl, the expression identifying a message sent by the site itself
SystemNotice = System Notice
#home.php, messages error
MessageDeleted = Message deleted.
NotYourMessage = This message is not one of yours.
MessageAlreadyDeleted = Message already deleted.
###
### Account create
###
CreateAccountTitle = Create an account
CreateAccountIntro = "<p>Welcome to Zed.<br />To get an account, you need an invite code. To get an invite code, ask who tell you about Zed.</p>"
YourLogin = The login you want
InviteCode = Your invite code
YourEmail = Your e-mail
EnterInviteCodePromptMessage = "Your invite code is something like ABC123."
EnterUsernamePromptMessage = "Enter your username, in lowercase (11 characters max.).<br />It's your usual username, not your character name."
EnterEmailPromptMessage = "Enter your e-mail. It will used (1) as password recovery method (2) to send you notification of new messages or events you've configured.<br />We don't like spam, so we take all the measures to protect your mail."
IncorrectInviteCode = "Your invite code's format isn't valid. It's something like ABC123."
InviteCodeAlreadyClaimed = "This invite code were valid. But it have already been claimed."
CreateAccountImageTitle = "Zed is for human being. But it's also for people defining themselves like other beings than humans."
CreateAccountImageAlt = "A strange-looking white picture. An half circle from top right to bottom right, then the brush come back in spirale to create a big white spot. Some brushes effects add fringes at start and end. Grayscale spots have been added in main circle."
MissingUsername = "You need to provide a login."
LoginUnavailable = "This login is already taken."
MissingPassword = "You need to provide a password."
InviteHaveBeenClaimed = "Your invite %s have just been claimed."
AccountCreated = "Your account is created. Welcome to Zed."
###
### Perso create/select
###
NewCharacterCreated = New character created
CreateCharacter = Create a character
EditCharacter = Edit %s information
FullName = Full name
Nickname = Nickname
Sex = Sex
Male = Male
Female = Female
Neutral = Neutral
Hermaphrodit = Hermaphrodit
Race = Race
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>'."
UnavailableNickname = "This nickname is already used.<br />Choose a more original one."
PickPerso = Pick your perso
SwapPerso = "Swap perso (%s's logout)"
NewLocationNotify = "You're slowly awaking in a place you don't recognize."
InvitePersoCreated = "Good news! %s you invited is in our galaxy.
%s"
###
### Places
###
CurrentLocation = "Current location"
UnknownBody = "Unknown asteroid"
UnknownPlace = "Unknown place"
WherePlace = "%s @ %s"
SpaceAround = "Space around %s"
hypership = hypership
asteroid = asteroid
moon = moon
planet = planet
star = star
orbital = orbital
place = place
ship = ship
###
### Stories
###
InvalidStoryGUID = "In story mode, you can't use previous/back URL."
ExpiredStorySession = "Story choices URL are temporary.<br />You can't bookmark them or use in another session."
###
### Requests
###
+Communicator = Communicator
+SendRequestToHyperShip = Send a request to the hypership
Request = Request
Title = Title
+Message = Message
+Warning = "Warning:"
+RequestHandledByHumans = Your request will be sent to and handled by humans.
+Send = Send
+RequestSent = Your request have been sent.
###
### MOTD
###
PushMessage = Push a message to the header
TextToAdd = Text to add
TextToAddWarning = Warning: once published, it can't be (easily) removed.
Rendering = How it will be printed?
RenderingWhere = "At the top right header corner:"
DummyPlaceholder = Here your message.
Push = Push
Published = Published :)
\ No newline at end of file
diff --git a/lang/fr/core.conf b/lang/fr/core.conf
--- a/lang/fr/core.conf
+++ b/lang/fr/core.conf
@@ -1,187 +1,195 @@
#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 = " :"
Save = Enregistrer
###
### 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
###
### Erreurs
###
UnauthorizedAccess = "Accès non autorisé"
SQLError = "Erreur SQL"
line = ligne
Error = Erreur
BackToHome = "Retourner à la page d'accueil"
GeneralError = "Erreur générale"
PageNotFound = "Cette page n'existe pas."
#Veuillez laisser en anglais, pour identifier plus clairement les erreurs.
FatalErrorScreen = Fatal error screen
FatalErrorInterrupt = Fatal error breaking screen
###
### 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
###
#NOTIFY if new messages
NewMessages = "Vous avez reçu %d message%s"
#messages.tpl, Reply
Reply = Répondre
#messages.tpl, the X link title
DeleteThisMessage = Effacer ce message
#messages.tpl, the expression identifying a message sent by the site itself
SystemNotice = Note système
#home.php, messages error
MessageDeleted = Message effacé.
NotYourMessage = Hey, ce message appartient à autrui !
MessageAlreadyDeleted = Message déjà effacé
###
### Account create
###
CreateAccountTitle = Créer un compte
CreateAccountIntro = "<p>Bienvenue sur Zed.<br />Zed est un site privé uniquement accessible suite à l'invitation d'un membre.</p>"
YourLogin = Le login de votre choix
InviteCode = "Votre code d'invitation"
YourEmail = Votre adresse e-mail
EnterInviteCodePromptMessage = "Votre code d'invitation ressemble à ABC123."
EnterUsernamePromptMessage = "Votre login sera en minuscule et d'au plus onze caractères.<br />Il sera uniquement utilisé pour vous identifier, votre login NE sera PAS le nom de votre perso."
EnterEmailPromptMessage = "Votre adresse sera utilisée pour vous permettre de modifier votre mot de passe en cas d'oubli. Vous pourrez également configurer des notifications en cas de nouveau message & co, mais par défaut c'est désactivé."
IncorrectInviteCode = "Format invalide du code d'invitation,<br />recherchez quelque chose ressemblant à ABC123."
InviteCodeAlreadyClaimed = "Ce code d'invitation était certes valide mais a déjà été utilisé par autrui."
CreateAccountImageTitle = "Zed est un site pour les êtres humains. Mais aussi pour tous ceux qui se définissent autrement que comme humain."
CreateAccountImageAlt = "Une étrange créature blanche. Un demi cercle allant d'en haut à droite vers le bas à droite ; la brosse poursuit ensuite en spirale pour créer une grosse tâche blanche. Les effets de la brosse ajoutent au début et à la fin des franges. Des tâches grises ont été rajoutées au centre."
MissingUsername = "Vous avez oublié de spécifier le login."
LoginUnavailable = "Ce login est déjà utilisé."
MissingPassword = "Vous avez oublié de spécifier le mot de passe."
InviteHaveBeenClaimed = "Votre invitation %s a été acceptée."
AccountCreated = "Votre compte a été créé. Bienvenue sur Zed."
###
### Perso create/select
###
NewCharacterCreated = Nouveau perso créé.
CreateCharacter = Nouveau perso
EditCharacter = Éditer les infos de %s
FullName = Prénom et nom
Nickname = Pseudonyme
Sex = Sexe
Male = Masculin
Female = Féminin
Neutral = Neutre
Hermaphrodit = Hermaphrodite
Race = Race
NoSexSpecified = "Quel est votre sexe ? Si vous ne souhaitez pas le dévoiler, vous pouvez toujours utiliser '<em>Neutral</em>'."
NoNicknameSpecified = "Vous devez choisir un pseudo. C'est comme un login, pour votre perso."
NoFullnameSpecified = "Tous les êtres doivent avoir un nom."
NoRaceSpecified = "Spécifiez une race: '<em>humanoid</em>' pour les humains et humanoïdes.<br />Si vous ne souhaitez pas spécifier de race, vous pouvez utiliser '<em>being</em>'."
UnavailableNickname = "Ce pseudo est déjà utilisé.<br />Veuillez en choisir un plus original."
PickPerso = "Sélectionnez votre perso"
SwapPerso = "Changer de perso (déco %s)"
NewLocationNotify = "Vous vous réveillez lentement dans un endroit inconnu"
InvitePersoCreated = "Bonne nouvelle ! %s vient d'arriver dans notre galaxie.
%s"
###
### Places
###
CurrentLocation = "Localisateur"
UnknownBody = "Astéroïde inconnu"
UnknownPlace = "Endroit inconnu"
WherePlace = "%2$s, %1$s."
SpaceAround = "%s et l'espace aux alentours"
hypership = hypership
asteroid = astéroïde
moon = lune
planet = planète
star = étoile
orbital = orbitale
place = endroit
ship = vaisseau
###
### Stories
###
InvalidStoryGUID = "En mode récit, il n'est pas possible <br />d'utiliser les boutons précédents et suivants."
ExpiredStorySession = "Les URL de choix sont temporaires.<br />Il n'est pas possible de les bookmark pour y revenir."
###
### Requests
###
+
+Communicator = Communicator
+SendRequestToHyperShip = "Envoyer une requête à l'HyperShip"
Request = Requête
Title = Titre
+Message = Message
+Warning = "Attention :"
+RequestHandledByHumans = "Votre requête sera envoyée à et traitées par des humains."
+Send = Envoyer
+RequestSent = Votre requête a bien été envoyée.
###
### MOTD
###
PushMessage = Publier un message tout en haut
TextToAdd = Texte à ajouter
TextToAddWarning = "Une fois publié, ne peut être facilement enlevé."
Rendering = Aperçu
RenderingWhere = "Coin supérieur droit de la page :"
DummyPlaceholder = Lorem ipsum dolor.
Push = Publier
Published = Publié :)
\ No newline at end of file
diff --git a/skins/zed/requests/aid.reach.tpl b/skins/zed/requests/aid.reach.tpl
--- a/skins/zed/requests/aid.reach.tpl
+++ b/skins/zed/requests/aid.reach.tpl
@@ -1,20 +1,24 @@
<!-- DIJIT -->
<script type="text/javascript">
dojo.require("dijit.form.Form");
dojo.require("dijit.form.ValidationTextBox");
dojo.require("dijit.form.Button");
</script>
<!-- Request form: aid.reach -->
- <h1>Communicator</h1>
- <h2>Send a request to the hypership</h2>
+ <h1>{#Communicator#}</h1>
+ <h2>{#SendRequestToHyperShip#}</h2>
<form dojoType="dijit.form.Form" name="aid.reach" method="post">
<div class="row">
<label class="firstLabel" for="PostTitle">{#Title#}</label>
<input dojoType="dijit.form.ValidationTextBox" value="{$request->title}" type="text" id="PostTitle" name="title" class="long" required="true" />
</div>
<div class="row">
- <button dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconSave" type="submit" value="Save" />Send</button>
+ <label class="firstLabel" for="PostMessage">{#Message#}</label>
+ <textarea id="PostMessage" name="message" cols="80" rows="8"></textarea>
</div>
- <p><strong>Warning:</strong> Your request will be sent to and handled by humans.</p>
+ <div class="row">
+ <button dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconSave" type="submit" value="Save" />{#Send#}</button>
+ </div>
+ <p><strong>{#Warning#}</strong> {#RequestHandledByHumans#}</p>
</form>
\ No newline at end of file
diff --git a/skins/zed/requests/confirm.tpl b/skins/zed/requests/confirm.tpl
new file mode 100644
--- /dev/null
+++ b/skins/zed/requests/confirm.tpl
@@ -0,0 +1,6 @@
+<div class="content_wrapper">
+ <h1>{#Communicator#}</h1>
+ <div class="content">
+ <p>{#RequestSent#}</p>
+ </div>
+</div>
\ No newline at end of file

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 23, 11:19 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
21216
Default Alt Text
(42 KB)

Event Timeline