Merge remote-tracking branch 'upstream/develop' into 1602-mixed-content

This commit is contained in:
Michael Vogel 2016-02-18 08:15:58 +01:00
commit 2eb461ed2c
4 changed files with 65 additions and 59 deletions

View File

@ -161,10 +161,7 @@
if (!isset($_SERVER['PHP_AUTH_USER'])) { if (!isset($_SERVER['PHP_AUTH_USER'])) {
logger('API_login: ' . print_r($_SERVER,true), LOGGER_DEBUG); logger('API_login: ' . print_r($_SERVER,true), LOGGER_DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"'); header('WWW-Authenticate: Basic realm="Friendica"');
header('HTTP/1.0 401 Unauthorized'); throw new UnauthorizedException("This API requires login");
die((api_error($a, 'json', "This api requires login")));
//die('This api requires login');
} }
$user = $_SERVER['PHP_AUTH_USER']; $user = $_SERVER['PHP_AUTH_USER'];
@ -216,8 +213,9 @@
if((! $record) || (! count($record))) { if((! $record) || (! count($record))) {
logger('API_login failure: ' . print_r($_SERVER,true), LOGGER_DEBUG); logger('API_login failure: ' . print_r($_SERVER,true), LOGGER_DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"'); header('WWW-Authenticate: Basic realm="Friendica"');
header('HTTP/1.0 401 Unauthorized'); #header('HTTP/1.0 401 Unauthorized');
die('This api requires login'); #die('This api requires login');
throw new UnauthorizedException("This API requires login");
} }
authenticate_success($record); $_SESSION["allow_api"] = true; authenticate_success($record); $_SESSION["allow_api"] = true;
@ -331,7 +329,8 @@
* *
* @param Api $a * @param Api $a
* @param string $type Return type (xml, json, rss, as) * @param string $type Return type (xml, json, rss, as)
* @param string $error Error message * @param HTTPException $error Error object
* @return strin error message formatted as $type
*/ */
function api_error(&$a, $type, $e) { function api_error(&$a, $type, $e) {
$error = ($e->getMessage()!==""?$e->getMessage():$e->httpdesc); $error = ($e->getMessage()!==""?$e->getMessage():$e->httpdesc);
@ -903,7 +902,8 @@
if ($posts_day > $throttle_day) { if ($posts_day > $throttle_day) {
logger('Daily posting limit reached for user '.api_user(), LOGGER_DEBUG); logger('Daily posting limit reached for user '.api_user(), LOGGER_DEBUG);
die(api_error($a, $type, sprintf(t("Daily posting limit of %d posts reached. The post was rejected."), $throttle_day))); #die(api_error($a, $type, sprintf(t("Daily posting limit of %d posts reached. The post was rejected."), $throttle_day)));
throw new TooManyRequestsException(sprintf(t("Daily posting limit of %d posts reached. The post was rejected."), $throttle_day));
} }
} }
@ -922,7 +922,9 @@
if ($posts_week > $throttle_week) { if ($posts_week > $throttle_week) {
logger('Weekly posting limit reached for user '.api_user(), LOGGER_DEBUG); logger('Weekly posting limit reached for user '.api_user(), LOGGER_DEBUG);
die(api_error($a, $type, sprintf(t("Weekly posting limit of %d posts reached. The post was rejected."), $throttle_week))); #die(api_error($a, $type, sprintf(t("Weekly posting limit of %d posts reached. The post was rejected."), $throttle_week)));
throw new TooManyRequestsException(sprintf(t("Weekly posting limit of %d posts reached. The post was rejected."), $throttle_week));
} }
} }
@ -941,7 +943,8 @@
if ($posts_month > $throttle_month) { if ($posts_month > $throttle_month) {
logger('Monthly posting limit reached for user '.api_user(), LOGGER_DEBUG); logger('Monthly posting limit reached for user '.api_user(), LOGGER_DEBUG);
die(api_error($a, $type, sprintf(t("Monthly posting limit of %d posts reached. The post was rejected."), $throttle_month))); #die(api_error($a, $type, sprintf(t("Monthly posting limit of %d posts reached. The post was rejected."), $throttle_month)));
throw new TooManyRequestsException(sprintf(t("Monthly posting limit of %d posts reached. The post was rejected."), $throttle_month));
} }
} }
@ -1809,7 +1812,7 @@
$action_argv_id=2; $action_argv_id=2;
if ($a->argv[1]=="1.1") $action_argv_id=3; if ($a->argv[1]=="1.1") $action_argv_id=3;
if ($a->argc<=$action_argv_id) die(api_error($a, $type, t("Invalid request."))); if ($a->argc<=$action_argv_id) throw new BadRequestException("Invalid request.");
$action = str_replace(".".$type,"",$a->argv[$action_argv_id]); $action = str_replace(".".$type,"",$a->argv[$action_argv_id]);
if ($a->argc==$action_argv_id+2) { if ($a->argc==$action_argv_id+2) {
$itemid = intval($a->argv[$action_argv_id+1]); $itemid = intval($a->argv[$action_argv_id+1]);

View File

@ -438,44 +438,47 @@ function poco_last_updated($profile, $force = false) {
$noscrape = json_decode($noscraperet["body"], true); $noscrape = json_decode($noscraperet["body"], true);
$contact = array("url" => $profile, if (is_array($noscrape)) {
"network" => $server[0]["network"], $contact = array("url" => $profile,
"generation" => $gcontacts[0]["generation"]); "network" => $server[0]["network"],
"generation" => $gcontacts[0]["generation"]);
$contact["name"] = $noscrape["fn"]; $contact["name"] = $noscrape["fn"];
$contact["community"] = $noscrape["comm"]; $contact["community"] = $noscrape["comm"];
if (isset($noscrape["tags"])) { if (isset($noscrape["tags"])) {
$keywords = implode(" ", $noscrape["tags"]); $keywords = implode(" ", $noscrape["tags"]);
if ($keywords != "") if ($keywords != "")
$contact["keywords"] = $keywords; $contact["keywords"] = $keywords;
}
$location = formatted_location($noscrape);
if ($location)
$contact["location"] = $location;
$contact["notify"] = $noscrape["dfrn-notify"];
// Remove all fields that are not present in the gcontact table
unset($noscrape["fn"]);
unset($noscrape["key"]);
unset($noscrape["homepage"]);
unset($noscrape["comm"]);
unset($noscrape["tags"]);
unset($noscrape["locality"]);
unset($noscrape["region"]);
unset($noscrape["country-name"]);
unset($noscrape["contacts"]);
unset($noscrape["dfrn-request"]);
unset($noscrape["dfrn-confirm"]);
unset($noscrape["dfrn-notify"]);
unset($noscrape["dfrn-poll"]);
$contact = array_merge($contact, $noscrape);
update_gcontact($contact);
return $noscrape["updated"];
} }
$location = formatted_location($noscrape);
if ($location)
$contact["location"] = $location;
$contact["notify"] = $noscrape["dfrn-notify"];
// Remove all fields that are not present in the gcontact table
unset($noscrape["fn"]);
unset($noscrape["key"]);
unset($noscrape["homepage"]);
unset($noscrape["comm"]);
unset($noscrape["tags"]);
unset($noscrape["locality"]);
unset($noscrape["region"]);
unset($noscrape["country-name"]);
unset($noscrape["contacts"]);
unset($noscrape["dfrn-request"]);
unset($noscrape["dfrn-confirm"]);
unset($noscrape["dfrn-notify"]);
unset($noscrape["dfrn-poll"]);
$contact = array_merge($contact, $noscrape);
update_gcontact($contact);
return $noscrape["updated"];
} }
} }
} }

View File

@ -16,7 +16,7 @@ msgstr ""
"Project-Id-Version: friendica\n" "Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-24 06:49+0100\n" "POT-Creation-Date: 2016-01-24 06:49+0100\n"
"PO-Revision-Date: 2016-01-30 08:43+0000\n" "PO-Revision-Date: 2016-02-16 10:29+0000\n"
"Last-Translator: Sandro Santilli <strk@keybit.net>\n" "Last-Translator: Sandro Santilli <strk@keybit.net>\n"
"Language-Team: Italian (http://www.transifex.com/Friendica/friendica/language/it/)\n" "Language-Team: Italian (http://www.transifex.com/Friendica/friendica/language/it/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -41,8 +41,8 @@ msgstr "Forum"
#, php-format #, php-format
msgid "%d contact edited." msgid "%d contact edited."
msgid_plural "%d contacts edited." msgid_plural "%d contacts edited."
msgstr[0] "" msgstr[0] "%d contatto modificato."
msgstr[1] "" msgstr[1] "%d contatti modificati"
#: mod/contacts.php:159 mod/contacts.php:383 #: mod/contacts.php:159 mod/contacts.php:383
msgid "Could not access contact record." msgid "Could not access contact record."
@ -887,7 +887,7 @@ msgstr "Rimuovi"
#: mod/ostatus_subscribe.php:14 #: mod/ostatus_subscribe.php:14
msgid "Subscribing to OStatus contacts" msgid "Subscribing to OStatus contacts"
msgstr "" msgstr "Iscrizione a contatti OStatus"
#: mod/ostatus_subscribe.php:25 #: mod/ostatus_subscribe.php:25
msgid "No contact provided." msgid "No contact provided."
@ -1943,7 +1943,7 @@ msgstr "Ispeziona Coda di invio"
#: mod/admin.php:163 mod/admin.php:354 #: mod/admin.php:163 mod/admin.php:354
msgid "Federation Statistics" msgid "Federation Statistics"
msgstr "" msgstr "Statistiche sulla Federazione"
#: mod/admin.php:177 mod/admin.php:188 mod/admin.php:1792 #: mod/admin.php:177 mod/admin.php:188 mod/admin.php:1792
msgid "Logs" msgid "Logs"
@ -1951,7 +1951,7 @@ msgstr "Log"
#: mod/admin.php:178 mod/admin.php:1859 #: mod/admin.php:178 mod/admin.php:1859
msgid "View Logs" msgid "View Logs"
msgstr "" msgstr "Vedi i log"
#: mod/admin.php:179 #: mod/admin.php:179
msgid "probe address" msgid "probe address"
@ -1982,7 +1982,7 @@ msgid ""
"This page offers you some numbers to the known part of the federated social " "This page offers you some numbers to the known part of the federated social "
"network your Friendica node is part of. These numbers are not complete but " "network your Friendica node is part of. These numbers are not complete but "
"only reflect the part of the network your node is aware of." "only reflect the part of the network your node is aware of."
msgstr "" msgstr "Questa pagina offre alcuni numeri riguardo la porzione del social network federato di cui il tuo nodo Friendica fa parte. Questi numeri non sono completi ma riflettono esclusivamente la porzione di rete di cui il tuo nodo e' a conoscenza."
#: mod/admin.php:348 #: mod/admin.php:348
msgid "" msgid ""

View File

@ -8,8 +8,8 @@ function string_plural_select_it($n){
$a->strings["Network:"] = "Rete:"; $a->strings["Network:"] = "Rete:";
$a->strings["Forum"] = "Forum"; $a->strings["Forum"] = "Forum";
$a->strings["%d contact edited."] = array( $a->strings["%d contact edited."] = array(
0 => "", 0 => "%d contatto modificato.",
1 => "", 1 => "%d contatti modificati",
); );
$a->strings["Could not access contact record."] = "Non è possibile accedere al contatto."; $a->strings["Could not access contact record."] = "Non è possibile accedere al contatto.";
$a->strings["Could not locate selected profile."] = "Non riesco a trovare il profilo selezionato."; $a->strings["Could not locate selected profile."] = "Non riesco a trovare il profilo selezionato.";
@ -186,7 +186,7 @@ $a->strings["Tag removed"] = "Tag rimosso";
$a->strings["Remove Item Tag"] = "Rimuovi il tag"; $a->strings["Remove Item Tag"] = "Rimuovi il tag";
$a->strings["Select a tag to remove: "] = "Seleziona un tag da rimuovere: "; $a->strings["Select a tag to remove: "] = "Seleziona un tag da rimuovere: ";
$a->strings["Remove"] = "Rimuovi"; $a->strings["Remove"] = "Rimuovi";
$a->strings["Subscribing to OStatus contacts"] = ""; $a->strings["Subscribing to OStatus contacts"] = "Iscrizione a contatti OStatus";
$a->strings["No contact provided."] = "Nessun contatto disponibile."; $a->strings["No contact provided."] = "Nessun contatto disponibile.";
$a->strings["Couldn't fetch information for contact."] = "Non è stato possibile recuperare le informazioni del contatto."; $a->strings["Couldn't fetch information for contact."] = "Non è stato possibile recuperare le informazioni del contatto.";
$a->strings["Couldn't fetch friends for contact."] = "Non è stato possibile recuperare gli amici del contatto."; $a->strings["Couldn't fetch friends for contact."] = "Non è stato possibile recuperare gli amici del contatto.";
@ -419,16 +419,16 @@ $a->strings["Themes"] = "Temi";
$a->strings["Additional features"] = "Funzionalità aggiuntive"; $a->strings["Additional features"] = "Funzionalità aggiuntive";
$a->strings["DB updates"] = "Aggiornamenti Database"; $a->strings["DB updates"] = "Aggiornamenti Database";
$a->strings["Inspect Queue"] = "Ispeziona Coda di invio"; $a->strings["Inspect Queue"] = "Ispeziona Coda di invio";
$a->strings["Federation Statistics"] = ""; $a->strings["Federation Statistics"] = "Statistiche sulla Federazione";
$a->strings["Logs"] = "Log"; $a->strings["Logs"] = "Log";
$a->strings["View Logs"] = ""; $a->strings["View Logs"] = "Vedi i log";
$a->strings["probe address"] = "controlla indirizzo"; $a->strings["probe address"] = "controlla indirizzo";
$a->strings["check webfinger"] = "verifica webfinger"; $a->strings["check webfinger"] = "verifica webfinger";
$a->strings["Admin"] = "Amministrazione"; $a->strings["Admin"] = "Amministrazione";
$a->strings["Plugin Features"] = "Impostazioni Plugins"; $a->strings["Plugin Features"] = "Impostazioni Plugins";
$a->strings["diagnostics"] = "diagnostiche"; $a->strings["diagnostics"] = "diagnostiche";
$a->strings["User registrations waiting for confirmation"] = "Utenti registrati in attesa di conferma"; $a->strings["User registrations waiting for confirmation"] = "Utenti registrati in attesa di conferma";
$a->strings["This page offers you some numbers to the known part of the federated social network your Friendica node is part of. These numbers are not complete but only reflect the part of the network your node is aware of."] = ""; $a->strings["This page offers you some numbers to the known part of the federated social network your Friendica node is part of. These numbers are not complete but only reflect the part of the network your node is aware of."] = "Questa pagina offre alcuni numeri riguardo la porzione del social network federato di cui il tuo nodo Friendica fa parte. Questi numeri non sono completi ma riflettono esclusivamente la porzione di rete di cui il tuo nodo e' a conoscenza.";
$a->strings["The <em>Auto Discovered Contact Directory</em> feature is not enabled, it will improve the data displayed here."] = ""; $a->strings["The <em>Auto Discovered Contact Directory</em> feature is not enabled, it will improve the data displayed here."] = "";
$a->strings["Administration"] = "Amministrazione"; $a->strings["Administration"] = "Amministrazione";
$a->strings["Currently this node is aware of %d nodes from the following platforms:"] = ""; $a->strings["Currently this node is aware of %d nodes from the following platforms:"] = "";