This commit is contained in:
jeroenpraat 2014-06-05 14:00:05 +00:00
commit 6ccf6455c4
12 changed files with 6952 additions and 6656 deletions

4
app/features.apd Normal file
View File

@ -0,0 +1,4 @@
url: $baseurl/settings/features
requires: local_user
name: Features
photo: $baseurl/app/features.png

BIN
app/features.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

3
app/hex.apd Normal file
View File

@ -0,0 +1,3 @@
url: $baseurl/hexit
name: Hexit
photo: $baseurl/app/hex.png

BIN
app/hex.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -281,6 +281,14 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
$Text = preg_replace("/\[img\](.*?)\[\/img\]/", '![' . t('image/photo') . '](' . '$1' . ')', $Text);
$Text = preg_replace("/\[img\=(.*?)\](.*?)\[\/img\]/", '![' . t('image/photo') . '](' . '$2' . ')', $Text);
$Text = preg_replace("/\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '[$1]($1)', $Text);
$Text = preg_replace("/\#\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '[#$2]($1)', $Text);
$Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '[$2]($1)', $Text);
$Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/", '![' . t('image/photo') . '](' . '$1' . ')', $Text);
$Text = preg_replace("/\[zmg\=(.*?)\](.*?)\[\/zmg\]/", '![' . t('image/photo') . '](' . '$2' . ')', $Text);
// Perform MAIL Search
$Text = preg_replace("(\[mail\]([$MAILSearchString]*)\[/mail\])", '[$1](mailto:$1)', $Text);
$Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.*?)\[\/mail\]/", '[$2](mailto:$1)', $Text);

View File

@ -2334,6 +2334,34 @@ function tag_deliver($uid,$item_id) {
}
if (stristr($item['verb'],ACTIVITY_POKE)) {
$poke_notify = true;
if(($item['obj_type'] == "") || ($item['obj_type'] !== ACTIVITY_OBJ_PERSON) || (! $item['object']))
$poke_notify = false;
$obj = json_decode_plus($item['object']);
if($obj) {
if($obj['id'] !== $u[0]['channel_hash'])
$poke_notify = false;
}
$verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
if($poke_notify) {
require_once('include/enotify.php');
notification(array(
'to_xchan' => $u[0]['channel_hash'],
'from_xchan' => $item['author_xchan'],
'type' => NOTIFY_POKE,
'item' => $item,
'link' => $i[0]['llink'],
'verb' => ACTIVITY_POKE,
'activity' => $verb,
'otype' => 'item'
));
}
}
if($item['obj_type'] === ACTIVITY_OBJ_TAGTERM) {
// We received a community tag activity for a post.

View File

@ -364,6 +364,13 @@ function zot_refresh($them,$channel = null, $force = false) {
if($r) {
// if the dob is the same as what we have stored (disregarding the year), keep the one
// we have as we may have updated the year after sending a notification; and resetting
// to the one we just received would cause us to create duplicated events.
if(substr($r[0]['abook_dob'],5) == substr($next_birthday,5))
$next_birthday = $r[0]['abook_dob'];
$current_abook_connected = (($r[0]['abook_flags'] & ABOOK_FLAG_UNCONNECTED) ? 0 : 1);
$y = q("update abook set abook_their_perms = %d, abook_dob = '%s'

181
mod/hexit.php Normal file
View File

@ -0,0 +1,181 @@
<?php
function hexit_content(&$a) {
$o .= <<< EOT
<script type="text/javascript">
/**
* A function for converting hex <-> dec w/o loss of precision.
*
* The problem is that parseInt("0x12345...") isn't precise enough to convert
* 64-bit integers correctly.
*
* Internally, this uses arrays to encode decimal digits starting with the least
* significant:
* 8 = [8]
* 16 = [6, 1]
* 1024 = [4, 2, 0, 1]
*/
// Adds two arrays for the given base (10 or 16), returning the result.
// This turns out to be the only "primitive" operation we need.
function add(x, y, base) {
var z = [];
var n = Math.max(x.length, y.length);
var carry = 0;
var i = 0;
while (i < n || carry) {
var xi = i < x.length ? x[i] : 0;
var yi = i < y.length ? y[i] : 0;
var zi = carry + xi + yi;
z.push(zi % base);
carry = Math.floor(zi / base);
i++;
}
return z;
}
// Returns a*x, where x is an array of decimal digits and a is an ordinary
// JavaScript number. base is the number base of the array x.
function multiplyByNumber(num, x, base) {
if (num < 0) return null;
if (num == 0) return [];
var result = [];
var power = x;
while (true) {
if (num & 1) {
result = add(result, power, base);
}
num = num >> 1;
if (num === 0) break;
power = add(power, power, base);
}
return result;
}
function parseToDigitsArray(str, base) {
var digits = str.split('');
var ary = [];
for (var i = digits.length - 1; i >= 0; i--) {
var n = parseInt(digits[i], base);
if (isNaN(n)) return null;
ary.push(n);
}
return ary;
}
function convertBase(str, fromBase, toBase) {
var digits = parseToDigitsArray(str, fromBase);
if (digits === null) return null;
var outArray = [];
var power = [1];
for (var i = 0; i < digits.length; i++) {
// invariant: at this point, fromBase^i = power
if (digits[i]) {
outArray = add(outArray, multiplyByNumber(digits[i], power, toBase), toBase);
}
power = multiplyByNumber(fromBase, power, toBase);
}
var out = '';
for (var i = outArray.length - 1; i >= 0; i--) {
out += outArray[i].toString(toBase);
}
return out;
}
function decToHex(decStr) {
var hex = convertBase(decStr, 10, 16);
return hex ? '0x' + hex : null;
}
function hexToDec(hexStr) {
if (hexStr.substring(0, 2) === '0x') hexStr = hexStr.substring(2);
hexStr = hexStr.toLowerCase();
return convertBase(hexStr, 16, 10);
}
function str_or_null(x) {
return x === null ? 'null' : x;
}
// "1.234e+5" -> "12340"
function expandExponential(x) {
var pos = x.indexOf("e");
if (pos === -1) pos = x.indexOf("E");
if (pos === -1) return x;
var base = x.substring(0, pos);
var pow = parseInt(x.substring(pos + 1), 10);
if (pow < 0) return x; // not supported.
var dotPos = base.indexOf('.');
if (dotPos === -1) dotPos = base.length;
var ret = base.replace('.', '');
while (ret.length < dotPos + pow) ret += '0';
return ret;
}
function boldDifference(correct, actual) {
for (var i = 0, j = 0; i < correct.length && j < actual.length; i++, j++) {
if (correct[i] !== actual[j]) {
break;
}
}
if (j < actual.length) {
return actual.substring(0, j) + '<b>' + actual.substring(j) + '</b>';
} else {
return actual;
}
}
function convert() {
var input = document.getElementById("in").value;
if (input) {
var aHex = str_or_null(decToHex(input));
var aDec = str_or_null(hexToDec(input));
var bHex = '0x' + (parseInt(input, 10)).toString(16);
var bDec = "" + expandExponential("" +parseInt(input, 16));
var html = '<p></p><p>To Decimal(' + input + ') = ' + aDec + '</p>';
html += '<p>To Hex(' + input + ') = ' + aHex + '</p>';
document.getElementById('result').innerHTML = html;
}
}
convert();
</script>
<h2>Hexit</h2>
<p>Type in a hex or decimal string:</p>
<input type="text" size=40 id="in" onkeyup="convert()" value="" />
<p id="result"></p>
EOT;
return $o;
}

View File

@ -1,9 +1,9 @@
<?php /** @file */
function notes_init(&$a) {
if(! local_user())
return;
logger('mod_notes: ' . print_r($_REQUEST,true));
$ret = array('success' => true);
if($_REQUEST['note_text'] || $_REQUEST['note_text'] == '') {
@ -18,7 +18,7 @@ function notes_init(&$a) {
build_sync_packet();
}
logger('notes saved.');
logger('notes saved.', LOGGER_DEBUG);
json_return_and_die($ret);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +1,33 @@
function commentOpenRedbasic(obj,id) {
$(document).click(function() {
$(document).unbind( "click.commentOpen", handler );
var handler = function() {
if(obj.value == aStr['comment']) {
obj.value = '';
$("#comment-edit-text-" + id).addClass("comment-edit-text-full").removeClass("comment-edit-text-empty");
$("#comment-tools-" + id).show();
}
});
};
$(document).bind( "click.commentOpen", handler );
}
function commentCloseRedbasic(obj,id) {
$(document).click(function() {
$(document).unbind( "click.commentClose", handler );
var handler = function() {
if(obj.value == '') {
obj.value = aStr['comment'];
$("#comment-edit-text-" + id).removeClass("comment-edit-text-full").addClass("comment-edit-text-empty");
$("#comment-tools-" + id).hide();
}
});
};
$(document).bind( "click.commentClose", handler );
}
$(document).ready(function() {