1
0
Fork 0

Merge pull request #4312 from zeroadam/feature/L10n

Move pgettext to src
This commit is contained in:
Hypolite Petovan 2018-01-24 11:48:55 -05:00 committed by GitHub
commit 30c1cc0e8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
144 changed files with 3411 additions and 3186 deletions

View file

@ -1,5 +1,4 @@
<?php <?php
/** @file boot.php /** @file boot.php
* *
* This file defines some global constants and includes the central App class. * This file defines some global constants and includes the central App class.
@ -25,6 +24,7 @@ use Friendica\Core\Addon;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Cache; use Friendica\Core\Cache;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendida\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -35,7 +35,6 @@ use Friendica\Module\Login;
require_once 'include/network.php'; require_once 'include/network.php';
require_once 'include/text.php'; require_once 'include/text.php';
require_once 'include/datetime.php'; require_once 'include/datetime.php';
require_once 'include/pgettext.php';
define('FRIENDICA_PLATFORM', 'Friendica'); define('FRIENDICA_PLATFORM', 'Friendica');
define('FRIENDICA_CODENAME', 'Asparagus'); define('FRIENDICA_CODENAME', 'Asparagus');
@ -782,7 +781,7 @@ function run_update_function($x)
//send the administrator an e-mail //send the administrator an e-mail
DBStructure::updateFail( DBStructure::updateFail(
$x, $x,
sprintf(t('Update %s failed. See error logs.'), $x) L10n::t('Update %s failed. See error logs.', $x)
); );
return false; return false;
} else { } else {

View file

@ -39,7 +39,7 @@ They are initialized with an array of data, depending on the tyle of the field.
All of these take an array holding the values, e.g. for a one line text input field, which is required and should be used to type email addesses use something along the lines of: All of these take an array holding the values, e.g. for a one line text input field, which is required and should be used to type email addesses use something along the lines of:
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.'), 'required', '', 'email'), '$adminmail' => array('adminmail', L10n::t('Site administrator email address'), $adminmail, L10n::t('Your account email address must match this in order to use the web admin panel.'), 'required', '', 'email'),
To evaluate the input value, you can then use the $_POST array, more precisely the $_POST['adminemail'] variable. To evaluate the input value, you can then use the $_POST array, more precisely the $_POST['adminemail'] variable.

View file

@ -109,17 +109,17 @@ The _post functions handle the processing of the send form, in this case they sa
To make your own variation appear in the menu, all you need to do is to create a new CSS file in the deriv directoy and include it in the array in the config.php: To make your own variation appear in the menu, all you need to do is to create a new CSS file in the deriv directoy and include it in the array in the config.php:
$colorset = array( $colorset = array(
'default'=>t('default'), 'default'=>L10n::t('default'),
'greenzero'=>t('greenzero'), 'greenzero'=>L10n::t('greenzero'),
'purplezero'=>t('purplezero'), 'purplezero'=>L10n::t('purplezero'),
'easterbunny'=>t('easterbunny'), 'easterbunny'=>L10n::t('easterbunny'),
'darkzero'=>t('darkzero'), 'darkzero'=>L10n::t('darkzero'),
'comix'=>t('comix'), 'comix'=>L10n::t('comix'),
'slackr'=>t('slackr'), 'slackr'=>L10n::t('slackr'),
); );
the 1st part of the line is the name of the CSS file (without the .css) the 2nd part is the common name of the variant. the 1st part of the line is the name of the CSS file (without the .css) the 2nd part is the common name of the variant.
Calling the t() function with the common name makes the string translateable. Calling the L10n::t() function with the common name makes the string translateable.
The selected 1st part will be saved in the database by the theme_post function. The selected 1st part will be saved in the database by the theme_post function.
function theme_post(App $a){ function theme_post(App $a){

View file

@ -7,6 +7,7 @@ use Friendica\Content\Feature;
use Friendica\Content\Widget; use Friendica\Content\Widget;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\GContact; use Friendica\Model\GContact;
@ -351,31 +352,30 @@ function populate_acl($user = null, $show_jotnets = false) {
if (!$user['hidewall']) { if (!$user['hidewall']) {
if ($mail_enabled) { if ($mail_enabled) {
$selected = (($pubmail_enabled) ? ' checked="checked" ' : ''); $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
$jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> ' . t("Post to Email") . '</div>'; $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> ' . L10n::t("Post to Email") . '</div>';
} }
Addon::callHooks('jot_networks', $jotnets); Addon::callHooks('jot_networks', $jotnets);
} else { } else {
$jotnets .= sprintf(t('Connectors disabled, since "%s" is enabled.'), $jotnets .= L10n::t('Connectors disabled, since "%s" is enabled.', L10n::t('Hide your profile details from unknown viewers?'));
t('Hide your profile details from unknown viewers?'));
} }
} }
$tpl = get_markup_template("acl_selector.tpl"); $tpl = get_markup_template("acl_selector.tpl");
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$showall'=> t("Visible to everybody"), '$showall'=> L10n::t("Visible to everybody"),
'$show' => t("show"), '$show' => L10n::t("show"),
'$hide' => t("don't show"), '$hide' => L10n::t("don't show"),
'$allowcid' => json_encode($perms['allow_cid']), '$allowcid' => json_encode($perms['allow_cid']),
'$allowgid' => json_encode($perms['allow_gid']), '$allowgid' => json_encode($perms['allow_gid']),
'$denycid' => json_encode($perms['deny_cid']), '$denycid' => json_encode($perms['deny_cid']),
'$denygid' => json_encode($perms['deny_gid']), '$denygid' => json_encode($perms['deny_gid']),
'$networks' => $show_jotnets, '$networks' => $show_jotnets,
'$emailcc' => t('CC: email addresses'), '$emailcc' => L10n::t('CC: email addresses'),
'$emtitle' => t('Example: bob@example.com, mary@example.com'), '$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),
'$jotnets' => $jotnets, '$jotnets' => $jotnets,
'$aclModalTitle' => t('Permissions'), '$aclModalTitle' => L10n::t('Permissions'),
'$aclModalDismiss' => t('Close'), '$aclModalDismiss' => L10n::t('Close'),
'$features' => [ '$features' => [
'aclautomention' => (Feature::isEnabled($user['uid'], "aclautomention") ? "true" : "false") 'aclautomention' => (Feature::isEnabled($user['uid'], "aclautomention") ? "true" : "false")
], ],

View file

@ -12,6 +12,7 @@ use Friendica\Core\Addon;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\NotificationsManager; use Friendica\Core\NotificationsManager;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -1176,8 +1177,8 @@ function api_statuses_update($type)
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($type, sprintf(t("Daily posting limit of %d posts reached. The post was rejected."), $throttle_day))); // die(api_error($type, L10n::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)); throw new TooManyRequestsException(L10n::tt("Daily posting limit of %d post reached. The post was rejected.", "Daily posting limit of %d posts reached. The post was rejected.", $throttle_day));
} }
} }
@ -1200,8 +1201,8 @@ function api_statuses_update($type)
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($type, sprintf(t("Weekly posting limit of %d posts reached. The post was rejected."), $throttle_week))); // die(api_error($type, L10n::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)); throw new TooManyRequestsException(L10n::tt("Weekly posting limit of %d post reached. The post was rejected.", "Weekly posting limit of %d posts reached. The post was rejected.", $throttle_week));
} }
} }
@ -1224,8 +1225,8 @@ function api_statuses_update($type)
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($type, sprintf(t("Monthly posting limit of %d posts reached. The post was rejected."), $throttle_month))); // die(api_error($type, L10n::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)); throw new TooManyRequestsException(L10n::t("Monthly posting limit of %d post reached. The post was rejected.", "Monthly posting limit of %d posts reached. The post was rejected.", $throttle_month));
} }
} }
@ -4374,7 +4375,7 @@ function api_account_update_profile_image($type)
$media = $_FILES['media']; $media = $_FILES['media'];
} }
// save new profile image // save new profile image
$data = save_media_to_database("profileimage", $media, $type, t('Profile Photos'), "", "", "", "", "", $is_default_profile); $data = save_media_to_database("profileimage", $media, $type, L10n::t('Profile Photos'), "", "", "", "", "", $is_default_profile);
// get filetype // get filetype
if (is_array($media['type'])) { if (is_array($media['type'])) {

View file

@ -234,13 +234,13 @@ function format_event_diaspora($ev) {
return ''; return '';
} }
$bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM $bd_format = L10n::t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
$o = 'Friendica event notification:' . "\n"; $o = 'Friendica event notification:' . "\n";
$o .= '**' . (($ev['summary']) ? bb2diaspora($ev['summary']) : bb2diaspora($ev['desc'])) . '**' . "\n"; $o .= '**' . (($ev['summary']) ? bb2diaspora($ev['summary']) : bb2diaspora($ev['desc'])) . '**' . "\n";
$o .= t('Starts:') . ' ' . '[' $o .= L10n::t('Starts:') . ' ' . '['
. (($ev['adjust']) ? day_translate(datetime_convert('UTC', 'UTC', . (($ev['adjust']) ? day_translate(datetime_convert('UTC', 'UTC',
$ev['start'] , $bd_format )) $ev['start'] , $bd_format ))
: day_translate(datetime_convert('UTC', 'UTC', : day_translate(datetime_convert('UTC', 'UTC',
@ -248,7 +248,7 @@ function format_event_diaspora($ev) {
. '](' . System::baseUrl() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['start'])) . ")\n"; . '](' . System::baseUrl() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['start'])) . ")\n";
if (! $ev['nofinish']) { if (! $ev['nofinish']) {
$o .= t('Finishes:') . ' ' . '[' $o .= L10n::t('Finishes:') . ' ' . '['
. (($ev['adjust']) ? day_translate(datetime_convert('UTC', 'UTC', . (($ev['adjust']) ? day_translate(datetime_convert('UTC', 'UTC',
$ev['finish'] , $bd_format )) $ev['finish'] , $bd_format ))
: day_translate(datetime_convert('UTC', 'UTC', : day_translate(datetime_convert('UTC', 'UTC',
@ -257,7 +257,7 @@ function format_event_diaspora($ev) {
} }
if (strlen($ev['location'])) { if (strlen($ev['location'])) {
$o .= t('Location:') . bb2diaspora($ev['location']) $o .= L10n::t('Location:') . bb2diaspora($ev['location'])
. "\n"; . "\n";
} }

View file

@ -1,10 +1,13 @@
<?php <?php
/**
* @file include/bbcode.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Content\Smilies; use Friendica\Content\Smilies;
use Friendica\Content\OEmbed; use Friendica\Content\OEmbed;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Cache; use Friendica\Core\Cache;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -411,7 +414,7 @@ function bb_replace_images($body, $images) {
// We're depending on the property of 'foreach' (specified on the PHP website) that // We're depending on the property of 'foreach' (specified on the PHP website) that
// it loops over the array starting from the first element and going sequentially // it loops over the array starting from the first element and going sequentially
// to the last element // to the last element
$newbody = str_replace('[$#saved_image' . $cnt . '#$]', '<img src="' . proxy_url($image) .'" alt="' . t('Image/photo') . '" />', $newbody); $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '<img src="' . proxy_url($image) .'" alt="' . L10n::t('Image/photo') . '" />', $newbody);
$cnt++; $cnt++;
} }
@ -549,7 +552,7 @@ function bb_ShareAttributes($share, $simplehtml)
break; break;
case 4: case 4:
$headline .= '<br /><b>' . html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8'); $headline .= '<br /><b>' . html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8');
$headline .= t('<a href="%1$s" target="_blank">%2$s</a> %3$s', $link, $userid, $posted); $headline .= L10n::t('<a href="%1$s" target="_blank">%2$s</a> %3$s', $link, $userid, $posted);
$headline .= ":</b><br />"; $headline .= ":</b><br />";
$text = trim($share[1]); $text = trim($share[1]);
@ -1180,7 +1183,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
// Check for [spoiler=Author] text // Check for [spoiler=Author] text
$t_wrote = t('$1 wrote:'); $t_wrote = L10n::t('$1 wrote:');
// handle nested quotes // handle nested quotes
$endlessloop = 0; $endlessloop = 0;
@ -1202,7 +1205,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
// Check for [quote=Author] text // Check for [quote=Author] text
$t_wrote = t('$1 wrote:'); $t_wrote = L10n::t('$1 wrote:');
// handle nested quotes // handle nested quotes
$endlessloop = 0; $endlessloop = 0;
@ -1223,8 +1226,8 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
// [img]pathtoimage[/img] // [img]pathtoimage[/img]
$Text = preg_replace_callback("/\[img\](.*?)\[\/img\]/ism", 'bb_PictureCache', $Text); $Text = preg_replace_callback("/\[img\](.*?)\[\/img\]/ism", 'bb_PictureCache', $Text);
$Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img src="$1" alt="' . t('Image/photo') . '" />', $Text); $Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img src="$1" alt="' . L10n::t('Image/photo') . '" />', $Text);
$Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img src="$1" alt="' . t('Image/photo') . '" />', $Text); $Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img src="$1" alt="' . L10n::t('Image/photo') . '" />', $Text);
// Shared content // Shared content
$Text = preg_replace_callback("/(.*?)\[share(.*?)\](.*?)\[\/share\]/ism", $Text = preg_replace_callback("/(.*?)\[share(.*?)\](.*?)\[\/share\]/ism",
@ -1232,9 +1235,9 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
return bb_ShareAttributes($match, $simplehtml); return bb_ShareAttributes($match, $simplehtml);
}, $Text); }, $Text);
$Text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism", '<br/><img src="' .System::baseUrl() . '/images/lock_icon.gif" alt="' . t('Encrypted content') . '" title="' . t('Encrypted content') . '" /><br />', $Text); $Text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism", '<br/><img src="' .System::baseUrl() . '/images/lock_icon.gif" alt="' . L10n::t('Encrypted content') . '" title="' . L10n::t('Encrypted content') . '" /><br />', $Text);
$Text = preg_replace("/\[crypt(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .System::baseUrl() . '/images/lock_icon.gif" alt="' . t('Encrypted content') . '" title="' . '$1' . ' ' . t('Encrypted content') . '" /><br />', $Text); $Text = preg_replace("/\[crypt(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .System::baseUrl() . '/images/lock_icon.gif" alt="' . L10n::t('Encrypted content') . '" title="' . '$1' . ' ' . L10n::t('Encrypted content') . '" /><br />', $Text);
//$Text = preg_replace("/\[crypt=(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .System::baseUrl() . '/images/lock_icon.gif" alt="' . t('Encrypted content') . '" title="' . '$1' . ' ' . t('Encrypted content') . '" /><br />', $Text); //$Text = preg_replace("/\[crypt=(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .System::baseUrl() . '/images/lock_icon.gif" alt="' . L10n::t('Encrypted content') . '" title="' . '$1' . ' ' . L10n::t('Encrypted content') . '" /><br />', $Text);
// Try to Oembed // Try to Oembed
if ($tryoembed) { if ($tryoembed) {
@ -1352,7 +1355,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
// sanitizes src attributes (http and redir URLs for displaying in a web page, cid used for inline images in emails) // sanitizes src attributes (http and redir URLs for displaying in a web page, cid used for inline images in emails)
static $allowed_src_protocols = ['http', 'redir', 'cid']; static $allowed_src_protocols = ['http', 'redir', 'cid'];
$Text = preg_replace('#<([^>]*?)(src)="(?!' . implode('|', $allowed_src_protocols) . ')(.*?)"(.*?)>#ism', $Text = preg_replace('#<([^>]*?)(src)="(?!' . implode('|', $allowed_src_protocols) . ')(.*?)"(.*?)>#ism',
'<$1$2=""$4 data-original-src="$3" class="invalid-src" title="' . t('Invalid source protocol') . '">', $Text); '<$1$2=""$4 data-original-src="$3" class="invalid-src" title="' . L10n::t('Invalid source protocol') . '">', $Text);
// sanitize href attributes (only whitelisted protocols URLs) // sanitize href attributes (only whitelisted protocols URLs)
// default value for backward compatibility // default value for backward compatibility
@ -1363,7 +1366,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
$allowed_link_protocols[] = 'redir/'; $allowed_link_protocols[] = 'redir/';
$regex = '#<([^>]*?)(href)="(?!' . implode('|', $allowed_link_protocols) . ')(.*?)"(.*?)>#ism'; $regex = '#<([^>]*?)(href)="(?!' . implode('|', $allowed_link_protocols) . ')(.*?)"(.*?)>#ism';
$Text = preg_replace($regex, '<$1$2="javascript:void(0)"$4 data-original-href="$3" class="invalid-href" title="' . t('Invalid link protocol') . '">', $Text); $Text = preg_replace($regex, '<$1$2="javascript:void(0)"$4 data-original-href="$3" class="invalid-href" title="' . L10n::t('Invalid link protocol') . '">', $Text);
if ($saved_image) { if ($saved_image) {
$Text = bb_replace_images($Text, $saved_image); $Text = bb_replace_images($Text, $saved_image);

View file

@ -7,6 +7,7 @@ use Friendica\Content\ContactSelector;
use Friendica\Content\Feature; use Friendica\Content\Feature;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -137,39 +138,39 @@ function localize_item(&$item) {
case ACTIVITY_POST: case ACTIVITY_POST:
switch ($obj['object-type']) { switch ($obj['object-type']) {
case ACTIVITY_OBJ_EVENT: case ACTIVITY_OBJ_EVENT:
$post_type = t('event'); $post_type = L10n::t('event');
break; break;
default: default:
$post_type = t('status'); $post_type = L10n::t('status');
} }
break; break;
default: default:
if ($obj['resource-id']) { if ($obj['resource-id']) {
$post_type = t('photo'); $post_type = L10n::t('photo');
$m = []; $m = [];
preg_match("/\[url=([^]]*)\]/", $obj['body'], $m); preg_match("/\[url=([^]]*)\]/", $obj['body'], $m);
$rr['plink'] = $m[1]; $rr['plink'] = $m[1];
} else { } else {
$post_type = t('status'); $post_type = L10n::t('status');
} }
} }
$plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]'; $plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
if (activity_match($item['verb'], ACTIVITY_LIKE)) { if (activity_match($item['verb'], ACTIVITY_LIKE)) {
$bodyverb = t('%1$s likes %2$s\'s %3$s'); $bodyverb = L10n::t('%1$s likes %2$s\'s %3$s');
} }
elseif (activity_match($item['verb'], ACTIVITY_DISLIKE)) { elseif (activity_match($item['verb'], ACTIVITY_DISLIKE)) {
$bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s'); $bodyverb = L10n::t('%1$s doesn\'t like %2$s\'s %3$s');
} }
elseif (activity_match($item['verb'], ACTIVITY_ATTEND)) { elseif (activity_match($item['verb'], ACTIVITY_ATTEND)) {
$bodyverb = t('%1$s attends %2$s\'s %3$s'); $bodyverb = L10n::t('%1$s attends %2$s\'s %3$s');
} }
elseif (activity_match($item['verb'], ACTIVITY_ATTENDNO)) { elseif (activity_match($item['verb'], ACTIVITY_ATTENDNO)) {
$bodyverb = t('%1$s doesn\'t attend %2$s\'s %3$s'); $bodyverb = L10n::t('%1$s doesn\'t attend %2$s\'s %3$s');
} }
elseif (activity_match($item['verb'], ACTIVITY_ATTENDMAYBE)) { elseif (activity_match($item['verb'], ACTIVITY_ATTENDMAYBE)) {
$bodyverb = t('%1$s attends maybe %2$s\'s %3$s'); $bodyverb = L10n::t('%1$s attends maybe %2$s\'s %3$s');
} }
$item['body'] = sprintf($bodyverb, $author, $objauthor, $plink); $item['body'] = sprintf($bodyverb, $author, $objauthor, $plink);
@ -202,7 +203,7 @@ function localize_item(&$item) {
$Bphoto = '[url=' . Profile::zrl($Blink) . '][img]' . $Bphoto . '[/img][/url]'; $Bphoto = '[url=' . Profile::zrl($Blink) . '][img]' . $Bphoto . '[/img][/url]';
} }
$item['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$Bphoto; $item['body'] = L10n::t('%1$s is now friends with %2$s', $A, $B)."\n\n\n".$Bphoto;
} }
if (stristr($item['verb'], ACTIVITY_POKE)) { if (stristr($item['verb'], ACTIVITY_POKE)) {
@ -243,11 +244,11 @@ function localize_item(&$item) {
* we can't have a translation string with three positions but no distinguishable text * we can't have a translation string with three positions but no distinguishable text
* So here is the translate string. * So here is the translate string.
*/ */
$txt = t('%1$s poked %2$s'); $txt = L10n::t('%1$s poked %2$s');
// now translate the verb // now translate the verb
$poked_t = trim(sprintf($txt, "", "")); $poked_t = trim(sprintf($txt, "", ""));
$txt = str_replace( $poked_t, t($verb), $txt); $txt = str_replace( $poked_t, L10n::t($verb), $txt);
// then do the sprintf on the translation string // then do the sprintf on the translation string
@ -275,19 +276,19 @@ function localize_item(&$item) {
case ACTIVITY_POST: case ACTIVITY_POST:
switch ($obj['object-type']) { switch ($obj['object-type']) {
case ACTIVITY_OBJ_EVENT: case ACTIVITY_OBJ_EVENT:
$post_type = t('event'); $post_type = L10n::t('event');
break; break;
default: default:
$post_type = t('status'); $post_type = L10n::t('status');
} }
break; break;
default: default:
if ($obj['resource-id']) { if ($obj['resource-id']) {
$post_type = t('photo'); $post_type = L10n::t('photo');
$m=[]; preg_match("/\[url=([^]]*)\]/", $obj['body'], $m); $m=[]; preg_match("/\[url=([^]]*)\]/", $obj['body'], $m);
$rr['plink'] = $m[1]; $rr['plink'] = $m[1];
} else { } else {
$post_type = t('status'); $post_type = L10n::t('status');
} }
// Let's break everthing ... ;-) // Let's break everthing ... ;-)
break; break;
@ -297,7 +298,7 @@ function localize_item(&$item) {
$parsedobj = parse_xml_string($xmlhead.$item['object']); $parsedobj = parse_xml_string($xmlhead.$item['object']);
$tag = sprintf('#[url=%s]%s[/url]', $parsedobj->id, $parsedobj->content); $tag = sprintf('#[url=%s]%s[/url]', $parsedobj->id, $parsedobj->content);
$item['body'] = sprintf( t('%1$s tagged %2$s\'s %3$s with %4$s'), $author, $objauthor, $plink, $tag ); $item['body'] = L10n::t('%1$s tagged %2$s\'s %3$s with %4$s', $author, $objauthor, $plink, $tag );
} }
if (activity_match($item['verb'], ACTIVITY_FAVORITE)) { if (activity_match($item['verb'], ACTIVITY_FAVORITE)) {
@ -324,8 +325,8 @@ function localize_item(&$item) {
$Blink = $target['author-link']; $Blink = $target['author-link'];
$A = '[url=' . Profile::zrl($Alink) . ']' . $Aname . '[/url]'; $A = '[url=' . Profile::zrl($Alink) . ']' . $Aname . '[/url]';
$B = '[url=' . Profile::zrl($Blink) . ']' . $Bname . '[/url]'; $B = '[url=' . Profile::zrl($Blink) . ']' . $Bname . '[/url]';
$P = '[url=' . $target['plink'] . ']' . t('post/item') . '[/url]'; $P = '[url=' . $target['plink'] . ']' . L10n::t('post/item') . '[/url]';
$item['body'] = sprintf( t('%1$s marked %2$s\'s %3$s as favorite'), $A, $B, $P)."\n"; $item['body'] = L10n::t('%1$s marked %2$s\'s %3$s as favorite', $A, $B, $P)."\n";
} }
} }
} }
@ -601,8 +602,8 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$items = $cb['items']; $items = $cb['items'];
$conv_responses = [ $conv_responses = [
'like' => ['title' => t('Likes','title')], 'dislike' => ['title' => t('Dislikes','title')], 'like' => ['title' => L10n::t('Likes','title')], 'dislike' => ['title' => L10n::t('Dislikes','title')],
'attendyes' => ['title' => t('Attending','title')], 'attendno' => ['title' => t('Not attending','title')], 'attendmaybe' => ['title' => t('Might attend','title')] 'attendyes' => ['title' => L10n::t('Attending','title')], 'attendno' => ['title' => L10n::t('Not attending','title')], 'attendmaybe' => ['title' => L10n::t('Might attend','title')]
]; ];
// array with html for each thread (parent+comments) // array with html for each thread (parent+comments)
@ -746,8 +747,8 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$drop = [ $drop = [
'dropping' => $dropping, 'dropping' => $dropping,
'pagedrop' => $page_dropping, 'pagedrop' => $page_dropping,
'select' => t('Select'), 'select' => L10n::t('Select'),
'delete' => t('Delete'), 'delete' => L10n::t('Delete'),
]; ];
$star = false; $star = false;
@ -779,7 +780,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
'guid' => (($preview) ? 'Q0' : $item['guid']), 'guid' => (($preview) ? 'Q0' : $item['guid']),
'network' => $item['item_network'], 'network' => $item['item_network'],
'network_name' => ContactSelector::networkToName($item['item_network'], $profile_link), 'network_name' => ContactSelector::networkToName($item['item_network'], $profile_link),
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])), 'linktitle' => L10n::t('View %s\'s profile @ %s', $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
'profile_url' => $profile_link, 'profile_url' => $profile_link,
'item_photo_menu' => item_photo_menu($item), 'item_photo_menu' => item_photo_menu($item),
'name' => $profile_name_e, 'name' => $profile_name_e,
@ -791,15 +792,15 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
'tags' => $tags_e, 'tags' => $tags_e,
'hashtags' => $hashtags_e, 'hashtags' => $hashtags_e,
'mentions' => $mentions_e, 'mentions' => $mentions_e,
'txt_cats' => t('Categories:'), 'txt_cats' => L10n::t('Categories:'),
'txt_folders' => t('Filed under:'), 'txt_folders' => L10n::t('Filed under:'),
'has_cats' => ((count($categories)) ? 'true' : ''), 'has_cats' => ((count($categories)) ? 'true' : ''),
'has_folders' => ((count($folders)) ? 'true' : ''), 'has_folders' => ((count($folders)) ? 'true' : ''),
'categories' => $categories, 'categories' => $categories,
'folders' => $folders, 'folders' => $folders,
'text' => strip_tags($body_e), 'text' => strip_tags($body_e),
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])), 'ago' => (($item['app']) ? L10n::t('%s from %s', relative_date($item['created']),$item['app']) : relative_date($item['created'])),
'location' => $location_e, 'location' => $location_e,
'indent' => '', 'indent' => '',
'owner_name' => $owner_name_e, 'owner_name' => $owner_name_e,
@ -814,9 +815,9 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
'like' => '', 'like' => '',
'dislike' => '', 'dislike' => '',
'comment' => '', 'comment' => '',
'conv' => (($preview) ? '' : ['href'=> 'display/'.$item['guid'], 'title'=> t('View in context')]), 'conv' => (($preview) ? '' : ['href'=> 'display/'.$item['guid'], 'title'=> L10n::t('View in context')]),
'previewing' => $previewing, 'previewing' => $previewing,
'wait' => t('Please wait'), 'wait' => L10n::t('Please wait'),
'thread_level' => 1, 'thread_level' => 1,
]; ];
@ -887,11 +888,11 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
'$baseurl' => System::baseUrl($ssl_state), '$baseurl' => System::baseUrl($ssl_state),
'$return_path' => $a->query_string, '$return_path' => $a->query_string,
'$live_update' => $live_update_div, '$live_update' => $live_update_div,
'$remove' => t('remove'), '$remove' => L10n::t('remove'),
'$mode' => $mode, '$mode' => $mode,
'$user' => $a->user, '$user' => $a->user,
'$threads' => $threads, '$threads' => $threads,
'$dropping' => ($page_dropping && Feature::isEnabled(local_user(), 'multi_delete') ? t('Delete Selected Items') : False), '$dropping' => ($page_dropping && Feature::isEnabled(local_user(), 'multi_delete') ? L10n::t('Delete Selected Items') : False),
]); ]);
return $o; return $o;
@ -1053,25 +1054,25 @@ function item_photo_menu($item) {
if (local_user()) { if (local_user()) {
$menu = [ $menu = [
t('Follow Thread') => $sub_link, L10n::t('Follow Thread') => $sub_link,
t('View Status') => $status_link, L10n::t('View Status') => $status_link,
t('View Profile') => $profile_link, L10n::t('View Profile') => $profile_link,
t('View Photos') => $photos_link, L10n::t('View Photos') => $photos_link,
t('Network Posts') => $posts_link, L10n::t('Network Posts') => $posts_link,
t('View Contact') => $contact_url, L10n::t('View Contact') => $contact_url,
t('Send PM') => $pm_url L10n::t('Send PM') => $pm_url
]; ];
if ($network == NETWORK_DFRN) { if ($network == NETWORK_DFRN) {
$menu[t("Poke")] = $poke_link; $menu[L10n::t("Poke")] = $poke_link;
} }
if ((($cid == 0) || ($rel == CONTACT_IS_FOLLOWER)) && if ((($cid == 0) || ($rel == CONTACT_IS_FOLLOWER)) &&
in_array($item['network'], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA])) { in_array($item['network'], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA])) {
$menu[t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']); $menu[L10n::t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']);
} }
} else { } else {
$menu = [t('View Profile') => $item['author-link']]; $menu = [L10n::t('View Profile') => $item['author-link']];
} }
$args = ['item' => $item, 'menu' => $menu]; $args = ['item' => $item, 'menu' => $menu];
@ -1187,19 +1188,19 @@ function format_like($cnt, array $arr, $type, $id) {
// list which show all likers // list which show all likers
switch ($type) { switch ($type) {
case 'like' : case 'like' :
$phrase = sprintf( t('%s likes this.'), $likers); $phrase = L10n::t('%s likes this.', $likers);
break; break;
case 'dislike' : case 'dislike' :
$phrase = sprintf( t('%s doesn\'t like this.'), $likers); $phrase = L10n::t('%s doesn\'t like this.', $likers);
break; break;
case 'attendyes' : case 'attendyes' :
$phrase = sprintf( t('%s attends.'), $likers); $phrase = L10n::t('%s attends.', $likers);
break; break;
case 'attendno' : case 'attendno' :
$phrase = sprintf( t('%s doesn\'t attend.'), $likers); $phrase = L10n::t('%s doesn\'t attend.', $likers);
break; break;
case 'attendmaybe' : case 'attendmaybe' :
$phrase = sprintf( t('%s attends maybe.'), $likers); $phrase = L10n::t('%s attends maybe.', $likers);
break; break;
} }
} }
@ -1210,13 +1211,13 @@ function format_like($cnt, array $arr, $type, $id) {
$arr = array_slice($arr, 0, MAX_LIKERS - 1); $arr = array_slice($arr, 0, MAX_LIKERS - 1);
} }
if ($total < MAX_LIKERS) { if ($total < MAX_LIKERS) {
$last = t('and') . ' ' . $arr[count($arr)-1]; $last = L10n::t('and') . ' ' . $arr[count($arr)-1];
$arr2 = array_slice($arr, 0, -1); $arr2 = array_slice($arr, 0, -1);
$str = implode(', ', $arr2) . ' ' . $last; $str = implode(', ', $arr2) . ' ' . $last;
} }
if ($total >= MAX_LIKERS) { if ($total >= MAX_LIKERS) {
$str = implode(', ', $arr); $str = implode(', ', $arr);
$str .= sprintf( t(', and %d other people'), $total - MAX_LIKERS ); $str .= L10n::t(', and %d other people', $total - MAX_LIKERS );
} }
$likers = $str; $likers = $str;
@ -1225,24 +1226,24 @@ function format_like($cnt, array $arr, $type, $id) {
switch ($type) { switch ($type) {
case 'like': case 'like':
$phrase = sprintf( t('<span %1$s>%2$d people</span> like this'), $spanatts, $cnt); $phrase = L10n::t('<span %1$s>%2$d people</span> like this', $spanatts, $cnt);
$explikers = sprintf( t('%s like this.'), $likers); $explikers = L10n::t('%s like this.', $likers);
break; break;
case 'dislike': case 'dislike':
$phrase = sprintf( t('<span %1$s>%2$d people</span> don\'t like this'), $spanatts, $cnt); $phrase = L10n::t('<span %1$s>%2$d people</span> don\'t like this', $spanatts, $cnt);
$explikers = sprintf( t('%s don\'t like this.'), $likers); $explikers = L10n::t('%s don\'t like this.', $likers);
break; break;
case 'attendyes': case 'attendyes':
$phrase = sprintf( t('<span %1$s>%2$d people</span> attend'), $spanatts, $cnt); $phrase = L10n::t('<span %1$s>%2$d people</span> attend', $spanatts, $cnt);
$explikers = sprintf( t('%s attend.'), $likers); $explikers = L10n::t('%s attend.', $likers);
break; break;
case 'attendno': case 'attendno':
$phrase = sprintf( t('<span %1$s>%2$d people</span> don\'t attend'), $spanatts, $cnt); $phrase = L10n::t('<span %1$s>%2$d people</span> don\'t attend', $spanatts, $cnt);
$explikers = sprintf( t('%s don\'t attend.'), $likers); $explikers = L10n::t('%s don\'t attend.', $likers);
break; break;
case 'attendmaybe': case 'attendmaybe':
$phrase = sprintf( t('<span %1$s>%2$d people</span> attend maybe'), $spanatts, $cnt); $phrase = L10n::t('<span %1$s>%2$d people</span> attend maybe', $spanatts, $cnt);
$explikers = sprintf( t('%s anttend maybe.'), $likers); $explikers = L10n::t('%s anttend maybe.', $likers);
break; break;
} }
@ -1272,14 +1273,14 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$geotag' => $geotag, '$geotag' => $geotag,
'$nickname' => $x['nickname'], '$nickname' => $x['nickname'],
'$ispublic' => t('Visible to <strong>everybody</strong>'), '$ispublic' => L10n::t('Visible to <strong>everybody</strong>'),
'$linkurl' => t('Please enter a link URL:'), '$linkurl' => L10n::t('Please enter a link URL:'),
'$vidurl' => t("Please enter a video link/URL:"), '$vidurl' => L10n::t("Please enter a video link/URL:"),
'$audurl' => t("Please enter an audio link/URL:"), '$audurl' => L10n::t("Please enter an audio link/URL:"),
'$term' => t('Tag term:'), '$term' => L10n::t('Tag term:'),
'$fileas' => t('Save to Folder:'), '$fileas' => L10n::t('Save to Folder:'),
'$whereareu' => t('Where are you right now?'), '$whereareu' => L10n::t('Where are you right now?'),
'$delitems' => t('Delete item(s)?') '$delitems' => L10n::t('Delete item(s)?')
]); ]);
$tpl = get_markup_template('jot-end.tpl'); $tpl = get_markup_template('jot-end.tpl');
@ -1288,13 +1289,13 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$geotag' => $geotag, '$geotag' => $geotag,
'$nickname' => $x['nickname'], '$nickname' => $x['nickname'],
'$ispublic' => t('Visible to <strong>everybody</strong>'), '$ispublic' => L10n::t('Visible to <strong>everybody</strong>'),
'$linkurl' => t('Please enter a link URL:'), '$linkurl' => L10n::t('Please enter a link URL:'),
'$vidurl' => t("Please enter a video link/URL:"), '$vidurl' => L10n::t("Please enter a video link/URL:"),
'$audurl' => t("Please enter an audio link/URL:"), '$audurl' => L10n::t("Please enter an audio link/URL:"),
'$term' => t('Tag term:'), '$term' => L10n::t('Tag term:'),
'$fileas' => t('Save to Folder:'), '$fileas' => L10n::t('Save to Folder:'),
'$whereareu' => t('Where are you right now?') '$whereareu' => L10n::t('Where are you right now?')
]); ]);
$jotplugins = ''; $jotplugins = '';
@ -1328,28 +1329,28 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
$o .= replace_macros($tpl,[ $o .= replace_macros($tpl,[
'$return_path' => $query_str, '$return_path' => $query_str,
'$action' => 'item', '$action' => 'item',
'$share' => defaults($x, 'button', t('Share')), '$share' => defaults($x, 'button', L10n::t('Share')),
'$upload' => t('Upload photo'), '$upload' => L10n::t('Upload photo'),
'$shortupload' => t('upload photo'), '$shortupload' => L10n::t('upload photo'),
'$attach' => t('Attach file'), '$attach' => L10n::t('Attach file'),
'$shortattach' => t('attach file'), '$shortattach' => L10n::t('attach file'),
'$weblink' => t('Insert web link'), '$weblink' => L10n::t('Insert web link'),
'$shortweblink' => t('web link'), '$shortweblink' => L10n::t('web link'),
'$video' => t('Insert video link'), '$video' => L10n::t('Insert video link'),
'$shortvideo' => t('video link'), '$shortvideo' => L10n::t('video link'),
'$audio' => t('Insert audio link'), '$audio' => L10n::t('Insert audio link'),
'$shortaudio' => t('audio link'), '$shortaudio' => L10n::t('audio link'),
'$setloc' => t('Set your location'), '$setloc' => L10n::t('Set your location'),
'$shortsetloc' => t('set location'), '$shortsetloc' => L10n::t('set location'),
'$noloc' => t('Clear browser location'), '$noloc' => L10n::t('Clear browser location'),
'$shortnoloc' => t('clear location'), '$shortnoloc' => L10n::t('clear location'),
'$title' => defaults($x, 'title', ''), '$title' => defaults($x, 'title', ''),
'$placeholdertitle' => t('Set title'), '$placeholdertitle' => L10n::t('Set title'),
'$category' => defaults($x, 'category', ''), '$category' => defaults($x, 'category', ''),
'$placeholdercategory' => Feature::isEnabled(local_user(), 'categories') ? t('Categories (comma-separated list)') : '', '$placeholdercategory' => Feature::isEnabled(local_user(), 'categories') ? L10n::t('Categories (comma-separated list)') : '',
'$wait' => t('Please wait'), '$wait' => L10n::t('Please wait'),
'$permset' => t('Permission settings'), '$permset' => L10n::t('Permission settings'),
'$shortpermset' => t('permissions'), '$shortpermset' => L10n::t('permissions'),
'$ptyp' => $notes_cid ? 'note' : 'wall', '$ptyp' => $notes_cid ? 'note' : 'wall',
'$content' => defaults($x, 'content', ''), '$content' => defaults($x, 'content', ''),
'$post_id' => defaults($x, 'post_id', ''), '$post_id' => defaults($x, 'post_id', ''),
@ -1357,28 +1358,28 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
'$defloc' => $x['default_location'], '$defloc' => $x['default_location'],
'$visitor' => $x['visitor'], '$visitor' => $x['visitor'],
'$pvisit' => $notes_cid ? 'none' : $x['visitor'], '$pvisit' => $notes_cid ? 'none' : $x['visitor'],
'$public' => t('Public post'), '$public' => L10n::t('Public post'),
'$lockstate' => $x['lockstate'], '$lockstate' => $x['lockstate'],
'$bang' => $x['bang'], '$bang' => $x['bang'],
'$profile_uid' => $x['profile_uid'], '$profile_uid' => $x['profile_uid'],
'$preview' => Feature::isEnabled($x['profile_uid'], 'preview') ? t('Preview') : '', '$preview' => Feature::isEnabled($x['profile_uid'], 'preview') ? L10n::t('Preview') : '',
'$jotplugins' => $jotplugins, '$jotplugins' => $jotplugins,
'$notes_cid' => $notes_cid, '$notes_cid' => $notes_cid,
'$sourceapp' => t($a->sourcename), '$sourceapp' => L10n::t($a->sourcename),
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
'$rand_num' => random_digits(12), '$rand_num' => random_digits(12),
// ACL permissions box // ACL permissions box
'$acl' => $x['acl'], '$acl' => $x['acl'],
'$group_perms' => t('Post to Groups'), '$group_perms' => L10n::t('Post to Groups'),
'$contact_perms' => t('Post to Contacts'), '$contact_perms' => L10n::t('Post to Contacts'),
'$private' => t('Private post'), '$private' => L10n::t('Private post'),
'$is_private' => $private_post, '$is_private' => $private_post,
'$public_link' => $public_post_link, '$public_link' => $public_post_link,
//jot nav tab (used in some themes) //jot nav tab (used in some themes)
'$message' => t('Message'), '$message' => L10n::t('Message'),
'$browser' => t('Browser'), '$browser' => L10n::t('Browser'),
]); ]);
@ -1645,7 +1646,7 @@ function get_responses($conv_responses, $response_verbs, $ob, $item) {
if (count($ret[$v]['list']) > MAX_LIKERS) { if (count($ret[$v]['list']) > MAX_LIKERS) {
$ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS); $ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS);
array_push($ret[$v]['list_part'], '<a href="#" data-toggle="modal" data-target="#' . $v . 'Modal-' array_push($ret[$v]['list_part'], '<a href="#" data-toggle="modal" data-target="#' . $v . 'Modal-'
. (($ob) ? $ob->getId() : $item['id']) . '"><b>' . t('View all') . '</b></a>'); . (($ob) ? $ob->getId() : $item['id']) . '"><b>' . L10n::t('View all') . '</b></a>');
} else { } else {
$ret[$v]['list_part'] = ''; $ret[$v]['list_part'] = '';
} }
@ -1668,19 +1669,19 @@ function get_response_button_text($v, $count)
{ {
switch ($v) { switch ($v) {
case 'like': case 'like':
$return = tt('Like', 'Likes', $count); $return = L10n::tt('Like', 'Likes', $count);
break; break;
case 'dislike': case 'dislike':
$return = tt('Dislike', 'Dislikes', $count); $return = L10n::tt('Dislike', 'Dislikes', $count);
break; break;
case 'attendyes': case 'attendyes':
$return = tt('Attending', 'Attending', $count); $return = L10n::tt('Attending', 'Attending', $count);
break; break;
case 'attendno': case 'attendno':
$return = tt('Not Attending', 'Not Attending', $count); $return = L10n::tt('Not Attending', 'Not Attending', $count);
break; break;
case 'attendmaybe': case 'attendmaybe':
$return = tt('Undecided', 'Undecided', $count); $return = L10n::tt('Undecided', 'Undecided', $count);
break; break;
} }

View file

@ -5,6 +5,7 @@
*/ */
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -17,21 +18,21 @@ use Friendica\Database\DBM;
*/ */
function timezone_cmp($a, $b) { function timezone_cmp($a, $b) {
if (strstr($a, '/') && strstr($b, '/')) { if (strstr($a, '/') && strstr($b, '/')) {
if ( t($a) == t($b)) { if (L10n::t($a) == L10n::t($b)) {
return 0; return 0;
} }
return ( t($a) < t($b)) ? -1 : 1; return (L10n::t($a) < L10n::t($b)) ? -1 : 1;
} }
if (strstr($a, '/')) { if (strstr($a, '/')) {
return -1; return -1;
} elseif (strstr($b, '/')) { } elseif (strstr($b, '/')) {
return 1; return 1;
} elseif ( t($a) == t($b)) { } elseif (L10n::t($a) == L10n::t($b)) {
return 0; return 0;
} }
return ( t($a) < t($b)) ? -1 : 1; return (L10n::t($a) < L10n::t($b)) ? -1 : 1;
} }
/** /**
@ -56,7 +57,7 @@ function select_timezone($current = 'America/Los_Angeles') {
$o .= '</optgroup>'; $o .= '</optgroup>';
} }
$continent = $ex[0]; $continent = $ex[0];
$o .= '<optgroup label="' . t($continent) . '">'; $o .= '<optgroup label="' . L10n::t($continent) . '">';
} }
if (count($ex) > 2) { if (count($ex) > 2) {
$city = substr($value,strpos($value,'/')+1); $city = substr($value,strpos($value,'/')+1);
@ -65,13 +66,13 @@ function select_timezone($current = 'America/Los_Angeles') {
} }
} else { } else {
$city = $ex[0]; $city = $ex[0];
if ($continent != t('Miscellaneous')) { if ($continent != L10n::t('Miscellaneous')) {
$o .= '</optgroup>'; $o .= '</optgroup>';
$continent = t('Miscellaneous'); $continent = L10n::t('Miscellaneous');
$o .= '<optgroup label="' . t($continent) . '">'; $o .= '<optgroup label="' . L10n::t($continent) . '">';
} }
} }
$city = str_replace('_', ' ', t($city)); $city = str_replace('_', ' ', L10n::t($city));
$selected = (($value == $current) ? " selected=\"selected\" " : ""); $selected = (($value == $current) ? " selected=\"selected\" " : "");
$o .= "<option value=\"$value\" $selected >$city</option>"; $o .= "<option value=\"$value\" $selected >$city</option>";
} }
@ -192,11 +193,11 @@ function dob($dob)
$o = replace_macros(get_markup_template("field_input.tpl"), [ $o = replace_macros(get_markup_template("field_input.tpl"), [
'$field' => [ '$field' => [
'dob', 'dob',
t('Birthday:'), L10n::t('Birthday:'),
$value, $value,
(((intval($age)) > 0 ) ? t('Age: ') . $age : ""), (((intval($age)) > 0 ) ? L10n::t('Age: ') . $age : ""),
'', '',
'placeholder="' . t('YYYY-MM-DD or MM-DD') . '"' 'placeholder="' . L10n::t('YYYY-MM-DD or MM-DD') . '"'
] ]
]); ]);
@ -270,7 +271,7 @@ function datetimesel($min, $max, $default, $label, $id = 'datetimepicker', $pick
// First day of the week (0 = Sunday) // First day of the week (0 = Sunday)
$firstDay = PConfig::get(local_user(), 'system', 'first_day_of_week', 0); $firstDay = PConfig::get(local_user(), 'system', 'first_day_of_week', 0);
$lang = substr(get_browser_language(), 0, 2); $lang = substr(L10n::getBrowserLanguage(), 0, 2);
// Check if the detected language is supported by the picker // Check if the detected language is supported by the picker
if (!in_array($lang, ["ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr", "it", "da", "no", "ja", "vi", "sl", "cs", "hu"])) { if (!in_array($lang, ["ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr", "it", "da", "no", "ja", "vi", "sl", "cs", "hu"])) {
@ -352,23 +353,23 @@ function relative_date($posted_date, $format = null) {
$abs = strtotime($localtime); $abs = strtotime($localtime);
if (is_null($posted_date) || $posted_date <= NULL_DATE || $abs === False) { if (is_null($posted_date) || $posted_date <= NULL_DATE || $abs === false) {
return t('never'); return L10n::t('never');
} }
$etime = time() - $abs; $etime = time() - $abs;
if ($etime < 1) { if ($etime < 1) {
return t('less than a second ago'); return L10n::t('less than a second ago');
} }
$a = [ 12 * 30 * 24 * 60 * 60 => [ t('year'), t('years')], $a = [ 12 * 30 * 24 * 60 * 60 => [L10n::t('year'), L10n::t('years')],
30 * 24 * 60 * 60 => [ t('month'), t('months')], 30 * 24 * 60 * 60 => [L10n::t('month'), L10n::t('months')],
7 * 24 * 60 * 60 => [ t('week'), t('weeks')], 7 * 24 * 60 * 60 => [L10n::t('week'), L10n::t('weeks')],
24 * 60 * 60 => [ t('day'), t('days')], 24 * 60 * 60 => [L10n::t('day'), L10n::t('days')],
60 * 60 => [ t('hour'), t('hours')], 60 * 60 => [L10n::t('hour'), L10n::t('hours')],
60 => [ t('minute'), t('minutes')], 60 => [L10n::t('minute'), L10n::t('minutes')],
1 => [ t('second'), t('seconds')] 1 => [L10n::t('second'), L10n::t('seconds')]
]; ];
foreach ($a as $secs => $str) { foreach ($a as $secs => $str) {
@ -377,7 +378,7 @@ function relative_date($posted_date, $format = null) {
$r = round($d); $r = round($d);
// translators - e.g. 22 hours ago, 1 minute ago // translators - e.g. 22 hours ago, 1 minute ago
if (!$format) { if (!$format) {
$format = t('%1$d %2$s ago'); $format = L10n::t('%1$d %2$s ago');
} }
return sprintf($format, $r, (($r == 1) ? $str[0] : $str[1])); return sprintf($format, $r, (($r == 1) ? $str[0] : $str[1]));
@ -604,8 +605,8 @@ function update_contact_birthdays() {
continue; continue;
} }
$bdtext = sprintf( t('%s\'s birthday'), $rr['name']); $bdtext = L10n::t('%s\'s birthday', $rr['name']);
$bdtext2 = sprintf( t('Happy Birthday %s'), ' [url=' . $rr['url'] . ']' . $rr['name'] . '[/url]') ; $bdtext2 = L10n::t('Happy Birthday %s', ' [url=' . $rr['url'] . ']' . $rr['name'] . '[/url]');
q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`summary`,`desc`,`type`,`adjust`) q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`summary`,`desc`,`type`,`adjust`)
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d' ) ", VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d' ) ",

View file

@ -55,7 +55,7 @@ class dba {
if ($install) { if ($install) {
if (strlen($server) && ($server !== 'localhost') && ($server !== '127.0.0.1')) { if (strlen($server) && ($server !== 'localhost') && ($server !== '127.0.0.1')) {
if (! dns_get_record($server, DNS_A + DNS_CNAME + DNS_PTR)) { if (! dns_get_record($server, DNS_A + DNS_CNAME + DNS_PTR)) {
self::$error = sprintf(t('Cannot locate DNS info for database server \'%s\''), $server); self::$error = L10n::t('Cannot locate DNS info for database server \'%s\'', $server);
self::$connected = false; self::$connected = false;
self::$db = null; self::$db = null;
return false; return false;

View file

@ -5,6 +5,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Util\Emailer; use Friendica\Util\Emailer;
@ -26,17 +27,17 @@ function notification($params)
$a = get_app(); $a = get_app();
// from here on everything is in the recipients language // from here on everything is in the recipients language
push_lang($params['language']); L10n::pushLang($params['language']);
$banner = t('Friendica Notification'); $banner = L10n::t('Friendica Notification');
$product = FRIENDICA_PLATFORM; $product = FRIENDICA_PLATFORM;
$siteurl = System::baseUrl(true); $siteurl = System::baseUrl(true);
$thanks = t('Thank You,'); $thanks = L10n::t('Thank You,');
$sitename = $a->config['sitename']; $sitename = $a->config['sitename'];
if (!x($a->config['admin_name'])) { if (!x($a->config['admin_name'])) {
$site_admin = sprintf(t('%s Administrator'), $sitename); $site_admin = L10n::t('%s Administrator', $sitename);
} else { } else {
$site_admin = sprintf(t('%1$s, %2$s Administrator'), $a->config['admin_name'], $sitename); $site_admin = L10n::t('%1$s, %2$s Administrator', $a->config['admin_name'], $sitename);
} }
$sender_name = $sitename; $sender_name = $sitename;
@ -47,7 +48,7 @@ function notification($params)
$sender_email = $a->config['sender_email']; $sender_email = $a->config['sender_email'];
if (empty($sender_email)) { if (empty($sender_email)) {
$sender_email = t('noreply').'@'.$hostname; $sender_email = L10n::t('noreply').'@'.$hostname;
} }
if ($params['type'] != SYSTEM_EMAIL) { if ($params['type'] != SYSTEM_EMAIL) {
@ -95,12 +96,12 @@ function notification($params)
} }
if ($params['type'] == NOTIFY_MAIL) { if ($params['type'] == NOTIFY_MAIL) {
$subject = sprintf(t('[Friendica:Notify] New mail received at %s'), $sitename); $subject = L10n::t('[Friendica:Notify] New mail received at %s', $sitename);
$preamble = sprintf(t('%1$s sent you a new private message at %2$s.'), $params['source_name'], $sitename); $preamble = L10n::t('%1$s sent you a new private message at %2$s.', $params['source_name'], $sitename);
$epreamble = sprintf(t('%1$s sent you %2$s.'), '[url='.$params['source_link'].']'.$params['source_name'].'[/url]', '[url=$itemlink]'.t('a private message').'[/url]'); $epreamble = L10n::t('%1$s sent you %2$s.', '[url='.$params['source_link'].']'.$params['source_name'].'[/url]', '[url=$itemlink]'.L10n::t('a private message').'[/url]');
$sitelink = t('Please visit %s to view and/or reply to your private messages.'); $sitelink = L10n::t('Please visit %s to view and/or reply to your private messages.');
$tsitelink = sprintf($sitelink, $siteurl.'/message/'.$params['item']['id']); $tsitelink = sprintf($sitelink, $siteurl.'/message/'.$params['item']['id']);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'/message/'.$params['item']['id'].'">'.$sitename.'</a>'); $hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'/message/'.$params['item']['id'].'">'.$sitename.'</a>');
$itemlink = $siteurl.'/message/'.$params['item']['id']; $itemlink = $siteurl.'/message/'.$params['item']['id'];
@ -123,7 +124,7 @@ function notification($params)
intval($params['uid']) intval($params['uid'])
); );
if ($p && count($p)) { if ($p && count($p)) {
pop_lang(); L10n::popLang();
return; return;
} }
@ -138,26 +139,29 @@ function notification($params)
$item_post_type = item_post_type($item); $item_post_type = item_post_type($item);
// "a post" // "a post"
$dest_str = sprintf(t('%1$s commented on [url=%2$s]a %3$s[/url]'), $dest_str = L10n::t('%1$s commented on [url=%2$s]a %3$s[/url]',
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]', '[url='.$params['source_link'].']'.$params['source_name'].'[/url]',
$itemlink, $itemlink,
$item_post_type); $item_post_type
);
// "George Bull's post" // "George Bull's post"
if ($item) { if ($item) {
$dest_str = sprintf(t('%1$s commented on [url=%2$s]%3$s\'s %4$s[/url]'), $dest_str = L10n::t('%1$s commented on [url=%2$s]%3$s\'s %4$s[/url]',
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]', '[url='.$params['source_link'].']'.$params['source_name'].'[/url]',
$itemlink, $itemlink,
$item['author-name'], $item['author-name'],
$item_post_type); $item_post_type
);
} }
// "your post" // "your post"
if (DBM::is_result($item) && $item['owner-name'] == $item['author-name'] && $item['wall']) { if (DBM::is_result($item) && $item['owner-name'] == $item['author-name'] && $item['wall']) {
$dest_str = sprintf(t('%1$s commented on [url=%2$s]your %3$s[/url]'), $dest_str = L10n::t('%1$s commented on [url=%2$s]your %3$s[/url]',
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]', '[url='.$params['source_link'].']'.$params['source_name'].'[/url]',
$itemlink, $itemlink,
$item_post_type); $item_post_type
);
} }
// Some mail softwares relies on subject field for threading. // Some mail softwares relies on subject field for threading.
@ -165,102 +169,108 @@ function notification($params)
// Before this we have the name of the replier on the subject rendering // Before this we have the name of the replier on the subject rendering
// differents subjects for messages on the same thread. // differents subjects for messages on the same thread.
$subject = sprintf(t('[Friendica:Notify] Comment to conversation #%1$d by %2$s'), $parent_id, $params['source_name']); $subject = L10n::t('[Friendica:Notify] Comment to conversation #%1$d by %2$s', $parent_id, $params['source_name']);
$preamble = sprintf(t('%s commented on an item/conversation you have been following.'), $params['source_name']); $preamble = L10n::t('%s commented on an item/conversation you have been following.', $params['source_name']);
$epreamble = $dest_str; $epreamble = $dest_str;
$sitelink = t('Please visit %s to view and/or reply to the conversation.'); $sitelink = L10n::t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf($sitelink, $siteurl); $tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>'); $hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link']; $itemlink = $params['link'];
} }
if ($params['type'] == NOTIFY_WALL) { if ($params['type'] == NOTIFY_WALL) {
$subject = sprintf(t('[Friendica:Notify] %s posted to your profile wall'), $params['source_name']); $subject = L10n::t('[Friendica:Notify] %s posted to your profile wall', $params['source_name']);
$preamble = sprintf(t('%1$s posted to your profile wall at %2$s'), $params['source_name'], $sitename); $preamble = L10n::t('%1$s posted to your profile wall at %2$s', $params['source_name'], $sitename);
$epreamble = sprintf(t('%1$s posted to [url=%2$s]your wall[/url]'), $epreamble = L10n::t('%1$s posted to [url=%2$s]your wall[/url]',
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]', '[url='.$params['source_link'].']'.$params['source_name'].'[/url]',
$params['link']); $params['link']
);
$sitelink = t('Please visit %s to view and/or reply to the conversation.'); $sitelink = L10n::t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf($sitelink, $siteurl); $tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>'); $hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link']; $itemlink = $params['link'];
} }
if ($params['type'] == NOTIFY_TAGSELF) { if ($params['type'] == NOTIFY_TAGSELF) {
$subject = sprintf(t('[Friendica:Notify] %s tagged you'), $params['source_name']); $subject = L10n::t('[Friendica:Notify] %s tagged you', $params['source_name']);
$preamble = sprintf(t('%1$s tagged you at %2$s'), $params['source_name'], $sitename); $preamble = L10n::t('%1$s tagged you at %2$s', $params['source_name'], $sitename);
$epreamble = sprintf(t('%1$s [url=%2$s]tagged you[/url].'), $epreamble = L10n::t('%1$s [url=%2$s]tagged you[/url].',
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]', '[url='.$params['source_link'].']'.$params['source_name'].'[/url]',
$params['link']); $params['link']
);
$sitelink = t('Please visit %s to view and/or reply to the conversation.'); $sitelink = L10n::t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf($sitelink, $siteurl); $tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>'); $hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link']; $itemlink = $params['link'];
} }
if ($params['type'] == NOTIFY_SHARE) { if ($params['type'] == NOTIFY_SHARE) {
$subject = sprintf(t('[Friendica:Notify] %s shared a new post'), $params['source_name']); $subject = L10n::t('[Friendica:Notify] %s shared a new post', $params['source_name']);
$preamble = sprintf(t('%1$s shared a new post at %2$s'), $params['source_name'], $sitename); $preamble = L10n::t('%1$s shared a new post at %2$s', $params['source_name'], $sitename);
$epreamble = sprintf(t('%1$s [url=%2$s]shared a post[/url].'), $epreamble = L10n::t('%1$s [url=%2$s]shared a post[/url].',
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]', '[url='.$params['source_link'].']'.$params['source_name'].'[/url]',
$params['link']); $params['link']
);
$sitelink = t('Please visit %s to view and/or reply to the conversation.'); $sitelink = L10n::t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf($sitelink, $siteurl); $tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>'); $hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link']; $itemlink = $params['link'];
} }
if ($params['type'] == NOTIFY_POKE) { if ($params['type'] == NOTIFY_POKE) {
$subject = sprintf(t('[Friendica:Notify] %1$s poked you'), $params['source_name']); $subject = L10n::t('[Friendica:Notify] %1$s poked you', $params['source_name']);
$preamble = sprintf(t('%1$s poked you at %2$s'), $params['source_name'], $sitename); $preamble = L10n::t('%1$s poked you at %2$s', $params['source_name'], $sitename);
$epreamble = sprintf(t('%1$s [url=%2$s]poked you[/url].'), $epreamble = L10n::t('%1$s [url=%2$s]poked you[/url].',
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]', '[url='.$params['source_link'].']'.$params['source_name'].'[/url]',
$params['link']); $params['link']
);
$subject = str_replace('poked', t($params['activity']), $subject); $subject = str_replace('poked', L10n::t($params['activity']), $subject);
$preamble = str_replace('poked', t($params['activity']), $preamble); $preamble = str_replace('poked', L10n::t($params['activity']), $preamble);
$epreamble = str_replace('poked', t($params['activity']), $epreamble); $epreamble = str_replace('poked', L10n::t($params['activity']), $epreamble);
$sitelink = t('Please visit %s to view and/or reply to the conversation.'); $sitelink = L10n::t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf($sitelink, $siteurl); $tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>'); $hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link']; $itemlink = $params['link'];
} }
if ($params['type'] == NOTIFY_TAGSHARE) { if ($params['type'] == NOTIFY_TAGSHARE) {
$subject = sprintf(t('[Friendica:Notify] %s tagged your post'), $params['source_name']); $subject = L10n::t('[Friendica:Notify] %s tagged your post', $params['source_name']);
$preamble = sprintf(t('%1$s tagged your post at %2$s'), $params['source_name'], $sitename); $preamble = L10n::t('%1$s tagged your post at %2$s', $params['source_name'], $sitename);
$epreamble = sprintf(t('%1$s tagged [url=%2$s]your post[/url]'), $epreamble = L10n::t('%1$s tagged [url=%2$s]your post[/url]',
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]', '[url='.$params['source_link'].']'.$params['source_name'].'[/url]',
$itemlink); $itemlink
);
$sitelink = t('Please visit %s to view and/or reply to the conversation.'); $sitelink = L10n::t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf($sitelink, $siteurl); $tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>'); $hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link']; $itemlink = $params['link'];
} }
if ($params['type'] == NOTIFY_INTRO) { if ($params['type'] == NOTIFY_INTRO) {
$subject = sprintf(t('[Friendica:Notify] Introduction received')); $subject = L10n::t('[Friendica:Notify] Introduction received');
$preamble = sprintf(t('You\'ve received an introduction from \'%1$s\' at %2$s'), $params['source_name'], $sitename); $preamble = L10n::t('You\'ve received an introduction from \'%1$s\' at %2$s', $params['source_name'], $sitename);
$epreamble = sprintf(t('You\'ve received [url=%1$s]an introduction[/url] from %2$s.'), $epreamble = L10n::t('You\'ve received [url=%1$s]an introduction[/url] from %2$s.',
$itemlink, $itemlink,
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]'); '[url='.$params['source_link'].']'.$params['source_name'].'[/url]'
);
$body = sprintf(t('You may visit their profile at %s'), $params['source_link']); $body = L10n::t('You may visit their profile at %s', $params['source_link']);
$sitelink = t('Please visit %s to approve or reject the introduction.'); $sitelink = L10n::t('Please visit %s to approve or reject the introduction.');
$tsitelink = sprintf($sitelink, $siteurl); $tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>'); $hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link']; $itemlink = $params['link'];
@ -268,21 +278,23 @@ function notification($params)
switch ($params['verb']) { switch ($params['verb']) {
case ACTIVITY_FRIEND: case ACTIVITY_FRIEND:
// someone started to share with user (mostly OStatus) // someone started to share with user (mostly OStatus)
$subject = sprintf(t('[Friendica:Notify] A new person is sharing with you')); $subject = L10n::t('[Friendica:Notify] A new person is sharing with you');
$preamble = sprintf(t('%1$s is sharing with you at %2$s'), $params['source_name'], $sitename); $preamble = L10n::t('%1$s is sharing with you at %2$s', $params['source_name'], $sitename);
$epreamble = sprintf(t('%1$s is sharing with you at %2$s'), $epreamble = L10n::t('%1$s is sharing with you at %2$s',
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]', '[url='.$params['source_link'].']'.$params['source_name'].'[/url]',
$sitename); $sitename
);
break; break;
case ACTIVITY_FOLLOW: case ACTIVITY_FOLLOW:
// someone started to follow the user (mostly OStatus) // someone started to follow the user (mostly OStatus)
$subject = sprintf(t('[Friendica:Notify] You have a new follower')); $subject = L10n::t('[Friendica:Notify] You have a new follower');
$preamble = sprintf(t('You have a new follower at %2$s : %1$s'), $params['source_name'], $sitename); $preamble = L10n::t('You have a new follower at %2$s : %1$s', $params['source_name'], $sitename);
$epreamble = sprintf(t('You have a new follower at %2$s : %1$s'), $epreamble = L10n::t('You have a new follower at %2$s : %1$s',
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]', '[url='.$params['source_link'].']'.$params['source_name'].'[/url]',
$sitename); $sitename
);
break; break;
default: default:
// ACTIVITY_REQ_FRIEND is default activity for notifications // ACTIVITY_REQ_FRIEND is default activity for notifications
@ -291,19 +303,20 @@ function notification($params)
} }
if ($params['type'] == NOTIFY_SUGGEST) { if ($params['type'] == NOTIFY_SUGGEST) {
$subject = sprintf(t('[Friendica:Notify] Friend suggestion received')); $subject = L10n::t('[Friendica:Notify] Friend suggestion received');
$preamble = sprintf(t('You\'ve received a friend suggestion from \'%1$s\' at %2$s'), $params['source_name'], $sitename); $preamble = L10n::t('You\'ve received a friend suggestion from \'%1$s\' at %2$s', $params['source_name'], $sitename);
$epreamble = sprintf(t('You\'ve received [url=%1$s]a friend suggestion[/url] for %2$s from %3$s.'), $epreamble = L10n::t('You\'ve received [url=%1$s]a friend suggestion[/url] for %2$s from %3$s.',
$itemlink, $itemlink,
'[url='.$params['item']['url'].']'.$params['item']['name'].'[/url]', '[url='.$params['item']['url'].']'.$params['item']['name'].'[/url]',
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]'); '[url='.$params['source_link'].']'.$params['source_name'].'[/url]'
);
$body = t('Name:').' '.$params['item']['name']."\n"; $body = L10n::t('Name:').' '.$params['item']['name']."\n";
$body .= t('Photo:').' '.$params['item']['photo']."\n"; $body .= L10n::t('Photo:').' '.$params['item']['photo']."\n";
$body .= sprintf(t('You may visit their profile at %s'), $params['item']['url']); $body .= L10n::t('You may visit their profile at %s', $params['item']['url']);
$sitelink = t('Please visit %s to approve or reject the suggestion.'); $sitelink = L10n::t('Please visit %s to approve or reject the suggestion.');
$tsitelink = sprintf($sitelink, $siteurl); $tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>'); $hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link']; $itemlink = $params['link'];
@ -311,32 +324,34 @@ function notification($params)
if ($params['type'] == NOTIFY_CONFIRM) { if ($params['type'] == NOTIFY_CONFIRM) {
if ($params['verb'] == ACTIVITY_FRIEND) { // mutual connection if ($params['verb'] == ACTIVITY_FRIEND) { // mutual connection
$subject = sprintf(t('[Friendica:Notify] Connection accepted')); $subject = L10n::t('[Friendica:Notify] Connection accepted');
$preamble = sprintf(t('\'%1$s\' has accepted your connection request at %2$s'), $params['source_name'], $sitename); $preamble = L10n::t('\'%1$s\' has accepted your connection request at %2$s', $params['source_name'], $sitename);
$epreamble = sprintf(t('%2$s has accepted your [url=%1$s]connection request[/url].'), $epreamble = L10n::t('%2$s has accepted your [url=%1$s]connection request[/url].',
$itemlink, $itemlink,
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]'); '[url='.$params['source_link'].']'.$params['source_name'].'[/url]'
);
$body = t('You are now mutual friends and may exchange status updates, photos, and email without restriction.'); $body = L10n::t('You are now mutual friends and may exchange status updates, photos, and email without restriction.');
$sitelink = t('Please visit %s if you wish to make any changes to this relationship.'); $sitelink = L10n::t('Please visit %s if you wish to make any changes to this relationship.');
$tsitelink = sprintf($sitelink, $siteurl); $tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>'); $hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link']; $itemlink = $params['link'];
} else { // ACTIVITY_FOLLOW } else { // ACTIVITY_FOLLOW
$subject = sprintf(t('[Friendica:Notify] Connection accepted')); $subject = L10n::t('[Friendica:Notify] Connection accepted');
$preamble = sprintf(t('\'%1$s\' has accepted your connection request at %2$s'), $params['source_name'], $sitename); $preamble = L10n::t('\'%1$s\' has accepted your connection request at %2$s', $params['source_name'], $sitename);
$epreamble = sprintf(t('%2$s has accepted your [url=%1$s]connection request[/url].'), $epreamble = L10n::t('%2$s has accepted your [url=%1$s]connection request[/url].',
$itemlink, $itemlink,
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]'); '[url='.$params['source_link'].']'.$params['source_name'].'[/url]'
);
$body = sprintf(t('\'%1$s\' has chosen to accept you a "fan", which restricts some forms of communication - such as private messaging and some profile interactions. If this is a celebrity or community page, these settings were applied automatically.'), $params['source_name']); $body = L10n::t('\'%1$s\' has chosen to accept you a "fan", which restricts some forms of communication - such as private messaging and some profile interactions. If this is a celebrity or community page, these settings were applied automatically.', $params['source_name']);
$body .= "\n\n"; $body .= "\n\n";
$body .= sprintf(t('\'%1$s\' may choose to extend this into a two-way or more permissive relationship in the future.'), $params['source_name']); $body .= L10n::t('\'%1$s\' may choose to extend this into a two-way or more permissive relationship in the future.', $params['source_name']);
$sitelink = t('Please visit %s if you wish to make any changes to this relationship.'); $sitelink = L10n::t('Please visit %s if you wish to make any changes to this relationship.');
$tsitelink = sprintf($sitelink, $siteurl); $tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>'); $hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link']; $itemlink = $params['link'];
@ -346,17 +361,21 @@ function notification($params)
if ($params['type'] == NOTIFY_SYSTEM) { if ($params['type'] == NOTIFY_SYSTEM) {
switch($params['event']) { switch($params['event']) {
case "SYSTEM_REGISTER_REQUEST": case "SYSTEM_REGISTER_REQUEST":
$subject = sprintf(t('[Friendica System:Notify] registration request')); $subject = L10n::t('[Friendica System:Notify] registration request');
$preamble = sprintf(t('You\'ve received a registration request from \'%1$s\' at %2$s'), $params['source_name'], $sitename); $preamble = L10n::t('You\'ve received a registration request from \'%1$s\' at %2$s', $params['source_name'], $sitename);
$epreamble = sprintf(t('You\'ve received a [url=%1$s]registration request[/url] from %2$s.'), $epreamble = L10n::t('You\'ve received a [url=%1$s]registration request[/url] from %2$s.',
$itemlink, $itemlink,
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]'); '[url='.$params['source_link'].']'.$params['source_name'].'[/url]'
);
$body = sprintf(t('Full Name: %1$s\nSite Location: %2$s\nLogin Name: %3$s (%4$s)'), $body = L10n::t('Full Name: %1$s\nSite Location: %2$s\nLogin Name: %3$s (%4$s)',
$params['source_name'], $siteurl, $params['source_mail'], $params['source_nick']); $params['source_name'],
$siteurl, $params['source_mail'],
$params['source_nick']
);
$sitelink = t('Please visit %s to approve or reject the request.'); $sitelink = L10n::t('Please visit %s to approve or reject the request.');
$tsitelink = sprintf($sitelink, $params['link']); $tsitelink = sprintf($sitelink, $params['link']);
$hsitelink = sprintf($sitelink, '<a href="'.$params['link'].'">'.$sitename.'</a><br><br>'); $hsitelink = sprintf($sitelink, '<a href="'.$params['link'].'">'.$sitename.'</a><br><br>');
$itemlink = $params['link']; $itemlink = $params['link'];
@ -444,7 +463,7 @@ function notification($params)
Addon::callHooks('enotify_store', $datarray); Addon::callHooks('enotify_store', $datarray);
if ($datarray['abort']) { if ($datarray['abort']) {
pop_lang(); L10n::popLang();
return False; return False;
} }
@ -473,7 +492,7 @@ function notification($params)
if ($r) { if ($r) {
$notify_id = $r[0]['id']; $notify_id = $r[0]['id'];
} else { } else {
pop_lang(); L10n::popLang();
return False; return False;
} }
@ -492,8 +511,8 @@ function notification($params)
// only continue on if we stored the first one // only continue on if we stored the first one
if ($notify_id != $p[0]['id']) { if ($notify_id != $p[0]['id']) {
pop_lang(); L10n::popLang();
return False; return false;
} }
} }

View file

@ -7,6 +7,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Feature; use Friendica\Content\Feature;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -22,7 +23,7 @@ function format_event_html($ev, $simple = false) {
return ''; return '';
} }
$bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM. $bd_format = L10n::t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM.
$event_start = (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $event_start = (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
$ev['start'] , $bd_format )) $ev['start'] , $bd_format ))
@ -39,14 +40,14 @@ function format_event_html($ev, $simple = false) {
$o .= "<div>" . bbcode($ev['desc']) . "</div>"; $o .= "<div>" . bbcode($ev['desc']) . "</div>";
$o .= "<h4>" . t('Starts:') . "</h4><p>" . $event_start . "</p>"; $o .= "<h4>" . L10n::t('Starts:') . "</h4><p>" . $event_start . "</p>";
if (! $ev['nofinish']) { if (! $ev['nofinish']) {
$o .= "<h4>" . t('Finishes:') . "</h4><p>" . $event_end ."</p>"; $o .= "<h4>" . L10n::t('Finishes:') . "</h4><p>" . $event_end ."</p>";
} }
if (strlen($ev['location'])) { if (strlen($ev['location'])) {
$o .= "<h4>" . t('Location:') . "</h4><p>" . $ev['location'] . "</p>"; $o .= "<h4>" . L10n::t('Location:') . "</h4><p>" . $ev['location'] . "</p>";
} }
return $o; return $o;
@ -56,13 +57,13 @@ function format_event_html($ev, $simple = false) {
$o .= '<div class="summary event-summary">' . bbcode($ev['summary']) . '</div>' . "\r\n"; $o .= '<div class="summary event-summary">' . bbcode($ev['summary']) . '</div>' . "\r\n";
$o .= '<div class="event-start"><span class="event-label">' . t('Starts:') . '</span>&nbsp;<span class="dtstart" title="' $o .= '<div class="event-start"><span class="event-label">' . L10n::t('Starts:') . '</span>&nbsp;<span class="dtstart" title="'
. datetime_convert('UTC', 'UTC', $ev['start'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )) . datetime_convert('UTC', 'UTC', $ev['start'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
. '" >'.$event_start . '" >'.$event_start
. '</span></div>' . "\r\n"; . '</span></div>' . "\r\n";
if (! $ev['nofinish']) { if (! $ev['nofinish']) {
$o .= '<div class="event-end" ><span class="event-label">' . t('Finishes:') . '</span>&nbsp;<span class="dtend" title="' $o .= '<div class="event-end" ><span class="event-label">' . L10n::t('Finishes:') . '</span>&nbsp;<span class="dtend" title="'
. datetime_convert('UTC', 'UTC', $ev['finish'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )) . datetime_convert('UTC', 'UTC', $ev['finish'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
. '" >'.$event_end . '" >'.$event_end
. '</span></div>' . "\r\n"; . '</span></div>' . "\r\n";
@ -71,7 +72,7 @@ function format_event_html($ev, $simple = false) {
$o .= '<div class="description event-description">' . bbcode($ev['desc']) . '</div>' . "\r\n"; $o .= '<div class="description event-description">' . bbcode($ev['desc']) . '</div>' . "\r\n";
if (strlen($ev['location'])) { if (strlen($ev['location'])) {
$o .= '<div class="event-location"><span class="event-label">' . t('Location:') . '</span>&nbsp;<span class="location">' $o .= '<div class="event-location"><span class="event-label">' . L10n::t('Location:') . '</span>&nbsp;<span class="location">'
. bbcode($ev['location']) . bbcode($ev['location'])
. '</span></div>' . "\r\n"; . '</span></div>' . "\r\n";
@ -425,60 +426,60 @@ function get_event_strings() {
$i18n = [ $i18n = [
"firstDay" => $firstDay, "firstDay" => $firstDay,
"allday" => t("all-day"), "allday" => L10n::t("all-day"),
"Sun" => t("Sun"), "Sun" => L10n::t("Sun"),
"Mon" => t("Mon"), "Mon" => L10n::t("Mon"),
"Tue" => t("Tue"), "Tue" => L10n::t("Tue"),
"Wed" => t("Wed"), "Wed" => L10n::t("Wed"),
"Thu" => t("Thu"), "Thu" => L10n::t("Thu"),
"Fri" => t("Fri"), "Fri" => L10n::t("Fri"),
"Sat" => t("Sat"), "Sat" => L10n::t("Sat"),
"Sunday" => t("Sunday"), "Sunday" => L10n::t("Sunday"),
"Monday" => t("Monday"), "Monday" => L10n::t("Monday"),
"Tuesday" => t("Tuesday"), "Tuesday" => L10n::t("Tuesday"),
"Wednesday" => t("Wednesday"), "Wednesday" => L10n::t("Wednesday"),
"Thursday" => t("Thursday"), "Thursday" => L10n::t("Thursday"),
"Friday" => t("Friday"), "Friday" => L10n::t("Friday"),
"Saturday" => t("Saturday"), "Saturday" => L10n::t("Saturday"),
"Jan" => t("Jan"), "Jan" => L10n::t("Jan"),
"Feb" => t("Feb"), "Feb" => L10n::t("Feb"),
"Mar" => t("Mar"), "Mar" => L10n::t("Mar"),
"Apr" => t("Apr"), "Apr" => L10n::t("Apr"),
"May" => t("May"), "May" => L10n::t("May"),
"Jun" => t("Jun"), "Jun" => L10n::t("Jun"),
"Jul" => t("Jul"), "Jul" => L10n::t("Jul"),
"Aug" => t("Aug"), "Aug" => L10n::t("Aug"),
"Sep" => t("Sept"), "Sep" => L10n::t("Sept"),
"Oct" => t("Oct"), "Oct" => L10n::t("Oct"),
"Nov" => t("Nov"), "Nov" => L10n::t("Nov"),
"Dec" => t("Dec"), "Dec" => L10n::t("Dec"),
"January" => t("January"), "January" => L10n::t("January"),
"February" => t("February"), "February" => L10n::t("February"),
"March" => t("March"), "March" => L10n::t("March"),
"April" => t("April"), "April" => L10n::t("April"),
"May" => t("May"), "May" => L10n::t("May"),
"June" => t("June"), "June" => L10n::t("June"),
"July" => t("July"), "July" => L10n::t("July"),
"August" => t("August"), "August" => L10n::t("August"),
"September" => t("September"), "September" => L10n::t("September"),
"October" => t("October"), "October" => L10n::t("October"),
"November" => t("November"), "November" => L10n::t("November"),
"December" => t("December"), "December" => L10n::t("December"),
"today" => t("today"), "today" => L10n::t("today"),
"month" => t("month"), "month" => L10n::t("month"),
"week" => t("week"), "week" => L10n::t("week"),
"day" => t("day"), "day" => L10n::t("day"),
"noevent" => t("No events to display"), "noevent" => L10n::t("No events to display"),
"dtstart_label" => t("Starts:"), "dtstart_label" => L10n::t("Starts:"),
"dtend_label" => t("Finishes:"), "dtend_label" => L10n::t("Finishes:"),
"location_label" => t("Location:") "location_label" => L10n::t("Location:")
]; ];
return $i18n; return $i18n;
@ -588,7 +589,7 @@ function process_events($arr) {
$events=[]; $events=[];
$last_date = ''; $last_date = '';
$fmt = t('l, F j'); $fmt = L10n::t('l, F j');
if (count($arr)) { if (count($arr)) {
foreach ($arr as $rr) { foreach ($arr as $rr) {
$j = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j')); $j = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j'));
@ -612,9 +613,9 @@ function process_events($arr) {
$copy = null; $copy = null;
$drop = null; $drop = null;
if (local_user() && local_user() == $rr['uid'] && $rr['type'] == 'event') { if (local_user() && local_user() == $rr['uid'] && $rr['type'] == 'event') {
$edit = ((! $rr['cid']) ? [System::baseUrl() . '/events/event/' . $rr['id'], t('Edit event'), '', ''] : null); $edit = ((! $rr['cid']) ? [System::baseUrl() . '/events/event/' . $rr['id'], L10n::t('Edit event'), '', ''] : null);
$copy = ((! $rr['cid']) ? [System::baseUrl() . '/events/copy/' . $rr['id'], t('Duplicate event'), '', ''] : null); $copy = ((! $rr['cid']) ? [System::baseUrl() . '/events/copy/' . $rr['id'], L10n::t('Duplicate event'), '', ''] : null);
$drop = [System::baseUrl() . '/events/drop/' . $rr['id'], t('Delete event'), '', '']; $drop = [System::baseUrl() . '/events/drop/' . $rr['id'], L10n::t('Delete event'), '', ''];
} }
$title = strip_tags(html_entity_decode(bbcode($rr['summary']), ENT_QUOTES, 'UTF-8')); $title = strip_tags(html_entity_decode(bbcode($rr['summary']), ENT_QUOTES, 'UTF-8'));
@ -641,7 +642,7 @@ function process_events($arr) {
'is_first' => $is_first, 'is_first' => $is_first,
'item' => $rr, 'item' => $rr,
'html' => $html, 'html' => $html,
'plink' => [$rr['plink'], t('link to source'), '', ''], 'plink' => [$rr['plink'], L10n::t('link to source'), '', ''],
]; ];
} }
} }
@ -901,9 +902,9 @@ function widget_events() {
} }
return replace_macros(get_markup_template("events_aside.tpl"), [ return replace_macros(get_markup_template("events_aside.tpl"), [
'$etitle' => t("Export"), '$etitle' => L10n::t("Export"),
'$export_ical' => t("Export calendar as ical"), '$export_ical' => L10n::t("Export calendar as ical"),
'$export_csv' => t("Export calendar as csv"), '$export_csv' => L10n::t("Export calendar as csv"),
'$user' => $user '$user' => $user
]); ]);
} }
@ -919,9 +920,9 @@ function format_event_item($item) {
$finish = false; $finish = false;
// Set the different time formats. // Set the different time formats.
$dformat = t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8:01 AM. $dformat = L10n::t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8:01 AM.
$dformat_short = t('D g:i A'); // Fri 8:01 AM. $dformat_short = L10n::t('D g:i A'); // Fri 8:01 AM.
$tformat = t('g:i A'); // 8:01 AM. $tformat = L10n::t('g:i A'); // 8:01 AM.
// Convert the time to different formats. // Convert the time to different formats.
$dtstart_dt = (($item['event-adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $item['event-start'], $dformat)) : day_translate(datetime_convert('UTC', 'UTC', $item['event-start'], $dformat))); $dtstart_dt = (($item['event-adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $item['event-start'], $dformat)) : day_translate(datetime_convert('UTC', 'UTC', $item['event-start'], $dformat)));
@ -971,11 +972,11 @@ function format_event_item($item) {
$event = replace_macros(get_markup_template('event_stream_item.tpl'), [ $event = replace_macros(get_markup_template('event_stream_item.tpl'), [
'$id' => $item['event-id'], '$id' => $item['event-id'],
'$title' => prepare_text($item['event-summary']), '$title' => prepare_text($item['event-summary']),
'$dtstart_label' => t('Starts:'), '$dtstart_label' => L10n::t('Starts:'),
'$dtstart_title' => $dtstart_title, '$dtstart_title' => $dtstart_title,
'$dtstart_dt' => $dtstart_dt, '$dtstart_dt' => $dtstart_dt,
'$finish' => $finish, '$finish' => $finish,
'$dtend_label' => t('Finishes:'), '$dtend_label' => L10n::t('Finishes:'),
'$dtend_title' => $dtend_title, '$dtend_title' => $dtend_title,
'$dtend_dt' => $dtend_dt, '$dtend_dt' => $dtend_dt,
'$month_short' => $month_short, '$month_short' => $month_short,
@ -989,10 +990,10 @@ function format_event_item($item) {
'$author_link' => $profile_link, '$author_link' => $profile_link,
'$author_avatar' => $item['author-avatar'], '$author_avatar' => $item['author-avatar'],
'$description' => prepare_text($item['event-desc']), '$description' => prepare_text($item['event-desc']),
'$location_label' => t('Location:'), '$location_label' => L10n::t('Location:'),
'$show_map_label' => t('Show map'), '$show_map_label' => L10n::t('Show map'),
'$hide_map_label' => t('Hide map'), '$hide_map_label' => L10n::t('Hide map'),
'$map_btn_label' => t('Show map'), '$map_btn_label' => L10n::t('Show map'),
'$location' => $location '$location' => $location
]); ]);

View file

@ -6,6 +6,7 @@ use Friendica\App;
use Friendica\Content\Feature; use Friendica\Content\Feature;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Core\System; use Friendica\Core\System;
@ -1495,7 +1496,7 @@ function new_follower($importer, $contact, $datarray, $item, $sharing = false) {
'to_email' => $r[0]['email'], 'to_email' => $r[0]['email'],
'uid' => $r[0]['uid'], 'uid' => $r[0]['uid'],
'link' => System::baseUrl() . '/notifications/intro', 'link' => System::baseUrl() . '/notifications/intro',
'source_name' => ((strlen(stripslashes($contact_record['name']))) ? stripslashes($contact_record['name']) : t('[Name Withheld]')), 'source_name' => ((strlen(stripslashes($contact_record['name']))) ? stripslashes($contact_record['name']) : L10n::t('[Name Withheld]')),
'source_link' => $contact_record['url'], 'source_link' => $contact_record['url'],
'source_photo' => $contact_record['photo'], 'source_photo' => $contact_record['photo'],
'verb' => ($sharing ? ACTIVITY_FRIEND : ACTIVITY_FOLLOW), 'verb' => ($sharing ? ACTIVITY_FRIEND : ACTIVITY_FOLLOW),
@ -1867,7 +1868,7 @@ function drop_item($id) {
); );
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
notice(t('Item not found.') . EOL); notice(L10n::t('Item not found.') . EOL);
goaway(System::baseUrl() . '/' . $_SESSION['return_url']); goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
} }
@ -1907,12 +1908,12 @@ function drop_item($id) {
return replace_macros(get_markup_template('confirm.tpl'), [ return replace_macros(get_markup_template('confirm.tpl'), [
'$method' => 'get', '$method' => 'get',
'$message' => t('Do you really want to delete this item?'), '$message' => L10n::t('Do you really want to delete this item?'),
'$extra_inputs' => $inputs, '$extra_inputs' => $inputs,
'$confirm' => t('Yes'), '$confirm' => L10n::t('Yes'),
'$confirm_url' => $query['base'], '$confirm_url' => $query['base'],
'$confirm_name' => 'confirmed', '$confirm_name' => 'confirmed',
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
]); ]);
} }
// Now check how the user responded to the confirmation query // Now check how the user responded to the confirmation query
@ -1926,7 +1927,7 @@ function drop_item($id) {
goaway(System::baseUrl() . '/' . $_SESSION['return_url']); goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
//NOTREACHED //NOTREACHED
} else { } else {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
goaway(System::baseUrl() . '/' . $_SESSION['return_url']); goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
//NOTREACHED //NOTREACHED
} }
@ -2015,13 +2016,13 @@ function posted_date_widget($url, $uid, $wall) {
$cutoff = ((array_key_exists($cutoff_year, $ret))? true : false); $cutoff = ((array_key_exists($cutoff_year, $ret))? true : false);
$o = replace_macros(get_markup_template('posted_date_widget.tpl'),[ $o = replace_macros(get_markup_template('posted_date_widget.tpl'),[
'$title' => t('Archives'), '$title' => L10n::t('Archives'),
'$size' => $visible_years, '$size' => $visible_years,
'$cutoff_year' => $cutoff_year, '$cutoff_year' => $cutoff_year,
'$cutoff' => $cutoff, '$cutoff' => $cutoff,
'$url' => $url, '$url' => $url,
'$dates' => $ret, '$dates' => $ret,
'$showmore' => t('show more') '$showmore' => L10n::t('show more')
]); ]);
return $o; return $o;

View file

@ -1,7 +1,10 @@
<?php <?php
/**
* @file include/like.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -31,31 +34,31 @@ function do_like($item_id, $verb) {
switch ($verb) { switch ($verb) {
case 'like': case 'like':
$bodyverb = t('%1$s likes %2$s\'s %3$s'); $bodyverb = L10n::t('%1$s likes %2$s\'s %3$s');
$activity = ACTIVITY_LIKE; $activity = ACTIVITY_LIKE;
break; break;
case 'unlike': case 'unlike':
$bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s'); $bodyverb = L10n::t('%1$s doesn\'t like %2$s\'s %3$s');
$activity = ACTIVITY_LIKE; $activity = ACTIVITY_LIKE;
break; break;
case 'dislike': case 'dislike':
case 'undislike': case 'undislike':
$bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s'); $bodyverb = L10n::t('%1$s doesn\'t like %2$s\'s %3$s');
$activity = ACTIVITY_DISLIKE; $activity = ACTIVITY_DISLIKE;
break; break;
case 'attendyes': case 'attendyes':
case 'unattendyes': case 'unattendyes':
$bodyverb = t('%1$s is attending %2$s\'s %3$s'); $bodyverb = L10n::t('%1$s is attending %2$s\'s %3$s');
$activity = ACTIVITY_ATTEND; $activity = ACTIVITY_ATTEND;
break; break;
case 'attendno': case 'attendno':
case 'unattendno': case 'unattendno':
$bodyverb = t('%1$s is not attending %2$s\'s %3$s'); $bodyverb = L10n::t('%1$s is not attending %2$s\'s %3$s');
$activity = ACTIVITY_ATTENDNO; $activity = ACTIVITY_ATTENDNO;
break; break;
case 'attendmaybe': case 'attendmaybe':
case 'unattendmaybe': case 'unattendmaybe':
$bodyverb = t('%1$s may attend %2$s\'s %3$s'); $bodyverb = L10n::t('%1$s may attend %2$s\'s %3$s');
$activity = ACTIVITY_ATTENDMAYBE; $activity = ACTIVITY_ATTENDMAYBE;
break; break;
default: default:
@ -185,9 +188,9 @@ function do_like($item_id, $verb) {
} }
// Else or if event verb different from existing row, create a new item row // Else or if event verb different from existing row, create a new item row
$post_type = (($item['resource-id']) ? t('photo') : t('status')); $post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status'));
if ($item['object-type'] === ACTIVITY_OBJ_EVENT) { if ($item['object-type'] === ACTIVITY_OBJ_EVENT) {
$post_type = t('event'); $post_type = L10n::t('event');
} }
$objtype = $item['resource-id'] ? ACTIVITY_OBJ_IMAGE : ACTIVITY_OBJ_NOTE ; $objtype = $item['resource-id'] ? ACTIVITY_OBJ_IMAGE : ACTIVITY_OBJ_NOTE ;
$link = xmlify('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/display/' . $owner_self_contact['nick'] . '/' . $item['id'] . '" />' . "\n") ; $link = xmlify('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/display/' . $owner_self_contact['nick'] . '/' . $item['id'] . '" />' . "\n") ;

View file

@ -4,6 +4,7 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Network\Probe; use Friendica\Network\Probe;
@ -737,7 +738,7 @@ function scale_external_images($srctext, $include_link = true, $scale_replace =
$mtch[0], $mtch[0],
'[img=' . $new_width . 'x' . $new_height. ']' . $scaled . '[/img]' '[img=' . $new_width . 'x' . $new_height. ']' . $scaled . '[/img]'
. "\n" . (($include_link) . "\n" . (($include_link)
? '[url=' . $mtch[1] . ']' . t('view full size') . '[/url]' . "\n" ? '[url=' . $mtch[1] . ']' . L10n::t('view full size') . '[/url]' . "\n"
: ''), : ''),
$s $s
); );

View file

@ -1,233 +0,0 @@
<?php
/**
* @brief translation support
*
* Get the language setting directly from system variables, bypassing Config::get()
* as database may not yet be configured.
*
* If possible, we use the value from the browser.
*
*/
use Friendica\Core\Config;
require_once "include/dba.php";
/**
* @brief get the prefered language from the HTTP_ACCEPT_LANGUAGE header
*/
function get_browser_language() {
$lang_list = [];
if (x($_SERVER, 'HTTP_ACCEPT_LANGUAGE')) {
// break up string into pieces (languages and q factors)
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i',
$_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
if (count($lang_parse[1])) {
// go through the list of prefered languages and add a generic language
// for sub-linguas (e.g. de-ch will add de) if not already in array
for ($i = 0; $i < count($lang_parse[1]); $i++) {
$lang_list[] = strtolower($lang_parse[1][$i]);
if (strlen($lang_parse[1][$i])>3 ) {
$dashpos = strpos($lang_parse[1][$i], '-');
if (!in_array(substr($lang_parse[1][$i], 0, $dashpos), $lang_list ) ) {
$lang_list[] = strtolower(substr($lang_parse[1][$i], 0, $dashpos));
}
}
}
}
}
// check if we have translations for the preferred languages and pick the 1st that has
foreach ($lang_list as $lang) {
if ($lang === 'en' || (file_exists("view/lang/$lang") && is_dir("view/lang/$lang"))) {
$preferred = $lang;
break;
}
}
if (isset($preferred)) {
return $preferred;
}
// in case none matches, get the system wide configured language, or fall back to English
return Config::get('system', 'language', 'en');
}
function push_lang($language) {
global $lang, $a;
$a->langsave = $lang;
if ($language === $lang) {
return;
}
if (isset($a->strings) && count($a->strings)) {
$a->stringsave = $a->strings;
}
$a->strings = [];
load_translation_table($language);
$lang = $language;
}
function pop_lang() {
global $lang, $a;
if ($lang === $a->langsave) {
return;
}
if (isset($a->stringsave)) {
$a->strings = $a->stringsave;
} else {
$a->strings = [];
}
$lang = $a->langsave;
}
// l
/**
* load string translation table for alternate language
*
* first addon strings are loaded, then globals
*
* @param string $lang language code to load
*/
function load_translation_table($lang) {
$a = get_app();
$a->strings = [];
// load enabled addons strings
$addons = dba::select('addon', ['name'], ['installed' => true]);
while ($p = dba::fetch($addons)) {
$name = $p['name'];
if (file_exists("addon/$name/lang/$lang/strings.php")) {
include("addon/$name/lang/$lang/strings.php");
}
}
if (file_exists("view/lang/$lang/strings.php")) {
include("view/lang/$lang/strings.php");
}
}
/**
* @brief Return the localized version of the provided string with optional string interpolation
*
* This function takes a english string as parameter, and if a localized version
* exists for the current language, substitutes it before performing an eventual
* string interpolation (sprintf) with additional optional arguments.
*
* Usages:
* - t('This is an example')
* - t('URL %s returned no result', $url)
* - t('Current version: %s, new version: %s', $current_version, $new_version)
*
* @param string $s
* @return string
*/
function t($s)
{
$a = get_app();
if (x($a->strings, $s)) {
$t = $a->strings[$s];
$s = is_array($t) ? $t[0] : $t;
}
if (func_num_args() > 1) {
$args = array_slice(func_get_args(), 1);
$s = @vsprintf($s, $args);
}
return $s;
}
/**
* @brief Return the localized version of a singular/plural string with optional string interpolation
*
* This function takes two english strings as parameters, singular and plural, as
* well as a count. If a localized version exists for the current language, they
* are used instead. Discrimination between singular and plural is done using the
* localized function if any or the default one. Finally, a string interpolation
* is performed using the count as parameter.
*
* Usages:
* - tt('Like', 'Likes', $count)
* - tt("%s user deleted", "%s users deleted", count($users))
*
* @global type $lang
* @param string $singular
* @param string $plural
* @param int $count
* @return string
*/
function tt($singular, $plural, $count)
{
global $lang;
$a = get_app();
if (x($a->strings, $singular)) {
$t = $a->strings[$singular];
if (is_array($t)) {
$plural_function = 'string_plural_select_' . str_replace('-', '_', $lang);
if (function_exists($plural_function)) {
$plural_function = 'string_plural_select_default';
}
$i = $plural_function($count);
$s = $t[$i];
} else {
$s = $t;
}
} elseif (string_plural_select_default($count)) {
$s = $plural;
} else {
$s = $singular;
}
$s = @sprintf($s, $count);
return $s;
}
// provide a fallback which will not collide with
// a function defined in any language file
function string_plural_select_default($n)
{
return $n != 1;
}
/**
* @brief Return installed languages codes as associative array
*
* Scans the view/lang directory for the existence of "strings.php" files, and
* returns an alphabetical list of their folder names (@-char language codes).
* Adds the english language if it's missing from the list.
*
* Ex: array('de' => 'de', 'en' => 'en', 'fr' => 'fr', ...)
*
* @return array
*/
function get_available_languages() {
$langs = [];
$strings_file_paths = glob('view/lang/*/strings.php');
if (is_array($strings_file_paths) && count($strings_file_paths)) {
if (!in_array('view/lang/en/strings.php', $strings_file_paths)) {
$strings_file_paths[] = 'view/lang/en/strings.php';
}
asort($strings_file_paths);
foreach ($strings_file_paths as $strings_file_path) {
$path_array = explode('/', $strings_file_path);
$langs[$path_array[2]] = $path_array[2];
}
}
return $langs;
}

View file

@ -1,8 +1,11 @@
<?php <?php
/**
* @file include/security.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -74,10 +77,10 @@ function authenticate_success($user_record, $login_initial = false, $interactive
if ($a->user['login_date'] <= NULL_DATE) { if ($a->user['login_date'] <= NULL_DATE) {
$_SESSION['return_url'] = 'profile_photo/new'; $_SESSION['return_url'] = 'profile_photo/new';
$a->module = 'profile_photo'; $a->module = 'profile_photo';
info(t("Welcome ") . $a->user['username'] . EOL); info(L10n::t("Welcome ") . $a->user['username'] . EOL);
info(t('Please upload a profile photo.') . EOL); info(L10n::t('Please upload a profile photo.') . EOL);
} else { } else {
info(t("Welcome back ") . $a->user['username'] . EOL); info(L10n::t("Welcome back ") . $a->user['username'] . EOL);
} }
} }
@ -401,7 +404,7 @@ function check_form_security_token($typename = '', $formname = 'form_security_to
function check_form_security_std_err_msg() function check_form_security_std_err_msg()
{ {
return t('The form security token was not correct. This probably happened because the form has been opened for too long (>3 hours) before submitting it.') . EOL; return L10n::t('The form security token was not correct. This probably happened because the form has been opened for too long (>3 hours) before submitting it.') . EOL;
} }
function check_form_security_token_redirectOnErr($err_redirect, $typename = '', $formname = 'form_security_token') function check_form_security_token_redirectOnErr($err_redirect, $typename = '', $formname = 'form_security_token')

View file

@ -1,10 +1,10 @@
<?php <?php
/** /**
* @file include/tags.php * @file include/tags.php
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\Feature; use Friendica\Content\Feature;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -239,7 +239,7 @@ function wtagblock($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HA
$tpl = get_markup_template('tagblock_widget.tpl'); $tpl = get_markup_template('tagblock_widget.tpl');
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$title' => t('Tags'), '$title' => L10n::t('Tags'),
'$tags' => $tags '$tags' => $tags
]); ]);
} }

View file

@ -8,6 +8,7 @@ use Friendica\Content\Feature;
use Friendica\Content\Smilies; use Friendica\Content\Smilies;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -294,14 +295,14 @@ function paginate_data(App $a, $count = null) {
if (!is_null($count)) { if (!is_null($count)) {
// minimal pager (newer / older) // minimal pager (newer / older)
$data['class'] = 'pager'; $data['class'] = 'pager';
_l($data, 'prev', $url . '&page=' . ($a->pager['page'] - 1), t('newer'), 'previous' . ($a->pager['page'] == 1 ? ' disabled' : '')); _l($data, 'prev', $url . '&page=' . ($a->pager['page'] - 1), L10n::t('newer'), 'previous' . ($a->pager['page'] == 1 ? ' disabled' : ''));
_l($data, 'next', $url . '&page=' . ($a->pager['page'] + 1), t('older'), 'next' . ($count <= 0 ? ' disabled' : '')); _l($data, 'next', $url . '&page=' . ($a->pager['page'] + 1), L10n::t('older'), 'next' . ($count <= 0 ? ' disabled' : ''));
} else { } else {
// full pager (first / prev / 1 / 2 / ... / 14 / 15 / next / last) // full pager (first / prev / 1 / 2 / ... / 14 / 15 / next / last)
$data['class'] = 'pagination'; $data['class'] = 'pagination';
if ($a->pager['total'] > $a->pager['itemspage']) { if ($a->pager['total'] > $a->pager['itemspage']) {
_l($data, 'first', $url . '&page=1', t('first'), $a->pager['page'] == 1 ? 'disabled' : ''); _l($data, 'first', $url . '&page=1', L10n::t('first'), $a->pager['page'] == 1 ? 'disabled' : '');
_l($data, 'prev', $url . '&page=' . ($a->pager['page'] - 1), t('prev'), $a->pager['page'] == 1 ? 'disabled' : ''); _l($data, 'prev', $url . '&page=' . ($a->pager['page'] - 1), L10n::t('prev'), $a->pager['page'] == 1 ? 'disabled' : '');
$numpages = $a->pager['total'] / $a->pager['itemspage']; $numpages = $a->pager['total'] / $a->pager['itemspage'];
@ -335,8 +336,8 @@ function paginate_data(App $a, $count = null) {
$data['pages'] = $pages; $data['pages'] = $pages;
$lastpage = (($numpages > intval($numpages)) ? intval($numpages)+1 : $numpages); $lastpage = (($numpages > intval($numpages)) ? intval($numpages)+1 : $numpages);
_l($data, 'next', $url . '&page=' . ($a->pager['page'] + 1), t('next'), $a->pager['page'] == $lastpage ? 'disabled' : ''); _l($data, 'next', $url . '&page=' . ($a->pager['page'] + 1), L10n::t('next'), $a->pager['page'] == $lastpage ? 'disabled' : '');
_l($data, 'last', $url . '&page=' . $lastpage, t('last'), $a->pager['page'] == $lastpage ? 'disabled' : ''); _l($data, 'last', $url . '&page=' . $lastpage, L10n::t('last'), $a->pager['page'] == $lastpage ? 'disabled' : '');
} }
} }
@ -390,8 +391,8 @@ function alt_pager(App $a, $i) {
function scroll_loader() { function scroll_loader() {
$tpl = get_markup_template("scroll_loader.tpl"); $tpl = get_markup_template("scroll_loader.tpl");
return replace_macros($tpl, [ return replace_macros($tpl, [
'wait' => t('Loading more entries...'), 'wait' => L10n::t('Loading more entries...'),
'end' => t('The end') 'end' => L10n::t('The end')
]); ]);
} }
@ -927,7 +928,7 @@ function contact_block() {
$total = intval($r[0]['total']); $total = intval($r[0]['total']);
} }
if (!$total) { if (!$total) {
$contacts = t('No contacts'); $contacts = L10n::t('No contacts');
$micropro = null; $micropro = null;
} else { } else {
// Splitting the query in two parts makes it much faster // Splitting the query in two parts makes it much faster
@ -951,10 +952,10 @@ function contact_block() {
dbesc(implode(",", $contacts))); dbesc(implode(",", $contacts)));
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
$contacts = sprintf(tt('%d Contact','%d Contacts', $total),$total); $contacts = L10n::tt('%d Contact', '%d Contacts', $total);
$micropro = []; $micropro = [];
foreach ($r as $rr) { foreach ($r as $rr) {
$micropro[] = micropro($rr,true,'mpfriend'); $micropro[] = micropro($rr, true, 'mpfriend');
} }
} }
} }
@ -964,7 +965,7 @@ function contact_block() {
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$contacts' => $contacts, '$contacts' => $contacts,
'$nickname' => $a->profile['nickname'], '$nickname' => $a->profile['nickname'],
'$viewcontacts' => t('View Contacts'), '$viewcontacts' => L10n::t('View Contacts'),
'$micropro' => $micropro, '$micropro' => $micropro,
]); ]);
@ -1053,27 +1054,27 @@ function search($s, $id = 'search-box', $url = 'search', $save = false, $aside =
if (strpos($s, '#') === 0) { if (strpos($s, '#') === 0) {
$mode = 'tag'; $mode = 'tag';
} }
$save_label = $mode === 'text' ? t('Save') : t('Follow'); $save_label = $mode === 'text' ? L10n::t('Save') : L10n::t('Follow');
$values = [ $values = [
'$s' => htmlspecialchars($s), '$s' => htmlspecialchars($s),
'$id' => $id, '$id' => $id,
'$action_url' => $url, '$action_url' => $url,
'$search_label' => t('Search'), '$search_label' => L10n::t('Search'),
'$save_label' => $save_label, '$save_label' => $save_label,
'$savedsearch' => Feature::isEnabled(local_user(),'savedsearch'), '$savedsearch' => Feature::isEnabled(local_user(),'savedsearch'),
'$search_hint' => t('@name, !forum, #tags, content'), '$search_hint' => L10n::t('@name, !forum, #tags, content'),
'$mode' => $mode '$mode' => $mode
]; ];
if (!$aside) { if (!$aside) {
$values['$searchoption'] = [ $values['$searchoption'] = [
t("Full Text"), L10n::t("Full Text"),
t("Tags"), L10n::t("Tags"),
t("Contacts")]; L10n::t("Contacts")];
if (Config::get('system','poco_local_search')) { if (Config::get('system','poco_local_search')) {
$values['$searchoption'][] = t("Forums"); $values['$searchoption'][] = L10n::t("Forums");
} }
} }
@ -1117,12 +1118,12 @@ function get_poke_verbs() {
// value is array containing past tense verb, translation of present, translation of past // value is array containing past tense verb, translation of present, translation of past
$arr = [ $arr = [
'poke' => ['poked', t('poke'), t('poked')], 'poke' => ['poked', L10n::t('poke'), L10n::t('poked')],
'ping' => ['pinged', t('ping'), t('pinged')], 'ping' => ['pinged', L10n::t('ping'), L10n::t('pinged')],
'prod' => ['prodded', t('prod'), t('prodded')], 'prod' => ['prodded', L10n::t('prod'), L10n::t('prodded')],
'slap' => ['slapped', t('slap'), t('slapped')], 'slap' => ['slapped', L10n::t('slap'), L10n::t('slapped')],
'finger' => ['fingered', t('finger'), t('fingered')], 'finger' => ['fingered', L10n::t('finger'), L10n::t('fingered')],
'rebuff' => ['rebuffed', t('rebuff'), t('rebuffed')], 'rebuff' => ['rebuffed', L10n::t('rebuff'), L10n::t('rebuffed')],
]; ];
Addon::callHooks('poke_verbs', $arr); Addon::callHooks('poke_verbs', $arr);
return $arr; return $arr;
@ -1136,11 +1137,11 @@ function get_poke_verbs() {
*/ */
function day_translate($s) { function day_translate($s) {
$ret = str_replace(['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'], $ret = str_replace(['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],
[t('Monday'), t('Tuesday'), t('Wednesday'), t('Thursday'), t('Friday'), t('Saturday'), t('Sunday')], [L10n::t('Monday'), L10n::t('Tuesday'), L10n::t('Wednesday'), L10n::t('Thursday'), L10n::t('Friday'), L10n::t('Saturday'), L10n::t('Sunday')],
$s); $s);
$ret = str_replace(['January','February','March','April','May','June','July','August','September','October','November','December'], $ret = str_replace(['January','February','March','April','May','June','July','August','September','October','November','December'],
[t('January'), t('February'), t('March'), t('April'), t('May'), t('June'), t('July'), t('August'), t('September'), t('October'), t('November'), t('December')], [L10n::t('January'), L10n::t('February'), L10n::t('March'), L10n::t('April'), L10n::t('May'), L10n::t('June'), L10n::t('July'), L10n::t('August'), L10n::t('September'), L10n::t('October'), L10n::t('November'), L10n::t('December')],
$ret); $ret);
return $ret; return $ret;
@ -1154,10 +1155,10 @@ function day_translate($s) {
*/ */
function day_short_translate($s) { function day_short_translate($s) {
$ret = str_replace(['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], $ret = str_replace(['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
[t('Mon'), t('Tue'), t('Wed'), t('Thu'), t('Fri'), t('Sat'), t('Sun')], [L10n::t('Mon'), L10n::t('Tue'), L10n::t('Wed'), L10n::t('Thu'), L10n::t('Fri'), L10n::t('Sat'), L10n::t('Sun')],
$s); $s);
$ret = str_replace(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov','Dec'], $ret = str_replace(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov','Dec'],
[t('Jan'), t('Feb'), t('Mar'), t('Apr'), t('May'), ('Jun'), t('Jul'), t('Aug'), t('Sep'), t('Oct'), t('Nov'), t('Dec')], [L10n::t('Jan'), L10n::t('Feb'), L10n::t('Mar'), L10n::t('Apr'), L10n::t('May'), ('Jun'), L10n::t('Jul'), L10n::t('Aug'), L10n::t('Sep'), L10n::t('Oct'), L10n::t('Nov'), L10n::t('Dec')],
$ret); $ret);
return $ret; return $ret;
} }
@ -1358,7 +1359,7 @@ function prepare_body(&$item, $attach = false, $preview = false) {
$as .= replace_macros(get_markup_template('video_top.tpl'), [ $as .= replace_macros(get_markup_template('video_top.tpl'), [
'$video' => [ '$video' => [
'id' => $id, 'id' => $id,
'title' => t('View Video'), 'title' => L10n::t('View Video'),
'src' => $the_url, 'src' => $the_url,
'mime' => $mime, 'mime' => $mime,
], ],
@ -1375,7 +1376,7 @@ function prepare_body(&$item, $attach = false, $preview = false) {
} }
$title = ((strlen(trim($mtch[4]))) ? escape_tags(trim($mtch[4])) : escape_tags($mtch[1])); $title = ((strlen(trim($mtch[4]))) ? escape_tags(trim($mtch[4])) : escape_tags($mtch[1]));
$title .= ' ' . $mtch[2] . ' ' . t('bytes'); $title .= ' ' . $mtch[2] . ' ' . L10n::t('bytes');
$icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>'; $icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>';
$as .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" >' . $icon . '</a>'; $as .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" >' . $icon . '</a>';
@ -1410,7 +1411,7 @@ function prepare_body(&$item, $attach = false, $preview = false) {
while ((strpos($s, $spoilersearch) !== false)) { while ((strpos($s, $spoilersearch) !== false)) {
$pos = strpos($s, $spoilersearch); $pos = strpos($s, $spoilersearch);
$rnd = random_string(8); $rnd = random_string(8);
$spoilerreplace = '<br /> <span id="spoiler-wrap-' . $rnd . '" class="spoiler-wrap fakelink" onclick="openClose(\'spoiler-' . $rnd . '\');">' . sprintf(t('Click to open/close')) . '</span>'. $spoilerreplace = '<br /> <span id="spoiler-wrap-' . $rnd . '" class="spoiler-wrap fakelink" onclick="openClose(\'spoiler-' . $rnd . '\');">' . L10n::t('Click to open/close') . '</span>'.
'<blockquote class="spoiler" id="spoiler-' . $rnd . '" style="display: none;">'; '<blockquote class="spoiler" id="spoiler-' . $rnd . '" style="display: none;">';
$s = substr($s, 0, $pos) . $spoilerreplace . substr($s, $pos + strlen($spoilersearch)); $s = substr($s, 0, $pos) . $spoilerreplace . substr($s, $pos + strlen($spoilersearch));
} }
@ -1421,7 +1422,7 @@ function prepare_body(&$item, $attach = false, $preview = false) {
while ((strpos($s, $authorsearch) !== false)) { while ((strpos($s, $authorsearch) !== false)) {
$pos = strpos($s, $authorsearch); $pos = strpos($s, $authorsearch);
$rnd = random_string(8); $rnd = random_string(8);
$authorreplace = '<br /> <span id="author-wrap-' . $rnd . '" class="author-wrap fakelink" onclick="openClose(\'author-' . $rnd . '\');">' . sprintf(t('Click to open/close')) . '</span>'. $authorreplace = '<br /> <span id="author-wrap-' . $rnd . '" class="author-wrap fakelink" onclick="openClose(\'author-' . $rnd . '\');">' . L10n::t('Click to open/close') . '</span>'.
'<blockquote class="author" id="author-' . $rnd . '" style="display: block;">'; '<blockquote class="author" id="author-' . $rnd . '" style="display: block;">';
$s = substr($s, 0, $pos) . $authorreplace . substr($s, $pos + strlen($authorsearch)); $s = substr($s, 0, $pos) . $authorreplace . substr($s, $pos + strlen($authorsearch));
} }
@ -1548,20 +1549,20 @@ function get_plink($item) {
//'href' => "display/" . $a->user['nickname'] . "/" . $item['id'], //'href' => "display/" . $a->user['nickname'] . "/" . $item['id'],
'href' => "display/" . $item['guid'], 'href' => "display/" . $item['guid'],
'orig' => "display/" . $item['guid'], 'orig' => "display/" . $item['guid'],
'title' => t('View on separate page'), 'title' => L10n::t('View on separate page'),
'orig_title' => t('view on separate page'), 'orig_title' => L10n::t('view on separate page'),
]; ];
if (x($item, 'plink')) { if (x($item, 'plink')) {
$ret["href"] = $a->remove_baseurl($item['plink']); $ret["href"] = $a->remove_baseurl($item['plink']);
$ret["title"] = t('link to source'); $ret["title"] = L10n::t('link to source');
} }
} elseif (x($item, 'plink') && ($item['private'] != 1)) { } elseif (x($item, 'plink') && ($item['private'] != 1)) {
$ret = [ $ret = [
'href' => $item['plink'], 'href' => $item['plink'],
'orig' => $item['plink'], 'orig' => $item['plink'],
'title' => t('link to source'), 'title' => L10n::t('link to source'),
]; ];
} else { } else {
$ret = []; $ret = [];
@ -1763,16 +1764,16 @@ function reltoabs($text, $base) {
*/ */
function item_post_type($item) { function item_post_type($item) {
if (intval($item['event-id'])) { if (intval($item['event-id'])) {
return t('event'); return L10n::t('event');
} elseif (strlen($item['resource-id'])) { } elseif (strlen($item['resource-id'])) {
return t('photo'); return L10n::t('photo');
} elseif (strlen($item['verb']) && $item['verb'] !== ACTIVITY_POST) { } elseif (strlen($item['verb']) && $item['verb'] !== ACTIVITY_POST) {
return t('activity'); return L10n::t('activity');
} elseif ($item['id'] != $item['parent']) { } elseif ($item['id'] != $item['parent']) {
return t('comment'); return L10n::t('comment');
} }
return t('post'); return L10n::t('post');
} }
// post categories and "save to file" use the same item.file table for storage. // post categories and "save to file" use the same item.file table for storage.
@ -1935,7 +1936,7 @@ function file_tag_save_file($uid, $item, $file)
if (!strlen($saved) || !stristr($saved, '[' . file_tag_encode($file) . ']')) { if (!strlen($saved) || !stristr($saved, '[' . file_tag_encode($file) . ']')) {
PConfig::set($uid, 'system', 'filetags', $saved . '[' . file_tag_encode($file) . ']'); PConfig::set($uid, 'system', 'filetags', $saved . '[' . file_tag_encode($file) . ']');
} }
info(t('Item filed')); info(L10n::t('Item filed'));
} }
return true; return true;
} }

View file

@ -15,6 +15,7 @@ use Friendica\Core\Addon;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Theme; use Friendica\Core\Theme;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Profile; use Friendica\Model\Profile;
@ -83,9 +84,9 @@ if (!$install) {
$maintenance = Config::get('system', 'maintenance'); $maintenance = Config::get('system', 'maintenance');
} }
$lang = get_browser_language(); $lang = L10n::getBrowserLanguage();
load_translation_table($lang); L10n::loadTranslationTable($lang);
/** /**
* Important stuff we always need to do. * Important stuff we always need to do.
@ -121,7 +122,7 @@ if (x($_SESSION, 'authenticated') && !x($_SESSION, 'language')) {
if ((x($_SESSION, 'language')) && ($_SESSION['language'] !== $lang)) { if ((x($_SESSION, 'language')) && ($_SESSION['language'] !== $lang)) {
$lang = $_SESSION['language']; $lang = $_SESSION['language'];
load_translation_table($lang); L10n::loadTranslationTable($lang);
} }
if ((x($_GET, 'zrl')) && (!$install && !$maintenance)) { if ((x($_GET, 'zrl')) && (!$install && !$maintenance)) {
@ -246,7 +247,7 @@ if (strlen($a->module)) {
if (is_array($a->addons) && in_array($a->module, $a->addons) && file_exists("addon/{$a->module}/{$a->module}.php")) { if (is_array($a->addons) && in_array($a->module, $a->addons) && file_exists("addon/{$a->module}/{$a->module}.php")) {
//Check if module is an app and if public access to apps is allowed or not //Check if module is an app and if public access to apps is allowed or not
if ((!local_user()) && Addon::isApp($a->module) && $privateapps === "1") { if ((!local_user()) && Addon::isApp($a->module) && $privateapps === "1") {
info(t("You must be logged in to use addons. ")); info(L10n::t("You must be logged in to use addons. "));
} else { } else {
include_once "addon/{$a->module}/{$a->module}.php"; include_once "addon/{$a->module}/{$a->module}.php";
if (function_exists($a->module . '_module')) { if (function_exists($a->module . '_module')) {
@ -293,12 +294,12 @@ if (strlen($a->module)) {
} }
logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG); logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG);
header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found')); header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . L10n::t('Not Found'));
$tpl = get_markup_template("404.tpl"); $tpl = get_markup_template("404.tpl");
$a->page['content'] = replace_macros( $a->page['content'] = replace_macros(
$tpl, $tpl,
[ [
'$message' => t('Page not found.')] '$message' => L10n::t('Page not found.')]
); );
} }
} }
@ -416,8 +417,8 @@ if (isset($homebase)) {
* now that we've been through the module content, see if the page reported * now that we've been through the module content, see if the page reported
* a permission problem and if so, a 403 response would seem to be in order. * a permission problem and if so, a 403 response would seem to be in order.
*/ */
if (stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) { if (stristr(implode("", $_SESSION['sysmsg']), L10n::t('Permission denied'))) {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 ' . t('Permission denied.')); header($_SERVER["SERVER_PROTOCOL"] . ' 403 ' . L10n::t('Permission denied.'));
} }
/* /*
@ -445,7 +446,7 @@ if ($a->is_mobile || $a->is_tablet) {
get_markup_template("toggle_mobile_footer.tpl"), get_markup_template("toggle_mobile_footer.tpl"),
[ [
'$toggle_link' => $link, '$toggle_link' => $link,
'$toggle_text' => t('toggle mobile')] '$toggle_text' => L10n::t('toggle mobile')]
); );
} }

File diff suppressed because it is too large Load diff

View file

@ -4,12 +4,12 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\ContactSelector; use Friendica\Content\ContactSelector;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\GContact; use Friendica\Model\GContact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use dba;
require_once 'include/dba.php'; require_once 'include/dba.php';
require_once 'mod/contacts.php'; require_once 'mod/contacts.php';
@ -18,7 +18,7 @@ function allfriends_content(App $a)
{ {
$o = ''; $o = '';
if (!local_user()) { if (!local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -48,7 +48,7 @@ function allfriends_content(App $a)
$r = GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']); $r = GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
$o .= t('No friends to display.'); $o .= L10n::t('No friends to display.');
return $o; return $o;
} }
@ -70,8 +70,8 @@ function allfriends_content(App $a)
} else { } else {
$connlnk = System::baseUrl() . '/follow/?url=' . $rr['url']; $connlnk = System::baseUrl() . '/follow/?url=' . $rr['url'];
$photo_menu = [ $photo_menu = [
'profile' => [t("View Profile"), Profile::zrl($rr['url'])], 'profile' => [L10n::t("View Profile"), Profile::zrl($rr['url'])],
'follow' => [t("Connect/Follow"), $connlnk] 'follow' => [L10n::t("Connect/Follow"), $connlnk]
]; ];
} }
@ -87,7 +87,7 @@ function allfriends_content(App $a)
'account_type' => Contact::getAccountType($contact_details), 'account_type' => Contact::getAccountType($contact_details),
'network' => ContactSelector::networkToName($contact_details['network'], $contact_details['url']), 'network' => ContactSelector::networkToName($contact_details['network'], $contact_details['url']),
'photo_menu' => $photo_menu, 'photo_menu' => $photo_menu,
'conntxt' => t('Connect'), 'conntxt' => L10n::t('Connect'),
'connlnk' => $connlnk, 'connlnk' => $connlnk,
'id' => ++$id, 'id' => ++$id,
]; ];
@ -99,7 +99,7 @@ function allfriends_content(App $a)
$tpl = get_markup_template('viewcontact_template.tpl'); $tpl = get_markup_template('viewcontact_template.tpl');
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
//'$title' => sprintf( t('Friends of %s'), htmlentities($c[0]['name'])), //'$title' => L10n::t('Friends of %s', htmlentities($c[0]['name'])),
'$tab_str' => $tab_str, '$tab_str' => $tab_str,
'$contacts' => $entries, '$contacts' => $entries,
'$paginate' => paginate($a), '$paginate' => paginate($a),

View file

@ -1,11 +1,14 @@
<?php <?php
/**
* @file mod/api.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Module\Login; use Friendica\Module\Login;
require_once('include/api.php'); require_once 'include/api.php';
function oauth_get_client($request) function oauth_get_client($request)
{ {
@ -19,8 +22,9 @@ function oauth_get_client($request)
WHERE `clients`.`client_id`=`tokens`.`client_id` WHERE `clients`.`client_id`=`tokens`.`client_id`
AND `tokens`.`id`='%s' AND `tokens`.`scope`='request'", dbesc($token)); AND `tokens`.`id`='%s' AND `tokens`.`scope`='request'", dbesc($token));
if (!DBM::is_result($r)) if (!DBM::is_result($r)) {
return null; return null;
}
return $r[0]; return $r[0];
} }
@ -28,12 +32,12 @@ function oauth_get_client($request)
function api_post(App $a) function api_post(App $a)
{ {
if (!local_user()) { if (!local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
if (count($a->user) && x($a->user, 'uid') && $a->user['uid'] != local_user()) { if (count($a->user) && x($a->user, 'uid') && $a->user['uid'] != local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
} }
@ -78,8 +82,8 @@ function api_content(App $a)
$tpl = get_markup_template("oauth_authorize_done.tpl"); $tpl = get_markup_template("oauth_authorize_done.tpl");
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$title' => t('Authorize application connection'), '$title' => L10n::t('Authorize application connection'),
'$info' => t('Return to your app and insert this Securty Code:'), '$info' => L10n::t('Return to your app and insert this Securty Code:'),
'$code' => $verifier, '$code' => $verifier,
]); ]);
@ -88,7 +92,7 @@ function api_content(App $a)
if (!local_user()) { if (!local_user()) {
/// @TODO We need login form to redirect to this page /// @TODO We need login form to redirect to this page
notice(t('Please login to continue.') . EOL); notice(L10n::t('Please login to continue.') . EOL);
return Login::form($a->query_string, false, $request->get_parameters()); return Login::form($a->query_string, false, $request->get_parameters());
} }
//FKOAuth1::loginUser(4); //FKOAuth1::loginUser(4);
@ -100,11 +104,11 @@ function api_content(App $a)
$tpl = get_markup_template('oauth_authorize.tpl'); $tpl = get_markup_template('oauth_authorize.tpl');
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$title' => t('Authorize application connection'), '$title' => L10n::t('Authorize application connection'),
'$app' => $app, '$app' => $app,
'$authorize' => t('Do you want to authorize this application to access your posts and contacts, and/or create new posts for you?'), '$authorize' => L10n::t('Do you want to authorize this application to access your posts and contacts, and/or create new posts for you?'),
'$yes' => t('Yes'), '$yes' => L10n::t('Yes'),
'$no' => t('No'), '$no' => L10n::t('No'),
]); ]);
return $o; return $o;

View file

@ -1,21 +1,25 @@
<?php <?php
/**
* @file mod/apps.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
function apps_content(App $a) { function apps_content(App $a)
{
$privateaddons = Config::get('config', 'private_addons'); $privateaddons = Config::get('config', 'private_addons');
if ($privateaddons === "1") { if ($privateaddons === "1") {
if (! local_user()) { if (! local_user()) {
info(t('You must be logged in to use addons. ')); info(L10n::t('You must be logged in to use addons. '));
return; return;
}; };
} }
$title = t('Applications'); $title = L10n::t('Applications');
if (count($a->apps) == 0) { if (count($a->apps) == 0) {
notice(t('No installed applications.') . EOL); notice(L10n::t('No installed applications.') . EOL);
} }
$tpl = get_markup_template('apps.tpl'); $tpl = get_markup_template('apps.tpl');

View file

@ -1,14 +1,18 @@
<?php <?php
/**
* @file mod/attach.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Database\DBM; use Friendica\Database\DBM;
require_once('include/security.php'); require_once 'include/dba.php';
require_once 'include/security.php';
function attach_init(App $a) { function attach_init(App $a)
{
if($a->argc != 2) { if ($a->argc != 2) {
notice( t('Item not available.') . EOL); notice(L10n::t('Item not available.') . EOL);
return; return;
} }
@ -16,15 +20,13 @@ function attach_init(App $a) {
// Check for existence, which will also provide us the owner uid // Check for existence, which will also provide us the owner uid
$r = q("SELECT * FROM `attach` WHERE `id` = %d LIMIT 1", $r = dba::selectFirst('attach', [], ['id' => $item_id]);
intval($item_id) if (!DBM::is_result($r)) {
); notice(L10n::t('Item was not found.'). EOL);
if (! DBM::is_result($r)) {
notice( t('Item was not found.'). EOL);
return; return;
} }
$sql_extra = permissions_sql($r[0]['uid']); $sql_extra = permissions_sql($r['uid']);
// Now we'll see if we can access the attachment // Now we'll see if we can access the attachment
@ -32,8 +34,8 @@ function attach_init(App $a) {
dbesc($item_id) dbesc($item_id)
); );
if (! DBM::is_result($r)) { if (!DBM::is_result($r)) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -41,10 +43,11 @@ function attach_init(App $a) {
// error in Chrome for filenames with commas in them // error in Chrome for filenames with commas in them
header('Content-type: ' . $r[0]['filetype']); header('Content-type: ' . $r[0]['filetype']);
header('Content-length: ' . $r[0]['filesize']); header('Content-length: ' . $r[0]['filesize']);
if(isset($_GET['attachment']) && $_GET['attachment'] === '0') if (isset($_GET['attachment']) && $_GET['attachment'] === '0') {
header('Content-disposition: filename="' . $r[0]['filename'] . '"'); header('Content-disposition: filename="' . $r[0]['filename'] . '"');
else } else {
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();

View file

@ -1,11 +1,13 @@
<?php <?php
/**
* @file mod/babel.php
*/
use Friendica\Content\Text\Markdown; use Friendica\Content\Text\Markdown;
use Friendica\Core\L10n;
require_once 'include/bbcode.php'; require_once 'include/bbcode.php';
require_once 'include/bb2diaspora.php'; require_once 'include/bb2diaspora.php';
require_once 'include/html2bbcode.php'; require_once 'include/html2bbcode.php';
require_once 'include/pgettext.php';
function visible_lf($s) function visible_lf($s)
{ {
@ -17,14 +19,14 @@ function babel_content()
$o = '<h1>Babel Diagnostic</h1>'; $o = '<h1>Babel Diagnostic</h1>';
$o .= '<form action="babel" method="post">'; $o .= '<form action="babel" method="post">';
$o .= t('Source (bbcode) text:') . EOL; $o .= L10n::t('Source (bbcode) text:') . EOL;
$o .= '<textarea name="text" cols="80" rows="10">' . htmlspecialchars($_REQUEST['text']) . '</textarea>' . EOL; $o .= '<textarea name="text" cols="80" rows="10">' . htmlspecialchars($_REQUEST['text']) . '</textarea>' . EOL;
$o .= '<input type="submit" name="submit" value="Submit" /></form>'; $o .= '<input type="submit" name="submit" value="Submit" /></form>';
$o .= '<br /><br />'; $o .= '<br /><br />';
$o .= '<form action="babel" method="post">'; $o .= '<form action="babel" method="post">';
$o .= t('Source (Diaspora) text to convert to BBcode:') . EOL; $o .= L10n::t('Source (Diaspora) text to convert to BBcode:') . EOL;
$o .= '<textarea name="d2bbtext" cols="80" rows="10">' . htmlspecialchars($_REQUEST['d2bbtext']) . '</textarea>' . EOL; $o .= '<textarea name="d2bbtext" cols="80" rows="10">' . htmlspecialchars($_REQUEST['d2bbtext']) . '</textarea>' . EOL;
$o .= '<input type="submit" name="submit" value="Submit" /></form>'; $o .= '<input type="submit" name="submit" value="Submit" /></form>';
@ -32,45 +34,45 @@ function babel_content()
if (x($_REQUEST, 'text')) { if (x($_REQUEST, 'text')) {
$text = trim($_REQUEST['text']); $text = trim($_REQUEST['text']);
$o .= '<h2>' . t('Source input: ') . '</h2>' . EOL . EOL; $o .= '<h2>' . L10n::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 .= '<h2>' . t('bbcode (raw HTML): ') . '</h2>' . EOL . EOL; $o .= '<h2>' . L10n::t('bbcode (raw HTML): ') . '</h2>' . EOL . EOL;
$o .= htmlspecialchars($html) . EOL . EOL; $o .= htmlspecialchars($html) . EOL . EOL;
//$html = bbcode($text); //$html = bbcode($text);
$o .= '<h2>' . t('bbcode: ') . '</h2>' . EOL . EOL; $o .= '<h2>' . L10n::t('bbcode: ') . '</h2>' . EOL . EOL;
$o .= $html . EOL . EOL; $o .= $html . EOL . EOL;
$bbcode = html2bbcode($html); $bbcode = html2bbcode($html);
$o .= '<h2>' . t('bbcode => html2bbcode: ') . '</h2>' . EOL . EOL; $o .= '<h2>' . L10n::t('bbcode => html2bbcode: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($bbcode) . EOL . EOL; $o .= visible_lf($bbcode) . EOL . EOL;
$diaspora = bb2diaspora($text); $diaspora = bb2diaspora($text);
$o .= '<h2>' . t('bb2diaspora: ') . '</h2>' . EOL . EOL; $o .= '<h2>' . L10n::t('bb2diaspora: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($diaspora) . EOL . EOL; $o .= visible_lf($diaspora) . EOL . EOL;
$html = Markdown::convert($diaspora); $html = Markdown::convert($diaspora);
$o .= '<h2>' . t('bb2diaspora => Markdown: ') . '</h2>' . EOL . EOL; $o .= '<h2>' . L10n::t('bb2diaspora => Markdown: ') . '</h2>' . EOL . EOL;
$o .= $html . EOL . EOL; $o .= $html . EOL . EOL;
$bbcode = diaspora2bb($diaspora); $bbcode = diaspora2bb($diaspora);
$o .= '<h2>' . t('bb2diaspora => diaspora2bb: ') . '</h2>' . EOL . EOL; $o .= '<h2>' . L10n::t('bb2diaspora => diaspora2bb: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($bbcode) . EOL . EOL; $o .= visible_lf($bbcode) . EOL . EOL;
$bbcode = html2bbcode($html); $bbcode = html2bbcode($html);
$o .= '<h2>' . t('bbcode => html2bbcode: ') . '</h2>' . EOL . EOL; $o .= '<h2>' . L10n::t('bbcode => html2bbcode: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($bbcode) . EOL . EOL; $o .= visible_lf($bbcode) . EOL . EOL;
} }
if (x($_REQUEST, 'd2bbtext')) { if (x($_REQUEST, 'd2bbtext')) {
$d2bbtext = trim($_REQUEST['d2bbtext']); $d2bbtext = trim($_REQUEST['d2bbtext']);
$o .= '<h2>' . t('Source input (Diaspora format): ') . '</h2>' . EOL . EOL; $o .= '<h2>' . L10n::t('Source input (Diaspora format): ') . '</h2>' . EOL . EOL;
$o .= '<pre>' . $d2bbtext . '</pre>' . EOL . EOL; $o .= '<pre>' . $d2bbtext . '</pre>' . EOL . EOL;
$bb = diaspora2bb($d2bbtext); $bb = diaspora2bb($d2bbtext);
$o .= '<h2>' . t('diaspora2bb: ') . '</h2>' . EOL . EOL; $o .= '<h2>' . L10n::t('diaspora2bb: ') . '</h2>' . EOL . EOL;
$o .= '<pre>' . $bb . '</pre>' . EOL . EOL; $o .= '<pre>' . $bb . '</pre>' . EOL . EOL;
} }

View file

@ -1,11 +1,14 @@
<?php <?php
/**
* @file mod/bookmarklet.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Module\Login; use Friendica\Module\Login;
require_once('include/conversation.php'); require_once 'include/conversation.php';
require_once('include/items.php'); require_once 'include/items.php';
function bookmarklet_init() function bookmarklet_init()
{ {
@ -15,7 +18,7 @@ function bookmarklet_init()
function bookmarklet_content(App $a) function bookmarklet_content(App $a)
{ {
if (!local_user()) { if (!local_user()) {
$o = '<h2>' . t('Login') . '</h2>'; $o = '<h2>' . L10n::t('Login') . '</h2>';
$o .= Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? false : true); $o .= Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? false : true);
return $o; return $o;
} }
@ -43,7 +46,7 @@ function bookmarklet_content(App $a)
$o = status_editor($a, $x, 0, false); $o = status_editor($a, $x, 0, false);
$o .= "<script>window.resizeTo(800,550);</script>"; $o .= "<script>window.resizeTo(800,550);</script>";
} else { } else {
$o = '<h2>' . t('The post was created') . '</h2>'; $o = '<h2>' . L10n::t('The post was created') . '</h2>';
$o .= "<script>window.close()</script>"; $o .= "<script>window.close()</script>";
} }

View file

@ -9,6 +9,7 @@ use Friendica\App;
use Friendica\Content\Feature; use Friendica\Content\Feature;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -135,7 +136,7 @@ function cal_content(App $a)
$is_owner = local_user() == $a->profile['profile_uid']; $is_owner = local_user() == $a->profile['profile_uid'];
if ($a->profile['hidewall'] && (!$is_owner) && (!$remote_contact)) { if ($a->profile['hidewall'] && (!$is_owner) && (!$remote_contact)) {
notice(t('Access to this profile has been restricted.') . EOL); notice(L10n::t('Access to this profile has been restricted.') . EOL);
return; return;
} }
@ -267,17 +268,17 @@ function cal_content(App $a)
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$baseurl' => System::baseUrl(), '$baseurl' => System::baseUrl(),
'$tabs' => $tabs, '$tabs' => $tabs,
'$title' => t('Events'), '$title' => L10n::t('Events'),
'$view' => t('View'), '$view' => L10n::t('View'),
'$previous' => [System::baseUrl() . "/events/$prevyear/$prevmonth", t('Previous'), '', ''], '$previous' => [System::baseUrl() . "/events/$prevyear/$prevmonth", L10n::t('Previous'), '', ''],
'$next' => [System::baseUrl() . "/events/$nextyear/$nextmonth", t('Next'), '', ''], '$next' => [System::baseUrl() . "/events/$nextyear/$nextmonth", L10n::t('Next'), '', ''],
'$calendar' => cal($y, $m, $links, ' eventcal'), '$calendar' => cal($y, $m, $links, ' eventcal'),
'$events' => $events, '$events' => $events,
"today" => t("today"), "today" => L10n::t("today"),
"month" => t("month"), "month" => L10n::t("month"),
"week" => t("week"), "week" => L10n::t("week"),
"day" => t("day"), "day" => L10n::t("day"),
"list" => t("list"), "list" => L10n::t("list"),
]); ]);
if (x($_GET, 'id')) { if (x($_GET, 'id')) {
@ -290,14 +291,14 @@ function cal_content(App $a)
if ($mode == 'export') { if ($mode == 'export') {
if (!(intval($owner_uid))) { if (!(intval($owner_uid))) {
notice(t('User not found')); notice(L10n::t('User not found'));
return; return;
} }
// Test permissions // Test permissions
// Respect the export feature setting for all other /cal pages if it's not the own profile // Respect the export feature setting for all other /cal pages if it's not the own profile
if (((local_user() !== intval($owner_uid))) && !Feature::isEnabled($owner_uid, "export_calendar")) { if (((local_user() !== intval($owner_uid))) && !Feature::isEnabled($owner_uid, "export_calendar")) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
goaway('cal/' . $nick); goaway('cal/' . $nick);
} }
@ -306,9 +307,9 @@ function cal_content(App $a)
if (!$evexport["success"]) { if (!$evexport["success"]) {
if ($evexport["content"]) { if ($evexport["content"]) {
notice(t('This calendar format is not supported')); notice(L10n::t('This calendar format is not supported'));
} else { } else {
notice(t('No exportable data found')); notice(L10n::t('No exportable data found'));
} }
// If it the own calendar return to the events page // If it the own calendar return to the events page
@ -325,7 +326,7 @@ function cal_content(App $a)
// If nothing went wrong we can echo the export content // If nothing went wrong we can echo the export content
if ($evexport["success"]) { if ($evexport["success"]) {
header('Content-type: text/calendar'); header('Content-type: text/calendar');
header('content-disposition: attachment; filename="' . t('calendar') . '-' . $nick . '.' . $evexport["extension"] . '"'); header('content-disposition: attachment; filename="' . L10n::t('calendar') . '-' . $nick . '.' . $evexport["extension"] . '"');
echo $evexport["content"]; echo $evexport["content"];
killme(); killme();
} }

View file

@ -4,11 +4,11 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\ContactSelector; use Friendica\Content\ContactSelector;
use Friendica\Core\L10n;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\GContact; use Friendica\Model\GContact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use dba;
require_once 'include/dba.php'; require_once 'include/dba.php';
require_once 'mod/contacts.php'; require_once 'mod/contacts.php';
@ -23,7 +23,7 @@ function common_content(App $a)
$zcid = 0; $zcid = 0;
if (!local_user()) { if (!local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -88,7 +88,7 @@ function common_content(App $a)
if ($t > 0) { if ($t > 0) {
$a->set_pager_total($t); $a->set_pager_total($t);
} else { } else {
notice(t('No contacts in common.') . EOL); notice(L10n::t('No contacts in common.') . EOL);
return $o; return $o;
} }
@ -137,7 +137,7 @@ function common_content(App $a)
if ($cmd === 'loc' && $cid && local_user() == $uid) { if ($cmd === 'loc' && $cid && local_user() == $uid) {
$tab_str = contacts_tab($a, $cid, 4); $tab_str = contacts_tab($a, $cid, 4);
} else { } else {
$title = t('Common Friends'); $title = L10n::t('Common Friends');
} }
$tpl = get_markup_template('viewcontact_template.tpl'); $tpl = get_markup_template('viewcontact_template.tpl');

View file

@ -5,6 +5,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -21,7 +22,7 @@ function community_content(App $a, $update = 0)
$o = ''; $o = '';
if (Config::get('system', 'block_public') && !local_user() && !remote_user()) { if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
notice(t('Public access denied.') . EOL); notice(L10n::t('Public access denied.') . EOL);
return; return;
} }
@ -30,7 +31,7 @@ function community_content(App $a, $update = 0)
if ($a->argc > 1) { if ($a->argc > 1) {
$content = $a->argv[1]; $content = $a->argv[1];
} else { } else {
if (!empty(Config::get('system','singleuser'))) { if (!empty(Config::get('system', 'singleuser'))) {
// On single user systems only the global page does make sense // On single user systems only the global page does make sense
$content = 'global'; $content = 'global';
} else { } else {
@ -40,7 +41,7 @@ function community_content(App $a, $update = 0)
} }
if (!in_array($content, ['local', 'global'])) { if (!in_array($content, ['local', 'global'])) {
notice(t('Community option not available.') . EOL); notice(L10n::t('Community option not available.') . EOL);
return; return;
} }
@ -57,7 +58,7 @@ function community_content(App $a, $update = 0)
} }
if (!$available) { if (!$available) {
notice(t('Not available.') . EOL); notice(L10n::t('Not available.') . EOL);
return; return;
} }
} }
@ -69,12 +70,12 @@ function community_content(App $a, $update = 0)
if (!$update) { if (!$update) {
$tabs = []; $tabs = [];
if ((local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(Config::get('system','singleuser'))) { if ((local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(Config::get('system', 'singleuser'))) {
$tabs[] = [ $tabs[] = [
'label' => t('Community'), 'label' => L10n::t('Community'),
'url' => 'community/local', 'url' => 'community/local',
'sel' => $content == 'local' ? 'active' : '', 'sel' => $content == 'local' ? 'active' : '',
'title' => t('Posts from local users on this server'), 'title' => L10n::t('Posts from local users on this server'),
'id' => 'community-local-tab', 'id' => 'community-local-tab',
'accesskey' => 'l' 'accesskey' => 'l'
]; ];
@ -82,10 +83,10 @@ function community_content(App $a, $update = 0)
if (local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_GLOBAL_COMMUNITY])) { if (local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_GLOBAL_COMMUNITY])) {
$tabs[] = [ $tabs[] = [
'label' => t('Global Timeline'), 'label' => L10n::t('Global Timeline'),
'url' => 'community/global', 'url' => 'community/global',
'sel' => $content == 'global' ? 'active' : '', 'sel' => $content == 'global' ? 'active' : '',
'title' => t('Posts from users of the federated network'), 'title' => L10n::t('Posts from users of the federated network'),
'id' => 'community-global-tab', 'id' => 'community-global-tab',
'accesskey' => 'g' 'accesskey' => 'g'
]; ];
@ -134,7 +135,7 @@ function community_content(App $a, $update = 0)
$r = community_getitems($a->pager['start'], $a->pager['itemspage'], $content); $r = community_getitems($a->pager['start'], $a->pager['itemspage'], $content);
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
info(t('No results.') . EOL); info(L10n::t('No results.') . EOL);
return $o; return $o;
} }
@ -178,7 +179,7 @@ function community_content(App $a, $update = 0)
'$content' => $o, '$content' => $o,
'$header' => '', '$header' => '',
'$show_global_community_hint' => ($content == 'global') && Config::get('system', 'show_global_community_hint'), '$show_global_community_hint' => ($content == 'global') && Config::get('system', 'show_global_community_hint'),
'$global_community_hint' => t("This community stream shows all public posts received by this node. They may not reflect the opinions of this nodes users.") '$global_community_hint' => L10n::t("This community stream shows all public posts received by this node. They may not reflect the opinions of this nodes users.")
]); ]);
} }

View file

@ -7,6 +7,7 @@ use Friendica\Content\ContactSelector;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Content\Widget; use Friendica\Content\Widget;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -56,7 +57,7 @@ function contacts_init(App $a)
'$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? "redir/" . $a->data['contact']['id'] : $a->data['contact']['url'], '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? "redir/" . $a->data['contact']['id'] : $a->data['contact']['url'],
'$addr' => (($a->data['contact']['addr'] != "") ? ($a->data['contact']['addr']) : ""), '$addr' => (($a->data['contact']['addr'] != "") ? ($a->data['contact']['addr']) : ""),
'$network_name' => $networkname, '$network_name' => $networkname,
'$network' => t('Network:'), '$network' => L10n::t('Network:'),
'$account_type' => Contact::getAccountType($a->data['contact']) '$account_type' => Contact::getAccountType($a->data['contact'])
]); ]);
@ -142,7 +143,7 @@ function contacts_batch_actions(App $a)
} }
} }
if ($count_actions > 0) { if ($count_actions > 0) {
info(tt("%d contact edited.", "%d contacts edited.", $count_actions)); info(L10n::tt("%d contact edited.", "%d contacts edited.", $count_actions));
} }
if (x($_SESSION, 'return_url')) { if (x($_SESSION, 'return_url')) {
@ -169,7 +170,7 @@ function contacts_post(App $a)
} }
if (!dba::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) { if (!dba::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
notice(t('Could not access contact record.') . EOL); notice(L10n::t('Could not access contact record.') . EOL);
goaway('contacts'); goaway('contacts');
return; // NOTREACHED return; // NOTREACHED
} }
@ -179,7 +180,7 @@ function contacts_post(App $a)
$profile_id = intval($_POST['profile-assign']); $profile_id = intval($_POST['profile-assign']);
if ($profile_id) { if ($profile_id) {
if (!dba::exists('profile', ['id' => $profile_id, 'uid' => local_user()])) { if (!dba::exists('profile', ['id' => $profile_id, 'uid' => local_user()])) {
notice(t('Could not locate selected profile.') . EOL); notice(L10n::t('Could not locate selected profile.') . EOL);
return; return;
} }
} }
@ -213,9 +214,9 @@ function contacts_post(App $a)
intval(local_user()) intval(local_user())
); );
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
info(t('Contact updated.') . EOL); info(L10n::t('Contact updated.') . EOL);
} else { } else {
notice(t('Failed to update contact record.') . EOL); notice(L10n::t('Failed to update contact record.') . EOL);
} }
$contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]); $contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
@ -374,7 +375,7 @@ function contacts_content(App $a)
Nav::setSelected('contacts'); Nav::setSelected('contacts');
if (!local_user()) { if (!local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -388,7 +389,7 @@ function contacts_content(App $a)
$orig_record = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'self' => false]); $orig_record = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'self' => false]);
if (!DBM::is_result($orig_record)) { if (!DBM::is_result($orig_record)) {
notice(t('Could not access contact record.') . EOL); notice(L10n::t('Could not access contact record.') . EOL);
goaway('contacts'); goaway('contacts');
return; // NOTREACHED return; // NOTREACHED
} }
@ -409,7 +410,7 @@ function contacts_content(App $a)
$r = _contact_block($contact_id, $orig_record); $r = _contact_block($contact_id, $orig_record);
if ($r) { if ($r) {
$blocked = (($orig_record['blocked']) ? 0 : 1); $blocked = (($orig_record['blocked']) ? 0 : 1);
info((($blocked) ? t('Contact has been blocked') : t('Contact has been unblocked')) . EOL); info((($blocked) ? L10n::t('Contact has been blocked') : L10n::t('Contact has been unblocked')) . EOL);
} }
goaway('contacts/' . $contact_id); goaway('contacts/' . $contact_id);
@ -420,7 +421,7 @@ function contacts_content(App $a)
$r = _contact_ignore($contact_id, $orig_record); $r = _contact_ignore($contact_id, $orig_record);
if ($r) { if ($r) {
$readonly = (($orig_record['readonly']) ? 0 : 1); $readonly = (($orig_record['readonly']) ? 0 : 1);
info((($readonly) ? t('Contact has been ignored') : t('Contact has been unignored')) . EOL); info((($readonly) ? L10n::t('Contact has been ignored') : L10n::t('Contact has been unignored')) . EOL);
} }
goaway('contacts/' . $contact_id); goaway('contacts/' . $contact_id);
@ -431,7 +432,7 @@ function contacts_content(App $a)
$r = _contact_archive($contact_id, $orig_record); $r = _contact_archive($contact_id, $orig_record);
if ($r) { if ($r) {
$archived = (($orig_record['archive']) ? 0 : 1); $archived = (($orig_record['archive']) ? 0 : 1);
info((($archived) ? t('Contact has been archived') : t('Contact has been unarchived')) . EOL); info((($archived) ? L10n::t('Contact has been archived') : L10n::t('Contact has been unarchived')) . EOL);
} }
goaway('contacts/' . $contact_id); goaway('contacts/' . $contact_id);
@ -455,15 +456,15 @@ function contacts_content(App $a)
$a->page['aside'] = ''; $a->page['aside'] = '';
return replace_macros(get_markup_template('contact_drop_confirm.tpl'), [ return replace_macros(get_markup_template('contact_drop_confirm.tpl'), [
'$header' => t('Drop contact'), '$header' => L10n::t('Drop contact'),
'$contact' => _contact_detail_for_template($orig_record), '$contact' => _contact_detail_for_template($orig_record),
'$method' => 'get', '$method' => 'get',
'$message' => t('Do you really want to delete this contact?'), '$message' => L10n::t('Do you really want to delete this contact?'),
'$extra_inputs' => $inputs, '$extra_inputs' => $inputs,
'$confirm' => t('Yes'), '$confirm' => L10n::t('Yes'),
'$confirm_url' => $query['base'], '$confirm_url' => $query['base'],
'$confirm_name' => 'confirmed', '$confirm_name' => 'confirmed',
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
]); ]);
} }
// Now check how the user responded to the confirmation query // Now check how the user responded to the confirmation query
@ -476,7 +477,7 @@ function contacts_content(App $a)
} }
_contact_drop($orig_record); _contact_drop($orig_record);
info(t('Contact has been removed.') . EOL); info(L10n::t('Contact has been removed.') . EOL);
if (x($_SESSION, 'return_url')) { if (x($_SESSION, 'return_url')) {
goaway('' . $_SESSION['return_url']); goaway('' . $_SESSION['return_url']);
} else { } else {
@ -507,15 +508,15 @@ function contacts_content(App $a)
switch ($contact['rel']) { switch ($contact['rel']) {
case CONTACT_IS_FRIEND: case CONTACT_IS_FRIEND:
$dir_icon = 'images/lrarrow.gif'; $dir_icon = 'images/lrarrow.gif';
$relation_text = t('You are mutual friends with %s'); $relation_text = L10n::t('You are mutual friends with %s');
break; break;
case CONTACT_IS_FOLLOWER; case CONTACT_IS_FOLLOWER;
$dir_icon = 'images/larrow.gif'; $dir_icon = 'images/larrow.gif';
$relation_text = t('You are sharing with %s'); $relation_text = L10n::t('You are sharing with %s');
break; break;
case CONTACT_IS_SHARING; case CONTACT_IS_SHARING;
$dir_icon = 'images/rarrow.gif'; $dir_icon = 'images/rarrow.gif';
$relation_text = t('%s is sharing with you'); $relation_text = L10n::t('%s is sharing with you');
break; break;
default: default:
break; break;
@ -535,35 +536,35 @@ function contacts_content(App $a)
$sparkle = ''; $sparkle = '';
} }
$insecure = t('Private communications are not available for this contact.'); $insecure = L10n::t('Private communications are not available for this contact.');
$last_update = (($contact['last-update'] <= NULL_DATE) ? t('Never') : datetime_convert('UTC', date_default_timezone_get(), $contact['last-update'], 'D, j M Y, g:i A')); $last_update = (($contact['last-update'] <= NULL_DATE) ? L10n::t('Never') : datetime_convert('UTC', date_default_timezone_get(), $contact['last-update'], 'D, j M Y, g:i A'));
if ($contact['last-update'] > NULL_DATE) { if ($contact['last-update'] > NULL_DATE) {
$last_update .= ' ' . (($contact['last-update'] <= $contact['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29")); $last_update .= ' ' . (($contact['last-update'] <= $contact['success_update']) ? L10n::t("\x28Update was successful\x29") : L10n::t("\x28Update was not successful\x29"));
} }
$lblsuggest = (($contact['network'] === NETWORK_DFRN) ? t('Suggest friends') : ''); $lblsuggest = (($contact['network'] === NETWORK_DFRN) ? L10n::t('Suggest friends') : '');
$poll_enabled = in_array($contact['network'], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL]); $poll_enabled = in_array($contact['network'], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL]);
$nettype = t('Network type: %s', ContactSelector::networkToName($contact['network'], $contact["url"])); $nettype = L10n::t('Network type: %s', ContactSelector::networkToName($contact['network'], $contact["url"]));
// tabs // tabs
$tab_str = contacts_tab($a, $contact_id, 2); $tab_str = contacts_tab($a, $contact_id, 2);
$lost_contact = (($contact['archive'] && $contact['term-date'] > NULL_DATE && $contact['term-date'] < datetime_convert('', '', 'now')) ? t('Communications lost with this contact!') : ''); $lost_contact = (($contact['archive'] && $contact['term-date'] > NULL_DATE && $contact['term-date'] < datetime_converL10n::t('', '', 'now')) ? L10n::t('Communications lost with this contact!') : '');
$fetch_further_information = null; $fetch_further_information = null;
if ($contact['network'] == NETWORK_FEED) { if ($contact['network'] == NETWORK_FEED) {
$fetch_further_information = [ $fetch_further_information = [
'fetch_further_information', 'fetch_further_information',
t('Fetch further information for feeds'), L10n::t('Fetch further information for feeds'),
$contact['fetch_further_information'], $contact['fetch_further_information'],
t("Fetch information like preview pictures, title and teaser from the feed item. You can activate this if the feed doesn't contain much text. Keywords are taken from the meta header in the feed item and are posted as hash tags."), L10n::t("Fetch information like preview pictures, title and teaser from the feed item. You can activate this if the feed doesn't contain much text. Keywords are taken from the meta header in the feed item and are posted as hash tags."),
['0' => t('Disabled'), ['0' => L10n::t('Disabled'),
'1' => t('Fetch information'), '1' => L10n::t('Fetch information'),
'3' => t('Fetch keywords'), '3' => L10n::t('Fetch keywords'),
'2' => t('Fetch information and keywords') '2' => L10n::t('Fetch information and keywords')
] ]
]; ];
} }
@ -583,10 +584,10 @@ function contacts_content(App $a)
if (in_array($contact['network'], [NETWORK_DIASPORA, NETWORK_OSTATUS])) { if (in_array($contact['network'], [NETWORK_DIASPORA, NETWORK_OSTATUS])) {
if ($contact['rel'] == CONTACT_IS_FOLLOWER) { if ($contact['rel'] == CONTACT_IS_FOLLOWER) {
$follow = System::baseUrl(true) . "/follow?url=" . urlencode($contact["url"]); $follow = System::baseUrl(true) . "/follow?url=" . urlencode($contact["url"]);
$follow_text = t("Connect/Follow"); $follow_text = L10n::t("Connect/Follow");
} elseif ($contact['rel'] == CONTACT_IS_FRIEND) { } elseif ($contact['rel'] == CONTACT_IS_FRIEND) {
$follow = System::baseUrl(true) . "/unfollow?url=" . urlencode($contact["url"]); $follow = System::baseUrl(true) . "/unfollow?url=" . urlencode($contact["url"]);
$follow_text = t("Disconnect/Unfollow"); $follow_text = L10n::t("Disconnect/Unfollow");
} }
} }
@ -595,70 +596,70 @@ function contacts_content(App $a)
$tpl = get_markup_template("contact_edit.tpl"); $tpl = get_markup_template("contact_edit.tpl");
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$header' => t("Contact"), '$header' => L10n::t("Contact"),
'$tab_str' => $tab_str, '$tab_str' => $tab_str,
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
'$lbl_vis1' => t('Profile Visibility'), '$lbl_vis1' => L10n::t('Profile Visibility'),
'$lbl_vis2' => t('Please choose the profile you would like to display to %s when viewing your profile securely.', $contact['name']), '$lbl_vis2' => L10n::t('Please choose the profile you would like to display to %s when viewing your profile securely.', $contact['name']),
'$lbl_info1' => t('Contact Information / Notes'), '$lbl_info1' => L10n::t('Contact Information / Notes'),
'$lbl_info2' => t('Their personal note'), '$lbl_info2' => L10n::t('Their personal note'),
'$reason' => trim(notags($contact['reason'])), '$reason' => trim(notags($contact['reason'])),
'$infedit' => t('Edit contact notes'), '$infedit' => L10n::t('Edit contact notes'),
'$common_link' => 'common/loc/' . local_user() . '/' . $contact['id'], '$common_link' => 'common/loc/' . local_user() . '/' . $contact['id'],
'$relation_text' => $relation_text, '$relation_text' => $relation_text,
'$visit' => t('Visit %s\'s profile [%s]', $contact['name'], $contact['url']), '$visit' => L10n::t('Visit %s\'s profile [%s]', $contact['name'], $contact['url']),
'$blockunblock' => t('Block/Unblock contact'), '$blockunblock' => L10n::t('Block/Unblock contact'),
'$ignorecont' => t('Ignore contact'), '$ignorecont' => L10n::t('Ignore contact'),
'$lblcrepair' => t("Repair URL settings"), '$lblcrepair' => L10n::t("Repair URL settings"),
'$lblrecent' => t('View conversations'), '$lblrecent' => L10n::t('View conversations'),
'$lblsuggest' => $lblsuggest, '$lblsuggest' => $lblsuggest,
'$nettype' => $nettype, '$nettype' => $nettype,
'$poll_interval' => $poll_interval, '$poll_interval' => $poll_interval,
'$poll_enabled' => $poll_enabled, '$poll_enabled' => $poll_enabled,
'$lastupdtext' => t('Last update:'), '$lastupdtext' => L10n::t('Last update:'),
'$lost_contact' => $lost_contact, '$lost_contact' => $lost_contact,
'$updpub' => t('Update public posts'), '$updpub' => L10n::t('Update public posts'),
'$last_update' => $last_update, '$last_update' => $last_update,
'$udnow' => t('Update now'), '$udnow' => L10n::t('Update now'),
'$follow' => $follow, '$follow' => $follow,
'$follow_text' => $follow_text, '$follow_text' => $follow_text,
'$profile_select' => $profile_select, '$profile_select' => $profile_select,
'$contact_id' => $contact['id'], '$contact_id' => $contact['id'],
'$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ), '$block_text' => (($contact['blocked']) ? L10n::t('Unblock') : L10n::t('Block') ),
'$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ), '$ignore_text' => (($contact['readonly']) ? L10n::t('Unignore') : L10n::t('Ignore') ),
'$insecure' => (($contact['network'] !== NETWORK_DFRN && $contact['network'] !== NETWORK_MAIL && $contact['network'] !== NETWORK_FACEBOOK && $contact['network'] !== NETWORK_DIASPORA) ? $insecure : ''), '$insecure' => (($contact['network'] !== NETWORK_DFRN && $contact['network'] !== NETWORK_MAIL && $contact['network'] !== NETWORK_FACEBOOK && $contact['network'] !== NETWORK_DIASPORA) ? $insecure : ''),
'$info' => $contact['info'], '$info' => $contact['info'],
'$cinfo' => ['info', '', $contact['info'], ''], '$cinfo' => ['info', '', $contact['info'], ''],
'$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''), '$blocked' => (($contact['blocked']) ? L10n::t('Currently blocked') : ''),
'$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''), '$ignored' => (($contact['readonly']) ? L10n::t('Currently ignored') : ''),
'$archived' => (($contact['archive']) ? t('Currently archived') : ''), '$archived' => (($contact['archive']) ? L10n::t('Currently archived') : ''),
'$pending' => (($contact['pending']) ? t('Awaiting connection acknowledge') : ''), '$pending' => (($contact['pending']) ? L10n::t('Awaiting connection acknowledge') : ''),
'$hidden' => ['hidden', t('Hide this contact from others'), ($contact['hidden'] == 1), t('Replies/likes to your public posts <strong>may</strong> still be visible')], '$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($contact['hidden'] == 1), L10n::t('Replies/likes to your public posts <strong>may</strong> still be visible')],
'$notify' => ['notify', t('Notification for new posts'), ($contact['notify_new_posts'] == 1), t('Send a notification of every new post of this contact')], '$notify' => ['notify', L10n::t('Notification for new posts'), ($contact['notify_new_posts'] == 1), L10n::t('Send a notification of every new post of this contact')],
'$fetch_further_information' => $fetch_further_information, '$fetch_further_information' => $fetch_further_information,
'$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'], '$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'],
'$ffi_keyword_blacklist' => ['ffi_keyword_blacklist', t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')], '$ffi_keyword_blacklist' => ['ffi_keyword_blacklist', L10n::t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], L10n::t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')],
'$photo' => $contact['photo'], '$photo' => $contact['photo'],
'$name' => htmlentities($contact['name']), '$name' => htmlentities($contact['name']),
'$dir_icon' => $dir_icon, '$dir_icon' => $dir_icon,
'$sparkle' => $sparkle, '$sparkle' => $sparkle,
'$url' => $url, '$url' => $url,
'$profileurllabel' => t('Profile URL'), '$profileurllabel' => L10n::t('Profile URL'),
'$profileurl' => $contact['url'], '$profileurl' => $contact['url'],
'$account_type' => Contact::getAccountType($contact), '$account_type' => Contact::getAccountType($contact),
'$location' => bbcode($contact["location"]), '$location' => bbcode($contact["location"]),
'$location_label' => t("Location:"), '$location_label' => L10n::t("Location:"),
'$xmpp' => bbcode($contact["xmpp"]), '$xmpp' => bbcode($contact["xmpp"]),
'$xmpp_label' => t("XMPP:"), '$xmpp_label' => L10n::t("XMPP:"),
'$about' => bbcode($contact["about"], false, false), '$about' => bbcode($contact["about"], false, false),
'$about_label' => t("About:"), '$about_label' => L10n::t("About:"),
'$keywords' => $contact["keywords"], '$keywords' => $contact["keywords"],
'$keywords_label' => t("Tags:"), '$keywords_label' => L10n::t("Tags:"),
'$contact_action_button' => t("Actions"), '$contact_action_button' => L10n::t("Actions"),
'$contact_actions' => $contact_actions, '$contact_actions' => $contact_actions,
'$contact_status' => t("Status"), '$contact_status' => L10n::t("Status"),
'$contact_settings_label' => t('Contact Settings'), '$contact_settings_label' => L10n::t('Contact Settings'),
'$contact_profile_label' => t("Profile"), '$contact_profile_label' => L10n::t("Profile"),
]); ]);
$arr = ['contact' => $contact, 'output' => $o]; $arr = ['contact' => $contact, 'output' => $o];
@ -698,58 +699,58 @@ function contacts_content(App $a)
$tabs = [ $tabs = [
[ [
'label' => t('Suggestions'), 'label' => L10n::t('Suggestions'),
'url' => 'suggest', 'url' => 'suggest',
'sel' => '', 'sel' => '',
'title' => t('Suggest potential friends'), 'title' => L10n::t('Suggest potential friends'),
'id' => 'suggestions-tab', 'id' => 'suggestions-tab',
'accesskey' => 'g', 'accesskey' => 'g',
], ],
[ [
'label' => t('All Contacts'), 'label' => L10n::t('All Contacts'),
'url' => 'contacts/all', 'url' => 'contacts/all',
'sel' => ($all) ? 'active' : '', 'sel' => ($all) ? 'active' : '',
'title' => t('Show all contacts'), 'title' => L10n::t('Show all contacts'),
'id' => 'showall-tab', 'id' => 'showall-tab',
'accesskey' => 'l', 'accesskey' => 'l',
], ],
[ [
'label' => t('Unblocked'), 'label' => L10n::t('Unblocked'),
'url' => 'contacts', 'url' => 'contacts',
'sel' => ((!$all) && (!$blocked) && (!$hidden) && (!$search) && (!$nets) && (!$ignored) && (!$archived)) ? 'active' : '', 'sel' => ((!$all) && (!$blocked) && (!$hidden) && (!$search) && (!$nets) && (!$ignored) && (!$archived)) ? 'active' : '',
'title' => t('Only show unblocked contacts'), 'title' => L10n::t('Only show unblocked contacts'),
'id' => 'showunblocked-tab', 'id' => 'showunblocked-tab',
'accesskey' => 'o', 'accesskey' => 'o',
], ],
[ [
'label' => t('Blocked'), 'label' => L10n::t('Blocked'),
'url' => 'contacts/blocked', 'url' => 'contacts/blocked',
'sel' => ($blocked) ? 'active' : '', 'sel' => ($blocked) ? 'active' : '',
'title' => t('Only show blocked contacts'), 'title' => L10n::t('Only show blocked contacts'),
'id' => 'showblocked-tab', 'id' => 'showblocked-tab',
'accesskey' => 'b', 'accesskey' => 'b',
], ],
[ [
'label' => t('Ignored'), 'label' => L10n::t('Ignored'),
'url' => 'contacts/ignored', 'url' => 'contacts/ignored',
'sel' => ($ignored) ? 'active' : '', 'sel' => ($ignored) ? 'active' : '',
'title' => t('Only show ignored contacts'), 'title' => L10n::t('Only show ignored contacts'),
'id' => 'showignored-tab', 'id' => 'showignored-tab',
'accesskey' => 'i', 'accesskey' => 'i',
], ],
[ [
'label' => t('Archived'), 'label' => L10n::t('Archived'),
'url' => 'contacts/archived', 'url' => 'contacts/archived',
'sel' => ($archived) ? 'active' : '', 'sel' => ($archived) ? 'active' : '',
'title' => t('Only show archived contacts'), 'title' => L10n::t('Only show archived contacts'),
'id' => 'showarchived-tab', 'id' => 'showarchived-tab',
'accesskey' => 'y', 'accesskey' => 'y',
], ],
[ [
'label' => t('Hidden'), 'label' => L10n::t('Hidden'),
'url' => 'contacts/hidden', 'url' => 'contacts/hidden',
'sel' => ($hidden) ? 'active' : '', 'sel' => ($hidden) ? 'active' : '',
'title' => t('Only show hidden contacts'), 'title' => L10n::t('Only show hidden contacts'),
'id' => 'showhidden-tab', 'id' => 'showhidden-tab',
'accesskey' => 'h', 'accesskey' => 'h',
], ],
@ -801,25 +802,25 @@ function contacts_content(App $a)
$tpl = get_markup_template("contacts-template.tpl"); $tpl = get_markup_template("contacts-template.tpl");
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$baseurl' => System::baseUrl(), '$baseurl' => System::baseUrl(),
'$header' => t('Contacts') . (($nets) ? ' - ' . ContactSelector::networkToName($nets) : ''), '$header' => L10n::t('Contacts') . (($nets) ? ' - ' . ContactSelector::networkToName($nets) : ''),
'$tabs' => $t, '$tabs' => $t,
'$total' => $total, '$total' => $total,
'$search' => $search_hdr, '$search' => $search_hdr,
'$desc' => t('Search your contacts'), '$desc' => L10n::t('Search your contacts'),
'$finding' => $searching ? t('Results for: %s', $search) : "", '$finding' => $searching ? L10n::t('Results for: %s', $search) : "",
'$submit' => t('Find'), '$submit' => L10n::t('Find'),
'$cmd' => $a->cmd, '$cmd' => $a->cmd,
'$contacts' => $contacts, '$contacts' => $contacts,
'$contact_drop_confirm' => t('Do you really want to delete this contact?'), '$contact_drop_confirm' => L10n::t('Do you really want to delete this contact?'),
'multiselect' => 1, 'multiselect' => 1,
'$batch_actions' => [ '$batch_actions' => [
'contacts_batch_update' => t('Update'), 'contacts_batch_update' => L10n::t('Update'),
'contacts_batch_block' => t('Block') . "/" . t("Unblock"), 'contacts_batch_block' => L10n::t('Block') . "/" . L10n::t("Unblock"),
"contacts_batch_ignore" => t('Ignore') . "/" . t("Unignore"), "contacts_batch_ignore" => L10n::t('Ignore') . "/" . L10n::t("Unignore"),
"contacts_batch_archive" => t('Archive') . "/" . t("Unarchive"), "contacts_batch_archive" => L10n::t('Archive') . "/" . L10n::t("Unarchive"),
"contacts_batch_drop" => t('Delete'), "contacts_batch_drop" => L10n::t('Delete'),
], ],
'$h_batch_actions' => t('Batch Actions'), '$h_batch_actions' => L10n::t('Batch Actions'),
'$paginate' => paginate($a), '$paginate' => paginate($a),
]); ]);
@ -842,18 +843,18 @@ function contacts_tab($a, $contact_id, $active_tab)
// tabs // tabs
$tabs = [ $tabs = [
[ [
'label' => t('Status'), 'label' => L10n::t('Status'),
'url' => "contacts/" . $contact_id . "/posts", 'url' => "contacts/" . $contact_id . "/posts",
'sel' => (($active_tab == 1) ? 'active' : ''), 'sel' => (($active_tab == 1) ? 'active' : ''),
'title' => t('Status Messages and Posts'), 'title' => L10n::t('Status Messages and Posts'),
'id' => 'status-tab', 'id' => 'status-tab',
'accesskey' => 'm', 'accesskey' => 'm',
], ],
[ [
'label' => t('Profile'), 'label' => L10n::t('Profile'),
'url' => "contacts/" . $contact_id, 'url' => "contacts/" . $contact_id,
'sel' => (($active_tab == 2) ? 'active' : ''), 'sel' => (($active_tab == 2) ? 'active' : ''),
'title' => t('Profile Details'), 'title' => L10n::t('Profile Details'),
'id' => 'profile-tab', 'id' => 'profile-tab',
'accesskey' => 'o', 'accesskey' => 'o',
] ]
@ -862,10 +863,10 @@ function contacts_tab($a, $contact_id, $active_tab)
// Show this tab only if there is visible friend list // Show this tab only if there is visible friend list
$x = GContact::countAllFriends(local_user(), $contact_id); $x = GContact::countAllFriends(local_user(), $contact_id);
if ($x) { if ($x) {
$tabs[] = ['label' => t('Contacts'), $tabs[] = ['label' => L10n::t('Contacts'),
'url' => "allfriends/" . $contact_id, 'url' => "allfriends/" . $contact_id,
'sel' => (($active_tab == 3) ? 'active' : ''), 'sel' => (($active_tab == 3) ? 'active' : ''),
'title' => t('View all contacts'), 'title' => L10n::t('View all contacts'),
'id' => 'allfriends-tab', 'id' => 'allfriends-tab',
'accesskey' => 't']; 'accesskey' => 't'];
} }
@ -873,19 +874,19 @@ function contacts_tab($a, $contact_id, $active_tab)
// Show this tab only if there is visible common friend list // Show this tab only if there is visible common friend list
$common = GContact::countCommonFriends(local_user(), $contact_id); $common = GContact::countCommonFriends(local_user(), $contact_id);
if ($common) { if ($common) {
$tabs[] = ['label' => t('Common Friends'), $tabs[] = ['label' => L10n::t('Common Friends'),
'url' => "common/loc/" . local_user() . "/" . $contact_id, 'url' => "common/loc/" . local_user() . "/" . $contact_id,
'sel' => (($active_tab == 4) ? 'active' : ''), 'sel' => (($active_tab == 4) ? 'active' : ''),
'title' => t('View all common friends'), 'title' => L10n::t('View all common friends'),
'id' => 'common-loc-tab', 'id' => 'common-loc-tab',
'accesskey' => 'd' 'accesskey' => 'd'
]; ];
} }
$tabs[] = ['label' => t('Advanced'), $tabs[] = ['label' => L10n::t('Advanced'),
'url' => 'crepair/' . $contact_id, 'url' => 'crepair/' . $contact_id,
'sel' => (($active_tab == 5) ? 'active' : ''), 'sel' => (($active_tab == 5) ? 'active' : ''),
'title' => t('Advanced Contact Settings'), 'title' => L10n::t('Advanced Contact Settings'),
'id' => 'advanced-tab', 'id' => 'advanced-tab',
'accesskey' => 'r' 'accesskey' => 'r'
]; ];
@ -917,15 +918,15 @@ function _contact_detail_for_template($rr)
switch ($rr['rel']) { switch ($rr['rel']) {
case CONTACT_IS_FRIEND: case CONTACT_IS_FRIEND:
$dir_icon = 'images/lrarrow.gif'; $dir_icon = 'images/lrarrow.gif';
$alt_text = t('Mutual Friendship'); $alt_text = L10n::t('Mutual Friendship');
break; break;
case CONTACT_IS_FOLLOWER; case CONTACT_IS_FOLLOWER;
$dir_icon = 'images/larrow.gif'; $dir_icon = 'images/larrow.gif';
$alt_text = t('is a fan of yours'); $alt_text = L10n::t('is a fan of yours');
break; break;
case CONTACT_IS_SHARING; case CONTACT_IS_SHARING;
$dir_icon = 'images/rarrow.gif'; $dir_icon = 'images/rarrow.gif';
$alt_text = t('you are a fan of'); $alt_text = L10n::t('you are a fan of');
break; break;
default: default:
break; break;
@ -939,8 +940,8 @@ function _contact_detail_for_template($rr)
} }
return [ return [
'img_hover' => t('Visit %s\'s profile [%s]', $rr['name'], $rr['url']), 'img_hover' => L10n::t('Visit %s\'s profile [%s]', $rr['name'], $rr['url']),
'edit_hover' => t('Edit contact'), 'edit_hover' => L10n::t('Edit contact'),
'photo_menu' => Contact::photoMenu($rr), 'photo_menu' => Contact::photoMenu($rr),
'id' => $rr['id'], 'id' => $rr['id'],
'alt_text' => $alt_text, 'alt_text' => $alt_text,
@ -972,7 +973,7 @@ function contact_actions($contact)
// Provide friend suggestion only for Friendica contacts // Provide friend suggestion only for Friendica contacts
if ($contact['network'] === NETWORK_DFRN) { if ($contact['network'] === NETWORK_DFRN) {
$contact_actions['suggest'] = [ $contact_actions['suggest'] = [
'label' => t('Suggest friends'), 'label' => L10n::t('Suggest friends'),
'url' => 'fsuggest/' . $contact['id'], 'url' => 'fsuggest/' . $contact['id'],
'title' => '', 'title' => '',
'sel' => '', 'sel' => '',
@ -982,7 +983,7 @@ function contact_actions($contact)
if ($poll_enabled) { if ($poll_enabled) {
$contact_actions['update'] = [ $contact_actions['update'] = [
'label' => t('Update now'), 'label' => L10n::t('Update now'),
'url' => 'contacts/' . $contact['id'] . '/update', 'url' => 'contacts/' . $contact['id'] . '/update',
'title' => '', 'title' => '',
'sel' => '', 'sel' => '',
@ -991,33 +992,33 @@ function contact_actions($contact)
} }
$contact_actions['block'] = [ $contact_actions['block'] = [
'label' => (intval($contact['blocked']) ? t('Unblock') : t('Block') ), 'label' => (intval($contact['blocked']) ? L10n::t('Unblock') : L10n::t('Block') ),
'url' => 'contacts/' . $contact['id'] . '/block', 'url' => 'contacts/' . $contact['id'] . '/block',
'title' => t('Toggle Blocked status'), 'title' => L10n::t('Toggle Blocked status'),
'sel' => (intval($contact['blocked']) ? 'active' : ''), 'sel' => (intval($contact['blocked']) ? 'active' : ''),
'id' => 'toggle-block', 'id' => 'toggle-block',
]; ];
$contact_actions['ignore'] = [ $contact_actions['ignore'] = [
'label' => (intval($contact['readonly']) ? t('Unignore') : t('Ignore') ), 'label' => (intval($contact['readonly']) ? L10n::t('Unignore') : L10n::t('Ignore') ),
'url' => 'contacts/' . $contact['id'] . '/ignore', 'url' => 'contacts/' . $contact['id'] . '/ignore',
'title' => t('Toggle Ignored status'), 'title' => L10n::t('Toggle Ignored status'),
'sel' => (intval($contact['readonly']) ? 'active' : ''), 'sel' => (intval($contact['readonly']) ? 'active' : ''),
'id' => 'toggle-ignore', 'id' => 'toggle-ignore',
]; ];
$contact_actions['archive'] = [ $contact_actions['archive'] = [
'label' => (intval($contact['archive']) ? t('Unarchive') : t('Archive') ), 'label' => (intval($contact['archive']) ? L10n::t('Unarchive') : L10n::t('Archive') ),
'url' => 'contacts/' . $contact['id'] . '/archive', 'url' => 'contacts/' . $contact['id'] . '/archive',
'title' => t('Toggle Archive status'), 'title' => L10n::t('Toggle Archive status'),
'sel' => (intval($contact['archive']) ? 'active' : ''), 'sel' => (intval($contact['archive']) ? 'active' : ''),
'id' => 'toggle-archive', 'id' => 'toggle-archive',
]; ];
$contact_actions['delete'] = [ $contact_actions['delete'] = [
'label' => t('Delete'), 'label' => L10n::t('Delete'),
'url' => 'contacts/' . $contact['id'] . '/drop', 'url' => 'contacts/' . $contact['id'] . '/drop',
'title' => t('Delete contact'), 'title' => L10n::t('Delete contact'),
'sel' => '', 'sel' => '',
'id' => 'delete', 'id' => 'delete',
]; ];

View file

@ -1,11 +1,12 @@
<?php <?php
/** /**
* @file mod/credits.php
* Show a credits page for all the developers who helped with the project * Show a credits page for all the developers who helped with the project
* (only contributors to the git repositories for friendica core and the * (only contributors to the git repositories for friendica core and the
* addons repository will be listed though ATM) * addons repository will be listed though ATM)
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
function credits_content() function credits_content()
{ {
@ -14,8 +15,8 @@ function credits_content()
$names = explode("\n", htmlspecialchars($credits_string)); $names = explode("\n", htmlspecialchars($credits_string));
$tpl = get_markup_template('credits.tpl'); $tpl = get_markup_template('credits.tpl');
return replace_macros($tpl, [ return replace_macros($tpl, [
'$title' => t('Credits'), '$title' => L10n::t('Credits'),
'$thanks' => t('Friendica is a community project, that would not be possible without the help of many people. Here is a list of those who have contributed to the code or the translation of Friendica. Thank you all!'), '$thanks' => L10n::t('Friendica is a community project, that would not be possible without the help of many people. Here is a list of those who have contributed to the code or the translation of Friendica. Thank you all!'),
'$names' => $names, '$names' => $names,
]); ]);
} }

View file

@ -4,6 +4,7 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
@ -83,9 +84,9 @@ function crepair_post(App $a)
} }
if ($r) { if ($r) {
info(t('Contact settings applied.') . EOL); info(L10n::t('Contact settings applied.') . EOL);
} else { } else {
notice(t('Contact update failed.') . EOL); notice(L10n::t('Contact update failed.') . EOL);
} }
return; return;
@ -94,7 +95,7 @@ function crepair_post(App $a)
function crepair_content(App $a) function crepair_content(App $a)
{ {
if (!local_user()) { if (!local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -106,12 +107,12 @@ function crepair_content(App $a)
} }
if (!DBM::is_result($contact)) { if (!DBM::is_result($contact)) {
notice(t('Contact not found.') . EOL); notice(L10n::t('Contact not found.') . EOL);
return; return;
} }
$warning = t('<strong>WARNING: This is highly advanced</strong> and if you enter incorrect information your communications with this contact may stop working.'); $warning = L10n::t('<strong>WARNING: This is highly advanced</strong> and if you enter incorrect information your communications with this contact may stop working.');
$info = t('Please use your browser \'Back\' button <strong>now</strong> if you are uncertain what to do on this page.'); $info = L10n::t('Please use your browser \'Back\' button <strong>now</strong> if you are uncertain what to do on this page.');
$returnaddr = "contacts/$cid"; $returnaddr = "contacts/$cid";
@ -125,9 +126,9 @@ function crepair_content(App $a)
} }
if ($contact['network'] == NETWORK_FEED) { if ($contact['network'] == NETWORK_FEED) {
$remote_self_options = ['0' => t('No mirroring'), '1' => t('Mirror as forwarded posting'), '2' => t('Mirror as my own posting')]; $remote_self_options = ['0' => L10n::t('No mirroring'), '1' => L10n::t('Mirror as forwarded posting'), '2' => L10n::t('Mirror as my own posting')];
} else { } else {
$remote_self_options = ['0' => t('No mirroring'), '2' => t('Mirror as my own posting')]; $remote_self_options = ['0' => L10n::t('No mirroring'), '2' => L10n::t('Mirror as my own posting')];
} }
$update_profile = in_array($contact['network'], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]); $update_profile = in_array($contact['network'], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]);
@ -140,29 +141,29 @@ function crepair_content(App $a)
'$warning' => $warning, '$warning' => $warning,
'$info' => $info, '$info' => $info,
'$returnaddr' => $returnaddr, '$returnaddr' => $returnaddr,
'$return' => t('Return to contact editor'), '$return' => L10n::t('Return to contact editor'),
'$update_profile' => $update_profile, '$update_profile' => $update_profile,
'$udprofilenow' => t('Refetch contact data'), '$udprofilenow' => L10n::t('Refetch contact data'),
'$contact_id' => $contact['id'], '$contact_id' => $contact['id'],
'$lbl_submit' => t('Submit'), '$lbl_submit' => L10n::t('Submit'),
'$label_remote_self' => t('Remote Self'), '$label_remote_self' => L10n::t('Remote Self'),
'$allow_remote_self' => $allow_remote_self, '$allow_remote_self' => $allow_remote_self,
'$remote_self' => ['remote_self', '$remote_self' => ['remote_self',
t('Mirror postings from this contact'), L10n::t('Mirror postings from this contact'),
$contact['remote_self'], $contact['remote_self'],
t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'), L10n::t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'),
$remote_self_options $remote_self_options
], ],
'$name' => ['name', t('Name') , htmlentities($contact['name'])], '$name' => ['name', L10n::t('Name') , htmlentities($contact['name'])],
'$nick' => ['nick', t('Account Nickname'), htmlentities($contact['nick'])], '$nick' => ['nick', L10n::t('Account Nickname'), htmlentities($contact['nick'])],
'$attag' => ['attag', t('@Tagname - overrides Name/Nickname'), $contact['attag']], '$attag' => ['attag', L10n::t('@Tagname - overrides Name/Nickname'), $contact['attag']],
'$url' => ['url', t('Account URL'), $contact['url']], '$url' => ['url', L10n::t('Account URL'), $contact['url']],
'$request' => ['request', t('Friend Request URL'), $contact['request']], '$request' => ['request', L10n::t('Friend Request URL'), $contact['request']],
'confirm' => ['confirm', t('Friend Confirm URL'), $contact['confirm']], 'confirm' => ['confirm', L10n::t('Friend Confirm URL'), $contact['confirm']],
'notify' => ['notify', t('Notification Endpoint URL'), $contact['notify']], 'notify' => ['notify', L10n::t('Notification Endpoint URL'), $contact['notify']],
'poll' => ['poll', t('Poll/Feed URL'), $contact['poll']], 'poll' => ['poll', L10n::t('Poll/Feed URL'), $contact['poll']],
'photo' => ['photo', t('New photo from this URL'), ''], 'photo' => ['photo', L10n::t('New photo from this URL'), ''],
]); ]);
return $o; return $o;

View file

@ -1,6 +1,9 @@
<?php <?php
/**
* @file mod/delegate.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -14,7 +17,7 @@ function delegate_init(App $a)
function delegate_content(App $a) function delegate_content(App $a)
{ {
if (!local_user()) { if (!local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -90,7 +93,7 @@ function delegate_content(App $a)
dbesc(NETWORK_DFRN) dbesc(NETWORK_DFRN)
); );
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
notice(t('No potential page delegates located.') . EOL); notice(L10n::t('No potential page delegates located.') . EOL);
return; return;
} }
@ -116,18 +119,18 @@ function delegate_content(App $a)
settings_init($a); settings_init($a);
$o = replace_macros(get_markup_template('delegate.tpl'), [ $o = replace_macros(get_markup_template('delegate.tpl'), [
'$header' => t('Delegate Page Management'), '$header' => L10n::t('Delegate Page Management'),
'$base' => System::baseUrl(), '$base' => System::baseUrl(),
'$desc' => t('Delegates are able to manage all aspects of this account/page except for basic account settings. Please do not delegate your personal account to anybody that you do not trust completely.'), '$desc' => L10n::t('Delegates are able to manage all aspects of this account/page except for basic account settings. Please do not delegate your personal account to anybody that you do not trust completely.'),
'$head_managers' => t('Existing Page Managers'), '$head_managers' => L10n::t('Existing Page Managers'),
'$managers' => $full_managers, '$managers' => $full_managers,
'$head_delegates' => t('Existing Page Delegates'), '$head_delegates' => L10n::t('Existing Page Delegates'),
'$delegates' => $delegates, '$delegates' => $delegates,
'$head_potentials' => t('Potential Delegates'), '$head_potentials' => L10n::t('Potential Delegates'),
'$potentials' => $potentials, '$potentials' => $potentials,
'$remove' => t('Remove'), '$remove' => L10n::t('Remove'),
'$add' => t('Add'), '$add' => L10n::t('Add'),
'$none' => t('No entries.') '$none' => L10n::t('No entries.')
]); ]);

View file

@ -1,5 +1,4 @@
<?php <?php
/** /**
* @file mod/dfrn_confirm.php * @file mod/dfrn_confirm.php
* @brief Module: dfrn_confirm * @brief Module: dfrn_confirm
@ -20,6 +19,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
@ -61,13 +61,13 @@ function dfrn_confirm_post(App $a, $handsfree = null)
if (!x($_POST, 'source_url')) { if (!x($_POST, 'source_url')) {
$uid = defaults($handsfree, 'uid', local_user()); $uid = defaults($handsfree, 'uid', local_user());
if (!$uid) { if (!$uid) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
$user = dba::selectFirst('user', [], ['uid' => $uid]); $user = dba::selectFirst('user', [], ['uid' => $uid]);
if (!DBM::is_result($user)) { if (!DBM::is_result($user)) {
notice(t('Profile not found.') . EOL); notice(L10n::t('Profile not found.') . EOL);
return; return;
} }
@ -124,8 +124,8 @@ function dfrn_confirm_post(App $a, $handsfree = null)
); );
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
logger('Contact not found in DB.'); logger('Contact not found in DB.');
notice(t('Contact not found.') . EOL); notice(L10n::t('Contact not found.') . EOL);
notice(t('This may occasionally happen if contact was requested by both persons and it has already been approved.') . EOL); notice(L10n::t('This may occasionally happen if contact was requested by both persons and it has already been approved.') . EOL);
return; return;
} }
@ -235,19 +235,19 @@ function dfrn_confirm_post(App $a, $handsfree = null)
// We shouldn't proceed, because the xml parser might choke, // We shouldn't proceed, because the xml parser might choke,
// and $status is going to be zero, which indicates success. // and $status is going to be zero, which indicates success.
// We can hardly call this a success. // We can hardly call this a success.
notice(t('Response from remote site was not understood.') . EOL); notice(L10n::t('Response from remote site was not understood.') . EOL);
return; return;
} }
if (strlen($leading_junk) && Config::get('system', 'debugging')) { if (strlen($leading_junk) && Config::get('system', 'debugging')) {
// This might be more common. Mixed error text and some XML. // This might be more common. Mixed error text and some XML.
// If we're configured for debugging, show the text. Proceed in either case. // If we're configured for debugging, show the text. Proceed in either case.
notice(t('Unexpected response from remote site: ') . EOL . $leading_junk . EOL); notice(L10n::t('Unexpected response from remote site: ') . EOL . $leading_junk . EOL);
} }
if (stristr($res, "<status") === false) { if (stristr($res, "<status") === false) {
// wrong xml! stop here! // wrong xml! stop here!
notice(t('Unexpected response from remote site: ') . EOL . htmlspecialchars($res) . EOL); notice(L10n::t('Unexpected response from remote site: ') . EOL . htmlspecialchars($res) . EOL);
return; return;
} }
@ -256,7 +256,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$message = unxmlify($xml->message); // human readable text of what may have gone wrong. $message = unxmlify($xml->message); // human readable text of what may have gone wrong.
switch ($status) { switch ($status) {
case 0: case 0:
info(t("Confirmation completed successfully.") . EOL); info(L10n::t("Confirmation completed successfully.") . EOL);
break; break;
case 1: case 1:
// birthday paradox - generate new dfrn-id and fall through. // birthday paradox - generate new dfrn-id and fall through.
@ -268,15 +268,15 @@ function dfrn_confirm_post(App $a, $handsfree = null)
); );
case 2: case 2:
notice(t("Temporary failure. Please wait and try again.") . EOL); notice(L10n::t("Temporary failure. Please wait and try again.") . EOL);
break; break;
case 3: case 3:
notice(t("Introduction failed or was revoked.") . EOL); notice(L10n::t("Introduction failed or was revoked.") . EOL);
break; break;
} }
if (strlen($message)) { if (strlen($message)) {
notice(t('Remote site reported: ') . $message . EOL); notice(L10n::t('Remote site reported: ') . $message . EOL);
} }
if (($status == 0) && ($intro_id)) { if (($status == 0) && ($intro_id)) {
@ -389,7 +389,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
/// @TODO is DBM::is_result() working here? /// @TODO is DBM::is_result() working here?
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
notice(t('Unable to set contact photo.') . EOL); notice(L10n::t('Unable to set contact photo.') . EOL);
} }
// reload contact info // reload contact info
@ -424,7 +424,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$arr['verb'] = ACTIVITY_FRIEND; $arr['verb'] = ACTIVITY_FRIEND;
$arr['object-type'] = ACTIVITY_OBJ_PERSON; $arr['object-type'] = ACTIVITY_OBJ_PERSON;
$arr['body'] = t('%1$s is now friends with %2$s', $A, $B) . "\n\n\n" . $BPhoto; $arr['body'] = L10n::t('%1$s is now friends with %2$s', $A, $B) . "\n\n\n" . $BPhoto;
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $contact['name'] . '</title>' $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $contact['name'] . '</title>'
. '<id>' . $contact['url'] . '/' . $contact['name'] . '</id>'; . '<id>' . $contact['url'] . '/' . $contact['name'] . '</id>';
@ -491,7 +491,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
// Find our user's account // Find our user's account
$user = dba::selectFirst('user', [], ['nickname' => $node]); $user = dba::selectFirst('user', [], ['nickname' => $node]);
if (!DBM::is_result($user)) { if (!DBM::is_result($user)) {
$message = t('No user record found for \'%s\' ', $node); $message = L10n::t('No user record found for \'%s\' ', $node);
xml_status(3, $message); // failure xml_status(3, $message); // failure
// NOTREACHED // NOTREACHED
} }
@ -501,7 +501,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
if (!strstr($my_prvkey, 'PRIVATE KEY')) { if (!strstr($my_prvkey, 'PRIVATE KEY')) {
$message = t('Our site encryption key is apparently messed up.'); $message = L10n::t('Our site encryption key is apparently messed up.');
xml_status(3, $message); xml_status(3, $message);
} }
@ -512,7 +512,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
if (!strlen($decrypted_source_url)) { if (!strlen($decrypted_source_url)) {
$message = t('Empty site URL was provided or URL could not be decrypted by us.'); $message = L10n::t('Empty site URL was provided or URL could not be decrypted by us.');
xml_status(3, $message); xml_status(3, $message);
// NOTREACHED // NOTREACHED
} }
@ -528,7 +528,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$contact = dba::selectFirst('contact', [], ['url' => $newurl, 'uid' => $local_uid]); $contact = dba::selectFirst('contact', [], ['url' => $newurl, 'uid' => $local_uid]);
if (!DBM::is_result($contact)) { if (!DBM::is_result($contact)) {
// this is either a bogus confirmation (?) or we deleted the original introduction. // this is either a bogus confirmation (?) or we deleted the original introduction.
$message = t('Contact record was not found for you on our site.'); $message = L10n::t('Contact record was not found for you on our site.');
xml_status(3, $message); xml_status(3, $message);
return; // NOTREACHED return; // NOTREACHED
} }
@ -542,7 +542,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$dfrn_record = $contact['id']; $dfrn_record = $contact['id'];
if (!$foreign_pubkey) { if (!$foreign_pubkey) {
$message = t('Site public key not available in contact record for URL %s.', $decrypted_source_url); $message = L10n::t('Site public key not available in contact record for URL %s.', $decrypted_source_url);
xml_status(3, $message); xml_status(3, $message);
} }
@ -558,7 +558,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
} }
if (dba::exists('contact', ['dfrn-id' => $decrypted_dfrn_id])) { if (dba::exists('contact', ['dfrn-id' => $decrypted_dfrn_id])) {
$message = t('The ID provided by your system is a duplicate on our system. It should work if you try again.'); $message = L10n::t('The ID provided by your system is a duplicate on our system. It should work if you try again.');
xml_status(1, $message); // Birthday paradox - duplicate dfrn-id xml_status(1, $message); // Birthday paradox - duplicate dfrn-id
// NOTREACHED // NOTREACHED
} }
@ -569,7 +569,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
intval($dfrn_record) intval($dfrn_record)
); );
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
$message = t('Unable to set your contact credentials on our system.'); $message = L10n::t('Unable to set your contact credentials on our system.');
xml_status(3, $message); xml_status(3, $message);
} }
@ -624,7 +624,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
intval($dfrn_record) intval($dfrn_record)
); );
if (!DBM::is_result($r)) { // indicates schema is messed up or total db failure if (!DBM::is_result($r)) { // indicates schema is messed up or total db failure
$message = t('Unable to update your contact profile details on our system'); $message = L10n::t('Unable to update your contact profile details on our system');
xml_status(3, $message); xml_status(3, $message);
} }
@ -654,7 +654,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
'to_email' => $combined['email'], 'to_email' => $combined['email'],
'uid' => $combined['uid'], 'uid' => $combined['uid'],
'link' => System::baseUrl() . '/contacts/' . $dfrn_record, 'link' => System::baseUrl() . '/contacts/' . $dfrn_record,
'source_name' => ((strlen(stripslashes($combined['name']))) ? stripslashes($combined['name']) : t('[Name Withheld]')), 'source_name' => ((strlen(stripslashes($combined['name']))) ? stripslashes($combined['name']) : L10n::t('[Name Withheld]')),
'source_link' => $combined['url'], 'source_link' => $combined['url'],
'source_photo' => $combined['photo'], 'source_photo' => $combined['photo'],
'verb' => ($mutual?ACTIVITY_FRIEND:ACTIVITY_FOLLOW), 'verb' => ($mutual?ACTIVITY_FRIEND:ACTIVITY_FOLLOW),
@ -687,7 +687,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$arr['verb'] = ACTIVITY_JOIN; $arr['verb'] = ACTIVITY_JOIN;
$arr['object-type'] = ACTIVITY_OBJ_GROUP; $arr['object-type'] = ACTIVITY_OBJ_GROUP;
$arr['body'] = t('%1$s has joined %2$s', $A, $B) . "\n\n\n" . $BPhoto; $arr['body'] = L10n::t('%1$s has joined %2$s', $A, $B) . "\n\n\n" . $BPhoto;
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_GROUP . '</type><title>' . $combined['name'] . '</title>' $arr['object'] = '<object><type>' . ACTIVITY_OBJ_GROUP . '</type><title>' . $combined['name'] . '</title>'
. '<id>' . $combined['url'] . '/' . $combined['name'] . '</id>'; . '<id>' . $combined['url'] . '/' . $combined['name'] . '</id>';
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $combined['url'] . '" />' . "\n"); $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $combined['url'] . '" />' . "\n");

View file

@ -117,7 +117,7 @@ function dfrn_poll_init(App $a)
$_SESSION['visitor_handle'] = $r[0]['addr']; $_SESSION['visitor_handle'] = $r[0]['addr'];
$_SESSION['visitor_visiting'] = $r[0]['uid']; $_SESSION['visitor_visiting'] = $r[0]['uid'];
if (!$quiet) { if (!$quiet) {
info(sprintf(t('%1$s welcomes %2$s'), $r[0]['username'], $r[0]['name']) . EOL); info(L10n::t('%1$s welcomes %2$s', $r[0]['username'], $r[0]['name']) . EOL);
} }
// Visitors get 1 day session. // Visitors get 1 day session.
@ -537,7 +537,7 @@ function dfrn_poll_content(App $a)
$_SESSION['visitor_home'] = $r[0]['url']; $_SESSION['visitor_home'] = $r[0]['url'];
$_SESSION['visitor_visiting'] = $r[0]['uid']; $_SESSION['visitor_visiting'] = $r[0]['uid'];
if (!$quiet) { if (!$quiet) {
info(sprintf(t('%1$s welcomes %2$s'), $r[0]['username'], $r[0]['name']) . EOL); info(L10n::t('%1$s welcomes %2$s', $r[0]['username'], $r[0]['name']) . EOL);
} }
// Visitors get 1 day session. // Visitors get 1 day session.

View file

@ -13,6 +13,7 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -87,7 +88,7 @@ function dfrn_request_post(App $a)
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
if (strlen($r[0]['dfrn-id'])) { if (strlen($r[0]['dfrn-id'])) {
// We don't need to be here. It has already happened. // We don't need to be here. It has already happened.
notice(t("This introduction has already been accepted.") . EOL); notice(L10n::t("This introduction has already been accepted.") . EOL);
return; return;
} else { } else {
$contact_record = $r[0]; $contact_record = $r[0];
@ -105,18 +106,18 @@ function dfrn_request_post(App $a)
$parms = Probe::profile($dfrn_url); $parms = Probe::profile($dfrn_url);
if (!count($parms)) { if (!count($parms)) {
notice(t('Profile location is not valid or does not contain profile information.') . EOL); notice(L10n::t('Profile location is not valid or does not contain profile information.') . EOL);
return; return;
} else { } else {
if (!x($parms, 'fn')) { if (!x($parms, 'fn')) {
notice(t('Warning: profile location has no identifiable owner name.') . EOL); notice(L10n::t('Warning: profile location has no identifiable owner name.') . EOL);
} }
if (!x($parms, 'photo')) { if (!x($parms, 'photo')) {
notice(t('Warning: profile location has no profile photo.') . EOL); notice(L10n::t('Warning: profile location has no profile photo.') . EOL);
} }
$invalid = Probe::validDfrn($parms); $invalid = Probe::validDfrn($parms);
if ($invalid) { if ($invalid) {
notice(sprintf(tt("%d required parameter was not found at the given location", "%d required parameters were not found at the given location", $invalid), $invalid) . EOL); notice(L10n::tt("%d required parameter was not found at the given location", "%d required parameters were not found at the given location", $invalid) . EOL);
return; return;
} }
} }
@ -155,7 +156,7 @@ function dfrn_request_post(App $a)
} }
if ($r) { if ($r) {
info(t("Introduction complete.") . EOL); info(L10n::t("Introduction complete.") . EOL);
} }
$r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `site-pubkey` = '%s' LIMIT 1", $r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `site-pubkey` = '%s' LIMIT 1",
@ -192,7 +193,7 @@ function dfrn_request_post(App $a)
} }
// invalid/bogus request // invalid/bogus request
notice(t('Unrecoverable protocol error.') . EOL); notice(L10n::t('Unrecoverable protocol error.') . EOL);
goaway(System::baseUrl()); goaway(System::baseUrl());
return; // NOTREACHED return; // NOTREACHED
} }
@ -219,7 +220,7 @@ function dfrn_request_post(App $a)
* *
*/ */
if (!(is_array($a->profile) && count($a->profile))) { if (!(is_array($a->profile) && count($a->profile))) {
notice(t('Profile unavailable.') . EOL); notice(L10n::t('Profile unavailable.') . EOL);
return; return;
} }
@ -241,9 +242,9 @@ function dfrn_request_post(App $a)
intval($uid) intval($uid)
); );
if (DBM::is_result($r) && count($r) > $maxreq) { if (DBM::is_result($r) && count($r) > $maxreq) {
notice(sprintf(t('%s has received too many connection requests today.'), $a->profile['name']) . EOL); notice(L10n::t('%s has received too many connection requests today.', $a->profile['name']) . EOL);
notice(t('Spam protection measures have been invoked.') . EOL); notice(L10n::t('Spam protection measures have been invoked.') . EOL);
notice(t('Friends are advised to please try again in 24 hours.') . EOL); notice(L10n::t('Friends are advised to please try again in 24 hours.') . EOL);
return; return;
} }
} }
@ -273,7 +274,7 @@ function dfrn_request_post(App $a)
$url = trim($_POST['dfrn_url']); $url = trim($_POST['dfrn_url']);
if (!strlen($url)) { if (!strlen($url)) {
notice(t("Invalid locator") . EOL); notice(L10n::t("Invalid locator") . EOL);
return; return;
} }
@ -309,10 +310,10 @@ function dfrn_request_post(App $a)
if (DBM::is_result($ret)) { if (DBM::is_result($ret)) {
if (strlen($ret[0]['issued-id'])) { if (strlen($ret[0]['issued-id'])) {
notice(t('You have already introduced yourself here.') . EOL); notice(L10n::t('You have already introduced yourself here.') . EOL);
return; return;
} elseif ($ret[0]['rel'] == CONTACT_IS_FRIEND) { } elseif ($ret[0]['rel'] == CONTACT_IS_FRIEND) {
notice(sprintf(t('Apparently you are already friends with %s.'), $a->profile['name']) . EOL); notice(L10n::t('Apparently you are already friends with %s.', $a->profile['name']) . EOL);
return; return;
} else { } else {
$contact_record = $ret[0]; $contact_record = $ret[0];
@ -332,19 +333,19 @@ function dfrn_request_post(App $a)
} else { } else {
$url = validate_url($url); $url = validate_url($url);
if (!$url) { if (!$url) {
notice(t('Invalid profile URL.') . EOL); notice(L10n::t('Invalid profile URL.') . EOL);
goaway(System::baseUrl() . '/' . $a->cmd); goaway(System::baseUrl() . '/' . $a->cmd);
return; // NOTREACHED return; // NOTREACHED
} }
if (!allowed_url($url)) { if (!allowed_url($url)) {
notice(t('Disallowed profile URL.') . EOL); notice(L10n::t('Disallowed profile URL.') . EOL);
goaway(System::baseUrl() . '/' . $a->cmd); goaway(System::baseUrl() . '/' . $a->cmd);
return; // NOTREACHED return; // NOTREACHED
} }
if (blocked_url($url)) { if (blocked_url($url)) {
notice(t('Blocked domain') . EOL); notice(L10n::t('Blocked domain') . EOL);
goaway(System::baseUrl() . '/' . $a->cmd); goaway(System::baseUrl() . '/' . $a->cmd);
return; // NOTREACHED return; // NOTREACHED
} }
@ -352,18 +353,18 @@ function dfrn_request_post(App $a)
$parms = Probe::profile(($hcard) ? $hcard : $url); $parms = Probe::profile(($hcard) ? $hcard : $url);
if (!count($parms)) { if (!count($parms)) {
notice(t('Profile location is not valid or does not contain profile information.') . EOL); notice(L10n::t('Profile location is not valid or does not contain profile information.') . EOL);
goaway(System::baseUrl() . '/' . $a->cmd); goaway(System::baseUrl() . '/' . $a->cmd);
} else { } else {
if (!x($parms, 'fn')) { if (!x($parms, 'fn')) {
notice(t('Warning: profile location has no identifiable owner name.') . EOL); notice(L10n::t('Warning: profile location has no identifiable owner name.') . EOL);
} }
if (!x($parms, 'photo')) { if (!x($parms, 'photo')) {
notice(t('Warning: profile location has no profile photo.') . EOL); notice(L10n::t('Warning: profile location has no profile photo.') . EOL);
} }
$invalid = Probe::validDfrn($parms); $invalid = Probe::validDfrn($parms);
if ($invalid) { if ($invalid) {
notice(sprintf(tt("%d required parameter was not found at the given location", "%d required parameters were not found at the given location", $invalid), $invalid) . EOL); notice(L10n::tt("%d required parameter was not found at the given location", "%d required parameters were not found at the given location", $invalid) . EOL);
return; return;
} }
@ -412,7 +413,7 @@ function dfrn_request_post(App $a)
} }
} }
if ($r === false) { if ($r === false) {
notice(t('Failed to update contact record.') . EOL); notice(L10n::t('Failed to update contact record.') . EOL);
return; return;
} }
@ -432,7 +433,7 @@ function dfrn_request_post(App $a)
// This notice will only be seen by the requestor if the requestor and requestee are on the same server. // This notice will only be seen by the requestor if the requestor and requestee are on the same server.
if (!$failed) { if (!$failed) {
info(t('Your introduction has been sent.') . EOL); info(L10n::t('Your introduction has been sent.') . EOL);
} }
// "Homecoming" - send the requestor back to their site to record the introduction. // "Homecoming" - send the requestor back to their site to record the introduction.
@ -470,7 +471,7 @@ function dfrn_request_post(App $a)
// NOTREACHED // NOTREACHED
// END $network != NETWORK_PHANTOM // END $network != NETWORK_PHANTOM
} else { } else {
notice(t("Remote subscription can't be done for your network. Please subscribe directly on your system.") . EOL); notice(L10n::t("Remote subscription can't be done for your network. Please subscribe directly on your system.") . EOL);
return; return;
} }
} return; } return;
@ -486,7 +487,7 @@ function dfrn_request_content(App $a)
// to send us to the post section to record the introduction. // to send us to the post section to record the introduction.
if (x($_GET, 'dfrn_url')) { if (x($_GET, 'dfrn_url')) {
if (!local_user()) { if (!local_user()) {
info(t("Please login to confirm introduction.") . EOL); info(L10n::t("Please login to confirm introduction.") . EOL);
/* setup the return URL to come back to this page if they use openid */ /* setup the return URL to come back to this page if they use openid */
return Login::form(); return Login::form();
} }
@ -494,7 +495,7 @@ function dfrn_request_content(App $a)
// Edge case, but can easily happen in the wild. This person is authenticated, // Edge case, but can easily happen in the wild. This person is authenticated,
// but not as the person who needs to deal with this request. // but not as the person who needs to deal with this request.
if ($a->user['nickname'] != $a->argv[1]) { if ($a->user['nickname'] != $a->argv[1]) {
notice(t("Incorrect identity currently logged in. Please login to <strong>this</strong> profile.") . EOL); notice(L10n::t("Incorrect identity currently logged in. Please login to <strong>this</strong> profile.") . EOL);
return Login::form(); return Login::form();
} }
@ -508,7 +509,7 @@ function dfrn_request_content(App $a)
$_POST["confirm_key"] = $confirm_key; $_POST["confirm_key"] = $confirm_key;
$_POST["localconfirm"] = 1; $_POST["localconfirm"] = 1;
$_POST["hidden-contact"] = 0; $_POST["hidden-contact"] = 0;
$_POST["submit"] = t('Confirm'); $_POST["submit"] = L10n::t('Confirm');
dfrn_request_post($a); dfrn_request_post($a);
@ -520,12 +521,12 @@ function dfrn_request_content(App $a)
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$dfrn_url' => $dfrn_url, '$dfrn_url' => $dfrn_url,
'$aes_allow' => (($aes_allow) ? '<input type="hidden" name="aes_allow" value="1" />' : "" ), '$aes_allow' => (($aes_allow) ? '<input type="hidden" name="aes_allow" value="1" />' : "" ),
'$hidethem' => t('Hide this contact'), '$hidethem' => L10n::t('Hide this contact'),
'$hidechecked' => '', '$hidechecked' => '',
'$confirm_key' => $confirm_key, '$confirm_key' => $confirm_key,
'$welcome' => sprintf(t('Welcome home %s.'), $a->user['username']), '$welcome' => L10n::t('Welcome home %s.', $a->user['username']),
'$please' => sprintf(t('Please confirm your introduction/connection request to %s.'), $dfrn_url), '$please' => L10n::t('Please confirm your introduction/connection request to %s.', $dfrn_url),
'$submit' => t('Confirm'), '$submit' => L10n::t('Confirm'),
'$uid' => $_SESSION['uid'], '$uid' => $_SESSION['uid'],
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'dfrn_rawurl' => $_GET['dfrn_url'] 'dfrn_rawurl' => $_GET['dfrn_url']
@ -561,7 +562,7 @@ function dfrn_request_content(App $a)
'to_email' => $r[0]['email'], 'to_email' => $r[0]['email'],
'uid' => $r[0]['uid'], 'uid' => $r[0]['uid'],
'link' => System::baseUrl() . '/notifications/intros', 'link' => System::baseUrl() . '/notifications/intros',
'source_name' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : t('[Name Withheld]')), 'source_name' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : L10n::t('[Name Withheld]')),
'source_link' => $r[0]['url'], 'source_link' => $r[0]['url'],
'source_photo' => $r[0]['photo'], 'source_photo' => $r[0]['photo'],
'verb' => ACTIVITY_REQ_FRIEND, 'verb' => ACTIVITY_REQ_FRIEND,
@ -600,7 +601,7 @@ function dfrn_request_content(App $a)
// Normal web request. Display our user's introduction form. // Normal web request. Display our user's introduction form.
if ((Config::get('system', 'block_public')) && (!local_user()) && (!remote_user())) { if ((Config::get('system', 'block_public')) && (!local_user()) && (!remote_user())) {
if (!Config::get('system', 'local_block')) { if (!Config::get('system', 'local_block')) {
notice(t('Public access denied.') . EOL); notice(L10n::t('Public access denied.') . EOL);
return; return;
} }
} }
@ -635,28 +636,28 @@ function dfrn_request_content(App $a)
$tpl = get_markup_template('auto_request.tpl'); $tpl = get_markup_template('auto_request.tpl');
} }
$page_desc = t("Please enter your 'Identity Address' from one of the following supported communications networks:"); $page_desc = L10n::t("Please enter your 'Identity Address' from one of the following supported communications networks:");
$invite_desc = sprintf( $invite_desc = sprintf(
t('If you are not yet a member of the free social web, <a href="%s">follow this link to find a public Friendica site and join us today</a>.'), L10n::t('If you are not yet a member of the free social web, <a href="%s">follow this link to find a public Friendica site and join us today</a>.'),
get_server() . '/servers' get_server() . '/servers'
); );
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$header' => t('Friend/Connection Request'), '$header' => L10n::t('Friend/Connection Request'),
'$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@gnusocial.de'), '$desc' => L10n::t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@gnusocial.de'),
'$pls_answer' => t('Please answer the following:'), '$pls_answer' => L10n::t('Please answer the following:'),
'$does_know_you' => ['knowyou', sprintf(t('Does %s know you?'), $a->profile['name']), false, '', [t('No'), t('Yes')]], '$does_know_you' => ['knowyou', L10n::t('Does %s know you?', $a->profile['name']), false, '', [L10n::t('No'), L10n::t('Yes')]],
'$add_note' => t('Add a personal note:'), '$add_note' => L10n::t('Add a personal note:'),
'$page_desc' => $page_desc, '$page_desc' => $page_desc,
'$friendica' => t('Friendica'), '$friendica' => L10n::t('Friendica'),
'$statusnet' => t('GNU Social (Pleroma, Mastodon)'), '$statusnet' => L10n::t('GNU Social (Pleroma, Mastodon)'),
'$diaspora' => t('Diaspora (Socialhome, Hubzilla)'), '$diaspora' => L10n::t('Diaspora (Socialhome, Hubzilla)'),
'$diasnote' => sprintf(t(' - please do not use this form. Instead, enter %s into your Diaspora search bar.'), $target_addr), '$diasnote' => L10n::t(' - please do not use this form. Instead, enter %s into your Diaspora search bar.', $target_addr),
'$your_address' => t('Your Identity Address:'), '$your_address' => L10n::t('Your Identity Address:'),
'$invite_desc' => $invite_desc, '$invite_desc' => $invite_desc,
'$submit' => t('Submit Request'), '$submit' => L10n::t('Submit Request'),
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
'$nickname' => $a->argv[1], '$nickname' => $a->argv[1],
'$name' => $a->profile['name'], '$name' => $a->profile['name'],
'$myaddr' => $myaddr '$myaddr' => $myaddr

View file

@ -7,6 +7,7 @@ use Friendica\Content\Nav;
use Friendica\Content\Widget; use Friendica\Content\Widget;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
@ -34,7 +35,7 @@ function directory_content(App $a) {
if((Config::get('system','block_public')) && (! local_user()) && (! remote_user()) || if((Config::get('system','block_public')) && (! local_user()) && (! remote_user()) ||
(Config::get('system','block_local_dir')) && (! local_user()) && (! remote_user())) { (Config::get('system','block_local_dir')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL); notice(L10n::t('Public access denied.') . EOL);
return; return;
} }
@ -124,10 +125,10 @@ function directory_content(App $a) {
} }
// if(strlen($rr['dob'])) { // if(strlen($rr['dob'])) {
// if(($years = age($rr['dob'],$rr['timezone'],'')) != 0) // if(($years = age($rr['dob'],$rr['timezone'],'')) != 0)
// $details .= '<br />' . t('Age: ') . $years ; // $details .= '<br />' . L10n::t('Age: ') . $years ;
// } // }
// if(strlen($rr['gender'])) // if(strlen($rr['gender']))
// $details .= '<br />' . t('Gender: ') . $rr['gender']; // $details .= '<br />' . L10n::t('Gender: ') . $rr['gender'];
$profile = $rr; $profile = $rr;
@ -136,20 +137,20 @@ function directory_content(App $a) {
|| (x($profile,'region') == 1) || (x($profile,'region') == 1)
|| (x($profile,'postal-code') == 1) || (x($profile,'postal-code') == 1)
|| (x($profile,'country-name') == 1)) || (x($profile,'country-name') == 1))
$location = t('Location:'); $location = L10n::t('Location:');
$gender = ((x($profile,'gender') == 1) ? t('Gender:') : False); $gender = ((x($profile,'gender') == 1) ? L10n::t('Gender:') : False);
$marital = ((x($profile,'marital') == 1) ? t('Status:') : False); $marital = ((x($profile,'marital') == 1) ? L10n::t('Status:') : False);
$homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False); $homepage = ((x($profile,'homepage') == 1) ? L10n::t('Homepage:') : False);
$about = ((x($profile,'about') == 1) ? t('About:') : False); $about = ((x($profile,'about') == 1) ? L10n::t('About:') : False);
$location_e = $location; $location_e = $location;
$photo_menu = [ $photo_menu = [
'profile' => [t("View Profile"), Profile::zrl($profile_link)] 'profile' => [L10n::t("View Profile"), Profile::zrl($profile_link)]
]; ];
$entry = [ $entry = [
@ -180,31 +181,30 @@ function directory_content(App $a) {
unset($profile); unset($profile);
unset($location); unset($location);
if(! $arr['entry']) if (!$arr['entry']) {
continue; continue;
}
$entries[] = $arr['entry']; $entries[] = $arr['entry'];
} }
$tpl = get_markup_template('directory_header.tpl'); $tpl = get_markup_template('directory_header.tpl');
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$search' => $search, '$search' => $search,
'$globaldir' => t('Global Directory'), '$globaldir' => L10n::t('Global Directory'),
'$gdirpath' => $gdirpath, '$gdirpath' => $gdirpath,
'$desc' => t('Find on this site'), '$desc' => L10n::t('Find on this site'),
'$contacts' => $entries, '$contacts' => $entries,
'$finding' => t('Results for:'), '$finding' => L10n::t('Results for:'),
'$findterm' => (strlen($search) ? $search : ""), '$findterm' => (strlen($search) ? $search : ""),
'$title' => t('Site Directory'), '$title' => L10n::t('Site Directory'),
'$submit' => t('Find'), '$submit' => L10n::t('Find'),
'$paginate' => paginate($a), '$paginate' => paginate($a),
]); ]);
} else {
info(L10n::t("No entries \x28some entries may be hidden\x29.") . EOL);
} }
else
info( t("No entries \x28some entries may be hidden\x29.") . EOL);
return $o; return $o;
} }

View file

@ -6,6 +6,7 @@ use Friendica\App;
use Friendica\Content\ContactSelector; use Friendica\Content\ContactSelector;
use Friendica\Content\Widget; use Friendica\Content\Widget;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -19,7 +20,7 @@ require_once 'mod/contacts.php';
function dirfind_init(App $a) { function dirfind_init(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL ); notice(L10n::t('Permission denied.') . EOL );
return; return;
} }
@ -43,7 +44,7 @@ function dirfind_content(App $a, $prefix = "") {
if (strpos($search,'@') === 0) { if (strpos($search,'@') === 0) {
$search = substr($search,1); $search = substr($search,1);
$header = sprintf( t('People Search - %s'), $search); $header = L10n::t('People Search - %s', $search);
if ((valid_email($search) && validate_email($search)) || if ((valid_email($search) && validate_email($search)) ||
(substr(normalise_link($search), 0, 7) == "http://")) { (substr(normalise_link($search), 0, 7) == "http://")) {
$user_data = Probe::uri($search); $user_data = Probe::uri($search);
@ -54,7 +55,7 @@ function dirfind_content(App $a, $prefix = "") {
if (strpos($search,'!') === 0) { if (strpos($search,'!') === 0) {
$search = substr($search,1); $search = substr($search,1);
$community = true; $community = true;
$header = sprintf( t('Forum Search - %s'), $search); $header = L10n::t('Forum Search - %s', $search);
} }
$o = ''; $o = '';
@ -213,10 +214,10 @@ function dirfind_content(App $a, $prefix = "") {
} }
} else { } else {
$connlnk = System::baseUrl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url); $connlnk = System::baseUrl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url);
$conntxt = t('Connect'); $conntxt = L10n::t('Connect');
$photo_menu = [ $photo_menu = [
'profile' => [t("View Profile"), Profile::zrl($jj->url)], 'profile' => [L10n::t("View Profile"), Profile::zrl($jj->url)],
'follow' => [t("Connect/Follow"), $connlnk] 'follow' => [L10n::t("Connect/Follow"), $connlnk]
]; ];
} }
@ -251,7 +252,7 @@ function dirfind_content(App $a, $prefix = "") {
]); ]);
} else { } else {
info( t('No matches') . EOL); info(L10n::t('No matches') . EOL);
} }
} }

View file

@ -4,6 +4,7 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -63,7 +64,7 @@ function display_init(App $a)
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
$a->error = 404; $a->error = 404;
notice(t('Item not found.') . EOL); notice(L10n::t('Item not found.') . EOL);
return; return;
} }
} elseif (($a->argc == 3) && ($nick == 'feed-item')) { } elseif (($a->argc == 3) && ($nick == 'feed-item')) {
@ -194,7 +195,7 @@ function display_fetchauthor($a, $item) {
function display_content(App $a, $update = false, $update_uid = 0) { function display_content(App $a, $update = false, $update_uid = 0) {
if (Config::get('system','block_public') && !local_user() && !remote_user()) { if (Config::get('system','block_public') && !local_user() && !remote_user()) {
notice(t('Public access denied.') . EOL); notice(L10n::t('Public access denied.') . EOL);
return; return;
} }
@ -240,7 +241,7 @@ function display_content(App $a, $update = false, $update_uid = 0) {
if (!$item_id) { if (!$item_id) {
$a->error = 404; $a->error = 404;
notice(t('Item not found.').EOL); notice(L10n::t('Item not found.').EOL);
return; return;
} }
@ -301,7 +302,7 @@ function display_content(App $a, $update = false, $update_uid = 0) {
$is_owner = (local_user() && (in_array($a->profile['profile_uid'], [local_user(), 0])) ? true : false); $is_owner = (local_user() && (in_array($a->profile['profile_uid'], [local_user(), 0])) ? true : false);
if (x($a->profile, 'hidewall') && !$is_owner && !$remote_contact) { if (x($a->profile, 'hidewall') && !$is_owner && !$remote_contact) {
notice(t('Access to this profile has been restricted.') . EOL); notice(L10n::t('Access to this profile has been restricted.') . EOL);
return; return;
} }
@ -342,7 +343,7 @@ function display_content(App $a, $update = false, $update_uid = 0) {
); );
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
notice(t('Item not found.') . EOL); notice(L10n::t('Item not found.') . EOL);
return $o; return $o;
} }

View file

@ -6,24 +6,25 @@ use Friendica\App;
use Friendica\Content\Feature; use Friendica\Content\Feature;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
require_once('include/acl_selectors.php'); require_once 'include/acl_selectors.php';
function editpost_content(App $a) { function editpost_content(App $a) {
$o = ''; $o = '';
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
$post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
if (! $post_id) { if (! $post_id) {
notice( t('Item not found') . EOL); notice(L10n::t('Item not found') . EOL);
return; return;
} }
@ -33,18 +34,18 @@ function editpost_content(App $a) {
); );
if (! DBM::is_result($itm)) { if (! DBM::is_result($itm)) {
notice( t('Item not found') . EOL); notice(L10n::t('Item not found') . EOL);
return; return;
} }
$o .= replace_macros(get_markup_template("section_title.tpl"),[ $o .= replace_macros(get_markup_template("section_title.tpl"),[
'$title' => t('Edit post') '$title' => L10n::t('Edit post')
]); ]);
$tpl = get_markup_template('jot-header.tpl'); $tpl = get_markup_template('jot-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, [ $a->page['htmlhead'] .= replace_macros($tpl, [
'$baseurl' => System::baseUrl(), '$baseurl' => System::baseUrl(),
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'), '$ispublic' => '&nbsp;', // L10n::t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag, '$geotag' => $geotag,
'$nickname' => $a->user['nickname'] '$nickname' => $a->user['nickname']
]); ]);
@ -52,7 +53,7 @@ function editpost_content(App $a) {
$tpl = get_markup_template('jot-end.tpl'); $tpl = get_markup_template('jot-end.tpl');
$a->page['end'] .= replace_macros($tpl, [ $a->page['end'] .= replace_macros($tpl, [
'$baseurl' => System::baseUrl(), '$baseurl' => System::baseUrl(),
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'), '$ispublic' => '&nbsp;', // L10n::t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag, '$geotag' => $geotag,
'$nickname' => $a->user['nickname'] '$nickname' => $a->user['nickname']
]); ]);
@ -90,7 +91,7 @@ function editpost_content(App $a) {
/* if($mail_enabled) { /* if($mail_enabled) {
$selected = (($pubmail_enabled) ? ' checked="checked" ' : ''); $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
$jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> ' $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
. t("Post to Email") . '</div>'; . L10n::t("Post to Email") . '</div>';
}*/ }*/
@ -105,23 +106,23 @@ function editpost_content(App $a) {
'$is_edit' => true, '$is_edit' => true,
'$return_path' => $_SESSION['return_url'], '$return_path' => $_SESSION['return_url'],
'$action' => 'item', '$action' => 'item',
'$share' => t('Save'), '$share' => L10n::t('Save'),
'$upload' => t('Upload photo'), '$upload' => L10n::t('Upload photo'),
'$shortupload' => t('upload photo'), '$shortupload' => L10n::t('upload photo'),
'$attach' => t('Attach file'), '$attach' => L10n::t('Attach file'),
'$shortattach' => t('attach file'), '$shortattach' => L10n::t('attach file'),
'$weblink' => t('Insert web link'), '$weblink' => L10n::t('Insert web link'),
'$shortweblink' => t('web link'), '$shortweblink' => L10n::t('web link'),
'$video' => t('Insert video link'), '$video' => L10n::t('Insert video link'),
'$shortvideo' => t('video link'), '$shortvideo' => L10n::t('video link'),
'$audio' => t('Insert audio link'), '$audio' => L10n::t('Insert audio link'),
'$shortaudio' => t('audio link'), '$shortaudio' => L10n::t('audio link'),
'$setloc' => t('Set your location'), '$setloc' => L10n::t('Set your location'),
'$shortsetloc' => t('set location'), '$shortsetloc' => L10n::t('set location'),
'$noloc' => t('Clear browser location'), '$noloc' => L10n::t('Clear browser location'),
'$shortnoloc' => t('clear location'), '$shortnoloc' => L10n::t('clear location'),
'$wait' => t('Please wait'), '$wait' => L10n::t('Please wait'),
'$permset' => t('Permission settings'), '$permset' => L10n::t('Permission settings'),
'$ptyp' => $itm[0]['type'], '$ptyp' => $itm[0]['type'],
'$content' => undo_post_tagging($itm[0]['body']), '$content' => undo_post_tagging($itm[0]['body']),
'$post_id' => $post_id, '$post_id' => $post_id,
@ -129,32 +130,29 @@ function editpost_content(App $a) {
'$defloc' => $a->user['default-location'], '$defloc' => $a->user['default-location'],
'$visitor' => 'none', '$visitor' => 'none',
'$pvisit' => 'none', '$pvisit' => 'none',
'$emailcc' => t('CC: email addresses'), '$emailcc' => L10n::t('CC: email addresses'),
'$public' => t('Public post'), '$public' => L10n::t('Public post'),
'$jotnets' => $jotnets, '$jotnets' => $jotnets,
'$title' => htmlspecialchars($itm[0]['title']), '$title' => htmlspecialchars($itm[0]['title']),
'$placeholdertitle' => t('Set title'), '$placeholdertitle' => L10n::t('Set title'),
'$category' => file_tag_file_to_list($itm[0]['file'], 'category'), '$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
'$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''), '$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t('Categories (comma-separated list)') : ''),
'$emtitle' => t('Example: bob@example.com, mary@example.com'), '$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate, '$lockstate' => $lockstate,
'$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)), '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
'$bang' => (($group) ? '!' : ''), '$bang' => (($group) ? '!' : ''),
'$profile_uid' => $_SESSION['uid'], '$profile_uid' => $_SESSION['uid'],
'$preview' => t('Preview'), '$preview' => L10n::t('Preview'),
'$jotplugins' => $jotplugins, '$jotplugins' => $jotplugins,
'$sourceapp' => t($a->sourcename), '$sourceapp' => L10n::t($a->sourcename),
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
'$rand_num' => random_digits(12), '$rand_num' => random_digits(12),
//jot nav tab (used in some themes) //jot nav tab (used in some themes)
'$message' => t('Message'), '$message' => L10n::t('Message'),
'$browser' => t('Browser'), '$browser' => L10n::t('Browser'),
'$shortpermset' => t('permissions'), '$shortpermset' => L10n::t('permissions'),
]); ]);
return $o; return $o;
} }

View file

@ -6,6 +6,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -99,18 +100,18 @@ function events_post(App $a) {
$onerror_url = System::baseUrl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish"; $onerror_url = System::baseUrl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish";
if (strcmp($finish, $start) < 0 && !$nofinish) { if (strcmp($finish, $start) < 0 && !$nofinish) {
notice(t('Event can not end before it has started.') . EOL); notice(L10n::t('Event can not end before it has started.') . EOL);
if (intval($_REQUEST['preview'])) { if (intval($_REQUEST['preview'])) {
echo t('Event can not end before it has started.'); echo L10n::t('Event can not end before it has started.');
killme(); killme();
} }
goaway($onerror_url); goaway($onerror_url);
} }
if ((! $summary) || ($start === NULL_DATE)) { if ((! $summary) || ($start === NULL_DATE)) {
notice(t('Event title and start time are required.') . EOL); notice(L10n::t('Event title and start time are required.') . EOL);
if (intval($_REQUEST['preview'])) { if (intval($_REQUEST['preview'])) {
echo t('Event title and start time are required.'); echo L10n::t('Event title and start time are required.');
killme(); killme();
} }
goaway($onerror_url); goaway($onerror_url);
@ -191,7 +192,7 @@ function events_post(App $a) {
function events_content(App $a) { function events_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -388,20 +389,20 @@ function events_content(App $a) {
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$baseurl' => System::baseUrl(), '$baseurl' => System::baseUrl(),
'$tabs' => $tabs, '$tabs' => $tabs,
'$title' => t('Events'), '$title' => L10n::t('Events'),
'$view' => t('View'), '$view' => L10n::t('View'),
'$new_event' => [System::baseUrl() . '/events/new', t('Create New Event'), '', ''], '$new_event' => [System::baseUrl() . '/events/new', L10n::t('Create New Event'), '', ''],
'$previous' => [System::baseUrl() . '/events/$prevyear/$prevmonth', t('Previous'), '', ''], '$previous' => [System::baseUrl() . '/events/$prevyear/$prevmonth', L10n::t('Previous'), '', ''],
'$next' => [System::baseUrl() . '/events/$nextyear/$nextmonth', t('Next'), '', ''], '$next' => [System::baseUrl() . '/events/$nextyear/$nextmonth', L10n::t('Next'), '', ''],
'$calendar' => cal($y, $m, $links, ' eventcal'), '$calendar' => cal($y, $m, $links, ' eventcal'),
'$events' => $events, '$events' => $events,
'$today' => t('today'), '$today' => L10n::t('today'),
'$month' => t('month'), '$month' => L10n::t('month'),
'$week' => t('week'), '$week' => L10n::t('week'),
'$day' => t('day'), '$day' => L10n::t('day'),
'$list' => t('list'), '$list' => L10n::t('list'),
]); ]);
if (x($_GET, 'id')) { if (x($_GET, 'id')) {
@ -505,34 +506,34 @@ function events_content(App $a) {
'$deny_cid' => json_encode($perms['deny_cid']), '$deny_cid' => json_encode($perms['deny_cid']),
'$deny_gid' => json_encode($perms['deny_gid']), '$deny_gid' => json_encode($perms['deny_gid']),
'$title' => t('Event details'), '$title' => L10n::t('Event details'),
'$desc' => t('Starting date and Title are required.'), '$desc' => L10n::t('Starting date and Title are required.'),
'$s_text' => t('Event Starts:') . ' <span class="required" title="' . t('Required') . '">*</span>', '$s_text' => L10n::t('Event Starts:') . ' <span class="required" title="' . L10n::t('Required') . '">*</span>',
'$s_dsel' => datetimesel(new DateTime(), DateTime::createFromFormat('Y', $syear+5), DateTime::createFromFormat('Y-m-d H:i', "$syear-$smonth-$sday $shour:$sminute"), t('Event Starts:'), 'start_text', true, true, '', '', true), '$s_dsel' => datetimesel(new DateTime(), DateTime::createFromFormat('Y', $syear+5), DateTime::createFromFormat('Y-m-d H:i', "$syear-$smonth-$sday $shour:$sminute"), L10n::t('Event Starts:'), 'start_text', true, true, '', '', true),
'$n_text' => t('Finish date/time is not known or not relevant'), '$n_text' => L10n::t('Finish date/time is not known or not relevant'),
'$n_checked' => $n_checked, '$n_checked' => $n_checked,
'$f_text' => t('Event Finishes:'), '$f_text' => L10n::t('Event Finishes:'),
'$f_dsel' => datetimesel(new DateTime(), DateTime::createFromFormat('Y', $fyear+5), DateTime::createFromFormat('Y-m-d H:i', "$fyear-$fmonth-$fday $fhour:$fminute"), t('Event Finishes:'), 'finish_text', true, true, 'start_text'), '$f_dsel' => datetimesel(new DateTime(), DateTime::createFromFormat('Y', $fyear+5), DateTime::createFromFormat('Y-m-d H:i', "$fyear-$fmonth-$fday $fhour:$fminute"), L10n::t('Event Finishes:'), 'finish_text', true, true, 'start_text'),
'$a_text' => t('Adjust for viewer timezone'), '$a_text' => L10n::t('Adjust for viewer timezone'),
'$a_checked' => $a_checked, '$a_checked' => $a_checked,
'$d_text' => t('Description:'), '$d_text' => L10n::t('Description:'),
'$d_orig' => $d_orig, '$d_orig' => $d_orig,
'$l_text' => t('Location:'), '$l_text' => L10n::t('Location:'),
'$l_orig' => $l_orig, '$l_orig' => $l_orig,
'$t_text' => t('Title:') . ' <span class="required" title="' . t('Required') . '">*</span>', '$t_text' => L10n::t('Title:') . ' <span class="required" title="' . L10n::t('Required') . '">*</span>',
'$t_orig' => $t_orig, '$t_orig' => $t_orig,
'$summary' => ['summary', t('Title:'), $t_orig, '', '*'], '$summary' => ['summary', L10n::t('Title:'), $t_orig, '', '*'],
'$sh_text' => t('Share this event'), '$sh_text' => L10n::t('Share this event'),
'$share' => ['share', t('Share this event'), $sh_checked, '', $sh_disabled], '$share' => ['share', L10n::t('Share this event'), $sh_checked, '', $sh_disabled],
'$sh_checked' => $sh_checked, '$sh_checked' => $sh_checked,
'$nofinish' => ['nofinish', t('Finish date/time is not known or not relevant'), $n_checked], '$nofinish' => ['nofinish', L10n::t('Finish date/time is not known or not relevant'), $n_checked],
'$adjust' => ['adjust', t('Adjust for viewer timezone'), $a_checked], '$adjust' => ['adjust', L10n::t('Adjust for viewer timezone'), $a_checked],
'$preview' => t('Preview'), '$preview' => L10n::t('Preview'),
'$acl' => $acl, '$acl' => $acl,
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
'$basic' => t('Basic'), '$basic' => L10n::t('Basic'),
'$advanced' => t('Advanced'), '$advanced' => L10n::t('Advanced'),
'$permissions' => t('Permissions'), '$permissions' => L10n::t('Permissions'),
]); ]);
@ -552,9 +553,9 @@ function events_content(App $a) {
} }
if ($del == 0) { if ($del == 0) {
notice(t('Failed to remove event' ) . EOL); notice(L10n::t('Failed to remove event') . EOL);
} else { } else {
info(t('Event removed') . EOL); info(L10n::t('Event removed') . EOL);
} }
goaway(System::baseUrl() . '/events'); goaway(System::baseUrl() . '/events');

View file

@ -6,14 +6,15 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Object\Image; use Friendica\Object\Image;
/** /**
* @param App $a * @param App $a
*/ */
function fbrowser_content(App $a) { function fbrowser_content(App $a)
{
if (!local_user()) { if (!local_user()) {
killme(); killme();
} }
@ -24,33 +25,36 @@ function fbrowser_content(App $a) {
$template_file = "filebrowser.tpl"; $template_file = "filebrowser.tpl";
$mode = ""; $mode = "";
if (x($_GET,'mode')) { if (x($_GET, 'mode')) {
$mode = "?mode=".$_GET['mode']; $mode = "?mode=".$_GET['mode'];
} }
switch ($a->argv[1]) { switch ($a->argv[1]) {
case "image": case "image":
$path = [["", t("Photos")]]; $path = [["", L10n::t("Photos")]];
$albums = false; $albums = false;
$sql_extra = ""; $sql_extra = "";
$sql_extra2 = " ORDER BY created DESC LIMIT 0, 10"; $sql_extra2 = " ORDER BY created DESC LIMIT 0, 10";
if ($a->argc==2){ if ($a->argc==2) {
$albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' ", $albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' ",
intval(local_user()), intval(local_user()),
dbesc('Contact Photos'), dbesc('Contact Photos'),
dbesc( t('Contact Photos')) dbesc(L10n::t('Contact Photos'))
); );
function _map_folder1($el){return [bin2hex($el['album']),$el['album']];}; function _map_folder1($el)
$albums = array_map( "_map_folder1" , $albums); {
return [bin2hex($el['album']),$el['album']];
};
$albums = array_map("_map_folder1", $albums);
} }
$album = ""; $album = "";
if ($a->argc==3){ if ($a->argc==3) {
$album = hex2bin($a->argv[2]); $album = hex2bin($a->argv[2]);
$sql_extra = sprintf("AND `album` = '%s' ",dbesc($album)); $sql_extra = sprintf("AND `album` = '%s' ", dbesc($album));
$sql_extra2 = ""; $sql_extra2 = "";
$path[]=[$a->argv[2], $album]; $path[]=[$a->argv[2], $album];
} }
@ -61,10 +65,11 @@ function fbrowser_content(App $a) {
GROUP BY `resource-id` $sql_extra2", GROUP BY `resource-id` $sql_extra2",
intval(local_user()), intval(local_user()),
dbesc('Contact Photos'), dbesc('Contact Photos'),
dbesc( t('Contact Photos')) dbesc(L10n::t('Contact Photos'))
); );
function _map_files1($rr){ function _map_files1($rr)
{
$a = get_app(); $a = get_app();
$types = Image::supportedTypes(); $types = Image::supportedTypes();
$ext = $types[$rr['type']]; $ext = $types[$rr['type']];
@ -73,10 +78,11 @@ function fbrowser_content(App $a) {
// Take the largest picture that is smaller or equal 640 pixels // Take the largest picture that is smaller or equal 640 pixels
$p = q("SELECT `scale` FROM `photo` WHERE `resource-id` = '%s' AND `height` <= 640 AND `width` <= 640 ORDER BY `resource-id`, `scale` LIMIT 1", $p = q("SELECT `scale` FROM `photo` WHERE `resource-id` = '%s' AND `height` <= 640 AND `width` <= 640 ORDER BY `resource-id`, `scale` LIMIT 1",
dbesc($rr['resource-id'])); dbesc($rr['resource-id']));
if ($p) if ($p) {
$scale = $p[0]["scale"]; $scale = $p[0]["scale"];
else } else {
$scale = $rr['loq']; $scale = $rr['loq'];
}
return [ return [
System::baseUrl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'], System::baseUrl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'],
@ -94,11 +100,11 @@ function fbrowser_content(App $a) {
'$path' => $path, '$path' => $path,
'$folders' => $albums, '$folders' => $albums,
'$files' => $files, '$files' => $files,
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$upload' => L10n::t('Upload')
]); ]);
break; break;
case "file": case "file":
if ($a->argc==2) { if ($a->argc==2) {
@ -106,9 +112,10 @@ function fbrowser_content(App $a) {
intval(local_user()) intval(local_user())
); );
function _map_files2($rr){ function _map_files2($rr)
{
$a = get_app(); $a = get_app();
list($m1,$m2) = explode("/",$rr['filetype']); list($m1,$m2) = explode("/", $rr['filetype']);
$filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip"); $filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
$filename_e = $rr['filename']; $filename_e = $rr['filename'];
@ -121,24 +128,22 @@ function fbrowser_content(App $a) {
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$type' => 'file', '$type' => 'file',
'$baseurl' => System::baseUrl(), '$baseurl' => System::baseUrl(),
'$path' => [ [ "", t("Files")] ], '$path' => [ [ "", L10n::t("Files")] ],
'$folders' => false, '$folders' => false,
'$files' =>$files, '$files' => $files,
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$upload' => L10n::t('Upload')
]); ]);
} }
break; break;
} }
if (x($_GET,'mode')) { if (x($_GET, 'mode')) {
return $o; return $o;
} else { } else {
echo $o; echo $o;
killme(); killme();
} }
} }

View file

@ -4,6 +4,7 @@ This file is part of the Diaspora protocol. It is used for fetching single publi
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Protocol\Diaspora; use Friendica\Protocol\Diaspora;
use Friendica\Util\XML; use Friendica\Util\XML;
@ -12,7 +13,7 @@ function fetch_init(App $a)
{ {
if (($a->argc != 3) || (!in_array($a->argv[1], ["post", "status_message", "reshare"]))) { if (($a->argc != 3) || (!in_array($a->argv[1], ["post", "status_message", "reshare"]))) {
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found')); header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found'));
killme(); killme();
} }
@ -48,7 +49,7 @@ function fetch_init(App $a)
} }
} }
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found')); header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found'));
killme(); killme();
} }
@ -61,7 +62,7 @@ function fetch_init(App $a)
); );
if (!$r) { if (!$r) {
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found')); header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found'));
killme(); killme();
} }
$user = $r[0]; $user = $r[0];

View file

@ -1,14 +1,17 @@
<?php <?php
/**
* @file mod/filer.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
require_once('include/security.php'); require_once 'include/security.php';
require_once('include/bbcode.php'); require_once 'include/bbcode.php';
require_once('include/items.php'); require_once 'include/items.php';
function filer_content(App $a) {
function filer_content(App $a)
{
if (! local_user()) { if (! local_user()) {
killme(); killme();
} }
@ -18,19 +21,19 @@ function filer_content(App $a) {
logger('filer: tag ' . $term . ' item ' . $item_id); logger('filer: tag ' . $term . ' item ' . $item_id);
if($item_id && strlen($term)){ if ($item_id && strlen($term)) {
// file item // file item
file_tag_save_file(local_user(),$item_id,$term); file_tag_save_file(local_user(), $item_id, $term);
} else { } else {
// return filer dialog // return filer dialog
$filetags = PConfig::get(local_user(),'system','filetags'); $filetags = PConfig::get(local_user(), 'system', 'filetags');
$filetags = file_tag_file_to_list($filetags,'file'); $filetags = file_tag_file_to_list($filetags, 'file');
$filetags = explode(",", $filetags); $filetags = explode(",", $filetags);
$tpl = get_markup_template("filer_dialog.tpl"); $tpl = get_markup_template("filer_dialog.tpl");
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$field' => ['term', t("Save to Folder:"), '', '', $filetags, t('- select -')], '$field' => ['term', L10n::t("Save to Folder:"), '', '', $filetags, L10n::t('- select -')],
'$submit' => t('Save'), '$submit' => L10n::t('Save'),
]); ]);
echo $o; echo $o;

View file

@ -4,6 +4,7 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
@ -12,7 +13,7 @@ use Friendica\Network\Probe;
function follow_post(App $a) { function follow_post(App $a) {
if (!local_user()) { if (!local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
goaway($_SESSION['return_url']); goaway($_SESSION['return_url']);
// NOTREACHED // NOTREACHED
} }
@ -40,9 +41,9 @@ function follow_post(App $a) {
goaway(System::baseUrl().'/contacts/'.$result['cid']); goaway(System::baseUrl().'/contacts/'.$result['cid']);
} }
info(t('Contact added').EOL); info(L10n::t('Contact added').EOL);
if (strstr($return_url,'contacts')) { if (strstr($return_url, 'contacts')) {
goaway(System::baseUrl().'/contacts/'.$contact_id); goaway(System::baseUrl().'/contacts/'.$contact_id);
} }
@ -53,7 +54,7 @@ function follow_post(App $a) {
function follow_content(App $a) { function follow_content(App $a) {
if (!local_user()) { if (!local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
goaway($_SESSION['return_url']); goaway($_SESSION['return_url']);
// NOTREACHED // NOTREACHED
} }
@ -61,7 +62,7 @@ function follow_content(App $a) {
$uid = local_user(); $uid = local_user();
$url = notags(trim($_REQUEST['url'])); $url = notags(trim($_REQUEST['url']));
$submit = t('Submit Request'); $submit = L10n::t('Submit Request');
// There is a current issue. It seems as if you can't start following a Friendica that is following you // There is a current issue. It seems as if you can't start following a Friendica that is following you
// With Diaspora this works - but Friendica is special, it seems ... // With Diaspora this works - but Friendica is special, it seems ...
@ -72,7 +73,7 @@ function follow_content(App $a) {
dbesc(normalise_link($url)), dbesc($url), dbesc(NETWORK_STATUSNET)); dbesc(normalise_link($url)), dbesc($url), dbesc(NETWORK_STATUSNET));
if ($r) { if ($r) {
notice(t('You already added this contact.').EOL); notice(L10n::t('You already added this contact.').EOL);
$submit = ""; $submit = "";
//goaway($_SESSION['return_url']); //goaway($_SESSION['return_url']);
// NOTREACHED // NOTREACHED
@ -80,22 +81,22 @@ function follow_content(App $a) {
$ret = Probe::uri($url); $ret = Probe::uri($url);
if (($ret["network"] == NETWORK_DIASPORA) && !Config::get('system','diaspora_enabled')) { if (($ret["network"] == NETWORK_DIASPORA) && !Config::get('system', 'diaspora_enabled')) {
notice(t("Diaspora support isn't enabled. Contact can't be added.") . EOL); notice(L10n::t("Diaspora support isn't enabled. Contact can't be added.") . EOL);
$submit = ""; $submit = "";
//goaway($_SESSION['return_url']); //goaway($_SESSION['return_url']);
// NOTREACHED // NOTREACHED
} }
if (($ret["network"] == NETWORK_OSTATUS) && Config::get('system','ostatus_disabled')) { if (($ret["network"] == NETWORK_OSTATUS) && Config::get('system', 'ostatus_disabled')) {
notice(t("OStatus support is disabled. Contact can't be added.") . EOL); notice(L10n::t("OStatus support is disabled. Contact can't be added.") . EOL);
$submit = ""; $submit = "";
//goaway($_SESSION['return_url']); //goaway($_SESSION['return_url']);
// NOTREACHED // NOTREACHED
} }
if ($ret["network"] == NETWORK_PHANTOM) { if ($ret["network"] == NETWORK_PHANTOM) {
notice(t("The network type couldn't be detected. Contact can't be added.") . EOL); notice(L10n::t("The network type couldn't be detected. Contact can't be added.") . EOL);
$submit = ""; $submit = "";
//goaway($_SESSION['return_url']); //goaway($_SESSION['return_url']);
// NOTREACHED // NOTREACHED
@ -116,7 +117,7 @@ function follow_content(App $a) {
$r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", intval($uid)); $r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", intval($uid));
if (!$r) { if (!$r) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
goaway($_SESSION['return_url']); goaway($_SESSION['return_url']);
// NOTREACHED // NOTREACHED
} }
@ -141,38 +142,38 @@ function follow_content(App $a) {
$r[0]["about"] = ""; $r[0]["about"] = "";
} }
$header = t("Connect/Follow"); $header = L10n::t("Connect/Follow");
$o = replace_macros($tpl,[ $o = replace_macros($tpl, [
'$header' => htmlentities($header), '$header' => htmlentities($header),
//'$photo' => proxy_url($ret["photo"], false, PROXY_SIZE_SMALL), //'$photo' => proxy_url($ret["photo"], false, PROXY_SIZE_SMALL),
'$desc' => "", '$desc' => "",
'$pls_answer' => t('Please answer the following:'), '$pls_answer' => L10n::t('Please answer the following:'),
'$does_know_you' => ['knowyou', sprintf(t('Does %s know you?'),$ret["name"]), false, '', [t('No'), t('Yes')]], '$does_know_you' => ['knowyou', L10n::t('Does %s know you?', $ret["name"]), false, '', [L10n::t('No'), L10n::t('Yes')]],
'$add_note' => t('Add a personal note:'), '$add_note' => L10n::t('Add a personal note:'),
'$page_desc' => "", '$page_desc' => "",
'$friendica' => "", '$friendica' => "",
'$statusnet' => "", '$statusnet' => "",
'$diaspora' => "", '$diaspora' => "",
'$diasnote' => "", '$diasnote' => "",
'$your_address' => t('Your Identity Address:'), '$your_address' => L10n::t('Your Identity Address:'),
'$invite_desc' => "", '$invite_desc' => "",
'$emailnet' => "", '$emailnet' => "",
'$submit' => $submit, '$submit' => $submit,
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
'$nickname' => "", '$nickname' => "",
'$name' => $ret["name"], '$name' => $ret["name"],
'$url' => $ret["url"], '$url' => $ret["url"],
'$zrl' => Profile::zrl($ret["url"]), '$zrl' => Profile::zrl($ret["url"]),
'$url_label' => t("Profile URL"), '$url_label' => L10n::t("Profile URL"),
'$myaddr' => $myaddr, '$myaddr' => $myaddr,
'$request' => $request, '$request' => $request,
/*'$location' => bbcode($r[0]["location"]), /*'$location' => bbcode($r[0]["location"]),
'$location_label' => t("Location:"), '$location_label' => L10n::t("Location:"),
'$about' => bbcode($r[0]["about"], false, false), '$about' => bbcode($r[0]["about"], false, false),
'$about_label' => t("About:"), */ '$about_label' => L10n::t("About:"), */
'$keywords' => $r[0]["keywords"], '$keywords' => $r[0]["keywords"],
'$keywords_label' => t("Tags:") '$keywords_label' => L10n::t("Tags:")
]); ]);
$a->page['aside'] = ""; $a->page['aside'] = "";
@ -181,8 +182,8 @@ function follow_content(App $a) {
if ($gcontact_id <> 0) { if ($gcontact_id <> 0) {
$o .= replace_macros(get_markup_template('section_title.tpl'), $o .= replace_macros(get_markup_template('section_title.tpl'),
['$title' => t('Status Messages and Posts') ['$title' => L10n::t('Status Messages and Posts')]
]); );
// Show last public posts // Show last public posts
$o .= Contact::getPostsFromUrl($ret["url"]); $o .= Contact::getPostsFromUrl($ret["url"]);

View file

@ -1,17 +1,21 @@
<?php <?php
/**
* @file mod/friendica.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Database\DBM; use Friendica\Database\DBM;
function friendica_init(App $a) { function friendica_init(App $a)
if ($a->argv[1] == "json"){ {
if ($a->argv[1] == "json") {
$register_policy = ['REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN']; $register_policy = ['REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'];
$sql_extra = ''; $sql_extra = '';
if (x($a->config,'admin_nickname')) { if (x($a->config, 'admin_nickname')) {
$sql_extra = sprintf(" AND `nickname` = '%s' ", dbesc($a->config['admin_nickname'])); $sql_extra = sprintf(" AND `nickname` = '%s' ", dbesc($a->config['admin_nickname']));
} }
if (isset($a->config['admin_email']) && $a->config['admin_email']!='') { if (isset($a->config['admin_email']) && $a->config['admin_email']!='') {
@ -30,7 +34,7 @@ function friendica_init(App $a) {
if (is_array($a->addons) && count($a->addons)) { if (is_array($a->addons) && count($a->addons)) {
$r = q("SELECT * FROM `addon` WHERE `hidden` = 0"); $r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
foreach($r as $rr) { foreach ($r as $rr) {
$visible_addons[] = $rr['name']; $visible_addons[] = $rr['name'];
} }
} }
@ -57,7 +61,7 @@ function friendica_init(App $a) {
'admin' => $admin, 'admin' => $admin,
'site_name' => $a->config['sitename'], 'site_name' => $a->config['sitename'],
'platform' => FRIENDICA_PLATFORM, 'platform' => FRIENDICA_PLATFORM,
'info' => ((x($a->config,'info')) ? $a->config['info'] : ''), 'info' => ((x($a->config, 'info')) ? $a->config['info'] : ''),
'no_scrape_url' => System::baseUrl().'/noscrape' 'no_scrape_url' => System::baseUrl().'/noscrape'
]; ];
@ -66,36 +70,37 @@ function friendica_init(App $a) {
} }
} }
function friendica_content(App $a) { function friendica_content(App $a)
{
$o = '<h1>Friendica</h1>' . PHP_EOL; $o = '<h1>Friendica</h1>' . PHP_EOL;
$o .= '<p>'; $o .= '<p>';
$o .= t('This is Friendica, version') . ' <strong>' . FRIENDICA_VERSION . '</strong> '; $o .= L10n::t('This is Friendica, version') . ' <strong>' . FRIENDICA_VERSION . '</strong> ';
$o .= t('running at web location') . ' ' . System::baseUrl(); $o .= L10n::t('running at web location') . ' ' . System::baseUrl();
$o .= '</p>' . PHP_EOL; $o .= '</p>' . PHP_EOL;
$o .= '<p>'; $o .= '<p>';
$o .= t('Please visit <a href="https://friendi.ca">Friendi.ca</a> to learn more about the Friendica project.') . PHP_EOL; $o .= L10n::t('Please visit <a href="https://friendi.ca">Friendi.ca</a> to learn more about the Friendica project.') . PHP_EOL;
$o .= '</p>' . PHP_EOL; $o .= '</p>' . PHP_EOL;
$o .= '<p>'; $o .= '<p>';
$o .= t('Bug reports and issues: please visit') . ' ' . '<a href="https://github.com/friendica/friendica/issues?state=open">'.t('the bugtracker at github').'</a>'; $o .= L10n::t('Bug reports and issues: please visit') . ' ' . '<a href="https://github.com/friendica/friendica/issues?state=open">'.L10n::t('the bugtracker at github').'</a>';
$o .= '</p>' . PHP_EOL; $o .= '</p>' . PHP_EOL;
$o .= '<p>'; $o .= '<p>';
$o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com'); $o .= L10n::t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com');
$o .= '</p>' . PHP_EOL; $o .= '</p>' . PHP_EOL;
$visible_addons = []; $visible_addons = [];
if (is_array($a->addons) && count($a->addons)) { if (is_array($a->addons) && count($a->addons)) {
$r = q("SELECT * FROM `addon` WHERE `hidden` = 0"); $r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
foreach($r as $rr) { foreach ($r as $rr) {
$visible_addons[] = $rr['name']; $visible_addons[] = $rr['name'];
} }
} }
} }
if (count($visible_addons)) { if (count($visible_addons)) {
$o .= '<p>' . t('Installed addons/addons/apps:') . '</p>' . PHP_EOL; $o .= '<p>' . L10n::t('Installed addons/addons/apps:') . '</p>' . PHP_EOL;
$sorted = $visible_addons; $sorted = $visible_addons;
$s = ''; $s = '';
sort($sorted); sort($sorted);
@ -109,13 +114,13 @@ function friendica_content(App $a) {
} }
$o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>' . PHP_EOL; $o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>' . PHP_EOL;
} else { } else {
$o .= '<p>' . t('No installed addons/addons/apps') . '</p>' . PHP_EOL; $o .= '<p>' . L10n::t('No installed addons/addons/apps') . '</p>' . PHP_EOL;
} }
$blocklist = Config::get('system', 'blocklist'); $blocklist = Config::get('system', 'blocklist');
if (count($blocklist)) { if (count($blocklist)) {
$o .= '<div id="about_blocklist"><p>' . t('On this server the following remote servers are blocked.') . '</p>' . PHP_EOL; $o .= '<div id="about_blocklist"><p>' . L10n::t('On this server the following remote servers are blocked.') . '</p>' . PHP_EOL;
$o .= '<table class="table"><thead><tr><th>' . t('Blocked domain') . '</th><th>' . t('Reason for the block') . '</th></thead><tbody>' . PHP_EOL; $o .= '<table class="table"><thead><tr><th>' . L10n::t('Blocked domain') . '</th><th>' . L10n::t('Reason for the block') . '</th></thead><tbody>' . PHP_EOL;
foreach ($blocklist as $b) { foreach ($blocklist as $b) {
$o .= '<tr><td>' . $b['domain'] .'</td><td>' . $b['reason'] . '</td></tr>' . PHP_EOL; $o .= '<tr><td>' . $b['domain'] .'</td><td>' . $b['reason'] . '</td></tr>' . PHP_EOL;
} }

View file

@ -3,11 +3,12 @@
* @file mod/fsuggest.php * @file mod/fsuggest.php
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
function fsuggest_post(App $a) { function fsuggest_post(App $a)
{
if (! local_user()) { if (! local_user()) {
return; return;
} }
@ -23,7 +24,7 @@ function fsuggest_post(App $a) {
intval(local_user()) intval(local_user())
); );
if (! DBM::is_result($r)) { if (! DBM::is_result($r)) {
notice( t('Contact not found.') . EOL); notice(L10n::t('Contact not found.') . EOL);
return; return;
} }
$contact = $r[0]; $contact = $r[0];
@ -34,13 +35,12 @@ function fsuggest_post(App $a) {
$note = escape_tags(trim($_POST['note'])); $note = escape_tags(trim($_POST['note']));
if($new_contact) { if ($new_contact) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($new_contact), intval($new_contact),
intval(local_user()) intval(local_user())
); );
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
$x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`) $x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`)
VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')", VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')",
intval(local_user()), intval(local_user()),
@ -66,22 +66,17 @@ function fsuggest_post(App $a) {
Worker::add(PRIORITY_HIGH, 'Notifier', 'suggest', $fsuggest_id); Worker::add(PRIORITY_HIGH, 'Notifier', 'suggest', $fsuggest_id);
} }
info( t('Friend suggestion sent.') . EOL); info(L10n::t('Friend suggestion sent.') . EOL);
} }
} }
} }
function fsuggest_content(App $a) function fsuggest_content(App $a)
{ {
require_once 'include/acl_selectors.php'; require_once 'include/acl_selectors.php';
if (! local_user()) { if (! local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -97,14 +92,14 @@ function fsuggest_content(App $a)
intval(local_user()) intval(local_user())
); );
if (! DBM::is_result($r)) { if (! DBM::is_result($r)) {
notice(t('Contact not found.') . EOL); notice(L10n::t('Contact not found.') . EOL);
return; return;
} }
$contact = $r[0]; $contact = $r[0];
$o = '<h3>' . t('Suggest Friends') . '</h3>'; $o = '<h3>' . L10n::t('Suggest Friends') . '</h3>';
$o .= '<div id="fsuggest-desc" >' . sprintf(t('Suggest a friend for %s'), $contact['name']) . '</div>'; $o .= '<div id="fsuggest-desc" >' . L10n::t('Suggest a friend for %s', $contact['name']) . '</div>';
$o .= '<form id="fsuggest-form" action="fsuggest/' . $contact_id . '" method="post" >'; $o .= '<form id="fsuggest-form" action="fsuggest/' . $contact_id . '" method="post" >';
@ -116,7 +111,7 @@ function fsuggest_content(App $a)
); );
$o .= '<div id="fsuggest-submit-wrapper"><input id="fsuggest-submit" type="submit" name="submit" value="' . t('Submit') . '" /></div>'; $o .= '<div id="fsuggest-submit-wrapper"><input id="fsuggest-submit" type="submit" name="submit" value="' . L10n::t('Submit') . '" /></div>';
$o .= '</form>'; $o .= '</form>';
return $o; return $o;

View file

@ -7,6 +7,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -22,7 +23,7 @@ function group_init(App $a) {
function group_post(App $a) { function group_post(App $a) {
if (! local_user()) { if (! local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -32,13 +33,13 @@ function group_post(App $a) {
$name = notags(trim($_POST['groupname'])); $name = notags(trim($_POST['groupname']));
$r = Group::create(local_user(), $name); $r = Group::create(local_user(), $name);
if ($r) { if ($r) {
info(t('Group created.') . EOL); info(L10n::t('Group created.') . EOL);
$r = Group::getIdByName(local_user(), $name); $r = Group::getIdByName(local_user(), $name);
if ($r) { if ($r) {
goaway(System::baseUrl() . '/group/' . $r); goaway(System::baseUrl() . '/group/' . $r);
} }
} else { } else {
notice(t('Could not create group.') . EOL); notice(L10n::t('Could not create group.') . EOL);
} }
goaway(System::baseUrl() . '/group'); goaway(System::baseUrl() . '/group');
return; // NOTREACHED return; // NOTREACHED
@ -52,7 +53,7 @@ function group_post(App $a) {
intval(local_user()) intval(local_user())
); );
if (! DBM::is_result($r)) { if (! DBM::is_result($r)) {
notice(t('Group not found.') . EOL); notice(L10n::t('Group not found.') . EOL);
goaway(System::baseUrl() . '/contacts'); goaway(System::baseUrl() . '/contacts');
return; // NOTREACHED return; // NOTREACHED
} }
@ -66,7 +67,7 @@ function group_post(App $a) {
); );
if ($r) { if ($r) {
info(t('Group name changed.') . EOL); info(L10n::t('Group name changed.') . EOL);
} }
} }
@ -79,7 +80,7 @@ function group_content(App $a) {
$change = false; $change = false;
if (! local_user()) { if (! local_user()) {
notice(t('Permission denied') . EOL); notice(L10n::t('Permission denied') . EOL);
return; return;
} }
@ -93,13 +94,13 @@ function group_content(App $a) {
$tpl = get_markup_template('group_edit.tpl'); $tpl = get_markup_template('group_edit.tpl');
$context = [ $context = [
'$submit' => t('Save Group'), '$submit' => L10n::t('Save Group'),
]; ];
if (($a->argc == 2) && ($a->argv[1] === 'new')) { if (($a->argc == 2) && ($a->argv[1] === 'new')) {
return replace_macros($tpl, $context + [ return replace_macros($tpl, $context + [
'$title' => t('Create a group of contacts/friends.'), '$title' => L10n::t('Create a group of contacts/friends.'),
'$gname' => ['groupname', t('Group Name: '), '', ''], '$gname' => ['groupname', L10n::t('Group Name: '), '', ''],
'$gid' => 'new', '$gid' => 'new',
'$form_security_token' => get_form_security_token("group_edit"), '$form_security_token' => get_form_security_token("group_edit"),
]); ]);
@ -123,9 +124,9 @@ function group_content(App $a) {
} }
if ($result) { if ($result) {
info(t('Group removed.') . EOL); info(L10n::t('Group removed.') . EOL);
} else { } else {
notice(t('Unable to remove group.') . EOL); notice(L10n::t('Unable to remove group.') . EOL);
} }
} }
goaway(System::baseUrl() . '/group'); goaway(System::baseUrl() . '/group');
@ -154,7 +155,7 @@ function group_content(App $a) {
); );
if (! DBM::is_result($r)) { if (! DBM::is_result($r)) {
notice(t('Group not found.') . EOL); notice(L10n::t('Group not found.') . EOL);
goaway(System::baseUrl() . '/contacts'); goaway(System::baseUrl() . '/contacts');
} }
@ -189,18 +190,18 @@ function group_content(App $a) {
$drop_tpl = get_markup_template('group_drop.tpl'); $drop_tpl = get_markup_template('group_drop.tpl');
$drop_txt = replace_macros($drop_tpl, [ $drop_txt = replace_macros($drop_tpl, [
'$id' => $group['id'], '$id' => $group['id'],
'$delete' => t('Delete Group'), '$delete' => L10n::t('Delete Group'),
'$form_security_token' => get_form_security_token("group_drop"), '$form_security_token' => get_form_security_token("group_drop"),
]); ]);
$context = $context + [ $context = $context + [
'$title' => t('Group Editor'), '$title' => L10n::t('Group Editor'),
'$gname' => ['groupname', t('Group Name: '), $group['name'], ''], '$gname' => ['groupname', L10n::t('Group Name: '), $group['name'], ''],
'$gid' => $group['id'], '$gid' => $group['id'],
'$drop' => $drop_txt, '$drop' => $drop_txt,
'$form_security_token' => get_form_security_token('group_edit'), '$form_security_token' => get_form_security_token('group_edit'),
'$edit_name' => t('Edit Group Name') '$edit_name' => L10n::t('Edit Group Name')
]; ];
} }
@ -210,10 +211,10 @@ function group_content(App $a) {
} }
$groupeditor = [ $groupeditor = [
'label_members' => t('Members'), 'label_members' => L10n::t('Members'),
'members' => [], 'members' => [],
'label_contacts' => t('All Contacts'), 'label_contacts' => L10n::t('All Contacts'),
'group_is_empty' => t('Group is empty'), 'group_is_empty' => L10n::t('Group is empty'),
'contacts' => [], 'contacts' => [],
]; ];
@ -226,7 +227,7 @@ function group_content(App $a) {
$entry['label'] = 'members'; $entry['label'] = 'members';
$entry['photo_menu'] = ''; $entry['photo_menu'] = '';
$entry['change_member'] = [ $entry['change_member'] = [
'title' => t("Remove Contact"), 'title' => L10n::t("Remove Contact"),
'gid' => $group['id'], 'gid' => $group['id'],
'cid' => $member['id'], 'cid' => $member['id'],
'sec_token' => $sec_token 'sec_token' => $sec_token
@ -250,7 +251,7 @@ function group_content(App $a) {
$entry['label'] = 'contacts'; $entry['label'] = 'contacts';
$entry['photo_menu'] = ''; $entry['photo_menu'] = '';
$entry['change_member'] = [ $entry['change_member'] = [
'title' => t("Add Contact"), 'title' => L10n::t("Add Contact"),
'gid' => $group['id'], 'gid' => $group['id'],
'cid' => $member['id'], 'cid' => $member['id'],
'sec_token' => $sec_token 'sec_token' => $sec_token
@ -262,7 +263,7 @@ function group_content(App $a) {
} }
$context['$groupeditor'] = $groupeditor; $context['$groupeditor'] = $groupeditor;
$context['$desc'] = t('Click on a contact to add or remove.'); $context['$desc'] = L10n::t('Click on a contact to add or remove.');
// If there are to many contacts we could provide an alternative view mode // If there are to many contacts we could provide an alternative view mode
$total = count($groupeditor['members']) + count($groupeditor['contacts']); $total = count($groupeditor['members']) + count($groupeditor['contacts']);

View file

@ -4,6 +4,7 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Model\Profile; use Friendica\Model\Profile;
@ -14,7 +15,7 @@ function hcard_init(App $a)
if ($a->argc > 1) { if ($a->argc > 1) {
$which = $a->argv[1]; $which = $a->argv[1];
} else { } else {
notice(t('No profile') . EOL); notice(L10n::t('No profile') . EOL);
$a->error = 404; $a->error = 404;
return; return;
} }

View file

@ -5,6 +5,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Content\Text\Markdown; use Friendica\Content\Text\Markdown;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
if (!function_exists('load_doc_file')) { if (!function_exists('load_doc_file')) {
@ -44,22 +45,22 @@ function help_content(App $a) {
$title = basename($path); $title = basename($path);
$filename = $path; $filename = $path;
$text = load_doc_file('doc/' . $path . '.md'); $text = load_doc_file('doc/' . $path . '.md');
$a->page['title'] = t('Help:') . ' ' . str_replace('-', ' ', notags($title)); $a->page['title'] = L10n::t('Help:') . ' ' . str_replace('-', ' ', notags($title));
} }
$home = load_doc_file('doc/Home.md'); $home = load_doc_file('doc/Home.md');
if (!$text) { if (!$text) {
$text = $home; $text = $home;
$filename = "Home"; $filename = "Home";
$a->page['title'] = t('Help'); $a->page['title'] = L10n::t('Help');
} else { } else {
$a->page['aside'] = Markdown::convert($home, false); $a->page['aside'] = Markdown::convert($home, false);
} }
if (!strlen($text)) { if (!strlen($text)) {
header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found')); header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . L10n::t('Not Found'));
$tpl = get_markup_template("404.tpl"); $tpl = get_markup_template("404.tpl");
return replace_macros($tpl, [ return replace_macros($tpl, [
'$message' => t('Page not found.') '$message' => L10n::t('Page not found.')
]); ]);
} }

View file

@ -1,8 +1,11 @@
<?php <?php
/**
* @file mod/home.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Module\Login; use Friendica\Module\Login;
@ -33,7 +36,7 @@ function home_content(App $a) {
} }
$customhome = false; $customhome = false;
$defaultheader = '<h1>'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'</h1>'; $defaultheader = '<h1>'.((x($a->config,'sitename')) ? L10n::t("Welcome to %s", $a->config['sitename']) : "").'</h1>';
$homefilepath = $a->basepath . "/home.html"; $homefilepath = $a->basepath . "/home.html";
$cssfilepath = $a->basepath . "/home.css"; $cssfilepath = $a->basepath . "/home.css";

View file

@ -3,6 +3,7 @@
* @file mod/install.php * @file mod/install.php
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Database\DBStructure; use Friendica\Database\DBStructure;
@ -107,29 +108,29 @@ function install_content(App $a) {
global $install_wizard_pass; global $install_wizard_pass;
$o = ''; $o = '';
$wizard_status = ""; $wizard_status = "";
$install_title = t('Friendica Communications Server - Setup'); $install_title = L10n::t('Friendica Communications Server - Setup');
if (x($a->data, 'db_conn_failed')) { if (x($a->data, 'db_conn_failed')) {
$install_wizard_pass = 2; $install_wizard_pass = 2;
$wizard_status = t('Could not connect to database.'); $wizard_status = L10n::t('Could not connect to database.');
} }
if (x($a->data, 'db_create_failed')) { if (x($a->data, 'db_create_failed')) {
$install_wizard_pass = 2; $install_wizard_pass = 2;
$wizard_status = t('Could not create table.'); $wizard_status = L10n::t('Could not create table.');
} }
$db_return_text = ""; $db_return_text = "";
if (x($a->data, 'db_installed')) { if (x($a->data, 'db_installed')) {
$txt = '<p style="font-size: 130%;">'; $txt = '<p style="font-size: 130%;">';
$txt .= t('Your Friendica site database has been installed.') . EOL; $txt .= L10n::t('Your Friendica site database has been installed.') . EOL;
$db_return_text .= $txt; $db_return_text .= $txt;
} }
if (x($a->data, 'db_failed')) { if (x($a->data, 'db_failed')) {
$txt = t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . EOL; $txt = L10n::t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . EOL;
$txt .= t('Please see the file "INSTALL.txt".') . EOL ."<hr>"; $txt .= L10n::t('Please see the file "INSTALL.txt".') . EOL ."<hr>";
$txt .= "<pre>".$a->data['db_failed'] . "</pre>". EOL; $txt .= "<pre>".$a->data['db_failed'] . "</pre>". EOL;
$db_return_text .= $txt; $db_return_text .= $txt;
} }
@ -141,7 +142,7 @@ function install_content(App $a) {
return replace_macros($tpl, [ return replace_macros($tpl, [
'$title' => $install_title, '$title' => $install_title,
'$pass' => '', '$pass' => '',
'$status' => t('Database already in use.'), '$status' => L10n::t('Database already in use.'),
'$text' => '', '$text' => '',
]); ]);
} }
@ -198,12 +199,12 @@ function install_content(App $a) {
$tpl = get_markup_template('install_checks.tpl'); $tpl = get_markup_template('install_checks.tpl');
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$title' => $install_title, '$title' => $install_title,
'$pass' => t('System check'), '$pass' => L10n::t('System check'),
'$checks' => $checks, '$checks' => $checks,
'$passed' => $checkspassed, '$passed' => $checkspassed,
'$see_install' => t('Please see the file "INSTALL.txt".'), '$see_install' => L10n::t('Please see the file "INSTALL.txt".'),
'$next' => t('Next'), '$next' => L10n::t('Next'),
'$reload' => t('Check again'), '$reload' => L10n::t('Check again'),
'$phpath' => $phpath, '$phpath' => $phpath,
'$baseurl' => System::baseUrl(), '$baseurl' => System::baseUrl(),
]); ]);
@ -222,28 +223,28 @@ function install_content(App $a) {
$tpl = get_markup_template('install_db.tpl'); $tpl = get_markup_template('install_db.tpl');
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$title' => $install_title, '$title' => $install_title,
'$pass' => t('Database connection'), '$pass' => L10n::t('Database connection'),
'$info_01' => t('In order to install Friendica we need to know how to connect to your database.'), '$info_01' => L10n::t('In order to install Friendica we need to know how to connect to your database.'),
'$info_02' => t('Please contact your hosting provider or site administrator if you have questions about these settings.'), '$info_02' => L10n::t('Please contact your hosting provider or site administrator if you have questions about these settings.'),
'$info_03' => t('The database you specify below should already exist. If it does not, please create it before continuing.'), '$info_03' => L10n::t('The database you specify below should already exist. If it does not, please create it before continuing.'),
'$status' => $wizard_status, '$status' => $wizard_status,
'$dbhost' => ['dbhost', t('Database Server Name'), $dbhost, '', 'required'], '$dbhost' => ['dbhost', L10n::t('Database Server Name'), $dbhost, '', 'required'],
'$dbuser' => ['dbuser', t('Database Login Name'), $dbuser, '', 'required', 'autofocus'], '$dbuser' => ['dbuser', L10n::t('Database Login Name'), $dbuser, '', 'required', 'autofocus'],
'$dbpass' => ['dbpass', t('Database Login Password'), $dbpass, t("For security reasons the password must not be empty"), 'required'], '$dbpass' => ['dbpass', L10n::t('Database Login Password'), $dbpass, L10n::t("For security reasons the password must not be empty"), 'required'],
'$dbdata' => ['dbdata', t('Database Name'), $dbdata, '', 'required'], '$dbdata' => ['dbdata', L10n::t('Database Name'), $dbdata, '', 'required'],
'$adminmail' => ['adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'], '$adminmail' => ['adminmail', L10n::t('Site administrator email address'), $adminmail, L10n::t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'],
'$lbl_10' => t('Please select a default timezone for your website'), '$lbl_10' => L10n::t('Please select a default timezone for your website'),
'$baseurl' => System::baseUrl(), '$baseurl' => System::baseUrl(),
'$phpath' => $phpath, '$phpath' => $phpath,
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
]); ]);
return $o; return $o;
@ -259,12 +260,12 @@ function install_content(App $a) {
$adminmail = notags(trim($_POST['adminmail'])); $adminmail = notags(trim($_POST['adminmail']));
$timezone = ((x($_POST, 'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles'); $timezone = ((x($_POST, 'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles');
/* Installed langs */ /* Installed langs */
$lang_choices = get_available_languages(); $lang_choices = L10n::getAvailableLanguages();
$tpl = get_markup_template('install_settings.tpl'); $tpl = get_markup_template('install_settings.tpl');
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$title' => $install_title, '$title' => $install_title,
'$pass' => t('Site settings'), '$pass' => L10n::t('Site settings'),
'$status' => $wizard_status, '$status' => $wizard_status,
@ -274,16 +275,16 @@ function install_content(App $a) {
'$dbdata' => $dbdata, '$dbdata' => $dbdata,
'$phpath' => $phpath, '$phpath' => $phpath,
'$adminmail' => ['adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'], '$adminmail' => ['adminmail', L10n::t('Site administrator email address'), $adminmail, L10n::t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'],
'$timezone' => field_timezone('timezone', t('Please select a default timezone for your website'), $timezone, ''), '$timezone' => field_timezone('timezone', L10n::t('Please select a default timezone for your website'), $timezone, ''),
'$language' => ['language', t('System Language:'), 'en', t('Set the default language for your Friendica installation interface and to send emails.'), $lang_choices], '$language' => ['language', L10n::t('System Language:'), 'en', L10n::t('Set the default language for your Friendica installation interface and to send emails.'), $lang_choices],
'$baseurl' => System::baseUrl(), '$baseurl' => System::baseUrl(),
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
]); ]);
return $o; return $o;
@ -318,17 +319,17 @@ function check_php(&$phpath, &$checks) {
} }
$help = ""; $help = "";
if (!$passed) { if (!$passed) {
$help .= t('Could not find a command line version of PHP in the web server PATH.'). EOL; $help .= L10n::t('Could not find a command line version of PHP in the web server PATH.'). EOL;
$help .= t("If you don't have a command line version of PHP installed on your server, you will not be able to run the background processing. See <a href='https://github.com/friendica/friendica/blob/master/doc/Install.md#set-up-the-worker'>'Setup the worker'</a>") . EOL; $help .= L10n::t("If you don't have a command line version of PHP installed on your server, you will not be able to run the background processing. See <a href='https://github.com/friendica/friendica/blob/master/doc/Install.md#set-up-the-worker'>'Setup the worker'</a>") . EOL;
$help .= EOL . EOL; $help .= EOL . EOL;
$tpl = get_markup_template('field_input.tpl'); $tpl = get_markup_template('field_input.tpl');
$help .= replace_macros($tpl, [ $help .= replace_macros($tpl, [
'$field' => ['phpath', t('PHP executable path'), $phpath, t('Enter full path to php executable. You can leave this blank to continue the installation.')], '$field' => ['phpath', L10n::t('PHP executable path'), $phpath, L10n::t('Enter full path to php executable. You can leave this blank to continue the installation.')],
]); ]);
$phpath = ""; $phpath = "";
} }
check_add($checks, t('Command line PHP').($passed?" (<tt>$phpath</tt>)":""), $passed, false, $help); check_add($checks, L10n::t('Command line PHP').($passed?" (<tt>$phpath</tt>)":""), $passed, false, $help);
if ($passed) { if ($passed) {
$cmd = "$phpath -v"; $cmd = "$phpath -v";
@ -337,10 +338,10 @@ function check_php(&$phpath, &$checks) {
list($result) = explode("\n", $result); list($result) = explode("\n", $result);
$help = ""; $help = "";
if (!$passed2) { if (!$passed2) {
$help .= t('PHP executable is not the php cli binary (could be cgi-fgci version)'). EOL; $help .= L10n::t('PHP executable is not the php cli binary (could be cgi-fgci version)'). EOL;
$help .= t('Found PHP version: ')."<tt>$result</tt>"; $help .= L10n::t('Found PHP version: ')."<tt>$result</tt>";
} }
check_add($checks, t('PHP cli binary'), $passed2, true, $help); check_add($checks, L10n::t('PHP cli binary'), $passed2, true, $help);
} }
@ -351,10 +352,10 @@ function check_php(&$phpath, &$checks) {
$passed3 = $result == $str; $passed3 = $result == $str;
$help = ""; $help = "";
if (!$passed3) { if (!$passed3) {
$help .= t('The command line version of PHP on your system does not have "register_argc_argv" enabled.'). EOL; $help .= L10n::t('The command line version of PHP on your system does not have "register_argc_argv" enabled.'). EOL;
$help .= t('This is required for message delivery to work.'); $help .= L10n::t('This is required for message delivery to work.');
} }
check_add($checks, t('PHP register_argc_argv'), $passed3, true, $help); check_add($checks, L10n::t('PHP register_argc_argv'), $passed3, true, $help);
} }
@ -377,59 +378,59 @@ function check_keys(&$checks) {
// Get private key // Get private key
if (! $res) { if (! $res) {
$help .= t('Error: the "openssl_pkey_new" function on this system is not able to generate encryption keys'). EOL; $help .= L10n::t('Error: the "openssl_pkey_new" function on this system is not able to generate encryption keys'). EOL;
$help .= t('If running under Windows, please see "http://www.php.net/manual/en/openssl.installation.php".'); $help .= L10n::t('If running under Windows, please see "http://www.php.net/manual/en/openssl.installation.php".');
} }
check_add($checks, t('Generate encryption keys'), $res, true, $help); check_add($checks, L10n::t('Generate encryption keys'), $res, true, $help);
} }
function check_funcs(&$checks) { function check_funcs(&$checks) {
$ck_funcs = []; $ck_funcs = [];
check_add($ck_funcs, t('libCurl PHP module'), true, true, ""); check_add($ck_funcs, L10n::t('libCurl PHP module'), true, true, "");
check_add($ck_funcs, t('GD graphics PHP module'), true, true, ""); check_add($ck_funcs, L10n::t('GD graphics PHP module'), true, true, "");
check_add($ck_funcs, t('OpenSSL PHP module'), true, true, ""); check_add($ck_funcs, L10n::t('OpenSSL PHP module'), true, true, "");
check_add($ck_funcs, t('PDO or MySQLi PHP module'), true, true, ""); check_add($ck_funcs, L10n::t('PDO or MySQLi PHP module'), true, true, "");
check_add($ck_funcs, t('mb_string PHP module'), true, true, ""); check_add($ck_funcs, L10n::t('mb_string PHP module'), true, true, "");
check_add($ck_funcs, t('XML PHP module'), true, true, ""); check_add($ck_funcs, L10n::t('XML PHP module'), true, true, "");
check_add($ck_funcs, t('iconv module'), true, true, ""); check_add($ck_funcs, L10n::t('iconv module'), true, true, "");
if (function_exists('apache_get_modules')) { if (function_exists('apache_get_modules')) {
if (! in_array('mod_rewrite',apache_get_modules())) { if (! in_array('mod_rewrite',apache_get_modules())) {
check_add($ck_funcs, t('Apache mod_rewrite module'), false, true, t('Error: Apache webserver mod-rewrite module is required but not installed.')); check_add($ck_funcs, L10n::t('Apache mod_rewrite module'), false, true, L10n::t('Error: Apache webserver mod-rewrite module is required but not installed.'));
} else { } else {
check_add($ck_funcs, t('Apache mod_rewrite module'), true, true, ""); check_add($ck_funcs, L10n::t('Apache mod_rewrite module'), true, true, "");
} }
} }
if (! function_exists('curl_init')) { if (! function_exists('curl_init')) {
$ck_funcs[0]['status'] = false; $ck_funcs[0]['status'] = false;
$ck_funcs[0]['help'] = t('Error: libCURL PHP module required but not installed.'); $ck_funcs[0]['help'] = L10n::t('Error: libCURL PHP module required but not installed.');
} }
if (! function_exists('imagecreatefromjpeg')) { if (! function_exists('imagecreatefromjpeg')) {
$ck_funcs[1]['status'] = false; $ck_funcs[1]['status'] = false;
$ck_funcs[1]['help'] = t('Error: GD graphics PHP module with JPEG support required but not installed.'); $ck_funcs[1]['help'] = L10n::t('Error: GD graphics PHP module with JPEG support required but not installed.');
} }
if (! function_exists('openssl_public_encrypt')) { if (! function_exists('openssl_public_encrypt')) {
$ck_funcs[2]['status'] = false; $ck_funcs[2]['status'] = false;
$ck_funcs[2]['help'] = t('Error: openssl PHP module required but not installed.'); $ck_funcs[2]['help'] = L10n::t('Error: openssl PHP module required but not installed.');
} }
if (! function_exists('mysqli_connect') && !class_exists('pdo')) { if (! function_exists('mysqli_connect') && !class_exists('pdo')) {
$ck_funcs[3]['status'] = false; $ck_funcs[3]['status'] = false;
$ck_funcs[3]['help'] = t('Error: PDO or MySQLi PHP module required but not installed.'); $ck_funcs[3]['help'] = L10n::t('Error: PDO or MySQLi PHP module required but not installed.');
} }
if (!function_exists('mysqli_connect') && class_exists('pdo') && !in_array('mysql', PDO::getAvailableDrivers())) { if (!function_exists('mysqli_connect') && class_exists('pdo') && !in_array('mysql', PDO::getAvailableDrivers())) {
$ck_funcs[3]['status'] = false; $ck_funcs[3]['status'] = false;
$ck_funcs[3]['help'] = t('Error: The MySQL driver for PDO is not installed.'); $ck_funcs[3]['help'] = L10n::t('Error: The MySQL driver for PDO is not installed.');
} }
if (! function_exists('mb_strlen')) { if (! function_exists('mb_strlen')) {
$ck_funcs[4]['status'] = false; $ck_funcs[4]['status'] = false;
$ck_funcs[4]['help'] = t('Error: mb_string PHP module required but not installed.'); $ck_funcs[4]['help'] = L10n::t('Error: mb_string PHP module required but not installed.');
} }
if (! function_exists('iconv_strlen')) { if (! function_exists('iconv_strlen')) {
$ck_funcs[7]['status'] = false; $ck_funcs[7]['status'] = false;
$ck_funcs[7]['help'] = t('Error: iconv PHP module required but not installed.'); $ck_funcs[7]['help'] = L10n::t('Error: iconv PHP module required but not installed.');
} }
$checks = array_merge($checks, $ck_funcs); $checks = array_merge($checks, $ck_funcs);
@ -439,7 +440,7 @@ function check_funcs(&$checks) {
$xml = new DOMDocument(); $xml = new DOMDocument();
} catch (Exception $e) { } catch (Exception $e) {
$ck_funcs[6]['status'] = false; $ck_funcs[6]['status'] = false;
$ck_funcs[6]['help'] = t('Error, XML PHP module required but not installed.'); $ck_funcs[6]['help'] = L10n::t('Error, XML PHP module required but not installed.');
} }
} }
@ -451,13 +452,13 @@ function check_htconfig(&$checks) {
(!file_exists('.htconfig.php') && !is_writable('.'))) { (!file_exists('.htconfig.php') && !is_writable('.'))) {
$status = false; $status = false;
$help = t('The web installer needs to be able to create a file called ".htconfig.php" in the top folder of your web server and it is unable to do so.') .EOL; $help = L10n::t('The web installer needs to be able to create a file called ".htconfig.php" in the top folder of your web server and it is unable to do so.') .EOL;
$help .= t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.').EOL; $help .= L10n::t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.').EOL;
$help .= t('At the end of this procedure, we will give you a text to save in a file named .htconfig.php in your Friendica top folder.').EOL; $help .= L10n::t('At the end of this procedure, we will give you a text to save in a file named .htconfig.php in your Friendica top folder.').EOL;
$help .= t('You can alternatively skip this procedure and perform a manual installation. Please see the file "INSTALL.txt" for instructions.').EOL; $help .= L10n::t('You can alternatively skip this procedure and perform a manual installation. Please see the file "INSTALL.txt" for instructions.').EOL;
} }
check_add($checks, t('.htconfig.php is writable'), $status, false, $help); check_add($checks, L10n::t('.htconfig.php is writable'), $status, false, $help);
} }
@ -467,13 +468,13 @@ function check_smarty3(&$checks) {
if (!is_writable('view/smarty3')) { if (!is_writable('view/smarty3')) {
$status = false; $status = false;
$help = t('Friendica uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL; $help = L10n::t('Friendica uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL;
$help .= t('In order to store these compiled templates, the web server needs to have write access to the directory view/smarty3/ under the Friendica top level folder.').EOL; $help .= L10n::t('In order to store these compiled templates, the web server needs to have write access to the directory view/smarty3/ under the Friendica top level folder.').EOL;
$help .= t('Please ensure that the user that your web server runs as (e.g. www-data) has write access to this folder.').EOL; $help .= L10n::t('Please ensure that the user that your web server runs as (e.g. www-data) has write access to this folder.').EOL;
$help .= t('Note: as a security measure, you should give the web server write access to view/smarty3/ only--not the template files (.tpl) that it contains.').EOL; $help .= L10n::t('Note: as a security measure, you should give the web server write access to view/smarty3/ only--not the template files (.tpl) that it contains.').EOL;
} }
check_add($checks, t('view/smarty3 is writable'), $status, true, $help); check_add($checks, L10n::t('view/smarty3 is writable'), $status, true, $help);
} }
@ -489,9 +490,9 @@ function check_htaccess(&$checks) {
if ($test != "ok") { if ($test != "ok") {
$status = false; $status = false;
$help = t('Url rewrite in .htaccess is not working. Check your server configuration.'); $help = L10n::t('Url rewrite in .htaccess is not working. Check your server configuration.');
} }
check_add($checks, t('Url rewrite is working'), $status, true, $help); check_add($checks, L10n::t('Url rewrite is working'), $status, true, $help);
} else { } else {
// cannot check modrewrite if libcurl is not installed // cannot check modrewrite if libcurl is not installed
/// @TODO Maybe issue warning here? /// @TODO Maybe issue warning here?
@ -510,18 +511,18 @@ function check_imagik(&$checks) {
} }
} }
if ($imagick == false) { if ($imagick == false) {
check_add($checks, t('ImageMagick PHP extension is not installed'), $imagick, false, ""); check_add($checks, L10n::t('ImageMagick PHP extension is not installed'), $imagick, false, "");
} else { } else {
check_add($checks, t('ImageMagick PHP extension is installed'), $imagick, false, ""); check_add($checks, L10n::t('ImageMagick PHP extension is installed'), $imagick, false, "");
if ($imagick) { if ($imagick) {
check_add($checks, t('ImageMagick supports GIF'), $gif, false, ""); check_add($checks, L10n::t('ImageMagick supports GIF'), $gif, false, "");
} }
} }
} }
function manual_config(App $a) { function manual_config(App $a) {
$data = htmlentities($a->data['txt'],ENT_COMPAT, 'UTF-8'); $data = htmlentities($a->data['txt'],ENT_COMPAT, 'UTF-8');
$o = t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.'); $o = L10n::t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.');
$o .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>"; $o .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>";
return $o; return $o;
} }
@ -544,10 +545,10 @@ function load_database() {
function what_next() { function what_next() {
$baseurl = System::baseUrl(); $baseurl = System::baseUrl();
return return
t('<h1>What next</h1>') L10n::t('<h1>What next</h1>')
."<p>".t('IMPORTANT: You will need to [manually] setup a scheduled task for the worker.') ."<p>".L10n::t('IMPORTANT: You will need to [manually] setup a scheduled task for the worker.')
.t('Please see the file "INSTALL.txt".') .L10n::t('Please see the file "INSTALL.txt".')
."</p><p>" ."</p><p>"
.t("Go to your new Friendica node <a href='$baseurl/register'>registration page</a> and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.") .L10n::t("Go to your new Friendica node <a href='$baseurl/register'>registration page</a> and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.")
."</p>"; ."</p>";
} }

View file

@ -7,56 +7,56 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Protocol\Email; use Friendica\Protocol\Email;
function invite_post(App $a) { function invite_post(App $a)
{
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
check_form_security_token_redirectOnErr('/', 'send_invite'); check_form_security_token_redirectOnErr('/', 'send_invite');
$max_invites = intval(Config::get('system','max_invites')); $max_invites = intval(Config::get('system', 'max_invites'));
if (! $max_invites) { if (! $max_invites) {
$max_invites = 50; $max_invites = 50;
} }
$current_invites = intval(PConfig::get(local_user(),'system','sent_invites')); $current_invites = intval(PConfig::get(local_user(), 'system', 'sent_invites'));
if ($current_invites > $max_invites) { if ($current_invites > $max_invites) {
notice( t('Total invitation limit exceeded.') . EOL); notice(L10n::t('Total invitation limit exceeded.') . EOL);
return; return;
} }
$recips = ((x($_POST,'recipients')) ? explode("\n",$_POST['recipients']) : []); $recips = ((x($_POST, 'recipients')) ? explode("\n", $_POST['recipients']) : []);
$message = ((x($_POST,'message')) ? notags(trim($_POST['message'])) : ''); $message = ((x($_POST, 'message')) ? notags(trim($_POST['message'])) : '');
$total = 0; $total = 0;
if (Config::get('system','invitation_only')) { if (Config::get('system', 'invitation_only')) {
$invonly = true; $invonly = true;
$x = PConfig::get(local_user(),'system','invites_remaining'); $x = PConfig::get(local_user(), 'system', 'invites_remaining');
if ((! $x) && (! is_site_admin())) { if ((! $x) && (! is_site_admin())) {
return; return;
} }
} }
foreach ($recips as $recip) { foreach ($recips as $recip) {
$recip = trim($recip); $recip = trim($recip);
if (! valid_email($recip)) { if (! valid_email($recip)) {
notice( sprintf( t('%s : Not a valid email address.'), $recip) . EOL); notice(L10n::t('%s : Not a valid email address.', $recip) . EOL);
continue; continue;
} }
if ($invonly && ($x || is_site_admin())) { if ($invonly && ($x || is_site_admin())) {
$code = autoname(8) . srand(1000,9999); $code = autoname(8) . srand(1000, 9999);
$nmessage = str_replace('$invite_code',$code,$message); $nmessage = str_replace('$invite_code', $code, $message);
$r = q("INSERT INTO `register` (`hash`,`created`) VALUES ('%s', '%s') ", $r = q("INSERT INTO `register` (`hash`,`created`) VALUES ('%s', '%s') ",
dbesc($code), dbesc($code),
@ -66,7 +66,7 @@ function invite_post(App $a) {
if (! is_site_admin()) { if (! is_site_admin()) {
$x --; $x --;
if ($x >= 0) { if ($x >= 0) {
PConfig::set(local_user(),'system','invites_remaining',$x); PConfig::set(local_user(), 'system', 'invites_remaining', $x);
} else { } else {
return; return;
} }
@ -75,7 +75,7 @@ function invite_post(App $a) {
$nmessage = $message; $nmessage = $message;
} }
$res = mail($recip, Email::encodeHeader(t('Please join us on Friendica'),'UTF-8'), $res = mail($recip, Email::encodeHeader(L10n::t('Please join us on Friendica'), 'UTF-8'),
$nmessage, $nmessage,
"From: " . $a->user['email'] . "\n" "From: " . $a->user['email'] . "\n"
. 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n"
@ -84,69 +84,68 @@ function invite_post(App $a) {
if ($res) { if ($res) {
$total ++; $total ++;
$current_invites ++; $current_invites ++;
PConfig::set(local_user(),'system','sent_invites',$current_invites); PConfig::set(local_user(), 'system', 'sent_invites', $current_invites);
if($current_invites > $max_invites) { if ($current_invites > $max_invites) {
notice( t('Invitation limit exceeded. Please contact your site administrator.') . EOL); notice(L10n::t('Invitation limit exceeded. Please contact your site administrator.') . EOL);
return; return;
} }
} else { } else {
notice( sprintf( t('%s : Message delivery failed.'), $recip) . EOL); notice(L10n::t('%s : Message delivery failed.', $recip) . EOL);
} }
} }
notice( sprintf( tt("%d message sent.", "%d messages sent.", $total) , $total) . EOL); notice(L10n::tt("%d message sent.", "%d messages sent.", $total) . EOL);
return; return;
} }
function invite_content(App $a) { function invite_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
$tpl = get_markup_template('invite.tpl'); $tpl = get_markup_template('invite.tpl');
$invonly = false; $invonly = false;
if (Config::get('system','invitation_only')) { if (Config::get('system', 'invitation_only')) {
$invonly = true; $invonly = true;
$x = PConfig::get(local_user(),'system','invites_remaining'); $x = PConfig::get(local_user(), 'system', 'invites_remaining');
if ((! $x) && (! is_site_admin())) { if ((! $x) && (! is_site_admin())) {
notice( t('You have no more invitations available') . EOL); notice(L10n::t('You have no more invitations available') . EOL);
return ''; return '';
} }
} }
$dirloc = Config::get('system','directory'); $dirloc = Config::get('system', 'directory');
if (strlen($dirloc)) { if (strlen($dirloc)) {
if ($a->config['register_policy'] == REGISTER_CLOSED) { if ($a->config['register_policy'] == REGISTER_CLOSED) {
$linktxt = sprintf( t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.'), $dirloc . '/servers'); $linktxt = L10n::t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.', $dirloc . '/servers');
} else { } else {
$linktxt = sprintf( t('To accept this invitation, please visit and register at %s or any other public Friendica website.'), System::baseUrl()) $linktxt = L10n::t('To accept this invitation, please visit and register at %s or any other public Friendica website.', System::baseUrl())
. "\r\n" . "\r\n" . sprintf( t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.'),$dirloc . '/servers'); . "\r\n" . "\r\n" . L10n::t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.', $dirloc . '/servers');
} }
} else { // there is no global directory URL defined } else { // there is no global directory URL defined
if ($a->config['register_policy'] == REGISTER_CLOSED) { if ($a->config['register_policy'] == REGISTER_CLOSED) {
$o = t('Our apologies. This system is not currently configured to connect with other public sites or invite members.'); $o = L10n::t('Our apologies. This system is not currently configured to connect with other public sites or invite members.');
return $o; return $o;
} else { } else {
$linktxt = sprintf( t('To accept this invitation, please visit and register at %s.'), System::baseUrl() $linktxt = L10n::t('To accept this invitation, please visit and register at %s.', System::baseUrl()
. "\r\n" . "\r\n" . t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks.')); . "\r\n" . "\r\n" . L10n::t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks.'));
} }
} }
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$form_security_token' => get_form_security_token("send_invite"), '$form_security_token' => get_form_security_token("send_invite"),
'$invite' => t('Send invitations'), '$invite' => L10n::t('Send invitations'),
'$addr_text' => t('Enter email addresses, one per line:'), '$addr_text' => L10n::t('Enter email addresses, one per line:'),
'$msg_text' => t('Your message:'), '$msg_text' => L10n::t('Your message:'),
'$default_message' => t('You are cordially invited to join me and other close friends on Friendica - and help us to create a better social web.') . "\r\n" . "\r\n" '$default_message' => L10n::t('You are cordially invited to join me and other close friends on Friendica - and help us to create a better social web.') . "\r\n" . "\r\n"
. $linktxt . $linktxt
. "\r\n" . "\r\n" . (($invonly) ? t('You will need to supply this invitation code: $invite_code') . "\r\n" . "\r\n" : '') .t('Once you have registered, please connect with me via my profile page at:') . "\r\n" . "\r\n" . (($invonly) ? L10n::t('You will need to supply this invitation code: $invite_code') . "\r\n" . "\r\n" : '') .L10n::t('Once you have registered, please connect with me via my profile page at:')
. "\r\n" . "\r\n" . System::baseUrl() . '/profile/' . $a->user['nickname'] . "\r\n" . "\r\n" . System::baseUrl() . '/profile/' . $a->user['nickname']
. "\r\n" . "\r\n" . t('For more information about the Friendica project and why we feel it is important, please visit http://friendi.ca') . "\r\n" . "\r\n" , . "\r\n" . "\r\n" . L10n::t('For more information about the Friendica project and why we feel it is important, please visit http://friendi.ca') . "\r\n" . "\r\n" ,
'$submit' => t('Submit') '$submit' => L10n::t('Submit')
]); ]);
return $o; return $o;

View file

@ -17,6 +17,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -111,7 +112,7 @@ function item_post(App $a) {
} }
if (!DBM::is_result($parent_item)) { if (!DBM::is_result($parent_item)) {
notice(t('Unable to locate original post.') . EOL); notice(L10n::t('Unable to locate original post.') . EOL);
if (x($_REQUEST, 'return')) { if (x($_REQUEST, 'return')) {
goaway($return_path); goaway($return_path);
} }
@ -157,7 +158,7 @@ function item_post(App $a) {
// Now check that valid personal details have been provided // Now check that valid personal details have been provided
if (!can_write_wall($profile_uid) && !$allow_comment) { if (!can_write_wall($profile_uid) && !$allow_comment) {
notice(t('Permission denied.') . EOL) ; notice(L10n::t('Permission denied.') . EOL) ;
if (x($_REQUEST, 'return')) { if (x($_REQUEST, 'return')) {
goaway($return_path); goaway($return_path);
} }
@ -271,7 +272,7 @@ function item_post(App $a) {
if ($preview) { if ($preview) {
killme(); killme();
} }
info(t('Empty post discarded.') . EOL); info(L10n::t('Empty post discarded.') . EOL);
if (x($_REQUEST, 'return')) { if (x($_REQUEST, 'return')) {
goaway($return_path); goaway($return_path);
} }
@ -468,7 +469,7 @@ function item_post(App $a) {
$fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow, $fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny]; 'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny];
$condition = ['resource-id' => $image_uri, 'uid' => $profile_uid, 'album' => t('Wall Photos')]; $condition = ['resource-id' => $image_uri, 'uid' => $profile_uid, 'album' => L10n::t('Wall Photos')];
dba::update('photo', $fields, $condition); dba::update('photo', $fields, $condition);
} }
} }
@ -799,14 +800,14 @@ function item_post(App $a) {
if (!strlen($addr)) { if (!strlen($addr)) {
continue; continue;
} }
$disclaimer = '<hr />' . sprintf(t('This message was sent to you by %s, a member of the Friendica social network.'), $a->user['username']) $disclaimer = '<hr />' . L10n::t('This message was sent to you by %s, a member of the Friendica social network.', $a->user['username'])
. '<br />'; . '<br />';
$disclaimer .= sprintf(t('You may visit them online at %s'), System::baseUrl() . '/profile/' . $a->user['nickname']) . EOL; $disclaimer .= L10n::t('You may visit them online at %s', System::baseUrl() . '/profile/' . $a->user['nickname']) . EOL;
$disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL; $disclaimer .= L10n::t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
if (!$datarray['title']=='') { if (!$datarray['title']=='') {
$subject = Email::encodeHeader($datarray['title'], 'UTF-8'); $subject = Email::encodeHeader($datarray['title'], 'UTF-8');
} else { } else {
$subject = Email::encodeHeader('[Friendica]' . ' ' . sprintf(t('%s posted an update.'), $a->user['username']), 'UTF-8'); $subject = Email::encodeHeader('[Friendica]' . ' ' . L10n::t('%s posted an update.', $a->user['username']), 'UTF-8');
} }
$link = '<a href="' . System::baseUrl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />'; $link = '<a href="' . System::baseUrl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />';
$html = prepare_body($datarray); $html = prepare_body($datarray);

View file

@ -1,51 +1,58 @@
<?php <?php
/**
* @file mod/localtime.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
require_once('include/datetime.php'); require_once 'include/datetime.php';
function localtime_post(App $a) {
function localtime_post(App $a)
{
$t = $_REQUEST['time']; $t = $_REQUEST['time'];
if(! $t) if (! $t) {
$t = 'now'; $t = 'now';
}
$bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM $bd_format = L10n::t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
if($_POST['timezone'])
$a->data['mod-localtime'] = datetime_convert('UTC',$_POST['timezone'],$t,$bd_format);
if ($_POST['timezone']) {
$a->data['mod-localtime'] = datetime_convert('UTC', $_POST['timezone'], $t, $bd_format);
}
} }
function localtime_content(App $a) { function localtime_content(App $a)
{
$t = $_REQUEST['time']; $t = $_REQUEST['time'];
if(! $t) if (! $t) {
$t = 'now'; $t = 'now';
}
$o .= '<h3>' . t('Time Conversion') . '</h3>'; $o .= '<h3>' . L10n::t('Time Conversion') . '</h3>';
$o .= '<p>' . t('Friendica provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>'; $o .= '<p>' . L10n::t('Friendica provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>';
$o .= '<p>' . sprintf( t('UTC time: %s'), $t) . '</p>'; $o .= '<p>' . L10n::t('UTC time: %s', $t) . '</p>';
if($_REQUEST['timezone']) if ($_REQUEST['timezone']) {
$o .= '<p>' . sprintf( t('Current timezone: %s'), $_REQUEST['timezone']) . '</p>'; $o .= '<p>' . L10n::t('Current timezone: %s', $_REQUEST['timezone']) . '</p>';
}
if(x($a->data,'mod-localtime')) if (x($a->data, 'mod-localtime')) {
$o .= '<p>' . sprintf( t('Converted localtime: %s'),$a->data['mod-localtime']) . '</p>'; $o .= '<p>' . L10n::t('Converted localtime: %s', $a->data['mod-localtime']) . '</p>';
}
$o .= '<form action ="' . System::baseUrl() . '/localtime?f=&time=' . $t . '" method="post" >'; $o .= '<form action ="' . System::baseUrl() . '/localtime?f=&time=' . $t . '" method="post" >';
$o .= '<p>' . t('Please select your timezone:') . '</p>'; $o .= '<p>' . L10n::t('Please select your timezone:') . '</p>';
$o .= select_timezone(($_REQUEST['timezone']) ? $_REQUEST['timezone'] : 'America/Los_Angeles'); $o .= select_timezone(($_REQUEST['timezone']) ? $_REQUEST['timezone'] : 'America/Los_Angeles');
$o .= '<input type="submit" name="submit" value="' . t('Submit') . '" /></form>'; $o .= '<input type="submit" name="submit" value="' . L10n::t('Submit') . '" /></form>';
return $o; return $o;
} }

View file

@ -1,7 +1,10 @@
<?php <?php
/**
* @file mod/lockview.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Database\DBM; use Friendica\Database\DBM;
function lockview_content(App $a) { function lockview_content(App $a) {
@ -32,7 +35,7 @@ function lockview_content(App $a) {
Addon::callHooks('lockview_content', $item); Addon::callHooks('lockview_content', $item);
if($item['uid'] != local_user()) { if($item['uid'] != local_user()) {
echo t('Remote privacy information not available.') . '<br />'; echo L10n::t('Remote privacy information not available.') . '<br />';
killme(); killme();
} }
@ -40,7 +43,7 @@ function lockview_content(App $a) {
if(($item['private'] == 1) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid'])) if(($item['private'] == 1) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid']))
&& (! strlen($item['deny_cid'])) && (! strlen($item['deny_gid']))) { && (! strlen($item['deny_cid'])) && (! strlen($item['deny_gid']))) {
echo t('Remote privacy information not available.') . '<br />'; echo L10n::t('Remote privacy information not available.') . '<br />';
killme(); killme();
} }
@ -49,7 +52,7 @@ function lockview_content(App $a) {
$deny_users = expand_acl($item['deny_cid']); $deny_users = expand_acl($item['deny_cid']);
$deny_groups = expand_acl($item['deny_gid']); $deny_groups = expand_acl($item['deny_gid']);
$o = t('Visible to:') . '<br />'; $o = L10n::t('Visible to:') . '<br />';
$l = []; $l = [];
if(count($allowed_groups)) { if(count($allowed_groups)) {

View file

@ -1,10 +1,10 @@
<?php <?php
/** /**
* @file mod/lostpass.php * @file mod/lostpass.php
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\User; use Friendica\Model\User;
@ -13,7 +13,6 @@ require_once 'boot.php';
require_once 'include/datetime.php'; require_once 'include/datetime.php';
require_once 'include/enotify.php'; require_once 'include/enotify.php';
require_once 'include/text.php'; require_once 'include/text.php';
require_once 'include/pgettext.php';
function lostpass_post(App $a) function lostpass_post(App $a)
{ {
@ -25,7 +24,7 @@ function lostpass_post(App $a)
$condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame]; $condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame];
$user = dba::selectFirst('user', ['uid', 'username', 'email'], $condition); $user = dba::selectFirst('user', ['uid', 'username', 'email'], $condition);
if (!DBM::is_result($user)) { if (!DBM::is_result($user)) {
notice(t('No valid account found.') . EOL); notice(L10n::t('No valid account found.') . EOL);
goaway(System::baseUrl()); goaway(System::baseUrl());
} }
@ -37,13 +36,13 @@ function lostpass_post(App $a)
]; ];
$result = dba::update('user', $fields, ['uid' => $user['uid']]); $result = dba::update('user', $fields, ['uid' => $user['uid']]);
if ($result) { if ($result) {
info(t('Password reset request issued. Check your email.') . EOL); info(L10n::t('Password reset request issued. Check your email.') . EOL);
} }
$sitename = $a->config['sitename']; $sitename = $a->config['sitename'];
$resetlink = System::baseUrl() . '/lostpass/' . $pwdreset_token; $resetlink = System::baseUrl() . '/lostpass/' . $pwdreset_token;
$preamble = deindent(t(' $preamble = deindent(L10n::t('
Dear %1$s, Dear %1$s,
A request was recently received at "%2$s" to reset your account A request was recently received at "%2$s" to reset your account
password. In order to confirm this request, please select the verification link password. In order to confirm this request, please select the verification link
@ -54,7 +53,7 @@ function lostpass_post(App $a)
Your password will not be changed unless we can verify that you Your password will not be changed unless we can verify that you
issued this request.', $user['username'], $sitename)); issued this request.', $user['username'], $sitename));
$body = deindent(t(' $body = deindent(L10n::t('
Follow this link soon to verify your identity: Follow this link soon to verify your identity:
%1$s %1$s
@ -70,7 +69,7 @@ function lostpass_post(App $a)
notification([ notification([
'type' => SYSTEM_EMAIL, 'type' => SYSTEM_EMAIL,
'to_email' => $user['email'], 'to_email' => $user['email'],
'subject' => t('Password reset requested at %s', $sitename), 'subject' => L10n::t('Password reset requested at %s', $sitename),
'preamble' => $preamble, 'preamble' => $preamble,
'body' => $body 'body' => $body
]); ]);
@ -86,7 +85,7 @@ function lostpass_content(App $a)
$user = dba::selectFirst('user', ['uid', 'username', 'email', 'pwdreset_time'], ['pwdreset' => $pwdreset_token]); $user = dba::selectFirst('user', ['uid', 'username', 'email', 'pwdreset_time'], ['pwdreset' => $pwdreset_token]);
if (!DBM::is_result($user)) { if (!DBM::is_result($user)) {
notice(t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed.")); notice(L10n::t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
return lostpass_form(); return lostpass_form();
} }
@ -99,7 +98,7 @@ function lostpass_content(App $a)
]; ];
dba::update('user', $fields, ['uid' => $user['uid']]); dba::update('user', $fields, ['uid' => $user['uid']]);
notice(t('Request has expired, please make a new one.')); notice(L10n::t('Request has expired, please make a new one.'));
return lostpass_form(); return lostpass_form();
} }
@ -114,10 +113,10 @@ function lostpass_form()
{ {
$tpl = get_markup_template('lostpass.tpl'); $tpl = get_markup_template('lostpass.tpl');
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$title' => t('Forgot your Password?'), '$title' => L10n::t('Forgot your Password?'),
'$desc' => t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'), '$desc' => L10n::t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'),
'$name' => t('Nickname or Email: '), '$name' => L10n::t('Nickname or Email: '),
'$submit' => t('Reset') '$submit' => L10n::t('Reset')
]); ]);
return $o; return $o;
@ -132,12 +131,12 @@ function lostpass_generate_password($user)
if (DBM::is_result($result)) { if (DBM::is_result($result)) {
$tpl = get_markup_template('pwdreset.tpl'); $tpl = get_markup_template('pwdreset.tpl');
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$lbl1' => t('Password Reset'), '$lbl1' => L10n::t('Password Reset'),
'$lbl2' => t('Your password has been reset as requested.'), '$lbl2' => L10n::t('Your password has been reset as requested.'),
'$lbl3' => t('Your new password is'), '$lbl3' => L10n::t('Your new password is'),
'$lbl4' => t('Save or copy your new password - and then'), '$lbl4' => L10n::t('Save or copy your new password - and then'),
'$lbl5' => '<a href="' . System::baseUrl() . '">' . t('click here to login') . '</a>.', '$lbl5' => '<a href="' . System::baseUrl() . '">' . L10n::t('click here to login') . '</a>.',
'$lbl6' => t('Your password may be changed from the <em>Settings</em> page after successful login.'), '$lbl6' => L10n::t('Your password may be changed from the <em>Settings</em> page after successful login.'),
'$newpass' => $new_password, '$newpass' => $new_password,
'$baseurl' => System::baseUrl() '$baseurl' => System::baseUrl()
]); ]);
@ -145,13 +144,13 @@ function lostpass_generate_password($user)
info("Your password has been reset." . EOL); info("Your password has been reset." . EOL);
$sitename = $a->config['sitename']; $sitename = $a->config['sitename'];
$preamble = deindent(t(' $preamble = deindent(L10n::t('
Dear %1$s, Dear %1$s,
Your password has been changed as requested. Please retain this Your password has been changed as requested. Please retain this
information for your records (or change your password immediately to information for your records (or change your password immediately to
something that you will remember). something that you will remember).
', $user['username'])); ', $user['username']));
$body = deindent(t(' $body = deindent(L10n::t('
Your login details are as follows: Your login details are as follows:
Site Location: %1$s Site Location: %1$s
@ -164,7 +163,7 @@ function lostpass_generate_password($user)
notification([ notification([
'type' => SYSTEM_EMAIL, 'type' => SYSTEM_EMAIL,
'to_email' => $user['email'], 'to_email' => $user['email'],
'subject' => t('Your password has been changed at %s', $sitename), 'subject' => L10n::t('Your password has been changed at %s', $sitename),
'preamble' => $preamble, 'preamble' => $preamble,
'body' => $body 'body' => $body
]); ]);

View file

@ -1,10 +1,13 @@
<?php <?php
/**
* @file mod/maintenance.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
function maintenance_content(App $a) { function maintenance_content(App $a)
{
$reason = Config::get('system', 'maintenance_reason'); $reason = Config::get('system', 'maintenance_reason');
if (substr(normalise_link($reason), 0, 7) == 'http://') { if (substr(normalise_link($reason), 0, 7) == 'http://') {
@ -18,7 +21,7 @@ function maintenance_content(App $a) {
header('Retry-After: 600'); header('Retry-After: 600');
return replace_macros(get_markup_template('maintenance.tpl'), [ return replace_macros(get_markup_template('maintenance.tpl'), [
'$sysdown' => t('System down for maintenance'), '$sysdown' => L10n::t('System down for maintenance'),
'$reason' => $reason '$reason' => $reason
]); ]);
} }

View file

@ -1,11 +1,14 @@
<?php <?php
/**
* @file mod/manage.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
require_once("include/text.php"); require_once "include/text.php";
function manage_post(App $a) { function manage_post(App $a) {
@ -103,7 +106,7 @@ function manage_post(App $a) {
function manage_content(App $a) { function manage_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -152,11 +155,11 @@ function manage_content(App $a) {
} }
$o = replace_macros(get_markup_template('manage.tpl'), [ $o = replace_macros(get_markup_template('manage.tpl'), [
'$title' => t('Manage Identities and/or Pages'), '$title' => L10n::t('Manage Identities and/or Pages'),
'$desc' => t('Toggle between different identities or community/group pages which share your account details or which you have been granted "manage" permissions'), '$desc' => L10n::t('Toggle between different identities or community/group pages which share your account details or which you have been granted "manage" permissions'),
'$choose' => t('Select an identity to manage: '), '$choose' => L10n::t('Select an identity to manage: '),
'$identities' => $identities, '$identities' => $identities,
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
]); ]);
return $o; return $o;

View file

@ -5,6 +5,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Widget; use Friendica\Content\Widget;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -43,7 +44,7 @@ function match_content(App $a)
return; return;
} }
if (! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) { if (! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) {
notice(t('No keywords to match. Please add keywords to your default profile.') . EOL); notice(L10n::t('No keywords to match. Please add keywords to your default profile.') . EOL);
return; return;
} }
@ -84,8 +85,8 @@ function match_content(App $a)
$jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo); $jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo);
$connlnk = System::baseUrl() . '/follow/?url=' . $jj->url; $connlnk = System::baseUrl() . '/follow/?url=' . $jj->url;
$photo_menu = [ $photo_menu = [
'profile' => [t("View Profile"), Profile::zrl($jj->url)], 'profile' => [L10n::t("View Profile"), Profile::zrl($jj->url)],
'follow' => [t("Connect/Follow"), $connlnk] 'follow' => [L10n::t("Connect/Follow"), $connlnk]
]; ];
$contact_details = Contact::getDetailsByURL($jj->url, local_user()); $contact_details = Contact::getDetailsByURL($jj->url, local_user());
@ -99,8 +100,8 @@ function match_content(App $a)
'about' => $contact_details['about'], 'about' => $contact_details['about'],
'account_type' => Contact::getAccountType($contact_details), 'account_type' => Contact::getAccountType($contact_details),
'thumb' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB), 'thumb' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB),
'inttxt' => ' ' . t('is interested in:'), 'inttxt' => ' ' . L10n::t('is interested in:'),
'conntxt' => t('Connect'), 'conntxt' => L10n::t('Connect'),
'connlnk' => $connlnk, 'connlnk' => $connlnk,
'img_hover' => $jj->tags, 'img_hover' => $jj->tags,
'photo_menu' => $photo_menu, 'photo_menu' => $photo_menu,
@ -115,12 +116,12 @@ function match_content(App $a)
$o .= replace_macros( $o .= replace_macros(
$tpl, $tpl,
[ [
'$title' => t('Profile Match'), '$title' => L10n::t('Profile Match'),
'$contacts' => $entries, '$contacts' => $entries,
'$paginate' => paginate($a)] '$paginate' => paginate($a)]
); );
} else { } else {
info(t('No matches') . EOL); info(L10n::t('No matches') . EOL);
} }
} }

View file

@ -5,6 +5,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Content\Smilies; use Friendica\Content\Smilies;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -22,7 +23,7 @@ function message_init(App $a)
} }
$new = [ $new = [
'label' => t('New Message'), 'label' => L10n::t('New Message'),
'url' => 'message/new', 'url' => 'message/new',
'sel' => $a->argc > 1 && $a->argv[1] == 'new', 'sel' => $a->argc > 1 && $a->argv[1] == 'new',
'accesskey' => 'm', 'accesskey' => 'm',
@ -51,7 +52,7 @@ function message_init(App $a)
function message_post(App $a) function message_post(App $a)
{ {
if (!local_user()) { if (!local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -65,20 +66,20 @@ function message_post(App $a)
switch ($ret) { switch ($ret) {
case -1: case -1:
notice(t('No recipient selected.') . EOL); notice(L10n::t('No recipient selected.') . EOL);
$norecip = true; $norecip = true;
break; break;
case -2: case -2:
notice(t('Unable to locate contact information.') . EOL); notice(L10n::t('Unable to locate contact information.') . EOL);
break; break;
case -3: case -3:
notice(t('Message could not be sent.') . EOL); notice(L10n::t('Message could not be sent.') . EOL);
break; break;
case -4: case -4:
notice(t('Message collection failure.') . EOL); notice(L10n::t('Message collection failure.') . EOL);
break; break;
default: default:
info(t('Message sent.') . EOL); info(L10n::t('Message sent.') . EOL);
} }
// fake it to go back to the input form if no recipient listed // fake it to go back to the input form if no recipient listed
@ -96,7 +97,7 @@ function message_content(App $a)
Nav::setSelected('messages'); Nav::setSelected('messages');
if (!local_user()) { if (!local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -104,7 +105,7 @@ function message_content(App $a)
$tpl = get_markup_template('mail_head.tpl'); $tpl = get_markup_template('mail_head.tpl');
$header = replace_macros($tpl, [ $header = replace_macros($tpl, [
'$messages' => t('Messages'), '$messages' => L10n::t('Messages'),
]); ]);
if (($a->argc == 3) && ($a->argv[1] === 'drop' || $a->argv[1] === 'dropconv')) { if (($a->argc == 3) && ($a->argv[1] === 'drop' || $a->argv[1] === 'dropconv')) {
@ -128,12 +129,12 @@ function message_content(App $a)
//$a->page['aside'] = ''; //$a->page['aside'] = '';
return replace_macros(get_markup_template('confirm.tpl'), [ return replace_macros(get_markup_template('confirm.tpl'), [
'$method' => 'get', '$method' => 'get',
'$message' => t('Do you really want to delete this message?'), '$message' => L10n::t('Do you really want to delete this message?'),
'$extra_inputs' => $inputs, '$extra_inputs' => $inputs,
'$confirm' => t('Yes'), '$confirm' => L10n::t('Yes'),
'$confirm_url' => $query['base'], '$confirm_url' => $query['base'],
'$confirm_name' => 'confirmed', '$confirm_name' => 'confirmed',
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
]); ]);
} }
// Now check how the user responded to the confirmation query // Now check how the user responded to the confirmation query
@ -148,7 +149,7 @@ function message_content(App $a)
intval(local_user()) intval(local_user())
); );
if ($r) { if ($r) {
info(t('Message deleted.') . EOL); info(L10n::t('Message deleted.') . EOL);
} }
//goaway(System::baseUrl(true) . '/message' ); //goaway(System::baseUrl(true) . '/message' );
goaway($_SESSION['return_url']); goaway($_SESSION['return_url']);
@ -177,7 +178,7 @@ function message_content(App $a)
//} //}
if ($r) { if ($r) {
info(t('Conversation removed.') . EOL); info(L10n::t('Conversation removed.') . EOL);
} }
} }
//goaway(System::baseUrl(true) . '/message' ); //goaway(System::baseUrl(true) . '/message' );
@ -192,14 +193,14 @@ function message_content(App $a)
$a->page['htmlhead'] .= replace_macros($tpl, [ $a->page['htmlhead'] .= replace_macros($tpl, [
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:') '$linkurl' => L10n::t('Please enter a link URL:')
]); ]);
$tpl = get_markup_template('msg-end.tpl'); $tpl = get_markup_template('msg-end.tpl');
$a->page['end'] .= replace_macros($tpl, [ $a->page['end'] .= replace_macros($tpl, [
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:') '$linkurl' => L10n::t('Please enter a link URL:')
]); ]);
$preselect = isset($a->argv[2]) ? [$a->argv[2]] : false; $preselect = isset($a->argv[2]) ? [$a->argv[2]] : false;
@ -242,23 +243,23 @@ function message_content(App $a)
$tpl = get_markup_template('prv_message.tpl'); $tpl = get_markup_template('prv_message.tpl');
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$header' => t('Send Private Message'), '$header' => L10n::t('Send Private Message'),
'$to' => t('To:'), '$to' => L10n::t('To:'),
'$showinputs' => 'true', '$showinputs' => 'true',
'$prefill' => $prefill, '$prefill' => $prefill,
'$autocomp' => $autocomp, '$autocomp' => $autocomp,
'$preid' => $preid, '$preid' => $preid,
'$subject' => t('Subject:'), '$subject' => L10n::t('Subject:'),
'$subjtxt' => x($_REQUEST, 'subject') ? strip_tags($_REQUEST['subject']) : '', '$subjtxt' => x($_REQUEST, 'subject') ? strip_tags($_REQUEST['subject']) : '',
'$text' => x($_REQUEST, 'body') ? escape_tags(htmlspecialchars($_REQUEST['body'])) : '', '$text' => x($_REQUEST, 'body') ? escape_tags(htmlspecialchars($_REQUEST['body'])) : '',
'$readonly' => '', '$readonly' => '',
'$yourmessage' => t('Your message:'), '$yourmessage' => L10n::t('Your message:'),
'$select' => $select, '$select' => $select,
'$parent' => '', '$parent' => '',
'$upload' => t('Upload photo'), '$upload' => L10n::t('Upload photo'),
'$insert' => t('Insert web link'), '$insert' => L10n::t('Insert web link'),
'$wait' => t('Please wait'), '$wait' => L10n::t('Please wait'),
'$submit' => t('Submit') '$submit' => L10n::t('Submit')
]); ]);
return $o; return $o;
} }
@ -284,7 +285,7 @@ function message_content(App $a)
$r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']); $r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']);
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
info(t('No messages.') . EOL); info(L10n::t('No messages.') . EOL);
return $o; return $o;
} }
@ -323,7 +324,7 @@ function message_content(App $a)
); );
} }
if (!count($messages)) { if (!count($messages)) {
notice(t('Message not available.') . EOL); notice(L10n::t('Message not available.') . EOL);
return $o; return $o;
} }
@ -338,14 +339,14 @@ function message_content(App $a)
$a->page['htmlhead'] .= replace_macros($tpl, [ $a->page['htmlhead'] .= replace_macros($tpl, [
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:') '$linkurl' => L10n::t('Please enter a link URL:')
]); ]);
$tpl = get_markup_template('msg-end.tpl'); $tpl = get_markup_template('msg-end.tpl');
$a->page['end'] .= replace_macros($tpl, [ $a->page['end'] .= replace_macros($tpl, [
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:') '$linkurl' => L10n::t('Please enter a link URL:')
]); ]);
$mails = []; $mails = [];
@ -392,7 +393,7 @@ function message_content(App $a)
'from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB), 'from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB),
'subject' => $subject_e, 'subject' => $subject_e,
'body' => $body_e, 'body' => $body_e,
'delete' => t('Delete message'), 'delete' => L10n::t('Delete message'),
'to_name' => $to_name_e, 'to_name' => $to_name_e,
'date' => datetime_convert('UTC', date_default_timezone_get(), $message['created'], 'D, d M Y - g:i A'), 'date' => datetime_convert('UTC', date_default_timezone_get(), $message['created'], 'D, d M Y - g:i A'),
'ago' => relative_date($message['created']), 'ago' => relative_date($message['created']),
@ -409,26 +410,26 @@ function message_content(App $a)
'$thread_id' => $a->argv[1], '$thread_id' => $a->argv[1],
'$thread_subject' => $message['title'], '$thread_subject' => $message['title'],
'$thread_seen' => $seen, '$thread_seen' => $seen,
'$delete' => t('Delete conversation'), '$delete' => L10n::t('Delete conversation'),
'$canreply' => (($unknown) ? false : '1'), '$canreply' => (($unknown) ? false : '1'),
'$unknown_text' => t("No secure communications available. You <strong>may</strong> be able to respond from the sender's profile page."), '$unknown_text' => L10n::t("No secure communications available. You <strong>may</strong> be able to respond from the sender's profile page."),
'$mails' => $mails, '$mails' => $mails,
// reply // reply
'$header' => t('Send Reply'), '$header' => L10n::t('Send Reply'),
'$to' => t('To:'), '$to' => L10n::t('To:'),
'$showinputs' => '', '$showinputs' => '',
'$subject' => t('Subject:'), '$subject' => L10n::t('Subject:'),
'$subjtxt' => $message['title'], '$subjtxt' => $message['title'],
'$readonly' => ' readonly="readonly" style="background: #BBBBBB;" ', '$readonly' => ' readonly="readonly" style="background: #BBBBBB;" ',
'$yourmessage' => t('Your message:'), '$yourmessage' => L10n::t('Your message:'),
'$text' => '', '$text' => '',
'$select' => $select, '$select' => $select,
'$parent' => $parent, '$parent' => $parent,
'$upload' => t('Upload photo'), '$upload' => L10n::t('Upload photo'),
'$insert' => t('Insert web link'), '$insert' => L10n::t('Insert web link'),
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
'$wait' => t('Please wait') '$wait' => L10n::t('Please wait')
]); ]);
return $o; return $o;
@ -466,11 +467,11 @@ function render_messages(array $msg, $t)
foreach ($msg as $rr) { foreach ($msg as $rr) {
if ($rr['unknown']) { if ($rr['unknown']) {
$participants = t("Unknown sender - %s", $rr['from-name']); $participants = L10n::t("Unknown sender - %s", $rr['from-name']);
} elseif (link_compare($rr['from-url'], $myprofile)) { } elseif (link_compare($rr['from-url'], $myprofile)) {
$participants = t("You and %s", $rr['name']); $participants = L10n::t("You and %s", $rr['name']);
} else { } else {
$participants = t("%s and You", $rr['from-name']); $participants = L10n::t("%s and You", $rr['from-name']);
} }
$subject_e = (($rr['mailseen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>'); $subject_e = (($rr['mailseen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>');
@ -492,13 +493,13 @@ function render_messages(array $msg, $t)
'$sparkle' => ' sparkle', '$sparkle' => ' sparkle',
'$from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB), '$from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB),
'$subject' => $subject_e, '$subject' => $subject_e,
'$delete' => t('Delete conversation'), '$delete' => L10n::t('Delete conversation'),
'$body' => $body_e, '$body' => $body_e,
'$to_name' => $to_name_e, '$to_name' => $to_name_e,
'$date' => datetime_convert('UTC', date_default_timezone_get(), $rr['mailcreated'], t('D, d M Y - g:i A')), '$date' => datetime_convert('UTC', date_default_timezone_get(), $rr['mailcreated'], L10n::t('D, d M Y - g:i A')),
'$ago' => relative_date($rr['mailcreated']), '$ago' => relative_date($rr['mailcreated']),
'$seen' => $rr['mailseen'], '$seen' => $rr['mailseen'],
'$count' => tt('%d message', '%d messages', $rr['count']), '$count' => L10n::tt('%d message', '%d messages', $rr['count']),
]); ]);
} }

View file

@ -9,6 +9,7 @@ use Friendica\Content\ForumManager;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Content\Widget; use Friendica\Content\Widget;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
@ -25,7 +26,7 @@ require_once 'include/acl_selectors.php';
function network_init(App $a) function network_init(App $a)
{ {
if (!local_user()) { if (!local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -187,15 +188,15 @@ function saved_searches($search)
'id' => $rr['id'], 'id' => $rr['id'],
'term' => $rr['term'], 'term' => $rr['term'],
'encodedterm' => urlencode($rr['term']), 'encodedterm' => urlencode($rr['term']),
'delete' => t('Remove term'), 'delete' => L10n::t('Remove term'),
'selected' => ($search == $rr['term']), 'selected' => ($search == $rr['term']),
]; ];
} }
$tpl = get_markup_template('saved_searches_aside.tpl'); $tpl = get_markup_template('saved_searches_aside.tpl');
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$title' => t('Saved Searches'), '$title' => L10n::t('Saved Searches'),
'$add' => t('add'), '$add' => L10n::t('add'),
'$searchbox' => search($search, 'netsearch-box', $srchurl, true), '$searchbox' => search($search, 'netsearch-box', $srchurl, true),
'$saved' => $saved, '$saved' => $saved,
]); ]);
@ -540,9 +541,10 @@ function networkThreadedView(App $a, $update = 0)
if ($gid) { if ($gid) {
if (($t = Contact::getOStatusCountByGroupId($gid)) && !PConfig::get(local_user(), 'system', 'nowarn_insecure')) { if (($t = Contact::getOStatusCountByGroupId($gid)) && !PConfig::get(local_user(), 'system', 'nowarn_insecure')) {
notice(tt("Warning: This group contains %s member from a network that doesn't allow non public messages.", notice(L10n::tt("Warning: This group contains %s member from a network that doesn't allow non public messages.",
"Warning: This group contains %s members from a network that doesn't allow non public messages.", $t) . EOL); "Warning: This group contains %s members from a network that doesn't allow non public messages.",
notice(t("Messages in this group won't be send to these receivers.") . EOL); $t) . EOL);
notice(L10n::t("Messages in this group won't be send to these receivers.").EOL);
} }
} }
@ -610,7 +612,7 @@ function networkThreadedView(App $a, $update = 0)
if ($update) { if ($update) {
killme(); killme();
} }
notice(t('No such group') . EOL); notice(L10n::t('No such group') . EOL);
goaway('network/0'); goaway('network/0');
// NOTREACHED // NOTREACHED
} }
@ -631,11 +633,11 @@ function networkThreadedView(App $a, $update = 0)
$sql_extra3 .= " OR (`thread`.`contact-id` = '$contact_str_self' AND `temp1`.`allow_gid` LIKE '" . protect_sprintf('%<' . intval($gid) . '>%') . "' AND `temp1`.`private`))"; $sql_extra3 .= " OR (`thread`.`contact-id` = '$contact_str_self' AND `temp1`.`allow_gid` LIKE '" . protect_sprintf('%<' . intval($gid) . '>%') . "' AND `temp1`.`private`))";
} else { } else {
$sql_extra3 .= " AND false "; $sql_extra3 .= " AND false ";
info(t('Group is empty')); info(L10n::t('Group is empty'));
} }
$o = replace_macros(get_markup_template('section_title.tpl'), [ $o = replace_macros(get_markup_template('section_title.tpl'), [
'$title' => t('Group: %s', $group['name']) '$title' => L10n::t('Group: %s', $group['name'])
]) . $o; ]) . $o;
} elseif ($cid) { } elseif ($cid) {
$fields = ['id', 'name', 'network', 'writable', 'nurl', $fields = ['id', 'name', 'network', 'writable', 'nurl',
@ -660,12 +662,11 @@ function networkThreadedView(App $a, $update = 0)
'id' => 'network', 'id' => 'network',
]) . $o; ]) . $o;
if ($contact['network'] === NETWORK_OSTATUS && $contact['writable'] && !PConfig::get(local_user(), 'system', if ($contact['network'] === NETWORK_OSTATUS && $contact['writable'] && !PConfig::get(local_user(),'system','nowarn_insecure')) {
'nowarn_insecure')) { notice(L10n::t('Private messages to this person are at risk of public disclosure.') . EOL);
notice(t('Private messages to this person are at risk of public disclosure.') . EOL);
} }
} else { } else {
notice(t('Invalid contact.') . EOL); notice(L10n::t('Invalid contact.') . EOL);
goaway('network'); goaway('network');
// NOTREACHED // NOTREACHED
} }
@ -908,18 +909,18 @@ function network_tabs(App $a)
// tabs // tabs
$tabs = [ $tabs = [
[ [
'label' => t('Commented Order'), 'label' => L10n::t('Commented Order'),
'url' => str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 'url' => str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
'sel' => $all_active, 'sel' => $all_active,
'title' => t('Sort by Comment Date'), 'title' => L10n::t('Sort by Comment Date'),
'id' => 'commented-order-tab', 'id' => 'commented-order-tab',
'accesskey' => 'e', 'accesskey' => 'e',
], ],
[ [
'label' => t('Posted Order'), 'label' => L10n::t('Posted Order'),
'url' => str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 'url' => str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
'sel' => $postord_active, 'sel' => $postord_active,
'title' => t('Sort by Post Date'), 'title' => L10n::t('Sort by Post Date'),
'id' => 'posted-order-tab', 'id' => 'posted-order-tab',
'accesskey' => 't', 'accesskey' => 't',
], ],
@ -927,10 +928,10 @@ function network_tabs(App $a)
if (Feature::isEnabled(local_user(), 'personal_tab')) { if (Feature::isEnabled(local_user(), 'personal_tab')) {
$tabs[] = [ $tabs[] = [
'label' => t('Personal'), 'label' => L10n::t('Personal'),
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1', 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
'sel' => $conv_active, 'sel' => $conv_active,
'title' => t('Posts that mention or involve you'), 'title' => L10n::t('Posts that mention or involve you'),
'id' => 'personal-tab', 'id' => 'personal-tab',
'accesskey' => 'r', 'accesskey' => 'r',
]; ];
@ -938,10 +939,10 @@ function network_tabs(App $a)
if (Feature::isEnabled(local_user(), 'new_tab')) { if (Feature::isEnabled(local_user(), 'new_tab')) {
$tabs[] = [ $tabs[] = [
'label' => t('New'), 'label' => L10n::t('New'),
'url' => 'network/new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''), 'url' => 'network/new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
'sel' => $new_active, 'sel' => $new_active,
'title' => t('Activity Stream - by date'), 'title' => L10n::t('Activity Stream - by date'),
'id' => 'activitiy-by-date-tab', 'id' => 'activitiy-by-date-tab',
'accesskey' => 'w', 'accesskey' => 'w',
]; ];
@ -949,10 +950,10 @@ function network_tabs(App $a)
if (Feature::isEnabled(local_user(), 'link_tab')) { if (Feature::isEnabled(local_user(), 'link_tab')) {
$tabs[] = [ $tabs[] = [
'label' => t('Shared Links'), 'label' => L10n::t('Shared Links'),
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1', 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
'sel' => $bookmarked_active, 'sel' => $bookmarked_active,
'title' => t('Interesting Links'), 'title' => L10n::t('Interesting Links'),
'id' => 'shared-links-tab', 'id' => 'shared-links-tab',
'accesskey' => 'b', 'accesskey' => 'b',
]; ];
@ -960,10 +961,10 @@ function network_tabs(App $a)
if (Feature::isEnabled(local_user(), 'star_posts')) { if (Feature::isEnabled(local_user(), 'star_posts')) {
$tabs[] = [ $tabs[] = [
'label' => t('Starred'), 'label' => L10n::t('Starred'),
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1', 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
'sel' => $starred_active, 'sel' => $starred_active,
'title' => t('Favourite Posts'), 'title' => L10n::t('Favourite Posts'),
'id' => 'starred-posts-tab', 'id' => 'starred-posts-tab',
'accesskey' => 'm', 'accesskey' => 'm',
]; ];

View file

@ -1,54 +1,57 @@
<?php <?php
/**
* @file mod/newmember.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
function newmember_content(App $a) { function newmember_content(App $a)
{
$o = '<h1>' . t('Welcome to Friendica') . '</h1>'; $o = '<h1>' . L10n::t('Welcome to Friendica') . '</h1>';
$o .= '<h3>' . t('New Member Checklist') . '</h3>'; $o .= '<h3>' . L10n::t('New Member Checklist') . '</h3>';
$o .= '<div style="font-size: 120%;">'; $o .= '<div style="font-size: 120%;">';
$o .= t('We would like to offer some tips and links to help make your experience enjoyable. Click any item to visit the relevant page. A link to this page will be visible from your home page for two weeks after your initial registration and then will quietly disappear.'); $o .= L10n::t('We would like to offer some tips and links to help make your experience enjoyable. Click any item to visit the relevant page. A link to this page will be visible from your home page for two weeks after your initial registration and then will quietly disappear.');
$o .= '<h4>' . t('Getting Started') . '</h4>'; $o .= '<h4>' . L10n::t('Getting Started') . '</h4>';
$o .= '<ul>'; $o .= '<ul>';
$o .= '<li> ' . '<a target="newmember" href="help/guide">' . t('Friendica Walk-Through') . '</a><br />' . t('On your <em>Quick Start</em> page - find a brief introduction to your profile and network tabs, make some new connections, and find some groups to join.') . '</li>' . EOL; $o .= '<li> ' . '<a target="newmember" href="help/guide">' . L10n::t('Friendica Walk-Through') . '</a><br />' . L10n::t('On your <em>Quick Start</em> page - find a brief introduction to your profile and network tabs, make some new connections, and find some groups to join.') . '</li>' . EOL;
$o .= '</ul>'; $o .= '</ul>';
$o .= '<h4>' . t('Settings') . '</h4>'; $o .= '<h4>' . L10n::t('Settings') . '</h4>';
$o .= '<ul>'; $o .= '<ul>';
$o .= '<li>' . '<a target="newmember" href="settings">' . t('Go to Your Settings') . '</a><br />' . t('On your <em>Settings</em> page - change your initial password. Also make a note of your Identity Address. This looks just like an email address - and will be useful in making friends on the free social web.') . '</li>' . EOL; $o .= '<li>' . '<a target="newmember" href="settings">' . L10n::t('Go to Your Settings') . '</a><br />' . L10n::t('On your <em>Settings</em> page - change your initial password. Also make a note of your Identity Address. This looks just like an email address - and will be useful in making friends on the free social web.') . '</li>' . EOL;
$o .= '<li>' . t('Review the other settings, particularly the privacy settings. An unpublished directory listing is like having an unlisted phone number. In general, you should probably publish your listing - unless all of your friends and potential friends know exactly how to find you.') . '</li>' . EOL; $o .= '<li>' . L10n::t('Review the other settings, particularly the privacy settings. An unpublished directory listing is like having an unlisted phone number. In general, you should probably publish your listing - unless all of your friends and potential friends know exactly how to find you.') . '</li>' . EOL;
$o .= '</ul>'; $o .= '</ul>';
$o .= '<h4>' . t('Profile') . '</h4>'; $o .= '<h4>' . L10n::t('Profile') . '</h4>';
$o .= '<ul>'; $o .= '<ul>';
$o .= '<li>' . '<a target="newmember" href="profile_photo">' . t('Upload Profile Photo') . '</a><br />' . t('Upload a profile photo if you have not done so already. Studies have shown that people with real photos of themselves are ten times more likely to make friends than people who do not.') . '</li>' . EOL; $o .= '<li>' . '<a target="newmember" href="profile_photo">' . L10n::t('Upload Profile Photo') . '</a><br />' . L10n::t('Upload a profile photo if you have not done so already. Studies have shown that people with real photos of themselves are ten times more likely to make friends than people who do not.') . '</li>' . EOL;
$o .= '<li>' . '<a target="newmember" href="profiles">' . t('Edit Your Profile') . '</a><br />' . t('Edit your <strong>default</strong> profile to your liking. Review the settings for hiding your list of friends and hiding the profile from unknown visitors.') . '</li>' . EOL; $o .= '<li>' . '<a target="newmember" href="profiles">' . L10n::t('Edit Your Profile') . '</a><br />' . L10n::t('Edit your <strong>default</strong> profile to your liking. Review the settings for hiding your list of friends and hiding the profile from unknown visitors.') . '</li>' . EOL;
$o .= '<li>' . '<a target="newmember" href="profiles">' . t('Profile Keywords') . '</a><br />' . t('Set some public keywords for your default profile which describe your interests. We may be able to find other people with similar interests and suggest friendships.') . '</li>' . EOL; $o .= '<li>' . '<a target="newmember" href="profiles">' . L10n::t('Profile Keywords') . '</a><br />' . L10n::t('Set some public keywords for your default profile which describe your interests. We may be able to find other people with similar interests and suggest friendships.') . '</li>' . EOL;
$o .= '</ul>'; $o .= '</ul>';
$o .= '<h4>' . t('Connecting') . '</h4>'; $o .= '<h4>' . L10n::t('Connecting') . '</h4>';
$o .= '<ul>'; $o .= '<ul>';
$mail_disabled = ((function_exists('imap_open') && (!Config::get('system', 'imap_disabled'))) ? 0 : 1); $mail_disabled = ((function_exists('imap_open') && (!Config::get('system', 'imap_disabled'))) ? 0 : 1);
if (!$mail_disabled) { if (!$mail_disabled) {
$o .= '<li>' . '<a target="newmember" href="settings/connectors">' . t('Importing Emails') . '</a><br />' . t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</li>' . EOL; $o .= '<li>' . '<a target="newmember" href="settings/connectors">' . L10n::t('Importing Emails') . '</a><br />' . L10n::t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</li>' . EOL;
} }
$o .= '<li>' . '<a target="newmember" href="contacts">' . t('Go to Your Contacts Page') . '</a><br />' . t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Add New Contact</em> dialog.') . '</li>' . EOL; $o .= '<li>' . '<a target="newmember" href="contacts">' . L10n::t('Go to Your Contacts Page') . '</a><br />' . L10n::t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Add New Contact</em> dialog.') . '</li>' . EOL;
$o .= '<li>' . '<a target="newmember" href="directory">' . t("Go to Your Site's Directory") . '</a><br />' . t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</li>' . EOL; $o .= '<li>' . '<a target="newmember" href="directory">' . L10n::t("Go to Your Site's Directory") . '</a><br />' . L10n::t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</li>' . EOL;
$o .= '<li>' . '<a target="newmember" href="contacts">' . t('Finding New People') . '</a><br />' . t("On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.") . '</li>' . EOL; $o .= '<li>' . '<a target="newmember" href="contacts">' . L10n::t('Finding New People') . '</a><br />' . L10n::t("On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.") . '</li>' . EOL;
$o .= '</ul>'; $o .= '</ul>';
$o .= '<h4>' . t('Groups') . '</h4>'; $o .= '<h4>' . L10n::t('Groups') . '</h4>';
$o .= '<ul>'; $o .= '<ul>';
$o .= '<li>' . '<a target="newmember" href="contacts">' . t('Group Your Contacts') . '</a><br />' . t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</li>' . EOL; $o .= '<li>' . '<a target="newmember" href="contacts">' . L10n::t('Group Your Contacts') . '</a><br />' . L10n::t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</li>' . EOL;
if (Config::get('system', 'newuser_private')) { if (Config::get('system', 'newuser_private')) {
$o .= '<li>' . '<a target="newmember" href="help/Groups-and-Privacy">' . t("Why Aren't My Posts Public?") . '</a><br />' . t("Friendica respects your privacy. By default, your posts will only show up to people you've added as friends. For more information, see the help section from the link above.") . '</li>' . EOL; $o .= '<li>' . '<a target="newmember" href="help/Groups-and-Privacy">' . L10n::t("Why Aren't My Posts Public?") . '</a><br />' . L10n::t("Friendica respects your privacy. By default, your posts will only show up to people you've added as friends. For more information, see the help section from the link above.") . '</li>' . EOL;
} }
$o .= '</ul>'; $o .= '</ul>';
$o .= '<h4>' . t('Getting Help') . '</h4>'; $o .= '<h4>' . L10n::t('Getting Help') . '</h4>';
$o .= '<ul>'; $o .= '<ul>';
$o .= '<li>' . '<a target="newmember" href="help">' . t('Go to the Help Section') . '</a><br />' . t('Our <strong>help</strong> pages may be consulted for detail on other program features and resources.') . '</li>' . EOL; $o .= '<li>' . '<a target="newmember" href="help">' . L10n::t('Go to the Help Section') . '</a><br />' . L10n::t('Our <strong>help</strong> pages may be consulted for detail on other program features and resources.') . '</li>' . EOL;
$o .= '</ul>'; $o .= '</ul>';
$o .= '</div>'; $o .= '</div>';

View file

@ -4,6 +4,7 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\ContactSelector; use Friendica\Content\ContactSelector;
use Friendica\Core\L10n;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Group; use Friendica\Model\Group;
@ -24,7 +25,7 @@ function nogroup_init(App $a)
function nogroup_content(App $a) function nogroup_content(App $a)
{ {
if (! local_user()) { if (! local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return ''; return '';
} }
@ -38,8 +39,8 @@ function nogroup_content(App $a)
$contact_details = Contact::getDetailsByURL($rr['url'], local_user(), $rr); $contact_details = Contact::getDetailsByURL($rr['url'], local_user(), $rr);
$contacts[] = [ $contacts[] = [
'img_hover' => t('Visit %s\'s profile [%s]', $contact_details['name'], $rr['url']), 'img_hover' => L10n::t('Visit %s\'s profile [%s]', $contact_details['name'], $rr['url']),
'edit_hover' => t('Edit contact'), 'edit_hover' => L10n::t('Edit contact'),
'photo_menu' => Contact::photoMenu($rr), 'photo_menu' => Contact::photoMenu($rr),
'id' => $rr['id'], 'id' => $rr['id'],
'thumb' => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB), 'thumb' => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
@ -59,7 +60,7 @@ function nogroup_content(App $a)
$o = replace_macros( $o = replace_macros(
$tpl, $tpl,
[ [
'$header' => t('Contacts who are not members of a group'), '$header' => L10n::t('Contacts who are not members of a group'),
'$contacts' => $contacts, '$contacts' => $contacts,
'$paginate' => paginate($a)] '$paginate' => paginate($a)]
); );

View file

@ -4,11 +4,12 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\L10n;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Profile; use Friendica\Model\Profile;
function notes_init(App $a) { function notes_init(App $a)
{
if (! local_user()) { if (! local_user()) {
return; return;
} }
@ -20,21 +21,20 @@ function notes_init(App $a) {
Nav::setSelected('home'); Nav::setSelected('home');
//Profile::load($a, $which, $profile); //Profile::load($a, $which, $profile);
} }
function notes_content(App $a, $update = false) { function notes_content(App $a, $update = false)
{
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
require_once("include/bbcode.php"); require_once 'include/bbcode.php';
require_once('include/security.php'); require_once 'include/security.php';
require_once('include/conversation.php'); require_once 'include/conversation.php';
require_once('include/acl_selectors.php'); require_once 'include/acl_selectors.php';
$groups = []; $groups = [];
@ -50,8 +50,8 @@ function notes_content(App $a, $update = false) {
$o =""; $o ="";
$o .= Profile::getTabs($a, true); $o .= Profile::getTabs($a, true);
if(! $update) { if (!$update) {
$o .= '<h3>' . t('Personal Notes') . '</h3>'; $o .= '<h3>' . L10n::t('Personal Notes') . '</h3>';
$commpage = false; $commpage = false;
$commvisitor = false; $commvisitor = false;
@ -66,12 +66,11 @@ function notes_content(App $a, $update = false) {
'bang' => '', 'bang' => '',
'visitor' => 'block', 'visitor' => 'block',
'profile_uid' => local_user(), 'profile_uid' => local_user(),
'button' => t('Save'), 'button' => L10n::t('Save'),
'acl_data' => '', 'acl_data' => '',
]; ];
$o .= status_editor($a,$x,$a->contact['id']); $o .= status_editor($a, $x, $a->contact['id']);
} }
// Construct permissions // Construct permissions
@ -85,9 +84,9 @@ function notes_content(App $a, $update = false) {
WHERE %s AND `item`.`uid` = %d AND `item`.`type` = 'note' WHERE %s AND `item`.`uid` = %d AND `item`.`type` = 'note'
AND `contact`.`self` AND `item`.`id` = `item`.`parent` AND NOT `item`.`wall` AND `contact`.`self` AND `item`.`id` = `item`.`parent` AND NOT `item`.`wall`
$sql_extra ", $sql_extra ",
item_joins(), item_condition(), item_joins(),
item_condition(),
intval(local_user()) intval(local_user())
); );
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
@ -100,7 +99,8 @@ function notes_content(App $a, $update = false) {
AND `item`.`id` = `item`.`parent` AND NOT `item`.`wall` AND `item`.`id` = `item`.`parent` AND NOT `item`.`wall`
$sql_extra $sql_extra
ORDER BY `item`.`created` DESC LIMIT %d ,%d ", ORDER BY `item`.`created` DESC LIMIT %d ,%d ",
item_joins(), item_condition(), item_joins(),
item_condition(),
intval(local_user()), intval(local_user()),
intval($a->pager['start']), intval($a->pager['start']),
intval($a->pager['itemspage']) intval($a->pager['itemspage'])
@ -111,27 +111,29 @@ function notes_content(App $a, $update = false) {
$parents_str = ''; $parents_str = '';
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
foreach($r as $rr) foreach ($r as $rr) {
$parents_arr[] = $rr['item_id']; $parents_arr[] = $rr['item_id'];
}
$parents_str = implode(', ', $parents_arr); $parents_str = implode(', ', $parents_arr);
$r = q("SELECT %s FROM `item` %s $r = q("SELECT %s FROM `item` %s
WHERE %s AND `item`.`uid` = %d AND `item`.`parent` IN (%s) WHERE %s AND `item`.`uid` = %d AND `item`.`parent` IN (%s)
$sql_extra $sql_extra
ORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ", ORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ",
item_fieldlists(), item_joins(), item_condition(), item_fieldlists(),
item_joins(),
item_condition(),
intval(local_user()), intval(local_user()),
dbesc($parents_str) dbesc($parents_str)
); );
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
$items = conv_sort($r,"`commented`"); $items = conv_sort($r, "`commented`");
$o .= conversation($a,$items,'notes',$update); $o .= conversation($a, $items, 'notes', $update);
} }
} }
$o .= paginate($a); $o .= paginate($a);
return $o; return $o;
} }

View file

@ -1,13 +1,16 @@
<?php <?php
/**
/* GNU Social -> friendica items permanent-url compatibility */ * @file mod/notice.php
* GNU Social -> friendica items permanent-url compatibility
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
function notice_init(App $a) { function notice_init(App $a)
{
$id = $a->argv[1]; $id = $a->argv[1];
$r = q("SELECT `user`.`nickname` FROM `user` LEFT JOIN `item` ON `item`.`uid` = `user`.`uid` WHERE `item`.`id` = %d", intval($id)); $r = q("SELECT `user`.`nickname` FROM `user` LEFT JOIN `item` ON `item`.`uid` = `user`.`uid` WHERE `item`.`id` = %d", intval($id));
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
@ -16,7 +19,7 @@ function notice_init(App $a) {
goaway($url); goaway($url);
} else { } else {
$a->error = 404; $a->error = 404;
notice(t('Item not found.') . EOL); notice(L10n::t('Item not found.') . EOL);
} }
return; return;

View file

@ -6,6 +6,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\ContactSelector; use Friendica\Content\ContactSelector;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\L10n;
use Friendica\Core\NotificationsManager; use Friendica\Core\NotificationsManager;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -35,7 +36,7 @@ function notifications_post(App $a) {
$contact_id = $r[0]['contact-id']; $contact_id = $r[0]['contact-id'];
} }
else { else {
notice( t('Invalid request identifier.') . EOL); notice(L10n::t('Invalid request identifier.') . EOL);
return; return;
} }
@ -44,7 +45,7 @@ function notifications_post(App $a) {
$fid = $r[0]['fid']; $fid = $r[0]['fid'];
if($_POST['submit'] == t('Discard')) { if($_POST['submit'] == L10n::t('Discard')) {
$r = q("DELETE FROM `intro` WHERE `id` = %d", $r = q("DELETE FROM `intro` WHERE `id` = %d",
intval($intro_id) intval($intro_id)
); );
@ -60,7 +61,7 @@ function notifications_post(App $a) {
} }
goaway('notifications/intros'); goaway('notifications/intros');
} }
if($_POST['submit'] == t('Ignore')) { if($_POST['submit'] == L10n::t('Ignore')) {
$r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d", $r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d",
intval($intro_id)); intval($intro_id));
goaway('notifications/intros'); goaway('notifications/intros');
@ -71,7 +72,7 @@ function notifications_post(App $a) {
function notifications_content(App $a) { function notifications_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -96,7 +97,7 @@ function notifications_content(App $a) {
// Get introductions // Get introductions
if ((($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) { if ((($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) {
Nav::setSelected('introductions'); Nav::setSelected('introductions');
$notif_header = t('Notifications'); $notif_header = L10n::t('Notifications');
$all = (($a->argc > 2) && ($a->argv[2] == 'all')); $all = (($a->argc > 2) && ($a->argv[2] == 'all'));
@ -105,25 +106,25 @@ function notifications_content(App $a) {
// Get the network notifications // Get the network notifications
} else if (($a->argc > 1) && ($a->argv[1] == 'network')) { } else if (($a->argc > 1) && ($a->argv[1] == 'network')) {
$notif_header = t('Network Notifications'); $notif_header = L10n::t('Network Notifications');
$notifs = $nm->networkNotifs($show, $startrec, $perpage); $notifs = $nm->networkNotifs($show, $startrec, $perpage);
// Get the system notifications // Get the system notifications
} else if (($a->argc > 1) && ($a->argv[1] == 'system')) { } else if (($a->argc > 1) && ($a->argv[1] == 'system')) {
$notif_header = t('System Notifications'); $notif_header = L10n::t('System Notifications');
$notifs = $nm->systemNotifs($show, $startrec, $perpage); $notifs = $nm->systemNotifs($show, $startrec, $perpage);
// Get the personal notifications // Get the personal notifications
} else if (($a->argc > 1) && ($a->argv[1] == 'personal')) { } else if (($a->argc > 1) && ($a->argv[1] == 'personal')) {
$notif_header = t('Personal Notifications'); $notif_header = L10n::t('Personal Notifications');
$notifs = $nm->personalNotifs($show, $startrec, $perpage); $notifs = $nm->personalNotifs($show, $startrec, $perpage);
// Get the home notifications // Get the home notifications
} else if (($a->argc > 1) && ($a->argv[1] == 'home')) { } else if (($a->argc > 1) && ($a->argv[1] == 'home')) {
$notif_header = t('Home Notifications'); $notif_header = L10n::t('Home Notifications');
$notifs = $nm->homeNotifs($show, $startrec, $perpage); $notifs = $nm->homeNotifs($show, $startrec, $perpage);
} }
@ -152,7 +153,7 @@ function notifications_content(App $a) {
// The link to switch between ignored and normal connection requests // The link to switch between ignored and normal connection requests
$notif_show_lnk = [ $notif_show_lnk = [
'href' => (!$all ? 'notifications/intros/all' : 'notifications/intros' ), 'href' => (!$all ? 'notifications/intros/all' : 'notifications/intros' ),
'text' => (!$all ? t('Show Ignored Requests') : t('Hide Ignored Requests')) 'text' => (!$all ? L10n::t('Show Ignored Requests') : L10n::t('Hide Ignored Requests'))
]; ];
// Loop through all introduction notifications.This creates an array with the output html for each // Loop through all introduction notifications.This creates an array with the output html for each
@ -164,23 +165,23 @@ function notifications_content(App $a) {
switch ($it['label']) { switch ($it['label']) {
case 'friend_suggestion': case 'friend_suggestion':
$notif_content[] = replace_macros($sugg, [ $notif_content[] = replace_macros($sugg, [
'$str_notifytype' => t('Notification type: '), '$str_notifytype' => L10n::t('Notification type: '),
'$notify_type' => $it['notify_type'], '$notify_type' => $it['notify_type'],
'$intro_id' => $it['intro_id'], '$intro_id' => $it['intro_id'],
'$madeby' => sprintf( t('suggested by %s'),$it['madeby']), '$madeby' => L10n::t('suggested by %s', $it['madeby']),
'$contact_id' => $it['contact-id'], '$contact_id' => $it['contact-id'],
'$photo' => $it['photo'], '$photo' => $it['photo'],
'$fullname' => $it['name'], '$fullname' => $it['name'],
'$url' => $it['url'], '$url' => $it['url'],
'$hidden' => ['hidden', t('Hide this contact from others'), ($it['hidden'] == 1), ''], '$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($it['hidden'] == 1), ''],
'$activity' => ['activity', t('Post a new friend activity'), $it['post_newfriend'], t('if applicable')], '$activity' => ['activity', L10n::t('Post a new friend activity'), $it['post_newfriend'], L10n::t('if applicable')],
'$knowyou' => $it['knowyou'], '$knowyou' => $it['knowyou'],
'$approve' => t('Approve'), '$approve' => L10n::t('Approve'),
'$note' => $it['note'], '$note' => $it['note'],
'$request' => $it['request'], '$request' => $it['request'],
'$ignore' => t('Ignore'), '$ignore' => L10n::t('Ignore'),
'$discard' => t('Discard'), '$discard' => L10n::t('Discard'),
]); ]);
break; break;
@ -195,16 +196,16 @@ function notifications_content(App $a) {
if($it['network'] === NETWORK_DFRN || $it['network'] === NETWORK_DIASPORA) { if($it['network'] === NETWORK_DFRN || $it['network'] === NETWORK_DIASPORA) {
if($it['network'] === NETWORK_DFRN) { if($it['network'] === NETWORK_DFRN) {
$lbl_knowyou = t('Claims to be known to you: '); $lbl_knowyou = L10n::t('Claims to be known to you: ');
$knowyou = (($it['knowyou']) ? t('yes') : t('no')); $knowyou = (($it['knowyou']) ? L10n::t('yes') : L10n::t('no'));
$helptext = t('Shall your connection be bidirectional or not?'); $helptext = L10n::t('Shall your connection be bidirectional or not?');
$helptext2 = sprintf(t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.'), $it['name'], $it['name']); $helptext2 = L10n::t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.', $it['name'], $it['name']);
$helptext3 = sprintf(t('Accepting %s as a subscriber allows them to subscribe to your posts, but you will not receive updates from them in your news feed.'), $it['name']); $helptext3 = L10n::t('Accepting %s as a subscriber allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $it['name']);
} else { } else {
$knowyou = ''; $knowyou = '';
$helptext = t('Shall your connection be bidirectional or not?'); $helptext = L10n::t('Shall your connection be bidirectional or not?');
$helptext2 = sprintf(t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.'), $it['name'], $it['name']); $helptext2 = L10n::t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.', $it['name'], $it['name']);
$helptext3 = sprintf(t('Accepting %s as a sharer allows them to subscribe to your posts, but you will not receive updates from them in your news feed.'), $it['name']); $helptext3 = L10n::t('Accepting %s as a sharer allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $it['name']);
} }
} }
@ -215,8 +216,8 @@ function notifications_content(App $a) {
'$approve_as1' => $helptext, '$approve_as1' => $helptext,
'$approve_as2' => $helptext2, '$approve_as2' => $helptext2,
'$approve_as3' => $helptext3, '$approve_as3' => $helptext3,
'$as_friend' => t('Friend'), '$as_friend' => L10n::t('Friend'),
'$as_fan' => (($it['network'] == NETWORK_DIASPORA) ? t('Sharer') : t('Subscriber')) '$as_fan' => (($it['network'] == NETWORK_DIASPORA) ? L10n::t('Sharer') : L10n::t('Subscriber'))
]); ]);
$header = $it["name"]; $header = $it["name"];
@ -227,14 +228,14 @@ function notifications_content(App $a) {
$header .= " (".ContactSelector::networkToName($it['network'], $it['url']).")"; $header .= " (".ContactSelector::networkToName($it['network'], $it['url']).")";
if ($it['network'] != NETWORK_DIASPORA) { if ($it['network'] != NETWORK_DIASPORA) {
$discard = t('Discard'); $discard = L10n::t('Discard');
} else { } else {
$discard = ''; $discard = '';
} }
$notif_content[] = replace_macros($tpl, [ $notif_content[] = replace_macros($tpl, [
'$header' => htmlentities($header), '$header' => htmlentities($header),
'$str_notifytype' => t('Notification type: '), '$str_notifytype' => L10n::t('Notification type: '),
'$notify_type' => $it['notify_type'], '$notify_type' => $it['notify_type'],
'$dfrn_text' => $dfrn_text, '$dfrn_text' => $dfrn_text,
'$dfrn_id' => $it['dfrn_id'], '$dfrn_id' => $it['dfrn_id'],
@ -244,26 +245,26 @@ function notifications_content(App $a) {
'$photo' => $it['photo'], '$photo' => $it['photo'],
'$fullname' => $it['name'], '$fullname' => $it['name'],
'$location' => $it['location'], '$location' => $it['location'],
'$lbl_location' => t('Location:'), '$lbl_location' => L10n::t('Location:'),
'$about' => $it['about'], '$about' => $it['about'],
'$lbl_about' => t('About:'), '$lbl_about' => L10n::t('About:'),
'$keywords' => $it['keywords'], '$keywords' => $it['keywords'],
'$lbl_keywords' => t('Tags:'), '$lbl_keywords' => L10n::t('Tags:'),
'$gender' => $it['gender'], '$gender' => $it['gender'],
'$lbl_gender' => t('Gender:'), '$lbl_gender' => L10n::t('Gender:'),
'$hidden' => ['hidden', t('Hide this contact from others'), ($it['hidden'] == 1), ''], '$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($it['hidden'] == 1), ''],
'$activity' => ['activity', t('Post a new friend activity'), $it['post_newfriend'], t('if applicable')], '$activity' => ['activity', L10n::t('Post a new friend activity'), $it['post_newfriend'], L10n::t('if applicable')],
'$url' => $it['url'], '$url' => $it['url'],
'$zrl' => $it['zrl'], '$zrl' => $it['zrl'],
'$lbl_url' => t('Profile URL'), '$lbl_url' => L10n::t('Profile URL'),
'$addr' => $it['addr'], '$addr' => $it['addr'],
'$lbl_knowyou' => $lbl_knowyou, '$lbl_knowyou' => $lbl_knowyou,
'$lbl_network' => t('Network:'), '$lbl_network' => L10n::t('Network:'),
'$network' => ContactSelector::networkToName($it['network'], $it['url']), '$network' => ContactSelector::networkToName($it['network'], $it['url']),
'$knowyou' => $knowyou, '$knowyou' => $knowyou,
'$approve' => t('Approve'), '$approve' => L10n::t('Approve'),
'$note' => $it['note'], '$note' => $it['note'],
'$ignore' => t('Ignore'), '$ignore' => L10n::t('Ignore'),
'$discard' => $discard, '$discard' => $discard,
]); ]);
@ -272,7 +273,7 @@ function notifications_content(App $a) {
} }
if($notifs['total'] == 0) if($notifs['total'] == 0)
info( t('No introductions.') . EOL); info(L10n::t('No introductions.') . EOL);
// Normal notifications (no introductions) // Normal notifications (no introductions)
} else { } else {
@ -310,16 +311,17 @@ function notifications_content(App $a) {
// It doesn't make sense to show the Show unread / Show all link visible if the user is on the // It doesn't make sense to show the Show unread / Show all link visible if the user is on the
// "Show all" page and there are no notifications. So we will hide it. // "Show all" page and there are no notifications. So we will hide it.
if($show == 0 || intval($show) && $notifs['total'] > 0) { if ($show == 0 || intval($show) && $notifs['total'] > 0) {
$notif_show_lnk = [ $notif_show_lnk = [
'href' => ($show ? 'notifications/'.$notifs['ident'] : 'notifications/'.$notifs['ident'].'?show=all' ), 'href' => ($show ? 'notifications/'.$notifs['ident'] : 'notifications/'.$notifs['ident'].'?show=all' ),
'text' => ($show ? t('Show unread') : t('Show all')), 'text' => ($show ? L10n::t('Show unread') : L10n::t('Show all')),
]; ];
} }
// Output if there aren't any notifications available // Output if there aren't any notifications available
if($notifs['total'] == 0) if ($notifs['total'] == 0) {
$notif_nocontent = sprintf( t('No more %s notifications.'), $notifs['ident']); $notif_nocontent = L10n::t('No more %s notifications.', $notifs['ident']);
}
} }
$o .= replace_macros($notif_tpl, [ $o .= replace_macros($notif_tpl, [

View file

@ -1,12 +1,16 @@
<?php <?php
/**
* @file mod/notify.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\NotificationsManager; use Friendica\Core\NotificationsManager;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Module\Login; use Friendica\Module\Login;
function notify_init(App $a) { function notify_init(App $a)
{
if (! local_user()) { if (! local_user()) {
return; return;
} }
@ -35,16 +39,16 @@ function notify_init(App $a) {
goaway(System::baseUrl(true)); goaway(System::baseUrl(true));
} }
if ($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all' ) { if ($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all') {
$r = $nm->setAllSeen(); $r = $nm->setAllSeen();
$j = json_encode(['result' => ($r) ? 'success' : 'fail']); $j = json_encode(['result' => ($r) ? 'success' : 'fail']);
echo $j; echo $j;
killme(); killme();
} }
} }
function notify_content(App $a) { function notify_content(App $a)
{
if (! local_user()) { if (! local_user()) {
return Login::form(); return Login::form();
} }
@ -59,7 +63,7 @@ function notify_content(App $a) {
$r = $nm->getAll(['seen'=>0]); $r = $nm->getAll(['seen'=>0]);
if (DBM::is_result($r) > 0) { if (DBM::is_result($r) > 0) {
foreach ($r as $it) { foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,[ $notif_content .= replace_macros($not_tpl, [
'$item_link' => System::baseUrl(true).'/notify/view/'. $it['id'], '$item_link' => System::baseUrl(true).'/notify/view/'. $it['id'],
'$item_image' => $it['photo'], '$item_image' => $it['photo'],
'$item_text' => strip_tags(bbcode($it['msg'])), '$item_text' => strip_tags(bbcode($it['msg'])),
@ -67,16 +71,14 @@ function notify_content(App $a) {
]); ]);
} }
} else { } else {
$notif_content .= t('No more system notifications.'); $notif_content .= L10n::t('No more system notifications.');
} }
$o .= replace_macros($notif_tpl, [ $o .= replace_macros($notif_tpl, [
'$notif_header' => t('System Notifications'), '$notif_header' => L10n::t('System Notifications'),
'$tabs' => false, // $tabs, '$tabs' => false, // $tabs,
'$notif_content' => $notif_content, '$notif_content' => $notif_content,
]); ]);
return $o; return $o;
} }

View file

@ -1,6 +1,9 @@
<?php <?php
/**
* @file mod/oexchange.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Module\Login; use Friendica\Module\Login;
@ -23,7 +26,7 @@ function oexchange_content(App $a) {
} }
if (($a->argc > 1) && $a->argv[1] === 'done') { if (($a->argc > 1) && $a->argv[1] === 'done') {
info( t('Post successful.') . EOL); info(L10n::t('Post successful.') . EOL);
return; return;
} }

View file

@ -1,7 +1,10 @@
<?php <?php
/**
* @file mod/openid.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -24,7 +27,7 @@ function openid_content(App $a) {
$authid = $_REQUEST['openid_identity']; $authid = $_REQUEST['openid_identity'];
if(! strlen($authid)) { if(! strlen($authid)) {
logger( t('OpenID protocol error. No ID returned.') . EOL); logger(L10n::t('OpenID protocol error. No ID returned.') . EOL);
goaway(System::baseUrl()); goaway(System::baseUrl());
} }
@ -61,7 +64,7 @@ function openid_content(App $a) {
// New registration? // New registration?
if ($a->config['register_policy'] == REGISTER_CLOSED) { if ($a->config['register_policy'] == REGISTER_CLOSED) {
notice( t('Account not found and OpenID registration is not permitted on this site.') . EOL); notice(L10n::t('Account not found and OpenID registration is not permitted on this site.') . EOL);
goaway(System::baseUrl()); goaway(System::baseUrl());
} }
@ -111,7 +114,7 @@ function openid_content(App $a) {
// NOTREACHED // NOTREACHED
} }
} }
notice( t('Login failed.') . EOL); notice(L10n::t('Login failed.') . EOL);
goaway(System::baseUrl()); goaway(System::baseUrl());
// NOTREACHED // NOTREACHED
} }

View file

@ -3,6 +3,7 @@
* @file mod/ostatus_subscribe.php * @file mod/ostatus_subscribe.php
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -11,12 +12,12 @@ use Friendica\Network\Probe;
function ostatus_subscribe_content(App $a) { function ostatus_subscribe_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
goaway($_SESSION['return_url']); goaway($_SESSION['return_url']);
// NOTREACHED // NOTREACHED
} }
$o = "<h2>".t("Subscribing to OStatus contacts")."</h2>"; $o = "<h2>".L10n::t("Subscribing to OStatus contacts")."</h2>";
$uid = local_user(); $uid = local_user();
@ -27,13 +28,13 @@ function ostatus_subscribe_content(App $a) {
if (PConfig::get($uid, "ostatus", "legacy_friends") == "") { if (PConfig::get($uid, "ostatus", "legacy_friends") == "") {
if ($_REQUEST["url"] == "") { if ($_REQUEST["url"] == "") {
return $o.t("No contact provided."); return $o.L10n::t("No contact provided.");
} }
$contact = Probe::uri($_REQUEST["url"]); $contact = Probe::uri($_REQUEST["url"]);
if (!$contact) { if (!$contact) {
return $o.t("Couldn't fetch information for contact."); return $o.L10n::t("Couldn't fetch information for contact.");
} }
$api = $contact["baseurl"]."/api/"; $api = $contact["baseurl"]."/api/";
@ -42,7 +43,7 @@ function ostatus_subscribe_content(App $a) {
$data = z_fetch_url($api."statuses/friends.json?screen_name=".$contact["nick"]); $data = z_fetch_url($api."statuses/friends.json?screen_name=".$contact["nick"]);
if (!$data["success"]) { if (!$data["success"]) {
return $o.t("Couldn't fetch friends for contact."); return $o.L10n::t("Couldn't fetch friends for contact.");
} }
PConfig::set($uid, "ostatus", "legacy_friends", $data["body"]); PConfig::set($uid, "ostatus", "legacy_friends", $data["body"]);
@ -56,7 +57,7 @@ function ostatus_subscribe_content(App $a) {
$a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL='.System::baseUrl().'/settings/connectors">'; $a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL='.System::baseUrl().'/settings/connectors">';
PConfig::delete($uid, "ostatus", "legacy_friends"); PConfig::delete($uid, "ostatus", "legacy_friends");
PConfig::delete($uid, "ostatus", "legacy_contact"); PConfig::delete($uid, "ostatus", "legacy_contact");
$o .= t("Done"); $o .= L10n::t("Done");
return $o; return $o;
} }
@ -70,17 +71,17 @@ function ostatus_subscribe_content(App $a) {
if ($data["network"] == NETWORK_OSTATUS) { if ($data["network"] == NETWORK_OSTATUS) {
$result = Contact::createFromProbe($uid, $url, true, NETWORK_OSTATUS); $result = Contact::createFromProbe($uid, $url, true, NETWORK_OSTATUS);
if ($result["success"]) { if ($result["success"]) {
$o .= " - ".t("success"); $o .= " - ".L10n::t("success");
} else { } else {
$o .= " - ".t("failed"); $o .= " - ".L10n::t("failed");
} }
} else { } else {
$o .= " - ".t("ignored"); $o .= " - ".L10n::t("ignored");
} }
$o .= "</p>"; $o .= "</p>";
$o .= "<p>".t("Keep this window open until done.")."</p>"; $o .= "<p>".L10n::t("Keep this window open until done.")."</p>";
$a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL='.System::baseUrl().'/ostatus_subscribe?counter='.$counter.'">'; $a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL='.System::baseUrl().'/ostatus_subscribe?counter='.$counter.'">';

View file

@ -4,20 +4,21 @@ This file is part of the Diaspora protocol. It is used for fetching single publi
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Protocol\Diaspora; use Friendica\Protocol\Diaspora;
function p_init($a){ function p_init($a){
if ($a->argc != 2) { if ($a->argc != 2) {
header($_SERVER["SERVER_PROTOCOL"].' 510 '.t('Not Extended')); header($_SERVER["SERVER_PROTOCOL"].' 510 '.L10n::t('Not Extended'));
killme(); killme();
} }
$guid = $a->argv[1]; $guid = $a->argv[1];
if (strtolower(substr($guid, -4)) != ".xml") { if (strtolower(substr($guid, -4)) != ".xml") {
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found')); header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found'));
killme(); killme();
} }
@ -44,7 +45,7 @@ function p_init($a){
} }
} }
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found')); header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found'));
killme(); killme();
} }
@ -53,7 +54,7 @@ function p_init($a){
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self` INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
WHERE `user`.`uid` = %d", intval($item[0]["uid"])); WHERE `user`.`uid` = %d", intval($item[0]["uid"]));
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found')); header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found'));
killme(); killme();
} }
$user = $r[0]; $user = $r[0];

View file

@ -6,6 +6,7 @@ use Friendica\App;
use Friendica\Content\Feature; use Friendica\Content\Feature;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\Worker; use Friendica\Core\Worker;
@ -81,7 +82,7 @@ function photos_init(App $a) {
$ret['albums'] = []; $ret['albums'] = [];
foreach ($albums as $k => $album) { foreach ($albums as $k => $album) {
//hide profile photos to others //hide profile photos to others
if (!$is_owner && !remote_user() && ($album['album'] == t('Profile Photos'))) if (!$is_owner && !remote_user() && ($album['album'] == L10n::t('Profile Photos')))
continue; continue;
$entry = [ $entry = [
'text' => $album['album'], 'text' => $album['album'],
@ -101,11 +102,11 @@ function photos_init(App $a) {
if ($ret['success']) { if ($ret['success']) {
$photo_albums_widget = replace_macros(get_markup_template('photo_albums.tpl'), [ $photo_albums_widget = replace_macros(get_markup_template('photo_albums.tpl'), [
'$nick' => $a->data['user']['nickname'], '$nick' => $a->data['user']['nickname'],
'$title' => t('Photo Albums'), '$title' => L10n::t('Photo Albums'),
'$recent' => t('Recent Photos'), '$recent' => L10n::t('Recent Photos'),
'$albums' => $ret['albums'], '$albums' => $ret['albums'],
'$baseurl' => System::baseUrl(), '$baseurl' => System::baseUrl(),
'$upload' => [t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload'], '$upload' => [L10n::t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload'],
'$can_post' => $can_post '$can_post' => $can_post
]); ]);
} }
@ -119,7 +120,7 @@ function photos_init(App $a) {
$tpl = get_markup_template("photos_head.tpl"); $tpl = get_markup_template("photos_head.tpl");
$a->page['htmlhead'] .= replace_macros($tpl,[ $a->page['htmlhead'] .= replace_macros($tpl,[
'$ispublic' => t('everybody') '$ispublic' => L10n::t('everybody')
]); ]);
} }
@ -167,7 +168,7 @@ function photos_post(App $a)
} }
if (!$can_post) { if (!$can_post) {
notice( t('Permission denied.') . EOL ); notice(L10n::t('Permission denied.') . EOL );
killme(); killme();
} }
@ -177,7 +178,7 @@ function photos_post(App $a)
); );
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
notice( t('Contact information unavailable') . EOL); notice(L10n::t('Contact information unavailable') . EOL);
logger('photos_post: unable to locate contact record for page owner. uid=' . $page_owner_uid); logger('photos_post: unable to locate contact record for page owner. uid=' . $page_owner_uid);
killme(); killme();
} }
@ -187,7 +188,7 @@ function photos_post(App $a)
if ($a->argc > 3 && $a->argv[2] === 'album') { if ($a->argc > 3 && $a->argv[2] === 'album') {
$album = hex2bin($a->argv[3]); $album = hex2bin($a->argv[3]);
if ($album === t('Profile Photos') || $album === 'Contact Photos' || $album === t('Contact Photos')) { if ($album === L10n::t('Profile Photos') || $album === 'Contact Photos' || $album === L10n::t('Contact Photos')) {
goaway($_SESSION['photo_return']); goaway($_SESSION['photo_return']);
return; // NOTREACHED return; // NOTREACHED
} }
@ -197,7 +198,7 @@ function photos_post(App $a)
intval($page_owner_uid) intval($page_owner_uid)
); );
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
notice( t('Album not found.') . EOL); notice(L10n::t('Album not found.') . EOL);
goaway($_SESSION['photo_return']); goaway($_SESSION['photo_return']);
return; // NOTREACHED return; // NOTREACHED
} }
@ -227,7 +228,7 @@ function photos_post(App $a)
* DELETE photo album and all its photos * DELETE photo album and all its photos
*/ */
if ($_POST['dropalbum'] == t('Delete Album')) { if ($_POST['dropalbum'] == L10n::t('Delete Album')) {
// Check if we should do HTML-based delete confirmation // Check if we should do HTML-based delete confirmation
if (x($_REQUEST, 'confirm')) { if (x($_REQUEST, 'confirm')) {
$drop_url = $a->query_string; $drop_url = $a->query_string;
@ -236,12 +237,12 @@ function photos_post(App $a)
]; ];
$a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [ $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [
'$method' => 'post', '$method' => 'post',
'$message' => t('Do you really want to delete this photo album and all its photos?'), '$message' => L10n::t('Do you really want to delete this photo album and all its photos?'),
'$extra_inputs' => $extra_inputs, '$extra_inputs' => $extra_inputs,
'$confirm' => t('Delete Album'), '$confirm' => L10n::t('Delete Album'),
'$confirm_url' => $drop_url, '$confirm_url' => $drop_url,
'$confirm_name' => 'dropalbum', // Needed so that confirmation will bring us back into this if statement '$confirm_name' => 'dropalbum', // Needed so that confirmation will bring us back into this if statement
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
]); ]);
$a->error = 1; // Set $a->error so the other module functions don't execute $a->error = 1; // Set $a->error so the other module functions don't execute
return; return;
@ -316,7 +317,7 @@ function photos_post(App $a)
goaway($_SESSION['photo_return']); goaway($_SESSION['photo_return']);
} }
if ($a->argc > 2 && defaults($_POST, 'delete', '') === t('Delete Photo')) { if ($a->argc > 2 && defaults($_POST, 'delete', '') === L10n::t('Delete Photo')) {
// same as above but remove single photo // same as above but remove single photo
@ -325,12 +326,12 @@ function photos_post(App $a)
$drop_url = $a->query_string; $drop_url = $a->query_string;
$a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [ $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [
'$method' => 'post', '$method' => 'post',
'$message' => t('Do you really want to delete this photo?'), '$message' => L10n::t('Do you really want to delete this photo?'),
'$extra_inputs' => [], '$extra_inputs' => [],
'$confirm' => t('Delete Photo'), '$confirm' => L10n::t('Delete Photo'),
'$confirm_url' => $drop_url, '$confirm_url' => $drop_url,
'$confirm_name' => 'delete', // Needed so that confirmation will bring us back into this if statement '$confirm_name' => 'delete', // Needed so that confirmation will bring us back into this if statement
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
]); ]);
$a->error = 1; // Set $a->error so the other module functions don't execute $a->error = 1; // Set $a->error so the other module functions don't execute
return; return;
@ -694,7 +695,7 @@ function photos_post(App $a)
$arr['tag'] = $tagged[4]; $arr['tag'] = $tagged[4];
$arr['inform'] = $tagged[2]; $arr['inform'] = $tagged[2];
$arr['origin'] = 1; $arr['origin'] = 1;
$arr['body'] = sprintf( t('%1$s was tagged in %2$s by %3$s'), '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') ; $arr['body'] = L10n::t('%1$s was tagged in %2$s by %3$s', '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . L10n::t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') ;
$arr['body'] .= "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . '[img]' . System::baseUrl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ; $arr['body'] .= "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . '[img]' . System::baseUrl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ;
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>'; $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>';
@ -749,7 +750,7 @@ function photos_post(App $a)
dbesc($album), dbesc($album),
intval($page_owner_uid) intval($page_owner_uid)
); );
if (!DBM::is_result($r) || ($album == t('Profile Photos'))) { if (!DBM::is_result($r) || ($album == L10n::t('Profile Photos'))) {
$visible = 1; $visible = 1;
} else { } else {
$visible = 0; $visible = 0;
@ -790,21 +791,21 @@ function photos_post(App $a)
if ($error !== UPLOAD_ERR_OK) { if ($error !== UPLOAD_ERR_OK) {
switch ($error) { switch ($error) {
case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_INI_SIZE:
notice(t('Image exceeds size limit of %s', ini_get('upload_max_filesize')) . EOL); notice(L10n::t('Image exceeds size limit of %s', ini_get('upload_max_filesize')) . EOL);
break; break;
case UPLOAD_ERR_FORM_SIZE: case UPLOAD_ERR_FORM_SIZE:
notice(t('Image exceeds size limit of %s', formatBytes(defaults($_REQUEST, 'MAX_FILE_SIZE', 0))) . EOL); notice(L10n::t('Image exceeds size limit of %s', formatBytes(defaults($_REQUEST, 'MAX_FILE_SIZE', 0))) . EOL);
break; break;
case UPLOAD_ERR_PARTIAL: case UPLOAD_ERR_PARTIAL:
notice(t('Image upload didn\'t complete, please try again') . EOL); notice(L10n::t('Image upload didn\'t complete, please try again') . EOL);
break; break;
case UPLOAD_ERR_NO_FILE: case UPLOAD_ERR_NO_FILE:
notice(t('Image file is missing') . EOL); notice(L10n::t('Image file is missing') . EOL);
break; break;
case UPLOAD_ERR_NO_TMP_DIR: case UPLOAD_ERR_NO_TMP_DIR:
case UPLOAD_ERR_CANT_WRITE: case UPLOAD_ERR_CANT_WRITE:
case UPLOAD_ERR_EXTENSION: case UPLOAD_ERR_EXTENSION:
notice(t('Server can\'t accept new file upload at this time, please contact your administrator') . EOL); notice(L10n::t('Server can\'t accept new file upload at this time, please contact your administrator') . EOL);
break; break;
} }
@unlink($src); @unlink($src);
@ -822,7 +823,7 @@ function photos_post(App $a)
$maximagesize = Config::get('system', 'maximagesize'); $maximagesize = Config::get('system', 'maximagesize');
if ($maximagesize && ($filesize > $maximagesize)) { if ($maximagesize && ($filesize > $maximagesize)) {
notice(t('Image exceeds size limit of %s', formatBytes($maximagesize)) . EOL); notice(L10n::t('Image exceeds size limit of %s', formatBytes($maximagesize)) . EOL);
@unlink($src); @unlink($src);
$foo = 0; $foo = 0;
Addon::callHooks('photo_post_end', $foo); Addon::callHooks('photo_post_end', $foo);
@ -830,7 +831,7 @@ function photos_post(App $a)
} }
if (!$filesize) { if (!$filesize) {
notice(t('Image file is empty.') . EOL); notice(L10n::t('Image file is empty.') . EOL);
@unlink($src); @unlink($src);
$foo = 0; $foo = 0;
Addon::callHooks('photo_post_end', $foo); Addon::callHooks('photo_post_end', $foo);
@ -845,7 +846,7 @@ function photos_post(App $a)
if (!$Image->isValid()) { if (!$Image->isValid()) {
logger('mod/photos.php: photos_post(): unable to process image' , LOGGER_DEBUG); logger('mod/photos.php: photos_post(): unable to process image' , LOGGER_DEBUG);
notice(t('Unable to process image.') . EOL); notice(L10n::t('Unable to process image.') . EOL);
@unlink($src); @unlink($src);
$foo = 0; $foo = 0;
Addon::callHooks('photo_post_end',$foo); Addon::callHooks('photo_post_end',$foo);
@ -873,8 +874,8 @@ function photos_post(App $a)
$r = Photo::store($Image, $page_owner_uid, $visitor, $photo_hash, $filename, $album, 0 , 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny); $r = Photo::store($Image, $page_owner_uid, $visitor, $photo_hash, $filename, $album, 0 , 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
if (!$r) { if (!$r) {
logger('mod/photos.php: photos_post(): image store failed' , LOGGER_DEBUG); logger('mod/photos.php: photos_post(): image store failed', LOGGER_DEBUG);
notice(t('Image upload failed.') . EOL); notice(L10n::t('Image upload failed.') . EOL);
killme(); killme();
} }
@ -959,7 +960,7 @@ function photos_content(App $a)
// photos/name/image/xxxxx/edit // photos/name/image/xxxxx/edit
if (Config::get('system', 'block_public') && !local_user() && !remote_user()) { if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
notice( t('Public access denied.') . EOL); notice(L10n::t('Public access denied.') . EOL);
return; return;
} }
@ -968,7 +969,7 @@ function photos_content(App $a)
require_once 'include/conversation.php'; require_once 'include/conversation.php';
if (!x($a->data,'user')) { if (!x($a->data,'user')) {
notice( t('No photos selected') . EOL ); notice(L10n::t('No photos selected') . EOL );
return; return;
} }
@ -1064,7 +1065,7 @@ function photos_content(App $a)
} }
if ($a->data['user']['hidewall'] && (local_user() != $owner_uid) && !$remote_contact) { if ($a->data['user']['hidewall'] && (local_user() != $owner_uid) && !$remote_contact) {
notice( t('Access to this item is restricted.') . EOL); notice(L10n::t('Access to this item is restricted.') . EOL);
return; return;
} }
@ -1079,7 +1080,7 @@ function photos_content(App $a)
// Display upload form // Display upload form
if ($datatype === 'upload') { if ($datatype === 'upload') {
if (!$can_post) { if (!$can_post) {
notice(t('Permission denied.')); notice(L10n::t('Permission denied.'));
return; return;
} }
@ -1090,7 +1091,7 @@ function photos_content(App $a)
$albumselect .= '<option value="" ' . (!$selname ? ' selected="selected" ' : '') . '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>'; $albumselect .= '<option value="" ' . (!$selname ? ' selected="selected" ' : '') . '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
if (count($a->data['albums'])) { if (count($a->data['albums'])) {
foreach ($a->data['albums'] as $album) { foreach ($a->data['albums'] as $album) {
if (($album['album'] === '') || ($album['album'] === 'Contact Photos') || ($album['album'] === t('Contact Photos'))) { if (($album['album'] === '') || ($album['album'] === 'Contact Photos') || ($album['album'] === L10n::t('Contact Photos'))) {
continue; continue;
} }
$selected = (($selname === $album['album']) ? ' selected="selected" ' : ''); $selected = (($selname === $album['album']) ? ' selected="selected" ' : '');
@ -1108,7 +1109,7 @@ function photos_content(App $a)
$default_upload_box = replace_macros(get_markup_template('photos_default_uploader_box.tpl'), []); $default_upload_box = replace_macros(get_markup_template('photos_default_uploader_box.tpl'), []);
$default_upload_submit = replace_macros(get_markup_template('photos_default_uploader_submit.tpl'), [ $default_upload_submit = replace_macros(get_markup_template('photos_default_uploader_submit.tpl'), [
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
]); ]);
$usage_message = ''; $usage_message = '';
@ -1118,15 +1119,15 @@ function photos_content(App $a)
$aclselect_e = ($visitor ? '' : populate_acl($a->user)); $aclselect_e = ($visitor ? '' : populate_acl($a->user));
$o .= replace_macros($tpl,[ $o .= replace_macros($tpl,[
'$pagename' => t('Upload Photos'), '$pagename' => L10n::t('Upload Photos'),
'$sessid' => session_id(), '$sessid' => session_id(),
'$usage' => $usage_message, '$usage' => $usage_message,
'$nickname' => $a->data['user']['nickname'], '$nickname' => $a->data['user']['nickname'],
'$newalbum' => t('New album name: '), '$newalbum' => L10n::t('New album name: '),
'$existalbumtext' => t('or existing album name: '), '$existalbumtext' => L10n::t('or existing album name: '),
'$nosharetext' => t('Do not show a status post for this upload'), '$nosharetext' => L10n::t('Do not show a status post for this upload'),
'$albumselect' => $albumselect, '$albumselect' => $albumselect,
'$permissions' => t('Permissions'), '$permissions' => L10n::t('Permissions'),
'$aclselect' => $aclselect_e, '$aclselect' => $aclselect_e,
'$alt_uploader' => $ret['addon_text'], '$alt_uploader' => $ret['addon_text'],
'$default_upload_box' => ($ret['default_upload'] ? $default_upload_box : ''), '$default_upload_box' => ($ret['default_upload'] ? $default_upload_box : ''),
@ -1134,8 +1135,8 @@ function photos_content(App $a)
'$uploadurl' => $ret['post_url'], '$uploadurl' => $ret['post_url'],
// ACL permissions box // ACL permissions box
'$group_perms' => t('Show to Groups'), '$group_perms' => L10n::t('Show to Groups'),
'$contact_perms' => t('Show to Contacts'), '$contact_perms' => L10n::t('Show to Contacts'),
'$return_path' => $a->query_string, '$return_path' => $a->query_string,
]); ]);
@ -1177,32 +1178,32 @@ function photos_content(App $a)
// edit album name // edit album name
if ($cmd === 'edit') { if ($cmd === 'edit') {
if (($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { if (($album !== L10n::t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== L10n::t('Contact Photos'))) {
if ($can_post) { if ($can_post) {
$edit_tpl = get_markup_template('album_edit.tpl'); $edit_tpl = get_markup_template('album_edit.tpl');
$album_e = $album; $album_e = $album;
$o .= replace_macros($edit_tpl,[ $o .= replace_macros($edit_tpl,[
'$nametext' => t('New album name: '), '$nametext' => L10n::t('New album name: '),
'$nickname' => $a->data['user']['nickname'], '$nickname' => $a->data['user']['nickname'],
'$album' => $album_e, '$album' => $album_e,
'$hexalbum' => bin2hex($album), '$hexalbum' => bin2hex($album),
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
'$dropsubmit' => t('Delete Album') '$dropsubmit' => L10n::t('Delete Album')
]); ]);
} }
} }
} else { } else {
if (($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos')) && $can_post) { if (($album !== L10n::t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== L10n::t('Contact Photos')) && $can_post) {
$edit = [t('Edit Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit']; $edit = [L10n::t('Edit Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit'];
} }
} }
if ($order_field === 'posted') { if ($order_field === 'posted') {
$order = [t('Show Newest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album)]; $order = [L10n::t('Show Newest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album)];
} else { } else {
$order = [t('Show Oldest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted']; $order = [L10n::t('Show Oldest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted'];
} }
$photos = []; $photos = [];
@ -1223,7 +1224,7 @@ function photos_content(App $a)
'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4), 'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4),
'link' => 'photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'] 'link' => 'photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id']
. ($order_field === 'posted' ? '?f=&order=posted' : ''), . ($order_field === 'posted' ? '?f=&order=posted' : ''),
'title' => t('View Photo'), 'title' => L10n::t('View Photo'),
'src' => 'photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext, 'src' => 'photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext,
'alt' => $imgalt_e, 'alt' => $imgalt_e,
'desc'=> $desc_e, 'desc'=> $desc_e,
@ -1238,7 +1239,7 @@ function photos_content(App $a)
'$photos' => $photos, '$photos' => $photos,
'$album' => $album, '$album' => $album,
'$can_post' => $can_post, '$can_post' => $can_post,
'$upload' => [t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album)], '$upload' => [L10n::t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album)],
'$order' => $order, '$order' => $order,
'$edit' => $edit, '$edit' => $edit,
'$paginate' => paginate($a), '$paginate' => paginate($a),
@ -1264,9 +1265,9 @@ function photos_content(App $a)
dbesc($datum) dbesc($datum)
); );
if (DBM::is_result($ph)) { if (DBM::is_result($ph)) {
notice(t('Permission denied. Access to this item may be restricted.')); notice(L10n::t('Permission denied. Access to this item may be restricted.'));
} else { } else {
notice(t('Photo not available') . EOL ); notice(L10n::t('Photo not available') . EOL );
} }
return; return;
} }
@ -1329,14 +1330,14 @@ function photos_content(App $a)
if ($can_post && ($ph[0]['uid'] == $owner_uid)) { if ($can_post && ($ph[0]['uid'] == $owner_uid)) {
$tools = [ $tools = [
'edit' => ['photos/' . $a->data['user']['nickname'] . '/image/' . $datum . (($cmd === 'edit') ? '' : '/edit'), (($cmd === 'edit') ? t('View photo') : t('Edit photo'))], 'edit' => ['photos/' . $a->data['user']['nickname'] . '/image/' . $datum . (($cmd === 'edit') ? '' : '/edit'), (($cmd === 'edit') ? L10n::t('View photo') : L10n::t('Edit photo'))],
'profile'=>['profile_photo/use/'.$ph[0]['resource-id'], t('Use as profile photo')], 'profile'=>['profile_photo/use/'.$ph[0]['resource-id'], L10n::t('Use as profile photo')],
]; ];
// lock // lock
$lock = ( ( ($ph[0]['uid'] == local_user()) && (strlen($ph[0]['allow_cid']) || strlen($ph[0]['allow_gid']) $lock = ( ( ($ph[0]['uid'] == local_user()) && (strlen($ph[0]['allow_cid']) || strlen($ph[0]['allow_gid'])
|| strlen($ph[0]['deny_cid']) || strlen($ph[0]['deny_gid'])) ) || strlen($ph[0]['deny_cid']) || strlen($ph[0]['deny_gid'])) )
? t('Private Message') ? L10n::t('Private Message')
: Null); : Null);
@ -1355,7 +1356,7 @@ function photos_content(App $a)
$photo = [ $photo = [
'href' => 'photo/' . $hires['resource-id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']], 'href' => 'photo/' . $hires['resource-id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']],
'title'=> t('View Full Size'), 'title'=> L10n::t('View Full Size'),
'src' => 'photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . datetime_convert('','','','ymdhis'), 'src' => 'photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . datetime_convert('','','','ymdhis'),
'height' => $hires['height'], 'height' => $hires['height'],
'width' => $hires['width'], 'width' => $hires['width'],
@ -1446,10 +1447,10 @@ function photos_content(App $a)
} }
$tag_str .= bbcode($t); $tag_str .= bbcode($t);
} }
$tags = [t('Tags: '), $tag_str]; $tags = [L10n::t('Tags: '), $tag_str];
if ($cmd === 'edit') { if ($cmd === 'edit') {
$tags[] = 'tagrm/' . $link_item['id']; $tags[] = 'tagrm/' . $link_item['id'];
$tags[] = t('[Remove any tag]'); $tags[] = L10n::t('[Remove any tag]');
} }
} }
@ -1464,25 +1465,25 @@ function photos_content(App $a)
$edit = replace_macros($edit_tpl, [ $edit = replace_macros($edit_tpl, [
'$id' => $ph[0]['id'], '$id' => $ph[0]['id'],
'$album' => ['albname', t('New album name'), $album_e,''], '$album' => ['albname', L10n::t('New album name'), $album_e,''],
'$caption' => ['desc', t('Caption'), $caption_e, ''], '$caption' => ['desc', L10n::t('Caption'), $caption_e, ''],
'$tags' => ['newtag', t('Add a Tag'), "", t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping')], '$tags' => ['newtag', L10n::t('Add a Tag'), "", L10n::t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping')],
'$rotate_none' => ['rotate', t('Do not rotate'),0,'', true], '$rotate_none' => ['rotate', L10n::t('Do not rotate'),0,'', true],
'$rotate_cw' => ['rotate', t('Rotate CW (right)'),1,''], '$rotate_cw' => ['rotate', L10n::t('Rotate CW (right)'),1,''],
'$rotate_ccw' => ['rotate', t('Rotate CCW (left)'),2,''], '$rotate_ccw' => ['rotate', L10n::t('Rotate CCW (left)'),2,''],
'$nickname' => $a->data['user']['nickname'], '$nickname' => $a->data['user']['nickname'],
'$resource_id' => $ph[0]['resource-id'], '$resource_id' => $ph[0]['resource-id'],
'$permissions' => t('Permissions'), '$permissions' => L10n::t('Permissions'),
'$aclselect' => $aclselect_e, '$aclselect' => $aclselect_e,
'$item_id' => defaults($link_item, 'id', 0), '$item_id' => defaults($link_item, 'id', 0),
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
'$delete' => t('Delete Photo'), '$delete' => L10n::t('Delete Photo'),
// ACL permissions box // ACL permissions box
'$group_perms' => t('Show to Groups'), '$group_perms' => L10n::t('Show to Groups'),
'$contact_perms' => t('Show to Contacts'), '$contact_perms' => L10n::t('Show to Contacts'),
'$return_path' => $a->query_string, '$return_path' => $a->query_string,
]); ]);
} }
@ -1503,9 +1504,9 @@ function photos_content(App $a)
$like_tpl = get_markup_template('like_noshare.tpl'); $like_tpl = get_markup_template('like_noshare.tpl');
$likebuttons = replace_macros($like_tpl, [ $likebuttons = replace_macros($like_tpl, [
'$id' => $link_item['id'], '$id' => $link_item['id'],
'$likethis' => t("I like this \x28toggle\x29"), '$likethis' => L10n::t("I like this \x28toggle\x29"),
'$nolike' => (Feature::isEnabled(local_user(), 'dislike') ? t("I don't like this \x28toggle\x29") : ''), '$nolike' => (Feature::isEnabled(local_user(), 'dislike') ? L10n::t("I don't like this \x28toggle\x29") : ''),
'$wait' => t('Please wait'), '$wait' => L10n::t('Please wait'),
'$return_path' => $a->query_string, '$return_path' => $a->query_string,
]); ]);
} }
@ -1520,12 +1521,12 @@ function photos_content(App $a)
'$parent' => $link_item['id'], '$parent' => $link_item['id'],
'$profile_uid' => $owner_uid, '$profile_uid' => $owner_uid,
'$mylink' => $contact['url'], '$mylink' => $contact['url'],
'$mytitle' => t('This is you'), '$mytitle' => L10n::t('This is you'),
'$myphoto' => $contact['thumb'], '$myphoto' => $contact['thumb'],
'$comment' => t('Comment'), '$comment' => L10n::t('Comment'),
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
'$preview' => t('Preview'), '$preview' => L10n::t('Preview'),
'$sourceapp' => t($a->sourcename), '$sourceapp' => L10n::t($a->sourcename),
'$ww' => '', '$ww' => '',
'$rand_num' => random_digits(12) '$rand_num' => random_digits(12)
]); ]);
@ -1533,8 +1534,8 @@ function photos_content(App $a)
} }
$conv_responses = [ $conv_responses = [
'like' => ['title' => t('Likes','title')],'dislike' => ['title' => t('Dislikes','title')], 'like' => ['title' => L10n::t('Likes','title')],'dislike' => ['title' => L10n::t('Dislikes','title')],
'attendyes' => ['title' => t('Attending','title')], 'attendno' => ['title' => t('Not attending','title')], 'attendmaybe' => ['title' => t('Might attend','title')] 'attendyes' => ['title' => L10n::t('Attending','title')], 'attendno' => ['title' => L10n::t('Not attending','title')], 'attendmaybe' => ['title' => L10n::t('Might attend','title')]
]; ];
// display comments // display comments
@ -1559,12 +1560,12 @@ function photos_content(App $a)
'$parent' => $link_item['id'], '$parent' => $link_item['id'],
'$profile_uid' => $owner_uid, '$profile_uid' => $owner_uid,
'$mylink' => $contact['url'], '$mylink' => $contact['url'],
'$mytitle' => t('This is you'), '$mytitle' => L10n::t('This is you'),
'$myphoto' => $contact['thumb'], '$myphoto' => $contact['thumb'],
'$comment' => t('Comment'), '$comment' => L10n::t('Comment'),
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
'$preview' => t('Preview'), '$preview' => L10n::t('Preview'),
'$sourceapp' => t($a->sourcename), '$sourceapp' => L10n::t($a->sourcename),
'$ww' => '', '$ww' => '',
'$rand_num' => random_digits(12) '$rand_num' => random_digits(12)
]); ]);
@ -1601,8 +1602,8 @@ function photos_content(App $a)
$drop = [ $drop = [
'dropping' => $dropping, 'dropping' => $dropping,
'pagedrop' => false, 'pagedrop' => false,
'select' => t('Select'), 'select' => L10n::t('Select'),
'delete' => t('Delete'), 'delete' => L10n::t('Delete'),
]; ];
$name_e = $profile_name; $name_e = $profile_name;
@ -1632,12 +1633,12 @@ function photos_content(App $a)
'$parent' => $item['parent'], '$parent' => $item['parent'],
'$profile_uid' => $owner_uid, '$profile_uid' => $owner_uid,
'$mylink' => $contact['url'], '$mylink' => $contact['url'],
'$mytitle' => t('This is you'), '$mytitle' => L10n::t('This is you'),
'$myphoto' => $contact['thumb'], '$myphoto' => $contact['thumb'],
'$comment' => t('Comment'), '$comment' => L10n::t('Comment'),
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
'$preview' => t('Preview'), '$preview' => L10n::t('Preview'),
'$sourceapp' => t($a->sourcename), '$sourceapp' => L10n::t($a->sourcename),
'$ww' => '', '$ww' => '',
'$rand_num' => random_digits(12) '$rand_num' => random_digits(12)
]); ]);
@ -1666,7 +1667,7 @@ function photos_content(App $a)
'$tags' => $tags, '$tags' => $tags,
'$edit' => $edit, '$edit' => $edit,
'$map' => $map, '$map' => $map,
'$map_text' => t('Map'), '$map_text' => L10n::t('Map'),
'$likebuttons' => $likebuttons, '$likebuttons' => $likebuttons,
'$like' => $like, '$like' => $like,
'$dislike' => $dislike, '$dislike' => $dislike,
@ -1691,7 +1692,7 @@ function photos_content(App $a)
$sql_extra GROUP BY `resource-id`", $sql_extra GROUP BY `resource-id`",
intval($a->data['user']['uid']), intval($a->data['user']['uid']),
dbesc('Contact Photos'), dbesc('Contact Photos'),
dbesc( t('Contact Photos')) dbesc(L10n::t('Contact Photos'))
); );
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
$a->set_pager_total(count($r)); $a->set_pager_total(count($r));
@ -1705,7 +1706,7 @@ function photos_content(App $a)
$sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT %d , %d", $sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT %d , %d",
intval($a->data['user']['uid']), intval($a->data['user']['uid']),
dbesc('Contact Photos'), dbesc('Contact Photos'),
dbesc( t('Contact Photos')), dbesc(L10n::t('Contact Photos')),
intval($a->pager['start']), intval($a->pager['start']),
intval($a->pager['itemspage']) intval($a->pager['itemspage'])
); );
@ -1716,7 +1717,7 @@ function photos_content(App $a)
$twist = false; $twist = false;
foreach ($r as $rr) { foreach ($r as $rr) {
//hide profile photos to others //hide profile photos to others
if (!$is_owner && !remote_user() && ($rr['album'] == t('Profile Photos'))) if (!$is_owner && !remote_user() && ($rr['album'] == L10n::t('Profile Photos')))
continue; continue;
$twist = !$twist; $twist = !$twist;
@ -1730,13 +1731,13 @@ function photos_content(App $a)
'id' => $rr['id'], 'id' => $rr['id'],
'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4), 'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4),
'link' => 'photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'], 'link' => 'photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'],
'title' => t('View Photo'), 'title' => L10n::t('View Photo'),
'src' => 'photo/' . $rr['resource-id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext, 'src' => 'photo/' . $rr['resource-id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext,
'alt' => $alt_e, 'alt' => $alt_e,
'album' => [ 'album' => [
'link' => 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']), 'link' => 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']),
'name' => $name_e, 'name' => $name_e,
'alt' => t('View Album'), 'alt' => L10n::t('View Album'),
], ],
]; ];
@ -1745,9 +1746,9 @@ function photos_content(App $a)
$tpl = get_markup_template('photos_recent.tpl'); $tpl = get_markup_template('photos_recent.tpl');
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$title' => t('Recent Photos'), '$title' => L10n::t('Recent Photos'),
'$can_post' => $can_post, '$can_post' => $can_post,
'$upload' => [t('Upload New Photos'), 'photos/'.$a->data['user']['nickname'].'/upload'], '$upload' => [L10n::t('Upload New Photos'), 'photos/'.$a->data['user']['nickname'].'/upload'],
'$photos' => $photos, '$photos' => $photos,
'$paginate' => paginate($a), '$paginate' => paginate($a),
]); ]);

View file

@ -7,6 +7,7 @@ use Friendica\Content\Feature;
use Friendica\Content\ForumManager; use Friendica\Content\ForumManager;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Cache; use Friendica\Core\Cache;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -286,7 +287,7 @@ function ping_init(App $a)
'photo' => $intro['photo'], 'photo' => $intro['photo'],
'date' => $intro['datetime'], 'date' => $intro['datetime'],
'seen' => false, 'seen' => false,
'message' => t('{0} wants to be your friend'), 'message' => L10n::t('{0} wants to be your friend'),
]; ];
$notifs[] = $notif; $notifs[] = $notif;
} }
@ -301,7 +302,7 @@ function ping_init(App $a)
'photo' => $mail['from-photo'], 'photo' => $mail['from-photo'],
'date' => $mail['created'], 'date' => $mail['created'],
'seen' => false, 'seen' => false,
'message' => t('{0} sent you a message'), 'message' => L10n::t('{0} sent you a message'),
]; ];
$notifs[] = $notif; $notifs[] = $notif;
} }
@ -316,7 +317,7 @@ function ping_init(App $a)
'photo' => $reg['micro'], 'photo' => $reg['micro'],
'date' => $reg['created'], 'date' => $reg['created'],
'seen' => false, 'seen' => false,
'message' => t('{0} requested registration'), 'message' => L10n::t('{0} requested registration'),
]; ];
$notifs[] = $notif; $notifs[] = $notif;
} }

View file

@ -1,5 +1,4 @@
<?php <?php
/** /**
* Poke, prod, finger, or otherwise do unspeakable things to somebody - who must be a connection in your address book * Poke, prod, finger, or otherwise do unspeakable things to somebody - who must be a connection in your address book
* This function can be invoked with the required arguments (verb and cid and private and possibly parent) silently via ajax or * This function can be invoked with the required arguments (verb and cid and private and possibly parent) silently via ajax or
@ -16,13 +15,14 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
require_once('include/security.php'); require_once 'include/security.php';
require_once('include/bbcode.php'); require_once 'include/bbcode.php';
require_once('include/items.php'); require_once 'include/items.php';
function poke_init(App $a) { function poke_init(App $a) {
@ -124,7 +124,7 @@ function poke_init(App $a) {
$arr['object-type'] = ACTIVITY_OBJ_PERSON; $arr['object-type'] = ACTIVITY_OBJ_PERSON;
$arr['origin'] = 1; $arr['origin'] = 1;
$arr['body'] = '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' . ' ' . t($verbs[$verb][0]) . ' ' . '[url=' . $target['url'] . ']' . $target['name'] . '[/url]'; $arr['body'] = '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' . ' ' . L10n::t($verbs[$verb][0]) . ' ' . '[url=' . $target['url'] . ']' . $target['name'] . '[/url]';
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $target['name'] . '</title><id>' . System::baseUrl() . '/contact/' . $target['id'] . '</id>'; $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $target['name'] . '</title><id>' . System::baseUrl() . '/contact/' . $target['id'] . '</id>';
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $target['url'] . '" />' . "\n"); $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $target['url'] . '" />' . "\n");
@ -155,7 +155,7 @@ function poke_init(App $a) {
function poke_content(App $a) { function poke_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -197,14 +197,14 @@ function poke_content(App $a) {
$tpl = get_markup_template('poke_content.tpl'); $tpl = get_markup_template('poke_content.tpl');
$o = replace_macros($tpl,[ $o = replace_macros($tpl,[
'$title' => t('Poke/Prod'), '$title' => L10n::t('Poke/Prod'),
'$desc' => t('poke, prod or do other things to somebody'), '$desc' => L10n::t('poke, prod or do other things to somebody'),
'$clabel' => t('Recipient'), '$clabel' => L10n::t('Recipient'),
'$choice' => t('Choose what you wish to do to recipient'), '$choice' => L10n::t('Choose what you wish to do to recipient'),
'$verbs' => $shortlist, '$verbs' => $shortlist,
'$parent' => $parent, '$parent' => $parent,
'$prv_desc' => t('Make this post private'), '$prv_desc' => L10n::t('Make this post private'),
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
'$name' => $name, '$name' => $name,
'$id' => $id '$id' => $id
]); ]);

View file

@ -1,13 +1,16 @@
<?php <?php
/**
* @file mod/probe.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Network\Probe; use Friendica\Network\Probe;
function probe_content(App $a) { function probe_content(App $a)
{
if (!local_user()) { if (!local_user()) {
http_status_exit(403, ["title" => t("Public access denied."), http_status_exit(403, ["title" => L10n::t("Public access denied."),
"description" => t("Only logged in users are permitted to perform a probing.")]); "description" => L10n::t("Only logged in users are permitted to perform a probing.")]);
killme(); killme();
} }

View file

@ -7,6 +7,7 @@ use Friendica\Content\Widget;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -29,7 +30,7 @@ function profile_init(App $a)
goaway(System::baseUrl() . '/profile/' . $r[0]['nickname']); goaway(System::baseUrl() . '/profile/' . $r[0]['nickname']);
} else { } else {
logger('profile error: mod_profile ' . $a->query_string, LOGGER_DEBUG); logger('profile error: mod_profile ' . $a->query_string, LOGGER_DEBUG);
notice(t('Requested profile is not available.') . EOL); notice(L10n::t('Requested profile is not available.') . EOL);
$a->error = 404; $a->error = 404;
return; return;
} }
@ -70,9 +71,9 @@ function profile_init(App $a)
} }
$a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . ($a->profile['net-publish'] ? 'true' : 'false') . '" />' . "\r\n"; $a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . ($a->profile['net-publish'] ? 'true' : 'false') . '" />' . "\r\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n"; $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n"; $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n"; $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n";
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . ($a->path ? '/' . $a->path : '')); $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . ($a->path ? '/' . $a->path : ''));
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n"; $a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
@ -167,7 +168,7 @@ function profile_content(App $a, $update = 0)
$last_updated_key = "profile:" . $a->profile['profile_uid'] . ":" . local_user() . ":" . remote_user(); $last_updated_key = "profile:" . $a->profile['profile_uid'] . ":" . local_user() . ":" . remote_user();
if (x($a->profile, 'hidewall') && !$is_owner && !$remote_contact) { if (x($a->profile, 'hidewall') && !$is_owner && !$remote_contact) {
notice(t('Access to this profile has been restricted.') . EOL); notice(L10n::t('Access to this profile has been restricted.') . EOL);
return; return;
} }
@ -188,7 +189,7 @@ function profile_content(App $a, $update = 0)
$o .= Widget::commonFriendsVisitor($a->profile['profile_uid']); $o .= Widget::commonFriendsVisitor($a->profile['profile_uid']);
if (x($_SESSION, 'new_member') && $is_owner) { if (x($_SESSION, 'new_member') && $is_owner) {
$o .= '<a href="newmember" id="newmember-tips" style="font-size: 1.2em;"><b>' . t('Tips for New Members') . '</b></a>' . EOL; $o .= '<a href="newmember" id="newmember-tips" style="font-size: 1.2em;"><b>' . L10n::t('Tips for New Members') . '</b></a>' . EOL;
} }
$commpage = $a->profile['page-flags'] == PAGE_COMMUNITY; $commpage = $a->profile['page-flags'] == PAGE_COMMUNITY;

View file

@ -4,6 +4,7 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -23,7 +24,7 @@ function profile_photo_init(App $a)
function profile_photo_post(App $a) { function profile_photo_post(App $a) {
if (! local_user()) { if (! local_user()) {
notice ( t('Permission denied.') . EOL ); notice(L10n::t('Permission denied.') . EOL );
return; return;
} }
@ -48,7 +49,7 @@ function profile_photo_post(App $a) {
// phase 2 - we have finished cropping // phase 2 - we have finished cropping
if($a->argc != 2) { if($a->argc != 2) {
notice( t('Image uploaded but image cropping failed.') . EOL ); notice(L10n::t('Image uploaded but image cropping failed.') . EOL );
return; return;
} }
@ -78,26 +79,26 @@ function profile_photo_post(App $a) {
if ($Image->isValid()) { if ($Image->isValid()) {
$Image->crop(175,$srcX,$srcY,$srcW,$srcH); $Image->crop(175,$srcX,$srcY,$srcW,$srcH);
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 4, $is_default_profile); $r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], L10n::t('Profile Photos'), 4, $is_default_profile);
if ($r === false) { if ($r === false) {
notice ( sprintf(t('Image size reduction [%s] failed.'),"175") . EOL ); notice(L10n::t('Image size reduction [%s] failed.', "175") . EOL);
} }
$Image->scaleDown(80); $Image->scaleDown(80);
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, $is_default_profile); $r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], L10n::t('Profile Photos'), 5, $is_default_profile);
if ($r === false) { if ($r === false) {
notice( sprintf(t('Image size reduction [%s] failed.'),"80") . EOL ); notice(L10n::t('Image size reduction [%s] failed.', "80") . EOL);
} }
$Image->scaleDown(48); $Image->scaleDown(48);
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 6, $is_default_profile); $r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], L10n::t('Profile Photos'), 6, $is_default_profile);
if ($r === false) { if ($r === false) {
notice( sprintf(t('Image size reduction [%s] failed.'),"48") . EOL ); notice(L10n::t('Image size reduction [%s] failed.', "48") . EOL);
} }
// If setting for the default profile, unset the profile photo flag from any other photos I own // If setting for the default profile, unset the profile photo flag from any other photos I own
@ -131,7 +132,7 @@ function profile_photo_post(App $a) {
intval(local_user()) intval(local_user())
); );
info( t('Shift-reload the page or clear browser cache if the new photo does not display immediately.') . EOL); info(L10n::t('Shift-reload the page or clear browser cache if the new photo does not display immediately.') . EOL);
// Update global directory in background // Update global directory in background
$url = System::baseUrl() . '/profile/' . $a->user['nickname']; $url = System::baseUrl() . '/profile/' . $a->user['nickname'];
if ($url && strlen(Config::get('system','directory'))) { if ($url && strlen(Config::get('system','directory'))) {
@ -140,7 +141,7 @@ function profile_photo_post(App $a) {
Worker::add(PRIORITY_LOW, 'ProfileUpdate', local_user()); Worker::add(PRIORITY_LOW, 'ProfileUpdate', local_user());
} else { } else {
notice( t('Unable to process image') . EOL); notice(L10n::t('Unable to process image') . EOL);
} }
} }
@ -159,7 +160,7 @@ function profile_photo_post(App $a) {
$maximagesize = Config::get('system', 'maximagesize'); $maximagesize = Config::get('system', 'maximagesize');
if (($maximagesize) && ($filesize > $maximagesize)) { if (($maximagesize) && ($filesize > $maximagesize)) {
notice(sprintf(t('Image exceeds size limit of %s'), formatBytes($maximagesize)) . EOL); notice(L10n::t('Image exceeds size limit of %s', formatBytes($maximagesize)) . EOL);
@unlink($src); @unlink($src);
return; return;
} }
@ -168,7 +169,7 @@ function profile_photo_post(App $a) {
$ph = new Image($imagedata, $filetype); $ph = new Image($imagedata, $filetype);
if (! $ph->isValid()) { if (! $ph->isValid()) {
notice(t('Unable to process image.') . EOL); notice(L10n::t('Unable to process image.') . EOL);
@unlink($src); @unlink($src);
return; return;
} }
@ -182,7 +183,7 @@ function profile_photo_post(App $a) {
function profile_photo_content(App $a) { function profile_photo_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL ); notice(L10n::t('Permission denied.') . EOL );
return; return;
} }
@ -193,7 +194,7 @@ function profile_photo_content(App $a) {
if( $a->argv[1]=='use'){ if( $a->argv[1]=='use'){
if ($a->argc<3){ if ($a->argc<3){
notice( t('Permission denied.') . EOL ); notice(L10n::t('Permission denied.') . EOL );
return; return;
}; };
@ -206,7 +207,7 @@ function profile_photo_content(App $a) {
dbesc($resource_id) dbesc($resource_id)
); );
if (!DBM::is_result($r)){ if (!DBM::is_result($r)){
notice( t('Permission denied.') . EOL ); notice(L10n::t('Permission denied.') . EOL );
return; return;
} }
$havescale = false; $havescale = false;
@ -217,7 +218,7 @@ function profile_photo_content(App $a) {
// set an already uloaded photo as profile photo // set an already uloaded photo as profile photo
// if photo is in 'Profile Photos', change it in db // if photo is in 'Profile Photos', change it in db
if (($r[0]['album']== t('Profile Photos')) && ($havescale)){ if (($r[0]['album']== L10n::t('Profile Photos')) && ($havescale)){
$r=q("UPDATE `photo` SET `profile`=0 WHERE `profile`=1 AND `uid`=%d", $r=q("UPDATE `photo` SET `profile`=0 WHERE `profile`=1 AND `uid`=%d",
intval(local_user())); intval(local_user()));
@ -256,13 +257,13 @@ function profile_photo_content(App $a) {
$o .= replace_macros($tpl,[ $o .= replace_macros($tpl,[
'$user' => $a->user['nickname'], '$user' => $a->user['nickname'],
'$lbl_upfile' => t('Upload File:'), '$lbl_upfile' => L10n::t('Upload File:'),
'$lbl_profiles' => t('Select a profile:'), '$lbl_profiles' => L10n::t('Select a profile:'),
'$title' => t('Upload Profile Photo'), '$title' => L10n::t('Upload Profile Photo'),
'$submit' => t('Upload'), '$submit' => L10n::t('Upload'),
'$profiles' => $profiles, '$profiles' => $profiles,
'$form_security_token' => get_form_security_token("profile_photo"), '$form_security_token' => get_form_security_token("profile_photo"),
'$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . System::baseUrl() . '">' . t('skip this step') . '</a>' : '<a href="'. System::baseUrl() . '/photos/' . $a->user['nickname'] . '">' . t('select a photo from your photo albums') . '</a>') '$select' => sprintf('%s %s', L10n::t('or'), ($newuser) ? '<a href="' . System::baseUrl() . '">' . L10n::t('skip this step') . '</a>' : '<a href="'. System::baseUrl() . '/photos/' . $a->user['nickname'] . '">' . L10n::t('select a photo from your photo albums') . '</a>')
]); ]);
return $o; return $o;
@ -276,10 +277,10 @@ function profile_photo_content(App $a) {
'$profile' => intval($_REQUEST['profile']), '$profile' => intval($_REQUEST['profile']),
'$resource' => $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'], '$resource' => $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'],
'$image_url' => System::baseUrl() . '/photo/' . $filename, '$image_url' => System::baseUrl() . '/photo/' . $filename,
'$title' => t('Crop Image'), '$title' => L10n::t('Crop Image'),
'$desc' => t('Please adjust the image cropping for optimum viewing.'), '$desc' => L10n::t('Please adjust the image cropping for optimum viewing.'),
'$form_security_token' => get_form_security_token("profile_photo"), '$form_security_token' => get_form_security_token("profile_photo"),
'$done' => t('Done Editing') '$done' => L10n::t('Done Editing')
]); ]);
return $o; return $o;
} }
@ -311,20 +312,20 @@ function profile_photo_crop_ui_head(App $a, Image $Image) {
$smallest = 0; $smallest = 0;
$r = Photo::store($Image, local_user(), 0 , $hash, $filename, t('Profile Photos'), 0 ); $r = Photo::store($Image, local_user(), 0, $hash, $filename, L10n::t('Profile Photos'), 0);
if ($r) { if ($r) {
info( t('Image uploaded successfully.') . EOL ); info(L10n::t('Image uploaded successfully.') . EOL);
} else { } else {
notice( t('Image upload failed.') . EOL ); notice(L10n::t('Image upload failed.') . EOL);
} }
if ($width > 640 || $height > 640) { if ($width > 640 || $height > 640) {
$Image->scaleDown(640); $Image->scaleDown(640);
$r = Photo::store($Image, local_user(), 0 , $hash, $filename, t('Profile Photos'), 1 ); $r = Photo::store($Image, local_user(), 0, $hash, $filename, L10n::t('Profile Photos'), 1);
if ($r === false) { if ($r === false) {
notice( sprintf(t('Image size reduction [%s] failed.'),"640") . EOL ); notice(L10n::t('Image size reduction [%s] failed.', "640") . EOL);
} else { } else {
$smallest = 1; $smallest = 1;
} }

View file

@ -8,6 +8,7 @@ use Friendica\Content\Feature;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
@ -30,7 +31,7 @@ function profiles_init(App $a) {
intval(local_user()) intval(local_user())
); );
if (! DBM::is_result($r)) { if (! DBM::is_result($r)) {
notice( t('Profile not found.') . EOL); notice(L10n::t('Profile not found.') . EOL);
goaway('profiles'); goaway('profiles');
return; // NOTREACHED return; // NOTREACHED
} }
@ -49,7 +50,7 @@ function profiles_init(App $a) {
intval(local_user()) intval(local_user())
); );
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
info(t('Profile deleted.').EOL); info(L10n::t('Profile deleted.').EOL);
} }
goaway('profiles'); goaway('profiles');
@ -65,7 +66,7 @@ function profiles_init(App $a) {
$num_profiles = (DBM::is_result($r0) ? count($r0) : 0); $num_profiles = (DBM::is_result($r0) ? count($r0) : 0);
$name = t('Profile-') . ($num_profiles + 1); $name = L10n::t('Profile-') . ($num_profiles + 1);
$r1 = q("SELECT `name`, `photo`, `thumb` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1", $r1 = q("SELECT `name`, `photo`, `thumb` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
intval(local_user())); intval(local_user()));
@ -84,7 +85,7 @@ function profiles_init(App $a) {
dbesc($name) dbesc($name)
); );
info( t('New profile created.') . EOL); info(L10n::t('New profile created.') . EOL);
if (DBM::is_result($r3) && count($r3) == 1) { if (DBM::is_result($r3) && count($r3) == 1) {
goaway('profiles/' . $r3[0]['id']); goaway('profiles/' . $r3[0]['id']);
} }
@ -101,13 +102,13 @@ function profiles_init(App $a) {
$num_profiles = (DBM::is_result($r0) ? count($r0) : 0); $num_profiles = (DBM::is_result($r0) ? count($r0) : 0);
$name = t('Profile-') . ($num_profiles + 1); $name = L10n::t('Profile-') . ($num_profiles + 1);
$r1 = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d LIMIT 1", $r1 = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval(local_user()), intval(local_user()),
intval($a->argv[2]) intval($a->argv[2])
); );
if(! DBM::is_result($r1)) { if(! DBM::is_result($r1)) {
notice( t('Profile unavailable to clone.') . EOL); notice(L10n::t('Profile unavailable to clone.') . EOL);
killme(); killme();
return; return;
} }
@ -123,7 +124,7 @@ function profiles_init(App $a) {
intval(local_user()), intval(local_user()),
dbesc($name) dbesc($name)
); );
info( t('New profile created.') . EOL); info(L10n::t('New profile created.') . EOL);
if ((DBM::is_result($r3)) && (count($r3) == 1)) { if ((DBM::is_result($r3)) && (count($r3) == 1)) {
goaway('profiles/'.$r3[0]['id']); goaway('profiles/'.$r3[0]['id']);
} }
@ -140,7 +141,7 @@ function profiles_init(App $a) {
intval(local_user()) intval(local_user())
); );
if (! DBM::is_result($r)) { if (! DBM::is_result($r)) {
notice( t('Profile not found.') . EOL); notice(L10n::t('Profile not found.') . EOL);
killme(); killme();
return; return;
} }
@ -173,7 +174,7 @@ function profile_clean_keywords($keywords) {
function profiles_post(App $a) { function profiles_post(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -187,7 +188,7 @@ function profiles_post(App $a) {
intval(local_user()) intval(local_user())
); );
if (! DBM::is_result($orig)) { if (! DBM::is_result($orig)) {
notice( t('Profile not found.') . EOL); notice(L10n::t('Profile not found.') . EOL);
return; return;
} }
@ -197,7 +198,7 @@ function profiles_post(App $a) {
$profile_name = notags(trim($_POST['profile_name'])); $profile_name = notags(trim($_POST['profile_name']));
if (! strlen($profile_name)) { if (! strlen($profile_name)) {
notice( t('Profile Name is required.') . EOL); notice(L10n::t('Profile Name is required.') . EOL);
return; return;
} }
@ -337,61 +338,61 @@ function profiles_post(App $a) {
$value = ''; $value = '';
if ($is_default) { if ($is_default) {
if ($marital != $orig[0]['marital']) { if ($marital != $orig[0]['marital']) {
$changes[] = '[color=#ff0000]&hearts;[/color] ' . t('Marital Status'); $changes[] = '[color=#ff0000]&hearts;[/color] ' . L10n::t('Marital Status');
$value = $marital; $value = $marital;
} }
if ($withchanged) { if ($withchanged) {
$changes[] = '[color=#ff0000]&hearts;[/color] ' . t('Romantic Partner'); $changes[] = '[color=#ff0000]&hearts;[/color] ' . L10n::t('Romantic Partner');
$value = strip_tags($with); $value = strip_tags($with);
} }
if ($likes != $orig[0]['likes']) { if ($likes != $orig[0]['likes']) {
$changes[] = t('Likes'); $changes[] = L10n::t('Likes');
$value = $likes; $value = $likes;
} }
if ($dislikes != $orig[0]['dislikes']) { if ($dislikes != $orig[0]['dislikes']) {
$changes[] = t('Dislikes'); $changes[] = L10n::t('Dislikes');
$value = $dislikes; $value = $dislikes;
} }
if ($work != $orig[0]['work']) { if ($work != $orig[0]['work']) {
$changes[] = t('Work/Employment'); $changes[] = L10n::t('Work/Employment');
} }
if ($religion != $orig[0]['religion']) { if ($religion != $orig[0]['religion']) {
$changes[] = t('Religion'); $changes[] = L10n::t('Religion');
$value = $religion; $value = $religion;
} }
if ($politic != $orig[0]['politic']) { if ($politic != $orig[0]['politic']) {
$changes[] = t('Political Views'); $changes[] = L10n::t('Political Views');
$value = $politic; $value = $politic;
} }
if ($gender != $orig[0]['gender']) { if ($gender != $orig[0]['gender']) {
$changes[] = t('Gender'); $changes[] = L10n::t('Gender');
$value = $gender; $value = $gender;
} }
if ($sexual != $orig[0]['sexual']) { if ($sexual != $orig[0]['sexual']) {
$changes[] = t('Sexual Preference'); $changes[] = L10n::t('Sexual Preference');
$value = $sexual; $value = $sexual;
} }
if ($xmpp != $orig[0]['xmpp']) { if ($xmpp != $orig[0]['xmpp']) {
$changes[] = t('XMPP'); $changes[] = L10n::t('XMPP');
$value = $xmpp; $value = $xmpp;
} }
if ($homepage != $orig[0]['homepage']) { if ($homepage != $orig[0]['homepage']) {
$changes[] = t('Homepage'); $changes[] = L10n::t('Homepage');
$value = $homepage; $value = $homepage;
} }
if ($interest != $orig[0]['interest']) { if ($interest != $orig[0]['interest']) {
$changes[] = t('Interests'); $changes[] = L10n::t('Interests');
$value = $interest; $value = $interest;
} }
if ($address != $orig[0]['address']) { if ($address != $orig[0]['address']) {
$changes[] = t('Address'); $changes[] = L10n::t('Address');
// New address not sent in notifications, potential privacy issues // New address not sent in notifications, potential privacy issues
// in case this leaks to unintended recipients. Yes, it's in the public // in case this leaks to unintended recipients. Yes, it's in the public
// profile but that doesn't mean we have to broadcast it to everybody. // profile but that doesn't mean we have to broadcast it to everybody.
} }
if ($locality != $orig[0]['locality'] || $region != $orig[0]['region'] if ($locality != $orig[0]['locality'] || $region != $orig[0]['region']
|| $country_name != $orig[0]['country-name']) { || $country_name != $orig[0]['country-name']) {
$changes[] = t('Location'); $changes[] = L10n::t('Location');
$comma1 = ((($locality) && ($region || $country_name)) ? ', ' : ' '); $comma1 = ((($locality) && ($region || $country_name)) ? ', ' : ' ');
$comma2 = (($region && $country_name) ? ', ' : ''); $comma2 = (($region && $country_name) ? ', ' : '');
$value = $locality . $comma1 . $region . $comma2 . $country_name; $value = $locality . $comma1 . $region . $comma2 . $country_name;
@ -476,7 +477,7 @@ function profiles_post(App $a) {
); );
if ($r) { if ($r) {
info(t('Profile updated.') . EOL); info(L10n::t('Profile updated.') . EOL);
} }
@ -568,7 +569,7 @@ function profile_activity($changed, $value) {
foreach ($changed as $ch) { foreach ($changed as $ch) {
if (strlen($changes)) { if (strlen($changes)) {
if ($z == ($t - 1)) { if ($z == ($t - 1)) {
$changes .= t(' and '); $changes .= L10n::t(' and ');
} else { } else {
$changes .= ', '; $changes .= ', ';
} }
@ -577,13 +578,13 @@ function profile_activity($changed, $value) {
$changes .= $ch; $changes .= $ch;
} }
$prof = '[url=' . $self[0]['url'] . '?tab=profile' . ']' . t('public profile') . '[/url]'; $prof = '[url=' . $self[0]['url'] . '?tab=profile' . ']' . L10n::t('public profile') . '[/url]';
if ($t == 1 && strlen($value)) { if ($t == 1 && strlen($value)) {
$message = sprintf( t('%1$s changed %2$s to &ldquo;%3$s&rdquo;'), $A, $changes, $value); $message = L10n::t('%1$s changed %2$s to &ldquo;%3$s&rdquo;', $A, $changes, $value);
$message .= "\n\n" . sprintf( t(' - Visit %1$s\'s %2$s'), $A, $prof); $message .= "\n\n" . L10n::t(' - Visit %1$s\'s %2$s', $A, $prof);
} else { } else {
$message = sprintf( t('%1$s has an updated %2$s, changing %3$s.'), $A, $prof, $changes); $message = L10n::t('%1$s has an updated %2$s, changing %3$s.', $A, $prof, $changes);
} }
@ -610,7 +611,7 @@ function profile_activity($changed, $value) {
function profiles_content(App $a) { function profiles_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -622,7 +623,7 @@ function profiles_content(App $a) {
intval(local_user()) intval(local_user())
); );
if (! DBM::is_result($r)) { if (! DBM::is_result($r)) {
notice( t('Profile not found.') . EOL); notice(L10n::t('Profile not found.') . EOL);
return; return;
} }
@ -637,14 +638,14 @@ function profiles_content(App $a) {
$hide_friends = replace_macros($opt_tpl,[ $hide_friends = replace_macros($opt_tpl,[
'$yesno' => [ '$yesno' => [
'hide-friends', //Name 'hide-friends', //Name
t('Hide contacts and friends:'), //Label L10n::t('Hide contacts and friends:'), //Label
!!$r[0]['hide-friends'], //Value !!$r[0]['hide-friends'], //Value
'', //Help string '', //Help string
[t('No'), t('Yes')] //Off - On strings [L10n::t('No'), L10n::t('Yes')] //Off - On strings
], ],
'$desc' => t('Hide your contact/friend list from viewers of this profile?'), '$desc' => L10n::t('Hide your contact/friend list from viewers of this profile?'),
'$yes_str' => t('Yes'), '$yes_str' => L10n::t('Yes'),
'$no_str' => t('No'), '$no_str' => L10n::t('No'),
'$yes_selected' => (($r[0]['hide-friends']) ? " checked=\"checked\" " : ""), '$yes_selected' => (($r[0]['hide-friends']) ? " checked=\"checked\" " : ""),
'$no_selected' => (($r[0]['hide-friends'] == 0) ? " checked=\"checked\" " : "") '$no_selected' => (($r[0]['hide-friends'] == 0) ? " checked=\"checked\" " : "")
]); ]);
@ -662,10 +663,10 @@ function profiles_content(App $a) {
'$details' => [ '$details' => [
'detailled_profile', //Name 'detailled_profile', //Name
t('Show more profile fields:'), //Label L10n::t('Show more profile fields:'), //Label
$detailled_profile, //Value $detailled_profile, //Value
'', //Help string '', //Help string
[t('No'), t('Yes')] //Off - On strings [L10n::t('No'), L10n::t('Yes')] //Off - On strings
], ],
'$multi_profiles' => Feature::isEnabled(local_user(), 'multi_profiles'), '$multi_profiles' => Feature::isEnabled(local_user(), 'multi_profiles'),
@ -674,73 +675,73 @@ function profiles_content(App $a) {
'$profile_clone_link' => ((Feature::isEnabled(local_user(), 'multi_profiles')) ? 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone") : ""), '$profile_clone_link' => ((Feature::isEnabled(local_user(), 'multi_profiles')) ? 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone") : ""),
'$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"), '$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"),
'$profile_action' => t('Profile Actions'), '$profile_action' => L10n::t('Profile Actions'),
'$banner' => t('Edit Profile Details'), '$banner' => L10n::t('Edit Profile Details'),
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
'$profpic' => t('Change Profile Photo'), '$profpic' => L10n::t('Change Profile Photo'),
'$viewprof' => t('View this profile'), '$viewprof' => L10n::t('View this profile'),
'$editvis' => t('Edit visibility'), '$editvis' => L10n::t('Edit visibility'),
'$cr_prof' => t('Create a new profile using these settings'), '$cr_prof' => L10n::t('Create a new profile using these settings'),
'$cl_prof' => t('Clone this profile'), '$cl_prof' => L10n::t('Clone this profile'),
'$del_prof' => t('Delete this profile'), '$del_prof' => L10n::t('Delete this profile'),
'$lbl_basic_section' => t('Basic information'), '$lbl_basic_section' => L10n::t('Basic information'),
'$lbl_picture_section' => t('Profile picture'), '$lbl_picture_section' => L10n::t('Profile picture'),
'$lbl_location_section' => t('Location'), '$lbl_location_section' => L10n::t('Location'),
'$lbl_preferences_section' => t('Preferences'), '$lbl_preferences_section' => L10n::t('Preferences'),
'$lbl_status_section' => t('Status information'), '$lbl_status_section' => L10n::t('Status information'),
'$lbl_about_section' => t('Additional information'), '$lbl_about_section' => L10n::t('Additional information'),
'$lbl_interests_section' => t('Interests'), '$lbl_interests_section' => L10n::t('Interests'),
'$lbl_personal_section' => t('Personal'), '$lbl_personal_section' => L10n::t('Personal'),
'$lbl_relation_section' => t('Relation'), '$lbl_relation_section' => L10n::t('Relation'),
'$lbl_miscellaneous_section' => t('Miscellaneous'), '$lbl_miscellaneous_section' => L10n::t('Miscellaneous'),
'$lbl_profile_photo' => t('Upload Profile Photo'), '$lbl_profile_photo' => L10n::t('Upload Profile Photo'),
'$lbl_gender' => t('Your Gender:'), '$lbl_gender' => L10n::t('Your Gender:'),
'$lbl_marital' => t('<span class="heart">&hearts;</span> Marital Status:'), '$lbl_marital' => L10n::t('<span class="heart">&hearts;</span> Marital Status:'),
'$lbl_sexual' => t('Sexual Preference:'), '$lbl_sexual' => L10n::t('Sexual Preference:'),
'$lbl_ex2' => t('Example: fishing photography software'), '$lbl_ex2' => L10n::t('Example: fishing photography software'),
'$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''),
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$profile_id' => $r[0]['id'], '$profile_id' => $r[0]['id'],
'$profile_name' => ['profile_name', t('Profile Name:'), $r[0]['profile-name'], t('Required'), '*'], '$profile_name' => ['profile_name', L10n::t('Profile Name:'), $r[0]['profile-name'], L10n::t('Required'), '*'],
'$is_default' => $is_default, '$is_default' => $is_default,
'$default' => (($is_default) ? '<p id="profile-edit-default-desc">' . t('This is your <strong>public</strong> profile.<br />It <strong>may</strong> be visible to anybody using the internet.') . '</p>' : ""), '$default' => (($is_default) ? '<p id="profile-edit-default-desc">' . L10n::t('This is your <strong>public</strong> profile.<br />It <strong>may</strong> be visible to anybody using the internet.') . '</p>' : ""),
'$name' => ['name', t('Your Full Name:'), $r[0]['name']], '$name' => ['name', L10n::t('Your Full Name:'), $r[0]['name']],
'$pdesc' => ['pdesc', t('Title/Description:'), $r[0]['pdesc']], '$pdesc' => ['pdesc', L10n::t('Title/Description:'), $r[0]['pdesc']],
'$dob' => dob($r[0]['dob']), '$dob' => dob($r[0]['dob']),
'$hide_friends' => $hide_friends, '$hide_friends' => $hide_friends,
'$address' => ['address', t('Street Address:'), $r[0]['address']], '$address' => ['address', L10n::t('Street Address:'), $r[0]['address']],
'$locality' => ['locality', t('Locality/City:'), $r[0]['locality']], '$locality' => ['locality', L10n::t('Locality/City:'), $r[0]['locality']],
'$region' => ['region', t('Region/State:'), $r[0]['region']], '$region' => ['region', L10n::t('Region/State:'), $r[0]['region']],
'$postal_code' => ['postal_code', t('Postal/Zip Code:'), $r[0]['postal-code']], '$postal_code' => ['postal_code', L10n::t('Postal/Zip Code:'), $r[0]['postal-code']],
'$country_name' => ['country_name', t('Country:'), $r[0]['country-name']], '$country_name' => ['country_name', L10n::t('Country:'), $r[0]['country-name']],
'$age' => ((intval($r[0]['dob'])) ? '(' . t('Age: ') . age($r[0]['dob'],$a->user['timezone'],$a->user['timezone']) . ')' : ''), '$age' => ((intval($r[0]['dob'])) ? '(' . L10n::t('Age: ') . age($r[0]['dob'],$a->user['timezone'],$a->user['timezone']) . ')' : ''),
'$gender' => ContactSelector::gender($r[0]['gender']), '$gender' => ContactSelector::gender($r[0]['gender']),
'$marital' => ContactSelector::maritalStatus($r[0]['marital']), '$marital' => ContactSelector::maritalStatus($r[0]['marital']),
'$with' => ['with', t("Who: \x28if applicable\x29"), strip_tags($r[0]['with']), t('Examples: cathy123, Cathy Williams, cathy@example.com')], '$with' => ['with', L10n::t("Who: \x28if applicable\x29"), strip_tags($r[0]['with']), L10n::t('Examples: cathy123, Cathy Williams, cathy@example.com')],
'$howlong' => ['howlong', t('Since [date]:'), ($r[0]['howlong'] <= NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))], '$howlong' => ['howlong', L10n::t('Since [date]:'), ($r[0]['howlong'] <= NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))],
'$sexual' => ContactSelector::sexualPreference($r[0]['sexual']), '$sexual' => ContactSelector::sexualPreference($r[0]['sexual']),
'$about' => ['about', t('Tell us about yourself...'), $r[0]['about']], '$about' => ['about', L10n::t('Tell us about yourself...'), $r[0]['about']],
'$xmpp' => ['xmpp', t('XMPP (Jabber) address:'), $r[0]['xmpp'], t("The XMPP address will be propagated to your contacts so that they can follow you.")], '$xmpp' => ['xmpp', L10n::t('XMPP (Jabber) address:'), $r[0]['xmpp'], L10n::t("The XMPP address will be propagated to your contacts so that they can follow you.")],
'$homepage' => ['homepage', t('Homepage URL:'), $r[0]['homepage']], '$homepage' => ['homepage', L10n::t('Homepage URL:'), $r[0]['homepage']],
'$hometown' => ['hometown', t('Hometown:'), $r[0]['hometown']], '$hometown' => ['hometown', L10n::t('Hometown:'), $r[0]['hometown']],
'$politic' => ['politic', t('Political Views:'), $r[0]['politic']], '$politic' => ['politic', L10n::t('Political Views:'), $r[0]['politic']],
'$religion' => ['religion', t('Religious Views:'), $r[0]['religion']], '$religion' => ['religion', L10n::t('Religious Views:'), $r[0]['religion']],
'$pub_keywords' => ['pub_keywords', t('Public Keywords:'), $r[0]['pub_keywords'], t("\x28Used for suggesting potential friends, can be seen by others\x29")], '$pub_keywords' => ['pub_keywords', L10n::t('Public Keywords:'), $r[0]['pub_keywords'], L10n::t("\x28Used for suggesting potential friends, can be seen by others\x29")],
'$prv_keywords' => ['prv_keywords', t('Private Keywords:'), $r[0]['prv_keywords'], t("\x28Used for searching profiles, never shown to others\x29")], '$prv_keywords' => ['prv_keywords', L10n::t('Private Keywords:'), $r[0]['prv_keywords'], L10n::t("\x28Used for searching profiles, never shown to others\x29")],
'$likes' => ['likes', t('Likes:'), $r[0]['likes']], '$likes' => ['likes', L10n::t('Likes:'), $r[0]['likes']],
'$dislikes' => ['dislikes', t('Dislikes:'), $r[0]['dislikes']], '$dislikes' => ['dislikes', L10n::t('Dislikes:'), $r[0]['dislikes']],
'$music' => ['music', t('Musical interests'), $r[0]['music']], '$music' => ['music', L10n::t('Musical interests'), $r[0]['music']],
'$book' => ['book', t('Books, literature'), $r[0]['book']], '$book' => ['book', L10n::t('Books, literature'), $r[0]['book']],
'$tv' => ['tv', t('Television'), $r[0]['tv']], '$tv' => ['tv', L10n::t('Television'), $r[0]['tv']],
'$film' => ['film', t('Film/dance/culture/entertainment'), $r[0]['film']], '$film' => ['film', L10n::t('Film/dance/culture/entertainment'), $r[0]['film']],
'$interest' => ['interest', t('Hobbies/Interests'), $r[0]['interest']], '$interest' => ['interest', L10n::t('Hobbies/Interests'), $r[0]['interest']],
'$romance' => ['romance', t('Love/romance'), $r[0]['romance']], '$romance' => ['romance', L10n::t('Love/romance'), $r[0]['romance']],
'$work' => ['work', t('Work/employment'), $r[0]['work']], '$work' => ['work', L10n::t('Work/employment'), $r[0]['work']],
'$education' => ['education', t('School/education'), $r[0]['education']], '$education' => ['education', L10n::t('School/education'), $r[0]['education']],
'$contact' => ['contact', t('Contact information and Social Networks'), $r[0]['contact']], '$contact' => ['contact', L10n::t('Contact information and Social Networks'), $r[0]['contact']],
]); ]);
$arr = ['profile' => $r[0], 'entry' => $o]; $arr = ['profile' => $r[0], 'entry' => $o];
@ -771,18 +772,18 @@ function profiles_content(App $a) {
$profiles .= replace_macros($tpl, [ $profiles .= replace_macros($tpl, [
'$photo' => $a->remove_baseurl($rr['thumb']), '$photo' => $a->remove_baseurl($rr['thumb']),
'$id' => $rr['id'], '$id' => $rr['id'],
'$alt' => t('Profile Image'), '$alt' => L10n::t('Profile Image'),
'$profile_name' => $rr['profile-name'], '$profile_name' => $rr['profile-name'],
'$visible' => (($rr['is-default']) ? '<strong>' . t('visible to everybody') . '</strong>' '$visible' => (($rr['is-default']) ? '<strong>' . L10n::t('visible to everybody') . '</strong>'
: '<a href="'.'profperm/'.$rr['id'].'" />' . t('Edit visibility') . '</a>') : '<a href="'.'profperm/'.$rr['id'].'" />' . L10n::t('Edit visibility') . '</a>')
]); ]);
} }
$tpl_header = get_markup_template('profile_listing_header.tpl'); $tpl_header = get_markup_template('profile_listing_header.tpl');
$o .= replace_macros($tpl_header,[ $o .= replace_macros($tpl_header,[
'$header' => t('Edit/Manage Profiles'), '$header' => L10n::t('Edit/Manage Profiles'),
'$chg_photo' => t('Change profile photo'), '$chg_photo' => L10n::t('Change profile photo'),
'$cr_new' => t('Create New Profile'), '$cr_new' => L10n::t('Create New Profile'),
'$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new"), '$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new"),
'$profiles' => $profiles '$profiles' => $profiles
]); ]);

View file

@ -4,6 +4,7 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Profile; use Friendica\Model\Profile;
@ -24,13 +25,13 @@ function profperm_init(App $a)
function profperm_content(App $a) { function profperm_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied') . EOL); notice(L10n::t('Permission denied') . EOL);
return; return;
} }
if($a->argc < 2) { if($a->argc < 2) {
notice( t('Invalid profile identifier.') . EOL ); notice(L10n::t('Invalid profile identifier.') . EOL );
return; return;
} }
@ -59,7 +60,7 @@ function profperm_content(App $a) {
intval(local_user()) intval(local_user())
); );
if (! DBM::is_result($r)) { if (! DBM::is_result($r)) {
notice( t('Invalid profile identifier.') . EOL ); notice(L10n::t('Invalid profile identifier.') . EOL );
return; return;
} }
$profile = $r[0]; $profile = $r[0];
@ -105,11 +106,11 @@ function profperm_content(App $a) {
$ingroup[] = $member['id']; $ingroup[] = $member['id'];
} }
$o .= '<h2>' . t('Profile Visibility Editor') . '</h2>'; $o .= '<h2>' . L10n::t('Profile Visibility Editor') . '</h2>';
$o .= '<h3>' . t('Profile') . ' \'' . $profile['profile-name'] . '\'</h3>'; $o .= '<h3>' . L10n::t('Profile') . ' \'' . $profile['profile-name'] . '\'</h3>';
$o .= '<div id="prof-edit-desc">' . t('Click on a contact to add or remove.') . '</div>'; $o .= '<div id="prof-edit-desc">' . L10n::t('Click on a contact to add or remove.') . '</div>';
} }
@ -118,7 +119,7 @@ function profperm_content(App $a) {
$o = ''; $o = '';
$o .= '<div id="prof-members-title">'; $o .= '<div id="prof-members-title">';
$o .= '<h3>' . t('Visible To') . '</h3>'; $o .= '<h3>' . L10n::t('Visible To') . '</h3>';
$o .= '</div>'; $o .= '</div>';
$o .= '<div id="prof-members">'; $o .= '<div id="prof-members">';
@ -134,7 +135,7 @@ function profperm_content(App $a) {
$o .= '<hr id="prof-separator" />'; $o .= '<hr id="prof-separator" />';
$o .= '<div id="prof-all-contcts-title">'; $o .= '<div id="prof-all-contcts-title">';
$o .= '<h3>' . t("All Contacts \x28with secure profile access\x29") . '</h3>'; $o .= '<h3>' . L10n::t("All Contacts \x28with secure profile access\x29") . '</h3>';
$o .= '</div>'; $o .= '</div>';
$o .= '<div id="prof-all-contacts">'; $o .= '<div id="prof-all-contacts">';

View file

@ -1,8 +1,11 @@
<?php <?php
/**
* @file mod/register.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
@ -45,7 +48,7 @@ function register_post(App $a)
default: default:
case REGISTER_CLOSED: case REGISTER_CLOSED:
if ((!x($_SESSION, 'authenticated') && (!x($_SESSION, 'administrator')))) { if ((!x($_SESSION, 'authenticated') && (!x($_SESSION, 'administrator')))) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
$blocked = 1; $blocked = 1;
@ -58,7 +61,7 @@ function register_post(App $a)
$arr['blocked'] = $blocked; $arr['blocked'] = $blocked;
$arr['verified'] = $verified; $arr['verified'] = $verified;
$arr['language'] = get_browser_language(); $arr['language'] = L10n::getBrowserLanguage();
try { try {
$result = User::create($arr); $result = User::create($arr);
@ -90,23 +93,23 @@ function register_post(App $a)
$user['email'], $a->config['sitename'], System::baseUrl(), $user['username'], $result['password']); $user['email'], $a->config['sitename'], System::baseUrl(), $user['username'], $result['password']);
if ($res) { if ($res) {
info(t('Registration successful. Please check your email for further instructions.') . EOL); info(L10n::t('Registration successful. Please check your email for further instructions.') . EOL);
goaway(System::baseUrl()); goaway(System::baseUrl());
} else { } else {
notice( notice(
t('Failed to send email message. Here your accout details:<br> login: %s<br> password: %s<br><br>You can change your password after login.', L10n::t('Failed to send email message. Here your accout details:<br> login: %s<br> password: %s<br><br>You can change your password after login.',
$user['email'], $user['email'],
$result['password']) $result['password'])
. EOL . EOL
); );
} }
} else { } else {
info(t('Registration successful.') . EOL); info(L10n::t('Registration successful.') . EOL);
goaway(System::baseUrl()); goaway(System::baseUrl());
} }
} elseif ($a->config['register_policy'] == REGISTER_APPROVE) { } elseif ($a->config['register_policy'] == REGISTER_APPROVE) {
if (!strlen($a->config['admin_email'])) { if (!strlen($a->config['admin_email'])) {
notice(t('Your registration can not be processed.') . EOL); notice(L10n::t('Your registration can not be processed.') . EOL);
goaway(System::baseUrl()); goaway(System::baseUrl());
} }
@ -153,7 +156,7 @@ function register_post(App $a)
User::sendRegisterPendingEmail( User::sendRegisterPendingEmail(
$user['email'], $a->config['sitename'], $user['username']); $user['email'], $a->config['sitename'], $user['username']);
info(t('Your registration is pending approval by the site owner.') . EOL); info(L10n::t('Your registration is pending approval by the site owner.') . EOL);
goaway(System::baseUrl()); goaway(System::baseUrl());
} }
@ -182,7 +185,7 @@ function register_content(App $a)
$r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day"); $r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day");
if ($r && $r[0]['total'] >= $max_dailies) { if ($r && $r[0]['total'] >= $max_dailies) {
logger('max daily registrations exceeded.'); logger('max daily registrations exceeded.');
notice(t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL); notice(L10n::t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);
return; return;
} }
} }
@ -211,13 +214,13 @@ function register_content(App $a)
$oidlabel = ''; $oidlabel = '';
} else { } else {
$oidhtml = '<label for="register-openid" id="label-register-openid" >$oidlabel</label><input type="text" maxlength="60" size="32" name="openid_url" class="openid" id="register-openid" value="$openid" >'; $oidhtml = '<label for="register-openid" id="label-register-openid" >$oidlabel</label><input type="text" maxlength="60" size="32" name="openid_url" class="openid" id="register-openid" value="$openid" >';
$fillwith = t("You may \x28optionally\x29 fill in this form via OpenID by supplying your OpenID and clicking 'Register'."); $fillwith = L10n::t("You may \x28optionally\x29 fill in this form via OpenID by supplying your OpenID and clicking 'Register'.");
$fillext = t('If you are not familiar with OpenID, please leave that field blank and fill in the rest of the items.'); $fillext = L10n::t('If you are not familiar with OpenID, please leave that field blank and fill in the rest of the items.');
$oidlabel = t("Your OpenID \x28optional\x29: "); $oidlabel = L10n::t("Your OpenID \x28optional\x29: ");
} }
// I set this and got even more fake names than before... // I set this and got even more fake names than before...
$realpeople = ''; // t('Members of this network prefer to communicate with real people who use their real names.'); $realpeople = ''; // L10n::t('Members of this network prefer to communicate with real people who use their real names.');
if (Config::get('system', 'publish_all')) { if (Config::get('system', 'publish_all')) {
$profile_publish = '<input type="hidden" name="profile_publish_reg" value="1" />'; $profile_publish = '<input type="hidden" name="profile_publish_reg" value="1" />';
@ -225,11 +228,11 @@ function register_content(App $a)
$publish_tpl = get_markup_template("profile_publish.tpl"); $publish_tpl = get_markup_template("profile_publish.tpl");
$profile_publish = replace_macros($publish_tpl, [ $profile_publish = replace_macros($publish_tpl, [
'$instance' => 'reg', '$instance' => 'reg',
'$pubdesc' => t('Include your profile in member directory?'), '$pubdesc' => L10n::t('Include your profile in member directory?'),
'$yes_selected' => ' checked="checked" ', '$yes_selected' => ' checked="checked" ',
'$no_selected' => '', '$no_selected' => '',
'$str_yes' => t('Yes'), '$str_yes' => L10n::t('Yes'),
'$str_no' => t('No'), '$str_no' => L10n::t('No'),
]); ]);
} }
@ -250,34 +253,34 @@ function register_content(App $a)
'$oidhtml' => $oidhtml, '$oidhtml' => $oidhtml,
'$invitations' => Config::get('system', 'invitation_only'), '$invitations' => Config::get('system', 'invitation_only'),
'$permonly' => $a->config['register_policy'] == REGISTER_APPROVE, '$permonly' => $a->config['register_policy'] == REGISTER_APPROVE,
'$permonlybox' => ['permonlybox', t('Note for the admin'), '', t('Leave a message for the admin, why you want to join this node')], '$permonlybox' => ['permonlybox', L10n::t('Note for the admin'), '', L10n::t('Leave a message for the admin, why you want to join this node')],
'$invite_desc' => t('Membership on this site is by invitation only.'), '$invite_desc' => L10n::t('Membership on this site is by invitation only.'),
'$invite_label' => t('Your invitation ID: '), '$invite_label' => L10n::t('Your invitation ID: '),
'$invite_id' => $invite_id, '$invite_id' => $invite_id,
'$realpeople' => $realpeople, '$realpeople' => $realpeople,
'$regtitle' => t('Registration'), '$regtitle' => L10n::t('Registration'),
'$registertext' => x($a->config, 'register_text') ? bbcode($a->config['register_text']) : "", '$registertext' => x($a->config, 'register_text') ? bbcode($a->config['register_text']) : "",
'$fillwith' => $fillwith, '$fillwith' => $fillwith,
'$fillext' => $fillext, '$fillext' => $fillext,
'$oidlabel' => $oidlabel, '$oidlabel' => $oidlabel,
'$openid' => $openid_url, '$openid' => $openid_url,
'$namelabel' => t('Your Full Name ' . "\x28" . 'e.g. Joe Smith, real or real-looking' . "\x29" . ': '), '$namelabel' => L10n::t('Your Full Name ' . "\x28" . 'e.g. Joe Smith, real or real-looking' . "\x29" . ': '),
'$addrlabel' => t('Your Email Address: (Initial information will be send there, so this has to be an existing address.)'), '$addrlabel' => L10n::t('Your Email Address: (Initial information will be send there, so this has to be an existing address.)'),
'$passwords' => $passwords, '$passwords' => $passwords,
'$password1' => ['password1', t('New Password:'), '', t('Leave empty for an auto generated password.')], '$password1' => ['password1', L10n::t('New Password:'), '', L10n::t('Leave empty for an auto generated password.')],
'$password2' => ['confirm', t('Confirm:'), '', ''], '$password2' => ['confirm', L10n::t('Confirm:'), '', ''],
'$nickdesc' => t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be \'<strong>nickname@%s</strong>\'.', $a->get_hostname()), '$nickdesc' => L10n::t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be \'<strong>nickname@%s</strong>\'.', $a->get_hostname()),
'$nicklabel' => t('Choose a nickname: '), '$nicklabel' => L10n::t('Choose a nickname: '),
'$photo' => $photo, '$photo' => $photo,
'$publish' => $profile_publish, '$publish' => $profile_publish,
'$regbutt' => t('Register'), '$regbutt' => L10n::t('Register'),
'$username' => $username, '$username' => $username,
'$email' => $email, '$email' => $email,
'$nickname' => $nickname, '$nickname' => $nickname,
'$license' => $license, '$license' => $license,
'$sitename' => $a->get_hostname(), '$sitename' => $a->get_hostname(),
'$importh' => t('Import'), '$importh' => L10n::t('Import'),
'$importt' => t('Import your profile to this friendica instance'), '$importt' => L10n::t('Import your profile to this friendica instance'),
'$form_security_token' => get_form_security_token("register") '$form_security_token' => get_form_security_token("register")
]); ]);
return $o; return $o;

View file

@ -1,7 +1,10 @@
<?php <?php
/**
* @file mod/regmod.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -50,7 +53,7 @@ function user_allow($hash)
} }
} }
push_lang($register[0]['language']); L10n::pushLang($register[0]['language']);
User::sendRegisterOpenEmail( User::sendRegisterOpenEmail(
$user[0]['email'], $user[0]['email'],
@ -59,10 +62,10 @@ function user_allow($hash)
$user[0]['username'], $user[0]['username'],
$register[0]['password']); $register[0]['password']);
pop_lang(); L10n::popLang();
if ($res) { if ($res) {
info(t('Account approved.') . EOL); info(L10n::t('Account approved.') . EOL);
return true; return true;
} }
} }
@ -87,7 +90,7 @@ function user_deny($hash)
dba::delete('user', ['uid' => $register[0]['uid']]); dba::delete('user', ['uid' => $register[0]['uid']]);
dba::delete('register', ['hash' => $register[0]['hash']]); dba::delete('register', ['hash' => $register[0]['hash']]);
notice(sprintf(t('Registration revoked for %s'), $user[0]['username']) . EOL); notice(L10n::t('Registration revoked for %s', $user[0]['username']) . EOL);
return true; return true;
} }
@ -96,13 +99,13 @@ function regmod_content(App $a)
global $lang; global $lang;
if (!local_user()) { if (!local_user()) {
info(t('Please login.') . EOL); info(L10n::t('Please login.') . EOL);
$o .= '<br /><br />' . Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1); $o .= '<br /><br />' . Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1);
return $o; return $o;
} }
if ((!is_site_admin()) || (x($_SESSION, 'submanage') && intval($_SESSION['submanage']))) { if ((!is_site_admin()) || (x($_SESSION, 'submanage') && intval($_SESSION['submanage']))) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return ''; return '';
} }

View file

@ -1,6 +1,9 @@
<?php <?php
/**
* @file mod/removeme.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Model\User; use Friendica\Model\User;
@ -49,10 +52,10 @@ function removeme_content(App $a)
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$basedir' => System::baseUrl(), '$basedir' => System::baseUrl(),
'$hash' => $hash, '$hash' => $hash,
'$title' => t('Remove My Account'), '$title' => L10n::t('Remove My Account'),
'$desc' => t('This will completely remove your account. Once this has been done it is not recoverable.'), '$desc' => L10n::t('This will completely remove your account. Once this has been done it is not recoverable.'),
'$passwd' => t('Please enter your password for verification:'), '$passwd' => L10n::t('Please enter your password for verification:'),
'$submit' => t('Remove My Account') '$submit' => L10n::t('Remove My Account')
]); ]);
return $o; return $o;

View file

@ -3,18 +3,19 @@
* @file mod/repair_ostatus.php * @file mod/repair_ostatus.php
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Model\Contact; use Friendica\Model\Contact;
function repair_ostatus_content(App $a) { function repair_ostatus_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
goaway($_SESSION['return_url']); goaway($_SESSION['return_url']);
// NOTREACHED // NOTREACHED
} }
$o = "<h2>".t("Resubscribing to OStatus contacts")."</h2>"; $o = "<h2>".L10n::t("Resubscribing to OStatus contacts")."</h2>";
$uid = local_user(); $uid = local_user();
@ -30,7 +31,7 @@ function repair_ostatus_content(App $a) {
intval(CONTACT_IS_SHARING)); intval(CONTACT_IS_SHARING));
if (!$r) if (!$r)
return($o.t("Error")); return($o.L10n::t("Error"));
$total = $r[0]["total"]; $total = $r[0]["total"];
@ -44,15 +45,15 @@ function repair_ostatus_content(App $a) {
intval(CONTACT_IS_SHARING), $counter++); intval(CONTACT_IS_SHARING), $counter++);
if (!$r) { if (!$r) {
$o .= t("Done"); $o .= L10n::t("Done");
return $o; return $o;
} }
$o .= "<p>".$counter."/".$total.": ".$r[0]["url"]."</p>"; $o .= "<p>".$counter."/".$total.": ".$r[0]["url"]."</p>";
$o .= "<p>".t("Keep this window open until done.")."</p>"; $o .= "<p>".L10n::t("Keep this window open until done.")."</p>";
$result = Contact::createFromProbe($uid,$r[0]["url"],true); $result = Contact::createFromProbe($uid, $r[0]["url"], true);
$a->page['htmlhead'] = '<meta http-equiv="refresh" content="1; URL='.System::baseUrl().'/repair_ostatus?counter='.$counter.'">'; $a->page['htmlhead'] = '<meta http-equiv="refresh" content="1; URL='.System::baseUrl().'/repair_ostatus?counter='.$counter.'">';

View file

@ -7,6 +7,7 @@ use Friendica\Content\Feature;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\Cache; use Friendica\Core\Cache;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Database\DBM; use Friendica\Database\DBM;
require_once "include/bbcode.php"; require_once "include/bbcode.php";
@ -32,7 +33,7 @@ function search_saved_searches() {
'id' => $rr['id'], 'id' => $rr['id'],
'term' => $rr['term'], 'term' => $rr['term'],
'encodedterm' => urlencode($rr['term']), 'encodedterm' => urlencode($rr['term']),
'delete' => t('Remove term'), 'delete' => L10n::t('Remove term'),
'selected' => ($search==$rr['term']), 'selected' => ($search==$rr['term']),
]; ];
} }
@ -41,7 +42,7 @@ function search_saved_searches() {
$tpl = get_markup_template("saved_searches_aside.tpl"); $tpl = get_markup_template("saved_searches_aside.tpl");
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$title' => t('Saved Searches'), '$title' => L10n::t('Saved Searches'),
'$add' => '', '$add' => '',
'$searchbox' => '', '$searchbox' => '',
'$saved' => $saved, '$saved' => $saved,
@ -93,16 +94,16 @@ function search_post(App $a) {
function search_content(App $a) { function search_content(App $a) {
if (Config::get('system','block_public') && !local_user() && !remote_user()) { if (Config::get('system','block_public') && !local_user() && !remote_user()) {
notice(t('Public access denied.') . EOL); notice(L10n::t('Public access denied.') . EOL);
return; return;
} }
if (Config::get('system','local_search') && !local_user() && !remote_user()) { if (Config::get('system','local_search') && !local_user() && !remote_user()) {
http_status_exit(403, http_status_exit(403,
["title" => t("Public access denied."), ["title" => L10n::t("Public access denied."),
"description" => t("Only logged in users are permitted to perform a search.")]); "description" => L10n::t("Only logged in users are permitted to perform a search.")]);
killme(); killme();
//notice(t('Public access denied.').EOL); //notice(L10n::t('Public access denied.').EOL);
//return; //return;
} }
@ -124,8 +125,8 @@ function search_content(App $a) {
$resultdata = json_decode($result); $resultdata = json_decode($result);
if (($resultdata->time > (time() - $crawl_permit_period)) && ($resultdata->accesses > $free_crawls)) { if (($resultdata->time > (time() - $crawl_permit_period)) && ($resultdata->accesses > $free_crawls)) {
http_status_exit(429, http_status_exit(429,
["title" => t("Too Many Requests"), ["title" => L10n::t("Too Many Requests"),
"description" => t("Only one search per minute is permitted for not logged in users.")]); "description" => L10n::t("Only one search per minute is permitted for not logged in users.")]);
killme(); killme();
} }
Cache::set("remote_search:".$remote, json_encode(["time" => time(), "accesses" => $resultdata->accesses + 1]), CACHE_HOUR); Cache::set("remote_search:".$remote, json_encode(["time" => time(), "accesses" => $resultdata->accesses + 1]), CACHE_HOUR);
@ -150,7 +151,7 @@ function search_content(App $a) {
// contruct a wrapper for the search header // contruct a wrapper for the search header
$o .= replace_macros(get_markup_template("content_wrapper.tpl"),[ $o .= replace_macros(get_markup_template("content_wrapper.tpl"),[
'name' => "search-header", 'name' => "search-header",
'$title' => t("Search"), '$title' => L10n::t("Search"),
'$title_size' => 3, '$title_size' => 3,
'$content' => search($search,'search-box','search',((local_user()) ? true : false), false) '$content' => search($search,'search-box','search',((local_user()) ? true : false), false)
]); ]);
@ -220,15 +221,16 @@ function search_content(App $a) {
} }
if (! DBM::is_result($r)) { if (! DBM::is_result($r)) {
info( t('No results.') . EOL); info(L10n::t('No results.') . EOL);
return $o; return $o;
} }
if ($tag) if ($tag) {
$title = sprintf( t('Items tagged with: %s'), $search); $title = L10n::t('Items tagged with: %s', $search);
else } else {
$title = sprintf( t('Results for: %s'), $search); $title = L10n::t('Results for: %s', $search);
}
$o .= replace_macros(get_markup_template("section_title.tpl"),[ $o .= replace_macros(get_markup_template("section_title.tpl"),[
'$title' => $title '$title' => $title

View file

@ -8,6 +8,7 @@ use Friendica\Content\Feature;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
@ -34,20 +35,20 @@ function get_theme_config_file($theme)
function settings_init(App $a) function settings_init(App $a)
{ {
if (!local_user()) { if (!local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
// These lines provide the javascript needed by the acl selector // These lines provide the javascript needed by the acl selector
$tpl = get_markup_template('settings/head.tpl'); $tpl = get_markup_template('settings/head.tpl');
$a->page['htmlhead'] .= replace_macros($tpl,[ $a->page['htmlhead'] .= replace_macros($tpl, [
'$ispublic' => t('everybody') '$ispublic' => L10n::t('everybody')
]); ]);
$tabs = [ $tabs = [
[ [
'label' => t('Account'), 'label' => L10n::t('Account'),
'url' => 'settings', 'url' => 'settings',
'selected' => (($a->argc == 1) && ($a->argv[0] === 'settings')?'active':''), 'selected' => (($a->argc == 1) && ($a->argv[0] === 'settings')?'active':''),
'accesskey' => 'o', 'accesskey' => 'o',
@ -56,7 +57,7 @@ function settings_init(App $a)
if (Feature::get()) { if (Feature::get()) {
$tabs[] = [ $tabs[] = [
'label' => t('Additional features'), 'label' => L10n::t('Additional features'),
'url' => 'settings/features', 'url' => 'settings/features',
'selected' => (($a->argc > 1) && ($a->argv[1] === 'features') ? 'active' : ''), 'selected' => (($a->argc > 1) && ($a->argv[1] === 'features') ? 'active' : ''),
'accesskey' => 't', 'accesskey' => 't',
@ -64,49 +65,49 @@ function settings_init(App $a)
} }
$tabs[] = [ $tabs[] = [
'label' => t('Display'), 'label' => L10n::t('Display'),
'url' => 'settings/display', 'url' => 'settings/display',
'selected' => (($a->argc > 1) && ($a->argv[1] === 'display')?'active':''), 'selected' => (($a->argc > 1) && ($a->argv[1] === 'display')?'active':''),
'accesskey' => 'i', 'accesskey' => 'i',
]; ];
$tabs[] = [ $tabs[] = [
'label' => t('Social Networks'), 'label' => L10n::t('Social Networks'),
'url' => 'settings/connectors', 'url' => 'settings/connectors',
'selected' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''), 'selected' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''),
'accesskey' => 'w', 'accesskey' => 'w',
]; ];
$tabs[] = [ $tabs[] = [
'label' => t('Addons'), 'label' => L10n::t('Addons'),
'url' => 'settings/addon', 'url' => 'settings/addon',
'selected' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''), 'selected' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''),
'accesskey' => 'l', 'accesskey' => 'l',
]; ];
$tabs[] = [ $tabs[] = [
'label' => t('Delegations'), 'label' => L10n::t('Delegations'),
'url' => 'delegate', 'url' => 'delegate',
'selected' => (($a->argc == 1) && ($a->argv[0] === 'delegate')?'active':''), 'selected' => (($a->argc == 1) && ($a->argv[0] === 'delegate')?'active':''),
'accesskey' => 'd', 'accesskey' => 'd',
]; ];
$tabs[] = [ $tabs[] = [
'label' => t('Connected apps'), 'label' => L10n::t('Connected apps'),
'url' => 'settings/oauth', 'url' => 'settings/oauth',
'selected' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''), 'selected' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''),
'accesskey' => 'b', 'accesskey' => 'b',
]; ];
$tabs[] = [ $tabs[] = [
'label' => t('Export personal data'), 'label' => L10n::t('Export personal data'),
'url' => 'uexport', 'url' => 'uexport',
'selected' => (($a->argc == 1) && ($a->argv[0] === 'uexport')?'active':''), 'selected' => (($a->argc == 1) && ($a->argv[0] === 'uexport')?'active':''),
'accesskey' => 'e', 'accesskey' => 'e',
]; ];
$tabs[] = [ $tabs[] = [
'label' => t('Remove account'), 'label' => L10n::t('Remove account'),
'url' => 'removeme', 'url' => 'removeme',
'selected' => (($a->argc == 1) && ($a->argv[0] === 'removeme')?'active':''), 'selected' => (($a->argc == 1) && ($a->argv[0] === 'removeme')?'active':''),
'accesskey' => 'r', 'accesskey' => 'r',
@ -115,7 +116,7 @@ function settings_init(App $a)
$tabtpl = get_markup_template("generic_links_widget.tpl"); $tabtpl = get_markup_template("generic_links_widget.tpl");
$a->page['aside'] = replace_macros($tabtpl, [ $a->page['aside'] = replace_macros($tabtpl, [
'$title' => t('Settings'), '$title' => L10n::t('Settings'),
'$class' => 'settings-widget', '$class' => 'settings-widget',
'$items' => $tabs, '$items' => $tabs,
]); ]);
@ -133,7 +134,7 @@ function settings_post(App $a)
} }
if (count($a->user) && x($a->user, 'uid') && $a->user['uid'] != local_user()) { if (count($a->user) && x($a->user, 'uid') && $a->user['uid'] != local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -160,9 +161,9 @@ function settings_post(App $a)
$icon = defaults($_POST, 'icon' , ''); $icon = defaults($_POST, 'icon' , '');
if ($name == "" || $key == "" || $secret == "") { if ($name == "" || $key == "" || $secret == "") {
notice(t("Missing some important data!")); notice(L10n::t("Missing some important data!"));
} else { } else {
if ($_POST['submit']==t("Update")) { if ($_POST['submit'] == L10n::t("Update")) {
q("UPDATE clients SET q("UPDATE clients SET
client_id='%s', client_id='%s',
pw='%s', pw='%s',
@ -271,12 +272,12 @@ function settings_post(App $a)
unset($dcrpass); unset($dcrpass);
if (!$mbox) { if (!$mbox) {
$failed = true; $failed = true;
notice(t('Failed to connect with email account using the settings provided.') . EOL); notice(L10n::t('Failed to connect with email account using the settings provided.') . EOL);
} }
} }
} }
if (!$failed) { if (!$failed) {
info(t('Email settings updated.') . EOL); info(L10n::t('Email settings updated.') . EOL);
} }
} }
} }
@ -292,7 +293,7 @@ function settings_post(App $a)
PConfig::set(local_user(), 'feature', substr($k, 8), ((intval($v)) ? 1 : 0)); PConfig::set(local_user(), 'feature', substr($k, 8), ((intval($v)) ? 1 : 0));
} }
} }
info(t('Features updated') . EOL); info(L10n::t('Features updated') . EOL);
return; return;
} }
@ -364,7 +365,7 @@ function settings_post(App $a)
if (x($_POST,'resend_relocate')) { if (x($_POST,'resend_relocate')) {
Worker::add(PRIORITY_HIGH, 'Notifier', 'relocate', local_user()); Worker::add(PRIORITY_HIGH, 'Notifier', 'relocate', local_user());
info(t("Relocate message has been send to your contacts")); info(L10n::t("Relocate message has been send to your contacts"));
goaway('settings'); goaway('settings');
} }
@ -376,27 +377,27 @@ function settings_post(App $a)
$err = false; $err = false;
if ($newpass != $confirm) { if ($newpass != $confirm) {
notice(t('Passwords do not match. Password unchanged.') . EOL); notice(L10n::t('Passwords do not match. Password unchanged.') . EOL);
$err = true; $err = true;
} }
if (!x($newpass) || !x($confirm)) { if (!x($newpass) || !x($confirm)) {
notice(t('Empty passwords are not allowed. Password unchanged.') . EOL); notice(L10n::t('Empty passwords are not allowed. Password unchanged.') . EOL);
$err = true; $err = true;
} }
// check if the old password was supplied correctly before changing it to the new value // check if the old password was supplied correctly before changing it to the new value
if (!User::authenticate(intval(local_user()), $_POST['opassword'])) { if (!User::authenticate(intval(local_user()), $_POST['opassword'])) {
notice(t('Wrong password.') . EOL); notice(L10n::t('Wrong password.') . EOL);
$err = true; $err = true;
} }
if (!$err) { if (!$err) {
$result = User::updatePassword(local_user(), $newpass); $result = User::updatePassword(local_user(), $newpass);
if (DBM::is_result($result)) { if (DBM::is_result($result)) {
info(t('Password changed.') . EOL); info(L10n::t('Password changed.') . EOL);
} else { } else {
notice(t('Password update failed. Please try again.') . EOL); notice(L10n::t('Password update failed. Please try again.') . EOL);
} }
} }
} }
@ -486,10 +487,10 @@ function settings_post(App $a)
if ($username != $a->user['username']) { if ($username != $a->user['username']) {
$name_change = true; $name_change = true;
if (strlen($username) > 40) { if (strlen($username) > 40) {
$err .= t(' Please use a shorter name.'); $err .= L10n::t(' Please use a shorter name.');
} }
if (strlen($username) < 3) { if (strlen($username) < 3) {
$err .= t(' Name too short.'); $err .= L10n::t(' Name too short.');
} }
} }
@ -497,19 +498,19 @@ function settings_post(App $a)
$email_changed = true; $email_changed = true;
// check for the correct password // check for the correct password
if (!User::authenticate(intval(local_user()), $_POST['mpassword'])) { if (!User::authenticate(intval(local_user()), $_POST['mpassword'])) {
$err .= t('Wrong Password') . EOL; $err .= L10n::t('Wrong Password') . EOL;
$email = $a->user['email']; $email = $a->user['email'];
} }
// check the email is valid // check the email is valid
if (!valid_email($email)) { if (!valid_email($email)) {
$err .= t('Invalid email.'); $err .= L10n::t('Invalid email.');
} }
// ensure new email is not the admin mail // ensure new email is not the admin mail
//if ((x($a->config, 'admin_email')) && (strcasecmp($email, $a->config['admin_email']) == 0)) { //if ((x($a->config, 'admin_email')) && (strcasecmp($email, $a->config['admin_email']) == 0)) {
if (x($a->config, 'admin_email')) { if (x($a->config, 'admin_email')) {
$adminlist = explode(",", str_replace(" ", "", strtolower($a->config['admin_email']))); $adminlist = explode(",", str_replace(" ", "", strtolower($a->config['admin_email'])));
if (in_array(strtolower($email), $adminlist)) { if (in_array(strtolower($email), $adminlist)) {
$err .= t('Cannot change to that email.'); $err .= L10n::t('Cannot change to that email.');
$email = $a->user['email']; $email = $a->user['email'];
} }
} }
@ -563,10 +564,10 @@ function settings_post(App $a)
$hidewall = 1; $hidewall = 1;
if (!$str_contact_allow && !$str_group_allow && !$str_contact_deny && !$str_group_deny) { if (!$str_contact_allow && !$str_group_allow && !$str_contact_deny && !$str_group_deny) {
if ($def_gid) { if ($def_gid) {
info(t('Private forum has no privacy permissions. Using default privacy group.'). EOL); info(L10n::t('Private forum has no privacy permissions. Using default privacy group.'). EOL);
$str_group_allow = '<' . $def_gid . '>'; $str_group_allow = '<' . $def_gid . '>';
} else { } else {
notice(t('Private forum has no privacy permissions and no default privacy group.') . EOL); notice(L10n::t('Private forum has no privacy permissions and no default privacy group.') . EOL);
} }
} }
} }
@ -606,7 +607,7 @@ function settings_post(App $a)
intval(local_user()) intval(local_user())
); );
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
info(t('Settings updated.') . EOL); info(L10n::t('Settings updated.') . EOL);
} }
// clear session language // clear session language
@ -658,12 +659,12 @@ function settings_content(App $a)
Nav::setSelected('settings'); Nav::setSelected('settings');
if (!local_user()) { if (!local_user()) {
//notice(t('Permission denied.') . EOL); //notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) { if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -672,14 +673,14 @@ function settings_content(App $a)
$tpl = get_markup_template('settings/oauth_edit.tpl'); $tpl = get_markup_template('settings/oauth_edit.tpl');
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$form_security_token' => get_form_security_token("settings_oauth"), '$form_security_token' => get_form_security_token("settings_oauth"),
'$title' => t('Add application'), '$title' => L10n::t('Add application'),
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
'$name' => ['name', t('Name'), '', ''], '$name' => ['name', L10n::t('Name'), '', ''],
'$key' => ['key', t('Consumer Key'), '', ''], '$key' => ['key', L10n::t('Consumer Key'), '', ''],
'$secret' => ['secret', t('Consumer Secret'), '', ''], '$secret' => ['secret', L10n::t('Consumer Secret'), '', ''],
'$redirect' => ['redirect', t('Redirect'), '', ''], '$redirect' => ['redirect', L10n::t('Redirect'), '', ''],
'$icon' => ['icon', t('Icon url'), '', ''], '$icon' => ['icon', L10n::t('Icon url'), '', ''],
]); ]);
return $o; return $o;
} }
@ -690,7 +691,7 @@ function settings_content(App $a)
local_user()); local_user());
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
notice(t("You can't edit this application.")); notice(L10n::t("You can't edit this application."));
return; return;
} }
$app = $r[0]; $app = $r[0];
@ -698,14 +699,14 @@ function settings_content(App $a)
$tpl = get_markup_template('settings/oauth_edit.tpl'); $tpl = get_markup_template('settings/oauth_edit.tpl');
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$form_security_token' => get_form_security_token("settings_oauth"), '$form_security_token' => get_form_security_token("settings_oauth"),
'$title' => t('Add application'), '$title' => L10n::t('Add application'),
'$submit' => t('Update'), '$submit' => L10n::t('Update'),
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
'$name' => ['name', t('Name'), $app['name'] , ''], '$name' => ['name', L10n::t('Name'), $app['name'] , ''],
'$key' => ['key', t('Consumer Key'), $app['client_id'], ''], '$key' => ['key', L10n::t('Consumer Key'), $app['client_id'], ''],
'$secret' => ['secret', t('Consumer Secret'), $app['pw'], ''], '$secret' => ['secret', L10n::t('Consumer Secret'), $app['pw'], ''],
'$redirect' => ['redirect', t('Redirect'), $app['redirect_uri'], ''], '$redirect' => ['redirect', L10n::t('Redirect'), $app['redirect_uri'], ''],
'$icon' => ['icon', t('Icon url'), $app['icon'], ''], '$icon' => ['icon', L10n::t('Icon url'), $app['icon'], ''],
]); ]);
return $o; return $o;
} }
@ -733,13 +734,13 @@ function settings_content(App $a)
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$form_security_token' => get_form_security_token("settings_oauth"), '$form_security_token' => get_form_security_token("settings_oauth"),
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$title' => t('Connected Apps'), '$title' => L10n::t('Connected Apps'),
'$add' => t('Add application'), '$add' => L10n::t('Add application'),
'$edit' => t('Edit'), '$edit' => L10n::t('Edit'),
'$delete' => t('Delete'), '$delete' => L10n::t('Delete'),
'$consumerkey' => t('Client key starts with'), '$consumerkey' => L10n::t('Client key starts with'),
'$noname' => t('No name'), '$noname' => L10n::t('No name'),
'$remove' => t('Remove authorization'), '$remove' => L10n::t('Remove authorization'),
'$apps' => $r, '$apps' => $r,
]); ]);
return $o; return $o;
@ -750,7 +751,7 @@ function settings_content(App $a)
$r = q("SELECT * FROM `hook` WHERE `hook` = 'addon_settings' "); $r = q("SELECT * FROM `hook` WHERE `hook` = 'addon_settings' ");
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
$settings_addons = t('No Addon settings configured'); $settings_addons = L10n::t('No Addon settings configured');
} }
Addon::callHooks('addon_settings', $settings_addons); Addon::callHooks('addon_settings', $settings_addons);
@ -759,7 +760,7 @@ function settings_content(App $a)
$tpl = get_markup_template('settings/addons.tpl'); $tpl = get_markup_template('settings/addons.tpl');
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$form_security_token' => get_form_security_token("settings_addon"), '$form_security_token' => get_form_security_token("settings_addon"),
'$title' => t('Addon Settings'), '$title' => L10n::t('Addon Settings'),
'$settings_addons' => $settings_addons '$settings_addons' => $settings_addons
]); ]);
return $o; return $o;
@ -773,16 +774,16 @@ function settings_content(App $a)
$arr[$fname] = []; $arr[$fname] = [];
$arr[$fname][0] = $fdata[0]; $arr[$fname][0] = $fdata[0];
foreach (array_slice($fdata,1) as $f) { foreach (array_slice($fdata,1) as $f) {
$arr[$fname][1][] = ['feature_' .$f[0], $f[1],((intval(Feature::isEnabled(local_user(), $f[0]))) ? "1" : ''), $f[2],[t('Off'), t('On')]]; $arr[$fname][1][] = ['feature_' .$f[0], $f[1],((intval(Feature::isEnabled(local_user(), $f[0]))) ? "1" : ''), $f[2],[L10n::t('Off'), L10n::t('On')]];
} }
} }
$tpl = get_markup_template('settings/features.tpl'); $tpl = get_markup_template('settings/features.tpl');
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$form_security_token' => get_form_security_token("settings_features"), '$form_security_token' => get_form_security_token("settings_features"),
'$title' => t('Additional Features'), '$title' => L10n::t('Additional Features'),
'$features' => $arr, '$features' => $arr,
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
]); ]);
return $o; return $o;
} }
@ -802,8 +803,8 @@ function settings_content(App $a)
Addon::callHooks('connector_settings', $settings_connectors); Addon::callHooks('connector_settings', $settings_connectors);
if (is_site_admin()) { if (is_site_admin()) {
$diasp_enabled = t('Built-in support for %s connectivity is %s', t('Diaspora'), ((Config::get('system', 'diaspora_enabled')) ? t('enabled') : t('disabled'))); $diasp_enabled = L10n::t('Built-in support for %s connectivity is %s', L10n::t('Diaspora'), ((Config::get('system', 'diaspora_enabled')) ? L10n::t('enabled') : L10n::t('disabled')));
$ostat_enabled = t('Built-in support for %s connectivity is %s', t('GNU Social (OStatus)'), ((Config::get('system', 'ostatus_disabled')) ? t('disabled') : t('enabled'))); $ostat_enabled = L10n::t('Built-in support for %s connectivity is %s', L10n::t('GNU Social (OStatus)'), ((Config::get('system', 'ostatus_disabled')) ? L10n::t('disabled') : L10n::t('enabled')));
} else { } else {
$diasp_enabled = ""; $diasp_enabled = "";
$ostat_enabled = ""; $ostat_enabled = "";
@ -834,41 +835,41 @@ function settings_content(App $a)
$tpl = get_markup_template('settings/connectors.tpl'); $tpl = get_markup_template('settings/connectors.tpl');
$mail_disabled_message = (($mail_disabled) ? t('Email access is disabled on this site.') : ''); $mail_disabled_message = (($mail_disabled) ? L10n::t('Email access is disabled on this site.') : '');
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$form_security_token' => get_form_security_token("settings_connectors"), '$form_security_token' => get_form_security_token("settings_connectors"),
'$title' => t('Social Networks'), '$title' => L10n::t('Social Networks'),
'$diasp_enabled' => $diasp_enabled, '$diasp_enabled' => $diasp_enabled,
'$ostat_enabled' => $ostat_enabled, '$ostat_enabled' => $ostat_enabled,
'$general_settings' => t('General Social Media Settings'), '$general_settings' => L10n::t('General Social Media Settings'),
'$no_intelligent_shortening' => ['no_intelligent_shortening', t('Disable intelligent shortening'), $no_intelligent_shortening, t('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.')], '$no_intelligent_shortening' => ['no_intelligent_shortening', L10n::t('Disable intelligent shortening'), $no_intelligent_shortening, L10n::t('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.')],
'$ostatus_autofriend' => ['snautofollow', t('Automatically follow any GNU Social (OStatus) followers/mentioners'), $ostatus_autofriend, t('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.')], '$ostatus_autofriend' => ['snautofollow', L10n::t('Automatically follow any GNU Social (OStatus) followers/mentioners'), $ostatus_autofriend, L10n::t('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.')],
'$default_group' => Group::displayGroupSelection(local_user(), $default_group, t("Default group for OStatus contacts")), '$default_group' => Group::displayGroupSelection(local_user(), $default_group, L10n::t("Default group for OStatus contacts")),
'$legacy_contact' => ['legacy_contact', t('Your legacy GNU Social account'), $legacy_contact, t('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.')], '$legacy_contact' => ['legacy_contact', L10n::t('Your legacy GNU Social account'), $legacy_contact, L10n::t('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.')],
'$repair_ostatus_url' => System::baseUrl() . '/repair_ostatus', '$repair_ostatus_url' => System::baseUrl() . '/repair_ostatus',
'$repair_ostatus_text' => t('Repair OStatus subscriptions'), '$repair_ostatus_text' => L10n::t('Repair OStatus subscriptions'),
'$settings_connectors' => $settings_connectors, '$settings_connectors' => $settings_connectors,
'$h_imap' => t('Email/Mailbox Setup'), '$h_imap' => L10n::t('Email/Mailbox Setup'),
'$imap_desc' => t("If you wish to communicate with email contacts using this service \x28optional\x29, please specify how to connect to your mailbox."), '$imap_desc' => L10n::t("If you wish to communicate with email contacts using this service \x28optional\x29, please specify how to connect to your mailbox."),
'$imap_lastcheck' => ['imap_lastcheck', t('Last successful email check:'), $mail_chk, ''], '$imap_lastcheck' => ['imap_lastcheck', L10n::t('Last successful email check:'), $mail_chk, ''],
'$mail_disabled' => $mail_disabled_message, '$mail_disabled' => $mail_disabled_message,
'$mail_server' => ['mail_server', t('IMAP server name:'), $mail_server, ''], '$mail_server' => ['mail_server', L10n::t('IMAP server name:'), $mail_server, ''],
'$mail_port' => ['mail_port', t('IMAP port:'), $mail_port, ''], '$mail_port' => ['mail_port', L10n::t('IMAP port:'), $mail_port, ''],
'$mail_ssl' => ['mail_ssl', t('Security:'), strtoupper($mail_ssl), '', ['notls'=>t('None'), 'TLS'=>'TLS', 'SSL'=>'SSL']], '$mail_ssl' => ['mail_ssl', L10n::t('Security:'), strtoupper($mail_ssl), '', ['notls'=>L10n::t('None'), 'TLS'=>'TLS', 'SSL'=>'SSL']],
'$mail_user' => ['mail_user', t('Email login name:'), $mail_user, ''], '$mail_user' => ['mail_user', L10n::t('Email login name:'), $mail_user, ''],
'$mail_pass' => ['mail_pass', t('Email password:'), '', ''], '$mail_pass' => ['mail_pass', L10n::t('Email password:'), '', ''],
'$mail_replyto' => ['mail_replyto', t('Reply-to address:'), $mail_replyto, 'Optional'], '$mail_replyto' => ['mail_replyto', L10n::t('Reply-to address:'), $mail_replyto, 'Optional'],
'$mail_pubmail' => ['mail_pubmail', t('Send public posts to all email contacts:'), $mail_pubmail, ''], '$mail_pubmail' => ['mail_pubmail', L10n::t('Send public posts to all email contacts:'), $mail_pubmail, ''],
'$mail_action' => ['mail_action', t('Action after import:'), $mail_action, '', [0=>t('None'), /*1=>t('Delete'),*/ 2=>t('Mark as seen'), 3=>t('Move to folder')]], '$mail_action' => ['mail_action', L10n::t('Action after import:'), $mail_action, '', [0=>L10n::t('None'), /*1=>L10n::t('Delete'),*/ 2=>L10n::t('Mark as seen'), 3=>L10n::t('Move to folder')]],
'$mail_movetofolder' => ['mail_movetofolder', t('Move to folder:'), $mail_movetofolder, ''], '$mail_movetofolder' => ['mail_movetofolder', L10n::t('Move to folder:'), $mail_movetofolder, ''],
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
]); ]);
Addon::callHooks('display_settings', $o); Addon::callHooks('display_settings', $o);
@ -901,7 +902,7 @@ function settings_content(App $a)
$themes = []; $themes = [];
$mobile_themes = ["---" => t('No special theme for mobile devices')]; $mobile_themes = ["---" => L10n::t('No special theme for mobile devices')];
if ($allowed_themes) { if ($allowed_themes) {
foreach ($allowed_themes as $theme) { foreach ($allowed_themes as $theme) {
$is_experimental = file_exists('view/theme/' . $theme . '/experimental'); $is_experimental = file_exists('view/theme/' . $theme . '/experimental');
@ -910,9 +911,9 @@ function settings_content(App $a)
if (!$is_experimental || ($is_experimental && (Config::get('experimentals', 'exp_themes')==1 || is_null(Config::get('experimentals', 'exp_themes'))))) { if (!$is_experimental || ($is_experimental && (Config::get('experimentals', 'exp_themes')==1 || is_null(Config::get('experimentals', 'exp_themes'))))) {
$theme_name = ucfirst($theme); $theme_name = ucfirst($theme);
if ($is_unsupported) { if ($is_unsupported) {
$theme_name = t("%s - (Unsupported)", $theme_name); $theme_name = L10n::t("%s - (Unsupported)", $theme_name);
} elseif ($is_experimental) { } elseif ($is_experimental) {
$theme_name = t("%s - (Experimental)", $theme_name); $theme_name = L10n::t("%s - (Experimental)", $theme_name);
} }
if ($is_mobile) { if ($is_mobile) {
$mobile_themes[$theme] = $theme_name; $mobile_themes[$theme] = $theme_name;
@ -939,7 +940,7 @@ function settings_content(App $a)
$nosmile = PConfig::get(local_user(), 'system', 'no_smilies', 0); $nosmile = PConfig::get(local_user(), 'system', 'no_smilies', 0);
$first_day_of_week = PConfig::get(local_user(), 'system', 'first_day_of_week', 0); $first_day_of_week = PConfig::get(local_user(), 'system', 'first_day_of_week', 0);
$weekdays = [0 => t("Sunday"), 1 => t("Monday")]; $weekdays = [0 => L10n::t("Sunday"), 1 => L10n::t("Monday")];
$noinfo = PConfig::get(local_user(), 'system', 'ignore_info', 0); $noinfo = PConfig::get(local_user(), 'system', 'ignore_info', 0);
$infinite_scroll = PConfig::get(local_user(), 'system', 'infinite_scroll', 0); $infinite_scroll = PConfig::get(local_user(), 'system', 'infinite_scroll', 0);
@ -955,37 +956,37 @@ function settings_content(App $a)
$tpl = get_markup_template('settings/display.tpl'); $tpl = get_markup_template('settings/display.tpl');
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$ptitle' => t('Display Settings'), '$ptitle' => L10n::t('Display Settings'),
'$form_security_token' => get_form_security_token("settings_display"), '$form_security_token' => get_form_security_token("settings_display"),
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$uid' => local_user(), '$uid' => local_user(),
'$theme' => ['theme', t('Display Theme:'), $theme_selected, '', $themes, true], '$theme' => ['theme', L10n::t('Display Theme:'), $theme_selected, '', $themes, true],
'$mobile_theme' => ['mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, false], '$mobile_theme' => ['mobile_theme', L10n::t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, false],
'$nowarn_insecure' => ['nowarn_insecure', t('Suppress warning of insecure networks'), $nowarn_insecure, t("Should the system suppress the warning that the current group contains members of networks that can't receive non public postings.")], '$nowarn_insecure' => ['nowarn_insecure', L10n::t('Suppress warning of insecure networks'), $nowarn_insecure, L10n::t("Should the system suppress the warning that the current group contains members of networks that can't receive non public postings.")],
'$ajaxint' => ['browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds. Enter -1 to disable it.')], '$ajaxint' => ['browser_update', L10n::t("Update browser every xx seconds"), $browser_update, L10n::t('Minimum of 10 seconds. Enter -1 to disable it.')],
'$itemspage_network' => ['itemspage_network', t("Number of items to display per page:"), $itemspage_network, t('Maximum of 100 items')], '$itemspage_network' => ['itemspage_network', L10n::t("Number of items to display per page:"), $itemspage_network, L10n::t('Maximum of 100 items')],
'$itemspage_mobile_network' => ['itemspage_mobile_network', t("Number of items to display per page when viewed from mobile device:"), $itemspage_mobile_network, t('Maximum of 100 items')], '$itemspage_mobile_network' => ['itemspage_mobile_network', L10n::t("Number of items to display per page when viewed from mobile device:"), $itemspage_mobile_network, L10n::t('Maximum of 100 items')],
'$nosmile' => ['nosmile', t("Don't show emoticons"), $nosmile, ''], '$nosmile' => ['nosmile', L10n::t("Don't show emoticons"), $nosmile, ''],
'$calendar_title' => t('Calendar'), '$calendar_title' => L10n::t('Calendar'),
'$first_day_of_week' => ['first_day_of_week', t('Beginning of week:'), $first_day_of_week, '', $weekdays, false], '$first_day_of_week' => ['first_day_of_week', L10n::t('Beginning of week:'), $first_day_of_week, '', $weekdays, false],
'$noinfo' => ['noinfo', t("Don't show notices"), $noinfo, ''], '$noinfo' => ['noinfo', L10n::t("Don't show notices"), $noinfo, ''],
'$infinite_scroll' => ['infinite_scroll', t("Infinite scroll"), $infinite_scroll, ''], '$infinite_scroll' => ['infinite_scroll', L10n::t("Infinite scroll"), $infinite_scroll, ''],
'$no_auto_update' => ['no_auto_update', t("Automatic updates only at the top of the network page"), $no_auto_update, t('When disabled, the network page is updated all the time, which could be confusing while reading.')], '$no_auto_update' => ['no_auto_update', L10n::t("Automatic updates only at the top of the network page"), $no_auto_update, L10n::t('When disabled, the network page is updated all the time, which could be confusing while reading.')],
'$bandwidth_saver' => ['bandwidth_saver', t('Bandwith Saver Mode'), $bandwidth_saver, t('When enabled, embedded content is not displayed on automatic updates, they only show on page reload.')], '$bandwidth_saver' => ['bandwidth_saver', L10n::t('Bandwith Saver Mode'), $bandwidth_saver, L10n::t('When enabled, embedded content is not displayed on automatic updates, they only show on page reload.')],
'$smart_threading' => ['smart_threading', t('Smart Threading'), $smart_threading, t('When enabled, suppress extraneous thread indentation while keeping it where it matters. Only works if threading is available and enabled.')], '$smart_threading' => ['smart_threading', L10n::t('Smart Threading'), $smart_threading, L10n::t('When enabled, suppress extraneous thread indentation while keeping it where it matters. Only works if threading is available and enabled.')],
'$d_tset' => t('General Theme Settings'), '$d_tset' => L10n::t('General Theme Settings'),
'$d_ctset' => t('Custom Theme Settings'), '$d_ctset' => L10n::t('Custom Theme Settings'),
'$d_cset' => t('Content Settings'), '$d_cset' => L10n::t('Content Settings'),
'stitle' => t('Theme settings'), 'stitle' => L10n::t('Theme settings'),
'$theme_config' => $theme_config, '$theme_config' => $theme_config,
]); ]);
$tpl = get_markup_template('settings/display_end.tpl'); $tpl = get_markup_template('settings/display_end.tpl');
$a->page['end'] .= replace_macros($tpl, [ $a->page['end'] .= replace_macros($tpl, [
'$theme' => ['theme', t('Display Theme:'), $theme_selected, '', $themes] '$theme' => ['theme', L10n::t('Display Theme:'), $theme_selected, '', $themes]
]); ]);
return $o; return $o;
@ -1000,7 +1001,7 @@ function settings_content(App $a)
$profile = dba::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]); $profile = dba::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]);
if (!DBM::is_result($profile)) { if (!DBM::is_result($profile)) {
notice(t('Unable to find your profile. Please contact your admin.') . EOL); notice(L10n::t('Unable to find your profile. Please contact your admin.') . EOL);
return; return;
} }
@ -1042,49 +1043,49 @@ function settings_content(App $a)
$pageset_tpl = get_markup_template('settings/pagetypes.tpl'); $pageset_tpl = get_markup_template('settings/pagetypes.tpl');
$pagetype = replace_macros($pageset_tpl, [ $pagetype = replace_macros($pageset_tpl, [
'$account_types' => t("Account Types"), '$account_types' => L10n::t("Account Types"),
'$user' => t("Personal Page Subtypes"), '$user' => L10n::t("Personal Page Subtypes"),
'$community' => t("Community Forum Subtypes"), '$community' => L10n::t("Community Forum Subtypes"),
'$account_type' => $a->user['account-type'], '$account_type' => $a->user['account-type'],
'$type_person' => ACCOUNT_TYPE_PERSON, '$type_person' => ACCOUNT_TYPE_PERSON,
'$type_organisation' => ACCOUNT_TYPE_ORGANISATION, '$type_organisation' => ACCOUNT_TYPE_ORGANISATION,
'$type_news' => ACCOUNT_TYPE_NEWS, '$type_news' => ACCOUNT_TYPE_NEWS,
'$type_community' => ACCOUNT_TYPE_COMMUNITY, '$type_community' => ACCOUNT_TYPE_COMMUNITY,
'$account_person' => ['account-type', t('Personal Page'), ACCOUNT_TYPE_PERSON, '$account_person' => ['account-type', L10n::t('Personal Page'), ACCOUNT_TYPE_PERSON,
t('Account for a personal profile.'), L10n::t('Account for a personal profile.'),
($a->user['account-type'] == ACCOUNT_TYPE_PERSON)], ($a->user['account-type'] == ACCOUNT_TYPE_PERSON)],
'$account_organisation' => ['account-type', t('Organisation Page'), ACCOUNT_TYPE_ORGANISATION, '$account_organisation' => ['account-type', L10n::t('Organisation Page'), ACCOUNT_TYPE_ORGANISATION,
t('Account for an organisation that automatically approves contact requests as "Followers".'), L10n::t('Account for an organisation that automatically approves contact requests as "Followers".'),
($a->user['account-type'] == ACCOUNT_TYPE_ORGANISATION)], ($a->user['account-type'] == ACCOUNT_TYPE_ORGANISATION)],
'$account_news' => ['account-type', t('News Page'), ACCOUNT_TYPE_NEWS, '$account_news' => ['account-type', L10n::t('News Page'), ACCOUNT_TYPE_NEWS,
t('Account for a news reflector that automatically approves contact requests as "Followers".'), L10n::t('Account for a news reflector that automatically approves contact requests as "Followers".'),
($a->user['account-type'] == ACCOUNT_TYPE_NEWS)], ($a->user['account-type'] == ACCOUNT_TYPE_NEWS)],
'$account_community' => ['account-type', t('Community Forum'), ACCOUNT_TYPE_COMMUNITY, '$account_community' => ['account-type', L10n::t('Community Forum'), ACCOUNT_TYPE_COMMUNITY,
t('Account for community discussions.'), L10n::t('Account for community discussions.'),
($a->user['account-type'] == ACCOUNT_TYPE_COMMUNITY)], ($a->user['account-type'] == ACCOUNT_TYPE_COMMUNITY)],
'$page_normal' => ['page-flags', t('Normal Account Page'), PAGE_NORMAL, '$page_normal' => ['page-flags', L10n::t('Normal Account Page'), PAGE_NORMAL,
t('Account for a regular personal profile that requires manual approval of "Friends" and "Followers".'), L10n::t('Account for a regular personal profile that requires manual approval of "Friends" and "Followers".'),
($a->user['page-flags'] == PAGE_NORMAL)], ($a->user['page-flags'] == PAGE_NORMAL)],
'$page_soapbox' => ['page-flags', t('Soapbox Page'), PAGE_SOAPBOX, '$page_soapbox' => ['page-flags', L10n::t('Soapbox Page'), PAGE_SOAPBOX,
t('Account for a public profile that automatically approves contact requests as "Followers".'), L10n::t('Account for a public profile that automatically approves contact requests as "Followers".'),
($a->user['page-flags'] == PAGE_SOAPBOX)], ($a->user['page-flags'] == PAGE_SOAPBOX)],
'$page_community' => ['page-flags', t('Public Forum'), PAGE_COMMUNITY, '$page_community' => ['page-flags', L10n::t('Public Forum'), PAGE_COMMUNITY,
t('Automatically approves all contact requests.'), L10n::t('Automatically approves all contact requests.'),
($a->user['page-flags'] == PAGE_COMMUNITY)], ($a->user['page-flags'] == PAGE_COMMUNITY)],
'$page_freelove' => ['page-flags', t('Automatic Friend Page'), PAGE_FREELOVE, '$page_freelove' => ['page-flags', L10n::t('Automatic Friend Page'), PAGE_FREELOVE,
t('Account for a popular profile that automatically approves contact requests as "Friends".'), L10n::t('Account for a popular profile that automatically approves contact requests as "Friends".'),
($a->user['page-flags'] == PAGE_FREELOVE)], ($a->user['page-flags'] == PAGE_FREELOVE)],
'$page_prvgroup' => ['page-flags', t('Private Forum [Experimental]'), PAGE_PRVGROUP, '$page_prvgroup' => ['page-flags', L10n::t('Private Forum [Experimental]'), PAGE_PRVGROUP,
t('Requires manual approval of contact requests.'), L10n::t('Requires manual approval of contact requests.'),
($a->user['page-flags'] == PAGE_PRVGROUP)], ($a->user['page-flags'] == PAGE_PRVGROUP)],
@ -1095,7 +1096,7 @@ function settings_content(App $a)
if ($noid) { if ($noid) {
$openid_field = false; $openid_field = false;
} else { } else {
$openid_field = ['openid_url', t('OpenID:'), $openid, t("\x28Optional\x29 Allow this OpenID to login to this account."), "", "", "url"]; $openid_field = ['openid_url', L10n::t('OpenID:'), $openid, L10n::t("\x28Optional\x29 Allow this OpenID to login to this account."), "", "", "url"];
} }
$opt_tpl = get_markup_template("field_yesno.tpl"); $opt_tpl = get_markup_template("field_yesno.tpl");
@ -1103,64 +1104,64 @@ function settings_content(App $a)
$profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />'; $profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
} else { } else {
$profile_in_dir = replace_macros($opt_tpl, [ $profile_in_dir = replace_macros($opt_tpl, [
'$field' => ['profile_in_directory', t('Publish your default profile in your local site directory?'), $profile['publish'], t("Your profile may be visible in public."), [t('No'), t('Yes')]] '$field' => ['profile_in_directory', L10n::t('Publish your default profile in your local site directory?'), $profile['publish'], L10n::t("Your profile may be visible in public."), [L10n::t('No'), L10n::t('Yes')]]
]); ]);
} }
if (strlen(Config::get('system', 'directory'))) { if (strlen(Config::get('system', 'directory'))) {
$profile_in_net_dir = replace_macros($opt_tpl, [ $profile_in_net_dir = replace_macros($opt_tpl, [
'$field' => ['profile_in_netdirectory', t('Publish your default profile in the global social directory?'), $profile['net-publish'], '', [t('No'), t('Yes')]] '$field' => ['profile_in_netdirectory', L10n::t('Publish your default profile in the global social directory?'), $profile['net-publish'], '', [L10n::t('No'), L10n::t('Yes')]]
]); ]);
} else { } else {
$profile_in_net_dir = ''; $profile_in_net_dir = '';
} }
$hide_friends = replace_macros($opt_tpl, [ $hide_friends = replace_macros($opt_tpl, [
'$field' => ['hide-friends', t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], '', [t('No'), t('Yes')]], '$field' => ['hide-friends', L10n::t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], '', [L10n::t('No'), L10n::t('Yes')]],
]); ]);
$hide_wall = replace_macros($opt_tpl, [ $hide_wall = replace_macros($opt_tpl, [
'$field' => ['hidewall', t('Hide your profile details from unknown viewers?'), $a->user['hidewall'], t("If enabled, posting public messages to Diaspora and other networks isn't possible."), [t('No'), t('Yes')]], '$field' => ['hidewall', L10n::t('Hide your profile details from unknown viewers?'), $a->user['hidewall'], L10n::t("If enabled, posting public messages to Diaspora and other networks isn't possible."), [L10n::t('No'), L10n::t('Yes')]],
]); ]);
$blockwall = replace_macros($opt_tpl, [ $blockwall = replace_macros($opt_tpl, [
'$field' => ['blockwall', t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), '', [t('No'), t('Yes')]], '$field' => ['blockwall', L10n::t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), '', [L10n::t('No'), L10n::t('Yes')]],
]); ]);
$blocktags = replace_macros($opt_tpl, [ $blocktags = replace_macros($opt_tpl, [
'$field' => ['blocktags', t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), '', [t('No'), t('Yes')]], '$field' => ['blocktags', L10n::t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), '', [L10n::t('No'), L10n::t('Yes')]],
]); ]);
$suggestme = replace_macros($opt_tpl, [ $suggestme = replace_macros($opt_tpl, [
'$field' => ['suggestme', t('Allow us to suggest you as a potential friend to new members?'), $suggestme, '', [t('No'), t('Yes')]], '$field' => ['suggestme', L10n::t('Allow us to suggest you as a potential friend to new members?'), $suggestme, '', [L10n::t('No'), L10n::t('Yes')]],
]); ]);
$unkmail = replace_macros($opt_tpl, [ $unkmail = replace_macros($opt_tpl, [
'$field' => ['unkmail', t('Permit unknown people to send you private mail?'), $unkmail, '', [t('No'), t('Yes')]], '$field' => ['unkmail', L10n::t('Permit unknown people to send you private mail?'), $unkmail, '', [L10n::t('No'), L10n::t('Yes')]],
]); ]);
if (!$profile['publish'] && !$profile['net-publish']) { if (!$profile['publish'] && !$profile['net-publish']) {
info(t('Profile is <strong>not published</strong>.') . EOL); info(L10n::t('Profile is <strong>not published</strong>.') . EOL);
} }
$tpl_addr = get_markup_template('settings/nick_set.tpl'); $tpl_addr = get_markup_template('settings/nick_set.tpl');
$prof_addr = replace_macros($tpl_addr,[ $prof_addr = replace_macros($tpl_addr,[
'$desc' => t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . $a->get_hostname() . $a->get_path(), System::baseUrl() . '/profile/' . $nickname), '$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . $a->get_hostname() . $a->get_path(), System::baseUrl() . '/profile/' . $nickname),
'$basepath' => $a->get_hostname() '$basepath' => $a->get_hostname()
]); ]);
$stpl = get_markup_template('settings/settings.tpl'); $stpl = get_markup_template('settings/settings.tpl');
$expire_arr = [ $expire_arr = [
'days' => ['expire', t("Automatically expire posts after this many days:"), $expire, t('If empty, posts will not expire. Expired posts will be deleted')], 'days' => ['expire', L10n::t("Automatically expire posts after this many days:"), $expire, L10n::t('If empty, posts will not expire. Expired posts will be deleted')],
'advanced' => t('Advanced expiration settings'), 'advanced' => L10n::t('Advanced expiration settings'),
'label' => t('Advanced Expiration'), 'label' => L10n::t('Advanced Expiration'),
'items' => ['expire_items', t("Expire posts:"), $expire_items, '', [t('No'), t('Yes')]], 'items' => ['expire_items', L10n::t("Expire posts:"), $expire_items, '', [L10n::t('No'), L10n::t('Yes')]],
'notes' => ['expire_notes', t("Expire personal notes:"), $expire_notes, '', [t('No'), t('Yes')]], 'notes' => ['expire_notes', L10n::t("Expire personal notes:"), $expire_notes, '', [L10n::t('No'), L10n::t('Yes')]],
'starred' => ['expire_starred', t("Expire starred posts:"), $expire_starred, '', [t('No'), t('Yes')]], 'starred' => ['expire_starred', L10n::t("Expire starred posts:"), $expire_starred, '', [L10n::t('No'), L10n::t('Yes')]],
'photos' => ['expire_photos', t("Expire photos:"), $expire_photos, '', [t('No'), t('Yes')]], 'photos' => ['expire_photos', L10n::t("Expire photos:"), $expire_photos, '', [L10n::t('No'), L10n::t('Yes')]],
'network_only' => ['expire_network_only', t("Only expire posts by others:"), $expire_network_only, '', [t('No'), t('Yes')]], 'network_only' => ['expire_network_only', L10n::t("Only expire posts by others:"), $expire_network_only, '', [L10n::t('No'), L10n::t('Yes')]],
]; ];
$group_select = Group::displayGroupSelection(local_user(), $a->user['def_gid']); $group_select = Group::displayGroupSelection(local_user(), $a->user['def_gid']);
@ -1186,55 +1187,55 @@ function settings_content(App $a)
} }
/* Installed langs */ /* Installed langs */
$lang_choices = get_available_languages(); $lang_choices = L10n::getAvailableLanguages();
/// @TODO Fix indending (or so) /// @TODO Fix indending (or so)
$o .= replace_macros($stpl, [ $o .= replace_macros($stpl, [
'$ptitle' => t('Account Settings'), '$ptitle' => L10n::t('Account Settings'),
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$uid' => local_user(), '$uid' => local_user(),
'$form_security_token' => get_form_security_token("settings"), '$form_security_token' => get_form_security_token("settings"),
'$nickname_block' => $prof_addr, '$nickname_block' => $prof_addr,
'$h_pass' => t('Password Settings'), '$h_pass' => L10n::t('Password Settings'),
'$password1'=> ['password', t('New Password:'), '', ''], '$password1'=> ['password', L10n::t('New Password:'), '', ''],
'$password2'=> ['confirm', t('Confirm:'), '', t('Leave password fields blank unless changing')], '$password2'=> ['confirm', L10n::t('Confirm:'), '', L10n::t('Leave password fields blank unless changing')],
'$password3'=> ['opassword', t('Current Password:'), '', t('Your current password to confirm the changes')], '$password3'=> ['opassword', L10n::t('Current Password:'), '', L10n::t('Your current password to confirm the changes')],
'$password4'=> ['mpassword', t('Password:'), '', t('Your current password to confirm the changes')], '$password4'=> ['mpassword', L10n::t('Password:'), '', L10n::t('Your current password to confirm the changes')],
'$oid_enable' => (!Config::get('system', 'no_openid')), '$oid_enable' => (!Config::get('system', 'no_openid')),
'$openid' => $openid_field, '$openid' => $openid_field,
'$h_basic' => t('Basic Settings'), '$h_basic' => L10n::t('Basic Settings'),
'$username' => ['username', t('Full Name:'), $username, ''], '$username' => ['username', L10n::t('Full Name:'), $username, ''],
'$email' => ['email', t('Email Address:'), $email, '', '', '', 'email'], '$email' => ['email', L10n::t('Email Address:'), $email, '', '', '', 'email'],
'$timezone' => ['timezone_select' , t('Your Timezone:'), select_timezone($timezone), ''], '$timezone' => ['timezone_select' , L10n::t('Your Timezone:'), select_timezone($timezone), ''],
'$language' => ['language', t('Your Language:'), $language, t('Set the language we use to show you friendica interface and to send you emails'), $lang_choices], '$language' => ['language', L10n::t('Your Language:'), $language, L10n::t('Set the language we use to show you friendica interface and to send you emails'), $lang_choices],
'$defloc' => ['defloc', t('Default Post Location:'), $defloc, ''], '$defloc' => ['defloc', L10n::t('Default Post Location:'), $defloc, ''],
'$allowloc' => ['allow_location', t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''], '$allowloc' => ['allow_location', L10n::t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''],
'$h_prv' => t('Security and Privacy Settings'), '$h_prv' => L10n::t('Security and Privacy Settings'),
'$maxreq' => ['maxreq', t('Maximum Friend Requests/Day:'), $maxreq , t("\x28to prevent spam abuse\x29")], '$maxreq' => ['maxreq', L10n::t('Maximum Friend Requests/Day:'), $maxreq , L10n::t("\x28to prevent spam abuse\x29")],
'$permissions' => t('Default Post Permissions'), '$permissions' => L10n::t('Default Post Permissions'),
'$permdesc' => t("\x28click to open/close\x29"), '$permdesc' => L10n::t("\x28click to open/close\x29"),
'$visibility' => $profile['net-publish'], '$visibility' => $profile['net-publish'],
'$aclselect' => populate_acl($a->user), '$aclselect' => populate_acl($a->user),
'$suggestme' => $suggestme, '$suggestme' => $suggestme,
'$blockwall'=> $blockwall, // array('blockwall', t('Allow friends to post to your profile page:'), !$blockwall, ''), '$blockwall'=> $blockwall, // array('blockwall', L10n::t('Allow friends to post to your profile page:'), !$blockwall, ''),
'$blocktags'=> $blocktags, // array('blocktags', t('Allow friends to tag your posts:'), !$blocktags, ''), '$blocktags'=> $blocktags, // array('blocktags', L10n::t('Allow friends to tag your posts:'), !$blocktags, ''),
// ACL permissions box // ACL permissions box
'$group_perms' => t('Show to Groups'), '$group_perms' => L10n::t('Show to Groups'),
'$contact_perms' => t('Show to Contacts'), '$contact_perms' => L10n::t('Show to Contacts'),
'$private' => t('Default Private Post'), '$private' => L10n::t('Default Private Post'),
'$public' => t('Default Public Post'), '$public' => L10n::t('Default Public Post'),
'$is_private' => $private_post, '$is_private' => $private_post,
'$return_path' => $query_str, '$return_path' => $query_str,
'$public_link' => $public_post_link, '$public_link' => $public_post_link,
'$settings_perms' => t('Default Permissions for New Posts'), '$settings_perms' => L10n::t('Default Permissions for New Posts'),
'$group_select' => $group_select, '$group_select' => $group_select,
@ -1246,41 +1247,41 @@ function settings_content(App $a)
'$hide_friends' => $hide_friends, '$hide_friends' => $hide_friends,
'$hide_wall' => $hide_wall, '$hide_wall' => $hide_wall,
'$unkmail' => $unkmail, '$unkmail' => $unkmail,
'$cntunkmail' => ['cntunkmail', t('Maximum private messages per day from unknown people:'), $cntunkmail , t("\x28to prevent spam abuse\x29")], '$cntunkmail' => ['cntunkmail', L10n::t('Maximum private messages per day from unknown people:'), $cntunkmail , L10n::t("\x28to prevent spam abuse\x29")],
'$h_not' => t('Notification Settings'), '$h_not' => L10n::t('Notification Settings'),
'$activity_options' => t('By default post a status message when:'), '$activity_options' => L10n::t('By default post a status message when:'),
'$post_newfriend' => ['post_newfriend', t('accepting a friend request'), $post_newfriend, ''], '$post_newfriend' => ['post_newfriend', L10n::t('accepting a friend request'), $post_newfriend, ''],
'$post_joingroup' => ['post_joingroup', t('joining a forum/community'), $post_joingroup, ''], '$post_joingroup' => ['post_joingroup', L10n::t('joining a forum/community'), $post_joingroup, ''],
'$post_profilechange' => ['post_profilechange', t('making an <em>interesting</em> profile change'), $post_profilechange, ''], '$post_profilechange' => ['post_profilechange', L10n::t('making an <em>interesting</em> profile change'), $post_profilechange, ''],
'$lbl_not' => t('Send a notification email when:'), '$lbl_not' => L10n::t('Send a notification email when:'),
'$notify1' => ['notify1', t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''], '$notify1' => ['notify1', L10n::t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''],
'$notify2' => ['notify2', t('Your introductions are confirmed'), ($notify & NOTIFY_CONFIRM), NOTIFY_CONFIRM, ''], '$notify2' => ['notify2', L10n::t('Your introductions are confirmed'), ($notify & NOTIFY_CONFIRM), NOTIFY_CONFIRM, ''],
'$notify3' => ['notify3', t('Someone writes on your profile wall'), ($notify & NOTIFY_WALL), NOTIFY_WALL, ''], '$notify3' => ['notify3', L10n::t('Someone writes on your profile wall'), ($notify & NOTIFY_WALL), NOTIFY_WALL, ''],
'$notify4' => ['notify4', t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''], '$notify4' => ['notify4', L10n::t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''],
'$notify5' => ['notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''], '$notify5' => ['notify5', L10n::t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''],
'$notify6' => ['notify6', t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''], '$notify6' => ['notify6', L10n::t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''],
'$notify7' => ['notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''], '$notify7' => ['notify7', L10n::t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''],
'$notify8' => ['notify8', t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''], '$notify8' => ['notify8', L10n::t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''],
'$desktop_notifications' => ['desktop_notifications', t('Activate desktop notifications') , false, t('Show desktop popup on new notifications')], '$desktop_notifications' => ['desktop_notifications', L10n::t('Activate desktop notifications') , false, L10n::t('Show desktop popup on new notifications')],
'$email_textonly' => ['email_textonly', t('Text-only notification emails'), '$email_textonly' => ['email_textonly', L10n::t('Text-only notification emails'),
PConfig::get(local_user(), 'system', 'email_textonly'), PConfig::get(local_user(), 'system', 'email_textonly'),
t('Send text only notification emails, without the html part')], L10n::t('Send text only notification emails, without the html part')],
'$detailed_notif' => ['detailed_notif', t('Show detailled notifications'), '$detailed_notif' => ['detailed_notif', L10n::t('Show detailled notifications'),
PConfig::get(local_user(), 'system', 'detailed_notif'), PConfig::get(local_user(), 'system', 'detailed_notif'),
t('Per default the notificiation are condensed to a single notification per item. When enabled, every notification is displayed.')], L10n::t('Per default the notificiation are condensed to a single notification per item. When enabled, every notification is displayed.')],
'$h_advn' => t('Advanced Account/Page Type Settings'), '$h_advn' => L10n::t('Advanced Account/Page Type Settings'),
'$h_descadvn' => t('Change the behaviour of this account for special situations'), '$h_descadvn' => L10n::t('Change the behaviour of this account for special situations'),
'$pagetype' => $pagetype, '$pagetype' => $pagetype,
'$relocate' => t('Relocate'), '$relocate' => L10n::t('Relocate'),
'$relocate_text' => t("If you have moved this profile from another server, and some of your contacts don't receive your updates, try pushing this button."), '$relocate_text' => L10n::t("If you have moved this profile from another server, and some of your contacts don't receive your updates, try pushing this button."),
'$relocate_button' => t("Resend relocate message to contacts"), '$relocate_button' => L10n::t("Resend relocate message to contacts"),
]); ]);

View file

@ -1,13 +1,16 @@
<?php <?php
/**
* @file mod/subthread.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
require_once('include/security.php'); require_once 'include/security.php';
require_once('include/bbcode.php'); require_once 'include/bbcode.php';
require_once('include/items.php'); require_once 'include/items.php';
function subthread_content(App $a) { function subthread_content(App $a) {
@ -89,7 +92,7 @@ function subthread_content(App $a) {
$uri = item_new_uri($a->get_hostname(),$owner_uid); $uri = item_new_uri($a->get_hostname(),$owner_uid);
$post_type = (($item['resource-id']) ? t('photo') : t('status')); $post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status'));
$objtype = (($item['resource-id']) ? ACTIVITY_OBJ_IMAGE : ACTIVITY_OBJ_NOTE ); $objtype = (($item['resource-id']) ? ACTIVITY_OBJ_IMAGE : ACTIVITY_OBJ_NOTE );
$link = xmlify('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ; $link = xmlify('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
$body = $item['body']; $body = $item['body'];
@ -105,7 +108,7 @@ function subthread_content(App $a) {
<content>$body</content> <content>$body</content>
</object> </object>
EOT; EOT;
$bodyverb = t('%1$s is following %2$s\'s %3$s'); $bodyverb = L10n::t('%1$s is following %2$s\'s %3$s');
if (! isset($bodyverb)) { if (! isset($bodyverb)) {
return; return;

View file

@ -5,6 +5,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\ContactSelector; use Friendica\Content\ContactSelector;
use Friendica\Content\Widget; use Friendica\Content\Widget;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -32,12 +33,12 @@ function suggest_init(App $a) {
$a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [ $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [
'$method' => 'get', '$method' => 'get',
'$message' => t('Do you really want to delete this suggestion?'), '$message' => L10n::t('Do you really want to delete this suggestion?'),
'$extra_inputs' => $inputs, '$extra_inputs' => $inputs,
'$confirm' => t('Yes'), '$confirm' => L10n::t('Yes'),
'$confirm_url' => $query['base'], '$confirm_url' => $query['base'],
'$confirm_name' => 'confirmed', '$confirm_name' => 'confirmed',
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
]); ]);
$a->error = 1; // Set $a->error so the other module functions don't execute $a->error = 1; // Set $a->error so the other module functions don't execute
return; return;
@ -56,7 +57,7 @@ function suggest_content(App $a) {
$o = ''; $o = '';
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
@ -69,7 +70,7 @@ function suggest_content(App $a) {
$r = GContact::suggestionQuery(local_user()); $r = GContact::suggestionQuery(local_user());
if (! DBM::is_result($r)) { if (! DBM::is_result($r)) {
$o .= t('No suggestions available. If this is a new site, please try again in 24 hours.'); $o .= L10n::t('No suggestions available. If this is a new site, please try again in 24 hours.');
return $o; return $o;
} }
@ -78,9 +79,9 @@ function suggest_content(App $a) {
$connlnk = System::baseUrl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']); $connlnk = System::baseUrl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']);
$ignlnk = System::baseUrl() . '/suggest?ignore=' . $rr['id']; $ignlnk = System::baseUrl() . '/suggest?ignore=' . $rr['id'];
$photo_menu = [ $photo_menu = [
'profile' => [t("View Profile"), Profile::zrl($rr["url"])], 'profile' => [L10n::t("View Profile"), Profile::zrl($rr["url"])],
'follow' => [t("Connect/Follow"), $connlnk], 'follow' => [L10n::t("Connect/Follow"), $connlnk],
'hide' => [t('Ignore/Hide'), $ignlnk] 'hide' => [L10n::t('Ignore/Hide'), $ignlnk]
]; ];
$contact_details = Contact::getDetailsByURL($rr["url"], local_user(), $rr); $contact_details = Contact::getDetailsByURL($rr["url"], local_user(), $rr);
@ -97,10 +98,10 @@ function suggest_content(App $a) {
'account_type' => Contact::getAccountType($contact_details), 'account_type' => Contact::getAccountType($contact_details),
'ignlnk' => $ignlnk, 'ignlnk' => $ignlnk,
'ignid' => $rr['id'], 'ignid' => $rr['id'],
'conntxt' => t('Connect'), 'conntxt' => L10n::t('Connect'),
'connlnk' => $connlnk, 'connlnk' => $connlnk,
'photo_menu' => $photo_menu, 'photo_menu' => $photo_menu,
'ignore' => t('Ignore/Hide'), 'ignore' => L10n::t('Ignore/Hide'),
'network' => ContactSelector::networkToName($rr['network'], $rr['url']), 'network' => ContactSelector::networkToName($rr['network'], $rr['url']),
'id' => ++$id, 'id' => ++$id,
]; ];
@ -110,7 +111,7 @@ function suggest_content(App $a) {
$tpl = get_markup_template('viewcontact_template.tpl'); $tpl = get_markup_template('viewcontact_template.tpl');
$o .= replace_macros($tpl,[ $o .= replace_macros($tpl,[
'$title' => t('Friend Suggestions'), '$title' => L10n::t('Friend Suggestions'),
'$contacts' => $entries, '$contacts' => $entries,
]); ]);

View file

@ -1,14 +1,17 @@
<?php <?php
/**
* @file mod/tagger.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
require_once('include/security.php'); require_once 'include/security.php';
require_once('include/bbcode.php'); require_once 'include/bbcode.php';
require_once('include/items.php'); require_once 'include/items.php';
function tagger_content(App $a) { function tagger_content(App $a) {
@ -64,7 +67,7 @@ function tagger_content(App $a) {
$uri = item_new_uri($a->get_hostname(),$owner_uid); $uri = item_new_uri($a->get_hostname(),$owner_uid);
$xterm = xmlify($term); $xterm = xmlify($term);
$post_type = (($item['resource-id']) ? t('photo') : t('status')); $post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status'));
$targettype = (($item['resource-id']) ? ACTIVITY_OBJ_IMAGE : ACTIVITY_OBJ_NOTE ); $targettype = (($item['resource-id']) ? ACTIVITY_OBJ_IMAGE : ACTIVITY_OBJ_NOTE );
$link = xmlify('<link rel="alternate" type="text/html" href="' $link = xmlify('<link rel="alternate" type="text/html" href="'
@ -97,7 +100,7 @@ EOT;
</object> </object>
EOT; EOT;
$bodyverb = t('%1$s tagged %2$s\'s %3$s with %4$s'); $bodyverb = L10n::t('%1$s tagged %2$s\'s %3$s with %4$s');
if (! isset($bodyverb)) { if (! isset($bodyverb)) {
return; return;

View file

@ -1,10 +1,13 @@
<?php <?php
/**
* @file mod/tagrm.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
require_once('include/bbcode.php'); require_once 'include/bbcode.php';
function tagrm_post(App $a) { function tagrm_post(App $a) {
@ -12,7 +15,7 @@ function tagrm_post(App $a) {
goaway(System::baseUrl() . '/' . $_SESSION['photo_return']); goaway(System::baseUrl() . '/' . $_SESSION['photo_return']);
} }
if ((x($_POST,'submit')) && ($_POST['submit'] === t('Cancel'))) { if ((x($_POST,'submit')) && ($_POST['submit'] === L10n::t('Cancel'))) {
goaway(System::baseUrl() . '/' . $_SESSION['photo_return']); goaway(System::baseUrl() . '/' . $_SESSION['photo_return']);
} }
@ -44,7 +47,7 @@ function tagrm_post(App $a) {
intval(local_user()) intval(local_user())
); );
info( t('Tag removed') . EOL ); info(L10n::t('Tag removed') . EOL );
goaway(System::baseUrl() . '/' . $_SESSION['photo_return']); goaway(System::baseUrl() . '/' . $_SESSION['photo_return']);
// NOTREACHED // NOTREACHED
@ -83,9 +86,9 @@ function tagrm_content(App $a) {
goaway(System::baseUrl() . '/' . $_SESSION['photo_return']); goaway(System::baseUrl() . '/' . $_SESSION['photo_return']);
} }
$o .= '<h3>' . t('Remove Item Tag') . '</h3>'; $o .= '<h3>' . L10n::t('Remove Item Tag') . '</h3>';
$o .= '<p id="tag-remove-desc">' . t('Select a tag to remove: ') . '</p>'; $o .= '<p id="tag-remove-desc">' . L10n::t('Select a tag to remove: ') . '</p>';
$o .= '<form id="tagrm" action="tagrm" method="post" >'; $o .= '<form id="tagrm" action="tagrm" method="post" >';
$o .= '<input type="hidden" name="item" value="' . $item . '" />'; $o .= '<input type="hidden" name="item" value="' . $item . '" />';
@ -96,8 +99,8 @@ function tagrm_content(App $a) {
} }
$o .= '</ul>'; $o .= '</ul>';
$o .= '<input id="tagrm-submit" type="submit" name="submit" value="' . t('Remove') .'" />'; $o .= '<input id="tagrm-submit" type="submit" name="submit" value="' . L10n::t('Remove') .'" />';
$o .= '<input id="tagrm-cancel" type="submit" name="submit" value="' . t('Cancel') .'" />'; $o .= '<input id="tagrm-cancel" type="submit" name="submit" value="' . L10n::t('Cancel') .'" />';
$o .= '</form>'; $o .= '</form>';
return $o; return $o;

View file

@ -1,7 +1,10 @@
<?php <?php
/**
* @file mod/uexport.php
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -38,15 +41,15 @@ function uexport_content(App $a) {
* list of array( 'link url', 'link text', 'help text' ) * list of array( 'link url', 'link text', 'help text' )
*/ */
$options = [ $options = [
['uexport/account', t('Export account'), t('Export your account info and contacts. Use this to make a backup of your account and/or to move it to another server.')], ['uexport/account', L10n::t('Export account'), L10n::t('Export your account info and contacts. Use this to make a backup of your account and/or to move it to another server.')],
['uexport/backup', t('Export all'), t('Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account (photos are not exported)')], ['uexport/backup', L10n::t('Export all'), L10n::t('Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account (photos are not exported)')],
]; ];
Addon::callHooks('uexport_options', $options); Addon::callHooks('uexport_options', $options);
$tpl = get_markup_template("uexport.tpl"); $tpl = get_markup_template("uexport.tpl");
return replace_macros($tpl, [ return replace_macros($tpl, [
'$baseurl' => System::baseUrl(), '$baseurl' => System::baseUrl(),
'$title' => t('Export personal data'), '$title' => L10n::t('Export personal data'),
'$options' => $options '$options' => $options
]); ]);
} }

View file

@ -6,9 +6,11 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\UserImport; use Friendica\Core\UserImport;
function uimport_post(App $a) { function uimport_post(App $a)
{
switch ($a->config['register_policy']) { switch ($a->config['register_policy']) {
case REGISTER_OPEN: case REGISTER_OPEN:
$blocked = 0; $blocked = 0;
@ -23,7 +25,7 @@ function uimport_post(App $a) {
default: default:
case REGISTER_CLOSED: case REGISTER_CLOSED:
if ((!x($_SESSION, 'authenticated') && (!x($_SESSION, 'administrator')))) { if ((!x($_SESSION, 'authenticated') && (!x($_SESSION, 'administrator')))) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return; return;
} }
$blocked = 1; $blocked = 1;
@ -50,7 +52,7 @@ function uimport_content(App $a) {
$r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day"); $r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day");
if ($r && $r[0]['total'] >= $max_dailies) { if ($r && $r[0]['total'] >= $max_dailies) {
logger('max daily registrations exceeded.'); logger('max daily registrations exceeded.');
notice(t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL); notice(L10n::t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);
return; return;
} }
} }
@ -65,13 +67,13 @@ function uimport_content(App $a) {
$tpl = get_markup_template("uimport.tpl"); $tpl = get_markup_template("uimport.tpl");
return replace_macros($tpl, [ return replace_macros($tpl, [
'$regbutt' => t('Import'), '$regbutt' => L10n::t('Import'),
'$import' => [ '$import' => [
'title' => t("Move account"), 'title' => L10n::t("Move account"),
'intro' => t("You can import an account from another Friendica server."), 'intro' => L10n::t("You can import an account from another Friendica server."),
'instruct' => t("You need to export your account from the old server and upload it here. We will recreate your old account here with all your contacts. We will try also to inform your friends that you moved here."), 'instruct' => L10n::t("You need to export your account from the old server and upload it here. We will recreate your old account here with all your contacts. We will try also to inform your friends that you moved here."),
'warn' => t("This feature is experimental. We can't import contacts from the OStatus network (GNU Social/Statusnet) or from Diaspora"), 'warn' => L10n::t("This feature is experimental. We can't import contacts from the OStatus network (GNU Social/Statusnet) or from Diaspora"),
'field' => ['accountfile', t('Account file'), '<input id="id_accountfile" name="accountfile" type="file">', t('To export your account, go to "Settings->Export your personal data" and select "Export account"')], 'field' => ['accountfile', L10n::t('Account file'), '<input id="id_accountfile" name="accountfile" type="file">', L10n::t('To export your account, go to "Settings->Export your personal data" and select "Export account"')],
], ],
]); ]);
} }

View file

@ -3,6 +3,7 @@
* @file mod/unfollow.php * @file mod/unfollow.php
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -11,7 +12,7 @@ use Friendica\Model\Profile;
function unfollow_post(App $a) function unfollow_post(App $a)
{ {
if (!local_user()) { if (!local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
goaway($_SESSION['return_url']); goaway($_SESSION['return_url']);
// NOTREACHED // NOTREACHED
} }
@ -30,30 +31,30 @@ function unfollow_post(App $a)
$contact = dba::selectFirst('contact', [], $condition); $contact = dba::selectFirst('contact', [], $condition);
if (!DBM::is_result($contact)) { if (!DBM::is_result($contact)) {
notice(t("Contact wasn't found or can't be unfollowed.")); notice(L10n::t("Contact wasn't found or can't be unfollowed."));
} else { } else {
if (in_array($contact['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA])) { if (in_array($contact['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA])) {
$r = q("SELECT `contact`.*, `user`.* FROM `contact` INNER JOIN `user` ON `contact`.`uid` = `user`.`uid` $r = q("SELECT `contact`.*, `user`.* FROM `contact` INNER JOIN `user` ON `contact`.`uid` = `user`.`uid`
WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1", WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1",
intval($uid) intval($uid)
); );
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
Contact::terminateFriendship($r[0], $contact); Contact::terminateFriendship($r[0], $contact);
} }
} }
dba::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]); dba::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
info(t('Contact unfollowed').EOL); info(L10n::t('Contact unfollowed').EOL);
goaway(System::baseUrl().'/contacts/'.$contact['id']); goaway(System::baseUrl().'/contacts/'.$contact['id']);
} }
goaway($return_url); goaway($return_url);
// NOTREACHED // NOTREACHED
} }
function unfollow_content(App $a) { function unfollow_content(App $a)
{
if (! local_user()) { if (! local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
goaway($_SESSION['return_url']); goaway($_SESSION['return_url']);
// NOTREACHED // NOTREACHED
} }
@ -61,7 +62,7 @@ function unfollow_content(App $a) {
$uid = local_user(); $uid = local_user();
$url = notags(trim($_REQUEST['url'])); $url = notags(trim($_REQUEST['url']));
$submit = t('Submit Request'); $submit = L10n::t('Submit Request');
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?", $condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
local_user(), CONTACT_IS_FRIEND, normalise_link($url), local_user(), CONTACT_IS_FRIEND, normalise_link($url),
@ -69,13 +70,13 @@ function unfollow_content(App $a) {
$contact = dba::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition); $contact = dba::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
if (!DBM::is_result($contact)) { if (!DBM::is_result($contact)) {
notice(t("You aren't a friend of this contact.").EOL); notice(L10n::t("You aren't a friend of this contact.").EOL);
$submit = ""; $submit = "";
// NOTREACHED // NOTREACHED
} }
if (!in_array($contact['network'], [NETWORK_DIASPORA, NETWORK_OSTATUS])) { if (!in_array($contact['network'], [NETWORK_DIASPORA, NETWORK_OSTATUS])) {
notice(t("Unfollowing is currently not supported by your network.").EOL); notice(L10n::t("Unfollowing is currently not supported by your network.").EOL);
$submit = ""; $submit = "";
// NOTREACHED // NOTREACHED
} }
@ -86,7 +87,7 @@ function unfollow_content(App $a) {
$r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", intval($uid)); $r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", intval($uid));
if (!$r) { if (!$r) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
goaway($_SESSION['return_url']); goaway($_SESSION['return_url']);
// NOTREACHED // NOTREACHED
} }
@ -96,9 +97,9 @@ function unfollow_content(App $a) {
// Makes the connection request for friendica contacts easier // Makes the connection request for friendica contacts easier
$_SESSION["fastlane"] = $contact["url"]; $_SESSION["fastlane"] = $contact["url"];
$header = t("Disconnect/Unfollow"); $header = L10n::t("Disconnect/Unfollow");
$o = replace_macros($tpl,[ $o = replace_macros($tpl, [
'$header' => htmlentities($header), '$header' => htmlentities($header),
'$desc' => "", '$desc' => "",
'$pls_answer' => "", '$pls_answer' => "",
@ -109,16 +110,16 @@ function unfollow_content(App $a) {
'$statusnet' => "", '$statusnet' => "",
'$diaspora' => "", '$diaspora' => "",
'$diasnote' => "", '$diasnote' => "",
'$your_address' => t('Your Identity Address:'), '$your_address' => L10n::t('Your Identity Address:'),
'$invite_desc' => "", '$invite_desc' => "",
'$emailnet' => "", '$emailnet' => "",
'$submit' => $submit, '$submit' => $submit,
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
'$nickname' => "", '$nickname' => "",
'$name' => $contact["name"], '$name' => $contact["name"],
'$url' => $contact["url"], '$url' => $contact["url"],
'$zrl' => Profile::zrl($contact["url"]), '$zrl' => Profile::zrl($contact["url"]),
'$url_label' => t("Profile URL"), '$url_label' => L10n::t("Profile URL"),
'$myaddr' => $myaddr, '$myaddr' => $myaddr,
'$request' => $request, '$request' => $request,
'$keywords' => "", '$keywords' => "",
@ -128,7 +129,7 @@ function unfollow_content(App $a) {
$a->page['aside'] = ""; $a->page['aside'] = "";
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"])); Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
$o .= replace_macros(get_markup_template('section_title.tpl'), ['$title' => t('Status Messages and Posts')]); $o .= replace_macros(get_markup_template('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]);
// Show last public posts // Show last public posts
$o .= Contact::getPostsFromUrl($contact["url"]); $o .= Contact::getPostsFromUrl($contact["url"]);

View file

@ -3,9 +3,10 @@
// See update_profile.php for documentation // See update_profile.php for documentation
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
require_once("mod/community.php"); require_once 'mod/community.php';
function update_community_content(App $a) { function update_community_content(App $a) {
header("Content-type: text/html"); header("Content-type: text/html");
@ -23,7 +24,7 @@ function update_community_content(App $a) {
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);
if (PConfig::get(local_user(), "system", "bandwith_saver")) { if (PConfig::get(local_user(), "system", "bandwith_saver")) {
$replace = "<br />".t("[Embedded content - reload page to view]")."<br />"; $replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";

View file

@ -1,8 +1,11 @@
<?php <?php
/**
// See update_profile.php for documentation * @file mod/update_display.php
* See update_profile.php for documentation
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
require_once "mod/display.php"; require_once "mod/display.php";
@ -21,7 +24,7 @@ function update_display_content(App $a)
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);
if (PConfig::get(local_user(), "system", "bandwith_saver")) { if (PConfig::get(local_user(), "system", "bandwith_saver")) {
$replace = "<br />" . t("[Embedded content - reload page to view]") . "<br />"; $replace = "<br />" . L10n::t("[Embedded content - reload page to view]") . "<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";

View file

@ -1,8 +1,11 @@
<?php <?php
/**
// See update_profile.php for documentation * @file mod/update_network
* See update_profile.php for documentation
*/
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
require_once "mod/network.php"; require_once "mod/network.php";
@ -26,7 +29,7 @@ function update_network_content(App $a)
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);
if (PConfig::get(local_user(), "system", "bandwith_saver")) { if (PConfig::get(local_user(), "system", "bandwith_saver")) {
$replace = "<br />" . t("[Embedded content - reload page to view]") . "<br />"; $replace = "<br />" . L10n::t("[Embedded content - reload page to view]") . "<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";

View file

@ -6,6 +6,7 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
require_once("mod/notes.php"); require_once("mod/notes.php");
@ -36,7 +37,7 @@ function update_notes_content(App $a) {
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);
if (PConfig::get(local_user(), "system", "bandwith_saver")) { if (PConfig::get(local_user(), "system", "bandwith_saver")) {
$replace = "<br />".t("[Embedded content - reload page to view]")."<br />"; $replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";

View file

@ -6,9 +6,10 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
require_once("mod/profile.php"); require_once 'mod/profile.php';
function update_profile_content(App $a) { function update_profile_content(App $a) {
@ -35,7 +36,7 @@ function update_profile_content(App $a) {
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);
if (PConfig::get(local_user(), "system", "bandwith_saver")) { if (PConfig::get(local_user(), "system", "bandwith_saver")) {
$replace = "<br />".t("[Embedded content - reload page to view]")."<br />"; $replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";

View file

@ -5,6 +5,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -71,7 +72,7 @@ function videos_init(App $a) {
if($albums_visible) { if($albums_visible) {
$o .= '<div id="sidebar-photos-albums" class="widget">'; $o .= '<div id="sidebar-photos-albums" class="widget">';
$o .= '<h3>' . '<a href="' . System::baseUrl() . '/photos/' . $a->data['user']['nickname'] . '">' . t('Photo Albums') . '</a></h3>'; $o .= '<h3>' . '<a href="' . System::baseUrl() . '/photos/' . $a->data['user']['nickname'] . '">' . L10n::t('Photo Albums') . '</a></h3>';
$o .= '<ul>'; $o .= '<ul>';
foreach($albums as $album) { foreach($albums as $album) {
@ -79,14 +80,14 @@ function videos_init(App $a) {
// don't show contact photos. We once translated this name, but then you could still access it under // don't show contact photos. We once translated this name, but then you could still access it under
// a different language setting. Now we store the name in English and check in English (and translated for legacy albums). // a different language setting. Now we store the name in English and check in English (and translated for legacy albums).
if((! strlen($album['album'])) || ($album['album'] === 'Contact Photos') || ($album['album'] === t('Contact Photos'))) if((! strlen($album['album'])) || ($album['album'] === 'Contact Photos') || ($album['album'] === L10n::t('Contact Photos')))
continue; continue;
$o .= '<li>' . '<a href="photos/' . $a->argv[1] . '/album/' . bin2hex($album['album']) . '" >' . $album['album'] . '</a></li>'; $o .= '<li>' . '<a href="photos/' . $a->argv[1] . '/album/' . bin2hex($album['album']) . '" >' . $album['album'] . '</a></li>';
} }
$o .= '</ul>'; $o .= '</ul>';
} }
if(local_user() && $a->data['user']['uid'] == local_user()) { if(local_user() && $a->data['user']['uid'] == local_user()) {
$o .= '<div id="photo-albums-upload-link"><a href="' . System::baseUrl() . '/photos/' . $a->data['user']['nickname'] . '/upload" >' .t('Upload New Photos') . '</a></div>'; $o .= '<div id="photo-albums-upload-link"><a href="' . System::baseUrl() . '/photos/' . $a->data['user']['nickname'] . '/upload" >' .L10n::t('Upload New Photos') . '</a></div>';
} }
$o .= '</div>'; $o .= '</div>';
@ -133,15 +134,15 @@ function videos_post(App $a) {
$drop_url = $a->query_string; $drop_url = $a->query_string;
$a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [ $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [
'$method' => 'post', '$method' => 'post',
'$message' => t('Do you really want to delete this video?'), '$message' => L10n::t('Do you really want to delete this video?'),
'$extra_inputs' => [ '$extra_inputs' => [
['name'=>'id', 'value'=> $_POST['id']], ['name'=>'id', 'value'=> $_POST['id']],
['name'=>'delete', 'value'=>'x'] ['name'=>'delete', 'value'=>'x']
], ],
'$confirm' => t('Delete Video'), '$confirm' => L10n::t('Delete Video'),
'$confirm_url' => $drop_url, '$confirm_url' => $drop_url,
'$confirm_name' => 'confirm', // Needed so that confirmation will bring us back into this if statement '$confirm_name' => 'confirm', // Needed so that confirmation will bring us back into this if statement
'$cancel' => t('Cancel'), '$cancel' => L10n::t('Cancel'),
]); ]);
$a->error = 1; // Set $a->error so the other module functions don't execute $a->error = 1; // Set $a->error so the other module functions don't execute
@ -207,7 +208,7 @@ function videos_content(App $a) {
if((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) { if((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL); notice(L10n::t('Public access denied.') . EOL);
return; return;
} }
@ -217,7 +218,7 @@ function videos_content(App $a) {
require_once('include/conversation.php'); require_once('include/conversation.php');
if(! x($a->data,'user')) { if(! x($a->data,'user')) {
notice( t('No videos selected') . EOL ); notice(L10n::t('No videos selected') . EOL );
return; return;
} }
@ -319,7 +320,7 @@ function videos_content(App $a) {
} }
if($a->data['user']['hidewall'] && (local_user() != $owner_uid) && (! $remote_contact)) { if($a->data['user']['hidewall'] && (local_user() != $owner_uid) && (! $remote_contact)) {
notice( t('Access to this item is restricted.') . EOL); notice(L10n::t('Access to this item is restricted.') . EOL);
return; return;
} }
@ -390,14 +391,14 @@ function videos_content(App $a) {
$videos[] = [ $videos[] = [
'id' => $rr['id'], 'id' => $rr['id'],
'link' => System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/video/' . $rr['resource-id'], 'link' => System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/video/' . $rr['resource-id'],
'title' => t('View Video'), 'title' => L10n::t('View Video'),
'src' => System::baseUrl() . '/attach/' . $rr['id'] . '?attachment=0', 'src' => System::baseUrl() . '/attach/' . $rr['id'] . '?attachment=0',
'alt' => $alt_e, 'alt' => $alt_e,
'mime' => $rr['filetype'], 'mime' => $rr['filetype'],
'album' => [ 'album' => [
'link' => System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']), 'link' => System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']),
'name' => $name_e, 'name' => $name_e,
'alt' => t('View Album'), 'alt' => L10n::t('View Album'),
], ],
]; ];
@ -406,9 +407,9 @@ function videos_content(App $a) {
$tpl = get_markup_template('videos_recent.tpl'); $tpl = get_markup_template('videos_recent.tpl');
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$title' => t('Recent Videos'), '$title' => L10n::t('Recent Videos'),
'$can_post' => $can_post, '$can_post' => $can_post,
'$upload' => [t('Upload New Videos'), System::baseUrl().'/videos/'.$a->data['user']['nickname'].'/upload'], '$upload' => [L10n::t('Upload New Videos'), System::baseUrl().'/videos/'.$a->data['user']['nickname'].'/upload'],
'$videos' => $videos, '$videos' => $videos,
'$delete_url' => (($can_post)?System::baseUrl().'/videos/'.$a->data['user']['nickname']:False) '$delete_url' => (($can_post)?System::baseUrl().'/videos/'.$a->data['user']['nickname']:False)
]); ]);

Some files were not shown because too many files have changed in this diff Show more