Merge pull request #582 from fermionic/20130112-various-fixes

Various fixes
This commit is contained in:
friendica 2013-01-12 12:24:51 -08:00
commit ceaedb41e4
29 changed files with 75 additions and 62 deletions

View file

@ -42,6 +42,10 @@ function z_mime_content_type($filename) {
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'ogg' => 'application/ogg',
'mp4' => 'video/mp4',
'avi' => 'video/x-msvideo',
'wmv' => 'video/x-ms-wmv',
'wma' => 'audio/x-ms-wma',
// adobe
'pdf' => 'application/pdf',

View file

@ -877,26 +877,21 @@ function format_like($cnt,$arr,$type,$id) {
if($cnt == 1)
$o .= (($type === 'like') ? sprintf( t('%s likes this.'), $arr[0]) : sprintf( t('%s doesn\'t like this.'), $arr[0])) . EOL ;
else {
//$spanatts = 'class="fakelink" onclick="openClose(\'' . $type . 'list-' . $id . '\');"';
$spanatts = "class=\"fakelink\" onclick=\"openClose('{$type}list-$id');\"";
switch($type) {
case 'like':
// $phrase = sprintf( t('<span %1$s>%2$d people</span> like this.'), $spanatts, $cnt);
$mood = t('like this');
$phrase = sprintf( t('<span %1$s>%2$d people</span> like this'), $spanatts, $cnt);
break;
case 'dislike':
// $phrase = sprintf( t('<span %1$s>%2$d people</span> don\'t like this.'), $spanatts, $cnt);
$mood = t('don\'t like this');
$phrase = sprintf( t('<span %1$s>%2$d people</span> don\'t like this'), $spanatts, $cnt);
break;
}
$tpl = get_markup_template("voting_fakelink.tpl");
$phrase = replace_macros($tpl, array(
'$vote_id' => $type . 'list-' . $id,
'$count' => $cnt,
'$people' => t('people'),
'$vote_mood' => $mood
$phrase .= EOL ;
$o .= replace_macros(get_markup_template('voting_fakelink.tpl'), array(
'$phrase' => $phrase,
'$type' => $type,
'$id' => $id
));
$o .= $phrase;
// $o .= EOL ;
$total = count($arr);
if($total >= MAX_LIKERS)

View file

@ -209,7 +209,7 @@ function html2plain($html, $wraplength = 75, $compact = false)
if (!$compact) {
$counter = 1;
foreach ($urls as $id=>$url)
if (strpos($message, $url) == false)
if (strpos($message, $url) === false)
$message .= "\n".$url." ";
//$message .= "\n[".($counter++)."] ".$url;
}

View file

@ -3732,11 +3732,11 @@ function item_getfeedtags($item) {
function item_getfeedattach($item) {
$ret = '';
$arr = explode(',',$item['attach']);
$arr = explode('[/attach],',$item['attach']);
if(count($arr)) {
foreach($arr as $r) {
$matches = false;
$cnt = preg_match('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"\[\/attach\]|',$r,$matches);
$cnt = preg_match('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"|',$r,$matches);
if($cnt) {
$ret .= '<link rel="enclosure" href="' . xmlify($matches[1]) . '" type="' . xmlify($matches[3]) . '" ';
if(intval($matches[2]))

View file

@ -37,6 +37,7 @@ require_once('include/html2plain.php');
* tag (in photos.php, poke.php, tagger.php)
* tgroup (in items.php)
* wall-new (in photos.php, item.php)
* removeme (in Contact.php)
*
* and ITEM_ID is the id of the item in the database that needs to be sent to others.
*/
@ -138,14 +139,17 @@ function notifier_run(&$argv, &$argc){
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($item_id));
if (! $r)
return;
$user = $r[0];
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", intval($item_id));
if (! $r)
return;
$self = $r[0];
$r = q("SELECT * FROM `contact` WHERE `self` = 0 AND `uid` = %d", intval($item_id));
if(! $r)
return;
require_once('include/Contact.php');
foreach($r as $contact) {
terminate_friendship($user, $self, $contact);

View file

@ -1041,13 +1041,13 @@ function prepare_body($item,$attach = false) {
return $s;
}
$arr = explode(',',$item['attach']);
$arr = explode('[/attach],',$item['attach']);
if(count($arr)) {
$s .= '<div class="body-attach">';
foreach($arr as $r) {
$matches = false;
$icon = '';
$cnt = preg_match_all('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"\[\/attach\]|',$r,$matches, PREG_SET_ORDER);
$cnt = preg_match_all('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"|',$r,$matches, PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
$icontype = strtolower(substr($mtch[3],0,strpos($mtch[3],'/')));

View file

@ -253,7 +253,7 @@ ACL.prototype.populate = function(data){
//console.log(html);
that.list_content.append(html);
});
$(".acl-list-item[rel!=acl-template] img[data-src]").each(function(i, el){
$(".acl-list-item img[data-src]", that.list_content).each(function(i, el){
// Add src attribute for images with a data-src attribute
$(el).attr('src', $(el).data("src"));
});

2
js/acl.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -34,8 +34,10 @@ function attach_init(&$a) {
return;
}
// Use quotes around the filename to prevent a "multiple Content-Disposition"
// error in Chrome for filenames with commas in them
header('Content-type: ' . $r[0]['filetype']);
header('Content-disposition: attachment; filename=' . $r[0]['filename']);
header('Content-disposition: attachment; filename="' . $r[0]['filename'] . '"');
echo $r[0]['data'];
killme();
// NOTREACHED

View file

@ -11,7 +11,7 @@ function visible_lf($s) {
function babel_content(&$a) {
$o .= '<h3>Babel Diagnostic</h3>';
$o .= '<h1>Babel Diagnostic</h1>';
$o .= '<form action="babel" method="post">';
$o .= t('Source (bbcode) text:') . EOL . '<textarea name="text" >' . htmlspecialchars($_REQUEST['text']) .'</textarea>' . EOL;
@ -28,31 +28,35 @@ function babel_content(&$a) {
if(x($_REQUEST,'text')) {
$text = trim($_REQUEST['text']);
$o .= t("Source input: ") . EOL. EOL;
$o .= "<h2>" . t("Source input: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($text) . EOL. EOL;
$html = bbcode($text);
$o .= t("bb2html: ") . EOL. EOL;
$o .= "<h2>" . t("bb2html (raw HTML): ") . "</h2>" . EOL. EOL;
$o .= htmlspecialchars($html). EOL. EOL;
//$html = bbcode($text);
$o .= "<h2>" . t("bb2html: ") . "</h2>" . EOL. EOL;
$o .= $html. EOL. EOL;
$bbcode = html2bbcode($html);
$o .= t("bb2html2bb: ") . EOL. EOL;
$o .= "<h2>" . t("bb2html2bb: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($bbcode) . EOL. EOL;
$diaspora = bb2diaspora($text);
$o .= t("bb2md: ") . EOL. EOL;
$o .= "<h2>" . t("bb2md: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($diaspora) . EOL. EOL;
$html = Markdown($diaspora);
$o .= t("bb2md2html: ") . EOL. EOL;
$o .= "<h2>" . t("bb2md2html: ") . "</h2>" . EOL. EOL;
$o .= $html. EOL. EOL;
$bbcode = diaspora2bb($diaspora);
$o .= t("bb2dia2bb: ") . EOL. EOL;
$o .= "<h2>" . t("bb2dia2bb: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($bbcode) . EOL. EOL;
$bbcode = html2bbcode($html);
$o .= t("bb2md2html2bb: ") . EOL. EOL;
$o .= "<h2>" . t("bb2md2html2bb: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($bbcode) . EOL. EOL;
@ -62,12 +66,12 @@ function babel_content(&$a) {
if(x($_REQUEST,'d2bbtext')) {
$d2bbtext = trim($_REQUEST['d2bbtext']);
$o .= t("Source input (Diaspora format): ") . EOL. EOL;
$o .= "<h2>" . t("Source input (Diaspora format): ") . "</h2>" . EOL. EOL;
$o .= visible_lf($d2bbtext) . EOL. EOL;
$bb = diaspora2bb($d2bbtext);
$o .= t("diaspora2bb: ") . EOL. EOL;
$o .= "<h2>" . t("diaspora2bb: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($bb) . EOL. EOL;
}

View file

@ -236,8 +236,6 @@ function parse_url_content(&$a) {
$str_tags = '';
$textmode = false;
if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
$textmode = true;
if(local_user() && (! feature_enabled(local_user(),'richtext')))
$textmode = true;

View file

@ -160,8 +160,13 @@ function wall_upload_post(&$a) {
//if we get the signal then return the image url info in BBCODE, otherwise this outputs the info and bails (for the ajax image uploader on wall post)
if ($_REQUEST['hush']!='yeah') {
if(local_user() && (! feature_enabled(local_user(),'richtext') || x($_REQUEST['nomce'])) ) {
echo "\n\n" . '[url=' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]\n\n";
}
else {
echo '<br /><br /><a href="' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '" ><img src="' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."\" alt=\"$basename\" /></a><br /><br />";
}
}
else {
$m = '[url=' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]";
return($m);

View file

@ -10,6 +10,8 @@ import sys, getopt
ldelim = '{{'
rdelim = '}}'
addheader = True
def fToSmarty(matches):
match = matches.group(0)
if match == '$j':
@ -94,6 +96,7 @@ def fix_element(element):
def convert(filename, tofilename, php_tpl):
if addheader:
header = ldelim + "*\n *\tAUTOMATICALLY GENERATED TEMPLATE\n *\tDO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN\n *\n *" + rdelim + "\n"
tofilename.write(header)
@ -190,13 +193,15 @@ def help(pname):
path = ''
try:
opts, args = getopt.getopt(sys.argv[1:], "hp:")
opts, args = getopt.getopt(sys.argv[1:], "hp:", ['no-header'])
for opt, arg in opts:
if opt == '-h':
help(sys.argv[0])
sys.exit()
elif opt == '-p':
path = arg
elif opt == '--no-header':
addheader = False
except getopt.GetoptError:
help(sys.argv[0])
sys.exit(2)

View file

@ -3,5 +3,4 @@
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
*
*}}
<span class="fakelink" onclick="openClose('{{$vote_id}}');">{{$count}} {{$people}}</span> {{$vote_mood}}<br />
{{$phrase}}

View file

@ -253,9 +253,9 @@ ACL.prototype.populate = function(data){
//console.log(html);
that.list_content.append(html);
});
$(".acl-list-item[rel!=acl-template] img[data-src]").each(function(i, el){
$j(".acl-list-item img[data-src]", that.list_content).each(function(i, el){
// Add src attribute for images with a data-src attribute
$(el).attr('src', $(el).data("src"));
$j(el).attr('src', $j(el).data("src"));
});
that.update_view();
}

File diff suppressed because one or more lines are too long

View file

@ -188,9 +188,9 @@
nnm.append(html);
});
$("img[data-src]", nnm).each(function(i, el){
$j("img[data-src]", nnm).each(function(i, el){
// Add src attribute for images with a data-src attribute
$(el).attr('src', $(el).data("src"));
$j(el).attr('src', $j(el).data("src"));
});
}
notif = eNotif.attr('count');

File diff suppressed because one or more lines are too long

View file

@ -3,5 +3,4 @@
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
*
*}}
<span class="fakelink-wrapper" id={{$vote_id}}-wrapper><span class="fakelink" onclick="openClose('{{$vote_id}}');">{{$count}} {{$people}}</span> {{$vote_mood}}</span>
<span class="fakelink-wrapper" id="{{$type}}list-{{$id}}-wrapper">{{$phrase}}</span>

View file

@ -1,2 +1 @@
<span class="fakelink-wrapper" id=$vote_id-wrapper><span class="fakelink" onclick="openClose('$vote_id');">$count $people</span> $vote_mood</span>
<span class="fakelink-wrapper" id="$[type]list-$id-wrapper">$phrase</span>

View file

@ -9,6 +9,7 @@
</div>
<div class="acl-list-item" rel="acl-template" style="display:none">
<img data-src="{0}"><p>{1}</p>
<a href="#" class='acl-button-show'>$show</a>
<a href="#" class='acl-button-hide'>$hide</a>
</div>

View file

@ -253,9 +253,9 @@ ACL.prototype.populate = function(data){
//console.log(html);
that.list_content.append(html);
});
$(".acl-list-item[rel!=acl-template] img[data-src]").each(function(i, el){
$j(".acl-list-item img[data-src]", that.list_content).each(function(i, el){
// Add src attribute for images with a data-src attribute
$(el).attr('src', $(el).data("src"));
$j(el).attr('src', $j(el).data("src"));
});
that.update_view();
}

File diff suppressed because one or more lines are too long

View file

@ -180,9 +180,9 @@
nnm.append(html);
});
$("img[data-src]", nnm).each(function(i, el){
$j("img[data-src]", nnm).each(function(i, el){
// Add src attribute for images with a data-src attribute
$(el).attr('src', $(el).data("src"));
$j(el).attr('src', $j(el).data("src"));
});
}
notif = eNotif.attr('count');

File diff suppressed because one or more lines are too long

View file

@ -14,6 +14,7 @@
</div>
<div class="acl-list-item" rel="acl-template" style="display:none">
<img data-src="{0}"><p>{1}</p>
<a href="#" class='acl-button-show'>{{$show}}</a>
<a href="#" class='acl-button-hide'>{{$hide}}</a>
</div>

View file

@ -3,5 +3,4 @@
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
*
*}}
<span class="fakelink-wrapper" id={{$vote_id}}-wrapper><span class="fakelink" onclick="openClose('{{$vote_id}}');">{{$count}} {{$people}}</span> {{$vote_mood}}</span>
<span class="fakelink-wrapper" id="{{$type}}list-{{$id}}-wrapper">{{$phrase}}</span>

View file

@ -1,2 +1 @@
<span class="fakelink-wrapper" id=$vote_id-wrapper><span class="fakelink" onclick="openClose('$vote_id');">$count $people</span> $vote_mood</span>
<span class="fakelink-wrapper" id="$[type]list-$id-wrapper">$phrase</span>

View file

@ -1,2 +1 @@
<span class="fakelink" onclick="openClose('$vote_id');">$count $people</span> $vote_mood<br />
$phrase