This commit is contained in:
friendica 2013-12-22 13:51:08 -08:00
commit 42361588e9
15 changed files with 7506 additions and 42 deletions

View File

@ -46,7 +46,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1084 );
define ( 'DB_UPDATE_VERSION', 1085 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@ -363,7 +363,7 @@ define ( 'HUBLOC_FLAGS_PRIMARY', 0x0001);
define ( 'HUBLOC_FLAGS_UNVERIFIED', 0x0002);
define ( 'HUBLOC_FLAGS_DELETED', 0x1000);
define ( 'XCHAN_FLAGS_NORMAL', 0x0000);
define ( 'XCHAN_FLAGS_HIDDEN', 0x0001);
define ( 'XCHAN_FLAGS_ORPHAN', 0x0002);
define ( 'XCHAN_FLAGS_CENSORED', 0x0004);
@ -496,10 +496,11 @@ define ( 'ITEM_MODERATED', 0x0004);
define ( 'ITEM_SPAM', 0x0008);
define ( 'ITEM_DELETED', 0x0010);
define ( 'ITEM_UNPUBLISHED', 0x0020);
define ( 'ITEM_WEBPAGE', 0x0040); // is a static web page, not a conversational item
define ( 'ITEM_WEBPAGE', 0x0040); // is a static web page, not a conversational item
define ( 'ITEM_DELAYED_PUBLISH', 0x0080);
define ( 'ITEM_BUILDBLOCK', 0x0100); // Named thusly to make sure nobody confuses this with ITEM_BLOCKED
define ( 'ITEM_PDL', 0x0200); // Page Description Language - e.g. Comanche
define ( 'ITEM_BUILDBLOCK', 0x0100); // Named thusly to make sure nobody confuses this with ITEM_BLOCKED
define ( 'ITEM_PDL', 0x0200); // Page Description Language - e.g. Comanche
define ( 'ITEM_BUG', 0x0400); // Is a bug, can be used by the internal bug tracker
/**
* Item Flags
*/
@ -518,7 +519,6 @@ define ( 'ITEM_MENTIONSME', 0x0400);
define ( 'ITEM_NOCOMMENT', 0x0800); // commenting/followups are disabled
define ( 'ITEM_OBSCURED', 0x1000); // bit-mangled to protect from casual browsing by site admin
define ( 'ITEM_VERIFIED', 0x2000); // Signature verification was successful
/**
*
* Reverse the effect of magic_quotes_gpc if it is enabled.

View File

@ -1142,6 +1142,8 @@ function status_editor($a,$x,$popup=false) {
'$feature_encrypt' => ((feature_enabled($x['profile_uid'],'content_encrypt') && (! $webpage)) ? 'block' : 'none'),
'$encrypt' => t('Encrypt text'),
'$cipher' => $cipher,
'$expiryModalOK' => t('OK'),
'$expiryModalCANCEL' => t('Cancel'),
));

View File

@ -71,22 +71,21 @@ function validate_channelname($name) {
/**
* @function create_dir_account()
* @function create_sys_account()
* Create a system channel - which has no account attached
*
* Currently unused.
*
*/
function create_dir_account() {
create_identity(array(
'account_id' => 'xxx', // This will create an identity with an (integer) account_id of 0, but account_id is required
'nickname' => 'dir',
'name' => 'Directory',
'pageflags' => PAGE_DIRECTORY_CHANNEL|PAGE_HIDDEN,
'publish' => 0
));
}
//function create_sys_channel() {
// create_identity(array(
// 'nickname' => 'sys',
// 'name' => 'System',
// 'pageflags' => PAGE_SYSTEM,
// 'publish' => 0,
// 'xchanflags' => XCHAN_FLAGS_SYSTEM
// ));
//}
/**
* @channel_total()
@ -145,7 +144,7 @@ function create_identity($arr) {
$name = escape_tags($arr['name']);
$pageflags = ((x($arr,'pageflags')) ? intval($arr['pageflags']) : PAGE_NORMAL);
$xchanflags = ((x($arr,'xchanflags')) ? intval($arr['xchanflags']) : XCHAN_FLAGS_NORMAL);
$name_error = validate_channelname($arr['name']);
if($name_error) {
$ret['message'] = $name_error;
@ -243,7 +242,7 @@ function create_identity($arr) {
$newuid = $ret['channel']['channel_id'];
$r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_l, xchan_photo_m, xchan_photo_s, xchan_addr, xchan_url, xchan_follow, xchan_connurl, xchan_name, xchan_network, xchan_photo_date, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
$r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_l, xchan_photo_m, xchan_photo_s, xchan_addr, xchan_url, xchan_follow, xchan_connurl, xchan_name, xchan_network, xchan_photo_date, xchan_name_date, xchan_flags ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d')",
dbesc($hash),
dbesc($guid),
dbesc($sig),
@ -258,7 +257,8 @@ function create_identity($arr) {
dbesc($ret['channel']['channel_name']),
dbesc('zot'),
dbesc(datetime_convert()),
dbesc(datetime_convert())
dbesc(datetime_convert()),
intval($xchanflags)
);
// Not checking return value.
@ -1111,22 +1111,18 @@ function get_theme_uid() {
}
/**
* @function get_default_profile_photo($size = 175)
* Retrieves the path of the default_profile_photo for this system
* with the specified size.
* @param int $size
* one of (175, 80, 48)
* @returns string
*
*/
* @function get_default_profile_photo($size = 175)
* Retrieves the path of the default_profile_photo for this system
* with the specified size.
* @param int $size
* one of (175, 80, 48)
* @returns string
*
*/
function get_default_profile_photo($size = 175) {
$scheme = get_config('system','default_profile_photo');
if(! $scheme)
$scheme = 'rainbow_man';
return 'images/default_profile_photos/' . $scheme . '/' . $size . '.jpg';
$scheme = get_config('system','default_profile_photo');
if(! $scheme)
$scheme = 'rainbow_man';
return 'images/default_profile_photos/' . $scheme . '/' . $size . '.jpg';
}

View File

@ -1029,3 +1029,11 @@ CREATE TABLE IF NOT EXISTS `xtag` (
KEY `xtag_hash` (`xtag_hash`),
KEY `xtag_flags` (`xtag_flags`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE if not exists `sys_perms` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`cat` CHAR( 255 ) NOT NULL ,
`k` CHAR( 255 ) NOT NULL ,
`v` MEDIUMTEXT NOT NULL,
`public_perm` TINYINT( 1 ) UNSIGNED NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET = utf8");

View File

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1084 );
define( 'UPDATE_VERSION' , 1085 );
/**
*
@ -919,3 +919,19 @@ ADD INDEX ( `aid` )");
return UPDATE_FAILED;
}
function update_r1084() {
$r = q("CREATE TABLE if not exists `sys_perms` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`cat` CHAR( 255 ) NOT NULL ,
`k` CHAR( 255 ) NOT NULL ,
`v` MEDIUMTEXT NOT NULL,
`public_perm` TINYINT( 1 ) UNSIGNED NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET = utf8");
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

View File

@ -0,0 +1,174 @@
/**
* Build file for the dist version of datetimepicker.css
*/
/*!
* Datetimepicker for Bootstrap v3
* https://github.com/Eonasdan/bootstrap-datetimepicker/
* Copyright 2012 Stefan Petre
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
.bootstrap-datetimepicker-widget {
top: 0;
left: 0;
width: 250px;
padding: 4px;
margin-top: 1px;
z-index: 9999;
border-radius: 4px;
/*.dow {
border-top: 1px solid #ddd !important;
}*/
}
.bootstrap-datetimepicker-widget .btn {
padding: 6px;
}
.bootstrap-datetimepicker-widget:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-bottom-color: rgba(0, 0, 0, 0.2);
position: absolute;
top: -7px;
left: 6px;
}
.bootstrap-datetimepicker-widget:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid white;
position: absolute;
top: -6px;
left: 7px;
}
.bootstrap-datetimepicker-widget.pull-right:before {
left: auto;
right: 6px;
}
.bootstrap-datetimepicker-widget.pull-right:after {
left: auto;
right: 7px;
}
.bootstrap-datetimepicker-widget > ul {
list-style-type: none;
margin: 0;
}
.bootstrap-datetimepicker-widget .timepicker-hour,
.bootstrap-datetimepicker-widget .timepicker-minute,
.bootstrap-datetimepicker-widget .timepicker-second {
width: 100%;
font-weight: bold;
font-size: 1.2em;
}
.bootstrap-datetimepicker-widget table[data-hour-format="12"] .separator {
width: 4px;
padding: 0;
margin: 0;
}
.bootstrap-datetimepicker-widget .datepicker > div {
display: none;
}
.bootstrap-datetimepicker-widget .picker-switch {
text-align: center;
}
.bootstrap-datetimepicker-widget table {
width: 100%;
margin: 0;
}
.bootstrap-datetimepicker-widget td,
.bootstrap-datetimepicker-widget th {
text-align: center;
width: 20px;
height: 20px;
border-radius: 4px;
}
.bootstrap-datetimepicker-widget td.day:hover,
.bootstrap-datetimepicker-widget td.hour:hover,
.bootstrap-datetimepicker-widget td.minute:hover,
.bootstrap-datetimepicker-widget td.second:hover {
background: #eeeeee;
cursor: pointer;
}
.bootstrap-datetimepicker-widget td.old,
.bootstrap-datetimepicker-widget td.new {
color: #999999;
}
.bootstrap-datetimepicker-widget td.active,
.bootstrap-datetimepicker-widget td.active:hover {
background-color: #428bca;
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.bootstrap-datetimepicker-widget td.disabled,
.bootstrap-datetimepicker-widget td.disabled:hover {
background: none;
color: #999999;
cursor: not-allowed;
}
.bootstrap-datetimepicker-widget td span {
display: block;
width: 47px;
height: 54px;
line-height: 54px;
float: left;
margin: 2px;
cursor: pointer;
border-radius: 4px;
}
.bootstrap-datetimepicker-widget td span:hover {
background: #eeeeee;
}
.bootstrap-datetimepicker-widget td span.active {
background-color: #428bca;
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.bootstrap-datetimepicker-widget td span.old {
color: #999999;
}
.bootstrap-datetimepicker-widget td span.disabled,
.bootstrap-datetimepicker-widget td span.disabled:hover {
background: none;
color: #999999;
cursor: not-allowed;
}
.bootstrap-datetimepicker-widget th.switch {
width: 145px;
}
.bootstrap-datetimepicker-widget th.next,
.bootstrap-datetimepicker-widget th.prev {
font-size: 21px;
}
.bootstrap-datetimepicker-widget th.disabled,
.bootstrap-datetimepicker-widget th.disabled:hover {
background: none;
color: #999999;
cursor: not-allowed;
}
.bootstrap-datetimepicker-widget thead tr:first-child th {
cursor: pointer;
}
.bootstrap-datetimepicker-widget thead tr:first-child th:hover {
background: #eeeeee;
}
.input-group.date .input-group-addon span {
display: block;
cursor: pointer;
width: 16px;
height: 16px;
}
.bootstrap-datetimepicker-widget.left-oriented:before {
left: auto;
right: 6px;
}
.bootstrap-datetimepicker-widget.left-oriented:after {
left: auto;
right: 7px;
}
.bootstrap-datetimepicker-widget ul.list-unstyled li.in div.timepicker div.timepicker-picker table.table-condensed tbody > tr > td {
padding: 0px !important;
}

View File

@ -0,0 +1,8 @@
/*!
* Datetimepicker for Bootstrap v3
* https://github.com/Eonasdan/bootstrap-datetimepicker/
* Copyright 2012 Stefan Petre
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*/.bootstrap-datetimepicker-widget{top:0;left:0;width:250px;padding:4px;margin-top:1px;z-index:9999;border-radius:4px}.bootstrap-datetimepicker-widget .btn{padding:6px}.bootstrap-datetimepicker-widget:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0,0,0,0.2);position:absolute;top:-7px;left:6px}.bootstrap-datetimepicker-widget:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;position:absolute;top:-6px;left:7px}.bootstrap-datetimepicker-widget.pull-right:before{left:auto;right:6px}.bootstrap-datetimepicker-widget.pull-right:after{left:auto;right:7px}.bootstrap-datetimepicker-widget>ul{list-style-type:none;margin:0}.bootstrap-datetimepicker-widget .timepicker-hour,.bootstrap-datetimepicker-widget .timepicker-minute,.bootstrap-datetimepicker-widget .timepicker-second{width:100%;font-weight:bold;font-size:1.2em}.bootstrap-datetimepicker-widget table[data-hour-format="12"] .separator{width:4px;padding:0;margin:0}.bootstrap-datetimepicker-widget .datepicker>div{display:none}.bootstrap-datetimepicker-widget .picker-switch{text-align:center}.bootstrap-datetimepicker-widget table{width:100%;margin:0}.bootstrap-datetimepicker-widget td,.bootstrap-datetimepicker-widget th{text-align:center;width:20px;height:20px;border-radius:4px}.bootstrap-datetimepicker-widget td.day:hover,.bootstrap-datetimepicker-widget td.hour:hover,.bootstrap-datetimepicker-widget td.minute:hover,.bootstrap-datetimepicker-widget td.second:hover{background:#eee;cursor:pointer}.bootstrap-datetimepicker-widget td.old,.bootstrap-datetimepicker-widget td.new{color:#999}.bootstrap-datetimepicker-widget td.active,.bootstrap-datetimepicker-widget td.active:hover{background-color:#428bca;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.bootstrap-datetimepicker-widget td.disabled,.bootstrap-datetimepicker-widget td.disabled:hover{background:none;color:#999;cursor:not-allowed}.bootstrap-datetimepicker-widget td span{display:block;width:47px;height:54px;line-height:54px;float:left;margin:2px;cursor:pointer;border-radius:4px}.bootstrap-datetimepicker-widget td span:hover{background:#eee}.bootstrap-datetimepicker-widget td span.active{background-color:#428bca;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.bootstrap-datetimepicker-widget td span.old{color:#999}.bootstrap-datetimepicker-widget td span.disabled,.bootstrap-datetimepicker-widget td span.disabled:hover{background:none;color:#999;cursor:not-allowed}.bootstrap-datetimepicker-widget th.switch{width:145px}.bootstrap-datetimepicker-widget th.next,.bootstrap-datetimepicker-widget th.prev{font-size:21px}.bootstrap-datetimepicker-widget th.disabled,.bootstrap-datetimepicker-widget th.disabled:hover{background:none;color:#999;cursor:not-allowed}.bootstrap-datetimepicker-widget thead tr:first-child th{cursor:pointer}.bootstrap-datetimepicker-widget thead tr:first-child th:hover{background:#eee}.input-group.date .input-group-addon span{display:block;cursor:pointer;width:16px;height:16px}.bootstrap-datetimepicker-widget.left-oriented:before{left:auto;right:6px}.bootstrap-datetimepicker-widget.left-oriented:after{left:auto;right:7px}.bootstrap-datetimepicker-widget ul.list-unstyled li.in div.timepicker div.timepicker-picker table.table-condensed tbody>tr>td{padding:0 !important}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

84
mod/achievements.php Normal file
View File

@ -0,0 +1,84 @@
<?php
function achievements_content(&$a) {
if(argc() > 1)
$which = argv(1);
else {
notice( t('Requested profile is not available.') . EOL );
return;
}
$profile = 0;
$profile = argv(1);
profile_load($a,$which,$profile);
$r = q("select channel_id from channel where channel_address = '%s'",
dbesc($which)
);
if($r) {
$owner = intval($r[0]['channel_id']);
}
$observer = $a->get_observer();
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
$perms = get_all_perms($owner,$ob_hash);
if(! $perms['view_profile']) {
notice( t('Permission denied.') . EOL);
return;
}
// By default, all badges are false
$contactbadge = false;
$profilebadge = false;
$keywordsbadge = false;
// Check number of contacts. Award a badge if over 10
// We'll figure these out on each page load instead of
// writing them to the DB because that will mean one needs
// to retain their achievements - eg, you can't add
// a bunch of channels just to get your badge, and then
// delete them all again. If these become popular or
// used in profiles or something, we may need to reconsider
// and add a table for this - because this won't scale.
$r = q("select * from abook where abook_channel = %d",
intval($owner)
);
if (count($r))
$contacts = count($r);
// We're checking for 11 to adjust for the abook record for self
if ($contacts >= 11)
$contactbadge = true;
// Check if an about field in the profile has been created.
$r = q("select * from profile where uid = %d and about <> ''",
intval($owner)
);
if ($r)
$profilebadge = 1;
// Check if keywords have been set
$r = q("select * from profile where uid = %d and keywords <> ''",
intval($owner)
);
if($r)
$keywordsbadge = 1;
// FIXME - stick ths in a template, and make it look pretty.
$o .= "Template not implemented";
$o .= "If this is one, you get the profile badge" . $profilebadge . "<br>";
$o .= "If this is one, you get the contact badge" . $contactbadge . "<br>";
$o .= "If this is one you get the keywords badge" . $keywordsbadge . "<br>";
$o .= "I haven't done the top level posts badge yet" . $toplevelpostsbadge . "<br>";
$o .= "I haven't done the number of channels badge yet" . $channelsbadge;
return $o;
}

View File

@ -132,6 +132,8 @@ function editpost_content(&$a) {
'$expires' => t('Set expiration date'),
'$feature_encrypt' => 'none',
'$encrypt' => t('Encrypt text'),
'$expiryModalOK' => t('OK'),
'$expiryModalCANCEL' => t('Cancel'),
));
return $o;

20
mod/xref.php Normal file
View File

@ -0,0 +1,20 @@
<?php
function ref_init(&$a) {
// Sets a referral URL using an xchan directly
// Link format: example.com/xref/[xchan]/[TargetURL]
// Target URL is optional.
// Cookie lasts 24 hours to survive a browser restart. Contains no personal
// information at all - just somebody else's xchan.
$referrer = argv(1);
$expire=time()+60*60*24;
$path = 'ref';
setcookie(ref, $referrer, $expire, "/");
$url = '';
if (argc() > 2)
$url = argv(2);
goaway (z_root() . '/' . $url);
}

View File

@ -10,10 +10,12 @@ head_add_css('library/jgrowl/jquery.jgrowl.css');
head_add_css('library/jslider/css/jslider.css');
head_add_css('library/prettyphoto/css/prettyPhoto.css');
head_add_css('library/colorbox/colorbox.css');
// head_add_css('library/font_awesome/css/font-awesome.min.css');
head_add_css('view/css/conversation.css');
head_add_css('view/css/bootstrap-red.css');
head_add_css('view/css/widgets.css');
head_add_css('library/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css');
head_add_js('js/jquery.js');
head_add_js('library/bootstrap/js/bootstrap.min.js');
@ -43,7 +45,8 @@ head_add_js('library/jslider/bin/jquery.slider.min.js');
head_add_js('docready.js');
head_add_js('library/prettyphoto/js/jquery.prettyPhoto.js');
head_add_js('library/colorbox/jquery.colorbox-min.js');
head_add_js('library/bootstrap-datetimepicker/js/moment.js');
head_add_js('library/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js');
/**
* Those who require this feature will know what to do with it.
* Those who don't, won't.

View File

@ -194,10 +194,17 @@ function enableOnUser(){
}
function jotGetExpiry() {
reply = prompt("{{$expirewhen}}", $('#jot-expire').val());
if(reply && reply.length) {
//reply = prompt("{{$expirewhen}}", $('#jot-expire').val());
$('#expiryModal').modal();
$('#expiry-modal-OKButton').on('click', function() {
reply=$('#expiration-date').val();
if(reply && reply.length) {
$('#jot-expire').val(reply);
$('#expiryModal').modal('hide');
}
})
}
function jotShare(id) {
@ -299,3 +306,16 @@ function enableOnUser(){
</script>
<!--
<script>
$( document ).on( "click", ".wall-item-delete-link", function(e) {
var link = $(this).attr("href"); // "get" the intended link in a var
e.preventDefault();
bootbox.confirm("<h4>Delete item?</h4>", function(result) {
if (result) {
document.location.href = link;}
});
});
</script>
-->

View File

@ -90,10 +90,50 @@
{{$jotnets}}
</div>
</div>
<!-- Modal for item expiry-->
<div class="modal fade" id="expiryModal" tabindex="-1" role="dialog" aria-labelledby="expiryModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="expiryModalLabel">{{$expires}}</h4>
</div>
<!-- <div class="modal-body"> -->
<div class="modal-body form-group" style="width:90%">
<div class="input-group input-group-sm date" id="datetimepicker1">
<span class="input-group-addon"><!-- <span class="glyphicon glyphicon-calendar"></span> -->
<span class="icon-calendar"></span>
</span>
<input id="expiration-date" type='text' class="form-control" data-format="YYYY-MM-DD HH:mm" size="20"/>
</div>
</div>
<!-- </div> -->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{$expiryModalCANCEL}}</button>
<button id="expiry-modal-OKButton" type="button" class="btn btn-primary">{{$expiryModalOK}}</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script type="text/javascript">
$(function() {
$('#datetimepicker1').datetimepicker({
language: 'us',
icons: {
time: "icon-time",
date: "icon-calendar",
up: "icon-arrow-up",
down: "icon-arrow-down"
}
});
});
</script>
</div>
<div id="profile-jot-end"></div>
</form>
</div>