This commit is contained in:
marijus 2014-03-05 17:03:38 +01:00
commit 6cdc25ade9
28 changed files with 340 additions and 59 deletions

View File

@ -26,7 +26,7 @@ header { z-index: 10000; }
<div style="margin-top: 50px;"></div>
<center>
<div style="color:#808080;font-weight:bold;font-size:4.0em; margin-bottom:75px;">Dream it. Do it.</div>
<div style="color:#808080;font-weight:bold;font-size:4.0em; margin-top:105px; margin-bottom:45px;">Dream it. Do it.</div>
<img style="width: 450px; margin-bottom: 95px;" src="assets/logo_simplifiedap.png" >
</center>
<div class="tr">
@ -72,4 +72,4 @@ header { z-index: 10000; }
<div class="tr"></div>
<center><div style="margin-top: 35px; color: #808080; font-size: 1.8em;">Welcome to the Matrix</div><div style="font-size: 1.4em; color: #808080;">&ldquo;The most fun you ever had without taking your clothes off.&rdquo;<br /><a href="pubsites">Public Sites</a> | <a href="https://redmatrix.me">Project Home</a> | <a href="https://github.com/friendica/red">Git</a> | <a href="https://zothub.com/channel/one">Developers</a></div></center>
<center><div style="margin-top: 35px; color: #808080; font-size: 1.8em;">Welcome to the Matrix</div><a href="pubsites">Public Sites</a> | <a href="https://redmatrix.me">Project Home</a> | <a href="https://github.com/friendica/red">Git</a> | <a href="https://zothub.com/channel/one">Developers</a></div></center>

View File

@ -290,6 +290,7 @@ define ( 'ABOOK_FLAG_IGNORED' , 0x0002);
define ( 'ABOOK_FLAG_HIDDEN' , 0x0004);
define ( 'ABOOK_FLAG_ARCHIVED' , 0x0008);
define ( 'ABOOK_FLAG_PENDING' , 0x0010);
define ( 'ABOOK_FLAG_UNCONNECTED', 0x0020);
define ( 'ABOOK_FLAG_SELF' , 0x0080);

View File

@ -98,9 +98,9 @@ Widgets are executable apps provided by the system which you can place on your p
Widgets and arguments are specified with the 'widget' and 'arg' tags.
Widgets and arguments are specified with the 'widget' and 'var' tags.
[widget=recent_visitors][arg=count]24[/arg][/widget]
[widget=recent_visitors][var=count]24[/var][/widget]
This loads the "recent_visitors" widget and supplies it with the argument "count" set to "24".
@ -136,8 +136,8 @@ Please note that pasting this example into a layout page is not likely to do any
[menu]myfavouritemenu[/menu]
[widget=recent_visitors]
[arg=count]24[/arg]
[arg=names_only]1[/arg]
[var=count]24[/var]
[var=names_only]1[/var]
[/widget]
[widget=tagcloud][/widget]

73
doc/Widgets.md Normal file
View File

@ -0,0 +1,73 @@
Core Widgets
============
Some/many of these widgets have restrictions which may restrict the type of page where they may appear or may require login
* clock - displays the current time
* args: military (1 or 0) - use 24 hour time as opposed to AM/PM
*
* profile - displays a profile sidebar on pages which load profiles (pages with nickname in the URL)
* tagcloud - display a tagcloud of webpage items
* args: count - number of items to return (default 24)
*
* collections - collection selector for the current logged in channel
* args: mode - one of "conversation", "group", "abook" depending on module
*
* suggestions - friend suggestions for the current logged on channel
* follow - presents a text box for following another channel
* notes - private notes area for the current logged in channel if private_notes feature is enabled
* savedsearch - network/matrix search with save - must be logged in and savedsearch feature enabled
* filer - select filed items from network/matrix stream - must be logged in
* archive - date range selector for network and channel pages
* fullprofile - same as profile currently
* categories - categories filter (channel page)
* tagcloud_wall - tagcloud for channel page only
* affinity - affinity slider for network page - must be logged in
* settings_menu - sidebar menu for settings page, must be logged in
* mailmenu - sidebar menu for private message page - must be logged in
* design_tools - design tools menu for webpage building pages, must be logged in
* findpeople - tools to find other channels
* photo_albums - list photo albums of the current page owner with a selector menu
* vcard - mini profile sidebar for the person of interest (page owner, whatever)
* dirsafemode - directory selection tool - only on directory pages
* dirsort - directory selection tool - only on directory pages
* dirtags - directory tool - only on directory pages
* menu_preview - preview a menu - only on menu edit pages
* chatroom_list - list of chatrooms for the page owner
* bookmarkedchats - list of bookmarked chatrooms collected on this site for the current observer
* suggestechats - "interesting" chatrooms chosen for the current observer
* item - displays a single webpage item by mid
1 args: mid - message_id of webpage to display

View File

@ -111,9 +111,9 @@ Widgets are executable apps provided by the system which you can place on your p
[/code]
Widgets and arguments are specified with the 'widget' and 'arg' tags.
Widgets and arguments are specified with the 'widget' and 'var' tags.
[code]
[widget=recent_visitors][arg=count]24[/arg][/widget]
[widget=recent_visitors][var=count]24[/var][/widget]
[/code]
This loads the &quot;recent_visitors&quot; widget and supplies it with the argument &quot;count&quot; set to &quot;24&quot;.
@ -150,8 +150,8 @@ The 'comment' tag is used to delimit comments. These comments will not appear on
[menu]myfavouritemenu[/menu]
[widget=recent_visitors]
[arg=count]24[/arg]
[arg=names_only]1[/arg]
[var=count]24[/var]
[var=names_only]1[/var]
[/widget]
[widget=tagcloud][/widget]

View File

@ -37,6 +37,7 @@
[zrl=[baseurl]/help/install]Install[/zrl]
[zrl=[baseurl]/help/comanche]Comanche Page Descriptions[/zrl]
[zrl=[baseurl]/help/Creating-Templates]Creating Comanche Templates[/zrl]
[zrl=[baseurl]/help/Widgets]Core Widgets[/zrl]
[zrl=[baseurl]/help/plugins]Plugins[/zrl]
[zrl=[baseurl]/help/schema_development]Schemas[/zrl]
[zrl=[baseurl]/help/developers]Developers[/zrl]

View File

@ -533,6 +533,12 @@ require_once('include/items.php');
api_register_func('api/red/channel/export/basic','api_export_basic', true);
function api_channel_stream(&$a, $type) {
if(api_user() === false) {
logger('api_channel_stream: no user');
@ -691,6 +697,48 @@ require_once('include/items.php');
api_register_func('api/statuses/update','api_statuses_update', true);
function red_item_new(&$a, $type) {
if (api_user() === false) {
logger('api_statuses_update: no user');
return false;
}
logger('api_statuses_update: REQUEST ' . print_r($_REQUEST,true));
logger('api_statuses_update: FILES ' . print_r($_FILES,true));
// set this so that the item_post() function is quiet and doesn't redirect or emit json
$_REQUEST['api_source'] = true;
$_REQUEST['profile_uid'] = api_user();
if(x($_FILES,'media')) {
$_FILES['userfile'] = $_FILES['media'];
// upload the image if we have one
$_REQUEST['silent']='1'; //tell wall_upload function to return img info instead of echo
require_once('mod/wall_upload.php');
$media = wall_upload_post($a);
if(strlen($media)>0)
$_REQUEST['body'] .= "\n\n".$media;
}
require_once('mod/item.php');
$x = item_post($a);
json_return_and_die($x);
}
api_register_func('api/red/item/new','red_item_new', true);
function api_status_show(&$a, $type){
$user_info = api_get_user($a);

View File

@ -1223,4 +1223,4 @@ function get_channel_by_nick($nick) {
);
return(($r) ? $r[0] : false);
}
}

View File

@ -1548,7 +1548,7 @@ function item_store($arr,$allow_exec = false) {
$allow_exec = $d['allow_exec'];
$ret = array('result' => false, 'item_id' => 0);
$ret = array('success' => false, 'item_id' => 0);
if(! $arr['uid']) {
logger('item_store: no uid');
@ -1933,7 +1933,7 @@ function item_store_update($arr,$allow_exec = false) {
$ret = array('result' => false, 'item_id' => 0);
$ret = array('success' => false, 'item_id' => 0);
if(! intval($arr['uid'])) {
logger('item_store_update: no uid');
$ret['message'] = 'no uid.';

View File

@ -59,7 +59,6 @@ EOT;
$a->page['header'] .= replace_macros(get_markup_template('hdr.tpl'), array(
'$baseurl' => $a->get_baseurl(),
'$sitelocation' => $sitelocation,
'$langselector' => ((get_config('system','select_language')) ? lang_selector() : ''),
'$banner' => $banner
));

View File

@ -29,19 +29,16 @@ function onepoll_run($argv, $argc){
return;
}
$d = datetime_convert();
$contacts = q("SELECT abook.*, xchan.*, account.*
FROM abook LEFT JOIN account on abook_account = account_id left join xchan on xchan_hash = abook_xchan
where abook_id = %d
AND (( abook_flags = %d ) OR ( abook_flags = %d ) OR ( abook_flags & %d ))
AND (( abook_flags & %d ) OR ( abook_flags = %d ))
AND (( account_flags = %d ) OR ( account_flags = %d )) limit 1",
intval($contact_id),
intval(ABOOK_FLAG_HIDDEN),
intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED),
intval(0),
intval(ABOOK_FLAG_PENDING),
intval(ACCOUNT_OK),
intval(ACCOUNT_UNVERIFIED)
);

View File

@ -184,9 +184,7 @@ function poller_run($argv, $argc){
if(! $restart)
proc_run('php','include/cronhooks.php');
// Only poll from those with suitable relationships,
// and which have a polling address and ignore Diaspora since
// we are unable to match those posts with a Diaspora GUID and prevent duplicates.
// Only poll from those with suitable relationships
$abandon_sql = (($abandon_days)
? sprintf(" AND account_lastlog > UTC_TIMESTAMP() - INTERVAL %d DAY ", intval($abandon_days))
@ -197,10 +195,9 @@ function poller_run($argv, $argc){
$contacts = q("SELECT abook_id, abook_flags, abook_updated, abook_connected, abook_closeness, abook_channel
FROM abook LEFT JOIN account on abook_account = account_id where 1
$sql_extra
AND (( abook_flags = %d ) OR ( abook_flags = %d ))
AND (( abook_flags & %d ) OR ( abook_flags = %d ))
AND (( account_flags = %d ) OR ( account_flags = %d )) $abandon_sql ORDER BY RAND()",
intval(ABOOK_FLAG_HIDDEN),
intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED),
intval(0),
intval(ACCOUNT_OK),
intval(ACCOUNT_UNVERIFIED) // FIXME

View File

@ -649,4 +649,60 @@ function widget_item($arr) {
$o .= prepare_page($r[0]);
return $o;
}
function widget_clock($arr) {
$miltime = 0;
if(isset($arr['military']) && $arr['military'])
$miltime = 1;
$o = <<< EOT
<div class="widget">
<h3 class="clockface"></h3>
<script>
var timerID = null
var timerRunning = false
function stopclock(){
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}
function startclock(){
stopclock()
showtime()
}
function showtime(){
var now = new Date()
var hours = now.getHours()
var minutes = now.getMinutes()
var seconds = now.getSeconds()
var military = $miltime
var timeValue = ""
if(military)
timeValue = hours
else
timeValue = ((hours > 12) ? hours - 12 : hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
// timeValue += ((seconds < 10) ? ":0" : ":") + seconds
if(! military)
timeValue += (hours >= 12) ? " P.M." : " A.M."
$('.clockface').html(timeValue)
timerID = setTimeout("showtime()",1000)
timerRunning = true
}
$(document).ready(function() {
startclock();
});
</script>
</div>
EOT;
return $o;
}

View File

@ -351,7 +351,10 @@ function zot_refresh($them,$channel = null, $force = false) {
intval(ABOOK_FLAG_SELF)
);
if($r) {
if($r) {
$current_abook_connected = (($r[0]['abook_flags'] & ABOOK_FLAG_UNCONNECTED) ? 0 : 1);
$y = q("update abook set abook_their_perms = %d
where abook_xchan = '%s' and abook_channel = %d
and not (abook_flags & %d) limit 1",
@ -360,14 +363,16 @@ function zot_refresh($them,$channel = null, $force = false) {
intval($channel['channel_id']),
intval(ABOOK_FLAG_SELF)
);
if($connected_set === 0) {
// if they are in your address book but you aren't in theirs, mark their address book entry hidden.
if(($connected_set === 0 || $connected_set === 1) && ($connected_set !== $current_abook_unconnected)) {
$y1 = q("update abook set abook_flags = (abook_flags | %d)
// if they are in your address book but you aren't in theirs, and/or this does not
// match your current connected state setting, toggle it.
$y1 = q("update abook set abook_flags = (abook_flags ^ %d)
where abook_xchan = '%s' and abook_channel = %d
and not (abook_flags & %d) limit 1",
intval(ABOOK_FLAG_HIDDEN),
intval(ABOOK_FLAG_UNCONNECTED),
dbesc($x['hash']),
intval($channel['channel_id']),
intval(ABOOK_FLAG_SELF)

View File

@ -35,7 +35,7 @@ function connections_post(&$a) {
if(! $orig_record) {
notice( t('Could not access contact record.') . EOL);
goaway($a->get_baseurl(true) . '/connections');
goaway(z_root() . '/connections');
return; // NOTREACHED
}
@ -170,14 +170,14 @@ function connections_content(&$a) {
return login();
}
$blocked = false;
$hidden = false;
$ignored = false;
$archived = false;
$unblocked = false;
$pending = false;
$all = false;
$blocked = false;
$hidden = false;
$ignored = false;
$archived = false;
$unblocked = false;
$pending = false;
$unconnected = false;
$all = false;
$_SESSION['return_url'] = $a->query_string;
@ -212,6 +212,11 @@ function connections_content(&$a) {
$pending = true;
nav_set_selected('intros');
break;
case 'unconnected':
$search_flags = ABOOK_FLAG_UNCONNECTED;
$head = t('Unconnected');
$unconnected = true;
break;
case 'all':
$head = t('All');
@ -237,57 +242,65 @@ function connections_content(&$a) {
$tabs = array(
array(
'label' => t('Suggestions'),
'url' => $a->get_baseurl(true) . '/suggest',
'url' => z_root() . '/suggest',
'sel' => '',
'title' => t('Suggest new connections'),
),
array(
'label' => t('New Connections'),
'url' => $a->get_baseurl(true) . '/connections/pending',
'url' => z_root() . '/connections/pending',
'sel' => ($pending) ? 'active' : '',
'title' => t('Show pending (new) connections'),
),
array(
'label' => t('All Connections'),
'url' => $a->get_baseurl(true) . '/connections/all',
'url' => z_root() . '/connections/all',
'sel' => ($all) ? 'active' : '',
'title' => t('Show all connections'),
),
array(
'label' => t('Unblocked'),
'url' => $a->get_baseurl(true) . '/connections',
'url' => z_root() . '/connections',
'sel' => (($unblocked) && (! $search) && (! $nets)) ? 'active' : '',
'title' => t('Only show unblocked connections'),
),
array(
'label' => t('Blocked'),
'url' => $a->get_baseurl(true) . '/connections/blocked',
'url' => z_root() . '/connections/blocked',
'sel' => ($blocked) ? 'active' : '',
'title' => t('Only show blocked connections'),
),
array(
'label' => t('Ignored'),
'url' => $a->get_baseurl(true) . '/connections/ignored',
'url' => z_root() . '/connections/ignored',
'sel' => ($ignored) ? 'active' : '',
'title' => t('Only show ignored connections'),
),
array(
'label' => t('Archived'),
'url' => $a->get_baseurl(true) . '/connections/archived',
'url' => z_root() . '/connections/archived',
'sel' => ($archived) ? 'active' : '',
'title' => t('Only show archived connections'),
),
array(
'label' => t('Hidden'),
'url' => $a->get_baseurl(true) . '/connections/hidden',
'url' => z_root() . '/connections/hidden',
'sel' => ($hidden) ? 'active' : '',
'title' => t('Only show hidden connections'),
),
array(
'label' => t('Unconnected'),
'url' => z_root() . '/connections/unconnected',
'sel' => ($unconnected) ? 'active' : '',
'title' => t('Only show one-way connections'),
),
);
$tab_tpl = get_markup_template('common_tabs.tpl');

View File

@ -99,7 +99,7 @@ function dirsearch_content(&$a) {
$perpage = (($_REQUEST['n']) ? $_REQUEST['n'] : 80);
$perpage = (($_REQUEST['n']) ? $_REQUEST['n'] : 300);
$page = (($_REQUEST['p']) ? intval($_REQUEST['p'] - 1) : 0);
$startrec = (($page+1) * $perpage) - $perpage;
$limit = (($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 0);

View File

@ -862,7 +862,7 @@ function item_post(&$a) {
// figure out how to return, depending on from whence we came
if($api_source)
return;
return $post;
if($return_path) {
goaway($a->get_baseurl() . "/" . $return_path);

6
mod/lang.php Normal file
View File

@ -0,0 +1,6 @@
<?php
function lang_content(&$a) {
return lang_selector();
}

View File

@ -62,6 +62,7 @@ function openid_content(&$a) {
if($r) {
$_SESSION['authenticated'] = 1;
$_SESSION['visitor_id'] = $r[0]['xchan_hash'];
$_SESSION['my_url'] = $r[0]['xchan_url'];
$_SESSION['my_address'] = $r[0]['xchan_addr'];
$arr = array('xchan' => $r[0], 'session' => $_SESSION);
call_hooks('magic_auth_openid_success',$arr);
@ -169,6 +170,7 @@ function openid_content(&$a) {
set_xconfig($url,'system','openid',$authid);
$_SESSION['authenticated'] = 1;
$_SESSION['visitor_id'] = $r[0]['xchan_hash'];
$_SESSION['my_url'] = $r[0]['xchan_url'];
$_SESSION['my_address'] = $r[0]['xchan_addr'];
$arr = array('xchan' => $r[0], 'session' => $_SESSION);
call_hooks('magic_auth_openid_success',$arr);

62
mod/pdledit.php Normal file
View File

@ -0,0 +1,62 @@
<?php
function pdledit_post(&$a) {
if(! local_user())
return;
if(! $_REQUEST['module'])
return;
if(! trim($_REQUEST['content'])) {
del_pconfig(local_user(),'system','mod_' . $_REQUEST['module'] . '.pdl');
goaway(z_root() . '/pdledit/' . $_REQUEST['module']);
}
set_pconfig(local_user(),'system','mod_' . $_REQUEST['module'] . '.pdl',escape_tags($_REQUEST['content']));
info( t('Layout updated.') . EOL);
goaway(z_root() . '/pdledit/' . $_REQUEST['module']);
}
function pdledit_content(&$a) {
if(! local_user()) {
notice( t('Permission denied.') . EOL);
return;
}
if(argc() > 1)
$module = 'mod_' . argv(1) . '.pdl';
else {
$o .= '<h1>' . t('Edit System Page Description') . '</h1>';
$files = glob('mod/*');
if($files) {
foreach($files as $f) {
$name = basename($f,'.php');
$x = theme_include('mod_' . $name . '.pdl');
if($x) {
$o .= '<a href="pdledit/' . $name . '" >' . $name . '</a><br />';
}
}
}
// list module pdl files
return $o;
}
$t = get_pconfig(local_user(),'system',$module);
if(! $t)
$t = file_get_contents(theme_include($module));
if(! $t) {
notice( t('Layout not found.') . EOL);
return '';
}
$o = replace_macros(get_markup_template('pdledit.tpl'),array(
'$header' => t('Edit System Page Description'),
'$mname' => t('Module Name:'),
'$help' => t('Layout Help'),
'$module' => argv(1),
'$content' => htmlspecialchars($t,ENT_COMPAT,'UTF-8'),
'$submit' => t('Submit')
));
return $o;
}

View File

@ -243,6 +243,7 @@ function post_init(&$a) {
$_SESSION['authenticated'] = 1;
$_SESSION['visitor_id'] = $x[0]['xchan_hash'];
$_SESSION['my_url'] = $x[0]['xchan_url'];
$_SESSION['my_address'] = $address;
$_SESSION['remote_service_class'] = $remote_service_class;
$_SESSION['remote_level'] = $remote_level;

View File

@ -758,6 +758,7 @@ function settings_content(&$a) {
'$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 100 items')),
'$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''),
'$chanview_full' => array('chanview_full', t('Do not view remote profiles in frames'), $chanview, t('By default open in a sub-window of your own site')),
'$layout_editor' => t('System Page Layout Editor - (advanced)'),
'$theme_config' => $theme_config,
));

View File

@ -1 +1 @@
2014-03-04.606
2014-03-05.607

View File

@ -1107,12 +1107,6 @@ footer {
margin-bottom: 15px;
}
#language-selector {
position: absolute;
top: 0px;
left: 16px;
}
#group-members {
margin-top: 20px;
padding: 10px;

View File

@ -4,5 +4,4 @@
<li class="{5}"><a href="{0}" title="{2} {3}"><img src="{1}"><span class='contactname'>{2}</span>{3}<br><span class="notif-when">{4}</span></a></li>
</ul>
{{if $langselector}}<div id="langselector" >{{$langselector}}</div>{{/if}}
<div id="panel" style="display: none;"></div>

View File

@ -1,5 +1,6 @@
<div id="lang-select-icon" title="{{$title}}" onclick="openClose('language-selector');" ><i class="icon-flag"></i></div>
<div id="language-selector" style="display: none;" >
<h1>{{$title}}</h1>
<br />
<div id="language-selector" >
<form action="#" method="post" >
<select name="system_language" onchange="this.form.submit();" >
{{foreach $langs.0 as $v=>$l}}

21
view/tpl/pdledit.tpl Normal file
View File

@ -0,0 +1,21 @@
<h1>{{$header}}</h1>
<h2>{{$mname}} {{$module}}</h2>
<br />
<a href="help/Comanche" target="redmatrix-help">{{$help}}</a>
<br />
<br />
<form action="pdledit" method="post" >
<input type="hidden" name="module" value="{{$module}}" />
<textarea rows="24" cols="80" name="content">{{$content}}</textarea>
<br />
<input type="submit" name="submit" value="{{$submit}}" />
</form>

View File

@ -16,6 +16,10 @@
<input type="submit" name="submit" class="settings-submit" value="{{$submit}}" />
</div>
<br />
<a href="pdledit">{{$layout_editor}}</a>
<br />
{{if $theme_config}}
<h2>Theme settings</h2>
{{$theme_config}}