Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Haakon Meland Eriksen 2015-11-13 16:45:31 +01:00
commit 0178840c19
16 changed files with 132 additions and 10 deletions

View File

@ -2056,6 +2056,10 @@ function construct_page(&$a) {
$a->build_pagehead(); $a->build_pagehead();
if($a->page['pdl_content']) {
$a->page['content'] = comanche_region($a,$a->page['content']);
}
// Let's say we have a comanche declaration '[region=nav][/region][region=content]$nav $content[/region]'. // Let's say we have a comanche declaration '[region=nav][/region][region=content]$nav $content[/region]'.
// The text 'region=' identifies a section of the layout by that name. So what we want to do here is leave // The text 'region=' identifies a section of the layout by that name. So what we want to do here is leave
// $a->page['nav'] empty and put the default content from $a->page['nav'] and $a->page['section'] // $a->page['nav'] empty and put the default content from $a->page['nav'] and $a->page['section']
@ -2070,6 +2074,7 @@ function construct_page(&$a) {
call_hooks('construct_page', $arr); call_hooks('construct_page', $arr);
$a->layout = $arr['layout']; $a->layout = $arr['layout'];
foreach($a->layout as $k => $v) { foreach($a->layout as $k => $v) {
if((strpos($k, 'region_') === 0) && strlen($v)) { if((strpos($k, 'region_') === 0) && strlen($v)) {
if(strpos($v, '$region_') !== false) { if(strpos($v, '$region_') !== false) {

View File

@ -108,6 +108,13 @@ Some/many of these widgets have restrictions which may restrict the type of page
<br />&nbsp;<br /> <br />&nbsp;<br />
* album - provides a widget containing a complete photo album from albums belonging to the page owner; this may be too large to present in a sidebar region as is best implemented as a content region widget.
* args:
* album - album name
* title - optional title, album name is used if not present
<br />&nbsp;<br />
Creating New Widgets Creating New Widgets
==================== ====================

View File

@ -15,7 +15,7 @@
[/td][/tr] [/td][/tr]
[tr][td]channel_guid_sig[/td][td]channel.gui signed with channel.prvkey and base64url_encoded[/td][td]text[/td][td]NO[/td][td][/td][td]NULL[/td][td] [tr][td]channel_guid_sig[/td][td]channel.gui signed with channel.prvkey and base64url_encoded[/td][td]text[/td][td]NO[/td][td][/td][td]NULL[/td][td]
[/td][/tr] [/td][/tr]
[tr][td]channel_hash[/td][td]whirlpool hash of channel.guid and channel_guid_sig concatenated, synonymous with xchan_hash[/td][td]char(255)[/td][td]NO[/td][td]MUL[/td][td][/td][td] [tr][td]channel_hash[/td][td]base64url_encode of a 64-char whirlpool hash of channel.guid and channel_guid_sig concatenated, synonymous with xchan_hash.[/td][td]char(255)[/td][td]NO[/td][td]MUL[/td][td][/td][td]
[/td][/tr] [/td][/tr]
[tr][td]channel_timezone[/td][td]PHP-legal timezone[/td][td]char(128)[/td][td]NO[/td][td]MUL[/td][td]UTC[/td][td] [tr][td]channel_timezone[/td][td]PHP-legal timezone[/td][td]char(128)[/td][td]NO[/td][td]MUL[/td][td]UTC[/td][td]
[/td][/tr] [/td][/tr]
@ -97,4 +97,4 @@
[/td][/tr] [/td][/tr]
[/table] [/table]
Return to [zrl=[baseurl]/help/database]database documentation[/zrl] Return to [zrl=[baseurl]/help/database]database documentation[/zrl]

View File

@ -15,7 +15,7 @@
[zrl=[baseurl]/help/Translations]Translations[/zrl] [zrl=[baseurl]/help/Translations]Translations[/zrl]
[zrl=[baseurl]/help/developers]Developers[/zrl] [zrl=[baseurl]/help/developers]Developers[/zrl]
[zrl=[baseurl]/help/intro_for_developers]Intro for Developers[/zrl] [zrl=[baseurl]/help/intro_for_developers]Intro for Developers[/zrl]
[zrl=[baseurl]/help/database]Database schema documantation[/zrl] [zrl=[baseurl]/help/database]Database schema documentation[/zrl]
[zrl=[baseurl]/help/api_functions]API functions[/zrl] [zrl=[baseurl]/help/api_functions]API functions[/zrl]
[zrl=[baseurl]/help/api_posting]Posting to the red# using the API[/zrl] [zrl=[baseurl]/help/api_posting]Posting to the red# using the API[/zrl]
[zrl=[baseurl]/help/developer_function_primer]Red Functions 101[/zrl] [zrl=[baseurl]/help/developer_function_primer]Red Functions 101[/zrl]

File diff suppressed because one or more lines are too long

View File

@ -1089,6 +1089,11 @@ function format_like($cnt, $arr, $type, $id) {
return $o; return $o;
} }
/**
* This is our general purpose content editor.
* It was once nicknamed "jot" and you may see references to "jot" littered throughout the code.
* They are referring to the content editor or components thereof.
*/
function status_editor($a, $x, $popup = false) { function status_editor($a, $x, $popup = false) {

View File

@ -3,6 +3,17 @@
function photo_factory($data, $type = null) { function photo_factory($data, $type = null) {
$ph = null; $ph = null;
$unsupported_types = array(
'image/bmp',
'image/vnd.microsoft.icon',
'image/tiff',
'image/svg+xml'
);
if($type && in_array(strtolower($type),$unsupported_types))
return null;
$ignore_imagick = get_config('system', 'ignore_imagick'); $ignore_imagick = get_config('system', 'ignore_imagick');
if(class_exists('Imagick') && !$ignore_imagick) { if(class_exists('Imagick') && !$ignore_imagick) {

View File

@ -94,6 +94,8 @@ function z_input_filter($channel_id,$s,$type = 'text/bbcode') {
return escape_tags($s); return escape_tags($s);
if($type == 'text/plain') if($type == 'text/plain')
return escape_tags($s); return escape_tags($s);
if($type == 'application/x-pdl')
return escape_tags($s);
$a = get_app(); $a = get_app();
if($a->is_sys) { if($a->is_sys) {
@ -1517,6 +1519,11 @@ function prepare_text($text, $content_type = 'text/bbcode', $cache = false) {
$s = Markdown($text); $s = Markdown($text);
break; break;
case 'application/x-pdl';
$s = escape_tags($text);
break;
// No security checking is done here at display time - so we need to verify // No security checking is done here at display time - so we need to verify
// that the author is allowed to use PHP before storing. We also cannot allow // that the author is allowed to use PHP before storing. We also cannot allow
// importation of PHP text bodies from other sites. Therefore this content // importation of PHP text bodies from other sites. Therefore this content
@ -1681,7 +1688,8 @@ function mimetype_select($channel_id, $current = 'text/bbcode') {
'text/bbcode', 'text/bbcode',
'text/html', 'text/html',
'text/markdown', 'text/markdown',
'text/plain' 'text/plain',
'application/x-pdl'
); );
$a = get_app(); $a = get_app();

View File

@ -1221,3 +1221,81 @@ function widget_admin($arr) {
return $o; return $o;
} }
function widget_album($args) {
$owner_uid = get_app()->profile_uid;
$sql_extra = permissions_sql($owner_uid);
if($args['album'])
$album = $args['album'];
if($args['title'])
$title = $args['title'];
$order = 'DESC';
$r = q("SELECT p.resource_id, p.id, p.filename, p.type, p.scale, p.description, p.created FROM photo p INNER JOIN
(SELECT resource_id, max(scale) scale FROM photo WHERE uid = %d AND album = '%s' AND scale <= 4 AND photo_usage IN ( %d, %d ) $sql_extra GROUP BY resource_id) ph
ON (p.resource_id = ph.resource_id AND p.scale = ph.scale)
ORDER BY created $order ",
intval($owner_uid),
dbesc($album),
intval(PHOTO_NORMAL),
intval(PHOTO_PROFILE)
);
//edit album name
$album_edit = null;
$photos = array();
if($r) {
$twist = 'rotright';
foreach($r as $rr) {
if($twist == 'rotright')
$twist = 'rotleft';
else
$twist = 'rotright';
$ext = $phototypes[$rr['type']];
$imgalt_e = $rr['filename'];
$desc_e = $rr['description'];
$imagelink = (z_root() . '/photos/' . get_app()->profile['channel_address'] . '/image/' . $rr['resource_id']);
$photos[] = array(
'id' => $rr['id'],
'twist' => ' ' . $twist . rand(2,4),
'link' => $imagelink,
'title' => t('View Photo'),
'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['scale'] . '.' .$ext,
'alt' => $imgalt_e,
'desc'=> $desc_e,
'ext' => $ext,
'hash'=> $rr['resource_id'],
'unknown' => t('Unknown')
);
}
}
$tpl = get_markup_template('photo_album.tpl');
$o .= replace_macros($tpl, array(
'$photos' => $photos,
'$album' => (($title) ? $title : $album),
'$album_edit' => array(t('Edit Album'), $album_edit),
'$can_post' => false,
'$upload' => array(t('Upload'), z_root() . '/photos/' . get_app()->profile['channel_address'] . '/upload/' . bin2hex($album)),
'$order' => false,
'$upload_form' => $upload_form,
'$usage' => $usage_message
));
return $o;
}

View File

@ -44,7 +44,6 @@ CREATE TABLE "abook" (
create index "abook_profile" on abook ("abook_profile"); create index "abook_profile" on abook ("abook_profile");
create index "abook_dob" on abook ("abook_dob"); create index "abook_dob" on abook ("abook_dob");
create index "abook_connected" on abook ("abook_connected"); create index "abook_connected" on abook ("abook_connected");
create index "abook_rating" on abook ("abook_rating");
create index "abook_channel_closeness" on abook ("abook_channel", "abook_closeness"); create index "abook_channel_closeness" on abook ("abook_channel", "abook_closeness");
CREATE TABLE "account" ( CREATE TABLE "account" (

View File

@ -121,6 +121,8 @@ function directory_content(&$a) {
} }
if(! $url) { if(! $url) {
$directory = find_upstream_directory($dirmode); $directory = find_upstream_directory($dirmode);
if((! $directory) || (! array_key_exists('url',$directory)) || (! $directory['url']))
logger('CRITICAL: No directory server URL');
$url = $directory['url'] . '/dirsearch'; $url = $directory['url'] . '/dirsearch';
} }

View File

@ -56,7 +56,7 @@ function dreport_content(&$a) {
return; return;
} }
$o .= '<div class="generic-content-wrapper-styled">';
$o .= '<h2>' . sprintf( t('Delivery report for %1$s'),substr($mid,0,32)) . '...' . '</h2>'; $o .= '<h2>' . sprintf( t('Delivery report for %1$s'),substr($mid,0,32)) . '...' . '</h2>';
$o .= '<table>'; $o .= '<table>';
@ -121,6 +121,7 @@ function dreport_content(&$a) {
$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>'; $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>';
} }
$o .= '</table>'; $o .= '</table>';
$o .= '</div>';
return $o; return $o;
@ -135,4 +136,4 @@ function dreport_gravity_sort($a,$b) {
return strcmp($a['name'],$b['name']); return strcmp($a['name'],$b['name']);
} }
return (($a['gravity'] > $b['gravity']) ? 1 : (-1)); return (($a['gravity'] > $b['gravity']) ? 1 : (-1));
} }

View File

@ -131,6 +131,10 @@ function page_content(&$a) {
xchan_query($r); xchan_query($r);
$r = fetch_post_tags($r,true); $r = fetch_post_tags($r,true);
if($r[0]['mimetype'] === 'application/x-pdl')
$a->page['pdl_content'] = true;
$o .= prepare_page($r[0]); $o .= prepare_page($r[0]);
return $o; return $o;

View File

@ -1 +1 @@
2015-11-11.1213 2015-11-12.1214

View File

@ -299,7 +299,7 @@ input {
border: 1px solid rgba(255,255,255,.5); border: 1px solid rgba(255,255,255,.5);
} }
.contact-entry-edit a:hover, .contact-entry-edit a:focus, .generic-content-wrapper-styled > p > span.btn.btn-default > a:hover,.generic-content-wrapper-styled > p > span.btn.btn-default > a:focus, div#profile-edit-links a:hover, div#profile-edit-links a:focus { .contact-entry-edit:hover a, .contact-entry-edit:focus a, .generic-content-wrapper-styled > p > span.btn.btn-default > a:hover,.generic-content-wrapper-styled > p > span.btn.btn-default > a:focus, div#profile-edit-links a:hover, div#profile-edit-links a:focus {
color: #43488A; color: #43488A;
} }

View File

@ -1,7 +1,9 @@
<div class="generic-content-wrapper"> <div class="generic-content-wrapper">
<div class="section-title-wrapper"> <div class="section-title-wrapper">
<div class="pull-right"> <div class="pull-right">
{{if $order}}
<a class="btn btn-default btn-xs" href="{{$order.1}}" title="{{$order.0}}"><i class="icon-sort"></i></a> <a class="btn btn-default btn-xs" href="{{$order.1}}" title="{{$order.0}}"><i class="icon-sort"></i></a>
{{/if}}
<div class="btn-group btn-group"> <div class="btn-group btn-group">
{{if $album_edit.1}} {{if $album_edit.1}}
<i class="icon-pencil btn btn-default btn-xs" title="{{$album_edit.0}}" onclick="openClose('photo-album-edit-wrapper'); closeMenu('photo-upload-form');"></i> <i class="icon-pencil btn btn-default btn-xs" title="{{$album_edit.0}}" onclick="openClose('photo-album-edit-wrapper'); closeMenu('photo-upload-form');"></i>