Merge remote-tracking branch 'upstream/dev' into wiki

This commit is contained in:
Andrew Manning
2016-06-30 21:51:33 -04:00
319 changed files with 10689 additions and 8258 deletions
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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']);
+1 -1
View File
@@ -22,7 +22,7 @@ class Blocks extends \Zotlabs\Web\Controller {
else
return;
profile_load($a,$which);
profile_load($which);
}
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -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() {
+1 -1
View File
@@ -433,7 +433,7 @@ class Connedit extends \Zotlabs\Web\Controller {
else {
// if you are on a different network we'll force a refresh of the connection basic info
Zotlabs\Daemon\Master::Summon(array('Notifier','permission_update',$contact_id));
\Zotlabs\Daemon\Master::Summon(array('Notifier','permission_update',$contact_id));
}
goaway(z_root() . '/connedit/' . $contact_id);
}
+2 -2
View File
@@ -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']);
}
@@ -50,7 +50,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
check_form_security_token_redirectOnErr('/cover_photo', 'cover_photo');
if((x($_POST,'cropfinal')) && ($_POST['cropfinal'] == 1)) {
if((array_key_exists('cropfinal',$_POST)) && ($_POST['cropfinal'] == 1)) {
// phase 2 - we have finished cropping
+1 -1
View File
@@ -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);
+35 -11
View File
@@ -16,7 +16,24 @@ class Dreport extends \Zotlabs\Web\Controller {
$channel = \App::get_channel();
$mid = ((argc() > 1) ? argv(1) : '');
if($mid === 'push') {
$table = 'push';
$mid = ((argc() > 2) ? argv(2) : '');
if($mid) {
$i = q("select id from item where mid = '%s' and author_xchan = '%s' and uid = %d",
dbesc($mid),
dbesc($channel['channel_hash']),
intval($channel['channel_id'])
);
if($i) {
\Zotlabs\Daemon\Master::Summon([ 'Notifier', 'edit_post', $i[0]['id'] ]);
}
}
sleep(3);
goaway(z_root() . '/dreport/' . urlencode($mid));
}
if($mid === 'mail') {
$table = 'mail';
$mid = ((argc() > 2) ? argv(2) : '');
@@ -59,11 +76,7 @@ class Dreport extends \Zotlabs\Web\Controller {
notice( t('no results') . EOL);
return;
}
$o .= '<div class="generic-content-wrapper-styled">';
$o .= '<h2>' . sprintf( t('Delivery report for %1$s'),substr($mid,0,32)) . '...' . '</h2>';
$o .= '<table>';
for($x = 0; $x < count($r); $x++ ) {
$r[$x]['name'] = escape_tags(substr($r[$x]['dreport_recip'],strpos($r[$x]['dreport_recip'],' ')));
@@ -119,13 +132,24 @@ class Dreport extends \Zotlabs\Web\Controller {
}
usort($r,'self::dreport_gravity_sort');
$entries = array();
foreach($r as $rr) {
$o .= '<tr><td width="40%">' . $rr['name'] . '</td><td width="20%">' . escape_tags($rr['dreport_result']) . '</td><td width="20%">' . escape_tags($rr['dreport_time']) . '</td></tr>';
$entries[] = [
'name' => $rr['name'],
'result' => escape_tags($rr['dreport_result']),
'time' => escape_tags(datetime_convert('UTC',date_default_timezone_get(),$rr['dreport_time']))
];
}
$o .= '</table>';
$o .= '</div>';
$o = replace_macros(get_markup_template('dreport.tpl'), array(
'$title' => sprintf( t('Delivery report for %1$s'),substr($mid,0,32)) . '...',
'$table' => $table,
'$mid' => urlencode($mid),
'$push' => t('Redeliver'),
'$entries' => $entries
));
return $o;
+1 -1
View File
@@ -21,7 +21,7 @@ class Editblock extends \Zotlabs\Web\Controller {
else
return;
profile_load($a,$which);
profile_load($which);
}
+1 -1
View File
@@ -21,7 +21,7 @@ class Editlayout extends \Zotlabs\Web\Controller {
else
return;
profile_load($a,$which);
profile_load($which);
}
+1 -1
View File
@@ -23,7 +23,7 @@ class Editwebpage extends \Zotlabs\Web\Controller {
else
return;
profile_load($a,$which);
profile_load($which);
}
+1 -1
View File
@@ -40,7 +40,7 @@ class Hcard extends \Zotlabs\Web\Controller {
}
}
profile_load($a,$which,$profile);
profile_load($which,$profile);
}
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -21,7 +21,7 @@ class Layouts extends \Zotlabs\Web\Controller {
else
return;
profile_load($a,$which);
profile_load($which);
}
+2 -2
View File
@@ -62,7 +62,7 @@ class New_channel extends \Zotlabs\Web\Controller {
}
function post() {
function post() {
$arr = $_POST;
@@ -96,7 +96,7 @@ class New_channel extends \Zotlabs\Web\Controller {
}
function get() {
function get() {
$acc = \App::get_account();
+1 -1
View File
@@ -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 -3
View File
@@ -2,6 +2,7 @@
namespace Zotlabs\Module;
require_once('include/security.php');
require_once('include/attach.php');
require_once('include/photo/photo_driver.php');
@@ -10,6 +11,8 @@ class Photo extends \Zotlabs\Web\Controller {
function init() {
$prvcachecontrol = false;
$streaming = null;
$channel = null;
switch(argc()) {
case 4:
@@ -131,6 +134,8 @@ class Photo extends \Zotlabs\Web\Controller {
$sql_extra = permissions_sql($r[0]['uid']);
$channel = channelx_by_n($r[0]['uid']);
// Now we'll see if we can access the photo
$r = q("SELECT * FROM photo WHERE resource_id = '%s' AND imgscale = %d $sql_extra LIMIT 1",
@@ -141,8 +146,9 @@ class Photo extends \Zotlabs\Web\Controller {
if($r && $allowed) {
$data = dbunescbin($r[0]['content']);
$mimetype = $r[0]['mimetype'];
if(intval($r[0]['os_storage']))
$data = file_get_contents($data);
if(intval($r[0]['os_storage'])) {
$streaming = $data;
}
}
else {
@@ -242,7 +248,25 @@ class Photo extends \Zotlabs\Web\Controller {
header("Cache-Control: max-age=" . $cache);
}
echo $data;
// If it's a file resource, stream it.
if($streaming && $channel) {
if(strpos($streaming,'store') !== false)
$istream = fopen($streaming,'rb');
else
$istream = fopen('store/' . $channel['channel_address'] . '/' . $streaming,'rb');
$ostream = fopen('php://output','wb');
if($istream && $ostream) {
pipe_streams($istream,$ostream);
fclose($istream);
fclose($ostream);
}
}
else {
echo $data;
}
killme();
// NOTREACHED
}
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -48,7 +48,7 @@ class Profile extends \Zotlabs\Web\Controller {
}
}
profile_load($a,$which,$profile);
profile_load($which,$profile);
}
+3 -4
View File
@@ -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']);
}
@@ -53,7 +53,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
if((array_key_exists('postfinal',$_POST)) && (intval($_POST['cropfinal']) == 1)) {
if((array_key_exists('cropfinal',$_POST)) && (intval($_POST['cropfinal']) == 1)) {
// phase 2 - we have finished cropping
@@ -90,12 +90,11 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$srcY = $_POST['ystart'];
$srcW = $_POST['xfinal'] - $srcX;
$srcH = $_POST['yfinal'] - $srcY;
$r = q("SELECT * FROM photo WHERE resource_id = '%s' AND uid = %d AND imgscale = %d LIMIT 1",
dbesc($image_id),
dbesc(local_channel()),
intval($scale));
if($r) {
$base_image = $r[0];
+2 -2
View File
@@ -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()));
}
}
+1 -1
View File
@@ -17,7 +17,7 @@ class Profperm extends \Zotlabs\Web\Controller {
$profile = \App::$argv[1];
profile_load($a,$which,$profile);
profile_load($which,$profile);
}
+2 -1
View File
@@ -259,7 +259,8 @@ class Register extends \Zotlabs\Web\Controller {
'$email' => $email,
'$pass1' => $password,
'$pass2' => $password2,
'$submit' => ((UNO || $auto_create || $registration_is) ? t('Register') : t('Proceed to create your first channel'))
'$submit' => t('Register'),
'$verify_note' => t('This site may require email verification after submitting this form. If you are returned to a login page, please check your email for instructions.')
));
return $o;
+8 -2
View File
@@ -596,7 +596,7 @@ class Setup extends \Zotlabs\Web\Controller {
if(! is_writable('store')) {
$status = false;
$help = t('Red uses the store directory to save uploaded files. The web server needs to have write access to the store directory under the Red top level folder') . EOL;
$help = t('This software uses the store directory to save uploaded files. The web server needs to have write access to the store directory under the Red top level folder') . EOL;
$help .= t('Please ensure that the user that your web server runs as (e.g. www-data) has write access to this folder.').EOL;
}
@@ -639,6 +639,9 @@ class Setup extends \Zotlabs\Web\Controller {
$help .= t('If your certificate is not recognized, members of other sites (who may themselves have valid certificates) will get a warning message on their own site complaining about security issues.') . EOL;
$help .= t('This can cause usability issues elsewhere (not just on your own site) so we must insist on this requirement.') .EOL;
$help .= t('Providers are available that issue free certificates which are browser-valid.'). EOL;
$help .= t('If you are confident that the certificate is valid and signed by a trusted authority, check to see if you have failed to install an intermediate cert. These are not normally required by browsers, but are required for server-to-server communications.') . EOL;
$this->check_add($checks, t('SSL certificate validation'), false, true, $help);
}
@@ -695,6 +698,7 @@ class Setup extends \Zotlabs\Web\Controller {
// install the standard theme
set_config('system', 'allowed_themes', 'redbasic');
// Set a lenient list of ciphers if using openssl. Other ssl engines
// (e.g. NSS used in RedHat) require different syntax, so hopefully
// the default curl cipher list will work for most sites. If not,
@@ -704,7 +708,9 @@ class Setup extends \Zotlabs\Web\Controller {
// z_fetch_url() is also used to import shared links and other content
// so in theory most any cipher could show up and we should do our best
// to make the content available rather than tell folks that there's a
// weird SSL error which they can't do anything about.
// weird SSL error which they can't do anything about. This does not affect
// the SSL server, but is only a client negotiation to find something workable.
// Hence it will not make your system susceptible to POODL or other nasties.
$x = curl_version();
if(stristr($x['ssl_version'],'openssl'))
+5 -2
View File
@@ -10,8 +10,11 @@ class Viewconnections extends \Zotlabs\Web\Controller {
if(observer_prohibited()) {
return;
}
if(argc() > 1)
profile_load($a,argv(1));
if(argc() > 1) {
profile_load(argv(1));
}
}
function get() {
+1 -1
View File
@@ -23,7 +23,7 @@ class Webpages extends \Zotlabs\Web\Controller {
else
return;
profile_load($a,$which);
profile_load($which);
}
+18 -1
View File
@@ -20,11 +20,23 @@ 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() {
if(observer_prohibited(true)) {
return login();
}
$tab = 'wiki';
require_once('include/wiki.php');
require_once('include/acl_selectors.php');
require_once('include/conversation.php');
// TODO: Combine the interface configuration into a unified object
// Something like $interface = array('new_page_button' => false, 'new_wiki_button' => false, ...)
$wiki_owner = false;
@@ -123,7 +135,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');
$html = wiki_generate_toc(purify_html(Markdown(json_decode($content))));
@@ -150,6 +162,11 @@ class Wiki extends \Zotlabs\Web\Controller {
)
);
$is_owner = ((local_channel()) && (local_channel() == \App::$profile['profile_uid']) ? true : false);
$o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']);
$o .= replace_macros(get_markup_template('wiki.tpl'),array(
'$wikiheaderName' => $wikiheaderName,
'$wikiheaderPage' => $wikiheaderPage,