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', 'qt' => 'video/quicktime',
'mov' => 'video/quicktime', 'mov' => 'video/quicktime',
'ogg' => 'application/ogg', 'ogg' => 'application/ogg',
'mp4' => 'video/mp4',
'avi' => 'video/x-msvideo',
'wmv' => 'video/x-ms-wmv',
'wma' => 'audio/x-ms-wma',
// adobe // adobe
'pdf' => 'application/pdf', 'pdf' => 'application/pdf',

View file

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

View file

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

View file

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

View file

@ -37,6 +37,7 @@ require_once('include/html2plain.php');
* tag (in photos.php, poke.php, tagger.php) * tag (in photos.php, poke.php, tagger.php)
* tgroup (in items.php) * tgroup (in items.php)
* wall-new (in photos.php, item.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. * 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)); $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($item_id));
if (! $r) if (! $r)
return; return;
$user = $r[0]; $user = $r[0];
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", intval($item_id)); $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", intval($item_id));
if (! $r) if (! $r)
return; return;
$self = $r[0]; $self = $r[0];
$r = q("SELECT * FROM `contact` WHERE `self` = 0 AND `uid` = %d", intval($item_id)); $r = q("SELECT * FROM `contact` WHERE `self` = 0 AND `uid` = %d", intval($item_id));
if(! $r) if(! $r)
return; return;
require_once('include/Contact.php'); require_once('include/Contact.php');
foreach($r as $contact) { foreach($r as $contact) {
terminate_friendship($user, $self, $contact); terminate_friendship($user, $self, $contact);

View file

@ -1041,13 +1041,13 @@ function prepare_body($item,$attach = false) {
return $s; return $s;
} }
$arr = explode(',',$item['attach']); $arr = explode('[/attach],',$item['attach']);
if(count($arr)) { if(count($arr)) {
$s .= '<div class="body-attach">'; $s .= '<div class="body-attach">';
foreach($arr as $r) { foreach($arr as $r) {
$matches = false; $matches = false;
$icon = ''; $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) { if($cnt) {
foreach($matches as $mtch) { foreach($matches as $mtch) {
$icontype = strtolower(substr($mtch[3],0,strpos($mtch[3],'/'))); $icontype = strtolower(substr($mtch[3],0,strpos($mtch[3],'/')));

View file

@ -253,7 +253,7 @@ ACL.prototype.populate = function(data){
//console.log(html); //console.log(html);
that.list_content.append(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 // Add src attribute for images with a data-src attribute
$(el).attr('src', $(el).data("src")); $(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,9 +34,11 @@ function attach_init(&$a) {
return; 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-type: ' . $r[0]['filetype']);
header('Content-disposition: attachment; filename=' . $r[0]['filename']); header('Content-disposition: attachment; filename="' . $r[0]['filename'] . '"');
echo $r[0]['data']; echo $r[0]['data'];
killme(); killme();
// NOTREACHED // NOTREACHED
} }

View file

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

View file

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

View file

@ -160,7 +160,12 @@ 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 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 ($_REQUEST['hush']!='yeah') {
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"; 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 { else {
$m = '[url=' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]"; $m = '[url=' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]";

View file

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

View file

@ -3,5 +3,4 @@
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN * 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); //console.log(html);
that.list_content.append(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 // 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(); that.update_view();
} }

File diff suppressed because one or more lines are too long

View file

@ -188,9 +188,9 @@
nnm.append(html); 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 // 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'); 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 * 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>
<div class="acl-list-item" rel="acl-template" style="display:none"> <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-show'>$show</a>
<a href="#" class='acl-button-hide'>$hide</a> <a href="#" class='acl-button-hide'>$hide</a>
</div> </div>

View file

@ -253,9 +253,9 @@ ACL.prototype.populate = function(data){
//console.log(html); //console.log(html);
that.list_content.append(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 // 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(); that.update_view();
} }

File diff suppressed because one or more lines are too long

View file

@ -180,9 +180,9 @@
nnm.append(html); 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 // 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'); notif = eNotif.attr('count');

File diff suppressed because one or more lines are too long

View file

@ -14,6 +14,7 @@
</div> </div>
<div class="acl-list-item" rel="acl-template" style="display:none"> <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-show'>{{$show}}</a>
<a href="#" class='acl-button-hide'>{{$hide}}</a> <a href="#" class='acl-button-hide'>{{$hide}}</a>
</div> </div>

View file

@ -3,5 +3,4 @@
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN * 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