Merge branch 'dev' into sabre32
This commit is contained in:
commit
5b9cd0af64
43
Zotlabs/Daemon/README.md
Normal file
43
Zotlabs/Daemon/README.md
Normal file
@ -0,0 +1,43 @@
|
||||
Daemon (background) Processes
|
||||
=============================
|
||||
|
||||
|
||||
This directory provides background tasks which are executed by a
|
||||
command-line process and detached from normal web processing.
|
||||
|
||||
Background tasks are invoked by calling
|
||||
|
||||
|
||||
Zotlabs\Daemon\Master::Summon([ $cmd, $arg1, $argn... ]);
|
||||
|
||||
The Master class loads the desired command file and passes the arguments.
|
||||
|
||||
|
||||
To create a background task 'Foo' use the following template.
|
||||
|
||||
<?php
|
||||
|
||||
namespace Zotlabs\Daemon;
|
||||
|
||||
class Foo {
|
||||
|
||||
static public function run($argc,$argv) {
|
||||
// do something
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
The Master class "summons" the command by creating an executable script
|
||||
from the provided arguments, then it invokes "Release" to execute the script
|
||||
detached from web processing. This process calls the static::run() function
|
||||
with any command line arguments using the traditional argc, argv format.
|
||||
|
||||
Please note: These are *real* $argc, $argv variables passed from the command
|
||||
line, and not the parsed argc() and argv() functions/variables which were
|
||||
obtained from parsing path components of the request URL by web processes.
|
||||
|
||||
Background processes do not emit displayable output except through logs. They
|
||||
should also not make any assumptions about their HTML and web environment
|
||||
(as they do not have a web environment), particularly with respect to global
|
||||
variables such as $_SERVER, $_REQUEST, $_GET, $_POST, $_COOKIES, and $_SESSION.
|
||||
|
@ -18,7 +18,7 @@ class Achievements extends \Zotlabs\Web\Controller {
|
||||
|
||||
$profile = 0;
|
||||
$profile = argv(1);
|
||||
profile_load($a,$which,$profile);
|
||||
profile_load($which,$profile);
|
||||
|
||||
$r = q("select channel_id from channel where channel_address = '%s'",
|
||||
dbesc($which)
|
||||
|
@ -12,7 +12,7 @@ class Block extends \Zotlabs\Web\Controller {
|
||||
|
||||
$which = argv(1);
|
||||
$profile = 0;
|
||||
profile_load($a,$which,$profile);
|
||||
profile_load($which,$profile);
|
||||
|
||||
if(\App::$profile['profile_uid'])
|
||||
head_set_icon(\App::$profile['thumb']);
|
||||
|
@ -22,7 +22,7 @@ class Blocks extends \Zotlabs\Web\Controller {
|
||||
else
|
||||
return;
|
||||
|
||||
profile_load($a,$which);
|
||||
profile_load($which);
|
||||
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ class Cal extends \Zotlabs\Web\Controller {
|
||||
if(argc() > 1) {
|
||||
$nick = argv(1);
|
||||
|
||||
profile_load($a,$nick);
|
||||
profile_load($nick);
|
||||
|
||||
$channelx = channelx_by_nick($nick);
|
||||
|
||||
|
@ -48,7 +48,7 @@ class Channel extends \Zotlabs\Web\Controller {
|
||||
// Run profile_load() here to make sure the theme is set before
|
||||
// we start loading content
|
||||
|
||||
profile_load($a,$which,$profile);
|
||||
profile_load($which,$profile);
|
||||
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ class Chat extends \Zotlabs\Web\Controller {
|
||||
// Run profile_load() here to make sure the theme is set before
|
||||
// we start loading content
|
||||
|
||||
profile_load($a,$which,$profile);
|
||||
profile_load($which,$profile);
|
||||
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ class Cloud extends \Zotlabs\Web\Controller {
|
||||
\App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n";
|
||||
|
||||
if ($which)
|
||||
profile_load($a, $which, $profile);
|
||||
profile_load( $which, $profile);
|
||||
|
||||
$auth = new \Zotlabs\Storage\BasicAuth();
|
||||
|
||||
|
@ -21,7 +21,7 @@ class Common extends \Zotlabs\Web\Controller {
|
||||
);
|
||||
|
||||
if($x)
|
||||
profile_load($a,$x[0]['channel_address'],0);
|
||||
profile_load($x[0]['channel_address'],0);
|
||||
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ class Connect extends \Zotlabs\Web\Controller {
|
||||
if($r)
|
||||
\App::$data['channel'] = $r[0];
|
||||
|
||||
profile_load($a,$which,'');
|
||||
profile_load($which,'');
|
||||
}
|
||||
|
||||
function post() {
|
||||
|
@ -29,7 +29,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
|
||||
$channel = \App::get_channel();
|
||||
profile_load($a,$channel['channel_address']);
|
||||
profile_load($channel['channel_address']);
|
||||
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ class Dav extends \Zotlabs\Web\Controller {
|
||||
\App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n";
|
||||
|
||||
if ($which)
|
||||
profile_load($a, $which, $profile);
|
||||
profile_load( $which, $profile);
|
||||
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@ class Editblock extends \Zotlabs\Web\Controller {
|
||||
else
|
||||
return;
|
||||
|
||||
profile_load($a,$which);
|
||||
profile_load($which);
|
||||
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ class Editlayout extends \Zotlabs\Web\Controller {
|
||||
else
|
||||
return;
|
||||
|
||||
profile_load($a,$which);
|
||||
profile_load($which);
|
||||
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ class Editwebpage extends \Zotlabs\Web\Controller {
|
||||
else
|
||||
return;
|
||||
|
||||
profile_load($a,$which);
|
||||
profile_load($which);
|
||||
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ class Hcard extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
}
|
||||
|
||||
profile_load($a,$which,$profile);
|
||||
profile_load($which,$profile);
|
||||
|
||||
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class Id extends \Zotlabs\Web\Controller {
|
||||
|
||||
$profile = '';
|
||||
$channel = \App::get_channel();
|
||||
profile_load($a,$which,$profile);
|
||||
profile_load($which,$profile);
|
||||
|
||||
$op = new MysqlProvider;
|
||||
$op->server();
|
||||
|
@ -21,7 +21,7 @@ class Layouts extends \Zotlabs\Web\Controller {
|
||||
else
|
||||
return;
|
||||
|
||||
profile_load($a,$which);
|
||||
profile_load($which);
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ class Page extends \Zotlabs\Web\Controller {
|
||||
|
||||
$which = argv(1);
|
||||
$profile = 0;
|
||||
profile_load($a,$which,$profile);
|
||||
profile_load($which,$profile);
|
||||
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
||||
if(argc() > 1) {
|
||||
$nick = argv(1);
|
||||
|
||||
profile_load($a,$nick);
|
||||
profile_load($nick);
|
||||
|
||||
$channelx = channelx_by_nick($nick);
|
||||
|
||||
|
@ -48,7 +48,7 @@ class Profile extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
}
|
||||
|
||||
profile_load($a,$which,$profile);
|
||||
profile_load($which,$profile);
|
||||
|
||||
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
|
||||
$channel = \App::get_channel();
|
||||
profile_load($a,$channel['channel_address']);
|
||||
profile_load($channel['channel_address']);
|
||||
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ class Profiles extends \Zotlabs\Web\Controller {
|
||||
|
||||
$chan = \App::get_channel();
|
||||
|
||||
profile_load($a,$chan['channel_address'],$r[0]['id']);
|
||||
profile_load($chan['channel_address'],$r[0]['id']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -584,7 +584,7 @@ class Profiles extends \Zotlabs\Web\Controller {
|
||||
|
||||
if($is_default) {
|
||||
// reload the info for the sidebar widget - why does this not work?
|
||||
profile_load($a,$channel['channel_address']);
|
||||
profile_load($channel['channel_address']);
|
||||
\Zotlabs\Daemon\Master::Summon(array('Directory',local_channel()));
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ class Profperm extends \Zotlabs\Web\Controller {
|
||||
|
||||
$profile = \App::$argv[1];
|
||||
|
||||
profile_load($a,$which,$profile);
|
||||
profile_load($which,$profile);
|
||||
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class Viewconnections extends \Zotlabs\Web\Controller {
|
||||
return;
|
||||
}
|
||||
if(argc() > 1)
|
||||
profile_load($a,argv(1));
|
||||
profile_load(argv(1));
|
||||
}
|
||||
|
||||
function get() {
|
||||
|
@ -23,7 +23,7 @@ class Webpages extends \Zotlabs\Web\Controller {
|
||||
else
|
||||
return;
|
||||
|
||||
profile_load($a,$which);
|
||||
profile_load($which);
|
||||
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,8 @@ class Wiki extends \Zotlabs\Web\Controller {
|
||||
notice(t('You must be logged in to see this page.') . EOL);
|
||||
goaway('/login');
|
||||
}
|
||||
profile_load($nick);
|
||||
|
||||
}
|
||||
|
||||
function get() {
|
||||
@ -123,7 +125,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
||||
notice('Error retrieving page content' . EOL);
|
||||
goaway('/'.argv(0).'/'.argv(1).'/'.$wikiUrlName);
|
||||
}
|
||||
$content = ($p['content'] !== '' ? $p['content'] : '"# New page\n"');
|
||||
$content = ($p['content'] !== '' ? htmlspecialchars_decode($p['content'],ENT_COMPAT) : '"# New page\n"');
|
||||
// Render the Markdown-formatted page content in HTML
|
||||
require_once('library/markdown.php');
|
||||
$renderedContent = wiki_convert_links(Markdown(json_decode($content)),argv(0).'/'.argv(1).'/'.$wikiUrlName);
|
||||
|
@ -498,6 +498,18 @@ function bb_highlight($match) {
|
||||
return $match[0];
|
||||
}
|
||||
|
||||
function bb_fixtable_lf($match) {
|
||||
|
||||
// remove extraneous whitespace between table element tags since newlines will all
|
||||
// be converted to '<br />' and turn your neatly crafted tables into a whole lot of
|
||||
// empty space.
|
||||
|
||||
$x = preg_replace("/\]\s+\[/",'][',$match[1]);
|
||||
return '[table]' . $x . '[/table]';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// BBcode 2 HTML was written by WAY2WEB.net
|
||||
// extended to work with Mistpark/Friendica/Redmatrix/Hubzilla - Mike Macgirvin
|
||||
@ -579,7 +591,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
|
||||
$Text = preg_replace_callback("/\[code=(.*?)\](.*?)\[\/code\]/ism", 'bb_highlight', $Text);
|
||||
}
|
||||
|
||||
|
||||
$Text = preg_replace_callback("/\[table\](.*?)\[\/table\]/ism",'bb_fixtable_lf',$Text);
|
||||
|
||||
// Convert new line chars to html <br /> tags
|
||||
|
||||
|
@ -761,11 +761,10 @@ function identity_export_year($channel_id,$year,$month = 0) {
|
||||
*
|
||||
* The channel default theme is also selected for use, unless over-riden elsewhere.
|
||||
*
|
||||
* @param[in,out] App &$a
|
||||
* @param string $nickname
|
||||
* @param string $profile
|
||||
*/
|
||||
function profile_load(&$a, $nickname, $profile = '') {
|
||||
function profile_load($nickname, $profile = '') {
|
||||
|
||||
// logger('profile_load: ' . $nickname . (($profile) ? ' profile: ' . $profile : ''));
|
||||
|
||||
|
@ -1336,8 +1336,20 @@ function discover_by_webbie($webbie) {
|
||||
$fullname = $vcard['fn'];
|
||||
if($vcard['photo'] && (strpos($vcard['photo'],'http') !== 0))
|
||||
$vcard['photo'] = $diaspora_base . '/' . $vcard['photo'];
|
||||
if(($vcard['key']) && (! $pubkey))
|
||||
$pubkey = $vcard['key'];
|
||||
if(! $avatar)
|
||||
$avatar = $vcard['photo'];
|
||||
if($diaspora) {
|
||||
if(($vcard['guid']) && (! $diaspora_guid))
|
||||
$diaspora_guid = $vcard['guid'];
|
||||
if(($vcard['url']) && (! $diaspora_base))
|
||||
$diaspora_base = $vcard['url'];
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user