]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
inline salmon magic keys
[friendica.git] / boot.php
index 7bf3e75a6b2de3a7b8e9f78e842899e1a347a8be..4deafe317c279c1a4a514e4d19ee34d2cc742b2e 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -2,7 +2,7 @@
 
 set_time_limit(0);
 
-define ( 'BUILD_ID' , 1005 );
+define ( 'BUILD_ID' , 1007 );
 
 define ( 'EOL', "<br />\r\n");
 define ( 'ATOM_TIME',  'Y-m-d\TH:i:s\Z' );
@@ -28,6 +28,7 @@ define ( 'NAMESPACE_THREAD' ,         'http://purl.org/syndication/thread/1.0' )
 define ( 'NAMESPACE_TOMB' ,           'http://purl.org/atompub/tombstones/1.0' );
 define ( 'NAMESPACE_ACTIVITY',        'http://activitystrea.ms/spec/1.0/' );
 define ( 'NAMESPACE_ACTIVITY_SCHEMA', 'http://activitystrea.ms/schema/1.0/');
+define ( 'NAMESPACE_SALMON_ME',       'http://salmon-protocol.org/ns/magic-env');
 
 define ( 'ACTIVITY_LIKE',        NAMESPACE_ACTIVITY_SCHEMA . 'like' );
 define ( 'ACTIVITY_DISLIKE',     NAMESPACE_DFRN            . '/dislike' );
@@ -169,6 +170,15 @@ class App {
 
 }}
 
+// retrieve the App structure
+// useful in functions which require it but don't get it passed to them
+
+if(! function_exists('get_app')) {
+function get_app() {
+       global $a;
+       return $a;
+}};
+
 
 // Multi-purpose function to check variable state.
 // Usage: x($var) or $x($array,'key')
@@ -226,7 +236,6 @@ function check_config(&$a) {
                $stored = intval($build);
                $current = intval(BUILD_ID);
                if(($stored < $current) && file_exists('update.php')) {
-
                        // We're reporting a different version than what is currently installed.
                        // Run any existing update scripts to bring the database up to current.
 
@@ -269,19 +278,21 @@ function replace_macros($s,$r) {
 
 
 // load string tranlsation table for alternate language
-// not yet implemented
 
 if(! function_exists('load_translation_table')) {
 function load_translation_table($lang) {
        global $a;
 
+       if(file_exists("view/$lang/strings.php"))
+               include("view/$lang/strings.php");
 }}
 
 // translate string if translation exists
 
 if(! function_exists('t')) {
 function t($s) {
-       global $a;
+       
+       $a = get_app();
 
        if($a->strings[$s])
                return $a->strings[$s];
@@ -488,14 +499,18 @@ function goaway($s) {
 }}
 
 // Generic XML return
-// Outputs a basic XML status structure to STDOUT, with a value variable 
-// of $st and terminates the current process. 
+// Outputs a basic dfrn XML status structure to STDOUT, with a <status> variable 
+// of $st and an optional text <message> of $message and terminates the current process. 
 
 if(! function_exists('xml_status')) {
-function xml_status($st) {
+function xml_status($st, $message = '') {
+
+       if(strlen($message))
+               $xml_message = "\t<message>" . xmlify($message) . "</message>\r\n";
+
        header( "Content-type: text/xml" );
        echo '<?xml version="1.0" encoding="UTF-8"?>'."\r\n";
-       echo "<result><status>$st</status></result>\r\n";
+       echo "<result>\r\n\t<status>$st</status>\r\n$xml_message</result>\r\n";
        killme();
 }}