From 3ff196f00dbad7e1efe6bb32cefbd7ece24127d4 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 24 Aug 2015 11:55:29 +0200 Subject: [PATCH 1/5] Now you can set search options so that searching for contacts or forums isn't occult science anymore. --- include/nav.php | 8 +++++++- include/text.php | 5 +++++ mod/dirfind.php | 4 ++-- mod/search.php | 24 +++++++++++++++++++----- view/templates/searchbox.tpl | 7 +++++++ view/theme/vier/templates/nav.tpl | 6 ++++++ 6 files changed, 46 insertions(+), 8 deletions(-) diff --git a/include/nav.php b/include/nav.php index 3d27be13b..e1661644d 100644 --- a/include/nav.php +++ b/include/nav.php @@ -26,7 +26,7 @@ function nav(&$a) { $tpl = get_markup_template('nav.tpl'); $a->page['nav'] .= replace_macros($tpl, array( - '$baseurl' => $a->get_baseurl(), + '$baseurl' => $a->get_baseurl(), '$langselector' => lang_selector(), '$sitelocation' => $nav_info['sitelocation'], '$nav' => $nav_info['nav'], @@ -118,6 +118,12 @@ function nav_info(&$a) { $nav['search'] = array('search', t('Search'), "", t('Search site content')); + $nav['searchoption'] = array( + t("Full Text"), + t("Tags"), + t("Contacts"), + t("Forums")); + $gdirpath = 'directory'; if(strlen(get_config('system','singleuser'))) { diff --git a/include/text.php b/include/text.php index 4747a376f..f3e44b3eb 100644 --- a/include/text.php +++ b/include/text.php @@ -995,6 +995,11 @@ function search($s,$id='search-box',$url='/search',$save = false) { '$search_label' => t('Search'), '$save_label' => t('Save'), '$savedsearch' => feature_enabled(local_user(),'savedsearch'), + '$searchoption' => array( + t("Full Text"), + t("Tags"), + t("Contacts"), + t("Forums")) )); }} diff --git a/mod/dirfind.php b/mod/dirfind.php index e70dfe968..3cee6c133 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -14,13 +14,13 @@ function dirfind_init(&$a) { -function dirfind_content(&$a) { +function dirfind_content(&$a, $prefix = "") { $community = false; $local = get_config('system','poco_local_search'); - $search = notags(trim($_REQUEST['search'])); + $search = $prefix.notags(trim($_REQUEST['search'])); if(strpos($search,'@') === 0) $search = substr($search,1); diff --git a/mod/search.php b/mod/search.php index a01984d24..d5e0dfb20 100644 --- a/mod/search.php +++ b/mod/search.php @@ -1,4 +1,8 @@ ' . t('Search') . ''; @@ -117,14 +118,27 @@ function search_content(&$a) { $search = substr($search,1); } if(strpos($search,'@') === 0) { - require_once('mod/dirfind.php'); return dirfind_content($a); } if(strpos($search,'!') === 0) { - require_once('mod/dirfind.php'); return dirfind_content($a); } + if(x($_GET,'search-option')) + switch($_GET['search-option']) { + case 'fulltext': + break; + case 'tags': + $tag = true; + break; + case 'contacts': + return dirfind_content($a, "@"); + break; + case 'forums': + return dirfind_content($a, "!"); + break; + } + if(! $search) return $o; diff --git a/view/templates/searchbox.tpl b/view/templates/searchbox.tpl index c3b875294..b9a01752c 100644 --- a/view/templates/searchbox.tpl +++ b/view/templates/searchbox.tpl @@ -2,6 +2,13 @@
{{strip}} + + {{if $savedsearch}} diff --git a/view/theme/vier/templates/nav.tpl b/view/theme/vier/templates/nav.tpl index 8a40d6dd7..5483113f3 100644 --- a/view/theme/vier/templates/nav.tpl +++ b/view/theme/vier/templates/nav.tpl @@ -72,6 +72,12 @@
{{/if}} From 3bca2db11bf45fb132cc06185d57792b2bf44930 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 24 Aug 2015 12:12:14 +0200 Subject: [PATCH 2/5] Don't show search options in side bar. --- include/text.php | 27 ++++++++++++++++----------- mod/search.php | 2 +- view/templates/searchbox.tpl | 4 +++- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/include/text.php b/include/text.php index f3e44b3eb..9a65224af 100644 --- a/include/text.php +++ b/include/text.php @@ -986,21 +986,26 @@ if(! function_exists('search')) { * @param string $url search url * @param boolean $savedsearch show save search button */ -function search($s,$id='search-box',$url='/search',$save = false) { +function search($s,$id='search-box',$url='/search',$save = false, $aside = true) { $a = get_app(); - return replace_macros(get_markup_template('searchbox.tpl'), array( - '$s' => $s, - '$id' => $id, - '$action_url' => $a->get_baseurl((stristr($url,'network')) ? true : false) . $url, - '$search_label' => t('Search'), - '$save_label' => t('Save'), - '$savedsearch' => feature_enabled(local_user(),'savedsearch'), - '$searchoption' => array( + + $values = array( + '$s' => $s, + '$id' => $id, + '$action_url' => $a->get_baseurl((stristr($url,'network')) ? true : false) . $url, + '$search_label' => t('Search'), + '$save_label' => t('Save'), + '$savedsearch' => feature_enabled(local_user(),'savedsearch'), + ); + + if (!$aside) + $values['$searchoption'] = array( t("Full Text"), t("Tags"), t("Contacts"), - t("Forums")) - )); + t("Forums")); + + return replace_macros(get_markup_template('searchbox.tpl'), $values); }} if(! function_exists('valid_email')) { diff --git a/mod/search.php b/mod/search.php index d5e0dfb20..d9a2852dd 100644 --- a/mod/search.php +++ b/mod/search.php @@ -111,7 +111,7 @@ function search_content(&$a) { } - $o .= search($search,'search-box','/search',((local_user()) ? true : false)); + $o .= search($search,'search-box','/search',((local_user()) ? true : false), false); if(strpos($search,'#') === 0) { $tag = true; diff --git a/view/templates/searchbox.tpl b/view/templates/searchbox.tpl index b9a01752c..9c1be50cf 100644 --- a/view/templates/searchbox.tpl +++ b/view/templates/searchbox.tpl @@ -2,12 +2,14 @@
{{strip}} - + {{/if}} {{if $savedsearch}} From cbabac298d1f7efdf680594166db7a4b72a1aa81 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Mon, 24 Aug 2015 13:54:41 +0200 Subject: [PATCH 3/5] filebrowser: link image to original picture, show error messages --- js/filebrowser.js | 51 +++++++++++------ mod/fbrowser.php | 62 ++++++++++---------- mod/wall_attach.php | 55 ++++++++++++++---- mod/wall_upload.php | 85 ++++++++++++++++++++-------- view/global.css | 3 + view/templates/filebrowser_plain.tpl | 11 ++-- 6 files changed, 183 insertions(+), 84 deletions(-) diff --git a/js/filebrowser.js b/js/filebrowser.js index c203151e1..66db2833c 100644 --- a/js/filebrowser.js +++ b/js/filebrowser.js @@ -1,6 +1,6 @@ /** * Filebrowser - Friendica Communications Server - * + * * Copyright (c) 2010-2013 the Friendica Project * * This program is free software: you can redistribute it and/or modify @@ -28,7 +28,7 @@ * The event is named * * fbrowser..[] - * + * * with params: * * filemane: filename of item choosed by user @@ -49,13 +49,13 @@ * $(id).value = bbcode; * }); **/ - + var FileBrowser = { nickname : "", type : "", event: "", id : null, - + init: function(nickname, type) { FileBrowser.nickname = nickname; FileBrowser.type = type; @@ -65,18 +65,23 @@ var FileBrowser = { FileBrowser.event = FileBrowser.event + "." + h.split("-")[0]; FileBrowser.id = h.split("-")[1]; } - + console.log("FileBrowser:", nickname, type,FileBrowser.event, FileBrowser.id ); - + + $(".error a.close").on("click", function(e) { + e.preventDefault(); + $(".error").addClass("hidden"); + }); + $(".folders a, .path a").on("click", function(e){ e.preventDefault(); var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + this.dataset.folder + "?mode=minimal" + location['hash']; location.href = url; }); - + $(".photo-album-photo-link").on('click', function(e){ e.preventDefault(); - + var embed = ""; if (FileBrowser.type == "image") { embed = "[url="+this.dataset.link+"][img]"+this.dataset.img+"[/img][/url]"; @@ -91,31 +96,45 @@ var FileBrowser = { embed, FileBrowser.id ]); - + }); - + if ($("#upload-image").length) var image_uploader = new window.AjaxUpload( 'upload-image', - { action: 'wall_upload/'+FileBrowser.nickname, + { action: 'wall_upload/'+FileBrowser.nickname+'?response=json', name: 'userfile', - onSubmit: function(file,ext) { $('#profile-rotator').show(); }, + responseType: 'json', + onSubmit: function(file,ext) { $('#profile-rotator').show(); $(".error").addClass('hidden'); }, onComplete: function(file,response) { + if (response['error']!= undefined) { + $(".error span").html(response['error']); + $(".error").removeClass('hidden'); + $('#profile-rotator').hide(); + return; + } location = baseurl + "/fbrowser/image/?mode=minimal"+location['hash']; location.reload(true); - } + } } ); if ($("#upload-file").length) var file_uploader = new window.AjaxUpload( 'upload-file', - { action: 'wall_attach/'+FileBrowser.nickname, + { action: 'wall_attach/'+FileBrowser.nickname+'?response=json', name: 'userfile', - onSubmit: function(file,ext) { $('#profile-rotator').show(); }, + onSubmit: function(file,ext) { $('#profile-rotator').show(); $(".error").addClass('hidden'); }, onComplete: function(file,response) { + if (response['error']!= undefined) { + $(".error span").html(response['error']); + $(".error").removeClass('hidden'); + $('#profile-rotator').hide(); + return; + } location = baseurl + "/fbrowser/file/?mode=minimal"+location['hash']; - location.reload(true); } + location.reload(true); + } } ); } diff --git a/mod/fbrowser.php b/mod/fbrowser.php index b2bda8287..e7f4b76d4 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -11,29 +11,29 @@ require_once('include/Photo.php'); * @param App $a */ function fbrowser_content($a){ - + if (!local_user()) killme(); if ($a->argc==1) killme(); - + $template_file = "filebrowser.tpl"; $mode = ""; if (x($_GET,'mode')) { $template_file = "filebrowser_plain.tpl"; $mode = "?mode=".$_GET['mode']; } - - //echo "
"; var_dump($a->argv); killme();	
-	
+
+	//echo "
"; var_dump($a->argv); killme();
+
 	switch($a->argv[1]){
 		case "image":
 			$path = array( array("", t("Photos")));
 			$albums = false;
 			$sql_extra = "";
 			$sql_extra2 = " ORDER BY created DESC LIMIT 0, 10";
-			
+
 			if ($a->argc==2){
 				$albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d ",
 					intval(local_user())
@@ -41,9 +41,9 @@ function fbrowser_content($a){
 				// anon functions only from 5.3.0... meglio tardi che mai..
 				$folder1 = function($el) use ($mode) {return array(bin2hex($el['album']),$el['album']);};
 				$albums = array_map( $folder1 , $albums);
-				
+
 			}
-			
+
 			$album = "";
 			if ($a->argc==3){
 				$album = hex2bin($a->argv[2]);
@@ -51,14 +51,14 @@ function fbrowser_content($a){
 				$sql_extra2 = "";
 				$path[]=array($a->argv[2], $album);
 			}
-				
-			$r = q("SELECT `resource-id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `desc`  
-					FROM `photo` WHERE `uid` = %d AND (height <= 320 AND width <= 320) $sql_extra
+
+			$r = q("SELECT `resource-id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `desc`
+					FROM `photo` WHERE `uid` = %d  $sql_extra
 					GROUP BY `resource-id` $sql_extra2",
-				intval(local_user())					
+				intval(local_user())
 			);
-			
-			function files1($rr){ 
+
+			function files1($rr){
 				global $a;
 				$types = Photo::supportedTypes();
 				$ext = $types[$rr['type']];
@@ -70,16 +70,16 @@ function fbrowser_content($a){
 					$filename_e = $rr['filename'];
 				}
 
-				return array( 
-					$a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['hiq'] . '.' .$ext, 
-					$filename_e, 
+				return array(
+					$a->get_baseurl() . '/photo/' . $rr['resource-id'] . '.' .$ext,
+					$filename_e,
 					$a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['loq'] . '.'. $ext
 				);
 			}
 			$files = array_map("files1", $r);
-			
+
 			$tpl = get_markup_template($template_file);
-			
+
 			$o =  replace_macros($tpl, array(
 				'$type' => 'image',
 				'$baseurl' => $a->get_baseurl(),
@@ -89,16 +89,16 @@ function fbrowser_content($a){
 				'$cancel' => t('Cancel'),
 				'$nickname' => $a->user['nickname'],
 			));
-				
-				
+
+
 			break;
 		case "file":
 			if ($a->argc==2){
 				$files = q("SELECT id, filename, filetype FROM `attach` WHERE `uid` = %d ",
 					intval(local_user())
 				);
-				
-				function files2($rr){ global $a; 
+
+				function files2($rr){ global $a;
 					list($m1,$m2) = explode("/",$rr['filetype']);
 					$filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
 
@@ -109,12 +109,12 @@ function fbrowser_content($a){
 						$filename_e = $rr['filename'];
 					}
 
-					return array( $a->get_baseurl() . '/attach/' . $rr['id'], $filename_e, $a->get_baseurl() . '/images/icons/16/' . $filetype . '.png'); 
+					return array( $a->get_baseurl() . '/attach/' . $rr['id'], $filename_e, $a->get_baseurl() . '/images/icons/16/' . $filetype . '.png');
 				}
 				$files = array_map("files2", $files);
 				//echo "
"; var_dump($files); killme();
-			
-							
+
+
 				$tpl = get_markup_template($template_file);
 				$o = replace_macros($tpl, array(
 					'$type' => 'file',
@@ -125,18 +125,18 @@ function fbrowser_content($a){
 					'$cancel' => t('Cancel'),
 					'$nickname' => $a->user['nickname'],
 				));
-				
+
 			}
-		
+
 			break;
 	}
-	
+
 	if (x($_GET,'mode')) {
 		return $o;
 	} else {
 		echo $o;
 		killme();
 	}
-	
-	
+
+
 }
diff --git a/mod/wall_attach.php b/mod/wall_attach.php
index 1e63a904c..e11d749a3 100644
--- a/mod/wall_attach.php
+++ b/mod/wall_attach.php
@@ -5,17 +5,22 @@ require_once('include/datetime.php');
 
 function wall_attach_post(&$a) {
 
+	$r_json = (x($_GET,'response') && $_GET['response']=='json');
+
 	if($a->argc > 1) {
 		$nick = $a->argv[1];
 		$r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid`  WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
 			dbesc($nick)
 		);
-		if(! count($r))
+		if(! count($r)){
+			if ($r_json) { echo json_encode(['error'=>t('Invalid request.')]); killme(); }
 			return;
+        }
 
-	}
-	else
+	} else {
+		if ($r_json) { echo json_encode(['error'=>t('Invalid request.')]); killme(); }
 		return;
+    }
 
 	$can_post  = false;
 	$visitor   = 0;
@@ -52,12 +57,15 @@ function wall_attach_post(&$a) {
 		}
 	}
 	if(! $can_post) {
+		if ($r_json) { echo json_encode(['error'=>t('Permission denied.')]); killme(); }
 		notice( t('Permission denied.') . EOL );
 		killme();
 	}
 
-	if(! x($_FILES,'userfile'))
+	if(! x($_FILES,'userfile')) {
+		if ($r_json) { echo json_encode(['error'=>t('Invalid request.')]); killme(); }
 		killme();
+	}
 
 	$src      = $_FILES['userfile']['tmp_name'];
 	$filename = basename($_FILES['userfile']['name']);
@@ -72,13 +80,23 @@ function wall_attach_post(&$a) {
 	 */
 
 	if($filesize <=0) {
-		notice(t('Sorry, maybe your upload is bigger than the PHP configuration allows') . EOL .(t('Or - did you try to upload an empty file?')) . EOL);
+		$msg = t('Sorry, maybe your upload is bigger than the PHP configuration allows') . EOL .(t('Or - did you try to upload an empty file?'));
+		if ($r_json) {
+			echo json_encode(['error'=>$msg]);
+		} else {
+			notice( $msg. EOL );
+		}
 		@unlink($src);
 		killme();
 	}
 
 	if(($maxfilesize) && ($filesize > $maxfilesize)) {
-		echo sprintf(t('File exceeds size limit of %s'), formatBytes($maxfilesize)) . EOL;
+		$msg = sprintf(t('File exceeds size limit of %s'), formatBytes($maxfilesize));
+		if ($r_json) {
+			echo json_encode(['error'=>$msg]);
+		} else {
+			echo  $msg. EOL ;
+		}
 		@unlink($src);
 		killme();
 	}
@@ -90,7 +108,12 @@ function wall_attach_post(&$a) {
 	$limit = service_class_fetch($page_owner_uid,'attach_upload_limit');
 
 	if(($limit !== false) && (($r[0]['total'] + strlen($imagedata)) > $limit)) {
-		echo upgrade_message(true) . EOL ;
+		$msg = upgrade_message(true);
+		if ($r_json) {
+			echo json_encode(['error'=>$msg]);
+		} else {
+			echo  $msg. EOL ;
+		}
 		@unlink($src);
 		killme();
 	}
@@ -119,7 +142,12 @@ function wall_attach_post(&$a) {
 	@unlink($src);
 
 	if(! $r) {
-		echo ( t('File upload failed.') . EOL);
+		$msg =  t('File upload failed.');
+		if ($r_json) {
+			echo json_encode(['error'=>$msg]);
+		} else {
+			echo  $msg. EOL ;
+		}
 		killme();
 	}
 
@@ -130,14 +158,21 @@ function wall_attach_post(&$a) {
 	);
 
 	if(! count($r)) {
-		echo ( t('File upload failed.') . EOL);
+		$msg = t('File upload failed.');
+		if ($r_json) {
+			echo json_encode(['error'=>$msg]);
+		} else {
+			echo  $msg. EOL ;
+		}
 		killme();
 	}
 
+	if ($r_json) { echo json_encode(['ok'=>true]); killme(); }
+
 	$lf = "\n";
 
 	echo  $lf . $lf . '[attachment]' . $r[0]['id'] . '[/attachment]' . $lf;
-	
+
 	killme();
 	// NOTREACHED
 }
diff --git a/mod/wall_upload.php b/mod/wall_upload.php
index 44cfa0156..fce28c47d 100644
--- a/mod/wall_upload.php
+++ b/mod/wall_upload.php
@@ -6,26 +6,29 @@ function wall_upload_post(&$a, $desktopmode = true) {
 
 	logger("wall upload: starting new upload", LOGGER_DEBUG);
 
+	$r_json = (x($_GET,'response') && $_GET['response']=='json');
+
 	if($a->argc > 1) {
-	        if(! x($_FILES,'media')) {
-		        $nick = $a->argv[1];
-		        $r = q("SELECT `user`.*, `contact`.`id` FROM `user` INNER JOIN `contact` on `user`.`uid` = `contact`.`uid`  WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
-			        dbesc($nick)
-		        );
+		if(! x($_FILES,'media')) {
+			$nick = $a->argv[1];
+			$r = q("SELECT `user`.*, `contact`.`id` FROM `user` INNER JOIN `contact` on `user`.`uid` = `contact`.`uid`  WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
+				dbesc($nick)
+			);
 
-		        if(! count($r))
-                                return;
-		}
-                else {
+			if(! count($r)){
+				if ($r_json) { echo json_encode(['error'=>t('Invalid request.')]); killme(); }
+				return;
+			}
+		} else {
 			$user_info = api_get_user($a);
-		        $r = q("SELECT `user`.*, `contact`.`id` FROM `user` INNER JOIN `contact` on `user`.`uid` = `contact`.`uid`  WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
-			        dbesc($user_info['screen_name'])
-		        );
-                }
-	}
-	else
+			$r = q("SELECT `user`.*, `contact`.`id` FROM `user` INNER JOIN `contact` on `user`.`uid` = `contact`.`uid`  WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
+				dbesc($user_info['screen_name'])
+			);
+		}
+	} else {
+		if ($r_json) { echo json_encode(['error'=>t('Invalid request.')]); killme(); }
 		return;
-
+	}
 
 	$can_post  = false;
 	$visitor   = 0;
@@ -62,14 +65,19 @@ function wall_upload_post(&$a, $desktopmode = true) {
 		}
 	}
 
+
 	if(! $can_post) {
+		if ($r_json) { echo json_encode(['error'=>t('Permission denied.')]); killme(); }
 		notice( t('Permission denied.') . EOL );
 		killme();
 	}
 
-	if(! x($_FILES,'userfile') && ! x($_FILES,'media'))
+	if(! x($_FILES,'userfile') && ! x($_FILES,'media')){
+		if ($r_json) { echo json_encode(['error'=>t('Invalid request.')]); killme(); }
 		killme();
+	}
 
+	$src = "";
 	if(x($_FILES,'userfile')) {
 		$src      = $_FILES['userfile']['tmp_name'];
 		$filename = basename($_FILES['userfile']['name']);
@@ -98,6 +106,12 @@ function wall_upload_post(&$a, $desktopmode = true) {
 			$filetype = $_FILES['media']['type'];
 	}
 
+	if ($src=="") {
+		if ($r_json) { echo json_encode(['error'=>t('Invalid request.')]); killme(); }
+		notice(t('Invalid request.').EOL);
+		killme();
+	}
+
 	// This is a special treatment for picture upload from Twidere
 	if (($filename == "octet-stream") AND ($filetype != "")) {
 		$filename = $filetype;
@@ -109,6 +123,7 @@ function wall_upload_post(&$a, $desktopmode = true) {
 
 	// If there is a temp name, then do a manual check
 	// This is more reliable than the provided value
+
 	$imagedata = getimagesize($src);
 	if ($imagedata)
 		$filetype = $imagedata['mime'];
@@ -119,7 +134,12 @@ function wall_upload_post(&$a, $desktopmode = true) {
 	$maximagesize = get_config('system','maximagesize');
 
 	if(($maximagesize) && ($filesize > $maximagesize)) {
-		echo  sprintf( t('Image exceeds size limit of %s'), formatBytes($maximagesize)) . EOL;
+		$msg = sprintf( t('Image exceeds size limit of %s'), formatBytes($maximagesize));
+		if ($r_json) {
+			echo json_encode(['error'=>$msg]);
+		} else {
+			echo  $msg. EOL;
+		}
 		@unlink($src);
 		killme();
 	}
@@ -131,7 +151,12 @@ function wall_upload_post(&$a, $desktopmode = true) {
 	$limit = service_class_fetch($page_owner_uid,'photo_upload_limit');
 
 	if(($limit !== false) && (($r[0]['total'] + strlen($imagedata)) > $limit)) {
-		echo upgrade_message(true) . EOL ;
+		$msg = upgrade_message(true);
+		if ($r_json) {
+			echo json_encode(['error'=>$msg]);
+		} else {
+			echo  $msg. EOL;
+		}
 		@unlink($src);
 		killme();
 	}
@@ -141,7 +166,12 @@ function wall_upload_post(&$a, $desktopmode = true) {
 	$ph = new Photo($imagedata, $filetype);
 
 	if(! $ph->is_valid()) {
-		echo ( t('Unable to process image.') . EOL);
+		$msg = t('Unable to process image.');
+		if ($r_json) {
+			echo json_encode(['error'=>$msg]);
+		} else {
+			echo  $msg. EOL;
+		}
 		@unlink($src);
 		killme();
 	}
@@ -169,7 +199,12 @@ function wall_upload_post(&$a, $desktopmode = true) {
 	$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, t('Wall Photos'), 0, 0, $defperm);
 
 	if(! $r) {
-		echo ( t('Image upload failed.') . EOL);
+		$msg = t('Image upload failed.');
+		if ($r_json) {
+			echo json_encode(['error'=>$msg]);
+		} else {
+			echo  $msg. EOL;
+		}
 		killme();
 	}
 
@@ -192,9 +227,10 @@ function wall_upload_post(&$a, $desktopmode = true) {
 	if (!$desktopmode) {
 
 		$r = q("SELECT `id`, `datasize`, `width`, `height`, `type` FROM `photo` WHERE `resource-id` = '%s' ORDER BY `width` DESC LIMIT 1", $hash);
-		if (!$r)
+		if (!$r){
+			if ($r_json) { echo json_encode(['error'=>'']); killme(); }
 			return false;
-
+		}
 		$picture = array();
 
 		$picture["id"] = $r[0]["id"];
@@ -206,9 +242,12 @@ function wall_upload_post(&$a, $desktopmode = true) {
 		$picture["picture"] = $a->get_baseurl()."/photo/{$hash}-0.".$ph->getExt();
 		$picture["preview"] = $a->get_baseurl()."/photo/{$hash}-{$smallest}.".$ph->getExt();
 
+		if ($r_json) { echo json_encode(['picture'=>$picture]); killme(); }
 		return $picture;
 	}
 
+	if ($r_json) { echo json_encode(['ok'=>true]); killme(); }
+
 /* mod Waitman Gobble NO WARRANTY */
 
 //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)
diff --git a/view/global.css b/view/global.css
index 720ffc530..c2f584003 100644
--- a/view/global.css
+++ b/view/global.css
@@ -194,6 +194,9 @@ key { display: inline; background-color: #eee; color: #666; padding:0.2em; font-
 .fbrowser.file img { display: inline; }
 .fbrowser.file p  { display: inline; white-space: nowrap; }
 .fbrowser .upload { clear: both; padding-top: 1em;}
+.fbrowser .error { background: #ffeeee; border: 1px solid #994444; color: #994444; padding: 0.5em;}
+.fbrowser .error a.close { float: right; font-weight: bold; }
+.fbrowser .error.hidden { display: none; }
 
 a {
   cursor: pointer;
diff --git a/view/templates/filebrowser_plain.tpl b/view/templates/filebrowser_plain.tpl
index 4a50d4ac9..1ebf8a2cc 100644
--- a/view/templates/filebrowser_plain.tpl
+++ b/view/templates/filebrowser_plain.tpl
@@ -13,11 +13,14 @@
 	});
 
 
+
{{foreach $path as $p}}{{$p.1}}{{/foreach}}
- + {{if $folders }}
    @@ -25,7 +28,7 @@
{{/if}} - +
{{foreach $files as $f}}
@@ -38,11 +41,11 @@
- +
- + From 489e90281aff5ea4eb3fe1027babd493c7541b5d Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 24 Aug 2015 14:21:22 +0200 Subject: [PATCH 4/5] DE updated translation --- view/de/messages.po | 475 +++++++++++++++++++++++--------------------- view/de/strings.php | 10 +- 2 files changed, 251 insertions(+), 234 deletions(-) diff --git a/view/de/messages.po b/view/de/messages.po index 00adec133..1402fc30b 100644 --- a/view/de/messages.po +++ b/view/de/messages.po @@ -18,6 +18,7 @@ # marmor , 2012 # Martin Schmitt , 2012 # Matthias Moritz , 2012 +# Oliver , 2015 # Oliver , 2012 # Sennewood , 2013 # Sennewood , 2012-2013 @@ -30,8 +31,8 @@ msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-08-17 09:52+0200\n" -"PO-Revision-Date: 2015-08-17 09:59+0000\n" +"POT-Creation-Date: 2015-08-24 07:49+0200\n" +"PO-Revision-Date: 2015-08-24 12:19+0000\n" "Last-Translator: bavatar \n" "Language-Team: German (http://www.transifex.com/Friendica/friendica/language/de/)\n" "MIME-Version: 1.0\n" @@ -73,7 +74,7 @@ msgstr "Aktualisierung der Kontaktdaten fehlgeschlagen." #: mod/nogroup.php:25 mod/network.php:4 mod/allfriends.php:9 #: mod/events.php:164 mod/wallmessage.php:9 mod/wallmessage.php:33 #: mod/wallmessage.php:79 mod/wallmessage.php:103 mod/wall_attach.php:55 -#: mod/settings.php:20 mod/settings.php:116 mod/settings.php:618 +#: mod/settings.php:20 mod/settings.php:116 mod/settings.php:619 #: mod/register.php:42 mod/delegate.php:12 mod/mood.php:114 mod/suggest.php:58 #: mod/profiles.php:165 mod/profiles.php:615 mod/editpost.php:10 #: mod/api.php:26 mod/api.php:31 mod/notes.php:20 mod/poke.php:135 @@ -112,11 +113,11 @@ msgid "Do you really want to delete this contact?" msgstr "Möchtest Du wirklich diesen Kontakt löschen?" #: mod/contacts.php:413 mod/follow.php:57 mod/message.php:210 -#: mod/settings.php:1054 mod/settings.php:1060 mod/settings.php:1068 -#: mod/settings.php:1072 mod/settings.php:1077 mod/settings.php:1083 -#: mod/settings.php:1089 mod/settings.php:1095 mod/settings.php:1123 -#: mod/settings.php:1124 mod/settings.php:1125 mod/settings.php:1126 -#: mod/settings.php:1127 mod/dfrn_request.php:845 mod/register.php:235 +#: mod/settings.php:1063 mod/settings.php:1069 mod/settings.php:1077 +#: mod/settings.php:1081 mod/settings.php:1086 mod/settings.php:1092 +#: mod/settings.php:1098 mod/settings.php:1104 mod/settings.php:1130 +#: mod/settings.php:1131 mod/settings.php:1132 mod/settings.php:1133 +#: mod/settings.php:1134 mod/dfrn_request.php:845 mod/register.php:235 #: mod/suggest.php:29 mod/profiles.php:658 mod/profiles.php:661 #: mod/api.php:105 include/items.php:4854 msgid "Yes" @@ -124,7 +125,7 @@ msgstr "Ja" #: mod/contacts.php:416 mod/tagrm.php:11 mod/tagrm.php:94 mod/follow.php:68 #: mod/videos.php:121 mod/message.php:213 mod/fbrowser.php:89 -#: mod/fbrowser.php:125 mod/settings.php:632 mod/settings.php:658 +#: mod/fbrowser.php:125 mod/settings.php:633 mod/settings.php:659 #: mod/dfrn_request.php:859 mod/suggest.php:32 mod/editpost.php:148 #: mod/photos.php:225 mod/photos.php:314 include/conversation.php:1093 #: include/items.php:4857 @@ -325,7 +326,7 @@ msgstr "Letzte Aktualisierung: " msgid "Update public posts" msgstr "Öffentliche Beiträge aktualisieren" -#: mod/contacts.php:591 mod/admin.php:1573 +#: mod/contacts.php:591 mod/admin.php:1580 msgid "Update now" msgstr "Jetzt aktualisieren" @@ -343,7 +344,7 @@ msgstr "Momentan archiviert" #: mod/contacts.php:601 mod/notifications.php:167 mod/notifications.php:227 msgid "Hide this contact from others" -msgstr "Verbirg diesen Kontakt von anderen" +msgstr "Verbirg diesen Kontakt vor andere" #: mod/contacts.php:601 msgid "" @@ -444,12 +445,12 @@ msgstr "Funde: " msgid "Find" msgstr "Finde" -#: mod/contacts.php:769 mod/settings.php:146 mod/settings.php:657 +#: mod/contacts.php:769 mod/settings.php:146 mod/settings.php:658 msgid "Update" msgstr "Aktualisierungen" #: mod/contacts.php:773 mod/group.php:171 mod/admin.php:1077 -#: mod/content.php:440 mod/content.php:743 mod/settings.php:694 +#: mod/content.php:440 mod/content.php:743 mod/settings.php:695 #: mod/photos.php:1673 object/Item.php:131 include/conversation.php:613 msgid "Delete" msgstr "Löschen" @@ -523,7 +524,7 @@ msgid "All Contacts (with secure profile access)" msgstr "Alle Kontakte (mit gesichertem Profilzugriff)" #: mod/display.php:82 mod/display.php:295 mod/display.php:512 -#: mod/viewsrc.php:15 mod/admin.php:173 mod/admin.php:1122 mod/admin.php:1335 +#: mod/viewsrc.php:15 mod/admin.php:173 mod/admin.php:1122 mod/admin.php:1342 #: mod/notice.php:15 include/items.php:4813 msgid "Item not found." msgstr "Beitrag nicht gefunden." @@ -573,7 +574,7 @@ msgid "" " join." msgstr "Auf der Quick Start Seite findest Du eine kurze Einleitung in die einzelnen Funktionen Deines Profils und die Netzwerk-Reiter, wo Du interessante Foren findest und neue Kontakte knüpfst." -#: mod/newmember.php:22 mod/admin.php:1174 mod/admin.php:1395 +#: mod/newmember.php:22 mod/admin.php:1174 mod/admin.php:1402 #: mod/settings.php:99 include/nav.php:173 view/theme/diabook/theme.php:544 #: view/theme/diabook/theme.php:648 msgid "Settings" @@ -799,7 +800,7 @@ msgstr "Profil auswählen:" msgid "Upload" msgstr "Hochladen" -#: mod/profile_photo.php:248 mod/settings.php:1106 +#: mod/profile_photo.php:248 msgid "or" msgstr "oder" @@ -893,11 +894,11 @@ msgstr "Bitte beantworte folgendes:" msgid "Does %s know you?" msgstr "Kennt %s Dich?" -#: mod/follow.php:57 mod/settings.php:1054 mod/settings.php:1060 -#: mod/settings.php:1068 mod/settings.php:1072 mod/settings.php:1077 -#: mod/settings.php:1083 mod/settings.php:1089 mod/settings.php:1095 -#: mod/settings.php:1123 mod/settings.php:1124 mod/settings.php:1125 -#: mod/settings.php:1126 mod/settings.php:1127 mod/dfrn_request.php:845 +#: mod/follow.php:57 mod/settings.php:1063 mod/settings.php:1069 +#: mod/settings.php:1077 mod/settings.php:1081 mod/settings.php:1086 +#: mod/settings.php:1092 mod/settings.php:1098 mod/settings.php:1104 +#: mod/settings.php:1130 mod/settings.php:1131 mod/settings.php:1132 +#: mod/settings.php:1133 mod/settings.php:1134 mod/dfrn_request.php:845 #: mod/register.php:236 mod/profiles.php:658 mod/profiles.php:662 #: mod/api.php:106 msgid "No" @@ -1762,8 +1763,8 @@ msgid "Refetch contact data" msgstr "Kontaktdaten neu laden" #: mod/crepair.php:170 mod/admin.php:1073 mod/admin.php:1085 -#: mod/admin.php:1086 mod/admin.php:1099 mod/settings.php:633 -#: mod/settings.php:659 +#: mod/admin.php:1086 mod/admin.php:1099 mod/settings.php:634 +#: mod/settings.php:660 msgid "Name" msgstr "Name" @@ -1864,11 +1865,11 @@ msgstr "Seite" msgid "Users" msgstr "Nutzer" -#: mod/admin.php:106 mod/admin.php:1172 mod/admin.php:1225 mod/settings.php:66 +#: mod/admin.php:106 mod/admin.php:1172 mod/admin.php:1232 mod/settings.php:66 msgid "Plugins" msgstr "Plugins" -#: mod/admin.php:107 mod/admin.php:1393 mod/admin.php:1427 +#: mod/admin.php:107 mod/admin.php:1400 mod/admin.php:1434 msgid "Themes" msgstr "Themen" @@ -1880,7 +1881,7 @@ msgstr "DB Updates" msgid "Inspect Queue" msgstr "Warteschlange Inspizieren" -#: mod/admin.php:124 mod/admin.php:133 mod/admin.php:1514 +#: mod/admin.php:124 mod/admin.php:133 mod/admin.php:1521 msgid "Logs" msgstr "Protokolle" @@ -1909,8 +1910,8 @@ msgid "User registrations waiting for confirmation" msgstr "Nutzeranmeldungen die auf Bestätigung warten" #: mod/admin.php:199 mod/admin.php:249 mod/admin.php:678 mod/admin.php:1067 -#: mod/admin.php:1171 mod/admin.php:1224 mod/admin.php:1392 mod/admin.php:1426 -#: mod/admin.php:1513 +#: mod/admin.php:1171 mod/admin.php:1231 mod/admin.php:1399 mod/admin.php:1433 +#: mod/admin.php:1520 msgid "Administration" msgstr "Administration" @@ -1997,7 +1998,7 @@ msgstr "Die Basis-URL konnte nicht analysiert werden. Sie muss mindestens aus

not published." msgstr "Profil ist nicht veröffentlicht." -#: mod/settings.php:1111 -msgid "Your Identity Address is" -msgstr "Die Adresse Deines Profils lautet:" - #: mod/settings.php:1120 +#, php-format +msgid "Your Identity Address is '%s' or '%s'." +msgstr "Die Adresse deines Profils lautet '%s' oder '%s'." + +#: mod/settings.php:1127 msgid "Automatically expire posts after this many days:" msgstr "Beiträge verfallen automatisch nach dieser Anzahl von Tagen:" -#: mod/settings.php:1120 +#: mod/settings.php:1127 msgid "If empty, posts will not expire. Expired posts will be deleted" msgstr "Wenn leer verfallen Beiträge nie automatisch. Verfallene Beiträge werden gelöscht." -#: mod/settings.php:1121 +#: mod/settings.php:1128 msgid "Advanced expiration settings" msgstr "Erweiterte Verfallseinstellungen" -#: mod/settings.php:1122 +#: mod/settings.php:1129 msgid "Advanced Expiration" msgstr "Erweitertes Verfallen" -#: mod/settings.php:1123 +#: mod/settings.php:1130 msgid "Expire posts:" msgstr "Beiträge verfallen lassen:" -#: mod/settings.php:1124 +#: mod/settings.php:1131 msgid "Expire personal notes:" msgstr "Persönliche Notizen verfallen lassen:" -#: mod/settings.php:1125 +#: mod/settings.php:1132 msgid "Expire starred posts:" msgstr "Markierte Beiträge verfallen lassen:" -#: mod/settings.php:1126 +#: mod/settings.php:1133 msgid "Expire photos:" msgstr "Fotos verfallen lassen:" -#: mod/settings.php:1127 +#: mod/settings.php:1134 msgid "Only expire posts by others:" msgstr "Nur Beiträge anderer verfallen:" -#: mod/settings.php:1153 +#: mod/settings.php:1160 msgid "Account Settings" msgstr "Kontoeinstellungen" -#: mod/settings.php:1161 +#: mod/settings.php:1168 msgid "Password Settings" msgstr "Passwort-Einstellungen" -#: mod/settings.php:1162 mod/register.php:271 +#: mod/settings.php:1169 mod/register.php:271 msgid "New Password:" msgstr "Neues Passwort:" -#: mod/settings.php:1163 mod/register.php:272 +#: mod/settings.php:1170 mod/register.php:272 msgid "Confirm:" msgstr "Bestätigen:" -#: mod/settings.php:1163 +#: mod/settings.php:1170 msgid "Leave password fields blank unless changing" msgstr "Lass die Passwort-Felder leer, außer Du willst das Passwort ändern" -#: mod/settings.php:1164 +#: mod/settings.php:1171 msgid "Current Password:" msgstr "Aktuelles Passwort:" -#: mod/settings.php:1164 mod/settings.php:1165 +#: mod/settings.php:1171 mod/settings.php:1172 msgid "Your current password to confirm the changes" msgstr "Dein aktuelles Passwort um die Änderungen zu bestätigen" -#: mod/settings.php:1165 +#: mod/settings.php:1172 msgid "Password:" msgstr "Passwort:" -#: mod/settings.php:1169 +#: mod/settings.php:1176 msgid "Basic Settings" msgstr "Grundeinstellungen" -#: mod/settings.php:1170 include/identity.php:538 +#: mod/settings.php:1177 include/identity.php:538 msgid "Full Name:" msgstr "Kompletter Name:" -#: mod/settings.php:1171 +#: mod/settings.php:1178 msgid "Email Address:" msgstr "E-Mail-Adresse:" -#: mod/settings.php:1172 +#: mod/settings.php:1179 msgid "Your Timezone:" msgstr "Deine Zeitzone:" -#: mod/settings.php:1173 +#: mod/settings.php:1180 msgid "Default Post Location:" msgstr "Standardstandort:" -#: mod/settings.php:1174 +#: mod/settings.php:1181 msgid "Use Browser Location:" msgstr "Standort des Browsers verwenden:" -#: mod/settings.php:1177 +#: mod/settings.php:1184 msgid "Security and Privacy Settings" msgstr "Sicherheits- und Privatsphäre-Einstellungen" -#: mod/settings.php:1179 +#: mod/settings.php:1186 msgid "Maximum Friend Requests/Day:" msgstr "Maximale Anzahl von Freundschaftsanfragen/Tag:" -#: mod/settings.php:1179 mod/settings.php:1209 +#: mod/settings.php:1186 mod/settings.php:1216 msgid "(to prevent spam abuse)" msgstr "(um SPAM zu vermeiden)" -#: mod/settings.php:1180 +#: mod/settings.php:1187 msgid "Default Post Permissions" msgstr "Standard-Zugriffsrechte für Beiträge" -#: mod/settings.php:1181 +#: mod/settings.php:1188 msgid "(click to open/close)" msgstr "(klicke zum öffnen/schließen)" -#: mod/settings.php:1190 mod/photos.php:1166 mod/photos.php:1538 +#: mod/settings.php:1197 mod/photos.php:1166 mod/photos.php:1538 msgid "Show to Groups" msgstr "Zeige den Gruppen" -#: mod/settings.php:1191 mod/photos.php:1167 mod/photos.php:1539 +#: mod/settings.php:1198 mod/photos.php:1167 mod/photos.php:1539 msgid "Show to Contacts" msgstr "Zeige den Kontakten" -#: mod/settings.php:1192 +#: mod/settings.php:1199 msgid "Default Private Post" msgstr "Privater Standardbeitrag" -#: mod/settings.php:1193 +#: mod/settings.php:1200 msgid "Default Public Post" msgstr "Öffentlicher Standardbeitrag" -#: mod/settings.php:1197 +#: mod/settings.php:1204 msgid "Default Permissions for New Posts" msgstr "Standardberechtigungen für neue Beiträge" -#: mod/settings.php:1209 +#: mod/settings.php:1216 msgid "Maximum private messages per day from unknown people:" msgstr "Maximale Anzahl privater Nachrichten von Unbekannten pro Tag:" -#: mod/settings.php:1212 +#: mod/settings.php:1219 msgid "Notification Settings" msgstr "Benachrichtigungseinstellungen" -#: mod/settings.php:1213 +#: mod/settings.php:1220 msgid "By default post a status message when:" msgstr "Standardmäßig eine Statusnachricht posten, wenn:" -#: mod/settings.php:1214 +#: mod/settings.php:1221 msgid "accepting a friend request" msgstr "– Du eine Kontaktanfrage akzeptierst" -#: mod/settings.php:1215 +#: mod/settings.php:1222 msgid "joining a forum/community" msgstr "– Du einem Forum/einer Gemeinschaftsseite beitrittst" -#: mod/settings.php:1216 +#: mod/settings.php:1223 msgid "making an interesting profile change" msgstr "– Du eine interessante Änderung an Deinem Profil durchführst" -#: mod/settings.php:1217 +#: mod/settings.php:1224 msgid "Send a notification email when:" msgstr "Benachrichtigungs-E-Mail senden wenn:" -#: mod/settings.php:1218 +#: mod/settings.php:1225 msgid "You receive an introduction" msgstr "– Du eine Kontaktanfrage erhältst" -#: mod/settings.php:1219 +#: mod/settings.php:1226 msgid "Your introductions are confirmed" msgstr "– eine Deiner Kontaktanfragen akzeptiert wurde" -#: mod/settings.php:1220 +#: mod/settings.php:1227 msgid "Someone writes on your profile wall" msgstr "– jemand etwas auf Deine Pinnwand schreibt" -#: mod/settings.php:1221 +#: mod/settings.php:1228 msgid "Someone writes a followup comment" msgstr "– jemand auch einen Kommentar verfasst" -#: mod/settings.php:1222 +#: mod/settings.php:1229 msgid "You receive a private message" msgstr "– Du eine private Nachricht erhältst" -#: mod/settings.php:1223 +#: mod/settings.php:1230 msgid "You receive a friend suggestion" msgstr "– Du eine Empfehlung erhältst" -#: mod/settings.php:1224 +#: mod/settings.php:1231 msgid "You are tagged in a post" msgstr "– Du in einem Beitrag erwähnt wirst" -#: mod/settings.php:1225 +#: mod/settings.php:1232 msgid "You are poked/prodded/etc. in a post" msgstr "– Du von jemandem angestupst oder sonstwie behandelt wirst" -#: mod/settings.php:1227 +#: mod/settings.php:1234 msgid "Activate desktop notifications" msgstr "Desktop Benachrichtigungen einschalten" -#: mod/settings.php:1227 +#: mod/settings.php:1234 msgid "Show desktop popup on new notifications" msgstr "Desktop Benachrichtigungen einschalten" -#: mod/settings.php:1229 +#: mod/settings.php:1236 msgid "Text-only notification emails" msgstr "Benachrichtigungs E-Mail als Rein-Text." -#: mod/settings.php:1231 +#: mod/settings.php:1238 msgid "Send text only notification emails, without the html part" msgstr "Sende Benachrichtigungs E-Mail als Rein-Text - ohne HTML-Teil" -#: mod/settings.php:1233 +#: mod/settings.php:1240 msgid "Advanced Account/Page Type Settings" msgstr "Erweiterte Konto-/Seitentyp-Einstellungen" -#: mod/settings.php:1234 +#: mod/settings.php:1241 msgid "Change the behaviour of this account for special situations" msgstr "Verhalten dieses Kontos in bestimmten Situationen:" -#: mod/settings.php:1237 +#: mod/settings.php:1244 msgid "Relocate" msgstr "Umziehen" -#: mod/settings.php:1238 +#: mod/settings.php:1245 msgid "" "If you have moved this profile from another server, and some of your " "contacts don't receive your updates, try pushing this button." msgstr "Wenn Du Dein Profil von einem anderen Server umgezogen hast und einige Deiner Kontakte Deine Beiträge nicht erhalten, verwende diesen Button." -#: mod/settings.php:1239 +#: mod/settings.php:1246 msgid "Resend relocate message to contacts" msgstr "Umzugsbenachrichtigung erneut an Kontakte senden" @@ -4552,11 +4566,12 @@ msgid "" msgstr "Bitte gib die Adresse Deines Profils in einem der unterstützten sozialen Netzwerke an:" #: mod/dfrn_request.php:839 +#, php-format msgid "" "If you are not yet a member of the free social web, follow this link to find a public" -" Friendica site and join us today." -msgstr "Wenn Du noch kein Mitglied dieses freien sozialen Netzwerks bist, folge diesem Link um einen öffentlichen Friendica-Server zu finden und beizutreten." +"href=\"%s/siteinfo\">follow this link to find a public Friendica site and " +"join us today." +msgstr "Wenn du noch kein Mitglied dieses freien sozialen Netzwerks bist, folge diesem Link um einen öffentlichen Friendica-Server zu finden und beizutreten." #: mod/dfrn_request.php:842 msgid "Friend/Connection Request" @@ -6827,27 +6842,27 @@ msgstr "Beitrag" msgid "Item filed" msgstr "Beitrag abgelegt" -#: include/bbcode.php:451 include/bbcode.php:1105 include/bbcode.php:1106 +#: include/bbcode.php:458 include/bbcode.php:1112 include/bbcode.php:1113 msgid "Image/photo" msgstr "Bild/Foto" -#: include/bbcode.php:549 +#: include/bbcode.php:556 #, php-format msgid "%2$s %3$s" msgstr "%2$s %3$s" -#: include/bbcode.php:583 +#: include/bbcode.php:590 #, php-format msgid "" "%s wrote the following post" msgstr "%s schrieb den folgenden Beitrag" -#: include/bbcode.php:1069 include/bbcode.php:1089 +#: include/bbcode.php:1076 include/bbcode.php:1096 msgid "$1 wrote:" msgstr "$1 hat geschrieben:" -#: include/bbcode.php:1114 include/bbcode.php:1115 +#: include/bbcode.php:1121 include/bbcode.php:1122 msgid "Encrypted content" msgstr "Verschlüsselter Inhalt" @@ -7124,47 +7139,47 @@ msgstr "Navigation" msgid "Site map" msgstr "Sitemap" -#: include/api.php:310 include/api.php:321 include/api.php:430 -#: include/api.php:1133 include/api.php:1135 +#: include/api.php:321 include/api.php:332 include/api.php:441 +#: include/api.php:1141 include/api.php:1143 msgid "User not found." msgstr "Nutzer nicht gefunden." -#: include/api.php:784 +#: include/api.php:795 #, php-format msgid "Daily posting limit of %d posts reached. The post was rejected." msgstr "Das tägliche Nachrichtenlimit von %d Nachrichten wurde erreicht. Die Nachtricht wurde verworfen." -#: include/api.php:803 +#: include/api.php:814 #, php-format msgid "Weekly posting limit of %d posts reached. The post was rejected." msgstr "Das wöchentliche Nachrichtenlimit von %d Nachrichten wurde erreicht. Die Nachtricht wurde verworfen." -#: include/api.php:822 +#: include/api.php:833 #, php-format msgid "Monthly posting limit of %d posts reached. The post was rejected." msgstr "Das monatliche Nachrichtenlimit von %d Nachrichten wurde erreicht. Die Nachtricht wurde verworfen." -#: include/api.php:1342 +#: include/api.php:1350 msgid "There is no status with this id." msgstr "Es gibt keinen Status mit dieser ID." -#: include/api.php:1416 +#: include/api.php:1424 msgid "There is no conversation with this id." msgstr "Es existiert keine Unterhaltung mit dieser ID." -#: include/api.php:1686 +#: include/api.php:1692 msgid "Invalid request." msgstr "Ungültige Anfrage" -#: include/api.php:1697 +#: include/api.php:1703 msgid "Invalid item." msgstr "Ungültiges Objekt" -#: include/api.php:1707 +#: include/api.php:1713 msgid "Invalid action. " msgstr "Ungültige Aktion" -#: include/api.php:1715 +#: include/api.php:1721 msgid "DB error" msgstr "DB Error" diff --git a/view/de/strings.php b/view/de/strings.php index 481b8cefa..f45f5774e 100644 --- a/view/de/strings.php +++ b/view/de/strings.php @@ -72,7 +72,7 @@ $a->strings["Update now"] = "Jetzt aktualisieren"; $a->strings["Currently blocked"] = "Derzeit geblockt"; $a->strings["Currently ignored"] = "Derzeit ignoriert"; $a->strings["Currently archived"] = "Momentan archiviert"; -$a->strings["Hide this contact from others"] = "Verbirg diesen Kontakt von anderen"; +$a->strings["Hide this contact from others"] = "Verbirg diesen Kontakt vor andere"; $a->strings["Replies/likes to your public posts may still be visible"] = "Antworten/Likes auf deine öffentlichen Beiträge könnten weiterhin sichtbar sein"; $a->strings["Notification for new posts"] = "Benachrichtigung bei neuen Beiträgen"; $a->strings["Send a notification of every new post of this contact"] = "Sende eine Benachrichtigung, wann immer dieser Kontakt einen neuen Beitrag schreibt."; @@ -471,7 +471,7 @@ $a->strings["Banner/Logo"] = "Banner/Logo"; $a->strings["Shortcut icon"] = "Shortcut Icon"; $a->strings["Touch icon"] = "Touch Icon"; $a->strings["Additional Info"] = "Zusätzliche Informationen"; -$a->strings["For public servers: you can add additional information here that will be listed at dir.friendica.com/siteinfo."] = "Für öffentliche Server kannst Du hier zusätzliche Informationen angeben, die dann auf Dir.friendica.com/siteinfo angezeigt werden."; +$a->strings["For public servers: you can add additional information here that will be listed at %s/siteinfo."] = "Für öffentliche Server kannst Du hier zusätzliche Informationen angeben, die dann auf %s/siteinfo angezeigt werden."; $a->strings["System language"] = "Systemsprache"; $a->strings["System theme"] = "Systemweites Theme"; $a->strings["Default system theme - may be over-ridden by user profiles - change theme settings"] = "Vorgabe für das System-Theme - kann von Benutzerprofilen überschrieben werden - Theme-Einstellungen ändern"; @@ -880,6 +880,8 @@ $a->strings["Disable intelligent shortening"] = "Intelligentes Link kürzen auss $a->strings["Normally the system tries to find the best link to add to shortened posts. If this option is enabled then every shortened post will always point to the original friendica post."] = "Normalerweise versucht das System den besten Link zu finden um ihn zu gekürzten Postings hinzu zu fügen. Wird diese Option ausgewählt wird stets ein Link auf die originale Friendica Nachricht beigefügt."; $a->strings["Automatically follow any GNU Social (OStatus) followers/mentioners"] = "Automatisch allen GNU Social (OStatus) Followern/Erwähnern folgen"; $a->strings["If you receive a message from an unknown OStatus user, this option decides what to do. If it is checked, a new contact will be created for every unknown user."] = "Wenn du eine Nachricht eines unbekannten OStatus Nutzers bekommst, entscheidet diese Option wie diese behandelt werden soll. Ist die Option aktiviert, wird ein neuer Kontakt für den Verfasser erstellt,."; +$a->strings["Your legacy GNU Social account"] = "Dein alter GNU Social Account"; +$a->strings["If you enter your old GNU Social/Statusnet account name here (in the format user@domain.tld), your contacts will be added automatically. The field will be emptied when done."] = "Wenn du deinen alten GNU Socual/Statusnet Accountnamen hier angibst (Fprmat name@domain.tld) werden deine Kontakte automatisch hinzugefügt. Dieses Feld wird geleert, wenn die Kontakte hinzugefügt wurden."; $a->strings["Built-in support for %s connectivity is %s"] = "Eingebaute Unterstützung für Verbindungen zu %s ist %s"; $a->strings["Diaspora"] = "Diaspora"; $a->strings["enabled"] = "eingeschaltet"; @@ -938,7 +940,7 @@ $a->strings["Allow friends to tag your posts?"] = "Dürfen Deine Kontakte Deine $a->strings["Allow us to suggest you as a potential friend to new members?"] = "Dürfen wir Dich neuen Mitgliedern als potentiellen Kontakt vorschlagen?"; $a->strings["Permit unknown people to send you private mail?"] = "Dürfen Dir Unbekannte private Nachrichten schicken?"; $a->strings["Profile is not published."] = "Profil ist nicht veröffentlicht."; -$a->strings["Your Identity Address is"] = "Die Adresse Deines Profils lautet:"; +$a->strings["Your Identity Address is '%s' or '%s'."] = "Die Adresse deines Profils lautet '%s' oder '%s'."; $a->strings["Automatically expire posts after this many days:"] = "Beiträge verfallen automatisch nach dieser Anzahl von Tagen:"; $a->strings["If empty, posts will not expire. Expired posts will be deleted"] = "Wenn leer verfallen Beiträge nie automatisch. Verfallene Beiträge werden gelöscht."; $a->strings["Advanced expiration settings"] = "Erweiterte Verfallseinstellungen"; @@ -1026,7 +1028,7 @@ $a->strings["Hide this contact"] = "Verberge diesen Kontakt"; $a->strings["Welcome home %s."] = "Willkommen zurück %s."; $a->strings["Please confirm your introduction/connection request to %s."] = "Bitte bestätige Deine Kontaktanfrage bei %s."; $a->strings["Please enter your 'Identity Address' from one of the following supported communications networks:"] = "Bitte gib die Adresse Deines Profils in einem der unterstützten sozialen Netzwerke an:"; -$a->strings["If you are not yet a member of the free social web, follow this link to find a public Friendica site and join us today."] = "Wenn Du noch kein Mitglied dieses freien sozialen Netzwerks bist, folge diesem Link um einen öffentlichen Friendica-Server zu finden und beizutreten."; +$a->strings["If you are not yet a member of the free social web, follow this link to find a public Friendica site and join us today."] = "Wenn du noch kein Mitglied dieses freien sozialen Netzwerks bist, folge diesem Link um einen öffentlichen Friendica-Server zu finden und beizutreten."; $a->strings["Friend/Connection Request"] = "Freundschafts-/Kontaktanfrage"; $a->strings["Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@identi.ca"] = "Beispiele: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@identi.ca"; $a->strings["Friendica"] = "Friendica"; From b52bc71c6cdc3ee328604d9b68b730137c6df92d Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 24 Aug 2015 17:24:14 +0200 Subject: [PATCH 5/5] Now you can define the duration of the cache entries. --- boot.php | 11 ++++++++++- include/Scrape.php | 2 +- include/cache.php | 31 ++++++++++++++++--------------- include/dbstructure.php | 1 + include/discover_poco.php | 2 +- include/items.php | 2 +- include/oembed.php | 2 +- mod/parse_url.php | 2 +- update.php | 2 +- 9 files changed, 33 insertions(+), 22 deletions(-) diff --git a/boot.php b/boot.php index 7fb459141..7451891fe 100644 --- a/boot.php +++ b/boot.php @@ -19,7 +19,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_CODENAME', 'Lily of the valley'); define ( 'FRIENDICA_VERSION', '3.4.1' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1187 ); +define ( 'DB_UPDATE_VERSION', 1188 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -84,6 +84,15 @@ define ( 'LOGGER_DEBUG', 2 ); define ( 'LOGGER_DATA', 3 ); define ( 'LOGGER_ALL', 4 ); +/** + * cache levels + */ + +define ( 'CACHE_MONTH', 0 ); +define ( 'CACHE_WEEK', 1 ); +define ( 'CACHE_DAY', 2 ); +define ( 'CACHE_HOUR', 3 ); + /** * registration policies */ diff --git a/include/Scrape.php b/include/Scrape.php index 83c099769..a2bf5ee0a 100644 --- a/include/Scrape.php +++ b/include/Scrape.php @@ -819,7 +819,7 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) { } } - Cache::set("probe_url:".$mode.":".$url,serialize($result)); + Cache::set("probe_url:".$mode.":".$url,serialize($result), CACHE_DAY); return $result; } diff --git a/include/cache.php b/include/cache.php index 3a18fe2a5..d0b0dfafd 100644 --- a/include/cache.php +++ b/include/cache.php @@ -5,33 +5,25 @@ class Cache { public static function get($key) { - /*if (function_exists("apc_fetch") AND function_exists("apc_exists")) - if (apc_exists($key)) - return(apc_fetch($key));*/ $r = q("SELECT `v` FROM `cache` WHERE `k`='%s' limit 1", dbesc($key) ); - if (count($r)) { - /*if (function_exists("apc_store")) - apc_store($key, $r[0]['v'], 600);*/ - + if (count($r)) return $r[0]['v']; - } + return null; } - public static function set($key,$value) { + public static function set($key,$value, $duration = CACHE_MONTH) { - q("REPLACE INTO `cache` (`k`,`v`,`updated`) VALUES ('%s','%s','%s')", + q("REPLACE INTO `cache` (`k`,`v`,`expire_mode`,`updated`) VALUES ('%s','%s',%d,'%s')", dbesc($key), dbesc($value), + intval($duration), dbesc(datetime_convert())); - /*if (function_exists("apc_store")) - apc_store($key, $value, 600);*/ - } @@ -63,8 +55,17 @@ public static function clear(){ - q("DELETE FROM `cache` WHERE `updated` < '%s'", - dbesc(datetime_convert('UTC','UTC',"now - 30 days"))); + q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d", + dbesc(datetime_convert('UTC','UTC',"now - 30 days")), intval(CACHE_MONTH)); + + q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d", + dbesc(datetime_convert('UTC','UTC',"now - 7 days")), intval(CACHE_WEEK)); + + q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d", + dbesc(datetime_convert('UTC','UTC',"now - 1 days")), intval(CACHE_DAY)); + + q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d", + dbesc(datetime_convert('UTC','UTC',"now - 1 hours")), intval(CACHE_HOUR)); } } diff --git a/include/dbstructure.php b/include/dbstructure.php index 2370b01be..2b1ee84fd 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -364,6 +364,7 @@ function db_definition() { "fields" => array( "k" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"), "v" => array("type" => "text", "not null" => "1"), + "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"), "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), ), "indexes" => array( diff --git a/include/discover_poco.php b/include/discover_poco.php index 4a17b4927..79958a884 100644 --- a/include/discover_poco.php +++ b/include/discover_poco.php @@ -183,7 +183,7 @@ function discover_directory($search) { poco_check($data["url"], $data["name"], $data["network"], $data["photo"], "", "", "", $jj->tags, $data["addr"], "", 0); } } - Cache::set("dirsearch:".$search, time()); + Cache::set("dirsearch:".$search, time(), CACHE_DAY); } if (array_search(__file__,get_included_files())===0){ diff --git a/include/items.php b/include/items.php index a2b2a0197..f15e2a1fc 100644 --- a/include/items.php +++ b/include/items.php @@ -969,7 +969,7 @@ function query_page_info($url, $no_photos = false, $photo = "", $keywords = fals $data = Cache::get("parse_url:".$url); if (is_null($data)){ $data = parseurl_getsiteinfo($url, true); - Cache::set("parse_url:".$url,serialize($data)); + Cache::set("parse_url:".$url,serialize($data), CACHE_DAY); } else $data = unserialize($data); diff --git a/include/oembed.php b/include/oembed.php index b32cb512b..aec92bfa0 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -73,7 +73,7 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){ if ($txt[0]!="{") $txt='{"type":"error"}'; //save in cache - Cache::set($a->videowidth . $embedurl,$txt); + Cache::set($a->videowidth . $embedurl,$txt, CACHE_DAY); } diff --git a/mod/parse_url.php b/mod/parse_url.php index 50c6a15b0..97eebb89a 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -60,7 +60,7 @@ function parseurl_getsiteinfo_cached($url, $no_guessing = false, $do_oembed = tr $data = parseurl_getsiteinfo($url, $no_guessing, $do_oembed); - Cache::set("parse_url:".$no_guessing.":".$do_oembed.":".$url,serialize($data)); + Cache::set("parse_url:".$no_guessing.":".$do_oembed.":".$url,serialize($data), CACHE_DAY); return $data; } diff --git a/update.php b/update.php index a2c867402..761da7273 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@