* Add MIME types for file attachments

* Restore translatability to mood phrases
* Prevent casting of "false" in html2plain
* Allow attachments with a comma in the filename
* Fix/optimize ACL img data-src jQuery search
* Fix bug when uploading files with a comma in the name using Chrome/Chromium
* Babel nicer output formatting
* Remove obsolete "plaintext" check in mod/parse_url
* Restore TinyMCE live insertion of images
* Smarty conversion script: add --no-header option to suppress warning headers in Smarty template files
This commit is contained in:
Zach Prezkuta 2013-01-12 06:31:32 -07:00
parent d62483f526
commit 74caf1a4a7
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],'/')));